Merge "Sync PRIV_APP_OOB_ENABLED setting to pm.dexopt.priv-apps-oob"

This commit is contained in:
TreeHugger Robot
2017-11-13 20:31:52 +00:00
committed by Android (Google) Code Review

View File

@@ -551,6 +551,8 @@ public class PackageManagerService extends IPackageManager.Stub
private static final String VENDOR_OVERLAY_DIR = "/vendor/overlay";
private static final String PROPERTY_NAME_PM_DEXOPT_PRIV_APPS_OOB = "pm.dexopt.priv-apps-oob";
/** Canonical intent used to identify what counts as a "web browser" app */
private static final Intent sBrowserIntent;
static {
@@ -9598,7 +9600,7 @@ public class PackageManagerService extends IPackageManager.Stub
if (Build.IS_DEBUGGABLE &&
pkg.isPrivileged() &&
SystemProperties.getBoolean("pm.dexopt.priv-apps-oob", false)) {
SystemProperties.getBoolean(PROPERTY_NAME_PM_DEXOPT_PRIV_APPS_OOB, false)) {
PackageManagerServiceUtils.logPackageHasUncompressedCode(pkg);
}
@@ -19900,6 +19902,23 @@ Slog.v(TAG, ":: stepped forward, applying functor at tag " + parser.getName());
.getUriFor(Secure.INSTANT_APPS_ENABLED), false, co, UserHandle.USER_SYSTEM);
co.onChange(true);
// This observer provides an one directional mapping from Global.PRIV_APP_OOB_ENABLED to
// pm.dexopt.priv-apps-oob property. This is only for experiment and should be removed once
// it is done.
ContentObserver privAppOobObserver = new ContentObserver(mHandler) {
@Override
public void onChange(boolean selfChange) {
int oobEnabled = Global.getInt(resolver, Global.PRIV_APP_OOB_ENABLED, 0);
SystemProperties.set(PROPERTY_NAME_PM_DEXOPT_PRIV_APPS_OOB,
oobEnabled == 1 ? "true" : "false");
}
};
mContext.getContentResolver().registerContentObserver(
Global.getUriFor(Global.PRIV_APP_OOB_ENABLED), false, privAppOobObserver,
UserHandle.USER_SYSTEM);
// At boot, restore the value from the setting, which persists across reboot.
privAppOobObserver.onChange(true);
// Disable any carrier apps. We do this very early in boot to prevent the apps from being
// disabled after already being started.
CarrierAppUtils.disableCarrierAppsUntilPrivileged(mContext.getOpPackageName(), this,