Replace bubble settings icon with "manage" text
Bug: 130346513
Test: manual
Change-Id: I01e5dbd79976bf58a037258952bbdd3550e2251f
diff --git a/packages/SystemUI/res/layout/bubble_expanded_view.xml b/packages/SystemUI/res/layout/bubble_expanded_view.xml
index 65ede3d..b734125 100644
--- a/packages/SystemUI/res/layout/bubble_expanded_view.xml
+++ b/packages/SystemUI/res/layout/bubble_expanded_view.xml
@@ -33,13 +33,15 @@
android:layout_height="wrap_content"
android:animateLayoutChanges="true">
- <ImageView
+ <com.android.systemui.statusbar.AlphaOptimizedButton
+ style="@android:style/Widget.Material.Button.Borderless"
android:id="@+id/settings_button"
- android:layout_width="@dimen/bubble_header_icon_size"
- android:layout_height="@dimen/bubble_header_icon_size"
- android:src="@drawable/ic_settings"
- android:scaleType="center"
- android:layout_gravity="end"/>
+ android:layout_gravity="end"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:focusable="true"
+ android:text="@string/manage_bubbles_text"
+ android:textColor="?attr/wallpaperTextColor"/>
<include layout="@layout/bubble_permission_view"
android:id="@+id/permission_layout"
diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml
index acc03c4..35358c2 100644
--- a/packages/SystemUI/res/values/strings.xml
+++ b/packages/SystemUI/res/values/strings.xml
@@ -2413,6 +2413,8 @@
<!-- Text for asking the user whether bubbles (floating app content) should be enabled for an
app. [CHAR LIMIT=NONE] -->
<string name="bubbles_prompt">Allow bubbles from <xliff:g id="app_name" example="YouTube">%1$s</xliff:g>?</string>
+ <!-- The text for the manage bubbles link. [CHAR LIMIT=NONE] -->
+ <string name="manage_bubbles_text">Manage</string>
<!-- Text used for button allowing user to opt out of bubbles [CHAR LIMIT=20] -->
<string name="no_bubbles">Deny</string>
<!-- Text used for button allowing user to approve / enable bubbles [CHAR LIMIT=20] -->
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java
index 346660d..67f3274 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java
@@ -40,11 +40,8 @@
import android.graphics.Color;
import android.graphics.Insets;
import android.graphics.Point;
-import android.graphics.drawable.AdaptiveIconDrawable;
-import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable;
-import android.graphics.drawable.InsetDrawable;
import android.graphics.drawable.ShapeDrawable;
import android.os.RemoteException;
import android.os.ServiceManager;
@@ -66,6 +63,7 @@
import com.android.systemui.Interpolators;
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;
@@ -80,7 +78,7 @@
private View mPointerView;
private int mPointerMargin;
- private ImageView mSettingsIcon;
+ private AlphaOptimizedButton mSettingsIcon;
// Permission view
private View mPermissionView;
@@ -100,8 +98,6 @@
private int mSettingsIconHeight;
private int mBubbleHeight;
private int mPermissionHeight;
- private int mIconInset;
- private Drawable mSettingsIconDrawable;
private int mPointerWidth;
private int mPointerHeight;
@@ -218,10 +214,7 @@
mSettingsIconHeight = getContext().getResources().getDimensionPixelSize(
R.dimen.bubble_expanded_header_height);
mSettingsIcon = findViewById(R.id.settings_button);
- mIconInset = getResources().getDimensionPixelSize(R.dimen.bubble_icon_inset);
mSettingsIcon.setOnClickListener(this);
- // Save initial drawable to create adaptive icons that will take its place.
- mSettingsIconDrawable = mSettingsIcon.getDrawable();
mPermissionHeight = getContext().getResources().getDimensionPixelSize(
R.dimen.bubble_permission_height);
@@ -377,16 +370,6 @@
int foregroundColor = ta.getColor(1, Color.BLACK /* default */);
ta.recycle();
- // Must clear tint first - otherwise tint updates inconsistently.
- mSettingsIconDrawable.setTintList(null);
- mSettingsIconDrawable.setTint(foregroundColor);
-
- InsetDrawable foreground = new InsetDrawable(mSettingsIconDrawable, mIconInset);
- ColorDrawable background = new ColorDrawable(backgroundColor);
- AdaptiveIconDrawable adaptiveIcon = new AdaptiveIconDrawable(background,
- foreground);
- mSettingsIcon.setImageDrawable(adaptiveIcon);
-
// Update permission prompt color.
mPermissionView.setBackground(createPermissionBackground(backgroundColor));
mPermissionPrompt.setTextColor(foregroundColor);
@@ -649,11 +632,12 @@
}
private Intent getSettingsIntent(String packageName, final int appUid) {
- final Intent intent = new Intent(Settings.ACTION_APP_NOTIFICATION_SETTINGS);
+ final Intent intent = new Intent(Settings.ACTION_APP_NOTIFICATION_BUBBLE_SETTINGS);
intent.putExtra(Settings.EXTRA_APP_PACKAGE, packageName);
intent.putExtra(Settings.EXTRA_APP_UID, appUid);
intent.addFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
return intent;
}