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

Commit 0e02a293 authored by Vishnu Nair's avatar Vishnu Nair
Browse files

Adds logging for debugging when the takeScreenshot is called.

When an error occurs during the takeScreenshot process, it is helpful to
have logs on the reason for the failure.

Test: presubmit
Bug: 410067902
Flag: EXEMPT adding more logs
Change-Id: Iff56e3f2b9aaa1d3989332171050ed931cb47856
parent aa763b87
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -1386,21 +1386,25 @@ public final class UiAutomation {
    @Nullable
    public Bitmap takeScreenshot(@NonNull Window window) {
        if (window == null) {
            Log.e(LOG_TAG, "Window is null");
            return null;
        }

        View decorView = window.peekDecorView();
        if (decorView == null) {
            Log.e(LOG_TAG, "Decor view is null");
            return null;
        }

        ViewRootImpl viewRoot = decorView.getViewRootImpl();
        if (viewRoot == null) {
            Log.e(LOG_TAG, "View root is null");
            return null;
        }

        SurfaceControl sc = viewRoot.getSurfaceControl();
        if (!sc.isValid()) {
            Log.e(LOG_TAG, "ViewRootImpl SurfaceControl is not valid");
            return null;
        }