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

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17956045

Change-Id: I8699de694e2356b6577069cb01a9786b11e47a28
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Justin Weir
2022-05-02 23:07:31 +00:00
committed by Automerger Merge Worker
2 changed files with 21 additions and 38 deletions

View File

@@ -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
} }
} }
} }

View File

@@ -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,
} }
}; };
} }
} }