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

Commit d2b4be09 authored by Phil Weaver's avatar Phil Weaver Committed by android-build-merger
Browse files

Merge "Add config value for fingerprint gesture support" into pi-dev am: 3f9aaad4

am: 48de1812

Change-Id: Ie857bd953d1005d3e17e17dbf1fb5b0a4234f5d9
parents 8228a899 48de1812
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -302,7 +302,16 @@ public class AccessibilityServiceInfo implements Parcelable {

    /**
     * This flag requests that all fingerprint gestures be sent to the accessibility service.
     * It is handled in {@link FingerprintGestureController}
     * <p>
     * Services that want to set this flag have to declare the capability
     * to retrieve window content in their meta-data by setting the attribute
     * {@link android.R.attr#canRequestFingerprintGestures} to
     * true, otherwise this flag will be ignored. For how to declare the meta-data
     * of a service refer to {@value AccessibilityService#SERVICE_META_DATA}.
     * </p>
     *
     * @see android.R.styleable#AccessibilityService_canRequestFingerprintGestures
     * @see AccessibilityService#getFingerprintGestureController()
     */
    public static final int FLAG_REQUEST_FINGERPRINT_GESTURES = 0x00000200;

+3 −0
Original line number Diff line number Diff line
@@ -2853,6 +2853,9 @@
    <!-- For performance and storage reasons, limit the number of fingerprints per user -->
    <integer name="config_fingerprintMaxTemplatesPerUser">5</integer>

    <!-- Specify if the fingerprint hardware support gestures-->
    <bool name="config_fingerprintSupportsGestures">false</bool>

    <!-- This config is used to force VoiceInteractionService to start on certain low ram devices.
         It declares the package name of VoiceInteractionService that should be started. -->
    <string translatable="false" name="config_forceVoiceInteractionServicePackage"></string>
+1 −0
Original line number Diff line number Diff line
@@ -2407,6 +2407,7 @@

  <!-- Fingerprint config -->
  <java-symbol type="integer" name="config_fingerprintMaxTemplatesPerUser"/>
  <java-symbol type="bool" name="config_fingerprintSupportsGestures"/>

  <!-- From various Material changes -->
  <java-symbol type="attr" name="titleTextAppearance" />
+1 −1
Original line number Diff line number Diff line
@@ -2232,7 +2232,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
                        }
                        if (service != null) {
                            mFingerprintGestureDispatcher = new FingerprintGestureDispatcher(
                                    service, mLock);
                                    service, mContext.getResources(), mLock);
                            break;
                        }
                    }
+16 −3
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.server.accessibility;

import android.accessibilityservice.FingerprintGestureController;
import android.content.res.Resources;
import android.hardware.fingerprint.IFingerprintClientActiveCallback;
import android.hardware.fingerprint.IFingerprintService;
import android.os.Binder;
@@ -42,6 +43,7 @@ public class FingerprintGestureDispatcher extends IFingerprintClientActiveCallba
    private final Object mLock;
    private final IFingerprintService mFingerprintService;
    private final Handler mHandler;
    private final boolean mHardwareSupportsGestures;

    // This field is ground truth for whether or not we are registered. Only write to it in handler.
    private boolean mRegisteredReadOnlyExceptInHandler;
@@ -50,8 +52,11 @@ public class FingerprintGestureDispatcher extends IFingerprintClientActiveCallba
     * @param fingerprintService The system's fingerprint service
     * @param lock A lock to use when managing internal state
     */
    public FingerprintGestureDispatcher(IFingerprintService fingerprintService, Object lock) {
    public FingerprintGestureDispatcher(IFingerprintService fingerprintService,
            Resources resources, Object lock) {
        mFingerprintService = fingerprintService;
        mHardwareSupportsGestures = resources.getBoolean(
                com.android.internal.R.bool.config_fingerprintSupportsGestures);
        mLock = lock;
        mHandler = new Handler(this);
    }
@@ -61,9 +66,11 @@ public class FingerprintGestureDispatcher extends IFingerprintClientActiveCallba
     * @param lock A lock to use when managing internal state
     * @param handler A handler to use internally. Used for testing.
     */
    public FingerprintGestureDispatcher(IFingerprintService fingerprintService, Object lock,
            Handler handler) {
    public FingerprintGestureDispatcher(IFingerprintService fingerprintService,
            Resources resources, Object lock, Handler handler) {
        mFingerprintService = fingerprintService;
        mHardwareSupportsGestures = resources.getBoolean(
                com.android.internal.R.bool.config_fingerprintSupportsGestures);
        mLock = lock;
        mHandler = handler;
    }
@@ -74,6 +81,8 @@ public class FingerprintGestureDispatcher extends IFingerprintClientActiveCallba
     * @param clientList The list of potential clients.
     */
    public void updateClientList(List<? extends FingerprintGestureClient> clientList) {
        if (!mHardwareSupportsGestures) return;

        synchronized (mLock) {
            mCapturingClients.clear();
            for (int i = 0; i < clientList.size(); i++) {
@@ -96,6 +105,8 @@ public class FingerprintGestureDispatcher extends IFingerprintClientActiveCallba

    @Override
    public void onClientActiveChanged(boolean nonGestureFingerprintClientActive) {
        if (!mHardwareSupportsGestures) return;

        synchronized (mLock) {
            for (int i = 0; i < mCapturingClients.size(); i++) {
                mCapturingClients.get(i).onFingerprintGestureDetectionActiveChanged(
@@ -105,6 +116,8 @@ public class FingerprintGestureDispatcher extends IFingerprintClientActiveCallba
    }

    public boolean isFingerprintGestureDetectionAvailable() {
        if (!mHardwareSupportsGestures) return false;

        long identity = Binder.clearCallingIdentity();
        try {
            return !mFingerprintService.isClientActive();
Loading