Loading packages/SystemUI/src/com/android/systemui/dagger/SystemUIDefaultModule.java +10 −2 Original line number Diff line number Diff line Loading @@ -64,6 +64,7 @@ import com.android.systemui.statusbar.policy.ConfigurationController; import com.android.systemui.statusbar.policy.DeviceProvisionedController; import com.android.systemui.statusbar.policy.DeviceProvisionedControllerImpl; import com.android.systemui.statusbar.policy.HeadsUpManager; import com.android.systemui.statusbar.policy.HeadsUpManagerLogger; import com.android.systemui.statusbar.policy.IndividualSensorPrivacyController; import com.android.systemui.statusbar.policy.IndividualSensorPrivacyControllerImpl; import com.android.systemui.statusbar.policy.SensorPrivacyController; Loading Loading @@ -169,12 +170,19 @@ public abstract class SystemUIDefaultModule { @Provides static HeadsUpManagerPhone provideHeadsUpManagerPhone( Context context, HeadsUpManagerLogger headsUpManagerLogger, StatusBarStateController statusBarStateController, KeyguardBypassController bypassController, GroupMembershipManager groupManager, ConfigurationController configurationController) { return new HeadsUpManagerPhone(context, statusBarStateController, bypassController, groupManager, configurationController); return new HeadsUpManagerPhone( context, headsUpManagerLogger, statusBarStateController, bypassController, groupManager, configurationController ); } @Binds Loading packages/SystemUI/src/com/android/systemui/log/dagger/LogModule.java +8 −0 Original line number Diff line number Diff line Loading @@ -52,6 +52,14 @@ public class LogModule { return factory.create("NotifLog", 1000); } /** Provides a logging buffer for all logs related to the data layer of notifications. */ @Provides @SysUISingleton @NotificationHeadsUpLog public static LogBuffer provideNotificationHeadsUpLogBuffer(LogBufferFactory factory) { return factory.create("NotifHeadsUpLog", 1000); } /** Provides a logging buffer for all logs related to managing notification sections. */ @Provides @SysUISingleton Loading packages/SystemUI/src/com/android/systemui/log/dagger/NotificationHeadsUpLog.java 0 → 100644 +33 −0 Original line number Diff line number Diff line /* * Copyright (C) 2020 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.systemui.log.dagger; import static java.lang.annotation.RetentionPolicy.RUNTIME; import com.android.systemui.log.LogBuffer; import java.lang.annotation.Documented; import java.lang.annotation.Retention; import javax.inject.Qualifier; /** A {@link LogBuffer} for heads up notification-related messages. */ @Qualifier @Documented @Retention(RUNTIME) public @interface NotificationHeadsUpLog { } packages/SystemUI/src/com/android/systemui/statusbar/AlertingNotificationManager.java +11 −17 Original line number Diff line number Diff line Loading @@ -23,12 +23,12 @@ import android.os.Looper; import android.os.SystemClock; import android.util.ArrayMap; import android.util.ArraySet; import android.util.Log; import android.view.accessibility.AccessibilityEvent; import com.android.internal.annotations.VisibleForTesting; import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.row.NotificationRowContentBinder.InflationFlag; import com.android.systemui.statusbar.policy.HeadsUpManagerLogger; import java.util.stream.Stream; Loading @@ -41,6 +41,11 @@ public abstract class AlertingNotificationManager implements NotificationLifetim private static final String TAG = "AlertNotifManager"; protected final Clock mClock = new Clock(); protected final ArrayMap<String, AlertEntry> mAlertEntries = new ArrayMap<>(); protected final HeadsUpManagerLogger mLogger; public AlertingNotificationManager(HeadsUpManagerLogger logger) { mLogger = logger; } /** * This is the list of entries that have already been removed from the Loading @@ -61,9 +66,7 @@ public abstract class AlertingNotificationManager implements NotificationLifetim * @param entry entry to show */ public void showNotification(@NonNull NotificationEntry entry) { if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "showNotification"); } mLogger.logShowNotification(entry.getKey()); addAlertEntry(entry); updateNotification(entry.getKey(), true /* alert */); entry.setInterruption(); Loading @@ -77,9 +80,7 @@ public abstract class AlertingNotificationManager implements NotificationLifetim * @return true if notification is removed, false otherwise */ public boolean removeNotification(@NonNull String key, boolean releaseImmediately) { if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "removeNotification"); } mLogger.logRemoveNotification(key, releaseImmediately); AlertEntry alertEntry = mAlertEntries.get(key); if (alertEntry == null) { return true; Loading @@ -100,11 +101,8 @@ public abstract class AlertingNotificationManager implements NotificationLifetim * removal time */ public void updateNotification(@NonNull String key, boolean alert) { if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "updateNotification"); } AlertEntry alertEntry = mAlertEntries.get(key); mLogger.logUpdateNotification(key, alert, alertEntry != null); if (alertEntry == null) { // the entry was released before this update (i.e by a listener) This can happen // with the groupmanager Loading @@ -121,9 +119,7 @@ public abstract class AlertingNotificationManager implements NotificationLifetim * Clears all managed notifications. */ public void releaseAllImmediately() { if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "releaseAllImmediately"); } mLogger.logReleaseAllImmediately(); // A copy is necessary here as we are changing the underlying map. This would cause // undefined behavior if we iterated over the key set directly. ArraySet<String> keysToRemove = new ArraySet<>(mAlertEntries.keySet()); Loading Loading @@ -300,9 +296,7 @@ public abstract class AlertingNotificationManager implements NotificationLifetim * @param updatePostTime whether or not to refresh the post time */ public void updateEntry(boolean updatePostTime) { if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "updateEntry"); } mLogger.logUpdateEntry(updatePostTime); long currentTime = mClock.currentTimeMillis(); mEarliestRemovaltime = currentTime + mMinimumDisplayTime; Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhone.java +3 −1 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ import com.android.systemui.statusbar.notification.collection.render.GroupMember import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; import com.android.systemui.statusbar.policy.ConfigurationController; import com.android.systemui.statusbar.policy.HeadsUpManager; import com.android.systemui.statusbar.policy.HeadsUpManagerLogger; import com.android.systemui.statusbar.policy.OnHeadsUpChangedListener; import java.io.FileDescriptor; Loading Loading @@ -101,11 +102,12 @@ public class HeadsUpManagerPhone extends HeadsUpManager implements Dumpable, // Constructor: public HeadsUpManagerPhone(@NonNull final Context context, HeadsUpManagerLogger logger, StatusBarStateController statusBarStateController, KeyguardBypassController bypassController, GroupMembershipManager groupMembershipManager, ConfigurationController configurationController) { super(context); super(context, logger); Resources resources = mContext.getResources(); mExtensionTime = resources.getInteger(R.integer.ambient_notification_extension_time); mAutoHeadsUpNotificationDecay = resources.getInteger( Loading Loading
packages/SystemUI/src/com/android/systemui/dagger/SystemUIDefaultModule.java +10 −2 Original line number Diff line number Diff line Loading @@ -64,6 +64,7 @@ import com.android.systemui.statusbar.policy.ConfigurationController; import com.android.systemui.statusbar.policy.DeviceProvisionedController; import com.android.systemui.statusbar.policy.DeviceProvisionedControllerImpl; import com.android.systemui.statusbar.policy.HeadsUpManager; import com.android.systemui.statusbar.policy.HeadsUpManagerLogger; import com.android.systemui.statusbar.policy.IndividualSensorPrivacyController; import com.android.systemui.statusbar.policy.IndividualSensorPrivacyControllerImpl; import com.android.systemui.statusbar.policy.SensorPrivacyController; Loading Loading @@ -169,12 +170,19 @@ public abstract class SystemUIDefaultModule { @Provides static HeadsUpManagerPhone provideHeadsUpManagerPhone( Context context, HeadsUpManagerLogger headsUpManagerLogger, StatusBarStateController statusBarStateController, KeyguardBypassController bypassController, GroupMembershipManager groupManager, ConfigurationController configurationController) { return new HeadsUpManagerPhone(context, statusBarStateController, bypassController, groupManager, configurationController); return new HeadsUpManagerPhone( context, headsUpManagerLogger, statusBarStateController, bypassController, groupManager, configurationController ); } @Binds Loading
packages/SystemUI/src/com/android/systemui/log/dagger/LogModule.java +8 −0 Original line number Diff line number Diff line Loading @@ -52,6 +52,14 @@ public class LogModule { return factory.create("NotifLog", 1000); } /** Provides a logging buffer for all logs related to the data layer of notifications. */ @Provides @SysUISingleton @NotificationHeadsUpLog public static LogBuffer provideNotificationHeadsUpLogBuffer(LogBufferFactory factory) { return factory.create("NotifHeadsUpLog", 1000); } /** Provides a logging buffer for all logs related to managing notification sections. */ @Provides @SysUISingleton Loading
packages/SystemUI/src/com/android/systemui/log/dagger/NotificationHeadsUpLog.java 0 → 100644 +33 −0 Original line number Diff line number Diff line /* * Copyright (C) 2020 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.systemui.log.dagger; import static java.lang.annotation.RetentionPolicy.RUNTIME; import com.android.systemui.log.LogBuffer; import java.lang.annotation.Documented; import java.lang.annotation.Retention; import javax.inject.Qualifier; /** A {@link LogBuffer} for heads up notification-related messages. */ @Qualifier @Documented @Retention(RUNTIME) public @interface NotificationHeadsUpLog { }
packages/SystemUI/src/com/android/systemui/statusbar/AlertingNotificationManager.java +11 −17 Original line number Diff line number Diff line Loading @@ -23,12 +23,12 @@ import android.os.Looper; import android.os.SystemClock; import android.util.ArrayMap; import android.util.ArraySet; import android.util.Log; import android.view.accessibility.AccessibilityEvent; import com.android.internal.annotations.VisibleForTesting; import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.row.NotificationRowContentBinder.InflationFlag; import com.android.systemui.statusbar.policy.HeadsUpManagerLogger; import java.util.stream.Stream; Loading @@ -41,6 +41,11 @@ public abstract class AlertingNotificationManager implements NotificationLifetim private static final String TAG = "AlertNotifManager"; protected final Clock mClock = new Clock(); protected final ArrayMap<String, AlertEntry> mAlertEntries = new ArrayMap<>(); protected final HeadsUpManagerLogger mLogger; public AlertingNotificationManager(HeadsUpManagerLogger logger) { mLogger = logger; } /** * This is the list of entries that have already been removed from the Loading @@ -61,9 +66,7 @@ public abstract class AlertingNotificationManager implements NotificationLifetim * @param entry entry to show */ public void showNotification(@NonNull NotificationEntry entry) { if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "showNotification"); } mLogger.logShowNotification(entry.getKey()); addAlertEntry(entry); updateNotification(entry.getKey(), true /* alert */); entry.setInterruption(); Loading @@ -77,9 +80,7 @@ public abstract class AlertingNotificationManager implements NotificationLifetim * @return true if notification is removed, false otherwise */ public boolean removeNotification(@NonNull String key, boolean releaseImmediately) { if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "removeNotification"); } mLogger.logRemoveNotification(key, releaseImmediately); AlertEntry alertEntry = mAlertEntries.get(key); if (alertEntry == null) { return true; Loading @@ -100,11 +101,8 @@ public abstract class AlertingNotificationManager implements NotificationLifetim * removal time */ public void updateNotification(@NonNull String key, boolean alert) { if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "updateNotification"); } AlertEntry alertEntry = mAlertEntries.get(key); mLogger.logUpdateNotification(key, alert, alertEntry != null); if (alertEntry == null) { // the entry was released before this update (i.e by a listener) This can happen // with the groupmanager Loading @@ -121,9 +119,7 @@ public abstract class AlertingNotificationManager implements NotificationLifetim * Clears all managed notifications. */ public void releaseAllImmediately() { if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "releaseAllImmediately"); } mLogger.logReleaseAllImmediately(); // A copy is necessary here as we are changing the underlying map. This would cause // undefined behavior if we iterated over the key set directly. ArraySet<String> keysToRemove = new ArraySet<>(mAlertEntries.keySet()); Loading Loading @@ -300,9 +296,7 @@ public abstract class AlertingNotificationManager implements NotificationLifetim * @param updatePostTime whether or not to refresh the post time */ public void updateEntry(boolean updatePostTime) { if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "updateEntry"); } mLogger.logUpdateEntry(updatePostTime); long currentTime = mClock.currentTimeMillis(); mEarliestRemovaltime = currentTime + mMinimumDisplayTime; Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhone.java +3 −1 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ import com.android.systemui.statusbar.notification.collection.render.GroupMember import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; import com.android.systemui.statusbar.policy.ConfigurationController; import com.android.systemui.statusbar.policy.HeadsUpManager; import com.android.systemui.statusbar.policy.HeadsUpManagerLogger; import com.android.systemui.statusbar.policy.OnHeadsUpChangedListener; import java.io.FileDescriptor; Loading Loading @@ -101,11 +102,12 @@ public class HeadsUpManagerPhone extends HeadsUpManager implements Dumpable, // Constructor: public HeadsUpManagerPhone(@NonNull final Context context, HeadsUpManagerLogger logger, StatusBarStateController statusBarStateController, KeyguardBypassController bypassController, GroupMembershipManager groupMembershipManager, ConfigurationController configurationController) { super(context); super(context, logger); Resources resources = mContext.getResources(); mExtensionTime = resources.getInteger(R.integer.ambient_notification_extension_time); mAutoHeadsUpNotificationDecay = resources.getInteger( Loading