diff options
| author | 2016-08-26 22:46:44 +0000 | |
|---|---|---|
| committer | 2016-08-26 22:46:44 +0000 | |
| commit | 742f4de6cffc6b49b317756c8e48dbadf8d3bee4 (patch) | |
| tree | 060854ac509758988d12de1afe42d69d0be2d954 | |
| parent | ffe4d641823051d5f30bc472612b713679f53d9f (diff) | |
| parent | efc1c4d50104e9b9a7581c9b60703727805897f0 (diff) | |
Enable web action apps based on system setting
am: efc1c4d501
Change-Id: I2c8c12aebddecb920d1924c4a04f96acdcd3cc02
| -rwxr-xr-x | core/java/android/provider/Settings.java | 7 | ||||
| -rw-r--r-- | services/core/java/com/android/server/pm/PackageManagerService.java | 26 |
2 files changed, 27 insertions, 6 deletions
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index eb9252c7d668..919a4b4cfeee 100755 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -6333,6 +6333,13 @@ public final class Settings { = "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. * * NOTE: Settings are backed up and restored in the order they appear diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java index 29cbdbb990de..f84356bdb2b7 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<ResolveInfo> 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<EphemeralApplicationInfo> 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; } |