Merge "Updates isKeyguardSecure to take in a user id."
This commit is contained in:
committed by
Android (Google) Code Review
commit
fbc4c76b24
@@ -440,7 +440,7 @@ public class KeyguardManager {
|
||||
*/
|
||||
public boolean isKeyguardSecure() {
|
||||
try {
|
||||
return mWM.isKeyguardSecure();
|
||||
return mWM.isKeyguardSecure(mContext.getUserId());
|
||||
} catch (RemoteException ex) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ interface IWindowManager
|
||||
@UnsupportedAppUsage
|
||||
boolean isKeyguardLocked();
|
||||
@UnsupportedAppUsage
|
||||
boolean isKeyguardSecure();
|
||||
boolean isKeyguardSecure(int userId);
|
||||
void dismissKeyguard(IKeyguardDismissCallback callback, CharSequence message);
|
||||
|
||||
// Requires INTERACT_ACROSS_USERS_FULL permission
|
||||
|
||||
@@ -269,7 +269,8 @@ class KeyguardController {
|
||||
* @return True if we may show an activity while Keyguard is occluded, false otherwise.
|
||||
*/
|
||||
boolean canShowWhileOccluded(boolean dismissKeyguard, boolean showWhenLocked) {
|
||||
return showWhenLocked || dismissKeyguard && !mWindowManager.isKeyguardSecure();
|
||||
return showWhenLocked || dismissKeyguard
|
||||
&& !mWindowManager.isKeyguardSecure(mService.getCurrentUserId());
|
||||
}
|
||||
|
||||
private void visibilitiesUpdated() {
|
||||
@@ -317,7 +318,7 @@ class KeyguardController {
|
||||
// We only allow dismissing Keyguard via the flag when Keyguard is secure for legacy
|
||||
// reasons, because that's how apps used to dismiss Keyguard in the secure case. In the
|
||||
// insecure case, we actually show it on top of the lockscreen. See #canShowWhileOccluded.
|
||||
if (!mWindowManager.isKeyguardSecure()) {
|
||||
if (!mWindowManager.isKeyguardSecure(mService.getCurrentUserId())) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -345,7 +346,8 @@ class KeyguardController {
|
||||
* @return true if Keyguard can be currently dismissed without entering credentials.
|
||||
*/
|
||||
boolean canDismissKeyguard() {
|
||||
return mWindowManager.isKeyguardTrusted() || !mWindowManager.isKeyguardSecure();
|
||||
return mWindowManager.isKeyguardTrusted()
|
||||
|| !mWindowManager.isKeyguardSecure(mService.getCurrentUserId());
|
||||
}
|
||||
|
||||
private int resolveOccludeTransit() {
|
||||
@@ -487,7 +489,8 @@ class KeyguardController {
|
||||
}
|
||||
if (lastDismissActivity != mDismissingKeyguardActivity && !mOccluded
|
||||
&& mDismissingKeyguardActivity != null
|
||||
&& controller.mWindowManager.isKeyguardSecure()) {
|
||||
&& controller.mWindowManager.isKeyguardSecure(
|
||||
controller.mService.getCurrentUserId())) {
|
||||
mRequestDismissKeyguard = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -762,7 +762,7 @@ public class LockTaskController {
|
||||
} else {
|
||||
// If keyguard is not secure and it is locked, dismiss the keyguard before
|
||||
// disabling it, which avoids the platform to think the keyguard is still on.
|
||||
if (mWindowManager.isKeyguardLocked() && !mWindowManager.isKeyguardSecure()) {
|
||||
if (mWindowManager.isKeyguardLocked() && !mWindowManager.isKeyguardSecure(userId)) {
|
||||
mPendingDisableFromDismiss = userId;
|
||||
mWindowManager.dismissKeyguard(new IKeyguardDismissCallback.Stub() {
|
||||
@Override
|
||||
|
||||
@@ -2868,8 +2868,13 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isKeyguardSecure() {
|
||||
int userId = UserHandle.getCallingUserId();
|
||||
public boolean isKeyguardSecure(int userId) {
|
||||
if (userId != UserHandle.getCallingUserId()
|
||||
&& !checkCallingPermission(Manifest.permission.INTERACT_ACROSS_USERS,
|
||||
"isKeyguardSecure")) {
|
||||
throw new SecurityException("Requires INTERACT_ACROSS_USERS permission");
|
||||
}
|
||||
|
||||
long origId = Binder.clearCallingIdentity();
|
||||
try {
|
||||
return mPolicy.isKeyguardSecure(userId);
|
||||
|
||||
Reference in New Issue
Block a user