Loading core/java/android/provider/Settings.java +12 −0 Original line number Diff line number Diff line Loading @@ -8275,6 +8275,16 @@ public final class Settings { private static final Validator FACE_UNLOCK_DISMISSES_KEYGUARD_VALIDATOR = BOOLEAN_VALIDATOR; /** * Whether or not media is shown automatically when bypassing as a heads up. * @hide */ public static final String SHOW_MEDIA_WHEN_BYPASSING = "show_media_when_bypassing"; private static final Validator SHOW_MEDIA_WHEN_BYPASSING_VALIDATOR = BOOLEAN_VALIDATOR; /** * Whether or not face unlock requires attention. This is a cached value, the source of * truth is obtained through the HAL. Loading Loading @@ -8974,6 +8984,7 @@ public final class Settings { NFC_PAYMENT_DEFAULT_COMPONENT, AUTOMATIC_STORAGE_MANAGER_DAYS_TO_RETAIN, FACE_UNLOCK_KEYGUARD_ENABLED, SHOW_MEDIA_WHEN_BYPASSING, FACE_UNLOCK_DISMISSES_KEYGUARD, FACE_UNLOCK_APP_ENABLED, FACE_UNLOCK_ALWAYS_REQUIRE_CONFIRMATION, Loading Loading @@ -9150,6 +9161,7 @@ public final class Settings { VALIDATORS.put(FACE_UNLOCK_KEYGUARD_ENABLED, FACE_UNLOCK_KEYGUARD_ENABLED_VALIDATOR); VALIDATORS.put(FACE_UNLOCK_DISMISSES_KEYGUARD, FACE_UNLOCK_DISMISSES_KEYGUARD_VALIDATOR); VALIDATORS.put(SHOW_MEDIA_WHEN_BYPASSING, SHOW_MEDIA_WHEN_BYPASSING_VALIDATOR); VALIDATORS.put(FACE_UNLOCK_APP_ENABLED, FACE_UNLOCK_APP_ENABLED_VALIDATOR); VALIDATORS.put(FACE_UNLOCK_ALWAYS_REQUIRE_CONFIRMATION, FACE_UNLOCK_ALWAYS_REQUIRE_CONFIRMATION_VALIDATOR); Loading packages/SystemUI/res/values/config.xml +3 −0 Original line number Diff line number Diff line Loading @@ -141,6 +141,9 @@ <!-- The number of milliseconds before the heads up notification auto-dismisses. --> <integer name="heads_up_notification_decay">5000</integer> <!-- The number of milliseconds before the heads up notification sent automatically by the system auto-dismisses. --> <integer name="auto_heads_up_notification_decay">3000</integer> <!-- The number of milliseconds after a heads up notification is pushed back before the app can interrupt again. --> <integer name="heads_up_default_snooze_length_ms">60000</integer> Loading packages/SystemUI/src/com/android/systemui/keyguard/KeyguardSliceProvider.java +10 −12 Original line number Diff line number Diff line Loading @@ -52,6 +52,7 @@ import com.android.keyguard.KeyguardUpdateMonitorCallback; import com.android.systemui.R; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.statusbar.NotificationMediaManager; import com.android.systemui.statusbar.phone.DozeParameters; import com.android.systemui.statusbar.phone.KeyguardBypassController; import com.android.systemui.statusbar.policy.NextAlarmController; import com.android.systemui.statusbar.policy.NextAlarmControllerImpl; Loading Loading @@ -103,8 +104,8 @@ public class KeyguardSliceProvider extends SliceProvider implements private final Date mCurrentTime = new Date(); private final Handler mHandler; private final AlarmManager.OnAlarmListener mUpdateNextAlarm = this::updateNextAlarm; private final HashSet<Integer> mMediaInvisibleStates; private final Object mMediaToken = new Object(); private DozeParameters mDozeParameters; @VisibleForTesting protected SettableWakeLock mMediaWakeLock; @VisibleForTesting Loading Loading @@ -184,11 +185,6 @@ public class KeyguardSliceProvider extends SliceProvider implements mAlarmUri = Uri.parse(KEYGUARD_NEXT_ALARM_URI); mDndUri = Uri.parse(KEYGUARD_DND_URI); mMediaUri = Uri.parse(KEYGUARD_MEDIA_URI); mMediaInvisibleStates = new HashSet<>(); mMediaInvisibleStates.add(PlaybackState.STATE_NONE); mMediaInvisibleStates.add(PlaybackState.STATE_STOPPED); mMediaInvisibleStates.add(PlaybackState.STATE_PAUSED); } /** Loading @@ -201,12 +197,14 @@ public class KeyguardSliceProvider extends SliceProvider implements public void initDependencies( NotificationMediaManager mediaManager, StatusBarStateController statusBarStateController, KeyguardBypassController keyguardBypassController) { KeyguardBypassController keyguardBypassController, DozeParameters dozeParameters) { mMediaManager = mediaManager; mMediaManager.addCallback(this); mStatusBarStateController = statusBarStateController; mStatusBarStateController.addCallback(this); mKeyguardBypassController = keyguardBypassController; mDozeParameters = dozeParameters; } @AnyThread Loading @@ -231,9 +229,9 @@ public class KeyguardSliceProvider extends SliceProvider implements } protected boolean needsMediaLocked() { boolean isBypass = mKeyguardBypassController != null && mKeyguardBypassController.getBypassEnabled(); return !TextUtils.isEmpty(mMediaTitle) && mMediaIsVisible && (mDozing || isBypass); boolean keepWhenAwake = mKeyguardBypassController != null && mKeyguardBypassController.getBypassEnabled() && mDozeParameters.getAlwaysOn(); return !TextUtils.isEmpty(mMediaTitle) && mMediaIsVisible && (mDozing || keepWhenAwake); } protected void addMediaLocked(ListBuilder listBuilder) { Loading Loading @@ -458,7 +456,7 @@ public class KeyguardSliceProvider extends SliceProvider implements @Override public void onMetadataOrStateChanged(MediaMetadata metadata, @PlaybackState.State int state) { synchronized (this) { boolean nextVisible = !mMediaInvisibleStates.contains(state); boolean nextVisible = NotificationMediaManager.isPlayingState(state); mHandler.removeCallbacksAndMessages(mMediaToken); if (mMediaIsVisible && !nextVisible) { // We need to delay this event for a few millis when stopping to avoid jank in the Loading @@ -477,7 +475,7 @@ public class KeyguardSliceProvider extends SliceProvider implements } private void updateMediaStateLocked(MediaMetadata metadata, @PlaybackState.State int state) { boolean nextVisible = !mMediaInvisibleStates.contains(state); boolean nextVisible = NotificationMediaManager.isPlayingState(state); CharSequence title = null; if (metadata != null) { title = metadata.getText(MediaMetadata.METADATA_KEY_TITLE); Loading packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java +13 −0 Original line number Diff line number Diff line Loading @@ -69,6 +69,7 @@ import java.io.FileDescriptor; import java.io.PrintWriter; import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; Loading @@ -91,6 +92,14 @@ public class NotificationMediaManager implements Dumpable { private final SysuiColorExtractor mColorExtractor = Dependency.get(SysuiColorExtractor.class); private final KeyguardMonitor mKeyguardMonitor = Dependency.get(KeyguardMonitor.class); private final KeyguardBypassController mKeyguardBypassController; private static final HashSet<Integer> PAUSED_MEDIA_STATES = new HashSet<>(); static { PAUSED_MEDIA_STATES.add(PlaybackState.STATE_NONE); PAUSED_MEDIA_STATES.add(PlaybackState.STATE_STOPPED); PAUSED_MEDIA_STATES.add(PlaybackState.STATE_PAUSED); PAUSED_MEDIA_STATES.add(PlaybackState.STATE_ERROR); } // Late binding private NotificationEntryManager mEntryManager; Loading Loading @@ -207,6 +216,10 @@ public class NotificationMediaManager implements Dumpable { mPropertiesChangedListener); } public static boolean isPlayingState(int state) { return !PAUSED_MEDIA_STATES.contains(state); } public void setUpWithPresenter(NotificationPresenter presenter) { mPresenter = presenter; } Loading packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java +15 −2 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.systemui.statusbar; import static com.android.systemui.Interpolators.FAST_OUT_SLOW_IN_REVERSE; import static com.android.systemui.statusbar.phone.NotificationIconContainer.IconState.NO_VALUE; import static com.android.systemui.util.InjectionInflationController.VIEW_CONTEXT; import android.content.Context; import android.content.res.Configuration; Loading Loading @@ -48,8 +49,12 @@ import com.android.systemui.statusbar.notification.stack.AnimationProperties; import com.android.systemui.statusbar.notification.stack.ExpandableViewState; import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout; import com.android.systemui.statusbar.notification.stack.ViewState; import com.android.systemui.statusbar.phone.KeyguardBypassController; import com.android.systemui.statusbar.phone.NotificationIconContainer; import javax.inject.Inject; import javax.inject.Named; /** * A notification shelf view that is placed inside the notification scroller. It manages the * overflow icons that don't fit into the regular list anymore. Loading @@ -63,6 +68,7 @@ public class NotificationShelf extends ActivatableNotificationView implements = SystemProperties.getBoolean("debug.icon_scroll_animations", true); private static final int TAG_CONTINUOUS_CLIPPING = R.id.continuous_clipping_tag; private static final String TAG = "NotificationShelf"; private final KeyguardBypassController mBypassController; private NotificationIconContainer mShelfIcons; private int[] mTmp = new int[2]; Loading Loading @@ -93,8 +99,12 @@ public class NotificationShelf extends ActivatableNotificationView implements private int mCutoutHeight; private int mGapHeight; public NotificationShelf(Context context, AttributeSet attrs) { @Inject public NotificationShelf(@Named(VIEW_CONTEXT) Context context, AttributeSet attrs, KeyguardBypassController keyguardBypassController) { super(context, attrs); mBypassController = keyguardBypassController; } @Override Loading Loading @@ -309,7 +319,10 @@ public class NotificationShelf extends ActivatableNotificationView implements colorTwoBefore = previousColor; transitionAmount = inShelfAmount; } if (isLastChild) { // We don't want to modify the color if the notification is hun'd boolean canModifyColor = mAmbientState.isShadeExpanded() && !(mAmbientState.isOnKeyguard() && mBypassController.getBypassEnabled()); if (isLastChild && canModifyColor) { if (colorOfViewBeforeLast == NO_COLOR) { colorOfViewBeforeLast = ownColorUntinted; } Loading Loading
core/java/android/provider/Settings.java +12 −0 Original line number Diff line number Diff line Loading @@ -8275,6 +8275,16 @@ public final class Settings { private static final Validator FACE_UNLOCK_DISMISSES_KEYGUARD_VALIDATOR = BOOLEAN_VALIDATOR; /** * Whether or not media is shown automatically when bypassing as a heads up. * @hide */ public static final String SHOW_MEDIA_WHEN_BYPASSING = "show_media_when_bypassing"; private static final Validator SHOW_MEDIA_WHEN_BYPASSING_VALIDATOR = BOOLEAN_VALIDATOR; /** * Whether or not face unlock requires attention. This is a cached value, the source of * truth is obtained through the HAL. Loading Loading @@ -8974,6 +8984,7 @@ public final class Settings { NFC_PAYMENT_DEFAULT_COMPONENT, AUTOMATIC_STORAGE_MANAGER_DAYS_TO_RETAIN, FACE_UNLOCK_KEYGUARD_ENABLED, SHOW_MEDIA_WHEN_BYPASSING, FACE_UNLOCK_DISMISSES_KEYGUARD, FACE_UNLOCK_APP_ENABLED, FACE_UNLOCK_ALWAYS_REQUIRE_CONFIRMATION, Loading Loading @@ -9150,6 +9161,7 @@ public final class Settings { VALIDATORS.put(FACE_UNLOCK_KEYGUARD_ENABLED, FACE_UNLOCK_KEYGUARD_ENABLED_VALIDATOR); VALIDATORS.put(FACE_UNLOCK_DISMISSES_KEYGUARD, FACE_UNLOCK_DISMISSES_KEYGUARD_VALIDATOR); VALIDATORS.put(SHOW_MEDIA_WHEN_BYPASSING, SHOW_MEDIA_WHEN_BYPASSING_VALIDATOR); VALIDATORS.put(FACE_UNLOCK_APP_ENABLED, FACE_UNLOCK_APP_ENABLED_VALIDATOR); VALIDATORS.put(FACE_UNLOCK_ALWAYS_REQUIRE_CONFIRMATION, FACE_UNLOCK_ALWAYS_REQUIRE_CONFIRMATION_VALIDATOR); Loading
packages/SystemUI/res/values/config.xml +3 −0 Original line number Diff line number Diff line Loading @@ -141,6 +141,9 @@ <!-- The number of milliseconds before the heads up notification auto-dismisses. --> <integer name="heads_up_notification_decay">5000</integer> <!-- The number of milliseconds before the heads up notification sent automatically by the system auto-dismisses. --> <integer name="auto_heads_up_notification_decay">3000</integer> <!-- The number of milliseconds after a heads up notification is pushed back before the app can interrupt again. --> <integer name="heads_up_default_snooze_length_ms">60000</integer> Loading
packages/SystemUI/src/com/android/systemui/keyguard/KeyguardSliceProvider.java +10 −12 Original line number Diff line number Diff line Loading @@ -52,6 +52,7 @@ import com.android.keyguard.KeyguardUpdateMonitorCallback; import com.android.systemui.R; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.statusbar.NotificationMediaManager; import com.android.systemui.statusbar.phone.DozeParameters; import com.android.systemui.statusbar.phone.KeyguardBypassController; import com.android.systemui.statusbar.policy.NextAlarmController; import com.android.systemui.statusbar.policy.NextAlarmControllerImpl; Loading Loading @@ -103,8 +104,8 @@ public class KeyguardSliceProvider extends SliceProvider implements private final Date mCurrentTime = new Date(); private final Handler mHandler; private final AlarmManager.OnAlarmListener mUpdateNextAlarm = this::updateNextAlarm; private final HashSet<Integer> mMediaInvisibleStates; private final Object mMediaToken = new Object(); private DozeParameters mDozeParameters; @VisibleForTesting protected SettableWakeLock mMediaWakeLock; @VisibleForTesting Loading Loading @@ -184,11 +185,6 @@ public class KeyguardSliceProvider extends SliceProvider implements mAlarmUri = Uri.parse(KEYGUARD_NEXT_ALARM_URI); mDndUri = Uri.parse(KEYGUARD_DND_URI); mMediaUri = Uri.parse(KEYGUARD_MEDIA_URI); mMediaInvisibleStates = new HashSet<>(); mMediaInvisibleStates.add(PlaybackState.STATE_NONE); mMediaInvisibleStates.add(PlaybackState.STATE_STOPPED); mMediaInvisibleStates.add(PlaybackState.STATE_PAUSED); } /** Loading @@ -201,12 +197,14 @@ public class KeyguardSliceProvider extends SliceProvider implements public void initDependencies( NotificationMediaManager mediaManager, StatusBarStateController statusBarStateController, KeyguardBypassController keyguardBypassController) { KeyguardBypassController keyguardBypassController, DozeParameters dozeParameters) { mMediaManager = mediaManager; mMediaManager.addCallback(this); mStatusBarStateController = statusBarStateController; mStatusBarStateController.addCallback(this); mKeyguardBypassController = keyguardBypassController; mDozeParameters = dozeParameters; } @AnyThread Loading @@ -231,9 +229,9 @@ public class KeyguardSliceProvider extends SliceProvider implements } protected boolean needsMediaLocked() { boolean isBypass = mKeyguardBypassController != null && mKeyguardBypassController.getBypassEnabled(); return !TextUtils.isEmpty(mMediaTitle) && mMediaIsVisible && (mDozing || isBypass); boolean keepWhenAwake = mKeyguardBypassController != null && mKeyguardBypassController.getBypassEnabled() && mDozeParameters.getAlwaysOn(); return !TextUtils.isEmpty(mMediaTitle) && mMediaIsVisible && (mDozing || keepWhenAwake); } protected void addMediaLocked(ListBuilder listBuilder) { Loading Loading @@ -458,7 +456,7 @@ public class KeyguardSliceProvider extends SliceProvider implements @Override public void onMetadataOrStateChanged(MediaMetadata metadata, @PlaybackState.State int state) { synchronized (this) { boolean nextVisible = !mMediaInvisibleStates.contains(state); boolean nextVisible = NotificationMediaManager.isPlayingState(state); mHandler.removeCallbacksAndMessages(mMediaToken); if (mMediaIsVisible && !nextVisible) { // We need to delay this event for a few millis when stopping to avoid jank in the Loading @@ -477,7 +475,7 @@ public class KeyguardSliceProvider extends SliceProvider implements } private void updateMediaStateLocked(MediaMetadata metadata, @PlaybackState.State int state) { boolean nextVisible = !mMediaInvisibleStates.contains(state); boolean nextVisible = NotificationMediaManager.isPlayingState(state); CharSequence title = null; if (metadata != null) { title = metadata.getText(MediaMetadata.METADATA_KEY_TITLE); Loading
packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java +13 −0 Original line number Diff line number Diff line Loading @@ -69,6 +69,7 @@ import java.io.FileDescriptor; import java.io.PrintWriter; import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; Loading @@ -91,6 +92,14 @@ public class NotificationMediaManager implements Dumpable { private final SysuiColorExtractor mColorExtractor = Dependency.get(SysuiColorExtractor.class); private final KeyguardMonitor mKeyguardMonitor = Dependency.get(KeyguardMonitor.class); private final KeyguardBypassController mKeyguardBypassController; private static final HashSet<Integer> PAUSED_MEDIA_STATES = new HashSet<>(); static { PAUSED_MEDIA_STATES.add(PlaybackState.STATE_NONE); PAUSED_MEDIA_STATES.add(PlaybackState.STATE_STOPPED); PAUSED_MEDIA_STATES.add(PlaybackState.STATE_PAUSED); PAUSED_MEDIA_STATES.add(PlaybackState.STATE_ERROR); } // Late binding private NotificationEntryManager mEntryManager; Loading Loading @@ -207,6 +216,10 @@ public class NotificationMediaManager implements Dumpable { mPropertiesChangedListener); } public static boolean isPlayingState(int state) { return !PAUSED_MEDIA_STATES.contains(state); } public void setUpWithPresenter(NotificationPresenter presenter) { mPresenter = presenter; } Loading
packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java +15 −2 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.systemui.statusbar; import static com.android.systemui.Interpolators.FAST_OUT_SLOW_IN_REVERSE; import static com.android.systemui.statusbar.phone.NotificationIconContainer.IconState.NO_VALUE; import static com.android.systemui.util.InjectionInflationController.VIEW_CONTEXT; import android.content.Context; import android.content.res.Configuration; Loading Loading @@ -48,8 +49,12 @@ import com.android.systemui.statusbar.notification.stack.AnimationProperties; import com.android.systemui.statusbar.notification.stack.ExpandableViewState; import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout; import com.android.systemui.statusbar.notification.stack.ViewState; import com.android.systemui.statusbar.phone.KeyguardBypassController; import com.android.systemui.statusbar.phone.NotificationIconContainer; import javax.inject.Inject; import javax.inject.Named; /** * A notification shelf view that is placed inside the notification scroller. It manages the * overflow icons that don't fit into the regular list anymore. Loading @@ -63,6 +68,7 @@ public class NotificationShelf extends ActivatableNotificationView implements = SystemProperties.getBoolean("debug.icon_scroll_animations", true); private static final int TAG_CONTINUOUS_CLIPPING = R.id.continuous_clipping_tag; private static final String TAG = "NotificationShelf"; private final KeyguardBypassController mBypassController; private NotificationIconContainer mShelfIcons; private int[] mTmp = new int[2]; Loading Loading @@ -93,8 +99,12 @@ public class NotificationShelf extends ActivatableNotificationView implements private int mCutoutHeight; private int mGapHeight; public NotificationShelf(Context context, AttributeSet attrs) { @Inject public NotificationShelf(@Named(VIEW_CONTEXT) Context context, AttributeSet attrs, KeyguardBypassController keyguardBypassController) { super(context, attrs); mBypassController = keyguardBypassController; } @Override Loading Loading @@ -309,7 +319,10 @@ public class NotificationShelf extends ActivatableNotificationView implements colorTwoBefore = previousColor; transitionAmount = inShelfAmount; } if (isLastChild) { // We don't want to modify the color if the notification is hun'd boolean canModifyColor = mAmbientState.isShadeExpanded() && !(mAmbientState.isOnKeyguard() && mBypassController.getBypassEnabled()); if (isLastChild && canModifyColor) { if (colorOfViewBeforeLast == NO_COLOR) { colorOfViewBeforeLast = ownColorUntinted; } Loading