orbot icon indicating copy to clipboard operation
orbot copied to clipboard

[BUG] Authentication Lock Stuck in Loop on Nougat (API 24)

Open bitmold opened this issue 6 months ago • 1 comments

The new Authentication Lock feature enters a loop on my emulated API 24 device. This is because the prompt to enter authentication is in onStart() and on that device OrbotActivity is restarted after the password enter screen is closed after successfully entering your password.

AFTER the activity is restarted the callback saying that the password was correctly entered is called, but this occurs after re-prompting the user for their passoword.

Not seeing this on my API 34 and 35 devices, and currently finding a way to refactor the code so that this flow plays nice on all of these devices.

bitmold avatar Jun 16 '25 21:06 bitmold

Image

The issue specifically lies in how within OrbotApp we have a lifecycle observer set a flag to prompt the password when the process is stopped. The idea behind this was to catch cases where:

  • You open orbot, enter your password
  • You close the app and return to the launcher, or otherwise switch apps
  • You return to Orbot and need to re-authenticate

Seemingly on Nougat this feature stops the process and switches to a System one resetting this flag and creating the infinite loop. On newer systems this never fires off when users are prompted to authenticate

  ProcessLifecycleOwner.get().lifecycle.addObserver(object : DefaultLifecycleObserver {
            override fun onStop(owner: LifecycleOwner) {
                super.onStop(owner)
                shouldRequestPasswordReset = true
            }
        })

bitmold avatar Jun 16 '25 22:06 bitmold