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

Commit 9ab9e751 authored by Justin Weir's avatar Justin Weir Committed by Automerger Merge Worker
Browse files

Merge "Remove Dependency.get usage, warnings, and dead code" into tm-dev am: 82081000

parents a7e67547 82081000
Loading
Loading
Loading
Loading
+8 −22
Original line number Diff line number Diff line
@@ -17,13 +17,11 @@
package com.android.systemui.recents;

import android.annotation.Nullable;
import android.app.trust.TrustManager;
import android.content.Context;
import android.os.Handler;
import android.os.RemoteException;
import android.util.Log;

import com.android.systemui.Dependency;
import com.android.systemui.dagger.SysUISingleton;
import com.android.systemui.shared.recents.IOverviewProxy;
import com.android.systemui.statusbar.phone.CentralSurfaces;
@@ -44,23 +42,20 @@ public class OverviewProxyRecentsImpl implements RecentsImplementation {
    @Nullable
    private final Lazy<Optional<CentralSurfaces>> mCentralSurfacesOptionalLazy;

    private Context mContext;
    private Handler mHandler;
    private TrustManager mTrustManager;
    private OverviewProxyService mOverviewProxyService;
    private final OverviewProxyService mOverviewProxyService;

    @SuppressWarnings("OptionalUsedAsFieldOrParameterType")
    @Inject
    public OverviewProxyRecentsImpl(Lazy<Optional<CentralSurfaces>> centralSurfacesOptionalLazy) {
    public OverviewProxyRecentsImpl(Lazy<Optional<CentralSurfaces>> centralSurfacesOptionalLazy,
            OverviewProxyService overviewProxyService) {
        mCentralSurfacesOptionalLazy = centralSurfacesOptionalLazy;
        mOverviewProxyService = overviewProxyService;
    }

    @Override
    public void onStart(Context context) {
        mContext = context;
        mHandler = new Handler();
        mTrustManager = (TrustManager) context.getSystemService(Context.TRUST_SERVICE);
        mOverviewProxyService = Dependency.get(OverviewProxyService.class);
    }

    @Override
@@ -69,12 +64,9 @@ public class OverviewProxyRecentsImpl implements RecentsImplementation {
        if (overviewProxy != null) {
            try {
                overviewProxy.onOverviewShown(triggeredFromAltTab);
                return;
            } catch (RemoteException e) {
                Log.e(TAG, "Failed to send overview show event to launcher.", e);
            }
        } else {
            // Do nothing
        }
    }

@@ -84,12 +76,9 @@ public class OverviewProxyRecentsImpl implements RecentsImplementation {
        if (overviewProxy != null) {
            try {
                overviewProxy.onOverviewHidden(triggeredFromAltTab, triggeredFromHomeKey);
                return;
            } catch (RemoteException e) {
                Log.e(TAG, "Failed to send overview hide event to launcher.", e);
            }
        } else {
            // Do nothing
        }
    }

@@ -112,16 +101,13 @@ public class OverviewProxyRecentsImpl implements RecentsImplementation {
            final Optional<CentralSurfaces> centralSurfacesOptional =
                    mCentralSurfacesOptionalLazy.get();
            if (centralSurfacesOptional.map(CentralSurfaces::isKeyguardShowing).orElse(false)) {
                centralSurfacesOptional.get().executeRunnableDismissingKeyguard(() -> {
                        mHandler.post(toggleRecents);
                    }, null,  true /* dismissShade */, false /* afterKeyguardGone */,
                centralSurfacesOptional.get().executeRunnableDismissingKeyguard(
                        () -> mHandler.post(toggleRecents), null, true /* dismissShade */,
                        false /* afterKeyguardGone */,
                        true /* deferred */);
            } else {
                toggleRecents.run();
            }
            return;
        } else {
            // Do nothing
        }
    }
}
+13 −16
Original line number Diff line number Diff line
@@ -49,7 +49,6 @@ import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.android.systemui.Dependency;
import com.android.systemui.R;
import com.android.systemui.broadcast.BroadcastDispatcher;
import com.android.systemui.navigationbar.NavigationBarView;
@@ -74,26 +73,28 @@ public class ScreenPinningRequest implements View.OnClickListener,

    private final AccessibilityManager mAccessibilityService;
    private final WindowManager mWindowManager;
    private final OverviewProxyService mOverviewProxyService;
    private final BroadcastDispatcher mBroadcastDispatcher;

    private RequestWindowView mRequestWindow;
    private int mNavBarMode;

    // Id of task to be pinned or locked.
    /** ID of task to be pinned or locked. */
    private int taskId;

    @Inject
    public ScreenPinningRequest(
            Context context,
            Lazy<Optional<CentralSurfaces>> centralSurfacesOptionalLazy) {
            Lazy<Optional<CentralSurfaces>> centralSurfacesOptionalLazy,
            NavigationModeController navigationModeController,
            BroadcastDispatcher broadcastDispatcher) {
        mContext = context;
        mCentralSurfacesOptionalLazy = centralSurfacesOptionalLazy;
        mAccessibilityService = (AccessibilityManager)
                mContext.getSystemService(Context.ACCESSIBILITY_SERVICE);
        mWindowManager = (WindowManager)
                mContext.getSystemService(Context.WINDOW_SERVICE);
        mOverviewProxyService = Dependency.get(OverviewProxyService.class);
        mNavBarMode = Dependency.get(NavigationModeController.class).addListener(this);
        mNavBarMode = navigationModeController.addListener(this);
        mBroadcastDispatcher = broadcastDispatcher;
    }

    public void clearPrompt() {
@@ -172,13 +173,10 @@ public class ScreenPinningRequest implements View.OnClickListener,
        private static final int OFFSET_DP = 96;

        private final ColorDrawable mColor = new ColorDrawable(0);
        private ValueAnimator mColorAnim;
        private ViewGroup mLayout;
        private boolean mShowCancel;
        private final BroadcastDispatcher mBroadcastDispatcher =
                Dependency.get(BroadcastDispatcher.class);
        private final boolean mShowCancel;

        public RequestWindowView(Context context, boolean showCancel) {
        private RequestWindowView(Context context, boolean showCancel) {
            super(context);
            setClickable(true);
            setOnClickListener(ScreenPinningRequest.this);
@@ -213,16 +211,16 @@ public class ScreenPinningRequest implements View.OnClickListener,
                        .setInterpolator(new DecelerateInterpolator())
                        .start();

                mColorAnim = ValueAnimator.ofObject(new ArgbEvaluator(), 0, bgColor);
                mColorAnim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
                ValueAnimator colorAnim = ValueAnimator.ofObject(new ArgbEvaluator(), 0, bgColor);
                colorAnim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
                    @Override
                    public void onAnimationUpdate(ValueAnimator animation) {
                        final int c = (Integer) animation.getAnimatedValue();
                        mColor.setColor(c);
                    }
                });
                mColorAnim.setDuration(1000);
                mColorAnim.start();
                colorAnim.setDuration(1000);
                colorAnim.start();
            } else {
                mColor.setColor(bgColor);
            }
@@ -382,5 +380,4 @@ public class ScreenPinningRequest implements View.OnClickListener,
            }
        };
    }

}