Enable web action apps based on system setting
Bug: 28140107 Change-Id: I4cff49165be6432404b9a616ca35bee249daab2a
This commit is contained in:
@@ -6325,6 +6325,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.
|
||||
*
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user