diff --git a/services/core/java/com/android/server/notification/NotificationRecord.java b/services/core/java/com/android/server/notification/NotificationRecord.java index 5a5e658d3714c..803b0dc0ee5e5 100644 --- a/services/core/java/com/android/server/notification/NotificationRecord.java +++ b/services/core/java/com/android/server/notification/NotificationRecord.java @@ -153,7 +153,7 @@ public final class NotificationRecord { final ApplicationInfo applicationInfo = mContext.getPackageManager().getApplicationInfoAsUser(sbn.getPackageName(), 0, UserHandle.getUserId(sbn.getUid())); - if (applicationInfo.targetSdkVersion <= Build.VERSION_CODES.N_MR1) { + if (applicationInfo.targetSdkVersion < Build.VERSION_CODES.O) { return true; } } diff --git a/services/core/java/com/android/server/notification/RankingHelper.java b/services/core/java/com/android/server/notification/RankingHelper.java index e184f839e8057..f00ef386ba591 100644 --- a/services/core/java/com/android/server/notification/RankingHelper.java +++ b/services/core/java/com/android/server/notification/RankingHelper.java @@ -286,7 +286,7 @@ public class RankingHelper implements RankingConfig { private boolean shouldHaveDefaultChannel(Record r) throws NameNotFoundException { final int userId = UserHandle.getUserId(r.uid); final ApplicationInfo applicationInfo = mPm.getApplicationInfoAsUser(r.pkg, 0, userId); - if (applicationInfo.targetSdkVersion > Build.VERSION_CODES.N_MR1) { + if (applicationInfo.targetSdkVersion >= Build.VERSION_CODES.O) { // O apps should not have the default channel. return false; } diff --git a/services/tests/notification/src/com/android/server/notification/NotificationRecordTest.java b/services/tests/notification/src/com/android/server/notification/NotificationRecordTest.java index 267d2a6d5c4f0..081278381f916 100644 --- a/services/tests/notification/src/com/android/server/notification/NotificationRecordTest.java +++ b/services/tests/notification/src/com/android/server/notification/NotificationRecordTest.java @@ -99,7 +99,7 @@ public class NotificationRecordTest extends NotificationTestCase { when(mMockContext.getPackageManager()).thenReturn(mPm); legacy.targetSdkVersion = Build.VERSION_CODES.N_MR1; - upgrade.targetSdkVersion = Build.VERSION_CODES.N_MR1 + 1; + upgrade.targetSdkVersion = Build.VERSION_CODES.O; try { when(mPm.getApplicationInfoAsUser(eq(pkg), anyInt(), anyInt())).thenReturn(legacy); when(mPm.getApplicationInfoAsUser(eq(pkg2), anyInt(), anyInt())).thenReturn(upgrade); diff --git a/services/tests/notification/src/com/android/server/notification/RankingHelperTest.java b/services/tests/notification/src/com/android/server/notification/RankingHelperTest.java index cb0ee2566bee8..2c9c114039050 100644 --- a/services/tests/notification/src/com/android/server/notification/RankingHelperTest.java +++ b/services/tests/notification/src/com/android/server/notification/RankingHelperTest.java @@ -119,7 +119,7 @@ public class RankingHelperTest extends NotificationTestCase { final ApplicationInfo legacy = new ApplicationInfo(); legacy.targetSdkVersion = Build.VERSION_CODES.N_MR1; final ApplicationInfo upgrade = new ApplicationInfo(); - upgrade.targetSdkVersion = Build.VERSION_CODES.N_MR1 + 1; + upgrade.targetSdkVersion = Build.VERSION_CODES.O; when(mPm.getApplicationInfoAsUser(eq(PKG), anyInt(), anyInt())).thenReturn(legacy); when(mPm.getApplicationInfoAsUser(eq(UPDATED_PKG), anyInt(), anyInt())).thenReturn(upgrade); when(mPm.getPackageUidAsUser(eq(PKG), anyInt())).thenReturn(UID);