Loading packages/SystemUI/src/com/android/systemui/controls/ui/ChallengeDialogs.kt +11 −4 Original line number Diff line number Diff line Loading @@ -50,7 +50,8 @@ object ChallengeDialogs { fun createPinDialog( cvh: ControlViewHolder, useAlphaNumeric: Boolean, useRetryStrings: Boolean useRetryStrings: Boolean, onCancel: () -> Unit ): Dialog? { val lastAction = cvh.lastAction if (lastAction == null) { Loading Loading @@ -86,7 +87,10 @@ object ChallengeDialogs { }) setNegativeButton( android.R.string.cancel, DialogInterface.OnClickListener { dialog, _ -> dialog.cancel() } DialogInterface.OnClickListener { dialog, _ -> onCancel.invoke() dialog.cancel() } ) } return builder.create().apply { Loading @@ -111,7 +115,7 @@ object ChallengeDialogs { /** * AlertDialogs to handle [ControlAction#RESPONSE_CHALLENGE_ACK] response type. */ fun createConfirmationDialog(cvh: ControlViewHolder): Dialog? { fun createConfirmationDialog(cvh: ControlViewHolder, onCancel: () -> Unit): Dialog? { val lastAction = cvh.lastAction if (lastAction == null) { Log.e(ControlsUiController.TAG, Loading @@ -130,7 +134,10 @@ object ChallengeDialogs { }) setNegativeButton( android.R.string.cancel, DialogInterface.OnClickListener { dialog, _ -> dialog.cancel() } DialogInterface.OnClickListener { dialog, _ -> onCancel.invoke() dialog.cancel() } ) } return builder.create().apply { Loading packages/SystemUI/src/com/android/systemui/controls/ui/ControlViewHolder.kt +7 −3 Original line number Diff line number Diff line Loading @@ -86,6 +86,7 @@ class ControlViewHolder( var behavior: Behavior? = null var lastAction: ControlAction? = null private var lastChallengeDialog: Dialog? = null private val onDialogCancel: () -> Unit = { lastChallengeDialog = null } val deviceType: Int get() = cws.control?.let { it.getDeviceType() } ?: cws.ci.deviceType Loading Loading @@ -154,15 +155,18 @@ class ControlViewHolder( setTransientStatus(context.resources.getString(R.string.controls_error_failed)) } ControlAction.RESPONSE_CHALLENGE_PIN -> { lastChallengeDialog = ChallengeDialogs.createPinDialog(this, false, failedAttempt) lastChallengeDialog = ChallengeDialogs.createPinDialog( this, false, failedAttempt, onDialogCancel) lastChallengeDialog?.show() } ControlAction.RESPONSE_CHALLENGE_PASSPHRASE -> { lastChallengeDialog = ChallengeDialogs.createPinDialog(this, true, failedAttempt) lastChallengeDialog = ChallengeDialogs.createPinDialog( this, false, failedAttempt, onDialogCancel) lastChallengeDialog?.show() } ControlAction.RESPONSE_CHALLENGE_ACK -> { lastChallengeDialog = ChallengeDialogs.createConfirmationDialog(this) lastChallengeDialog = ChallengeDialogs.createConfirmationDialog( this, onDialogCancel) lastChallengeDialog?.show() } } Loading Loading
packages/SystemUI/src/com/android/systemui/controls/ui/ChallengeDialogs.kt +11 −4 Original line number Diff line number Diff line Loading @@ -50,7 +50,8 @@ object ChallengeDialogs { fun createPinDialog( cvh: ControlViewHolder, useAlphaNumeric: Boolean, useRetryStrings: Boolean useRetryStrings: Boolean, onCancel: () -> Unit ): Dialog? { val lastAction = cvh.lastAction if (lastAction == null) { Loading Loading @@ -86,7 +87,10 @@ object ChallengeDialogs { }) setNegativeButton( android.R.string.cancel, DialogInterface.OnClickListener { dialog, _ -> dialog.cancel() } DialogInterface.OnClickListener { dialog, _ -> onCancel.invoke() dialog.cancel() } ) } return builder.create().apply { Loading @@ -111,7 +115,7 @@ object ChallengeDialogs { /** * AlertDialogs to handle [ControlAction#RESPONSE_CHALLENGE_ACK] response type. */ fun createConfirmationDialog(cvh: ControlViewHolder): Dialog? { fun createConfirmationDialog(cvh: ControlViewHolder, onCancel: () -> Unit): Dialog? { val lastAction = cvh.lastAction if (lastAction == null) { Log.e(ControlsUiController.TAG, Loading @@ -130,7 +134,10 @@ object ChallengeDialogs { }) setNegativeButton( android.R.string.cancel, DialogInterface.OnClickListener { dialog, _ -> dialog.cancel() } DialogInterface.OnClickListener { dialog, _ -> onCancel.invoke() dialog.cancel() } ) } return builder.create().apply { Loading
packages/SystemUI/src/com/android/systemui/controls/ui/ControlViewHolder.kt +7 −3 Original line number Diff line number Diff line Loading @@ -86,6 +86,7 @@ class ControlViewHolder( var behavior: Behavior? = null var lastAction: ControlAction? = null private var lastChallengeDialog: Dialog? = null private val onDialogCancel: () -> Unit = { lastChallengeDialog = null } val deviceType: Int get() = cws.control?.let { it.getDeviceType() } ?: cws.ci.deviceType Loading Loading @@ -154,15 +155,18 @@ class ControlViewHolder( setTransientStatus(context.resources.getString(R.string.controls_error_failed)) } ControlAction.RESPONSE_CHALLENGE_PIN -> { lastChallengeDialog = ChallengeDialogs.createPinDialog(this, false, failedAttempt) lastChallengeDialog = ChallengeDialogs.createPinDialog( this, false, failedAttempt, onDialogCancel) lastChallengeDialog?.show() } ControlAction.RESPONSE_CHALLENGE_PASSPHRASE -> { lastChallengeDialog = ChallengeDialogs.createPinDialog(this, true, failedAttempt) lastChallengeDialog = ChallengeDialogs.createPinDialog( this, false, failedAttempt, onDialogCancel) lastChallengeDialog?.show() } ControlAction.RESPONSE_CHALLENGE_ACK -> { lastChallengeDialog = ChallengeDialogs.createConfirmationDialog(this) lastChallengeDialog = ChallengeDialogs.createConfirmationDialog( this, onDialogCancel) lastChallengeDialog?.show() } } Loading