Merge "Remove notification permission feature flag" into tm-dev am: 23a85a1f96
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/18164272 Change-Id: I08f148210ade5545c070a88656909d4acb7becb7 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -16,9 +16,6 @@
|
||||
|
||||
package com.android.settings.notification;
|
||||
|
||||
import static android.os.UserHandle.USER_SYSTEM;
|
||||
import static android.provider.Settings.*;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import static org.junit.Assert.assertFalse;
|
||||
@@ -37,11 +34,9 @@ import android.content.ComponentName;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.PermissionInfo;
|
||||
import android.net.MacAddress;
|
||||
import android.os.Build;
|
||||
import android.os.Parcel;
|
||||
import android.provider.Settings;
|
||||
|
||||
import com.android.settings.notification.NotificationBackend.AppRow;
|
||||
import com.android.settingslib.bluetooth.CachedBluetoothDevice;
|
||||
@@ -117,9 +112,6 @@ public class NotificationBackendTest {
|
||||
|
||||
@Test
|
||||
public void testMarkAppRow_fixedPermission_withRole() throws Exception {
|
||||
Secure.putIntForUser(RuntimeEnvironment.application.getContentResolver(),
|
||||
Settings.Secure.NOTIFICATION_PERMISSION_ENABLED, 1, USER_SYSTEM);
|
||||
|
||||
PackageInfo pi = new PackageInfo();
|
||||
pi.packageName = "test";
|
||||
pi.applicationInfo = new ApplicationInfo();
|
||||
@@ -141,9 +133,6 @@ public class NotificationBackendTest {
|
||||
|
||||
@Test
|
||||
public void testMarkAppRow_fixedPermission() throws Exception {
|
||||
Secure.putIntForUser(RuntimeEnvironment.application.getContentResolver(),
|
||||
Settings.Secure.NOTIFICATION_PERMISSION_ENABLED, 1, USER_SYSTEM);
|
||||
|
||||
PackageInfo pi = new PackageInfo();
|
||||
pi.packageName = "test";
|
||||
pi.applicationInfo = new ApplicationInfo();
|
||||
@@ -161,9 +150,6 @@ public class NotificationBackendTest {
|
||||
|
||||
@Test
|
||||
public void testMarkAppRow_notFixedPermission() throws Exception {
|
||||
Secure.putIntForUser(RuntimeEnvironment.application.getContentResolver(),
|
||||
Settings.Secure.NOTIFICATION_PERMISSION_ENABLED, 1, USER_SYSTEM);
|
||||
|
||||
PackageInfo pi = new PackageInfo();
|
||||
pi.packageName = "test";
|
||||
pi.applicationInfo = new ApplicationInfo();
|
||||
@@ -181,9 +167,6 @@ public class NotificationBackendTest {
|
||||
|
||||
@Test
|
||||
public void testMarkAppRow_targetsT_noPermissionRequest() throws Exception {
|
||||
Secure.putIntForUser(RuntimeEnvironment.application.getContentResolver(),
|
||||
Settings.Secure.NOTIFICATION_PERMISSION_ENABLED, 1, USER_SYSTEM);
|
||||
|
||||
PackageInfo pi = new PackageInfo();
|
||||
pi.packageName = "test";
|
||||
pi.applicationInfo = new ApplicationInfo();
|
||||
@@ -203,9 +186,6 @@ public class NotificationBackendTest {
|
||||
|
||||
@Test
|
||||
public void testMarkAppRow_targetsT_permissionRequest() throws Exception {
|
||||
Secure.putIntForUser(RuntimeEnvironment.application.getContentResolver(),
|
||||
Settings.Secure.NOTIFICATION_PERMISSION_ENABLED, 1, USER_SYSTEM);
|
||||
|
||||
PackageInfo pi = new PackageInfo();
|
||||
pi.packageName = "test";
|
||||
pi.applicationInfo = new ApplicationInfo();
|
||||
|
@@ -225,9 +225,6 @@ public class NotificationPreferenceControllerTest {
|
||||
|
||||
@Test
|
||||
public void testIsChannelBlockable_postMigration_locked() {
|
||||
Settings.Secure.putIntForUser(RuntimeEnvironment.application.getContentResolver(),
|
||||
Settings.Secure.NOTIFICATION_PERMISSION_ENABLED, 1, USER_SYSTEM);
|
||||
|
||||
mController = new TestPreferenceController(mContext, mBackend);
|
||||
|
||||
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
|
||||
@@ -240,9 +237,6 @@ public class NotificationPreferenceControllerTest {
|
||||
|
||||
@Test
|
||||
public void testIsChannelBlockable_postMigration_locked_butChannelOff() {
|
||||
Settings.Secure.putIntForUser(RuntimeEnvironment.application.getContentResolver(),
|
||||
Settings.Secure.NOTIFICATION_PERMISSION_ENABLED, 1, USER_SYSTEM);
|
||||
|
||||
mController = new TestPreferenceController(mContext, mBackend);
|
||||
|
||||
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
|
||||
@@ -255,9 +249,6 @@ public class NotificationPreferenceControllerTest {
|
||||
|
||||
@Test
|
||||
public void testIsChannelBlockable_postMigration_locked_butChannelBlockable() {
|
||||
Settings.Secure.putIntForUser(RuntimeEnvironment.application.getContentResolver(),
|
||||
Settings.Secure.NOTIFICATION_PERMISSION_ENABLED, 1, USER_SYSTEM);
|
||||
|
||||
mController = new TestPreferenceController(mContext, mBackend);
|
||||
|
||||
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
|
||||
@@ -271,9 +262,6 @@ public class NotificationPreferenceControllerTest {
|
||||
|
||||
@Test
|
||||
public void testIsChannelGroupBlockable_postMigration_locked() {
|
||||
Settings.Secure.putIntForUser(RuntimeEnvironment.application.getContentResolver(),
|
||||
Settings.Secure.NOTIFICATION_PERMISSION_ENABLED, 1, USER_SYSTEM);
|
||||
|
||||
mController = new TestPreferenceController(mContext, mBackend);
|
||||
|
||||
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
|
||||
@@ -285,9 +273,6 @@ public class NotificationPreferenceControllerTest {
|
||||
|
||||
@Test
|
||||
public void testIsChannelGroupBlockable_postMigration_locked_butChannelGroupOff() {
|
||||
Settings.Secure.putIntForUser(RuntimeEnvironment.application.getContentResolver(),
|
||||
Settings.Secure.NOTIFICATION_PERMISSION_ENABLED, 1, USER_SYSTEM);
|
||||
|
||||
mController = new TestPreferenceController(mContext, mBackend);
|
||||
|
||||
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
|
||||
@@ -300,9 +285,6 @@ public class NotificationPreferenceControllerTest {
|
||||
|
||||
@Test
|
||||
public void testIsAppBlockable_postMigration_locked() {
|
||||
Settings.Secure.putIntForUser(RuntimeEnvironment.application.getContentResolver(),
|
||||
Settings.Secure.NOTIFICATION_PERMISSION_ENABLED, 1, USER_SYSTEM);
|
||||
|
||||
mController = new TestPreferenceController(mContext, mBackend);
|
||||
|
||||
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
|
||||
@@ -314,9 +296,6 @@ public class NotificationPreferenceControllerTest {
|
||||
|
||||
@Test
|
||||
public void testIsAppBlockable_postMigration_locked_butAppOff() {
|
||||
Settings.Secure.putIntForUser(RuntimeEnvironment.application.getContentResolver(),
|
||||
Settings.Secure.NOTIFICATION_PERMISSION_ENABLED, 1, USER_SYSTEM);
|
||||
|
||||
mController = new TestPreferenceController(mContext, mBackend);
|
||||
|
||||
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
|
||||
@@ -326,32 +305,6 @@ public class NotificationPreferenceControllerTest {
|
||||
assertFalse(mController.isAppBlockable());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsBlockable_oemAllowlist() {
|
||||
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
|
||||
NotificationChannel channel = mock(NotificationChannel.class);
|
||||
when(channel.isImportanceLockedByOEM()).thenReturn(true);
|
||||
when(channel.getImportance()).thenReturn(IMPORTANCE_LOW);
|
||||
|
||||
mController.onResume(appRow, channel, null, null, null, null, null);
|
||||
assertFalse(mController.isChannelBlockable());
|
||||
|
||||
when(channel.isImportanceLockedByOEM()).thenReturn(false);
|
||||
mController.onResume(appRow, channel, null, null, null, null, null);
|
||||
assertTrue(mController.isChannelBlockable());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsBlockable_defaultApp() {
|
||||
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
|
||||
NotificationChannel channel = mock(NotificationChannel.class);
|
||||
when(channel.getImportance()).thenReturn(IMPORTANCE_LOW);
|
||||
when(channel.isImportanceLockedByCriticalDeviceFunction()).thenReturn(true);
|
||||
|
||||
mController.onResume(appRow, channel, null, null, null, null, null);
|
||||
assertFalse(mController.isChannelBlockable());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsChannelBlockable_nonSystemAppsBlockable() {
|
||||
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
|
||||
@@ -409,30 +362,6 @@ public class NotificationPreferenceControllerTest {
|
||||
assertTrue(mController.isChannelGroupBlockable());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsChannelBlockable_oemLocked() {
|
||||
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
|
||||
appRow.systemApp = false;
|
||||
NotificationChannel channel = mock(NotificationChannel.class);
|
||||
when(channel.isImportanceLockedByOEM()).thenReturn(true);
|
||||
when(channel.getImportance()).thenReturn(IMPORTANCE_DEFAULT);
|
||||
|
||||
mController.onResume(appRow, channel, null, null, null, null, null);
|
||||
assertFalse(mController.isChannelBlockable());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsChannelBlockable_criticalDeviceFunction() {
|
||||
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
|
||||
appRow.systemApp = false;
|
||||
NotificationChannel channel = mock(NotificationChannel.class);
|
||||
when(channel.isImportanceLockedByCriticalDeviceFunction()).thenReturn(true);
|
||||
when(channel.getImportance()).thenReturn(IMPORTANCE_DEFAULT);
|
||||
|
||||
mController.onResume(appRow, channel, null, null, null, null, null);
|
||||
assertFalse(mController.isChannelBlockable());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsChannelGroupBlockable_SystemNotBlockable() {
|
||||
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
|
||||
|
Reference in New Issue
Block a user