Backport 'add config to disable snapshots'.

Bug: 201691826
Test: m
Merged-In: I83d9ab4a15a862ea220debdd8da8b3d5673da276
Merged-In: Ibdff22eda7be6c91e2872e5ac3ae8f2fe1e65b69
Change-Id: I4914876e4925284d55951d16e472654ee599c619
This commit is contained in:
Brett Chabot
2021-06-29 17:49:15 -07:00
parent 3f8b9fe50b
commit 44dfd78b29
3 changed files with 16 additions and 2 deletions

View File

@@ -5049,4 +5049,7 @@
<!-- the number of the max cached processes in the system. -->
<integer name="config_customizedMaxCachedProcesses">32</integer>
<!-- Whether this device should support taking app snapshots on closure -->
<bool name="config_disableTaskSnapshots">false</bool>
</resources>

View File

@@ -4403,7 +4403,7 @@
<java-symbol type="string" name="view_and_control_notification_title" />
<java-symbol type="string" name="view_and_control_notification_content" />
<java-symbol type="array" name="config_accessibility_allowed_install_source" />
<!-- Translation -->
<java-symbol type="string" name="ui_translation_accessibility_translated_text" />
<java-symbol type="string" name="ui_translation_accessibility_translation_finished" />
@@ -4426,4 +4426,7 @@
<java-symbol type="bool" name="config_volumeShowRemoteSessions" />
<java-symbol type="integer" name="config_customizedMaxCachedProcesses" />
<java-symbol type="bool" name="config_disableTaskSnapshots" />
</resources>

View File

@@ -118,6 +118,11 @@ class TaskSnapshotController {
*/
private final boolean mIsRunningOnWear;
/**
* Flag indicating if device configuration has disabled app snapshots.
*/
private final boolean mConfigDisableTaskSnapshots;
TaskSnapshotController(WindowManagerService service) {
mService = service;
mPersister = new TaskSnapshotPersister(mService, Environment::getDataSystemCeDirectory);
@@ -131,6 +136,8 @@ class TaskSnapshotController {
PackageManager.FEATURE_WATCH);
mHighResTaskSnapshotScale = mService.mContext.getResources().getFloat(
com.android.internal.R.dimen.config_highResTaskSnapshotScale);
mConfigDisableTaskSnapshots = mService.mContext.getResources().getBoolean(
com.android.internal.R.bool.config_disableTaskSnapshots);
}
void systemReady() {
@@ -488,7 +495,8 @@ class TaskSnapshotController {
}
boolean shouldDisableSnapshots() {
return mIsRunningOnWear || mIsRunningOnTv || mIsRunningOnIoT;
return mIsRunningOnWear || mIsRunningOnTv || mIsRunningOnIoT
|| mConfigDisableTaskSnapshots;
}
/**