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

Commit 93aa8f24 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 6192723 from 7082688f to qt-qpr3-release

Change-Id: I708fe35a54789ecd90a4edeaf7d0b5578218f786
parents 3e522087 7082688f
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -1274,6 +1274,16 @@ public class UserManager {
        return RoSystemProperties.FW_SYSTEM_USER_SPLIT;
    }

    /**
     * @hide
     * @return Whether the device is running in a headless system user mode. It means the headless
     * user (system user) runs system services and system UI, but is not associated with any real
     * person. Secondary users can be created to be associated with real person.
     */
    public static boolean isHeadlessSystemUserMode() {
        return RoSystemProperties.MULTIUSER_HEADLESS_SYSTEM_USER;
    }

    /**
     * @return Whether guest user is always ephemeral
     * @hide
+3 −0
Original line number Diff line number Diff line
@@ -1692,6 +1692,9 @@
         This feature should be disabled for most devices. -->
    <integer name="config_virtualKeyQuietTimeMillis">0</integer>

    <!-- Flag indicating whether system user specific blacklist/whitelist is supported -->
    <bool name="config_systemUserPackagesBlacklistSupported">false</bool>

    <!-- A list of potential packages, in priority order, that may contain an
         ephemeral resolver. Each package will be be queried for a component
         that has been granted the PACKAGE_EPHEMERAL_AGENT permission.
+1 −0
Original line number Diff line number Diff line
@@ -308,6 +308,7 @@
  <java-symbol type="bool" name="config_sms_utf8_support" />
  <java-symbol type="bool" name="config_suspendWhenScreenOffDueToProximity" />
  <java-symbol type="bool" name="config_swipeDisambiguation" />
  <java-symbol type="bool" name="config_systemUserPackagesBlacklistSupported" />
  <java-symbol type="bool" name="config_syncstorageengine_masterSyncAutomatically" />
  <java-symbol type="bool" name="config_ui_enableFadingMarquee" />
  <java-symbol type="bool" name="config_enableHapticTextHandle" />
+72 −19
Original line number Diff line number Diff line
@@ -2320,30 +2320,56 @@ public class PackageManagerService extends IPackageManager.Stub
        return m;
    }
    private boolean isSystemUserPackagesBlacklistSupported() {
        return Resources.getSystem().getBoolean(
              R.bool.config_systemUserPackagesBlacklistSupported);
    }
    private void enableSystemUserPackages() {
        if (!UserManager.isSplitSystemUser()) {
        if (!isSystemUserPackagesBlacklistSupported()) {
            Log.i(TAG, "Skipping system user blacklist since "
                    + "config_systemUserPackagesBlacklistSupported is false");
            return;
        }
        boolean isHeadlessSystemUserMode = UserManager.isHeadlessSystemUserMode();
        if (!isHeadlessSystemUserMode && !UserManager.isSplitSystemUser()) {
            Log.i(TAG, "Skipping system user blacklist on 'regular' device type");
            return;
        }
        // For system user, enable apps based on the following conditions:
        // - app is whitelisted or belong to one of these groups:
        Log.i(TAG, "blacklisting packages for system user");
        Set<String> enableApps = new ArraySet<>();
        AppsQueryHelper queryHelper = new AppsQueryHelper(this);
        List<String> allAps = queryHelper.queryApps(0, /* systemAppsOnly */ false,
                UserHandle.SYSTEM);
        if (isHeadlessSystemUserMode) {
            enableApps.addAll(allAps);
        } else {
            // For split system user, select apps based on the following conditions:
            //   -- system app which has no launcher icons
            //   -- system app which has INTERACT_ACROSS_USERS permission
            //   -- system IME app
        // - app is not in the blacklist
        AppsQueryHelper queryHelper = new AppsQueryHelper(this);
        Set<String> enableApps = new ArraySet<>();
            enableApps.addAll(queryHelper.queryApps(AppsQueryHelper.GET_NON_LAUNCHABLE_APPS
                    | AppsQueryHelper.GET_APPS_WITH_INTERACT_ACROSS_USERS_PERM
                    | AppsQueryHelper.GET_IMES, /* systemAppsOnly */ true, UserHandle.SYSTEM));
        ArraySet<String> wlApps = SystemConfig.getInstance().getSystemUserWhitelistedApps();
        enableApps.addAll(wlApps);
            enableApps.addAll(queryHelper.queryApps(AppsQueryHelper.GET_REQUIRED_FOR_SYSTEM_USER,
                    /* systemAppsOnly */ false, UserHandle.SYSTEM));
        ArraySet<String> blApps = SystemConfig.getInstance().getSystemUserBlacklistedApps();
        enableApps.removeAll(blApps);
        Log.i(TAG, "Applications installed for system user: " + enableApps);
        List<String> allAps = queryHelper.queryApps(0, /* systemAppsOnly */ false,
                UserHandle.SYSTEM);
            // Apply whitelist for split system user
            ArraySet<String> whitelistedSystemUserApps = SystemConfig.getInstance()
                    .getSystemUserWhitelistedApps();
            enableApps.addAll(whitelistedSystemUserApps);
            Log.i(TAG, "Whitelisted packages: " + whitelistedSystemUserApps);
        }
        // Apply blacklist for split system user/headless system user
        ArraySet<String> blacklistedSystemUserApps = SystemConfig.getInstance()
                .getSystemUserBlacklistedApps();
        enableApps.removeAll(blacklistedSystemUserApps);
        Log.i(TAG, "Blacklisted packages: " + blacklistedSystemUserApps);
        final int allAppsSize = allAps.size();
        synchronized (mPackages) {
            for  (int i = 0; i < allAppsSize; i++) {
@@ -22287,6 +22313,18 @@ public class PackageManagerService extends IPackageManager.Stub
            if (dumpState.isDumping(DumpState.DUMP_PACKAGES)) {
                mSettings.dumpPackagesLPr(pw, packageName, permissionNames, dumpState, checkin);
                boolean systemUserPackagesBlacklistSupported =
                        isSystemUserPackagesBlacklistSupported();
                pw.println("isSystemUserPackagesBlacklistSupported: "
                        + systemUserPackagesBlacklistSupported);
                if (systemUserPackagesBlacklistSupported) {
                    SystemConfig sysconfig = SystemConfig.getInstance();
                    dumpPackagesList(pw, "  ", "whitelist",
                            sysconfig.getSystemUserWhitelistedApps());
                    dumpPackagesList(pw, "  ", "blacklist",
                            sysconfig.getSystemUserBlacklistedApps());
                }
            }
            if (dumpState.isDumping(DumpState.DUMP_SHARED_USERS)) {
@@ -22396,6 +22434,21 @@ public class PackageManagerService extends IPackageManager.Stub
        }
    }
    private void dumpPackagesList(PrintWriter pw, String prefix, String name,
            ArraySet<String> list) {
        pw.print(prefix); pw.print(name); pw.print(": ");
        int size = list.size();
        if (size == 0) {
            pw.println("empty");
            return;
        }
        pw.print(size); pw.println(" packages");
        String prefix2 = prefix + "  ";
        for (int i = 0; i < size; i++) {
            pw.print(prefix2); pw.println(list.valueAt(i));
        }
    }
    //TODO: b/111402650
    private void disableSkuSpecificApps() {
        String apkList[] = mContext.getResources().getStringArray(