Merge "Whitelist default apps for DND access." into nyc-mr1-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
5bd9ea82d2
@@ -2528,6 +2528,9 @@
|
||||
<!-- Package name for the device provisioning package. -->
|
||||
<string name="config_deviceProvisioningPackage"></string>
|
||||
|
||||
<!-- Colon separated list of package names that should be granted DND access -->
|
||||
<string name="config_defaultDndAccessPackages" translatable="false">com.android.camera2</string>
|
||||
|
||||
<!-- User restrictions set when the first user is created.
|
||||
Note: Also update appropriate overlay files. -->
|
||||
<string-array translatable="false" name="config_defaultFirstUserRestrictions">
|
||||
|
||||
@@ -2639,6 +2639,9 @@
|
||||
<!-- Package name for the device provisioning package -->
|
||||
<java-symbol type="string" name="config_deviceProvisioningPackage" />
|
||||
|
||||
<!-- Colon separated list of package names that should be granted DND access -->
|
||||
<java-symbol type="string" name="config_defaultDndAccessPackages" />
|
||||
|
||||
<!-- Used for MimeIconUtils. -->
|
||||
<java-symbol type="drawable" name="ic_doc_apk" />
|
||||
<java-symbol type="drawable" name="ic_doc_audio" />
|
||||
|
||||
@@ -2085,7 +2085,7 @@ public class SettingsProvider extends ContentProvider {
|
||||
}
|
||||
|
||||
private final class UpgradeController {
|
||||
private static final int SETTINGS_VERSION = 128;
|
||||
private static final int SETTINGS_VERSION = 129;
|
||||
|
||||
private final int mUserId;
|
||||
|
||||
@@ -2345,6 +2345,37 @@ public class SettingsProvider extends ContentProvider {
|
||||
currentVersion = 128;
|
||||
}
|
||||
|
||||
if (currentVersion == 128) {
|
||||
// Version 128: Allow OEMs to grant DND access to default apps. Note that
|
||||
// the new apps are appended to the list of already approved apps.
|
||||
final SettingsState systemSecureSettings =
|
||||
getSecureSettingsLocked(userId);
|
||||
|
||||
final Setting policyAccess = systemSecureSettings.getSettingLocked(
|
||||
Settings.Secure.ENABLED_NOTIFICATION_POLICY_ACCESS_PACKAGES);
|
||||
String defaultPolicyAccess = getContext().getResources().getString(
|
||||
com.android.internal.R.string.config_defaultDndAccessPackages);
|
||||
if (!TextUtils.isEmpty(defaultPolicyAccess)) {
|
||||
if (policyAccess.isNull()) {
|
||||
systemSecureSettings.insertSettingLocked(
|
||||
Settings.Secure.ENABLED_NOTIFICATION_POLICY_ACCESS_PACKAGES,
|
||||
defaultPolicyAccess,
|
||||
SettingsState.SYSTEM_PACKAGE_NAME);
|
||||
} else {
|
||||
StringBuilder currentSetting =
|
||||
new StringBuilder(policyAccess.getValue());
|
||||
currentSetting.append(":");
|
||||
currentSetting.append(defaultPolicyAccess);
|
||||
systemSecureSettings.updateSettingLocked(
|
||||
Settings.Secure.ENABLED_NOTIFICATION_POLICY_ACCESS_PACKAGES,
|
||||
currentSetting.toString(),
|
||||
SettingsState.SYSTEM_PACKAGE_NAME);
|
||||
}
|
||||
}
|
||||
|
||||
currentVersion = 129;
|
||||
}
|
||||
|
||||
// vXXX: Add new settings above this point.
|
||||
|
||||
// Return the current version.
|
||||
|
||||
Reference in New Issue
Block a user