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

Commit 28ca6242 authored by Archisha Baranwal's avatar Archisha Baranwal
Browse files

Modified Revert of "Adding ViewCaptureAwareWindowManager to NavigationBar window."

This reverts commit 2562515b.

Reason for revert: Reverting change due to the restructure of ViewCaptureAwareWindowManager ( go/wm-for-viewcapture )

Flag: com.android.systemui.enable_view_capture_tracing

Change-Id: Idc8a494b9f73a7dbc68bcfd49e1a10e61ba640d4
parent 94f988a7
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -82,7 +82,6 @@ import android.view.inputmethod.InputMethodManager;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.filters.SmallTest;

import com.android.app.viewcapture.ViewCaptureAwareWindowManager;
import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.UiEventLogger;
import com.android.systemui.SysuiTestCase;
@@ -218,8 +217,6 @@ public class NavigationBarTest extends SysuiTestCase {
    @Mock
    private WindowManager mWindowManager;
    @Mock
    private ViewCaptureAwareWindowManager mViewCaptureAwareWindowManager;
    @Mock
    private TelecomManager mTelecomManager;
    @Mock
    private InputMethodManager mInputMethodManager;
@@ -685,7 +682,6 @@ public class NavigationBarTest extends SysuiTestCase {
                null,
                context,
                mWindowManager,
                mViewCaptureAwareWindowManager,
                () -> mAssistManager,
                mock(AccessibilityManager.class),
                deviceProvisionedController,
+4 −19
Original line number Diff line number Diff line
@@ -16,17 +16,12 @@

package com.android.systemui.navigationbar;

import static com.android.systemui.Flags.enableViewCaptureTracing;
import static com.android.systemui.util.ConvenienceExtensionsKt.toKotlinLazy;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.WindowManager;

import com.android.app.displaylib.PerDisplayRepository;
import com.android.app.viewcapture.ViewCapture;
import com.android.app.viewcapture.ViewCaptureAwareWindowManager;
import com.android.systemui.dagger.qualifiers.DisplayId;
import com.android.systemui.model.SysUiState;
import com.android.systemui.navigationbar.NavigationBarComponent.NavigationBarScope;
@@ -34,8 +29,8 @@ import com.android.systemui.navigationbar.views.NavigationBarFrame;
import com.android.systemui.navigationbar.views.NavigationBarView;
import com.android.systemui.res.R;
import com.android.systemui.shade.shared.flag.ShadeWindowGoesAround;
import com.android.systemui.utils.windowmanager.WindowManagerProvider;

import dagger.Lazy;
import dagger.Module;
import dagger.Provides;

@@ -70,8 +65,9 @@ public interface NavigationBarModule {
    @Provides
    @NavigationBarScope
    @DisplayId
    static WindowManager provideWindowManager(@DisplayId Context context) {
        return context.getSystemService(WindowManager.class);
    static WindowManager provideWindowManager(@DisplayId Context context,
            WindowManagerProvider windowManagerProvider) {
        return windowManagerProvider.getWindowManager(context);
    }

    /** A SysUiState for the navigation bar display. */
@@ -87,15 +83,4 @@ public interface NavigationBarModule {
            return defaultState;
        }
    }

    /** A ViewCaptureAwareWindowManager specific to the display's context. */
    @Provides
    @NavigationBarScope
    @DisplayId
    static ViewCaptureAwareWindowManager provideViewCaptureAwareWindowManager(
            @DisplayId WindowManager windowManager, Lazy<ViewCapture> daggerLazyViewCapture) {
        return new ViewCaptureAwareWindowManager(windowManager,
                /* lazyViewCapture= */ toKotlinLazy(daggerLazyViewCapture),
                /* isViewCaptureEnabled= */ enableViewCaptureTracing());
    }
}
+4 −8
Original line number Diff line number Diff line
@@ -104,7 +104,6 @@ import android.view.inputmethod.InputMethodManager;
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;

import com.android.app.viewcapture.ViewCaptureAwareWindowManager;
import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.UiEvent;
import com.android.internal.logging.UiEventLogger;
@@ -199,7 +198,6 @@ public class NavigationBar extends ViewController<NavigationBarView> implements
    private final Context mContext;
    private final Bundle mSavedState;
    private final WindowManager mWindowManager;
    private final ViewCaptureAwareWindowManager mViewCaptureAwareWindowManager;
    private final AccessibilityManager mAccessibilityManager;
    private final DeviceProvisionedController mDeviceProvisionedController;
    private final StatusBarStateController mStatusBarStateController;
@@ -560,7 +558,6 @@ public class NavigationBar extends ViewController<NavigationBarView> implements
            @Nullable Bundle savedState,
            @DisplayId Context context,
            @DisplayId WindowManager windowManager,
            @DisplayId ViewCaptureAwareWindowManager viewCaptureAwareWindowManager,
            Lazy<AssistManager> assistManagerLazy,
            AccessibilityManager accessibilityManager,
            DeviceProvisionedController deviceProvisionedController,
@@ -605,7 +602,6 @@ public class NavigationBar extends ViewController<NavigationBarView> implements
        mContext = context;
        mSavedState = savedState;
        mWindowManager = windowManager;
        mViewCaptureAwareWindowManager = viewCaptureAwareWindowManager;
        mAccessibilityManager = accessibilityManager;
        mDeviceProvisionedController = deviceProvisionedController;
        mStatusBarStateController = statusBarStateController;
@@ -726,7 +722,7 @@ public class NavigationBar extends ViewController<NavigationBarView> implements
        if (DEBUG) Log.v(TAG, "addNavigationBar: about to add " + mView);

        try {
            mViewCaptureAwareWindowManager.addView(
            mWindowManager.addView(
                    mFrame,
                    getBarLayoutParams(
                            mContext.getResources()
@@ -783,7 +779,7 @@ public class NavigationBar extends ViewController<NavigationBarView> implements
            mCommandQueue.removeCallback(this);
            Trace.beginSection("NavigationBar#removeViewImmediate");
            try {
                mViewCaptureAwareWindowManager.removeViewImmediate(mView.getRootView());
                mWindowManager.removeViewImmediate(mView.getRootView());
            } catch (IllegalArgumentException e) {
                // Wrapping this in a try/catch to avoid crashes when a display is instantly removed
                // after being added, and initialization hasn't finished yet.
@@ -888,7 +884,7 @@ public class NavigationBar extends ViewController<NavigationBarView> implements
            resetSecondaryHandle();
            getBarTransitions().removeDarkIntensityListener(mOrientationHandleIntensityListener);
            try {
                mViewCaptureAwareWindowManager.removeView(mOrientationHandle);
                mWindowManager.removeView(mOrientationHandle);
            } catch (IllegalArgumentException e) {
                // Wrapping this in a try/catch to avoid crashes when a display is instantly removed
                // after being added, and initialization hasn't finished yet.
@@ -967,7 +963,7 @@ public class NavigationBar extends ViewController<NavigationBarView> implements
        mOrientationParams.privateFlags |= PRIVATE_FLAG_NO_MOVE_ANIMATION
                | WindowManager.LayoutParams.PRIVATE_FLAG_LAYOUT_SIZE_EXTENDED_BY_CUTOUT;
        try {
            mViewCaptureAwareWindowManager.addView(mOrientationHandle, mOrientationParams);
            mWindowManager.addView(mOrientationHandle, mOrientationParams);
        } catch (WindowManager.InvalidDisplayException e) {
            // Wrapping this in a try/catch to avoid crashes when a display is instantly removed
            // after being added, and initialization hasn't finished yet.