diff options
4 files changed, 16 insertions, 16 deletions
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/recordissue/IssueRecordingServiceSessionTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/recordissue/IssueRecordingServiceSessionTest.kt index 8e57914050d6..a1edfc1dbcd5 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/recordissue/IssueRecordingServiceSessionTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/recordissue/IssueRecordingServiceSessionTest.kt @@ -99,7 +99,7 @@ class IssueRecordingServiceSessionTest : SysuiTestCase() { @Test fun cancelsNotification_afterReceivingShareCommand() { - underTest.share(0, null, mContext) + underTest.share(0, null) bgExecutor.runAllReady() verify(notificationManager).cancelAsUser(isNull(), anyInt(), any<UserHandle>()) @@ -110,7 +110,7 @@ class IssueRecordingServiceSessionTest : SysuiTestCase() { issueRecordingState.takeBugreport = true val uri = mock<Uri>() - underTest.share(0, uri, mContext) + underTest.share(0, uri) bgExecutor.runAllReady() verify(iActivityManager).requestBugReportWithExtraAttachment(uri) @@ -121,17 +121,17 @@ class IssueRecordingServiceSessionTest : SysuiTestCase() { issueRecordingState.takeBugreport = false val uri = mock<Uri>() - underTest.share(0, uri, mContext) + underTest.share(0, uri) bgExecutor.runAllReady() - verify(traceurConnection).shareTraces(mContext, uri) + verify(traceurConnection).shareTraces(uri) } @Test fun closesShade_afterReceivingShareCommand() { val uri = mock<Uri>() - underTest.share(0, uri, mContext) + underTest.share(0, uri) bgExecutor.runAllReady() verify(panelInteractor).collapsePanels() diff --git a/packages/SystemUI/src/com/android/systemui/recordissue/IssueRecordingService.kt b/packages/SystemUI/src/com/android/systemui/recordissue/IssueRecordingService.kt index e804baffce05..d1fa94e0a65e 100644 --- a/packages/SystemUI/src/com/android/systemui/recordissue/IssueRecordingService.kt +++ b/packages/SystemUI/src/com/android/systemui/recordissue/IssueRecordingService.kt @@ -99,7 +99,6 @@ constructor( session.share( intent.getIntExtra(EXTRA_NOTIFICATION_ID, mNotificationId), intent.getParcelableExtra(EXTRA_PATH, Uri::class.java), - this, ) // Unlike all other actions, action_share has different behavior for the screen // recording qs tile than it does for the record issue qs tile. Return sticky to diff --git a/packages/SystemUI/src/com/android/systemui/recordissue/IssueRecordingServiceSession.kt b/packages/SystemUI/src/com/android/systemui/recordissue/IssueRecordingServiceSession.kt index 6fc248ffa459..ad9b4fe164e8 100644 --- a/packages/SystemUI/src/com/android/systemui/recordissue/IssueRecordingServiceSession.kt +++ b/packages/SystemUI/src/com/android/systemui/recordissue/IssueRecordingServiceSession.kt @@ -19,7 +19,6 @@ package com.android.systemui.recordissue import android.app.IActivityManager import android.app.NotificationManager import android.content.ContentResolver -import android.content.Context import android.net.Uri import android.os.UserHandle import android.provider.Settings @@ -64,7 +63,7 @@ class IssueRecordingServiceSession( issueRecordingState.isRecording = false } - fun share(notificationId: Int, screenRecording: Uri?, context: Context) { + fun share(notificationId: Int, screenRecording: Uri?) { bgExecutor.execute { notificationManager.cancelAsUser( null, @@ -75,7 +74,7 @@ class IssueRecordingServiceSession( if (issueRecordingState.takeBugreport) { iActivityManager.requestBugReportWithExtraAttachment(screenRecording) } else { - traceurConnection.shareTraces(context, screenRecording) + traceurConnection.shareTraces(screenRecording) } } diff --git a/packages/SystemUI/src/com/android/systemui/recordissue/TraceurConnection.kt b/packages/SystemUI/src/com/android/systemui/recordissue/TraceurConnection.kt index 75df49e3676f..9494da91afe0 100644 --- a/packages/SystemUI/src/com/android/systemui/recordissue/TraceurConnection.kt +++ b/packages/SystemUI/src/com/android/systemui/recordissue/TraceurConnection.kt @@ -17,7 +17,6 @@ package com.android.systemui.recordissue import android.content.ComponentName -import android.content.Context import android.content.Intent import android.net.Uri import android.os.Bundle @@ -69,8 +68,8 @@ constructor(userContextProvider: UserContextProvider, @Background private val bg @WorkerThread fun stopTracing() = sendMessage(MessageConstants.STOP_WHAT) @WorkerThread - fun shareTraces(context: Context, screenRecord: Uri?) { - val replyHandler = Messenger(ShareFilesHandler(context, screenRecord, bgLooper)) + fun shareTraces(screenRecord: Uri?) { + val replyHandler = Messenger(ShareFilesHandler(screenRecord, userContextProvider, bgLooper)) sendMessage(MessageConstants.SHARE_WHAT, replyTo = replyHandler) } @@ -87,15 +86,15 @@ constructor(userContextProvider: UserContextProvider, @Background private val bg this.data = data this.replyTo = replyTo } - binder!!.send(msg) + binder?.send(msg) ?: onBound.add { binder!!.send(msg) } } catch (e: Exception) { Log.e(TAG, "failed to notify Traceur", e) } } private class ShareFilesHandler( - private val context: Context, private val screenRecord: Uri?, + private val userContextProvider: UserContextProvider, looper: Looper, ) : Handler(looper) { @@ -118,9 +117,12 @@ private class ShareFilesHandler( screenRecord?.let { add(it) } } val fileSharingIntent = - FileSender.buildSendIntent(context, uris) + FileSender.buildSendIntent(userContextProvider.userContext, uris) .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT) - context.startActivity(fileSharingIntent) + userContextProvider.userContext.startActivityAsUser( + fileSharingIntent, + userContextProvider.userContext.user, + ) } } |