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

Commit 27e759d7 authored by Kun Liang's avatar Kun Liang Committed by Gerrit - the friendly Code Review server
Browse files

AppOps: remove uid control mechanism for default behavior

Many pre-installed apps' uid are less than FIRST_APPLICATION_UID.
These kind of apps will be allowed for strict operations by
default. This breaks some rules about pre-installed apps.

Need remove this UID control mechanism and add trusted apps in
whiltelist instead.

Change-Id: I561dbe6bacd9df3d9ea8bdbc0da2d5b2f791aece
parent fce01875
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -71,6 +71,7 @@ public class AppOpsService extends IAppOpsService.Stub {
    static final boolean DEBUG = false;
    static final int SHOW_PERMISSION_DIALOG = 1;
    static final String WHITELIST_FILE = "persist.sys.whitelist";
    static final String DEFAULT_WHITELIST_FILE = "/system/etc/whitelist_appops.xml";

    // Write at most every 30 minutes.
    static final long WRITE_DELAY = DEBUG ? 1000 : 30*60*1000;
@@ -1157,8 +1158,7 @@ public class AppOpsService extends IAppOpsService.Stub {
        if (!mStrictEnable)
            return false;

        return ((uid > Process.FIRST_APPLICATION_UID) &&
            !isInWhitelist(packageName));
        return (!isInWhitelist(packageName));
    }

    private boolean isInWhitelist(String packageName) {
@@ -1292,7 +1292,8 @@ public class AppOpsService extends IAppOpsService.Stub {

    void readWhitelist() {
        // Read if whitelist file provided
        String whitelistFileName = SystemProperties.get(WHITELIST_FILE);
        String whitelistFileName = SystemProperties.get(WHITELIST_FILE,
                DEFAULT_WHITELIST_FILE);
        if(!mStrictEnable || "".equals(whitelistFileName)) {
            return;
        }