Skip to content
This repository has been archived by the owner on May 15, 2024. It is now read-only.

[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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant