Loading packages/SystemUI/res/layout/super_status_bar.xml +1 −9 Original line number Diff line number Diff line Loading @@ -44,7 +44,7 @@ </com.android.systemui.statusbar.BackDropView> <com.android.systemui.statusbar.ScrimView android:id="@+id/scrim_for_bubble" android:id="@+id/scrim_behind" android:layout_width="match_parent" android:layout_height="match_parent" android:importantForAccessibility="no" Loading @@ -56,14 +56,6 @@ android:layout_width="match_parent" android:layout_height="wrap_content" /> <com.android.systemui.statusbar.ScrimView android:id="@+id/scrim_behind" android:layout_width="match_parent" android:layout_height="match_parent" android:importantForAccessibility="no" sysui:ignoreRightInset="true" /> <include layout="@layout/status_bar_expanded" android:layout_width="match_parent" android:layout_height="match_parent" Loading packages/SystemUI/src/com/android/systemui/ForegroundServiceLifetimeExtender.java 0 → 100644 +90 −0 Original line number Diff line number Diff line /* * Copyright (C) 2019 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; import android.annotation.NonNull; import android.app.Notification; import android.os.Handler; import android.os.Looper; import android.util.ArraySet; import com.android.internal.annotations.VisibleForTesting; import com.android.systemui.statusbar.NotificationLifetimeExtender; import com.android.systemui.statusbar.notification.collection.NotificationEntry; /** * Extends the lifetime of foreground notification services such that they show for at least * five seconds */ public class ForegroundServiceLifetimeExtender implements NotificationLifetimeExtender { private static final String TAG = "FGSLifetimeExtender"; @VisibleForTesting static final int MIN_FGS_TIME_MS = 5000; private NotificationSafeToRemoveCallback mNotificationSafeToRemoveCallback; private ArraySet<NotificationEntry> mManagedEntries = new ArraySet<>(); private Handler mHandler = new Handler(Looper.getMainLooper()); public ForegroundServiceLifetimeExtender() { } @Override public void setCallback(@NonNull NotificationSafeToRemoveCallback callback) { mNotificationSafeToRemoveCallback = callback; } @Override public boolean shouldExtendLifetime(@NonNull NotificationEntry entry) { if ((entry.notification.getNotification().flags & Notification.FLAG_FOREGROUND_SERVICE) == 0) { return false; } long currentTime = System.currentTimeMillis(); return currentTime - entry.notification.getPostTime() < MIN_FGS_TIME_MS; } @Override public boolean shouldExtendLifetimeForPendingNotification( @NonNull NotificationEntry entry) { return shouldExtendLifetime(entry); } @Override public void setShouldManageLifetime( @NonNull NotificationEntry entry, boolean shouldManage) { if (!shouldManage) { mManagedEntries.remove(entry); return; } mManagedEntries.add(entry); Runnable r = () -> { if (mManagedEntries.contains(entry)) { mManagedEntries.remove(entry); if (mNotificationSafeToRemoveCallback != null) { mNotificationSafeToRemoveCallback.onSafeToRemove(entry.key); } } }; long delayAmt = MIN_FGS_TIME_MS - (System.currentTimeMillis() - entry.notification.getPostTime()); mHandler.postDelayed(r, delayAmt); } } packages/SystemUI/src/com/android/systemui/ForegroundServiceNotificationListener.java +3 −0 Original line number Diff line number Diff line Loading @@ -66,6 +66,9 @@ public class ForegroundServiceNotificationListener { removeNotification(entry.notification); } }); notificationEntryManager.addNotificationLifetimeExtender( new ForegroundServiceLifetimeExtender()); } /** Loading packages/SystemUI/src/com/android/systemui/SystemUIFactory.java +1 −2 Original line number Diff line number Diff line Loading @@ -123,12 +123,11 @@ public class SystemUIFactory { } public ScrimController createScrimController(ScrimView scrimBehind, ScrimView scrimInFront, ScrimView scrimForBubble, LockscreenWallpaper lockscreenWallpaper, TriConsumer<ScrimState, Float, GradientColors> scrimStateListener, Consumer<Integer> scrimVisibleListener, DozeParameters dozeParameters, AlarmManager alarmManager, KeyguardMonitor keyguardMonitor) { return new ScrimController(scrimBehind, scrimInFront, scrimForBubble, scrimStateListener, return new ScrimController(scrimBehind, scrimInFront, scrimStateListener, scrimVisibleListener, dozeParameters, alarmManager, keyguardMonitor); } Loading packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java +4 −3 Original line number Diff line number Diff line Loading @@ -316,9 +316,10 @@ public class BubbleController implements ConfigurationController.ConfigurationLi if (mStackView == null) { mStackView = new BubbleStackView(mContext, mBubbleData, mSurfaceSynchronizer); ViewGroup sbv = mStatusBarWindowController.getStatusBarView(); int bubbleScrimIndex = sbv.indexOfChild(sbv.findViewById(R.id.scrim_for_bubble)); int stackIndex = bubbleScrimIndex + 1; // Show stack above bubble scrim. sbv.addView(mStackView, stackIndex, // TODO(b/130237686): When you expand the shade on top of expanded bubble, there is no // scrim between bubble and the shade int bubblePosition = sbv.indexOfChild(sbv.findViewById(R.id.scrim_behind)) + 1; sbv.addView(mStackView, bubblePosition, new FrameLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT)); if (mExpandListener != null) { mStackView.setExpandListener(mExpandListener); Loading Loading
packages/SystemUI/res/layout/super_status_bar.xml +1 −9 Original line number Diff line number Diff line Loading @@ -44,7 +44,7 @@ </com.android.systemui.statusbar.BackDropView> <com.android.systemui.statusbar.ScrimView android:id="@+id/scrim_for_bubble" android:id="@+id/scrim_behind" android:layout_width="match_parent" android:layout_height="match_parent" android:importantForAccessibility="no" Loading @@ -56,14 +56,6 @@ android:layout_width="match_parent" android:layout_height="wrap_content" /> <com.android.systemui.statusbar.ScrimView android:id="@+id/scrim_behind" android:layout_width="match_parent" android:layout_height="match_parent" android:importantForAccessibility="no" sysui:ignoreRightInset="true" /> <include layout="@layout/status_bar_expanded" android:layout_width="match_parent" android:layout_height="match_parent" Loading
packages/SystemUI/src/com/android/systemui/ForegroundServiceLifetimeExtender.java 0 → 100644 +90 −0 Original line number Diff line number Diff line /* * Copyright (C) 2019 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; import android.annotation.NonNull; import android.app.Notification; import android.os.Handler; import android.os.Looper; import android.util.ArraySet; import com.android.internal.annotations.VisibleForTesting; import com.android.systemui.statusbar.NotificationLifetimeExtender; import com.android.systemui.statusbar.notification.collection.NotificationEntry; /** * Extends the lifetime of foreground notification services such that they show for at least * five seconds */ public class ForegroundServiceLifetimeExtender implements NotificationLifetimeExtender { private static final String TAG = "FGSLifetimeExtender"; @VisibleForTesting static final int MIN_FGS_TIME_MS = 5000; private NotificationSafeToRemoveCallback mNotificationSafeToRemoveCallback; private ArraySet<NotificationEntry> mManagedEntries = new ArraySet<>(); private Handler mHandler = new Handler(Looper.getMainLooper()); public ForegroundServiceLifetimeExtender() { } @Override public void setCallback(@NonNull NotificationSafeToRemoveCallback callback) { mNotificationSafeToRemoveCallback = callback; } @Override public boolean shouldExtendLifetime(@NonNull NotificationEntry entry) { if ((entry.notification.getNotification().flags & Notification.FLAG_FOREGROUND_SERVICE) == 0) { return false; } long currentTime = System.currentTimeMillis(); return currentTime - entry.notification.getPostTime() < MIN_FGS_TIME_MS; } @Override public boolean shouldExtendLifetimeForPendingNotification( @NonNull NotificationEntry entry) { return shouldExtendLifetime(entry); } @Override public void setShouldManageLifetime( @NonNull NotificationEntry entry, boolean shouldManage) { if (!shouldManage) { mManagedEntries.remove(entry); return; } mManagedEntries.add(entry); Runnable r = () -> { if (mManagedEntries.contains(entry)) { mManagedEntries.remove(entry); if (mNotificationSafeToRemoveCallback != null) { mNotificationSafeToRemoveCallback.onSafeToRemove(entry.key); } } }; long delayAmt = MIN_FGS_TIME_MS - (System.currentTimeMillis() - entry.notification.getPostTime()); mHandler.postDelayed(r, delayAmt); } }
packages/SystemUI/src/com/android/systemui/ForegroundServiceNotificationListener.java +3 −0 Original line number Diff line number Diff line Loading @@ -66,6 +66,9 @@ public class ForegroundServiceNotificationListener { removeNotification(entry.notification); } }); notificationEntryManager.addNotificationLifetimeExtender( new ForegroundServiceLifetimeExtender()); } /** Loading
packages/SystemUI/src/com/android/systemui/SystemUIFactory.java +1 −2 Original line number Diff line number Diff line Loading @@ -123,12 +123,11 @@ public class SystemUIFactory { } public ScrimController createScrimController(ScrimView scrimBehind, ScrimView scrimInFront, ScrimView scrimForBubble, LockscreenWallpaper lockscreenWallpaper, TriConsumer<ScrimState, Float, GradientColors> scrimStateListener, Consumer<Integer> scrimVisibleListener, DozeParameters dozeParameters, AlarmManager alarmManager, KeyguardMonitor keyguardMonitor) { return new ScrimController(scrimBehind, scrimInFront, scrimForBubble, scrimStateListener, return new ScrimController(scrimBehind, scrimInFront, scrimStateListener, scrimVisibleListener, dozeParameters, alarmManager, keyguardMonitor); } Loading
packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java +4 −3 Original line number Diff line number Diff line Loading @@ -316,9 +316,10 @@ public class BubbleController implements ConfigurationController.ConfigurationLi if (mStackView == null) { mStackView = new BubbleStackView(mContext, mBubbleData, mSurfaceSynchronizer); ViewGroup sbv = mStatusBarWindowController.getStatusBarView(); int bubbleScrimIndex = sbv.indexOfChild(sbv.findViewById(R.id.scrim_for_bubble)); int stackIndex = bubbleScrimIndex + 1; // Show stack above bubble scrim. sbv.addView(mStackView, stackIndex, // TODO(b/130237686): When you expand the shade on top of expanded bubble, there is no // scrim between bubble and the shade int bubblePosition = sbv.indexOfChild(sbv.findViewById(R.id.scrim_behind)) + 1; sbv.addView(mStackView, bubblePosition, new FrameLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT)); if (mExpandListener != null) { mStackView.setExpandListener(mExpandListener); Loading