Enable notification permission feature

Missed the space the first time

Fixes: 217428011
Bug: 217942983
Test: upgrade from device with 209 settings version to 210 settings
Test: upgrade from S to T with 210 settings
Change-Id: I718cc8cb175a1b793fc8a45443aee7c705bbf203
This commit is contained in:
Julia Reynolds
2022-02-04 16:18:04 -05:00
parent 0bfb83dbe5
commit dcdc3e3272
2 changed files with 11 additions and 4 deletions

View File

@@ -3624,7 +3624,7 @@ public class SettingsProvider extends ContentProvider {
}
private final class UpgradeController {
private static final int SETTINGS_VERSION = 209;
private static final int SETTINGS_VERSION = 210;
private final int mUserId;
@@ -5498,17 +5498,21 @@ public class SettingsProvider extends ContentProvider {
}
if (currentVersion == 208) {
// Version 208: Enable enforcement of
// Unused
currentVersion = 209;
}
if (currentVersion == 209) {
// Version 209: Enable enforcement of
// android.Manifest.permission#POST_NOTIFICATIONS in order for applications
// to post notifications.
final SettingsState secureSettings = getSecureSettingsLocked(userId);
secureSettings.insertSettingLocked(
Secure.NOTIFICATION_PERMISSION_ENABLED,
/* enabled= */" 1",
/* enabled= */ "1",
/* tag= */ null,
/* makeDefault= */ false,
SettingsState.SYSTEM_PACKAGE_NAME);
currentVersion = 209;
currentVersion = 210;
}
// vXXX: Add new settings above this point.

View File

@@ -372,6 +372,9 @@ public class NotificationManagerServiceTest extends UiServiceTestCase {
"android.permission.WRITE_DEVICE_CONFIG",
"android.permission.READ_DEVICE_CONFIG",
"android.permission.READ_CONTACTS");
Settings.Secure.putIntForUser(
getContext().getContentResolver(),
Settings.Secure.NOTIFICATION_PERMISSION_ENABLED, 0, USER_SYSTEM);
MockitoAnnotations.initMocks(this);