Merge "Apply theme by using notification context" am: abca0166d7 am: a5181ef40d am: 1f8f8861cf

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1372978

Change-Id: I52673e7c26279c2c3461b0f8379541c5abbb5b13
This commit is contained in:
Ned Burns
2020-09-03 01:46:25 +00:00
committed by Automerger Merge Worker

View File

@@ -390,17 +390,21 @@ public class StatusBarIconView extends AnimatedImageView implements StatusIconDi
} }
private Drawable getIcon(StatusBarIcon icon) { 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 * 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 * @return Drawable for this item, or null if the package or item could not
* be found * 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(); int userId = statusBarIcon.user.getIdentifier();
if (userId == UserHandle.USER_ALL) { if (userId == UserHandle.USER_ALL) {
userId = UserHandle.USER_SYSTEM; userId = UserHandle.USER_SYSTEM;
@@ -409,7 +413,8 @@ public class StatusBarIconView extends AnimatedImageView implements StatusIconDi
Drawable icon = statusBarIcon.icon.loadDrawableAsUser(context, userId); Drawable icon = statusBarIcon.icon.loadDrawableAsUser(context, userId);
TypedValue typedValue = new TypedValue(); 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(); float scaleFactor = typedValue.getFloat();
// No need to scale the icon, so return it as is. // No need to scale the icon, so return it as is.