diff options
author | Danny Baumann <dannybaumann@web.de> | 2016-02-06 13:12:12 +0100 |
---|---|---|
committer | Clark Scheff <clark@cyngn.com> | 2016-02-23 08:55:45 -0800 |
commit | e30cc7ef23cf4a558d9e77080e56f0a06fb36475 (patch) | |
tree | 95b93903f2acede1d699f335d86837625ac42ba9 /packages/SystemUI | |
parent | 78f9faa193e4f3e55140ad9c7b39fa1777532c71 (diff) | |
download | frameworks_base-e30cc7ef23cf4a558d9e77080e56f0a06fb36475.zip frameworks_base-e30cc7ef23cf4a558d9e77080e56f0a06fb36475.tar.gz frameworks_base-e30cc7ef23cf4a558d9e77080e56f0a06fb36475.tar.bz2 |
Inflate custom notifications with the app's theme.
Change-Id: I2572abdf0e2e47af2494a99047a386fbc138a1e0
Diffstat (limited to 'packages/SystemUI')
-rwxr-xr-x | packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java index dbf4996..0e726b5 100755 --- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java @@ -1345,27 +1345,50 @@ public abstract class BaseStatusBar extends SystemUI implements View contentViewLocal = null; View bigContentViewLocal = null; View headsUpContentViewLocal = null; - String themePackageName = mCurrentTheme != null ? - mCurrentTheme.getOverlayForStatusBar() : null; + String themePackageName = mCurrentTheme != null + ? mCurrentTheme.getOverlayPkgNameForApp(sbn.getPackageName()) : null; + String statusBarThemePackageName = mCurrentTheme != null + ? mCurrentTheme.getOverlayForStatusBar() : null; + try { contentViewLocal = contentView.apply( sbn.getPackageContext(mContext), contentContainer, mOnClickHandler, - themePackageName); + statusBarThemePackageName); + + final int platformTemplateRootViewId = + com.android.internal.R.id.status_bar_latest_event_content; + final String inflationThemePackageName; + if (themePackageName != null + && !TextUtils.equals(themePackageName, statusBarThemePackageName) + && contentViewLocal.getId() != platformTemplateRootViewId) { + // This notification uses custom RemoteViews, and its app uses a different + // theme than the status bar. Re-inflate the views using the app's theme, + // as the RemoteViews likely will contain resources of the app, not the platform + inflationThemePackageName = themePackageName; + contentViewLocal = contentView.apply( + sbn.getPackageContext(mContext), + contentContainer, + mOnClickHandler, + inflationThemePackageName); + } else { + inflationThemePackageName = statusBarThemePackageName; + } + if (bigContentView != null) { bigContentViewLocal = bigContentView.apply( sbn.getPackageContext(mContext), contentContainer, mOnClickHandler, - themePackageName); + inflationThemePackageName); } if (headsUpContentView != null) { headsUpContentViewLocal = headsUpContentView.apply( sbn.getPackageContext(mContext), contentContainer, mOnClickHandler, - themePackageName); + inflationThemePackageName); } } catch (RuntimeException e) { |