Skip to content

AndroidView is offsetted and clipped on some Xiaomi devices with a notch #24657

Open
@yoavrofe

Description

@yoavrofe

When running the webview_flutter example on a device with a notch, a blank bar apears on the top of the native view, below the app bar. The platform view responds to touches with a vertical offset (one must touch above the point). #19030

screenshot_2018-11-22-15-39-43-001_com example webviewtest

Activity

added this to the Goals milestone on Nov 22, 2018
modified the milestones: Goals, January 2019 on Nov 29, 2018
amirh

amirh commented on Dec 10, 2018

@amirh
Contributor

I can't reproduce this on an emulator with a notch.

@yoavrofe which device are you seeing this on?
Can you post the output of flutter doctor.
Do you see the issue on latest master?

kf6gpe

kf6gpe commented on Dec 10, 2018

@kf6gpe
Contributor

I can't reproduce this on a Pixel 3 XL, either --- I did a sync to head this morning and a flutter run of the webview example, and it worked. @amirh and I are wondering if it's a device-specific issue?
flutter_01

added
waiting for customer responseThe Flutter team cannot make further progress on this issue until the original reporter responds
on Dec 10, 2018
CaiJingLong

CaiJingLong commented on Dec 11, 2018

@CaiJingLong
Contributor

same problem #25152 .

View will have a padding on this Android screen.
图片

code example is

https://github.com/CaiJingLong/androidview-notch-error

And touching events can also be offset.

Other androidview is also have the problem . I just extracted the smallest repository of code.

flutter doctor -v

flutter doctor -v
[✓] Flutter (Channel dev, v1.0.0, on Mac OS X 10.13.6 17G65, locale zh-Hans-CN)
    • Flutter version 1.0.0 at /Users/cai/fluttersdk/flutter
    • Framework revision 5391447fae (10 days ago), 2018-11-29 19:41:26 -0800
    • Engine revision 7375a0f414
    • Dart version 2.1.0 (build 2.1.0-dev.9.4 f9ebf21297)

[✓] Android toolchain - develop for Android devices (Android SDK 28.0.3)
    • Android SDK at /Users/cai/Library/Android/sdk
    • Android NDK at /Users/cai/Library/Android/sdk/ndk-bundle
    • Platform android-28, build-tools 28.0.3
    • Java binary at: /Volumes/Evo512/application/develop/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)
    • All Android licenses accepted.

[✓] iOS toolchain - develop for iOS devices (Xcode 9.2)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 9.2, Build version 9C40b
    • ios-deploy 2.0.0
    • CocoaPods version 1.5.3

[✓] Android Studio (version 3.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 29.0.1
    • Dart plugin version 173.4700
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)

[✓] Android Studio (version 3.2)
    • Android Studio at /Volumes/Evo512/application/develop/Android Studio.app/Contents
    • Flutter plugin version 30.0.1
    • Dart plugin version 181.5656
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)

[✓] IntelliJ IDEA Ultimate Edition (version 2018.2.5)
    • IntelliJ at /Users/cai/Applications/JetBrains Toolbox/IntelliJ IDEA Ultimate.app
    • Flutter plugin version 31.1.3
    • Dart plugin version 182.5124

[✓] VS Code (version 1.29.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 2.21.1

[✓] Connected device (1 available)
    • MI 8 • b6ec3684 • android-arm64 • Android 8.1.0 (API 27)

my device photo
image

I will test the master channel.

32 remaining items

removed this from the None milestone on Aug 17, 2020
xyh256

xyh256 commented on Dec 2, 2020

@xyh256

Current solution is

Modify SingleViewPresentation which is create PlatformView

code:

int flag = 0x00000100 | 0x00000200 | 0x00000400;
try {
    Method method = Window.class.getMethod("addExtraFlags",
            int.class);
    method.invoke(getWindow(), flag);
} catch (Exception e) {
    Log.i(TAG, "addExtraFlags not found.");
}

document: https://dev.mi.com/console/doc/detail?pId=1293#_3_3

android:screenOrientation="landscape" ,This problem has not been solved

icofans

icofans commented on Jan 9, 2021

@icofans

AndroidManifest.xml

<meta-data android:name="notch.config" android:value="portrait"/>
document: https://dev.mi.com/console/doc/detail?pId=1293#_3_3

added
P2Important issues not at the top of the work list
and removed
P1High-priority issues at the top of the work list
on Oct 23, 2023
mossmana

mossmana commented on Oct 23, 2023

@mossmana
Contributor

Bumping this issue down to a P3 since it is fixed with a later version of Android and has a posted workaround. If this issue gains additional thumbs up we may reconsider the priority.

added
P3Issues that are less important to the Flutter project
and removed
P2Important issues not at the top of the work list
on Oct 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Issues that are less important to the Flutter projecta: platform-viewsEmbedding Android/iOS views in Flutter appse: device-specificOnly manifests on certain devicesengineflutter/engine repository. See also e: labels.platform-androidAndroid applications specificallyteam-androidOwned by Android platform teamtriaged-androidTriaged by Android platform team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @mossmana@yoavrofe@zoechi@Hixie@amirh

        Issue actions

          AndroidView is offsetted and clipped on some Xiaomi devices with a notch · Issue #24657 · flutter/flutter