Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App closes if secured with password/biometrics, minimized to background and then reopened #1576

Open
kaerbr opened this issue Dec 20, 2024 · 13 comments
Labels
bug A bug report

Comments

@kaerbr
Copy link

kaerbr commented Dec 20, 2024

Version

3.3.2

Source

Google Play

Vault encryption

Yes (with biometric unlock)

Device

Pixel 9 Pro
The same result on my Pixel 5 with Android 14

Android version

Android 15

ROM

Stock Pixel Android

Steps to reproduce

  1. Install Aegis (Play Store)
  2. Open Aegis
  3. Go through wizard (Set password and / or biometric as protection)
  4. Close app (swipe up / going to homescreen)
  5. Lock device
  6. Open Aegis
  7. Crash

What do you expect to happen?

Step 7 should not be a crash.

What happens instead?

The app crashes in step 7.

Log

If I dont add any security (password / biometrics) the app does not crash in the scenario above
--------- beginning of main
12-20 10:17:36.534  8501  8501 I velopment.aegis: Using CollectorTypeCMC GC.
12-20 10:17:36.536  8501  8501 E velopment.aegis: Not starting debugger since process cannot load the jdwp agent.
12-20 10:17:36.538  8501  8501 D nativeloader: Load libframework-connectivity-tiramisu-jni.so using APEX ns com_android_tethering for caller /apex/com.android.tethering/javalib/framework-connectivity-t.jar: ok
12-20 10:17:36.547  8501  8501 D ApplicationLoaders: Returning zygote-cached class loader: /system_ext/framework/androidx.window.extensions.jar
12-20 10:17:36.547  8501  8501 D ApplicationLoaders: Returning zygote-cached class loader: /system_ext/framework/androidx.window.sidecar.jar
12-20 10:17:36.550  8501  8501 D nativeloader: Configuring clns-7 for other apk /data/app/~~qU1xfe6TTkbk1ZqePaWAhg==/com.beemdevelopment.aegis-55LtqCit8L-bjURXvMit8Q==/base.apk. target_sdk_version=35, uses_libraries=, library_path=/data/app/~~qU1xfe6TTkbk1ZqePaWAhg==/com.beemdevelopment.aegis-55LtqCit8L-bjURXvMit8Q==/lib/arm64:/data/app/~~qU1xfe6TTkbk1ZqePaWAhg==/com.beemdevelopment.aegis-55LtqCit8L-bjURXvMit8Q==/base.apk!/lib/arm64-v8a, permitted_path=/data:/mnt/expand:/data/user/0/com.beemdevelopment.aegis
12-20 10:17:36.551  8501  8501 D CompatChangeReporter: Compat change id reported: 202956589; UID 10361; state: ENABLED
12-20 10:17:36.553  8501  8501 V GraphicsEnvironment: Currently set values for:
12-20 10:17:36.553  8501  8501 V GraphicsEnvironment:   angle_gl_driver_selection_pkgs=[com.android.angle, com.linecorp.b612.android, com.campmobile.snow, com.google.android.apps.tachyon]
12-20 10:17:36.553  8501  8501 V GraphicsEnvironment:   angle_gl_driver_selection_values=[angle, native, native, native]
12-20 10:17:36.553  8501  8501 V GraphicsEnvironment: com.beemdevelopment.aegis is not listed in per-application setting
12-20 10:17:36.553  8501  8501 V GraphicsEnvironment: Neither updatable production driver nor prerelease driver is supported.
12-20 10:17:36.555  8501  8501 D CompatChangeReporter: Compat change id reported: 279646685; UID 10361; state: ENABLED
12-20 10:17:36.564  8501  8516 D vulkan  : searching for layers in '/data/app/~~qU1xfe6TTkbk1ZqePaWAhg==/com.beemdevelopment.aegis-55LtqCit8L-bjURXvMit8Q==/lib/arm64'
12-20 10:17:36.564  8501  8516 D vulkan  : searching for layers in '/data/app/~~qU1xfe6TTkbk1ZqePaWAhg==/com.beemdevelopment.aegis-55LtqCit8L-bjURXvMit8Q==/base.apk!/lib/arm64-v8a'
12-20 10:17:36.566  8501  8501 D AppCompatDelegate: Checking for metadata for AppLocalesMetadataHolderService : Service not found
12-20 10:17:36.576  8501  8501 D CompatChangeReporter: Compat change id reported: 309578419; UID 10361; state: ENABLED
12-20 10:17:36.576  8501  8501 D DesktopModeFlagsUtil: Toggle override initialized to: OVERRIDE_UNSET
12-20 10:17:36.580  8501  8501 D CompatChangeReporter: Compat change id reported: 63938206; UID 10361; state: ENABLED
12-20 10:17:36.591  8501  8501 D CompatChangeReporter: Compat change id reported: 349153669; UID 10361; state: ENABLED
12-20 10:17:36.636  8501  8501 I ImeTracker: com.beemdevelopment.aegis:5ac844e9: onRequestHide at ORIGIN_CLIENT reason HIDE_SOFT_INPUT fromUser false
12-20 10:17:36.636  8501  8501 I ImeTracker: com.beemdevelopment.aegis:5ac844e9: onFailed at PHASE_CLIENT_VIEW_SERVED
12-20 10:17:36.659  8501  8501 D CompatChangeReporter: Compat change id reported: 303326708; UID 10361; state: ENABLED
12-20 10:17:36.660  8501  8501 D AutofillManager: view not autofillable - not passing ime action check
12-20 10:17:37.170  8501  8501 D VRI[MainActivity]: visibilityChanged oldVisibility=true newVisibility=false
12-20 10:17:38.685  8501  8501 I ImeTracker: com.beemdevelopment.aegis:eb6d389e: onRequestHide at ORIGIN_CLIENT reason HIDE_SOFT_INPUT fromUser false
12-20 10:17:41.626  8501  8501 I ImeTracker: com.beemdevelopment.aegis:d1b41a74: onRequestHide at ORIGIN_CLIENT reason HIDE_SOFT_INPUT fromUser false
12-20 10:17:41.628  8501  8501 I ImeTracker: com.beemdevelopment.aegis:48fc7c7f: onRequestHide at ORIGIN_CLIENT reason HIDE_SOFT_INPUT fromUser false
12-20 10:17:42.502  8501  8547 D ProfileInstaller: Installing profile for com.beemdevelopment.aegis
12-20 10:17:43.486  8501  8501 D VRI[IntroActivity]: visibilityChanged oldVisibility=true newVisibility=false
12-20 10:17:43.498  8501  8516 D HWUI    : endAllActiveAnimators on 0xb400006fa84528d0 (RippleDrawable) with handle 0xb400007138477c80
12-20 10:17:43.508  8501  8501 W WindowOnBackDispatcher: sendCancelIfRunning: isInProgress=false callback=androidx.activity.OnBackPressedDispatcher$Api34Impl$createOnBackAnimationCallback$1@f446516
12-20 10:17:43.514  8501  8501 W WindowOnBackDispatcher: sendCancelIfRunning: isInProgress=false callback=android.app.Activity$$ExternalSyntheticLambda0@c24ba31
12-20 10:17:44.223  8501  8501 D VRI[MainActivity]: visibilityChanged oldVisibility=true newVisibility=false
12-20 10:17:44.340  8501  8506 W velopment.aegis: Cleared Reference was only reachable from finalizer (only reported once)
12-20 10:17:53.875  8501  8894 W InteractionJankMonitor: Initializing without READ_DEVICE_CONFIG permission. enabled=false, interval=1, missedFrameThreshold=3, frameTimeThreshold=64, package=com.beemdevelopment.aegis
12-20 10:17:54.932  8501  8501 D VRI[MainActivity]: visibilityChanged oldVisibility=true newVisibility=false
If I add any security (password / biometrics) the app does crash in the scenario above
--------- beginning of main
12-20 10:19:31.254  9553  9553 I velopment.aegis: Using CollectorTypeCMC GC.
12-20 10:19:31.256  9553  9553 E velopment.aegis: Not starting debugger since process cannot load the jdwp agent.
12-20 10:19:31.257  9553  9553 D nativeloader: Load libframework-connectivity-tiramisu-jni.so using APEX ns com_android_tethering for caller /apex/com.android.tethering/javalib/framework-connectivity-t.jar: ok
12-20 10:19:31.270  9553  9553 D ApplicationLoaders: Returning zygote-cached class loader: /system_ext/framework/androidx.window.extensions.jar
12-20 10:19:31.270  9553  9553 D ApplicationLoaders: Returning zygote-cached class loader: /system_ext/framework/androidx.window.sidecar.jar
12-20 10:19:31.273  9553  9553 D nativeloader: Configuring clns-7 for other apk /data/app/~~9i21X_t7N-yFmkvYPDZaRQ==/com.beemdevelopment.aegis-VCmDWW3Ft3i_CM0TU_EaCQ==/base.apk. target_sdk_version=35, uses_libraries=, library_path=/data/app/~~9i21X_t7N-yFmkvYPDZaRQ==/com.beemdevelopment.aegis-VCmDWW3Ft3i_CM0TU_EaCQ==/lib/arm64:/data/app/~~9i21X_t7N-yFmkvYPDZaRQ==/com.beemdevelopment.aegis-VCmDWW3Ft3i_CM0TU_EaCQ==/base.apk!/lib/arm64-v8a, permitted_path=/data:/mnt/expand:/data/user/0/com.beemdevelopment.aegis
12-20 10:19:31.273  9553  9553 D CompatChangeReporter: Compat change id reported: 202956589; UID 10363; state: ENABLED
12-20 10:19:31.275  9553  9553 V GraphicsEnvironment: Currently set values for:
12-20 10:19:31.275  9553  9553 V GraphicsEnvironment:   angle_gl_driver_selection_pkgs=[com.android.angle, com.linecorp.b612.android, com.campmobile.snow, com.google.android.apps.tachyon]
12-20 10:19:31.275  9553  9553 V GraphicsEnvironment:   angle_gl_driver_selection_values=[angle, native, native, native]
12-20 10:19:31.275  9553  9553 V GraphicsEnvironment: com.beemdevelopment.aegis is not listed in per-application setting
12-20 10:19:31.275  9553  9553 V GraphicsEnvironment: Neither updatable production driver nor prerelease driver is supported.
12-20 10:19:31.279  9553  9553 D CompatChangeReporter: Compat change id reported: 279646685; UID 10363; state: ENABLED
12-20 10:19:31.289  9553  9569 D vulkan  : searching for layers in '/data/app/~~9i21X_t7N-yFmkvYPDZaRQ==/com.beemdevelopment.aegis-VCmDWW3Ft3i_CM0TU_EaCQ==/lib/arm64'
12-20 10:19:31.290  9553  9569 D vulkan  : searching for layers in '/data/app/~~9i21X_t7N-yFmkvYPDZaRQ==/com.beemdevelopment.aegis-VCmDWW3Ft3i_CM0TU_EaCQ==/base.apk!/lib/arm64-v8a'
12-20 10:19:31.291  9553  9553 D AppCompatDelegate: Checking for metadata for AppLocalesMetadataHolderService : Service not found
12-20 10:19:31.299  9553  9553 D CompatChangeReporter: Compat change id reported: 309578419; UID 10363; state: ENABLED
12-20 10:19:31.299  9553  9553 D DesktopModeFlagsUtil: Toggle override initialized to: OVERRIDE_UNSET
12-20 10:19:31.303  9553  9553 D CompatChangeReporter: Compat change id reported: 63938206; UID 10363; state: ENABLED
12-20 10:19:31.315  9553  9553 D CompatChangeReporter: Compat change id reported: 349153669; UID 10363; state: ENABLED
12-20 10:19:31.364  9553  9553 I ImeTracker: com.beemdevelopment.aegis:3bd77bb5: onRequestHide at ORIGIN_CLIENT reason HIDE_SOFT_INPUT fromUser false
12-20 10:19:31.365  9553  9553 I ImeTracker: com.beemdevelopment.aegis:3bd77bb5: onFailed at PHASE_CLIENT_VIEW_SERVED
12-20 10:19:31.388  9553  9553 D CompatChangeReporter: Compat change id reported: 303326708; UID 10363; state: ENABLED
12-20 10:19:31.389  9553  9553 D AutofillManager: view not autofillable - not passing ime action check
12-20 10:19:31.900  9553  9553 D VRI[MainActivity]: visibilityChanged oldVisibility=true newVisibility=false
12-20 10:19:37.057  9553  9591 D ProfileInstaller: Installing profile for com.beemdevelopment.aegis
12-20 10:19:38.651  9553  9553 I ImeTracker: com.beemdevelopment.aegis:33bdf201: onRequestHide at ORIGIN_CLIENT reason HIDE_SOFT_INPUT fromUser false
12-20 10:19:40.737  9553  9553 I ImeTracker: com.beemdevelopment.aegis:ac47bad8: onRequestHide at ORIGIN_CLIENT reason HIDE_SOFT_INPUT fromUser false
12-20 10:19:41.570  9553  9553 I ImeTracker: com.beemdevelopment.aegis:46547632: onRequestShow at ORIGIN_CLIENT reason SHOW_SOFT_INPUT fromUser true
12-20 10:19:41.571  9553  9553 D InputMethodManager: showSoftInput() view=com.google.android.material.textfield.TextInputEditText{fa0bfa8 VFED..CL. .F.P..ID 0,0-816,125 #7f0902a8 app:id/text_password aid=1073741828} flags=0 reason=SHOW_SOFT_INPUT
12-20 10:19:41.576  9553  9553 I AssistStructure: Flattened final assist data: 2560 bytes, containing 1 windows, 14 views
12-20 10:19:41.620  9553  9553 D InsetsController: show(ime(), fromIme=true)
12-20 10:19:41.622  9553  9603 W InteractionJankMonitor: Initializing without READ_DEVICE_CONFIG permission. enabled=false, interval=1, missedFrameThreshold=3, frameTimeThreshold=64, package=com.beemdevelopment.aegis
12-20 10:19:41.825  9553  9553 I ImeTracker: com.beemdevelopment.aegis:46547632: onShown
12-20 10:19:42.784  9553  9553 I ImeTracker: com.beemdevelopment.aegis:7a4d10b0: onRequestShow at ORIGIN_CLIENT reason SHOW_SOFT_INPUT fromUser true
12-20 10:19:42.785  9553  9553 D InputMethodManager: showSoftInput() view=com.google.android.material.textfield.TextInputEditText{fa0bfa8 VFED..CL. .F.P..ID 0,0-816,125 #7f0902a8 app:id/text_password aid=1073741828} flags=0 reason=SHOW_SOFT_INPUT
12-20 10:19:42.793  9553  9553 I AssistStructure: Flattened final assist data: 2560 bytes, containing 1 windows, 14 views
12-20 10:19:42.794  9553  9553 D InsetsController: show(ime(), fromIme=true)
12-20 10:19:42.795  9553  9553 I ImeTracker: com.beemdevelopment.aegis:7a4d10b0: onCancelled at PHASE_CLIENT_APPLY_ANIMATION
12-20 10:19:45.280  9553  9553 I AssistStructure: Flattened final assist data: 2568 bytes, containing 1 windows, 14 views
12-20 10:19:50.530  9553  9553 I ImeTracker: com.beemdevelopment.aegis:2f4990b8: onRequestShow at ORIGIN_CLIENT reason SHOW_SOFT_INPUT fromUser true
12-20 10:19:50.530  9553  9553 D InputMethodManager: showSoftInput() view=com.google.android.material.textfield.TextInputEditText{f366b8b VFED..CL. .F.P..ID 0,0-816,125 #7f0902a9 app:id/text_password_confirm aid=1073741829} flags=0 reason=SHOW_SOFT_INPUT
12-20 10:19:50.535  9553  9553 W RemoteInputConnectionImpl: requestCursorUpdates on inactive InputConnection
12-20 10:19:50.539  9553  9553 W WindowOnBackDispatcher: sendCancelIfRunning: isInProgress=false callback=android.view.ImeBackAnimationController@865c266
12-20 10:19:50.563  9553  9553 D InsetsController: show(ime(), fromIme=true)
12-20 10:19:50.564  9553  9553 I ImeTracker: com.beemdevelopment.aegis:84819b06: onCancelled at PHASE_CLIENT_APPLY_ANIMATION
12-20 10:19:50.572  9553  9553 D InsetsController: show(ime(), fromIme=true)
12-20 10:19:50.572  9553  9553 I ImeTracker: com.beemdevelopment.aegis:2f4990b8: onCancelled at PHASE_CLIENT_APPLY_ANIMATION
12-20 10:19:57.989  9553  9553 W WindowOnBackDispatcher: sendCancelIfRunning: isInProgress=false callback=android.app.Dialog$$ExternalSyntheticLambda2@3e1b10c
12-20 10:19:57.995  9553  9553 I ImeTracker: com.beemdevelopment.aegis:d1d7a508: onRequestHide at ORIGIN_CLIENT reason HIDE_SOFT_INPUT fromUser false
12-20 10:19:58.006  9553  9553 D InsetsController: hide(ime(), fromIme=true)
12-20 10:19:58.010  9553  9553 W WindowOnBackDispatcher: sendCancelIfRunning: isInProgress=false callback=android.view.ImeBackAnimationController@865c266
12-20 10:19:58.211  9553  9553 I ImeTracker: com.beemdevelopment.aegis:d2e0cef8: onRequestHide at ORIGIN_CLIENT reason HIDE_SOFT_INPUT_ON_ANIMATION_STATE_CHANGED fromUser false
12-20 10:19:58.212  9553  9553 I ImeTracker: com.beemdevelopment.aegis:d1d7a508: onHidden
12-20 10:19:59.367  9553  9553 D VRI[IntroActivity]: visibilityChanged oldVisibility=true newVisibility=false
12-20 10:19:59.378  9553  9569 D HWUI    : endAllActiveAnimators on 0xb400006fa8454290 (RippleDrawable) with handle 0xb400007138490940
12-20 10:19:59.386  9553  9553 W WindowOnBackDispatcher: sendCancelIfRunning: isInProgress=false callback=androidx.activity.OnBackPressedDispatcher$Api34Impl$createOnBackAnimationCallback$1@f446516
12-20 10:19:59.389  9553  9553 I AutofillManager: onInvisibleForAutofill(): expiringResponse
12-20 10:19:59.390  9553  9553 W WindowOnBackDispatcher: sendCancelIfRunning: isInProgress=false callback=android.app.Activity$$ExternalSyntheticLambda0@c24ba31
12-20 10:20:00.775  9553  9553 W AutofillManager: setSaveUiState(297583506, false) called on existing session 297583506; cancelling it
12-20 10:20:01.575  9553  9553 D VRI[MainActivity]: visibilityChanged oldVisibility=true newVisibility=false
12-20 10:20:01.591  9553  9553 W WindowOnBackDispatcher: sendCancelIfRunning: isInProgress=false callback=androidx.activity.OnBackPressedDispatcher$Api34Impl$createOnBackAnimationCallback$1@cb6bc01
12-20 10:20:07.277  9553  9553 W velopment.aegis: Accessing hidden method Landroid/app/Activity;->finish(I)V (max-target-r, reflection, denied)
12-20 10:20:07.528  9553  9553 D VRI[MainActivity]: visibilityChanged oldVisibility=true newVisibility=false
12-20 10:20:07.552  9553  9553 W WindowOnBackDispatcher: sendCancelIfRunning: isInProgress=false callback=androidx.activity.OnBackPressedDispatcher$Api34Impl$createOnBackAnimationCallback$1@cb6bc01
12-20 10:20:07.576  9553  9553 W WindowOnBackDispatcher: sendCancelIfRunning: isInProgress=false callback=android.app.Activity$$ExternalSyntheticLambda0@2297256
12-20 10:20:07.577  9553  9553 D AutofillManager: view not autofillable - not passing ime action check
@kaerbr kaerbr added the bug A bug report label Dec 20, 2024
@kaerbr kaerbr changed the title App crashes if secured with password/biometrics minimized to background and then reopened App crashes if secured with password/biometrics, minimized to background and then reopened Dec 20, 2024
@alexbakker
Copy link
Member

I'm not able to reproduce this. The log you shared does not indicate a crash. Could you reproduce using the following APK, record the screen while doing so and share the recording here? https://alexbakker.me/u/bxve7fb64i.apk

@kaerbr
Copy link
Author

kaerbr commented Dec 20, 2024

I was irritated, that there was noch obvious crash in the log file too.
I took the exact steps described above. But I did use the provided apk.
https://github.com/user-attachments/assets/b471acd5-70cc-495f-964d-ec4c385f2bbb

This is the log i captured using: .\adb.exe logcat --pid=$(.\adb.exe shell pidof -s com.beemdevelopment.aegis.debug) > debug_custom-app-with-password.log:
debug_custom-app-with-password.log

I even installed android studio and build the app myself, installed it on my pixel 9 via wifi debugging. But still got the same error as shown in the screen capture.

@ParsleighScumble
Copy link

I'm having the same issue on pixel 7 with grapheneos.

@alexbakker alexbakker changed the title App crashes if secured with password/biometrics, minimized to background and then reopened App closes if secured with password/biometrics, minimized to background and then reopened Dec 31, 2024
@alexbakker
Copy link
Member

I'm able to reproduce this by enabling the "Don't keep activities" developer option. I suspect that you have that enabled as well.

Full reproduction steps:

  • Enable "Don't keep activities" in developer options
  • Set up Aegis with an encrypted vault
  • Configure auto lock in Aegis to be enabled when "device is locked" and disabled when "the app is minimized" (i.e. defaults)
  • Unlock Aegis and minimize it
  • Lock the device and unlock it
  • Start Aegis and notice that it closes

The problem appears to be that MainActivity is destroyed before the android.intent.action.SCREEN_OFF intent is received. When Aegis is opened again and MainActivity is restored, that intent is finally received, which triggers a lock of the app.

Please give this debug APK a shot and let me know whether the issue is now gone: https://alexbakker.me/u/ge7r8h7pt5.apk

@kaerbr
Copy link
Author

kaerbr commented Jan 1, 2025

First of all: Thanks for your support! (:
Second: For me personally this bug is not a big deal at all. I can easily work around it by reopening the app.
Another workaround is to enable the option in aegis to lock when minimizing the app.

The developer option "Don't keep activities" was never actived by me on my phone.

Disabled Don't keep activities (default):

Ensabled Don't keep activities:

  • v3.3.2: buggy behaviour
  • ge7r8h7pt5.apk: fixed behaviour. But it locks the app even tho 'lock the app if it's minimized` is not ticked. ( I took a look in your PR which explains this behaviour. (: )

@kaerbr
Copy link
Author

kaerbr commented Jan 2, 2025

I think I found the place where it goes wrong: VaultLockReceiver.java:24

If I'm right this is the function to lock the app when the devices is locked. Unfortunately the code is not trigged, when I lock the device but only when i unlock the device and reopen the app again.

On a virtual "Pixel 9 Pro API 35" inside Android Studio the onreceive method is triggered on locking the device.

Now I'm trying to search why my physical device behaves this way.

It might be something like:

  • Battery optimization
  • Pixel specific things
  • ...

@kaerbr
Copy link
Author

kaerbr commented Jan 3, 2025

I found the "culprit":

I do not use the default Pixel launcher but Olauncher.

Stock Pixel Launcher: the android.intent.action.SCREEN_OFF intent is received right when the device is locked.
Olauncher: the android.intent.action.SCREEN_OFF intent is only received when the device is unlocked again and the app is opened. Therefor the app is locked at this late time which lets the app be closed.

Edit: @ParsleighScumble do you use Olauncher as well?

@kaerbr
Copy link
Author

kaerbr commented Jan 3, 2025

So I guess this issue can be closed without any changes to aegis's code. (:

@alexbakker
Copy link
Member

Thanks for following up, I'm able to reproduce using Olauncher (without "Don't keep activities" enabled). I noticed the same thing as you regarding the delayed android.intent.action.SCREEN_OFF intent (with "Don't keep activities" enabled).

I still think it's worth investigating what Olauncher does differently to cause this, so I'm going to leave this open for now.

@ParsleighScumble
Copy link

I do not use Olauncher afaik, just GrapheneOS' default. It still happens but it's not very severe as the app opens on the second try every time. I'm not running aegis from source, it's v3.3.3.

@alexbakker
Copy link
Member

@ParsleighScumble Do you have "Don't keep activities" enabled in developer options?

@ParsleighScumble
Copy link

It's not enabled.

@ParsleighScumble
Copy link

Also, when I opened the app a couple of times today, it didn't close on launching once.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug report
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants