diff options
| author | 2024-10-23 11:16:01 -0700 | |
|---|---|---|
| committer | 2024-10-23 20:20:49 +0000 | |
| commit | 8cc98babd8a6fab1fc38a81ea237bf3a68d1f670 (patch) | |
| tree | 1c87b11b7417b8dd0c47158c6ea19d1eb3435251 | |
| parent | 081823fb5cc4b808f967c07f80725f42e13171c0 (diff) | |
[Record Issue QS Tile] Remove Share Button Click when generating a bug report.
Bug: 375133946
Test: Verified locally that this works as intended.
Flag: EXEMPT bug fix
Change-Id: If9ee386f06be66bd4a012fd1e93973411f1a49b2
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/recordissue/IssueRecordingService.kt | 14 | ||||
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/screenrecord/RecordingService.java | 16 |
2 files changed, 24 insertions, 6 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/recordissue/IssueRecordingService.kt b/packages/SystemUI/src/com/android/systemui/recordissue/IssueRecordingService.kt index 32d9ba822382..1eac0e1a75fa 100644 --- a/packages/SystemUI/src/com/android/systemui/recordissue/IssueRecordingService.kt +++ b/packages/SystemUI/src/com/android/systemui/recordissue/IssueRecordingService.kt @@ -24,6 +24,7 @@ import android.content.res.Resources import android.net.Uri import android.os.Handler import android.os.IBinder +import android.os.UserHandle import android.util.Log import com.android.internal.logging.UiEventLogger import com.android.systemui.animation.DialogTransitionAnimator @@ -34,6 +35,7 @@ import com.android.systemui.res.R import com.android.systemui.screenrecord.RecordingController import com.android.systemui.screenrecord.RecordingService import com.android.systemui.screenrecord.RecordingServiceStrings +import com.android.systemui.screenrecord.ScreenMediaRecorder.SavedRecording import com.android.systemui.settings.UserContextProvider import com.android.systemui.statusbar.phone.KeyguardDismissUtil import com.android.traceur.MessageConstants.INTENT_EXTRA_TRACE_TYPE @@ -144,6 +146,18 @@ constructor( return super.onStartCommand(intent, flags, startId) } + /** + * If the user chooses to create a bugreport, we do not want to make them click share twice. To + * avoid that, the code immediately triggers the bugreport flow which will handle the rest. + */ + override fun onRecordingSaved(recording: SavedRecording?, currentUser: UserHandle) { + if (session.takeBugReport) { + session.share(mNotificationId, recording?.uri) + } else { + super.onRecordingSaved(recording, currentUser) + } + } + companion object { private const val TAG = "IssueRecordingService" private const val CHANNEL_ID = "issue_record" diff --git a/packages/SystemUI/src/com/android/systemui/screenrecord/RecordingService.java b/packages/SystemUI/src/com/android/systemui/screenrecord/RecordingService.java index 5028c2ea8f0a..6cc9ae4fb674 100644 --- a/packages/SystemUI/src/com/android/systemui/screenrecord/RecordingService.java +++ b/packages/SystemUI/src/com/android/systemui/screenrecord/RecordingService.java @@ -45,6 +45,7 @@ import com.android.systemui.dagger.qualifiers.Main; import com.android.systemui.mediaprojection.MediaProjectionCaptureTarget; import com.android.systemui.recordissue.ScreenRecordingStartTimeStore; import com.android.systemui.res.R; +import com.android.systemui.screenrecord.ScreenMediaRecorder.SavedRecording; import com.android.systemui.screenrecord.ScreenMediaRecorder.ScreenMediaRecorderListener; import com.android.systemui.settings.UserContextProvider; import com.android.systemui.statusbar.phone.KeyguardDismissUtil; @@ -384,8 +385,7 @@ public class RecordingService extends Service implements ScreenMediaRecorderList } @VisibleForTesting - protected Notification createSaveNotification( - @Nullable ScreenMediaRecorder.SavedRecording recording) { + protected Notification createSaveNotification(@Nullable SavedRecording recording) { Uri uri = recording != null ? recording.getUri() : null; Intent viewIntent = new Intent(Intent.ACTION_VIEW) .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_GRANT_READ_URI_PERMISSION) @@ -506,15 +506,13 @@ public class RecordingService extends Service implements ScreenMediaRecorderList mLongExecutor.execute(() -> { try { Log.d(getTag(), "saving recording"); - Notification notification = createSaveNotification( - getRecorder() != null ? getRecorder().save() : null); + SavedRecording savedRecording = getRecorder() != null ? getRecorder().save() : null; postGroupSummaryNotification( currentUser, strings().getSaveTitle(), GROUP_KEY_SAVED, NOTIF_GROUP_ID_SAVED); - mNotificationManager.notifyAsUser(null, mNotificationId, notification, - currentUser); + onRecordingSaved(savedRecording, currentUser); } catch (IOException | IllegalStateException e) { Log.e(getTag(), "Error saving screen recording: " + e.getMessage()); e.printStackTrace(); @@ -524,6 +522,12 @@ public class RecordingService extends Service implements ScreenMediaRecorderList }); } + protected void onRecordingSaved(ScreenMediaRecorder.SavedRecording savedRecording, + UserHandle currentUser) { + mNotificationManager.notifyAsUser(null, mNotificationId, + createSaveNotification(savedRecording), currentUser); + } + private void setTapsVisible(boolean turnOn) { int value = turnOn ? 1 : 0; Settings.System.putInt(getContentResolver(), Settings.System.SHOW_TOUCHES, value); |