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

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

Merge "Adding ViewCaptureAwareWindowManager to ScreenDecorations window." into main

parents 69af11ad 27a9061e
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -66,6 +66,7 @@ import android.widget.FrameLayout;

import androidx.annotation.VisibleForTesting;

import com.android.app.viewcapture.ViewCaptureAwareWindowManager;
import com.android.internal.util.Preconditions;
import com.android.settingslib.Utils;
import com.android.systemui.biometrics.data.repository.FacePropertyRepository;
@@ -168,7 +169,7 @@ public class ScreenDecorations implements
    ViewGroup mScreenDecorHwcWindow;
    @VisibleForTesting
    ScreenDecorHwcLayer mScreenDecorHwcLayer;
    private WindowManager mWindowManager;
    private ViewCaptureAwareWindowManager mWindowManager;
    private int mRotation;
    private UserSettingObserver mColorInversionSetting;
    @Nullable
@@ -338,7 +339,8 @@ public class ScreenDecorations implements
            ScreenDecorationsLogger logger,
            FacePropertyRepository facePropertyRepository,
            JavaAdapter javaAdapter,
            CameraProtectionLoader cameraProtectionLoader) {
            CameraProtectionLoader cameraProtectionLoader,
            ViewCaptureAwareWindowManager viewCaptureAwareWindowManager) {
        mContext = context;
        mSecureSettings = secureSettings;
        mCommandRegistry = commandRegistry;
@@ -353,6 +355,7 @@ public class ScreenDecorations implements
        mLogger = logger;
        mFacePropertyRepository = facePropertyRepository;
        mJavaAdapter = javaAdapter;
        mWindowManager = viewCaptureAwareWindowManager;
    }

    private final ScreenDecorCommand.Callback mScreenDecorCommandCallback = (cmd, pw) -> {
@@ -484,7 +487,6 @@ public class ScreenDecorations implements

    private void startOnScreenDecorationsThread() {
        Trace.beginSection("ScreenDecorations#startOnScreenDecorationsThread");
        mWindowManager = mContext.getSystemService(WindowManager.class);
        mContext.getDisplay().getDisplayInfo(mDisplayInfo);
        mRotation = mDisplayInfo.rotation;
        mDisplaySize.x = mDisplayInfo.getNaturalWidth();
+13 −2
Original line number Diff line number Diff line
@@ -80,6 +80,8 @@ import androidx.annotation.Nullable;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.filters.SmallTest;

import com.android.app.viewcapture.ViewCapture;
import com.android.app.viewcapture.ViewCaptureAwareWindowManager;
import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.systemui.biometrics.AuthController;
import com.android.systemui.biometrics.data.repository.FakeFacePropertyRepository;
@@ -109,6 +111,8 @@ import com.android.systemui.util.settings.FakeSettings;
import com.android.systemui.util.settings.SecureSettings;
import com.android.systemui.util.time.FakeSystemClock;

import kotlin.Lazy;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -127,6 +131,7 @@ public class ScreenDecorationsTest extends SysuiTestCase {

    private ScreenDecorations mScreenDecorations;
    private WindowManager mWindowManager;
    private ViewCaptureAwareWindowManager mViewCaptureAwareWindowManager;
    private DisplayManager mDisplayManager;
    private SecureSettings mSecureSettings;
    private FakeExecutor mExecutor;
@@ -173,6 +178,8 @@ public class ScreenDecorationsTest extends SysuiTestCase {
    private CutoutDecorProviderFactory mCutoutFactory;
    @Mock
    private JavaAdapter mJavaAdapter;
    @Mock
    private Lazy<ViewCapture> mLazyViewCapture;

    private FakeFacePropertyRepository mFakeFacePropertyRepository =
            new FakeFacePropertyRepository();
@@ -245,12 +252,15 @@ public class ScreenDecorationsTest extends SysuiTestCase {
                new ScreenDecorationsLogger(logcatLogBuffer("TestLogBuffer")),
                mFakeFacePropertyRepository));

        mViewCaptureAwareWindowManager = new ViewCaptureAwareWindowManager(mWindowManager,
                mLazyViewCapture, false);
        mScreenDecorations = spy(new ScreenDecorations(mContext, mSecureSettings,
                mCommandRegistry, mUserTracker, mDisplayTracker, mDotViewController,
                mThreadFactory,
                mPrivacyDotDecorProviderFactory, mFaceScanningProviderFactory,
                new ScreenDecorationsLogger(logcatLogBuffer("TestLogBuffer")),
                mFakeFacePropertyRepository, mJavaAdapter, mCameraProtectionLoader) {
                mFakeFacePropertyRepository, mJavaAdapter, mCameraProtectionLoader,
                mViewCaptureAwareWindowManager) {
            @Override
            public void start() {
                super.start();
@@ -1264,7 +1274,8 @@ public class ScreenDecorationsTest extends SysuiTestCase {
                mDotViewController,
                mThreadFactory, mPrivacyDotDecorProviderFactory, mFaceScanningProviderFactory,
                new ScreenDecorationsLogger(logcatLogBuffer("TestLogBuffer")),
                mFakeFacePropertyRepository, mJavaAdapter, mCameraProtectionLoader);
                mFakeFacePropertyRepository, mJavaAdapter, mCameraProtectionLoader,
                mViewCaptureAwareWindowManager);
        screenDecorations.start();
        when(mContext.getDisplay()).thenReturn(mDisplay);
        when(mDisplay.getDisplayInfo(any())).thenAnswer(new Answer<Boolean>() {