Kevin Chyn | aae4a15 | 2018-01-18 11:48:09 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2018 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 | |
Kevin Chyn | e927566 | 2018-07-23 16:42:06 -0700 | [diff] [blame] | 17 | package com.android.systemui.biometrics; |
Kevin Chyn | aae4a15 | 2018-01-18 11:48:09 -0800 | [diff] [blame] | 18 | |
Kevin Chyn | 050315f | 2019-08-08 14:22:54 -0700 | [diff] [blame^] | 19 | import android.app.ActivityManager; |
| 20 | import android.app.ActivityTaskManager; |
| 21 | import android.app.IActivityTaskManager; |
| 22 | import android.app.TaskStackListener; |
Kevin Chyn | 42653e8 | 2018-01-19 14:15:46 -0800 | [diff] [blame] | 23 | import android.content.Context; |
Kevin Chyn | aae4a15 | 2018-01-18 11:48:09 -0800 | [diff] [blame] | 24 | import android.content.pm.PackageManager; |
Gus Prevas | a7df7b2 | 2018-10-30 10:29:34 -0400 | [diff] [blame] | 25 | import android.content.res.Configuration; |
Vishwath Mohan | ecf00ce | 2018-04-05 10:28:24 -0700 | [diff] [blame] | 26 | import android.hardware.biometrics.BiometricPrompt; |
Kevin Chyn | 23289ef | 2018-11-28 16:32:36 -0800 | [diff] [blame] | 27 | import android.hardware.biometrics.IBiometricServiceReceiverInternal; |
Kevin Chyn | aae4a15 | 2018-01-18 11:48:09 -0800 | [diff] [blame] | 28 | import android.os.Bundle; |
Kevin Chyn | 050315f | 2019-08-08 14:22:54 -0700 | [diff] [blame^] | 29 | import android.os.Handler; |
| 30 | import android.os.Looper; |
Kevin Chyn | 42653e8 | 2018-01-19 14:15:46 -0800 | [diff] [blame] | 31 | import android.os.RemoteException; |
Kevin Chyn | aae4a15 | 2018-01-18 11:48:09 -0800 | [diff] [blame] | 32 | import android.util.Log; |
Kevin Chyn | 42653e8 | 2018-01-19 14:15:46 -0800 | [diff] [blame] | 33 | import android.view.WindowManager; |
Kevin Chyn | aae4a15 | 2018-01-18 11:48:09 -0800 | [diff] [blame] | 34 | |
Kevin Chyn | 050315f | 2019-08-08 14:22:54 -0700 | [diff] [blame^] | 35 | import com.android.internal.annotations.VisibleForTesting; |
Kevin Chyn | 42653e8 | 2018-01-19 14:15:46 -0800 | [diff] [blame] | 36 | import com.android.internal.os.SomeArgs; |
Kevin Chyn | aae4a15 | 2018-01-18 11:48:09 -0800 | [diff] [blame] | 37 | import com.android.systemui.SystemUI; |
Kevin Chyn | c53d981 | 2019-07-30 18:10:30 -0700 | [diff] [blame] | 38 | import com.android.systemui.biometrics.ui.BiometricDialogView; |
Kevin Chyn | aae4a15 | 2018-01-18 11:48:09 -0800 | [diff] [blame] | 39 | import com.android.systemui.statusbar.CommandQueue; |
| 40 | |
Kevin Chyn | 050315f | 2019-08-08 14:22:54 -0700 | [diff] [blame^] | 41 | import java.util.List; |
| 42 | |
Kevin Chyn | e927566 | 2018-07-23 16:42:06 -0700 | [diff] [blame] | 43 | /** |
Kevin Chyn | c53d981 | 2019-07-30 18:10:30 -0700 | [diff] [blame] | 44 | * Receives messages sent from {@link com.android.server.biometrics.BiometricService} and shows the |
| 45 | * appropriate biometric UI (e.g. BiometricDialogView). |
Kevin Chyn | e927566 | 2018-07-23 16:42:06 -0700 | [diff] [blame] | 46 | */ |
Kevin Chyn | c53d981 | 2019-07-30 18:10:30 -0700 | [diff] [blame] | 47 | public class BiometricDialogImpl extends SystemUI implements CommandQueue.Callbacks, |
| 48 | DialogViewCallback { |
Kevin Chyn | 5a2ff5d | 2018-08-29 19:07:30 -0700 | [diff] [blame] | 49 | private static final String TAG = "BiometricDialogImpl"; |
Kevin Chyn | 42653e8 | 2018-01-19 14:15:46 -0800 | [diff] [blame] | 50 | private static final boolean DEBUG = true; |
| 51 | |
Kevin Chyn | 050315f | 2019-08-08 14:22:54 -0700 | [diff] [blame^] | 52 | private final Injector mInjector; |
| 53 | |
Kevin Chyn | c53d981 | 2019-07-30 18:10:30 -0700 | [diff] [blame] | 54 | // TODO: These should just be saved from onSaveState |
Gus Prevas | a7df7b2 | 2018-10-30 10:29:34 -0400 | [diff] [blame] | 55 | private SomeArgs mCurrentDialogArgs; |
Kevin Chyn | 050315f | 2019-08-08 14:22:54 -0700 | [diff] [blame^] | 56 | @VisibleForTesting |
| 57 | BiometricDialog mCurrentDialog; |
Kevin Chyn | c53d981 | 2019-07-30 18:10:30 -0700 | [diff] [blame] | 58 | |
Kevin Chyn | 050315f | 2019-08-08 14:22:54 -0700 | [diff] [blame^] | 59 | private Handler mHandler = new Handler(Looper.getMainLooper()); |
Kevin Chyn | 42653e8 | 2018-01-19 14:15:46 -0800 | [diff] [blame] | 60 | private WindowManager mWindowManager; |
Kevin Chyn | 050315f | 2019-08-08 14:22:54 -0700 | [diff] [blame^] | 61 | @VisibleForTesting |
| 62 | IActivityTaskManager mActivityTaskManager; |
| 63 | @VisibleForTesting |
| 64 | BiometricTaskStackListener mTaskStackListener; |
| 65 | @VisibleForTesting |
| 66 | IBiometricServiceReceiverInternal mReceiver; |
| 67 | |
| 68 | public class BiometricTaskStackListener extends TaskStackListener { |
| 69 | @Override |
| 70 | public void onTaskStackChanged() { |
| 71 | mHandler.post(mTaskStackChangedRunnable); |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | private final Runnable mTaskStackChangedRunnable = () -> { |
| 76 | if (mCurrentDialog != null) { |
| 77 | try { |
| 78 | final String clientPackage = mCurrentDialog.getOpPackageName(); |
| 79 | Log.w(TAG, "Task stack changed, current client: " + clientPackage); |
| 80 | final List<ActivityManager.RunningTaskInfo> runningTasks = |
| 81 | mActivityTaskManager.getTasks(1); |
| 82 | if (!runningTasks.isEmpty()) { |
| 83 | final String topPackage = runningTasks.get(0).topActivity.getPackageName(); |
| 84 | if (!topPackage.contentEquals(clientPackage)) { |
| 85 | Log.w(TAG, "Evicting client due to: " + topPackage); |
| 86 | mCurrentDialog.dismissWithoutCallback(true /* animate */); |
| 87 | mCurrentDialog = null; |
| 88 | mReceiver.onDialogDismissed(BiometricPrompt.DISMISSED_REASON_USER_CANCEL); |
| 89 | mReceiver = null; |
| 90 | } |
| 91 | } |
| 92 | } catch (RemoteException e) { |
| 93 | Log.e(TAG, "Remote exception", e); |
| 94 | } |
| 95 | } |
| 96 | }; |
Kevin Chyn | 42653e8 | 2018-01-19 14:15:46 -0800 | [diff] [blame] | 97 | |
Kevin Chyn | c53d981 | 2019-07-30 18:10:30 -0700 | [diff] [blame] | 98 | @Override |
| 99 | public void onTryAgainPressed() { |
| 100 | try { |
| 101 | mReceiver.onTryAgainPressed(); |
| 102 | } catch (RemoteException e) { |
| 103 | Log.e(TAG, "RemoteException when handling try again", e); |
Kevin Chyn | 5906c17 | 2018-07-23 15:43:02 -0700 | [diff] [blame] | 104 | } |
| 105 | } |
| 106 | |
Kevin Chyn | c53d981 | 2019-07-30 18:10:30 -0700 | [diff] [blame] | 107 | @Override |
Kevin Chyn | 050315f | 2019-08-08 14:22:54 -0700 | [diff] [blame^] | 108 | public void onDismissed(@DismissedReason int reason) { |
Kevin Chyn | c53d981 | 2019-07-30 18:10:30 -0700 | [diff] [blame] | 109 | switch (reason) { |
| 110 | case DialogViewCallback.DISMISSED_USER_CANCELED: |
| 111 | sendResultAndCleanUp(BiometricPrompt.DISMISSED_REASON_USER_CANCEL); |
| 112 | break; |
| 113 | |
| 114 | case DialogViewCallback.DISMISSED_BUTTON_NEGATIVE: |
| 115 | sendResultAndCleanUp(BiometricPrompt.DISMISSED_REASON_NEGATIVE); |
| 116 | break; |
| 117 | |
| 118 | case DialogViewCallback.DISMISSED_BUTTON_POSITIVE: |
| 119 | sendResultAndCleanUp(BiometricPrompt.DISMISSED_REASON_CONFIRMED); |
| 120 | break; |
| 121 | |
| 122 | case DialogViewCallback.DISMISSED_AUTHENTICATED: |
| 123 | sendResultAndCleanUp(BiometricPrompt.DISMISSED_REASON_CONFIRM_NOT_REQUIRED); |
Kevin Chyn | c53d981 | 2019-07-30 18:10:30 -0700 | [diff] [blame] | 124 | break; |
| 125 | |
| 126 | case DialogViewCallback.DISMISSED_ERROR: |
| 127 | sendResultAndCleanUp(BiometricPrompt.DISMISSED_REASON_ERROR); |
Kevin Chyn | c53d981 | 2019-07-30 18:10:30 -0700 | [diff] [blame] | 128 | break; |
Kevin Chyn | 050315f | 2019-08-08 14:22:54 -0700 | [diff] [blame^] | 129 | |
| 130 | case DialogViewCallback.DISMISSED_BY_SYSTEM_SERVER: |
| 131 | sendResultAndCleanUp(BiometricPrompt.DISMISSED_REASON_SERVER_REQUESTED); |
| 132 | break; |
| 133 | |
Kevin Chyn | c53d981 | 2019-07-30 18:10:30 -0700 | [diff] [blame] | 134 | default: |
| 135 | Log.e(TAG, "Unhandled reason: " + reason); |
| 136 | break; |
Kevin Chyn | c94b7db | 2019-05-15 17:28:16 -0700 | [diff] [blame] | 137 | } |
Kevin Chyn | c53d981 | 2019-07-30 18:10:30 -0700 | [diff] [blame] | 138 | } |
| 139 | |
Kevin Chyn | 050315f | 2019-08-08 14:22:54 -0700 | [diff] [blame^] | 140 | private void sendResultAndCleanUp(@DismissedReason int reason) { |
Kevin Chyn | c53d981 | 2019-07-30 18:10:30 -0700 | [diff] [blame] | 141 | if (mReceiver == null) { |
| 142 | Log.e(TAG, "Receiver is null"); |
| 143 | return; |
| 144 | } |
| 145 | try { |
Kevin Chyn | 050315f | 2019-08-08 14:22:54 -0700 | [diff] [blame^] | 146 | mReceiver.onDialogDismissed(reason); |
Kevin Chyn | c53d981 | 2019-07-30 18:10:30 -0700 | [diff] [blame] | 147 | } catch (RemoteException e) { |
| 148 | Log.w(TAG, "Remote exception", e); |
| 149 | } |
Kevin Chyn | 050315f | 2019-08-08 14:22:54 -0700 | [diff] [blame^] | 150 | onDialogDismissed(reason); |
| 151 | } |
| 152 | |
| 153 | public static class Injector { |
| 154 | IActivityTaskManager getActivityTaskManager() { |
| 155 | return ActivityTaskManager.getService(); |
| 156 | } |
| 157 | } |
| 158 | |
| 159 | public BiometricDialogImpl() { |
| 160 | this(new Injector()); |
| 161 | } |
| 162 | |
| 163 | @VisibleForTesting |
| 164 | BiometricDialogImpl(Injector injector) { |
| 165 | mInjector = injector; |
Kevin Chyn | c53d981 | 2019-07-30 18:10:30 -0700 | [diff] [blame] | 166 | } |
Kevin Chyn | c94b7db | 2019-05-15 17:28:16 -0700 | [diff] [blame] | 167 | |
Kevin Chyn | aae4a15 | 2018-01-18 11:48:09 -0800 | [diff] [blame] | 168 | @Override |
| 169 | public void start() { |
Kevin Chyn | e191271 | 2019-01-04 14:22:34 -0800 | [diff] [blame] | 170 | final PackageManager pm = mContext.getPackageManager(); |
| 171 | if (pm.hasSystemFeature(PackageManager.FEATURE_FINGERPRINT) |
| 172 | || pm.hasSystemFeature(PackageManager.FEATURE_FACE) |
| 173 | || pm.hasSystemFeature(PackageManager.FEATURE_IRIS)) { |
Jason Monk | d7c9855 | 2018-12-04 11:14:50 -0500 | [diff] [blame] | 174 | getComponent(CommandQueue.class).addCallback(this); |
Gus Prevas | a7df7b2 | 2018-10-30 10:29:34 -0400 | [diff] [blame] | 175 | mWindowManager = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE); |
Kevin Chyn | 050315f | 2019-08-08 14:22:54 -0700 | [diff] [blame^] | 176 | mActivityTaskManager = mInjector.getActivityTaskManager(); |
| 177 | |
| 178 | try { |
| 179 | mTaskStackListener = new BiometricTaskStackListener(); |
| 180 | mActivityTaskManager.registerTaskStackListener(mTaskStackListener); |
| 181 | } catch (RemoteException e) { |
| 182 | Log.w(TAG, "Unable to register task stack listener", e); |
| 183 | } |
Gus Prevas | a7df7b2 | 2018-10-30 10:29:34 -0400 | [diff] [blame] | 184 | } |
| 185 | } |
| 186 | |
Kevin Chyn | aae4a15 | 2018-01-18 11:48:09 -0800 | [diff] [blame] | 187 | @Override |
Kevin Chyn | 23289ef | 2018-11-28 16:32:36 -0800 | [diff] [blame] | 188 | public void showBiometricDialog(Bundle bundle, IBiometricServiceReceiverInternal receiver, |
Kevin Chyn | 050315f | 2019-08-08 14:22:54 -0700 | [diff] [blame^] | 189 | int type, boolean requireConfirmation, int userId, String opPackageName) { |
Kevin Chyn | 158fefb | 2019-01-03 18:59:05 -0800 | [diff] [blame] | 190 | if (DEBUG) { |
| 191 | Log.d(TAG, "showBiometricDialog, type: " + type |
| 192 | + ", requireConfirmation: " + requireConfirmation); |
| 193 | } |
Kevin Chyn | 42653e8 | 2018-01-19 14:15:46 -0800 | [diff] [blame] | 194 | SomeArgs args = SomeArgs.obtain(); |
| 195 | args.arg1 = bundle; |
| 196 | args.arg2 = receiver; |
Kevin Chyn | 6cf54e8 | 2018-09-18 19:13:27 -0700 | [diff] [blame] | 197 | args.argi1 = type; |
| 198 | args.arg3 = requireConfirmation; |
Kevin Chyn | 1b9f8df | 2018-11-12 19:04:55 -0800 | [diff] [blame] | 199 | args.argi2 = userId; |
Kevin Chyn | 050315f | 2019-08-08 14:22:54 -0700 | [diff] [blame^] | 200 | args.arg4 = opPackageName; |
Kevin Chyn | c53d981 | 2019-07-30 18:10:30 -0700 | [diff] [blame] | 201 | |
| 202 | boolean skipAnimation = false; |
| 203 | if (mCurrentDialog != null) { |
| 204 | Log.w(TAG, "mCurrentDialog: " + mCurrentDialog); |
| 205 | skipAnimation = true; |
| 206 | } |
Kevin Chyn | 050315f | 2019-08-08 14:22:54 -0700 | [diff] [blame^] | 207 | showDialog(args, skipAnimation, null /* savedState */); |
Kevin Chyn | aae4a15 | 2018-01-18 11:48:09 -0800 | [diff] [blame] | 208 | } |
| 209 | |
| 210 | @Override |
Kevin Chyn | e674e85 | 2019-04-24 12:39:40 -0700 | [diff] [blame] | 211 | public void onBiometricAuthenticated(boolean authenticated, String failureReason) { |
| 212 | if (DEBUG) Log.d(TAG, "onBiometricAuthenticated: " + authenticated |
| 213 | + " reason: " + failureReason); |
| 214 | |
Kevin Chyn | e191271 | 2019-01-04 14:22:34 -0800 | [diff] [blame] | 215 | if (authenticated) { |
Kevin Chyn | c53d981 | 2019-07-30 18:10:30 -0700 | [diff] [blame] | 216 | mCurrentDialog.onAuthenticationSucceeded(); |
Kevin Chyn | 6cf54e8 | 2018-09-18 19:13:27 -0700 | [diff] [blame] | 217 | } else { |
Kevin Chyn | 3b53d6f | 2019-05-01 11:49:05 -0700 | [diff] [blame] | 218 | mCurrentDialog.onAuthenticationFailed(failureReason); |
Kevin Chyn | 6cf54e8 | 2018-09-18 19:13:27 -0700 | [diff] [blame] | 219 | } |
Kevin Chyn | 42653e8 | 2018-01-19 14:15:46 -0800 | [diff] [blame] | 220 | } |
| 221 | |
Kevin Chyn | c53d981 | 2019-07-30 18:10:30 -0700 | [diff] [blame] | 222 | @Override |
| 223 | public void onBiometricHelp(String message) { |
| 224 | if (DEBUG) Log.d(TAG, "onBiometricHelp: " + message); |
| 225 | |
| 226 | mCurrentDialog.onHelp(message); |
Kevin Chyn | 42653e8 | 2018-01-19 14:15:46 -0800 | [diff] [blame] | 227 | } |
| 228 | |
Kevin Chyn | c53d981 | 2019-07-30 18:10:30 -0700 | [diff] [blame] | 229 | @Override |
| 230 | public void onBiometricError(String error) { |
| 231 | if (DEBUG) Log.d(TAG, "onBiometricError: " + error); |
| 232 | mCurrentDialog.onError(error); |
Kevin Chyn | 42653e8 | 2018-01-19 14:15:46 -0800 | [diff] [blame] | 233 | } |
| 234 | |
Kevin Chyn | c53d981 | 2019-07-30 18:10:30 -0700 | [diff] [blame] | 235 | @Override |
| 236 | public void hideBiometricDialog() { |
| 237 | if (DEBUG) Log.d(TAG, "hideBiometricDialog"); |
| 238 | |
Kevin Chyn | 050315f | 2019-08-08 14:22:54 -0700 | [diff] [blame^] | 239 | mCurrentDialog.dismissFromSystemServer(); |
Kevin Chyn | c53d981 | 2019-07-30 18:10:30 -0700 | [diff] [blame] | 240 | } |
| 241 | |
| 242 | private void showDialog(SomeArgs args, boolean skipAnimation, Bundle savedState) { |
| 243 | mCurrentDialogArgs = args; |
| 244 | final int type = args.argi1; |
Kevin Chyn | 050315f | 2019-08-08 14:22:54 -0700 | [diff] [blame^] | 245 | final Bundle biometricPromptBundle = (Bundle) args.arg1; |
| 246 | final boolean requireConfirmation = (boolean) args.arg3; |
| 247 | final int userId = args.argi2; |
| 248 | final String opPackageName = (String) args.arg4; |
Kevin Chyn | c53d981 | 2019-07-30 18:10:30 -0700 | [diff] [blame] | 249 | |
| 250 | // Create a new dialog but do not replace the current one yet. |
| 251 | final BiometricDialog newDialog = buildDialog( |
Kevin Chyn | 050315f | 2019-08-08 14:22:54 -0700 | [diff] [blame^] | 252 | biometricPromptBundle, |
| 253 | requireConfirmation, |
| 254 | userId, |
| 255 | type, |
| 256 | opPackageName); |
Kevin Chyn | c53d981 | 2019-07-30 18:10:30 -0700 | [diff] [blame] | 257 | |
| 258 | if (newDialog == null) { |
| 259 | Log.e(TAG, "Unsupported type: " + type); |
Kevin Chyn | 42653e8 | 2018-01-19 14:15:46 -0800 | [diff] [blame] | 260 | return; |
| 261 | } |
Kevin Chyn | c53d981 | 2019-07-30 18:10:30 -0700 | [diff] [blame] | 262 | |
| 263 | if (DEBUG) { |
| 264 | Log.d(TAG, "showDialog, " |
| 265 | + " savedState: " + savedState |
| 266 | + " mCurrentDialog: " + mCurrentDialog |
| 267 | + " newDialog: " + newDialog |
| 268 | + " type: " + type); |
| 269 | } |
| 270 | |
| 271 | if (savedState != null) { |
| 272 | // SavedState is only non-null if it's from onConfigurationChanged. Restore the state |
| 273 | // even though it may be removed / re-created again |
| 274 | newDialog.restoreState(savedState); |
| 275 | } else if (mCurrentDialog != null) { |
| 276 | // If somehow we're asked to show a dialog, the old one doesn't need to be animated |
| 277 | // away. This can happen if the app cancels and re-starts auth during configuration |
| 278 | // change. This is ugly because we also have to do things on onConfigurationChanged |
| 279 | // here. |
| 280 | mCurrentDialog.dismissWithoutCallback(false /* animate */); |
| 281 | } |
| 282 | |
| 283 | mReceiver = (IBiometricServiceReceiverInternal) args.arg2; |
| 284 | mCurrentDialog = newDialog; |
| 285 | mCurrentDialog.show(mWindowManager, skipAnimation); |
| 286 | } |
| 287 | |
Kevin Chyn | 050315f | 2019-08-08 14:22:54 -0700 | [diff] [blame^] | 288 | private void onDialogDismissed(@DismissedReason int reason) { |
| 289 | if (DEBUG) Log.d(TAG, "onDialogDismissed: " + reason); |
Kevin Chyn | c53d981 | 2019-07-30 18:10:30 -0700 | [diff] [blame] | 290 | if (mCurrentDialog == null) { |
| 291 | Log.w(TAG, "Dialog already dismissed"); |
Kevin Chyn | 42653e8 | 2018-01-19 14:15:46 -0800 | [diff] [blame] | 292 | } |
| 293 | mReceiver = null; |
Kevin Chyn | c53d981 | 2019-07-30 18:10:30 -0700 | [diff] [blame] | 294 | mCurrentDialog = null; |
Kevin Chyn | 23289ef | 2018-11-28 16:32:36 -0800 | [diff] [blame] | 295 | } |
| 296 | |
Gus Prevas | a7df7b2 | 2018-10-30 10:29:34 -0400 | [diff] [blame] | 297 | @Override |
| 298 | protected void onConfigurationChanged(Configuration newConfig) { |
Kevin Chyn | 02129b1 | 2018-11-01 16:47:12 -0700 | [diff] [blame] | 299 | super.onConfigurationChanged(newConfig); |
Kevin Chyn | e191271 | 2019-01-04 14:22:34 -0800 | [diff] [blame] | 300 | |
| 301 | // Save the state of the current dialog (buttons showing, etc) |
Kevin Chyn | e191271 | 2019-01-04 14:22:34 -0800 | [diff] [blame] | 302 | if (mCurrentDialog != null) { |
Kevin Chyn | c53d981 | 2019-07-30 18:10:30 -0700 | [diff] [blame] | 303 | final Bundle savedState = new Bundle(); |
Kevin Chyn | e191271 | 2019-01-04 14:22:34 -0800 | [diff] [blame] | 304 | mCurrentDialog.onSaveState(savedState); |
Kevin Chyn | c53d981 | 2019-07-30 18:10:30 -0700 | [diff] [blame] | 305 | mCurrentDialog.dismissWithoutCallback(false /* animate */); |
| 306 | mCurrentDialog = null; |
Kevin Chyn | e191271 | 2019-01-04 14:22:34 -0800 | [diff] [blame] | 307 | |
Kevin Chyn | c53d981 | 2019-07-30 18:10:30 -0700 | [diff] [blame] | 308 | showDialog(mCurrentDialogArgs, true /* skipAnimation */, savedState); |
Gus Prevas | a7df7b2 | 2018-10-30 10:29:34 -0400 | [diff] [blame] | 309 | } |
Kevin Chyn | c53d981 | 2019-07-30 18:10:30 -0700 | [diff] [blame] | 310 | } |
Kevin Chyn | e191271 | 2019-01-04 14:22:34 -0800 | [diff] [blame] | 311 | |
Kevin Chyn | c53d981 | 2019-07-30 18:10:30 -0700 | [diff] [blame] | 312 | protected BiometricDialog buildDialog(Bundle biometricPromptBundle, |
Kevin Chyn | 050315f | 2019-08-08 14:22:54 -0700 | [diff] [blame^] | 313 | boolean requireConfirmation, int userId, int type, String opPackageName) { |
Kevin Chyn | c53d981 | 2019-07-30 18:10:30 -0700 | [diff] [blame] | 314 | return new BiometricDialogView.Builder(mContext) |
| 315 | .setCallback(this) |
| 316 | .setBiometricPromptBundle(biometricPromptBundle) |
| 317 | .setRequireConfirmation(requireConfirmation) |
| 318 | .setUserId(userId) |
Kevin Chyn | 050315f | 2019-08-08 14:22:54 -0700 | [diff] [blame^] | 319 | .setOpPackageName(opPackageName) |
Kevin Chyn | c53d981 | 2019-07-30 18:10:30 -0700 | [diff] [blame] | 320 | .build(type); |
Gus Prevas | a7df7b2 | 2018-10-30 10:29:34 -0400 | [diff] [blame] | 321 | } |
Kevin Chyn | aae4a15 | 2018-01-18 11:48:09 -0800 | [diff] [blame] | 322 | } |