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

Commit d302508d authored by Jorim Jaggi's avatar Jorim Jaggi Committed by Android Git Automerger
Browse files

am 4a306fd7: am 3a464785: Add a private API to get notified about lockout resets

* commit '4a306fd7':
  Add a private API to get notified about lockout resets
parents d6597cb4 4a306fd7
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -160,6 +160,7 @@ LOCAL_SRC_FILES += \
	core/java/android/hardware/fingerprint/IFingerprintDaemon.aidl \
	core/java/android/hardware/fingerprint/IFingerprintDaemon.aidl \
	core/java/android/hardware/fingerprint/IFingerprintDaemonCallback.aidl \
	core/java/android/hardware/fingerprint/IFingerprintDaemonCallback.aidl \
	core/java/android/hardware/fingerprint/IFingerprintService.aidl \
	core/java/android/hardware/fingerprint/IFingerprintService.aidl \
	core/java/android/hardware/fingerprint/IFingerprintServiceLockoutResetCallback.aidl \
	core/java/android/hardware/fingerprint/IFingerprintServiceReceiver.aidl \
	core/java/android/hardware/fingerprint/IFingerprintServiceReceiver.aidl \
	core/java/android/hardware/hdmi/IHdmiControlCallback.aidl \
	core/java/android/hardware/hdmi/IHdmiControlCallback.aidl \
	core/java/android/hardware/hdmi/IHdmiControlService.aidl \
	core/java/android/hardware/hdmi/IHdmiControlService.aidl \
+41 −2
Original line number Original line Diff line number Diff line
@@ -391,6 +391,18 @@ public class FingerprintManager {
        public void onRemovalSucceeded(Fingerprint fingerprint) { }
        public void onRemovalSucceeded(Fingerprint fingerprint) { }
    };
    };


    /**
     * @hide
     */
    public static abstract class LockoutResetCallback {

        /**
         * Called when lockout period expired and clients are allowed to listen for fingerprint
         * again.
         */
        public void onLockoutReset() { }
    };

    /**
    /**
     * Request authentication of a crypto object. This call warms up the fingerprint hardware
     * Request authentication of a crypto object. This call warms up the fingerprint hardware
     * and starts scanning for a fingerprint. It terminates when
     * and starts scanning for a fingerprint. It terminates when
@@ -680,10 +692,37 @@ public class FingerprintManager {
            try {
            try {
                mService.resetTimeout(token);
                mService.resetTimeout(token);
            } catch (RemoteException e) {
            } catch (RemoteException e) {
                Log.v(TAG, "Remote exception in getAuthenticatorId(): ", e);
                Log.v(TAG, "Remote exception in resetTimeout(): ", e);
            }
            }
        } else {
        } else {
            Log.w(TAG, "getAuthenticatorId(): Service not connected!");
            Log.w(TAG, "resetTimeout(): Service not connected!");
        }
    }

    /**
     * @hide
     */
    public void addLockoutResetCallback(final LockoutResetCallback callback) {
        if (mService != null) {
            try {
                mService.addLockoutResetCallback(
                        new IFingerprintServiceLockoutResetCallback.Stub() {

                    @Override
                    public void onLockoutReset(long deviceId) throws RemoteException {
                        mHandler.post(new Runnable() {
                            @Override
                            public void run() {
                                callback.onLockoutReset();
                            }
                        });
                    }
                });
            } catch (RemoteException e) {
                Log.v(TAG, "Remote exception in addLockoutResetCallback(): ", e);
            }
        } else {
            Log.w(TAG, "addLockoutResetCallback(): Service not connected!");
        }
        }
    }
    }


+4 −0
Original line number Original line Diff line number Diff line
@@ -17,6 +17,7 @@ package android.hardware.fingerprint;


import android.os.Bundle;
import android.os.Bundle;
import android.hardware.fingerprint.IFingerprintServiceReceiver;
import android.hardware.fingerprint.IFingerprintServiceReceiver;
import android.hardware.fingerprint.IFingerprintServiceLockoutResetCallback;
import android.hardware.fingerprint.Fingerprint;
import android.hardware.fingerprint.Fingerprint;
import java.util.List;
import java.util.List;


@@ -71,4 +72,7 @@ interface IFingerprintService {


    // Reset the timeout when user authenticates with strong auth (e.g. PIN, pattern or password)
    // Reset the timeout when user authenticates with strong auth (e.g. PIN, pattern or password)
    void resetTimeout(in byte [] cryptoToken);
    void resetTimeout(in byte [] cryptoToken);

    // Add a callback which gets notified when the fingerprint lockout period expired.
    void addLockoutResetCallback(IFingerprintServiceLockoutResetCallback callback);
}
}
+28 −0
Original line number Original line Diff line number Diff line
/*
 * Copyright (C) 2015 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;

import android.hardware.fingerprint.Fingerprint;
import android.os.Bundle;
import android.os.UserHandle;

/**
 * Callback when lockout period expired and clients are allowed to authenticate again.
 * @hide
 */
oneway interface IFingerprintServiceLockoutResetCallback {
    void onLockoutReset(long deviceId);
}
+16 −0
Original line number Original line Diff line number Diff line
@@ -29,6 +29,7 @@ import android.content.Intent;
import android.content.IntentFilter;
import android.content.IntentFilter;
import android.database.ContentObserver;
import android.database.ContentObserver;
import android.graphics.Bitmap;
import android.graphics.Bitmap;
import android.hardware.fingerprint.Fingerprint;
import android.hardware.fingerprint.FingerprintManager;
import android.hardware.fingerprint.FingerprintManager;
import android.hardware.fingerprint.FingerprintManager.AuthenticationCallback;
import android.hardware.fingerprint.FingerprintManager.AuthenticationCallback;
import android.hardware.fingerprint.FingerprintManager.AuthenticationResult;
import android.hardware.fingerprint.FingerprintManager.AuthenticationResult;
@@ -472,6 +473,10 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
        }
        }
    }
    }


    private void handleFingerprintLockoutReset() {
        updateFingerprintListeningState();
    }

    private void setFingerprintRunningState(int fingerprintRunningState) {
    private void setFingerprintRunningState(int fingerprintRunningState) {
        boolean wasRunning = mFingerprintRunningState == FINGERPRINT_STATE_RUNNING;
        boolean wasRunning = mFingerprintRunningState == FINGERPRINT_STATE_RUNNING;
        boolean isRunning = fingerprintRunningState == FINGERPRINT_STATE_RUNNING;
        boolean isRunning = fingerprintRunningState == FINGERPRINT_STATE_RUNNING;
@@ -681,6 +686,14 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
        }
        }
    };
    };


    private final FingerprintManager.LockoutResetCallback mLockoutResetCallback
            = new FingerprintManager.LockoutResetCallback() {
        @Override
        public void onLockoutReset() {
            handleFingerprintLockoutReset();
        }
    };

    private FingerprintManager.AuthenticationCallback mAuthenticationCallback
    private FingerprintManager.AuthenticationCallback mAuthenticationCallback
            = new AuthenticationCallback() {
            = new AuthenticationCallback() {


@@ -1003,6 +1016,9 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {


        mFpm = (FingerprintManager) context.getSystemService(Context.FINGERPRINT_SERVICE);
        mFpm = (FingerprintManager) context.getSystemService(Context.FINGERPRINT_SERVICE);
        updateFingerprintListeningState();
        updateFingerprintListeningState();
        if (mFpm != null) {
            mFpm.addLockoutResetCallback(mLockoutResetCallback);
        }
    }
    }


    private void updateFingerprintListeningState() {
    private void updateFingerprintListeningState() {
Loading