Remove Dependency.get usage, warnings, and dead code

Fixes: 218352029
Test: ran all tests
Change-Id: I6d8b3c0066e64ca63406a2829d19bee0af203d18
This commit is contained in:
Justin Weir
2022-04-26 14:07:11 +00:00
parent 3600867ca9
commit a69c4ff3ff
2 changed files with 21 additions and 38 deletions

View File

@@ -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 */,
true /* deferred */);
centralSurfacesOptional.get().executeRunnableDismissingKeyguard(
() -> mHandler.post(toggleRecents), null, true /* dismissShade */,
false /* afterKeyguardGone */,
true /* deferred */);
} else {
toggleRecents.run();
}
return;
} else {
// Do nothing
}
}
}

View File

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