From 68079d54f3690885df9c5bbb691090633f3ef541 Mon Sep 17 00:00:00 2001 From: Dan Sandler Date: Wed, 22 Jul 2015 10:45:30 -0400 Subject: Fix media notification action icons. In addition to cleaning up some bare references to the icon slot, we now apply updates to notification RemoteViews in the context of the supplying app's package. This ensures we can find the drawables inside any Icon objects that were constructed without a proper package name, such as is the case with Actions (because the builder and constructor are Context-free and so don't know the package name). This CL also makes clear what was previously only implied: Non-resource action icons are not actually supported yet since they can't be pushed to TextView compound drawables using today's RemoteViews APIs. That will require an API change. Bug: 22600607 Change-Id: Ie6b88aed36e4db05be35f843ea3bc1898d4a5c96 --- .../android/systemui/statusbar/BaseStatusBar.java | 24 +++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'packages') diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java index a2e6632..d5da179 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java @@ -1328,14 +1328,20 @@ public abstract class BaseStatusBar extends SystemUI implements View bigContentViewLocal = null; View headsUpContentViewLocal = null; try { - contentViewLocal = contentView.apply(mContext, contentContainer, + contentViewLocal = contentView.apply( + sbn.getPackageContext(mContext), + contentContainer, mOnClickHandler); if (bigContentView != null) { - bigContentViewLocal = bigContentView.apply(mContext, contentContainer, + bigContentViewLocal = bigContentView.apply( + sbn.getPackageContext(mContext), + contentContainer, mOnClickHandler); } if (headsUpContentView != null) { - headsUpContentViewLocal = headsUpContentView.apply(mContext, contentContainer, + headsUpContentViewLocal = headsUpContentView.apply( + sbn.getPackageContext(mContext), + contentContainer, mOnClickHandler); } } @@ -1362,7 +1368,8 @@ public abstract class BaseStatusBar extends SystemUI implements View publicViewLocal = null; if (publicNotification != null) { try { - publicViewLocal = publicNotification.contentView.apply(mContext, + publicViewLocal = publicNotification.contentView.apply( + sbn.getPackageContext(mContext), contentContainerPublic, mOnClickHandler); if (publicViewLocal != null) { @@ -1981,15 +1988,18 @@ public abstract class BaseStatusBar extends SystemUI implements // Reapply the RemoteViews contentView.reapply(mContext, entry.getContentView(), mOnClickHandler); if (bigContentView != null && entry.getExpandedContentView() != null) { - bigContentView.reapply(mContext, entry.getExpandedContentView(), + bigContentView.reapply(notification.getPackageContext(mContext), + entry.getExpandedContentView(), mOnClickHandler); } View headsUpChild = entry.getHeadsUpContentView(); if (headsUpContentView != null && headsUpChild != null) { - headsUpContentView.reapply(mContext, headsUpChild, mOnClickHandler); + headsUpContentView.reapply(notification.getPackageContext(mContext), + headsUpChild, mOnClickHandler); } if (publicContentView != null && entry.getPublicContentView() != null) { - publicContentView.reapply(mContext, entry.getPublicContentView(), mOnClickHandler); + publicContentView.reapply(notification.getPackageContext(mContext), + entry.getPublicContentView(), mOnClickHandler); } // update the contentIntent mNotificationClicker.register(entry.row, notification); -- cgit v1.1