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

Commit a540ce20 authored by Stefan Andonian's avatar Stefan Andonian
Browse files

Add ViewCapture to Taskbar

Bug: 242867462
Test: Verified that the correct UI data showed up on go/web-hv.
Change-Id: I0904300887684d76d4a1c16ff4ba6986506d4a06
parent 979ae6b4
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import static android.view.KeyEvent.KEYCODE_BACK;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.RectF;
import android.media.permission.SafeCloseable;
import android.util.AttributeSet;
import android.util.FloatProperty;
import android.view.KeyEvent;
@@ -31,6 +32,7 @@ import android.view.ViewTreeObserver;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.android.app.viewcapture.SettingsAwareViewCapture;
import com.android.launcher3.AbstractFloatingView;
import com.android.launcher3.testing.TestLogging;
import com.android.launcher3.testing.shared.TestProtocol;
@@ -68,6 +70,7 @@ public class TaskbarDragLayer extends BaseDragLayer<TaskbarActivityContext> {

    // Initialized in init.
    private TaskbarDragLayerController.TaskbarDragLayerCallbacks mControllerCallbacks;
    private SafeCloseable mViewCaptureCloseable;

    private float mTaskbarBackgroundOffset;

@@ -128,12 +131,14 @@ public class TaskbarDragLayer extends BaseDragLayer<TaskbarActivityContext> {
    protected void onAttachedToWindow() {
        super.onAttachedToWindow();
        getViewTreeObserver().addOnComputeInternalInsetsListener(mTaskbarInsetsComputer);
        mViewCaptureCloseable = SettingsAwareViewCapture.getInstance(getContext())
                .startCapture(getRootView(), ".Taskbar");
    }

    @Override
    protected void onDetachedFromWindow() {
        super.onDetachedFromWindow();

        mViewCaptureCloseable.close();
        onDestroy(true);
    }

+6 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import static android.view.ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_

import android.content.Context;
import android.graphics.Insets;
import android.media.permission.SafeCloseable;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
@@ -29,6 +30,7 @@ import android.view.WindowInsets;

import androidx.annotation.NonNull;

import com.android.app.viewcapture.SettingsAwareViewCapture;
import com.android.launcher3.AbstractFloatingView;
import com.android.launcher3.testing.TestLogging;
import com.android.launcher3.testing.shared.TestProtocol;
@@ -44,6 +46,7 @@ public class TaskbarOverlayDragLayer extends
        BaseDragLayer<TaskbarOverlayContext> implements
        ViewTreeObserver.OnComputeInternalInsetsListener {

    private SafeCloseable mViewCaptureCloseable;
    private final List<OnClickListener> mOnClickListeners = new CopyOnWriteArrayList<>();
    private final TouchController mClickListenerTouchController = new TouchController() {
        @Override
@@ -77,12 +80,15 @@ public class TaskbarOverlayDragLayer extends
    protected void onAttachedToWindow() {
        super.onAttachedToWindow();
        getViewTreeObserver().addOnComputeInternalInsetsListener(this);
        mViewCaptureCloseable = SettingsAwareViewCapture.getInstance(getContext())
                .startCapture(getRootView(), ".TaskbarOverlay");
    }

    @Override
    protected void onDetachedFromWindow() {
        super.onDetachedFromWindow();
        getViewTreeObserver().removeOnComputeInternalInsetsListener(this);
        mViewCaptureCloseable.close();
    }

    @Override