Loading packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java +25 −1 Original line number Original line Diff line number Diff line Loading @@ -51,6 +51,7 @@ import com.android.settingslib.Utils; import com.android.systemui.Dependency; import com.android.systemui.Dependency; import com.android.systemui.Interpolators; import com.android.systemui.Interpolators; import com.android.systemui.R; import com.android.systemui.R; import com.android.systemui.statusbar.StatusBarStateController.StateListener; import com.android.systemui.statusbar.phone.KeyguardIndicationTextView; import com.android.systemui.statusbar.phone.KeyguardIndicationTextView; import com.android.systemui.statusbar.phone.LockIcon; import com.android.systemui.statusbar.phone.LockIcon; import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager; import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager; Loading @@ -66,7 +67,7 @@ import java.util.IllegalFormatConversionException; /** /** * Controls the indications and error messages shown on the Keyguard * Controls the indications and error messages shown on the Keyguard */ */ public class KeyguardIndicationController { public class KeyguardIndicationController implements StateListener { private static final String TAG = "KeyguardIndication"; private static final String TAG = "KeyguardIndication"; private static final boolean DEBUG_CHARGING_SPEED = false; private static final boolean DEBUG_CHARGING_SPEED = false; Loading Loading @@ -154,6 +155,19 @@ public class KeyguardIndicationController { mContext.registerReceiverAsUser(mTickReceiver, UserHandle.SYSTEM, mContext.registerReceiverAsUser(mTickReceiver, UserHandle.SYSTEM, new IntentFilter(Intent.ACTION_TIME_TICK), null, new IntentFilter(Intent.ACTION_TIME_TICK), null, Dependency.get(Dependency.TIME_TICK_HANDLER)); Dependency.get(Dependency.TIME_TICK_HANDLER)); Dependency.get(StatusBarStateController.class).addListener(this); } /** * Used by {@link com.android.systemui.statusbar.phone.StatusBar} to give the indication * controller a chance to unregister itself as a receiver. * * //TODO: This can probably be converted to a fragment and not have to be manually recreated */ public void destroy() { mContext.unregisterReceiver(mTickReceiver); Dependency.get(StatusBarStateController.class).removeListener(this); } } /** /** Loading Loading @@ -518,6 +532,16 @@ public class KeyguardIndicationController { updateAlphas(); updateAlphas(); } } @Override public void onStateChanged(int newState) { // don't care } @Override public void onDozingChanged(boolean isDozing) { setDozing(isDozing); } protected class BaseKeyguardCallback extends KeyguardUpdateMonitorCallback { protected class BaseKeyguardCallback extends KeyguardUpdateMonitorCallback { public static final int HIDE_DELAY_MS = 5000; public static final int HIDE_DELAY_MS = 5000; private int mLastSuccessiveErrorMessage = -1; private int mLastSuccessiveErrorMessage = -1; Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/logging/NotificationLogger.java +18 −4 Original line number Original line Diff line number Diff line Loading @@ -29,9 +29,11 @@ import com.android.internal.statusbar.IStatusBarService; import com.android.internal.statusbar.NotificationVisibility; import com.android.internal.statusbar.NotificationVisibility; import com.android.systemui.Dependency; import com.android.systemui.Dependency; import com.android.systemui.UiOffloadThread; import com.android.systemui.UiOffloadThread; import com.android.systemui.statusbar.notification.NotificationEntryManager; import com.android.systemui.statusbar.NotificationListener; import com.android.systemui.statusbar.NotificationListener; import com.android.systemui.statusbar.StatusBarStateController; import com.android.systemui.statusbar.StatusBarStateController.StateListener; import com.android.systemui.statusbar.notification.NotificationData; import com.android.systemui.statusbar.notification.NotificationData; import com.android.systemui.statusbar.notification.NotificationEntryManager; import com.android.systemui.statusbar.notification.stack.NotificationListContainer; import com.android.systemui.statusbar.notification.stack.NotificationListContainer; import java.util.ArrayList; import java.util.ArrayList; Loading @@ -42,7 +44,7 @@ import java.util.Collections; * Handles notification logging, in particular, logging which notifications are visible and which * Handles notification logging, in particular, logging which notifications are visible and which * are not. * are not. */ */ public class NotificationLogger { public class NotificationLogger implements StateListener { private static final String TAG = "NotificationLogger"; private static final String TAG = "NotificationLogger"; /** The minimum delay in ms between reports of notification visibility. */ /** The minimum delay in ms between reports of notification visibility. */ Loading @@ -63,7 +65,7 @@ public class NotificationLogger { protected IStatusBarService mBarService; protected IStatusBarService mBarService; private long mLastVisibilityReportUptimeMs; private long mLastVisibilityReportUptimeMs; private NotificationListContainer mListContainer; private NotificationListContainer mListContainer; private Object mDozingLock = new Object(); private final Object mDozingLock = new Object(); private boolean mDozing; private boolean mDozing; protected final OnChildLocationsChangedListener mNotificationLocationsChangedListener = protected final OnChildLocationsChangedListener mNotificationLocationsChangedListener = Loading Loading @@ -146,6 +148,8 @@ public class NotificationLogger { public NotificationLogger() { public NotificationLogger() { mBarService = IStatusBarService.Stub.asInterface( mBarService = IStatusBarService.Stub.asInterface( ServiceManager.getService(Context.STATUS_BAR_SERVICE)); ServiceManager.getService(Context.STATUS_BAR_SERVICE)); // Not expected to be destroyed, don't need to unsubscribe Dependency.get(StatusBarStateController.class).addListener(this); } } public void setUpWithContainer(NotificationListContainer listContainer) { public void setUpWithContainer(NotificationListContainer listContainer) { Loading Loading @@ -175,7 +179,7 @@ public class NotificationLogger { mNotificationLocationsChangedListener.onChildLocationsChanged(); mNotificationLocationsChangedListener.onChildLocationsChanged(); } } public void setDozing(boolean dozing) { private void setDozing(boolean dozing) { synchronized (mDozingLock) { synchronized (mDozingLock) { mDozing = dozing; mDozing = dozing; } } Loading Loading @@ -258,6 +262,16 @@ public class NotificationLogger { return mVisibilityReporter; return mVisibilityReporter; } } @Override public void onStateChanged(int newState) { // don't care about state change } @Override public void onDozingChanged(boolean isDozing) { setDozing(isDozing); } /** /** * A listener that is notified when some child locations might have changed. * A listener that is notified when some child locations might have changed. */ */ Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeScrimController.java +18 −1 Original line number Original line Diff line number Diff line Loading @@ -20,13 +20,17 @@ import android.annotation.NonNull; import android.os.Handler; import android.os.Handler; import android.util.Log; import android.util.Log; import com.android.internal.annotations.VisibleForTesting; import com.android.systemui.Dependency; import com.android.systemui.doze.DozeHost; import com.android.systemui.doze.DozeHost; import com.android.systemui.doze.DozeLog; import com.android.systemui.doze.DozeLog; import com.android.systemui.statusbar.StatusBarStateController; import com.android.systemui.statusbar.StatusBarStateController.StateListener; /** /** * Controller which handles all the doze animations of the scrims. * Controller which handles all the doze animations of the scrims. */ */ public class DozeScrimController { public class DozeScrimController implements StateListener { private static final String TAG = "DozeScrimController"; private static final String TAG = "DozeScrimController"; private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG); private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG); Loading Loading @@ -83,8 +87,11 @@ public class DozeScrimController { public DozeScrimController(DozeParameters dozeParameters) { public DozeScrimController(DozeParameters dozeParameters) { mDozeParameters = dozeParameters; mDozeParameters = dozeParameters; //Never expected to be destroyed Dependency.get(StatusBarStateController.class).addListener(this); } } @VisibleForTesting public void setDozing(boolean dozing) { public void setDozing(boolean dozing) { if (mDozing == dozing) return; if (mDozing == dozing) return; mDozing = dozing; mDozing = dozing; Loading Loading @@ -181,4 +188,14 @@ public class DozeScrimController { public ScrimController.Callback getScrimCallback() { public ScrimController.Callback getScrimCallback() { return mScrimCallback; return mScrimCallback; } } @Override public void onStateChanged(int newState) { // don't care } @Override public void onDozingChanged(boolean isDozing) { setDozing(isDozing); } } } No newline at end of file packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationGroupManager.java +19 −8 Original line number Original line Diff line number Diff line Loading @@ -16,22 +16,24 @@ package com.android.systemui.statusbar.phone; package com.android.systemui.statusbar.phone; import android.annotation.NonNull; import android.app.Notification; import android.app.Notification; import android.os.SystemClock; import android.os.SystemClock; import android.service.notification.StatusBarNotification; import android.service.notification.StatusBarNotification; import androidx.annotation.Nullable; import android.util.Log; import android.util.Log; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.android.internal.annotations.VisibleForTesting; import com.android.systemui.Dependency; import com.android.systemui.Dependency; import com.android.systemui.statusbar.AlertingNotificationManager; import com.android.systemui.statusbar.AlertingNotificationManager; import com.android.systemui.statusbar.AmbientPulseManager; import com.android.systemui.statusbar.AmbientPulseManager; import com.android.systemui.statusbar.AmbientPulseManager.OnAmbientChangedListener; import com.android.systemui.statusbar.AmbientPulseManager.OnAmbientChangedListener; import com.android.systemui.statusbar.StatusBarState; import com.android.systemui.statusbar.StatusBarState; import com.android.systemui.statusbar.StatusBarStateController; import com.android.systemui.statusbar.StatusBarStateController.StateListener; import com.android.systemui.statusbar.StatusBarStateController.StateListener; import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; import com.android.systemui.statusbar.notification.NotificationData; import com.android.systemui.statusbar.notification.NotificationData; import com.android.systemui.statusbar.StatusBarStateController; import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; import com.android.systemui.statusbar.policy.HeadsUpManager; import com.android.systemui.statusbar.policy.HeadsUpManager; import com.android.systemui.statusbar.policy.OnHeadsUpChangedListener; import com.android.systemui.statusbar.policy.OnHeadsUpChangedListener; Loading @@ -48,7 +50,7 @@ import java.util.Objects; * A class to handle notifications and their corresponding groups. * A class to handle notifications and their corresponding groups. */ */ public class NotificationGroupManager implements OnHeadsUpChangedListener, public class NotificationGroupManager implements OnHeadsUpChangedListener, OnAmbientChangedListener { OnAmbientChangedListener, StateListener { private static final String TAG = "NotificationGroupManager"; private static final String TAG = "NotificationGroupManager"; private static final long ALERT_TRANSFER_TIMEOUT = 300; private static final long ALERT_TRANSFER_TIMEOUT = 300; Loading @@ -62,10 +64,8 @@ public class NotificationGroupManager implements OnHeadsUpChangedListener, private boolean mIsUpdatingUnchangedGroup; private boolean mIsUpdatingUnchangedGroup; private HashMap<String, NotificationData.Entry> mPendingNotifications; private HashMap<String, NotificationData.Entry> mPendingNotifications; private final StateListener mStateListener = this::setStatusBarState; public NotificationGroupManager() { public NotificationGroupManager() { Dependency.get(StatusBarStateController.class).addListener(mStateListener); Dependency.get(StatusBarStateController.class).addListener(this); } } public void setOnGroupChangeListener(OnGroupChangeListener listener) { public void setOnGroupChangeListener(OnGroupChangeListener listener) { Loading Loading @@ -185,6 +185,7 @@ public class NotificationGroupManager implements OnHeadsUpChangedListener, * specific alert state logic based off when the state changes. * specific alert state logic based off when the state changes. * @param isDozing if the device is dozing. * @param isDozing if the device is dozing. */ */ @VisibleForTesting public void setDozing(boolean isDozing) { public void setDozing(boolean isDozing) { if (mIsDozing != isDozing) { if (mIsDozing != isDozing) { for (NotificationGroup group : mGroupMap.values()) { for (NotificationGroup group : mGroupMap.values()) { Loading Loading @@ -732,6 +733,16 @@ public class NotificationGroupManager implements OnHeadsUpChangedListener, mPendingNotifications = pendingNotifications; mPendingNotifications = pendingNotifications; } } @Override public void onStateChanged(int newState) { setStatusBarState(newState); } @Override public void onDozingChanged(boolean isDozing) { setDozing(isDozing); } public static class NotificationGroup { public static class NotificationGroup { public final HashMap<String, NotificationData.Entry> children = new HashMap<>(); public final HashMap<String, NotificationData.Entry> children = new HashMap<>(); public NotificationData.Entry summary; public NotificationData.Entry summary; Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +3 −13 Original line number Original line Diff line number Diff line Loading @@ -586,7 +586,6 @@ public class StatusBar extends SystemUI implements DemoMode, mNotificationLogger = Dependency.get(NotificationLogger.class); mNotificationLogger = Dependency.get(NotificationLogger.class); mRemoteInputManager = Dependency.get(NotificationRemoteInputManager.class); mRemoteInputManager = Dependency.get(NotificationRemoteInputManager.class); mNotificationListener = Dependency.get(NotificationListener.class); mNotificationListener = Dependency.get(NotificationListener.class); mGroupManager = Dependency.get(NotificationGroupManager.class); mNetworkController = Dependency.get(NetworkController.class); mNetworkController = Dependency.get(NetworkController.class); mUserSwitcherController = Dependency.get(UserSwitcherController.class); mUserSwitcherController = Dependency.get(UserSwitcherController.class); mScreenLifecycle = Dependency.get(ScreenLifecycle.class); mScreenLifecycle = Dependency.get(ScreenLifecycle.class); Loading Loading @@ -1096,6 +1095,9 @@ public class StatusBar extends SystemUI implements DemoMode, @Override @Override public void onThemeChanged() { public void onThemeChanged() { // Recreate Indication controller because internal references changed // Recreate Indication controller because internal references changed if (mKeyguardIndicationController != null) { mKeyguardIndicationController.destroy(); } mKeyguardIndicationController = mKeyguardIndicationController = SystemUIFactory.getInstance().createKeyguardIndicationController(mContext, SystemUIFactory.getInstance().createKeyguardIndicationController(mContext, mStatusBarWindow.findViewById(R.id.keyguard_indication_area), mStatusBarWindow.findViewById(R.id.keyguard_indication_area), Loading @@ -1104,7 +1106,6 @@ public class StatusBar extends SystemUI implements DemoMode, mKeyguardIndicationController mKeyguardIndicationController .setStatusBarKeyguardViewManager(mStatusBarKeyguardViewManager); .setStatusBarKeyguardViewManager(mStatusBarKeyguardViewManager); mKeyguardIndicationController.setVisible(mState == StatusBarState.KEYGUARD); mKeyguardIndicationController.setVisible(mState == StatusBarState.KEYGUARD); mKeyguardIndicationController.setDozing(mDozing); if (mStatusBarKeyguardViewManager != null) { if (mStatusBarKeyguardViewManager != null) { mStatusBarKeyguardViewManager.onThemeChanged(); mStatusBarKeyguardViewManager.onThemeChanged(); } } Loading Loading @@ -3247,12 +3248,8 @@ public class StatusBar extends SystemUI implements DemoMode, boolean animate = (!mDozing && mDozeServiceHost.shouldAnimateWakeup()) boolean animate = (!mDozing && mDozeServiceHost.shouldAnimateWakeup()) || (mDozing && mDozeServiceHost.shouldAnimateScreenOff() && sleepingFromKeyguard); || (mDozing && mDozeServiceHost.shouldAnimateScreenOff() && sleepingFromKeyguard); mDozeScrimController.setDozing(mDozing); mKeyguardIndicationController.setDozing(mDozing); mNotificationPanel.setDozing(mDozing, animate, mWakeUpTouchLocation, mNotificationPanel.setDozing(mDozing, animate, mWakeUpTouchLocation, mDozeServiceHost.wasPassivelyInterrupted()); mDozeServiceHost.wasPassivelyInterrupted()); mNotificationLogger.setDozing(mDozing); mGroupManager.setDozing(mDozing); updateQsExpansionEnabled(); updateQsExpansionEnabled(); Trace.endSection(); Trace.endSection(); } } Loading Loading @@ -3442,13 +3439,6 @@ public class StatusBar extends SystemUI implements DemoMode, updateQsExpansionEnabled(); updateQsExpansionEnabled(); mKeyguardViewMediator.setAodShowing(mDozing); mKeyguardViewMediator.setAodShowing(mDozing); //TODO: make these folks listeners of StatusBarStateController.onDozingChanged mStatusBarWindowController.setDozing(mDozing); mStatusBarKeyguardViewManager.setDozing(mDozing); if (mAmbientIndicationContainer instanceof DozeReceiver) { ((DozeReceiver) mAmbientIndicationContainer).setDozing(mDozing); } mEntryManager.updateNotifications(); mEntryManager.updateNotifications(); updateDozingState(); updateDozingState(); updateScrimController(); updateScrimController(); Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java +25 −1 Original line number Original line Diff line number Diff line Loading @@ -51,6 +51,7 @@ import com.android.settingslib.Utils; import com.android.systemui.Dependency; import com.android.systemui.Dependency; import com.android.systemui.Interpolators; import com.android.systemui.Interpolators; import com.android.systemui.R; import com.android.systemui.R; import com.android.systemui.statusbar.StatusBarStateController.StateListener; import com.android.systemui.statusbar.phone.KeyguardIndicationTextView; import com.android.systemui.statusbar.phone.KeyguardIndicationTextView; import com.android.systemui.statusbar.phone.LockIcon; import com.android.systemui.statusbar.phone.LockIcon; import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager; import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager; Loading @@ -66,7 +67,7 @@ import java.util.IllegalFormatConversionException; /** /** * Controls the indications and error messages shown on the Keyguard * Controls the indications and error messages shown on the Keyguard */ */ public class KeyguardIndicationController { public class KeyguardIndicationController implements StateListener { private static final String TAG = "KeyguardIndication"; private static final String TAG = "KeyguardIndication"; private static final boolean DEBUG_CHARGING_SPEED = false; private static final boolean DEBUG_CHARGING_SPEED = false; Loading Loading @@ -154,6 +155,19 @@ public class KeyguardIndicationController { mContext.registerReceiverAsUser(mTickReceiver, UserHandle.SYSTEM, mContext.registerReceiverAsUser(mTickReceiver, UserHandle.SYSTEM, new IntentFilter(Intent.ACTION_TIME_TICK), null, new IntentFilter(Intent.ACTION_TIME_TICK), null, Dependency.get(Dependency.TIME_TICK_HANDLER)); Dependency.get(Dependency.TIME_TICK_HANDLER)); Dependency.get(StatusBarStateController.class).addListener(this); } /** * Used by {@link com.android.systemui.statusbar.phone.StatusBar} to give the indication * controller a chance to unregister itself as a receiver. * * //TODO: This can probably be converted to a fragment and not have to be manually recreated */ public void destroy() { mContext.unregisterReceiver(mTickReceiver); Dependency.get(StatusBarStateController.class).removeListener(this); } } /** /** Loading Loading @@ -518,6 +532,16 @@ public class KeyguardIndicationController { updateAlphas(); updateAlphas(); } } @Override public void onStateChanged(int newState) { // don't care } @Override public void onDozingChanged(boolean isDozing) { setDozing(isDozing); } protected class BaseKeyguardCallback extends KeyguardUpdateMonitorCallback { protected class BaseKeyguardCallback extends KeyguardUpdateMonitorCallback { public static final int HIDE_DELAY_MS = 5000; public static final int HIDE_DELAY_MS = 5000; private int mLastSuccessiveErrorMessage = -1; private int mLastSuccessiveErrorMessage = -1; Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/logging/NotificationLogger.java +18 −4 Original line number Original line Diff line number Diff line Loading @@ -29,9 +29,11 @@ import com.android.internal.statusbar.IStatusBarService; import com.android.internal.statusbar.NotificationVisibility; import com.android.internal.statusbar.NotificationVisibility; import com.android.systemui.Dependency; import com.android.systemui.Dependency; import com.android.systemui.UiOffloadThread; import com.android.systemui.UiOffloadThread; import com.android.systemui.statusbar.notification.NotificationEntryManager; import com.android.systemui.statusbar.NotificationListener; import com.android.systemui.statusbar.NotificationListener; import com.android.systemui.statusbar.StatusBarStateController; import com.android.systemui.statusbar.StatusBarStateController.StateListener; import com.android.systemui.statusbar.notification.NotificationData; import com.android.systemui.statusbar.notification.NotificationData; import com.android.systemui.statusbar.notification.NotificationEntryManager; import com.android.systemui.statusbar.notification.stack.NotificationListContainer; import com.android.systemui.statusbar.notification.stack.NotificationListContainer; import java.util.ArrayList; import java.util.ArrayList; Loading @@ -42,7 +44,7 @@ import java.util.Collections; * Handles notification logging, in particular, logging which notifications are visible and which * Handles notification logging, in particular, logging which notifications are visible and which * are not. * are not. */ */ public class NotificationLogger { public class NotificationLogger implements StateListener { private static final String TAG = "NotificationLogger"; private static final String TAG = "NotificationLogger"; /** The minimum delay in ms between reports of notification visibility. */ /** The minimum delay in ms between reports of notification visibility. */ Loading @@ -63,7 +65,7 @@ public class NotificationLogger { protected IStatusBarService mBarService; protected IStatusBarService mBarService; private long mLastVisibilityReportUptimeMs; private long mLastVisibilityReportUptimeMs; private NotificationListContainer mListContainer; private NotificationListContainer mListContainer; private Object mDozingLock = new Object(); private final Object mDozingLock = new Object(); private boolean mDozing; private boolean mDozing; protected final OnChildLocationsChangedListener mNotificationLocationsChangedListener = protected final OnChildLocationsChangedListener mNotificationLocationsChangedListener = Loading Loading @@ -146,6 +148,8 @@ public class NotificationLogger { public NotificationLogger() { public NotificationLogger() { mBarService = IStatusBarService.Stub.asInterface( mBarService = IStatusBarService.Stub.asInterface( ServiceManager.getService(Context.STATUS_BAR_SERVICE)); ServiceManager.getService(Context.STATUS_BAR_SERVICE)); // Not expected to be destroyed, don't need to unsubscribe Dependency.get(StatusBarStateController.class).addListener(this); } } public void setUpWithContainer(NotificationListContainer listContainer) { public void setUpWithContainer(NotificationListContainer listContainer) { Loading Loading @@ -175,7 +179,7 @@ public class NotificationLogger { mNotificationLocationsChangedListener.onChildLocationsChanged(); mNotificationLocationsChangedListener.onChildLocationsChanged(); } } public void setDozing(boolean dozing) { private void setDozing(boolean dozing) { synchronized (mDozingLock) { synchronized (mDozingLock) { mDozing = dozing; mDozing = dozing; } } Loading Loading @@ -258,6 +262,16 @@ public class NotificationLogger { return mVisibilityReporter; return mVisibilityReporter; } } @Override public void onStateChanged(int newState) { // don't care about state change } @Override public void onDozingChanged(boolean isDozing) { setDozing(isDozing); } /** /** * A listener that is notified when some child locations might have changed. * A listener that is notified when some child locations might have changed. */ */ Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeScrimController.java +18 −1 Original line number Original line Diff line number Diff line Loading @@ -20,13 +20,17 @@ import android.annotation.NonNull; import android.os.Handler; import android.os.Handler; import android.util.Log; import android.util.Log; import com.android.internal.annotations.VisibleForTesting; import com.android.systemui.Dependency; import com.android.systemui.doze.DozeHost; import com.android.systemui.doze.DozeHost; import com.android.systemui.doze.DozeLog; import com.android.systemui.doze.DozeLog; import com.android.systemui.statusbar.StatusBarStateController; import com.android.systemui.statusbar.StatusBarStateController.StateListener; /** /** * Controller which handles all the doze animations of the scrims. * Controller which handles all the doze animations of the scrims. */ */ public class DozeScrimController { public class DozeScrimController implements StateListener { private static final String TAG = "DozeScrimController"; private static final String TAG = "DozeScrimController"; private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG); private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG); Loading Loading @@ -83,8 +87,11 @@ public class DozeScrimController { public DozeScrimController(DozeParameters dozeParameters) { public DozeScrimController(DozeParameters dozeParameters) { mDozeParameters = dozeParameters; mDozeParameters = dozeParameters; //Never expected to be destroyed Dependency.get(StatusBarStateController.class).addListener(this); } } @VisibleForTesting public void setDozing(boolean dozing) { public void setDozing(boolean dozing) { if (mDozing == dozing) return; if (mDozing == dozing) return; mDozing = dozing; mDozing = dozing; Loading Loading @@ -181,4 +188,14 @@ public class DozeScrimController { public ScrimController.Callback getScrimCallback() { public ScrimController.Callback getScrimCallback() { return mScrimCallback; return mScrimCallback; } } @Override public void onStateChanged(int newState) { // don't care } @Override public void onDozingChanged(boolean isDozing) { setDozing(isDozing); } } } No newline at end of file
packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationGroupManager.java +19 −8 Original line number Original line Diff line number Diff line Loading @@ -16,22 +16,24 @@ package com.android.systemui.statusbar.phone; package com.android.systemui.statusbar.phone; import android.annotation.NonNull; import android.app.Notification; import android.app.Notification; import android.os.SystemClock; import android.os.SystemClock; import android.service.notification.StatusBarNotification; import android.service.notification.StatusBarNotification; import androidx.annotation.Nullable; import android.util.Log; import android.util.Log; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.android.internal.annotations.VisibleForTesting; import com.android.systemui.Dependency; import com.android.systemui.Dependency; import com.android.systemui.statusbar.AlertingNotificationManager; import com.android.systemui.statusbar.AlertingNotificationManager; import com.android.systemui.statusbar.AmbientPulseManager; import com.android.systemui.statusbar.AmbientPulseManager; import com.android.systemui.statusbar.AmbientPulseManager.OnAmbientChangedListener; import com.android.systemui.statusbar.AmbientPulseManager.OnAmbientChangedListener; import com.android.systemui.statusbar.StatusBarState; import com.android.systemui.statusbar.StatusBarState; import com.android.systemui.statusbar.StatusBarStateController; import com.android.systemui.statusbar.StatusBarStateController.StateListener; import com.android.systemui.statusbar.StatusBarStateController.StateListener; import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; import com.android.systemui.statusbar.notification.NotificationData; import com.android.systemui.statusbar.notification.NotificationData; import com.android.systemui.statusbar.StatusBarStateController; import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; import com.android.systemui.statusbar.policy.HeadsUpManager; import com.android.systemui.statusbar.policy.HeadsUpManager; import com.android.systemui.statusbar.policy.OnHeadsUpChangedListener; import com.android.systemui.statusbar.policy.OnHeadsUpChangedListener; Loading @@ -48,7 +50,7 @@ import java.util.Objects; * A class to handle notifications and their corresponding groups. * A class to handle notifications and their corresponding groups. */ */ public class NotificationGroupManager implements OnHeadsUpChangedListener, public class NotificationGroupManager implements OnHeadsUpChangedListener, OnAmbientChangedListener { OnAmbientChangedListener, StateListener { private static final String TAG = "NotificationGroupManager"; private static final String TAG = "NotificationGroupManager"; private static final long ALERT_TRANSFER_TIMEOUT = 300; private static final long ALERT_TRANSFER_TIMEOUT = 300; Loading @@ -62,10 +64,8 @@ public class NotificationGroupManager implements OnHeadsUpChangedListener, private boolean mIsUpdatingUnchangedGroup; private boolean mIsUpdatingUnchangedGroup; private HashMap<String, NotificationData.Entry> mPendingNotifications; private HashMap<String, NotificationData.Entry> mPendingNotifications; private final StateListener mStateListener = this::setStatusBarState; public NotificationGroupManager() { public NotificationGroupManager() { Dependency.get(StatusBarStateController.class).addListener(mStateListener); Dependency.get(StatusBarStateController.class).addListener(this); } } public void setOnGroupChangeListener(OnGroupChangeListener listener) { public void setOnGroupChangeListener(OnGroupChangeListener listener) { Loading Loading @@ -185,6 +185,7 @@ public class NotificationGroupManager implements OnHeadsUpChangedListener, * specific alert state logic based off when the state changes. * specific alert state logic based off when the state changes. * @param isDozing if the device is dozing. * @param isDozing if the device is dozing. */ */ @VisibleForTesting public void setDozing(boolean isDozing) { public void setDozing(boolean isDozing) { if (mIsDozing != isDozing) { if (mIsDozing != isDozing) { for (NotificationGroup group : mGroupMap.values()) { for (NotificationGroup group : mGroupMap.values()) { Loading Loading @@ -732,6 +733,16 @@ public class NotificationGroupManager implements OnHeadsUpChangedListener, mPendingNotifications = pendingNotifications; mPendingNotifications = pendingNotifications; } } @Override public void onStateChanged(int newState) { setStatusBarState(newState); } @Override public void onDozingChanged(boolean isDozing) { setDozing(isDozing); } public static class NotificationGroup { public static class NotificationGroup { public final HashMap<String, NotificationData.Entry> children = new HashMap<>(); public final HashMap<String, NotificationData.Entry> children = new HashMap<>(); public NotificationData.Entry summary; public NotificationData.Entry summary; Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +3 −13 Original line number Original line Diff line number Diff line Loading @@ -586,7 +586,6 @@ public class StatusBar extends SystemUI implements DemoMode, mNotificationLogger = Dependency.get(NotificationLogger.class); mNotificationLogger = Dependency.get(NotificationLogger.class); mRemoteInputManager = Dependency.get(NotificationRemoteInputManager.class); mRemoteInputManager = Dependency.get(NotificationRemoteInputManager.class); mNotificationListener = Dependency.get(NotificationListener.class); mNotificationListener = Dependency.get(NotificationListener.class); mGroupManager = Dependency.get(NotificationGroupManager.class); mNetworkController = Dependency.get(NetworkController.class); mNetworkController = Dependency.get(NetworkController.class); mUserSwitcherController = Dependency.get(UserSwitcherController.class); mUserSwitcherController = Dependency.get(UserSwitcherController.class); mScreenLifecycle = Dependency.get(ScreenLifecycle.class); mScreenLifecycle = Dependency.get(ScreenLifecycle.class); Loading Loading @@ -1096,6 +1095,9 @@ public class StatusBar extends SystemUI implements DemoMode, @Override @Override public void onThemeChanged() { public void onThemeChanged() { // Recreate Indication controller because internal references changed // Recreate Indication controller because internal references changed if (mKeyguardIndicationController != null) { mKeyguardIndicationController.destroy(); } mKeyguardIndicationController = mKeyguardIndicationController = SystemUIFactory.getInstance().createKeyguardIndicationController(mContext, SystemUIFactory.getInstance().createKeyguardIndicationController(mContext, mStatusBarWindow.findViewById(R.id.keyguard_indication_area), mStatusBarWindow.findViewById(R.id.keyguard_indication_area), Loading @@ -1104,7 +1106,6 @@ public class StatusBar extends SystemUI implements DemoMode, mKeyguardIndicationController mKeyguardIndicationController .setStatusBarKeyguardViewManager(mStatusBarKeyguardViewManager); .setStatusBarKeyguardViewManager(mStatusBarKeyguardViewManager); mKeyguardIndicationController.setVisible(mState == StatusBarState.KEYGUARD); mKeyguardIndicationController.setVisible(mState == StatusBarState.KEYGUARD); mKeyguardIndicationController.setDozing(mDozing); if (mStatusBarKeyguardViewManager != null) { if (mStatusBarKeyguardViewManager != null) { mStatusBarKeyguardViewManager.onThemeChanged(); mStatusBarKeyguardViewManager.onThemeChanged(); } } Loading Loading @@ -3247,12 +3248,8 @@ public class StatusBar extends SystemUI implements DemoMode, boolean animate = (!mDozing && mDozeServiceHost.shouldAnimateWakeup()) boolean animate = (!mDozing && mDozeServiceHost.shouldAnimateWakeup()) || (mDozing && mDozeServiceHost.shouldAnimateScreenOff() && sleepingFromKeyguard); || (mDozing && mDozeServiceHost.shouldAnimateScreenOff() && sleepingFromKeyguard); mDozeScrimController.setDozing(mDozing); mKeyguardIndicationController.setDozing(mDozing); mNotificationPanel.setDozing(mDozing, animate, mWakeUpTouchLocation, mNotificationPanel.setDozing(mDozing, animate, mWakeUpTouchLocation, mDozeServiceHost.wasPassivelyInterrupted()); mDozeServiceHost.wasPassivelyInterrupted()); mNotificationLogger.setDozing(mDozing); mGroupManager.setDozing(mDozing); updateQsExpansionEnabled(); updateQsExpansionEnabled(); Trace.endSection(); Trace.endSection(); } } Loading Loading @@ -3442,13 +3439,6 @@ public class StatusBar extends SystemUI implements DemoMode, updateQsExpansionEnabled(); updateQsExpansionEnabled(); mKeyguardViewMediator.setAodShowing(mDozing); mKeyguardViewMediator.setAodShowing(mDozing); //TODO: make these folks listeners of StatusBarStateController.onDozingChanged mStatusBarWindowController.setDozing(mDozing); mStatusBarKeyguardViewManager.setDozing(mDozing); if (mAmbientIndicationContainer instanceof DozeReceiver) { ((DozeReceiver) mAmbientIndicationContainer).setDozing(mDozing); } mEntryManager.updateNotifications(); mEntryManager.updateNotifications(); updateDozingState(); updateDozingState(); updateScrimController(); updateScrimController(); Loading