Merge "Fix crash when trying to dismiss dialog" into tm-qpr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
0bfdbbf4c2
@@ -18,6 +18,7 @@ package com.android.systemui.controls.ui
|
|||||||
|
|
||||||
import android.annotation.AnyThread
|
import android.annotation.AnyThread
|
||||||
import android.annotation.MainThread
|
import android.annotation.MainThread
|
||||||
|
import android.app.Activity
|
||||||
import android.app.AlertDialog
|
import android.app.AlertDialog
|
||||||
import android.app.Dialog
|
import android.app.Dialog
|
||||||
import android.app.PendingIntent
|
import android.app.PendingIntent
|
||||||
@@ -85,8 +86,16 @@ class ControlActionCoordinatorImpl @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun closeDialogs() {
|
override fun closeDialogs() {
|
||||||
dialog?.dismiss()
|
val isActivityFinishing =
|
||||||
dialog = null
|
(activityContext as? Activity)?.let { it.isFinishing || it.isDestroyed }
|
||||||
|
if (isActivityFinishing == true) {
|
||||||
|
dialog = null
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (dialog?.isShowing == true) {
|
||||||
|
dialog?.dismiss()
|
||||||
|
dialog = null
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun toggle(cvh: ControlViewHolder, templateId: String, isChecked: Boolean) {
|
override fun toggle(cvh: ControlViewHolder, templateId: String, isChecked: Boolean) {
|
||||||
|
|||||||
Reference in New Issue
Block a user