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

Commit f371993c authored by Hongwei Wang's avatar Hongwei Wang
Browse files

[Debuggability] Log the menu actions PiP receives

Add extra log that prints out the list of action title whenever we
receive PictureInPictureParams update from the app.

Flag: com.android.wm.shell.enable_pip2
Bug: 401557393
Test: N/A log-only
Change-Id: I9a17cd59e903e692a4d37c535357bc1d0ebe2fa8
parent 503e2595
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@ import com.android.wm.shell.shared.annotations.ShellMainThread;

import java.util.ArrayList;
import java.util.List;
import java.util.StringJoiner;

/**
 * A Task Listener implementation used only for CUJs and trigger paths that cannot be initiated via
@@ -114,6 +115,17 @@ public class PipTaskListener implements ShellTaskOrganizer.TaskListener,
        // Set the new params but make sure mPictureInPictureParams is not null.
        mPictureInPictureParams = params == null
                ? new PictureInPictureParams.Builder().build() : params;
        logRemoteActions(mPictureInPictureParams);
    }

    private void logRemoteActions(@android.annotation.NonNull PictureInPictureParams params) {
        StringJoiner sj = new StringJoiner("|", "[", "]");
        if (params.hasSetActions()) {
            params.getActions().forEach((action) -> sj.add(action.getTitle()));
        }

        ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
                "PIP remote actions=%s", sj.toString());
    }

    /** Add a PipParamsChangedCallback listener. */