From c4f44ddf1558c4b2fb82d8964516e6b32e673967 Mon Sep 17 00:00:00 2001 From: jesswrd Date: Fri, 6 Sep 2024 09:23:47 -0700 Subject: [PATCH 01/12] Replaced WindowManager with DIsplayManager --- .../io/flutter/embedding/android/FlutterView.java | 5 +++-- shell/platform/android/io/flutter/view/FlutterView.java | 9 +++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/shell/platform/android/io/flutter/embedding/android/FlutterView.java b/shell/platform/android/io/flutter/embedding/android/FlutterView.java index d7c1387da804d..fec810669ffb4 100644 --- a/shell/platform/android/io/flutter/embedding/android/FlutterView.java +++ b/shell/platform/android/io/flutter/embedding/android/FlutterView.java @@ -14,6 +14,7 @@ import android.database.ContentObserver; import android.graphics.Insets; import android.graphics.Rect; +import android.hardware.display.DisplayManager; import android.os.Build; import android.os.Handler; import android.os.Looper; @@ -612,8 +613,8 @@ private ZeroSides calculateShouldZeroSides() { Context context = getContext(); int orientation = context.getResources().getConfiguration().orientation; int rotation = - ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)) - .getDefaultDisplay() + ((DisplayManager) context.getSystemService(Context.DISPLAY_SERVICE)) + .getDisplay(0) .getRotation(); if (orientation == Configuration.ORIENTATION_LANDSCAPE) { diff --git a/shell/platform/android/io/flutter/view/FlutterView.java b/shell/platform/android/io/flutter/view/FlutterView.java index 8dbdae146ef83..afa6c9c04895a 100644 --- a/shell/platform/android/io/flutter/view/FlutterView.java +++ b/shell/platform/android/io/flutter/view/FlutterView.java @@ -15,6 +15,7 @@ import android.graphics.Insets; import android.graphics.PixelFormat; import android.graphics.SurfaceTexture; +import android.hardware.display.DisplayManager; import android.os.Build; import android.os.Handler; import android.text.format.DateFormat; @@ -31,7 +32,7 @@ import android.view.ViewConfiguration; import android.view.ViewStructure; import android.view.WindowInsets; -import android.view.WindowManager; +// import android.view.WindowManager; import android.view.accessibility.AccessibilityManager; import android.view.accessibility.AccessibilityNodeProvider; import android.view.autofill.AutofillValue; @@ -537,10 +538,10 @@ private ZeroSides calculateShouldZeroSides() { Context context = getContext(); int orientation = context.getResources().getConfiguration().orientation; int rotation = - ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)) - .getDefaultDisplay() + ((DisplayManager) context.getSystemService(Context.DISPLAY_SERVICE)) + .getDisplay(0) .getRotation(); - + if (orientation == Configuration.ORIENTATION_LANDSCAPE) { if (rotation == Surface.ROTATION_90) { return ZeroSides.RIGHT; From c2080509dc59b7e4254318bfbfe49e79e475cf09 Mon Sep 17 00:00:00 2001 From: jesswrd Date: Fri, 6 Sep 2024 09:35:37 -0700 Subject: [PATCH 02/12] fixed formatting issues --- .../android/io/flutter/embedding/android/FlutterView.java | 1 - shell/platform/android/io/flutter/view/FlutterView.java | 1 - 2 files changed, 2 deletions(-) diff --git a/shell/platform/android/io/flutter/embedding/android/FlutterView.java b/shell/platform/android/io/flutter/embedding/android/FlutterView.java index fec810669ffb4..f5d089f365058 100644 --- a/shell/platform/android/io/flutter/embedding/android/FlutterView.java +++ b/shell/platform/android/io/flutter/embedding/android/FlutterView.java @@ -32,7 +32,6 @@ import android.view.ViewGroup; import android.view.ViewStructure; import android.view.WindowInsets; -import android.view.WindowManager; import android.view.accessibility.AccessibilityManager; import android.view.accessibility.AccessibilityNodeProvider; import android.view.autofill.AutofillValue; diff --git a/shell/platform/android/io/flutter/view/FlutterView.java b/shell/platform/android/io/flutter/view/FlutterView.java index afa6c9c04895a..c44931cf209d2 100644 --- a/shell/platform/android/io/flutter/view/FlutterView.java +++ b/shell/platform/android/io/flutter/view/FlutterView.java @@ -32,7 +32,6 @@ import android.view.ViewConfiguration; import android.view.ViewStructure; import android.view.WindowInsets; -// import android.view.WindowManager; import android.view.accessibility.AccessibilityManager; import android.view.accessibility.AccessibilityNodeProvider; import android.view.autofill.AutofillValue; From c4754d1ce9f5f82731a134e29434cd6bb7eabafc Mon Sep 17 00:00:00 2001 From: jesswrd Date: Fri, 6 Sep 2024 09:46:38 -0700 Subject: [PATCH 03/12] fixed formatting --- shell/platform/android/io/flutter/view/FlutterView.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shell/platform/android/io/flutter/view/FlutterView.java b/shell/platform/android/io/flutter/view/FlutterView.java index c44931cf209d2..b1dedcfa96825 100644 --- a/shell/platform/android/io/flutter/view/FlutterView.java +++ b/shell/platform/android/io/flutter/view/FlutterView.java @@ -540,7 +540,7 @@ private ZeroSides calculateShouldZeroSides() { ((DisplayManager) context.getSystemService(Context.DISPLAY_SERVICE)) .getDisplay(0) .getRotation(); - + if (orientation == Configuration.ORIENTATION_LANDSCAPE) { if (rotation == Surface.ROTATION_90) { return ZeroSides.RIGHT; From 448309668646efbe0223e964a9e333a82eecc781 Mon Sep 17 00:00:00 2001 From: jesswrd Date: Fri, 6 Sep 2024 16:47:20 -0700 Subject: [PATCH 04/12] added deprecation comments --- .../io/flutter/plugin/platform/WindowManagerHandlerTest.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/shell/platform/android/test/io/flutter/plugin/platform/WindowManagerHandlerTest.java b/shell/platform/android/test/io/flutter/plugin/platform/WindowManagerHandlerTest.java index 7e37231774ca9..230172d9e6cf8 100644 --- a/shell/platform/android/test/io/flutter/plugin/platform/WindowManagerHandlerTest.java +++ b/shell/platform/android/test/io/flutter/plugin/platform/WindowManagerHandlerTest.java @@ -109,6 +109,11 @@ public void windowManagerHandler_forwardsAllOtherCallsToDelegate() { @SuppressWarnings("Unchecked cast") Consumer mockListener = (Consumer) mock(Consumer.class); + // Windowmanager's getDefaultDisplay() function is deprecated in API 30 level 30. + // See Android docs here: + // https://developer.android.com/reference/android/view/WindowManager#getDefaultDisplay() + // We expect this behavior because this unit test expects a blind forward that includes + // deprecated function calls. See comment above for more details. windowManagerHandler.getDefaultDisplay(); verify(mockWindowManager).getDefaultDisplay(); From a9c9f2025472b693314cb9be405be0cc631c6c3f Mon Sep 17 00:00:00 2001 From: jesswrd Date: Mon, 9 Sep 2024 11:53:17 -0700 Subject: [PATCH 05/12] added back getDefaultDisplay in embedding --- .../android/io/flutter/embedding/android/FlutterView.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/shell/platform/android/io/flutter/embedding/android/FlutterView.java b/shell/platform/android/io/flutter/embedding/android/FlutterView.java index f5d089f365058..d7c1387da804d 100644 --- a/shell/platform/android/io/flutter/embedding/android/FlutterView.java +++ b/shell/platform/android/io/flutter/embedding/android/FlutterView.java @@ -14,7 +14,6 @@ import android.database.ContentObserver; import android.graphics.Insets; import android.graphics.Rect; -import android.hardware.display.DisplayManager; import android.os.Build; import android.os.Handler; import android.os.Looper; @@ -32,6 +31,7 @@ import android.view.ViewGroup; import android.view.ViewStructure; import android.view.WindowInsets; +import android.view.WindowManager; import android.view.accessibility.AccessibilityManager; import android.view.accessibility.AccessibilityNodeProvider; import android.view.autofill.AutofillValue; @@ -612,8 +612,8 @@ private ZeroSides calculateShouldZeroSides() { Context context = getContext(); int orientation = context.getResources().getConfiguration().orientation; int rotation = - ((DisplayManager) context.getSystemService(Context.DISPLAY_SERVICE)) - .getDisplay(0) + ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)) + .getDefaultDisplay() .getRotation(); if (orientation == Configuration.ORIENTATION_LANDSCAPE) { From b6cc69a5b9a9be023a5660080e5e2aac3b0e9cb6 Mon Sep 17 00:00:00 2001 From: jesswrd Date: Wed, 11 Sep 2024 17:32:56 -0700 Subject: [PATCH 06/12] updated v2 embedding and reverted v1 embedding flutterview --- .../android/io/flutter/embedding/android/FlutterView.java | 6 +++--- shell/platform/android/io/flutter/view/FlutterView.java | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/shell/platform/android/io/flutter/embedding/android/FlutterView.java b/shell/platform/android/io/flutter/embedding/android/FlutterView.java index d7c1387da804d..f5d089f365058 100644 --- a/shell/platform/android/io/flutter/embedding/android/FlutterView.java +++ b/shell/platform/android/io/flutter/embedding/android/FlutterView.java @@ -14,6 +14,7 @@ import android.database.ContentObserver; import android.graphics.Insets; import android.graphics.Rect; +import android.hardware.display.DisplayManager; import android.os.Build; import android.os.Handler; import android.os.Looper; @@ -31,7 +32,6 @@ import android.view.ViewGroup; import android.view.ViewStructure; import android.view.WindowInsets; -import android.view.WindowManager; import android.view.accessibility.AccessibilityManager; import android.view.accessibility.AccessibilityNodeProvider; import android.view.autofill.AutofillValue; @@ -612,8 +612,8 @@ private ZeroSides calculateShouldZeroSides() { Context context = getContext(); int orientation = context.getResources().getConfiguration().orientation; int rotation = - ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)) - .getDefaultDisplay() + ((DisplayManager) context.getSystemService(Context.DISPLAY_SERVICE)) + .getDisplay(0) .getRotation(); if (orientation == Configuration.ORIENTATION_LANDSCAPE) { diff --git a/shell/platform/android/io/flutter/view/FlutterView.java b/shell/platform/android/io/flutter/view/FlutterView.java index b1dedcfa96825..8dbdae146ef83 100644 --- a/shell/platform/android/io/flutter/view/FlutterView.java +++ b/shell/platform/android/io/flutter/view/FlutterView.java @@ -15,7 +15,6 @@ import android.graphics.Insets; import android.graphics.PixelFormat; import android.graphics.SurfaceTexture; -import android.hardware.display.DisplayManager; import android.os.Build; import android.os.Handler; import android.text.format.DateFormat; @@ -32,6 +31,7 @@ import android.view.ViewConfiguration; import android.view.ViewStructure; import android.view.WindowInsets; +import android.view.WindowManager; import android.view.accessibility.AccessibilityManager; import android.view.accessibility.AccessibilityNodeProvider; import android.view.autofill.AutofillValue; @@ -537,8 +537,8 @@ private ZeroSides calculateShouldZeroSides() { Context context = getContext(); int orientation = context.getResources().getConfiguration().orientation; int rotation = - ((DisplayManager) context.getSystemService(Context.DISPLAY_SERVICE)) - .getDisplay(0) + ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)) + .getDefaultDisplay() .getRotation(); if (orientation == Configuration.ORIENTATION_LANDSCAPE) { From 231b423dc680b5d7d7ec254eeceb57ad76bc44ba Mon Sep 17 00:00:00 2001 From: jesswrd Date: Mon, 23 Sep 2024 10:55:13 -0400 Subject: [PATCH 07/12] added rotation calculation tests # Conflicts: # shell/platform/android/test/io/flutter/embedding/android/FlutterViewTest.java --- .../gradle/wrapper/gradle-wrapper.properties | 7 +++ shell/platform/android/io/flutter/Build.java | 1 + .../embedding/android/FlutterView.java | 21 +++++-- .../embedding/android/FlutterViewTest.java | 57 +++++++++++++++---- 4 files changed, 70 insertions(+), 16 deletions(-) create mode 100644 shell/platform/android/gradle/wrapper/gradle-wrapper.properties diff --git a/shell/platform/android/gradle/wrapper/gradle-wrapper.properties b/shell/platform/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000000000..1af9e0930b89b --- /dev/null +++ b/shell/platform/android/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,7 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip +networkTimeout=10000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/shell/platform/android/io/flutter/Build.java b/shell/platform/android/io/flutter/Build.java index 904bcc392d1c7..817ee313a742d 100644 --- a/shell/platform/android/io/flutter/Build.java +++ b/shell/platform/android/io/flutter/Build.java @@ -8,6 +8,7 @@ public class Build { /** For use in place of the Android Build.VERSION_CODES class. */ public static class API_LEVELS { + public static final int FLUTTER_MIN = 21; public static final int API_21 = 21; public static final int API_22 = 22; public static final int API_23 = 23; diff --git a/shell/platform/android/io/flutter/embedding/android/FlutterView.java b/shell/platform/android/io/flutter/embedding/android/FlutterView.java index f5d089f365058..7a53336f94027 100644 --- a/shell/platform/android/io/flutter/embedding/android/FlutterView.java +++ b/shell/platform/android/io/flutter/embedding/android/FlutterView.java @@ -597,26 +597,35 @@ protected void setWindowInfoListenerDisplayFeatures(WindowLayoutInfo layoutInfo) // android may decide to place the software navigation bars on the side. When the nav // bar is hidden, the reported insets should be removed to prevent extra useless space // on the sides. - private enum ZeroSides { + @VisibleForTesting + public enum ZeroSides { NONE, LEFT, RIGHT, BOTH } - private ZeroSides calculateShouldZeroSides() { + /** + * This method can be run on APIs 30 and above but its intended use is for 30 and below. + * + * @return some ZeroSides enum + */ + @androidx.annotation.DeprecatedSinceApi(api = API_LEVELS.API_30) + @VisibleForTesting + public ZeroSides calculateShouldZeroSides() { // We get both orientation and rotation because rotation is all 4 // rotations relative to default rotation while orientation is portrait // or landscape. By combining both, we can obtain a more precise measure // of the rotation. Context context = getContext(); int orientation = context.getResources().getConfiguration().orientation; - int rotation = - ((DisplayManager) context.getSystemService(Context.DISPLAY_SERVICE)) - .getDisplay(0) - .getRotation(); if (orientation == Configuration.ORIENTATION_LANDSCAPE) { + int rotation = + ((DisplayManager) context.getSystemService(Context.DISPLAY_SERVICE)) + .getDisplay(0) + .getRotation(); + if (rotation == Surface.ROTATION_90) { return ZeroSides.RIGHT; } else if (rotation == Surface.ROTATION_270) { diff --git a/shell/platform/android/test/io/flutter/embedding/android/FlutterViewTest.java b/shell/platform/android/test/io/flutter/embedding/android/FlutterViewTest.java index b4c6e040caee0..dc62638fb2e32 100644 --- a/shell/platform/android/test/io/flutter/embedding/android/FlutterViewTest.java +++ b/shell/platform/android/test/io/flutter/embedding/android/FlutterViewTest.java @@ -29,6 +29,7 @@ import android.graphics.Rect; import android.graphics.Region; import android.hardware.HardwareBuffer; +import android.hardware.display.DisplayManager; import android.media.Image; import android.media.Image.Plane; import android.media.ImageReader; @@ -39,13 +40,13 @@ import android.view.Surface; import android.view.View; import android.view.WindowInsets; -import android.view.WindowManager; import android.widget.FrameLayout; import androidx.core.util.Consumer; import androidx.test.core.app.ApplicationProvider; import androidx.test.ext.junit.runners.AndroidJUnit4; import androidx.window.layout.FoldingFeature; import androidx.window.layout.WindowLayoutInfo; +import io.flutter.Build.API_LEVELS; import io.flutter.embedding.engine.FlutterEngine; import io.flutter.embedding.engine.FlutterJNI; import io.flutter.embedding.engine.loader.FlutterLoader; @@ -438,6 +439,48 @@ public void systemInsetHandlesFullscreenNavbarRightBelowSDK23() { validateViewportMetricPadding(viewportMetricsCaptor, 100, 0, 0, 0); } + @Test + @Config(minSdk = API_LEVELS.FLUTTER_MIN, maxSdk = API_LEVELS.API_29, qualifiers = "port") + public void calculateShouldZeroSidesInPortrait() { + FlutterView flutterView = spy(new FlutterView(ctx)); + assertEquals(FlutterView.ZeroSides.NONE, flutterView.calculateShouldZeroSides()); + } + + @Test + @Config(minSdk = API_LEVELS.FLUTTER_MIN, maxSdk = API_LEVELS.API_29, qualifiers = "land") + public void calculateShouldZeroSidesInLandscapeNeutralRotation() { + FlutterView flutterView = spy(new FlutterView(ctx)); + setExpectedDisplayRotation(Surface.ROTATION_0); + assertEquals(FlutterView.ZeroSides.BOTH, flutterView.calculateShouldZeroSides()); + + setExpectedDisplayRotation(Surface.ROTATION_180); + assertEquals(FlutterView.ZeroSides.BOTH, flutterView.calculateShouldZeroSides()); + } + + @Test + @Config(minSdk = API_LEVELS.FLUTTER_MIN, maxSdk = API_LEVELS.API_29, qualifiers = "land") + public void calculateShouldZeroSidesInLandscapeRotation90() { + FlutterView flutterView = spy(new FlutterView(ctx)); + setExpectedDisplayRotation(Surface.ROTATION_90); + assertEquals(FlutterView.ZeroSides.RIGHT, flutterView.calculateShouldZeroSides()); + } + + @Test + @Config(minSdk = API_LEVELS.API_21, maxSdk = API_LEVELS.API_22, qualifiers = "land") + public void calculateShouldZeroSidesInLandscapeRotation270API22() { + FlutterView flutterView = spy(new FlutterView(ctx)); + setExpectedDisplayRotation(Surface.ROTATION_270); + assertEquals(FlutterView.ZeroSides.RIGHT, flutterView.calculateShouldZeroSides()); + } + + @Test + @Config(minSdk = API_LEVELS.API_23, maxSdk = API_LEVELS.API_29, qualifiers = "land") + public void calculateShouldZeroSidesInLandscapeRotation270API23Plus() { + FlutterView flutterView = spy(new FlutterView(ctx)); + setExpectedDisplayRotation(Surface.ROTATION_270); + assertEquals(FlutterView.ZeroSides.LEFT, flutterView.calculateShouldZeroSides()); + } + @SuppressWarnings("deprecation") // getSystemUiVisibility, getWindowSystemUiVisibility required to test pre api 30 behavior. @Test @@ -615,9 +658,6 @@ public void systemInsetDisplayCutoutSimple() { public void itRegistersAndUnregistersToWindowManager() { Context context = Robolectric.setupActivity(Activity.class); FlutterView flutterView = spy(new FlutterView(context)); - ShadowDisplay display = - Shadows.shadowOf( - ((WindowManager) ctx.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay()); WindowInfoRepositoryCallbackAdapterWrapper windowInfoRepo = mock(WindowInfoRepositoryCallbackAdapterWrapper.class); // For reasoning behing using doReturn instead of when, read "Important gotcha" at @@ -646,9 +686,6 @@ public void itRegistersAndUnregistersToWindowManager() { public void itSendsHingeDisplayFeatureToFlutter() { Context context = Robolectric.setupActivity(Activity.class); FlutterView flutterView = spy(new FlutterView(context)); - ShadowDisplay display = - Shadows.shadowOf( - ((WindowManager) ctx.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay()); when(flutterView.getContext()).thenReturn(context); WindowInfoRepositoryCallbackAdapterWrapper windowInfoRepo = mock(WindowInfoRepositoryCallbackAdapterWrapper.class); @@ -1102,10 +1139,10 @@ public SettingsChannel.MessageBuilder answer(InvocationOnMock invocation) @SuppressWarnings("deprecation") private void setExpectedDisplayRotation(int rotation) { - ShadowDisplay display = + ShadowDisplay myDisplay = Shadows.shadowOf( - ((WindowManager) ctx.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay()); - display.setRotation(rotation); + ((DisplayManager) ctx.getSystemService(Context.DISPLAY_SERVICE)).getDisplay(0)); + myDisplay.setRotation(rotation); } private void validateViewportMetricPadding( From d584189f5aec3633c170d017c80f35696a42b876 Mon Sep 17 00:00:00 2001 From: jesswrd Date: Mon, 23 Sep 2024 11:27:33 -0400 Subject: [PATCH 08/12] deleted gradle configurations off of PR --- .../android/gradle/wrapper/gradle-wrapper.properties | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 shell/platform/android/gradle/wrapper/gradle-wrapper.properties diff --git a/shell/platform/android/gradle/wrapper/gradle-wrapper.properties b/shell/platform/android/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 1af9e0930b89b..0000000000000 --- a/shell/platform/android/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,7 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip -networkTimeout=10000 -validateDistributionUrl=true -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists From 4e6a76805dbaf72064723773a4b7607c0ccabf8b Mon Sep 17 00:00:00 2001 From: jesswrd Date: Wed, 25 Sep 2024 11:46:11 -0400 Subject: [PATCH 09/12] added suppress deprecation linter and visiblefortesting tag --- shell/platform/android/io/flutter/Build.java | 4 +++- .../android/io/flutter/embedding/android/FlutterView.java | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/shell/platform/android/io/flutter/Build.java b/shell/platform/android/io/flutter/Build.java index 817ee313a742d..09662c6dadb8d 100644 --- a/shell/platform/android/io/flutter/Build.java +++ b/shell/platform/android/io/flutter/Build.java @@ -4,11 +4,13 @@ package io.flutter; +import androidx.annotation.VisibleForTesting; + /** A replacement of utilities from android.os.Build. */ public class Build { /** For use in place of the Android Build.VERSION_CODES class. */ public static class API_LEVELS { - public static final int FLUTTER_MIN = 21; + @VisibleForTesting public static final int FLUTTER_MIN = 21; public static final int API_21 = 21; public static final int API_22 = 22; public static final int API_23 = 23; diff --git a/shell/platform/android/io/flutter/embedding/android/FlutterView.java b/shell/platform/android/io/flutter/embedding/android/FlutterView.java index 7a53336f94027..afbfe1615037a 100644 --- a/shell/platform/android/io/flutter/embedding/android/FlutterView.java +++ b/shell/platform/android/io/flutter/embedding/android/FlutterView.java @@ -610,6 +610,7 @@ public enum ZeroSides { * * @return some ZeroSides enum */ + @SuppressLint("deprecated") @androidx.annotation.DeprecatedSinceApi(api = API_LEVELS.API_30) @VisibleForTesting public ZeroSides calculateShouldZeroSides() { From 988549b529ac2734b3509ae9dd38c34fe3869132 Mon Sep 17 00:00:00 2001 From: jesswrd Date: Wed, 25 Sep 2024 12:54:07 -0400 Subject: [PATCH 10/12] suppress warning tag --- .../android/io/flutter/embedding/android/FlutterView.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shell/platform/android/io/flutter/embedding/android/FlutterView.java b/shell/platform/android/io/flutter/embedding/android/FlutterView.java index afbfe1615037a..70ce701bf27c4 100644 --- a/shell/platform/android/io/flutter/embedding/android/FlutterView.java +++ b/shell/platform/android/io/flutter/embedding/android/FlutterView.java @@ -610,7 +610,7 @@ public enum ZeroSides { * * @return some ZeroSides enum */ - @SuppressLint("deprecated") + @SuppressWarnings("deprecated") @androidx.annotation.DeprecatedSinceApi(api = API_LEVELS.API_30) @VisibleForTesting public ZeroSides calculateShouldZeroSides() { From 6d89aa585bf293c2ac46b104fa7e83577db98ef0 Mon Sep 17 00:00:00 2001 From: jesswrd Date: Wed, 25 Sep 2024 14:07:17 -0400 Subject: [PATCH 11/12] added suprress lint --- .../flutter/embedding/android/FlutterView.java | 1 - tools/android_lint/baseline.xml | 17 ++++++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/shell/platform/android/io/flutter/embedding/android/FlutterView.java b/shell/platform/android/io/flutter/embedding/android/FlutterView.java index 70ce701bf27c4..7a53336f94027 100644 --- a/shell/platform/android/io/flutter/embedding/android/FlutterView.java +++ b/shell/platform/android/io/flutter/embedding/android/FlutterView.java @@ -610,7 +610,6 @@ public enum ZeroSides { * * @return some ZeroSides enum */ - @SuppressWarnings("deprecated") @androidx.annotation.DeprecatedSinceApi(api = API_LEVELS.API_30) @VisibleForTesting public ZeroSides calculateShouldZeroSides() { diff --git a/tools/android_lint/baseline.xml b/tools/android_lint/baseline.xml index a73601b794503..c3932724a8245 100644 --- a/tools/android_lint/baseline.xml +++ b/tools/android_lint/baseline.xml @@ -1,5 +1,16 @@ - + + + + + @@ -30,7 +41,7 @@ errorLine2=" ~~~~~~~~~~~~"> From 9221a94932b51558185792656953500504722230 Mon Sep 17 00:00:00 2001 From: jesswrd Date: Wed, 25 Sep 2024 15:27:05 -0400 Subject: [PATCH 12/12] updated 0 to default display constant --- .../android/io/flutter/embedding/android/FlutterView.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/shell/platform/android/io/flutter/embedding/android/FlutterView.java b/shell/platform/android/io/flutter/embedding/android/FlutterView.java index 7a53336f94027..4c6d5448ae7f3 100644 --- a/shell/platform/android/io/flutter/embedding/android/FlutterView.java +++ b/shell/platform/android/io/flutter/embedding/android/FlutterView.java @@ -22,6 +22,7 @@ import android.text.format.DateFormat; import android.util.AttributeSet; import android.util.SparseArray; +import android.view.Display; import android.view.DisplayCutout; import android.view.KeyEvent; import android.view.MotionEvent; @@ -623,7 +624,7 @@ public ZeroSides calculateShouldZeroSides() { if (orientation == Configuration.ORIENTATION_LANDSCAPE) { int rotation = ((DisplayManager) context.getSystemService(Context.DISPLAY_SERVICE)) - .getDisplay(0) + .getDisplay(Display.DEFAULT_DISPLAY) .getRotation(); if (rotation == Surface.ROTATION_90) {