Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentInflater.java +8 −7 Original line number Diff line number Diff line Loading @@ -264,7 +264,7 @@ public class NotificationContentInflater { mIsChildInGroup, mUsesIncreasedHeight, mUsesIncreasedHeadsUpHeight, packageContext); result = inflateSmartReplyViews(result, reInflateFlags, mRow.getEntry(), mRow.getContext(), mRow.getHeadsUpManager(), mRow.getContext(), packageContext, mRow.getHeadsUpManager(), mRow.getExistingSmartRepliesAndActions()); apply( inflateSynchronously, Loading Loading @@ -311,20 +311,21 @@ public class NotificationContentInflater { private static InflationProgress inflateSmartReplyViews(InflationProgress result, @InflationFlag int reInflateFlags, NotificationEntry entry, Context context, HeadsUpManager headsUpManager, SmartRepliesAndActions previousSmartRepliesAndActions) { Context packageContext, HeadsUpManager headsUpManager, SmartRepliesAndActions previousSmartRepliesAndActions) { SmartReplyConstants smartReplyConstants = Dependency.get(SmartReplyConstants.class); SmartReplyController smartReplyController = Dependency.get(SmartReplyController.class); if ((reInflateFlags & FLAG_CONTENT_VIEW_EXPANDED) != 0 && result.newExpandedView != null) { result.expandedInflatedSmartReplies = InflatedSmartReplies.inflate( context, entry, smartReplyConstants, smartReplyController, headsUpManager, previousSmartRepliesAndActions); context, packageContext, entry, smartReplyConstants, smartReplyController, headsUpManager, previousSmartRepliesAndActions); } if ((reInflateFlags & FLAG_CONTENT_VIEW_HEADS_UP) != 0 && result.newHeadsUpView != null) { result.headsUpInflatedSmartReplies = InflatedSmartReplies.inflate( context, entry, smartReplyConstants, smartReplyController, headsUpManager, previousSmartRepliesAndActions); context, packageContext, entry, smartReplyConstants, smartReplyController, headsUpManager, previousSmartRepliesAndActions); } return result; } Loading Loading @@ -817,7 +818,7 @@ public class NotificationContentInflater { recoveredBuilder, mIsLowPriority, mIsChildInGroup, mUsesIncreasedHeight, mUsesIncreasedHeadsUpHeight, packageContext); return inflateSmartReplyViews(inflationProgress, mReInflateFlags, mRow.getEntry(), mRow.getContext(), mRow.getHeadsUpManager(), mRow.getContext(), packageContext, mRow.getHeadsUpManager(), mRow.getExistingSmartRepliesAndActions()); } catch (Exception e) { mError = e; Loading packages/SystemUI/src/com/android/systemui/statusbar/policy/InflatedSmartReplies.java +4 −3 Original line number Diff line number Diff line Loading @@ -80,6 +80,7 @@ public class InflatedSmartReplies { */ public static InflatedSmartReplies inflate( Context context, Context packageContext, NotificationEntry entry, SmartReplyConstants smartReplyConstants, SmartReplyController smartReplyController, Loading Loading @@ -108,9 +109,9 @@ public class InflatedSmartReplies { } if (newSmartRepliesAndActions.smartActions != null) { suggestionButtons.addAll( smartReplyView.inflateSmartActions(newSmartRepliesAndActions.smartActions, smartReplyController, entry, headsUpManager, delayOnClickListener)); smartReplyView.inflateSmartActions(packageContext, newSmartRepliesAndActions.smartActions, smartReplyController, entry, headsUpManager, delayOnClickListener)); } return new InflatedSmartReplies(smartReplyView, suggestionButtons, Loading packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyView.java +9 −7 Original line number Diff line number Diff line Loading @@ -235,17 +235,17 @@ public class SmartReplyView extends ViewGroup { * Add smart actions to be shown next to smart replies. Only the actions that fit into the * notification are shown. */ public List<Button> inflateSmartActions(@NonNull SmartActions smartActions, SmartReplyController smartReplyController, NotificationEntry entry, HeadsUpManager headsUpManager, boolean delayOnClickListener) { public List<Button> inflateSmartActions(Context packageContext, @NonNull SmartActions smartActions, SmartReplyController smartReplyController, NotificationEntry entry, HeadsUpManager headsUpManager, boolean delayOnClickListener) { List<Button> buttons = new ArrayList<>(); int numSmartActions = smartActions.actions.size(); for (int n = 0; n < numSmartActions; n++) { Notification.Action action = smartActions.actions.get(n); if (action.actionIntent != null) { buttons.add(inflateActionButton( this, getContext(), n, smartActions, smartReplyController, entry, headsUpManager, delayOnClickListener)); this, getContext(), packageContext, n, smartActions, smartReplyController, entry, headsUpManager, delayOnClickListener)); } } return buttons; Loading Loading @@ -327,7 +327,7 @@ public class SmartReplyView extends ViewGroup { @VisibleForTesting static Button inflateActionButton(SmartReplyView smartReplyView, Context context, int actionIndex, SmartActions smartActions, Context packageContext, int actionIndex, SmartActions smartActions, SmartReplyController smartReplyController, NotificationEntry entry, HeadsUpManager headsUpManager, boolean useDelayedOnClickListener) { Notification.Action action = smartActions.actions.get(actionIndex); Loading @@ -335,7 +335,9 @@ public class SmartReplyView extends ViewGroup { R.layout.smart_action_button, smartReplyView, false); button.setText(action.title); Drawable iconDrawable = action.getIcon().loadDrawable(context); // We received the Icon from the application - so use the Context of the application to // reference icon resources. Drawable iconDrawable = action.getIcon().loadDrawable(packageContext); // Add the action icon to the Smart Action button. int newIconSize = context.getResources().getDimensionPixelSize( R.dimen.smart_action_button_icon_size); Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/SmartReplyViewTest.java +3 −1 Original line number Diff line number Diff line Loading @@ -500,6 +500,7 @@ public class SmartReplyViewTest extends SysuiTestCase { private void setSmartActions(String[] actionTitles, boolean useDelayedOnClickListener) { mView.resetSmartSuggestions(mContainer); List<Button> actions = mView.inflateSmartActions( getContext(), new SmartReplyView.SmartActions(createActions(actionTitles), false), mLogger, mEntry, Loading @@ -520,6 +521,7 @@ public class SmartReplyViewTest extends SysuiTestCase { List<Button> smartSuggestions = inflateSmartReplies(choices, fromAssistant, useDelayedOnClickListener); smartSuggestions.addAll(mView.inflateSmartActions( getContext(), new SmartReplyView.SmartActions(createActions(actionTitles), fromAssistant), mLogger, mEntry, Loading Loading @@ -866,7 +868,7 @@ public class SmartReplyViewTest extends SysuiTestCase { } private Button inflateActionButton(Notification.Action action) { return SmartReplyView.inflateActionButton(mView, getContext(), 0, return SmartReplyView.inflateActionButton(mView, getContext(), getContext(), 0, new SmartReplyView.SmartActions(Collections.singletonList(action), false), mLogger, mEntry, mHeadsUpManager, true /* useDelayedOnClickListener */); } Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentInflater.java +8 −7 Original line number Diff line number Diff line Loading @@ -264,7 +264,7 @@ public class NotificationContentInflater { mIsChildInGroup, mUsesIncreasedHeight, mUsesIncreasedHeadsUpHeight, packageContext); result = inflateSmartReplyViews(result, reInflateFlags, mRow.getEntry(), mRow.getContext(), mRow.getHeadsUpManager(), mRow.getContext(), packageContext, mRow.getHeadsUpManager(), mRow.getExistingSmartRepliesAndActions()); apply( inflateSynchronously, Loading Loading @@ -311,20 +311,21 @@ public class NotificationContentInflater { private static InflationProgress inflateSmartReplyViews(InflationProgress result, @InflationFlag int reInflateFlags, NotificationEntry entry, Context context, HeadsUpManager headsUpManager, SmartRepliesAndActions previousSmartRepliesAndActions) { Context packageContext, HeadsUpManager headsUpManager, SmartRepliesAndActions previousSmartRepliesAndActions) { SmartReplyConstants smartReplyConstants = Dependency.get(SmartReplyConstants.class); SmartReplyController smartReplyController = Dependency.get(SmartReplyController.class); if ((reInflateFlags & FLAG_CONTENT_VIEW_EXPANDED) != 0 && result.newExpandedView != null) { result.expandedInflatedSmartReplies = InflatedSmartReplies.inflate( context, entry, smartReplyConstants, smartReplyController, headsUpManager, previousSmartRepliesAndActions); context, packageContext, entry, smartReplyConstants, smartReplyController, headsUpManager, previousSmartRepliesAndActions); } if ((reInflateFlags & FLAG_CONTENT_VIEW_HEADS_UP) != 0 && result.newHeadsUpView != null) { result.headsUpInflatedSmartReplies = InflatedSmartReplies.inflate( context, entry, smartReplyConstants, smartReplyController, headsUpManager, previousSmartRepliesAndActions); context, packageContext, entry, smartReplyConstants, smartReplyController, headsUpManager, previousSmartRepliesAndActions); } return result; } Loading Loading @@ -817,7 +818,7 @@ public class NotificationContentInflater { recoveredBuilder, mIsLowPriority, mIsChildInGroup, mUsesIncreasedHeight, mUsesIncreasedHeadsUpHeight, packageContext); return inflateSmartReplyViews(inflationProgress, mReInflateFlags, mRow.getEntry(), mRow.getContext(), mRow.getHeadsUpManager(), mRow.getContext(), packageContext, mRow.getHeadsUpManager(), mRow.getExistingSmartRepliesAndActions()); } catch (Exception e) { mError = e; Loading
packages/SystemUI/src/com/android/systemui/statusbar/policy/InflatedSmartReplies.java +4 −3 Original line number Diff line number Diff line Loading @@ -80,6 +80,7 @@ public class InflatedSmartReplies { */ public static InflatedSmartReplies inflate( Context context, Context packageContext, NotificationEntry entry, SmartReplyConstants smartReplyConstants, SmartReplyController smartReplyController, Loading Loading @@ -108,9 +109,9 @@ public class InflatedSmartReplies { } if (newSmartRepliesAndActions.smartActions != null) { suggestionButtons.addAll( smartReplyView.inflateSmartActions(newSmartRepliesAndActions.smartActions, smartReplyController, entry, headsUpManager, delayOnClickListener)); smartReplyView.inflateSmartActions(packageContext, newSmartRepliesAndActions.smartActions, smartReplyController, entry, headsUpManager, delayOnClickListener)); } return new InflatedSmartReplies(smartReplyView, suggestionButtons, Loading
packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyView.java +9 −7 Original line number Diff line number Diff line Loading @@ -235,17 +235,17 @@ public class SmartReplyView extends ViewGroup { * Add smart actions to be shown next to smart replies. Only the actions that fit into the * notification are shown. */ public List<Button> inflateSmartActions(@NonNull SmartActions smartActions, SmartReplyController smartReplyController, NotificationEntry entry, HeadsUpManager headsUpManager, boolean delayOnClickListener) { public List<Button> inflateSmartActions(Context packageContext, @NonNull SmartActions smartActions, SmartReplyController smartReplyController, NotificationEntry entry, HeadsUpManager headsUpManager, boolean delayOnClickListener) { List<Button> buttons = new ArrayList<>(); int numSmartActions = smartActions.actions.size(); for (int n = 0; n < numSmartActions; n++) { Notification.Action action = smartActions.actions.get(n); if (action.actionIntent != null) { buttons.add(inflateActionButton( this, getContext(), n, smartActions, smartReplyController, entry, headsUpManager, delayOnClickListener)); this, getContext(), packageContext, n, smartActions, smartReplyController, entry, headsUpManager, delayOnClickListener)); } } return buttons; Loading Loading @@ -327,7 +327,7 @@ public class SmartReplyView extends ViewGroup { @VisibleForTesting static Button inflateActionButton(SmartReplyView smartReplyView, Context context, int actionIndex, SmartActions smartActions, Context packageContext, int actionIndex, SmartActions smartActions, SmartReplyController smartReplyController, NotificationEntry entry, HeadsUpManager headsUpManager, boolean useDelayedOnClickListener) { Notification.Action action = smartActions.actions.get(actionIndex); Loading @@ -335,7 +335,9 @@ public class SmartReplyView extends ViewGroup { R.layout.smart_action_button, smartReplyView, false); button.setText(action.title); Drawable iconDrawable = action.getIcon().loadDrawable(context); // We received the Icon from the application - so use the Context of the application to // reference icon resources. Drawable iconDrawable = action.getIcon().loadDrawable(packageContext); // Add the action icon to the Smart Action button. int newIconSize = context.getResources().getDimensionPixelSize( R.dimen.smart_action_button_icon_size); Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/SmartReplyViewTest.java +3 −1 Original line number Diff line number Diff line Loading @@ -500,6 +500,7 @@ public class SmartReplyViewTest extends SysuiTestCase { private void setSmartActions(String[] actionTitles, boolean useDelayedOnClickListener) { mView.resetSmartSuggestions(mContainer); List<Button> actions = mView.inflateSmartActions( getContext(), new SmartReplyView.SmartActions(createActions(actionTitles), false), mLogger, mEntry, Loading @@ -520,6 +521,7 @@ public class SmartReplyViewTest extends SysuiTestCase { List<Button> smartSuggestions = inflateSmartReplies(choices, fromAssistant, useDelayedOnClickListener); smartSuggestions.addAll(mView.inflateSmartActions( getContext(), new SmartReplyView.SmartActions(createActions(actionTitles), fromAssistant), mLogger, mEntry, Loading Loading @@ -866,7 +868,7 @@ public class SmartReplyViewTest extends SysuiTestCase { } private Button inflateActionButton(Notification.Action action) { return SmartReplyView.inflateActionButton(mView, getContext(), 0, return SmartReplyView.inflateActionButton(mView, getContext(), getContext(), 0, new SmartReplyView.SmartActions(Collections.singletonList(action), false), mLogger, mEntry, mHeadsUpManager, true /* useDelayedOnClickListener */); } Loading