Loading services/core/java/com/android/server/pm/ShortcutService.java +7 −4 Original line number Diff line number Diff line Loading @@ -270,6 +270,7 @@ public class ShortcutService extends IShortcutService.Stub { final Context mContext; private final Object mLock = new Object(); private final Object mNonPersistentUsersLock = new Object(); private static List<ResolveInfo> EMPTY_RESOLVE_INFO = new ArrayList<>(0); Loading Loading @@ -310,8 +311,10 @@ public class ShortcutService extends IShortcutService.Stub { /** * User ID -> ShortcutNonPersistentUser * * Note we use a fine-grained lock for {@link #mShortcutNonPersistentUsers} due to b/183618378. */ @GuardedBy("mLock") @GuardedBy("mNonPersistentUsersLock") private final SparseArray<ShortcutNonPersistentUser> mShortcutNonPersistentUsers = new SparseArray<>(); Loading Loading @@ -1308,7 +1311,7 @@ public class ShortcutService extends IShortcutService.Stub { } /** Return the non-persistent per-user state. */ @GuardedBy("mLock") @GuardedBy("mNonPersistentUsersLock") @NonNull ShortcutNonPersistentUser getNonPersistentUserLocked(@UserIdInt int userId) { ShortcutNonPersistentUser ret = mShortcutNonPersistentUsers.get(userId); Loading Loading @@ -2748,7 +2751,7 @@ public class ShortcutService extends IShortcutService.Stub { if (injectHasAccessShortcutsPermission(callingPid, callingUid)) { return true; } synchronized (mLock) { synchronized (mNonPersistentUsersLock) { return getNonPersistentUserLocked(userId).hasHostPackage(callingPackage); } } Loading Loading @@ -2831,7 +2834,7 @@ public class ShortcutService extends IShortcutService.Stub { public void setShortcutHostPackage(@NonNull String type, @Nullable String packageName, int userId) { synchronized (mLock) { synchronized (mNonPersistentUsersLock) { getNonPersistentUserLocked(userId).setShortcutHostPackage(type, packageName); } } Loading services/tests/servicestests/src/com/android/server/pm/BaseShortcutManagerTest.java +3 −1 Original line number Diff line number Diff line Loading @@ -55,6 +55,7 @@ import android.app.appsearch.IAppSearchManager; import android.app.appsearch.IAppSearchResultCallback; import android.app.appsearch.PackageIdentifier; import android.app.appsearch.SearchResultPage; import android.app.appsearch.SetSchemaResponse; import android.app.role.OnRoleHoldersChangedListener; import android.app.usage.UsageStatsManagerInternal; import android.content.ActivityNotFoundException; Loading Loading @@ -672,7 +673,8 @@ public abstract class BaseShortcutManagerTest extends InstrumentationTestCase { packageIdentifiers.add(new PackageIdentifier(entry.getValue().get(i))); } } callback.onResult(AppSearchResult.newSuccessfulResult(null)); final SetSchemaResponse response = new SetSchemaResponse.Builder().build(); callback.onResult(AppSearchResult.newSuccessfulResult(response.getBundle())); } @Override Loading Loading
services/core/java/com/android/server/pm/ShortcutService.java +7 −4 Original line number Diff line number Diff line Loading @@ -270,6 +270,7 @@ public class ShortcutService extends IShortcutService.Stub { final Context mContext; private final Object mLock = new Object(); private final Object mNonPersistentUsersLock = new Object(); private static List<ResolveInfo> EMPTY_RESOLVE_INFO = new ArrayList<>(0); Loading Loading @@ -310,8 +311,10 @@ public class ShortcutService extends IShortcutService.Stub { /** * User ID -> ShortcutNonPersistentUser * * Note we use a fine-grained lock for {@link #mShortcutNonPersistentUsers} due to b/183618378. */ @GuardedBy("mLock") @GuardedBy("mNonPersistentUsersLock") private final SparseArray<ShortcutNonPersistentUser> mShortcutNonPersistentUsers = new SparseArray<>(); Loading Loading @@ -1308,7 +1311,7 @@ public class ShortcutService extends IShortcutService.Stub { } /** Return the non-persistent per-user state. */ @GuardedBy("mLock") @GuardedBy("mNonPersistentUsersLock") @NonNull ShortcutNonPersistentUser getNonPersistentUserLocked(@UserIdInt int userId) { ShortcutNonPersistentUser ret = mShortcutNonPersistentUsers.get(userId); Loading Loading @@ -2748,7 +2751,7 @@ public class ShortcutService extends IShortcutService.Stub { if (injectHasAccessShortcutsPermission(callingPid, callingUid)) { return true; } synchronized (mLock) { synchronized (mNonPersistentUsersLock) { return getNonPersistentUserLocked(userId).hasHostPackage(callingPackage); } } Loading Loading @@ -2831,7 +2834,7 @@ public class ShortcutService extends IShortcutService.Stub { public void setShortcutHostPackage(@NonNull String type, @Nullable String packageName, int userId) { synchronized (mLock) { synchronized (mNonPersistentUsersLock) { getNonPersistentUserLocked(userId).setShortcutHostPackage(type, packageName); } } Loading
services/tests/servicestests/src/com/android/server/pm/BaseShortcutManagerTest.java +3 −1 Original line number Diff line number Diff line Loading @@ -55,6 +55,7 @@ import android.app.appsearch.IAppSearchManager; import android.app.appsearch.IAppSearchResultCallback; import android.app.appsearch.PackageIdentifier; import android.app.appsearch.SearchResultPage; import android.app.appsearch.SetSchemaResponse; import android.app.role.OnRoleHoldersChangedListener; import android.app.usage.UsageStatsManagerInternal; import android.content.ActivityNotFoundException; Loading Loading @@ -672,7 +673,8 @@ public abstract class BaseShortcutManagerTest extends InstrumentationTestCase { packageIdentifiers.add(new PackageIdentifier(entry.getValue().get(i))); } } callback.onResult(AppSearchResult.newSuccessfulResult(null)); final SetSchemaResponse response = new SetSchemaResponse.Builder().build(); callback.onResult(AppSearchResult.newSuccessfulResult(response.getBundle())); } @Override Loading