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

Commit 1ba66726 authored by Ilya Matyukhin's avatar Ilya Matyukhin
Browse files

Add interfaces for controlling the UDFPS overlay

Bug: 158135499
Test: build
Change-Id: I099550a455c9e49741bb9f61eea11b98574151bc
parent f776ee08
Loading
Loading
Loading
Loading
+11 −1
Original line number Original line Diff line number Diff line
@@ -19,6 +19,7 @@ import android.hardware.biometrics.IBiometricSensorReceiver;
import android.hardware.biometrics.IBiometricServiceLockoutResetCallback;
import android.hardware.biometrics.IBiometricServiceLockoutResetCallback;
import android.hardware.fingerprint.IFingerprintClientActiveCallback;
import android.hardware.fingerprint.IFingerprintClientActiveCallback;
import android.hardware.fingerprint.IFingerprintServiceReceiver;
import android.hardware.fingerprint.IFingerprintServiceReceiver;
import android.hardware.fingerprint.IUdfpsOverlayController;
import android.hardware.fingerprint.Fingerprint;
import android.hardware.fingerprint.Fingerprint;
import android.view.Surface;
import android.view.Surface;
import java.util.List;
import java.util.List;
@@ -111,6 +112,15 @@ interface IFingerprintService {
    // Notifies about a finger leaving the sensor area.
    // Notifies about a finger leaving the sensor area.
    void onFingerUp();
    void onFingerUp();


    // Returns whether the specified sensor is a UDFPS.
    // Returns whether the specified sensor is an under-display fingerprint sensor (UDFPS).
    boolean isUdfps(int sensorId);
    boolean isUdfps(int sensorId);

    // Shows the UDFPS overlay.
    void showUdfpsOverlay();

    // Hides the UDFPS overlay.
    void hideUdfpsOverlay();

    // Sets the controller for managing the UDFPS overlay.
    void setUdfpsOverlayController(in IUdfpsOverlayController controller);
}
}
+28 −0
Original line number Original line Diff line number Diff line
/*
 * Copyright (C) 2020 The Android Open Source 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 android.hardware.fingerprint;

/**
 * Interface for interacting with the under-display fingerprint sensor (UDFPS) overlay.
 * @hide
 */
oneway interface IUdfpsOverlayController {
    // Shows the overlay.
    void showUdfpsOverlay();

    // Hides the overlay.
    void hideUdfpsOverlay();
}
+32 −0
Original line number Original line Diff line number Diff line
@@ -39,6 +39,7 @@ import android.hardware.fingerprint.Fingerprint;
import android.hardware.fingerprint.IFingerprintClientActiveCallback;
import android.hardware.fingerprint.IFingerprintClientActiveCallback;
import android.hardware.fingerprint.IFingerprintService;
import android.hardware.fingerprint.IFingerprintService;
import android.hardware.fingerprint.IFingerprintServiceReceiver;
import android.hardware.fingerprint.IFingerprintServiceReceiver;
import android.hardware.fingerprint.IUdfpsOverlayController;
import android.os.Binder;
import android.os.Binder;
import android.os.Build;
import android.os.Build;
import android.os.Environment;
import android.os.Environment;
@@ -412,11 +413,42 @@ public class FingerprintService extends BiometricServiceBase {
            }
            }
            return false;
            return false;
        }
        }

        @Override
        public void showUdfpsOverlay() {
            if (mUdfpsOverlayController == null) {
                Slog.e(TAG, "showUdfpsOverlay | mUdfpsOverlayController is null");
                return;
            }
            try {
                mUdfpsOverlayController.showUdfpsOverlay();
            } catch (RemoteException e) {
                Slog.e(TAG, "showUdfpsOverlay | RemoteException: ", e);
            }
        }

        @Override
        public void hideUdfpsOverlay() {
            if (mUdfpsOverlayController == null) {
                Slog.e(TAG, "hideUdfpsOverlay | mUdfpsOverlayController is null");
                return;
            }
            try {
                mUdfpsOverlayController.hideUdfpsOverlay();
            } catch (RemoteException e) {
                Slog.e(TAG, "hideUdfpsOverlay | RemoteException: ", e);
            }
        }

        public void setUdfpsOverlayController(IUdfpsOverlayController controller) {
            mUdfpsOverlayController = controller;
        }
    }
    }


    private final LockoutFrameworkImpl mLockoutTracker;
    private final LockoutFrameworkImpl mLockoutTracker;
    private final CopyOnWriteArrayList<IFingerprintClientActiveCallback> mClientActiveCallbacks =
    private final CopyOnWriteArrayList<IFingerprintClientActiveCallback> mClientActiveCallbacks =
            new CopyOnWriteArrayList<>();
            new CopyOnWriteArrayList<>();
    private IUdfpsOverlayController mUdfpsOverlayController;


    @GuardedBy("this")
    @GuardedBy("this")
    private IBiometricsFingerprint mDaemon;
    private IBiometricsFingerprint mDaemon;