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

Commit e704f390 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Use ActivityOptions for ambient cue pending intent start" into main

parents 10fde511 f3f617c4
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -245,7 +245,7 @@ class AmbientCueRepositoryTest : SysuiTestCase() {
            val action: ActionModel = actions!!.first()
            action.onPerformAction()
            runCurrent()
            verify(pendingIntent).send()
            verify(pendingIntent).send(any<Bundle>())
        }

    @Test
+16 −1
Original line number Diff line number Diff line
@@ -16,7 +16,10 @@

package com.android.systemui.ambientcue.data.repository

import android.app.ActivityOptions
import android.app.ActivityTaskManager
import android.app.BroadcastOptions
import android.app.PendingIntent
import android.app.assist.ActivityId
import android.app.smartspace.SmartspaceConfig
import android.app.smartspace.SmartspaceManager
@@ -148,7 +151,19 @@ constructor(
                                                activityId.taskId,
                                            )
                                        } else if (pendingIntent != null) {
                                            pendingIntent.send()
                                            val options = BroadcastOptions.makeBasic()
                                            options.isInteractive = true
                                            options.pendingIntentBackgroundActivityStartMode =
                                                ActivityOptions
                                                    .MODE_BACKGROUND_ACTIVITY_START_ALLOWED
                                            try {
                                                pendingIntent.send(options.toBundle())
                                            } catch (e: PendingIntent.CanceledException) {
                                                Log.e(
                                                    TAG,
                                                    "pending intent of $pendingIntent was canceled",
                                                )
                                            }
                                        } else if (intent != null) {
                                            activityStarter.startActivity(intent, false)
                                        }