android - BiometricPrompt 后,应用程序间歇性关闭
问题描述
Biometric Prompt 类用于实现生物特征识别。
问题是间歇性的,当生物识别后屏幕切换时,应用程序会关闭。
问题是,没有留下崩溃日志。
出现此问题时,如何调试?
大多数情况下,首次安装应用程序时会经常出现错误。
@RequiresApi(Build.VERSION_CODES.P)
class BioMetricAuthentication (val context:Context, val authenticationListener: BioMetric.AuthenticationListener)
: BioMetric.Authentication, BiometricPrompt.AuthenticationCallback(), CancellationSignal.OnCancelListener {
var biometricPrompt:BiometricPrompt? = null
var cancellationSignal:CancellationSignal? = null
init {
biometricPrompt = BiometricPrompt.Builder(context)
.setDescription( context.getString(R.string.biometric_description) )
.setTitle( context.getString(R.string.biometric_title) )
.setSubtitle( context.getString(R.string.biometric_sub_title) )
.setNegativeButton(context.getString(R.string.dialog_button_cancel), context.mainExecutor, DialogInterface.OnClickListener { _, _ ->
authenticationListener.onFailed()
}).build()
}
override fun start() {
try {
// var KeyPairGenerator = createkey(RULE.AUTH_KEY_ALIAS, true)
// var signature = Signature.getInstance("SHA256withECDSA")
// signature.initSign(KeyPairGenerator!!.generateKeyPair().private)
//if (isAvailable() && signature != null) {
if (isAvailable()) {
cancellationSignal = CancellationSignal()
cancellationSignal!!.setOnCancelListener(this)
/*biometricPrompt!!.authenticate(
BiometricPrompt.CryptoObject(signature),
cancellationSignal!!,
context.mainExecutor,
this
)
*/
biometricPrompt!!.authenticate(
cancellationSignal!!,
context.mainExecutor,
this
)
} else {
authenticationListener.onFailed()
}
} catch (e: java.lang.Exception) {
CompassDialog.Build(context)
.message(e.message.toString())
.positiveButton(R.string.dialog_button_confirm) {
// TODO
}.show()
}
}
override fun onAuthenticationError(errorCode: Int, errString: CharSequence?) {
super.onAuthenticationError(errorCode, errString)
authenticationListener.onFailed()
}
override fun onAuthenticationSucceeded(result: BiometricPrompt.AuthenticationResult?) {
super.onAuthenticationSucceeded(result)
authenticationListener.onSuccessed()
}
override fun onAuthenticationFailed() {
super.onAuthenticationFailed()
authenticationListener.onFailed()
}
override fun onCancel() {
authenticationListener.onCancel()
}
override fun stop() {
cancellationSignal?.cancel()
cancellationSignal = null
}
override fun isAvailable(): Boolean {
var pm = context.packageManager
var fingerprintManager = context.getSystemService(FINGERPRINT_SERVICE) as FingerprintManager
val keyguardManager = context.getSystemService(KEYGUARD_SERVICE) as KeyguardManager
if( !pm.hasSystemFeature(PackageManager.FEATURE_FINGERPRINT)
&& !pm.hasSystemFeature(PackageManager.FEATURE_IRIS)
&& !pm.hasSystemFeature(PackageManager.FEATURE_FACE)) {
return false
}
if (!fingerprintManager.isHardwareDetected())
{
// Device doesn't support fingerprint authentication
return false;
}
if (ActivityCompat.checkSelfPermission(context, Manifest.permission.USE_FINGERPRINT) != PackageManager.PERMISSION_GRANTED)
{
return false;
}
if (!keyguardManager.isKeyguardSecure())
{
return false;
}
if (!fingerprintManager.hasEnrolledFingerprints())
{
return false;
}
return true
}
}
...
2021-07-26 12:05:49.890 1139-2071/? I/ActivityTaskManager:从堆栈调用者=com.android.server.wm.ActivityRecord.destroyed:3508 com.android.server 中删除活动 ActivityRecord{9ebc42c u0 com.example.biotest/.view.DuplicateActivity t160 f}}(activityDestroyed)。 wm.ActivityTaskManagerService.activityDestroyed:2610 android.app.IActivityTaskManager$Stub.onTransact:2210 android.os.Binder.execTransactInternal:1195 android.os.Binder.execTransact:1159
2021-07-26 12:05:49.890 1035-1035/? I/Layer: id=2448[1] 销毁 2044d7f com.example.biotest/com.example.biotest.view.DuplicateActivity#0
2021-07-26 12:05:49.890 1035-1035/? I/Layer: id=2449[1] 销毁 com.example.biotest/com.example.biotest.view.DuplicateActivity$_29617#0
2021-07-26 12:05:49.890 1139-2071/? D/SurfaceControl:发布:Surface(name=ActivityRecord{9ebc42c u0 com.example.biotest/.view.DuplicateActivity t160})/@0x56a048a
2021-07-26 12:05:49.890 1139-2071/? I/SurfaceControl:nativeRelease nativeObject s[-5476376661136455072]
2021-07-26 12:05:49.890 1139-2071/? I/SurfaceControl:nativeRelease nativeObject e[-5476376661136455072]
2021-07-26 12:05:49.890 1139-2071/? D/SurfaceControl:发布:Surface(name=Task=160)/@0x60a0815
2021-07-26 12:05:49.890 1139-2071/? I/SurfaceControl:nativeRelease nativeObject s[-5476376661136978496]
2021-07-26 12:05:49.890 1139-2071/? I/SurfaceControl:nativeRelease nativeObject e[-5476376661136978496]
2021-07-26 12:05:49.891 1035-1083/? I/层:id=2373 removeFromCurrentState Task=160#0 (70)
2021-07-26 12:05:49.892 1035-1083/? I/层:id=2437 removeFromCurrentState ActivityRecord{9ebc42c u0 com.example.biotest/.view.DuplicateActivity t160}#0 (70)
2021-07-26 12:05:49.892 1035-1083/? I/层:id=2437 removeFromCurrentState ActivityRecord{9ebc42c u0 com.example.biotest/.view.DuplicateActivity t160}#0 (70)
2021-07-26 12:05:49.892 25019-25019/? I/BSS_SysUiManager:handleMessage = 9、2、160
2021-07-26 12:05:49.892 25019-25019/? I/BSS_SysUiManager:handleMessage = 9、2、160
2021-07-26 12:05:49.892 1035-1083/? I/SurfaceFlinger:id=2373 已删除任务=160#0 (70)
2021-07-26 12:05:49.893 1035-1083/? I/SurfaceFlinger:id=2437 已删除 ActivityRecord{9ebc42c u0 com.example.biotest/.view.DuplicateActivity t160}#0 (70)
2021-07-26 12:05:49.893 1139-1464/? D/SurfaceControl: hide : Surface(name=Input Consumer recents_animation_input_consumer)/@0xd7ddcde
2021-07-26 12:05:49.893 1139-1464/? D/SurfaceControl: nativeSetFlags Done : Surface(name=Input Consumer recents_animation_input_consumer)/@0xd7ddcde
2021-07-26 12:05:49.896 1139-1506/? D/SensorManager: TYPE_LIGHT (5): 237.000000
2021-07-26 12:05:49.907 1139-2203/? I/Pageboost:启动器向上翻页
2021-07-26 12:05:49.907 1035-1035/? I/Layer: id=2373[1] 销毁的任务=160#0
2021-07-26 12:05:49.907 1035-1035/? I/Layer: id=2437[1] 销毁的 ActivityRecord{9ebc42c u0 com.example.biotest/.view.DuplicateActivity t160}#0
2021-07-26 12:05:49.909 1139-2203/? I/Pageboost: IO Prefetch for : com.hyundaipay.blocktour
2021-07-26 12:05:49.909 1139-2203/? I/Pageboost:IO 预取:kr.co.busanbank.digitalvoucher
2021-07-26 12:05:49.909 1139-2203/? I/Pageboost:IO 预取:com.kt.KtplayMobileApp
2021-07-26 12:05:49.910 3340-31307/? E/pageboostd:预取开始:app krcobusanbankdigitalvoucher
2021-07-26 12:05:49.911 676-676/? I/io_stats: !@ 8,0 r 133318 7581180 w 45847 1950380 d 30056 1756596 f 26323 33617 iot 57208 52674 th 102400 0 0 pt 0 inp 0 0 2266.798
2021-07-26 12:05:49.915 3340-3340/? E/pageboostd: 收到 Reclaim 命令码 3, 0MB
2021-07-26 12:05:49.923 820-820/? E/审计:类型=1400审计(1627268749.918:3347):avc:拒绝{搜索}为pid=3340 comm="pageboostd" name="com.google.android.gms" dev="sda37" ino=5971 scontext= u:r:pageboostd:s0 tcontext=u:object_r:privapp_data_file:s0:c512,c768 tclass=dir permissive=0 SEPF_SM-G988N_11_0007 audit_filtered
2021-07-26 12:05:49.923 820-820/? E/审计:类型=1300 审计(1627268749.918:3347):arch=c00000b7 系统调用=56 成功=没有退出=-13 a0=ffffff9c a1=b4000074e4663a50 a2=0 a3=0 items=0 ppid=1 pid=3340 auid= 4294967295 uid=1000 gid=1000 euid=1000 suid=1000 fsuid=1000 egid=1000 sgid=1000 fsgid=1000 tty=(无) ses=4294967295 comm="pageboostd" exe="/system/bin/pageboostd" subj= u:r:pageboostd:s0 key=(null)
2021-07-26 12:05:49.923 820-820/? E/审计:type=1327审计(1627268749.918:3347):proctitle="/system/bin/pageboostd"
2021-07-26 12:05:49.925 3340-31307/? E/pageboostd:krcobusanbankdigitalvoucher,amt 52797440 scnt 41 fcnt 18
2021-07-26 12:05:49.925 3340-31307/? E/pageboostd:预取结束:app krcobusanbankdigitalvoucher data_amount 52797440
2021-07-26 12:05:49.925 3340-31306/? E/pageboostd: prefetch start : app comhyundaipayblocktour
2021-07-26 12:05:49.926 820-820/? E/audit: type=1400 audit(1627268749.922:3348):avc: denied { search } for pid=3340 comm="pageboostd" name="com.google.android.gms" dev="sda37" ino=2385 scontext= u:r:pageboostd:s0 tcontext=u:object_r:privapp_data_file:s0:c512,c768 tclass=dir permissive=0 SEPF_SM-G988N_11_0007 audit_filtered
2021-07-26 12:05:49.928 3340-31306/? E/pageboostd: comhyundaipayblocktour, amt 43257856 scnt 4 fcnt 12
2021-07-26 12:05:49.928 3340-31306/? E/pageboostd: prefetch end : app comhyundaipayblocktour data_amount 43257856
2021-07-26 12:05:49.928 3340-31308/? E/pageboostd:预取开始:app comktKtplayMobileApp
2021-07-26 12:05:49.932 3340-31308/? E/pageboostd:comktKtplayMobileApp,amt 60510208 scnt 22 fcnt 23
2021-07-26 12:05:49.932 3340-31308/? E/pageboostd: prefetch end : app comktKtplayMobileApp data_amount 60510208
2021-07-26 12:05:49.980 1139-2120/? D/MdnieScenarioControlService: packageName : com.sec.android.app.launcher className : com.android.launcher3.uioverrides.QuickstepLauncher
2021-07-26 12:05:49.980 1139-2120/? V/MdnieScenarioControlService:从 UI 函数中设置 UIMode(3)
2021-07-26 12:05:50.086 1259-31288/? I/bauth_TLC_Communicator:检查Trustlet返回码是否完成
2021-07-26 12:05:50.086 1259-31288/? I/bauth_FPBAuthService: FPBAuthService, 6318
2021-07-26 12:05:50.086 1259-31288/? I/bauth_FPBAuthService: check_opcode status = 2, opcode = 0, func_ret_val = 0, function_status = 2, timeout = 0
2021-07-26 12:05:50.086 1259-31288/? I/bauth_FPBAuthService: FPBAuthService, 6393
2021-07-26 12:05:50.086 1259-31288/? I/bauth_FPBAuthService: fpop: 100023
2021-07-26 12:05:50.086 1259-31288/? I/bauth_TLC_Communicator:调用 FP cmd 0xc (76)
2021-07-26 12:05:50.087 1139-1883/? I/FingerprintService:handleAcquired:acquiredInfo=6,vendor=10004
2021-07-26 12:05:50.087 1259-31288/? I/bauth_TLC_Communicator:检查输入数据参数 buf addr = 0x0 ,长度 = 0
2021-07-26 12:05:50.088 1259-1997/? I/bauth_FPBAuthService: pcf : 0x1012, 2 ,1 ,0 ,0 ,0 ,0, 5.1.0.1
2021-07-26 12:05:50.088 1259-1997/? I/bauth_FPBAuthService:线程 id:1,preenroll_flag:0,nd cnt:0,cso:0,et:0
2021-07-26 12:05:50.088 1259-1997/? I/bauth_FPBAuthService: FPBAuthService, 11519
2021-07-26 12:05:50.094 1259-31288/? I/bauth_TLC_Communicator:检查Trustlet返回码是否完成
2021-07-26 12:05:50.094 1259-31288/? I/bauth_FPBAuthService: adlg: [s] 16 320 07-26-12-05-50-086
(我
2021-07-26 12:05:50.094 1259-31288/? I/bauth_FPBAuthService:adlg:[000] 28 05 49 00 ed 69 d0 30
2021-07-26 12:05:50.094 1259-31288/? I/bauth_FPBAuthService: adlg: [001] 1d 3d 10 07 00 00 10 17
2021-07-26 12:05:50.094 1259-31288/? I/bauth_FPBAuthService:adlg:[002] 59 59 41 00 1d 23 26 1c
2021-07-26 12:05:50.094 1259-31288/? I/bauth_FPBAuthService: adlg: [003] 13 1a 16 20 11 0c 0d 00
2021-07-26 12:05:50.094 1259-31288/? I/bauth_FPBAuthService: adlg: [004] 00 00 00 00 00 96 00 74
2021-07-26 12:05:50.094 1259-31288/? I/bauth_FPBAuthService: adlg: [005] 84 00 00 00 00 00 00 00
2021-07-26 12:05:50.094 1259-31288/? I/bauth_FPBAuthService: adlg: [006] 00 00 01 20 00 00 00 00
2021-07-26 12:05:50.094 1259-31288/? I/bauth_FPBAuthService: adlg: [007] 01 00 00 00 00 00 00 00
2021-07-26 12:05:50.094 1259-31288/? I/bauth_FPBAuthService: adlg: [008] 00 00 00 00 00 00 00 00
2021-07-26 12:05:50.094 1259-31288/? I/bauth_FPBAuthService: adlg: [009] 00 28 07 45 00 ef 69 d0
2021-07-26 12:05:50.094 1259-31288/? I/bauth_FPBAuthService:adlg:[010] 30 27 33 00 07 00 00 01
2021-07-26 12:05:50.094 1259-31288/? I/bauth_FPBAuthService: adlg: [011] 00 01 00 71 01 90 0e fc
2021-07-26 12:05:50.094 1259-31288/? I/bauth_FPBAuthService: adlg: [012] 08 00 00 00 00 04 4e 0e
2021-07-26 12:05:50.094 1259-31288/? I/bauth_FPBAuthService: adlg: [013] 4c 01 00 00 00 00 00 00
2021-07-26 12:05:50.094 1259-31288/? I/bauth_FPBAuthService: adlg: [014] 00 00 00 00 00 00 00 00
2021-07-26 12:05:50.094 1259-31288/? I/bauth_FPBAuthService: adlg: [015] 00 00 00 00 00 00 00 00
2021-07-26 12:05:50.094 1259-31288/? I/bauth_FPBAuthService: adlg: [016] 00 00 00 00 00 00 00 00
2021-07-26 12:05:50.094 1259-31288/? I/bauth_FPBAuthService: adlg: [017] 00 00 00 00 00 00 28 04
2021-07-26 12:05:50.094 1259-31288/? I/bauth_FPBAuthService: adlg: [018] 1c 00 ef 69 d0 30 27 32
2021-07-26 12:05:50.094 1259-31288/? I/bauth_FPBAuthService: adlg: [019] 00 07 00 00 01 00 11 01
2021-07-26 12:05:50.094 1259-31288/? I/bauth_FPBAuthService: adlg: [020] 00 00 00 00 00 00 00 00
2021-07-26 12:05:50.094 1259-31288/? I/bauth_FPBAuthService:adlg:[021] 00 00 28 0b 18 00 ef 69
2021-07-26 12:05:50.094 1259-31288/? I/bauth_FPBAuthService: adlg: [022] d0 30 27 32 00 07 00 00
2021-07-26 12:05:50.094 1259-31288/? I/bauth_FPBAuthService: adlg: [023] 27 43 b1 f0 11 00 00 00
2021-07-26 12:05:50.094 1259-31288/? I/bauth_FPBAuthService:adlg:[024] 9c 00 28 08 35 00 f1 69
2021-07-26 12:05:50.094 1259-31288/? I/bauth_FPBAuthService:adlg:[025] d0 30 33 2b 17 07 00 00
2021-07-26 12:05:50.094 1259-31288/? I/bauth_FPBAuthService: adlg: [026] 00 00 00 00 00 fc 1c 23
2021-07-26 12:05:50.094 1259-31288/? I/bauth_FPBAuthService:adlg:[027] 26 1c 13 1a 16 20 11 13
2021-07-26 12:05:50.094 1259-31288/? I/bauth_FPBAuthService: adlg: [028] 00 00 00 00 00 00 00 74
2021-07-26 12:05:50.094 1259-31288/? I/bauth_FPBAuthService:adlg:[029] 86 00 27 04 63 17 00 53
2021-07-26 12:05:50.094 1259-31288/? I/bauth_FPBAuthService:adlg:[030] 04 00 7e 03 00 00 00 28
2021-07-26 12:05:50.094 1259-31288/? I/bauth_FPBAuthService:adlg:[031] 08 35 00 f4 69 d0 30 32
2021-07-26 12:05:50.094 1259-31288/? I/bauth_FPBAuthService: adlg: [032] 2c 17 07 00 00 00 00 00
2021-07-26 12:05:50.094 1259-31288/? I/bauth_FPBAuthService: adlg: [033] 00 00 fb 1d 23 26 1c 13
2021-07-26 12:05:50.094 1259-31288/? I/bauth_FPBAuthService:adlg:[034] 1a 16 20 11 13 00 00 00
2021-07-26 12:05:50.094 1259-31288/? I/bauth_FPBAuthService:adlg:[035] 00 00 00 00 71 8e 00 27
2021-07-26 12:05:50.094 1259-31288/? I/bauth_FPBAuthService:adlg:[036] 04 63 18 00 4b 04 00 4d
2021-07-26 12:05:50.094 1259-31288/? I/bauth_FPBAuthService: adlg: [037] 03 00 00 00 00 00 00 00
2021-07-26 12:05:50.094 1259-31288/? I/bauth_FPBAuthService:adlg:[e] 16 320
2021-07-26 12:05:50.100 1259-31288/? I/bauth_FPBAuthService: [16] 完成 l:320 r:0
2021-07-26 12:05:50.100 1259-31288/? I/bauth_FPQCBAuthSensorControl:FPQCBAuthSensorControl,513
2021-07-26 12:05:50.100 1259-31288/? I/bauth_FPQCBAuthSensorControl:FPQCBAuthSensorControl,400
2021-07-26 12:05:50.100 1259-31288/? I/bauth_FPBAuthService: FPBAuthService, 2261
2021-07-26 12:05:50.100 1259-31288/? I/bauth_FPBAuthService: acsf 0
2021-07-26 12:05:50.100 1259-31288/? I/bauth_FPQCBAuthSensorControl:FPQCBAuthSensorControl,205
2021-07-26 12:05:50.100 1259-31288/? I/qfp-vendorlib: QFPControl_DeviceSpiCtrl 0
2021-07-26 12:05:50.100 1259-31288/? I/bauth_FPQCBAuthSensorControl: scc 0
2021-07-26 12:05:50.100 1259-31288/? I/bauth_FPBAuthService:ncmi:G98X,ncpf:0
2021-07-26 12:05:50.100 1259-31288/? I/bauth_Worker:工人,79
2021-07-26 12:05:50.137 1139-1506/? D/SensorManager:TYPE_LIGHT(5):234.000000
2021-07-26 12:05:50.214 934-31295/? I/HYPER-HAL:[ResourceManager.cpp]removeResource():[CPUMinFreq] RemoveResource 请求 ID:686238
2021-07-26 12:05:50.214 934-31295/? I/HYPER-HAL:[RequestManager.cpp]releaseLocked():已发布 ID:686238
2021-07-26 12:05:50.379 1139-1506/? D/SensorManager: TYPE_LIGHT (5): 233.000000
2021-07-26 12:05:50.475 1139-8261/? D/SemGameManager:getGMSBinder(),开始
2021-07-26 12:05:50.476 934-31299/? I/HYPER-HAL:[RequestManager.cpp]releaseLocked():已发布 ID:2072630
2021-07-26 12:05:50.476 1139-8261/? D/SemGameManager:getGMSBinder(),成功:true
2021-07-26 12:05:50.476 1139-8261/? D/GameManagerService:识别GamePackage。com.sec.android.app.launcher,mCurrentUserId:0,callerUserId:0
2021-07-26 12:05:50.477 1139-8261/? D/PkgDataHelper:getGamePkgData()。com.sec.android.app.launcher
2021-07-26 12:05:50.619 1139-1506/? D/SensorManager: TYPE_LIGHT (5): 237.000000
2021-07-26 12:05:50.858 931-4553/? I/sensors-hal: handle_sns_std_sensor_event:242, [SSC_LIGHT] P: 243(243),m:1,c:11,b:123,ch:0,r:0,bl:0,16:243
2021-07-26 12:05:50.859 1139-1506/? D/SensorManager:TYPE_LIGHT (5):243.000000
2021-07-26 12:05:51.039 934-31305/? I/HYPER-HAL:[RequestManager.cpp]releaseLocked():已发布 ID:11909652
2021-07-26 12:05:51.089 1259-1997/? I/bauth_FPBAuthService: pcf : 0x1011, 0 ,3 ,0 ,0 ,0 ,0, 5.1.0.1
2021-07-26 12:05:51.089 1259-1997/? I/bauth_FPBAuthService: qskcu
2021-07-26 12:05:51.089 1259-1997/? I/bauth_service: BAuthService, 96
解决方案
推荐阅读
- pandas - Pandas 上的分组过滤器
- outlook - 使用nodemailer和office365认证失败
- r - .N 在 data.table 中的条件
- react-native - 如何在本机反应中同时水平和垂直两个方向滚动?
- entity-framework-core - 实体框架核心 IEntityTypeConfiguration 类是否具有 HasPrecision() 功能?
- bash - 如何在bash中的字符串后面回显一个变量?
- python - 为什么 Abaqus python 脚本没有从元素集中打印正确的最大应力?
- excel - 使用 PowerShell 修剪 Excel 单元格
- java - Java 字符串转日期格式
- ios - 如何在 Swift 中不断更新 ULabel 的文本