phhusson / treble_experimentations

Notes about tinkering with Android Project Treble
3.38k stars 655 forks source link

Biometric setup crash on v412 #2269

Open faelys opened 2 years ago

faelys commented 2 years ago

Hello,

I have a Unihertz Jelly 2, I'm aware that you don't support this device and I completely understand it, but I'm reporting this because I think it might affect other devices.

The problem is that after flashing system-squeak-arm64-ab-gapps.img and performing a factory reset, the google services setup asks for permissions, then sets up a PIN, then asks for permissions again, then asks for PIN confirmation, then asks for permission again, then asks for PIN confirmation, and so on forever, with sometims a popup saying "settings keeps stopping" and offering to kill it or display details, but that doesn't break the loop.

If I only flash your image on top of the stock ROM, without data reset, I get "android.process.media keeps stopping" like #2222, I didn't expected it to work fine but it confirms there is nothing fundamentally broken in Google services.

Pulling the logs from adb, it seems that the step after the PIN setup, which is fingerprint scanning, crashed because a default text color is missing:

AndroidRuntime: FATAL EXCEPTION: main
AndroidRuntime: Process: com.android.settings, PID: 5542
AndroidRuntime: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=1, result=1, data=Intent { (has extras) }} to activity {com.android.settings/com.android.settings.biometrics.fingerprint.SetupFingerprintEnrollIntroduction}: java.lang.IllegalStateException: There is no saved default color for button
lStateException: There is no saved default color for button
AndroidRuntime:        at android.app.ActivityThread.deliverResults(ActivityThread.java:5368)
AndroidRuntime:        at android.app.ActivityThread.handleSendResult(ActivityThread.java:5407)
AndroidRuntime:        at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:67)
AndroidRuntime:        at android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:45)
AndroidRuntime:        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
AndroidRuntime:        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
AndroidRuntime:        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2253)
AndroidRuntime:        at android.os.Handler.dispatchMessage(Handler.java:106)
AndroidRuntime:        at android.os.Looper.loopOnce(Looper.java:201)
AndroidRuntime:        at android.os.Looper.loop(Looper.java:288)
AndroidRuntime:        at android.app.ActivityThread.main(ActivityThread.java:7870)
AndroidRuntime:        at java.lang.reflect.Method.invoke(Native Method)
AndroidRuntime:        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
AndroidRuntime:        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
AndroidRuntime: Caused by: java.lang.IllegalStateException: There is no saved default color for button
AndroidRuntime:        at com.google.android.setupcompat.template.FooterButtonStyleUtils.getButtonDefaultTextCorlor(FooterButtonStyleUtils.java:423)
AndroidRuntime:        at com.google.android.setupcompat.template.FooterButtonStyleUtils.updateButtonTextDisabledColorWithPartnerConfig(FooterButtonStyleUtils.java:189)
AndroidRuntime:        at com.google.android.setupcompat.template.FooterBarMixin.updateButtonTextColorWithStates(FooterBarMixin.java:749)
AndroidRuntime:        at com.google.android.setupcompat.template.FooterBarMixin.access$200(FooterBarMixin.java:66)
AndroidRuntime:        at com.google.android.setupcompat.template.FooterBarMixin$1.onEnabledChanged(FooterBarMixin.java:110)
AndroidRuntime:        at com.google.android.setupcompat.template.FooterButton.setEnabled(FooterButton.java:143)
AndroidRuntime:        at com.android.settings.biometrics.BiometricEnrollIntroduction.onActivityResult(BiometricEnrollIntroduction.java:315)
AndroidRuntime:        at com.android.settings.biometrics.fingerprint.FingerprintEnrollIntroduction.onActivityResult(FingerprintEnrollIntroduction.java:107)
AndroidRuntime:        at com.android.settings.biometrics.fingerprint.SetupFingerprintEnrollIntroduction.onActivityResult(SetupFingerprintEnrollIntroduction.java:87)
AndroidRuntime:        at android.app.Activity.dispatchActivityResult(Activity.java:8385)
AndroidRuntime:        at android.app.ActivityThread.deliverResults(ActivityThread.java:5361)
AndroidRuntime:        ... 13 more

I can provide the full log if it can help.

I'm not sure you can do anything about it, but being a developer myself (although on very different projects) I would like such things to be reported to me if places were switched.

Because of #2206 I cannot check exactly when the issue appeared, but v400.h allowed be to setup Google services successfully. From there, I flashed v412 on top of it, reset the cache but not user data, and now the phone is usable.

I still cannot setup a fingerprint, with the same exception appearing in adb log, but I'm not interested in biometrics so I don't mind.

phhusson commented 2 years ago

So far, I can't really make sense of it...

It seems to me, that AOSP Settings app request Setup Wizard about color choices, probably related to Monet? But I tried following that code (it's in external/setupcompat) and uh can't make much sense about it. There is a codepath when there is no setup wizard since it works on floss variant, and I'd be happy to use that codepath, but idk how :shrug:

Kethen commented 2 years ago

Same issue on gapps 414, Galaxy S7, even if I try to set up fingerprint in settings after skipping screen lock in setup wizard

meanwhile, it works in other GSIs with gapps: google's own 12L GSI with google service Pixel experience 414 over https://github.com/ponces/treble_build_pe/releases/tag/v414-plus

Since it's crashing in the setupwizard setupcompat service, and removing it allows settings to fall back to it's built in setupcompat library (built from external/setupcompat), a workaround is just to remove setupwizard, then apply the setup finished state with an init

/system/bin/skip_wizard

#!/system/bin/sh
settings put global setup_wizard_has_run 1
settings put secure user_setup_complete 1
settings put global device_provisioned 1

/system/etc/init/skip_wizard.rc

on property:sys.boot_completed=1
    exec_start skip_wizard

service skip_wizard /system/bin/skip_wizard
    disabled
    oneshot  
    user root 
    group root
    seclabel u:r:su:s0

Otherwise perhaps there's another set of gapps that'd work, given pixel experience manges. Gapps is weird :woman_shrugging: