diff options
| author | 2023-03-23 20:46:22 +0800 | |
|---|---|---|
| committer | 2023-03-30 22:30:19 +0800 | |
| commit | c7ed8bb7ba9ee70bc84c9e404049fa7211400eef (patch) | |
| tree | e91be116a1b8673be76e49d2e447ac5564ee5a78 | |
| parent | 9bfbfcc4c5a4988cc63ddfc3c83e148b19bef56b (diff) | |
Allow pre-commit confirmation toggle-able via resource config
Currently, the pre-commit confirmation is controlled by device config
and default value is true. This makes the feature default enabled.
Even partners update the default value to false, it still can be
overrided by device config mechanism.
It is possible the partners would like to disable the feature so in
this change, we allow the feature can be toggled by resource config,
the value should not be overrided by device config.
Bug: 272507743
Test: atest PreapprovalInstallTest
Change-Id: I2fb45bb6da608d6772335d63d452d60560bcce27
| -rw-r--r-- | core/res/res/values/config.xml | 2 | ||||
| -rw-r--r-- | core/res/res/values/symbols.xml | 1 | ||||
| -rw-r--r-- | services/core/java/com/android/server/pm/PackageManagerService.java | 5 |
3 files changed, 8 insertions, 0 deletions
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index 5a35ca74e5dc..01871ed2b0d0 100644 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -6386,4 +6386,6 @@ <!-- Whether we should persist the brightness value in nits for the default display even if the underlying display device changes. --> <bool name="config_persistBrightnessNitsForDefaultDisplay">false</bool> + <!-- Whether to request the approval before commit sessions. --> + <bool name="config_isPreApprovalRequestAvailable">true</bool> </resources> diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index 8fb7c9d16170..0f4ef4978f05 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -2235,6 +2235,7 @@ <java-symbol type="array" name="config_nonPreemptibleInputMethods" /> <java-symbol type="bool" name="config_enhancedConfirmationModeEnabled" /> <java-symbol type="bool" name="config_persistBrightnessNitsForDefaultDisplay" /> + <java-symbol type="bool" name="config_isPreApprovalRequestAvailable" /> <java-symbol type="layout" name="resolver_list" /> <java-symbol type="id" name="resolver_list" /> diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java index 2038e798a038..6b213b78f11c 100644 --- a/services/core/java/com/android/server/pm/PackageManagerService.java +++ b/services/core/java/com/android/server/pm/PackageManagerService.java @@ -7208,6 +7208,7 @@ public class PackageManagerService implements PackageSender, TestUtilityService * TODO: In the meantime, can this be moved to a schedule call? * TODO(b/182523293): This should be removed once we finish migration of permission storage. */ + @SuppressWarnings("GuardedBy") void writeSettingsLPrTEMP(boolean sync) { snapshotComputer(false); mPermissionManager.writeLegacyPermissionsTEMP(mSettings.mPermissions); @@ -7257,6 +7258,10 @@ public class PackageManagerService implements PackageSender, TestUtilityService static boolean isPreapprovalRequestAvailable() { final long token = Binder.clearCallingIdentity(); try { + if (!Resources.getSystem().getBoolean( + com.android.internal.R.bool.config_isPreApprovalRequestAvailable)) { + return false; + } return DeviceConfig.getBoolean(NAMESPACE_PACKAGE_MANAGER_SERVICE, PROPERTY_IS_PRE_APPROVAL_REQUEST_AVAILABLE, true /* defaultValue */); } finally { |