summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Deepika Likhite <dlikhite@google.com> 2024-06-12 18:27:50 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2024-06-12 18:27:50 +0000
commitd437cac1efd0feaf237fee1a634ada1d10198de6 (patch)
tree1d8b8eb09dc04c6e9926e02b272e18ae4d28c829
parentefd686af335b918188167bdb185fc2aa7a40a9b5 (diff)
Revert "Unblock the registration of shortcut change callbacks"
This reverts commit efd686af335b918188167bdb185fc2aa7a40a9b5. Reason for revert: Reverting as part of the https://b.corp.google.com/issues/345035133#comment19 Change-Id: If950e48fa1392dcafdd49a36e3f3f0d3df973669
-rw-r--r--services/core/java/com/android/server/pm/ShortcutService.java17
1 files changed, 7 insertions, 10 deletions
diff --git a/services/core/java/com/android/server/pm/ShortcutService.java b/services/core/java/com/android/server/pm/ShortcutService.java
index ac16d6c1588a..9edf3b14bad7 100644
--- a/services/core/java/com/android/server/pm/ShortcutService.java
+++ b/services/core/java/com/android/server/pm/ShortcutService.java
@@ -320,10 +320,10 @@ public class ShortcutService extends IShortcutService.Stub {
private final Handler mHandler;
- @GuardedBy("itself")
+ @GuardedBy("mServiceLock")
private final ArrayList<ShortcutChangeListener> mListeners = new ArrayList<>(1);
- @GuardedBy("itself")
+ @GuardedBy("mServiceLock")
private final ArrayList<LauncherApps.ShortcutChangeCallback> mShortcutChangeCallbacks =
new ArrayList<>(1);
@@ -1847,9 +1847,7 @@ public class ShortcutService extends IShortcutService.Stub {
return;
}
- synchronized (mListeners) {
- copy = new ArrayList<>(mListeners);
- }
+ copy = new ArrayList<>(mListeners);
}
// Note onShortcutChanged() needs to be called with the system service permissions.
for (int i = copy.size() - 1; i >= 0; i--) {
@@ -1874,9 +1872,8 @@ public class ShortcutService extends IShortcutService.Stub {
if (!isUserUnlockedL(userId)) {
return;
}
- synchronized (mShortcutChangeCallbacks) {
- copy = new ArrayList<>(mShortcutChangeCallbacks);
- }
+
+ copy = new ArrayList<>(mShortcutChangeCallbacks);
}
for (int i = copy.size() - 1; i >= 0; i--) {
if (!CollectionUtils.isEmpty(changedList)) {
@@ -3428,7 +3425,7 @@ public class ShortcutService extends IShortcutService.Stub {
@Override
public void addListener(@NonNull ShortcutChangeListener listener) {
- synchronized (mListeners) {
+ synchronized (mServiceLock) {
mListeners.add(Objects.requireNonNull(listener));
}
}
@@ -3436,7 +3433,7 @@ public class ShortcutService extends IShortcutService.Stub {
@Override
public void addShortcutChangeCallback(
@NonNull LauncherApps.ShortcutChangeCallback callback) {
- synchronized (mShortcutChangeCallbacks) {
+ synchronized (mServiceLock) {
mShortcutChangeCallbacks.add(Objects.requireNonNull(callback));
}
}