Skip to content

Commit

Permalink
mido: Update biometrics for pie update
Browse files Browse the repository at this point in the history
  • Loading branch information
TheScarastic committed Aug 19, 2018
1 parent ffca6b3 commit b41ce8e
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 41 deletions.
6 changes: 3 additions & 3 deletions biometrics/Android.mk
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)
LOCAL_MODULE := android.hardware.biometrics.fingerprint@2.0-service.xiaomi_mido
LOCAL_INIT_RC := android.hardware.biometrics.fingerprint@2.0-service.xiaomi_mido.rc
LOCAL_MODULE := android.hardware.biometrics.fingerprint@2.1-service.xiaomi_mido
LOCAL_INIT_RC := android.hardware.biometrics.fingerprint@2.1-service.xiaomi_mido.rc
LOCAL_PROPRIETARY_MODULE := true
LOCAL_MODULE_RELATIVE_PATH := hw
LOCAL_SRC_FILES := \
Expand All @@ -23,7 +23,7 @@ LOCAL_SHARED_LIBRARIES := \
libhardware \
libutils \
libhwbinder \
libkeystore_binder \
libkeystore_aidl \
android.hardware.biometrics.fingerprint@2.1 \

include $(BUILD_EXECUTABLE)
Expand Down
29 changes: 3 additions & 26 deletions biometrics/BiometricsFingerprint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define LOG_TAG "android.hardware.biometrics.fingerprint@2.0-service"
#define LOG_VERBOSE "android.hardware.biometrics.fingerprint@2.0-service"
#define LOG_TAG "android.hardware.biometrics.fingerprint@2.1-service"
#define LOG_VERBOSE "android.hardware.biometrics.fingerprint@2.1-service"

#include <hardware/hw_auth_token.h>
#include <hardware/hardware.h>
Expand Down Expand Up @@ -194,30 +194,8 @@ Return<RequestStatus> BiometricsFingerprint::cancel() {
return ErrorFilter(mDevice->cancel(mDevice));
}

#define MAX_FINGERPRINTS 100

typedef int (*enumerate_2_0)(struct fingerprint_device *dev, fingerprint_finger_id_t *results,
uint32_t *max_size);

Return<RequestStatus> BiometricsFingerprint::enumerate() {
fingerprint_finger_id_t results[MAX_FINGERPRINTS];
uint32_t n = MAX_FINGERPRINTS;
enumerate_2_0 enumerate = (enumerate_2_0) mDevice->enumerate;
int ret = enumerate(mDevice, results, &n);

if (ret == 0 && mClientCallback != nullptr) {
ALOGD("Got %d enumerated templates", n);
for (uint32_t i = 0; i < n; i++) {
const uint64_t devId = reinterpret_cast<uint64_t>(mDevice);
const auto& fp = results[i];
ALOGD("onEnumerate(fid=%d, gid=%d)", fp.fid, fp.gid);
if (!mClientCallback->onEnumerate(devId, fp.fid, fp.gid, n - i - 1).isOk()) {
ALOGE("failed to invoke fingerprint onEnumerate callback");
}
}
}

return ErrorFilter(ret);
return ErrorFilter(mDevice->enumerate(mDevice));
}

Return<RequestStatus> BiometricsFingerprint::remove(uint32_t gid, uint32_t fid) {
Expand Down Expand Up @@ -356,7 +334,6 @@ void BiometricsFingerprint::notify(const fingerprint_msg_t *msg) {
}
break;
case FINGERPRINT_TEMPLATE_ENUMERATING:
// ignored, won't happen for 2.0 HALs
break;
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
service fps_hal /vendor/bin/hw/android.hardware.biometrics.fingerprint@2.0-service.xiaomi_mido
service fps_hal /vendor/bin/hw/android.hardware.biometrics.fingerprint@2.1-service.xiaomi_mido
# "class hal" causes a race condition on some devices due to files created
# in /data. As a workaround, postpone startup until later in boot once
# /data is mounted.
Expand Down
15 changes: 8 additions & 7 deletions biometrics/fingerprintd/FingerprintDaemonProxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
#include <hardware/hardware.h>
#include <hardware/fingerprint.h>
#include <hardware/hw_auth_token.h>
#include <keystore/IKeystoreService.h>
#include <keystore/keystore.h> // for error codes
#include <android/security/IKeystoreService.h>
#include <utils/Log.h>

#include "FingerprintDaemonProxy.h"
Expand Down Expand Up @@ -94,12 +93,14 @@ void FingerprintDaemonProxy::notifyKeystore(const uint8_t *auth_token, const siz
// TODO: cache service?
sp < IServiceManager > sm = defaultServiceManager();
sp < IBinder > binder = sm->getService(String16("android.security.keystore"));
sp < IKeystoreService > service = interface_cast < IKeystoreService > (binder);
sp < security::IKeystoreService > service = interface_cast < security::IKeystoreService > (binder);
if (service != NULL) {
status_t ret = service->addAuthToken(auth_token, auth_token_length);
if (ret != (int)ResponseCode::NO_ERROR) {
ALOGE("Falure sending auth token to KeyStore: %d", ret);
}
int result =0;
std::vector<uint8_t> auth_token_vector(*auth_token, (*auth_token) + auth_token_length);
auto binder_result = service->addAuthToken(auth_token_vector, &result);
if (!binder_result.isOk() || !keystore::KeyStoreServiceReturnCode(result).isOk()) {
ALOGE("Falure sending auth token to KeyStore");
}
} else {
ALOGE("Unable to communicate with KeyStore");
}
Expand Down
2 changes: 0 additions & 2 deletions biometrics/fingerprintd/IFingerprintDaemon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
#include <binder/PermissionCache.h>
#include <utils/String16.h>
#include <utils/Looper.h>
#include <keystore/IKeystoreService.h>
#include <keystore/keystore.h> // for error code
#include <hardware/hardware.h>
#include <hardware/fingerprint.h>
#include <hardware/hw_auth_token.h>
Expand Down
1 change: 0 additions & 1 deletion biometrics/service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#include <binder/PermissionCache.h>
#include <binder/ProcessState.h>
#include <utils/String16.h>
#include <keystore/keystore.h> // for error codes

#include <android/log.h>
#include <hidl/HidlSupport.h>
Expand Down
2 changes: 1 addition & 1 deletion device.mk
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ PRODUCT_COPY_FILES += \

# Fingerprint
PRODUCT_PACKAGES += \
android.hardware.biometrics.fingerprint@2.0-service.xiaomi_mido
android.hardware.biometrics.fingerprint@2.1-service.xiaomi_mido

# Consumerir
PRODUCT_PACKAGES += \
Expand Down

2 comments on commit b41ce8e

@weritos666
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

09-12 02:36:36.069 1018 1173 F libc : Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0 in tid 1173 (HwBinder:1018_1), pid 1018 (fingerprint@2.1)
09-12 02:36:36.102 1736 1736 F DEBUG : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
09-12 02:36:36.102 1736 1736 F DEBUG : Build fingerprint: 'Xiaomi/land/land:6.0.1/MMB29M/V9.5.8.0.MALMIFD:user/release-keys'
09-12 02:36:36.102 1736 1736 F DEBUG : Revision: '0'
09-12 02:36:36.102 1736 1736 F DEBUG : ABI: 'arm64'
09-12 02:36:36.102 1736 1736 F DEBUG : pid: 1018, tid: 1173, name: HwBinder:1018_1 >>> /vendor/bin/hw/android.hardware.biometrics.fingerprint@2.1-service.xiaomi_land <<<
09-12 02:36:36.102 1736 1736 F DEBUG : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0
09-12 02:36:36.102 1736 1736 F DEBUG : Cause: null pointer dereference
09-12 02:36:36.102 1736 1736 F DEBUG : x0 0000000000000005 x1 0000006fe8303804 x2 0000000000000014 x3 0000000000000005
09-12 02:36:36.102 1736 1736 F DEBUG : x4 0000006fe8303818 x5 0000006f65c16054 x6 0000000100000000 x7 0000000300000002
09-12 02:36:36.102 1736 1736 F DEBUG : x8 0000000000000000 x9 0000000000000013 x10 0000000000000001 x11 0000000000000000
09-12 02:36:36.102 1736 1736 F DEBUG : x12 0000000200000001 x13 0000000400000003 x14 0000000000000480 x15 0000006fe8303480
09-12 02:36:36.103 1736 1736 F DEBUG : x16 0000006f66677b68 x17 0000006fe77e1b70 x18 01f8121113f0c121 x19 0000006f65bfed88
09-12 02:36:36.103 1736 1736 F DEBUG : x20 0000006f65bfef90 x21 0000006f66253000 x22 0000006f65bfedc8 x23 0000006f65c16040
09-12 02:36:36.103 1736 1736 F DEBUG : x24 0000000000000000 x25 0000006fe74bc100 x26 0000006f66253198 x27 0000006f662530f8
09-12 02:36:36.103 1736 1736 F DEBUG : x28 0000006fe74bc050 x29 0000006f65bfed20
09-12 02:36:36.103 1736 1736 F DEBUG : sp 0000006f65bfed20 lr 0000006f6665c350 pc 0000006f6665c218
09-12 02:36:36.109 1736 1736 F DEBUG :
09-12 02:36:36.109 1736 1736 F DEBUG : backtrace:
09-12 02:36:36.109 1736 1736 F DEBUG : #00 pc 0000000000005218 /vendor/lib64/hw/fingerprint.default.so
09-12 02:36:36.109 1736 1736 F DEBUG : #1 pc 00000000000087c8 /vendor/bin/hw/android.hardware.biometrics.fingerprint@2.1-service.xiaomi_land (android::hardware::biometrics::fingerprint::V2_1::implementation::BiometricsFingerprint::enumerate()+24)
09-12 02:36:36.109 1736 1736 F DEBUG : #2 pc 0000000000019b68 /system/lib64/android.hardware.biometrics.fingerprint@2.1.so (android::hardware::biometrics::fingerprint::V2_1::BnHwBiometricsFingerprint::_hidl_enumerate(android::hidl::base::V1_0::BnHwBase*, android::hardware::Parcel const&, android::hardware::Parcel*, std::__1::function<void (android::hardware::Parcel&)>)+168)
09-12 02:36:36.109 1736 1736 F DEBUG : #3 pc 000000000001adc0 /system/lib64/android.hardware.biometrics.fingerprint@2.1.so (android::hardware::biometrics::fingerprint::V2_1::BnHwBiometricsFingerprint::onTransact(unsigned int, android::hardware::Parcel const&, android::hardware::Parcel*, unsigned int, std::__1::function<void (android::hardware::Parcel&)>)+1224)
09-12 02:36:36.109 1736 1736 F DEBUG : #4 pc 000000000001d5a0 /system/lib64/vndk-sp-28/libhwbinder.so (android::hardware::IPCThreadState::executeCommand(int)+640)
09-12 02:36:36.109 1736 1736 F DEBUG : #5 pc 00000000000143bc /system/lib64/vndk-sp-28/libhwbinder.so (android::hardware::IPCThreadState::getAndExecuteCommand()+196)
09-12 02:36:36.109 1736 1736 F DEBUG : #6 pc 000000000001463c /system/lib64/vndk-sp-28/libhwbinder.so (android::hardware::IPCThreadState::joinThreadPool(bool)+268)
09-12 02:36:36.109 1736 1736 F DEBUG : #7 pc 000000000001c398 /system/lib64/vndk-sp-28/libhwbinder.so (android::hardware::PoolThread::threadLoop()+24)
09-12 02:36:36.109 1736 1736 F DEBUG : #8 pc 000000000000fb78 /system/lib64/vndk-sp-28/libutils.so (android::Thread::_threadLoop(void*)+280)
09-12 02:36:36.109 1736 1736 F DEBUG : #9 pc 00000000000830c4 /system/lib64/libc.so (__pthread_start(void*)+36)
09-12 02:36:36.109 1736 1736 F DEBUG : #10 pc 00000000000233bc /system/lib64/libc.so (__start_thread+68)
09-12 02:36:36.230 1412 1628 V FingerprintService: fingerprint HAL died

@SwapnilSoni1999
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.