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 Original line Diff line number Diff line
@@ -964,6 +964,13 @@ flag {
  namespace: "systemui"
  namespace: "systemui"
  description: "Only dismiss media notifications when the control was removed by the user."
  description: "Only dismiss media notifications when the control was removed by the user."
  bug: "335875159"
  bug: "335875159"
}

flag {
  namespace: "systemui"
  name: "enable_view_capture_tracing"
  description: "Enables view capture tracing in System UI."
  bug: "336521992"
  metadata {
  metadata {
    purpose: PURPOSE_BUGFIX
    purpose: PURPOSE_BUGFIX
  }
  }
+11 −0
Original line number Original line Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.systemui.navigationbar;
import static android.inputmethodservice.InputMethodService.canImeRenderGesturalNavButtons;
import static android.inputmethodservice.InputMethodService.canImeRenderGesturalNavButtons;
import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL;
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_HOME_DISABLED;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_OVERVIEW_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;
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.Canvas;
import android.graphics.Point;
import android.graphics.Point;
import android.graphics.Rect;
import android.graphics.Rect;
import android.media.permission.SafeCloseable;
import android.os.Bundle;
import android.os.Bundle;
import android.os.RemoteException;
import android.os.RemoteException;
import android.util.AttributeSet;
import android.util.AttributeSet;
@@ -59,6 +61,7 @@ import android.widget.FrameLayout;
import androidx.annotation.Nullable;
import androidx.annotation.Nullable;


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


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


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


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


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


import static android.os.Trace.TRACE_TAG_APP;
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 static com.android.systemui.statusbar.phone.CentralSurfaces.DEBUG;


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


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


    private InteractionEventHandler mInteractionEventHandler;
    private InteractionEventHandler mInteractionEventHandler;


    private SafeCloseable mViewCaptureCloseable;

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

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


    @Override
    @Override