Merge "Show statusbar clock based on lockscreen status."
This commit is contained in:
@@ -20,4 +20,6 @@ public interface LockScreenWidgetInterface {
|
||||
|
||||
public void setCallback(LockScreenWidgetCallback callback);
|
||||
|
||||
public boolean providesClock();
|
||||
|
||||
}
|
||||
|
||||
@@ -381,4 +381,8 @@ public class TransportControlView extends FrameLayout implements OnClickListener
|
||||
mWidgetCallbacks = callback;
|
||||
}
|
||||
|
||||
public boolean providesClock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -589,6 +589,11 @@ class KeyguardStatusViewManager implements OnClickListener {
|
||||
public void onPhoneStateChanged(String newState) {
|
||||
updateEmergencyCallButtonState();
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void onClockVisibilityChanged() {
|
||||
// ignored
|
||||
}
|
||||
};
|
||||
|
||||
private SimStateCallback mSimStateCallback = new SimStateCallback() {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user