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

Commit 00917076 authored by Priyanka's avatar Priyanka Committed by Priyanka Patel
Browse files

Append start time in ms to filename.

This allows us to parse all screen recordings taken via the QS tile in
Winscope to aid the debugging of animation issues.

Bug: 427973454
Flag: EXEMPT trivial change
Test: atest SystemUiRoboTests
Change-Id: I67cab93194d17f419444d34e868e72f32d698c2f
parent fccf0e63
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -89,6 +89,7 @@ public class ScreenMediaRecorder extends MediaProjection.Callback {
    private int mUid;
    private ScreenInternalAudioRecorder mAudio;
    private ScreenRecordingAudioSource mAudioSource;
    private Long mStartTimeMillis = 0L;
    private final MediaProjectionCaptureTarget mCaptureRegion;
    private final Handler mHandler;
    private final int mDisplayId;
@@ -288,6 +289,7 @@ public class ScreenMediaRecorder extends MediaProjection.Callback {
        Log.d(TAG, "start recording");
        prepare();
        mMediaRecorder.start();
        mStartTimeMillis = System.currentTimeMillis();
        mListener.onStarted();
        recordInternalAudio();
    }
@@ -348,8 +350,10 @@ public class ScreenMediaRecorder extends MediaProjection.Callback {
     * Store recorded video
     */
    public SavedRecording save() throws IOException, IllegalStateException {
        String fileName = new SimpleDateFormat("'screen-'yyyyMMdd-HHmmss'.mp4'")
                .format(new Date());
        String saveDate = new SimpleDateFormat("yyyyMMdd-HHmmss").format(new Date());
        String fileName = mStartTimeMillis > 0L
                ? String.format("screen-%s-%d.mp4", saveDate, mStartTimeMillis)
                : String.format("screen-%s.mp4", saveDate);

        ContentValues values = new ContentValues();
        values.put(MediaStore.Video.Media.DISPLAY_NAME, fileName);