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

Commit 857326e3 authored by Tony Mak's avatar Tony Mak Committed by Joshua Koike
Browse files

clearCallingIdentity before calling into getPackageUidAsUser

Fix: 70585244
Bug: 69981755

Test: Enable any accessibility service -> inflate work profile
      -> Tap on any work app -> no longer crash

Test: cts-tradefed run cts-dev --module DevicePolicyManager --test com.android.cts.devicepolicy.CrossProfileAppsHostSideTest.testPrimaryUserToManagedProfile
Change-Id: I80d18f4e2ab76a228cb0aa2c8312c323a9b5c84d
parent 6c68a692
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -3426,11 +3426,14 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
        }

        private boolean isValidPackageForUid(String packageName, int uid) {
            final long token = Binder.clearCallingIdentity();
            try {
                return uid == mPackageManager.getPackageUid(
                        packageName, UserHandle.getUserId(uid));
            } catch (PackageManager.NameNotFoundException e) {
                return false;
            } finally {
                Binder.restoreCallingIdentity(token);
            }
        }