Loading packages/SystemUI/src/com/android/systemui/bubbles/Bubble.java +0 −8 Original line number Diff line number Diff line Loading @@ -39,7 +39,6 @@ class Bubble { private final String mKey; private final String mGroupId; private String mAppName; private final BubbleExpandedView.OnBubbleBlockedListener mListener; private boolean mInflated; public NotificationEntry entry; Loading @@ -57,16 +56,10 @@ class Bubble { /** Used in tests when no UI is required. */ @VisibleForTesting(visibility = PRIVATE) Bubble(Context context, NotificationEntry e) { this (context, e, null); } Bubble(Context context, NotificationEntry e, BubbleExpandedView.OnBubbleBlockedListener listener) { entry = e; mKey = e.key; mLastUpdated = e.notification.getPostTime(); mGroupId = groupId(e); mListener = listener; mPm = context.getPackageManager(); ApplicationInfo info; Loading Loading @@ -122,7 +115,6 @@ class Bubble { expandedView = (BubbleExpandedView) inflater.inflate( R.layout.bubble_expanded_view, stackView, false /* attachToRoot */); expandedView.setEntry(entry, stackView, mAppName); expandedView.setOnBlockedListener(mListener); mInflated = true; } Loading packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java +0 −85 Original line number Diff line number Diff line Loading @@ -44,7 +44,6 @@ import static java.lang.annotation.RetentionPolicy.SOURCE; import android.app.ActivityManager; import android.app.ActivityManager.RunningTaskInfo; import android.app.Notification; import android.app.NotificationManager; import android.app.PendingIntent; import android.content.Context; Loading @@ -56,7 +55,6 @@ import android.os.RemoteException; import android.os.ServiceManager; import android.provider.Settings; import android.service.notification.NotificationListenerService.RankingMap; import android.service.notification.StatusBarNotification; import android.service.notification.ZenModeConfig; import android.util.Log; import android.util.Pair; Loading Loading @@ -122,21 +120,8 @@ public class BubbleController implements ConfigurationController.ConfigurationLi public static final int MAX_BUBBLES = 5; // TODO: actually enforce this // Enables some subset of notifs to automatically become bubbles public static final boolean DEBUG_ENABLE_AUTO_BUBBLE = false; /** Flag to enable or disable the entire feature */ private static final String ENABLE_BUBBLES = "experiment_enable_bubbles"; /** Auto bubble flags set whether different notif types should be presented as a bubble */ private static final String ENABLE_AUTO_BUBBLE_MESSAGES = "experiment_autobubble_messaging"; private static final String ENABLE_AUTO_BUBBLE_ONGOING = "experiment_autobubble_ongoing"; private static final String ENABLE_AUTO_BUBBLE_ALL = "experiment_autobubble_all"; /** Use an activityView for an auto-bubbled notifs if it has an appropriate content intent */ private static final String ENABLE_BUBBLE_CONTENT_INTENT = "experiment_bubble_content_intent"; private static final String BUBBLE_STIFFNESS = "experiment_bubble_stiffness"; private static final String BUBBLE_BOUNCINESS = "experiment_bubble_bounciness"; private final Context mContext; private final NotificationEntryManager mNotificationEntryManager; Loading Loading @@ -698,42 +683,6 @@ public class BubbleController implements ConfigurationController.ConfigurationLi return mStackView; } /** * Whether the notification should automatically bubble or not. Gated by secure settings flags. */ @VisibleForTesting protected boolean shouldAutoBubbleForFlags(Context context, NotificationEntry entry) { if (entry.isBubbleDismissed()) { return false; } StatusBarNotification n = entry.notification; boolean autoBubbleMessages = shouldAutoBubbleMessages(context) || DEBUG_ENABLE_AUTO_BUBBLE; boolean autoBubbleOngoing = shouldAutoBubbleOngoing(context) || DEBUG_ENABLE_AUTO_BUBBLE; boolean autoBubbleAll = shouldAutoBubbleAll(context) || DEBUG_ENABLE_AUTO_BUBBLE; boolean hasRemoteInput = false; if (n.getNotification().actions != null) { for (Notification.Action action : n.getNotification().actions) { if (action.getRemoteInputs() != null) { hasRemoteInput = true; break; } } } boolean isCall = Notification.CATEGORY_CALL.equals(n.getNotification().category) && n.isOngoing(); boolean isMusic = n.getNotification().hasMediaSession(); boolean isImportantOngoing = isMusic || isCall; Class<? extends Notification.Style> style = n.getNotification().getNotificationStyle(); boolean isMessageType = Notification.CATEGORY_MESSAGE.equals(n.getNotification().category); boolean isMessageStyle = Notification.MessagingStyle.class.equals(style); return (((isMessageType && hasRemoteInput) || isMessageStyle) && autoBubbleMessages) || (isImportantOngoing && autoBubbleOngoing) || autoBubbleAll; } private void updateShowInShadeForSuppressNotification(NotificationEntry entry) { boolean suppressNotification = entry.getBubbleMetadata() != null && entry.getBubbleMetadata().isNotificationSuppressed() Loading Loading @@ -816,45 +765,11 @@ public class BubbleController implements ConfigurationController.ConfigurationLi } } private static boolean shouldAutoBubbleMessages(Context context) { return Settings.Secure.getInt(context.getContentResolver(), ENABLE_AUTO_BUBBLE_MESSAGES, 0) != 0; } private static boolean shouldAutoBubbleOngoing(Context context) { return Settings.Secure.getInt(context.getContentResolver(), ENABLE_AUTO_BUBBLE_ONGOING, 0) != 0; } private static boolean shouldAutoBubbleAll(Context context) { return Settings.Secure.getInt(context.getContentResolver(), ENABLE_AUTO_BUBBLE_ALL, 0) != 0; } static boolean shouldUseContentIntent(Context context) { return Settings.Secure.getInt(context.getContentResolver(), ENABLE_BUBBLE_CONTENT_INTENT, 0) != 0; } private static boolean areBubblesEnabled(Context context) { return Settings.Secure.getInt(context.getContentResolver(), ENABLE_BUBBLES, 1) != 0; } /** Default stiffness to use for bubble physics animations. */ public static int getBubbleStiffness(Context context, int defaultStiffness) { return Settings.Secure.getInt( context.getContentResolver(), BUBBLE_STIFFNESS, defaultStiffness); } /** Default bounciness/damping ratio to use for bubble physics animations. */ public static float getBubbleBounciness(Context context, float defaultBounciness) { return Settings.Secure.getInt( context.getContentResolver(), BUBBLE_BOUNCINESS, (int) (defaultBounciness * 100)) / 100f; } /** * Whether an intent is properly configured to display in an {@link android.app.ActivityView}. * Loading packages/SystemUI/src/com/android/systemui/bubbles/BubbleData.java +1 −24 Original line number Diff line number Diff line Loading @@ -40,7 +40,6 @@ import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Objects; Loading Loading @@ -172,7 +171,7 @@ public class BubbleData { Bubble bubble = getBubbleWithKey(entry.key); if (bubble == null) { // Create a new bubble bubble = new Bubble(mContext, entry, this::onBubbleBlocked); bubble = new Bubble(mContext, entry); doAdd(bubble); trim(); } else { Loading Loading @@ -552,28 +551,6 @@ public class BubbleData { } } private void onBubbleBlocked(NotificationEntry entry) { final String blockedGroupId = Bubble.groupId(entry); int selectedIndex = mBubbles.indexOf(mSelectedBubble); for (Iterator<Bubble> i = mBubbles.iterator(); i.hasNext(); ) { Bubble bubble = i.next(); if (bubble.getGroupId().equals(blockedGroupId)) { mStateChange.bubbleRemoved(bubble, BubbleController.DISMISS_BLOCKED); i.remove(); } } if (mBubbles.isEmpty()) { setExpandedInternal(false); setSelectedBubbleInternal(null); } else if (!mBubbles.contains(mSelectedBubble)) { // choose a new one int newIndex = Math.min(selectedIndex, mBubbles.size() - 1); Bubble newSelected = mBubbles.get(newIndex); setSelectedBubbleInternal(newSelected); } dispatchPendingChanges(); } private int indexForKey(String key) { for (int i = 0; i < mBubbles.size(); i++) { Bubble bubble = mBubbles.get(i); Loading packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java +3 −99 Original line number Diff line number Diff line Loading @@ -18,14 +18,12 @@ package com.android.systemui.bubbles; import static android.view.Display.INVALID_DISPLAY; import static com.android.systemui.bubbles.BubbleController.DEBUG_ENABLE_AUTO_BUBBLE; import static com.android.systemui.bubbles.BubbleDebugConfig.TAG_BUBBLES; import static com.android.systemui.bubbles.BubbleDebugConfig.TAG_WITH_CLASS_NAME; import android.annotation.Nullable; import android.app.ActivityOptions; import android.app.ActivityView; import android.app.INotificationManager; import android.app.Notification; import android.app.PendingIntent; import android.content.Context; Loading @@ -39,7 +37,6 @@ import android.graphics.Insets; import android.graphics.Point; import android.graphics.drawable.Drawable; import android.graphics.drawable.ShapeDrawable; import android.os.ServiceManager; import android.os.UserHandle; import android.provider.Settings; import android.service.notification.StatusBarNotification; Loading @@ -47,7 +44,6 @@ import android.util.AttributeSet; import android.util.Log; import android.util.StatsLog; import android.view.View; import android.view.ViewGroup; import android.view.WindowInsets; import android.widget.LinearLayout; Loading @@ -57,8 +53,6 @@ import com.android.systemui.R; import com.android.systemui.recents.TriangleShape; import com.android.systemui.statusbar.AlphaOptimizedButton; import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; import com.android.systemui.statusbar.notification.stack.ExpandableViewState; /** * Container for the expanded bubble view, handles rendering the caret and settings icon. Loading @@ -73,7 +67,6 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList private AlphaOptimizedButton mSettingsIcon; // Views for expanded state private ExpandableNotificationRow mNotifRow; private ActivityView mActivityView; private boolean mActivityViewReady = false; Loading @@ -84,7 +77,6 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList private int mMinHeight; private int mSettingsIconHeight; private int mBubbleHeight; private int mPointerWidth; private int mPointerHeight; private ShapeDrawable mPointerDrawable; Loading @@ -94,13 +86,10 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList private String mAppName; private Drawable mAppIcon; private INotificationManager mNotificationManagerService; private BubbleController mBubbleController = Dependency.get(BubbleController.class); private BubbleStackView mStackView; private BubbleExpandedView.OnBubbleBlockedListener mOnBubbleBlockedListener; private ActivityView.StateCallback mStateCallback = new ActivityView.StateCallback() { @Override public void onActivityViewReady(ActivityView view) { Loading Loading @@ -154,12 +143,6 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList mMinHeight = getResources().getDimensionPixelSize( R.dimen.bubble_expanded_default_height); mPointerMargin = getResources().getDimensionPixelSize(R.dimen.bubble_pointer_margin); try { mNotificationManagerService = INotificationManager.Stub.asInterface( ServiceManager.getServiceOrThrow(Context.NOTIFICATION_SERVICE)); } catch (ServiceManager.ServiceNotFoundException e) { Log.w(TAG, e); } } @Override Loading Loading @@ -273,13 +256,6 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList } } /** * Sets the listener to notify when a bubble has been blocked. */ public void setOnBlockedListener(OnBubbleBlockedListener listener) { mOnBubbleBlockedListener = listener; } /** * Sets the notification entry used to populate this view. */ Loading @@ -288,17 +264,14 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList mEntry = entry; mAppName = appName; ApplicationInfo info; try { info = mPm.getApplicationInfo( ApplicationInfo info = mPm.getApplicationInfo( entry.notification.getPackageName(), PackageManager.MATCH_UNINSTALLED_PACKAGES | PackageManager.MATCH_DISABLED_COMPONENTS | PackageManager.MATCH_DIRECT_BOOT_UNAWARE | PackageManager.MATCH_DIRECT_BOOT_AWARE); if (info != null) { mAppIcon = mPm.getApplicationIcon(info); } } catch (PackageManager.NameNotFoundException e) { // Do nothing. } Loading @@ -317,17 +290,7 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList if (usingActivityView()) { mActivityView.setCallback(mStateCallback); } else { // We're using notification template ViewGroup parent = (ViewGroup) mNotifRow.getParent(); if (parent == this) { // Already added return; } else if (parent != null) { // Still in the shade... remove it parent.removeView(mNotifRow); } addView(mNotifRow, 1 /* index */); mPointerView.setAlpha(1f); Log.e(TAG, "Cannot populate expanded view."); } } Loading @@ -349,17 +312,8 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList private void updateExpandedView() { mBubbleIntent = getBubbleIntent(mEntry); if (mBubbleIntent != null) { if (mNotifRow != null) { // Clear out the row if we had it previously removeView(mNotifRow); mNotifRow = null; } setContentVisibility(false); mActivityView.setVisibility(VISIBLE); } else if (DEBUG_ENABLE_AUTO_BUBBLE) { // Hide activity view if we had it previously mActivityView.setVisibility(GONE); mNotifRow = mEntry.getRow(); } updateView(); } Loading Loading @@ -403,12 +357,9 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList // If the keyboard is visible... don't adjust the height because that will cause // a configuration change and the keyboard will be lost. lp.height = (int) height; mBubbleHeight = (int) height; mActivityView.setLayoutParams(lp); mNeedsNewHeight = false; } } else { mBubbleHeight = mNotifRow != null ? mNotifRow.getIntrinsicHeight() : mMinHeight; } } Loading Loading @@ -448,9 +399,6 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList && mActivityView.getVisibility() == VISIBLE && mActivityView.isAttachedToWindow()) { mActivityView.onLocationChanged(); } else if (mNotifRow != null) { applyRowState(mNotifRow); mPointerView.setAlpha(1f); } updateHeight(); } Loading @@ -469,8 +417,6 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList * Removes and releases an ActivityView if one was previously created for this bubble. */ public void cleanUpExpandedState() { removeView(mNotifRow); if (mActivityView == null) { return; } Loading @@ -496,38 +442,6 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList return INVALID_DISPLAY; } private void applyRowState(ExpandableNotificationRow view) { view.reset(); view.setHeadsUp(false); view.resetTranslation(); view.setOnKeyguard(false); view.setClipBottomAmount(0); view.setClipTopAmount(0); view.setContentTransformationAmount(0, false); view.setIconsVisible(true); // TODO - Need to reset this (and others) when view goes back in shade, leave for now // view.setTopRoundness(1, false); // view.setBottomRoundness(1, false); ExpandableViewState viewState = view.getViewState(); viewState = viewState == null ? new ExpandableViewState() : viewState; viewState.height = view.getIntrinsicHeight(); viewState.gone = false; viewState.hidden = false; viewState.dimmed = false; viewState.alpha = 1f; viewState.notGoneIndex = -1; viewState.xTranslation = 0; viewState.yTranslation = 0; viewState.zTranslation = 0; viewState.scaleX = 1; viewState.scaleY = 1; viewState.inShelf = true; viewState.headsUpIsVisible = false; viewState.applyToView(view); } private Intent getSettingsIntent(String packageName, final int appUid) { final Intent intent = new Intent(Settings.ACTION_APP_NOTIFICATION_BUBBLE_SETTINGS); intent.putExtra(Settings.EXTRA_APP_PACKAGE, packageName); Loading @@ -548,16 +462,6 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList return null; } /** * Listener that is notified when a bubble is blocked. */ public interface OnBubbleBlockedListener { /** * Called when a bubble is blocked for the provided entry. */ void onBubbleBlocked(NotificationEntry entry); } /** * Logs bubble UI click event. * Loading packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java +0 −1 Original line number Diff line number Diff line Loading @@ -196,7 +196,6 @@ public class BubbleStackView extends FrameLayout { private BubbleTouchHandler mTouchHandler; private BubbleController.BubbleExpandListener mExpandListener; private BubbleExpandedView.OnBubbleBlockedListener mBlockedListener; private boolean mViewUpdatedRequested = false; private boolean mIsExpansionAnimating = false; Loading Loading
packages/SystemUI/src/com/android/systemui/bubbles/Bubble.java +0 −8 Original line number Diff line number Diff line Loading @@ -39,7 +39,6 @@ class Bubble { private final String mKey; private final String mGroupId; private String mAppName; private final BubbleExpandedView.OnBubbleBlockedListener mListener; private boolean mInflated; public NotificationEntry entry; Loading @@ -57,16 +56,10 @@ class Bubble { /** Used in tests when no UI is required. */ @VisibleForTesting(visibility = PRIVATE) Bubble(Context context, NotificationEntry e) { this (context, e, null); } Bubble(Context context, NotificationEntry e, BubbleExpandedView.OnBubbleBlockedListener listener) { entry = e; mKey = e.key; mLastUpdated = e.notification.getPostTime(); mGroupId = groupId(e); mListener = listener; mPm = context.getPackageManager(); ApplicationInfo info; Loading Loading @@ -122,7 +115,6 @@ class Bubble { expandedView = (BubbleExpandedView) inflater.inflate( R.layout.bubble_expanded_view, stackView, false /* attachToRoot */); expandedView.setEntry(entry, stackView, mAppName); expandedView.setOnBlockedListener(mListener); mInflated = true; } Loading
packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java +0 −85 Original line number Diff line number Diff line Loading @@ -44,7 +44,6 @@ import static java.lang.annotation.RetentionPolicy.SOURCE; import android.app.ActivityManager; import android.app.ActivityManager.RunningTaskInfo; import android.app.Notification; import android.app.NotificationManager; import android.app.PendingIntent; import android.content.Context; Loading @@ -56,7 +55,6 @@ import android.os.RemoteException; import android.os.ServiceManager; import android.provider.Settings; import android.service.notification.NotificationListenerService.RankingMap; import android.service.notification.StatusBarNotification; import android.service.notification.ZenModeConfig; import android.util.Log; import android.util.Pair; Loading Loading @@ -122,21 +120,8 @@ public class BubbleController implements ConfigurationController.ConfigurationLi public static final int MAX_BUBBLES = 5; // TODO: actually enforce this // Enables some subset of notifs to automatically become bubbles public static final boolean DEBUG_ENABLE_AUTO_BUBBLE = false; /** Flag to enable or disable the entire feature */ private static final String ENABLE_BUBBLES = "experiment_enable_bubbles"; /** Auto bubble flags set whether different notif types should be presented as a bubble */ private static final String ENABLE_AUTO_BUBBLE_MESSAGES = "experiment_autobubble_messaging"; private static final String ENABLE_AUTO_BUBBLE_ONGOING = "experiment_autobubble_ongoing"; private static final String ENABLE_AUTO_BUBBLE_ALL = "experiment_autobubble_all"; /** Use an activityView for an auto-bubbled notifs if it has an appropriate content intent */ private static final String ENABLE_BUBBLE_CONTENT_INTENT = "experiment_bubble_content_intent"; private static final String BUBBLE_STIFFNESS = "experiment_bubble_stiffness"; private static final String BUBBLE_BOUNCINESS = "experiment_bubble_bounciness"; private final Context mContext; private final NotificationEntryManager mNotificationEntryManager; Loading Loading @@ -698,42 +683,6 @@ public class BubbleController implements ConfigurationController.ConfigurationLi return mStackView; } /** * Whether the notification should automatically bubble or not. Gated by secure settings flags. */ @VisibleForTesting protected boolean shouldAutoBubbleForFlags(Context context, NotificationEntry entry) { if (entry.isBubbleDismissed()) { return false; } StatusBarNotification n = entry.notification; boolean autoBubbleMessages = shouldAutoBubbleMessages(context) || DEBUG_ENABLE_AUTO_BUBBLE; boolean autoBubbleOngoing = shouldAutoBubbleOngoing(context) || DEBUG_ENABLE_AUTO_BUBBLE; boolean autoBubbleAll = shouldAutoBubbleAll(context) || DEBUG_ENABLE_AUTO_BUBBLE; boolean hasRemoteInput = false; if (n.getNotification().actions != null) { for (Notification.Action action : n.getNotification().actions) { if (action.getRemoteInputs() != null) { hasRemoteInput = true; break; } } } boolean isCall = Notification.CATEGORY_CALL.equals(n.getNotification().category) && n.isOngoing(); boolean isMusic = n.getNotification().hasMediaSession(); boolean isImportantOngoing = isMusic || isCall; Class<? extends Notification.Style> style = n.getNotification().getNotificationStyle(); boolean isMessageType = Notification.CATEGORY_MESSAGE.equals(n.getNotification().category); boolean isMessageStyle = Notification.MessagingStyle.class.equals(style); return (((isMessageType && hasRemoteInput) || isMessageStyle) && autoBubbleMessages) || (isImportantOngoing && autoBubbleOngoing) || autoBubbleAll; } private void updateShowInShadeForSuppressNotification(NotificationEntry entry) { boolean suppressNotification = entry.getBubbleMetadata() != null && entry.getBubbleMetadata().isNotificationSuppressed() Loading Loading @@ -816,45 +765,11 @@ public class BubbleController implements ConfigurationController.ConfigurationLi } } private static boolean shouldAutoBubbleMessages(Context context) { return Settings.Secure.getInt(context.getContentResolver(), ENABLE_AUTO_BUBBLE_MESSAGES, 0) != 0; } private static boolean shouldAutoBubbleOngoing(Context context) { return Settings.Secure.getInt(context.getContentResolver(), ENABLE_AUTO_BUBBLE_ONGOING, 0) != 0; } private static boolean shouldAutoBubbleAll(Context context) { return Settings.Secure.getInt(context.getContentResolver(), ENABLE_AUTO_BUBBLE_ALL, 0) != 0; } static boolean shouldUseContentIntent(Context context) { return Settings.Secure.getInt(context.getContentResolver(), ENABLE_BUBBLE_CONTENT_INTENT, 0) != 0; } private static boolean areBubblesEnabled(Context context) { return Settings.Secure.getInt(context.getContentResolver(), ENABLE_BUBBLES, 1) != 0; } /** Default stiffness to use for bubble physics animations. */ public static int getBubbleStiffness(Context context, int defaultStiffness) { return Settings.Secure.getInt( context.getContentResolver(), BUBBLE_STIFFNESS, defaultStiffness); } /** Default bounciness/damping ratio to use for bubble physics animations. */ public static float getBubbleBounciness(Context context, float defaultBounciness) { return Settings.Secure.getInt( context.getContentResolver(), BUBBLE_BOUNCINESS, (int) (defaultBounciness * 100)) / 100f; } /** * Whether an intent is properly configured to display in an {@link android.app.ActivityView}. * Loading
packages/SystemUI/src/com/android/systemui/bubbles/BubbleData.java +1 −24 Original line number Diff line number Diff line Loading @@ -40,7 +40,6 @@ import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Objects; Loading Loading @@ -172,7 +171,7 @@ public class BubbleData { Bubble bubble = getBubbleWithKey(entry.key); if (bubble == null) { // Create a new bubble bubble = new Bubble(mContext, entry, this::onBubbleBlocked); bubble = new Bubble(mContext, entry); doAdd(bubble); trim(); } else { Loading Loading @@ -552,28 +551,6 @@ public class BubbleData { } } private void onBubbleBlocked(NotificationEntry entry) { final String blockedGroupId = Bubble.groupId(entry); int selectedIndex = mBubbles.indexOf(mSelectedBubble); for (Iterator<Bubble> i = mBubbles.iterator(); i.hasNext(); ) { Bubble bubble = i.next(); if (bubble.getGroupId().equals(blockedGroupId)) { mStateChange.bubbleRemoved(bubble, BubbleController.DISMISS_BLOCKED); i.remove(); } } if (mBubbles.isEmpty()) { setExpandedInternal(false); setSelectedBubbleInternal(null); } else if (!mBubbles.contains(mSelectedBubble)) { // choose a new one int newIndex = Math.min(selectedIndex, mBubbles.size() - 1); Bubble newSelected = mBubbles.get(newIndex); setSelectedBubbleInternal(newSelected); } dispatchPendingChanges(); } private int indexForKey(String key) { for (int i = 0; i < mBubbles.size(); i++) { Bubble bubble = mBubbles.get(i); Loading
packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java +3 −99 Original line number Diff line number Diff line Loading @@ -18,14 +18,12 @@ package com.android.systemui.bubbles; import static android.view.Display.INVALID_DISPLAY; import static com.android.systemui.bubbles.BubbleController.DEBUG_ENABLE_AUTO_BUBBLE; import static com.android.systemui.bubbles.BubbleDebugConfig.TAG_BUBBLES; import static com.android.systemui.bubbles.BubbleDebugConfig.TAG_WITH_CLASS_NAME; import android.annotation.Nullable; import android.app.ActivityOptions; import android.app.ActivityView; import android.app.INotificationManager; import android.app.Notification; import android.app.PendingIntent; import android.content.Context; Loading @@ -39,7 +37,6 @@ import android.graphics.Insets; import android.graphics.Point; import android.graphics.drawable.Drawable; import android.graphics.drawable.ShapeDrawable; import android.os.ServiceManager; import android.os.UserHandle; import android.provider.Settings; import android.service.notification.StatusBarNotification; Loading @@ -47,7 +44,6 @@ import android.util.AttributeSet; import android.util.Log; import android.util.StatsLog; import android.view.View; import android.view.ViewGroup; import android.view.WindowInsets; import android.widget.LinearLayout; Loading @@ -57,8 +53,6 @@ import com.android.systemui.R; import com.android.systemui.recents.TriangleShape; import com.android.systemui.statusbar.AlphaOptimizedButton; import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; import com.android.systemui.statusbar.notification.stack.ExpandableViewState; /** * Container for the expanded bubble view, handles rendering the caret and settings icon. Loading @@ -73,7 +67,6 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList private AlphaOptimizedButton mSettingsIcon; // Views for expanded state private ExpandableNotificationRow mNotifRow; private ActivityView mActivityView; private boolean mActivityViewReady = false; Loading @@ -84,7 +77,6 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList private int mMinHeight; private int mSettingsIconHeight; private int mBubbleHeight; private int mPointerWidth; private int mPointerHeight; private ShapeDrawable mPointerDrawable; Loading @@ -94,13 +86,10 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList private String mAppName; private Drawable mAppIcon; private INotificationManager mNotificationManagerService; private BubbleController mBubbleController = Dependency.get(BubbleController.class); private BubbleStackView mStackView; private BubbleExpandedView.OnBubbleBlockedListener mOnBubbleBlockedListener; private ActivityView.StateCallback mStateCallback = new ActivityView.StateCallback() { @Override public void onActivityViewReady(ActivityView view) { Loading Loading @@ -154,12 +143,6 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList mMinHeight = getResources().getDimensionPixelSize( R.dimen.bubble_expanded_default_height); mPointerMargin = getResources().getDimensionPixelSize(R.dimen.bubble_pointer_margin); try { mNotificationManagerService = INotificationManager.Stub.asInterface( ServiceManager.getServiceOrThrow(Context.NOTIFICATION_SERVICE)); } catch (ServiceManager.ServiceNotFoundException e) { Log.w(TAG, e); } } @Override Loading Loading @@ -273,13 +256,6 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList } } /** * Sets the listener to notify when a bubble has been blocked. */ public void setOnBlockedListener(OnBubbleBlockedListener listener) { mOnBubbleBlockedListener = listener; } /** * Sets the notification entry used to populate this view. */ Loading @@ -288,17 +264,14 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList mEntry = entry; mAppName = appName; ApplicationInfo info; try { info = mPm.getApplicationInfo( ApplicationInfo info = mPm.getApplicationInfo( entry.notification.getPackageName(), PackageManager.MATCH_UNINSTALLED_PACKAGES | PackageManager.MATCH_DISABLED_COMPONENTS | PackageManager.MATCH_DIRECT_BOOT_UNAWARE | PackageManager.MATCH_DIRECT_BOOT_AWARE); if (info != null) { mAppIcon = mPm.getApplicationIcon(info); } } catch (PackageManager.NameNotFoundException e) { // Do nothing. } Loading @@ -317,17 +290,7 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList if (usingActivityView()) { mActivityView.setCallback(mStateCallback); } else { // We're using notification template ViewGroup parent = (ViewGroup) mNotifRow.getParent(); if (parent == this) { // Already added return; } else if (parent != null) { // Still in the shade... remove it parent.removeView(mNotifRow); } addView(mNotifRow, 1 /* index */); mPointerView.setAlpha(1f); Log.e(TAG, "Cannot populate expanded view."); } } Loading @@ -349,17 +312,8 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList private void updateExpandedView() { mBubbleIntent = getBubbleIntent(mEntry); if (mBubbleIntent != null) { if (mNotifRow != null) { // Clear out the row if we had it previously removeView(mNotifRow); mNotifRow = null; } setContentVisibility(false); mActivityView.setVisibility(VISIBLE); } else if (DEBUG_ENABLE_AUTO_BUBBLE) { // Hide activity view if we had it previously mActivityView.setVisibility(GONE); mNotifRow = mEntry.getRow(); } updateView(); } Loading Loading @@ -403,12 +357,9 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList // If the keyboard is visible... don't adjust the height because that will cause // a configuration change and the keyboard will be lost. lp.height = (int) height; mBubbleHeight = (int) height; mActivityView.setLayoutParams(lp); mNeedsNewHeight = false; } } else { mBubbleHeight = mNotifRow != null ? mNotifRow.getIntrinsicHeight() : mMinHeight; } } Loading Loading @@ -448,9 +399,6 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList && mActivityView.getVisibility() == VISIBLE && mActivityView.isAttachedToWindow()) { mActivityView.onLocationChanged(); } else if (mNotifRow != null) { applyRowState(mNotifRow); mPointerView.setAlpha(1f); } updateHeight(); } Loading @@ -469,8 +417,6 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList * Removes and releases an ActivityView if one was previously created for this bubble. */ public void cleanUpExpandedState() { removeView(mNotifRow); if (mActivityView == null) { return; } Loading @@ -496,38 +442,6 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList return INVALID_DISPLAY; } private void applyRowState(ExpandableNotificationRow view) { view.reset(); view.setHeadsUp(false); view.resetTranslation(); view.setOnKeyguard(false); view.setClipBottomAmount(0); view.setClipTopAmount(0); view.setContentTransformationAmount(0, false); view.setIconsVisible(true); // TODO - Need to reset this (and others) when view goes back in shade, leave for now // view.setTopRoundness(1, false); // view.setBottomRoundness(1, false); ExpandableViewState viewState = view.getViewState(); viewState = viewState == null ? new ExpandableViewState() : viewState; viewState.height = view.getIntrinsicHeight(); viewState.gone = false; viewState.hidden = false; viewState.dimmed = false; viewState.alpha = 1f; viewState.notGoneIndex = -1; viewState.xTranslation = 0; viewState.yTranslation = 0; viewState.zTranslation = 0; viewState.scaleX = 1; viewState.scaleY = 1; viewState.inShelf = true; viewState.headsUpIsVisible = false; viewState.applyToView(view); } private Intent getSettingsIntent(String packageName, final int appUid) { final Intent intent = new Intent(Settings.ACTION_APP_NOTIFICATION_BUBBLE_SETTINGS); intent.putExtra(Settings.EXTRA_APP_PACKAGE, packageName); Loading @@ -548,16 +462,6 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList return null; } /** * Listener that is notified when a bubble is blocked. */ public interface OnBubbleBlockedListener { /** * Called when a bubble is blocked for the provided entry. */ void onBubbleBlocked(NotificationEntry entry); } /** * Logs bubble UI click event. * Loading
packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java +0 −1 Original line number Diff line number Diff line Loading @@ -196,7 +196,6 @@ public class BubbleStackView extends FrameLayout { private BubbleTouchHandler mTouchHandler; private BubbleController.BubbleExpandListener mExpandListener; private BubbleExpandedView.OnBubbleBlockedListener mBlockedListener; private boolean mViewUpdatedRequested = false; private boolean mIsExpansionAnimating = false; Loading