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

Commit cc1f8566 authored by Stefan Andonian's avatar Stefan Andonian Committed by Android (Google) Code Review
Browse files

Merge "Create an API for systemUI to save all ViewCapture data." into main

parents 86d5047d 1c134289
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
@@ -93,6 +94,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) {