diff options
| author | Felka Chang <felkachang@google.com> | 2020-02-15 12:03:00 +0800 |
|---|---|---|
| committer | Felka Chang <felkachang@google.com> | 2020-02-19 17:53:52 +0800 |
| commit | 15322da9dc68fe569ceed93a4fc6268bbd72dd5a (patch) | |
| tree | 6922ef5d8c7d8a0f07cd42274489323c49200b2d /core/java/android/view/CutoutSpecification.java | |
| parent | d99b89159b3c36a94a5ae3cb13eb4db284aa98e5 (diff) | |
Fix CutoutSpecification logic bug
if the specification contains all of left, top, right, and bottom bind
cutout, the bottom cutout rect return null. But, it should be non-null.
The specification that contains bottom right corner cutout assigned to long
edge in phone like device can't be achieved. But, it should be achieved.
Test: atest \
FrameworksCoreTests:android.view.DisplayCutoutTest \
FrameworksCoreTests:android.view.CutoutSpecificationTest \
SystemUITests:com.android.systemui.ScreenDecorationsTest \
CorePerfTests:android.view.CutoutSpecificationBenchmark
Fixes: 149675352
Change-Id: I6c742f93e72627f1d58b8ce971a4b1cc9792d5cf
Diffstat (limited to 'core/java/android/view/CutoutSpecification.java')
| -rw-r--r-- | core/java/android/view/CutoutSpecification.java | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/core/java/android/view/CutoutSpecification.java b/core/java/android/view/CutoutSpecification.java index d21a9520e12c..850e9fc0db7e 100644 --- a/core/java/android/view/CutoutSpecification.java +++ b/core/java/android/view/CutoutSpecification.java @@ -406,9 +406,7 @@ public class CutoutSpecification { } currentIndex += RIGHT_MARKER.length(); } else if (specWithoutDp.startsWith(BOTTOM_MARKER, currentIndex)) { - if (!mPositionFromCenterVertical) { - parseSvgPathSpec(region, sb.toString()); - } + parseSvgPathSpec(region, sb.toString()); currentIndex += BOTTOM_MARKER.length(); /* prepare to parse the rest path */ @@ -416,9 +414,7 @@ public class CutoutSpecification { mBindBottomCutout = true; mPositionFromBottom = true; } else if (specWithoutDp.startsWith(CENTER_VERTICAL_MARKER, currentIndex)) { - if (!mPositionFromBottom) { - parseSvgPathSpec(region, sb.toString()); - } + parseSvgPathSpec(region, sb.toString()); currentIndex += CENTER_VERTICAL_MARKER.length(); /* prepare to parse the rest path */ @@ -431,14 +427,16 @@ public class CutoutSpecification { /* prepare to parse the rest path */ resetStatus(sb); } else if (specWithoutDp.startsWith(BIND_LEFT_CUTOUT_MARKER, currentIndex)) { - if (!mBindBottomCutout && !mBindRightCutout) { - mBindLeftCutout = true; - } + mBindBottomCutout = false; + mBindRightCutout = false; + mBindLeftCutout = true; + currentIndex += BIND_LEFT_CUTOUT_MARKER.length(); } else if (specWithoutDp.startsWith(BIND_RIGHT_CUTOUT_MARKER, currentIndex)) { - if (!mBindBottomCutout && !mBindLeftCutout) { - mBindRightCutout = true; - } + mBindBottomCutout = false; + mBindLeftCutout = false; + mBindRightCutout = true; + currentIndex += BIND_RIGHT_CUTOUT_MARKER.length(); } else { currentIndex += 1; |
