Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 12245b83 authored by d34d's avatar d34d Committed by Clark Scheff
Browse files

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
parent ba54dd4e
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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 {
+6 −3
Original line number Diff line number Diff line
@@ -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),
+0 −3
Original line number Diff line number Diff line
@@ -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