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

Commit 9db605bb authored by Dave Mankoff's avatar Dave Mankoff Committed by Android (Google) Code Review
Browse files

Merge "Make CoreStartable an Interface."

parents 51db2863 c80ec2b1
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -17,7 +17,6 @@
package com.android.keyguard

import android.app.StatusBarManager.SESSION_KEYGUARD
import android.content.Context
import android.hardware.biometrics.BiometricSourceType
import com.android.internal.annotations.VisibleForTesting
import com.android.internal.logging.UiEvent
@@ -41,11 +40,10 @@ import javax.inject.Inject
 */
@SysUISingleton
class KeyguardBiometricLockoutLogger @Inject constructor(
    context: Context?,
    private val uiEventLogger: UiEventLogger,
    private val keyguardUpdateMonitor: KeyguardUpdateMonitor,
    private val sessionTracker: SessionTracker
) : CoreStartable(context) {
) : CoreStartable {
    private var fingerprintLockedOut = false
    private var faceLockedOut = false
    private var encryptedOrLockdown = false
+2 −2
Original line number Diff line number Diff line
@@ -19,11 +19,11 @@ import kotlinx.coroutines.withContext

@SysUISingleton
class ChooserSelector @Inject constructor(
        context: Context,
        private val context: Context,
        private val featureFlags: FeatureFlags,
        @Application private val coroutineScope: CoroutineScope,
        @Background private val bgDispatcher: CoroutineDispatcher
) : CoreStartable(context) {
) : CoreStartable {

    private val packageManager = context.packageManager
    private val chooserComponent = ComponentName.unflattenFromString(
+18 −16
Original line number Diff line number Diff line
@@ -16,39 +16,41 @@

package com.android.systemui;

import android.content.Context;
import android.content.res.Configuration;

import androidx.annotation.NonNull;

import com.android.internal.annotations.VisibleForTesting;

import java.io.PrintWriter;

/**
 * A top-level module of system UI code (sometimes called "system UI services" elsewhere in code).
 * Which CoreStartable modules are loaded can be controlled via a config resource.
 * Code that needs to be run when SystemUI is started.
 *
 * Which CoreStartable modules are loaded is controlled via the dagger graph. Bind them into the
 * CoreStartable map with code such as:
 *
 *  <pre>
 *  &#64;Binds
 *  &#64;IntoMap
 *  &#64;ClassKey(FoobarStartable::class)
 *  abstract fun bind(impl: FoobarStartable): CoreStartable
 *  </pre>
 *
 * @see SystemUIApplication#startServicesIfNeeded()
 */
public abstract class CoreStartable implements Dumpable {
    protected final Context mContext;

    public CoreStartable(Context context) {
        mContext = context;
    }
public interface CoreStartable extends Dumpable {

    /** Main entry point for implementations. Called shortly after app startup. */
    public abstract void start();
    void start();

    protected void onConfigurationChanged(Configuration newConfig) {
    /** */
    default void onConfigurationChanged(Configuration newConfig) {
    }

    @Override
    public void dump(@NonNull PrintWriter pw, @NonNull String[] args) {
    default void dump(@NonNull PrintWriter pw, @NonNull String[] args) {
    }

    @VisibleForTesting
    protected void onBootCompleted() {
    /** Called when the device reports BOOT_COMPLETED. */
    default void onBootCompleted() {
    }
}
+1 −3
Original line number Diff line number Diff line
@@ -46,7 +46,7 @@ import javax.inject.Inject;
 * system that are used for testing the latency.
 */
@SysUISingleton
public class LatencyTester extends CoreStartable {
public class LatencyTester implements CoreStartable {
    private static final boolean DEFAULT_ENABLED = Build.IS_ENG;
    private static final String
            ACTION_FINGERPRINT_WAKE =
@@ -62,13 +62,11 @@ public class LatencyTester extends CoreStartable {

    @Inject
    public LatencyTester(
            Context context,
            BiometricUnlockController biometricUnlockController,
            BroadcastDispatcher broadcastDispatcher,
            DeviceConfigProxy deviceConfigProxy,
            @Main DelayableExecutor mainExecutor
    ) {
        super(context);
        mBiometricUnlockController = biometricUnlockController;
        mBroadcastDispatcher = broadcastDispatcher;
        mDeviceConfigProxy = deviceConfigProxy;
+4 −3
Original line number Diff line number Diff line
@@ -105,7 +105,7 @@ import kotlin.Pair;
 * for antialiasing and emulation purposes.
 */
@SysUISingleton
public class ScreenDecorations extends CoreStartable implements Tunable , Dumpable {
public class ScreenDecorations implements CoreStartable, Tunable , Dumpable {
    private static final boolean DEBUG = false;
    private static final String TAG = "ScreenDecorations";

@@ -130,6 +130,7 @@ public class ScreenDecorations extends CoreStartable implements Tunable , Dumpab
    @VisibleForTesting
    protected boolean mIsRegistered;
    private final BroadcastDispatcher mBroadcastDispatcher;
    private final Context mContext;
    private final Executor mMainExecutor;
    private final TunerService mTunerService;
    private final SecureSettings mSecureSettings;
@@ -308,7 +309,7 @@ public class ScreenDecorations extends CoreStartable implements Tunable , Dumpab
            ThreadFactory threadFactory,
            PrivacyDotDecorProviderFactory dotFactory,
            FaceScanningProviderFactory faceScanningFactory) {
        super(context);
        mContext = context;
        mMainExecutor = mainExecutor;
        mSecureSettings = secureSettings;
        mBroadcastDispatcher = broadcastDispatcher;
@@ -973,7 +974,7 @@ public class ScreenDecorations extends CoreStartable implements Tunable , Dumpab
    }

    @Override
    protected void onConfigurationChanged(Configuration newConfig) {
    public void onConfigurationChanged(Configuration newConfig) {
        if (DEBUG_DISABLE_SCREEN_DECORATIONS) {
            Log.i(TAG, "ScreenDecorations is disabled");
            return;
Loading