plaid / plaid-link-android

Plaid Link Android SDK
https://plaid.com/docs/link/android
MIT License
114 stars 48 forks source link

[v3.9.0+] Task stack misbehaving when launched from launcher icon #239

Closed btrautmann closed 10 months ago

btrautmann commented 1 year ago

The problem

After upgrading the Plaid SDK on Android from < 3.9.0 to 3.10.1 we came across a bug where returning to an already-started app process using the app icon on the home launcher would cause a blank screen to occur. Because the blank screen is owned by an Activity that our app controls, I suspected it was our problem but in reverting the downgrade (without changing app host code), the issue goes away. The issue begins in version 3.9.0 of the SDK and is non-existent on version 3.8.0). See videos below.

Note: I do not believe the bug will manifest the same way in every application. I think the fact that we are showing a blank screen is likely specific to our application and our Flutter embedding, but the fact that our Activity is being presented rather than the Plaid SDK is the actual issue.

Environment

Android OS Version Android 12 (32)
Android Devices/Emulators Pixel 4XL emulator

Steps to Reproduce

  1. From an Activity owned by the host application (ours uses launchMode:singleTop but I've also found the bug to occur using standard), launch Plaid.
  2. Background the application
  3. Foreground the application using the app icon (note: foregrounding via Recents does not reproduce the bug)
  4. Activity from host application rather than SDK is shown (see note on manifestation above, this may be different depending on host application implementation)

Expected Result

See videos below.

Screenshots

Version 3.8.0 (expected)

https://user-images.githubusercontent.com/8343465/218859150-518d1c6c-0a91-41f3-80a6-76afbdfe2839.mov

Version 3.9.0 (bug)

https://user-images.githubusercontent.com/8343465/218859189-61217d9e-99a6-446f-b3eb-086df9fad196.mov

Logs

The following logs are output on version 3.9.0 when the following is done:

  1. App launches to launcher Activity
  2. App starts Plaid which leads to new process being started πŸ‘€
  3. App is backgrounded and foregrounded via app icon, leading to onCreate of host Activity being called
---------------------------- PROCESS STARTED (23305) for package com.betterment ----------------------------
2023-02-14 03:16:38.009 23305-23305 FlutterActivity com.betterment                       D  onCreate
---------------------------- PROCESS STARTED (23637) for package com.betterment ----------------------------
2023-02-14 03:16:59.143 23305-23305 FlutterActivity com.betterment                       D onCreate

Notes:

Code To Reproduce Issue

We're launching Plaid using the following code:

val linkTokenConfiguration = linkTokenConfiguration {
  token = linkToken
}

activity?.let {
  val plaidHandler: PlaidHandler = Plaid.create(it.application, linkTokenConfiguration)
  plaidHandler.open(it)
}
btrautmann commented 1 year ago

πŸ‘‹ any update on this? Thanks!

btrautmann commented 10 months ago

I believe this was fixed without ever being ack'd. We updated to 3.13.2 at some point down the road and no longer have this issue.