diff --git a/packages/SystemUI/res/layout/bubble_expanded_view.xml b/packages/SystemUI/res/layout/bubble_expanded_view.xml index b73412526f5e4..5b93edd1e6b3d 100644 --- a/packages/SystemUI/res/layout/bubble_expanded_view.xml +++ b/packages/SystemUI/res/layout/bubble_expanded_view.xml @@ -27,35 +27,14 @@ android:layout_height="@dimen/bubble_pointer_height" /> - - - - - - - - - + android:focusable="true" + android:text="@string/manage_bubbles_text" + android:textColor="?attr/wallpaperTextColor"/> diff --git a/packages/SystemUI/res/layout/bubble_permission_view.xml b/packages/SystemUI/res/layout/bubble_permission_view.xml deleted file mode 100644 index df5264cc7706d..0000000000000 --- a/packages/SystemUI/res/layout/bubble_permission_view.xml +++ /dev/null @@ -1,85 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index bb7b6630cb193..7b27cc479a85c 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -1123,12 +1123,8 @@ 100dp 48dp - - 24dp 8dp - - 120dp 10sp diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java index 67f327490a6ed..39867c3a0bdb1 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java +++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java @@ -22,8 +22,6 @@ import static android.util.StatsLogInternal.BUBBLE_DEVELOPER_ERROR_REPORTED__ERR import static android.util.StatsLogInternal.BUBBLE_DEVELOPER_ERROR_REPORTED__ERROR__DOCUMENT_LAUNCH_NOT_ALWAYS; import static android.view.Display.INVALID_DISPLAY; -import android.animation.LayoutTransition; -import android.animation.ObjectAnimator; import android.annotation.Nullable; import android.app.ActivityOptions; import android.app.ActivityView; @@ -41,9 +39,7 @@ import android.graphics.Color; import android.graphics.Insets; import android.graphics.Point; import android.graphics.drawable.Drawable; -import android.graphics.drawable.GradientDrawable; import android.graphics.drawable.ShapeDrawable; -import android.os.RemoteException; import android.os.ServiceManager; import android.os.UserHandle; import android.provider.Settings; @@ -54,13 +50,9 @@ import android.util.StatsLog; import android.view.View; import android.view.ViewGroup; import android.view.WindowInsets; -import android.widget.FrameLayout; -import android.widget.ImageView; import android.widget.LinearLayout; -import android.widget.TextView; import com.android.systemui.Dependency; -import com.android.systemui.Interpolators; import com.android.systemui.R; import com.android.systemui.recents.TriangleShape; import com.android.systemui.statusbar.AlphaOptimizedButton; @@ -80,10 +72,6 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList private AlphaOptimizedButton mSettingsIcon; - // Permission view - private View mPermissionView; - private TextView mPermissionPrompt; - // Views for expanded state private ExpandableNotificationRow mNotifRow; private ActivityView mActivityView; @@ -97,7 +85,6 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList private int mMinHeight; private int mSettingsIconHeight; private int mBubbleHeight; - private int mPermissionHeight; private int mPointerWidth; private int mPointerHeight; @@ -194,36 +181,11 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList triangleDrawable.setTint(bgColor); mPointerView.setBackground(triangleDrawable); - FrameLayout permissionOrSettings = findViewById(R.id.permission_or_settings); - - LayoutTransition transition = new LayoutTransition(); - transition.setDuration(200); - - ObjectAnimator appearAnimator = ObjectAnimator.ofFloat(null, View.ALPHA, 0f, 1f); - transition.setAnimator(LayoutTransition.APPEARING, appearAnimator); - transition.setInterpolator(LayoutTransition.APPEARING, Interpolators.ALPHA_IN); - - ObjectAnimator disappearAnimator = ObjectAnimator.ofFloat(null, View.ALPHA, 1f, 0f); - transition.setAnimator(LayoutTransition.DISAPPEARING, disappearAnimator); - transition.setInterpolator(LayoutTransition.DISAPPEARING, Interpolators.ALPHA_OUT); - - transition.setAnimateParentHierarchy(false); - permissionOrSettings.setLayoutTransition(transition); - permissionOrSettings.getLayoutTransition().enableTransitionType(LayoutTransition.CHANGING); - mSettingsIconHeight = getContext().getResources().getDimensionPixelSize( R.dimen.bubble_expanded_header_height); mSettingsIcon = findViewById(R.id.settings_button); mSettingsIcon.setOnClickListener(this); - mPermissionHeight = getContext().getResources().getDimensionPixelSize( - R.dimen.bubble_permission_height); - mPermissionView = findViewById(R.id.permission_layout); - mPermissionPrompt = mPermissionView.findViewById(R.id.prompt); - - findViewById(R.id.no_bubbles_button).setOnClickListener(this); - findViewById(R.id.yes_bubbles_button).setOnClickListener(this); - mActivityView = new ActivityView(mContext, null /* attrs */, 0 /* defStyle */, true /* singleTaskInstance */); addView(mActivityView); @@ -272,23 +234,6 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList } } - /** - * Creates a background with corners rounded based on how the view is configured to display - */ - private Drawable createPermissionBackground(int bgColor) { - TypedArray ta2 = getContext().obtainStyledAttributes( - new int[] {android.R.attr.dialogCornerRadius}); - final float cr = ta2.getDimension(0, 0f); - ta2.recycle(); - - float[] radii = new float[] {cr, cr, cr, cr, 0, 0, 0, 0}; - GradientDrawable chromeBackground = new GradientDrawable(); - chromeBackground.setShape(GradientDrawable.RECTANGLE); - chromeBackground.setCornerRadii(radii); - chromeBackground.setColor(bgColor); - return chromeBackground; - } - /** * Sets the listener to notify when a bubble has been blocked. */ @@ -323,7 +268,7 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList mAppIcon = mPm.getDefaultActivityIcon(); } updateTheme(); - togglePermissionOrSettings(); + showSettingsIcon(); updateExpandedView(); } @@ -370,10 +315,6 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList int foregroundColor = ta.getColor(1, Color.BLACK /* default */); ta.recycle(); - // Update permission prompt color. - mPermissionView.setBackground(createPermissionBackground(backgroundColor)); - mPermissionPrompt.setTextColor(foregroundColor); - // Update triangle color. ShapeDrawable triangleDrawable = new ShapeDrawable( TriangleShape.create(mPointerWidth, mPointerHeight, false /* pointUp */)); @@ -381,22 +322,6 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList mPointerView.setBackground(triangleDrawable); } - void togglePermissionOrSettings() { - boolean hasUserApprovedBubblesForPackage = false; - try { - hasUserApprovedBubblesForPackage = - mNotificationManagerService.hasUserApprovedBubblesForPackage( - mEntry.notification.getPackageName(), mEntry.notification.getUid()); - } catch (RemoteException e) { - Log.w(TAG, e); - } - if (hasUserApprovedBubblesForPackage) { - showSettingsIcon(); - } else { - showPermissionView(); - } - } - private void updateExpandedView() { mBubbleIntent = getBubbleIntent(mEntry); if (mBubbleIntent != null) { @@ -427,11 +352,8 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList * @return total height that the expanded view occupies. */ int getExpandedSize() { - int chromeHeight = mPermissionView.getVisibility() != View.VISIBLE - ? mSettingsIconHeight - : mPermissionHeight; return mBubbleHeight + mPointerView.getHeight() + mPointerMargin - + chromeHeight; + + mSettingsIconHeight; } void updateHeight() { @@ -455,11 +377,8 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList } desiredHeight = desiredPx > 0 ? desiredPx : mMinHeight; } - int chromeHeight = mPermissionView.getVisibility() != View.VISIBLE - ? mSettingsIconHeight - : mPermissionHeight; - int max = mStackView.getMaxExpandedHeight() - chromeHeight - mPointerView.getHeight() - - mPointerMargin; + int max = mStackView.getMaxExpandedHeight() - mSettingsIconHeight + - mPointerView.getHeight() - mPointerMargin; float height = Math.min(desiredHeight, max); height = Math.max(height, mMinHeight); LayoutParams lp = (LayoutParams) mActivityView.getLayoutParams(); @@ -492,30 +411,6 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList logBubbleClickEvent(mEntry, StatsLog.BUBBLE_UICHANGED__ACTION__HEADER_GO_TO_SETTINGS); }); - } else if (id == R.id.no_bubbles_button) { - setBubblesAllowed(false); - } else if (id == R.id.yes_bubbles_button) { - setBubblesAllowed(true); - } - } - - private void setBubblesAllowed(boolean allowed) { - try { - mNotificationManagerService.setBubblesAllowed( - mEntry.notification.getPackageName(), - mEntry.notification.getUid(), - allowed); - if (allowed) { - showSettingsIcon(); - } else if (mOnBubbleBlockedListener != null) { - mOnBubbleBlockedListener.onBubbleBlocked(mEntry); - } - mStackView.onExpandedHeightChanged(); - logBubbleClickEvent(mEntry, - allowed ? StatsLog.BUBBLE_UICHANGED__ACTION__PERMISSION_OPT_IN : - StatsLog.BUBBLE_UICHANGED__ACTION__PERMISSION_OPT_OUT); - } catch (RemoteException e) { - Log.w(TAG, e); } } @@ -526,23 +421,9 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList void showSettingsIcon() { updateSettingsContentDescription(); - - mPermissionView.setVisibility(GONE); mSettingsIcon.setVisibility(VISIBLE); } - void showPermissionView() { - ((ImageView) mPermissionView.findViewById(R.id.pkgicon)).setImageDrawable(mAppIcon); - ((TextView) mPermissionView.findViewById(R.id.pkgname)).setText(mAppName); - mPermissionPrompt.setText( - getResources().getString(R.string.bubbles_prompt, mAppName)); - logBubbleClickEvent(mEntry, - StatsLog.BUBBLE_UICHANGED__ACTION__PERMISSION_DIALOG_SHOWN); - - mSettingsIcon.setVisibility(GONE); - mPermissionView.setVisibility(VISIBLE); - } - /** * Update appearance of the expanded view being displayed. */