Android 解决Smart Lock 打不开的问题

在android 5.1的系统,使用Smart Lock时遇到这个问题,特此记下。

12-20 09:30:43.471: D/CameraHal(118): camera_get_camera_info(1307): camera_get_camera_info(1307): camera_0 facing(0), orientation(0)
12-20 09:30:43.473: D/CameraHal(118): camera_get_camera_info(1307): camera_get_camera_info(1307): camera_1 facing(1), orientation(0)
12-20 09:30:43.652: A/libc(18601): Fatal signal 4 (SIGILL), code 1, fault addr 0x48d60604 in tid 18601 (ndroid.facelock)
12-20 09:30:43.754: I/DEBUG(116): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
12-20 09:30:43.755: I/DEBUG(116): Build fingerprint: 'rockchip/rk3188/rk3188:5.1.1/LMY48Y/steven12151059:eng/test-keys'
12-20 09:30:43.755: I/DEBUG(116): Revision: '0'
12-20 09:30:43.755: I/DEBUG(116): ABI: 'arm'
12-20 09:30:43.756: I/DEBUG(116): pid: 18601, tid: 18601, name: ndroid.facelock  >>> com.android.facelock <<<
12-20 09:30:43.756: I/DEBUG(116): signal 4 (SIGILL), code 1 (ILL_ILLOPC), fault addr 0x48d60604
12-20 09:30:43.788: I/DEBUG(116):     r0 00000048  r1 00000003  r2 00000005  r3 424605d8
12-20 09:30:43.788: I/DEBUG(116):     r4 becfd6a4  r5 427275c0  r6 becfd614  r7 42727618
12-20 09:30:43.788: I/DEBUG(116):     r8 becfd610  r9 00000001  sl 00000220  fp 4274f7a0
12-20 09:30:43.788: I/DEBUG(116):     ip 0079c000  sp becfd608  lr 48d605f3  pc 48d60604  cpsr 200f0030
12-20 09:30:43.789: I/DEBUG(116): backtrace:
12-20 09:30:43.789: I/DEBUG(116):     #00 pc 000f0604  /system/lib/libfacelock_jni.so (pittpatt::proto::ExtractionMetaData::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*)+1071)
12-20 09:30:43.789: I/DEBUG(116):     #01 pc 000f0903  /system/lib/libfacelock_jni.so (pittpatt::proto::RecognitionStageMetaData::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*)+270)
12-20 09:30:43.789: I/DEBUG(116):     #02 pc 000f0dab  /system/lib/libfacelock_jni.so (pittpatt::proto::RecognitionModelMetaData::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*)+1102)
12-20 09:30:43.789: I/DEBUG(116):     #03 pc 000f9e3b  /system/lib/libfacelock_jni.so (google::protobuf::MessageLite::ParseFromString(std::string const&)+54)
12-20 09:30:43.789: I/DEBUG(116):     #04 pc 0009aad3  /system/lib/libfacelock_jni.so
12-20 09:30:43.789: I/DEBUG(116):     #05 pc 00099105  /system/lib/libfacelock_jni.so
12-20 09:30:43.789: I/DEBUG(116):     #06 pc 0006d2d1  /system/lib/libfacelock_jni.so
12-20 09:30:43.790: I/DEBUG(116):     #07 pc 000690a1  /system/lib/libfacelock_jni.so
12-20 09:30:43.790: I/DEBUG(116):     #08 pc 0006967f  /system/lib/libfacelock_jni.so
12-20 09:30:43.790: I/DEBUG(116):     #09 pc 0004a84f  /system/lib/libfacelock_jni.so
12-20 09:30:43.790: I/DEBUG(116):     #10 pc 00049051  /system/lib/libfacelock_jni.so (Java_com_android_facelock_FaceLockUtil_initializeJni+1036)
12-20 09:30:43.790: I/DEBUG(116):     #11 pc 0000011d  /data/dalvik-cache/arm/system@app@FaceLock.apk@classes.dex
12-20 09:30:44.449: I/DEBUG(116): Tombstone written to: /data/tombstones/tombstone_08
12-20 09:30:44.451: W/ActivityManager(395):   Force finishing activity 1 com.android.facelock/.SetupFaceLock
12-20 09:30:44.455: I/BootReceiver(395): Copying /data/tombstones/tombstone_08 to DropBox (SYSTEM_TOMBSTONE)
12-20 09:30:44.464: I/Zygote(124): Process 18601 exited due to signal (4)

bug重现步骤:
设置->安全->Smart Lock->可信面孔->设置->下一步
就会报上面的错误。由于Smart Lock是用调用的FaceLock.apk,FaceLock又会调用libfacelock_jni.so和libfilterpack_facedetect.so,在调用libfacelock_jni.so时就出错了,从上面的log可以得到基本的信息。对于这种没有源码的bug的真是一时无从下手,尝试过反编译apk和so,都没有找到好的解决办法,无意中找到了这个github.com/cgapps/vendor_google地址,它提供了arm、arm64和x86架构下的Google Apps,将其中的arm(因为公司的系统是arm)架构下的FaceLock.apk和libfacelock_jni.so替换掉系统中的相应文件即可,它们放在系统源码的vendor目录下,具体就不多说了。特此记下解决这个bug的方法,以及相关的网址。
这里还有一点要补充的是Tombstone,这个东西好像可以分析出出错问题点,但由于这个bug没有源码就没有深入下去了,有时间就研究研究Tombstone。

https://github.com/cgapps/vendor_google
https://github.com/opengapps/opengapps

你可能感兴趣的:(android之路)