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

Commit 27e797f9 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 3f4680da 82081000
Loading
Loading
Loading
Loading
+8 −22
Original line number Original line Diff line number Diff line
@@ -17,13 +17,11 @@
package com.android.systemui.recents;
package com.android.systemui.recents;


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


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


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


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


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


    @Override
    @Override
@@ -69,12 +64,9 @@ public class OverviewProxyRecentsImpl implements RecentsImplementation {
        if (overviewProxy != null) {
        if (overviewProxy != null) {
            try {
            try {
                overviewProxy.onOverviewShown(triggeredFromAltTab);
                overviewProxy.onOverviewShown(triggeredFromAltTab);
                return;
            } catch (RemoteException e) {
            } catch (RemoteException e) {
                Log.e(TAG, "Failed to send overview show event to launcher.", 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) {
        if (overviewProxy != null) {
            try {
            try {
                overviewProxy.onOverviewHidden(triggeredFromAltTab, triggeredFromHomeKey);
                overviewProxy.onOverviewHidden(triggeredFromAltTab, triggeredFromHomeKey);
                return;
            } catch (RemoteException e) {
            } catch (RemoteException e) {
                Log.e(TAG, "Failed to send overview hide event to launcher.", 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 =
            final Optional<CentralSurfaces> centralSurfacesOptional =
                    mCentralSurfacesOptionalLazy.get();
                    mCentralSurfacesOptionalLazy.get();
            if (centralSurfacesOptional.map(CentralSurfaces::isKeyguardShowing).orElse(false)) {
            if (centralSurfacesOptional.map(CentralSurfaces::isKeyguardShowing).orElse(false)) {
                centralSurfacesOptional.get().executeRunnableDismissingKeyguard(() -> {
                centralSurfacesOptional.get().executeRunnableDismissingKeyguard(
                        mHandler.post(toggleRecents);
                        () -> mHandler.post(toggleRecents), null, true /* dismissShade */,
                    }, null,  true /* dismissShade */, false /* afterKeyguardGone */,
                        false /* afterKeyguardGone */,
                        true /* deferred */);
                        true /* deferred */);
            } else {
            } else {
                toggleRecents.run();
                toggleRecents.run();
            }
            }
            return;
        } else {
            // Do nothing
        }
        }
    }
    }
}
}
+13 −16
Original line number Original line Diff line number Diff line
@@ -49,7 +49,6 @@ import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.TextView;


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


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


    private RequestWindowView mRequestWindow;
    private RequestWindowView mRequestWindow;
    private int mNavBarMode;
    private int mNavBarMode;


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


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


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


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


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


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

}
}