Search Issue Tracker

By Design

Votes

0

Found in

2019.4

2020.3

2021.2

2022.1

Issue ID

1351772

Regression

No

[UAAL][Android] MonoBehaviors do not receive OnApplicationPause calls until a Dialog is dismissed after the APP is resumed

Android

-

Reproduction steps:
1. Clone the https://github.com/Unity-Technologies/uaal-example repository
2. Checkout this commit 6d82032ed4d501c77929227a925e74d6acb2ddac
3. Apply the attached users git patch "UnityAndroidOnResumeBugDemo.patch"
4. Open the UAAL project "UnityProject" located inside the cloned repository
5. Export an Android project to "UnityProject/androidBuild"
6. Open NativeAndroidApp as a project in Android Studio
7. Build it and run it
8. Press the "Show Unity" button
9. Once the App loads press the "Dialog" Button and put the app in the background
10. Restore the App, observe that the background is no longer being rendered
11. Examine the Logcat
12. Dismissing the Dialog resumes the App

Expected result: Calls are received by MonoBehaviors even after the app is resumed while a Dialog is opened
Actual result: MonoBehaviors do not receive OnApplicationPause calls and UnitySendMessage messages are not delivered until the dialog is dismissed after the APP is resumed

Reproduces on: 2019.4.32f1, 2020.3.21f1, 2021.2.2f1, 2022.1.0a14

Reproduces with these devices:
VLNQA00318 - OnePlus 7 Pro (GM1913), OS: 9.0.0, CPU: Snapdragon 855 SM8150, GPU: Adreno 640
VLNQA00263 - Google Pixel 3 (Pixel 3), OS: 12.0.0, CPU: Snapdragon 845, GPU: Adreno 630
VLNQA00231 - HUAWEI Mate 20 Pro (LYA-L29), OS: 9.0.0, CPU: HiSilicon Kirin 980, GPU: Mali-G76
N/A, Samsung Galaxy S9 (SM-G960F), Android 8.0.0, CPU: Exynos 9 Series 9810, GPU: Mali-G72

Notes:
-MonoBehaviors do not receive OnApplicationPause calls and UnitySendMessage messages are not delivered until the dialog is dismissed
-Step 2 commit adds a "DIALOG" button that produces a simple modal dialog, sends a Unity message from MainUnityActivity.onResume() and adds logging for easy confirmation of the behaviors stated
-More detailed information is available in the patch
-S9 Logcat is attached

  1. Resolution Note (2022.1.X):

    This behavior is by design. Unity Android player is in a pause state when the Dialog is shown. The lifecycle events are resumed only after the dialog is dismissed, so OnApplicationPause is called only then.
    This case also mentions a black background after the app is returned from the background. We already have a bug report for that https://issuetracker.unity3d.com/issues/android-unity-app-background-gets-black-when-dialog-window-remains-open-after-re-entering-the-app

Comments (1)

  1. JessHolle

    Mar 21, 2022 14:11

    I noted that https://issuetracker.unity3d.com/issues/android-unity-app-background-gets-black-when-dialog-window-remains-open-after-re-entering-the-app has been fixed in 2020.3.31f1. I tested this and we still have a black background. This is, however, due to this bug -- we need the OnApplicationPause call to restart our AR camera and tracking. So we can't do better than show a black background until we get this callback.

    The effect of this "design" choice is therefore a bug as I see it. The application is not "paused" when a dialog is shown. The activity does not have focus but that is different.

    I believe SendMessage not firing is also a bug in this circumstance.

    So to me this is all still a bug -- just a design bug.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.