Loading packages/SystemUI/plugin/src/com/android/systemui/plugins/statusbar/NotificationMenuRowPlugin.java +7 −1 Original line number Diff line number Diff line Loading @@ -17,7 +17,6 @@ package com.android.systemui.plugins.statusbar; import android.annotation.Nullable; import android.content.Context; import android.graphics.Point; import android.service.notification.StatusBarNotification; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; Loading Loading @@ -62,6 +61,13 @@ public interface NotificationMenuRowPlugin extends Plugin { public View getGutsView(); public String getContentDescription(); /** * Set the name of the app for this menuitem. * * @param appName App name. */ void setAppName(String appName); } /** Loading packages/SystemUI/res/layout/promoted_permission_guts.xml +3 −4 Original line number Diff line number Diff line Loading @@ -48,9 +48,8 @@ android:layout_width="400dp" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_centerHorizontal="true" android:layout_below="@id/unpin_icon" android:layout_toLeftOf="@id/undo" android:padding="@*android:dimen/notification_content_margin_end" android:textColor="@androidprv:color/materialColorOnSurface" android:minWidth="@dimen/min_clickable_item_size" android:minHeight="@dimen/min_clickable_item_size" Loading @@ -60,8 +59,8 @@ android:id="@+id/undo" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@id/unpin_icon" android:layout_alignParentRight="true" android:layout_below="@id/demote_explain" android:layout_centerHorizontal="true" android:padding="@*android:dimen/notification_content_margin_end" android:textColor="@androidprv:color/materialColorOnSurface" android:minWidth="@dimen/min_clickable_item_size" Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationGutsManager.java +13 −14 Original line number Diff line number Diff line Loading @@ -42,6 +42,8 @@ import android.view.HapticFeedbackConstants; import android.view.View; import android.view.accessibility.AccessibilityManager; import androidx.annotation.NonNull; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.logging.MetricsLogger; import com.android.internal.logging.UiEventLogger; Loading Loading @@ -382,21 +384,18 @@ public class NotificationGutsManager implements NotifGutsViewManager, CoreStarta * @param demoteGuts view to set up/bind within {@code row} */ private void initializeDemoteView( final ExpandableNotificationRow row, StatusBarNotification sbn, PromotedPermissionGutsContent demoteGuts) { demoteGuts.setStatusBarNotification(sbn); demoteGuts.setOnDemoteAction(new View.OnClickListener() { @Override public void onClick(View v) { @NonNull final ExpandableNotificationRow row, @NonNull StatusBarNotification sbn, @NonNull PromotedPermissionGutsContent demoteGuts) { demoteGuts.setOnDemoteAction(v -> { try { // TODO(b/391661009): Signal AutomaticPromotionCoordinator here mNotificationManager.setCanBePromoted( sbn.getPackageName(), sbn.getUid(), false, true); mPackageDemotionInteractor.onPackageDemoted(sbn.getPackageName(), sbn.getUid()); } catch (RemoteException e) { Log.e(TAG, "Couldn't revoke live update permission", e); } } }); } Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationMenuRow.java +25 −13 Original line number Diff line number Diff line Loading @@ -468,19 +468,12 @@ public class NotificationMenuRow implements NotificationMenuRowPlugin, View.OnCl setAppName(appName, mRightMenuItems); } private void setAppName(String appName, ArrayList<MenuItem> menuItems) { private void setAppName(String appName, ArrayList<MenuItem> menuItems) { Resources res = mContext.getResources(); final int count = menuItems.size(); for (int i = 0; i < count; i++) { MenuItem item = menuItems.get(i); String description = String.format( res.getString(R.string.notification_menu_accessibility), appName, item.getContentDescription()); View menuView = item.getMenuView(); if (menuView != null) { menuView.setContentDescription(description); } item.setAppName(appName); } } Loading Loading @@ -705,7 +698,13 @@ public class NotificationMenuRow implements NotificationMenuRowPlugin, View.OnCl View demoteButton = LayoutInflater.from(context) .inflate(R.layout.promoted_menu_item, null, false); MenuItem info = new NotificationMenuItem(context, null, demoteContent, demoteButton); demoteButton) { @Override public void setAppName(String appName) { super.setAppName(appName); demoteContent.setAppName(appName); } }; return info; } Loading Loading @@ -853,6 +852,7 @@ public class NotificationMenuRow implements NotificationMenuRowPlugin, View.OnCl View mMenuView; GutsContent mGutsContent; String mContentDescription; Resources mResources; /** * Add a new 'guts' panel. If iconResId < 0 it will not appear in the slow swipe menu Loading @@ -860,9 +860,9 @@ public class NotificationMenuRow implements NotificationMenuRowPlugin, View.OnCl */ public NotificationMenuItem(Context context, String contentDescription, GutsContent content, int iconResId) { Resources res = context.getResources(); int padding = res.getDimensionPixelSize(R.dimen.notification_menu_icon_padding); int tint = res.getColor(R.color.notification_gear_color); mResources = context.getResources(); int padding = mResources.getDimensionPixelSize(R.dimen.notification_menu_icon_padding); int tint = mResources.getColor(R.color.notification_gear_color); if (iconResId >= 0) { AlphaOptimizedImageView iv = new AlphaOptimizedImageView(context); iv.setPadding(padding, padding, padding, padding); Loading @@ -882,6 +882,7 @@ public class NotificationMenuRow implements NotificationMenuRowPlugin, View.OnCl */ public NotificationMenuItem(Context context, String contentDescription, GutsContent content, View itemView) { mResources = context.getResources(); mMenuView = itemView; mContentDescription = contentDescription; mGutsContent = content; Loading @@ -902,5 +903,16 @@ public class NotificationMenuRow implements NotificationMenuRowPlugin, View.OnCl public String getContentDescription() { return mContentDescription; } @Override public void setAppName(String appName) { String description = String.format( mResources.getString(R.string.notification_menu_accessibility), appName, getContentDescription()); View menuView = getMenuView(); if (menuView != null) { menuView.setContentDescription(description); } } } } packages/SystemUI/src/com/android/systemui/statusbar/notification/row/PromotedPermissionGutsContent.java +6 −24 Original line number Diff line number Diff line Loading @@ -18,7 +18,6 @@ package com.android.systemui.statusbar.notification.row; import android.content.Context; import android.os.Bundle; import android.service.notification.StatusBarNotification; import android.util.AttributeSet; import android.view.View; import android.widget.LinearLayout; Loading @@ -36,11 +35,7 @@ import com.android.systemui.res.R; public class PromotedPermissionGutsContent extends LinearLayout implements NotificationGuts.GutsContent, View.OnClickListener { private static final String TAG = "SnoozyPromotedGuts"; private NotificationGuts mGutsContainer; private StatusBarNotification mSbn; private TextView mUndoButton; private MetricsLogger mMetricsLogger = new MetricsLogger(); Loading @@ -54,7 +49,7 @@ public class PromotedPermissionGutsContent extends LinearLayout @Override protected void onFinishInflate() { super.onFinishInflate(); mUndoButton = (TextView) findViewById(R.id.undo); mUndoButton = findViewById(R.id.undo); mUndoButton.setOnClickListener(this); mUndoButton.setContentDescription( getContext().getString(R.string.snooze_undo_content_description)); Loading @@ -67,18 +62,6 @@ public class PromotedPermissionGutsContent extends LinearLayout dispatchConfigurationChanged(getResources().getConfiguration()); } /** * Update the content description of the snooze view based on the snooze option and whether the * snooze options are expanded or not. * For example, this will be something like "Collapsed\u2029Snooze for 1 hour". The paragraph * separator is added to introduce a break in speech, to match what TalkBack does by default * when you e.g. press on a notification. */ private void updateContentDescription() { // } @Override public boolean performAccessibilityActionInternal(int action, Bundle arguments) { if (super.performAccessibilityActionInternal(action, arguments)) { Loading @@ -92,14 +75,13 @@ public class PromotedPermissionGutsContent extends LinearLayout } /** * TODO docs * @param sbn * Set the app name and update any necessary UI. * @param appName Display name for app. */ public void setStatusBarNotification(StatusBarNotification sbn) { mSbn = sbn; TextView demoteExplanation = (TextView) findViewById(R.id.demote_explain); public void setAppName(String appName) { TextView demoteExplanation = findViewById(R.id.demote_explain); demoteExplanation.setText(mContext.getResources().getString(R.string.demote_explain_text, mSbn.getPackageName())); appName)); } @Override Loading Loading
packages/SystemUI/plugin/src/com/android/systemui/plugins/statusbar/NotificationMenuRowPlugin.java +7 −1 Original line number Diff line number Diff line Loading @@ -17,7 +17,6 @@ package com.android.systemui.plugins.statusbar; import android.annotation.Nullable; import android.content.Context; import android.graphics.Point; import android.service.notification.StatusBarNotification; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; Loading Loading @@ -62,6 +61,13 @@ public interface NotificationMenuRowPlugin extends Plugin { public View getGutsView(); public String getContentDescription(); /** * Set the name of the app for this menuitem. * * @param appName App name. */ void setAppName(String appName); } /** Loading
packages/SystemUI/res/layout/promoted_permission_guts.xml +3 −4 Original line number Diff line number Diff line Loading @@ -48,9 +48,8 @@ android:layout_width="400dp" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_centerHorizontal="true" android:layout_below="@id/unpin_icon" android:layout_toLeftOf="@id/undo" android:padding="@*android:dimen/notification_content_margin_end" android:textColor="@androidprv:color/materialColorOnSurface" android:minWidth="@dimen/min_clickable_item_size" android:minHeight="@dimen/min_clickable_item_size" Loading @@ -60,8 +59,8 @@ android:id="@+id/undo" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@id/unpin_icon" android:layout_alignParentRight="true" android:layout_below="@id/demote_explain" android:layout_centerHorizontal="true" android:padding="@*android:dimen/notification_content_margin_end" android:textColor="@androidprv:color/materialColorOnSurface" android:minWidth="@dimen/min_clickable_item_size" Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationGutsManager.java +13 −14 Original line number Diff line number Diff line Loading @@ -42,6 +42,8 @@ import android.view.HapticFeedbackConstants; import android.view.View; import android.view.accessibility.AccessibilityManager; import androidx.annotation.NonNull; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.logging.MetricsLogger; import com.android.internal.logging.UiEventLogger; Loading Loading @@ -382,21 +384,18 @@ public class NotificationGutsManager implements NotifGutsViewManager, CoreStarta * @param demoteGuts view to set up/bind within {@code row} */ private void initializeDemoteView( final ExpandableNotificationRow row, StatusBarNotification sbn, PromotedPermissionGutsContent demoteGuts) { demoteGuts.setStatusBarNotification(sbn); demoteGuts.setOnDemoteAction(new View.OnClickListener() { @Override public void onClick(View v) { @NonNull final ExpandableNotificationRow row, @NonNull StatusBarNotification sbn, @NonNull PromotedPermissionGutsContent demoteGuts) { demoteGuts.setOnDemoteAction(v -> { try { // TODO(b/391661009): Signal AutomaticPromotionCoordinator here mNotificationManager.setCanBePromoted( sbn.getPackageName(), sbn.getUid(), false, true); mPackageDemotionInteractor.onPackageDemoted(sbn.getPackageName(), sbn.getUid()); } catch (RemoteException e) { Log.e(TAG, "Couldn't revoke live update permission", e); } } }); } Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationMenuRow.java +25 −13 Original line number Diff line number Diff line Loading @@ -468,19 +468,12 @@ public class NotificationMenuRow implements NotificationMenuRowPlugin, View.OnCl setAppName(appName, mRightMenuItems); } private void setAppName(String appName, ArrayList<MenuItem> menuItems) { private void setAppName(String appName, ArrayList<MenuItem> menuItems) { Resources res = mContext.getResources(); final int count = menuItems.size(); for (int i = 0; i < count; i++) { MenuItem item = menuItems.get(i); String description = String.format( res.getString(R.string.notification_menu_accessibility), appName, item.getContentDescription()); View menuView = item.getMenuView(); if (menuView != null) { menuView.setContentDescription(description); } item.setAppName(appName); } } Loading Loading @@ -705,7 +698,13 @@ public class NotificationMenuRow implements NotificationMenuRowPlugin, View.OnCl View demoteButton = LayoutInflater.from(context) .inflate(R.layout.promoted_menu_item, null, false); MenuItem info = new NotificationMenuItem(context, null, demoteContent, demoteButton); demoteButton) { @Override public void setAppName(String appName) { super.setAppName(appName); demoteContent.setAppName(appName); } }; return info; } Loading Loading @@ -853,6 +852,7 @@ public class NotificationMenuRow implements NotificationMenuRowPlugin, View.OnCl View mMenuView; GutsContent mGutsContent; String mContentDescription; Resources mResources; /** * Add a new 'guts' panel. If iconResId < 0 it will not appear in the slow swipe menu Loading @@ -860,9 +860,9 @@ public class NotificationMenuRow implements NotificationMenuRowPlugin, View.OnCl */ public NotificationMenuItem(Context context, String contentDescription, GutsContent content, int iconResId) { Resources res = context.getResources(); int padding = res.getDimensionPixelSize(R.dimen.notification_menu_icon_padding); int tint = res.getColor(R.color.notification_gear_color); mResources = context.getResources(); int padding = mResources.getDimensionPixelSize(R.dimen.notification_menu_icon_padding); int tint = mResources.getColor(R.color.notification_gear_color); if (iconResId >= 0) { AlphaOptimizedImageView iv = new AlphaOptimizedImageView(context); iv.setPadding(padding, padding, padding, padding); Loading @@ -882,6 +882,7 @@ public class NotificationMenuRow implements NotificationMenuRowPlugin, View.OnCl */ public NotificationMenuItem(Context context, String contentDescription, GutsContent content, View itemView) { mResources = context.getResources(); mMenuView = itemView; mContentDescription = contentDescription; mGutsContent = content; Loading @@ -902,5 +903,16 @@ public class NotificationMenuRow implements NotificationMenuRowPlugin, View.OnCl public String getContentDescription() { return mContentDescription; } @Override public void setAppName(String appName) { String description = String.format( mResources.getString(R.string.notification_menu_accessibility), appName, getContentDescription()); View menuView = getMenuView(); if (menuView != null) { menuView.setContentDescription(description); } } } }
packages/SystemUI/src/com/android/systemui/statusbar/notification/row/PromotedPermissionGutsContent.java +6 −24 Original line number Diff line number Diff line Loading @@ -18,7 +18,6 @@ package com.android.systemui.statusbar.notification.row; import android.content.Context; import android.os.Bundle; import android.service.notification.StatusBarNotification; import android.util.AttributeSet; import android.view.View; import android.widget.LinearLayout; Loading @@ -36,11 +35,7 @@ import com.android.systemui.res.R; public class PromotedPermissionGutsContent extends LinearLayout implements NotificationGuts.GutsContent, View.OnClickListener { private static final String TAG = "SnoozyPromotedGuts"; private NotificationGuts mGutsContainer; private StatusBarNotification mSbn; private TextView mUndoButton; private MetricsLogger mMetricsLogger = new MetricsLogger(); Loading @@ -54,7 +49,7 @@ public class PromotedPermissionGutsContent extends LinearLayout @Override protected void onFinishInflate() { super.onFinishInflate(); mUndoButton = (TextView) findViewById(R.id.undo); mUndoButton = findViewById(R.id.undo); mUndoButton.setOnClickListener(this); mUndoButton.setContentDescription( getContext().getString(R.string.snooze_undo_content_description)); Loading @@ -67,18 +62,6 @@ public class PromotedPermissionGutsContent extends LinearLayout dispatchConfigurationChanged(getResources().getConfiguration()); } /** * Update the content description of the snooze view based on the snooze option and whether the * snooze options are expanded or not. * For example, this will be something like "Collapsed\u2029Snooze for 1 hour". The paragraph * separator is added to introduce a break in speech, to match what TalkBack does by default * when you e.g. press on a notification. */ private void updateContentDescription() { // } @Override public boolean performAccessibilityActionInternal(int action, Bundle arguments) { if (super.performAccessibilityActionInternal(action, arguments)) { Loading @@ -92,14 +75,13 @@ public class PromotedPermissionGutsContent extends LinearLayout } /** * TODO docs * @param sbn * Set the app name and update any necessary UI. * @param appName Display name for app. */ public void setStatusBarNotification(StatusBarNotification sbn) { mSbn = sbn; TextView demoteExplanation = (TextView) findViewById(R.id.demote_explain); public void setAppName(String appName) { TextView demoteExplanation = findViewById(R.id.demote_explain); demoteExplanation.setText(mContext.getResources().getString(R.string.demote_explain_text, mSbn.getPackageName())); appName)); } @Override Loading