summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Winson Chung <winsonc@google.com> 2024-06-06 23:05:25 +0000
committer Winson Chung <winsonc@google.com> 2024-06-13 07:23:42 +0000
commit3b6b06bf3537e5dc4fe7fa376e29d34b50ff7b94 (patch)
tree3d65d7db41130277bf193f48fa4dc0a88523a76d
parent5610bd199e1f5af188d6aea678633905b1c8dacf (diff)
Update immersive cling dialog
- Layout the dialog under the cutout (but inset the contents if it overlaps with the cutout region) - Update the instruction string - Update the design to match spec - Update both WM (old) dialog and SysUI (new) dialog Flag: EXEMPT bugfix Fixes: 330912316 Fixes: 315134175 Fixes: 282424060 Test: Verify immersive cling visuals in small/large screen, portrait/landscape, with/without display cutouts Test: adb shell setprop persist.wm.debug.client_immersive_confirmation true/false Change-Id: I549211b71dcc14c8ba7bc977393af40b9ba0f6c5
-rw-r--r--core/res/res/drawable/ic_swipe_down.xml26
-rw-r--r--core/res/res/drawable/immersive_cling_bg.xml (renamed from core/res/res/drawable/immersive_cling_bg_circ.xml)16
-rw-r--r--core/res/res/drawable/immersive_cling_btn_bg.xml32
-rw-r--r--core/res/res/layout/immersive_mode_cling.xml88
-rw-r--r--core/res/res/values-land/dimens.xml2
-rw-r--r--core/res/res/values-sw600dp/dimens.xml2
-rw-r--r--core/res/res/values/strings.xml2
-rw-r--r--core/res/res/values/symbols.xml1
-rw-r--r--packages/SystemUI/res/drawable/ic_swipe_down.xml26
-rw-r--r--packages/SystemUI/res/drawable/immersive_cling_bg.xml (renamed from core/res/res/drawable/immersive_cling_light_bg_circ.xml)16
-rw-r--r--packages/SystemUI/res/drawable/immersive_cling_bg_circ.xml26
-rw-r--r--packages/SystemUI/res/drawable/immersive_cling_btn_bg.xml32
-rw-r--r--packages/SystemUI/res/drawable/immersive_cling_light_bg_circ.xml26
-rw-r--r--packages/SystemUI/res/layout/immersive_mode_cling.xml123
-rw-r--r--packages/SystemUI/res/values-land/dimens.xml2
-rw-r--r--packages/SystemUI/res/values-sw600dp/dimens.xml2
-rw-r--r--packages/SystemUI/res/values/strings.xml2
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/ImmersiveModeConfirmation.java51
-rw-r--r--services/core/java/com/android/server/wm/ImmersiveModeConfirmation.java33
19 files changed, 293 insertions, 215 deletions
diff --git a/core/res/res/drawable/ic_swipe_down.xml b/core/res/res/drawable/ic_swipe_down.xml
new file mode 100644
index 000000000000..15712d6fa4e9
--- /dev/null
+++ b/core/res/res/drawable/ic_swipe_down.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2024 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="960"
+ android:viewportHeight="960"
+ android:tint="?attr/colorControlNormal">
+ <path
+ android:fillColor="@android:color/white"
+ android:pathData="M180,600L40,460L82,418L152,488Q146,461 143,434Q140,407 140,380Q140,298 167,221Q194,144 245,80L288,123Q245,179 222.5,244.5Q200,310 200,380Q200,406 203,431.5Q206,457 213,482L278,418L320,460L180,600ZM658,833Q635,841 611.5,840.5Q588,840 566,829L304,707L322,667Q332,647 350,634.5Q368,622 390,620L458,615L346,308Q340,292 347,277.5Q354,263 370,257Q386,251 400.5,258Q415,265 421,281L569,688L469,695L600,756Q607,759 615,759.5Q623,760 630,758L787,701Q818,690 832,659.5Q846,629 835,598L780,448Q774,432 781,417.5Q788,403 804,397Q820,391 834.5,398Q849,405 855,421L910,571Q933,634 905.5,693.5Q878,753 815,776L658,833ZM568,568L514,417Q508,401 515,386.5Q522,372 538,366Q554,360 568.5,367Q583,374 589,390L644,540L568,568ZM681,527L640,414Q634,398 641,383.5Q648,369 664,363Q680,357 694.5,364Q709,371 715,387L756,499L681,527ZM689,605L689,605L689,605Q689,605 689,605Q689,605 689,605L689,605Q689,605 689,605Q689,605 689,605L689,605L689,605Z"/>
+</vector> \ No newline at end of file
diff --git a/core/res/res/drawable/immersive_cling_bg_circ.xml b/core/res/res/drawable/immersive_cling_bg.xml
index 4731bbd038fb..de29c32390e1 100644
--- a/core/res/res/drawable/immersive_cling_bg_circ.xml
+++ b/core/res/res/drawable/immersive_cling_bg.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
- ~ Copyright (C) 2015 The Android Open Source Project
+ ~ Copyright (C) 2024 The Android Open Source Project
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
@@ -15,12 +15,10 @@
~ limitations under the License
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
- android:shape="oval" >
-
- <solid android:color="@color/white" />
-
- <size
- android:height="56dp"
- android:width="56dp" />
-
+ xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
+ android:shape="rectangle">
+ <corners
+ android:bottomLeftRadius="28dp"
+ android:bottomRightRadius="28dp"/>
+ <solid android:color="?androidprv:attr/materialColorSurfaceContainer" />
</shape>
diff --git a/core/res/res/drawable/immersive_cling_btn_bg.xml b/core/res/res/drawable/immersive_cling_btn_bg.xml
new file mode 100644
index 000000000000..df49e38b4f1e
--- /dev/null
+++ b/core/res/res/drawable/immersive_cling_btn_bg.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2024 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+<inset xmlns:android="http://schemas.android.com/apk/res/android">
+ <ripple android:color="?android:attr/colorControlHighlight">
+ <item android:id="@android:id/mask">
+ <shape android:shape="rectangle">
+ <solid android:color="@android:color/white" />
+ <corners android:radius="28dp" />
+ </shape>
+ </item>
+ <item>
+ <shape android:shape="rectangle">
+ <corners android:radius="28dp" />
+ <solid android:color="?android:attr/colorAccent" />
+ </shape>
+ </item>
+ </ripple>
+</inset> \ No newline at end of file
diff --git a/core/res/res/layout/immersive_mode_cling.xml b/core/res/res/layout/immersive_mode_cling.xml
index 9fd615dc96b7..2cde9e648276 100644
--- a/core/res/res/layout/immersive_mode_cling.xml
+++ b/core/res/res/layout/immersive_mode_cling.xml
@@ -14,79 +14,67 @@
limitations under the License.
-->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
+ android:theme="@android:style/Theme.DeviceDefault.DayNight"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:background="?android:attr/colorAccent"
+ android:background="@android:drawable/immersive_cling_bg"
android:gravity="center_vertical"
- android:paddingBottom="24dp">
+ android:padding="24dp">
- <FrameLayout
- android:id="@+id/immersive_cling_chevron"
- android:layout_width="76dp"
- android:layout_height="76dp"
- android:layout_marginTop="-24dp"
- android:layout_centerHorizontal="true">
-
- <ImageView
- android:id="@+id/immersive_cling_back_bg_light"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:scaleType="center"
- android:src="@drawable/immersive_cling_light_bg_circ" />
-
- <ImageView
- android:id="@+id/immersive_cling_back_bg"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:scaleType="center"
- android:src="@drawable/immersive_cling_bg_circ" />
-
- <ImageView
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:paddingTop="8dp"
- android:scaleType="center"
- android:src="@drawable/ic_expand_more_48dp"
- android:tint="?android:attr/colorAccent"/>
- </FrameLayout>
+ <!-- The top margin of this icon can be adjusted to push the content down to prevent overlapping
+ with the display cutout. -->
+ <ImageView
+ android:id="@+id/immersive_cling_icon"
+ android:layout_width="32dp"
+ android:layout_height="32dp"
+ android:layout_centerHorizontal="true"
+ android:scaleType="fitXY"
+ android:src="@drawable/ic_swipe_down"
+ android:tint="?android:attr/colorAccent"
+ android:tintMode="src_in" />
<TextView
android:id="@+id/immersive_cling_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_below="@id/immersive_cling_chevron"
- android:paddingEnd="48dp"
- android:paddingStart="48dp"
- android:paddingTop="40dp"
+ android:layout_below="@id/immersive_cling_icon"
+ android:layout_marginTop="20dp"
+ android:gravity="center_horizontal"
android:text="@string/immersive_cling_title"
- android:textColor="@android:color/white"
- android:textSize="24sp" />
+ android:textColor="?androidprv:attr/materialColorOnSurface"
+ android:textSize="24sp"
+ android:fontFamily="google-sans" />
<TextView
android:id="@+id/immersive_cling_description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/immersive_cling_title"
- android:paddingEnd="48dp"
- android:paddingStart="48dp"
- android:paddingTop="12.6dp"
+ android:paddingTop="14dp"
+ android:gravity="center_horizontal"
android:text="@string/immersive_cling_description"
- android:textColor="@android:color/white"
- android:textSize="16sp" />
+ android:textColor="?androidprv:attr/materialColorOnSurfaceVariant"
+ android:textSize="14sp"
+ android:fontFamily="google-sans" />
<Button
android:id="@+id/ok"
- style="@style/Widget.Material.Button.Borderless"
+ style="@style/Widget.Material.Button.Borderless.Colored"
+ android:background="@drawable/immersive_cling_btn_bg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_below="@+id/immersive_cling_description"
- android:layout_marginEnd="40dp"
- android:layout_marginTop="18dp"
- android:paddingEnd="8dp"
- android:paddingStart="8dp"
+ android:layout_marginTop="24dp"
+ android:paddingStart="18dp"
+ android:paddingEnd="18dp"
+ android:minWidth="48dp"
+ android:minHeight="48dp"
android:text="@string/immersive_cling_positive"
- android:textColor="@android:color/white"
- android:textSize="14sp" />
-
+ android:textColor="?androidprv:attr/materialColorOnPrimary"
+ android:textAllCaps="false"
+ android:textSize="14sp"
+ android:textFontWeight="500"
+ android:fontFamily="google-sans" />
</RelativeLayout>
diff --git a/core/res/res/values-land/dimens.xml b/core/res/res/values-land/dimens.xml
index f58c4b0dbe7e..c0916bc8a1e1 100644
--- a/core/res/res/values-land/dimens.xml
+++ b/core/res/res/values-land/dimens.xml
@@ -69,7 +69,7 @@
<dimen name="timepicker_left_side_width">250dip</dimen>
<!-- width of ImmersiveModeConfirmation (-1 for match_parent) -->
- <dimen name="immersive_mode_cling_width">380dp</dimen>
+ <dimen name="immersive_mode_cling_width">500dp</dimen>
<!-- Floating toolbar dimensions -->
<dimen name="floating_toolbar_preferred_width">544dp</dimen>
diff --git a/core/res/res/values-sw600dp/dimens.xml b/core/res/res/values-sw600dp/dimens.xml
index 4c70ea32bb5b..4aed94c3d8b0 100644
--- a/core/res/res/values-sw600dp/dimens.xml
+++ b/core/res/res/values-sw600dp/dimens.xml
@@ -112,7 +112,7 @@
<dimen name="keyguard_muliuser_selector_margin">12dp</dimen>
<!-- width of ImmersiveModeConfirmation (-1 for match_parent) -->
- <dimen name="immersive_mode_cling_width">380dp</dimen>
+ <dimen name="immersive_mode_cling_width">600dp</dimen>
<dimen name="floating_toolbar_preferred_width">544dp</dimen>
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index b547a7a00ba8..b6e8383a0094 100644
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -5125,7 +5125,7 @@
<string name="immersive_cling_title">Viewing full screen</string>
<!-- Cling help message description when hiding the navigation bar entering immersive mode [CHAR LIMIT=none] -->
- <string name="immersive_cling_description">To exit, swipe down from the top.</string>
+ <string name="immersive_cling_description">To exit, swipe down from the top of your screen</string>
<!-- Cling help message confirmation button when hiding the navigation bar entering immersive mode [CHAR LIMIT=30] -->
<string name="immersive_cling_positive">Got it</string>
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 14f9f2ff5386..34f74a3f74c6 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -1618,6 +1618,7 @@
<java-symbol type="layout" name="restrictions_pin_challenge" />
<java-symbol type="layout" name="restrictions_pin_setup" />
<java-symbol type="layout" name="immersive_mode_cling" />
+ <java-symbol type="id" name="immersive_cling_icon" />
<java-symbol type="layout" name="user_switching_dialog" />
<java-symbol type="layout" name="common_tab_settings" />
<java-symbol type="layout" name="resolver_list_per_profile" />
diff --git a/packages/SystemUI/res/drawable/ic_swipe_down.xml b/packages/SystemUI/res/drawable/ic_swipe_down.xml
new file mode 100644
index 000000000000..15712d6fa4e9
--- /dev/null
+++ b/packages/SystemUI/res/drawable/ic_swipe_down.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2024 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="960"
+ android:viewportHeight="960"
+ android:tint="?attr/colorControlNormal">
+ <path
+ android:fillColor="@android:color/white"
+ android:pathData="M180,600L40,460L82,418L152,488Q146,461 143,434Q140,407 140,380Q140,298 167,221Q194,144 245,80L288,123Q245,179 222.5,244.5Q200,310 200,380Q200,406 203,431.5Q206,457 213,482L278,418L320,460L180,600ZM658,833Q635,841 611.5,840.5Q588,840 566,829L304,707L322,667Q332,647 350,634.5Q368,622 390,620L458,615L346,308Q340,292 347,277.5Q354,263 370,257Q386,251 400.5,258Q415,265 421,281L569,688L469,695L600,756Q607,759 615,759.5Q623,760 630,758L787,701Q818,690 832,659.5Q846,629 835,598L780,448Q774,432 781,417.5Q788,403 804,397Q820,391 834.5,398Q849,405 855,421L910,571Q933,634 905.5,693.5Q878,753 815,776L658,833ZM568,568L514,417Q508,401 515,386.5Q522,372 538,366Q554,360 568.5,367Q583,374 589,390L644,540L568,568ZM681,527L640,414Q634,398 641,383.5Q648,369 664,363Q680,357 694.5,364Q709,371 715,387L756,499L681,527ZM689,605L689,605L689,605Q689,605 689,605Q689,605 689,605L689,605Q689,605 689,605Q689,605 689,605L689,605L689,605Z"/>
+</vector> \ No newline at end of file
diff --git a/core/res/res/drawable/immersive_cling_light_bg_circ.xml b/packages/SystemUI/res/drawable/immersive_cling_bg.xml
index df5d5ad522c0..de29c32390e1 100644
--- a/core/res/res/drawable/immersive_cling_light_bg_circ.xml
+++ b/packages/SystemUI/res/drawable/immersive_cling_bg.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
- ~ Copyright (C) 2015 The Android Open Source Project
+ ~ Copyright (C) 2024 The Android Open Source Project
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
@@ -15,12 +15,10 @@
~ limitations under the License
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
- android:shape="oval" >
-
- <solid android:color="#80ffffff" />
-
- <size
- android:height="76dp"
- android:width="76dp" />
-
+ xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
+ android:shape="rectangle">
+ <corners
+ android:bottomLeftRadius="28dp"
+ android:bottomRightRadius="28dp"/>
+ <solid android:color="?androidprv:attr/materialColorSurfaceContainer" />
</shape>
diff --git a/packages/SystemUI/res/drawable/immersive_cling_bg_circ.xml b/packages/SystemUI/res/drawable/immersive_cling_bg_circ.xml
deleted file mode 100644
index 32e88ab22b91..000000000000
--- a/packages/SystemUI/res/drawable/immersive_cling_bg_circ.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (C) 2023 The Android Open Source Project
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License
- -->
-<shape xmlns:android="http://schemas.android.com/apk/res/android"
- android:shape="oval" >
-
- <solid android:color="?android:attr/colorBackground" />
-
- <size
- android:height="56dp"
- android:width="56dp" />
-
-</shape>
diff --git a/packages/SystemUI/res/drawable/immersive_cling_btn_bg.xml b/packages/SystemUI/res/drawable/immersive_cling_btn_bg.xml
new file mode 100644
index 000000000000..df49e38b4f1e
--- /dev/null
+++ b/packages/SystemUI/res/drawable/immersive_cling_btn_bg.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2024 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+<inset xmlns:android="http://schemas.android.com/apk/res/android">
+ <ripple android:color="?android:attr/colorControlHighlight">
+ <item android:id="@android:id/mask">
+ <shape android:shape="rectangle">
+ <solid android:color="@android:color/white" />
+ <corners android:radius="28dp" />
+ </shape>
+ </item>
+ <item>
+ <shape android:shape="rectangle">
+ <corners android:radius="28dp" />
+ <solid android:color="?android:attr/colorAccent" />
+ </shape>
+ </item>
+ </ripple>
+</inset> \ No newline at end of file
diff --git a/packages/SystemUI/res/drawable/immersive_cling_light_bg_circ.xml b/packages/SystemUI/res/drawable/immersive_cling_light_bg_circ.xml
deleted file mode 100644
index 12c3e23bf0a0..000000000000
--- a/packages/SystemUI/res/drawable/immersive_cling_light_bg_circ.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (C) 2023 The Android Open Source Project
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License
- -->
-<shape xmlns:android="http://schemas.android.com/apk/res/android"
- android:shape="oval" >
-
- <solid android:color="?android:attr/colorBackground" />
-
- <size
- android:height="76dp"
- android:width="76dp" />
-
-</shape>
diff --git a/packages/SystemUI/res/layout/immersive_mode_cling.xml b/packages/SystemUI/res/layout/immersive_mode_cling.xml
index e6529b9aa9a1..20b7cd3add4b 100644
--- a/packages/SystemUI/res/layout/immersive_mode_cling.xml
+++ b/packages/SystemUI/res/layout/immersive_mode_cling.xml
@@ -14,78 +14,67 @@
limitations under the License.
-->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:gravity="center_vertical"
- android:paddingBottom="24dp">
-
- <FrameLayout
- android:id="@+id/immersive_cling_chevron"
- android:layout_width="76dp"
- android:layout_height="76dp"
- android:layout_marginTop="-24dp"
- android:layout_centerHorizontal="true">
+ xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
+ android:theme="@android:style/Theme.DeviceDefault.DayNight"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:background="@drawable/immersive_cling_bg"
+ android:gravity="center_vertical"
+ android:padding="24dp">
- <ImageView
- android:id="@+id/immersive_cling_back_bg_light"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:scaleType="center"
- android:src="@drawable/immersive_cling_light_bg_circ" />
-
- <ImageView
- android:id="@+id/immersive_cling_back_bg"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:scaleType="center"
- android:src="@drawable/immersive_cling_bg_circ" />
-
- <ImageView
- android:id="@+id/immersive_cling_ic_expand_more"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:paddingTop="8dp"
- android:scaleType="center"
- android:src="@drawable/ic_expand_more_48dp"/>
- </FrameLayout>
+ <!-- The top margin of this icon can be adjusted to push the content down to prevent overlapping
+ with the display cutout. -->
+ <ImageView
+ android:id="@+id/immersive_cling_icon"
+ android:layout_width="32dp"
+ android:layout_height="32dp"
+ android:layout_centerHorizontal="true"
+ android:scaleType="fitXY"
+ android:src="@drawable/ic_swipe_down"
+ android:tint="?android:attr/colorAccent"
+ android:tintMode="src_in" />
<TextView
- android:id="@+id/immersive_cling_title"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_below="@id/immersive_cling_chevron"
- android:paddingEnd="48dp"
- android:paddingStart="48dp"
- android:paddingTop="40dp"
- android:text="@string/immersive_cling_title"
- android:textColor="?android:attr/textColorPrimaryInverse"
- android:textSize="24sp" />
+ android:id="@+id/immersive_cling_title"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_below="@id/immersive_cling_icon"
+ android:layout_marginTop="20dp"
+ android:gravity="center_horizontal"
+ android:text="@string/immersive_cling_title"
+ android:textColor="?androidprv:attr/materialColorOnSurface"
+ android:textSize="24sp"
+ android:fontFamily="google-sans" />
<TextView
- android:id="@+id/immersive_cling_description"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_below="@id/immersive_cling_title"
- android:paddingEnd="48dp"
- android:paddingStart="48dp"
- android:paddingTop="12.6dp"
- android:text="@string/immersive_cling_description"
- android:textColor="?android:attr/textColorPrimaryInverse"
- android:textSize="16sp" />
+ android:id="@+id/immersive_cling_description"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_below="@id/immersive_cling_title"
+ android:paddingTop="14dp"
+ android:gravity="center_horizontal"
+ android:text="@string/immersive_cling_description"
+ android:textColor="?androidprv:attr/materialColorOnSurfaceVariant"
+ android:textSize="14sp"
+ android:fontFamily="google-sans" />
<Button
- android:id="@+id/ok"
- style="@android:style/Widget.Material.Button.Borderless"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignParentEnd="true"
- android:layout_below="@+id/immersive_cling_description"
- android:layout_marginEnd="40dp"
- android:layout_marginTop="18dp"
- android:paddingEnd="8dp"
- android:paddingStart="8dp"
- android:text="@string/immersive_cling_positive"
- android:textColor="?android:attr/textColorPrimaryInverse"
- android:textSize="14sp" />
-
+ android:id="@+id/ok"
+ style="@android:style/Widget.Material.Button.Borderless.Colored"
+ android:background="@drawable/immersive_cling_btn_bg"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_alignParentEnd="true"
+ android:layout_below="@+id/immersive_cling_description"
+ android:layout_marginTop="24dp"
+ android:paddingStart="18dp"
+ android:paddingEnd="18dp"
+ android:minWidth="48dp"
+ android:minHeight="48dp"
+ android:text="@string/immersive_cling_positive"
+ android:textColor="?androidprv:attr/materialColorOnPrimary"
+ android:textAllCaps="false"
+ android:textSize="14sp"
+ android:textFontWeight="500"
+ android:fontFamily="google-sans" />
</RelativeLayout>
diff --git a/packages/SystemUI/res/values-land/dimens.xml b/packages/SystemUI/res/values-land/dimens.xml
index aea79e84f7e8..235015b5286f 100644
--- a/packages/SystemUI/res/values-land/dimens.xml
+++ b/packages/SystemUI/res/values-land/dimens.xml
@@ -34,7 +34,7 @@
<dimen name="volume_row_slider_height">128dp</dimen>
<!-- width of ImmersiveModeConfirmation (-1 for match_parent) -->
- <dimen name="immersive_mode_cling_width">380dp</dimen>
+ <dimen name="immersive_mode_cling_width">500dp</dimen>
<dimen name="controls_activity_view_top_offset">25dp</dimen>
diff --git a/packages/SystemUI/res/values-sw600dp/dimens.xml b/packages/SystemUI/res/values-sw600dp/dimens.xml
index 29e0dbea24f2..27af33438c84 100644
--- a/packages/SystemUI/res/values-sw600dp/dimens.xml
+++ b/packages/SystemUI/res/values-sw600dp/dimens.xml
@@ -56,7 +56,7 @@
<dimen name="navigation_key_padding">25dp</dimen>
<!-- width of ImmersiveModeConfirmation (-1 for match_parent) -->
- <dimen name="immersive_mode_cling_width">380dp</dimen>
+ <dimen name="immersive_mode_cling_width">600dp</dimen>
<!-- Keyboard shortcuts helper -->
<dimen name="ksh_layout_width">488dp</dimen>
diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml
index c2ca4daa5afe..77b8f6006b4a 100644
--- a/packages/SystemUI/res/values/strings.xml
+++ b/packages/SystemUI/res/values/strings.xml
@@ -344,7 +344,7 @@
<!-- Cling help message title when hiding the navigation bar entering immersive mode [CHAR LIMIT=none] -->
<string name="immersive_cling_title">Viewing full screen</string>
<!-- Cling help message description when hiding the navigation bar entering immersive mode [CHAR LIMIT=none] -->
- <string name="immersive_cling_description">To exit, swipe down from the top.</string>
+ <string name="immersive_cling_description">To exit, swipe down from the top of your screen</string>
<!-- Cling help message confirmation button when hiding the navigation bar entering immersive mode [CHAR LIMIT=30] -->
<string name="immersive_cling_positive">Got it</string>
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ImmersiveModeConfirmation.java b/packages/SystemUI/src/com/android/systemui/statusbar/ImmersiveModeConfirmation.java
index 2dfc920b4f20..abf258c44556 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/ImmersiveModeConfirmation.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/ImmersiveModeConfirmation.java
@@ -24,6 +24,7 @@ import static android.app.StatusBarManager.DISABLE_RECENT;
import static android.view.Display.DEFAULT_DISPLAY;
import static android.view.ViewRootImpl.CLIENT_IMMERSIVE_CONFIRMATION;
import static android.view.ViewRootImpl.CLIENT_TRANSIENT;
+import static android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS;
import static android.window.DisplayAreaOrganizer.FEATURE_UNDEFINED;
import static android.window.DisplayAreaOrganizer.KEY_ROOT_DISPLAY_AREA_ID;
@@ -36,12 +37,11 @@ import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
-import android.content.res.ColorStateList;
import android.content.res.Resources;
-import android.content.res.TypedArray;
import android.database.ContentObserver;
import android.graphics.Insets;
import android.graphics.PixelFormat;
+import android.graphics.Rect;
import android.graphics.drawable.ColorDrawable;
import android.os.Binder;
import android.os.Bundle;
@@ -71,7 +71,7 @@ import android.view.animation.AnimationUtils;
import android.view.animation.Interpolator;
import android.widget.Button;
import android.widget.FrameLayout;
-import android.widget.ImageView;
+import android.widget.RelativeLayout;
import com.android.systemui.CoreStartable;
import com.android.systemui.res.R;
@@ -263,6 +263,7 @@ public class ImmersiveModeConfirmation implements CoreStartable, CommandQueue.Ca
| WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL,
PixelFormat.TRANSLUCENT);
lp.setFitInsetsTypes(lp.getFitInsetsTypes() & ~Type.statusBars());
+ lp.layoutInDisplayCutoutMode = LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS;
// Trusted overlay so touches outside the touchable area are allowed to pass through
lp.privateFlags |= WindowManager.LayoutParams.SYSTEM_FLAG_SHOW_FOR_ALL_USERS
| WindowManager.LayoutParams.PRIVATE_FLAG_TRUSTED_OVERLAY
@@ -275,13 +276,20 @@ public class ImmersiveModeConfirmation implements CoreStartable, CommandQueue.Ca
private FrameLayout.LayoutParams getBubbleLayoutParams() {
return new FrameLayout.LayoutParams(
- mSysUiContext.getResources().getDimensionPixelSize(
- R.dimen.immersive_mode_cling_width),
+ getClingWindowWidth(),
ViewGroup.LayoutParams.WRAP_CONTENT,
Gravity.CENTER_HORIZONTAL | Gravity.TOP);
}
/**
+ * Returns the width of the cling window.
+ */
+ private int getClingWindowWidth() {
+ return mSysUiContext.getResources().getDimensionPixelSize(
+ R.dimen.immersive_mode_cling_width);
+ }
+
+ /**
* @return the window token that's used by all ImmersiveModeConfirmation windows.
*/
IBinder getWindowToken() {
@@ -409,21 +417,6 @@ public class ImmersiveModeConfirmation implements CoreStartable, CommandQueue.Ca
mClingLayout = (ViewGroup)
View.inflate(mSysUiContext, R.layout.immersive_mode_cling, null);
- TypedArray ta = mDisplayContext.obtainStyledAttributes(
- new int[]{android.R.attr.colorAccent});
- int colorAccent = ta.getColor(0, 0);
- ta.recycle();
- mClingLayout.setBackgroundColor(colorAccent);
- ImageView expandMore = mClingLayout.findViewById(R.id.immersive_cling_ic_expand_more);
- if (expandMore != null) {
- expandMore.setImageTintList(ColorStateList.valueOf(colorAccent));
- }
- ImageView lightBgCirc = mClingLayout.findViewById(R.id.immersive_cling_back_bg_light);
- if (lightBgCirc != null) {
- // Set transparency to 50%
- lightBgCirc.setImageAlpha(128);
- }
-
final Button ok = mClingLayout.findViewById(R.id.ok);
ok.setOnClickListener(new OnClickListener() {
@Override
@@ -482,6 +475,24 @@ public class ImmersiveModeConfirmation implements CoreStartable, CommandQueue.Ca
@Override
public WindowInsets onApplyWindowInsets(WindowInsets insets) {
+ // If the top display cutout overlaps with the full-width (windowWidth=-1)/centered
+ // dialog, then adjust the dialog contents by the cutout
+ final int width = getWidth();
+ final int windowWidth = getClingWindowWidth();
+ final Rect topDisplayCutout = insets.getDisplayCutout() != null
+ ? insets.getDisplayCutout().getBoundingRectTop()
+ : new Rect();
+ final boolean intersectsTopCutout = topDisplayCutout.intersects(
+ width - (windowWidth / 2), 0,
+ width + (windowWidth / 2), topDisplayCutout.bottom);
+ if (mClingWindow != null &&
+ (windowWidth < 0 || (width > 0 && intersectsTopCutout))) {
+ final View iconView = mClingWindow.findViewById(R.id.immersive_cling_icon);
+ RelativeLayout.LayoutParams lp = (RelativeLayout.LayoutParams)
+ iconView.getLayoutParams();
+ lp.topMargin = topDisplayCutout.bottom;
+ iconView.setLayoutParams(lp);
+ }
// we will be hiding the nav bar, so layout as if it's already hidden
return new WindowInsets.Builder(insets).setInsets(
Type.systemBars(), Insets.NONE).build();
diff --git a/services/core/java/com/android/server/wm/ImmersiveModeConfirmation.java b/services/core/java/com/android/server/wm/ImmersiveModeConfirmation.java
index b2ba9d1cc8fe..bf99ccdf1b0a 100644
--- a/services/core/java/com/android/server/wm/ImmersiveModeConfirmation.java
+++ b/services/core/java/com/android/server/wm/ImmersiveModeConfirmation.java
@@ -20,6 +20,7 @@ import static android.app.ActivityManager.LOCK_TASK_MODE_LOCKED;
import static android.app.ActivityManager.LOCK_TASK_MODE_NONE;
import static android.view.Display.DEFAULT_DISPLAY;
import static android.view.ViewRootImpl.CLIENT_TRANSIENT;
+import static android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS;
import static android.window.DisplayAreaOrganizer.FEATURE_UNDEFINED;
import static android.window.DisplayAreaOrganizer.KEY_ROOT_DISPLAY_AREA_ID;
@@ -35,6 +36,7 @@ import android.content.Intent;
import android.content.IntentFilter;
import android.graphics.Insets;
import android.graphics.PixelFormat;
+import android.graphics.Rect;
import android.graphics.drawable.ColorDrawable;
import android.os.Binder;
import android.os.Bundle;
@@ -60,6 +62,7 @@ import android.view.animation.AnimationUtils;
import android.view.animation.Interpolator;
import android.widget.Button;
import android.widget.FrameLayout;
+import android.widget.RelativeLayout;
import com.android.internal.R;
@@ -233,6 +236,7 @@ public class ImmersiveModeConfirmation {
| WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL,
PixelFormat.TRANSLUCENT);
lp.setFitInsetsTypes(lp.getFitInsetsTypes() & ~Type.statusBars());
+ lp.layoutInDisplayCutoutMode = LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS;
// Trusted overlay so touches outside the touchable area are allowed to pass through
lp.privateFlags |= WindowManager.LayoutParams.SYSTEM_FLAG_SHOW_FOR_ALL_USERS
| WindowManager.LayoutParams.PRIVATE_FLAG_TRUSTED_OVERLAY
@@ -245,13 +249,20 @@ public class ImmersiveModeConfirmation {
private FrameLayout.LayoutParams getBubbleLayoutParams() {
return new FrameLayout.LayoutParams(
- mContext.getResources().getDimensionPixelSize(
- R.dimen.immersive_mode_cling_width),
+ getClingWindowWidth(),
ViewGroup.LayoutParams.WRAP_CONTENT,
Gravity.CENTER_HORIZONTAL | Gravity.TOP);
}
/**
+ * Returns the width of the cling window.
+ */
+ private int getClingWindowWidth() {
+ return mContext.getResources().getDimensionPixelSize(
+ R.dimen.immersive_mode_cling_width);
+ }
+
+ /**
* @return the window token that's used by all ImmersiveModeConfirmation windows.
*/
IBinder getWindowToken() {
@@ -387,6 +398,24 @@ public class ImmersiveModeConfirmation {
@Override
public WindowInsets onApplyWindowInsets(WindowInsets insets) {
+ // If the top display cutout overlaps with the full-width (windowWidth=-1)/centered
+ // dialog, then adjust the dialog contents by the cutout
+ final int width = getWidth();
+ final int windowWidth = getClingWindowWidth();
+ final Rect topDisplayCutout = insets.getDisplayCutout() != null
+ ? insets.getDisplayCutout().getBoundingRectTop()
+ : new Rect();
+ final boolean intersectsTopCutout = topDisplayCutout.intersects(
+ width - (windowWidth / 2), 0,
+ width + (windowWidth / 2), topDisplayCutout.bottom);
+ if (mClingWindow != null &&
+ (windowWidth < 0 || (width > 0 && intersectsTopCutout))) {
+ final View iconView = mClingWindow.findViewById(R.id.immersive_cling_icon);
+ RelativeLayout.LayoutParams lp = (RelativeLayout.LayoutParams)
+ iconView.getLayoutParams();
+ lp.topMargin = topDisplayCutout.bottom;
+ iconView.setLayoutParams(lp);
+ }
// we will be hiding the nav bar, so layout as if it's already hidden
return new WindowInsets.Builder(insets).setInsets(
Type.systemBars(), Insets.NONE).build();