Loading core/java/com/android/internal/config/sysui/SystemUiDeviceConfigFlags.java +0 −3 Original line number Diff line number Diff line Loading @@ -118,9 +118,6 @@ public final class SystemUiDeviceConfigFlags { */ public static final String NAS_DEFAULT_SERVICE = "nas_default_service"; /** (boolean) Whether notify() calls to NMS should acquire and hold WakeLocks. */ public static final String NOTIFY_WAKELOCK = "nms_notify_wakelock"; // Flags related to media notifications /** Loading core/java/com/android/internal/config/sysui/SystemUiSystemPropertiesFlags.java +0 −4 Original line number Diff line number Diff line Loading @@ -74,10 +74,6 @@ public class SystemUiSystemPropertiesFlags { public static final Flag LOG_DND_STATE_EVENTS = releasedFlag("persist.sysui.notification.log_dnd_state_events"); /** Gating the holding of WakeLocks until NLSes are told about a new notification. */ public static final Flag WAKE_LOCK_FOR_POSTING_NOTIFICATION = releasedFlag("persist.sysui.notification.wake_lock_for_posting_notification"); /** Gating storing NotificationRankingUpdate ranking map in shared memory. */ public static final Flag RANKING_UPDATE_ASHMEM = devFlag( "persist.sysui.notification.ranking_update_ashmem"); Loading services/core/java/com/android/server/notification/NotificationManagerService.java +10 −17 Original line number Diff line number Diff line Loading @@ -118,7 +118,6 @@ import static android.service.notification.NotificationListenerService.TRIM_FULL import static android.service.notification.NotificationListenerService.TRIM_LIGHT; import static android.view.WindowManager.LayoutParams.TYPE_TOAST; import static com.android.internal.config.sysui.SystemUiSystemPropertiesFlags.NotificationFlags.WAKE_LOCK_FOR_POSTING_NOTIFICATION; import static com.android.internal.util.FrameworkStatsLog.DND_MODE_RULE; import static com.android.internal.util.FrameworkStatsLog.PACKAGE_NOTIFICATION_CHANNEL_GROUP_PREFERENCES; import static com.android.internal.util.FrameworkStatsLog.PACKAGE_NOTIFICATION_CHANNEL_PREFERENCES; Loading Loading @@ -533,6 +532,8 @@ public class NotificationManagerService extends SystemService { @EnabledAfter(targetSdkVersion = Build.VERSION_CODES.S_V2) private static final long NOTIFICATION_LOG_ASSISTANT_CANCEL = 195579280L; private static final Duration POST_WAKE_LOCK_TIMEOUT = Duration.ofSeconds(30); private IActivityManager mAm; private ActivityTaskManagerInternal mAtm; private ActivityManager mActivityManager; Loading Loading @@ -6676,22 +6677,14 @@ public class NotificationManagerService extends SystemService { } private PostNotificationTracker acquireWakeLockForPost(String pkg, int uid) { if (mFlagResolver.isEnabled(WAKE_LOCK_FOR_POSTING_NOTIFICATION) && Binder.withCleanCallingIdentity( () -> DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_SYSTEMUI, SystemUiDeviceConfigFlags.NOTIFY_WAKELOCK, false))) { // The package probably doesn't have WAKE_LOCK permission and should not require it. return Binder.withCleanCallingIdentity(() -> { WakeLock wakeLock = mPowerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "NotificationManagerService:post:" + pkg); wakeLock.setWorkSource(new WorkSource(uid, pkg)); // TODO(b/275044361): Adjust to a more reasonable number when we have the data. wakeLock.acquire(30_000); wakeLock.acquire(POST_WAKE_LOCK_TIMEOUT.toMillis()); return mPostNotificationTrackerFactory.newTracker(wakeLock); }); } else { return mPostNotificationTrackerFactory.newTracker(null); } } /** Loading services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java +0 −33 Original line number Diff line number Diff line Loading @@ -83,7 +83,6 @@ import static android.view.WindowManager.LayoutParams.TYPE_TOAST; import static com.android.internal.config.sysui.SystemUiSystemPropertiesFlags.NotificationFlags.FSI_FORCE_DEMOTE; import static com.android.internal.config.sysui.SystemUiSystemPropertiesFlags.NotificationFlags.SHOW_STICKY_HUN_FOR_DENIED_FSI; import static com.android.internal.config.sysui.SystemUiSystemPropertiesFlags.NotificationFlags.WAKE_LOCK_FOR_POSTING_NOTIFICATION; import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.STRONG_AUTH_REQUIRED_AFTER_USER_LOCKDOWN; import static com.android.server.am.PendingIntentRecord.FLAG_ACTIVITY_SENDER; import static com.android.server.am.PendingIntentRecord.FLAG_BROADCAST_SENDER; Loading Loading @@ -128,7 +127,6 @@ import static org.mockito.Mockito.timeout; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyNoMoreInteractions; import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.when; import static java.util.Collections.emptyList; Loading Loading @@ -596,9 +594,6 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { mAcquiredWakeLocks.add(wl); return wl; }); mTestFlagResolver.setFlagOverride(WAKE_LOCK_FOR_POSTING_NOTIFICATION, true); DeviceConfig.setProperty(DeviceConfig.NAMESPACE_SYSTEMUI, SystemUiDeviceConfigFlags.NOTIFY_WAKELOCK, "true", false); // apps allowed as convos mService.setStringArrayResourceValue(PKG_O); Loading Loading @@ -1963,34 +1958,6 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { inOrder.verifyNoMoreInteractions(); } @Test public void enqueueNotification_wakeLockSystemPropertyOff_noWakeLock() throws Exception { mTestFlagResolver.setFlagOverride(WAKE_LOCK_FOR_POSTING_NOTIFICATION, false); DeviceConfig.setProperty(DeviceConfig.NAMESPACE_SYSTEMUI, SystemUiDeviceConfigFlags.NOTIFY_WAKELOCK, "true", false); mBinderService.enqueueNotificationWithTag(PKG, PKG, "enqueueNotification_setsWakeLockWorkSource", 0, generateNotificationRecord(null).getNotification(), 0); waitForIdle(); verifyZeroInteractions(mPowerManager); } @Test public void enqueueNotification_wakeLockDeviceConfigOff_noWakeLock() throws Exception { mTestFlagResolver.setFlagOverride(WAKE_LOCK_FOR_POSTING_NOTIFICATION, true); DeviceConfig.setProperty(DeviceConfig.NAMESPACE_SYSTEMUI, SystemUiDeviceConfigFlags.NOTIFY_WAKELOCK, "false", false); mBinderService.enqueueNotificationWithTag(PKG, PKG, "enqueueNotification_setsWakeLockWorkSource", 0, generateNotificationRecord(null).getNotification(), 0); waitForIdle(); verifyZeroInteractions(mPowerManager); } @Test public void testCancelNonexistentNotification() throws Exception { mBinderService.cancelNotificationWithTag(PKG, PKG, Loading Loading
core/java/com/android/internal/config/sysui/SystemUiDeviceConfigFlags.java +0 −3 Original line number Diff line number Diff line Loading @@ -118,9 +118,6 @@ public final class SystemUiDeviceConfigFlags { */ public static final String NAS_DEFAULT_SERVICE = "nas_default_service"; /** (boolean) Whether notify() calls to NMS should acquire and hold WakeLocks. */ public static final String NOTIFY_WAKELOCK = "nms_notify_wakelock"; // Flags related to media notifications /** Loading
core/java/com/android/internal/config/sysui/SystemUiSystemPropertiesFlags.java +0 −4 Original line number Diff line number Diff line Loading @@ -74,10 +74,6 @@ public class SystemUiSystemPropertiesFlags { public static final Flag LOG_DND_STATE_EVENTS = releasedFlag("persist.sysui.notification.log_dnd_state_events"); /** Gating the holding of WakeLocks until NLSes are told about a new notification. */ public static final Flag WAKE_LOCK_FOR_POSTING_NOTIFICATION = releasedFlag("persist.sysui.notification.wake_lock_for_posting_notification"); /** Gating storing NotificationRankingUpdate ranking map in shared memory. */ public static final Flag RANKING_UPDATE_ASHMEM = devFlag( "persist.sysui.notification.ranking_update_ashmem"); Loading
services/core/java/com/android/server/notification/NotificationManagerService.java +10 −17 Original line number Diff line number Diff line Loading @@ -118,7 +118,6 @@ import static android.service.notification.NotificationListenerService.TRIM_FULL import static android.service.notification.NotificationListenerService.TRIM_LIGHT; import static android.view.WindowManager.LayoutParams.TYPE_TOAST; import static com.android.internal.config.sysui.SystemUiSystemPropertiesFlags.NotificationFlags.WAKE_LOCK_FOR_POSTING_NOTIFICATION; import static com.android.internal.util.FrameworkStatsLog.DND_MODE_RULE; import static com.android.internal.util.FrameworkStatsLog.PACKAGE_NOTIFICATION_CHANNEL_GROUP_PREFERENCES; import static com.android.internal.util.FrameworkStatsLog.PACKAGE_NOTIFICATION_CHANNEL_PREFERENCES; Loading Loading @@ -533,6 +532,8 @@ public class NotificationManagerService extends SystemService { @EnabledAfter(targetSdkVersion = Build.VERSION_CODES.S_V2) private static final long NOTIFICATION_LOG_ASSISTANT_CANCEL = 195579280L; private static final Duration POST_WAKE_LOCK_TIMEOUT = Duration.ofSeconds(30); private IActivityManager mAm; private ActivityTaskManagerInternal mAtm; private ActivityManager mActivityManager; Loading Loading @@ -6676,22 +6677,14 @@ public class NotificationManagerService extends SystemService { } private PostNotificationTracker acquireWakeLockForPost(String pkg, int uid) { if (mFlagResolver.isEnabled(WAKE_LOCK_FOR_POSTING_NOTIFICATION) && Binder.withCleanCallingIdentity( () -> DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_SYSTEMUI, SystemUiDeviceConfigFlags.NOTIFY_WAKELOCK, false))) { // The package probably doesn't have WAKE_LOCK permission and should not require it. return Binder.withCleanCallingIdentity(() -> { WakeLock wakeLock = mPowerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "NotificationManagerService:post:" + pkg); wakeLock.setWorkSource(new WorkSource(uid, pkg)); // TODO(b/275044361): Adjust to a more reasonable number when we have the data. wakeLock.acquire(30_000); wakeLock.acquire(POST_WAKE_LOCK_TIMEOUT.toMillis()); return mPostNotificationTrackerFactory.newTracker(wakeLock); }); } else { return mPostNotificationTrackerFactory.newTracker(null); } } /** Loading
services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java +0 −33 Original line number Diff line number Diff line Loading @@ -83,7 +83,6 @@ import static android.view.WindowManager.LayoutParams.TYPE_TOAST; import static com.android.internal.config.sysui.SystemUiSystemPropertiesFlags.NotificationFlags.FSI_FORCE_DEMOTE; import static com.android.internal.config.sysui.SystemUiSystemPropertiesFlags.NotificationFlags.SHOW_STICKY_HUN_FOR_DENIED_FSI; import static com.android.internal.config.sysui.SystemUiSystemPropertiesFlags.NotificationFlags.WAKE_LOCK_FOR_POSTING_NOTIFICATION; import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.STRONG_AUTH_REQUIRED_AFTER_USER_LOCKDOWN; import static com.android.server.am.PendingIntentRecord.FLAG_ACTIVITY_SENDER; import static com.android.server.am.PendingIntentRecord.FLAG_BROADCAST_SENDER; Loading Loading @@ -128,7 +127,6 @@ import static org.mockito.Mockito.timeout; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyNoMoreInteractions; import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.when; import static java.util.Collections.emptyList; Loading Loading @@ -596,9 +594,6 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { mAcquiredWakeLocks.add(wl); return wl; }); mTestFlagResolver.setFlagOverride(WAKE_LOCK_FOR_POSTING_NOTIFICATION, true); DeviceConfig.setProperty(DeviceConfig.NAMESPACE_SYSTEMUI, SystemUiDeviceConfigFlags.NOTIFY_WAKELOCK, "true", false); // apps allowed as convos mService.setStringArrayResourceValue(PKG_O); Loading Loading @@ -1963,34 +1958,6 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { inOrder.verifyNoMoreInteractions(); } @Test public void enqueueNotification_wakeLockSystemPropertyOff_noWakeLock() throws Exception { mTestFlagResolver.setFlagOverride(WAKE_LOCK_FOR_POSTING_NOTIFICATION, false); DeviceConfig.setProperty(DeviceConfig.NAMESPACE_SYSTEMUI, SystemUiDeviceConfigFlags.NOTIFY_WAKELOCK, "true", false); mBinderService.enqueueNotificationWithTag(PKG, PKG, "enqueueNotification_setsWakeLockWorkSource", 0, generateNotificationRecord(null).getNotification(), 0); waitForIdle(); verifyZeroInteractions(mPowerManager); } @Test public void enqueueNotification_wakeLockDeviceConfigOff_noWakeLock() throws Exception { mTestFlagResolver.setFlagOverride(WAKE_LOCK_FOR_POSTING_NOTIFICATION, true); DeviceConfig.setProperty(DeviceConfig.NAMESPACE_SYSTEMUI, SystemUiDeviceConfigFlags.NOTIFY_WAKELOCK, "false", false); mBinderService.enqueueNotificationWithTag(PKG, PKG, "enqueueNotification_setsWakeLockWorkSource", 0, generateNotificationRecord(null).getNotification(), 0); waitForIdle(); verifyZeroInteractions(mPowerManager); } @Test public void testCancelNonexistentNotification() throws Exception { mBinderService.cancelNotificationWithTag(PKG, PKG, Loading