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

Commit 6050e733 authored by Archisha Baranwal's avatar Archisha Baranwal
Browse files

Modified Revert of "Adding ViewCaptureAwareWindowManager to InattentiveSleepWarningView window."

This reverts commit cb5f9c2d.

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: I886afd5faac3b04e3cf74beef02d85c4ed11de92
parent 1d25c1be
Loading
Loading
Loading
Loading
+3 −5
Original line number Diff line number Diff line
@@ -40,11 +40,11 @@ import android.service.vr.IVrStateCallbacks;
import android.testing.TestableLooper;
import android.testing.TestableLooper.RunWithLooper;
import android.testing.TestableResources;
import android.view.WindowManager;

import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.filters.SmallTest;

import com.android.app.viewcapture.ViewCapture;
import com.android.settingslib.fuelgauge.Estimate;
import com.android.systemui.SysuiTestCase;
import com.android.systemui.broadcast.BroadcastDispatcher;
@@ -54,8 +54,6 @@ import com.android.systemui.res.R;
import com.android.systemui.settings.UserTracker;
import com.android.systemui.statusbar.CommandQueue;

import dagger.Lazy;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -96,7 +94,7 @@ public class PowerUITest extends SysuiTestCase {
    @Mock private BroadcastDispatcher mBroadcastDispatcher;
    @Mock private CommandQueue mCommandQueue;
    @Mock private IVrManager mVrManager;
    @Mock private Lazy<ViewCapture> mLazyViewCapture;
    @Mock private WindowManager mWindowManager;

    @Before
    public void setup() {
@@ -709,7 +707,7 @@ public class PowerUITest extends SysuiTestCase {
                mWakefulnessLifecycle,
                mPowerManager,
                mUserTracker,
                mLazyViewCapture);
                mWindowManager);
        mPowerUI.mThermalService = mThermalServiceMock;
    }

+3 −12
Original line number Diff line number Diff line
@@ -16,8 +16,6 @@

package com.android.systemui.power;

import static com.android.systemui.Flags.enableViewCaptureTracing;

import android.animation.Animator;
import android.animation.AnimatorInflater;
import android.animation.AnimatorListenerAdapter;
@@ -30,28 +28,21 @@ import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.FrameLayout;

import com.android.app.viewcapture.ViewCapture;
import com.android.app.viewcapture.ViewCaptureAwareWindowManager;
import com.android.systemui.res.R;

import kotlin.Lazy;

/**
 * View that shows a warning shortly before the device goes into sleep
 * after prolonged user inactivity when bound to.
 */
public class InattentiveSleepWarningView extends FrameLayout {
    private final IBinder mWindowToken = new Binder();
    private final ViewCaptureAwareWindowManager mWindowManager;
    private final WindowManager mWindowManager;
    private Animator mFadeOutAnimator;
    private boolean mDismissing;

    InattentiveSleepWarningView(Context context, Lazy<ViewCapture> lazyViewCapture) {
    InattentiveSleepWarningView(Context context, WindowManager windowManager) {
        super(context);
        WindowManager wm = mContext.getSystemService(WindowManager.class);
        mWindowManager = new ViewCaptureAwareWindowManager(wm, lazyViewCapture,
                enableViewCaptureTracing());
        mWindowManager = windowManager;

        final LayoutInflater layoutInflater = LayoutInflater.from(mContext);
        layoutInflater.inflate(R.layout.inattentive_sleep_warning, this, true /* attachToRoot */);
+5 −9
Original line number Diff line number Diff line
@@ -16,8 +16,6 @@

package com.android.systemui.power;

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

import android.content.BroadcastReceiver;
import android.content.ContentResolver;
import android.content.Context;
@@ -42,11 +40,11 @@ import android.service.vr.IVrStateCallbacks;
import android.text.format.DateUtils;
import android.util.Log;
import android.util.Slog;
import android.view.WindowManager;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.android.app.viewcapture.ViewCapture;
import com.android.internal.annotations.VisibleForTesting;
import com.android.settingslib.fuelgauge.Estimate;
import com.android.settingslib.utils.ThreadUtils;
@@ -59,8 +57,6 @@ import com.android.systemui.settings.UserTracker;
import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.policy.ConfigurationController;

import kotlin.Lazy;

import java.io.PrintWriter;
import java.util.Arrays;
import java.util.concurrent.Future;
@@ -120,9 +116,9 @@ public class PowerUI implements
    private IThermalEventListener mSkinThermalEventListener;
    private IThermalEventListener mUsbThermalEventListener;
    private final Context mContext;
    private final WindowManager mWindowManager;
    private final BroadcastDispatcher mBroadcastDispatcher;
    private final CommandQueue mCommandQueue;
    private final Lazy<ViewCapture> mLazyViewCapture;
    @Nullable
    private final IVrManager mVrManager;
    private final WakefulnessLifecycle.Observer mWakefulnessObserver =
@@ -164,7 +160,7 @@ public class PowerUI implements
            WakefulnessLifecycle wakefulnessLifecycle,
            PowerManager powerManager,
            UserTracker userTracker,
            dagger.Lazy<ViewCapture> daggerLazyViewCapture) {
            WindowManager windowManager) {
        mContext = context;
        mBroadcastDispatcher = broadcastDispatcher;
        mCommandQueue = commandQueue;
@@ -174,7 +170,7 @@ public class PowerUI implements
        mPowerManager = powerManager;
        mWakefulnessLifecycle = wakefulnessLifecycle;
        mUserTracker = userTracker;
        mLazyViewCapture = toKotlinLazy(daggerLazyViewCapture);
        mWindowManager = windowManager;
    }

    public void start() {
@@ -649,7 +645,7 @@ public class PowerUI implements
    @Override
    public void showInattentiveSleepWarning() {
        if (mOverlayView == null) {
            mOverlayView = new InattentiveSleepWarningView(mContext, mLazyViewCapture);
            mOverlayView = new InattentiveSleepWarningView(mContext, mWindowManager);
        }

        mOverlayView.show();