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

Commit 884cbd5f authored by LuK1337's avatar LuK1337 Committed by Daniel Jacob Chittoor
Browse files

udfps: Implement default udfps display mode provider

* This should let us choose between multiple UdfpsDisplayModeProvider implementations.

Original-Change-Id: I9b93e32644feaf1398cdac69e9696d8ec195f246
Change-Id: I676bcb660860b6463ecc43239bb15119e33932dd
parent 5208ed90
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -3,5 +3,8 @@
-keep class com.android.systemui.SystemUIInitializerImpl {
    *;
}
-keep class * implements com.android.systemui.biometrics.UdfpsDisplayModeProvider {
    public <init>(...);
}

-keep,allowoptimization,allowaccessmodification class com.android.systemui.dagger.DaggerReferenceGlobalRootComponent** { !synthetic *; }
+3 −0
Original line number Diff line number Diff line
@@ -52,6 +52,9 @@
          <item>4095,0</item>
    </string-array>

    <!-- Udfps display mode provider class name -->
    <string name="config_udfpsDisplayModeProviderComponent">com.android.systemui.biometrics.DummyUdfpsDisplayModeProvider</string>

    <!-- Doze: does the double tap sensor need a proximity check? -->
    <bool name="doze_double_tap_proximity_check">false</bool>

+32 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2022 The LineageOS Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.systemui.biometrics

import android.content.Context
import android.view.Surface

class DummyUdfpsDisplayModeProvider constructor(
    private val context: Context
): UdfpsDisplayModeProvider {
    override fun enable(onEnabled: Runnable?) {
        onEnabled?.run()
    }

    override fun disable(onDisabled: Runnable?) {
        onDisabled?.run()
    }
}
+2 −0
Original line number Diff line number Diff line
@@ -662,6 +662,7 @@ public class UdfpsController implements DozeReceiver, Dumpable {
            @NonNull VibratorHelper vibrator,
            @NonNull UdfpsHapticsSimulator udfpsHapticsSimulator,
            @NonNull UdfpsShell udfpsShell,
            @NonNull UdfpsDisplayModeProvider udfpsDisplayMode,
            @NonNull KeyguardStateController keyguardStateController,
            @NonNull DisplayManager displayManager,
            @Main Handler mainHandler,
@@ -709,6 +710,7 @@ public class UdfpsController implements DozeReceiver, Dumpable {
        mPowerManager = powerManager;
        mAccessibilityManager = accessibilityManager;
        mLockscreenShadeTransitionController = lockscreenShadeTransitionController;
        mUdfpsDisplayMode = udfpsDisplayMode;
        screenLifecycle.addObserver(mScreenObserver);
        mScreenOn = screenLifecycle.getScreenState() == ScreenLifecycle.SCREEN_ON;
        mConfigurationController = configurationController;
+12 −3
Original line number Diff line number Diff line
@@ -151,6 +151,7 @@ import com.android.systemui.util.time.SystemClock;
import com.android.systemui.util.time.SystemClockImpl;
import com.android.systemui.wallet.dagger.WalletModule;
import com.android.systemui.wmshell.BubblesManager;
import com.android.systemui.R;
import com.android.wm.shell.bubbles.Bubbles;

import dagger.Binds;
@@ -329,9 +330,17 @@ public abstract class SystemUIModule {
    @BindsOptionalOf
    abstract CentralSurfaces optionalCentralSurfaces();

    @BindsOptionalOf
    abstract UdfpsDisplayModeProvider optionalUdfpsDisplayModeProvider();

    @Provides
    static UdfpsDisplayModeProvider getUdfpsDisplayModeProvider(Context context) {
        String className = context.getString(R.string.config_udfpsDisplayModeProviderComponent);
        try {
            Class<?> clazz = context.getClassLoader().loadClass(className);
            return (UdfpsDisplayModeProvider) clazz.getDeclaredConstructor(
                    new Class[] { Context.class }).newInstance(context);
        } catch (Throwable t) {
            throw new RuntimeException("Error loading UdfpsDisplayModeProvider " + className, t);
        }
    }
    @BindsOptionalOf
    abstract FingerprintInteractiveToAuthProvider optionalFingerprintInteractiveToAuthProvider();