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

[Bug] Incorrect CurrentActivity value after activities are destroyed and restored by the system #2075

Open
sleushunou opened this issue Feb 13, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@sleushunou
Copy link

sleushunou commented Feb 13, 2023

Description

Steps to Reproduce

In our application we have two activities, DialogActivity is opened on top of MainActivity. We use Settings -> Developer Options -> Don't Keep Activities turned ON to simulate system high load. While top activity (DialogActivity) is opened - minimize the app and then open it again.

Expected Behavior

Platform.CurrentActivity should return instance of DialogActivity

Actual Behavior

Platform.CurrentActivity returns instance of MainActivity

Basic Information

  • Version with issue: 1.7.3
  • Last known good version: no version, this bug reproduces also on CurrentActivityPlugin link
  • IDE: VS for Mac/Rider
  • Platform Target Frameworks:
    • Android: API 31
  • Affected Devices: Android 10 Samsung Galaxy Note 9

Code snippet

Code: link
Logs: link
Looks like issue happens because paused activity also saved as current activity, which may override already resumed activity.

MainActivity.OnResume()
DialogActivity.OnResume()
MainActivity.OnPause()

void Application.IActivityLifecycleCallbacks.OnActivityPaused(Activity activity) { Activity = activity; Platform.OnActivityStateChanged(activity, ActivityState.Paused); }

Seems like we don't need to update Activity when OnPause called

@sleushunou sleushunou added the bug Something isn't working label Feb 13, 2023
@sleushunou sleushunou changed the title [Bug] [Bug] Incorrect CurrentActivity value after activities are destroyed and restored by the system Feb 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant