Loading core/java/android/app/KeyguardManager.java +36 −1 Original line number Diff line number Diff line Loading @@ -21,11 +21,14 @@ import android.annotation.RequiresPermission; import android.app.trust.ITrustManager; import android.content.Context; import android.content.Intent; import android.content.pm.UserInfo; import android.os.Binder; import android.os.RemoteException; import android.os.IBinder; import android.os.IUserManager; import android.os.ServiceManager; import android.os.UserHandle; import android.os.UserManager; import android.view.IWindowManager; import android.view.IOnKeyguardExitResult; import android.view.WindowManagerGlobal; Loading @@ -40,6 +43,7 @@ import android.view.WindowManagerGlobal; public class KeyguardManager { private IWindowManager mWM; private ITrustManager mTrustManager; private IUserManager mUserManager; /** * Intent used to prompt user for device credentials. Loading @@ -48,6 +52,13 @@ public class KeyguardManager { public static final String ACTION_CONFIRM_DEVICE_CREDENTIAL = "android.app.action.CONFIRM_DEVICE_CREDENTIAL"; /** * Intent used to prompt user for device credentials. * @hide */ public static final String ACTION_CONFIRM_DEVICE_CREDENTIAL_WITH_USER = "android.app.action.CONFIRM_DEVICE_CREDENTIAL_WITH_USER"; /** * A CharSequence dialog title to show to the user when used with a * {@link #ACTION_CONFIRM_DEVICE_CREDENTIAL}. Loading @@ -71,7 +82,7 @@ public class KeyguardManager { * @return the intent for launching the activity or null if no password is required. **/ public Intent createConfirmDeviceCredentialIntent(CharSequence title, CharSequence description) { if (!isKeyguardSecure()) return null; if (!isDeviceSecure()) return null; Intent intent = new Intent(ACTION_CONFIRM_DEVICE_CREDENTIAL); intent.putExtra(EXTRA_TITLE, title); intent.putExtra(EXTRA_DESCRIPTION, description); Loading @@ -80,6 +91,28 @@ public class KeyguardManager { return intent; } /** * Get an intent to prompt the user to confirm credentials (pin, pattern or password) * for the given user. The caller is expected to launch this activity using * {@link android.app.Activity#startActivityForResult(Intent, int)} and check for * {@link android.app.Activity#RESULT_OK} if the user successfully completes the challenge. * * @return the intent for launching the activity or null if no password is required. * * @hide */ public Intent createConfirmDeviceCredentialIntent( CharSequence title, CharSequence description, int userId) { if (!isDeviceSecure(userId)) return null; Intent intent = new Intent(ACTION_CONFIRM_DEVICE_CREDENTIAL_WITH_USER); intent.putExtra(EXTRA_TITLE, title); intent.putExtra(EXTRA_DESCRIPTION, description); intent.putExtra(Intent.EXTRA_USER_ID, userId); // For security reasons, only allow this to come from system settings. intent.setPackage("com.android.settings"); return intent; } /** * @deprecated Use {@link android.view.WindowManager.LayoutParams#FLAG_DISMISS_KEYGUARD} * and/or {@link android.view.WindowManager.LayoutParams#FLAG_SHOW_WHEN_LOCKED} Loading Loading @@ -162,6 +195,8 @@ public class KeyguardManager { mWM = WindowManagerGlobal.getWindowManagerService(); mTrustManager = ITrustManager.Stub.asInterface( ServiceManager.getService(Context.TRUST_SERVICE)); mUserManager = IUserManager.Stub.asInterface( ServiceManager.getService(Context.USER_SERVICE)); } /** Loading services/core/java/com/android/server/am/ActivityStackSupervisor.java +17 −15 Original line number Diff line number Diff line Loading @@ -1624,12 +1624,13 @@ public final class ActivityStackSupervisor implements DisplayListener { PendingIntent.FLAG_CANCEL_CURRENT | PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_IMMUTABLE, null); int flags = intent.getFlags(); intent = km.createConfirmDeviceCredentialIntent(null, null); intent.addFlags(FLAG_ACTIVITY_NEW_TASK Intent newIntent = km.createConfirmDeviceCredentialIntent(null, null, user.id); if (newIntent != null) { intent = newIntent; intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS); intent.putExtra(Intent.EXTRA_PACKAGE_NAME, aInfo.packageName); intent.putExtra(Intent.EXTRA_INTENT, new IntentSender(target)); intent.putExtra(Intent.EXTRA_USER_ID, userId); intent.setFlags(flags); resolvedType = null; Loading @@ -1640,6 +1641,7 @@ public final class ActivityStackSupervisor implements DisplayListener { aInfo = resolveActivity(intent, null, PackageManager.MATCH_DEFAULT_ONLY | ActivityManagerService.STOCK_PM_FLAGS, null, parent.id); } } if (abort) { if (resultRecord != null) { Loading services/core/java/com/android/server/trust/TrustManagerService.java +3 −2 Original line number Diff line number Diff line Loading @@ -53,7 +53,6 @@ import android.os.RemoteException; import android.os.SystemClock; import android.os.UserHandle; import android.os.UserManager; import android.os.storage.StorageManager; import android.provider.Settings; import android.service.trust.TrustAgentService; import android.util.ArraySet; Loading Loading @@ -681,7 +680,9 @@ public class TrustManagerService extends SystemService { public boolean isDeviceSecure(int userId) throws RemoteException { userId = ActivityManager.handleIncomingUser(getCallingPid(), getCallingUid(), userId, false /* allowAll */, true /* requireFull */, "isDeviceSecure", null); if (!LockPatternUtils.isSeparateWorkChallengeEnabled()) { userId = resolveProfileParent(userId); } long token = Binder.clearCallingIdentity(); try { Loading Loading
core/java/android/app/KeyguardManager.java +36 −1 Original line number Diff line number Diff line Loading @@ -21,11 +21,14 @@ import android.annotation.RequiresPermission; import android.app.trust.ITrustManager; import android.content.Context; import android.content.Intent; import android.content.pm.UserInfo; import android.os.Binder; import android.os.RemoteException; import android.os.IBinder; import android.os.IUserManager; import android.os.ServiceManager; import android.os.UserHandle; import android.os.UserManager; import android.view.IWindowManager; import android.view.IOnKeyguardExitResult; import android.view.WindowManagerGlobal; Loading @@ -40,6 +43,7 @@ import android.view.WindowManagerGlobal; public class KeyguardManager { private IWindowManager mWM; private ITrustManager mTrustManager; private IUserManager mUserManager; /** * Intent used to prompt user for device credentials. Loading @@ -48,6 +52,13 @@ public class KeyguardManager { public static final String ACTION_CONFIRM_DEVICE_CREDENTIAL = "android.app.action.CONFIRM_DEVICE_CREDENTIAL"; /** * Intent used to prompt user for device credentials. * @hide */ public static final String ACTION_CONFIRM_DEVICE_CREDENTIAL_WITH_USER = "android.app.action.CONFIRM_DEVICE_CREDENTIAL_WITH_USER"; /** * A CharSequence dialog title to show to the user when used with a * {@link #ACTION_CONFIRM_DEVICE_CREDENTIAL}. Loading @@ -71,7 +82,7 @@ public class KeyguardManager { * @return the intent for launching the activity or null if no password is required. **/ public Intent createConfirmDeviceCredentialIntent(CharSequence title, CharSequence description) { if (!isKeyguardSecure()) return null; if (!isDeviceSecure()) return null; Intent intent = new Intent(ACTION_CONFIRM_DEVICE_CREDENTIAL); intent.putExtra(EXTRA_TITLE, title); intent.putExtra(EXTRA_DESCRIPTION, description); Loading @@ -80,6 +91,28 @@ public class KeyguardManager { return intent; } /** * Get an intent to prompt the user to confirm credentials (pin, pattern or password) * for the given user. The caller is expected to launch this activity using * {@link android.app.Activity#startActivityForResult(Intent, int)} and check for * {@link android.app.Activity#RESULT_OK} if the user successfully completes the challenge. * * @return the intent for launching the activity or null if no password is required. * * @hide */ public Intent createConfirmDeviceCredentialIntent( CharSequence title, CharSequence description, int userId) { if (!isDeviceSecure(userId)) return null; Intent intent = new Intent(ACTION_CONFIRM_DEVICE_CREDENTIAL_WITH_USER); intent.putExtra(EXTRA_TITLE, title); intent.putExtra(EXTRA_DESCRIPTION, description); intent.putExtra(Intent.EXTRA_USER_ID, userId); // For security reasons, only allow this to come from system settings. intent.setPackage("com.android.settings"); return intent; } /** * @deprecated Use {@link android.view.WindowManager.LayoutParams#FLAG_DISMISS_KEYGUARD} * and/or {@link android.view.WindowManager.LayoutParams#FLAG_SHOW_WHEN_LOCKED} Loading Loading @@ -162,6 +195,8 @@ public class KeyguardManager { mWM = WindowManagerGlobal.getWindowManagerService(); mTrustManager = ITrustManager.Stub.asInterface( ServiceManager.getService(Context.TRUST_SERVICE)); mUserManager = IUserManager.Stub.asInterface( ServiceManager.getService(Context.USER_SERVICE)); } /** Loading
services/core/java/com/android/server/am/ActivityStackSupervisor.java +17 −15 Original line number Diff line number Diff line Loading @@ -1624,12 +1624,13 @@ public final class ActivityStackSupervisor implements DisplayListener { PendingIntent.FLAG_CANCEL_CURRENT | PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_IMMUTABLE, null); int flags = intent.getFlags(); intent = km.createConfirmDeviceCredentialIntent(null, null); intent.addFlags(FLAG_ACTIVITY_NEW_TASK Intent newIntent = km.createConfirmDeviceCredentialIntent(null, null, user.id); if (newIntent != null) { intent = newIntent; intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS); intent.putExtra(Intent.EXTRA_PACKAGE_NAME, aInfo.packageName); intent.putExtra(Intent.EXTRA_INTENT, new IntentSender(target)); intent.putExtra(Intent.EXTRA_USER_ID, userId); intent.setFlags(flags); resolvedType = null; Loading @@ -1640,6 +1641,7 @@ public final class ActivityStackSupervisor implements DisplayListener { aInfo = resolveActivity(intent, null, PackageManager.MATCH_DEFAULT_ONLY | ActivityManagerService.STOCK_PM_FLAGS, null, parent.id); } } if (abort) { if (resultRecord != null) { Loading
services/core/java/com/android/server/trust/TrustManagerService.java +3 −2 Original line number Diff line number Diff line Loading @@ -53,7 +53,6 @@ import android.os.RemoteException; import android.os.SystemClock; import android.os.UserHandle; import android.os.UserManager; import android.os.storage.StorageManager; import android.provider.Settings; import android.service.trust.TrustAgentService; import android.util.ArraySet; Loading Loading @@ -681,7 +680,9 @@ public class TrustManagerService extends SystemService { public boolean isDeviceSecure(int userId) throws RemoteException { userId = ActivityManager.handleIncomingUser(getCallingPid(), getCallingUid(), userId, false /* allowAll */, true /* requireFull */, "isDeviceSecure", null); if (!LockPatternUtils.isSeparateWorkChallengeEnabled()) { userId = resolveProfileParent(userId); } long token = Binder.clearCallingIdentity(); try { Loading