Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cc8e8c9a authored by Sudheer Shanka's avatar Sudheer Shanka Committed by Automerger Merge Worker
Browse files

Merge "[Bugfix] avoid deadlock caused by AppBatteryTracker.dump" into main am:...

Merge "[Bugfix] avoid deadlock caused by AppBatteryTracker.dump" into main am: 374f09eb am: d128efaf

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/3263912



Change-Id: Idd4e123d10a01826feb8e1d293a30c4957f7ae2a
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents b1075ab0 d128efaf
Loading
Loading
Loading
Loading
+15 −10
Original line number Diff line number Diff line
@@ -714,12 +714,14 @@ public class ActivityManagerService extends IActivityManager.Stub
    /**
     * Map userId to its companion app uids.
     */
    @GuardedBy("mCompanionAppUidsMap")
    private final Map<Integer, Set<Integer>> mCompanionAppUidsMap = new ArrayMap<>();
    /**
     * The profile owner UIDs.
     */
    private ArraySet<Integer> mProfileOwnerUids = null;
    @GuardedBy("mProfileOwnerUids")
    private final ArraySet<Integer> mProfileOwnerUids = new ArraySet<>();
    final UserController mUserController;
    @VisibleForTesting
@@ -17535,33 +17537,36 @@ public class ActivityManagerService extends IActivityManager.Stub
        @Override
        public void setProfileOwnerUid(ArraySet<Integer> profileOwnerUids) {
            synchronized (ActivityManagerService.this) {
                mProfileOwnerUids = profileOwnerUids;
            synchronized (mProfileOwnerUids) {
                mProfileOwnerUids.clear();
                mProfileOwnerUids.addAll(profileOwnerUids);
            }
        }
        @Override
        public boolean isProfileOwner(int uid) {
            synchronized (ActivityManagerService.this) {
                return mProfileOwnerUids != null && mProfileOwnerUids.indexOf(uid) >= 0;
            synchronized (mProfileOwnerUids) {
                return mProfileOwnerUids.indexOf(uid) >= 0;
            }
        }
        @Override
        public void setCompanionAppUids(int userId, Set<Integer> companionAppUids) {
            synchronized (ActivityManagerService.this) {
            synchronized (mCompanionAppUidsMap) {
                mCompanionAppUidsMap.put(userId, companionAppUids);
            }
        }
        @Override
        public boolean isAssociatedCompanionApp(int userId, int uid) {
            synchronized (mCompanionAppUidsMap) {
                final Set<Integer> allUids = mCompanionAppUidsMap.get(userId);
                if (allUids == null) {
                    return false;
                }
                return allUids.contains(uid);
            }
        }
        @Override
        public void addPendingTopUid(int uid, int pid, @Nullable IApplicationThread thread) {