diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index 698c39d230652..44d816d0ba2dc 100755 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -6332,6 +6332,13 @@ public final class Settings { public static final String DEMO_USER_SETUP_COMPLETE = "demo_user_setup_complete"; + /** + * Specifies whether the web action API is enabled. + * + * @hide + */ + public static final String WEB_ACTION_ENABLED = "web_action_enabled"; + /** * This are the settings to be backed up. * diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java index 29cbdbb990de6..f84356bdb2b7d 100644 --- a/services/core/java/com/android/server/pm/PackageManagerService.java +++ b/services/core/java/com/android/server/pm/PackageManagerService.java @@ -197,6 +197,7 @@ import android.os.storage.StorageManager; import android.os.storage.VolumeInfo; import android.os.storage.VolumeRecord; import android.provider.Settings.Global; +import android.provider.Settings.Secure; import android.security.KeyStore; import android.security.SystemKeyStore; import android.system.ErrnoException; @@ -364,6 +365,7 @@ public class PackageManagerService extends IPackageManager.Stub { static final boolean CLEAR_RUNTIME_PERMISSIONS_ON_UPGRADE = false; + // STOPSHIP; b/30256615 private static final boolean DISABLE_EPHEMERAL_APPS = !Build.IS_DEBUGGABLE; private static final int RADIO_UID = Process.PHONE_UID; @@ -4766,11 +4768,23 @@ public class PackageManagerService extends IPackageManager.Stub { false, false, false, userId); } + private boolean isEphemeralDisabled() { + // ephemeral apps have been disabled across the board + if (DISABLE_EPHEMERAL_APPS) { + return true; + } + // system isn't up yet; can't read settings, so, assume no ephemeral apps + if (!mSystemReady) { + return true; + } + return Secure.getInt(mContext.getContentResolver(), Secure.WEB_ACTION_ENABLED, 1) == 0; + } + private boolean isEphemeralAllowed( Intent intent, List resolvedActivities, int userId, boolean skipPackageCheck) { // Short circuit and return early if possible. - if (DISABLE_EPHEMERAL_APPS) { + if (isEphemeralDisabled()) { return false; } final int callingUser = UserHandle.getCallingUserId(); @@ -6239,7 +6253,7 @@ public class PackageManagerService extends IPackageManager.Stub { @Override public ParceledListSlice getEphemeralApplications(int userId) { - if (DISABLE_EPHEMERAL_APPS) { + if (isEphemeralDisabled()) { return null; } @@ -6263,7 +6277,7 @@ public class PackageManagerService extends IPackageManager.Stub { enforceCrossUserPermission(Binder.getCallingUid(), userId, true /* requireFullPermission */, false /* checkShell */, "isEphemeral"); - if (DISABLE_EPHEMERAL_APPS) { + if (isEphemeralDisabled()) { return false; } @@ -6281,7 +6295,7 @@ public class PackageManagerService extends IPackageManager.Stub { @Override public byte[] getEphemeralApplicationCookie(String packageName, int userId) { - if (DISABLE_EPHEMERAL_APPS) { + if (isEphemeralDisabled()) { return null; } @@ -6299,7 +6313,7 @@ public class PackageManagerService extends IPackageManager.Stub { @Override public boolean setEphemeralApplicationCookie(String packageName, byte[] cookie, int userId) { - if (DISABLE_EPHEMERAL_APPS) { + if (isEphemeralDisabled()) { return true; } @@ -6317,7 +6331,7 @@ public class PackageManagerService extends IPackageManager.Stub { @Override public Bitmap getEphemeralApplicationIcon(String packageName, int userId) { - if (DISABLE_EPHEMERAL_APPS) { + if (isEphemeralDisabled()) { return null; }