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

Commit fdcb3b0f authored by Matt Pietal's avatar Matt Pietal
Browse files

Launch app intent after unlock

While the taskview may embed a showWhenLocked activity, there is no
guarantee that launching the full activity will also have this
property. Instead, prompt for auth before launching the full intent.

Fixes: 232954894
Test: manual - use showWhenLocked activity over lockscreen, then click
top right button to launch full screen

Change-Id: I82857e4cf16b90a2e1a89b61e30aa89948072f87
parent 0e324fcf
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -261,7 +261,7 @@ class ControlActionCoordinatorImpl @Inject constructor(
                    taskViewFactory.get().create(context, uiExecutor, {
                        dialog = DetailDialog(
                            activityContext, broadcastSender,
                            it, pendingIntent, cvh
                            it, pendingIntent, cvh, keyguardStateController, activityStarter
                        ).also {
                            it.setOnDismissListener { _ -> dialog = null }
                            it.show()
+22 −5
Original line number Diff line number Diff line
@@ -34,6 +34,8 @@ import android.widget.ImageView
import com.android.internal.policy.ScreenDecorationsUtils
import com.android.systemui.R
import com.android.systemui.broadcast.BroadcastSender
import com.android.systemui.plugins.ActivityStarter
import com.android.systemui.statusbar.policy.KeyguardStateController
import com.android.wm.shell.TaskView

/**
@@ -46,7 +48,9 @@ class DetailDialog(
    val broadcastSender: BroadcastSender,
    val taskView: TaskView,
    val pendingIntent: PendingIntent,
    val cvh: ControlViewHolder
    val cvh: ControlViewHolder,
    val keyguardStateController: KeyguardStateController,
    val activityStarter: ActivityStarter
) : Dialog(
    activityContext,
    R.style.Theme_SystemUI_Dialog_Control_DetailPanel
@@ -145,12 +149,25 @@ class DetailDialog(

        requireViewById<ImageView>(R.id.control_detail_open_in_app).apply {
            setOnClickListener { v: View ->
                // Remove the task explicitly, since onRelease() callback will be executed after
                // startActivity() below is called.
                removeDetailTask()
                dismiss()

                val action = ActivityStarter.OnDismissAction {
                    // Remove the task explicitly, since onRelease() callback will be executed after
                    // startActivity() below is called.
                    broadcastSender.closeSystemDialogs()
                    pendingIntent.send()
                    false
                }
                if (keyguardStateController.isUnlocked()) {
                    action.onDismiss()
                } else {
                    activityStarter.dismissKeyguardThenExecute(
                        action,
                        null /* cancel */,
                        true /* afterKeyguardGone */
                    )
                }
            }
        }

+9 −1
Original line number Diff line number Diff line
@@ -22,6 +22,8 @@ import android.testing.TestableLooper
import androidx.test.filters.SmallTest
import com.android.systemui.SysuiTestCase
import com.android.systemui.broadcast.BroadcastSender
import com.android.systemui.plugins.ActivityStarter
import com.android.systemui.statusbar.policy.KeyguardStateController
import com.android.wm.shell.TaskView
import org.junit.Before
import org.junit.Test
@@ -45,6 +47,10 @@ class DetailDialogTest : SysuiTestCase() {
    private lateinit var controlViewHolder: ControlViewHolder
    @Mock
    private lateinit var pendingIntent: PendingIntent
    @Mock
    private lateinit var keyguardStateController: KeyguardStateController
    @Mock
    private lateinit var activityStarter: ActivityStarter

    @Before
    fun setUp() {
@@ -69,7 +75,9 @@ class DetailDialogTest : SysuiTestCase() {
            broadcastSender,
            taskView,
            pendingIntent,
            controlViewHolder
            controlViewHolder,
            keyguardStateController,
            activityStarter
        )
    }
}