diff options
| author | d34d <clark@cyngn.com> | 2016-01-15 12:07:17 -0800 |
|---|---|---|
| committer | Clark Scheff <clark@cyngn.com> | 2016-01-17 08:27:34 -0800 |
| commit | 12245b83014eda3359c3194ada8f5a00e24c4bb6 (patch) | |
| tree | df61fad66e877c953a21ac46547715a0b71ea574 | |
| parent | ba54dd4e7f08fcc91e53e430b6b30c66fa76dc43 (diff) | |
| download | frameworks_base-12245b83014eda3359c3194ada8f5a00e24c4bb6.zip frameworks_base-12245b83014eda3359c3194ada8f5a00e24c4bb6.tar.gz frameworks_base-12245b83014eda3359c3194ada8f5a00e24c4bb6.tar.bz2 | |
Themes: Fix applying theme for notifications
Notifications should be inflated using the current theme applied
to SystemUI. This was not happening because the Context created
when applying a RemoteView was returning a cahced context rather
than one with the supplied theme applied.
This patch also moves mCurrentTheme into BaseStatusBar so it can
be used when inflating the remote views for notifications.
Change-Id: I577ae30fc02028c7e497cd774f79029f8a045d1f
TICKET: CYNGNOS-1608
3 files changed, 8 insertions, 7 deletions
diff --git a/core/java/android/widget/RemoteViews.java b/core/java/android/widget/RemoteViews.java index e9ae071..6c9c0e3 100644 --- a/core/java/android/widget/RemoteViews.java +++ b/core/java/android/widget/RemoteViews.java @@ -2815,7 +2815,8 @@ public class RemoteViews implements Parcelable, Filter { private Context getContextForResources(Context context, String themePackageName) { if (mApplication != null) { if (context.getUserId() == UserHandle.getUserId(mApplication.uid) - && context.getPackageName().equals(mApplication.packageName)) { + && context.getPackageName().equals(mApplication.packageName) + && themePackageName == null) { return context; } try { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java index 800ee30..ce5cce5 100755 --- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java @@ -251,6 +251,10 @@ public abstract class BaseStatusBar extends SystemUI implements protected AssistManager mAssistManager; + // last theme that was applied in order to detect theme change (as opposed + // to some other configuration change). + protected ThemeConfig mCurrentTheme; + @Override // NotificationData.Environment public boolean isDeviceProvisioned() { return mDeviceProvisioned; @@ -1341,9 +1345,8 @@ public abstract class BaseStatusBar extends SystemUI implements View contentViewLocal = null; View bigContentViewLocal = null; View headsUpContentViewLocal = null; - final ThemeConfig themeConfig = mContext.getResources().getConfiguration().themeConfig; - String themePackageName = themeConfig != null ? - themeConfig.getOverlayPkgNameForApp(mContext.getPackageName()) : null; + String themePackageName = mCurrentTheme != null ? + mCurrentTheme.getOverlayForStatusBar() : null; try { contentViewLocal = contentView.apply( sbn.getPackageContext(mContext), diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java index d453084..d5887a0 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -395,9 +395,6 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, int mInitialTouchX; int mInitialTouchY; - // last theme that was applied in order to detect theme change (as opposed - // to some other configuration change). - ThemeConfig mCurrentTheme; private boolean mRecreating = false; // for disabling the status bar |
