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

Commit 4ef3a544 authored by Aaron Heuckroth's avatar Aaron Heuckroth
Browse files

Fix crash on power menu rotation, and re-render power menu onUiModeChanged.

Test: Automated tests pass. Unplug phone, turn on battery saver, open a rotateable app (like Chrome), hold power to open Global Actions. Rotate the phone -- shouldn't crash. Plug the phone in, battery saver should disable, and the power menu should re-render with a light theme.

Fixes: 129108888
Fixes: 129555054

Change-Id: If2646d5332b18ac32796ba44a86d3cc2aae18982
parent 7c491100
Loading
Loading
Loading
Loading
+12 −3
Original line number Diff line number Diff line
@@ -439,6 +439,9 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
    @Override
    public void onUiModeChanged() {
        mContext.getTheme().applyStyle(mContext.getThemeResId(), true);
        if (mDialog.isShowing()) {
            mDialog.refreshDialog();
        }
    }

    public void destroy() {
@@ -1577,7 +1580,9 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,

            boolean panelEnabled = initializePanel();
            if (!panelEnabled) {
                if (mBackgroundDrawable == null) {
                    mBackgroundDrawable = new GradientDrawable(mContext);
                }
                mScrimAlpha = ScrimController.GRADIENT_SCRIM_ALPHA;
            } else {
                mBackgroundDrawable = mContext.getDrawable(
@@ -1720,11 +1725,15 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
            mKeyguardShowing = keyguardShowing;
        }

        public void onRotate(int from, int to) {
            if (mShowing && isGridEnabled(mContext)) {
        public void refreshDialog() {
            initializeLayout();
            mGlobalActionsLayout.updateList();
        }

        public void onRotate(int from, int to) {
            if (mShowing && isGridEnabled(mContext)) {
                refreshDialog();
            }
        }
    }