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

Commit f02d4b8f authored by Svet Ganov's avatar Svet Ganov Committed by Android Git Automerger
Browse files

am f5a6941d: am e31ffee0: am b6e35d1c: am 30707bb7: Use unique preference key.

* commit 'f5a6941d':
  Use unique preference key.
parents 96c5dba9 f5a6941d
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -301,7 +301,7 @@ public class PermissionApps {
        }

        public String getKey() {
            return Integer.toString(getUid());
            return mPackageName + getUid();
        }

        public String getLabel() {
@@ -357,7 +357,7 @@ public class PermissionApps {
            final int result = mLabel.compareTo(another.mLabel);
            if (result == 0) {
                // Unbadged before badged.
                return getUid() - another.getUid();
                return getKey().compareTo(another.getKey());
            }
            return result;
        }
+6 −6
Original line number Diff line number Diff line
@@ -22,8 +22,8 @@ import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.util.ArrayMap;
import android.util.ArraySet;
import android.util.SparseArray;

import com.android.packageinstaller.permission.model.PermissionApps.PermissionApp;
import com.android.packageinstaller.permission.utils.Utils;
@@ -158,22 +158,22 @@ public class PermissionStatusReceiver extends BroadcastReceiver {
    public boolean getAppsWithPermissionsCount(Context context, int[] counts) {
        ArraySet<String> launcherPkgs = Utils.getLauncherPackages(context);
        // Indexed by uid.
        SparseArray<Boolean> grantedApps = new SparseArray<>();
        SparseArray<Boolean> allApps = new SparseArray<>();
        ArrayMap<String, Boolean> grantedApps = new ArrayMap<>();
        ArrayMap<String, Boolean> allApps = new ArrayMap<>();
        for (String group : Utils.MODERN_PERMISSION_GROUPS) {
            PermissionApps permissionApps = new PermissionApps(context,
                    group, null);
            permissionApps.loadNowWithoutUi();
            for (PermissionApp app : permissionApps.getApps()) {
                int uid = app.getUid();
                String key = app.getKey();
                if (Utils.isSystem(app, launcherPkgs)) {
                    // We default to not showing system apps, so hide them from count.
                    continue;
                }
                if (app.areRuntimePermissionsGranted()) {
                    grantedApps.put(uid, true);
                    grantedApps.put(key, true);
                }
                allApps.put(uid, true);
                allApps.put(key, true);
            }
        }
        counts[0] = grantedApps.size();