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

Commit aee4be2e authored by LuK1337's avatar LuK1337
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 15b8ab9a
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -10,6 +10,9 @@
}
-keep class * extends com.android.systemui.CoreStartable
-keep class * implements com.android.systemui.CoreStartable$Injector
-keep class * implements com.android.systemui.biometrics.UdfpsDisplayModeProvider {
    public <init>(...);
}

# Needed for builds to properly initialize KeyFrames from xml scene
-keepclassmembers class * extends androidx.constraintlayout.motion.widget.Key {
+3 −0
Original line number Diff line number Diff line
@@ -25,6 +25,9 @@
         causes a poor experience. -->
    <bool name="config_fingerprintWakeAndUnlock">true</bool>

    <!-- 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 −2
Original line number Diff line number Diff line
@@ -594,7 +594,7 @@ public class UdfpsController implements DozeReceiver {
            @NonNull VibratorHelper vibrator,
            @NonNull UdfpsHapticsSimulator udfpsHapticsSimulator,
            @NonNull UdfpsShell udfpsShell,
            @NonNull Optional<UdfpsDisplayModeProvider> udfpsDisplayMode,
            @NonNull UdfpsDisplayModeProvider udfpsDisplayMode,
            @NonNull KeyguardStateController keyguardStateController,
            @NonNull DisplayManager displayManager,
            @Main Handler mainHandler,
@@ -626,7 +626,7 @@ public class UdfpsController implements DozeReceiver {
        mPowerManager = powerManager;
        mAccessibilityManager = accessibilityManager;
        mLockscreenShadeTransitionController = lockscreenShadeTransitionController;
        mUdfpsDisplayMode = udfpsDisplayMode.orElse(null);
        mUdfpsDisplayMode = udfpsDisplayMode;
        screenLifecycle.addObserver(mScreenObserver);
        mScreenOn = screenLifecycle.getScreenState() == ScreenLifecycle.SCREEN_ON;
        mConfigurationController = configurationController;
+12 −2
Original line number Diff line number Diff line
@@ -93,6 +93,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 java.util.Optional;
@@ -198,8 +199,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 AlternateUdfpsTouchProvider optionalUdfpsTouchProvider();