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

Commit cdb2ee09 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Brightness mirror should use QS theme"

parents efc23a48 8c51ce24
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -333,7 +333,7 @@ public class KeyguardStatusBarView extends RelativeLayout
        return false;
    }

    public void onOverlayChanged() {
    public void onThemeChanged() {
        @ColorInt int textColor = Utils.getColorAttr(mContext, R.attr.wallpaperTextColor);
        @ColorInt int iconColor = Utils.getDefaultColor(mContext, Color.luminance(textColor) < 0.5 ?
                R.color.dark_mode_icon_color_single_tone :
+1 −1
Original line number Diff line number Diff line
@@ -330,7 +330,7 @@ public class NotificationPanelView extends PanelView implements
        }
    }

    public void onOverlayChanged() {
    public void onThemeChanged() {
        // Re-inflate the status view group.
        int index = indexOfChild(mKeyguardStatusView);
        removeView(mKeyguardStatusView);
+12 −10
Original line number Diff line number Diff line
@@ -43,7 +43,6 @@ import android.app.ActivityManager;
import android.app.ActivityOptions;
import android.app.KeyguardManager;
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.RemoteInput;
@@ -80,7 +79,6 @@ import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.media.AudioAttributes;
import android.media.MediaMetadata;
import android.media.session.MediaSessionManager;
import android.metrics.LogMaker;
import android.net.Uri;
import android.os.AsyncTask;
@@ -1230,13 +1228,13 @@ public class StatusBar extends SystemUI implements DemoMode,
        reevaluateStyles();
    }

    private void reinflateViews() {
    private void onThemeChanged() {
        reevaluateStyles();

        // Clock and bottom icons
        mNotificationPanel.onOverlayChanged();
        mNotificationPanel.onThemeChanged();
        // The status bar on the keyguard is a special layout.
        if (mKeyguardStatusBar != null) mKeyguardStatusBar.onOverlayChanged();
        if (mKeyguardStatusBar != null) mKeyguardStatusBar.onThemeChanged();
        // Recreate Indication controller because internal references changed
        mKeyguardIndicationController =
                SystemUIFactory.getInstance().createKeyguardIndicationController(mContext,
@@ -1247,11 +1245,8 @@ public class StatusBar extends SystemUI implements DemoMode,
                .setStatusBarKeyguardViewManager(mStatusBarKeyguardViewManager);
        mKeyguardIndicationController.setVisible(mState == StatusBarState.KEYGUARD);
        mKeyguardIndicationController.setDozing(mDozing);
        if (mBrightnessMirrorController != null) {
            mBrightnessMirrorController.onOverlayChanged();
        }
        if (mStatusBarKeyguardViewManager != null) {
            mStatusBarKeyguardViewManager.onOverlayChanged();
            mStatusBarKeyguardViewManager.onThemeChanged();
        }
        if (mAmbientIndicationContainer instanceof AutoReinflateContainer) {
            ((AutoReinflateContainer) mAmbientIndicationContainer).inflateLayout();
@@ -1266,6 +1261,13 @@ public class StatusBar extends SystemUI implements DemoMode,
        updateEmptyShadeView();
    }

    @Override
    public void onOverlayChanged() {
        if (mBrightnessMirrorController != null) {
            mBrightnessMirrorController.onOverlayChanged();
        }
    }

    private void updateNotificationsOnDensityOrFontScaleChanged() {
        ArrayList<Entry> activeNotifications = mNotificationData.getActiveNotifications();
        for (int i = 0; i < activeNotifications.size(); i++) {
@@ -4387,7 +4389,7 @@ public class StatusBar extends SystemUI implements DemoMode,
        if (mContext.getThemeResId() != themeResId) {
            mContext.setTheme(themeResId);
            if (inflated) {
                reinflateViews();
                onThemeChanged();
            }
        }

+1 −1
Original line number Diff line number Diff line
@@ -444,7 +444,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
        hideBouncer(true /* destroyView */);
    }

    public void onOverlayChanged() {
    public void onThemeChanged() {
        hideBouncer(true /* destroyView */);
        mBouncer.prepare();
    }
+8 −9
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.systemui.statusbar.policy;

import android.util.ArraySet;
import android.view.ContextThemeWrapper;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewPropertyAnimator;
@@ -51,8 +52,7 @@ public class BrightnessMirrorController
        mStatusBarWindow = statusBarWindow;
        mBrightnessMirror = statusBarWindow.findViewById(R.id.brightness_mirror);
        mNotificationPanel = statusBarWindow.findViewById(R.id.notification_panel);
        mStackScroller = (NotificationStackScrollLayout) statusBarWindow.findViewById(
                R.id.notification_stack_scroller);
        mStackScroller = statusBarWindow.findViewById(R.id.notification_stack_scroller);
        mScrimController = scrimController;
    }

@@ -68,12 +68,9 @@ public class BrightnessMirrorController
        mScrimController.forceHideScrims(false /* hide */, true /* animated */);
        inAnimation(mNotificationPanel.animate())
                .withLayer()
                .withEndAction(new Runnable() {
                    @Override
                    public void run() {
                .withEndAction(() -> {
                    mBrightnessMirror.setVisibility(View.INVISIBLE);
                    mStackScroller.setFadingOut(false);
                    }
                });
    }

@@ -128,9 +125,11 @@ public class BrightnessMirrorController
    }

    private void reinflate() {
        ContextThemeWrapper qsThemeContext =
                new ContextThemeWrapper(mBrightnessMirror.getContext(), R.style.qs_theme);
        int index = mStatusBarWindow.indexOfChild(mBrightnessMirror);
        mStatusBarWindow.removeView(mBrightnessMirror);
        mBrightnessMirror = LayoutInflater.from(mBrightnessMirror.getContext()).inflate(
        mBrightnessMirror = LayoutInflater.from(qsThemeContext).inflate(
                R.layout.brightness_mirror, mStatusBarWindow, false);
        mStatusBarWindow.addView(mBrightnessMirror, index);