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

Unable to log in via Custom Tab on debug build variants #702

Open
mileskrell opened this issue May 18, 2024 · 0 comments
Open

Unable to log in via Custom Tab on debug build variants #702

mileskrell opened this issue May 18, 2024 · 0 comments

Comments

@mileskrell
Copy link
Contributor

mileskrell commented May 18, 2024

Describe the bug
When I try to log in on a debug build variant via a Custom Tab, I get a NullPointerException that causes login to fail.

The NPE happens in LoginActivityIntent.getLoginMode because intent.getSerializableExtra(EXTRA_LOGIN_MODE) returns null and this value is then asserted to be not null.

I've narrowed it down to the following ProGuard rule:

-assumenosideeffects class kotlin.jvm.internal.Intrinsics {
    static void checkNotNull(java.lang.Object);
    # ...
}

When that rule is absent (e.g. in debug build variants), login doesn't work, but when that rule is present (e.g. in release build variants), then LoginActivityIntent.getLoginMode somehow just returns null and login via a Custom Tab works fine. Seems like the ProGuard rule is hiding the issue.

We could make the non-ProGuard behavior explicit by changing the implementation to

fun getLoginMode(intent: Intent) = intent.getSerializableExtra(EXTRA_LOGIN_MODE) as? LoginMode

But I'm not familiar with the intent of the code that calls this function; maybe there's a mistake somewhere else that we should fix instead so that EXTRA_LOGIN_MODE will always be present.

Screenshots or video
The following is what I experience when I install and try to log in with the blueFdroidDebug build variant, built from the v2.5.1 source (i.e. commit c6d6f0f).

login.issue.mp4

Versions
Pachli 2.5.1
Android 14
Server: 4.3.0-alpha.3+glitch

Additional context
Stack trace:

 E  FATAL EXCEPTION: main
    Process: app.pachli, PID: 17131
    java.lang.RuntimeException: Unable to start activity ComponentInfo{app.pachli/app.pachli.feature.login.LoginActivity}: java.lang.NullPointerException
    	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3946)
    	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4126)
    	at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:108)
    	at android.app.servertransaction.TransactionExecutor.executeNonLifecycleItem(TransactionExecutor.java:195)
    	at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:157)
    	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:90)
    	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2544)
    	at android.os.Handler.dispatchMessage(Handler.java:107)
    	at android.os.Looper.loopOnce(Looper.java:232)
    	at android.os.Looper.loop(Looper.java:317)
    	at android.app.ActivityThread.main(ActivityThread.java:8501)
    	at java.lang.reflect.Method.invoke(Native Method)
    	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
    	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:878)
    Caused by: java.lang.NullPointerException
    	at app.pachli.core.navigation.LoginActivityIntent$Companion.getLoginMode(Navigation.kt:239)
    	at app.pachli.feature.login.LoginActivity.isAccountMigration(LoginActivity.kt:352)
    	at app.pachli.feature.login.LoginActivity.onCreate(LoginActivity.kt:98)
    	at android.app.Activity.performCreate(Activity.java:8767)
    	...

Affirmation
I have checked other issues for this project (open and closed) and I cannot find one that matches the problem I am reporting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Todo
Development

No branches or pull requests

1 participant