summaryrefslogtreecommitdiffstats
path: root/policy/src
diff options
context:
space:
mode:
authorJeff Sharkey <jsharkey@android.com>2011-09-01 22:28:03 -0700
committerJeff Sharkey <jsharkey@android.com>2011-09-02 10:31:15 -0700
commit054340d0a3f242efeaf898cca38625bdcb3b4b5a (patch)
treece0d656891500b8a70b86bdf05e4937a5df419ee /policy/src
parent52f159c79e4ed3367a929f4bc34ab3e184f82a15 (diff)
downloadframeworks_base-054340d0a3f242efeaf898cca38625bdcb3b4b5a.zip
frameworks_base-054340d0a3f242efeaf898cca38625bdcb3b4b5a.tar.gz
frameworks_base-054340d0a3f242efeaf898cca38625bdcb3b4b5a.tar.bz2
Show statusbar clock based on lockscreen status.
Keep track of lockscreen clock visibility, and only hide statusbar clock when one is provided by lockscreen. This fixes bug where widget would hide all clocks. Bug: 5242065 Change-Id: I48de98ecb956c7f22bd40b54d771c78c1a80c14c
Diffstat (limited to 'policy/src')
-rw-r--r--policy/src/com/android/internal/policy/impl/KeyguardStatusViewManager.java5
-rw-r--r--policy/src/com/android/internal/policy/impl/KeyguardUpdateMonitor.java28
-rw-r--r--policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java40
-rw-r--r--policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java8
4 files changed, 78 insertions, 3 deletions
diff --git a/policy/src/com/android/internal/policy/impl/KeyguardStatusViewManager.java b/policy/src/com/android/internal/policy/impl/KeyguardStatusViewManager.java
index 40cc7d8..8654a25 100644
--- a/policy/src/com/android/internal/policy/impl/KeyguardStatusViewManager.java
+++ b/policy/src/com/android/internal/policy/impl/KeyguardStatusViewManager.java
@@ -589,6 +589,11 @@ class KeyguardStatusViewManager implements OnClickListener {
public void onPhoneStateChanged(String newState) {
updateEmergencyCallButtonState();
}
+
+ /** {@inheritDoc} */
+ public void onClockVisibilityChanged() {
+ // ignored
+ }
};
private SimStateCallback mSimStateCallback = new SimStateCallback() {
diff --git a/policy/src/com/android/internal/policy/impl/KeyguardUpdateMonitor.java b/policy/src/com/android/internal/policy/impl/KeyguardUpdateMonitor.java
index 2955de3..958f555 100644
--- a/policy/src/com/android/internal/policy/impl/KeyguardUpdateMonitor.java
+++ b/policy/src/com/android/internal/policy/impl/KeyguardUpdateMonitor.java
@@ -81,6 +81,8 @@ public class KeyguardUpdateMonitor {
private int mFailedAttempts = 0;
+ private boolean mClockVisible;
+
private Handler mHandler;
private ArrayList<InfoCallback> mInfoCallbacks = Lists.newArrayList();
@@ -94,6 +96,7 @@ public class KeyguardUpdateMonitor {
private static final int MSG_SIM_STATE_CHANGE = 304;
private static final int MSG_RINGER_MODE_CHANGED = 305;
private static final int MSG_PHONE_STATE_CHANGED = 306;
+ private static final int MSG_CLOCK_VISIBILITY_CHANGED = 307;
/**
* When we receive a
@@ -170,6 +173,9 @@ public class KeyguardUpdateMonitor {
case MSG_PHONE_STATE_CHANGED:
handlePhoneStateChanged((String)msg.obj);
break;
+ case MSG_CLOCK_VISIBILITY_CHANGED:
+ handleClockVisibilityChanged();
+ break;
}
}
};
@@ -334,6 +340,13 @@ public class KeyguardUpdateMonitor {
}
}
+ private void handleClockVisibilityChanged() {
+ if (DEBUG) Log.d(TAG, "handleClockVisibilityChanged()");
+ for (int i = 0; i < mInfoCallbacks.size(); i++) {
+ mInfoCallbacks.get(i).onClockVisibilityChanged();
+ }
+ }
+
/**
* @param status One of the statuses of {@link android.os.BatteryManager}
* @return Whether the status maps to a status for being plugged in.
@@ -448,6 +461,12 @@ public class KeyguardUpdateMonitor {
*/
void onPhoneStateChanged(String newState);
+ /**
+ * Called when visibility of lockscreen clock changes, such as when
+ * obscured by a widget.
+ */
+ void onClockVisibilityChanged();
+
}
/**
@@ -484,6 +503,11 @@ public class KeyguardUpdateMonitor {
}
}
+ public void reportClockVisible(boolean visible) {
+ mClockVisible = visible;
+ mHandler.obtainMessage(MSG_CLOCK_VISIBILITY_CHANGED).sendToTarget();
+ }
+
public IccCard.State getSimState() {
return mSimState;
}
@@ -546,4 +570,8 @@ public class KeyguardUpdateMonitor {
mFailedAttempts++;
}
+ public boolean isClockVisible() {
+ return mClockVisible;
+ }
+
}
diff --git a/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java b/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java
index a544167..2a34f18 100644
--- a/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java
+++ b/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java
@@ -92,7 +92,7 @@ import android.view.WindowManagerPolicy;
* thread of the keyguard.
*/
public class KeyguardViewMediator implements KeyguardViewCallback,
- KeyguardUpdateMonitor.SimStateCallback {
+ KeyguardUpdateMonitor.InfoCallback, KeyguardUpdateMonitor.SimStateCallback {
private static final int KEYGUARD_DISPLAY_TIMEOUT_DELAY_DEFAULT = 30000;
private final static boolean DEBUG = false;
private final static boolean DBG_WAKE = false;
@@ -284,6 +284,7 @@ public class KeyguardViewMediator implements KeyguardViewCallback,
mUpdateMonitor = new KeyguardUpdateMonitor(context);
+ mUpdateMonitor.registerInfoCallback(this);
mUpdateMonitor.registerSimStateCallback(this);
mLockPatternUtils = new LockPatternUtils(mContext);
@@ -1190,9 +1191,12 @@ public class KeyguardViewMediator implements KeyguardViewCallback,
flags |= StatusBarManager.DISABLE_NAVIGATION;
if (!mHidden) {
// showing lockscreen exclusively (no activities in front of it)
- // disable clock and back button too
+ // disable back button too
flags |= StatusBarManager.DISABLE_BACK;
- flags |= StatusBarManager.DISABLE_CLOCK;
+ if (mUpdateMonitor.isClockVisible()) {
+ // lockscreen showing a clock, so hide statusbar clock
+ flags |= StatusBarManager.DISABLE_CLOCK;
+ }
}
if (isSecure() || !ENABLE_INSECURE_STATUS_BAR_EXPAND) {
// showing secure lockscreen; disable expanding.
@@ -1283,4 +1287,34 @@ public class KeyguardViewMediator implements KeyguardViewCallback,
mKeyguardViewManager.onScreenTurnedOn();
}
}
+
+ /** {@inheritDoc} */
+ public void onClockVisibilityChanged() {
+ adjustStatusBarLocked();
+ }
+
+ /** {@inheritDoc} */
+ public void onPhoneStateChanged(String newState) {
+ // ignored
+ }
+
+ /** {@inheritDoc} */
+ public void onRefreshBatteryInfo(boolean showBatteryInfo, boolean pluggedIn, int batteryLevel) {
+ // ignored
+ }
+
+ /** {@inheritDoc} */
+ public void onRefreshCarrierInfo(CharSequence plmn, CharSequence spn) {
+ // ignored
+ }
+
+ /** {@inheritDoc} */
+ public void onRingerModeChanged(int state) {
+ // ignored
+ }
+
+ /** {@inheritDoc} */
+ public void onTimeChanged() {
+ // ignored
+ }
}
diff --git a/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java b/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java
index 9c14734..62abf20 100644
--- a/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java
+++ b/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java
@@ -21,6 +21,7 @@ import com.android.internal.policy.impl.LockPatternKeyguardView.UnlockMode;
import com.android.internal.telephony.IccCard;
import com.android.internal.widget.LockPatternUtils;
import com.android.internal.widget.LockScreenWidgetCallback;
+import com.android.internal.widget.LockScreenWidgetInterface;
import com.android.internal.widget.TransportControlView;
import android.accounts.Account;
@@ -191,11 +192,17 @@ public class LockPatternKeyguardView extends KeyguardViewBase {
public void requestShow(View view) {
if (DEBUG) Log.v(TAG, "View " + view + " requested show transports");
view.setVisibility(View.VISIBLE);
+
+ // TODO: examine all widgets to derive clock status
+ mUpdateMonitor.reportClockVisible(false);
}
public void requestHide(View view) {
if (DEBUG) Log.v(TAG, "View " + view + " requested hide transports");
view.setVisibility(View.GONE);
+
+ // TODO: examine all widgets to derive clock status
+ mUpdateMonitor.reportClockVisible(true);
}
};
@@ -743,6 +750,7 @@ public class LockPatternKeyguardView extends KeyguardViewBase {
if (tcv == null) {
if (DEBUG) Log.w(TAG, "Couldn't find transport control widget");
} else {
+ mUpdateMonitor.reportClockVisible(true);
tcv.setVisibility(View.GONE); // hide tcv until we get the callback below to show it.
tcv.setCallback(mWidgetCallback);
}