Loading packages/SystemUI/src/com/android/systemui/recordissue/IssueRecordingService.kt +14 −0 Original line number Diff line number Diff line Loading @@ -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 Loading @@ -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 Loading Loading @@ -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" Loading packages/SystemUI/src/com/android/systemui/screenrecord/RecordingService.java +10 −6 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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) Loading Loading @@ -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(); Loading @@ -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); Loading Loading
packages/SystemUI/src/com/android/systemui/recordissue/IssueRecordingService.kt +14 −0 Original line number Diff line number Diff line Loading @@ -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 Loading @@ -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 Loading Loading @@ -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" Loading
packages/SystemUI/src/com/android/systemui/screenrecord/RecordingService.java +10 −6 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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) Loading Loading @@ -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(); Loading @@ -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); Loading