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

Commit 27c6837d authored by Jeff Sharkey's avatar Jeff Sharkey Committed by Android (Google) Code Review
Browse files

Merge "Disable clock in lockscreen; better flag logic."

parents 4596eba7 f52c70b2
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -71,6 +71,7 @@
        </LinearLayout>

        <com.android.systemui.statusbar.policy.Clock
            android:id="@+id/clock"
            android:textAppearance="@*android:style/TextAppearance.StatusBar.Icon"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
+10 −0
Original line number Diff line number Diff line
@@ -1060,6 +1060,12 @@ public class PhoneStatusBar extends StatusBar {
        */
    }

    public void showClock(boolean show) {
        View clock = mStatusBarView.findViewById(R.id.clock);
        if (clock != null) {
            clock.setVisibility(show ? View.VISIBLE : View.GONE);
        }
    }

    /**
     * State is one or more of the DISABLE constants from StatusBarManager.
@@ -1074,6 +1080,10 @@ public class PhoneStatusBar extends StatusBar {
                old, state, diff));
        }

        if ((diff & StatusBarManager.DISABLE_CLOCK) != 0) {
            boolean show = (state & StatusBarManager.DISABLE_CLOCK) == 0;
            showClock(show);
        }
        if ((diff & StatusBarManager.DISABLE_EXPAND) != 0) {
            if ((state & StatusBarManager.DISABLE_EXPAND) != 0) {
                Slog.d(TAG, "DISABLE_EXPAND: yes");
+20 −14
Original line number Diff line number Diff line
@@ -145,10 +145,10 @@ public class KeyguardViewMediator implements KeyguardViewCallback,
    private static final int KEYGUARD_DONE_DRAWING_TIMEOUT_MS = 2000;

    /**
     * Allow the user to operate the status bar when the keyguard is engaged (without a pattern or
     * password).
     * Allow the user to expand the status bar when the keyguard is engaged
     * (without a pattern or password).
     */
    private static final boolean ENABLE_STATUS_BAR_IN_KEYGUARD = true;
    private static final boolean ENABLE_INSECURE_STATUS_BAR_EXPAND = true;

    private Context mContext;
    private AlarmManager mAlarmManager;
@@ -1184,19 +1184,25 @@ public class KeyguardViewMediator implements KeyguardViewCallback,
                }
            }

            // if the keyguard is shown, allow the status bar to open only if the keyguard is
            // insecure and (is covered by another window OR this feature is enabled in general)
            boolean enable = !mShowing
                || ((ENABLE_STATUS_BAR_IN_KEYGUARD || mHidden) && !isSecure());
            int flags = StatusBarManager.DISABLE_NONE;
            if (mShowing && !mHidden) {
                // showing lockscreen exclusively; disable various extra
                // statusbar components.
                flags |= StatusBarManager.DISABLE_NAVIGATION;
                flags |= StatusBarManager.DISABLE_CLOCK;
            }
            if (mShowing && (isSecure() || !ENABLE_INSECURE_STATUS_BAR_EXPAND)) {
                // showing secure lockscreen; disable expanding.
                flags |= StatusBarManager.DISABLE_EXPAND;
            }

            if (DEBUG) {
                Log.d(TAG, "adjustStatusBarLocked: mShowing=" + mShowing + " mHidden=" + mHidden
                    + " isSecure=" + isSecure() + " --> enable=" + enable);
            }
            mStatusBarManager.disable(enable ?
                         StatusBarManager.DISABLE_NONE :
                         ( StatusBarManager.DISABLE_EXPAND
                         | StatusBarManager.DISABLE_NAVIGATION
                         | StatusBarManager.DISABLE_CLOCK));
                Log.d(TAG,
                        "adjustStatusBarLocked: mShowing=" + mShowing + " mHidden=" + mHidden
                                + " isSecure=" + isSecure() + " --> flags=" + flags);
            }

            mStatusBarManager.disable(flags);
        }
    }