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

Commit 1c134289 authored by Stefan Andonian's avatar Stefan Andonian
Browse files

Create an API for systemUI to save all ViewCapture data.

Then use that API in IssueRecordingService.

Bug: 305049544
Flag: ACONFIG record_issue_qs_tile DEVELOPMENT
Test: Manually tested that everything works on device.
Change-Id: I72382da2ed6c451679f9dcc43dc3d4036ba3aabb
parent 7d49c500
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -133,4 +133,7 @@ interface ILauncherApps {
    void setArchiveCompatibilityOptions(boolean enableIconOverlay, boolean enableUnarchivalConfirmation);

    List<UserHandle> getUserProfiles();

    /** Saves view capture data to the wm trace directory. */
    void saveViewCaptureData();
}
+13 −0
Original line number Diff line number Diff line
@@ -1327,6 +1327,19 @@ public class LauncherApps {
        }
    }

    /**
     * Saves view capture data to the default location.
     * @hide
     */
    @RequiresPermission(READ_FRAME_BUFFER)
    public void saveViewCaptureData() {
        try {
            mService.saveViewCaptureData();
        } catch (RemoteException e) {
            e.rethrowAsRuntimeException();
        }
    }

    /**
     * Unregister a callback, so that it won't be called when LauncherApps dumps.
     * @hide
+5 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.systemui.recordissue
import android.app.NotificationManager
import android.content.Context
import android.content.Intent
import android.content.pm.LauncherApps
import android.content.res.Resources
import android.net.Uri
import android.os.Handler
@@ -86,6 +87,10 @@ constructor(
            }
            ACTION_STOP,
            ACTION_STOP_NOTIF -> {
                // ViewCapture needs to save it's data before it is disabled, or else the data will
                // be lost. This is expected to change in the near future, and when that happens
                // this line should be removed.
                getSystemService(LauncherApps::class.java)?.saveViewCaptureData()
                TraceUtils.traceStop(contentResolver)
            }
            ACTION_SHARE -> {
+12 −0
Original line number Diff line number Diff line
@@ -2114,6 +2114,18 @@ public class LauncherAppsService extends SystemService {
            }
        }

        @RequiresPermission(READ_FRAME_BUFFER)
        @Override
        public void saveViewCaptureData() {
            int status = checkCallingOrSelfPermissionForPreflight(mContext, READ_FRAME_BUFFER);
            if (PERMISSION_GRANTED == status) {
                forEachViewCaptureWindow(this::dumpViewCaptureDataToWmTrace);
            } else {
                Log.w(TAG, "caller lacks permissions to save view capture data");
            }
        }


        @RequiresPermission(READ_FRAME_BUFFER)
        @Override
        public void registerDumpCallback(@NonNull IDumpCallback cb) {