summaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
Diffstat (limited to 'packages')
-rw-r--r--packages/Keyguard/src/com/android/keyguard/KeyguardConstants.java1
-rw-r--r--packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java96
-rw-r--r--packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java4
-rw-r--r--packages/SystemUI/res/layout/status_bar_notification_keyguard_overflow.xml4
-rw-r--r--packages/SystemUI/src/com/android/systemui/DejankUtils.java80
-rw-r--r--packages/SystemUI/src/com/android/systemui/assist/AssistManager.java8
-rw-r--r--packages/SystemUI/src/com/android/systemui/keyguard/KeyguardService.java12
-rw-r--r--packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java93
-rw-r--r--packages/SystemUI/src/com/android/systemui/media/RingtonePlayer.java7
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/HotspotTile.java7
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java12
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java2
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java10
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java10
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java8
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java5
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java47
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/UnlockMethodCache.java2
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/policy/HotspotControllerImpl.java34
19 files changed, 325 insertions, 117 deletions
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardConstants.java b/packages/Keyguard/src/com/android/keyguard/KeyguardConstants.java
index e5f3dc9..3927122 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardConstants.java
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardConstants.java
@@ -27,4 +27,5 @@ public class KeyguardConstants {
*/
public static final boolean DEBUG = false;
public static final boolean DEBUG_SIM_STATES = false;
+ public static final boolean DEBUG_FP_WAKELOCK = true;
}
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java b/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java
index 9e5644e..b098258 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java
@@ -44,7 +44,9 @@ import android.os.CancellationSignal;
import android.os.Handler;
import android.os.IRemoteCallback;
import android.os.Message;
+import android.os.PowerManager;
import android.os.RemoteException;
+import android.os.SystemClock;
import android.os.UserHandle;
import android.provider.Settings;
@@ -90,12 +92,15 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
private static final String TAG = "KeyguardUpdateMonitor";
private static final boolean DEBUG = KeyguardConstants.DEBUG;
private static final boolean DEBUG_SIM_STATES = KeyguardConstants.DEBUG_SIM_STATES;
+ private static final boolean DEBUG_FP_WAKELOCK = KeyguardConstants.DEBUG_FP_WAKELOCK;
private static final int LOW_BATTERY_THRESHOLD = 20;
+ private static final long FINGERPRINT_WAKELOCK_TIMEOUT_MS = 15 * 1000;
private static final String ACTION_FACE_UNLOCK_STARTED
= "com.android.facelock.FACE_UNLOCK_STARTED";
private static final String ACTION_FACE_UNLOCK_STOPPED
= "com.android.facelock.FACE_UNLOCK_STOPPED";
+ private static final String FINGERPRINT_WAKE_LOCK_NAME = "wake-and-unlock wakelock";
// Callback messages
private static final int MSG_TIME_UPDATE = 301;
@@ -114,10 +119,6 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
private static final int MSG_SCREEN_TURNED_ON = 319;
private static final int MSG_SCREEN_TURNED_OFF = 320;
private static final int MSG_KEYGUARD_BOUNCER_CHANGED = 322;
- private static final int MSG_FINGERPRINT_AUTHENTICATED = 323;
- private static final int MSG_FINGERPRINT_ERROR = 324;
- private static final int MSG_FINGERPRINT_HELP = 325;
- private static final int MSG_FINGERPRINT_AUTH_FAILED = 326;
private static final int MSG_FACE_UNLOCK_STATE_CHANGED = 327;
private static final int MSG_SIM_SUBSCRIPTION_INFO_CHANGED = 328;
private static final int MSG_AIRPLANE_MODE_CHANGED = 329;
@@ -157,6 +158,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
private List<SubscriptionInfo> mSubscriptionInfo;
private boolean mFingerprintDetectionRunning;
private TrustManager mTrustManager;
+ private PowerManager mPowerManager;
private final Handler mHandler = new Handler() {
@Override
@@ -210,18 +212,6 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
case MSG_SCREEN_TURNED_ON:
handleScreenTurnedOn();
break;
- case MSG_FINGERPRINT_AUTHENTICATED:
- handleFingerprintAuthenticated();
- break;
- case MSG_FINGERPRINT_HELP:
- handleFingerprintHelp(msg.arg1 /* msgId */, (String) msg.obj /* errString */);
- break;
- case MSG_FINGERPRINT_ERROR:
- handleFingerprintError(msg.arg1 /* msgId */, (String) msg.obj /* errString */);
- break;
- case MSG_FINGERPRINT_AUTH_FAILED:
- handleFingerprintAuthFailed();
- break;
case MSG_FACE_UNLOCK_STATE_CHANGED:
handleFaceUnlockStateChanged(msg.arg1 != 0, msg.arg2);
break;
@@ -253,6 +243,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
private static int sCurrentUser;
+ private boolean mWakeAndUnlocking;
+
public synchronized static void setCurrentUser(int currentUser) {
sCurrentUser = currentUser;
}
@@ -353,23 +345,72 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
}
}
- private void onFingerprintAuthenticated(int userId) {
+ private void onFingerprintAuthenticated(int userId, boolean wakeAndUnlocking) {
mUserFingerprintAuthenticated.put(userId, true);
for (int i = 0; i < mCallbacks.size(); i++) {
KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
if (cb != null) {
- cb.onFingerprintAuthenticated(userId);
+ cb.onFingerprintAuthenticated(userId, wakeAndUnlocking);
}
}
}
private void handleFingerprintAuthFailed() {
+ releaseFingerprintWakeLock();
stopListeningForFingerprint();
handleFingerprintHelp(-1, mContext.getString(R.string.fingerprint_not_recognized));
updateFingerprintListeningState();
}
+ private void handleFingerprintAcquired(int acquireInfo) {
+ if (acquireInfo != FingerprintManager.FINGERPRINT_ACQUIRED_GOOD) {
+ return;
+ }
+ if (!mScreenOn) {
+ releaseFingerprintWakeLock();
+ mWakeLock = mPowerManager.newWakeLock(
+ PowerManager.PARTIAL_WAKE_LOCK, FINGERPRINT_WAKE_LOCK_NAME);
+ mWakeLock.acquire();
+ mWakeAndUnlocking = true;
+ if (DEBUG_FP_WAKELOCK) {
+ Log.i(TAG, "fingerprint acquired, grabbing fp wakelock");
+ }
+ mHandler.postDelayed(mReleaseFingerprintWakeLockRunnable,
+ FINGERPRINT_WAKELOCK_TIMEOUT_MS);
+ } else {
+ mWakeAndUnlocking = false;
+ }
+ }
+
+ private final Runnable mReleaseFingerprintWakeLockRunnable = new Runnable() {
+ @Override
+ public void run() {
+ if (DEBUG_FP_WAKELOCK) {
+ Log.i(TAG, "fp wakelock: TIMEOUT!!");
+ }
+ releaseFingerprintWakeLock();
+ }
+ };
+
+ private void releaseFingerprintWakeLock() {
+ if (mWakeLock != null) {
+ mHandler.removeCallbacks(mReleaseFingerprintWakeLockRunnable);
+ if (DEBUG_FP_WAKELOCK) {
+ Log.i(TAG, "releasing fp wakelock");
+ }
+ mWakeLock.release();
+ mWakeLock = null;
+ }
+ }
+
private void handleFingerprintAuthenticated() {
+ if (mWakeAndUnlocking) {
+ if (DEBUG_FP_WAKELOCK) {
+ Log.i(TAG, "fp wakelock: Authenticated, waking up...");
+ }
+ mPowerManager.wakeUp(SystemClock.uptimeMillis());
+ }
+ releaseFingerprintWakeLock();
try {
final int userId;
try {
@@ -382,7 +423,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
Log.d(TAG, "Fingerprint disabled by DPM for userId: " + userId);
return;
}
- onFingerprintAuthenticated(userId);
+ onFingerprintAuthenticated(userId, mWakeAndUnlocking);
} finally {
setFingerprintRunningDetectionRunning(false);
}
@@ -555,26 +596,32 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
@Override
public void onAuthenticationFailed() {
- mHandler.obtainMessage(MSG_FINGERPRINT_AUTH_FAILED).sendToTarget();
+ handleFingerprintAuthFailed();
};
@Override
public void onAuthenticationSucceeded(AuthenticationResult result) {
- mHandler.obtainMessage(MSG_FINGERPRINT_AUTHENTICATED).sendToTarget();
+ handleFingerprintAuthenticated();
}
@Override
public void onAuthenticationHelp(int helpMsgId, CharSequence helpString) {
- mHandler.obtainMessage(MSG_FINGERPRINT_HELP, helpMsgId, 0, helpString).sendToTarget();
+ handleFingerprintHelp(helpMsgId, helpString.toString());
}
@Override
public void onAuthenticationError(int errMsgId, CharSequence errString) {
- mHandler.obtainMessage(MSG_FINGERPRINT_ERROR, errMsgId, 0, errString).sendToTarget();
+ handleFingerprintError(errMsgId, errString.toString());
+ }
+
+ @Override
+ public void onAuthenticationAcquired(int acquireInfo) {
+ handleFingerprintAcquired(acquireInfo);
}
};
private CancellationSignal mFingerprintCancelSignal;
private FingerprintManager mFpm;
+ private PowerManager.WakeLock mWakeLock;
/**
* When we receive a
@@ -741,6 +788,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
private KeyguardUpdateMonitor(Context context) {
mContext = context;
mSubscriptionManager = SubscriptionManager.from(context);
+ mPowerManager = context.getSystemService(PowerManager.class);
mDeviceProvisioned = isDeviceProvisionedInSettingsDb();
// Since device can't be un-provisioned, we only need to register a content observer
// to update mDeviceProvisioned when we are...
@@ -819,7 +867,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
}
private boolean shouldListenForFingerprint() {
- return mScreenOn && mKeyguardIsVisible && !mSwitchingUser
+ return mKeyguardIsVisible && !mSwitchingUser
&& mTrustManager.hasUserAuthenticatedSinceBoot(ActivityManager.getCurrentUser());
}
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java b/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java
index 26e6973..9fd8d30 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java
@@ -178,8 +178,10 @@ public class KeyguardUpdateMonitorCallback {
/**
* Called when a fingerprint is recognized.
* @param userId the user id for which the fingerprint was authenticated
+ * @param wakeAndUnlocking whether the authentication woke the device up and thus we'd like to
+ * dismiss the lockscreen before turning on the screen
*/
- public void onFingerprintAuthenticated(int userId) { }
+ public void onFingerprintAuthenticated(int userId, boolean wakeAndUnlocking) { }
/**
* Called when fingerprint provides help string (e.g. "Try again")
diff --git a/packages/SystemUI/res/layout/status_bar_notification_keyguard_overflow.xml b/packages/SystemUI/res/layout/status_bar_notification_keyguard_overflow.xml
index 4526af5..f699fce 100644
--- a/packages/SystemUI/res/layout/status_bar_notification_keyguard_overflow.xml
+++ b/packages/SystemUI/res/layout/status_bar_notification_keyguard_overflow.xml
@@ -31,7 +31,7 @@
android:layout_height="match_parent"
/>
- <LinearLayout
+ <com.android.keyguard.AlphaOptimizedLinearLayout
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent">
@@ -63,6 +63,6 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
- </LinearLayout>
+ </com.android.keyguard.AlphaOptimizedLinearLayout>
</com.android.systemui.statusbar.NotificationOverflowContainer>
diff --git a/packages/SystemUI/src/com/android/systemui/DejankUtils.java b/packages/SystemUI/src/com/android/systemui/DejankUtils.java
new file mode 100644
index 0000000..fc98ec4
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/DejankUtils.java
@@ -0,0 +1,80 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+package com.android.systemui;
+
+import android.os.Handler;
+import android.os.Looper;
+import android.os.StrictMode;
+import android.view.Choreographer;
+
+import java.util.ArrayList;
+
+/**
+ * Utility class for methods used to dejank the UI.
+ */
+public class DejankUtils {
+
+ private static final Choreographer sChoreographer = Choreographer.getInstance();
+ private static final Handler sHandler = new Handler();
+
+ private static final ArrayList<Runnable> sPendingRunnables = new ArrayList<>();
+
+ private static final Runnable sAnimationCallbackRunnable = new Runnable() {
+ @Override
+ public void run() {
+ for (int i = 0; i < sPendingRunnables.size(); i++) {
+ sHandler.post(sPendingRunnables.get(i));
+ }
+ sPendingRunnables.clear();
+ }
+ };
+
+ /**
+ * Executes {@code r} after performTraversals. Use this do to CPU heavy work for which the
+ * timing is not critical for animation. The work is then scheduled at the same time
+ * RenderThread is doing its thing, leading to better parallelization.
+ *
+ * <p>Needs to be called from the main thread.
+ */
+ public static void postAfterTraversal(Runnable r) {
+ throwIfNotCalledOnMainThread();
+ sPendingRunnables.add(r);
+ postAnimationCallback();
+ }
+
+ /**
+ * Removes a previously scheduled runnable.
+ *
+ * <p>Needs to be called from the main thread.
+ */
+ public static void removeCallbacks(Runnable r) {
+ throwIfNotCalledOnMainThread();
+ sPendingRunnables.remove(r);
+ sHandler.removeCallbacks(r);
+ }
+
+ private static void postAnimationCallback() {
+ sChoreographer.postCallback(Choreographer.CALLBACK_ANIMATION, sAnimationCallbackRunnable,
+ null);
+ }
+
+ private static void throwIfNotCalledOnMainThread() {
+ if (!Looper.getMainLooper().isCurrentThread()) {
+ throw new IllegalStateException("should be called from the main thread.");
+ }
+ }
+}
diff --git a/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java b/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java
index 0daa5c9..9265b63 100644
--- a/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java
+++ b/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java
@@ -18,6 +18,7 @@ import android.os.Handler;
import android.os.RemoteException;
import android.os.UserHandle;
import android.provider.Settings;
+import android.service.voice.VoiceInteractionSession;
import android.util.Log;
import android.view.Gravity;
import android.view.HapticFeedbackConstants;
@@ -218,7 +219,8 @@ public class AssistManager {
}
private void startVoiceInteractor(Bundle args) {
- mAssistUtils.showSessionForActiveService(args, mShowCallback);
+ mAssistUtils.showSessionForActiveService(args,
+ VoiceInteractionSession.SHOW_SOURCE_ASSIST_GESTURE, mShowCallback, null);
}
public void launchVoiceAssistFromKeyguard() {
@@ -302,4 +304,8 @@ public class AssistManager {
public void onUserSwitched(int newUserId) {
updateAssistInfo();
}
+
+ public void onLockscreenShown() {
+ mAssistUtils.onLockscreenShown();
+ }
}
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/media/RingtonePlayer.java b/packages/SystemUI/src/com/android/systemui/media/RingtonePlayer.java
index e9a256c..fe876d7 100644
--- a/packages/SystemUI/src/com/android/systemui/media/RingtonePlayer.java
+++ b/packages/SystemUI/src/com/android/systemui/media/RingtonePlayer.java
@@ -171,6 +171,13 @@ public class RingtonePlayer extends SystemUI {
}
mAsyncPlayer.stop();
}
+
+ @Override
+ public String getTitle(Uri uri) {
+ final UserHandle user = Binder.getCallingUserHandle();
+ return Ringtone.getTitle(getContextForUser(user), uri,
+ false /*followSettingsUri*/, false /*allowRemote*/);
+ }
};
private Context getContextForUser(UserHandle user) {
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/HotspotTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/HotspotTile.java
index ddde106..7b83e6a 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/HotspotTile.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/HotspotTile.java
@@ -23,10 +23,9 @@ import android.content.Intent;
import com.android.internal.logging.MetricsLogger;
import com.android.systemui.Prefs;
import com.android.systemui.R;
-import com.android.systemui.qs.UsageTracker;
import com.android.systemui.qs.QSTile;
+import com.android.systemui.qs.UsageTracker;
import com.android.systemui.statusbar.policy.HotspotController;
-import com.android.systemui.statusbar.policy.KeyguardMonitor;
/** Quick settings tile: Hotspot **/
public class HotspotTile extends QSTile<QSTile.BooleanState> {
@@ -37,14 +36,12 @@ public class HotspotTile extends QSTile<QSTile.BooleanState> {
private final HotspotController mController;
private final Callback mCallback = new Callback();
private final UsageTracker mUsageTracker;
- private final KeyguardMonitor mKeyguard;
public HotspotTile(Host host) {
super(host);
mController = host.getHotspotController();
mUsageTracker = newUsageTracker(host.getContext());
mUsageTracker.setListening(true);
- mKeyguard = host.getKeyguardMonitor();
}
@Override
@@ -97,7 +94,7 @@ public class HotspotTile extends QSTile<QSTile.BooleanState> {
if (arg instanceof Boolean) {
state.value = (boolean) arg;
} else {
- mController.isHotspotEnabled();
+ state.value = mController.isHotspotEnabled();
}
state.icon = state.visible && state.value ? mEnable : mDisable;
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java b/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java
index 7cde44c..403af70 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java
@@ -656,12 +656,14 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView
}
private void setContentAlpha(float contentAlpha) {
- int layerType = contentAlpha == 0.0f || contentAlpha == 1.0f ? LAYER_TYPE_NONE
- : LAYER_TYPE_HARDWARE;
View contentView = getContentView();
- int currentLayerType = contentView.getLayerType();
- if (currentLayerType != layerType) {
- contentView.setLayerType(layerType, null);
+ if (contentView.hasOverlappingRendering()) {
+ int layerType = contentAlpha == 0.0f || contentAlpha == 1.0f ? LAYER_TYPE_NONE
+ : LAYER_TYPE_HARDWARE;
+ int currentLayerType = contentView.getLayerType();
+ if (currentLayerType != layerType) {
+ contentView.setLayerType(layerType, null);
+ }
}
contentView.setAlpha(contentAlpha);
}
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 91adc46..a5310a5 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java
@@ -641,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/KeyguardBouncer.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
index a7afec4..e9b2c61 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
@@ -29,6 +29,7 @@ import com.android.keyguard.KeyguardHostView;
import com.android.keyguard.KeyguardSecurityView;
import com.android.keyguard.R;
import com.android.keyguard.ViewMediatorCallback;
+import com.android.systemui.DejankUtils;
import static com.android.keyguard.KeyguardHostView.OnDismissAction;
import static com.android.keyguard.KeyguardSecurityModel.SecurityMode;
@@ -46,7 +47,6 @@ public class KeyguardBouncer {
private KeyguardHostView mKeyguardView;
private ViewGroup mRoot;
private boolean mShowingSoon;
- private Choreographer mChoreographer = Choreographer.getInstance();
private int mBouncerPromptReason;
public KeyguardBouncer(Context context, ViewMediatorCallback callback,
@@ -70,16 +70,13 @@ public class KeyguardBouncer {
return;
}
- mBouncerPromptReason = mCallback.getBouncerPromptReason();
-
// Try to dismiss the Keyguard. If no security pattern is set, this will dismiss the whole
// Keyguard. If we need to authenticate, show the bouncer.
if (!mKeyguardView.dismiss()) {
mShowingSoon = true;
// Split up the work over multiple frames.
- mChoreographer.postCallbackDelayed(Choreographer.CALLBACK_ANIMATION, mShowRunnable,
- null, 16);
+ DejankUtils.postAfterTraversal(mShowRunnable);
}
}
@@ -107,7 +104,7 @@ public class KeyguardBouncer {
}
private void cancelShowRunnable() {
- mChoreographer.removeCallbacks(Choreographer.CALLBACK_ANIMATION, mShowRunnable, null);
+ DejankUtils.removeCallbacks(mShowRunnable);
mShowingSoon = false;
}
@@ -165,6 +162,7 @@ public class KeyguardBouncer {
if (wasInitialized) {
mKeyguardView.showPrimarySecurityScreen();
}
+ mBouncerPromptReason = mCallback.getBouncerPromptReason();
}
private void ensureView() {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
index f40f501..416fb36 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
@@ -40,6 +40,7 @@ import android.view.MotionEvent;
import android.view.Surface;
import android.view.View;
import android.view.ViewGroup;
+import android.view.ViewRootImpl;
import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
import android.widget.FrameLayout;
@@ -184,6 +185,15 @@ public class NavigationBarView extends LinearLayout {
mBarTransitions = new NavigationBarTransitions(this);
}
+ @Override
+ protected void onAttachedToWindow() {
+ super.onAttachedToWindow();
+ ViewRootImpl root = getViewRootImpl();
+ if (root != null) {
+ root.setDrawDuringWindowsAnimating(true);
+ }
+ }
+
public BarTransitions getBarTransitions() {
return mBarTransitions;
}
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 162a4f4..d829299 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;
@@ -2677,6 +2677,9 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
if (mBluetoothController != null) {
mBluetoothController.dump(fd, pw, args);
}
+ if (mHotspotController != null) {
+ mHotspotController.dump(fd, pw, args);
+ }
if (mCastController != null) {
mCastController.dump(fd, pw, args);
}
@@ -3308,6 +3311,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
mDraggedDownRow.notifyHeightChanged(false /* needsAnimation */);
mDraggedDownRow = null;
}
+ mAssistManager.onLockscreenShown();
}
private void onLaunchTransitionFadingEnded() {
@@ -3457,7 +3461,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/PhoneStatusBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java
index 6d04b28..c0887ca 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java
@@ -24,6 +24,7 @@ import android.view.MotionEvent;
import android.view.View;
import android.view.accessibility.AccessibilityEvent;
+import com.android.systemui.DejankUtils;
import com.android.systemui.EventLogTags;
import com.android.systemui.R;
@@ -117,12 +118,12 @@ public class PhoneStatusBarView extends PanelBar {
public void onAllPanelsCollapsed() {
super.onAllPanelsCollapsed();
// Close the status bar in the next frame so we can show the end of the animation.
- postOnAnimation(mHideExpandedRunnable);
+ DejankUtils.postAfterTraversal(mHideExpandedRunnable);
mLastFullyOpenedPanel = null;
}
public void removePendingHideExpandedRunnables() {
- removeCallbacks(mHideExpandedRunnable);
+ DejankUtils.removeCallbacks(mHideExpandedRunnable);
}
@Override
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 6fc15a8..f31311d 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/UnlockMethodCache.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/UnlockMethodCache.java
@@ -132,7 +132,7 @@ public class UnlockMethodCache {
}
@Override
- public void onFingerprintAuthenticated(int userId) {
+ public void onFingerprintAuthenticated(int userId, boolean wakeAndUnlocking) {
update(false /* updateAlways */);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/HotspotControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/HotspotControllerImpl.java
index 1e3bc4d..41aeac9 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/HotspotControllerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/HotspotControllerImpl.java
@@ -17,7 +17,6 @@
package com.android.systemui.statusbar.policy;
import android.content.BroadcastReceiver;
-import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
@@ -27,6 +26,8 @@ import android.util.Log;
import com.android.settingslib.TetherUtil;
+import java.io.FileDescriptor;
+import java.io.PrintWriter;
import java.util.ArrayList;
public class HotspotControllerImpl implements HotspotController {
@@ -43,11 +44,32 @@ public class HotspotControllerImpl implements HotspotController {
private final ArrayList<Callback> mCallbacks = new ArrayList<Callback>();
private final Receiver mReceiver = new Receiver();
private final Context mContext;
- private final WifiManager mWifiManager;
+
+ private int mHotspotState;
public HotspotControllerImpl(Context context) {
mContext = context;
- mWifiManager = (WifiManager) mContext.getSystemService(Context.WIFI_SERVICE);
+ }
+
+ public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
+ pw.println("HotspotController state:");
+ pw.print(" mHotspotEnabled="); pw.println(stateToString(mHotspotState));
+ }
+
+ private static String stateToString(int hotspotState) {
+ switch (hotspotState) {
+ case WifiManager.WIFI_AP_STATE_DISABLED:
+ return "DISABLED";
+ case WifiManager.WIFI_AP_STATE_DISABLING:
+ return "DISABLING";
+ case WifiManager.WIFI_AP_STATE_ENABLED:
+ return "ENABLED";
+ case WifiManager.WIFI_AP_STATE_ENABLING:
+ return "ENABLING";
+ case WifiManager.WIFI_AP_STATE_FAILED:
+ return "FAILED";
+ }
+ return null;
}
public void addCallback(Callback callback) {
@@ -66,7 +88,7 @@ public class HotspotControllerImpl implements HotspotController {
@Override
public boolean isHotspotEnabled() {
- return mWifiManager.getWifiApState() == WifiManager.WIFI_AP_STATE_ENABLED;
+ return mHotspotState == WifiManager.WIFI_AP_STATE_ENABLED;
}
@Override
@@ -76,7 +98,6 @@ public class HotspotControllerImpl implements HotspotController {
@Override
public void setHotspotEnabled(boolean enabled) {
- final ContentResolver cr = mContext.getContentResolver();
// Call provisioning app which is called when enabling Tethering from Settings
if (enabled && TetherUtil.isProvisioningNeeded(mContext)) {
mContext.startServiceAsUser(TETHER_SERVICE_INTENT, UserHandle.CURRENT);
@@ -113,7 +134,8 @@ public class HotspotControllerImpl implements HotspotController {
if (DEBUG) Log.d(TAG, "onReceive " + intent.getAction());
int state = intent.getIntExtra(
WifiManager.EXTRA_WIFI_AP_STATE, WifiManager.WIFI_AP_STATE_FAILED);
- fireCallback(WifiManager.WIFI_AP_STATE_ENABLED == state);
+ mHotspotState = state;
+ fireCallback(mHotspotState == WifiManager.WIFI_AP_STATE_ENABLED);
}
}
}