Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9db0ca4e authored by Fabián Kozynski's avatar Fabián Kozynski
Browse files

Don't dismiss DetailDialog if activity is finishing

If the task is released when the containing activity is finishing, do
not dismiss the dialog. It will be dismissed by itself. See b/248562161.

Test: dialog is dismissed
Fixes: 210990128
Change-Id: I7c3a44cff6e0dab7f23205a8d454a293800af3b3
parent dd623d85
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.systemui.controls.ui

import android.app.Activity
import android.app.ActivityOptions
import android.app.ActivityTaskManager
import android.app.ActivityTaskManager.INVALID_TASK_ID
@@ -217,6 +218,12 @@ class DetailDialog(
        if (!isShowing()) return
        taskView.release()

        val isActivityFinishing =
            (activityContext as? Activity)?.let { it.isFinishing || it.isDestroyed }
        if (isActivityFinishing == true) {
            // Don't dismiss the dialog if the activity is finishing, it will get removed
            return
        }
        super.dismiss()
    }
}