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

Commit e7969d0c authored by vadimt's avatar vadimt Committed by Vadim Tryshev
Browse files

Adding a method for getting ExportedData from ViewCapture

Test: presubmit
Bug: 286251603
Flag: N/A
Change-Id: I332c90c50c4e803585eba3470466d7f91dfa2fa5
parent 957922f1
Loading
Loading
Loading
Loading
+8 −6
Original line number Diff line number Diff line
@@ -171,16 +171,18 @@ public abstract class ViewCapture {
    @AnyThread
    public void dumpTo(OutputStream os, Context context)
            throws InterruptedException, ExecutionException, IOException {
        if (!mIsEnabled) {
            return;
        if (mIsEnabled) getExportedData(context).writeTo(os);
    }

    @VisibleForTesting
    public ExportedData getExportedData(Context context)
            throws InterruptedException, ExecutionException {
        ArrayList<Class> classList = new ArrayList<>();
        ExportedData.newBuilder()
        return ExportedData.newBuilder()
                .setPackage(context.getPackageName())
                .addAllWindowData(getWindowData(context, classList, l -> l.mIsActive).get())
                .addAllClassname(toStringList(classList))
                .build()
                .writeTo(os);
                .build();
    }

    private static List<String> toStringList(List<Class> classList) {