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

Commit aba1b355 authored by Archisha Baranwal's avatar Archisha Baranwal Committed by Android (Google) Code Review
Browse files

Merge "Adding ViewCapture to NotificationShadeWindowView and NavigationBarView." into main

parents 3ea6353f 1a22b1f0
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -964,6 +964,13 @@ flag {
  namespace: "systemui"
  description: "Only dismiss media notifications when the control was removed by the user."
  bug: "335875159"
}

flag {
  namespace: "systemui"
  name: "enable_view_capture_tracing"
  description: "Enables view capture tracing in System UI."
  bug: "336521992"
  metadata {
    purpose: PURPOSE_BUGFIX
  }
+11 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.systemui.navigationbar;
import static android.inputmethodservice.InputMethodService.canImeRenderGesturalNavButtons;
import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL;

import static com.android.systemui.Flags.enableViewCaptureTracing;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_HOME_DISABLED;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_OVERVIEW_DISABLED;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_SEARCH_DISABLED;
@@ -37,6 +38,7 @@ import android.content.res.Configuration;
import android.graphics.Canvas;
import android.graphics.Point;
import android.graphics.Rect;
import android.media.permission.SafeCloseable;
import android.os.Bundle;
import android.os.RemoteException;
import android.util.AttributeSet;
@@ -59,6 +61,7 @@ import android.widget.FrameLayout;
import androidx.annotation.Nullable;

import com.android.app.animation.Interpolators;
import com.android.app.viewcapture.ViewCaptureFactory;
import com.android.internal.annotations.VisibleForTesting;
import com.android.settingslib.Utils;
import com.android.systemui.Gefingerpoken;
@@ -177,6 +180,7 @@ public class NavigationBarView extends FrameLayout {
    private boolean mOverviewProxyEnabled;
    private boolean mShowSwipeUpUi;
    private UpdateActiveTouchRegionsCallback mUpdateActiveTouchRegionsCallback;
    private SafeCloseable mViewCaptureCloseable;

    private class NavTransitionListener implements TransitionListener {
        private boolean mBackTransitioning;
@@ -1077,6 +1081,10 @@ public class NavigationBarView extends FrameLayout {
        }

        updateNavButtonIcons();
        if (enableViewCaptureTracing()) {
            mViewCaptureCloseable = ViewCaptureFactory.getInstance(getContext())
                    .startCapture(getRootView(), ".NavigationBarView");
        }
    }

    @Override
@@ -1089,6 +1097,9 @@ public class NavigationBarView extends FrameLayout {
            mFloatingRotationButton.hide();
            mRotationButtonController.unregisterListeners();
        }
        if (mViewCaptureCloseable != null) {
            mViewCaptureCloseable.close();
        }
    }

    void dump(PrintWriter pw) {
+17 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.systemui.shade;

import static android.os.Trace.TRACE_TAG_APP;

import static com.android.systemui.Flags.enableViewCaptureTracing;
import static com.android.systemui.statusbar.phone.CentralSurfaces.DEBUG;

import android.annotation.ColorInt;
@@ -29,6 +30,7 @@ import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.media.permission.SafeCloseable;
import android.net.Uri;
import android.os.Bundle;
import android.os.Trace;
@@ -47,6 +49,7 @@ import android.view.ViewTreeObserver;
import android.view.Window;
import android.view.WindowInsetsController;

import com.android.app.viewcapture.ViewCaptureFactory;
import com.android.internal.view.FloatingActionMode;
import com.android.internal.widget.floatingtoolbar.FloatingToolbar;
import com.android.systemui.scene.ui.view.WindowRootView;
@@ -68,6 +71,8 @@ public class NotificationShadeWindowView extends WindowRootView {

    private InteractionEventHandler mInteractionEventHandler;

    private SafeCloseable mViewCaptureCloseable;

    public NotificationShadeWindowView(Context context, AttributeSet attrs) {
        super(context, attrs);
        setMotionEventSplittingEnabled(false);
@@ -77,6 +82,18 @@ public class NotificationShadeWindowView extends WindowRootView {
    protected void onAttachedToWindow() {
        super.onAttachedToWindow();
        setWillNotDraw(!DEBUG);
        if (enableViewCaptureTracing()) {
            mViewCaptureCloseable = ViewCaptureFactory.getInstance(getContext())
                .startCapture(getRootView(), ".NotificationShadeWindowView");
        }
    }

    @Override
    protected void onDetachedFromWindow() {
        super.onDetachedFromWindow();
        if (mViewCaptureCloseable != null) {
            mViewCaptureCloseable.close();
        }
    }

    @Override