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

Commit 3da8264d authored by Julia Reynolds's avatar Julia Reynolds
Browse files

Check all apps for fixed permission status

Policy changes can be applied to all apps, not just system apps,
so remove the system apps filter.

Test: PreferencesHelperTest
Test: manual with testdpc
Fixes: 316825429
Change-Id: Ie097d2e903c8bb4fb18eb9a63fd18db7dd1db56b
parent 0e75605d
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -1387,8 +1387,7 @@ public class PreferencesHelper implements RankingConfig {
    public void updateFixedImportance(List<UserInfo> users) {
        for (UserInfo user : users) {
            List<PackageInfo> packages = mPm.getInstalledPackagesAsUser(
                    PackageManager.PackageInfoFlags.of(PackageManager.MATCH_SYSTEM_ONLY),
                    user.getUserHandle().getIdentifier());
                    0, user.getUserHandle().getIdentifier());
            for (PackageInfo pi : packages) {
                boolean fixed = mPermissionHelper.isPermissionFixed(
                        pi.packageName, user.getUserHandle().getIdentifier());
+5 −5
Original line number Diff line number Diff line
@@ -3981,7 +3981,7 @@ public class PreferencesHelperTest extends UiServiceTestCase {
        pm.applicationInfo = new ApplicationInfo();
        pm.applicationInfo.uid = UID_O;
        List<PackageInfo> packages = ImmutableList.of(pm);
        when(mPm.getInstalledPackagesAsUser(any(), anyInt())).thenReturn(packages);
        when(mPm.getInstalledPackagesAsUser(eq(0), anyInt())).thenReturn(packages);
        mHelper.updateFixedImportance(users);

        assertTrue(mHelper.isImportanceLocked(PKG_O, UID_O));
@@ -4097,7 +4097,7 @@ public class PreferencesHelperTest extends UiServiceTestCase {
        pm.applicationInfo = new ApplicationInfo();
        pm.applicationInfo.uid = UID_O;
        List<PackageInfo> packages = ImmutableList.of(pm);
        when(mPm.getInstalledPackagesAsUser(any(), eq(0))).thenReturn(packages);
        when(mPm.getInstalledPackagesAsUser(0, 0)).thenReturn(packages);
        mHelper.updateFixedImportance(users);

        assertTrue(mHelper.getNotificationChannel(PKG_O, UID_O, a.getId(), false)
@@ -4120,7 +4120,7 @@ public class PreferencesHelperTest extends UiServiceTestCase {
        pm.applicationInfo = new ApplicationInfo();
        pm.applicationInfo.uid = UID_O;
        List<PackageInfo> packages = ImmutableList.of(pm);
        when(mPm.getInstalledPackagesAsUser(any(), eq(0))).thenReturn(packages);
        when(mPm.getInstalledPackagesAsUser(0, 0)).thenReturn(packages);
        mHelper.updateFixedImportance(users);

        NotificationChannel a = new NotificationChannel("a", "a", IMPORTANCE_HIGH);
@@ -4309,7 +4309,7 @@ public class PreferencesHelperTest extends UiServiceTestCase {
        pm.applicationInfo = new ApplicationInfo();
        pm.applicationInfo.uid = UID_O;
        List<PackageInfo> packages = ImmutableList.of(pm);
        when(mPm.getInstalledPackagesAsUser(any(), eq(0))).thenReturn(packages);
        when(mPm.getInstalledPackagesAsUser(0, 0)).thenReturn(packages);
        mHelper.updateFixedImportance(users);

        ArraySet<String> toRemove = new ArraySet<>();
@@ -4341,7 +4341,7 @@ public class PreferencesHelperTest extends UiServiceTestCase {
        pm.applicationInfo = new ApplicationInfo();
        pm.applicationInfo.uid = UID_O;
        List<PackageInfo> packages = ImmutableList.of(pm);
        when(mPm.getInstalledPackagesAsUser(any(), eq(0))).thenReturn(packages);
        when(mPm.getInstalledPackagesAsUser(0, 0)).thenReturn(packages);
        mHelper.updateFixedImportance(users);

        assertTrue(mHelper.isImportanceLocked(PKG_O, UID_O));