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

Commit 2ce0a373 authored by Ilya Matyukhin's avatar Ilya Matyukhin Committed by Android (Google) Code Review
Browse files

Merge changes from topic "implement-lhbm" into sc-dev

* changes:
  Introduce IUdfpsHbmListener
  Implement LHBM/GHBM switch
parents 8d976939 0f75ed39
Loading
Loading
Loading
Loading
+47 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2021 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;

/**
 * A listener for the high-brightness mode (HBM) transitions. This allows other components to
 * perform certain actions when the HBM is toggled on or off. For example, a display manager
 * implementation can subscribe to these events from UdfpsController and adjust the display's
 * refresh rate when the HBM is enabled.
 *
 * @hide
 */
oneway interface IUdfpsHbmListener {
    /**
     * UdfpsController will call this method when the HBM is enabled.
     *
     * @param hbmType The type of HBM that was enabled. See
     *        {@link com.android.systemui.biometrics.HbmTypes}.
     * @param displayId The displayId for which the HBM is enabled. See
     *        {@link android.view.Display#getDisplayId()}.
     */
    void onHbmEnabled(int hbmType, int displayId);

    /**
     * UdfpsController will call this method when the HBM is disabled.
     *
     * @param hbmType The type of HBM that was disabled. See
     *        {@link com.android.systemui.biometrics.HbmTypes}.
     * @param displayId The displayId for which the HBM is disabled. See
     *        {@link android.view.Display#getDisplayId()}.
     */
    void onHbmDisabled(int hbmType, int displayId);
}
+6 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import android.content.ComponentName;
import android.graphics.Rect;
import android.hardware.biometrics.IBiometricSysuiReceiver;
import android.hardware.biometrics.PromptInfo;
import android.hardware.fingerprint.IUdfpsHbmListener;
import android.os.Bundle;
import android.os.ParcelFileDescriptor;
import android.service.notification.StatusBarNotification;
@@ -155,6 +156,11 @@ oneway interface IStatusBar
    // Used to hide the authentication dialog, e.g. when the application cancels authentication
    void hideAuthenticationDialog();

    /**
     * Sets an instance of IUdfpsHbmListener for UdfpsController.
     */
    void setUdfpsHbmListener(in IUdfpsHbmListener listener);

    /**
     * Notifies System UI that the display is ready to show system decorations.
     */
+6 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import android.content.ComponentName;
import android.graphics.Rect;
import android.hardware.biometrics.IBiometricSysuiReceiver;
import android.hardware.biometrics.PromptInfo;
import android.hardware.fingerprint.IUdfpsHbmListener;
import android.net.Uri;
import android.os.Bundle;
import android.os.UserHandle;
@@ -120,6 +121,11 @@ interface IStatusBarService
    // Used to hide the authentication dialog, e.g. when the application cancels authentication
    void hideAuthenticationDialog();

    /**
     * Sets an instance of IUdfpsHbmListener for UdfpsController.
     */
    void setUdfpsHbmListener(in IUdfpsHbmListener listener);

    /**
     * Show a warning that the device is about to go to sleep due to user inactivity.
     */
+12 −6
Original line number Diff line number Diff line
@@ -16,9 +16,11 @@

package com.android.systemui.biometrics;

import android.annotation.NonNull;
import android.annotation.Nullable;
import android.view.Surface;

import com.android.systemui.biometrics.HbmTypes.HbmType;

/**
 * Interface for controlling the high-brightness mode (HBM). UdfpsView can use this callback to
 * enable the HBM while showing the fingerprint illumination, and to disable the HBM after the
@@ -26,16 +28,20 @@ import android.view.Surface;
 */
public interface HbmCallback {
    /**
     * UdfpsView will call this to enable the HBM before drawing the illumination dot.
     * UdfpsView will call this to enable the HBM when the fingerprint illumination is needed.
     *
     * @param surface A valid surface for which the HBM should be enabled.
     * @param hbmType The type of HBM that should be enabled. See {@link HbmTypes}.
     * @param surface The surface for which the HBM is requested, in case the HBM implementation
     *                needs to set special surface flags to enable the HBM. Can be null.
     */
    void enableHbm(@NonNull Surface surface);
    void enableHbm(@HbmType int hbmType, @Nullable Surface surface);

    /**
     * UdfpsView will call this to disable the HBM when the illumination is not longer needed.
     *
     * @param surface A valid surface for which the HBM should be disabled.
     * @param hbmType The type of HBM that should be disabled. See {@link HbmTypes}.
     * @param surface The surface for which the HBM is requested, in case the HBM implementation
     *                needs to unset special surface flags to disable the HBM. Can be null.
     */
    void disableHbm(@NonNull Surface surface);
    void disableHbm(@HbmType int hbmType, @Nullable Surface surface);
}
+38 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2021 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 com.android.systemui.biometrics;

import android.annotation.IntDef;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

/**
 * Different high-brightness mode (HBM) types that are relevant to this package.
 */
public final class HbmTypes {
    /** HBM that applies to the whole screen. */
    public static final int GLOBAL_HBM = 0;

    /** HBM that only applies to a portion of the screen. */
    public static final int LOCAL_HBM = 1;

    @Retention(RetentionPolicy.SOURCE)
    @IntDef({GLOBAL_HBM, LOCAL_HBM})
    public @interface HbmType {
    }
}
Loading