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

This commit is contained in:
Jeff Sharkey
2011-08-30 22:51:00 -07:00
committed by Android (Google) Code Review
3 changed files with 32 additions and 15 deletions

View File

@@ -71,6 +71,7 @@
</LinearLayout> </LinearLayout>
<com.android.systemui.statusbar.policy.Clock <com.android.systemui.statusbar.policy.Clock
android:id="@+id/clock"
android:textAppearance="@*android:style/TextAppearance.StatusBar.Icon" android:textAppearance="@*android:style/TextAppearance.StatusBar.Icon"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" 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. * State is one or more of the DISABLE constants from StatusBarManager.
@@ -1074,6 +1080,10 @@ public class PhoneStatusBar extends StatusBar {
old, state, diff)); 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 ((diff & StatusBarManager.DISABLE_EXPAND) != 0) {
if ((state & StatusBarManager.DISABLE_EXPAND) != 0) { if ((state & StatusBarManager.DISABLE_EXPAND) != 0) {
Slog.d(TAG, "DISABLE_EXPAND: yes"); 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; 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 * Allow the user to expand the status bar when the keyguard is engaged
* password). * (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 Context mContext;
private AlarmManager mAlarmManager; 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 int flags = StatusBarManager.DISABLE_NONE;
// insecure and (is covered by another window OR this feature is enabled in general) if (mShowing && !mHidden) {
boolean enable = !mShowing // showing lockscreen exclusively; disable various extra
|| ((ENABLE_STATUS_BAR_IN_KEYGUARD || mHidden) && !isSecure()); // statusbar components.
if (DEBUG) { flags |= StatusBarManager.DISABLE_NAVIGATION;
Log.d(TAG, "adjustStatusBarLocked: mShowing=" + mShowing + " mHidden=" + mHidden flags |= StatusBarManager.DISABLE_CLOCK;
+ " isSecure=" + isSecure() + " --> enable=" + enable);
} }
mStatusBarManager.disable(enable ? if (mShowing && (isSecure() || !ENABLE_INSECURE_STATUS_BAR_EXPAND)) {
StatusBarManager.DISABLE_NONE : // showing secure lockscreen; disable expanding.
( StatusBarManager.DISABLE_EXPAND flags |= StatusBarManager.DISABLE_EXPAND;
| StatusBarManager.DISABLE_NAVIGATION }
| StatusBarManager.DISABLE_CLOCK));
if (DEBUG) {
Log.d(TAG,
"adjustStatusBarLocked: mShowing=" + mShowing + " mHidden=" + mHidden
+ " isSecure=" + isSecure() + " --> flags=" + flags);
}
mStatusBarManager.disable(flags);
} }
} }