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 | 42653e8 | 2018-01-19 14:15:46 -0800 | [diff] [blame] | 19 | import android.content.Context; |
Kevin Chyn | aae4a15 | 2018-01-18 11:48:09 -0800 | [diff] [blame] | 20 | import android.content.pm.PackageManager; |
Gus Prevas | a7df7b2 | 2018-10-30 10:29:34 -0400 | [diff] [blame] | 21 | import android.content.res.Configuration; |
Kevin Chyn | 6cf54e8 | 2018-09-18 19:13:27 -0700 | [diff] [blame] | 22 | import android.hardware.biometrics.BiometricAuthenticator; |
Vishwath Mohan | ecf00ce | 2018-04-05 10:28:24 -0700 | [diff] [blame] | 23 | import android.hardware.biometrics.BiometricPrompt; |
| 24 | import android.hardware.biometrics.IBiometricPromptReceiver; |
Kevin Chyn | aae4a15 | 2018-01-18 11:48:09 -0800 | [diff] [blame] | 25 | import android.os.Bundle; |
Kevin Chyn | 42653e8 | 2018-01-19 14:15:46 -0800 | [diff] [blame] | 26 | import android.os.Handler; |
| 27 | import android.os.Message; |
| 28 | import android.os.RemoteException; |
Kevin Chyn | aae4a15 | 2018-01-18 11:48:09 -0800 | [diff] [blame] | 29 | import android.util.Log; |
Kevin Chyn | 42653e8 | 2018-01-19 14:15:46 -0800 | [diff] [blame] | 30 | import android.view.WindowManager; |
Kevin Chyn | aae4a15 | 2018-01-18 11:48:09 -0800 | [diff] [blame] | 31 | |
Kevin Chyn | 42653e8 | 2018-01-19 14:15:46 -0800 | [diff] [blame] | 32 | import com.android.internal.os.SomeArgs; |
Kevin Chyn | aae4a15 | 2018-01-18 11:48:09 -0800 | [diff] [blame] | 33 | import com.android.systemui.SystemUI; |
| 34 | import com.android.systemui.statusbar.CommandQueue; |
| 35 | |
Kevin Chyn | 6cf54e8 | 2018-09-18 19:13:27 -0700 | [diff] [blame] | 36 | import java.util.HashMap; |
| 37 | import java.util.Map; |
| 38 | |
Kevin Chyn | e927566 | 2018-07-23 16:42:06 -0700 | [diff] [blame] | 39 | /** |
| 40 | * Receives messages sent from AuthenticationClient and shows the appropriate biometric UI (e.g. |
Kevin Chyn | a883fb5 | 2018-09-18 18:23:22 -0700 | [diff] [blame] | 41 | * BiometricDialogView). |
Kevin Chyn | e927566 | 2018-07-23 16:42:06 -0700 | [diff] [blame] | 42 | */ |
| 43 | public class BiometricDialogImpl extends SystemUI implements CommandQueue.Callbacks { |
Kevin Chyn | 5a2ff5d | 2018-08-29 19:07:30 -0700 | [diff] [blame] | 44 | private static final String TAG = "BiometricDialogImpl"; |
Kevin Chyn | 42653e8 | 2018-01-19 14:15:46 -0800 | [diff] [blame] | 45 | private static final boolean DEBUG = true; |
| 46 | |
Kevin Chyn | 5906c17 | 2018-07-23 15:43:02 -0700 | [diff] [blame] | 47 | private static final int MSG_SHOW_DIALOG = 1; |
Kevin Chyn | e927566 | 2018-07-23 16:42:06 -0700 | [diff] [blame] | 48 | private static final int MSG_BIOMETRIC_AUTHENTICATED = 2; |
| 49 | private static final int MSG_BIOMETRIC_HELP = 3; |
| 50 | private static final int MSG_BIOMETRIC_ERROR = 4; |
| 51 | private static final int MSG_HIDE_DIALOG = 5; |
Kevin Chyn | 5906c17 | 2018-07-23 15:43:02 -0700 | [diff] [blame] | 52 | private static final int MSG_BUTTON_NEGATIVE = 6; |
| 53 | private static final int MSG_USER_CANCELED = 7; |
| 54 | private static final int MSG_BUTTON_POSITIVE = 8; |
Kevin Chyn | 42653e8 | 2018-01-19 14:15:46 -0800 | [diff] [blame] | 55 | |
Kevin Chyn | 6cf54e8 | 2018-09-18 19:13:27 -0700 | [diff] [blame] | 56 | private Map<Integer, BiometricDialogView> mDialogs; // BiometricAuthenticator type, view |
Gus Prevas | a7df7b2 | 2018-10-30 10:29:34 -0400 | [diff] [blame] | 57 | private SomeArgs mCurrentDialogArgs; |
Kevin Chyn | 6cf54e8 | 2018-09-18 19:13:27 -0700 | [diff] [blame] | 58 | private BiometricDialogView mCurrentDialog; |
Kevin Chyn | 42653e8 | 2018-01-19 14:15:46 -0800 | [diff] [blame] | 59 | private WindowManager mWindowManager; |
Vishwath Mohan | ecf00ce | 2018-04-05 10:28:24 -0700 | [diff] [blame] | 60 | private IBiometricPromptReceiver mReceiver; |
Kevin Chyn | 42653e8 | 2018-01-19 14:15:46 -0800 | [diff] [blame] | 61 | private boolean mDialogShowing; |
Kevin Chyn | 5906c17 | 2018-07-23 15:43:02 -0700 | [diff] [blame] | 62 | private Callback mCallback = new Callback(); |
Kevin Chyn | 42653e8 | 2018-01-19 14:15:46 -0800 | [diff] [blame] | 63 | |
| 64 | private Handler mHandler = new Handler() { |
| 65 | @Override |
| 66 | public void handleMessage(Message msg) { |
| 67 | switch(msg.what) { |
| 68 | case MSG_SHOW_DIALOG: |
Kevin Chyn | 02129b1 | 2018-11-01 16:47:12 -0700 | [diff] [blame^] | 69 | handleShowDialog((SomeArgs) msg.obj, false /* skipAnimation */); |
Kevin Chyn | 42653e8 | 2018-01-19 14:15:46 -0800 | [diff] [blame] | 70 | break; |
Kevin Chyn | e927566 | 2018-07-23 16:42:06 -0700 | [diff] [blame] | 71 | case MSG_BIOMETRIC_AUTHENTICATED: |
| 72 | handleBiometricAuthenticated(); |
Kevin Chyn | 42653e8 | 2018-01-19 14:15:46 -0800 | [diff] [blame] | 73 | break; |
Kevin Chyn | e927566 | 2018-07-23 16:42:06 -0700 | [diff] [blame] | 74 | case MSG_BIOMETRIC_HELP: |
| 75 | handleBiometricHelp((String) msg.obj); |
Kevin Chyn | 42653e8 | 2018-01-19 14:15:46 -0800 | [diff] [blame] | 76 | break; |
Kevin Chyn | e927566 | 2018-07-23 16:42:06 -0700 | [diff] [blame] | 77 | case MSG_BIOMETRIC_ERROR: |
| 78 | handleBiometricError((String) msg.obj); |
Kevin Chyn | 42653e8 | 2018-01-19 14:15:46 -0800 | [diff] [blame] | 79 | break; |
| 80 | case MSG_HIDE_DIALOG: |
| 81 | handleHideDialog((Boolean) msg.obj); |
| 82 | break; |
| 83 | case MSG_BUTTON_NEGATIVE: |
| 84 | handleButtonNegative(); |
| 85 | break; |
| 86 | case MSG_USER_CANCELED: |
| 87 | handleUserCanceled(); |
| 88 | break; |
| 89 | case MSG_BUTTON_POSITIVE: |
| 90 | handleButtonPositive(); |
| 91 | break; |
Kevin Chyn | 42653e8 | 2018-01-19 14:15:46 -0800 | [diff] [blame] | 92 | } |
| 93 | } |
| 94 | }; |
Kevin Chyn | aae4a15 | 2018-01-18 11:48:09 -0800 | [diff] [blame] | 95 | |
Kevin Chyn | 5906c17 | 2018-07-23 15:43:02 -0700 | [diff] [blame] | 96 | private class Callback implements DialogViewCallback { |
| 97 | @Override |
| 98 | public void onUserCanceled() { |
Kevin Chyn | e927566 | 2018-07-23 16:42:06 -0700 | [diff] [blame] | 99 | mHandler.obtainMessage(BiometricDialogImpl.MSG_USER_CANCELED).sendToTarget(); |
Kevin Chyn | 5906c17 | 2018-07-23 15:43:02 -0700 | [diff] [blame] | 100 | } |
| 101 | |
| 102 | @Override |
| 103 | public void onErrorShown() { |
| 104 | mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_HIDE_DIALOG, |
| 105 | false /* userCanceled */), BiometricPrompt.HIDE_DIALOG_DELAY); |
| 106 | } |
| 107 | |
| 108 | @Override |
| 109 | public void onNegativePressed() { |
Kevin Chyn | e927566 | 2018-07-23 16:42:06 -0700 | [diff] [blame] | 110 | mHandler.obtainMessage(BiometricDialogImpl.MSG_BUTTON_NEGATIVE).sendToTarget(); |
Kevin Chyn | 5906c17 | 2018-07-23 15:43:02 -0700 | [diff] [blame] | 111 | } |
| 112 | |
| 113 | @Override |
| 114 | public void onPositivePressed() { |
Kevin Chyn | e927566 | 2018-07-23 16:42:06 -0700 | [diff] [blame] | 115 | mHandler.obtainMessage(BiometricDialogImpl.MSG_BUTTON_POSITIVE).sendToTarget(); |
Kevin Chyn | 5906c17 | 2018-07-23 15:43:02 -0700 | [diff] [blame] | 116 | } |
| 117 | } |
| 118 | |
Kevin Chyn | aae4a15 | 2018-01-18 11:48:09 -0800 | [diff] [blame] | 119 | @Override |
| 120 | public void start() { |
Gus Prevas | a7df7b2 | 2018-10-30 10:29:34 -0400 | [diff] [blame] | 121 | createDialogs(); |
| 122 | |
| 123 | if (!mDialogs.isEmpty()) { |
| 124 | getComponent(CommandQueue.class).addCallbacks(this); |
| 125 | mWindowManager = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE); |
| 126 | } |
| 127 | } |
| 128 | |
| 129 | private void createDialogs() { |
Kevin Chyn | 6cf54e8 | 2018-09-18 19:13:27 -0700 | [diff] [blame] | 130 | final PackageManager pm = mContext.getPackageManager(); |
| 131 | mDialogs = new HashMap<>(); |
| 132 | if (pm.hasSystemFeature(PackageManager.FEATURE_FACE)) { |
| 133 | mDialogs.put(BiometricAuthenticator.TYPE_FACE, new FaceDialogView(mContext, mCallback)); |
Kevin Chyn | aae4a15 | 2018-01-18 11:48:09 -0800 | [diff] [blame] | 134 | } |
Kevin Chyn | 6cf54e8 | 2018-09-18 19:13:27 -0700 | [diff] [blame] | 135 | if (pm.hasSystemFeature(PackageManager.FEATURE_FINGERPRINT)) { |
| 136 | mDialogs.put(BiometricAuthenticator.TYPE_FINGERPRINT, |
| 137 | new FingerprintDialogView(mContext, mCallback)); |
| 138 | } |
Kevin Chyn | aae4a15 | 2018-01-18 11:48:09 -0800 | [diff] [blame] | 139 | } |
| 140 | |
| 141 | @Override |
Kevin Chyn | 6cf54e8 | 2018-09-18 19:13:27 -0700 | [diff] [blame] | 142 | public void showBiometricDialog(Bundle bundle, IBiometricPromptReceiver receiver, int type, |
| 143 | boolean requireConfirmation) { |
Kevin Chyn | 5a2ff5d | 2018-08-29 19:07:30 -0700 | [diff] [blame] | 144 | if (DEBUG) Log.d(TAG, "showBiometricDialog, type: " + type); |
Kevin Chyn | 42653e8 | 2018-01-19 14:15:46 -0800 | [diff] [blame] | 145 | // Remove these messages as they are part of the previous client |
Kevin Chyn | e927566 | 2018-07-23 16:42:06 -0700 | [diff] [blame] | 146 | mHandler.removeMessages(MSG_BIOMETRIC_ERROR); |
| 147 | mHandler.removeMessages(MSG_BIOMETRIC_HELP); |
| 148 | mHandler.removeMessages(MSG_BIOMETRIC_AUTHENTICATED); |
Kevin Chyn | 42653e8 | 2018-01-19 14:15:46 -0800 | [diff] [blame] | 149 | SomeArgs args = SomeArgs.obtain(); |
| 150 | args.arg1 = bundle; |
| 151 | args.arg2 = receiver; |
Kevin Chyn | 6cf54e8 | 2018-09-18 19:13:27 -0700 | [diff] [blame] | 152 | args.argi1 = type; |
| 153 | args.arg3 = requireConfirmation; |
Kevin Chyn | 42653e8 | 2018-01-19 14:15:46 -0800 | [diff] [blame] | 154 | mHandler.obtainMessage(MSG_SHOW_DIALOG, args).sendToTarget(); |
Kevin Chyn | aae4a15 | 2018-01-18 11:48:09 -0800 | [diff] [blame] | 155 | } |
| 156 | |
| 157 | @Override |
Kevin Chyn | e927566 | 2018-07-23 16:42:06 -0700 | [diff] [blame] | 158 | public void onBiometricAuthenticated() { |
| 159 | if (DEBUG) Log.d(TAG, "onBiometricAuthenticated"); |
| 160 | mHandler.obtainMessage(MSG_BIOMETRIC_AUTHENTICATED).sendToTarget(); |
Kevin Chyn | aae4a15 | 2018-01-18 11:48:09 -0800 | [diff] [blame] | 161 | } |
| 162 | |
| 163 | @Override |
Kevin Chyn | e927566 | 2018-07-23 16:42:06 -0700 | [diff] [blame] | 164 | public void onBiometricHelp(String message) { |
| 165 | if (DEBUG) Log.d(TAG, "onBiometricHelp: " + message); |
| 166 | mHandler.obtainMessage(MSG_BIOMETRIC_HELP, message).sendToTarget(); |
Kevin Chyn | aae4a15 | 2018-01-18 11:48:09 -0800 | [diff] [blame] | 167 | } |
| 168 | |
| 169 | @Override |
Kevin Chyn | e927566 | 2018-07-23 16:42:06 -0700 | [diff] [blame] | 170 | public void onBiometricError(String error) { |
| 171 | if (DEBUG) Log.d(TAG, "onBiometricError: " + error); |
| 172 | mHandler.obtainMessage(MSG_BIOMETRIC_ERROR, error).sendToTarget(); |
Kevin Chyn | aae4a15 | 2018-01-18 11:48:09 -0800 | [diff] [blame] | 173 | } |
| 174 | |
| 175 | @Override |
Kevin Chyn | e927566 | 2018-07-23 16:42:06 -0700 | [diff] [blame] | 176 | public void hideBiometricDialog() { |
| 177 | if (DEBUG) Log.d(TAG, "hideBiometricDialog"); |
Kevin Chyn | 42653e8 | 2018-01-19 14:15:46 -0800 | [diff] [blame] | 178 | mHandler.obtainMessage(MSG_HIDE_DIALOG, false /* userCanceled */).sendToTarget(); |
| 179 | } |
| 180 | |
Kevin Chyn | 02129b1 | 2018-11-01 16:47:12 -0700 | [diff] [blame^] | 181 | private void handleShowDialog(SomeArgs args, boolean skipAnimation) { |
Gus Prevas | a7df7b2 | 2018-10-30 10:29:34 -0400 | [diff] [blame] | 182 | mCurrentDialogArgs = args; |
Kevin Chyn | 6cf54e8 | 2018-09-18 19:13:27 -0700 | [diff] [blame] | 183 | final int type = args.argi1; |
| 184 | mCurrentDialog = mDialogs.get(type); |
| 185 | |
Kevin Chyn | 87df068 | 2018-04-10 19:29:23 -0700 | [diff] [blame] | 186 | if (DEBUG) Log.d(TAG, "handleShowDialog, isAnimatingAway: " |
Kevin Chyn | 6cf54e8 | 2018-09-18 19:13:27 -0700 | [diff] [blame] | 187 | + mCurrentDialog.isAnimatingAway() + " type: " + type); |
| 188 | |
| 189 | if (mCurrentDialog.isAnimatingAway()) { |
| 190 | mCurrentDialog.forceRemove(); |
Kevin Chyn | 87df068 | 2018-04-10 19:29:23 -0700 | [diff] [blame] | 191 | } else if (mDialogShowing) { |
Kevin Chyn | 42653e8 | 2018-01-19 14:15:46 -0800 | [diff] [blame] | 192 | Log.w(TAG, "Dialog already showing"); |
| 193 | return; |
| 194 | } |
Vishwath Mohan | ecf00ce | 2018-04-05 10:28:24 -0700 | [diff] [blame] | 195 | mReceiver = (IBiometricPromptReceiver) args.arg2; |
Kevin Chyn | 6cf54e8 | 2018-09-18 19:13:27 -0700 | [diff] [blame] | 196 | mCurrentDialog.setBundle((Bundle)args.arg1); |
| 197 | mCurrentDialog.setRequireConfirmation((boolean)args.arg3); |
Kevin Chyn | 02129b1 | 2018-11-01 16:47:12 -0700 | [diff] [blame^] | 198 | mCurrentDialog.setSkipIntro(skipAnimation); |
Kevin Chyn | 6cf54e8 | 2018-09-18 19:13:27 -0700 | [diff] [blame] | 199 | mWindowManager.addView(mCurrentDialog, mCurrentDialog.getLayoutParams()); |
Kevin Chyn | 42653e8 | 2018-01-19 14:15:46 -0800 | [diff] [blame] | 200 | mDialogShowing = true; |
| 201 | } |
| 202 | |
Kevin Chyn | e927566 | 2018-07-23 16:42:06 -0700 | [diff] [blame] | 203 | private void handleBiometricAuthenticated() { |
| 204 | if (DEBUG) Log.d(TAG, "handleBiometricAuthenticated"); |
| 205 | |
Kevin Chyn | 6cf54e8 | 2018-09-18 19:13:27 -0700 | [diff] [blame] | 206 | mCurrentDialog.announceForAccessibility( |
| 207 | mContext.getResources() |
| 208 | .getText(mCurrentDialog.getAuthenticatedAccessibilityResourceId())); |
| 209 | if (mCurrentDialog.requiresConfirmation()) { |
| 210 | mCurrentDialog.showConfirmationButton(); |
| 211 | } else { |
| 212 | handleHideDialog(false /* userCanceled */); |
| 213 | } |
Kevin Chyn | 42653e8 | 2018-01-19 14:15:46 -0800 | [diff] [blame] | 214 | } |
| 215 | |
Kevin Chyn | e927566 | 2018-07-23 16:42:06 -0700 | [diff] [blame] | 216 | private void handleBiometricHelp(String message) { |
| 217 | if (DEBUG) Log.d(TAG, "handleBiometricHelp: " + message); |
Kevin Chyn | 6cf54e8 | 2018-09-18 19:13:27 -0700 | [diff] [blame] | 218 | mCurrentDialog.showHelpMessage(message); |
Kevin Chyn | 42653e8 | 2018-01-19 14:15:46 -0800 | [diff] [blame] | 219 | } |
| 220 | |
Kevin Chyn | e927566 | 2018-07-23 16:42:06 -0700 | [diff] [blame] | 221 | private void handleBiometricError(String error) { |
| 222 | if (DEBUG) Log.d(TAG, "handleBiometricError: " + error); |
Kevin Chyn | 42653e8 | 2018-01-19 14:15:46 -0800 | [diff] [blame] | 223 | if (!mDialogShowing) { |
| 224 | if (DEBUG) Log.d(TAG, "Dialog already dismissed"); |
| 225 | return; |
| 226 | } |
Kevin Chyn | 6cf54e8 | 2018-09-18 19:13:27 -0700 | [diff] [blame] | 227 | mCurrentDialog.showErrorMessage(error); |
Kevin Chyn | 42653e8 | 2018-01-19 14:15:46 -0800 | [diff] [blame] | 228 | } |
| 229 | |
| 230 | private void handleHideDialog(boolean userCanceled) { |
Kevin Chyn | 87df068 | 2018-04-10 19:29:23 -0700 | [diff] [blame] | 231 | if (DEBUG) Log.d(TAG, "handleHideDialog, userCanceled: " + userCanceled); |
Kevin Chyn | 42653e8 | 2018-01-19 14:15:46 -0800 | [diff] [blame] | 232 | if (!mDialogShowing) { |
| 233 | // This can happen if there's a race and we get called from both |
| 234 | // onAuthenticated and onError, etc. |
| 235 | Log.w(TAG, "Dialog already dismissed, userCanceled: " + userCanceled); |
| 236 | return; |
| 237 | } |
| 238 | if (userCanceled) { |
| 239 | try { |
Vishwath Mohan | ecf00ce | 2018-04-05 10:28:24 -0700 | [diff] [blame] | 240 | mReceiver.onDialogDismissed(BiometricPrompt.DISMISSED_REASON_USER_CANCEL); |
Kevin Chyn | 42653e8 | 2018-01-19 14:15:46 -0800 | [diff] [blame] | 241 | } catch (RemoteException e) { |
| 242 | Log.e(TAG, "RemoteException when hiding dialog", e); |
| 243 | } |
| 244 | } |
| 245 | mReceiver = null; |
Kevin Chyn | 42653e8 | 2018-01-19 14:15:46 -0800 | [diff] [blame] | 246 | mDialogShowing = false; |
Kevin Chyn | 6cf54e8 | 2018-09-18 19:13:27 -0700 | [diff] [blame] | 247 | mCurrentDialog.startDismiss(); |
Kevin Chyn | 42653e8 | 2018-01-19 14:15:46 -0800 | [diff] [blame] | 248 | } |
| 249 | |
| 250 | private void handleButtonNegative() { |
| 251 | if (mReceiver == null) { |
| 252 | Log.e(TAG, "Receiver is null"); |
| 253 | return; |
| 254 | } |
| 255 | try { |
Vishwath Mohan | ecf00ce | 2018-04-05 10:28:24 -0700 | [diff] [blame] | 256 | mReceiver.onDialogDismissed(BiometricPrompt.DISMISSED_REASON_NEGATIVE); |
Kevin Chyn | 42653e8 | 2018-01-19 14:15:46 -0800 | [diff] [blame] | 257 | } catch (RemoteException e) { |
| 258 | Log.e(TAG, "Remote exception when handling negative button", e); |
| 259 | } |
| 260 | handleHideDialog(false /* userCanceled */); |
| 261 | } |
| 262 | |
| 263 | private void handleButtonPositive() { |
| 264 | if (mReceiver == null) { |
| 265 | Log.e(TAG, "Receiver is null"); |
| 266 | return; |
| 267 | } |
| 268 | try { |
Vishwath Mohan | ecf00ce | 2018-04-05 10:28:24 -0700 | [diff] [blame] | 269 | mReceiver.onDialogDismissed(BiometricPrompt.DISMISSED_REASON_POSITIVE); |
Kevin Chyn | 42653e8 | 2018-01-19 14:15:46 -0800 | [diff] [blame] | 270 | } catch (RemoteException e) { |
| 271 | Log.e(TAG, "Remote exception when handling positive button", e); |
| 272 | } |
| 273 | handleHideDialog(false /* userCanceled */); |
| 274 | } |
| 275 | |
Kevin Chyn | 42653e8 | 2018-01-19 14:15:46 -0800 | [diff] [blame] | 276 | private void handleUserCanceled() { |
| 277 | handleHideDialog(true /* userCanceled */); |
Kevin Chyn | aae4a15 | 2018-01-18 11:48:09 -0800 | [diff] [blame] | 278 | } |
Gus Prevas | a7df7b2 | 2018-10-30 10:29:34 -0400 | [diff] [blame] | 279 | |
| 280 | @Override |
| 281 | protected void onConfigurationChanged(Configuration newConfig) { |
Kevin Chyn | 02129b1 | 2018-11-01 16:47:12 -0700 | [diff] [blame^] | 282 | super.onConfigurationChanged(newConfig); |
| 283 | final boolean wasShowing = mDialogShowing; |
Gus Prevas | a7df7b2 | 2018-10-30 10:29:34 -0400 | [diff] [blame] | 284 | if (mDialogShowing) { |
| 285 | mCurrentDialog.forceRemove(); |
Kevin Chyn | 02129b1 | 2018-11-01 16:47:12 -0700 | [diff] [blame^] | 286 | mDialogShowing = false; |
Gus Prevas | a7df7b2 | 2018-10-30 10:29:34 -0400 | [diff] [blame] | 287 | } |
| 288 | createDialogs(); |
Kevin Chyn | 02129b1 | 2018-11-01 16:47:12 -0700 | [diff] [blame^] | 289 | if (wasShowing) { |
| 290 | handleShowDialog(mCurrentDialogArgs, true /* skipAnimation */); |
Gus Prevas | a7df7b2 | 2018-10-30 10:29:34 -0400 | [diff] [blame] | 291 | } |
| 292 | } |
Kevin Chyn | aae4a15 | 2018-01-18 11:48:09 -0800 | [diff] [blame] | 293 | } |