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

Commit 981d9955 authored by Jackal Guo's avatar Jackal Guo
Browse files

Revert "Add MATCH_ANY_USER flag when get valid package uid"

Revert "Ensure getting UID/GID checks the installed state"

Revert submission 14700843-b186180067_main

Reason for revert: Break WM presubmit (b/189728752)
Reverted Changes:
I3d7c35dc2:Add the checking of the package installed state
I035eeca76:Ensure getting UID/GID checks the installed state
Iaac8e56f3:Use userId to query the package uid instead of 0.
I0c452d880:Add MATCH_ANY_USER flag when get valid package uid...

Change-Id: Icdecda29da253cb14ab8294c16dab3ad03d97256
parent dcea3c5d
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -444,10 +444,8 @@ public class AccessibilitySecurityPolicy {
    private boolean isValidPackageForUid(String packageName, int uid) {
        final long token = Binder.clearCallingIdentity();
        try {
            // Since we treat calls from a profile as if made by its parent, using
            // MATCH_ANY_USER to query the uid of the given package name.
            return uid == mPackageManager.getPackageUidAsUser(
                    packageName, PackageManager.MATCH_ANY_USER, UserHandle.getUserId(uid));
                    packageName, UserHandle.getUserId(uid));
        } catch (PackageManager.NameNotFoundException e) {
            return false;
        } finally {
+2 −2
Original line number Diff line number Diff line
@@ -261,8 +261,8 @@ public class AccessibilitySecurityPolicyTest {
    @Test
    public void resolveValidReportedPackage_uidAndPkgNameMatched_returnPkgName()
            throws PackageManager.NameNotFoundException {
        when(mMockPackageManager.getPackageUidAsUser(PACKAGE_NAME,
                PackageManager.MATCH_ANY_USER, TEST_USER_ID)).thenReturn(APP_UID);
        when(mMockPackageManager.getPackageUidAsUser(PACKAGE_NAME, TEST_USER_ID))
                .thenReturn(APP_UID);

        assertEquals(mA11ySecurityPolicy.resolveValidReportedPackageLocked(
                PACKAGE_NAME, APP_UID, TEST_USER_ID, APP_PID),