Merge "Merge "Switch from deprecated -stubpackages to --stub-packages" into main am: eaceceda38 am: 5e81a24e1e" into main
diff --git a/services/core/java/com/android/server/pm/ShortcutService.java b/services/core/java/com/android/server/pm/ShortcutService.java
index 78d8002..1cd77ff 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 @@
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 @@
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 @@
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)) {
@@ -3432,7 +3429,7 @@
@Override
public void addListener(@NonNull ShortcutChangeListener listener) {
- synchronized (mListeners) {
+ synchronized (mServiceLock) {
mListeners.add(Objects.requireNonNull(listener));
}
}
@@ -3440,7 +3437,7 @@
@Override
public void addShortcutChangeCallback(
@NonNull LauncherApps.ShortcutChangeCallback callback) {
- synchronized (mShortcutChangeCallbacks) {
+ synchronized (mServiceLock) {
mShortcutChangeCallbacks.add(Objects.requireNonNull(callback));
}
}