diff options
Diffstat (limited to 'packages/SystemUI')
7 files changed, 127 insertions, 70 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardService.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardService.java index 98558b4..9f21dbe 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardService.java +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardService.java @@ -25,9 +25,9 @@ import android.os.IBinder; import android.os.Process; import android.util.Log; +import com.android.internal.policy.IKeyguardDrawnCallback; import com.android.internal.policy.IKeyguardExitCallback; import com.android.internal.policy.IKeyguardService; -import com.android.internal.policy.IKeyguardShowCallback; import com.android.internal.policy.IKeyguardStateCallback; import com.android.systemui.SystemUIApplication; @@ -120,9 +120,15 @@ public class KeyguardService extends Service { } @Override // Binder interface - public void onStartedWakingUp(IKeyguardShowCallback callback) { + public void onStartedWakingUp() { checkPermission(); - mKeyguardViewMediator.onStartedWakingUp(callback); + mKeyguardViewMediator.onStartedWakingUp(); + } + + @Override // Binder interface + public void onScreenTurningOn(IKeyguardDrawnCallback callback) { + checkPermission(); + mKeyguardViewMediator.onScreenTurningOn(callback); } @Override // Binder interface diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java index 009a0d6..c01a485 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java @@ -41,6 +41,7 @@ import android.os.PowerManager; import android.os.RemoteException; import android.os.SystemClock; import android.os.SystemProperties; +import android.os.Trace; import android.os.UserHandle; import android.os.UserManager; import android.provider.Settings; @@ -55,8 +56,9 @@ import android.view.WindowManagerGlobal; import android.view.WindowManagerPolicy; import android.view.animation.Animation; import android.view.animation.AnimationUtils; + +import com.android.internal.policy.IKeyguardDrawnCallback; import com.android.internal.policy.IKeyguardExitCallback; -import com.android.internal.policy.IKeyguardShowCallback; import com.android.internal.policy.IKeyguardStateCallback; import com.android.internal.telephony.IccCardConstants; import com.android.internal.widget.LockPatternUtils; @@ -77,7 +79,6 @@ import java.util.List; import static android.provider.Settings.System.SCREEN_OFF_TIMEOUT; - /** * Mediates requests related to the keyguard. This includes queries about the * state of the keyguard, power management events that effect whether the keyguard @@ -138,7 +139,7 @@ public class KeyguardViewMediator extends SystemUI { private static final int RESET = 4; private static final int VERIFY_UNLOCK = 5; private static final int NOTIFY_SCREEN_OFF = 6; - private static final int NOTIFY_SCREEN_ON = 7; + private static final int NOTIFY_SCREEN_TURNING_ON = 7; private static final int KEYGUARD_DONE = 9; private static final int KEYGUARD_DONE_DRAWING = 10; private static final int KEYGUARD_DONE_AUTHENTICATING = 11; @@ -148,6 +149,7 @@ public class KeyguardViewMediator extends SystemUI { private static final int START_KEYGUARD_EXIT_ANIM = 18; private static final int ON_ACTIVITY_DRAWN = 19; private static final int KEYGUARD_DONE_PENDING_TIMEOUT = 20; + private static final int NOTIFY_STARTED_WAKING_UP = 21; /** * The default amount of time we stay awake (used for all key input) @@ -311,11 +313,14 @@ public class KeyguardViewMediator extends SystemUI { private boolean mPendingReset; /** - * When starting goign to sleep, we figured out that we need to lock Keyguard and this should be + * When starting going to sleep, we figured out that we need to lock Keyguard and this should be * committed when finished going to sleep. */ private boolean mPendingLock; + private boolean mWakeAndUnlocking; + private IKeyguardDrawnCallback mDrawnCallback; + KeyguardUpdateMonitorCallback mUpdateCallback = new KeyguardUpdateMonitorCallback() { @Override @@ -454,12 +459,17 @@ public class KeyguardViewMediator extends SystemUI { } @Override - public void onFingerprintAuthenticated(int userId) { + public void onFingerprintAuthenticated(int userId, boolean wakeAndUnlocking) { if (mStatusBarKeyguardViewManager.isBouncerShowing()) { mStatusBarKeyguardViewManager.notifyKeyguardAuthenticated(); } else { - mStatusBarKeyguardViewManager.animateCollapsePanels( - FINGERPRINT_COLLAPSE_SPEEDUP_FACTOR); + if (wakeAndUnlocking) { + mWakeAndUnlocking = true; + keyguardDone(true, true); + } else { + mStatusBarKeyguardViewManager.animateCollapsePanels( + FINGERPRINT_COLLAPSE_SPEEDUP_FACTOR); + } } }; @@ -752,21 +762,23 @@ public class KeyguardViewMediator extends SystemUI { /** * Let's us know when the device is waking up. */ - public void onStartedWakingUp(IKeyguardShowCallback callback) { + public void onStartedWakingUp() { // TODO: Rename all screen off/on references to interactive/sleeping synchronized (this) { mDeviceInteractive = true; cancelDoKeyguardLaterLocked(); if (DEBUG) Log.d(TAG, "onStartedWakingUp, seq = " + mDelayedShowingSequence); - if (callback != null) { - notifyScreenOnLocked(callback); - } + notifyStartedWakingUp(); } KeyguardUpdateMonitor.getInstance(mContext).dispatchScreenTurnedOn(); maybeSendUserPresentBroadcast(); } + public void onScreenTurningOn(IKeyguardDrawnCallback callback) { + notifyScreenOnLocked(callback); + } + private void maybeSendUserPresentBroadcast() { if (mSystemReady && mLockPatternUtils.isLockScreenDisabled( KeyguardUpdateMonitor.getCurrentUser())) { @@ -1093,14 +1105,14 @@ public class KeyguardViewMediator extends SystemUI { mHandler.sendEmptyMessage(NOTIFY_SCREEN_OFF); } - /** - * Send a message to keyguard telling it the screen just turned on. - * @see #onScreenTurnedOn - * @see #handleNotifyScreenOn - */ - private void notifyScreenOnLocked(IKeyguardShowCallback result) { + private void notifyStartedWakingUp() { + if (DEBUG) Log.d(TAG, "notifyStartedWakingUp"); + mHandler.sendEmptyMessage(NOTIFY_STARTED_WAKING_UP); + } + + private void notifyScreenOnLocked(IKeyguardDrawnCallback callback) { if (DEBUG) Log.d(TAG, "notifyScreenOnLocked"); - Message msg = mHandler.obtainMessage(NOTIFY_SCREEN_ON, result); + Message msg = mHandler.obtainMessage(NOTIFY_SCREEN_TURNING_ON, callback); mHandler.sendMessage(msg); } @@ -1190,8 +1202,11 @@ public class KeyguardViewMediator extends SystemUI { case NOTIFY_SCREEN_OFF: handleNotifyScreenOff(); break; - case NOTIFY_SCREEN_ON: - handleNotifyScreenOn((IKeyguardShowCallback) msg.obj); + case NOTIFY_SCREEN_TURNING_ON: + handleNotifyScreenTurningOn((IKeyguardDrawnCallback) msg.obj); + break; + case NOTIFY_STARTED_WAKING_UP: + handleNotifyStartedWakingUp(); break; case KEYGUARD_DONE: handleKeyguardDone(msg.arg1 != 0, msg.arg2 != 0); @@ -1354,6 +1369,7 @@ public class KeyguardViewMediator extends SystemUI { setShowingLocked(true); mStatusBarKeyguardViewManager.show(options); mHiding = false; + mWakeAndUnlocking = false; resetKeyguardDonePendingLocked(); mHideAnimationRun = false; updateActivityLockScreenState(); @@ -1375,7 +1391,8 @@ public class KeyguardViewMediator extends SystemUI { // manager until it tells us it's safe to do so with // startKeyguardExitAnimation. ActivityManagerNative.getDefault().keyguardGoingAway( - mStatusBarKeyguardViewManager.shouldDisableWindowAnimationsForUnlock(), + mStatusBarKeyguardViewManager.shouldDisableWindowAnimationsForUnlock() + || mWakeAndUnlocking, mStatusBarKeyguardViewManager.isGoingToNotificationShade()); } catch (RemoteException e) { Log.e(TAG, "Error while calling WindowManager", e); @@ -1437,6 +1454,9 @@ public class KeyguardViewMediator extends SystemUI { updateActivityLockScreenState(); adjustStatusBarLocked(); sendUserPresentBroadcast(); + if (mWakeAndUnlocking && mDrawnCallback != null) { + notifyDrawn(mDrawnCallback); + } } } @@ -1508,14 +1528,31 @@ public class KeyguardViewMediator extends SystemUI { } } - /** - * Handle message sent by {@link #notifyScreenOnLocked} - * @see #NOTIFY_SCREEN_ON - */ - private void handleNotifyScreenOn(IKeyguardShowCallback callback) { + private void handleNotifyStartedWakingUp() { + synchronized (KeyguardViewMediator.this) { + if (DEBUG) Log.d(TAG, "handleNotifyWakingUp"); + mStatusBarKeyguardViewManager.onScreenTurnedOn(); + } + } + + private void handleNotifyScreenTurningOn(IKeyguardDrawnCallback callback) { synchronized (KeyguardViewMediator.this) { - if (DEBUG) Log.d(TAG, "handleNotifyScreenOn"); - mStatusBarKeyguardViewManager.onScreenTurnedOn(callback); + if (DEBUG) Log.d(TAG, "handleNotifyScreenTurningOn"); + if (callback != null) { + if (mWakeAndUnlocking) { + mDrawnCallback = callback; + } else { + notifyDrawn(callback); + } + } + } + } + + private void notifyDrawn(final IKeyguardDrawnCallback callback) { + try { + callback.onDrawn(); + } catch (RemoteException e) { + Slog.w(TAG, "Exception calling onDrawn():", e); } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java index 07a055c..fc2b1ec 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java @@ -26,6 +26,7 @@ import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; +import android.content.res.Resources; import android.graphics.Color; import android.os.BatteryManager; import android.os.BatteryStats; @@ -45,6 +46,7 @@ import android.view.View; public class KeyguardIndicationController { private static final String TAG = "KeyguardIndicationController"; + private static final boolean DEBUG_CHARGING_CURRENT = false; private static final int MSG_HIDE_TRANSIENT = 1; @@ -52,6 +54,9 @@ public class KeyguardIndicationController { private final KeyguardIndicationTextView mTextView; private final IBatteryStats mBatteryInfo; + private final int mSlowThreshold; + private final int mFastThreshold; + private String mRestingIndication; private String mTransientIndication; private int mTransientTextColor; @@ -59,11 +64,18 @@ public class KeyguardIndicationController { private boolean mPowerPluggedIn; private boolean mPowerCharged; + private int mChargingSpeed; + private int mChargingCurrent; public KeyguardIndicationController(Context context, KeyguardIndicationTextView textView) { mContext = context; mTextView = textView; + Resources res = context.getResources(); + mSlowThreshold = res.getInteger(R.integer.config_chargingSlowlyThreshold); + mFastThreshold = res.getInteger(R.integer.config_chargingFastThreshold); + + mBatteryInfo = IBatteryStats.Stub.asInterface( ServiceManager.getService(BatteryStats.SERVICE_NAME)); KeyguardUpdateMonitor.getInstance(context).registerCallback(mUpdateMonitor); @@ -150,7 +162,11 @@ public class KeyguardIndicationController { return mTransientIndication; } if (mPowerPluggedIn) { - return computePowerIndication(); + String indication = computePowerIndication(); + if (DEBUG_CHARGING_CURRENT) { + indication = indication + mChargingCurrent; + } + return indication; } return mRestingIndication; } @@ -174,7 +190,19 @@ public class KeyguardIndicationController { } // Fall back to simple charging label. - return mContext.getResources().getString(R.string.keyguard_plugged_in); + int chargingId; + switch (mChargingSpeed) { + case KeyguardUpdateMonitor.BatteryStatus.CHARGING_FAST: + chargingId = R.string.keyguard_plugged_in_charging_fast; + break; + case KeyguardUpdateMonitor.BatteryStatus.CHARGING_SLOWLY: + chargingId = R.string.keyguard_plugged_in_charging_slowly; + break; + default: + chargingId = R.string.keyguard_plugged_in; + break; + } + return mContext.getResources().getString(chargingId); } KeyguardUpdateMonitorCallback mUpdateMonitor = new KeyguardUpdateMonitorCallback() { @@ -184,6 +212,8 @@ public class KeyguardIndicationController { || status.status == BatteryManager.BATTERY_STATUS_FULL; mPowerPluggedIn = status.isPluggedIn() && isChargingOrFull; mPowerCharged = status.isCharged(); + mChargingCurrent = status.maxChargingCurrent; + mChargingSpeed = status.getChargingSpeed(mSlowThreshold, mFastThreshold); updateIndication(); } }; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java index 815e123..def6947 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java @@ -18,7 +18,6 @@ package com.android.systemui.statusbar.phone; import android.app.ActivityManager; import android.app.ActivityManagerNative; -import android.app.Application; import android.app.admin.DevicePolicyManager; import android.content.BroadcastReceiver; import android.content.ComponentName; @@ -30,8 +29,6 @@ import android.content.pm.ActivityInfo; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.content.res.Configuration; -import android.graphics.drawable.Drawable; -import android.graphics.drawable.InsetDrawable; import android.os.AsyncTask; import android.os.Bundle; import android.os.IBinder; @@ -644,7 +641,7 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL } @Override - public void onFingerprintAuthenticated(int userId) { + public void onFingerprintAuthenticated(int userId, boolean wakeAndUnlocking) { } @Override diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java index 88aa071..3ff9877 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -1730,7 +1730,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, } private int adjustDisableFlags(int state) { - if (!mLaunchTransitionFadingAway + if (!mLaunchTransitionFadingAway && !mKeyguardFadingAway && (mExpandedVisible || mBouncerShowing || mWaitingForKeyguardExit)) { state |= StatusBarManager.DISABLE_NOTIFICATION_ICONS; state |= StatusBarManager.DISABLE_SYSTEM_INFO; @@ -3459,7 +3459,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, startTime + fadeoutDuration - StatusBarIconController.DEFAULT_TINT_ANIMATION_DURATION, StatusBarIconController.DEFAULT_TINT_ANIMATION_DURATION); - disable(mDisabledUnmodified1, mDisabledUnmodified2, true /* animate */); + disable(mDisabledUnmodified1, mDisabledUnmodified2, fadeoutDuration > 0 /* animate */); } public boolean isKeyguardFadingAway() { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java index a69416a..e622144 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java @@ -19,15 +19,12 @@ package com.android.systemui.statusbar.phone; import android.content.ComponentCallbacks2; import android.content.Context; import android.os.Bundle; -import android.os.RemoteException; import android.os.SystemClock; -import android.util.Slog; import android.view.KeyEvent; import android.view.View; import android.view.ViewGroup; import android.view.WindowManagerGlobal; -import com.android.internal.policy.IKeyguardShowCallback; import com.android.internal.widget.LockPatternUtils; import com.android.keyguard.KeyguardUpdateMonitor; import com.android.keyguard.ViewMediatorCallback; @@ -163,26 +160,10 @@ public class StatusBarKeyguardViewManager { mBouncer.onScreenTurnedOff(); } - public void onScreenTurnedOn(final IKeyguardShowCallback callback) { + public void onScreenTurnedOn() { mScreenOn = true; mScreenWillWakeUp = false; mPhoneStatusBar.onScreenTurnedOn(); - if (callback != null) { - callbackAfterDraw(callback); - } - } - - private void callbackAfterDraw(final IKeyguardShowCallback callback) { - mContainer.post(new Runnable() { - @Override - public void run() { - try { - callback.onShown(mContainer.getWindowToken()); - } catch (RemoteException e) { - Slog.w(TAG, "Exception calling onShown():", e); - } - } - }); } public void notifyScreenWakeUpRequested() { @@ -270,16 +251,22 @@ public class StatusBarKeyguardViewManager { mPhoneStatusBar.setKeyguardFadingAway(startTime, delay, fadeoutDuration); boolean staying = mPhoneStatusBar.hideKeyguard(); if (!staying) { - mStatusBarWindowManager.setKeyguardFadingAway(true); - mScrimController.animateKeyguardFadingOut(delay, fadeoutDuration, new Runnable() { - @Override - public void run() { - mStatusBarWindowManager.setKeyguardFadingAway(false); - mPhoneStatusBar.finishKeyguardFadingAway(); - WindowManagerGlobal.getInstance().trimMemory( - ComponentCallbacks2.TRIM_MEMORY_UI_HIDDEN); - } - }); + if (fadeoutDuration == 0) { + mPhoneStatusBar.finishKeyguardFadingAway(); + WindowManagerGlobal.getInstance().trimMemory( + ComponentCallbacks2.TRIM_MEMORY_UI_HIDDEN); + } else { + mStatusBarWindowManager.setKeyguardFadingAway(true); + mScrimController.animateKeyguardFadingOut(delay, fadeoutDuration, new Runnable() { + @Override + public void run() { + mStatusBarWindowManager.setKeyguardFadingAway(false); + mPhoneStatusBar.finishKeyguardFadingAway(); + WindowManagerGlobal.getInstance().trimMemory( + ComponentCallbacks2.TRIM_MEMORY_UI_HIDDEN); + } + }); + } } else { mScrimController.animateGoingToFullShade(delay, fadeoutDuration); mPhoneStatusBar.finishKeyguardFadingAway(); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/UnlockMethodCache.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/UnlockMethodCache.java index 66d71f6..6e34cd7 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/UnlockMethodCache.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/UnlockMethodCache.java @@ -125,7 +125,7 @@ public class UnlockMethodCache { } @Override - public void onFingerprintAuthenticated(int userId) { + public void onFingerprintAuthenticated(int userId, boolean wakeAndUnlocking) { update(false /* updateAlways */); } |