Disable clock in lockscreen; better flag logic.

When showing lockscreen, hide clock and navigation.  Clean up logic
to be easier to understand.

Bug: 5112812
Change-Id: I20e3563aa36644db678c7839d47f01f223fe8d37
This commit is contained in:
Jeff Sharkey
2011-08-30 22:05:47 -07:00
parent 0d32b317c2
commit f52c70b2cc
3 changed files with 32 additions and 15 deletions

View File

@@ -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"

View File

@@ -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");

View File

@@ -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());
if (DEBUG) {
Log.d(TAG, "adjustStatusBarLocked: mShowing=" + mShowing + " mHidden=" + mHidden
+ " isSecure=" + isSecure() + " --> enable=" + enable);
int flags = StatusBarManager.DISABLE_NONE;
if (mShowing && !mHidden) {
// showing lockscreen exclusively; disable various extra
// statusbar components.
flags |= StatusBarManager.DISABLE_NAVIGATION;
flags |= StatusBarManager.DISABLE_CLOCK;
}
mStatusBarManager.disable(enable ?
StatusBarManager.DISABLE_NONE :
( StatusBarManager.DISABLE_EXPAND
| StatusBarManager.DISABLE_NAVIGATION
| 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() + " --> flags=" + flags);
}
mStatusBarManager.disable(flags);
}
}