diff --git a/src/com/android/settings/notification/NotificationBackend.java b/src/com/android/settings/notification/NotificationBackend.java
index 2ae91e2..5215a33 100644
--- a/src/com/android/settings/notification/NotificationBackend.java
+++ b/src/com/android/settings/notification/NotificationBackend.java
@@ -115,40 +115,27 @@
 
     void recordCanBeBlocked(Context context, PackageManager pm, RoleManager rm, PackageInfo app,
             AppRow row) {
-        if (Settings.Secure.getIntForUser(context.getContentResolver(),
-                Settings.Secure.NOTIFICATION_PERMISSION_ENABLED, 0, USER_SYSTEM) != 0) {
-            try {
-                row.systemApp = row.lockedImportance =
-                        sINM.isPermissionFixed(app.packageName, row.userId);
-            } catch (RemoteException e) {
-                Log.w(TAG, "Error calling NMS", e);
-            }
-            // The permission system cannot make role permissions 'fixed', so check for these
-            // roles explicitly
-            List<String> roles = rm.getHeldRolesFromController(app.packageName);
-            if (roles.contains(RoleManager.ROLE_DIALER)
-                    || roles.contains(RoleManager.ROLE_EMERGENCY)) {
-                row.systemApp = row.lockedImportance = true;
-            }
-            // if the app targets T but has not requested the permission, we cannot change the
-            // permission state
-            if (app.applicationInfo.targetSdkVersion > Build.VERSION_CODES.S_V2) {
-                if (app.requestedPermissions == null || Arrays.stream(app.requestedPermissions)
-                        .noneMatch(p -> p.equals(android.Manifest.permission.POST_NOTIFICATIONS))) {
-                    row.lockedImportance = true;
-                }
-            }
 
-        } else {
-            row.systemApp = Utils.isSystemPackage(context.getResources(), pm, app);
-            List<String> roles = rm.getHeldRolesFromController(app.packageName);
-            if (roles.contains(RoleManager.ROLE_DIALER)
-                    || roles.contains(RoleManager.ROLE_EMERGENCY)) {
-                row.systemApp = true;
+        try {
+            row.systemApp = row.lockedImportance =
+                    sINM.isPermissionFixed(app.packageName, row.userId);
+        } catch (RemoteException e) {
+            Log.w(TAG, "Error calling NMS", e);
+        }
+        // The permission system cannot make role permissions 'fixed', so check for these
+        // roles explicitly
+        List<String> roles = rm.getHeldRolesFromController(app.packageName);
+        if (roles.contains(RoleManager.ROLE_DIALER)
+                || roles.contains(RoleManager.ROLE_EMERGENCY)) {
+            row.systemApp = row.lockedImportance = true;
+        }
+        // if the app targets T but has not requested the permission, we cannot change the
+        // permission state
+        if (app.applicationInfo.targetSdkVersion > Build.VERSION_CODES.S_V2) {
+            if (app.requestedPermissions == null || Arrays.stream(app.requestedPermissions)
+                    .noneMatch(p -> p.equals(android.Manifest.permission.POST_NOTIFICATIONS))) {
+                row.lockedImportance = true;
             }
-            final String[] nonBlockablePkgs = context.getResources().getStringArray(
-                    com.android.internal.R.array.config_nonBlockableNotificationPackages);
-            markAppRowWithBlockables(nonBlockablePkgs, row, app.packageName);
         }
     }
 
diff --git a/src/com/android/settings/notification/app/NotificationPreferenceController.java b/src/com/android/settings/notification/app/NotificationPreferenceController.java
index 289f1ed..9d339f0 100644
--- a/src/com/android/settings/notification/app/NotificationPreferenceController.java
+++ b/src/com/android/settings/notification/app/NotificationPreferenceController.java
@@ -64,7 +64,6 @@
     @Nullable
     protected ShortcutInfo mConversationInfo;
     protected List<String> mPreferenceFilter;
-    boolean mMigratedPermission;
 
     boolean overrideCanBlock;
     boolean overrideCanConfigure;
@@ -78,8 +77,6 @@
         mBackend = backend;
         mUm = (UserManager) mContext.getSystemService(Context.USER_SERVICE);
         mPm = mContext.getPackageManager();
-        mMigratedPermission = Settings.Secure.getIntForUser(context.getContentResolver(),
-                Settings.Secure.NOTIFICATION_PERMISSION_ENABLED, 0, USER_SYSTEM) != 0;
     }
 
     /**
@@ -155,9 +152,7 @@
             return overrideCanConfigureValue;
         }
         if (channel != null && mAppRow != null) {
-            boolean locked = mMigratedPermission ? mAppRow.lockedImportance
-                    : channel.isImportanceLockedByCriticalDeviceFunction()
-                            || channel.isImportanceLockedByOEM();
+            boolean locked = mAppRow.lockedImportance;
             if (locked) {
                 return channel.isBlockable() || channel.getImportance() == IMPORTANCE_NONE;
             }
@@ -186,8 +181,7 @@
             return overrideCanConfigureValue;
         }
         if (channel != null && mAppRow != null) {
-            boolean locked = mMigratedPermission ? mAppRow.lockedImportance
-                    : channel.isImportanceLockedByOEM();
+            boolean locked = mAppRow.lockedImportance;
             return !locked || channel.isBlockable();
         }
         return false;
diff --git a/tests/robotests/src/com/android/settings/notification/NotificationBackendTest.java b/tests/robotests/src/com/android/settings/notification/NotificationBackendTest.java
index a7ddec3..5745aa0 100644
--- a/tests/robotests/src/com/android/settings/notification/NotificationBackendTest.java
+++ b/tests/robotests/src/com/android/settings/notification/NotificationBackendTest.java
@@ -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.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 @@
 
     @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 @@
 
     @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 @@
 
     @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 @@
 
     @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 @@
 
     @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();
diff --git a/tests/robotests/src/com/android/settings/notification/app/NotificationPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/notification/app/NotificationPreferenceControllerTest.java
index 8d31fe5..4ba5fe7 100644
--- a/tests/robotests/src/com/android/settings/notification/app/NotificationPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/notification/app/NotificationPreferenceControllerTest.java
@@ -225,9 +225,6 @@
 
     @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 @@
 
     @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 @@
 
     @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 @@
 
     @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 @@
 
     @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 @@
 
     @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 @@
 
     @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();
@@ -327,32 +306,6 @@
     }
 
     @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();
         appRow.systemApp = false;
@@ -410,30 +363,6 @@
     }
 
     @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();
         appRow.systemApp = true;
