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

Commit baed81d8 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "More low-hanging Dependency#get calls."

parents b41b25ff d084d11b
Loading
Loading
Loading
Loading
+8 −6
Original line number Diff line number Diff line
@@ -52,7 +52,6 @@ import android.widget.LinearLayout;
import android.widget.ScrollView;

import com.android.internal.annotations.VisibleForTesting;
import com.android.systemui.Dependency;
import com.android.systemui.R;
import com.android.systemui.animation.Interpolators;
import com.android.systemui.keyguard.WakefulnessLifecycle;
@@ -106,7 +105,7 @@ public class AuthContainerView extends LinearLayout

    private final float mTranslationY;

    @VisibleForTesting final WakefulnessLifecycle mWakefulnessLifecycle;
    private final WakefulnessLifecycle mWakefulnessLifecycle;

    @VisibleForTesting @ContainerState int mContainerState = STATE_UNKNOWN;

@@ -187,10 +186,12 @@ public class AuthContainerView extends LinearLayout

        public AuthContainerView build(int[] sensorIds, boolean credentialAllowed,
                @Nullable List<FingerprintSensorPropertiesInternal> fpProps,
                @Nullable List<FaceSensorPropertiesInternal> faceProps) {
                @Nullable List<FaceSensorPropertiesInternal> faceProps,
                WakefulnessLifecycle wakefulnessLifecycle) {
            mConfig.mSensorIds = sensorIds;
            mConfig.mCredentialAllowed = credentialAllowed;
            return new AuthContainerView(mConfig, new Injector(), fpProps, faceProps);
            return new AuthContainerView(
                    mConfig, new Injector(), fpProps, faceProps, wakefulnessLifecycle);
        }
    }

@@ -276,7 +277,8 @@ public class AuthContainerView extends LinearLayout
    @VisibleForTesting
    AuthContainerView(Config config, Injector injector,
            @Nullable List<FingerprintSensorPropertiesInternal> fpProps,
            @Nullable List<FaceSensorPropertiesInternal> faceProps) {
            @Nullable List<FaceSensorPropertiesInternal> faceProps,
            WakefulnessLifecycle wakefulnessLifecycle) {
        super(config.mContext);

        mConfig = config;
@@ -289,7 +291,7 @@ public class AuthContainerView extends LinearLayout

        mHandler = new Handler(Looper.getMainLooper());
        mWindowManager = mContext.getSystemService(WindowManager.class);
        mWakefulnessLifecycle = Dependency.get(WakefulnessLifecycle.class);
        mWakefulnessLifecycle = wakefulnessLifecycle;

        mTranslationY = getResources()
                .getDimension(R.dimen.biometric_dialog_animation_translation_offset);
+9 −3
Original line number Diff line number Diff line
@@ -63,6 +63,7 @@ import com.android.systemui.assist.ui.DisplayUtils;
import com.android.systemui.dagger.SysUISingleton;
import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.doze.DozeReceiver;
import com.android.systemui.keyguard.WakefulnessLifecycle;
import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.util.concurrency.Execution;

@@ -130,6 +131,7 @@ public class AuthController extends CoreStartable implements CommandQueue.Callba

    @NonNull private final SparseBooleanArray mUdfpsEnrolledForUser;
    private SensorPrivacyManager mSensorPrivacyManager;
    private final WakefulnessLifecycle mWakefulnessLifecycle;

    private class BiometricTaskStackListener extends TaskStackListener {
        @Override
@@ -479,9 +481,11 @@ public class AuthController extends CoreStartable implements CommandQueue.Callba
            Provider<UdfpsController> udfpsControllerFactory,
            Provider<SidefpsController> sidefpsControllerFactory,
            @NonNull DisplayManager displayManager,
            WakefulnessLifecycle wakefulnessLifecycle,
            @Main Handler handler) {
        super(context);
        mExecution = execution;
        mWakefulnessLifecycle = wakefulnessLifecycle;
        mHandler = handler;
        mCommandQueue = commandQueue;
        mActivityTaskManager = activityTaskManager;
@@ -788,7 +792,8 @@ public class AuthController extends CoreStartable implements CommandQueue.Callba
                skipAnimation,
                operationId,
                requestId,
                multiSensorConfig);
                multiSensorConfig,
                mWakefulnessLifecycle);

        if (newDialog == null) {
            Log.e(TAG, "Unsupported type configuration");
@@ -868,7 +873,8 @@ public class AuthController extends CoreStartable implements CommandQueue.Callba
    protected AuthDialog buildDialog(PromptInfo promptInfo, boolean requireConfirmation,
            int userId, int[] sensorIds, boolean credentialAllowed, String opPackageName,
            boolean skipIntro, long operationId, long requestId,
            @BiometricMultiSensorMode int multiSensorConfig) {
            @BiometricMultiSensorMode int multiSensorConfig,
            WakefulnessLifecycle wakefulnessLifecycle) {
        return new AuthContainerView.Builder(mContext)
                .setCallback(this)
                .setPromptInfo(promptInfo)
@@ -879,7 +885,7 @@ public class AuthController extends CoreStartable implements CommandQueue.Callba
                .setOperationId(operationId)
                .setRequestId(requestId)
                .setMultiSensorConfig(multiSensorConfig)
                .build(sensorIds, credentialAllowed, mFpProps, mFaceProps);
                .build(sensorIds, credentialAllowed, mFpProps, mFaceProps, wakefulnessLifecycle);
    }

    /**
+3 −4
Original line number Diff line number Diff line
@@ -58,7 +58,6 @@ import com.android.internal.messages.nano.SystemMessageProto.SystemMessage;
import com.android.settingslib.Utils;
import com.android.settingslib.fuelgauge.BatterySaverUtils;
import com.android.settingslib.utils.PowerUtil;
import com.android.systemui.Dependency;
import com.android.systemui.R;
import com.android.systemui.SystemUIApplication;
import com.android.systemui.dagger.SysUISingleton;
@@ -421,7 +420,7 @@ public class PowerNotificationWarnings implements PowerUI.WarningsUI {
                                    new Intent(Intent.ACTION_VIEW)
                                            .setData(Uri.parse(url))
                                            .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                            Dependency.get(ActivityStarter.class).startActivity(helpIntent,
                            mActivityStarter.startActivity(helpIntent,
                                    true /* dismissShade */, resultCode -> {
                                        mHighTempDialog = null;
                                    });
@@ -456,7 +455,7 @@ public class PowerNotificationWarnings implements PowerUI.WarningsUI {
                                    new Intent(Intent.ACTION_VIEW)
                                            .setData(Uri.parse(url))
                                            .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                            Dependency.get(ActivityStarter.class).startActivity(helpIntent,
                            mActivityStarter.startActivity(helpIntent,
                                    true /* dismissShade */, resultCode -> {
                                        mThermalShutdownDialog = null;
                                    });
@@ -516,7 +515,7 @@ public class PowerNotificationWarnings implements PowerUI.WarningsUI {
                    helpIntent.setClassName("com.android.settings",
                            "com.android.settings.HelpTrampoline");
                    helpIntent.putExtra(Intent.EXTRA_TEXT, contextString);
                    Dependency.get(ActivityStarter.class).startActivity(helpIntent,
                    mActivityStarter.startActivity(helpIntent,
                            true /* dismissShade */, resultCode -> {
                                mUsbHighTempDialog = null;
                            });
+9 −8
Original line number Diff line number Diff line
@@ -43,7 +43,6 @@ import com.android.internal.annotations.VisibleForTesting;
import com.android.settingslib.fuelgauge.Estimate;
import com.android.settingslib.utils.ThreadUtils;
import com.android.systemui.CoreStartable;
import com.android.systemui.Dependency;
import com.android.systemui.R;
import com.android.systemui.broadcast.BroadcastDispatcher;
import com.android.systemui.dagger.SysUISingleton;
@@ -80,13 +79,13 @@ public class PowerUI extends CoreStartable implements CommandQueue.Callbacks {
    @VisibleForTesting
    final Receiver mReceiver = new Receiver();

    private PowerManager mPowerManager;
    private WarningsUI mWarnings;
    private final PowerManager mPowerManager;
    private final WarningsUI mWarnings;
    private InattentiveSleepWarningView mOverlayView;
    private final Configuration mLastConfiguration = new Configuration();
    private int mPlugType = 0;
    private int mInvalidCharger = 0;
    private EnhancedEstimates mEnhancedEstimates;
    private final EnhancedEstimates mEnhancedEstimates;
    private Future mLastShowWarningTask;
    private boolean mEnableSkinTemperatureWarning;
    private boolean mEnableUsbTemperatureAlarm;
@@ -113,18 +112,20 @@ public class PowerUI extends CoreStartable implements CommandQueue.Callbacks {

    @Inject
    public PowerUI(Context context, BroadcastDispatcher broadcastDispatcher,
            CommandQueue commandQueue, Lazy<Optional<StatusBar>> statusBarOptionalLazy) {
            CommandQueue commandQueue, Lazy<Optional<StatusBar>> statusBarOptionalLazy,
            WarningsUI warningsUI, EnhancedEstimates enhancedEstimates,
            PowerManager powerManager) {
        super(context);
        mBroadcastDispatcher = broadcastDispatcher;
        mCommandQueue = commandQueue;
        mStatusBarOptionalLazy = statusBarOptionalLazy;
        mWarnings = warningsUI;
        mEnhancedEstimates = enhancedEstimates;
        mPowerManager = powerManager;
    }

    public void start() {
        mPowerManager = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE);
        mScreenOffTime = mPowerManager.isScreenOn() ? -1 : SystemClock.elapsedRealtime();
        mWarnings = Dependency.get(WarningsUI.class);
        mEnhancedEstimates = Dependency.get(EnhancedEstimates.class);
        mLastConfiguration.setTo(mContext.getResources().getConfiguration());

        ContentObserver obs = new ContentObserver(mHandler) {
+7 −3
Original line number Diff line number Diff line
@@ -56,6 +56,7 @@ import android.widget.ImageView;
import android.widget.ScrollView;

import com.android.systemui.SysuiTestCase;
import com.android.systemui.keyguard.WakefulnessLifecycle;

import org.junit.Before;
import org.junit.Test;
@@ -75,6 +76,7 @@ public class AuthContainerViewTest extends SysuiTestCase {

    private @Mock AuthDialogCallback mCallback;
    private @Mock UserManager mUserManager;
    private @Mock WakefulnessLifecycle mWakefulnessLifecycle;

    @Before
    public void setup() {
@@ -263,15 +265,17 @@ public class AuthContainerViewTest extends SysuiTestCase {
                componentInfo,
                FingerprintSensorProperties.TYPE_REAR,
                false /* resetLockoutRequiresHardwareAuthToken */));
        mAuthContainer = new TestableAuthContainer(config, fpProps, null /* faceProps */);
        mAuthContainer = new TestableAuthContainer(config, fpProps, null /* faceProps */,
                mWakefulnessLifecycle);
    }

    private class TestableAuthContainer extends AuthContainerView {
        TestableAuthContainer(AuthContainerView.Config config,
                @Nullable List<FingerprintSensorPropertiesInternal> fpProps,
                @Nullable List<FaceSensorPropertiesInternal> faceProps) {
                @Nullable List<FaceSensorPropertiesInternal> faceProps,
                WakefulnessLifecycle wakefulnessLifecycle) {

            super(config, new MockInjector(), fpProps, faceProps);
            super(config, new MockInjector(), fpProps, faceProps, wakefulnessLifecycle);
        }

        @Override
Loading