Merge "Remove call to getComponent(StatusBar) from LatencyTester."
This commit is contained in:
committed by
Android (Google) Code Review
commit
281fe4691e
@@ -16,6 +16,8 @@
|
||||
|
||||
package com.android.systemui;
|
||||
|
||||
import static android.os.PowerManager.WAKE_REASON_UNKNOWN;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
@@ -28,21 +30,32 @@ import android.os.SystemClock;
|
||||
import com.android.internal.util.LatencyTracker;
|
||||
import com.android.keyguard.KeyguardUpdateMonitor;
|
||||
import com.android.systemui.statusbar.phone.BiometricUnlockController;
|
||||
import com.android.systemui.statusbar.phone.StatusBar;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
/**
|
||||
* Class that only runs on debuggable builds that listens to broadcasts that simulate actions in the
|
||||
* system that are used for testing the latency.
|
||||
*/
|
||||
@Singleton
|
||||
public class LatencyTester extends SystemUI {
|
||||
|
||||
private static final String ACTION_FINGERPRINT_WAKE =
|
||||
private static final String
|
||||
ACTION_FINGERPRINT_WAKE =
|
||||
"com.android.systemui.latency.ACTION_FINGERPRINT_WAKE";
|
||||
private static final String ACTION_TURN_ON_SCREEN =
|
||||
private static final String
|
||||
ACTION_TURN_ON_SCREEN =
|
||||
"com.android.systemui.latency.ACTION_TURN_ON_SCREEN";
|
||||
private final BiometricUnlockController mBiometricUnlockController;
|
||||
private final PowerManager mPowerManager;
|
||||
|
||||
public LatencyTester(Context context) {
|
||||
@Inject
|
||||
public LatencyTester(Context context, BiometricUnlockController biometricUnlockController,
|
||||
PowerManager powerManager) {
|
||||
super(context);
|
||||
mBiometricUnlockController = biometricUnlockController;
|
||||
mPowerManager = powerManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -68,19 +81,17 @@ public class LatencyTester extends SystemUI {
|
||||
}
|
||||
|
||||
private void fakeTurnOnScreen() {
|
||||
PowerManager powerManager = mContext.getSystemService(PowerManager.class);
|
||||
if (LatencyTracker.isEnabled(mContext)) {
|
||||
LatencyTracker.getInstance(mContext).onActionStart(
|
||||
LatencyTracker.ACTION_TURN_ON_SCREEN);
|
||||
}
|
||||
powerManager.wakeUp(SystemClock.uptimeMillis(), "android.policy:LATENCY_TESTS");
|
||||
mPowerManager.wakeUp(
|
||||
SystemClock.uptimeMillis(), WAKE_REASON_UNKNOWN, "android.policy:LATENCY_TESTS");
|
||||
}
|
||||
|
||||
private void fakeWakeAndUnlock() {
|
||||
BiometricUnlockController biometricUnlockController = getComponent(StatusBar.class)
|
||||
.getBiometricUnlockController();
|
||||
biometricUnlockController.onBiometricAcquired(BiometricSourceType.FINGERPRINT);
|
||||
biometricUnlockController.onBiometricAuthenticated(
|
||||
mBiometricUnlockController.onBiometricAcquired(BiometricSourceType.FINGERPRINT);
|
||||
mBiometricUnlockController.onBiometricAuthenticated(
|
||||
KeyguardUpdateMonitor.getCurrentUser(), BiometricSourceType.FINGERPRINT);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.android.systemui.dagger;
|
||||
|
||||
import com.android.systemui.LatencyTester;
|
||||
import com.android.systemui.SystemUI;
|
||||
import com.android.systemui.keyguard.KeyguardViewMediator;
|
||||
import com.android.systemui.pip.PipUI;
|
||||
@@ -48,6 +49,12 @@ public abstract class SystemUIBinder {
|
||||
@ClassKey(KeyguardViewMediator.class)
|
||||
public abstract SystemUI bindKeyguardViewMediator(KeyguardViewMediator sysui);
|
||||
|
||||
/** Inject into LatencyTests. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(LatencyTester.class)
|
||||
public abstract SystemUI bindLatencyTester(LatencyTester sysui);
|
||||
|
||||
/** Inject into PipUI. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@@ -66,6 +73,7 @@ public abstract class SystemUIBinder {
|
||||
@ClassKey(Recents.class)
|
||||
public abstract SystemUI bindRecents(Recents sysui);
|
||||
|
||||
|
||||
/** Inject into VolumeUI. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
|
||||
Reference in New Issue
Block a user