Skip to content

Huawei HarmonyOS Black Screen after being in background #109908

@yk3372

Description

@yk3372

Symptom is same to #108005
When app is brought to foreground from background after a while, the APP will stuck in a black screen.
Only after exited (put into background), and reopened (bring back to foreground), the app will function normally.

The exact trigging condition of the problem is unclear, and it is NOT guaranteed to show on every instance, but can be reproduced fairly often.

I am unable to provide a minimum reproducible example due to the uncertainty of the triggering condition.

I try dump the layout,it looks like normally. The node is exist and it can click? The click logic seems to be normal.
And I checked the flutter view's visibility in OnResume, it's VISIBLE.
The mini layout dump is :

<?xml version='1.0' encoding='UTF-8' standalone='yes' ?>
<hierarchy rotation="0">
    <node index="0" text="" resource-id="" class="android.widget.FrameLayout" package="com.test.flutter" content-desc="" checkable="false" checked="false" clickable="false" enabled="true" focusable="false" focused="false" scrollable="false" long-clickable="false" password="false" selected="false" bounds="[0,0][1080,2265]">
        <node index="0" text="" resource-id="" class="android.widget.LinearLayout" package="com.test.flutter" content-desc="" checkable="false" checked="false" clickable="false" enabled="true" focusable="false" focused="false" scrollable="false" long-clickable="false" password="false" selected="false" bounds="[0,0][1080,2265]">
            <node index="0" text="" resource-id="android:id/content" class="android.widget.FrameLayout" package="com.test.flutter" content-desc="" checkable="false" checked="false" clickable="false" enabled="true" focusable="false" focused="false" scrollable="false" long-clickable="false" password="false" selected="false" bounds="[0,0][1080,2265]">
                <node index="0" text="" resource-id="" class="android.widget.FrameLayout" package="com.test.flutter" content-desc="" checkable="false" checked="false" clickable="false" enabled="true" focusable="true" focused="false" scrollable="false" long-clickable="false" password="false" selected="false" bounds="[0,0][1080,2265]">
                    <node index="0" text="" resource-id="" class="android.view.View" package="com.test.flutter" content-desc="" checkable="false" checked="false" clickable="false" enabled="true" focusable="false" focused="false" scrollable="false" long-clickable="false" password="false" selected="false" bounds="[0,0][1080,2265]">
                        <node index="0" text="" resource-id="" class="android.view.View" package="com.test.flutter" content-desc="" checkable="false" checked="false" clickable="false" enabled="true" focusable="false" focused="false" scrollable="false" long-clickable="false" password="false" selected="false" bounds="[0,0][1080,2265]">
                            <node index="0" text="" resource-id="" class="android.view.View" package="com.test.flutter" content-desc="" checkable="false" checked="false" clickable="false" enabled="true" focusable="false" focused="false" scrollable="false" long-clickable="false" password="false" selected="false" bounds="[0,0][1080,2265]">
                                <node index="1" text="" resource-id="" class="android.view.View" package="com.test.flutter" content-desc="作品" checkable="false" checked="false" clickable="true" enabled="true" focusable="true" focused="false" scrollable="false" long-clickable="false" password="false" selected="false" bounds="[359,105][539,180]" />
                            </node>
                        </node>
                    </node>
                </node>
            </node>
        </node>
    </node>
</hierarchy>

And the flutter logs is below:

V/FlutterActivityAndFragmentDelegate( 6493): Forwarding onUserLeaveHint() to FlutterEngine.
V/FlutterActivityAndFragmentDelegate( 6493): onPause()
V/FlutterSurfaceView( 6493): SurfaceHolder.Callback.stopRenderingToSurface()
V/FlutterActivityAndFragmentDelegate( 6493): onStop()
V/FlutterActivityAndFragmentDelegate( 6493): onSaveInstanceState. Giving framework and plugins an opportunity to save state.

// after a few minutes, come back the App.

V/FlutterActivityAndFragmentDelegate( 6493): onStart()
V/FlutterActivityAndFragmentDelegate( 6493): Forwarding onNewIntent() to FlutterEngine and sending pushRoute message.
V/FlutterActivityAndFragmentDelegate( 6493): onResume()
V/FlutterActivityAndFragmentDelegate( 6493): onPostResume()
V/FlutterSurfaceView( 6493): SurfaceHolder.Callback.startRenderingToSurface()
V/FlutterSurfaceView( 6493): SurfaceHolder.Callback.surfaceChanged()
V/FlutterSurfaceView( 6493): Notifying FlutterRenderer that Android surface size has changed to 1080 x 2340

All the log looks like normally, but the screen is black. Even the debug label are also not visible...

The screenshot:
image

flutter doctor:
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.0.5, on macOS 12.5 21G72 darwin-arm, locale en-CN)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.2)
[✓] Android Studio (version 2021.2)
[✓] Android Studio (version 2021.2)
[✓] VS Code (version 1.70.2)
[✓] Connected device (3 available)

device: Huawei p30 pro

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Issues that are less important to the Flutter projecte: device-specificOnly manifests on certain devicesengineflutter/engine related. See also e: labels.platform-androidAndroid applications specificallyr: invalidIssue is closed as not valid

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions