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

Commit 2bf46f69 authored by archisha's avatar archisha Committed by Archisha Baranwal
Browse files

Adding ViewCaptureAwareWindowManager to ScreenPinningRequest window.

Bug: 356796570
Flag: com.android.systemui.enable_view_capture_tracing
Test: Ran relevant unit tests locally.

Change-Id: I23906e069f596c369a658bd8935cc8d4aa1a1e69
parent 618b77e9
Loading
Loading
Loading
Loading
+11 −3
Original line number Diff line number Diff line
@@ -16,7 +16,9 @@

package com.android.systemui.recents;

import static com.android.systemui.Flags.enableViewCaptureTracing;
import static com.android.systemui.shared.recents.utilities.Utilities.isLargeScreen;
import static com.android.systemui.util.ConvenienceExtensionsKt.toKotlinLazy;
import static com.android.systemui.util.leak.RotationUtils.ROTATION_LANDSCAPE;
import static com.android.systemui.util.leak.RotationUtils.ROTATION_NONE;
import static com.android.systemui.util.leak.RotationUtils.ROTATION_SEASCAPE;
@@ -53,6 +55,8 @@ import android.widget.TextView;

import androidx.annotation.NonNull;

import com.android.app.viewcapture.ViewCapture;
import com.android.app.viewcapture.ViewCaptureAwareWindowManager;
import com.android.systemui.CoreStartable;
import com.android.systemui.broadcast.BroadcastDispatcher;
import com.android.systemui.dagger.SysUISingleton;
@@ -83,6 +87,7 @@ public class ScreenPinningRequest implements
    private final Lazy<NavigationBarController> mNavigationBarControllerLazy;
    private final AccessibilityManager mAccessibilityService;
    private final WindowManager mWindowManager;
    private final ViewCaptureAwareWindowManager mViewCaptureAwareWindowManager;
    private final BroadcastDispatcher mBroadcastDispatcher;
    private final UserTracker mUserTracker;

@@ -106,13 +111,16 @@ public class ScreenPinningRequest implements
            NavigationModeController navigationModeController,
            Lazy<NavigationBarController> navigationBarControllerLazy,
            BroadcastDispatcher broadcastDispatcher,
            UserTracker userTracker) {
            UserTracker userTracker,
            Lazy<ViewCapture> daggerLazyViewCapture) {
        mContext = context;
        mNavigationBarControllerLazy = navigationBarControllerLazy;
        mAccessibilityService = (AccessibilityManager)
                mContext.getSystemService(Context.ACCESSIBILITY_SERVICE);
        mWindowManager = (WindowManager)
                mContext.getSystemService(Context.WINDOW_SERVICE);
        mViewCaptureAwareWindowManager = new ViewCaptureAwareWindowManager(mWindowManager,
                toKotlinLazy(daggerLazyViewCapture), enableViewCaptureTracing());
        mNavBarMode = navigationModeController.addListener(this);
        mBroadcastDispatcher = broadcastDispatcher;
        mUserTracker = userTracker;
@@ -123,7 +131,7 @@ public class ScreenPinningRequest implements

    public void clearPrompt() {
        if (mRequestWindow != null) {
            mWindowManager.removeView(mRequestWindow);
            mViewCaptureAwareWindowManager.removeView(mRequestWindow);
            mRequestWindow = null;
        }
    }
@@ -144,7 +152,7 @@ public class ScreenPinningRequest implements

        // show the confirmation
        WindowManager.LayoutParams lp = getWindowLayoutParams();
        mWindowManager.addView(mRequestWindow, lp);
        mViewCaptureAwareWindowManager.addView(mRequestWindow, lp);
    }

    @Override