Merge "Finish SensorUse activity when dialog is dismissed" into sc-dev

This commit is contained in:
Evan Severson
2021-12-07 20:46:09 +00:00
committed by Android (Google) Code Review
2 changed files with 10 additions and 3 deletions

View File

@@ -15,7 +15,8 @@ import com.android.systemui.statusbar.phone.SystemUIDialog
class SensorUseDialog( class SensorUseDialog(
context: Context, context: Context,
val sensor: Int, val sensor: Int,
val clickListener: DialogInterface.OnClickListener val clickListener: DialogInterface.OnClickListener,
val dismissListener: DialogInterface.OnDismissListener
) : SystemUIDialog(context) { ) : SystemUIDialog(context) {
// TODO move to onCreate (b/200815309) // TODO move to onCreate (b/200815309)
@@ -69,6 +70,8 @@ class SensorUseDialog(
context.getString(com.android.internal.R.string context.getString(com.android.internal.R.string
.cancel), clickListener) .cancel), clickListener)
setOnDismissListener(dismissListener)
setCancelable(false) setCancelable(false)
} }
} }

View File

@@ -50,7 +50,7 @@ class SensorUseStartedActivity @Inject constructor(
private val keyguardStateController: KeyguardStateController, private val keyguardStateController: KeyguardStateController,
private val keyguardDismissUtil: KeyguardDismissUtil, private val keyguardDismissUtil: KeyguardDismissUtil,
@Background private val bgHandler: Handler @Background private val bgHandler: Handler
) : Activity(), DialogInterface.OnClickListener { ) : Activity(), DialogInterface.OnClickListener, DialogInterface.OnDismissListener {
companion object { companion object {
private val LOG_TAG = SensorUseStartedActivity::class.java.simpleName private val LOG_TAG = SensorUseStartedActivity::class.java.simpleName
@@ -120,7 +120,7 @@ class SensorUseStartedActivity @Inject constructor(
} }
} }
mDialog = SensorUseDialog(this, sensor, this) mDialog = SensorUseDialog(this, sensor, this, this)
mDialog!!.show() mDialog!!.show()
} }
@@ -212,4 +212,8 @@ class SensorUseStartedActivity @Inject constructor(
.suppressSensorPrivacyReminders(sensor, suppressed) .suppressSensorPrivacyReminders(sensor, suppressed)
} }
} }
override fun onDismiss(dialog: DialogInterface?) {
finish()
}
} }