blob: 2a29616aab764f40057a9998127b4c5ee6403988 [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
2 * Copyright (C) 2007 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.app;
18
Tor Norbye672055e2015-04-23 17:30:56 -070019import android.Manifest;
Jorim Jaggi241ae102016-11-02 21:57:33 -070020import android.annotation.NonNull;
21import android.annotation.Nullable;
Tor Norbye672055e2015-04-23 17:30:56 -070022import android.annotation.RequiresPermission;
Jeff Sharkeyd86b8fe2017-06-02 17:36:26 -060023import android.annotation.SystemService;
Adrian Roosbcd07652014-10-22 16:57:16 +020024import android.app.trust.ITrustManager;
25import android.content.Context;
Jim Miller66093a92014-08-13 14:47:47 -070026import android.content.Intent;
Nancy Zheng43f166d2016-11-18 18:15:09 -080027import android.content.pm.PackageManager;
Nancy Zhenge256a182016-11-21 15:46:08 -080028import android.content.pm.ResolveInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080029import android.os.Binder;
Jorim Jaggi241ae102016-11-02 21:57:33 -070030import android.os.Handler;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080031import android.os.IBinder;
Nancy Zheng6111e232017-01-23 14:04:19 -080032import android.os.Looper;
Nancy Zhenge256a182016-11-21 15:46:08 -080033import android.os.RemoteException;
Adrian Roosbcd07652014-10-22 16:57:16 +020034import android.os.ServiceManager;
Jeff Sharkey49ca5292016-05-10 12:54:45 -060035import android.os.ServiceManager.ServiceNotFoundException;
Adrian Roosbcd07652014-10-22 16:57:16 +020036import android.os.UserHandle;
Jorim Jaggi241ae102016-11-02 21:57:33 -070037import android.util.Log;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080038import android.view.IOnKeyguardExitResult;
Nancy Zhenge256a182016-11-21 15:46:08 -080039import android.view.IWindowManager;
Jorim Jaggi241ae102016-11-02 21:57:33 -070040import android.view.WindowManager.LayoutParams;
Jeff Brown98365d72012-08-19 20:30:52 -070041import android.view.WindowManagerGlobal;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080042
Jorim Jaggi241ae102016-11-02 21:57:33 -070043import com.android.internal.policy.IKeyguardDismissCallback;
44
Nancy Zhenge256a182016-11-21 15:46:08 -080045import java.util.List;
46
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080047/**
Jeff Sharkeyd86b8fe2017-06-02 17:36:26 -060048 * Class that can be used to lock and unlock the keyboard. The
Jean-Michel Trivi37fde0a2012-05-24 17:13:06 -070049 * actual class to control the keyboard locking is
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080050 * {@link android.app.KeyguardManager.KeyguardLock}.
51 */
Jeff Sharkeyd86b8fe2017-06-02 17:36:26 -060052@SystemService(Context.KEYGUARD_SERVICE)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080053public class KeyguardManager {
Jorim Jaggi241ae102016-11-02 21:57:33 -070054
55 private static final String TAG = "KeyguardManager";
56
57 private final Context mContext;
58 private final IWindowManager mWM;
59 private final IActivityManager mAm;
60 private final ITrustManager mTrustManager;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080061
62 /**
Jim Miller66093a92014-08-13 14:47:47 -070063 * Intent used to prompt user for device credentials.
64 * @hide
65 */
66 public static final String ACTION_CONFIRM_DEVICE_CREDENTIAL =
67 "android.app.action.CONFIRM_DEVICE_CREDENTIAL";
68
69 /**
Clara Bayarrib3987bd2015-11-18 16:39:34 -080070 * Intent used to prompt user for device credentials.
71 * @hide
72 */
73 public static final String ACTION_CONFIRM_DEVICE_CREDENTIAL_WITH_USER =
74 "android.app.action.CONFIRM_DEVICE_CREDENTIAL_WITH_USER";
75
76 /**
Jim Miller66093a92014-08-13 14:47:47 -070077 * A CharSequence dialog title to show to the user when used with a
78 * {@link #ACTION_CONFIRM_DEVICE_CREDENTIAL}.
79 * @hide
80 */
81 public static final String EXTRA_TITLE = "android.app.extra.TITLE";
82
83 /**
84 * A CharSequence description to show to the user when used with
85 * {@link #ACTION_CONFIRM_DEVICE_CREDENTIAL}.
86 * @hide
87 */
88 public static final String EXTRA_DESCRIPTION = "android.app.extra.DESCRIPTION";
89
90 /**
91 * Get an intent to prompt the user to confirm credentials (pin, pattern or password)
92 * for the current user of the device. The caller is expected to launch this activity using
93 * {@link android.app.Activity#startActivityForResult(Intent, int)} and check for
94 * {@link android.app.Activity#RESULT_OK} if the user successfully completes the challenge.
95 *
96 * @return the intent for launching the activity or null if no password is required.
97 **/
Jim Millerbde3d182014-08-26 19:53:17 -070098 public Intent createConfirmDeviceCredentialIntent(CharSequence title, CharSequence description) {
Clara Bayarrib3987bd2015-11-18 16:39:34 -080099 if (!isDeviceSecure()) return null;
Jim Miller66093a92014-08-13 14:47:47 -0700100 Intent intent = new Intent(ACTION_CONFIRM_DEVICE_CREDENTIAL);
101 intent.putExtra(EXTRA_TITLE, title);
102 intent.putExtra(EXTRA_DESCRIPTION, description);
Nancy Zhenge256a182016-11-21 15:46:08 -0800103
104 // explicitly set the package for security
105 intent.setPackage(getSettingsPackageForIntent(intent));
Jim Miller66093a92014-08-13 14:47:47 -0700106 return intent;
107 }
108
109 /**
Clara Bayarrib3987bd2015-11-18 16:39:34 -0800110 * Get an intent to prompt the user to confirm credentials (pin, pattern or password)
111 * for the given user. The caller is expected to launch this activity using
112 * {@link android.app.Activity#startActivityForResult(Intent, int)} and check for
113 * {@link android.app.Activity#RESULT_OK} if the user successfully completes the challenge.
114 *
115 * @return the intent for launching the activity or null if no password is required.
116 *
117 * @hide
118 */
119 public Intent createConfirmDeviceCredentialIntent(
120 CharSequence title, CharSequence description, int userId) {
121 if (!isDeviceSecure(userId)) return null;
122 Intent intent = new Intent(ACTION_CONFIRM_DEVICE_CREDENTIAL_WITH_USER);
123 intent.putExtra(EXTRA_TITLE, title);
124 intent.putExtra(EXTRA_DESCRIPTION, description);
125 intent.putExtra(Intent.EXTRA_USER_ID, userId);
Nancy Zhenge256a182016-11-21 15:46:08 -0800126
127 // explicitly set the package for security
128 intent.setPackage(getSettingsPackageForIntent(intent));
129
Clara Bayarrib3987bd2015-11-18 16:39:34 -0800130 return intent;
131 }
132
Nancy Zhenge256a182016-11-21 15:46:08 -0800133 private String getSettingsPackageForIntent(Intent intent) {
134 List<ResolveInfo> resolveInfos = mContext.getPackageManager()
135 .queryIntentActivities(intent, PackageManager.MATCH_SYSTEM_ONLY);
136 for (int i = 0; i < resolveInfos.size(); i++) {
137 return resolveInfos.get(i).activityInfo.packageName;
138 }
139
140 return "com.android.settings";
141 }
142
Clara Bayarrib3987bd2015-11-18 16:39:34 -0800143 /**
Jorim Jaggi241ae102016-11-02 21:57:33 -0700144 * @deprecated Use {@link LayoutParams#FLAG_DISMISS_KEYGUARD}
145 * and/or {@link LayoutParams#FLAG_SHOW_WHEN_LOCKED}
Dianne Hackborn9567a662011-04-19 18:44:03 -0700146 * instead; this allows you to seamlessly hide the keyguard as your application
147 * moves in and out of the foreground and does not require that any special
148 * permissions be requested.
149 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800150 * Handle returned by {@link KeyguardManager#newKeyguardLock} that allows
151 * you to disable / reenable the keyguard.
152 */
Aurimas Liutikas514c5ef2016-05-24 15:22:55 -0700153 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800154 public class KeyguardLock {
Kenny Rootd7d2d432014-05-09 10:33:29 -0700155 private final IBinder mToken = new Binder();
156 private final String mTag;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800157
158 KeyguardLock(String tag) {
159 mTag = tag;
160 }
161
162 /**
163 * Disable the keyguard from showing. If the keyguard is currently
164 * showing, hide it. The keyguard will be prevented from showing again
165 * until {@link #reenableKeyguard()} is called.
166 *
167 * A good place to call this is from {@link android.app.Activity#onResume()}
168 *
Jim Miller66093a92014-08-13 14:47:47 -0700169 * Note: This call has no effect while any {@link android.app.admin.DevicePolicyManager}
Jim Millercb52cb52010-06-07 21:19:16 -0700170 * is enabled that requires a password.
Jim Millerd6b57052010-06-07 17:52:42 -0700171 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800172 * @see #reenableKeyguard()
173 */
Tor Norbye672055e2015-04-23 17:30:56 -0700174 @RequiresPermission(Manifest.permission.DISABLE_KEYGUARD)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800175 public void disableKeyguard() {
176 try {
177 mWM.disableKeyguard(mToken, mTag);
178 } catch (RemoteException ex) {
179 }
180 }
181
182 /**
183 * Reenable the keyguard. The keyguard will reappear if the previous
Jean-Michel Trivi37fde0a2012-05-24 17:13:06 -0700184 * call to {@link #disableKeyguard()} caused it to be hidden.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800185 *
Jim Millerd6b57052010-06-07 17:52:42 -0700186 * A good place to call this is from {@link android.app.Activity#onPause()}
187 *
Jim Millercb52cb52010-06-07 21:19:16 -0700188 * Note: This call has no effect while any {@link android.app.admin.DevicePolicyManager}
189 * is enabled that requires a password.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800190 *
191 * @see #disableKeyguard()
192 */
Tor Norbye672055e2015-04-23 17:30:56 -0700193 @RequiresPermission(Manifest.permission.DISABLE_KEYGUARD)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800194 public void reenableKeyguard() {
195 try {
196 mWM.reenableKeyguard(mToken);
197 } catch (RemoteException ex) {
198 }
199 }
200 }
201
202 /**
Jorim Jaggi241ae102016-11-02 21:57:33 -0700203 * @deprecated Use {@link KeyguardDismissCallback}
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800204 * Callback passed to {@link KeyguardManager#exitKeyguardSecurely} to notify
205 * caller of result.
206 */
Jorim Jaggi241ae102016-11-02 21:57:33 -0700207 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800208 public interface OnKeyguardExitResult {
209
210 /**
211 * @param success True if the user was able to authenticate, false if
212 * not.
213 */
214 void onKeyguardExitResult(boolean success);
215 }
216
Jorim Jaggi241ae102016-11-02 21:57:33 -0700217 /**
218 * Callback passed to {@link KeyguardManager#dismissKeyguard} to notify caller of result.
219 */
220 public static abstract class KeyguardDismissCallback {
221
222 /**
223 * Called when dismissing Keyguard is currently not feasible, i.e. when Keyguard is not
224 * available, not showing or when the activity requesting the Keyguard dismissal isn't
225 * showing or isn't showing behind Keyguard.
226 */
227 public void onDismissError() { }
228
229 /**
230 * Called when dismissing Keyguard has succeeded and the device is now unlocked.
231 */
232 public void onDismissSucceeded() { }
233
234 /**
235 * Called when dismissing Keyguard has been cancelled, i.e. when the user cancelled the
236 * operation or the bouncer was hidden for some other reason.
237 */
238 public void onDismissCancelled() { }
239 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800240
Nancy Zheng40cd8e42016-11-21 12:58:16 -0800241 KeyguardManager(Context context) throws ServiceNotFoundException {
Nancy Zheng43f166d2016-11-18 18:15:09 -0800242 mContext = context;
Jeff Brown98365d72012-08-19 20:30:52 -0700243 mWM = WindowManagerGlobal.getWindowManagerService();
Jorim Jaggi241ae102016-11-02 21:57:33 -0700244 mAm = ActivityManager.getService();
Adrian Roosbcd07652014-10-22 16:57:16 +0200245 mTrustManager = ITrustManager.Stub.asInterface(
Jeff Sharkey49ca5292016-05-10 12:54:45 -0600246 ServiceManager.getServiceOrThrow(Context.TRUST_SERVICE));
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800247 }
248
249 /**
Jorim Jaggi241ae102016-11-02 21:57:33 -0700250 * @deprecated Use {@link LayoutParams#FLAG_DISMISS_KEYGUARD}
251 * and/or {@link LayoutParams#FLAG_SHOW_WHEN_LOCKED}
Dianne Hackborn9567a662011-04-19 18:44:03 -0700252 * instead; this allows you to seamlessly hide the keyguard as your application
253 * moves in and out of the foreground and does not require that any special
254 * permissions be requested.
255 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800256 * Enables you to lock or unlock the keyboard. Get an instance of this class by
Jim Miller66093a92014-08-13 14:47:47 -0700257 * calling {@link android.content.Context#getSystemService(java.lang.String) Context.getSystemService()}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800258 * This class is wrapped by {@link android.app.KeyguardManager KeyguardManager}.
259 * @param tag A tag that informally identifies who you are (for debugging who
260 * is disabling he keyguard).
261 *
262 * @return A {@link KeyguardLock} handle to use to disable and reenable the
263 * keyguard.
264 */
Dianne Hackborn9567a662011-04-19 18:44:03 -0700265 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800266 public KeyguardLock newKeyguardLock(String tag) {
267 return new KeyguardLock(tag);
268 }
269
270 /**
Mike Lockwood520d8bc2011-02-18 13:23:13 -0500271 * Return whether the keyguard is currently locked.
272 *
Jean-Michel Trivi37fde0a2012-05-24 17:13:06 -0700273 * @return true if keyguard is locked.
Mike Lockwood520d8bc2011-02-18 13:23:13 -0500274 */
275 public boolean isKeyguardLocked() {
276 try {
Mike Lockwood50531242011-02-26 11:23:49 -0500277 return mWM.isKeyguardLocked();
Mike Lockwood520d8bc2011-02-18 13:23:13 -0500278 } catch (RemoteException ex) {
279 return false;
280 }
281 }
282
283 /**
Adrian Roosc39b4fc2015-04-28 15:48:00 -0700284 * Return whether the keyguard is secured by a PIN, pattern or password or a SIM card
285 * is currently locked.
Mike Lockwood520d8bc2011-02-18 13:23:13 -0500286 *
Adrian Roosc39b4fc2015-04-28 15:48:00 -0700287 * <p>See also {@link #isDeviceSecure()} which ignores SIM locked states.
288 *
289 * @return true if a PIN, pattern or password is set or a SIM card is locked.
Mike Lockwood520d8bc2011-02-18 13:23:13 -0500290 */
291 public boolean isKeyguardSecure() {
292 try {
293 return mWM.isKeyguardSecure();
294 } catch (RemoteException ex) {
295 return false;
296 }
297 }
298
299 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800300 * If keyguard screen is showing or in restricted key input mode (i.e. in
301 * keyguard password emergency screen). When in such mode, certain keys,
302 * such as the Home key and the right soft keys, don't work.
303 *
304 * @return true if in keyguard restricted input mode.
305 *
306 * @see android.view.WindowManagerPolicy#inKeyguardRestrictedKeyInputMode
307 */
308 public boolean inKeyguardRestrictedInputMode() {
309 try {
310 return mWM.inKeyguardRestrictedInputMode();
311 } catch (RemoteException ex) {
312 return false;
313 }
314 }
315
316 /**
Adrian Roos50bfeec2014-11-20 16:21:11 +0100317 * Returns whether the device is currently locked and requires a PIN, pattern or
318 * password to unlock.
Adrian Roosbcd07652014-10-22 16:57:16 +0200319 *
Adrian Roos50bfeec2014-11-20 16:21:11 +0100320 * @return true if unlocking the device currently requires a PIN, pattern or
321 * password.
Adrian Roosbcd07652014-10-22 16:57:16 +0200322 */
Adrian Roos50bfeec2014-11-20 16:21:11 +0100323 public boolean isDeviceLocked() {
Adrian Roos0b1853f2017-01-23 12:38:13 -0800324 return isDeviceLocked(UserHandle.myUserId());
Adrian Roosbcd07652014-10-22 16:57:16 +0200325 }
326
327 /**
Adrian Roosc39b4fc2015-04-28 15:48:00 -0700328 * Per-user version of {@link #isDeviceLocked()}.
Adrian Roosbcd07652014-10-22 16:57:16 +0200329 *
Adrian Roosbcd07652014-10-22 16:57:16 +0200330 * @hide
331 */
Adrian Roos50bfeec2014-11-20 16:21:11 +0100332 public boolean isDeviceLocked(int userId) {
Adrian Roosbcd07652014-10-22 16:57:16 +0200333 try {
Jorim Jaggi241ae102016-11-02 21:57:33 -0700334 return mTrustManager.isDeviceLocked(userId);
Adrian Roosbcd07652014-10-22 16:57:16 +0200335 } catch (RemoteException e) {
336 return false;
337 }
338 }
339
340 /**
Adrian Roos82893682015-04-02 16:17:46 +0200341 * Returns whether the device is secured with a PIN, pattern or
342 * password.
343 *
Adrian Roosc39b4fc2015-04-28 15:48:00 -0700344 * <p>See also {@link #isKeyguardSecure} which treats SIM locked states as secure.
345 *
Adrian Roos82893682015-04-02 16:17:46 +0200346 * @return true if a PIN, pattern or password was set.
347 */
348 public boolean isDeviceSecure() {
Adrian Roos0b1853f2017-01-23 12:38:13 -0800349 return isDeviceSecure(UserHandle.myUserId());
Adrian Roos82893682015-04-02 16:17:46 +0200350 }
351
352 /**
Adrian Roosc39b4fc2015-04-28 15:48:00 -0700353 * Per-user version of {@link #isDeviceSecure()}.
Adrian Roos82893682015-04-02 16:17:46 +0200354 *
Adrian Roos82893682015-04-02 16:17:46 +0200355 * @hide
356 */
357 public boolean isDeviceSecure(int userId) {
358 try {
Jorim Jaggi241ae102016-11-02 21:57:33 -0700359 return mTrustManager.isDeviceSecure(userId);
Adrian Roos82893682015-04-02 16:17:46 +0200360 } catch (RemoteException e) {
361 return false;
362 }
363 }
364
Jeff Sharkey000ce802017-04-29 13:13:27 -0600365 /** @removed */
Jorim Jaggif41e7662017-04-27 14:30:39 +0200366 @Deprecated
Jorim Jaggi241ae102016-11-02 21:57:33 -0700367 public void dismissKeyguard(@NonNull Activity activity,
368 @Nullable KeyguardDismissCallback callback, @Nullable Handler handler) {
Jorim Jaggif41e7662017-04-27 14:30:39 +0200369 requestDismissKeyguard(activity, callback);
370 }
371
372 /**
373 * If the device is currently locked (see {@link #isKeyguardLocked()}, requests the Keyguard to
374 * be dismissed.
375 * <p>
376 * If the Keyguard is not secure or the device is currently in a trusted state, calling this
377 * method will immediately dismiss the Keyguard without any user interaction.
378 * <p>
379 * If the Keyguard is secure and the device is not in a trusted state, this will bring up the
380 * UI so the user can enter their credentials.
381 *
382 * @param activity The activity requesting the dismissal. The activity must be either visible
383 * by using {@link LayoutParams#FLAG_SHOW_WHEN_LOCKED} or must be in a state in
384 * which it would be visible if Keyguard would not be hiding it. If that's not
385 * the case, the request will fail immediately and
386 * {@link KeyguardDismissCallback#onDismissError} will be invoked.
387 * @param callback The callback to be called if the request to dismiss Keyguard was successful
388 * or {@code null} if the caller isn't interested in knowing the result. The
389 * callback will not be invoked if the activity was destroyed before the
390 * callback was received.
391 */
392 public void requestDismissKeyguard(@NonNull Activity activity,
393 @Nullable KeyguardDismissCallback callback) {
Jorim Jaggi241ae102016-11-02 21:57:33 -0700394 try {
Jorim Jaggi241ae102016-11-02 21:57:33 -0700395 mAm.dismissKeyguard(activity.getActivityToken(), new IKeyguardDismissCallback.Stub() {
396 @Override
397 public void onDismissError() throws RemoteException {
Jorim Jaggif41e7662017-04-27 14:30:39 +0200398 if (callback != null && !activity.isDestroyed()) {
399 activity.mHandler.post(callback::onDismissError);
400 }
Jorim Jaggi241ae102016-11-02 21:57:33 -0700401 }
402
403 @Override
404 public void onDismissSucceeded() throws RemoteException {
Jorim Jaggif41e7662017-04-27 14:30:39 +0200405 if (callback != null && !activity.isDestroyed()) {
406 activity.mHandler.post(callback::onDismissSucceeded);
407 }
Jorim Jaggi241ae102016-11-02 21:57:33 -0700408 }
409
410 @Override
411 public void onDismissCancelled() throws RemoteException {
Jorim Jaggif41e7662017-04-27 14:30:39 +0200412 if (callback != null && !activity.isDestroyed()) {
413 activity.mHandler.post(callback::onDismissCancelled);
414 }
Jorim Jaggi241ae102016-11-02 21:57:33 -0700415 }
416 });
417 } catch (RemoteException e) {
418 Log.i(TAG, "Failed to dismiss keyguard: " + e);
Clara Bayarri56878a92015-10-29 15:43:55 +0000419 }
Clara Bayarri56878a92015-10-29 15:43:55 +0000420 }
421
Adrian Roos82893682015-04-02 16:17:46 +0200422 /**
Jorim Jaggi241ae102016-11-02 21:57:33 -0700423 * @deprecated Use {@link LayoutParams#FLAG_DISMISS_KEYGUARD}
424 * and/or {@link LayoutParams#FLAG_SHOW_WHEN_LOCKED}
Dianne Hackborn9567a662011-04-19 18:44:03 -0700425 * instead; this allows you to seamlessly hide the keyguard as your application
426 * moves in and out of the foreground and does not require that any special
427 * permissions be requested.
428 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800429 * Exit the keyguard securely. The use case for this api is that, after
430 * disabling the keyguard, your app, which was granted permission to
431 * disable the keyguard and show a limited amount of information deemed
432 * safe without the user getting past the keyguard, needs to navigate to
433 * something that is not safe to view without getting past the keyguard.
434 *
435 * This will, if the keyguard is secure, bring up the unlock screen of
436 * the keyguard.
437 *
438 * @param callback Let's you know whether the operation was succesful and
439 * it is safe to launch anything that would normally be considered safe
440 * once the user has gotten past the keyguard.
441 */
Dianne Hackborn9567a662011-04-19 18:44:03 -0700442 @Deprecated
Tor Norbye672055e2015-04-23 17:30:56 -0700443 @RequiresPermission(Manifest.permission.DISABLE_KEYGUARD)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800444 public void exitKeyguardSecurely(final OnKeyguardExitResult callback) {
445 try {
446 mWM.exitKeyguardSecurely(new IOnKeyguardExitResult.Stub() {
447 public void onKeyguardExitResult(boolean success) throws RemoteException {
Jim Millera999d462013-10-30 13:58:11 -0700448 if (callback != null) {
449 callback.onKeyguardExitResult(success);
450 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800451 }
452 });
453 } catch (RemoteException e) {
454
455 }
456 }
457}