summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNed Burns <pixel@google.com>2020-09-03 01:02:20 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2020-09-03 01:02:20 +0000
commitabca0166d7e1c75fe892480c0aad6a3bb60764f6 (patch)
treee6292415de854b793e377276d3f2fd95482ff748
parente0bd94e37de7080127f3bc9abfd10f2305549eed (diff)
parent41b2784da0d67784dce4a11fbe4f49170a56014b (diff)
Merge "Apply theme by using notification context"
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java13
1 files changed, 9 insertions, 4 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java
index f4af9ae21b75..04b591334276 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java
@@ -388,17 +388,21 @@ public class StatusBarIconView extends AnimatedImageView implements StatusIconDi
}
private Drawable getIcon(StatusBarIcon icon) {
- return getIcon(getContext(), icon);
+ Context notifContext = mNotification != null ?
+ mNotification.getPackageContext(getContext()) : getContext();
+ return getIcon(getContext(), notifContext, icon);
}
/**
* Returns the right icon to use for this item
*
- * @param context Context to use to get resources
+ * @param sysuiContext Context to use to get scale factor
+ * @param context Context to use to get resources of notification icon
* @return Drawable for this item, or null if the package or item could not
* be found
*/
- public static Drawable getIcon(Context context, StatusBarIcon statusBarIcon) {
+ public static Drawable getIcon(Context sysuiContext,
+ Context context, StatusBarIcon statusBarIcon) {
int userId = statusBarIcon.user.getIdentifier();
if (userId == UserHandle.USER_ALL) {
userId = UserHandle.USER_SYSTEM;
@@ -407,7 +411,8 @@ public class StatusBarIconView extends AnimatedImageView implements StatusIconDi
Drawable icon = statusBarIcon.icon.loadDrawableAsUser(context, userId);
TypedValue typedValue = new TypedValue();
- context.getResources().getValue(R.dimen.status_bar_icon_scale_factor, typedValue, true);
+ sysuiContext.getResources().getValue(R.dimen.status_bar_icon_scale_factor,
+ typedValue, true);
float scaleFactor = typedValue.getFloat();
// No need to scale the icon, so return it as is.