Merge "Make android:cantSaveState an optional feature." into pi-dev

This commit is contained in:
Dianne Hackborn
2018-05-08 17:59:32 +00:00
committed by Android (Google) Code Review
5 changed files with 16 additions and 2 deletions

View File

@@ -11274,6 +11274,7 @@ package android.content.pm {
field public static final java.lang.String FEATURE_CAMERA_FLASH = "android.hardware.camera.flash";
field public static final java.lang.String FEATURE_CAMERA_FRONT = "android.hardware.camera.front";
field public static final java.lang.String FEATURE_CAMERA_LEVEL_FULL = "android.hardware.camera.level.full";
field public static final java.lang.String FEATURE_CANT_SAVE_STATE = "android.software.cant_save_state";
field public static final java.lang.String FEATURE_COMPANION_DEVICE_SETUP = "android.software.companion_device_setup";
field public static final java.lang.String FEATURE_CONNECTION_SERVICE = "android.software.connectionservice";
field public static final java.lang.String FEATURE_CONSUMER_IR = "android.hardware.consumerir";

View File

@@ -2281,6 +2281,13 @@ public abstract class PackageManager {
*/
@SdkConstant(SdkConstantType.FEATURE)
public static final String FEATURE_APP_WIDGETS = "android.software.app_widgets";
/**
* Feature for {@link #getSystemAvailableFeatures} and
* {@link #hasSystemFeature}: The device supports the
* {@link android.R.attr#cantSaveState} API.
*/
@SdkConstant(SdkConstantType.FEATURE)
public static final String FEATURE_CANT_SAVE_STATE = "android.software.cant_save_state";
/**
* @hide

View File

@@ -1970,6 +1970,8 @@ public class ActivityManagerService extends IActivityManager.Stub
final boolean mPermissionReviewRequired;
boolean mHasHeavyWeightFeature;
/**
* Whether to force background check on all apps (for battery saver) or not.
*/
@@ -15081,6 +15083,8 @@ public class ActivityManagerService extends IActivityManager.Stub
return;
}
mHasHeavyWeightFeature = mContext.getPackageManager().hasSystemFeature(
PackageManager.FEATURE_CANT_SAVE_STATE);
mLocalDeviceIdleController
= LocalServices.getService(DeviceIdleController.LocalService.class);
mAssistUtils = new AssistUtils(mContext);

View File

@@ -1526,7 +1526,8 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D
mService.getLifecycleManager().scheduleTransaction(clientTransaction);
if ((app.info.privateFlags & ApplicationInfo.PRIVATE_FLAG_CANT_SAVE_STATE) != 0) {
if ((app.info.privateFlags & ApplicationInfo.PRIVATE_FLAG_CANT_SAVE_STATE) != 0
&& mService.mHasHeavyWeightFeature) {
// This may be a heavy-weight process! Note that the package
// manager will ensure that only activity can run in the main
// process of the .apk, which is the only thing that will be

View File

@@ -1023,7 +1023,8 @@ class ActivityStarter {
if (aInfo != null &&
(aInfo.applicationInfo.privateFlags
& ApplicationInfo.PRIVATE_FLAG_CANT_SAVE_STATE) != 0) {
& ApplicationInfo.PRIVATE_FLAG_CANT_SAVE_STATE) != 0 &&
mService.mHasHeavyWeightFeature) {
// This may be a heavy-weight process! Check to see if we already
// have another, different heavy-weight process running.
if (aInfo.processName.equals(aInfo.applicationInfo.packageName)) {