diff options
Diffstat (limited to 'packages/SystemUI')
125 files changed, 3303 insertions, 1310 deletions
diff --git a/packages/SystemUI/Android.bp b/packages/SystemUI/Android.bp index ea585a2eb46a..9cbdd82d786c 100644 --- a/packages/SystemUI/Android.bp +++ b/packages/SystemUI/Android.bp @@ -196,6 +196,7 @@ android_library { "motion_tool_lib", ], manifest: "AndroidManifest.xml", + additional_manifests: ["IceManifest.xml"], defaults: [ "SystemUI_compose_defaults", ], diff --git a/packages/SystemUI/AndroidManifest.xml b/packages/SystemUI/AndroidManifest.xml index 6ed3fc774252..c375527f325d 100644 --- a/packages/SystemUI/AndroidManifest.xml +++ b/packages/SystemUI/AndroidManifest.xml @@ -481,7 +481,7 @@ <activity android:name=".tuner.TunerActivity" android:enabled="false" android:icon="@drawable/tuner" - android:theme="@style/TunerSettings" + android:theme="@style/Theme.SubSettingsBase" android:label="@string/system_ui_tuner" android:process=":tuner" android:exported="true"> @@ -498,7 +498,7 @@ <activity-alias android:name=".DemoMode" android:targetActivity=".tuner.TunerActivity" android:icon="@drawable/tuner" - android:theme="@style/TunerSettings" + android:theme="@style/Theme.SubSettingsBase" android:label="@string/demo_mode" android:process=":tuner" android:exported="true"> diff --git a/packages/SystemUI/IceManifest.xml b/packages/SystemUI/IceManifest.xml new file mode 100644 index 000000000000..74638926a7e6 --- /dev/null +++ b/packages/SystemUI/IceManifest.xml @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* + * Copyright (c) 2017 The LineageOS 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. + */ +--> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="com.android.systemui"> + + <!-- SystemUI Tuner --> + <application> + <activity-alias + android:name=".tuner.StatusBarTuner" + android:targetActivity=".tuner.TunerActivity" + android:icon="@drawable/tuner" + android:theme="@style/Theme.SubSettingsBase" + android:label="@string/status_bar_icons_title" + android:process=":tuner" + android:exported="true"> + <intent-filter> + <action android:name="com.android.settings.action.STATUS_BAR_TUNER" /> + <category android:name="android.intent.category.DEFAULT" /> + </intent-filter> + </activity-alias> + </application> + +</manifest> diff --git a/packages/SystemUI/customization/res/font/clock.xml b/packages/SystemUI/customization/res/font/clock.xml new file mode 100644 index 000000000000..1074ef163c84 --- /dev/null +++ b/packages/SystemUI/customization/res/font/clock.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +** +** Copyright 2020, 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. +*/ +--> + +<!-- +** AOD/LockScreen Clock font. +** Should include all numeric glyphs in all supported locales. +** Recommended: font with variable width to support AOD => LS animations +--> +<font-family xmlns:android="http://schemas.android.com/apk/res/android"> + <font android:font="@font/google_sans_clock"/> +</font-family> diff --git a/packages/SystemUI/customization/res/font/google_sans_clock.ttf b/packages/SystemUI/customization/res/font/google_sans_clock.ttf Binary files differnew file mode 100644 index 000000000000..5e683a05088c --- /dev/null +++ b/packages/SystemUI/customization/res/font/google_sans_clock.ttf diff --git a/packages/SystemUI/customization/res/layout/clock_default_large.xml b/packages/SystemUI/customization/res/layout/clock_default_large.xml index 0139d50dcfba..415f964a215f 100644 --- a/packages/SystemUI/customization/res/layout/clock_default_large.xml +++ b/packages/SystemUI/customization/res/layout/clock_default_large.xml @@ -23,7 +23,7 @@ android:layout_gravity="center" android:gravity="center_horizontal" android:textSize="@dimen/large_clock_text_size" - android:fontFamily="@*android:string/config_clockFontFamily" + android:fontFamily="@font/clock" android:typeface="monospace" android:elegantTextHeight="false" chargeAnimationDelay="200" diff --git a/packages/SystemUI/customization/res/layout/clock_default_small.xml b/packages/SystemUI/customization/res/layout/clock_default_small.xml index ff6d7f9e2240..eb86ae50cbc9 100644 --- a/packages/SystemUI/customization/res/layout/clock_default_small.xml +++ b/packages/SystemUI/customization/res/layout/clock_default_small.xml @@ -23,7 +23,7 @@ android:layout_gravity="start" android:gravity="start" android:textSize="@dimen/small_clock_text_size" - android:fontFamily="@*android:string/config_clockFontFamily" + android:fontFamily="@font/clock" android:elegantTextHeight="false" android:ellipsize="none" android:singleLine="true" diff --git a/packages/SystemUI/res-keyguard/layout/keyguard_slice_view.xml b/packages/SystemUI/res-keyguard/layout/keyguard_slice_view.xml index 7c5dbc247428..64657547621f 100644 --- a/packages/SystemUI/res-keyguard/layout/keyguard_slice_view.xml +++ b/packages/SystemUI/res-keyguard/layout/keyguard_slice_view.xml @@ -38,7 +38,7 @@ android:id="@+id/row" android:layout_width="match_parent" android:layout_height="wrap_content" - android:orientation="horizontal" + android:orientation="vertical" android:gravity="start" /> </com.android.keyguard.KeyguardSliceView> diff --git a/packages/SystemUI/res/drawable-nodpi/udfps_icon_pressed.png b/packages/SystemUI/res/drawable-nodpi/udfps_icon_pressed.png Binary files differnew file mode 100644 index 000000000000..4102e28c1300 --- /dev/null +++ b/packages/SystemUI/res/drawable-nodpi/udfps_icon_pressed.png diff --git a/packages/SystemUI/res/drawable/dialog_tri_state_down_bg.xml b/packages/SystemUI/res/drawable/dialog_tri_state_down_bg.xml new file mode 100644 index 000000000000..7dddc9d0e930 --- /dev/null +++ b/packages/SystemUI/res/drawable/dialog_tri_state_down_bg.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2019 CypherOS + + 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. +--> +<layer-list + xmlns:android="http://schemas.android.com/apk/res/android"> + <item> + <shape> + <solid android:color="#ff1d1d1d" /> + <corners + android:topLeftRadius="@dimen/tri_state_down_top_left_radius" + android:topRightRadius="@dimen/tri_state_down_top_right_radius" + android:bottomLeftRadius="@dimen/tri_state_down_bottom_left_radius" + android:bottomRightRadius="@dimen/tri_state_down_bottom_right_radius" /> + </shape> + </item> +</layer-list>
\ No newline at end of file diff --git a/packages/SystemUI/res/drawable/dialog_tri_state_middle_bg.xml b/packages/SystemUI/res/drawable/dialog_tri_state_middle_bg.xml new file mode 100644 index 000000000000..7cde6be2808c --- /dev/null +++ b/packages/SystemUI/res/drawable/dialog_tri_state_middle_bg.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2019 CypherOS + + 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. +--> +<layer-list + xmlns:android="http://schemas.android.com/apk/res/android"> + <item> + <shape> + <solid android:color="#ff1d1d1d" /> + <corners + android:topLeftRadius="@dimen/tri_state_mid_top_left_radius" + android:topRightRadius="@dimen/tri_state_mid_top_right_radius" + android:bottomLeftRadius="@dimen/tri_state_mid_bottom_left_radius" + android:bottomRightRadius="@dimen/tri_state_mid_bottom_right_radius" /> + </shape> + </item> +</layer-list>
\ No newline at end of file diff --git a/packages/SystemUI/res/drawable/dialog_tri_state_up_bg.xml b/packages/SystemUI/res/drawable/dialog_tri_state_up_bg.xml new file mode 100644 index 000000000000..69757a77ee86 --- /dev/null +++ b/packages/SystemUI/res/drawable/dialog_tri_state_up_bg.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2019 CypherOS + + 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. +--> +<layer-list + xmlns:android="http://schemas.android.com/apk/res/android"> + <item> + <shape> + <solid android:color="#ff1d1d1d" /> + <corners + android:topLeftRadius="@dimen/tri_state_up_top_left_radius" + android:topRightRadius="@dimen/tri_state_up_top_right_radius" + android:bottomLeftRadius="@dimen/tri_state_up_bottom_left_radius" + android:bottomRightRadius="@dimen/tri_state_up_bottom_right_radius" /> + </shape> + </item> +</layer-list>
\ No newline at end of file diff --git a/packages/SystemUI/res/drawable/ic_qs_aod.xml b/packages/SystemUI/res/drawable/ic_qs_aod.xml new file mode 100644 index 000000000000..4bb2d4ac566b --- /dev/null +++ b/packages/SystemUI/res/drawable/ic_qs_aod.xml @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="utf-8"?> +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="24dp" + android:height="24dp" + android:viewportWidth="24" + android:viewportHeight="24"> + + <path + android:fillColor="#ffffff" + android:pathData="M17,19 L17,5 L7,5 L7,19 L17,19 M17,1 C18.1046,1,19,1.89543,19,3 L19,21 C19,22.1046,18.1046,23,17,23 L7,23 C5.89,23,5,22.1,5,21 L5,3 C5,1.89,5.89,1,7,1 L17,1 M9,7 L15,7 L15,9 L9,9 L9,7" /> +</vector> diff --git a/packages/SystemUI/res/drawable/ic_qs_caffeine.xml b/packages/SystemUI/res/drawable/ic_qs_caffeine.xml new file mode 100644 index 000000000000..2c3ba974a7e1 --- /dev/null +++ b/packages/SystemUI/res/drawable/ic_qs_caffeine.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (c) 2015 The CyanogenMod Project + Copyright (c) 2017 The LineageOS 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="48dp" + android:height="48dp" + android:viewportWidth="24" + android:viewportHeight="24"> + + <path + android:fillColor="#FFFFFFFF" + android:pathData="M2,21H20V19H2M20,8H18V5H20M20,3H4V13A4,4 0 0,0 8,17H14A4,4 0 0,0 18,13V10H20A2,2 0 0,0 22,8V5C22,3.89 21.1,3 20,3Z" /> +</vector> diff --git a/packages/SystemUI/res/drawable/ic_qs_heads_up.xml b/packages/SystemUI/res/drawable/ic_qs_heads_up.xml new file mode 100644 index 000000000000..b107602787c1 --- /dev/null +++ b/packages/SystemUI/res/drawable/ic_qs_heads_up.xml @@ -0,0 +1,36 @@ +<!-- +Copyright (C) 2014 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="64dp" + android:height="64dp" + android:viewportWidth="24.0" + android:viewportHeight="24.0"> + + <path + android:pathData="M0,0h24v24H0V0z" /> + <path + android:fillColor="#FFFFFFFF" + android:pathData="M18,16v-5c0-3.07-1.64-5.64-4.5-6.32V4c0-0.83-0.68-1.5-1.51-1.5S10.5,3.17,10.5,4v0.68C7.63,5.36,6,7.92,6,11v5 l-1.3,1.29C4.07,17.92,4.51,19,5.4,19h13.17c0.89,0,1.34-1.08,0.71-1.71L18,16z" /> + <path + android:fillColor="#FFFFFFFF" + android:pathData="M11.99,22c1.1,0,2-0.9,2-2h-4C9.99,21.1,10.88,22,11.99,22z" /> + <path + android:fillColor="#FFFFFFFF" + android:pathData="M6.77,4.73C7.19,4.35,7.2,3.7,6.8,3.3l0,0c-0.38-0.38-1-0.39-1.39-0.02C3.7,4.84,2.52,6.96,2.14,9.34 C2.05,9.95,2.52,10.5,3.14,10.5h0c0.48,0,0.9-0.35,0.98-0.83C4.42,7.73,5.38,6,6.77,4.73z" /> + <path + android:fillColor="#FFFFFFFF" + android:pathData="M18.6,3.28c-0.4-0.37-1.02-0.36-1.4,0.02l0,0c-0.4,0.4-0.38,1.04,0.03,1.42c1.38,1.27,2.35,3,2.65,4.94 c0.07,0.48,0.49,0.83,0.98,0.83c0.61,0,1.09-0.55,0.99-1.16C21.47,6.96,20.3,4.85,18.6,3.28z" /> +</vector> diff --git a/packages/SystemUI/res/drawable/ic_speaker_group_24dp.xml b/packages/SystemUI/res/drawable/ic_speaker_group_24dp.xml new file mode 100644 index 000000000000..37475e52010a --- /dev/null +++ b/packages/SystemUI/res/drawable/ic_speaker_group_24dp.xml @@ -0,0 +1,22 @@ +<!-- + Copyright (C) 2020-2022 The Android Open Source Project + + SPDX-License-Identifier: Apache-2.0 +--> + +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="24dp" + android:height="24dp" + android:viewportWidth="24" + android:viewportHeight="24" + android:tint="?android:attr/colorBackgroundFloating"> + <path + android:pathData="M18.2,1L9.8,1C8.81,1 8,1.81 8,2.8v14.4c0,0.99 0.81,1.79 1.8,1.79l8.4,0.01c0.99,0 1.8,-0.81 1.8,-1.8L20,2.8c0,-0.99 -0.81,-1.8 -1.8,-1.8zM14,3c1.1,0 2,0.89 2,2s-0.9,2 -2,2 -2,-0.89 -2,-2 0.9,-2 2,-2zM14,16.5c-2.21,0 -4,-1.79 -4,-4s1.79,-4 4,-4 4,1.79 4,4 -1.79,4 -4,4z" + android:fillColor="@android:color/white"/> + <path + android:pathData="M14,12.5m-2.5,0a2.5,2.5 0,1 1,5 0a2.5,2.5 0,1 1,-5 0" + android:fillColor="@android:color/white"/> + <path + android:pathData="M6,5H4v16c0,1.1 0.89,2 2,2h10v-2H6V5z" + android:fillColor="@android:color/white"/> +</vector> diff --git a/packages/SystemUI/res/drawable/ic_statusbar_airplanemode.xml b/packages/SystemUI/res/drawable/ic_statusbar_airplanemode.xml new file mode 100644 index 000000000000..7ade8b215590 --- /dev/null +++ b/packages/SystemUI/res/drawable/ic_statusbar_airplanemode.xml @@ -0,0 +1,25 @@ +<!-- + Copyright (C) 2017 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="24.0" + android:viewportHeight="24.0" + android:tint="?android:attr/colorControlNormal"> + <path + android:pathData="M21,16v-2l-8,-5V3.5C13,2.67 12.33,2 11.5,2S10,2.67 10,3.5V9l-8,5v2l8,-2.5V19l-2,1.5V22l3.5,-1l3.5,1v-1.5L13,19v-5.5L21,16z" + android:fillColor="#FFFFFFFF"/> +</vector> diff --git a/packages/SystemUI/res/drawable/ic_statusbar_alarm.xml b/packages/SystemUI/res/drawable/ic_statusbar_alarm.xml new file mode 100644 index 000000000000..4d0a5f8c7346 --- /dev/null +++ b/packages/SystemUI/res/drawable/ic_statusbar_alarm.xml @@ -0,0 +1,25 @@ +<!-- +Copyright (C) 2014 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="48.0" + android:viewportHeight="48.0" + android:tint="?android:attr/colorControlNormal"> + <path + android:fillColor="#FFFFFFFF" + android:pathData="M44.0,11.44l-9.19,-7.71 -2.57,3.06 9.19,7.71 2.57,-3.06zm-28.24,-4.66l-2.57,-3.06 -9.19,7.71 2.57,3.06 9.19,-7.71zm9.24,9.22l-3.0,0.0l0.0,12.0l9.49,5.71 1.51,-2.47 -8.0,-4.74l0.0,-10.5zm-1.01,-8.0c-9.95,0.0 -17.99,8.06 -17.99,18.0s8.04,18.0 17.99,18.0 18.01,-8.06 18.01,-18.0 -8.06,-18.0 -18.01,-18.0zm0.01,32.0c-7.73,0.0 -14.0,-6.27 -14.0,-14.0s6.27,-14.0 14.0,-14.0 14.0,6.27 14.0,14.0 -6.26,14.0 -14.0,14.0z"/> +</vector> diff --git a/packages/SystemUI/res/drawable/ic_statusbar_auto_rotate.xml b/packages/SystemUI/res/drawable/ic_statusbar_auto_rotate.xml new file mode 100644 index 000000000000..9a2cb496d282 --- /dev/null +++ b/packages/SystemUI/res/drawable/ic_statusbar_auto_rotate.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2018 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:height="24dp" + android:width="24dp" + android:viewportWidth="24.0" + android:viewportHeight="24.0" + android:tint="?android:attr/colorControlNormal"> + <path + android:fillColor="#FFFFFFFF" + android:pathData="M7.4,10.94H2.45V5.99l2,0.01v1.53l4.61,-4.61c0.64,-0.64 1.67,-0.66 2.29,-0.04l8.18,8.18h-2.83l-6.48,-6.48L5.86,8.95H7.4V10.94zM16.6,13.06l0.01,2h1.53l-4.36,4.36l-6.48,-6.48H4.46l8.19,8.19c0.62,0.62 1.65,0.6 2.29,-0.04l4.61,-4.61l0.01,0.01v1.53h1.99v-4.95H16.6z"/> +</vector> diff --git a/packages/SystemUI/res/drawable/ic_statusbar_camera.xml b/packages/SystemUI/res/drawable/ic_statusbar_camera.xml new file mode 100644 index 000000000000..32d6b5326ffc --- /dev/null +++ b/packages/SystemUI/res/drawable/ic_statusbar_camera.xml @@ -0,0 +1,25 @@ +<!-- +Copyright (C) 2018 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="24.0" + android:viewportHeight="24.0" + android:tint="?android:attr/colorControlNormal"> + <path + android:fillColor="#FFFFFFFF" + android:pathData="M20,5h-3.17L15,3H9L7.17,5H4C2.9,5 2,5.9 2,7v12c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2V7C22,5.9 21.1,5 20,5zM20,19H4V7h16V19zM12,9c-2.21,0 -4,1.79 -4,4c0,2.21 1.79,4 4,4s4,-1.79 4,-4C16,10.79 14.21,9 12,9z"/> +</vector> diff --git a/packages/SystemUI/res/drawable/ic_statusbar_cast.xml b/packages/SystemUI/res/drawable/ic_statusbar_cast.xml new file mode 100644 index 000000000000..5413c77215df --- /dev/null +++ b/packages/SystemUI/res/drawable/ic_statusbar_cast.xml @@ -0,0 +1,25 @@ +<!-- +Copyright (C) 2017 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="24.0" + android:viewportHeight="24.0" + android:tint="?android:attr/colorControlNormal"> + <path + android:fillColor="#FFFFFFFF" + android:pathData="M21,3L3,3c-1.1,0 -2,0.9 -2,2v3h2L3,5h18v14h-7v2h7c1.1,0 2,-0.9 2,-2L23,5c0,-1.1 -0.9,-2 -2,-2zM1,18v3h3c0,-1.66 -1.34,-3 -3,-3zM1,14v2c2.76,0 5,2.24 5,5h2c0,-3.87 -3.13,-7 -7,-7zM1,10v2c4.97,0 9,4.03 9,9h2c0,-6.08 -4.93,-11 -11,-11z"/> +</vector> diff --git a/packages/SystemUI/res/drawable/ic_statusbar_clock.xml b/packages/SystemUI/res/drawable/ic_statusbar_clock.xml new file mode 100644 index 000000000000..4b91508d2eb1 --- /dev/null +++ b/packages/SystemUI/res/drawable/ic_statusbar_clock.xml @@ -0,0 +1,28 @@ +<!-- + Copyright (C) 2015 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="24.0" + android:viewportHeight="24.0" + android:tint="?android:attr/colorControlNormal"> + <path + android:fillColor="#FFFFFFFF" + android:pathData="M11.99,2.0C6.47,2.0 2.0,6.48 2.0,12.0s4.47,10.0 9.99,10.0C17.52,22.0 22.0,17.52 22.0,12.0S17.52,2.0 11.99,2.0zM12.0,20.0c-4.42,0.0 -8.0,-3.58 -8.0,-8.0s3.58,-8.0 8.0,-8.0 8.0,3.58 8.0,8.0 -3.58,8.0 -8.0,8.0z"/> + <path + android:fillColor="#FFFFFFFF" + android:pathData="M12.5,7.0L11.0,7.0l0.0,6.0l5.25,3.1 0.75,-1.23 -4.5,-2.67z"/> +</vector> diff --git a/packages/SystemUI/res/drawable/ic_statusbar_do_not_disturb.xml b/packages/SystemUI/res/drawable/ic_statusbar_do_not_disturb.xml new file mode 100644 index 000000000000..cace8d4433f5 --- /dev/null +++ b/packages/SystemUI/res/drawable/ic_statusbar_do_not_disturb.xml @@ -0,0 +1,28 @@ +<!-- + Copyright (C) 2018 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="24.0" + android:viewportHeight="24.0" + android:tint="?android:attr/colorControlNormal"> + <path + android:fillColor="#FFFFFFFF" + android:pathData="M12,2C6.48,2 2,6.48 2,12c0,5.52 4.48,10 10,10c5.52,0 10,-4.48 10,-10C22,6.48 17.52,2 12,2zM12,20c-4.41,0 -8,-3.59 -8,-8c0,-4.41 3.59,-8 8,-8c4.41,0 8,3.59 8,8C20,16.41 16.41,20 12,20z"/> + <path + android:fillColor="#FFFFFFFF" + android:pathData="M7,11h10v2h-10z"/> +</vector> diff --git a/packages/SystemUI/res/drawable/ic_statusbar_ethernet.xml b/packages/SystemUI/res/drawable/ic_statusbar_ethernet.xml new file mode 100644 index 000000000000..46e753fd7eb8 --- /dev/null +++ b/packages/SystemUI/res/drawable/ic_statusbar_ethernet.xml @@ -0,0 +1,34 @@ + <!-- + ~ Copyright (C) 2021 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="24.0" + android:viewportHeight="24.0" + android:tint="?android:attr/colorControlNormal"> + <path + android:fillColor="#FFFFFFFF" + android:pathData="M17,6l-1.41,1.41L20.17,12l-4.58,4.59L17,18l6,-6zM8.41,7.41L7,6l-6,6 6,6 1.41,-1.41L3.83,12z"/> + <path + android:fillColor="#FFFFFFFF" + android:pathData="M8,12m-1,0a1,1 0,1 1,2 0a1,1 0,1 1,-2 0"/> + <path + android:fillColor="#FFFFFFFF" + android:pathData="M12,12m-1,0a1,1 0,1 1,2 0a1,1 0,1 1,-2 0"/> + <path + android:fillColor="#FFFFFFFF" + android:pathData="M16,12m-1,0a1,1 0,1 1,2 0a1,1 0,1 1,-2 0"/> + </vector> diff --git a/packages/SystemUI/res/drawable/ic_statusbar_headset.xml b/packages/SystemUI/res/drawable/ic_statusbar_headset.xml new file mode 100644 index 000000000000..ad9a55fcc5e2 --- /dev/null +++ b/packages/SystemUI/res/drawable/ic_statusbar_headset.xml @@ -0,0 +1,25 @@ +<!-- + Copyright (C) 2016 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="24.0" + android:viewportHeight="24.0" + android:tint="?android:attr/colorControlNormal"> + <path + android:fillColor="#FFFFFFFF" + android:pathData="M19,15v3c0,0.55 -0.45,1 -1,1h-1v-4h2M7,15v4H6c-0.55,0 -1,-0.45 -1,-1v-3h2m5,-13c-4.97,0 -9,4.03 -9,9v7c0,1.66 1.34,3 3,3h3v-8H5v-2c0,-3.87 3.13,-7 7,-7s7,3.13 7,7v2h-4v8h3c1.66,0 3,-1.34 3,-3v-7c0,-4.97 -4.03,-9 -9,-9z" /> +</vector> diff --git a/packages/SystemUI/res/drawable/ic_statusbar_hotspot.xml b/packages/SystemUI/res/drawable/ic_statusbar_hotspot.xml new file mode 100644 index 000000000000..37f5ea9075ae --- /dev/null +++ b/packages/SystemUI/res/drawable/ic_statusbar_hotspot.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2015 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="24.0" + android:viewportHeight="24.0" + android:tint="?android:attr/colorControlNormal"> + <path + android:fillColor="#FFFFFFFF" + android:pathData="M12,7c-3.31,0-6,2.69-6,6c0,1.66,0.68,3.15,1.76,4.24l1.42-1.42C8.45,15.1,8,14.11,8,13c0-2.21,1.79-4,4-4s4,1.79,4,4 c0,1.11-0.45,2.1-1.18,2.82l1.42,1.42C17.32,16.15,18,14.66,18,13C18,9.69,15.31,7,12,7z" /> + <path + android:fillColor="#FFFFFFFF" + android:pathData="M12,3C6.48,3,2,7.48,2,13c0,2.76,1.12,5.26,2.93,7.07l1.41-1.41C4.9,17.21,4,15.21,4,13c0-4.42,3.58-8,8-8s8,3.58,8,8 c0,2.21-0.9,4.2-2.35,5.65l1.41,1.41C20.88,18.26,22,15.76,22,13C22,7.48,17.52,3,12,3z" /> + <path + android:fillColor="#FFFFFFFF" + android:pathData="M12,11c-1.1,0-2,0.9-2,2c0,0.55,0.23,1.05,0.59,1.41C10.95,14.77,11.45,15,12,15s1.05-0.23,1.41-0.59 C13.77,14.05,14,13.55,14,13C14,11.9,13.1,11,12,11z" /> +</vector> diff --git a/packages/SystemUI/res/drawable/ic_statusbar_mobile_network.xml b/packages/SystemUI/res/drawable/ic_statusbar_mobile_network.xml new file mode 100644 index 000000000000..1f24717a1512 --- /dev/null +++ b/packages/SystemUI/res/drawable/ic_statusbar_mobile_network.xml @@ -0,0 +1,26 @@ +<!-- + Copyright (C) 2017 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:autoMirrored="true" + android:width="24dp" + android:height="24dp" + android:viewportWidth="24.0" + android:viewportHeight="24.0" + android:tint="?android:attr/colorControlNormal"> + <path + android:pathData="m3.8,22l17.19,0c0.55,0 1.01,-0.45 1.01,-1.01l0,-17.19c0,-0.71 -0.87,-1.08 -1.38,-0.57l-17.38,17.39c-0.51,0.51 -0.15,1.38 0.56,1.38z" + android:fillColor="#FFFFFFFF"/> +</vector> diff --git a/packages/SystemUI/res/drawable/ic_statusbar_mute.xml b/packages/SystemUI/res/drawable/ic_statusbar_mute.xml new file mode 100644 index 000000000000..c63aeea9489e --- /dev/null +++ b/packages/SystemUI/res/drawable/ic_statusbar_mute.xml @@ -0,0 +1,26 @@ +<!-- +Copyright (C) 2014 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="24.0" + android:viewportHeight="24.0" + android:tint="?android:attr/colorControlNormal"> + + <path + android:fillColor="#FFFFFFFF" + android:pathData="M11.5,22.0c1.1,0.0 2.0,-0.9 2.0,-2.0l-4.0,0.0C9.5,21.1 10.4,22.0 11.5,22.0zM18.0,10.5c0.0,-3.1 -2.1,-5.6 -5.0,-6.3L13.0,3.5C13.0,2.7 12.3,2.0 11.5,2.0C10.7,2.0 10.0,2.7 10.0,3.5l0.0,0.7C9.5,4.3 9.0,4.5 8.6,4.7l9.4,9.4L18.0,10.5zM17.7,19.0l2.0,2.0l1.3,-1.3L4.3,3.0L3.0,4.3l2.9,2.9C5.3,8.2 5.0,9.3 5.0,10.5L5.0,16.0l-2.0,2.0l0.0,1.0L17.7,19.0z" /> +</vector> diff --git a/packages/SystemUI/res/drawable/ic_statusbar_priority.xml b/packages/SystemUI/res/drawable/ic_statusbar_priority.xml new file mode 100644 index 000000000000..adcbbe932ec6 --- /dev/null +++ b/packages/SystemUI/res/drawable/ic_statusbar_priority.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2020 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="24.0" + android:viewportHeight="24.0" + android:tint="?android:attr/colorControlNormal"> + <path + android:fillColor="#FFFFFFFF" + android:pathData="M15,19L3,19l4.5,-7L3,5h12c0.65,0 1.26,0.31 1.63,0.84L21,12l-4.37,6.16c-0.37,0.52 -0.98,0.84 -1.63,0.84zM6.5,17L15,17l3.5,-5L15,7L6.5,7l3.5,5 -3.5,5z"/> +</vector> diff --git a/packages/SystemUI/res/drawable/ic_statusbar_vibrate.xml b/packages/SystemUI/res/drawable/ic_statusbar_vibrate.xml new file mode 100644 index 000000000000..dfa60992ba51 --- /dev/null +++ b/packages/SystemUI/res/drawable/ic_statusbar_vibrate.xml @@ -0,0 +1,26 @@ +<!-- +Copyright (C) 2014 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="24.0" + android:viewportHeight="24.0" + android:tint="?android:attr/colorControlNormal"> + + <path + android:fillColor="#FFFFFFFF" + android:pathData="M0.0,15.0l2.0,0.0L2.0,9.0L0.0,9.0L0.0,15.0zM3.0,17.0l2.0,0.0L5.0,7.0L3.0,7.0L3.0,17.0zM22.0,9.0l0.0,6.0l2.0,0.0L24.0,9.0L22.0,9.0zM19.0,17.0l2.0,0.0L21.0,7.0l-2.0,0.0L19.0,17.0zM16.5,3.0l-9.0,0.0C6.7,3.0 6.0,3.7 6.0,4.5l0.0,15.0C6.0,20.3 6.7,21.0 7.5,21.0l9.0,0.0c0.8,0.0 1.5,-0.7 1.5,-1.5l0.0,-15.0C18.0,3.7 17.3,3.0 16.5,3.0zM16.0,19.0L8.0,19.0L8.0,5.0l8.0,0.0L16.0,19.0z"/> +</vector> diff --git a/packages/SystemUI/res/drawable/ic_statusbar_wifi.xml b/packages/SystemUI/res/drawable/ic_statusbar_wifi.xml new file mode 100644 index 000000000000..e56e9512c9b5 --- /dev/null +++ b/packages/SystemUI/res/drawable/ic_statusbar_wifi.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2015 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="24.0" + android:viewportHeight="24.0" + android:tint="?android:attr/colorControlNormal"> + <path + android:fillColor="#FFFFFFFF" + android:pathData="M24,7.39L12,22L0,7.39C2.97,4.08,7.25,2,12,2S21.03,4.08,24,7.39z" /> +</vector> diff --git a/packages/SystemUI/res/drawable/ic_statusbar_work.xml b/packages/SystemUI/res/drawable/ic_statusbar_work.xml new file mode 100644 index 000000000000..ea8918b1ca12 --- /dev/null +++ b/packages/SystemUI/res/drawable/ic_statusbar_work.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +~ Copyright (C) 2019 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="24.0" + android:viewportHeight="24.0" + android:tint="?android:attr/colorControlNormal"> + <path + android:pathData="M20,6h-4L16,4c0,-1.11 -0.89,-2 -2,-2h-4c-1.11,0 -2,0.89 -2,2v2L4,6c-1.11,0 -1.99,0.89 -1.99,2L2,19c0,1.11 0.89,2 2,2h16c1.11,0 2,-0.89 2,-2L22,8c0,-1.11 -0.89,-2 -2,-2zM12,15c-1.1,0 -2,-0.9 -2,-2s0.9,-2 2,-2 2,0.9 2,2 -0.9,2 -2,2zM14,6h-4L10,4h4v2z" + android:fillColor="#FFFFFFFF"/> +</vector> diff --git a/packages/SystemUI/res/drawable/ic_vpn_key.xml b/packages/SystemUI/res/drawable/ic_vpn_key.xml new file mode 100644 index 000000000000..c2a7e342397e --- /dev/null +++ b/packages/SystemUI/res/drawable/ic_vpn_key.xml @@ -0,0 +1,28 @@ +<!-- + Copyright (C) 2017 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="24.0" + android:viewportHeight="24.0" + android:tint="?android:attr/colorControlNormal"> + <path + android:fillColor="#FFFFFFFF" + android:pathData="M12.09,9C11.11,7.5 9.43,6.5 7.5,6.5C4.46,6.5 2,8.96 2,12c0,3.04 2.46,5.5 5.5,5.5c1.93,0 3.61,-1 4.59,-2.5H14v3h6v-3h2V9H12.09zM20,13h-2v3h-2v-3h-5.16c-0.43,1.44 -1.76,2.5 -3.34,2.5C5.57,15.5 4,13.93 4,12c0,-1.93 1.57,-3.5 3.5,-3.5c1.58,0 2.9,1.06 3.34,2.5H20V13z"/> + <path + android:fillColor="#FFFFFFFF" + android:pathData="M7.5,12m-1.5,0a1.5,1.5 0,1 1,3 0a1.5,1.5 0,1 1,-3 0"/> +</vector> diff --git a/packages/SystemUI/res/drawable/stat_sys_dnd.xml b/packages/SystemUI/res/drawable/stat_sys_dnd.xml index aa352b42cf04..21bdb64db0bf 100644 --- a/packages/SystemUI/res/drawable/stat_sys_dnd.xml +++ b/packages/SystemUI/res/drawable/stat_sys_dnd.xml @@ -17,6 +17,6 @@ */ --> <inset xmlns:android="http://schemas.android.com/apk/res/android" - android:insetLeft="2.5dp" - android:insetRight="2.5dp" + android:insetLeft="0.5dp" + android:insetRight="0.5dp" android:drawable="@*android:drawable/ic_qs_dnd" />
\ No newline at end of file diff --git a/packages/SystemUI/res/drawable/stat_sys_ringer_silent.xml b/packages/SystemUI/res/drawable/stat_sys_ringer_silent.xml index 4a9d41fae1d5..13dc8a978a38 100644 --- a/packages/SystemUI/res/drawable/stat_sys_ringer_silent.xml +++ b/packages/SystemUI/res/drawable/stat_sys_ringer_silent.xml @@ -14,6 +14,6 @@ Copyright (C) 2015 The Android Open Source Project limitations under the License. --> <inset xmlns:android="http://schemas.android.com/apk/res/android" - android:insetLeft="3dp" - android:insetRight="3dp" + android:insetLeft="-2.5dp" + android:insetRight="-2.5dp" android:drawable="@drawable/ic_speaker_mute" /> diff --git a/packages/SystemUI/res/drawable/stat_sys_ringer_vibrate.xml b/packages/SystemUI/res/drawable/stat_sys_ringer_vibrate.xml index 21a4c1703d31..e3b22970d803 100644 --- a/packages/SystemUI/res/drawable/stat_sys_ringer_vibrate.xml +++ b/packages/SystemUI/res/drawable/stat_sys_ringer_vibrate.xml @@ -14,6 +14,4 @@ limitations under the License. --> <inset xmlns:android="http://schemas.android.com/apk/res/android" - android:insetLeft="2.5dp" - android:insetRight="2.5dp" android:drawable="@drawable/ic_volume_ringer_vibrate" />
\ No newline at end of file diff --git a/packages/SystemUI/res/drawable/volume_background.xml b/packages/SystemUI/res/drawable/volume_background.xml new file mode 100644 index 000000000000..671d45ce9006 --- /dev/null +++ b/packages/SystemUI/res/drawable/volume_background.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2022 The LineageOS Project + + SPDX-License-Identifier: Apache-2.0 +--> + +<shape xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"> + <size android:width="@dimen/volume_dialog_panel_width" /> + <solid android:color="?androidprv:attr/colorSurface" /> +</shape> diff --git a/packages/SystemUI/res/font b/packages/SystemUI/res/font new file mode 120000 index 000000000000..2acf8c302a6d --- /dev/null +++ b/packages/SystemUI/res/font @@ -0,0 +1 @@ +../customization/res/font
\ No newline at end of file diff --git a/packages/SystemUI/res/layout-land/volume_dialog.xml b/packages/SystemUI/res/layout-land/volume_dialog.xml index 3b70dc060e84..c7bb90278d6e 100644 --- a/packages/SystemUI/res/layout-land/volume_dialog.xml +++ b/packages/SystemUI/res/layout-land/volume_dialog.xml @@ -21,18 +21,17 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="right" - android:layout_gravity="right" android:background="@android:color/transparent" android:theme="@style/volume_dialog_theme"> <!-- right-aligned to be physically near volume button --> - <LinearLayout + <com.android.systemui.animation.view.LaunchableLinearLayout android:id="@+id/volume_dialog" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="right" - android:layout_gravity="right" - android:layout_marginRight="@dimen/volume_dialog_panel_transparent_padding_right" + android:layout_marginLeft="@dimen/volume_dialog_panel_transparent_padding_horizontal" + android:layout_marginRight="@dimen/volume_dialog_panel_transparent_padding_horizontal" android:orientation="vertical" android:clipToPadding="false" android:clipChildren="false"> @@ -55,7 +54,6 @@ android:layout_height="@dimen/volume_dialog_ringer_size" android:layout_marginBottom="@dimen/volume_dialog_spacer" android:gravity="right" - android:layout_gravity="right" android:translationZ="@dimen/volume_dialog_elevation" android:clipToPadding="false" android:background="@drawable/rounded_bg_full"> @@ -83,7 +81,6 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="right" - android:layout_gravity="right" android:orientation="vertical" android:clipChildren="false" android:clipToPadding="false" > @@ -99,13 +96,12 @@ android:id="@+id/settings_container" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:background="@drawable/volume_background_bottom" + android:background="@drawable/volume_background" android:paddingLeft="@dimen/volume_dialog_ringer_rows_padding" - android:paddingBottom="@dimen/volume_dialog_ringer_rows_padding" android:paddingRight="@dimen/volume_dialog_ringer_rows_padding"> <com.android.keyguard.AlphaOptimizedImageButton android:id="@+id/settings" - android:src="@drawable/horizontal_ellipsis" + android:src="@drawable/ic_speaker_group_24dp" android:layout_width="@dimen/volume_dialog_tap_target_size" android:layout_height="@dimen/volume_dialog_tap_target_size" android:layout_gravity="center" @@ -114,6 +110,38 @@ android:tint="?androidprv:attr/colorAccent" android:soundEffectsEnabled="false" /> </FrameLayout> + <FrameLayout + android:id="@+id/expandable_indicator_container" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:background="@drawable/volume_background_bottom" + android:paddingLeft="@dimen/volume_dialog_ringer_rows_padding" + android:paddingBottom="@dimen/volume_dialog_ringer_rows_padding" + android:paddingRight="@dimen/volume_dialog_ringer_rows_padding"> + <com.android.systemui.statusbar.phone.ExpandableIndicator + android:id="@+id/expandable_indicator" + android:layout_width="@dimen/volume_dialog_tap_target_size" + android:layout_height="@dimen/volume_dialog_tap_target_size" + android:layout_gravity="center" + android:contentDescription="@string/accessibility_volume_settings" + android:background="@drawable/ripple_drawable_20dp" + android:tint="?androidprv:attr/colorAccent" + android:soundEffectsEnabled="false" + android:padding="10dp" + android:rotation="90" /> + </FrameLayout> + <FrameLayout + android:id="@+id/rounded_border_bottom" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:background="@drawable/volume_background_bottom" + android:paddingLeft="@dimen/volume_dialog_ringer_rows_padding" + android:paddingRight="@dimen/volume_dialog_ringer_rows_padding"> + <View + android:layout_width="0dp" + android:layout_height="32dp" + android:background="@drawable/ripple_drawable_20dp"/> + </FrameLayout> </LinearLayout> </LinearLayout> @@ -124,7 +152,6 @@ android:layout_height="@dimen/volume_dialog_caption_size" android:layout_marginTop="@dimen/volume_dialog_row_margin_bottom" android:gravity="right" - android:layout_gravity="right" android:clipToPadding="false" android:clipToOutline="true" android:background="@drawable/volume_row_rounded_background"> @@ -138,7 +165,7 @@ android:layout_gravity="center" android:soundEffectsEnabled="false" /> </FrameLayout> - </LinearLayout> + </com.android.systemui.animation.view.LaunchableLinearLayout> <ViewStub android:id="@+id/odi_captions_tooltip_stub" @@ -146,7 +173,8 @@ android:layout="@layout/volume_tool_tip_view" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_gravity="bottom | right" - android:layout_marginRight="@dimen/volume_tool_tip_right_margin"/> + android:layout_gravity="bottom" + android:layout_marginLeft="@dimen/volume_tool_tip_horizontal_margin" + android:layout_marginRight="@dimen/volume_tool_tip_horizontal_margin"/> </FrameLayout>
\ No newline at end of file diff --git a/packages/SystemUI/res/layout/dream_overlay_complication_clock_time.xml b/packages/SystemUI/res/layout/dream_overlay_complication_clock_time.xml index 8bff1a135336..64e345e8a825 100644 --- a/packages/SystemUI/res/layout/dream_overlay_complication_clock_time.xml +++ b/packages/SystemUI/res/layout/dream_overlay_complication_clock_time.xml @@ -24,7 +24,7 @@ android:id="@+id/time_view" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:fontFamily="@*android:string/config_clockFontFamily" + android:fontFamily="@font/clock" android:textColor="@android:color/white" android:format12Hour="@string/dream_time_complication_12_hr_time_format" android:format24Hour="@string/dream_time_complication_24_hr_time_format" diff --git a/packages/SystemUI/res/layout/qs_customize_panel_content.xml b/packages/SystemUI/res/layout/qs_customize_panel_content.xml index 3be99939ba0f..53af93295189 100644 --- a/packages/SystemUI/res/layout/qs_customize_panel_content.xml +++ b/packages/SystemUI/res/layout/qs_customize_panel_content.xml @@ -56,10 +56,4 @@ android:importantForAccessibility="auto" /> </com.android.keyguard.AlphaOptimizedLinearLayout> - <View - android:id="@+id/nav_bar_background" - android:layout_width="match_parent" - android:layout_height="@dimen/navigation_bar_size" - android:layout_gravity="bottom" - android:background="#ff000000" /> </merge> diff --git a/packages/SystemUI/res/layout/tri_state_dialog.xml b/packages/SystemUI/res/layout/tri_state_dialog.xml new file mode 100644 index 000000000000..cf3890d59a88 --- /dev/null +++ b/packages/SystemUI/res/layout/tri_state_dialog.xml @@ -0,0 +1,60 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2019 CypherOS + + 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. +--> +<LinearLayout + xmlns:android="http://schemas.android.com/apk/res/android" + android:paddingLeft="@dimen/tri_state_dialog_padding" + android:paddingTop="@dimen/tri_state_dialog_padding" + android:paddingRight="@dimen/tri_state_dialog_padding" + android:paddingBottom="@dimen/tri_state_dialog_padding" + android:clipToPadding="false" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentTop="true"> + + <LinearLayout + android:layout_gravity="center|right" + android:orientation="horizontal" + android:id="@+id/tri_state_layout" + android:background="@drawable/dialog_tri_state_middle_bg" + android:layout_width="wrap_content" + android:layout_height="48.0dip" + android:translationZ="@dimen/tri_state_dialog_elevation"> + + <FrameLayout + android:layout_width="54.0dip" + android:layout_height="fill_parent"> + + <ImageView + android:layout_gravity="center" + android:id="@+id/tri_state_icon" + android:layout_marginLeft="2.0dip" + android:layout_width="@dimen/tri_state_dialog_icon_size" + android:layout_height="@dimen/tri_state_dialog_icon_size" /> + </FrameLayout> + + <TextView + android:gravity="center_vertical" + android:id="@+id/tri_state_text" + android:layout_width="wrap_content" + android:layout_height="fill_parent" + style="@style/TriStateUiText" /> + + <FrameLayout + android:layout_width="18.0dip" + android:layout_height="fill_parent" /> + </LinearLayout> +</LinearLayout>
\ No newline at end of file diff --git a/packages/SystemUI/res/layout/tuner_activity.xml b/packages/SystemUI/res/layout/tuner_activity.xml index 83cbf14edd39..7e91267d7ae6 100644 --- a/packages/SystemUI/res/layout/tuner_activity.xml +++ b/packages/SystemUI/res/layout/tuner_activity.xml @@ -20,13 +20,6 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> - <Toolbar - android:id="@+id/action_bar" - style="?android:attr/actionBarStyle" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:theme="?android:attr/actionBarTheme" - android:navigationContentDescription="@*android:string/action_bar_up_description" /> <FrameLayout android:id="@+id/content_frame" android:layout_width="match_parent" diff --git a/packages/SystemUI/res/layout/udfps_view.xml b/packages/SystemUI/res/layout/udfps_view.xml index 257d238f5c54..0fcbfa161ddf 100644 --- a/packages/SystemUI/res/layout/udfps_view.xml +++ b/packages/SystemUI/res/layout/udfps_view.xml @@ -28,4 +28,10 @@ android:layout_width="match_parent" android:layout_height="match_parent"/> + <com.android.systemui.biometrics.UdfpsSurfaceView + android:id="@+id/hbm_view" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:visibility="invisible"/> + </com.android.systemui.biometrics.UdfpsView> diff --git a/packages/SystemUI/res/layout/volume_dialog.xml b/packages/SystemUI/res/layout/volume_dialog.xml index 6a192d4b7e05..ffbb63bea855 100644 --- a/packages/SystemUI/res/layout/volume_dialog.xml +++ b/packages/SystemUI/res/layout/volume_dialog.xml @@ -21,18 +21,17 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="right" - android:layout_gravity="right" android:clipToPadding="false" android:theme="@style/volume_dialog_theme"> <!-- right-aligned to be physically near volume button --> - <LinearLayout + <com.android.systemui.animation.view.LaunchableLinearLayout android:id="@+id/volume_dialog" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="right" - android:layout_gravity="right" - android:layout_marginRight="@dimen/volume_dialog_panel_transparent_padding_right" + android:layout_marginLeft="@dimen/volume_dialog_panel_transparent_padding_horizontal" + android:layout_marginRight="@dimen/volume_dialog_panel_transparent_padding_horizontal" android:orientation="vertical" android:clipToPadding="false" android:clipChildren="false"> @@ -54,7 +53,6 @@ android:layout_height="@dimen/volume_dialog_ringer_size" android:layout_marginBottom="@dimen/volume_dialog_spacer" android:gravity="right" - android:layout_gravity="right" android:translationZ="@dimen/volume_dialog_elevation" android:clipToPadding="false" android:background="@drawable/rounded_bg_full"> @@ -82,7 +80,6 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="right" - android:layout_gravity="right" android:orientation="vertical" android:clipChildren="false" android:clipToPadding="false" > @@ -98,13 +95,12 @@ android:id="@+id/settings_container" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:background="@drawable/volume_background_bottom" + android:background="@drawable/volume_background" android:paddingLeft="@dimen/volume_dialog_ringer_rows_padding" - android:paddingBottom="@dimen/volume_dialog_ringer_rows_padding" android:paddingRight="@dimen/volume_dialog_ringer_rows_padding"> <com.android.keyguard.AlphaOptimizedImageButton android:id="@+id/settings" - android:src="@drawable/horizontal_ellipsis" + android:src="@drawable/ic_speaker_group_24dp" android:layout_width="@dimen/volume_dialog_tap_target_size" android:layout_height="@dimen/volume_dialog_tap_target_size" android:layout_gravity="center" @@ -113,6 +109,38 @@ android:tint="?androidprv:attr/colorAccent" android:soundEffectsEnabled="false" /> </FrameLayout> + <FrameLayout + android:id="@+id/expandable_indicator_container" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:background="@drawable/volume_background_bottom" + android:paddingLeft="@dimen/volume_dialog_ringer_rows_padding" + android:paddingBottom="@dimen/volume_dialog_ringer_rows_padding" + android:paddingRight="@dimen/volume_dialog_ringer_rows_padding"> + <com.android.systemui.statusbar.phone.ExpandableIndicator + android:id="@+id/expandable_indicator" + android:layout_width="@dimen/volume_dialog_tap_target_size" + android:layout_height="@dimen/volume_dialog_tap_target_size" + android:layout_gravity="center" + android:contentDescription="@string/accessibility_volume_settings" + android:background="@drawable/ripple_drawable_20dp" + android:tint="?androidprv:attr/colorAccent" + android:soundEffectsEnabled="false" + android:padding="10dp" + android:rotation="90" /> + </FrameLayout> + <FrameLayout + android:id="@+id/rounded_border_bottom" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:background="@drawable/volume_background_bottom" + android:paddingLeft="@dimen/volume_dialog_ringer_rows_padding" + android:paddingRight="@dimen/volume_dialog_ringer_rows_padding"> + <View + android:layout_width="0dp" + android:layout_height="32dp" + android:background="@drawable/ripple_drawable_20dp"/> + </FrameLayout> </LinearLayout> </LinearLayout> @@ -123,7 +151,6 @@ android:layout_height="@dimen/volume_dialog_caption_size" android:layout_marginTop="@dimen/volume_dialog_row_margin_bottom" android:gravity="right" - android:layout_gravity="right" android:clipToPadding="false" android:clipToOutline="true" android:background="@drawable/volume_row_rounded_background"> @@ -137,7 +164,7 @@ android:layout_gravity="center" android:soundEffectsEnabled="false"/> </FrameLayout> - </LinearLayout> + </com.android.systemui.animation.view.LaunchableLinearLayout> <ViewStub android:id="@+id/odi_captions_tooltip_stub" @@ -145,7 +172,8 @@ android:layout="@layout/volume_tool_tip_view" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_gravity="bottom | right" - android:layout_marginRight="@dimen/volume_tool_tip_right_margin"/> + android:layout_gravity="bottom" + android:layout_marginLeft="@dimen/volume_tool_tip_horizontal_margin" + android:layout_marginRight="@dimen/volume_tool_tip_horizontal_margin"/> </FrameLayout>
\ No newline at end of file diff --git a/packages/SystemUI/res/values/config.xml b/packages/SystemUI/res/values/config.xml index 4fc98b48bfde..e4bdb180aa19 100644 --- a/packages/SystemUI/res/values/config.xml +++ b/packages/SystemUI/res/values/config.xml @@ -91,7 +91,7 @@ <!-- Tiles native to System UI. Order should match "quick_settings_tiles_default" --> <string name="quick_settings_tiles_stock" translatable="false"> - internet,bt,flashlight,dnd,alarm,airplane,controls,wallet,rotation,battery,cast,screenrecord,mictoggle,cameratoggle,location,hotspot,inversion,saver,dark,work,night,reverse,reduce_brightness,qr_code_scanner,onehanded,color_correction,dream,font_scaling + internet,bt,flashlight,dnd,alarm,airplane,nfc,controls,wallet,rotation,battery,cast,screenrecord,mictoggle,cameratoggle,location,hotspot,inversion,saver,dark,work,night,reverse,reduce_brightness,qr_code_scanner,onehanded,color_correction,dream,font_scaling,aod,caffeine,heads_up </string> <!-- The tiles to display in QuickSettings --> diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index 44a5c07502ac..85a9b3c0839e 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -485,7 +485,7 @@ <dimen name="brightness_mirror_height">48dp</dimen> - <dimen name="volume_dialog_panel_transparent_padding_right">8dp</dimen> + <dimen name="volume_dialog_panel_transparent_padding_horizontal">8dp</dimen> <dimen name="volume_dialog_panel_transparent_padding">20dp</dimen> @@ -524,7 +524,7 @@ <dimen name="volume_dialog_background_blur_radius">0dp</dimen> - <dimen name="volume_tool_tip_right_margin">76dp</dimen> + <dimen name="volume_tool_tip_horizontal_margin">76dp</dimen> <dimen name="volume_tool_tip_arrow_corner_radius">2dp</dimen> diff --git a/packages/SystemUI/res/values/ice_config.xml b/packages/SystemUI/res/values/ice_config.xml new file mode 100644 index 000000000000..563d63f7ac2a --- /dev/null +++ b/packages/SystemUI/res/values/ice_config.xml @@ -0,0 +1,22 @@ +<!-- + Copyright (C) 2022 Project ICE + + 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. +--> +<resources> + <!-- Color of the UDFPS pressed view --> + <color name="config_udfpsColor">#ffffffff</color> + + <!-- Allow devices override audio panel location to the left side --> + <bool name="config_audioPanelOnLeftSide">false</bool> +</resources> diff --git a/packages/SystemUI/res/values/ice_dimens.xml b/packages/SystemUI/res/values/ice_dimens.xml new file mode 100644 index 000000000000..f81dc4ae7797 --- /dev/null +++ b/packages/SystemUI/res/values/ice_dimens.xml @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2022 Project ICE + + 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. +--> +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <!-- Alert Slider --> + <dimen name="tri_state_down_dialog_position">0px</dimen> + <dimen name="tri_state_down_dialog_position_l">0px</dimen> + <dimen name="tri_state_middle_dialog_position">0px</dimen> + <dimen name="tri_state_middle_dialog_position_l">0px</dimen> + <dimen name="tri_state_up_dialog_position">0px</dimen> + <dimen name="tri_state_up_dialog_position_l">0px</dimen> + <dimen name="tri_state_up_dialog_position_deep">0px</dimen> + <dimen name="tri_state_up_dialog_position_deep_land">0px</dimen> + <dimen name="tri_state_dialog_elevation">4.0dip</dimen> + <dimen name="tri_state_dialog_icon_size">24.0dip</dimen> + <dimen name="tri_state_dialog_padding">8.0dip</dimen> + <dimen name="tri_state_down_bottom_left_radius">24.0dip</dimen> + <dimen name="tri_state_down_bottom_right_radius">24.0dip</dimen> + <dimen name="tri_state_down_top_left_radius">24.0dip</dimen> + <dimen name="tri_state_down_top_right_radius">0.0dip</dimen> + <dimen name="tri_state_mid_bottom_left_radius">24.0dip</dimen> + <dimen name="tri_state_mid_bottom_right_radius">24.0dip</dimen> + <dimen name="tri_state_mid_top_left_radius">24.0dip</dimen> + <dimen name="tri_state_mid_top_right_radius">24.0dip</dimen> + <dimen name="tri_state_up_bottom_left_radius">24.0dip</dimen> + <dimen name="tri_state_up_bottom_right_radius">0.0dip</dimen> + <dimen name="tri_state_up_top_left_radius">24.0dip</dimen> + <dimen name="tri_state_up_top_right_radius">24.0dip</dimen> +</resources> diff --git a/packages/SystemUI/res/values/ice_strings.xml b/packages/SystemUI/res/values/ice_strings.xml new file mode 100644 index 000000000000..66948283c9bc --- /dev/null +++ b/packages/SystemUI/res/values/ice_strings.xml @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2008 The Android Open Source Project + Copyright (C) 2022 Project ICE + + 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. +--> +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <!-- Status bar - icons --> + <string name="status_bar_icons_title">Status bar icons</string> + <string name="status_bar_vpn">VPN</string> + + <!-- Label for area where tiles can be added to the qs panel --> + <string name="drag_or_tap_to_add_tiles">Hold & drag or tap to add tiles</string> + + <!-- Custom QS tiles --> + <!-- AOD QS tile --> + <string name="quick_settings_aod_label">AOD</string> + <string name="quick_settings_aod_off_powersave_label">AOD off\nBattery saver</string> + + <!-- Caffeine QS tile --> + <string name="quick_settings_caffeine_label">Caffeine</string> + <string name="accessibility_quick_settings_caffeine_off">Caffeine off.</string> + <string name="accessibility_quick_settings_caffeine_on">Caffeine on.</string> + + <!-- Heads up QS tile --> + <string name="quick_settings_heads_up_label">Heads up</string> + <string name="accessibility_quick_settings_heads_up_off">Heads up off.</string> + <string name="accessibility_quick_settings_heads_up_on">Heads up on.</string> +</resources> diff --git a/packages/SystemUI/res/values/ice_styles.xml b/packages/SystemUI/res/values/ice_styles.xml new file mode 100644 index 000000000000..652258a68746 --- /dev/null +++ b/packages/SystemUI/res/values/ice_styles.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2022 Project ICE + + 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. +--> +<resources> + <!-- Alert Slider --> + <style name="TriStateUiText"> + <item name="android:textSize">11.0sp</item> + <item name="android:fontFamily">sans-serif-medium</item> + </style> +</resources> diff --git a/packages/SystemUI/res/values/styles.xml b/packages/SystemUI/res/values/styles.xml index 5fcde457b09d..a7ef869929de 100644 --- a/packages/SystemUI/res/values/styles.xml +++ b/packages/SystemUI/res/values/styles.xml @@ -134,7 +134,6 @@ <style name="TextAppearance.QS.TileLabel"> <item name="android:textSize">@dimen/qs_tile_text_size</item> - <item name="android:letterSpacing">0.01</item> <item name="android:lineHeight">20sp</item> <item name="android:fontFamily">@*android:string/config_bodyFontFamilyMedium</item> </style> @@ -154,7 +153,6 @@ <item name="android:fontFamily">@*android:string/config_headlineFontFamily</item> <item name="android:textColor">?android:attr/textColorPrimary</item> <item name="android:textSize">14sp</item> - <item name="android:letterSpacing">0.01</item> </style> <style name="TextAppearance.QS.SecurityFooter" parent="@style/TextAppearance.QS.Status"> @@ -610,7 +608,6 @@ <style name="TextAppearance.QSEdit" > <item name="android:textSize">14sp</item> - <item name="android:letterSpacing">0.01</item> <item name="android:lineHeight">20sp</item> <item name="android:fontFamily">@*android:string/config_headlineFontFamily</item> <item name="android:textColor">?android:attr/textColorSecondary</item> diff --git a/packages/SystemUI/res/xml/status_bar_prefs.xml b/packages/SystemUI/res/xml/status_bar_prefs.xml new file mode 100644 index 000000000000..6f4c5bcf10b7 --- /dev/null +++ b/packages/SystemUI/res/xml/status_bar_prefs.xml @@ -0,0 +1,131 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2015 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. +--> +<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:sysui="http://schemas.android.com/apk/res-auto" + android:key="status_bar" + android:title="@string/status_bar"> + + <com.android.systemui.tuner.StatusBarSwitch + android:icon="@drawable/ic_statusbar_auto_rotate" + android:key="rotate" + android:title="@string/status_bar_settings_auto_rotation" /> + + <com.android.systemui.tuner.StatusBarSwitch + android:icon="@drawable/ic_statusbar_headset" + android:key="headset" + android:title="@string/headset" /> + + <com.android.systemui.tuner.StatusBarSwitch + android:icon="@drawable/ic_statusbar_work" + android:key="managed_profile" + android:title="@string/status_bar_work" /> + + <!-- ime --> + <!-- sync_failing --> + <!-- sync_active --> + + <com.android.systemui.tuner.StatusBarSwitch + android:icon="@drawable/ic_statusbar_cast" + android:key="cast" + android:title="@string/quick_settings_cast_title" /> + + <com.android.systemui.tuner.StatusBarSwitch + android:icon="@drawable/ic_statusbar_hotspot" + android:key="hotspot" + android:title="@string/quick_settings_hotspot_label" /> + + <com.android.systemui.tuner.StatusBarSwitch + android:icon="@*android:drawable/ic_qs_bluetooth" + android:key="bluetooth" + android:title="@string/quick_settings_bluetooth_label" /> + + <com.android.systemui.tuner.StatusBarSwitch + android:icon="@drawable/ic_statusbar_camera" + android:key="cameratoggle" + android:title="@string/quick_settings_camera_label" /> + + <!-- nfc --> + <!-- tty --> + <!-- speakerphone --> + + <com.android.systemui.tuner.StatusBarSwitch + android:icon="@drawable/ic_statusbar_do_not_disturb" + android:key="zen" + android:title="@string/quick_settings_dnd_label" /> + + <com.android.systemui.tuner.StatusBarSwitch + android:icon="@drawable/ic_statusbar_mute" + android:key="mute" + android:title="@string/volume_ringer_status_silent" /> + + <com.android.systemui.tuner.StatusBarSwitch + android:icon="@drawable/ic_statusbar_vibrate" + android:key="volume" + android:title="@string/volume_ringer_status_vibrate" /> + + <com.android.systemui.tuner.StatusBarSwitch + android:icon="@drawable/ic_statusbar_wifi" + android:key="wifi" + android:title="@string/quick_settings_wifi_label" /> + + <com.android.systemui.tuner.StatusBarSwitch + android:icon="@drawable/ic_statusbar_ethernet" + android:key="ethernet" + android:title="@string/status_bar_ethernet" /> + + <com.android.systemui.tuner.StatusBarSwitch + android:icon="@drawable/ic_statusbar_mobile_network" + android:key="mobile" + android:title="@string/quick_settings_cellular_detail_title" /> + + <com.android.systemui.tuner.StatusBarSwitch + android:icon="@drawable/ic_statusbar_airplanemode" + android:key="airplane" + android:title="@string/status_bar_airplane" /> + + <com.android.systemui.tuner.StatusBarSwitch + android:icon="@drawable/ic_vpn_key" + android:key="vpn" + android:title="@string/status_bar_vpn" /> + + <!-- other weird signal stuff --> + + <com.android.systemui.tuner.BatteryPreference + android:icon="@*android:drawable/ic_battery" + android:title="@string/battery" + android:summary="%s" + android:entries="@array/battery_options" /> + + <com.android.systemui.tuner.StatusBarSwitch + android:icon="@drawable/ic_statusbar_alarm" + android:key="alarm_clock" + android:title="@string/status_bar_alarm" /> + + <!-- secure --> + + <com.android.systemui.tuner.ClockPreference + android:icon="@drawable/ic_statusbar_clock" + android:title="@string/tuner_time" + android:summary="%s" + android:entries="@array/clock_options" /> + + <com.android.systemui.tuner.TunerSwitch + android:icon="@drawable/ic_statusbar_priority" + android:key="low_priority" + android:title="@string/tuner_low_priority" + sysui:defValue="false" /> + +</PreferenceScreen> diff --git a/packages/SystemUI/res/xml/tuner_prefs.xml b/packages/SystemUI/res/xml/tuner_prefs.xml index 902de23a9e2a..aab0b1e8ab51 100644 --- a/packages/SystemUI/res/xml/tuner_prefs.xml +++ b/packages/SystemUI/res/xml/tuner_prefs.xml @@ -20,94 +20,8 @@ <PreferenceScreen android:key="status_bar" - android:title="@string/status_bar" > - - <com.android.systemui.tuner.StatusBarSwitch - android:key="rotate" - android:title="@string/status_bar_settings_auto_rotation" /> - - <com.android.systemui.tuner.StatusBarSwitch - android:key="headset" - android:title="@string/headset" /> - - <com.android.systemui.tuner.StatusBarSwitch - android:key="managed_profile" - android:title="@string/status_bar_work" /> - - <!-- ime --> - <!-- sync_failing --> - <!-- sync_active --> - - <com.android.systemui.tuner.StatusBarSwitch - android:key="cast" - android:title="@string/quick_settings_cast_title" /> - - <com.android.systemui.tuner.StatusBarSwitch - android:key="hotspot" - android:title="@string/quick_settings_hotspot_label" /> - - <com.android.systemui.tuner.StatusBarSwitch - android:key="bluetooth" - android:title="@string/quick_settings_bluetooth_label" /> - - <com.android.systemui.tuner.StatusBarSwitch - android:key="cameratoggle" - android:title="@string/quick_settings_camera_label" /> - - <!-- nfc --> - <!-- tty --> - <!-- speakerphone --> - - <com.android.systemui.tuner.StatusBarSwitch - android:key="zen" - android:title="@string/quick_settings_dnd_label" /> - - <!-- mute --> - - <com.android.systemui.tuner.StatusBarSwitch - android:key="volume" - android:title="@*android:string/volume_unknown" /> - - <com.android.systemui.tuner.StatusBarSwitch - android:key="wifi" - android:title="@string/quick_settings_wifi_label" /> - - <com.android.systemui.tuner.StatusBarSwitch - android:key="ethernet" - android:title="@string/status_bar_ethernet" /> - - <com.android.systemui.tuner.StatusBarSwitch - android:key="mobile" - android:title="@string/quick_settings_cellular_detail_title" /> - - <com.android.systemui.tuner.StatusBarSwitch - android:key="airplane" - android:title="@string/status_bar_airplane" /> - - <!-- other weird signal stuff --> - - <com.android.systemui.tuner.BatteryPreference - android:title="@string/battery" - android:summary="%s" - android:entries="@array/battery_options" /> - - <com.android.systemui.tuner.StatusBarSwitch - android:key="alarm_clock" - android:title="@string/status_bar_alarm" /> - - <!-- secure --> - - <com.android.systemui.tuner.ClockPreference - android:title="@string/tuner_time" - android:summary="%s" - android:entries="@array/clock_options" /> - - <com.android.systemui.tuner.TunerSwitch - android:key="low_priority" - android:title="@string/tuner_low_priority" - sysui:defValue="false" /> - - </PreferenceScreen> + android:title="@string/status_bar" + android:fragment="com.android.systemui.tuner.StatusBarTuner" /> <PreferenceScreen android:key="volume_and_do_not_disturb" diff --git a/packages/SystemUI/src/com/android/keyguard/CarrierTextController.java b/packages/SystemUI/src/com/android/keyguard/CarrierTextController.java index eb75a00dc5a2..33f9ecd03bca 100644 --- a/packages/SystemUI/src/com/android/keyguard/CarrierTextController.java +++ b/packages/SystemUI/src/com/android/keyguard/CarrierTextController.java @@ -16,13 +16,8 @@ package com.android.keyguard; -import android.content.res.Configuration; -import android.telephony.TelephonyManager; - import com.android.systemui.util.ViewController; -import java.util.Locale; - import javax.inject.Inject; /** @@ -31,7 +26,6 @@ import javax.inject.Inject; public class CarrierTextController extends ViewController<CarrierText> { private final CarrierTextManager mCarrierTextManager; private final KeyguardUpdateMonitor mKeyguardUpdateMonitor; - private Locale mLocale; private final CarrierTextManager.CarrierTextCallback mCarrierTextCallback = new CarrierTextManager.CarrierTextCallback() { @Override @@ -62,8 +56,6 @@ public class CarrierTextController extends ViewController<CarrierText> { .setDebugLocationString(mView.getDebugLocation()) .build(); mKeyguardUpdateMonitor = keyguardUpdateMonitor; - mView.setOnConfigurationChangedListener(this::refreshInfoIfNeeded); - mLocale = mView.getResources().getConfiguration().locale; } @Override @@ -81,13 +73,4 @@ public class CarrierTextController extends ViewController<CarrierText> { protected void onViewDetached() { mCarrierTextManager.setListening(null); } - - private void refreshInfoIfNeeded(Configuration newConfig) { - if (mLocale != newConfig.locale) { - mCarrierTextManager.loadCarrierMap(); - mCarrierTextManager.updateCarrierText(); - mLocale = newConfig.locale; - } - - } } diff --git a/packages/SystemUI/src/com/android/keyguard/CarrierTextManager.java b/packages/SystemUI/src/com/android/keyguard/CarrierTextManager.java index 16b26028d728..b52ee01bfa61 100644 --- a/packages/SystemUI/src/com/android/keyguard/CarrierTextManager.java +++ b/packages/SystemUI/src/com/android/keyguard/CarrierTextManager.java @@ -14,12 +14,6 @@ * limitations under the License. */ -/** - * Changes from Qualcomm Innovation Center are provided under the following license: - * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. - * SPDX-License-Identifier: BSD-3-Clause-Clear - */ - package com.android.keyguard; import static com.android.keyguard.logging.CarrierTextManagerLogger.REASON_ACTIVE_DATA_SUB_CHANGED; @@ -50,10 +44,7 @@ import com.android.systemui.dagger.qualifiers.Background; import com.android.systemui.dagger.qualifiers.Main; import com.android.systemui.keyguard.WakefulnessLifecycle; import com.android.systemui.statusbar.pipeline.wifi.data.repository.WifiRepository; -import com.android.systemui.statusbar.policy.FiveGServiceClient; -import com.android.systemui.statusbar.policy.FiveGServiceClient.FiveGServiceState; import com.android.systemui.telephony.TelephonyListenerManager; -import com.android.systemui.util.CarrierNameCustomization; import java.util.Arrays; import java.util.List; @@ -109,8 +100,7 @@ public class CarrierTextManager { if (callback != null) callback.startedGoingToSleep(); } }; - private FiveGServiceClient mFiveGServiceClient; - private CarrierNameCustomization mCarrierNameCustomization; + @VisibleForTesting protected final KeyguardUpdateMonitorCallback mCallback = new KeyguardUpdateMonitorCallback() { @Override @@ -191,8 +181,8 @@ public class CarrierTextManager { @Main Executor mainExecutor, @Background Executor bgExecutor, KeyguardUpdateMonitor keyguardUpdateMonitor, - CarrierTextManagerLogger logger, - CarrierNameCustomization carrierNameCustomization) { + CarrierTextManagerLogger logger) { + mContext = context; mIsEmergencyCallCapable = telephonyManager.isVoiceCapable(); @@ -218,7 +208,6 @@ public class CarrierTextManager { handleSetListening(mCarrierTextCallback); } }); - mCarrierNameCustomization = carrierNameCustomization; } private TelephonyManager getTelephonyManager() { @@ -318,19 +307,15 @@ public class CarrierTextManager { return mKeyguardUpdateMonitor.getFilteredSubscriptionInfo(); } - public void updateCarrierText() { + protected void updateCarrierText() { Trace.beginSection("CarrierTextManager#updateCarrierText"); boolean allSimsMissing = true; boolean anySimReadyAndInService = false; - boolean missingSimsWithSubs = false; - boolean showCustomizeName = getContext().getResources().getBoolean( - com.android.systemui.R.bool.config_show_customize_carrier_name); CharSequence displayText = null; List<SubscriptionInfo> subs = getSubscriptionInfo(); final int numSubs = subs.size(); final int[] subsIds = new int[numSubs]; - if (DEBUG) Log.d(TAG, "updateCarrierText(): " + numSubs); // This array will contain in position i, the index of subscription in slot ID i. // -1 if no subscription in that slot final int[] subOrderBySlot = new int[mSimSlotsNumber]; @@ -347,14 +332,6 @@ public class CarrierTextManager { subOrderBySlot[subs.get(i).getSimSlotIndex()] = i; int simState = mKeyguardUpdateMonitor.getSimState(subId); CharSequence carrierName = subs.get(i).getCarrierName(); - if (showCustomizeName) { - if (mCarrierNameCustomization.isRoamingCustomizationEnabled() - && mCarrierNameCustomization.isRoaming(subId)) { - carrierName = mCarrierNameCustomization.getRoamingCarrierName(subId); - } else { - carrierName = getCustomizeCarrierName(carrierName, subs.get(i)); - } - } CharSequence carrierTextForSimState = getCarrierTextForSimState(simState, carrierName); mLogger.logUpdateLoopStart(subId, simState, String.valueOf(carrierName)); if (carrierTextForSimState != null) { @@ -580,7 +557,6 @@ public class CarrierTextManager { return CarrierTextManager.StatusMode.SimLocked; case TelephonyManager.SIM_STATE_PUK_REQUIRED: return CarrierTextManager.StatusMode.SimPukLocked; - case TelephonyManager.SIM_STATE_LOADED: case TelephonyManager.SIM_STATE_READY: return CarrierTextManager.StatusMode.Normal; case TelephonyManager.SIM_STATE_PERM_DISABLED: @@ -681,7 +657,6 @@ public class CarrierTextManager { private boolean mShowAirplaneMode; private boolean mShowMissingSim; private String mDebugLocation; - private CarrierNameCustomization mCarrierNameCustomization; @Inject public Builder( @@ -694,8 +669,7 @@ public class CarrierTextManager { @Main Executor mainExecutor, @Background Executor bgExecutor, KeyguardUpdateMonitor keyguardUpdateMonitor, - CarrierTextManagerLogger logger, - CarrierNameCustomization carrierNameCustomization) { + CarrierTextManagerLogger logger) { mContext = context; mSeparator = resources.getString( com.android.internal.R.string.kg_text_message_separator); @@ -707,7 +681,6 @@ public class CarrierTextManager { mBgExecutor = bgExecutor; mKeyguardUpdateMonitor = keyguardUpdateMonitor; mLogger = logger; - mCarrierNameCustomization = carrierNameCustomization; } /** */ @@ -737,7 +710,7 @@ public class CarrierTextManager { return new CarrierTextManager( mContext, mSeparator, mShowAirplaneMode, mShowMissingSim, mWifiRepository, mTelephonyManager, mTelephonyListenerManager, mWakefulnessLifecycle, - mMainExecutor, mBgExecutor, mKeyguardUpdateMonitor, mLogger, mCarrierNameCustomization); + mMainExecutor, mBgExecutor, mKeyguardUpdateMonitor, mLogger); } } @@ -798,123 +771,4 @@ public class CarrierTextManager { */ default void finishedWakingUp() {}; } - - private String getCustomizeCarrierName(CharSequence originCarrierName, - SubscriptionInfo sub) { - StringBuilder newCarrierName = new StringBuilder(); - int networkType = getNetworkType(sub.getSubscriptionId()); - String networkClass = networkTypeToString(networkType); - - String fiveGNetworkClass = get5GNetworkClass(sub, networkType); - if ( fiveGNetworkClass != null ) { - networkClass = fiveGNetworkClass; - } - - if (!TextUtils.isEmpty(originCarrierName)) { - String[] names = originCarrierName.toString().split(mSeparator.toString(), 2); - for (int j = 0; j < names.length; j++) { - names[j] = getLocalString( - names[j], com.android.systemui.R.array.origin_carrier_names, - com.android.systemui.R.array.locale_carrier_names); - if (!TextUtils.isEmpty(names[j])) { - if (!TextUtils.isEmpty(networkClass)) { - names[j] = new StringBuilder().append(names[j]).append(" ") - .append(networkClass).toString(); - } - if (j > 0 && names[j].equals(names[j - 1])) { - continue; - } - if (j > 0) { - newCarrierName.append(mSeparator); - } - newCarrierName.append(names[j]); - } - } - } - return newCarrierName.toString(); - } - - /** - * parse the string to current language. - * - * @param originalString original string - * @param originNamesId the id of the original string array. - * @param localNamesId the id of the local string keys. - * @return local language string - */ - private String getLocalString(String originalString, - int originNamesId, int localNamesId) { - String[] origNames = getContext().getResources().getStringArray(originNamesId); - String[] localNames = getContext().getResources().getStringArray(localNamesId); - for (int i = 0; i < origNames.length; i++) { - if (origNames[i].equalsIgnoreCase(originalString)) { - return localNames[i]; - } - } - return originalString; - } - - private int getNetworkType(int subId) { - int networkType = TelephonyManager.NETWORK_TYPE_UNKNOWN; - ServiceState ss = mKeyguardUpdateMonitor.mServiceStates.get(subId); - if (ss != null && (ss.getDataRegState() == ServiceState.STATE_IN_SERVICE - || ss.getVoiceRegState() == ServiceState.STATE_IN_SERVICE)) { - networkType = ss.getDataNetworkType(); - if (networkType == TelephonyManager.NETWORK_TYPE_UNKNOWN) { - networkType = ss.getVoiceNetworkType(); - } - } - return networkType; - } - - private String networkTypeToString(int networkType) { - int classId = com.android.systemui.R.string.config_rat_unknown; - long mask = TelephonyManager.getBitMaskForNetworkType(networkType); - if ((mask & TelephonyManager.NETWORK_CLASS_BITMASK_2G) != 0) { - classId = com.android.systemui.R.string.config_rat_2g; - } else if ((mask & TelephonyManager.NETWORK_CLASS_BITMASK_3G) != 0) { - classId = com.android.systemui.R.string.config_rat_3g; - } else if ((mask & TelephonyManager.NETWORK_CLASS_BITMASK_4G) != 0) { - classId = com.android.systemui.R.string.config_rat_4g; - } - return getContext().getResources().getString(classId); - } - - - private String get5GNetworkClass(SubscriptionInfo sub, int networkType) { - if ( networkType == TelephonyManager.NETWORK_TYPE_NR ) { - return mContext.getResources().getString(R.string.data_connection_5g); - } - - int slotIndex = sub.getSimSlotIndex(); - int subId = sub.getSubscriptionId(); - - if ( mFiveGServiceClient == null ) { - mFiveGServiceClient = FiveGServiceClient.getInstance(mContext); - mFiveGServiceClient.registerCallback(mCallback); - } - FiveGServiceState fiveGServiceState = - mFiveGServiceClient.getCurrentServiceState(slotIndex); - if ( fiveGServiceState.isNrIconTypeValid() && isDataRegisteredOnLte(subId)) { - return mContext.getResources().getString(R.string.data_connection_5g); - } - - return null; - } - - private boolean isDataRegisteredOnLte(int subId) { - TelephonyManager telephonyManager = (TelephonyManager) - mContext.getSystemService(Context.TELEPHONY_SERVICE); - int dataType = telephonyManager.getDataNetworkType(subId); - if ( dataType == TelephonyManager.NETWORK_TYPE_LTE || - dataType == TelephonyManager.NETWORK_TYPE_LTE_CA) { - return true; - }else{ - return false; - } - } - - public void loadCarrierMap() { - mCarrierNameCustomization.loadCarrierMap(getContext()); - } } diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitch.java b/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitch.java index ca4f2d389703..ae0a639cdfe0 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitch.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitch.java @@ -8,12 +8,14 @@ import static android.view.View.TRANSLATION_Y; import static com.android.keyguard.KeyguardStatusAreaView.TRANSLATE_X_CLOCK_DESIGN; import static com.android.keyguard.KeyguardStatusAreaView.TRANSLATE_Y_CLOCK_DESIGN; import static com.android.keyguard.KeyguardStatusAreaView.TRANSLATE_Y_CLOCK_SIZE; +import static com.android.systemui.shared.recents.utilities.Utilities.isLargeScreen; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.AnimatorSet; import android.animation.ObjectAnimator; import android.content.Context; +import android.content.res.Configuration; import android.graphics.Canvas; import android.graphics.Rect; import android.util.AttributeSet; @@ -128,6 +130,18 @@ public class KeyguardClockSwitch extends RelativeLayout { super(context, attrs); } + @Override + public void onConfigurationChanged(Configuration newConfig) { + super.onConfigurationChanged(newConfig); + + if (mDisplayedClockSize != null) { + boolean landscape = newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE; + boolean useLargeClock = mDisplayedClockSize == LARGE && + (!landscape || isLargeScreen(mContext)); + updateClockViews(useLargeClock, /* animate */ true); + } + } + /** * Apply dp changes on configuration change */ @@ -376,11 +390,14 @@ public class KeyguardClockSwitch extends RelativeLayout { if (mDisplayedClockSize != null && clockSize == mDisplayedClockSize) { return false; } + boolean landscape = getResources().getConfiguration().orientation + == Configuration.ORIENTATION_LANDSCAPE; + boolean useLargeClock = clockSize == LARGE && (!landscape || isLargeScreen(mContext)); // let's make sure clock is changed only after all views were laid out so we can // translate them properly if (mChildrenAreLaidOut) { - updateClockViews(clockSize == LARGE, animate); + updateClockViews(useLargeClock, animate); } mDisplayedClockSize = clockSize; diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java index bfca5d35156e..336eb82ca62d 100755 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java @@ -2480,7 +2480,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab // Take a guess at initial SIM state, battery status and PLMN until we get an update mBatteryStatus = new BatteryStatus(BATTERY_STATUS_UNKNOWN, /* level= */ 100, /* plugged= */ - 0, CHARGING_POLICY_DEFAULT, /* maxChargingWattage= */0, /* present= */true); + 0, CHARGING_POLICY_DEFAULT, /* maxChargingWattage= */0, false, /* present= */true); // Watch for interesting updates final IntentFilter filter = new IntentFilter(); @@ -3926,6 +3926,11 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab return true; } + // change in oem fast charging while plugged in + if (nowPluggedIn && current.oemFastChargeStatus != old.oemFastChargeStatus) { + return true; + } + // change in battery is present or not if (old.present != current.present) { return true; diff --git a/packages/SystemUI/src/com/android/keyguard/PasswordTextView.java b/packages/SystemUI/src/com/android/keyguard/PasswordTextView.java index 8e8ee48aba83..f87ccf51a8ac 100644 --- a/packages/SystemUI/src/com/android/keyguard/PasswordTextView.java +++ b/packages/SystemUI/src/com/android/keyguard/PasswordTextView.java @@ -30,6 +30,7 @@ import android.graphics.Rect; import android.graphics.Typeface; import android.os.PowerManager; import android.os.SystemClock; +import android.provider.Settings; import android.text.InputType; import android.text.TextUtils; import android.util.AttributeSet; @@ -448,7 +449,9 @@ public class PasswordTextView extends FrameLayout { * Controls whether the last entered digit is briefly shown after being entered */ public void setShowPassword(boolean enabled) { - mShowPassword = enabled; + mShowPassword = enabled && + Settings.System.getInt(mContext.getContentResolver(), + Settings.System.TEXT_SHOW_PASSWORD, 1) == 1; } private class CharState { diff --git a/packages/SystemUI/src/com/android/systemui/SystemUIService.java b/packages/SystemUI/src/com/android/systemui/SystemUIService.java index 50e03992df49..9f131446217d 100644 --- a/packages/SystemUI/src/com/android/systemui/SystemUIService.java +++ b/packages/SystemUI/src/com/android/systemui/SystemUIService.java @@ -83,7 +83,7 @@ public class SystemUIService extends Service { throw new RuntimeException(); } - if (Build.IS_DEBUGGABLE) { + if (Build.IS_ENG) { // b/71353150 - looking for leaked binder proxies BinderInternal.nSetBinderProxyCountEnabled(true); BinderInternal.nSetBinderProxyCountWatermarks(1000,900); diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/AuthRippleView.kt b/packages/SystemUI/src/com/android/systemui/biometrics/AuthRippleView.kt index 5ede16d221b7..7731e1108cd4 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/AuthRippleView.kt +++ b/packages/SystemUI/src/com/android/systemui/biometrics/AuthRippleView.kt @@ -29,6 +29,7 @@ import android.view.View import android.view.animation.PathInterpolator import com.android.internal.graphics.ColorUtils import com.android.app.animation.Interpolators +import com.android.settingslib.Utils import com.android.systemui.surfaceeffects.ripple.RippleShader private const val RIPPLE_SPARKLE_STRENGTH: Float = 0.3f @@ -89,7 +90,8 @@ class AuthRippleView(context: Context?, attrs: AttributeSet?) : View(context, at rippleShader.sparkleStrength = RIPPLE_SPARKLE_STRENGTH updateRippleFadeParams() ripplePaint.shader = rippleShader - setLockScreenColor(0xffffffff.toInt()) // default color + setLockScreenColor(Utils.getColorAttr(context, + android.R.attr.colorAccent).defaultColor) // default color dwellShader.color = 0xffffffff.toInt() // default color dwellShader.progress = 0f diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsSurfaceView.java b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsSurfaceView.java new file mode 100644 index 000000000000..2488132b508b --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsSurfaceView.java @@ -0,0 +1,159 @@ +/* + * Copyright (C) 2021 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. + */ + +package com.android.systemui.biometrics; + +import android.annotation.NonNull; +import android.annotation.Nullable; +import android.content.Context; +import android.graphics.drawable.Drawable; +import android.graphics.Canvas; +import android.graphics.Paint; +import android.graphics.PixelFormat; +import android.graphics.RectF; +import android.util.AttributeSet; +import android.util.Log; +import android.view.Surface; +import android.view.SurfaceHolder; +import android.view.SurfaceView; + +import com.android.systemui.R; + +/** + * Surface View for providing the Global High-Brightness Mode (GHBM) illumination for UDFPS. + */ +public class UdfpsSurfaceView extends SurfaceView implements SurfaceHolder.Callback { + private static final String TAG = "UdfpsSurfaceView"; + + /** + * Notifies {@link UdfpsView} when to enable GHBM illumination. + */ + interface GhbmIlluminationListener { + /** + * @param surface the surface for which GHBM should be enabled. + * @param onDisplayConfigured a runnable that should be run after GHBM is enabled. + */ + void enableGhbm(@NonNull Surface surface, @Nullable Runnable onDisplayConfigured); + } + + @NonNull private final SurfaceHolder mHolder; + @NonNull private final Paint mSensorPaint; + + @Nullable private GhbmIlluminationListener mGhbmIlluminationListener; + @Nullable private Runnable mOnDisplayConfigured; + boolean mAwaitingSurfaceToStartIllumination; + boolean mHasValidSurface; + + private Drawable mUdfpsIconPressed; + + public UdfpsSurfaceView(Context context, AttributeSet attrs) { + super(context, attrs); + + // Make this SurfaceView draw on top of everything else in this window. This allows us to + // 1) Always show the HBM circle on top of everything else, and + // 2) Properly composite this view with any other animations in the same window no matter + // what contents are added in which order to this view hierarchy. + setZOrderOnTop(true); + + mHolder = getHolder(); + mHolder.addCallback(this); + mHolder.setFormat(PixelFormat.RGBA_8888); + + mSensorPaint = new Paint(0 /* flags */); + mSensorPaint.setAntiAlias(true); + mSensorPaint.setColor(context.getColor(R.color.config_udfpsColor)); + mSensorPaint.setStyle(Paint.Style.FILL); + + mUdfpsIconPressed = context.getDrawable(R.drawable.udfps_icon_pressed); + } + + @Override public void surfaceCreated(SurfaceHolder holder) { + mHasValidSurface = true; + if (mAwaitingSurfaceToStartIllumination) { + doIlluminate(mOnDisplayConfigured); + mOnDisplayConfigured = null; + mAwaitingSurfaceToStartIllumination = false; + } + } + + @Override + public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { + // Unused. + } + + @Override public void surfaceDestroyed(SurfaceHolder holder) { + mHasValidSurface = false; + } + + void setGhbmIlluminationListener(@Nullable GhbmIlluminationListener listener) { + mGhbmIlluminationListener = listener; + } + + /** + * Note: there is no corresponding method to stop GHBM illumination. It is expected that + * {@link UdfpsView} will hide this view, which would destroy the surface and remove the + * illumination dot. + */ + void startGhbmIllumination(@Nullable Runnable onDisplayConfigured) { + if (mGhbmIlluminationListener == null) { + Log.e(TAG, "startIllumination | mGhbmIlluminationListener is null"); + return; + } + + if (mHasValidSurface) { + doIlluminate(onDisplayConfigured); + } else { + mAwaitingSurfaceToStartIllumination = true; + mOnDisplayConfigured = onDisplayConfigured; + } + } + + private void doIlluminate(@Nullable Runnable onDisplayConfigured) { + if (mGhbmIlluminationListener == null) { + Log.e(TAG, "doIlluminate | mGhbmIlluminationListener is null"); + return; + } + + mGhbmIlluminationListener.enableGhbm(mHolder.getSurface(), onDisplayConfigured); + } + + /** + * Immediately draws the illumination dot on this SurfaceView's surface. + */ + void drawIlluminationDot(@NonNull RectF sensorRect) { + if (!mHasValidSurface) { + Log.e(TAG, "drawIlluminationDot | the surface is destroyed or was never created."); + return; + } + Canvas canvas = null; + try { + canvas = mHolder.lockCanvas(); + mUdfpsIconPressed.setBounds( + Math.round(sensorRect.left), + Math.round(sensorRect.top), + Math.round(sensorRect.right), + Math.round(sensorRect.bottom) + ); + mUdfpsIconPressed.draw(canvas); + canvas.drawOval(sensorRect, mSensorPaint); + } finally { + // Make sure the surface is never left in a bad state. + if (canvas != null) { + mHolder.unlockCanvasAndPost(canvas); + } + } + } +} diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsView.kt b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsView.kt index 06dee7a2b9f6..ef7fcc954590 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsView.kt +++ b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsView.kt @@ -25,6 +25,7 @@ import android.graphics.RectF import android.util.AttributeSet import android.util.Log import android.view.MotionEvent +import android.view.Surface import android.widget.FrameLayout import com.android.settingslib.udfps.UdfpsOverlayParams import com.android.systemui.R @@ -61,6 +62,8 @@ class UdfpsView( a.getFloat(R.styleable.UdfpsView_sensorTouchAreaCoefficient, 0f) } + private var ghbmView: UdfpsSurfaceView? = null + /** View controller (can be different for enrollment, BiometricPrompt, Keyguard, etc.). */ var animationViewController: UdfpsAnimationViewController<*>? = null @@ -87,6 +90,10 @@ class UdfpsView( return (animationViewController == null || !animationViewController!!.shouldPauseAuth()) } + override fun onFinishInflate() { + ghbmView = findViewById(R.id.hbm_view) + } + override fun dozeTimeTick() { animationViewController?.dozeTimeTick() } @@ -150,12 +157,34 @@ class UdfpsView( fun configureDisplay(onDisplayConfigured: Runnable) { isDisplayConfigured = true animationViewController?.onDisplayConfiguring() - mUdfpsDisplayMode?.enable(onDisplayConfigured) + val gView = ghbmView + if (gView != null) { + gView.setGhbmIlluminationListener(this::doIlluminate) + gView.visibility = VISIBLE + gView.startGhbmIllumination(onDisplayConfigured) + } else { + doIlluminate(null /* surface */, onDisplayConfigured) + } + } + + private fun doIlluminate(surface: Surface?, onDisplayConfigured: Runnable?) { + if (ghbmView != null && surface == null) { + Log.e(TAG, "doIlluminate | surface must be non-null for GHBM") + } + + mUdfpsDisplayMode?.enable { + onDisplayConfigured?.run() + ghbmView?.drawIlluminationDot(RectF(sensorRect)) + } } fun unconfigureDisplay() { isDisplayConfigured = false animationViewController?.onDisplayUnconfigured() + ghbmView?.let { view -> + view.setGhbmIlluminationListener(null) + view.visibility = INVISIBLE + } mUdfpsDisplayMode?.disable(null /* onDisabled */) } } diff --git a/packages/SystemUI/src/com/android/systemui/controls/ui/ControlActionCoordinator.kt b/packages/SystemUI/src/com/android/systemui/controls/ui/ControlActionCoordinator.kt index 8029ba844850..c4c23124b39e 100644 --- a/packages/SystemUI/src/com/android/systemui/controls/ui/ControlActionCoordinator.kt +++ b/packages/SystemUI/src/com/android/systemui/controls/ui/ControlActionCoordinator.kt @@ -68,12 +68,6 @@ interface ControlActionCoordinator { fun setValue(cvh: ControlViewHolder, templateId: String, newValue: Float) /** - * Actions may have been put on hold while the device is unlocked. Invoke this action if - * present. - */ - fun runPendingAction(controlId: String) - - /** * User interaction with a control may be blocked for a period of time while actions are being * executed by the application. When the response returns, run this method to enable further * user interaction. diff --git a/packages/SystemUI/src/com/android/systemui/controls/ui/ControlActionCoordinatorImpl.kt b/packages/SystemUI/src/com/android/systemui/controls/ui/ControlActionCoordinatorImpl.kt index 37138114c740..c27a059c20fe 100644 --- a/packages/SystemUI/src/com/android/systemui/controls/ui/ControlActionCoordinatorImpl.kt +++ b/packages/SystemUI/src/com/android/systemui/controls/ui/ControlActionCoordinatorImpl.kt @@ -64,7 +64,6 @@ class ControlActionCoordinatorImpl @Inject constructor( private val featureFlags: FeatureFlags, ) : ControlActionCoordinator { private var dialog: Dialog? = null - private var pendingAction: Action? = null private var actionsInProgress = mutableSetOf<String>() private val isLocked: Boolean get() = !keyguardStateController.isUnlocked() @@ -166,15 +165,6 @@ class ControlActionCoordinatorImpl @Inject constructor( ) } - override fun runPendingAction(controlId: String) { - if (isLocked) return - if (pendingAction?.controlId == controlId) { - showSettingsDialogIfNeeded(pendingAction!!) - pendingAction?.invoke() - pendingAction = null - } - } - @MainThread override fun enableActionOnTouch(controlId: String) { actionsInProgress.remove(controlId) @@ -196,17 +186,11 @@ class ControlActionCoordinatorImpl @Inject constructor( val authRequired = action.authIsRequired || !allowTrivialControls if (keyguardStateController.isShowing() && authRequired) { - if (isLocked) { - broadcastSender.closeSystemDialogs() - - // pending actions will only run after the control state has been refreshed - pendingAction = action - } activityStarter.dismissKeyguardThenExecute({ Log.d(ControlsUiController.TAG, "Device unlocked, invoking controls action") action.invoke() true - }, { pendingAction = null }, true /* afterKeyguardGone */) + }, null, true /* afterKeyguardGone */) } else { showSettingsDialogIfNeeded(action) action.invoke() diff --git a/packages/SystemUI/src/com/android/systemui/controls/ui/ControlViewHolder.kt b/packages/SystemUI/src/com/android/systemui/controls/ui/ControlViewHolder.kt index c04bc8792223..18fb3e769e84 100644 --- a/packages/SystemUI/src/com/android/systemui/controls/ui/ControlViewHolder.kt +++ b/packages/SystemUI/src/com/android/systemui/controls/ui/ControlViewHolder.kt @@ -176,8 +176,6 @@ class ControlViewHolder( controlActionCoordinator.longPress(this@ControlViewHolder) true }) - - controlActionCoordinator.runPendingAction(cws.ci.controlId) } val wasLoading = isLoading diff --git a/packages/SystemUI/src/com/android/systemui/dagger/SystemUIModule.java b/packages/SystemUI/src/com/android/systemui/dagger/SystemUIModule.java index 5bcf32a9ebdb..632d16d4de35 100644 --- a/packages/SystemUI/src/com/android/systemui/dagger/SystemUIModule.java +++ b/packages/SystemUI/src/com/android/systemui/dagger/SystemUIModule.java @@ -54,6 +54,7 @@ import com.android.systemui.flags.FeatureFlags; import com.android.systemui.flags.FlagsModule; import com.android.systemui.keyboard.KeyboardModule; import com.android.systemui.keyguard.data.BouncerViewModule; +import com.android.systemui.lineage.LineageModule; import com.android.systemui.log.dagger.LogModule; import com.android.systemui.log.dagger.MonitorLog; import com.android.systemui.log.table.TableLogBuffer; @@ -175,6 +176,7 @@ import javax.inject.Named; GarbageMonitorModule.class, KeyboardModule.class, LetterboxModule.class, + LineageModule.class, LogModule.class, MediaProjectionModule.class, MotionToolModule.class, diff --git a/packages/SystemUI/src/com/android/systemui/doze/DozeSensors.java b/packages/SystemUI/src/com/android/systemui/doze/DozeSensors.java index 07efbfef732b..b8308df20553 100644 --- a/packages/SystemUI/src/com/android/systemui/doze/DozeSensors.java +++ b/packages/SystemUI/src/com/android/systemui/doze/DozeSensors.java @@ -249,7 +249,7 @@ public class DozeSensors { false /* ignoresSetting */, dozeParameters.longPressUsesProx(), false /* immediatelyReRegister */, - true /* requiresAod */ + !mScreenOffUdfpsEnabled /* requiresAod */ ), new PluginSensor( new SensorManagerPlugin.Sensor(TYPE_WAKE_DISPLAY), diff --git a/packages/SystemUI/src/com/android/systemui/doze/DozeTriggers.java b/packages/SystemUI/src/com/android/systemui/doze/DozeTriggers.java index 85272a609588..bf18b96fb2b6 100644 --- a/packages/SystemUI/src/com/android/systemui/doze/DozeTriggers.java +++ b/packages/SystemUI/src/com/android/systemui/doze/DozeTriggers.java @@ -326,11 +326,16 @@ public class DozeTriggers implements DozeMachine.Part { mDozeHost.onSlpiTap(screenX, screenY); gentleWakeUp(pulseReason); } else if (isPickup) { + final State state = mMachine.getState(); if (shouldDropPickupEvent()) { mDozeLog.traceSensorEventDropped(pulseReason, "keyguard occluded"); return; } - gentleWakeUp(pulseReason); + if (state == State.DOZE_AOD) { + gentleWakeUp(pulseReason); + } else { + requestPulse(pulseReason, true, null); + } } else if (isUdfpsLongPress) { if (canPulse(mMachine.getState(), true)) { mDozeLog.d("updfsLongPress - setting aodInterruptRunnable to run when " diff --git a/packages/SystemUI/src/com/android/systemui/flags/Flags.kt b/packages/SystemUI/src/com/android/systemui/flags/Flags.kt index 8ef27445fa75..e041202299dc 100644 --- a/packages/SystemUI/src/com/android/systemui/flags/Flags.kt +++ b/packages/SystemUI/src/com/android/systemui/flags/Flags.kt @@ -395,7 +395,7 @@ object Flags { val MEDIA_TAP_TO_TRANSFER = releasedFlag(900, "media_tap_to_transfer") // TODO(b/254512502): Tracking Bug - val MEDIA_SESSION_ACTIONS = unreleasedFlag(901, "media_session_actions") + val MEDIA_SESSION_ACTIONS = releasedFlag(901, "media_session_actions") // TODO(b/254512726): Tracking Bug val MEDIA_NEARBY_DEVICES = releasedFlag(903, "media_nearby_devices") diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java index b317af0686cb..8ea5e6459bc7 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java @@ -2221,6 +2221,8 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable, if (mLockPatternUtils.isLockScreenDisabled(KeyguardUpdateMonitor.getCurrentUser()) && !lockedOrMissing && !forceShow) { if (DEBUG) Log.d(TAG, "doKeyguard: not showing because lockscreen is off"); + setShowingLocked(false, mAodShowing); + hideLocked(); return; } @@ -3063,7 +3065,9 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable, // only play "unlock" noises if not on a call (since the incall UI // disables the keyguard) if (TelephonyManager.EXTRA_STATE_IDLE.equals(mPhoneState)) { - playSounds(false); + if (mShowing && mDeviceInteractive) { + playSounds(false); + } } setShowingLocked(false); diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractor.kt b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractor.kt index c44435ee2be0..8bfe951cc93e 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractor.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractor.kt @@ -188,6 +188,8 @@ constructor( CameraLaunchSourceModel.LIFT_TRIGGER StatusBarManager.CAMERA_LAUNCH_SOURCE_QUICK_AFFORDANCE -> CameraLaunchSourceModel.QUICK_AFFORDANCE + StatusBarManager.CAMERA_LAUNCH_SOURCE_SCREEN_GESTURE -> + CameraLaunchSourceModel.SCREEN_GESTURE else -> throw IllegalArgumentException("Invalid CameraLaunchSourceModel value: $value") } } diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/shared/model/CameraLaunchSourceModel.kt b/packages/SystemUI/src/com/android/systemui/keyguard/shared/model/CameraLaunchSourceModel.kt index 19baf7705546..71e0afe09054 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/shared/model/CameraLaunchSourceModel.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/shared/model/CameraLaunchSourceModel.kt @@ -25,4 +25,6 @@ enum class CameraLaunchSourceModel { LIFT_TRIGGER, /** Quick affordance button has been pressed */ QUICK_AFFORDANCE, + /** Screen gesture has been triggered */ + SCREEN_GESTURE, } diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardBottomAreaVibrations.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardBottomAreaVibrations.kt index e7803c5e964c..29fc70167ebb 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardBottomAreaVibrations.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardBottomAreaVibrations.kt @@ -17,6 +17,7 @@ package com.android.systemui.keyguard.ui.binder import android.os.VibrationEffect +import com.android.systemui.statusbar.VibratorHelper import kotlin.time.Duration.Companion.milliseconds object KeyguardBottomAreaVibrations { @@ -27,6 +28,14 @@ object KeyguardBottomAreaVibrations { private const val SmallVibrationScale = 0.3f private const val BigVibrationScale = 0.6f + val vibratorHelper: VibratorHelper? = null + val areAllPrimitivesSupported = vibratorHelper?.areAllPrimitivesSupported( + VibrationEffect.Composition.PRIMITIVE_TICK, + VibrationEffect.Composition.PRIMITIVE_QUICK_RISE, + VibrationEffect.Composition.PRIMITIVE_QUICK_FALL + ) ?: false + + val ShakeAlt = VibrationEffect.createPredefined(VibrationEffect.EFFECT_DOUBLE_CLICK) val Shake = VibrationEffect.startComposition() .apply { @@ -45,6 +54,7 @@ object KeyguardBottomAreaVibrations { } .compose() + val ActivatedAlt = VibrationEffect.createPredefined(VibrationEffect.EFFECT_HEAVY_CLICK) val Activated = VibrationEffect.startComposition() .addPrimitive( @@ -59,6 +69,7 @@ object KeyguardBottomAreaVibrations { ) .compose() + val DeactivatedAlt = VibrationEffect.createPredefined(VibrationEffect.EFFECT_HEAVY_CLICK) val Deactivated = VibrationEffect.startComposition() .addPrimitive( diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardBottomAreaViewBinder.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardBottomAreaViewBinder.kt index b64fc33ea252..eafcac50764e 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardBottomAreaViewBinder.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardBottomAreaViewBinder.kt @@ -279,7 +279,12 @@ object KeyguardBottomAreaViewBinder { isVisible -> settingsMenu.animateVisibility(visible = isVisible) if (isVisible) { - vibratorHelper?.vibrate(KeyguardBottomAreaVibrations.Activated) + vibratorHelper?.vibrate( + if (KeyguardBottomAreaVibrations.areAllPrimitivesSupported) { + KeyguardBottomAreaVibrations.Activated + } else { + KeyguardBottomAreaVibrations.ActivatedAlt + }) settingsMenu.setOnTouchListener( KeyguardSettingsButtonOnTouchListener( view = settingsMenu, @@ -491,9 +496,17 @@ object KeyguardBottomAreaViewBinder { ) vibratorHelper?.vibrate( if (viewModel.isActivated) { - KeyguardBottomAreaVibrations.Activated + if (KeyguardBottomAreaVibrations.areAllPrimitivesSupported) { + KeyguardBottomAreaVibrations.Activated + } else { + KeyguardBottomAreaVibrations.ActivatedAlt + } } else { - KeyguardBottomAreaVibrations.Deactivated + if (KeyguardBottomAreaVibrations.areAllPrimitivesSupported) { + KeyguardBottomAreaVibrations.Deactivated + } else { + KeyguardBottomAreaVibrations.DeactivatedAlt + } } ) } diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardQuickAffordanceOnTouchListener.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardQuickAffordanceOnTouchListener.kt index 7685345805f4..ec7883ac5e20 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardQuickAffordanceOnTouchListener.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardQuickAffordanceOnTouchListener.kt @@ -128,7 +128,12 @@ class KeyguardQuickAffordanceOnTouchListener( ) shakeAnimator.start() - vibratorHelper?.vibrate(KeyguardBottomAreaVibrations.Shake) + vibratorHelper?.vibrate( + if (KeyguardBottomAreaVibrations.areAllPrimitivesSupported) { + KeyguardBottomAreaVibrations.Shake + } else { + KeyguardBottomAreaVibrations.ShakeAlt + }) } } else { null @@ -151,9 +156,17 @@ class KeyguardQuickAffordanceOnTouchListener( view.setOnClickListener { vibratorHelper?.vibrate( if (viewModel.isActivated) { - KeyguardBottomAreaVibrations.Activated + if (KeyguardBottomAreaVibrations.areAllPrimitivesSupported) { + KeyguardBottomAreaVibrations.Activated + } else { + KeyguardBottomAreaVibrations.ActivatedAlt + } } else { - KeyguardBottomAreaVibrations.Deactivated + if (KeyguardBottomAreaVibrations.areAllPrimitivesSupported) { + KeyguardBottomAreaVibrations.Deactivated + } else { + KeyguardBottomAreaVibrations.DeactivatedAlt + } } ) viewModel.onClicked( diff --git a/packages/SystemUI/src/com/android/systemui/lineage/LineageModule.kt b/packages/SystemUI/src/com/android/systemui/lineage/LineageModule.kt new file mode 100644 index 000000000000..3e9aec36d8f3 --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/lineage/LineageModule.kt @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2023 The LineageOS 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. + */ + +package com.android.systemui.lineage + +import com.android.systemui.qs.tileimpl.QSTileImpl +import com.android.systemui.qs.tiles.AODTile +import com.android.systemui.qs.tiles.CaffeineTile +import com.android.systemui.qs.tiles.HeadsUpTile + +import dagger.Binds +import dagger.Module +import dagger.multibindings.IntoMap +import dagger.multibindings.StringKey + +@Module +interface LineageModule { + /** Inject AODTile into tileMap in QSModule */ + @Binds + @IntoMap + @StringKey(AODTile.TILE_SPEC) + fun bindAODTile(aodTile: AODTile): QSTileImpl<*> + + /** Inject CaffeineTile into tileMap in QSModule */ + @Binds + @IntoMap + @StringKey(CaffeineTile.TILE_SPEC) + fun bindCaffeineTile(caffeineTile: CaffeineTile): QSTileImpl<*> + + /** Inject HeadsUpTile into tileMap in QSModule */ + @Binds + @IntoMap + @StringKey(HeadsUpTile.TILE_SPEC) + fun bindHeadsUpTile(headsUpTile: HeadsUpTile): QSTileImpl<*> +} diff --git a/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarInflaterView.java b/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarInflaterView.java index 2a7704f13c3b..154bc79dbe6a 100644 --- a/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarInflaterView.java +++ b/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarInflaterView.java @@ -18,11 +18,17 @@ package com.android.systemui.navigationbar; import static android.view.ViewGroup.LayoutParams.MATCH_PARENT; import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_3BUTTON; +import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL; import android.annotation.Nullable; +import android.app.ActivityManager; import android.content.Context; +import android.content.om.IOverlayManager; import android.content.res.Configuration; import android.graphics.drawable.Icon; +import android.os.RemoteException; +import android.os.ServiceManager; +import android.provider.Settings; import android.util.AttributeSet; import android.util.Log; import android.util.SparseArray; @@ -43,12 +49,13 @@ import com.android.systemui.navigationbar.buttons.ReverseLinearLayout; import com.android.systemui.navigationbar.buttons.ReverseLinearLayout.ReverseRelativeLayout; import com.android.systemui.recents.OverviewProxyService; import com.android.systemui.shared.system.QuickStepContract; +import com.android.systemui.tuner.TunerService; import java.io.PrintWriter; import java.lang.ref.WeakReference; import java.util.Objects; -public class NavigationBarInflaterView extends FrameLayout { +public class NavigationBarInflaterView extends FrameLayout implements TunerService.Tunable { private static final String TAG = "NavBarInflater"; public static final String NAV_BAR_VIEWS = "sysui_nav_bar"; @@ -82,6 +89,11 @@ public class NavigationBarInflaterView extends FrameLayout { private static final String ABSOLUTE_SUFFIX = "A"; private static final String ABSOLUTE_VERTICAL_CENTERED_SUFFIX = "C"; + private static final String KEY_NAVIGATION_HINT = + Settings.Secure.NAVIGATION_BAR_HINT; + private static final String OVERLAY_NAVIGATION_HIDE_HINT = + "android.ice.overlay.hidenav"; + private static class Listener implements NavigationModeController.ModeChangedListener { private final WeakReference<NavigationBarInflaterView> mSelf; @@ -119,6 +131,8 @@ public class NavigationBarInflaterView extends FrameLayout { private OverviewProxyService mOverviewProxyService; private int mNavBarMode = NAV_BAR_MODE_3BUTTON; + private boolean mIsHintEnabled; + public NavigationBarInflaterView(Context context, AttributeSet attrs) { super(context, attrs); createInflaters(); @@ -161,11 +175,21 @@ public class NavigationBarInflaterView extends FrameLayout { : mOverviewProxyService.shouldShowSwipeUpUI() ? R.string.config_navBarLayoutQuickstep : R.string.config_navBarLayout; + if (!mIsHintEnabled && defaultResource == R.string.config_navBarLayoutHandle) { + return getContext().getString(defaultResource).replace(HOME_HANDLE, ""); + } return getContext().getString(defaultResource); } private void onNavigationModeChanged(int mode) { mNavBarMode = mode; + updateHint(); + } + + @Override + protected void onAttachedToWindow() { + super.onAttachedToWindow(); + Dependency.get(TunerService.class).addTunable(this, KEY_NAVIGATION_HINT); } @Override @@ -174,6 +198,15 @@ public class NavigationBarInflaterView extends FrameLayout { super.onDetachedFromWindow(); } + @Override + public void onTuningChanged(String key, String newValue) { + if (KEY_NAVIGATION_HINT.equals(key)) { + mIsHintEnabled = TunerService.parseIntegerSwitch(newValue, true); + updateHint(); + onLikelyDefaultLayoutChange(); + } + } + public void onLikelyDefaultLayoutChange() { // Reevaluate new layout final String newValue = getDefaultLayout(); @@ -227,6 +260,24 @@ public class NavigationBarInflaterView extends FrameLayout { } } + private void updateHint() { + final IOverlayManager iom = IOverlayManager.Stub.asInterface( + ServiceManager.getService(Context.OVERLAY_SERVICE)); + final boolean state = mNavBarMode == NAV_BAR_MODE_GESTURAL && !mIsHintEnabled; + final int userId = ActivityManager.getCurrentUser(); + try { + iom.setEnabled(OVERLAY_NAVIGATION_HIDE_HINT, state, userId); + if (state) { + // As overlays are also used to apply navigation mode, it is needed to set + // our customization overlay to highest priority to ensure it is applied. + iom.setHighestPriority(OVERLAY_NAVIGATION_HIDE_HINT, userId); + } + } catch (IllegalArgumentException | RemoteException e) { + Log.e(TAG, "Failed to " + (state ? "enable" : "disable") + + " overlay " + OVERLAY_NAVIGATION_HIDE_HINT + " for user " + userId); + } + } + private void initiallyFill(ButtonDispatcher buttonDispatcher) { addAll(buttonDispatcher, mHorizontal.findViewById(R.id.ends_group)); addAll(buttonDispatcher, mHorizontal.findViewById(R.id.center_group)); diff --git a/packages/SystemUI/src/com/android/systemui/privacy/PrivacyConfig.kt b/packages/SystemUI/src/com/android/systemui/privacy/PrivacyConfig.kt index d652889f0082..3f5e5223e91e 100644 --- a/packages/SystemUI/src/com/android/systemui/privacy/PrivacyConfig.kt +++ b/packages/SystemUI/src/com/android/systemui/privacy/PrivacyConfig.kt @@ -28,7 +28,6 @@ import com.android.systemui.util.asIndenting import com.android.systemui.util.concurrency.DelayableExecutor import com.android.systemui.util.withIncreasedIndent import java.io.PrintWriter -import java.lang.ref.WeakReference import javax.inject.Inject @SysUISingleton @@ -50,7 +49,7 @@ class PrivacyConfig @Inject constructor( private const val DEFAULT_MEDIA_PROJECTION = true } - private val callbacks = mutableListOf<WeakReference<Callback>>() + private val callbacks = mutableListOf<Callback>() var micCameraAvailable = isMicCameraEnabled() private set @@ -65,19 +64,19 @@ class PrivacyConfig @Inject constructor( // Running on the ui executor so can iterate on callbacks if (properties.keyset.contains(MIC_CAMERA)) { micCameraAvailable = properties.getBoolean(MIC_CAMERA, DEFAULT_MIC_CAMERA) - callbacks.forEach { it.get()?.onFlagMicCameraChanged(micCameraAvailable) } + callbacks.forEach { it.onFlagMicCameraChanged(micCameraAvailable) } } if (properties.keyset.contains(LOCATION)) { locationAvailable = properties.getBoolean(LOCATION, DEFAULT_LOCATION) - callbacks.forEach { it.get()?.onFlagLocationChanged(locationAvailable) } + callbacks.forEach { it.onFlagLocationChanged(locationAvailable) } } if (properties.keyset.contains(MEDIA_PROJECTION)) { mediaProjectionAvailable = properties.getBoolean(MEDIA_PROJECTION, DEFAULT_MEDIA_PROJECTION) callbacks.forEach { - it.get()?.onFlagMediaProjectionChanged(mediaProjectionAvailable) + it.onFlagMediaProjectionChanged(mediaProjectionAvailable) } } } @@ -107,23 +106,14 @@ class PrivacyConfig @Inject constructor( } fun addCallback(callback: Callback) { - addCallback(WeakReference(callback)) - } - - fun removeCallback(callback: Callback) { - removeCallback(WeakReference(callback)) - } - - private fun addCallback(callback: WeakReference<Callback>) { uiExecutor.execute { callbacks.add(callback) } } - private fun removeCallback(callback: WeakReference<Callback>) { + fun removeCallback(callback: Callback) { uiExecutor.execute { - // Removes also if the callback is null - callbacks.removeIf { it.get()?.equals(callback.get()) ?: true } + callbacks.remove(callback) } } @@ -136,9 +126,7 @@ class PrivacyConfig @Inject constructor( ipw.println("mediaProjectionAvailable: $mediaProjectionAvailable") ipw.println("Callbacks:") ipw.withIncreasedIndent { - callbacks.forEach { callback -> - callback.get()?.let { ipw.println(it) } - } + callbacks.forEach { ipw.println(it) } } } ipw.flush() @@ -154,4 +142,4 @@ class PrivacyConfig @Inject constructor( @JvmDefault fun onFlagMediaProjectionChanged(flag: Boolean) {} } -}
\ No newline at end of file +} diff --git a/packages/SystemUI/src/com/android/systemui/qrcodescanner/controller/QRCodeScannerController.java b/packages/SystemUI/src/com/android/systemui/qrcodescanner/controller/QRCodeScannerController.java index fa3f878ff431..032f8776a597 100644 --- a/packages/SystemUI/src/com/android/systemui/qrcodescanner/controller/QRCodeScannerController.java +++ b/packages/SystemUI/src/com/android/systemui/qrcodescanner/controller/QRCodeScannerController.java @@ -345,8 +345,6 @@ public class QRCodeScannerController implements // Reset cached values to default as we are no longer listening mQRCodeScannerPreferenceObserver = new HashMap<>(); - mSecureSettings.putStringForUser(Settings.Secure.SHOW_QR_CODE_SCANNER_SETTING, null, - mUserTracker.getUserId()); } private void unregisterDefaultQRCodeScannerObserver() { @@ -358,6 +356,8 @@ public class QRCodeScannerController implements mQRCodeScannerActivity = null; mIntent = null; mComponentName = null; + mSecureSettings.putStringForUser(Settings.Secure.SHOW_QR_CODE_SCANNER_SETTING, null, + mUserTracker.getUserId()); } private void notifyQRCodeScannerActivityChanged() { @@ -385,7 +385,10 @@ public class QRCodeScannerController implements // While registering the observers for the first time update the default values in the // background - mExecutor.execute(() -> updateQRCodeScannerActivityDetails()); + mExecutor.execute(() -> { + updateQRCodeScannerActivityDetails(); + updateQRCodeScannerPreferenceDetails(/* updateSettings = */true); + }); mOnDefaultQRCodeScannerChangedListener = properties -> { if (DeviceConfig.NAMESPACE_SYSTEMUI.equals(properties.getNamespace()) diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSHost.java b/packages/SystemUI/src/com/android/systemui/qs/QSHost.java index 856c64a52290..c03eaf4daf69 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSHost.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSHost.java @@ -46,7 +46,7 @@ public interface QSHost { final String defaultTileList = res.getString(R.string.quick_settings_tiles_default); tiles.addAll(Arrays.asList(defaultTileList.split(","))); - if (Build.IS_DEBUGGABLE + if (Build.IS_ENG && GarbageMonitor.ADD_MEMORY_TILE_TO_DEFAULT_ON_DEBUGGABLE_BUILDS) { tiles.add(GarbageMonitor.MemoryTile.TILE_SPEC); } diff --git a/packages/SystemUI/src/com/android/systemui/qs/customize/QSCustomizer.java b/packages/SystemUI/src/com/android/systemui/qs/customize/QSCustomizer.java index d511d8aea019..7ef47ab2293a 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/customize/QSCustomizer.java +++ b/packages/SystemUI/src/com/android/systemui/qs/customize/QSCustomizer.java @@ -93,12 +93,8 @@ public class QSCustomizer extends LinearLayout { } void updateNavBackDrop(Configuration newConfig, LightBarController lightBarController) { - View navBackdrop = findViewById(R.id.nav_bar_background); mIsShowingNavBackdrop = newConfig.smallestScreenWidthDp >= 600 || newConfig.orientation != Configuration.ORIENTATION_LANDSCAPE; - if (navBackdrop != null) { - navBackdrop.setVisibility(mIsShowingNavBackdrop ? View.VISIBLE : View.GONE); - } updateNavColors(lightBarController); } diff --git a/packages/SystemUI/src/com/android/systemui/qs/customize/TileAdapter.java b/packages/SystemUI/src/com/android/systemui/qs/customize/TileAdapter.java index 596475eedb43..7f0011b0a4c3 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/customize/TileAdapter.java +++ b/packages/SystemUI/src/com/android/systemui/qs/customize/TileAdapter.java @@ -23,9 +23,11 @@ import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.os.Handler; import android.view.LayoutInflater; +import android.view.MotionEvent; import android.view.View; import android.view.View.OnClickListener; import android.view.View.OnLayoutChangeListener; +import android.view.View.OnTouchListener; import android.view.ViewGroup; import android.widget.FrameLayout; import android.widget.TextView; @@ -342,7 +344,7 @@ public class TileAdapter extends RecyclerView.Adapter<Holder> implements TileSta final String titleText; Resources res = mContext.getResources(); if (mCurrentDrag == null) { - titleText = res.getString(R.string.drag_to_add_tiles); + titleText = res.getString(R.string.drag_or_tap_to_add_tiles); } else if (!canRemoveTiles() && mCurrentDrag.getAdapterPosition() < mEditIndex) { titleText = res.getString(R.string.drag_to_remove_disabled, mMinNumTiles); } else { @@ -423,6 +425,18 @@ public class TileAdapter extends RecyclerView.Adapter<Holder> implements TileSta if (position == mFocusIndex) { focusOnHolder(holder); } + holder.mTileView.setOnTouchListener(new OnTouchListener() { + @Override + public boolean onTouch(View v, MotionEvent ev) { + if (ev.getAction() == MotionEvent.ACTION_UP) { + int position = holder.getLayoutPosition(); + if (position >= mEditIndex || canRemoveTiles()) { + move(position, mEditIndex, true); + } + } + return false; + } + }); } private void focusOnHolder(Holder holder) { diff --git a/packages/SystemUI/src/com/android/systemui/qs/customize/TileQueryHelper.java b/packages/SystemUI/src/com/android/systemui/qs/customize/TileQueryHelper.java index d9f448493591..82f9f921af42 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/customize/TileQueryHelper.java +++ b/packages/SystemUI/src/com/android/systemui/qs/customize/TileQueryHelper.java @@ -114,7 +114,7 @@ public class TileQueryHelper { possibleTiles.add(spec); } } - if (Build.IS_DEBUGGABLE && !current.contains(GarbageMonitor.MemoryTile.TILE_SPEC)) { + if (Build.IS_ENG && !current.contains(GarbageMonitor.MemoryTile.TILE_SPEC)) { possibleTiles.add(GarbageMonitor.MemoryTile.TILE_SPEC); } diff --git a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSFactoryImpl.java b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSFactoryImpl.java index 6b23f5d77145..97f481325e58 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSFactoryImpl.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSFactoryImpl.java @@ -81,8 +81,8 @@ public class QSFactoryImpl implements QSFactory { protected QSTileImpl createTileInternal(String tileSpec) { // Stock tiles. if (mTileMap.containsKey(tileSpec) - // We should not return a Garbage Monitory Tile if the build is not Debuggable - && (!tileSpec.equals(GarbageMonitor.MemoryTile.TILE_SPEC) || Build.IS_DEBUGGABLE)) { + // We should not return a Garbage Monitory Tile if the build is not Eng + && (!tileSpec.equals(GarbageMonitor.MemoryTile.TILE_SPEC) || Build.IS_ENG)) { return mTileMap.get(tileSpec).get(); } diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/AODTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/AODTile.java new file mode 100644 index 000000000000..27edb0e2ad55 --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/AODTile.java @@ -0,0 +1,165 @@ +/* + * Copyright (C) 2018 The OmniROM Project + * 2020-2021 The LineageOS 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. + */ + +package com.android.systemui.qs.tiles; + +import android.content.Intent; +import android.os.Handler; +import android.os.Looper; +import android.provider.Settings; +import android.service.quicksettings.Tile; +import android.view.View; + +import androidx.annotation.Nullable; + +import com.android.internal.logging.MetricsLogger; +import com.android.internal.logging.nano.MetricsProto.MetricsEvent; +import com.android.systemui.R; +import com.android.systemui.dagger.qualifiers.Background; +import com.android.systemui.dagger.qualifiers.Main; +import com.android.systemui.plugins.ActivityStarter; +import com.android.systemui.plugins.FalsingManager; +import com.android.systemui.plugins.qs.QSTile.BooleanState; +import com.android.systemui.plugins.statusbar.StatusBarStateController; +import com.android.systemui.qs.QSHost; +import com.android.systemui.qs.QsEventLogger; +import com.android.systemui.qs.SettingObserver; +import com.android.systemui.qs.logging.QSLogger; +import com.android.systemui.qs.tileimpl.QSTileImpl; +import com.android.systemui.settings.UserTracker; +import com.android.systemui.statusbar.policy.BatteryController; +import com.android.systemui.util.settings.SecureSettings; + +import javax.inject.Inject; + +public class AODTile extends QSTileImpl<BooleanState> implements + BatteryController.BatteryStateChangeCallback { + + public static final String TILE_SPEC = "aod"; + + private final Icon mIcon = ResourceIcon.get(R.drawable.ic_qs_aod); + private final BatteryController mBatteryController; + + private final SettingObserver mSetting; + + @Inject + public AODTile( + QSHost host, + QsEventLogger uiEventLogger, + @Background Looper backgroundLooper, + @Main Handler mainHandler, + FalsingManager falsingManager, + MetricsLogger metricsLogger, + StatusBarStateController statusBarStateController, + ActivityStarter activityStarter, + QSLogger qsLogger, + SecureSettings secureSettings, + BatteryController batteryController, + UserTracker userTracker + ) { + super(host, uiEventLogger, backgroundLooper, mainHandler, falsingManager, metricsLogger, + statusBarStateController, activityStarter, qsLogger); + + mSetting = new SettingObserver(secureSettings, mHandler, Settings.Secure.DOZE_ALWAYS_ON, + userTracker.getUserId()) { + @Override + protected void handleValueChanged(int value, boolean observedChange) { + handleRefreshState(value); + } + }; + + mBatteryController = batteryController; + batteryController.observe(getLifecycle(), this); + } + + @Override + public void onPowerSaveChanged(boolean isPowerSave) { + refreshState(); + } + + @Override + protected void handleDestroy() { + super.handleDestroy(); + mSetting.setListening(false); + } + + @Override + public boolean isAvailable() { + return mContext.getResources().getBoolean( + com.android.internal.R.bool.config_dozeAlwaysOnDisplayAvailable); + } + + @Override + public BooleanState newTileState() { + BooleanState state = new BooleanState(); + state.handlesLongClick = false; + return state; + } + + @Override + public void handleSetListening(boolean listening) { + super.handleSetListening(listening); + mSetting.setListening(listening); + } + + @Override + protected void handleUserSwitch(int newUserId) { + mSetting.setUserId(newUserId); + handleRefreshState(mSetting.getValue()); + } + + @Override + protected void handleClick(@Nullable View view) { + mSetting.setValue(mState.value ? 0 : 1); + } + + @Override + public Intent getLongClickIntent() { + return null; + } + + @Override + public CharSequence getTileLabel() { + if (mBatteryController.isAodPowerSave()) { + return mContext.getString(R.string.quick_settings_aod_off_powersave_label); + } + return mContext.getString(R.string.quick_settings_aod_label); + } + + @Override + protected void handleUpdateState(BooleanState state, Object arg) { + final int value = arg instanceof Integer ? (Integer) arg : mSetting.getValue(); + final boolean enable = value != 0; + if (state.slash == null) { + state.slash = new SlashState(); + } + state.icon = mIcon; + state.value = enable; + state.slash.isSlashed = state.value; + state.label = mContext.getString(R.string.quick_settings_aod_label); + if (mBatteryController.isAodPowerSave()) { + state.state = Tile.STATE_UNAVAILABLE; + } else { + state.state = enable ? Tile.STATE_ACTIVE : Tile.STATE_INACTIVE; + } + } + + @Override + public int getMetricsCategory() { + return MetricsEvent.ICE; + } +} diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/CaffeineTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/CaffeineTile.java new file mode 100644 index 000000000000..a4a6c1738530 --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/CaffeineTile.java @@ -0,0 +1,257 @@ +/* + * Copyright (C) 2016 The CyanogenMod Project + * Copyright (c) 2017 The LineageOS 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. + */ + +package com.android.systemui.qs.tiles; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.content.IntentFilter; +import android.os.CountDownTimer; +import android.os.Handler; +import android.os.Looper; +import android.os.PowerManager; +import android.os.SystemClock; +import android.service.quicksettings.Tile; +import android.view.View; + +import androidx.annotation.Nullable; + +import com.android.internal.logging.MetricsLogger; +import com.android.internal.logging.nano.MetricsProto.MetricsEvent; +import com.android.systemui.R; +import com.android.systemui.dagger.qualifiers.Background; +import com.android.systemui.dagger.qualifiers.Main; +import com.android.systemui.plugins.ActivityStarter; +import com.android.systemui.plugins.FalsingManager; +import com.android.systemui.plugins.qs.QSTile.BooleanState; +import com.android.systemui.plugins.statusbar.StatusBarStateController; +import com.android.systemui.qs.QSHost; +import com.android.systemui.qs.QsEventLogger; +import com.android.systemui.qs.logging.QSLogger; +import com.android.systemui.qs.tileimpl.QSTileImpl; + +import javax.inject.Inject; + +/** Quick settings tile: Caffeine **/ +public class CaffeineTile extends QSTileImpl<BooleanState> { + + public static final String TILE_SPEC = "caffeine"; + + private final Icon mIcon = ResourceIcon.get(R.drawable.ic_qs_caffeine); + + private final PowerManager.WakeLock mWakeLock; + private int mSecondsRemaining; + private int mDuration; + private static int[] DURATIONS = new int[] { + 5 * 60, // 5 min + 10 * 60, // 10 min + 30 * 60, // 30 min + -1, // infinity + }; + private static final int INFINITE_DURATION_INDEX = DURATIONS.length - 1; + private CountDownTimer mCountdownTimer = null; + public long mLastClickTime = -1; + private final Receiver mReceiver = new Receiver(); + + @Inject + public CaffeineTile( + QSHost host, + QsEventLogger uiEventLogger, + @Background Looper backgroundLooper, + @Main Handler mainHandler, + FalsingManager falsingManager, + MetricsLogger metricsLogger, + StatusBarStateController statusBarStateController, + ActivityStarter activityStarter, + QSLogger qsLogger + ) { + super(host, uiEventLogger, backgroundLooper, mainHandler, falsingManager, metricsLogger, + statusBarStateController, activityStarter, qsLogger); + mWakeLock = mContext.getSystemService(PowerManager.class).newWakeLock( + PowerManager.FULL_WAKE_LOCK, "CaffeineTile"); + mReceiver.init(); + } + + @Override + public BooleanState newTileState() { + return new BooleanState(); + } + + @Override + protected void handleDestroy() { + super.handleDestroy(); + stopCountDown(); + mReceiver.destroy(); + if (mWakeLock.isHeld()) { + mWakeLock.release(); + } + } + + @Override + public void handleSetListening(boolean listening) { + } + + @Override + protected void handleClick(@Nullable View view) { + // If last user clicks < 5 seconds + // we cycle different duration + // otherwise toggle on/off + if (mWakeLock.isHeld() && (mLastClickTime != -1) && + (SystemClock.elapsedRealtime() - mLastClickTime < 5000)) { + // cycle duration + mDuration++; + if (mDuration >= DURATIONS.length) { + // all durations cycled, turn if off + mDuration = -1; + stopCountDown(); + if (mWakeLock.isHeld()) { + mWakeLock.release(); + } + } else { + // change duration + startCountDown(DURATIONS[mDuration]); + if (!mWakeLock.isHeld()) { + mWakeLock.acquire(); + } + } + } else { + // toggle + if (mWakeLock.isHeld()) { + mWakeLock.release(); + stopCountDown(); + } else { + mWakeLock.acquire(); + mDuration = 0; + startCountDown(DURATIONS[mDuration]); + } + } + mLastClickTime = SystemClock.elapsedRealtime(); + refreshState(); + } + + @Override + protected void handleLongClick(@Nullable View view) { + if (mWakeLock.isHeld()) { + if (mDuration == INFINITE_DURATION_INDEX) { + return; + } + } else { + mWakeLock.acquire(); + } + mDuration = INFINITE_DURATION_INDEX; + startCountDown(DURATIONS[INFINITE_DURATION_INDEX]); + refreshState(); + } + + @Override + public Intent getLongClickIntent() { + return null; + } + + @Override + public CharSequence getTileLabel() { + return mContext.getString(R.string.quick_settings_caffeine_label); + } + + @Override + public int getMetricsCategory() { + return MetricsEvent.ICE; + } + + private void startCountDown(long duration) { + stopCountDown(); + mSecondsRemaining = (int)duration; + if (duration == -1) { + // infinity timing, no need to start timer + return; + } + mCountdownTimer = new CountDownTimer(duration * 1000, 1000) { + @Override + public void onTick(long millisUntilFinished) { + mSecondsRemaining = (int) (millisUntilFinished / 1000); + refreshState(); + } + + @Override + public void onFinish() { + if (mWakeLock.isHeld()) + mWakeLock.release(); + refreshState(); + } + + }.start(); + } + + private void stopCountDown() { + if (mCountdownTimer != null) { + mCountdownTimer.cancel(); + mCountdownTimer = null; + } + } + + private String formatValueWithRemainingTime() { + if (mSecondsRemaining == -1) { + return "\u221E"; // infinity + } + return String.format("%02d:%02d", + mSecondsRemaining / 60 % 60, mSecondsRemaining % 60); + } + + @Override + protected void handleUpdateState(BooleanState state, Object arg) { + state.value = mWakeLock.isHeld(); + state.icon = mIcon; + state.label = mContext.getString(R.string.quick_settings_caffeine_label); + if (state.value) { + state.secondaryLabel = formatValueWithRemainingTime(); + state.contentDescription = mContext.getString( + R.string.accessibility_quick_settings_caffeine_on); + state.state = Tile.STATE_ACTIVE; + } else { + state.secondaryLabel = null; + state.contentDescription = mContext.getString( + R.string.accessibility_quick_settings_caffeine_off); + state.state = Tile.STATE_INACTIVE; + } + } + + private final class Receiver extends BroadcastReceiver { + public void init() { + // Register for Intent broadcasts for... + IntentFilter filter = new IntentFilter(); + filter.addAction(Intent.ACTION_SCREEN_OFF); + mContext.registerReceiver(this, filter, null, mHandler); + } + + public void destroy() { + mContext.unregisterReceiver(this); + } + + @Override + public void onReceive(Context context, Intent intent) { + String action = intent.getAction(); + if (Intent.ACTION_SCREEN_OFF.equals(action)) { + // disable caffeine if user force off (power button) + stopCountDown(); + if (mWakeLock.isHeld()) + mWakeLock.release(); + refreshState(); + } + } + } +} diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/CastTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/CastTile.java index cb6dbff00e3b..3ef3e1284c16 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/CastTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/CastTile.java @@ -116,7 +116,6 @@ public class CastTile extends QSTileImpl<BooleanState> { @Override public BooleanState newTileState() { BooleanState state = new BooleanState(); - state.handlesLongClick = false; return state; } @@ -137,12 +136,7 @@ public class CastTile extends QSTileImpl<BooleanState> { @Override public Intent getLongClickIntent() { - return new Intent(Settings.ACTION_CAST_SETTINGS); - } - - @Override - protected void handleLongClick(@Nullable View view) { - handleClick(view); + return CAST_SETTINGS; } @Override @@ -305,7 +299,8 @@ public class CastTile extends QSTileImpl<BooleanState> { refreshState(); } } else { - boolean enabledAndConnected = indicators.enabled && indicators.qsIcon.visible; + boolean enabledAndConnected = indicators.enabled + && (indicators.qsIcon == null ? false : indicators.qsIcon.visible); if (enabledAndConnected != mWifiConnected) { mWifiConnected = enabledAndConnected; // Hotspot is not connected, so changes here should update diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/HeadsUpTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/HeadsUpTile.java new file mode 100644 index 000000000000..f75e84664cbd --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/HeadsUpTile.java @@ -0,0 +1,141 @@ +/* + * Copyright (C) 2015 The CyanogenMod Project + * Copyright (C) 2017 The LineageOS 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. + */ + +package com.android.systemui.qs.tiles; + +import android.content.Intent; +import android.os.Handler; +import android.os.Looper; +import android.provider.Settings; +import android.provider.Settings.Global; +import android.service.quicksettings.Tile; +import android.view.View; + +import androidx.annotation.Nullable; + +import com.android.internal.logging.MetricsLogger; +import com.android.internal.logging.nano.MetricsProto.MetricsEvent; +import com.android.systemui.R; +import com.android.systemui.dagger.qualifiers.Background; +import com.android.systemui.dagger.qualifiers.Main; +import com.android.systemui.plugins.ActivityStarter; +import com.android.systemui.plugins.FalsingManager; +import com.android.systemui.plugins.qs.QSTile.BooleanState; +import com.android.systemui.plugins.statusbar.StatusBarStateController; +import com.android.systemui.qs.QSHost; +import com.android.systemui.qs.QsEventLogger; +import com.android.systemui.qs.SettingObserver; +import com.android.systemui.qs.logging.QSLogger; +import com.android.systemui.qs.tileimpl.QSTileImpl; +import com.android.systemui.settings.UserTracker; +import com.android.systemui.util.settings.GlobalSettings; + +import javax.inject.Inject; + +/** Quick settings tile: Heads up **/ +public class HeadsUpTile extends QSTileImpl<BooleanState> { + + public static final String TILE_SPEC = "heads_up"; + + private final Icon mIcon = ResourceIcon.get(R.drawable.ic_qs_heads_up); + + private static final Intent NOTIFICATION_SETTINGS = + new Intent("android.settings.NOTIFICATION_SETTINGS"); + + private final SettingObserver mSetting; + + @Inject + public HeadsUpTile( + QSHost host, + QsEventLogger uiEventLogger, + @Background Looper backgroundLooper, + @Main Handler mainHandler, + FalsingManager falsingManager, + MetricsLogger metricsLogger, + StatusBarStateController statusBarStateController, + ActivityStarter activityStarter, + QSLogger qsLogger, + GlobalSettings globalSettings, + UserTracker userTracker + ) { + super(host, uiEventLogger, backgroundLooper, mainHandler, falsingManager, metricsLogger, + statusBarStateController, activityStarter, qsLogger); + + mSetting = new SettingObserver(globalSettings, mHandler, + Global.HEADS_UP_NOTIFICATIONS_ENABLED, userTracker.getUserId()) { + @Override + protected void handleValueChanged(int value, boolean observedChange) { + handleRefreshState(value); + } + }; + } + + @Override + public BooleanState newTileState() { + return new BooleanState(); + } + + @Override + protected void handleClick(@Nullable View view) { + setEnabled(!mState.value); + refreshState(); + } + + @Override + public Intent getLongClickIntent() { + return NOTIFICATION_SETTINGS; + } + + private void setEnabled(boolean enabled) { + Settings.Global.putInt(mContext.getContentResolver(), + Settings.Global.HEADS_UP_NOTIFICATIONS_ENABLED, + enabled ? 1 : 0); + } + + @Override + protected void handleUpdateState(BooleanState state, Object arg) { + final int value = arg instanceof Integer ? (Integer) arg : mSetting.getValue(); + final boolean headsUp = value != 0; + state.value = headsUp; + state.label = mContext.getString(R.string.quick_settings_heads_up_label); + state.icon = mIcon; + if (headsUp) { + state.contentDescription = mContext.getString( + R.string.accessibility_quick_settings_heads_up_on); + state.state = Tile.STATE_ACTIVE; + } else { + state.contentDescription = mContext.getString( + R.string.accessibility_quick_settings_heads_up_off); + state.state = Tile.STATE_INACTIVE; + } + } + + @Override + public CharSequence getTileLabel() { + return mContext.getString(R.string.quick_settings_heads_up_label); + } + + @Override + public int getMetricsCategory() { + return MetricsEvent.ICE; + } + + @Override + public void handleSetListening(boolean listening) { + // Do nothing + } +} diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/InternetTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/InternetTile.java index 04baa94dc54e..b6d0e1b1ce6e 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/InternetTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/InternetTile.java @@ -68,7 +68,6 @@ import com.android.systemui.statusbar.connectivity.NetworkController; import com.android.systemui.statusbar.connectivity.SignalCallback; import com.android.systemui.statusbar.connectivity.WifiIcons; import com.android.systemui.statusbar.connectivity.WifiIndicators; -import com.android.systemui.util.CarrierNameCustomization; import java.io.PrintWriter; @@ -94,7 +93,6 @@ public class InternetTile extends QSTileImpl<SignalState> { protected final InternetSignalCallback mSignalCallback = new InternetSignalCallback(); private final InternetDialogFactory mInternetDialogFactory; final Handler mHandler; - private CarrierNameCustomization mCarrierNameCustomization; @Inject public InternetTile( @@ -109,8 +107,7 @@ public class InternetTile extends QSTileImpl<SignalState> { QSLogger qsLogger, NetworkController networkController, AccessPointController accessPointController, - InternetDialogFactory internetDialogFactory, - CarrierNameCustomization carrierNameCustomization + InternetDialogFactory internetDialogFactory ) { super(host, uiEventLogger, backgroundLooper, mainHandler, falsingManager, metricsLogger, statusBarStateController, activityStarter, qsLogger); @@ -120,7 +117,6 @@ public class InternetTile extends QSTileImpl<SignalState> { mAccessPointController = accessPointController; mDataController = mController.getMobileDataController(); mController.observe(getLifecycle(), mSignalCallback); - mCarrierNameCustomization = carrierNameCustomization; } @Override @@ -350,14 +346,8 @@ public class InternetTile extends QSTileImpl<SignalState> { return; } synchronized (mCellularInfo) { - if (mCarrierNameCustomization.isRoamingCustomizationEnabled() - && mCarrierNameCustomization.isRoaming(indicators.subId)) { - mCellularInfo.mDataSubscriptionName = - mCarrierNameCustomization.getRoamingCarrierName(indicators.subId); - } else { - mCellularInfo.mDataSubscriptionName = indicators.qsDescription == null - ? mController.getMobileDataNetworkName() : indicators.qsDescription; - } + mCellularInfo.mDataSubscriptionName = indicators.qsDescription == null + ? mController.getMobileDataNetworkName() : indicators.qsDescription; mCellularInfo.mDataContentDescription = indicators.qsDescription != null ? indicators.typeContentDescriptionHtml : null; mCellularInfo.mMobileSignalIconId = indicators.qsIcon.icon; diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/NfcTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/NfcTile.java index 29ccb76de820..7baf40d01206 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/NfcTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/NfcTile.java @@ -89,6 +89,7 @@ public class NfcTile extends QSTileImpl<BooleanState> { @Override public void handleSetListening(boolean listening) { super.handleSetListening(listening); + if (mListening == listening) return; mListening = listening; if (mListening) { mBroadcastDispatcher.registerReceiver(mNfcReceiver, @@ -155,7 +156,7 @@ public class NfcTile extends QSTileImpl<BooleanState> { private NfcAdapter getAdapter() { if (mAdapter == null) { try { - mAdapter = NfcAdapter.getDefaultAdapter(mContext); + mAdapter = NfcAdapter.getNfcAdapter(mContext.getApplicationContext()); } catch (UnsupportedOperationException e) { mAdapter = null; } diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/dialog/InternetDialog.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/dialog/InternetDialog.java index 8bed9c53465c..0ae53b8fbc65 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/dialog/InternetDialog.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/dialog/InternetDialog.java @@ -339,6 +339,7 @@ public class InternetDialog extends SystemUIDialog implements mHandler.removeCallbacks(mHideProgressBarRunnable); mHandler.removeCallbacks(mHideSearchingRunnable); mMobileNetworkLayout.setOnClickListener(null); + mMobileNetworkLayout.setOnLongClickListener(null); mMobileDataToggle.setOnCheckedChangeListener(null); mConnectedWifListLayout.setOnClickListener(null); if (mSecondaryMobileNetworkLayout != null) { @@ -411,6 +412,13 @@ public class InternetDialog extends SystemUIDialog implements } mInternetDialogController.connectCarrierNetwork(); }); + mMobileNetworkLayout.setOnLongClickListener(v -> { + if (!mInternetDialogController.isDeviceLocked()) { + mInternetDialogController.launchMobileNetworkSettings(v, mDefaultDataSubId); + return true; + } + return false; + }); mMobileDataToggle.setOnCheckedChangeListener( (buttonView, isChecked) -> { if (!isChecked && shouldShowMobileDialog(mDefaultDataSubId)) { diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/dialog/InternetDialogController.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/dialog/InternetDialogController.java index f519e611328a..125a91e8a74d 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/dialog/InternetDialogController.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/dialog/InternetDialogController.java @@ -98,7 +98,6 @@ import com.android.systemui.statusbar.policy.LocationController; import com.android.systemui.toast.SystemUIToast; import com.android.systemui.toast.ToastFactory; import com.android.systemui.util.CarrierConfigTracker; -import com.android.systemui.util.CarrierNameCustomization; import com.android.systemui.util.settings.GlobalSettings; import com.android.wifitrackerlib.MergedCarrierEntry; import com.android.wifitrackerlib.WifiEntry; @@ -229,7 +228,6 @@ public class InternetDialogController implements AccessPointController.AccessPoi protected ConnectedWifiInternetMonitor mConnectedWifiInternetMonitor; @VisibleForTesting protected boolean mCarrierNetworkChangeMode; - private CarrierNameCustomization mCarrierNameCustomization; private boolean mIsSmartDdsSwitchFeatureAvailable; private boolean mIsExtTelServiceConnected = false; @@ -296,8 +294,7 @@ public class InternetDialogController implements AccessPointController.AccessPoi LocationController locationController, DialogLaunchAnimator dialogLaunchAnimator, WifiStateWorker wifiStateWorker, - FeatureFlags featureFlags, - CarrierNameCustomization carrierNameCustomization + FeatureFlags featureFlags ) { if (DEBUG) { Log.d(TAG, "Init InternetDialogController"); @@ -332,7 +329,6 @@ public class InternetDialogController implements AccessPointController.AccessPoi mConnectedWifiInternetMonitor = new ConnectedWifiInternetMonitor(); mWifiStateWorker = wifiStateWorker; mFeatureFlags = featureFlags; - mCarrierNameCustomization = carrierNameCustomization; mExtTelephonyManager = ExtTelephonyManager.getInstance(context); } @@ -725,12 +721,7 @@ public class InternetDialogController implements AccessPointController.AccessPoi } CharSequence getMobileNetworkTitle(int subId) { - if (mCarrierNameCustomization.isRoamingCustomizationEnabled() - && mCarrierNameCustomization.isRoaming(subId)) { - return mCarrierNameCustomization.getRoamingCarrierName(subId); - } else { - return getUniqueSubscriptionDisplayName(subId, mContext); - } + return getUniqueSubscriptionDisplayName(subId, mContext); } String getMobileNetworkSummary(int subId) { @@ -821,6 +812,10 @@ public class InternetDialogController implements AccessPointController.AccessPoi void launchMobileNetworkSettings(View view) { final int subId = getActiveAutoSwitchNonDdsSubId(); + launchMobileNetworkSettings(view, subId); + } + + void launchMobileNetworkSettings(View view, int subId) { if (subId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) { Log.w(TAG, "launchMobileNetworkSettings fail, invalid subId:" + subId); return; diff --git a/packages/SystemUI/src/com/android/systemui/screenshot/ImageExporter.java b/packages/SystemUI/src/com/android/systemui/screenshot/ImageExporter.java index 5ad16f0a6078..16581ae630ea 100644 --- a/packages/SystemUI/src/com/android/systemui/screenshot/ImageExporter.java +++ b/packages/SystemUI/src/com/android/systemui/screenshot/ImageExporter.java @@ -391,19 +391,8 @@ public class ImageExporter { static void updateExifAttributes(ExifInterface exif, UUID uniqueId, int width, int height, ZonedDateTime captureTime) { - exif.setAttribute(ExifInterface.TAG_IMAGE_UNIQUE_ID, uniqueId.toString()); - - exif.setAttribute(ExifInterface.TAG_SOFTWARE, "Android " + Build.DISPLAY); exif.setAttribute(ExifInterface.TAG_IMAGE_WIDTH, Integer.toString(width)); exif.setAttribute(ExifInterface.TAG_IMAGE_LENGTH, Integer.toString(height)); - - String dateTime = DateTimeFormatter.ofPattern("yyyy:MM:dd HH:mm:ss").format(captureTime); - String subSec = DateTimeFormatter.ofPattern("SSS").format(captureTime); - String timeZone = DateTimeFormatter.ofPattern("xxx").format(captureTime); - - exif.setAttribute(ExifInterface.TAG_DATETIME_ORIGINAL, dateTime); - exif.setAttribute(ExifInterface.TAG_SUBSEC_TIME_ORIGINAL, subSec); - exif.setAttribute(ExifInterface.TAG_OFFSET_TIME_ORIGINAL, timeZone); } static String getMimeType(CompressFormat format) { diff --git a/packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotController.java b/packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotController.java index b59106efb769..bf61cfb11cc1 100644 --- a/packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotController.java +++ b/packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotController.java @@ -54,6 +54,7 @@ import android.graphics.Insets; import android.graphics.Rect; import android.hardware.display.DisplayManager; import android.media.AudioAttributes; +import android.media.AudioManager; import android.media.AudioSystem; import android.media.MediaPlayer; import android.net.Uri; @@ -62,6 +63,8 @@ import android.os.Process; import android.os.RemoteException; import android.os.UserHandle; import android.os.UserManager; +import android.os.VibrationEffect; +import android.os.Vibrator; import android.provider.Settings; import android.util.DisplayMetrics; import android.util.Log; @@ -255,7 +258,7 @@ public class ScreenshotController { // From WizardManagerHelper.java private static final String SETTINGS_SECURE_USER_SETUP_COMPLETE = "user_setup_complete"; - private static final int SCREENSHOT_CORNER_DEFAULT_TIMEOUT_MILLIS = 6000; + private static final int SCREENSHOT_CORNER_DEFAULT_TIMEOUT_MILLIS = 3000; private final WindowContext mContext; private final FeatureFlags mFlags; @@ -271,6 +274,7 @@ public class ScreenshotController { private final WindowManager mWindowManager; private final WindowManager.LayoutParams mWindowLayoutParams; private final AccessibilityManager mAccessibilityManager; + private final AudioManager mAudioManager; private final ListenableFuture<MediaPlayer> mCameraSound; private final ScrollCaptureClient mScrollCaptureClient; private final PhoneWindow mWindow; @@ -278,6 +282,7 @@ public class ScreenshotController { private final DisplayTracker mDisplayTracker; private final ScrollCaptureController mScrollCaptureController; private final LongScreenshotData mLongScreenshotHolder; + private final Vibrator mVibrator; private final boolean mIsLowRamDevice; private final ScreenshotNotificationSmartActionsProvider mScreenshotNotificationSmartActionsProvider; @@ -386,6 +391,10 @@ public class ScreenshotController { // Setup the Camera shutter sound mCameraSound = loadCameraSound(); + // Grab system services needed for screenshot sound + mAudioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE); + mVibrator = (Vibrator) mContext.getSystemService(Context.VIBRATOR_SERVICE); + mCopyBroadcastReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { @@ -911,12 +920,21 @@ public class ScreenshotController { private void playCameraSound() { mCameraSound.addListener(() -> { - try { - MediaPlayer player = mCameraSound.get(); - if (player != null) { - player.start(); - } - } catch (InterruptedException | ExecutionException e) { + switch (mAudioManager.getRingerMode()) { + case AudioManager.RINGER_MODE_NORMAL: + // Play the shutter sound to notify that we've taken a screenshot + try { + MediaPlayer player = mCameraSound.get(); + if (player != null) { + player.start(); + } + } catch (InterruptedException | ExecutionException e) { + } + case AudioManager.RINGER_MODE_VIBRATE: + if (mVibrator != null && mVibrator.hasVibrator()) { + mVibrator.vibrate(VibrationEffect.createOneShot(50, + VibrationEffect.DEFAULT_AMPLITUDE)); + } } }, mBgExecutor); } diff --git a/packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotView.java b/packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotView.java index 093c09fff995..b66da98f8f06 100644 --- a/packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotView.java +++ b/packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotView.java @@ -120,8 +120,8 @@ public class ScreenshotView extends FrameLayout implements private static final long SCREENSHOT_TO_CORNER_X_DURATION_MS = 234; private static final long SCREENSHOT_TO_CORNER_Y_DURATION_MS = 500; private static final long SCREENSHOT_TO_CORNER_SCALE_DURATION_MS = 234; - public static final long SCREENSHOT_ACTIONS_EXPANSION_DURATION_MS = 400; - private static final long SCREENSHOT_ACTIONS_ALPHA_DURATION_MS = 100; + public static final long SCREENSHOT_ACTIONS_EXPANSION_DURATION_MS = 300; + private static final long SCREENSHOT_ACTIONS_ALPHA_DURATION_MS = 75; private static final float SCREENSHOT_ACTIONS_START_SCALE_X = .7f; private static final int SWIPE_PADDING_DP = 12; // extra padding around views to allow swipe diff --git a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java index 335aeda766aa..9867ecbee2af 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java +++ b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java @@ -70,6 +70,7 @@ import android.provider.Settings; import android.util.IndentingPrintWriter; import android.util.Log; import android.util.MathUtils; +import android.view.GestureDetector; import android.view.InputDevice; import android.view.LayoutInflater; import android.view.MotionEvent; @@ -217,6 +218,7 @@ import com.android.systemui.statusbar.policy.KeyguardUserSwitcherController; import com.android.systemui.statusbar.policy.KeyguardUserSwitcherView; import com.android.systemui.statusbar.policy.OnHeadsUpChangedListener; import com.android.systemui.statusbar.window.StatusBarWindowStateController; +import com.android.systemui.tuner.TunerService; import com.android.systemui.unfold.SysUIUnfoldComponent; import com.android.systemui.util.Compile; import com.android.systemui.util.LargeScreenUtils; @@ -273,6 +275,8 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump private static final String COUNTER_PANEL_OPEN = "panel_open"; public static final String COUNTER_PANEL_OPEN_QS = "panel_open_qs"; private static final String COUNTER_PANEL_OPEN_PEEK = "panel_open_peek"; + private static final String DOUBLE_TAP_SLEEP_GESTURE = + Settings.Secure.DOUBLE_TAP_SLEEP_GESTURE; private static final Rect M_DUMMY_DIRTY_RECT = new Rect(0, 0, 1, 1); private static final Rect EMPTY_RECT = new Rect(); /** @@ -351,6 +355,7 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump private final QuickSettingsController mQsController; private final InteractionJankMonitor mInteractionJankMonitor; private final TouchHandler mTouchHandler = new TouchHandler(); + private final TunerService mTunerService; private long mDownTime; private boolean mTouchSlopExceededBeforeDown; @@ -503,6 +508,8 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump private final NotificationShadeDepthController mDepthController; private final NavigationBarController mNavigationBarController; private final int mDisplayId; + private boolean mDoubleTapToSleepEnabled; + private GestureDetector mDoubleTapGesture; private final KeyguardIndicationController mKeyguardIndicationController; private int mHeadsUpInset; @@ -748,7 +755,8 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump KeyguardInteractor keyguardInteractor, ActivityStarter activityStarter, EmergencyButtonController.Factory emergencyButtonControllerFactory, - KeyguardFaceAuthInteractor keyguardFaceAuthInteractor) { + KeyguardFaceAuthInteractor keyguardFaceAuthInteractor, + TunerService tunerService) { mInteractionJankMonitor = interactionJankMonitor; keyguardStateController.addCallback(new KeyguardStateController.Callback() { @Override @@ -843,6 +851,7 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump LargeScreenUtils.shouldUseSplitNotificationShade(mResources); mView.setWillNotDraw(!DEBUG_DRAWABLE); mShadeHeaderController = shadeHeaderController; + mTunerService = tunerService; mLayoutInflater = layoutInflater; mFeatureFlags = featureFlags; mAnimateBack = mFeatureFlags.isEnabled(Flags.WM_SHADE_ANIMATE_BACK_GESTURE); @@ -887,6 +896,16 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump }); mBottomAreaShadeAlphaAnimator.setDuration(160); mBottomAreaShadeAlphaAnimator.setInterpolator(Interpolators.ALPHA_OUT); + mDoubleTapGesture = new GestureDetector(mView.getContext(), + new GestureDetector.SimpleOnGestureListener() { + @Override + public boolean onDoubleTap(MotionEvent e) { + if (mPowerManager != null) { + mPowerManager.goToSleep(e.getEventTime()); + } + return true; + } + }); mConversationNotificationManager = conversationNotificationManager; mAuthController = authController; mLockIconViewController = lockIconViewController; @@ -4445,7 +4464,8 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump positionClockAndNotifications(true /* forceUpdate */); } - private final class ShadeAttachStateChangeListener implements View.OnAttachStateChangeListener { + private final class ShadeAttachStateChangeListener implements View.OnAttachStateChangeListener, + TunerService.Tunable { @Override public void onViewAttachedToWindow(View v) { mFragmentService.getFragmentHostManager(mView) @@ -4453,6 +4473,7 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump mStatusBarStateController.addCallback(mStatusBarStateListener); mStatusBarStateListener.onStateChanged(mStatusBarStateController.getState()); mConfigurationController.addCallback(mConfigurationListener); + mTunerService.addTunable(this, DOUBLE_TAP_SLEEP_GESTURE); // Theme might have changed between inflating this view and attaching it to the // window, so // force a call to onThemeChanged @@ -4469,8 +4490,16 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump .removeTagListener(QS.TAG, mQsController.getQsFragmentListener()); mStatusBarStateController.removeCallback(mStatusBarStateListener); mConfigurationController.removeCallback(mConfigurationListener); + mTunerService.removeTunable(this); mFalsingManager.removeTapListener(mFalsingTapListener); } + + @Override + public void onTuningChanged(String key, String newValue) { + if (DOUBLE_TAP_SLEEP_GESTURE.equals(key)) { + mDoubleTapToSleepEnabled = TunerService.parseIntegerSwitch(newValue, true); + } + } } private final class ShadeLayoutChangeListener implements View.OnLayoutChangeListener { @@ -4799,6 +4828,10 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump return false; } + if (mDoubleTapToSleepEnabled && !mPulsing && !mDozing && mBarState == StatusBarState.KEYGUARD) { + mDoubleTapGesture.onTouchEvent(event); + } + // Make sure the next touch won't the blocked after the current ends. if (event.getAction() == MotionEvent.ACTION_UP || event.getAction() == MotionEvent.ACTION_CANCEL) { diff --git a/packages/SystemUI/src/com/android/systemui/shade/PulsingGestureListener.kt b/packages/SystemUI/src/com/android/systemui/shade/PulsingGestureListener.kt index fd82e2fc01fc..702302d5d1ea 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/PulsingGestureListener.kt +++ b/packages/SystemUI/src/com/android/systemui/shade/PulsingGestureListener.kt @@ -60,10 +60,13 @@ class PulsingGestureListener @Inject constructor( ) : GestureDetector.SimpleOnGestureListener(), Dumpable { private var doubleTapEnabled = false private var singleTapEnabled = false + private var doubleTapEnabledNative = false init { - val tunable = Tunable { key: String?, _: String? -> + val tunable = Tunable { key: String?, value: String? -> when (key) { + Settings.Secure.DOUBLE_TAP_TO_WAKE -> + doubleTapEnabledNative = TunerService.parseIntegerSwitch(value, false) Settings.Secure.DOZE_DOUBLE_TAP_GESTURE -> doubleTapEnabled = ambientDisplayConfiguration.doubleTapGestureEnabled( userTracker.userId) @@ -73,6 +76,7 @@ class PulsingGestureListener @Inject constructor( } } tunerService.addTunable(tunable, + Settings.Secure.DOUBLE_TAP_TO_WAKE, Settings.Secure.DOZE_DOUBLE_TAP_GESTURE, Settings.Secure.DOZE_TAP_SCREEN_GESTURE) @@ -109,7 +113,7 @@ class PulsingGestureListener @Inject constructor( // checks MUST be on the ACTION_UP event. if (e.actionMasked == MotionEvent.ACTION_UP && statusBarStateController.isDozing && - (doubleTapEnabled || singleTapEnabled) && + (doubleTapEnabled || singleTapEnabled || doubleTapEnabledNative) && !falsingManager.isProximityNear && !falsingManager.isFalseDoubleTap ) { @@ -126,6 +130,7 @@ class PulsingGestureListener @Inject constructor( override fun dump(pw: PrintWriter, args: Array<out String>) { pw.println("singleTapEnabled=$singleTapEnabled") pw.println("doubleTapEnabled=$doubleTapEnabled") + pw.println("doubleTapEnabledNative=$doubleTapEnabledNative") pw.println("isDocked=${dockManager.isDocked}") pw.println("isProxCovered=${falsingManager.isProximityNear}") } diff --git a/packages/SystemUI/src/com/android/systemui/shade/ShadeHeaderController.kt b/packages/SystemUI/src/com/android/systemui/shade/ShadeHeaderController.kt index 3af75cef3d4c..f132dd95ce4a 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/ShadeHeaderController.kt +++ b/packages/SystemUI/src/com/android/systemui/shade/ShadeHeaderController.kt @@ -304,6 +304,11 @@ constructor( v.pivotY = v.height.toFloat() / 2 } clock.setOnClickListener { launchClockActivity() } + batteryIcon.setOnClickListener { + activityStarter.postStartActivityDismissingKeyguard( + Intent(Intent.ACTION_POWER_USAGE_SUMMARY), 0 + ) + } dumpManager.registerDumpable(this) configurationController.addCallback(configurationControllerListener) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/VibratorHelper.java b/packages/SystemUI/src/com/android/systemui/statusbar/VibratorHelper.java index 324e97294f4e..38219bed09c3 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/VibratorHelper.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/VibratorHelper.java @@ -124,6 +124,14 @@ public class VibratorHelper { } /** + * @see Vibrator#areAllPrimitivesSupported(VibrationEffect.Composition.PrimitiveType int...) + */ + public boolean areAllPrimitivesSupported( + @NonNull @VibrationEffect.Composition.PrimitiveType int... primitiveIds) { + return mVibrator != null && mVibrator.areAllPrimitivesSupported(primitiveIds); + } + + /** * @see Vibrator#cancel() */ public void cancel() { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/connectivity/MobileSignalController.java b/packages/SystemUI/src/com/android/systemui/statusbar/connectivity/MobileSignalController.java index 89e9acef8da4..1b36dd55a7a1 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/connectivity/MobileSignalController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/connectivity/MobileSignalController.java @@ -65,9 +65,6 @@ import com.android.settingslib.mobile.TelephonyIcons; import com.android.settingslib.net.SignalStrengthUtil; import com.android.systemui.R; import com.android.systemui.statusbar.pipeline.mobile.util.MobileMappingsProxy; -import com.android.systemui.statusbar.policy.FiveGServiceClient; -import com.android.systemui.statusbar.policy.FiveGServiceClient.FiveGServiceState; -import com.android.systemui.statusbar.policy.FiveGServiceClient.IFiveGStateListener; import com.android.systemui.util.CarrierConfigTracker; import java.io.PrintWriter; @@ -108,14 +105,6 @@ public class MobileSignalController extends SignalController<MobileState, Mobile private int mCallState = TelephonyManager.CALL_STATE_IDLE; - /****************************SideCar****************************/ - @VisibleForTesting - FiveGStateListener mFiveGStateListener; - @VisibleForTesting - FiveGServiceState mFiveGState; - private FiveGServiceClient mClient; - /**********************************************************/ - private ConnectivityManager mConnectivityManager; private ConnectivityManager.NetworkCallback mNetworkCallback; private boolean mIsConnectionFailed = false; @@ -175,8 +164,6 @@ public class MobileSignalController extends SignalController<MobileState, Mobile mDefaults = defaults; mSubscriptionInfo = info; mMobileMappingsProxy = mobileMappingsProxy; - mFiveGStateListener = new FiveGStateListener(); - mFiveGState = new FiveGServiceState(); mNetworkNameSeparator = getTextIfExists( R.string.status_bar_network_name_separator).toString(); mNetworkNameDefault = getTextIfExists( @@ -467,12 +454,6 @@ public class MobileSignalController extends SignalController<MobileState, Mobile (showDataIconInStatusBar || mConfig.alwaysShowDataRatIcon) ? dataTypeIcon : 0; boolean showTriangle = mCurrentState.enabled && !mCurrentState.airplaneMode; - if ( mConfig.enableRatIconEnhancement ) { - typeIcon = getEnhancementDataRatIcon(); - }else if ( mConfig.enableDdsRatIconEnhancement ) { - typeIcon = getEnhancementDdsRatIcon(); - } - MobileIconGroup vowifiIconGroup = getVowifiIconGroup(); if (mConfig.showVowifiIcon && vowifiIconGroup != null) { typeIcon = vowifiIconGroup.dataType; @@ -663,14 +644,6 @@ public class MobileSignalController extends SignalController<MobileState, Mobile mCurrentState.iconGroup = mDefaultIcons; } - //Modem has centralized logic to display 5G icon based on carrier requirements - //For 5G icon display, only query NrIconType reported by modem - if ( mFiveGState.isNrIconTypeValid() ) { - mCurrentState.iconGroup = mFiveGState.getIconGroup(); - }else { - mCurrentState.iconGroup = getNetworkTypeIconGroup(); - } - mCurrentState.dataConnected = mCurrentState.isDataConnected(); mCurrentState.roaming = isRoaming(); @@ -699,16 +672,6 @@ public class MobileSignalController extends SignalController<MobileState, Mobile mCurrentState.networkNameData = mCurrentState.getOperatorAlphaShort(); } - - if ( mConfig.alwaysShowNetworkTypeIcon ) { - if(!mCurrentState.connected) { - mCurrentState.iconGroup = TelephonyIcons.UNKNOWN; - }else if (mFiveGState.isNrIconTypeValid()) { - mCurrentState.iconGroup = mFiveGState.getIconGroup(); - }else { - mCurrentState.iconGroup = getNetworkTypeIconGroup(); - } - } mCurrentState.mobileDataEnabled = mPhone.isDataEnabled(); mCurrentState.roamingDataEnabled = mPhone.isDataRoamingEnabled(); @@ -820,64 +783,6 @@ public class MobileSignalController extends SignalController<MobileState, Mobile mMobileStatusHistoryIndex = (mMobileStatusHistoryIndex + 1) % STATUS_HISTORY_SIZE; } - public void registerFiveGStateListener(FiveGServiceClient client) { - int phoneId = mSubscriptionInfo.getSimSlotIndex(); - client.registerListener(phoneId, mFiveGStateListener); - mClient = client; - } - - public void unregisterFiveGStateListener(FiveGServiceClient client) { - int phoneId = mSubscriptionInfo.getSimSlotIndex(); - client.unregisterListener(phoneId, mFiveGStateListener); - } - - private MobileIconGroup getNetworkTypeIconGroup() { - MobileIconGroup iconGroup = mDefaultIcons; - int overrideNetworkType = mCurrentState.telephonyDisplayInfo.getOverrideNetworkType(); - String iconKey = null; - if (overrideNetworkType == TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NONE - || overrideNetworkType == TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NR_NSA_MMWAVE - || overrideNetworkType == TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NR_NSA ){ - int networkType = mCurrentState.telephonyDisplayInfo.getNetworkType(); - if (networkType == TelephonyManager.NETWORK_TYPE_UNKNOWN) { - networkType = mCurrentState.getVoiceNetworkType(); - } - iconKey = toIconKey(networkType); - } else{ - iconKey = toDisplayIconKey(overrideNetworkType); - } - - return mNetworkToIconLookup.getOrDefault(iconKey, mDefaultIcons); - } - - private boolean showDataRatIcon() { - boolean result = false; - if ( mCurrentState.mobileDataEnabled ) { - if(mCurrentState.roamingDataEnabled || !mCurrentState.roaming) { - result = true; - } - } - return result; - } - - private int getEnhancementDataRatIcon() { - return showDataRatIcon() && mCurrentState.connected ? getRatIconGroup().dataType : 0; - } - - private int getEnhancementDdsRatIcon() { - return mCurrentState.dataSim && mCurrentState.connected ? getRatIconGroup().dataType : 0; - } - - private MobileIconGroup getRatIconGroup() { - MobileIconGroup iconGroup = mDefaultIcons; - if ( mFiveGState.isNrIconTypeValid() ) { - iconGroup = mFiveGState.getIconGroup(); - }else { - iconGroup = getNetworkTypeIconGroup(); - } - return iconGroup; - } - private boolean isVowifiAvailable() { return mCurrentState.voiceCapable && mCurrentState.imsRegistrationTech == REGISTRATION_TECH_IWLAN; @@ -899,9 +804,6 @@ public class MobileSignalController extends SignalController<MobileState, Mobile pw.println(" mSubscription=" + mSubscriptionInfo + ","); pw.println(" mInflateSignalStrengths=" + mInflateSignalStrengths + ","); pw.println(" isDataDisabled=" + isDataDisabled() + ","); - pw.println(" mConfig.enableRatIconEnhancement=" + mConfig.enableRatIconEnhancement + ","); - pw.println(" mConfig.enableDdsRatIconEnhancement=" - + mConfig.enableDdsRatIconEnhancement + ","); pw.println(" mConfig.alwaysShowNetworkTypeIcon=" + mConfig.alwaysShowNetworkTypeIcon + ","); pw.println(" mConfig.showVowifiIcon=" + mConfig.showVowifiIcon + ","); @@ -922,23 +824,9 @@ public class MobileSignalController extends SignalController<MobileState, Mobile + (mMobileStatusHistoryIndex + STATUS_HISTORY_SIZE - i) + "): " + mMobileStatusHistory[i & (STATUS_HISTORY_SIZE - 1)]); } - pw.println(" mFiveGState=" + mFiveGState + ","); - dumpTableData(pw); } - class FiveGStateListener implements IFiveGStateListener{ - - public void onStateChanged(FiveGServiceState state) { - if (DEBUG) { - Log.d(mTag, "onStateChanged: state=" + state); - } - mFiveGState = state; - updateTelephony(); - notifyListeners(); - } - } - private ImsMmTelManager.CapabilityCallback mCapabilityCallback = new ImsMmTelManager.CapabilityCallback() { @Override diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/connectivity/NetworkControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/connectivity/NetworkControllerImpl.java index 3e7bfa73da7e..1bd6850e422b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/connectivity/NetworkControllerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/connectivity/NetworkControllerImpl.java @@ -86,7 +86,6 @@ import com.android.systemui.statusbar.policy.DataSaverController; import com.android.systemui.statusbar.policy.DataSaverControllerImpl; import com.android.systemui.statusbar.policy.DeviceProvisionedController; import com.android.systemui.statusbar.policy.DeviceProvisionedController.DeviceProvisionedListener; -import com.android.systemui.statusbar.policy.FiveGServiceClient; import com.android.systemui.telephony.TelephonyListenerManager; import com.android.systemui.util.CarrierConfigTracker; @@ -208,9 +207,6 @@ public class NetworkControllerImpl extends BroadcastReceiver private InternetDialogFactory mInternetDialogFactory; private Handler mMainHandler; - @VisibleForTesting - FiveGServiceClient mFiveGServiceClient; - private ConfigurationController.ConfigurationListener mConfigurationListener = new ConfigurationController.ConfigurationListener() { @Override @@ -387,8 +383,6 @@ public class NetworkControllerImpl extends BroadcastReceiver mWifiManager.registerScanResultsCallback(mReceiverHandler::post, scanResultsCallback); } - mFiveGServiceClient = FiveGServiceClient.getInstance(context); - NetworkCallback callback = new NetworkCallback(NetworkCallback.FLAG_INCLUDE_LOCATION_INFO){ private Network mLastNetwork; @@ -500,7 +494,6 @@ public class NetworkControllerImpl extends BroadcastReceiver for (int i = 0; i < mMobileSignalControllers.size(); i++) { MobileSignalController mobileSignalController = mMobileSignalControllers.valueAt(i); mobileSignalController.registerListener(); - mobileSignalController.registerFiveGStateListener(mFiveGServiceClient); } if (mSubscriptionListener == null) { mSubscriptionListener = new SubListener(mBgLooper); @@ -555,17 +548,11 @@ public class NetworkControllerImpl extends BroadcastReceiver for (int i = 0; i < mMobileSignalControllers.size(); i++) { MobileSignalController mobileSignalController = mMobileSignalControllers.valueAt(i); mobileSignalController.unregisterListener(); - mobileSignalController.unregisterFiveGStateListener(mFiveGServiceClient); } mSubscriptionManager.removeOnSubscriptionsChangedListener(mSubscriptionListener); mBroadcastDispatcher.unregisterReceiver(this); } - @VisibleForTesting - public FiveGServiceClient getFiveGServiceClient() { - return mFiveGServiceClient; - } - public int getConnectedWifiLevel() { return mWifiSignalController.getState().level; } @@ -1012,7 +999,6 @@ public class NetworkControllerImpl extends BroadcastReceiver } if (mListening) { controller.registerListener(); - controller.registerFiveGStateListener(mFiveGServiceClient); } } } @@ -1023,7 +1009,6 @@ public class NetworkControllerImpl extends BroadcastReceiver mDefaultSignalController = null; } cachedControllers.get(key).unregisterListener(); - cachedControllers.get(key).unregisterFiveGStateListener(mFiveGServiceClient); } } mCallbackHandler.setSubs(subscriptions); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/KeyguardNotificationVisibilityProvider.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/KeyguardNotificationVisibilityProvider.kt index 90014c2518d1..78225dfe8d86 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/KeyguardNotificationVisibilityProvider.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/KeyguardNotificationVisibilityProvider.kt @@ -87,6 +87,7 @@ private class KeyguardNotificationVisibilityProviderImpl @Inject constructor( private val userTrackerCallback = object : UserTracker.Callback { override fun onUserChanged(newUser: Int, userContext: Context) { + readShowSilentNotificationSetting() if (isLockedOrLocking) { // maybe public mode changed notifyStateChanged("onUserSwitched") diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesCommandQueueCallbacks.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesCommandQueueCallbacks.java index 0ccc81981e58..b4088d0db451 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesCommandQueueCallbacks.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesCommandQueueCallbacks.java @@ -369,7 +369,10 @@ public class CentralSurfacesCommandQueueCallbacks implements CommandQueue.Callba mPowerManager.wakeUp(SystemClock.uptimeMillis(), PowerManager.WAKE_REASON_CAMERA_LAUNCH, "com.android.systemui:CAMERA_GESTURE"); } - vibrateForCameraGesture(); + + if (source != StatusBarManager.CAMERA_LAUNCH_SOURCE_SCREEN_GESTURE) { + vibrateForCameraGesture(); + } if (source == StatusBarManager.CAMERA_LAUNCH_SOURCE_POWER_DOUBLE_TAP) { Log.v(CentralSurfaces.TAG, "Camera launch"); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java index 0f3f7434e603..8cd6ef276f2d 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java @@ -1581,6 +1581,7 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces { IntentFilter filter = new IntentFilter(); filter.addAction(Intent.ACTION_CLOSE_SYSTEM_DIALOGS); filter.addAction(Intent.ACTION_SCREEN_OFF); + filter.addAction(Intent.ACTION_SCREEN_CAMERA_GESTURE); mBroadcastDispatcher.registerReceiver(mBroadcastReceiver, filter, null, UserHandle.ALL); } @@ -2344,6 +2345,21 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces { finishBarAnimations(); resetUserExpandedStates(); } + else if (Intent.ACTION_SCREEN_CAMERA_GESTURE.equals(action)) { + boolean userSetupComplete = Settings.Secure.getInt(mContext.getContentResolver(), + Settings.Secure.USER_SETUP_COMPLETE, 0) != 0; + if (!userSetupComplete) { + if (DEBUG) Log.d(TAG, String.format( + "userSetupComplete = %s, ignoring camera launch gesture.", + userSetupComplete)); + return; + } + + // This gets executed before we will show Keyguard, so post it in order that the + // state is correct. + mMainExecutor.execute(() -> mCommandQueueCallbacks.onCameraLaunchGestureDetected( + StatusBarManager.CAMERA_LAUNCH_SOURCE_SCREEN_GESTURE)); + } Trace.endSection(); } }; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java index f56b6cf03413..e8935765b8aa 100755 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java @@ -341,6 +341,9 @@ public class PhoneStatusBarPolicy mRecordingController.addCallback(this); mCommandQueue.addCallback(this); + + // Get initial user setup state + onUserSetupChanged(); } private String getManagedProfileAccessibilityString() { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/fragment/CollapsedStatusBarFragment.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/fragment/CollapsedStatusBarFragment.java index fcae23b068bf..180758602998 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/fragment/CollapsedStatusBarFragment.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/fragment/CollapsedStatusBarFragment.java @@ -328,7 +328,7 @@ public class CollapsedStatusBarFragment extends Fragment implements CommandQueue boolean showVibrateIcon = mSecureSettings.getIntForUser( Settings.Secure.STATUS_BAR_SHOW_VIBRATE_ICON, - 0, + 1, UserHandle.USER_CURRENT) == 0; // Filter out vibrate icon from the blocklist if the setting is on diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/fragment/StatusBarIconBlocklist.kt b/packages/SystemUI/src/com/android/systemui/statusbar/phone/fragment/StatusBarIconBlocklist.kt index b845bada29dc..79d22bde3525 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/fragment/StatusBarIconBlocklist.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/fragment/StatusBarIconBlocklist.kt @@ -42,7 +42,7 @@ fun getStatusBarIconBlocklist( val vibrateIconSlot: String = res.getString(R.string.status_bar_volume) val showVibrateIcon = settings.getIntForUser( Settings.Secure.STATUS_BAR_SHOW_VIBRATE_ICON, - 0, + 1, UserHandle.USER_CURRENT) == 0 // Filter out vibrate icon from the blocklist if the setting is on diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/data/model/MobileIconCustomizationMode.kt b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/data/model/MobileIconCustomizationMode.kt index 53955fc8a99c..c6b974600903 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/data/model/MobileIconCustomizationMode.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/data/model/MobileIconCustomizationMode.kt @@ -8,14 +8,12 @@ package com.android.systemui.statusbar.pipeline.mobile.data.model import android.telephony.CellSignalStrength.SIGNAL_STRENGTH_NONE_OR_UNKNOWN import android.telephony.ims.stub.ImsRegistrationImplBase import android.telephony.TelephonyManager.NETWORK_TYPE_UNKNOWN -import com.android.systemui.statusbar.policy.FiveGServiceClient.FiveGServiceState data class MobileIconCustomizationMode( val alwaysUseRsrpLevelForLte: Boolean = false, val lteRsrpLevel: Int = SIGNAL_STRENGTH_NONE_OR_UNKNOWN, val dataNetworkType: Int = NETWORK_TYPE_UNKNOWN, val voiceNetworkType: Int = NETWORK_TYPE_UNKNOWN, - val fiveGServiceState: FiveGServiceState = FiveGServiceState(), val isRatCustomization: Boolean = false, val alwaysShowNetworkTypeIcon: Boolean = false, val ddsRatIconEnhancementEnabled: Boolean = false, @@ -29,4 +27,4 @@ data class MobileIconCustomizationMode( val videoCapable: Boolean = false, val imsRegistered: Boolean = false, val imsRegistrationTech: Int = ImsRegistrationImplBase.REGISTRATION_TECH_NONE, -)
\ No newline at end of file +) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/MobileConnectionRepositoryImpl.kt b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/MobileConnectionRepositoryImpl.kt index 13b3065b4027..3b434bae1b94 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/MobileConnectionRepositoryImpl.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/MobileConnectionRepositoryImpl.kt @@ -86,9 +86,6 @@ import com.android.systemui.statusbar.pipeline.mobile.data.repository.MobileConn import com.android.systemui.statusbar.pipeline.mobile.util.MobileMappingsProxy import com.android.systemui.statusbar.pipeline.shared.data.model.DataActivityModel import com.android.systemui.statusbar.pipeline.shared.data.model.toMobileDataActivityModel -import com.android.systemui.statusbar.policy.FiveGServiceClient -import com.android.systemui.statusbar.policy.FiveGServiceClient.FiveGServiceState -import com.android.systemui.statusbar.policy.FiveGServiceClient.IFiveGStateListener import com.qti.extphone.NrIconType import javax.inject.Inject import kotlinx.coroutines.CoroutineDispatcher @@ -129,7 +126,6 @@ class MobileConnectionRepositoryImpl( logger: MobileInputLogger, override val tableLogBuffer: TableLogBuffer, scope: CoroutineScope, - private val fiveGServiceClient: FiveGServiceClient, private val connectivityManager: ConnectivityManager ) : MobileConnectionRepository { init { @@ -173,8 +169,7 @@ class MobileConnectionRepositoryImpl( TelephonyCallback.DataActivityListener, TelephonyCallback.CarrierNetworkListener, TelephonyCallback.DisplayInfoListener, - TelephonyCallback.DataEnabledListener, - FiveGServiceClient.IFiveGStateListener { + TelephonyCallback.DataEnabledListener { override fun onServiceStateChanged(serviceState: ServiceState) { logger.logOnServiceStateChanged(serviceState, subId) trySend(CallbackEvent.OnServiceStateChanged(serviceState)) @@ -214,11 +209,6 @@ class MobileConnectionRepositoryImpl( logger.logOnDataEnabledChanged(enabled, subId) trySend(CallbackEvent.OnDataEnabledChanged(enabled)) } - - override fun onStateChanged(serviceState: FiveGServiceState) { - logger.logOnNrIconTypeChanged(serviceState.nrIconType, subId) - trySend(CallbackEvent.OnNrIconTypeChanged(serviceState.nrIconType)) - } } val imsStateCallback = @@ -238,7 +228,6 @@ class MobileConnectionRepositoryImpl( telephonyManager.registerTelephonyCallback(bgDispatcher.asExecutor(), callback) val slotIndex = getSlotIndex(subId) - fiveGServiceClient.registerListener(slotIndex, callback) try { imsMmTelManager.registerImsStateCallback(context.mainExecutor, imsStateCallback) } catch (exception: ImsException) { @@ -246,7 +235,6 @@ class MobileConnectionRepositoryImpl( } awaitClose { telephonyManager.unregisterTelephonyCallback(callback) - fiveGServiceClient.unregisterListener(slotIndex, callback) try { imsMmTelManager.unregisterImsStateCallback(imsStateCallback) } catch (exception: Exception) { @@ -614,7 +602,6 @@ class MobileConnectionRepositoryImpl( private val mobileMappingsProxy: MobileMappingsProxy, @Background private val bgDispatcher: CoroutineDispatcher, @Application private val scope: CoroutineScope, - private val fiveGServiceClient: FiveGServiceClient, private val connectivityManager: ConnectivityManager ) { fun build( @@ -636,7 +623,6 @@ class MobileConnectionRepositoryImpl( logger, mobileLogger, scope, - fiveGServiceClient, connectivityManager ) } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/domain/interactor/MobileIconInteractor.kt b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/domain/interactor/MobileIconInteractor.kt index faebb9d764c9..3343d4d6f6cd 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/domain/interactor/MobileIconInteractor.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/domain/interactor/MobileIconInteractor.kt @@ -45,7 +45,6 @@ import com.android.systemui.statusbar.pipeline.mobile.domain.model.NetworkTypeIc import com.android.systemui.statusbar.pipeline.mobile.domain.model.NetworkTypeIconModel.DefaultIcon import com.android.systemui.statusbar.pipeline.mobile.domain.model.NetworkTypeIconModel.OverriddenIcon import com.android.systemui.statusbar.pipeline.shared.data.model.DataActivityModel -import com.android.systemui.statusbar.policy.FiveGServiceClient.FiveGServiceState import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.Flow @@ -278,7 +277,6 @@ class MobileIconInteractorImpl( MobileIconCustomizationMode( dataNetworkType = signalStrengthCustomization.dataNetworkType, voiceNetworkType = signalStrengthCustomization.voiceNetworkType, - fiveGServiceState = FiveGServiceState(nrIconType), isRatCustomization = networkTypeIconCustomization.isRatCustomization, alwaysShowNetworkTypeIcon = networkTypeIconCustomization.alwaysShowNetworkTypeIcon, @@ -336,8 +334,7 @@ class MobileIconInteractorImpl( is ResolvedNetworkType.CarrierMergedNetworkType -> resolvedNetworkType.iconGroupOverride else -> { - getMobileIconGroup(resolvedNetworkType, mobileIconCustomization, mapping) - ?: defaultGroup + mapping[resolvedNetworkType.lookupKey] ?: defaultGroup } } } @@ -425,39 +422,4 @@ class MobileIconInteractorImpl( || mobileIconCustmization.voiceNetworkType == TelephonyManager.NETWORK_TYPE_LTE || mobileIconCustmization.voiceNetworkType == TelephonyManager.NETWORK_TYPE_LTE_CA) } - - private fun getMobileIconGroup(resolvedNetworkType: ResolvedNetworkType, - customizationInfo: MobileIconCustomizationMode, - mapping: Map<String, MobileIconGroup>): MobileIconGroup ?{ - return if (customizationInfo.fiveGServiceState.isNrIconTypeValid) { - customizationInfo.fiveGServiceState.iconGroup - } else { - when (resolvedNetworkType) { - is DefaultNetworkType -> - mapping[resolvedNetworkType.lookupKey] - is OverrideNetworkType -> - mapping[getLookupKey(resolvedNetworkType, customizationInfo)] - else -> - mapping[MobileMappings.toIconKey(customizationInfo.voiceNetworkType)] - } - } - } - - private fun getLookupKey(resolvedNetworkType: ResolvedNetworkType, - customizationInfo: MobileIconCustomizationMode): String { - return if (isNsa(resolvedNetworkType.networkType)) { - if (customizationInfo.dataNetworkType == TelephonyManager.NETWORK_TYPE_UNKNOWN) { - MobileMappings.toIconKey(customizationInfo.voiceNetworkType) - }else { - MobileMappings.toIconKey(customizationInfo.dataNetworkType) - } - }else { - resolvedNetworkType.lookupKey - } - } - - private fun isNsa(networkType: Int): Boolean { - return networkType == TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NR_NSA_MMWAVE - || networkType == TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NR_NSA - } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/FiveGServiceClient.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/FiveGServiceClient.java deleted file mode 100644 index 11e0949da463..000000000000 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/FiveGServiceClient.java +++ /dev/null @@ -1,387 +0,0 @@ -/* - * Copyright (c) 2018, The Linux Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of The Linux Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -package com.android.systemui.statusbar.policy; - -import android.content.ComponentName; -import android.content.Context; -import android.content.ServiceConnection; -import android.net.Uri; -import android.os.Handler; -import android.os.IBinder; -import android.os.Message; -import android.os.DeadObjectException; -import android.os.RemoteException; -import android.util.Log; -import android.util.SparseArray; - -import com.google.android.collect.Lists; -import com.android.internal.annotations.VisibleForTesting; - -import java.lang.Exception; -import java.util.ArrayList; -import java.util.concurrent.CopyOnWriteArrayList; -import java.lang.ref.WeakReference; -import javax.inject.Inject; - -import com.android.keyguard.KeyguardUpdateMonitorCallback; -import com.android.settingslib.mobile.TelephonyIcons; -import com.android.settingslib.SignalIcon.MobileIconGroup; -import com.android.systemui.R; -import com.android.systemui.dagger.SysUISingleton; - -import com.qti.extphone.Client; -import com.qti.extphone.ExtTelephonyManager; -import com.qti.extphone.IExtPhoneCallback; -import com.qti.extphone.ExtPhoneCallbackListener; -import com.qti.extphone.NrIconType; -import com.qti.extphone.Status; -import com.qti.extphone.ServiceCallback; -import com.qti.extphone.Token; - -@SysUISingleton -public class FiveGServiceClient { - private static final String TAG = "FiveGServiceClient"; - private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG)||true; - private static final int MESSAGE_REBIND = 1024; - private static final int MESSAGE_REINIT = MESSAGE_REBIND+1; - private static final int MESSAGE_NOTIFIY_MONITOR_CALLBACK = MESSAGE_REBIND+2; - private static final int MAX_RETRY = 4; - private static final int DELAY_MILLISECOND = 3000; - private static final int DELAY_INCREMENT = 2000; - - private static FiveGServiceClient sInstance; - private final ArrayList<WeakReference<KeyguardUpdateMonitorCallback>> - mKeyguardUpdateMonitorCallbacks = Lists.newArrayList(); - @VisibleForTesting - final SparseArray<CopyOnWriteArrayList<IFiveGStateListener>> mStatesListeners = - new SparseArray<>(); - private final SparseArray<FiveGServiceState> mCurrentServiceStates = new SparseArray<>(); - private final SparseArray<FiveGServiceState> mLastServiceStates = new SparseArray<>(); - - private Context mContext; - private boolean mServiceConnected; - private String mPackageName; - private Client mClient; - private int mInitRetryTimes = 0; - private ExtTelephonyManager mExtTelephonyManager; - private boolean mIsConnectInProgress = false; - - public static class FiveGServiceState{ - private static final String COL_NR_ICON_TYPE = "NrIconType"; - private int mNrIconType; - private MobileIconGroup mIconGroup; - - public FiveGServiceState(){ - mNrIconType = NrIconType.INVALID; - mIconGroup = TelephonyIcons.UNKNOWN; - } - - @VisibleForTesting - public FiveGServiceState(int nrIconType){ - mNrIconType = nrIconType; - mIconGroup = getNrIconGroup(nrIconType, 0); - } - - public boolean isNrIconTypeValid() { - return mNrIconType != NrIconType.INVALID && mNrIconType != NrIconType.TYPE_NONE; - } - - @VisibleForTesting - public MobileIconGroup getIconGroup() { - return mIconGroup; - } - - @VisibleForTesting - public int getNrIconType() { - return mNrIconType; - } - - public void copyFrom(FiveGServiceState state) { - this.mIconGroup = state.mIconGroup; - this.mNrIconType = state.mNrIconType; - } - - public boolean equals(FiveGServiceState state) { - return this.mIconGroup == state.mIconGroup - && this.mNrIconType == state.mNrIconType; - } - @Override - public String toString() { - StringBuilder builder = new StringBuilder(); - builder.append("mNrIconType=").append(mNrIconType).append(", "). - append("mIconGroup=").append(mIconGroup); - - return builder.toString(); - } - } - - @Inject - public FiveGServiceClient(Context context) { - mContext = context; - mPackageName = mContext.getPackageName(); - if (mExtTelephonyManager == null) { - mExtTelephonyManager = ExtTelephonyManager.getInstance(mContext); - } - } - - public static FiveGServiceClient getInstance(Context context) { - if ( sInstance == null ) { - sInstance = new FiveGServiceClient(context); - } - - return sInstance; - } - - public void registerCallback(KeyguardUpdateMonitorCallback callback) { - mKeyguardUpdateMonitorCallbacks.add( - new WeakReference<KeyguardUpdateMonitorCallback>(callback)); - } - - public void registerListener(int phoneId, IFiveGStateListener listener) { - Log.d(TAG, "registerListener phoneId=" + phoneId + " listener: " + listener); - resetState(phoneId); - CopyOnWriteArrayList<IFiveGStateListener> statesListenersForPhone = - mStatesListeners.get(phoneId); - if (statesListenersForPhone == null) { - statesListenersForPhone = new CopyOnWriteArrayList<>(); - mStatesListeners.put(phoneId, statesListenersForPhone); - } - statesListenersForPhone.add(listener); - - if ( !isServiceConnected() ) { - connectService(); - }else{ - initFiveGServiceState(phoneId); - } - } - - private void resetState(int phoneId) { - Log.d(TAG, "resetState phoneId=" + phoneId); - FiveGServiceState currentState = getCurrentServiceState(phoneId); - currentState.mNrIconType = NrIconType.INVALID; - currentState.mIconGroup = TelephonyIcons.UNKNOWN; - - FiveGServiceState lastState = getLastServiceState(phoneId); - lastState.mNrIconType = NrIconType.INVALID; - lastState.mIconGroup = TelephonyIcons.UNKNOWN; - } - - public void unregisterListener(int phoneId, IFiveGStateListener fiveGStateListener) { - Log.d(TAG, "unregisterListener phoneId=" + phoneId + " listener: " + fiveGStateListener); - CopyOnWriteArrayList<IFiveGStateListener> statesListenersForPhone = - mStatesListeners.get(phoneId); - if (statesListenersForPhone != null) { - statesListenersForPhone.remove(fiveGStateListener); - if (statesListenersForPhone.size() == 0) { - mStatesListeners.remove(phoneId); - mCurrentServiceStates.remove(phoneId); - mLastServiceStates.remove(phoneId); - } - } - } - - public boolean isServiceConnected() { - return mServiceConnected; - } - - private void connectService() { - if (!isServiceConnected() && !mIsConnectInProgress) { - mIsConnectInProgress = true; - Log.d(TAG, "Connect to ExtTelephony bound service..."); - mExtTelephonyManager.connectService(mServiceCallback); - } - } - - private ServiceCallback mServiceCallback = new ServiceCallback() { - @Override - public void onConnected() { - Log.d(TAG, "ExtTelephony Service connected"); - int[] events = new int[] { - ExtPhoneCallbackListener.EVENT_ON_NR_ICON_TYPE}; - mServiceConnected = true; - mIsConnectInProgress = false; - mClient = mExtTelephonyManager.registerCallbackWithEvents( - mPackageName, mExtPhoneCallbackListener, events); - initFiveGServiceState(); - Log.d(TAG, "Client = " + mClient); - } - @Override - public void onDisconnected() { - Log.d(TAG, "ExtTelephony Service disconnected..."); - if (mServiceConnected) { - mExtTelephonyManager.unregisterCallback(mExtPhoneCallbackListener); - } - mServiceConnected = false; - mClient = null; - mIsConnectInProgress = false; - mHandler.sendEmptyMessageDelayed(MESSAGE_REBIND, - DELAY_MILLISECOND + DELAY_INCREMENT); - } - }; - - @VisibleForTesting - public FiveGServiceState getCurrentServiceState(int phoneId) { - return getServiceState(phoneId, mCurrentServiceStates); - } - - private FiveGServiceState getLastServiceState(int phoneId) { - return getServiceState(phoneId, mLastServiceStates); - } - - private static FiveGServiceState getServiceState(int key, - SparseArray<FiveGServiceState> array) { - FiveGServiceState state = array.get(key); - if ( state == null ) { - state = new FiveGServiceState(); - array.put(key, state); - } - return state; - } - - private void notifyListenersIfNecessary(int phoneId) { - FiveGServiceState currentState = getCurrentServiceState(phoneId); - FiveGServiceState lastState = getLastServiceState(phoneId); - if ( !currentState.equals(lastState) ) { - - if ( DEBUG ) { - Log.d(TAG, "phoneId(" + phoneId + ") Change in state from " + lastState + " \n"+ - "\tto " + currentState); - - } - - lastState.copyFrom(currentState); - CopyOnWriteArrayList<IFiveGStateListener> statesListenersForPhone = - mStatesListeners.get(phoneId); - if (statesListenersForPhone != null) { - for (IFiveGStateListener listener: statesListenersForPhone) { - if (listener != null) { - listener.onStateChanged(currentState); - } - } - } - mHandler.sendEmptyMessage(MESSAGE_NOTIFIY_MONITOR_CALLBACK); - } - } - - private void initFiveGServiceState() { - Log.d(TAG, "initFiveGServiceState size=" + mStatesListeners.size()); - for( int i=0; i < mStatesListeners.size(); ++i ) { - int phoneId = mStatesListeners.keyAt(i); - initFiveGServiceState(phoneId); - } - } - - private void initFiveGServiceState(int phoneId) { - Log.d(TAG, "mServiceConnected=" + mServiceConnected + " mClient=" + mClient); - if ( mServiceConnected && mClient != null) { - Log.d(TAG, "query 5G service state for phoneId " + phoneId); - try { - Token token = mExtTelephonyManager.queryNrIconType(phoneId, mClient); - Log.d(TAG, "queryNrIconType result:" + token); - } catch (Exception e) { - Log.d(TAG, "initFiveGServiceState: Exception = " + e); - if ( mInitRetryTimes < MAX_RETRY && !mHandler.hasMessages(MESSAGE_REINIT) ) { - mHandler.sendEmptyMessageDelayed(MESSAGE_REINIT, - DELAY_MILLISECOND + mInitRetryTimes*DELAY_INCREMENT); - mInitRetryTimes +=1; - } - } - } - } - - @VisibleForTesting - void update5GIcon(FiveGServiceState state,int phoneId) { - state.mIconGroup = getNrIconGroup(state.mNrIconType, phoneId); - } - - private static MobileIconGroup getNrIconGroup(int nrIconType , int phoneId) { - MobileIconGroup iconGroup = TelephonyIcons.UNKNOWN; - switch (nrIconType){ - case NrIconType.TYPE_5G_BASIC: - iconGroup = TelephonyIcons.FIVE_G_BASIC; - break; - case NrIconType.TYPE_5G_UWB: - iconGroup = TelephonyIcons.FIVE_G_UWB; - break; - } - return iconGroup; - } - - private void notifyMonitorCallback() { - for (int i = 0; i < mKeyguardUpdateMonitorCallbacks.size(); i++) { - KeyguardUpdateMonitorCallback cb = mKeyguardUpdateMonitorCallbacks.get(i).get(); - if (cb != null) { - cb.onRefreshCarrierInfo(); - } - } - } - - private Handler mHandler = new Handler() { - public void handleMessage(Message msg) { - int what = msg.what; - switch ( msg.what ) { - case MESSAGE_REBIND: - connectService(); - break; - - case MESSAGE_REINIT: - initFiveGServiceState(); - break; - - case MESSAGE_NOTIFIY_MONITOR_CALLBACK: - notifyMonitorCallback(); - break; - } - - } - }; - - - @VisibleForTesting - protected ExtPhoneCallbackListener mExtPhoneCallbackListener = new ExtPhoneCallbackListener() { - @Override - public void onNrIconType(int slotId, Token token, Status status, NrIconType - nrIconType) throws RemoteException { - Log.d(TAG, - "onNrIconType: slotId = " + slotId + " token = " + token + " " + "status" - + status + " NrIconType = " + nrIconType); - if (status.get() == Status.SUCCESS) { - FiveGServiceState state = getCurrentServiceState(slotId); - state.mNrIconType = nrIconType.get(); - update5GIcon(state, slotId); - notifyListenersIfNecessary(slotId); - } - } - }; - - public interface IFiveGStateListener { - public void onStateChanged(FiveGServiceState state); - } -} diff --git a/packages/SystemUI/src/com/android/systemui/theme/ThemeOverlayController.java b/packages/SystemUI/src/com/android/systemui/theme/ThemeOverlayController.java index b78329cfa5aa..0b56084b0271 100644 --- a/packages/SystemUI/src/com/android/systemui/theme/ThemeOverlayController.java +++ b/packages/SystemUI/src/com/android/systemui/theme/ThemeOverlayController.java @@ -46,6 +46,7 @@ import android.content.res.Resources; import android.database.ContentObserver; import android.graphics.Color; import android.net.Uri; +import android.os.SystemProperties; import android.os.Handler; import android.os.UserHandle; import android.os.UserManager; @@ -508,6 +509,24 @@ public class ThemeOverlayController implements CoreStartable, Dumpable { }); } + private void setBootColorProps() { + int[] bootColors = { + android.R.color.system_accent3_100, // persist.bootanim.color1 + android.R.color.system_accent1_300, // persist.bootanim.color2 + android.R.color.system_accent2_500, // persist.bootanim.color3 + android.R.color.system_accent1_100, // persist.bootanim.color4 + }; + try { + for (int i = 0; i < bootColors.length; i++) { + String color = String.valueOf(mResources.getColor(bootColors[i])); + SystemProperties.set(String.format("persist.bootanim.color%d", i + 1), color); + Log.d(TAG, String.format("Writing boot animation colors %d: %s", i, color)); + } + } catch (RuntimeException e) { + Log.w(TAG, "Cannot set sysprop. Look for 'init' and 'dmesg' logs for more info."); + } + } + private void reevaluateSystemTheme(boolean forceReload) { final WallpaperColors currentColors = mCurrentColors.get(mUserTracker.getUserId()); final int mainColor; @@ -533,6 +552,8 @@ public class ThemeOverlayController implements CoreStartable, Dumpable { } updateThemeOverlays(); + + setBootColorProps(); } /** diff --git a/packages/SystemUI/src/com/android/systemui/tristate/TriStateUiController.java b/packages/SystemUI/src/com/android/systemui/tristate/TriStateUiController.java new file mode 100644 index 000000000000..5fed8858c34d --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/tristate/TriStateUiController.java @@ -0,0 +1,31 @@ +/* + * Copyright 2019 Paranoid Android + * + * 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. + */ + +package com.android.systemui.tristate; + +import com.android.systemui.plugins.Plugin; +import com.android.systemui.plugins.VolumeDialog.Callback; +import com.android.systemui.plugins.annotations.DependsOn; +import com.android.systemui.plugins.annotations.ProvidesInterface; + +@DependsOn(target = Callback.class) +@ProvidesInterface(action = "com.android.systemui.action.PLUGIN_TRI_STATE_UI", version = 1) +public interface TriStateUiController extends Plugin { + + public interface UserActivityListener { + void onTriStateUserActivity(); + } +} diff --git a/packages/SystemUI/src/com/android/systemui/tristate/TriStateUiControllerImpl.java b/packages/SystemUI/src/com/android/systemui/tristate/TriStateUiControllerImpl.java new file mode 100644 index 000000000000..941c91b9d1a0 --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/tristate/TriStateUiControllerImpl.java @@ -0,0 +1,487 @@ +/* + * Copyright 2019 Paranoid Android + * + * 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. + */ + +package com.android.systemui.tristate; + +import static android.view.Surface.ROTATION_90; +import static android.view.Surface.ROTATION_180; +import static android.view.Surface.ROTATION_270; + +import android.app.Dialog; +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.graphics.drawable.ColorDrawable; +import android.hardware.display.DisplayManagerGlobal; +import android.media.AudioManager; +import android.os.Build; +import android.os.Handler; +import android.os.Looper; +import android.os.Message; +import android.provider.Settings; +import android.util.Log; +import android.view.Display; +import android.view.OrientationEventListener; +import android.view.ViewGroup; +import android.view.Window; +import android.view.WindowManager.LayoutParams; +import android.widget.ImageView; +import android.widget.TextView; + +import com.android.internal.policy.SystemBarUtils; +import com.android.systemui.R; +import com.android.systemui.tristate.TriStateUiController; +import com.android.systemui.tristate.TriStateUiController.UserActivityListener; +import com.android.systemui.plugins.VolumeDialogController; +import com.android.systemui.plugins.VolumeDialogController.Callbacks; +import com.android.systemui.plugins.VolumeDialogController.State; +import com.android.systemui.statusbar.policy.ConfigurationController; +import com.android.systemui.statusbar.policy.ConfigurationController.ConfigurationListener; + +public class TriStateUiControllerImpl implements ConfigurationListener, TriStateUiController { + + private static String TAG = "TriStateUiControllerImpl"; + + private static final int MSG_DIALOG_SHOW = 1; + private static final int MSG_DIALOG_DISMISS = 2; + private static final int MSG_RESET_SCHEDULE = 3; + private static final int MSG_STATE_CHANGE = 4; + + private static final int MODE_NORMAL = AudioManager.RINGER_MODE_NORMAL; + private static final int MODE_SILENT = AudioManager.RINGER_MODE_SILENT; + private static final int MODE_VIBRATE = AudioManager.RINGER_MODE_VIBRATE; + + private static final int TRI_STATE_UI_POSITION_LEFT = 0; + private static final int TRI_STATE_UI_POSITION_RIGHT = 1; + + private static final int DIALOG_TIMEOUT = 2000; + + private Context mContext; + private final VolumeDialogController mVolumeDialogController; + private final ConfigurationController mConfigurationController; + private final Callbacks mVolumeDialogCallback = new Callbacks() { + @Override + public void onShowRequested(int reason, boolean keyguardLocked, int lockTaskModeState) { } + + @Override + public void onDismissRequested(int reason) { } + + @Override + public void onScreenOff() { } + + @Override + public void onStateChanged(State state) { } + + @Override + public void onLayoutDirectionChanged(int layoutDirection) { } + + @Override + public void onShowVibrateHint() { } + + @Override + public void onShowSilentHint() { } + + @Override + public void onShowSafetyWarning(int flags) { } + + @Override + public void onShowCsdWarning(int csdWarning, int durationMs) { } + + @Override + public void onAccessibilityModeChanged(Boolean showA11yStream) { } + + @Override + public void onCaptionComponentStateChanged( + Boolean isComponentEnabled, Boolean fromTooltip) {} + + @Override + public void onConfigurationChanged() { + updateTheme(); + updateTriStateLayout(); + } + }; + + private int mDensity; + private Dialog mDialog; + private int mDialogPosition; + private ViewGroup mDialogView; + private final H mHandler; + private UserActivityListener mListener; + OrientationEventListener mOrientationListener; + private int mOrientationType = 0; + private boolean mShowing = false; + private int mBackgroundColor = 0; + private int mThemeMode = 0; + private int mIconColor = 0; + private int mTextColor = 0; + private ImageView mTriStateIcon; + private TextView mTriStateText; + private int mTriStateMode = -1; + private Window mWindow; + private LayoutParams mWindowLayoutParams; + private int mWindowType; + + private final BroadcastReceiver mRingerStateReceiver = new BroadcastReceiver() { + @Override + public void onReceive(Context context, Intent intent) { + updateRingerModeChanged(); + } + }; + + private final class H extends Handler { + private TriStateUiControllerImpl mUiController; + + public H(TriStateUiControllerImpl uiController) { + super(Looper.getMainLooper()); + mUiController = uiController; + } + + public void handleMessage(Message msg) { + switch (msg.what) { + case MSG_DIALOG_SHOW: + mUiController.handleShow(); + return; + case MSG_DIALOG_DISMISS: + mUiController.handleDismiss(); + return; + case MSG_RESET_SCHEDULE: + mUiController.handleResetTimeout(); + return; + case MSG_STATE_CHANGE: + mUiController.handleStateChanged(); + return; + default: + return; + } + } + } + + public TriStateUiControllerImpl( + Context context, + VolumeDialogController volumeDialogController, + ConfigurationController configurationController) { + mContext = context; + mVolumeDialogController = volumeDialogController; + mConfigurationController = configurationController; + mHandler = new H(this); + mOrientationListener = new OrientationEventListener(mContext, 3) { + @Override + public void onOrientationChanged(int orientation) { + checkOrientationType(); + } + }; + IntentFilter ringerChanged = new IntentFilter(AudioManager.RINGER_MODE_CHANGED_ACTION); + mContext.registerReceiver(mRingerStateReceiver, ringerChanged); + } + + private void checkOrientationType() { + Display display = DisplayManagerGlobal.getInstance().getRealDisplay(0); + if (display != null) { + int rotation = display.getRotation(); + if (rotation != mOrientationType) { + mOrientationType = rotation; + updateTriStateLayout(); + } + } + } + + public void init(int windowType, UserActivityListener listener) { + mWindowType = windowType; + mDensity = mContext.getResources().getConfiguration().densityDpi; + mListener = listener; + mConfigurationController.addCallback(this); + mVolumeDialogController.addCallback(mVolumeDialogCallback, mHandler); + initDialog(); + } + + public void destroy() { + mConfigurationController.addCallback(this); + mVolumeDialogController.removeCallback(mVolumeDialogCallback); + mContext.unregisterReceiver(mRingerStateReceiver); + } + + private void initDialog() { + if (mDialog != null) { + mDialog.dismiss(); + mDialog = null; + } + mDialog = new Dialog(mContext); + mShowing = false; + mWindow = mDialog.getWindow(); + mWindow.requestFeature(Window.FEATURE_NO_TITLE); + mWindow.setBackgroundDrawable(new ColorDrawable(0)); + mWindow.clearFlags(LayoutParams.FLAG_DIM_BEHIND); + mWindow.addFlags(LayoutParams.FLAG_NOT_FOCUSABLE + | LayoutParams.FLAG_LAYOUT_IN_SCREEN + | LayoutParams.FLAG_NOT_TOUCH_MODAL + | LayoutParams.FLAG_SHOW_WHEN_LOCKED + | LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH + | LayoutParams.FLAG_HARDWARE_ACCELERATED); + mDialog.setCanceledOnTouchOutside(false); + mWindowLayoutParams = mWindow.getAttributes(); + mWindowLayoutParams.type = mWindowType; + mWindowLayoutParams.format = -3; + mWindowLayoutParams.setTitle(TriStateUiControllerImpl.class.getSimpleName()); + mWindowLayoutParams.gravity = 53; + mWindowLayoutParams.y = mDialogPosition; + mWindow.setAttributes(mWindowLayoutParams); + mWindow.setSoftInputMode(LayoutParams.SOFT_INPUT_ADJUST_NOTHING); + mDialog.setContentView(R.layout.tri_state_dialog); + mDialogView = (ViewGroup) mDialog.findViewById(R.id.tri_state_layout); + mTriStateIcon = (ImageView) mDialog.findViewById(R.id.tri_state_icon); + mTriStateText = (TextView) mDialog.findViewById(R.id.tri_state_text); + updateTheme(); + } + + public void show() { + mHandler.obtainMessage(MSG_DIALOG_SHOW, 0, 0).sendToTarget(); + } + + private void registerOrientationListener(boolean enable) { + if (mOrientationListener.canDetectOrientation() && enable) { + Log.v(TAG, "Can detect orientation"); + mOrientationListener.enable(); + return; + } + Log.v(TAG, "Cannot detect orientation"); + mOrientationListener.disable(); + } + + private void updateTriStateLayout() { + if (mContext != null) { + int iconId = 0; + int textId = 0; + int bg = 0; + Resources res = mContext.getResources(); + if (res != null) { + int positionY; + int positionY2 = mWindowLayoutParams.y; + int positionX = mWindowLayoutParams.x; + int gravity = mWindowLayoutParams.gravity; + switch (mTriStateMode) { + case MODE_SILENT: + iconId = R.drawable.ic_volume_ringer_mute; + textId = R.string.volume_ringer_status_silent; + break; + case MODE_VIBRATE: + iconId = R.drawable.ic_volume_ringer_vibrate; + textId = R.string.volume_ringer_status_vibrate; + break; + case MODE_NORMAL: + iconId = R.drawable.ic_volume_ringer; + textId = R.string.volume_ringer_status_normal; + break; + } + int triStatePos = res.getInteger( + com.android.internal.R.integer.config_alertSliderLocation); + boolean isTsKeyRight = + (triStatePos == TRI_STATE_UI_POSITION_LEFT) ? false : true; + switch (mOrientationType) { + case ROTATION_90: + gravity = (isTsKeyRight) ? 51 : 83; + positionY2 = res.getDimensionPixelSize( + R.dimen.tri_state_up_dialog_position_deep_land); + if (isTsKeyRight) { + positionY2 += SystemBarUtils.getStatusBarHeight(mContext); + } + if (mTriStateMode == MODE_SILENT) { + positionX = res.getDimensionPixelSize( + R.dimen.tri_state_up_dialog_position_l); + } else if (mTriStateMode == MODE_VIBRATE) { + positionX = res.getDimensionPixelSize( + R.dimen.tri_state_middle_dialog_position_l); + } else if (mTriStateMode == MODE_NORMAL) { + positionX = res.getDimensionPixelSize( + R.dimen.tri_state_down_dialog_position_l); + } + bg = R.drawable.dialog_tri_state_middle_bg; + break; + case ROTATION_180: + gravity = (isTsKeyRight) ? 83 : 85; + positionX = res.getDimensionPixelSize( + R.dimen.tri_state_up_dialog_position_deep); + positionY2 = SystemBarUtils.getStatusBarHeight(mContext); + bg = R.drawable.dialog_tri_state_middle_bg; + if (mTriStateMode != MODE_SILENT) { + if (mTriStateMode != MODE_VIBRATE) { + if (mTriStateMode == MODE_NORMAL) { + positionY2 += res.getDimensionPixelSize( + R.dimen.tri_state_down_dialog_position); + break; + } + } + positionY2 += res.getDimensionPixelSize( + R.dimen.tri_state_middle_dialog_position); + break; + } + positionY2 += res.getDimensionPixelSize(R.dimen.tri_state_up_dialog_position); + break; + case ROTATION_270: + gravity = (isTsKeyRight) ? 85 : 53; + positionY2 = res.getDimensionPixelSize( + R.dimen.tri_state_up_dialog_position_deep_land); + if (!isTsKeyRight) { + positionY2 += SystemBarUtils.getStatusBarHeight(mContext); + } + if (mTriStateMode == MODE_SILENT) { + positionX = res.getDimensionPixelSize( + R.dimen.tri_state_up_dialog_position_l); + } else if (mTriStateMode == MODE_VIBRATE) { + positionX = res.getDimensionPixelSize( + R.dimen.tri_state_middle_dialog_position_l); + } else if (mTriStateMode == MODE_NORMAL) { + positionX = res.getDimensionPixelSize( + R.dimen.tri_state_down_dialog_position_l); + } + bg = R.drawable.dialog_tri_state_middle_bg; + break; + default: + gravity = (isTsKeyRight) ? 53 : 51; + positionX = res.getDimensionPixelSize( + R.dimen.tri_state_up_dialog_position_deep); + if (mTriStateMode != MODE_SILENT) { + if (mTriStateMode != MODE_VIBRATE) { + if (mTriStateMode == MODE_NORMAL) { + positionY2 = res.getDimensionPixelSize( + R.dimen.tri_state_down_dialog_position) + + SystemBarUtils.getStatusBarHeight(mContext); + bg = R.drawable.dialog_tri_state_down_bg; + break; + } + } + positionY2 = res.getDimensionPixelSize( + R.dimen.tri_state_middle_dialog_position) + + SystemBarUtils.getStatusBarHeight(mContext); + bg = R.drawable.dialog_tri_state_middle_bg; + break; + } + positionY2 = res.getDimensionPixelSize( + R.dimen.tri_state_up_dialog_position) + + SystemBarUtils.getStatusBarHeight(mContext); + bg = R.drawable.dialog_tri_state_up_bg; + break; + } + if (mTriStateMode != -1) { + if (mTriStateIcon != null && iconId != 0) { + mTriStateIcon.setImageResource(iconId); + } + if (mTriStateText != null && textId != 0) { + String inputText = res.getString(textId); + if (inputText != null && mTriStateText.length() == inputText.length()) { + StringBuilder sb = new StringBuilder(); + sb.append(inputText); + sb.append(" "); + inputText = sb.toString(); + } + mTriStateText.setText(inputText); + } + if (mDialogView != null && bg != 0) { + mDialogView.setBackgroundDrawable(res.getDrawable(bg)); + } + mDialogPosition = positionY2; + } + positionY = res.getDimensionPixelSize(R.dimen.tri_state_dialog_padding); + mWindowLayoutParams.gravity = gravity; + mWindowLayoutParams.y = positionY2 - positionY; + mWindowLayoutParams.x = positionX - positionY; + mWindow.setAttributes(mWindowLayoutParams); + handleResetTimeout(); + } + } + } + + private void updateRingerModeChanged() { + mHandler.obtainMessage(MSG_STATE_CHANGE, 0, 0).sendToTarget(); + if (mTriStateMode != -1) { + show(); + } + } + + private void handleShow() { + mHandler.removeMessages(MSG_DIALOG_SHOW); + mHandler.removeMessages(MSG_DIALOG_DISMISS); + handleResetTimeout(); + if (!mShowing) { + updateTheme(); + registerOrientationListener(true); + checkOrientationType(); + mShowing = true; + mDialog.show(); + if (mListener != null) { + mListener.onTriStateUserActivity(); + } + } + } + + private void handleDismiss() { + mHandler.removeMessages(MSG_DIALOG_SHOW); + mHandler.removeMessages(MSG_DIALOG_DISMISS); + if (mShowing) { + registerOrientationListener(false); + mShowing = false; + mDialog.dismiss(); + } + } + + private void handleStateChanged() { + AudioManager am = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE); + int ringerMode = am.getRingerModeInternal(); + if (ringerMode != mTriStateMode) { + mTriStateMode = ringerMode; + updateTriStateLayout(); + if (mListener != null) { + mListener.onTriStateUserActivity(); + } + } + } + + public void handleResetTimeout() { + mHandler.removeMessages(MSG_DIALOG_DISMISS); + mHandler.sendMessageDelayed(mHandler.obtainMessage( + MSG_DIALOG_DISMISS, MSG_RESET_SCHEDULE, 0), (long) DIALOG_TIMEOUT); + if (mListener != null) { + mListener.onTriStateUserActivity(); + } + } + + @Override + public void onDensityOrFontScaleChanged() { + handleDismiss(); + initDialog(); + updateTriStateLayout(); + } + + private void updateTheme() { + // Todo: Add some logic to update the theme only when a new theme is applied + mIconColor = getAttrColor(android.R.attr.colorAccent); + mTextColor = getAttrColor(android.R.attr.textColorPrimary); + mBackgroundColor = getAttrColor(android.R.attr.colorPrimary); + mDialogView.setBackgroundTintList(ColorStateList.valueOf(mBackgroundColor)); + mTriStateIcon.setColorFilter(mIconColor); + mTriStateText.setTextColor(mTextColor); + } + + public int getAttrColor(int attr) { + TypedArray ta = mContext.obtainStyledAttributes(new int[]{attr}); + int colorAccent = ta.getColor(0, 0); + ta.recycle(); + return colorAccent; + } +} diff --git a/packages/SystemUI/src/com/android/systemui/tuner/DemoModeFragment.java b/packages/SystemUI/src/com/android/systemui/tuner/DemoModeFragment.java index 246488600eef..fc05d9b5ef02 100644 --- a/packages/SystemUI/src/com/android/systemui/tuner/DemoModeFragment.java +++ b/packages/SystemUI/src/com/android/systemui/tuner/DemoModeFragment.java @@ -19,7 +19,6 @@ import android.annotation.SuppressLint; import android.content.Context; import android.content.Intent; import android.os.Bundle; -import android.view.MenuItem; import androidx.preference.Preference; import androidx.preference.Preference.OnPreferenceChangeListener; @@ -87,18 +86,6 @@ public class DemoModeFragment extends PreferenceFragment implements OnPreference mDemoModeTracker.startTracking(); updateDemoModeEnabled(); updateDemoModeOn(); - - setHasOptionsMenu(true); - } - - @Override - public boolean onOptionsItemSelected(MenuItem item) { - switch (item.getItemId()) { - case android.R.id.home: - getFragmentManager().popBackStack(); - break; - } - return super.onOptionsItemSelected(item); } @Override diff --git a/packages/SystemUI/src/com/android/systemui/tuner/StatusBarTuner.java b/packages/SystemUI/src/com/android/systemui/tuner/StatusBarTuner.java new file mode 100644 index 000000000000..c1447e6c7ab4 --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/tuner/StatusBarTuner.java @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2017 The LineageOS 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. + */ +package com.android.systemui.tuner; + +import android.os.Bundle; + +import androidx.preference.PreferenceFragment; + +import com.android.internal.logging.MetricsLogger; +import com.android.internal.logging.nano.MetricsProto.MetricsEvent; +import com.android.systemui.R; + +public class StatusBarTuner extends PreferenceFragment { + + @Override + public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { + addPreferencesFromResource(R.xml.status_bar_prefs); + } + + @Override + public void onResume() { + super.onResume(); + MetricsLogger.visibility(getContext(), MetricsEvent.TUNER, true); + } + + @Override + public void onPause() { + super.onPause(); + MetricsLogger.visibility(getContext(), MetricsEvent.TUNER, false); + } +} diff --git a/packages/SystemUI/src/com/android/systemui/tuner/TunerActivity.java b/packages/SystemUI/src/com/android/systemui/tuner/TunerActivity.java index 32ecb6786a51..fc91ff129c06 100644 --- a/packages/SystemUI/src/com/android/systemui/tuner/TunerActivity.java +++ b/packages/SystemUI/src/com/android/systemui/tuner/TunerActivity.java @@ -15,20 +15,17 @@ */ package com.android.systemui.tuner; -import android.app.Activity; import android.app.Fragment; import android.app.FragmentTransaction; import android.os.Bundle; import android.util.Log; -import android.view.MenuItem; -import android.view.Window; -import android.view.WindowManager; -import android.widget.Toolbar; import androidx.preference.Preference; import androidx.preference.PreferenceFragment; import androidx.preference.PreferenceScreen; +import com.android.settingslib.collapsingtoolbar.CollapsingToolbarBaseActivity; + import com.android.systemui.Dependency; import com.android.systemui.R; import com.android.systemui.demomode.DemoModeController; @@ -37,7 +34,7 @@ import com.android.systemui.util.settings.GlobalSettings; import javax.inject.Inject; -public class TunerActivity extends Activity implements +public class TunerActivity extends CollapsingToolbarBaseActivity implements PreferenceFragment.OnPreferenceStartFragmentCallback, PreferenceFragment.OnPreferenceStartScreenCallback { @@ -61,23 +58,19 @@ public class TunerActivity extends Activity implements protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - setTheme(R.style.Theme_AppCompat_DayNight); - - getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); - requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.tuner_activity); - Toolbar toolbar = findViewById(R.id.action_bar); - if (toolbar != null) { - setActionBar(toolbar); - } if (getFragmentManager().findFragmentByTag(TAG_TUNER) == null) { final String action = getIntent().getAction(); - boolean showDemoMode = action != null && action.equals( - "com.android.settings.action.DEMO_MODE"); - final PreferenceFragment fragment = showDemoMode - ? new DemoModeFragment(mDemoModeController, mGlobalSettings) - : new TunerFragment(mTunerService); + final Fragment fragment; + if ("com.android.settings.action.DEMO_MODE".equals(action)) { + fragment = new DemoModeFragment(mDemoModeController, mGlobalSettings); + } else if ("com.android.settings.action.STATUS_BAR_TUNER".equals(action)) { + fragment = new StatusBarTuner(); + } else { + fragment = new TunerFragment(mTunerService); + } + getFragmentManager().beginTransaction().replace(R.id.content_frame, fragment, TAG_TUNER).commit(); } @@ -90,15 +83,6 @@ public class TunerActivity extends Activity implements } @Override - public boolean onMenuItemSelected(int featureId, MenuItem item) { - if (item.getItemId() == android.R.id.home) { - onBackPressed(); - return true; - } - return super.onMenuItemSelected(featureId, item); - } - - @Override public void onBackPressed() { if (!getFragmentManager().popBackStackImmediate()) { super.onBackPressed(); diff --git a/packages/SystemUI/src/com/android/systemui/tuner/TunerFragment.java b/packages/SystemUI/src/com/android/systemui/tuner/TunerFragment.java index 989462a9fd34..c1bb0ea68ec7 100644 --- a/packages/SystemUI/src/com/android/systemui/tuner/TunerFragment.java +++ b/packages/SystemUI/src/com/android/systemui/tuner/TunerFragment.java @@ -16,17 +16,9 @@ package com.android.systemui.tuner; import android.annotation.SuppressLint; -import android.app.AlertDialog; -import android.app.Dialog; -import android.app.DialogFragment; -import android.content.DialogInterface; import android.hardware.display.AmbientDisplayConfiguration; import android.os.Build; import android.os.Bundle; -import android.provider.Settings; -import android.view.Menu; -import android.view.MenuInflater; -import android.view.MenuItem; import androidx.preference.Preference; import androidx.preference.PreferenceFragment; @@ -53,8 +45,6 @@ public class TunerFragment extends PreferenceFragment { "picture_in_picture", }; - private static final int MENU_REMOVE = Menu.FIRST + 1; - private final TunerService mTunerService; // We are the only ones who ever call this constructor, so don't worry about the warning @@ -67,14 +57,6 @@ public class TunerFragment extends PreferenceFragment { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - - setHasOptionsMenu(true); - } - - @Override - public void onActivityCreated(Bundle savedInstanceState) { - super.onActivityCreated(savedInstanceState); - getActivity().getActionBar().setDisplayHomeAsUpEnabled(true); } @Override @@ -92,13 +74,6 @@ public class TunerFragment extends PreferenceFragment { if (preference != null) getPreferenceScreen().removePreference(preference); } } - - if (Settings.Secure.getInt(getContext().getContentResolver(), SETTING_SEEN_TUNER_WARNING, - 0) == 0) { - if (getFragmentManager().findFragmentByTag(WARNING_TAG) == null) { - new TunerWarningFragment().show(getFragmentManager(), WARNING_TAG); - } - } } private boolean alwaysOnAvailable() { @@ -119,42 +94,4 @@ public class TunerFragment extends PreferenceFragment { MetricsLogger.visibility(getContext(), MetricsEvent.TUNER, false); } - - @Override - public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { - menu.add(Menu.NONE, MENU_REMOVE, Menu.NONE, R.string.remove_from_settings); - } - - @Override - public boolean onOptionsItemSelected(MenuItem item) { - switch (item.getItemId()) { - case android.R.id.home: - getActivity().finish(); - return true; - case MENU_REMOVE: - mTunerService.showResetRequest(() -> { - if (getActivity() != null) { - getActivity().finish(); - } - }); - return true; - } - return super.onOptionsItemSelected(item); - } - - public static class TunerWarningFragment extends DialogFragment { - @Override - public Dialog onCreateDialog(Bundle savedInstanceState) { - return new AlertDialog.Builder(getContext()) - .setTitle(R.string.tuner_warning_title) - .setMessage(R.string.tuner_warning) - .setPositiveButton(R.string.got_it, new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - Settings.Secure.putInt(getContext().getContentResolver(), - SETTING_SEEN_TUNER_WARNING, 1); - } - }).show(); - } - } } diff --git a/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java b/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java index 095718bddf97..fc88f5be69d7 100644 --- a/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java +++ b/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java @@ -394,9 +394,8 @@ public class StorageNotification implements CoreStartable { final VolumeRecord rec = mStorageManager.findRecordByUuid(vol.getFsUuid()); final DiskInfo disk = vol.getDisk(); - // Don't annoy when user dismissed in past. (But make sure the disk is adoptable; we - // used to allow snoozing non-adoptable disks too.) - if (rec == null || (rec.isSnoozed() && disk.isAdoptable())) { + // Don't annoy when user dismissed in past. + if (rec == null || (rec.isSnoozed() && (disk.isAdoptable() || disk.isSd()))) { return null; } if (disk.isAdoptable() && !rec.isInited() && rec.getType() != VolumeInfo.TYPE_PUBLIC @@ -439,8 +438,12 @@ public class StorageNotification implements CoreStartable { buildUnmountPendingIntent(vol))) .setContentIntent(browseIntent) .setCategory(Notification.CATEGORY_SYSTEM); - // Non-adoptable disks can't be snoozed. - if (disk.isAdoptable()) { + // USB disks notification can be persistent + if (disk.isUsb()) { + builder.setOngoing(true); + } + + if (disk.isAdoptable() || disk.isSd()) { builder.setDeleteIntent(buildSnoozeIntent(vol.getFsUuid())); } diff --git a/packages/SystemUI/src/com/android/systemui/util/CarrierNameCustomization.java b/packages/SystemUI/src/com/android/systemui/util/CarrierNameCustomization.java deleted file mode 100644 index 3d80735f09eb..000000000000 --- a/packages/SystemUI/src/com/android/systemui/util/CarrierNameCustomization.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. - * SPDX-License-Identifier: BSD-3-Clause-Clear - */ -package com.android.systemui.util; - -import android.content.Context; -import android.telephony.SubscriptionInfo; -import android.telephony.TelephonyManager; -import android.text.TextUtils; -import android.util.Log; - -import com.android.systemui.dagger.SysUISingleton; -import com.android.systemui.R; - -import java.util.HashMap; -import javax.inject.Inject; - -@SysUISingleton -public class CarrierNameCustomization { - private final String TAG = "CarrierNameCustomization"; - private final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG); - - /** - * The map for carriers: - * The key is MCCMNC. - * The value of the key is unique carrier name. - * Carrier can have several MCCMNC, but it only has one unique carrier name. - */ - private HashMap<String, String> mCarrierMap; - private boolean mRoamingCustomizationCarrierNameEnabled; - private String mConnector; - private TelephonyManager mTelephonyManager; - - @Inject - public CarrierNameCustomization(Context context) { - mCarrierMap = new HashMap<String, String>(); - - mRoamingCustomizationCarrierNameEnabled = context.getResources().getBoolean( - R.bool.config_show_roaming_customization_carrier_name); - mConnector = context.getResources().getString(R.string.connector); - - mTelephonyManager = context.getSystemService(TelephonyManager.class); - - if (mRoamingCustomizationCarrierNameEnabled) { - loadCarrierMap(context); - } - } - - /** - * Returns true if the roaming customization is enabled - * @return - */ - public boolean isRoamingCustomizationEnabled() { - return mRoamingCustomizationCarrierNameEnabled; - } - - /** - * Returns true if the current network for the subscription is considered roaming. - * It is considered roaming if the carrier of the sim card and network are not the same. - * @param subId the subscription ID. - */ - public boolean isRoaming(int subId) { - String simOperatorName = - mCarrierMap.getOrDefault(mTelephonyManager.getSimOperator(subId), ""); - String networkOperatorName = - mCarrierMap.getOrDefault(mTelephonyManager.getNetworkOperator(subId), ""); - if (DEBUG) { - Log.d(TAG, "isRoaming subId=" + subId - + " simOperator=" + mTelephonyManager.getSimOperator(subId) - + " networkOperator=" + mTelephonyManager.getNetworkOperator(subId)); - } - boolean roaming = false; - if (!TextUtils.isEmpty(simOperatorName) && !TextUtils.isEmpty(networkOperatorName) - && !simOperatorName.equals(networkOperatorName)) { - roaming = true; - } - - return roaming; - } - - /** - * Returns the roaming customization carrier name. - * @param subId the subscription ID. - */ - public String getRoamingCarrierName(int subId) { - String simOperatorName = - mCarrierMap.getOrDefault(mTelephonyManager.getSimOperator(subId), ""); - String networkOperatorName = - mCarrierMap.getOrDefault(mTelephonyManager.getNetworkOperator(subId), ""); - StringBuilder combinedCarrierName = new StringBuilder(); - combinedCarrierName.append(simOperatorName) - .append(mConnector) - .append(networkOperatorName); - return combinedCarrierName.toString(); - } - - public void loadCarrierMap(Context context) { - String customizationConfigs[] = - context.getResources().getStringArray(R.array.customization_carrier_name_list); - for(String config : customizationConfigs ) { - String[] kv = config.trim().split(":"); - if (kv.length != 2) { - Log.e(TAG, "invalid key value config " + config); - continue; - } - mCarrierMap.put(kv[0], kv[1]); - } - } -}
\ No newline at end of file diff --git a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogComponent.java b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogComponent.java index a4537267ed62..948cb5ee6b58 100644 --- a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogComponent.java +++ b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogComponent.java @@ -36,7 +36,10 @@ import com.android.systemui.plugins.PluginDependencyProvider; import com.android.systemui.plugins.VolumeDialog; import com.android.systemui.plugins.VolumeDialogController; import com.android.systemui.qs.tiles.DndTile; +import com.android.systemui.statusbar.policy.ConfigurationController; import com.android.systemui.statusbar.policy.ExtensionController; +import com.android.systemui.tristate.TriStateUiController; +import com.android.systemui.tristate.TriStateUiControllerImpl; import com.android.systemui.tuner.TunerService; import java.io.PrintWriter; @@ -50,7 +53,7 @@ import javax.inject.Inject; */ @SysUISingleton public class VolumeDialogComponent implements VolumeComponent, TunerService.Tunable, - VolumeDialogControllerImpl.UserActivityListener{ + VolumeDialogControllerImpl.UserActivityListener, TriStateUiController.UserActivityListener { public static final String VOLUME_DOWN_SILENT = "sysui_volume_down_silent"; public static final String VOLUME_UP_SILENT = "sysui_volume_up_silent"; @@ -67,6 +70,7 @@ public class VolumeDialogComponent implements VolumeComponent, TunerService.Tuna protected final Context mContext; private final VolumeDialogControllerImpl mController; + private TriStateUiControllerImpl mTriStateController; private final InterestingConfigChanges mConfigChanges = new InterestingConfigChanges( ActivityInfo.CONFIG_FONT_SCALE | ActivityInfo.CONFIG_LOCALE | ActivityInfo.CONFIG_ASSETS_PATHS | ActivityInfo.CONFIG_UI_MODE); @@ -81,6 +85,7 @@ public class VolumeDialogComponent implements VolumeComponent, TunerService.Tuna KeyguardViewMediator keyguardViewMediator, ActivityStarter activityStarter, VolumeDialogControllerImpl volumeDialogController, + ConfigurationController configurationController, DemoModeController demoModeController, PluginDependencyProvider pluginDependencyProvider, ExtensionController extensionController, @@ -91,6 +96,8 @@ public class VolumeDialogComponent implements VolumeComponent, TunerService.Tuna mActivityStarter = activityStarter; mController = volumeDialogController; mController.setUserActivityListener(this); + boolean hasAlertSlider = mContext.getResources(). + getBoolean(com.android.internal.R.bool.config_hasAlertSlider); // Allow plugins to reference the VolumeDialogController. pluginDependencyProvider.allowPluginDependency(VolumeDialogController.class); extensionController.newExtension(VolumeDialog.class) @@ -102,6 +109,14 @@ public class VolumeDialogComponent implements VolumeComponent, TunerService.Tuna } mDialog = dialog; mDialog.init(LayoutParams.TYPE_VOLUME_OVERLAY, mVolumeDialogCallback); + if (hasAlertSlider) { + if (mTriStateController != null) { + mTriStateController.destroy(); + } + mTriStateController = new TriStateUiControllerImpl(mContext, + volumeDialogController, configurationController); + mTriStateController.init(LayoutParams.TYPE_VOLUME_OVERLAY, this); + } }).build(); @@ -202,6 +217,11 @@ public class VolumeDialogComponent implements VolumeComponent, TunerService.Tuna mActivityStarter.startActivity(intent, true /* onlyProvisioned */, true /* dismissShade */); } + @Override + public void onTriStateUserActivity() { + onUserActivity(); + } + private final VolumeDialogImpl.Callback mVolumeDialogCallback = new VolumeDialogImpl.Callback() { @Override public void onZenSettingsClicked() { diff --git a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java index 93622200ad46..d83a9acb41ad 100644 --- a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java +++ b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java @@ -23,11 +23,13 @@ import static android.media.AudioManager.RINGER_MODE_VIBRATE; import static android.media.AudioManager.STREAM_ACCESSIBILITY; import static android.media.AudioManager.STREAM_ALARM; import static android.media.AudioManager.STREAM_MUSIC; +import static android.media.AudioManager.STREAM_NOTIFICATION; import static android.media.AudioManager.STREAM_RING; import static android.media.AudioManager.STREAM_VOICE_CALL; import static android.view.View.ACCESSIBILITY_LIVE_REGION_POLITE; import static android.view.View.GONE; import static android.view.View.INVISIBLE; +import static android.view.View.LAYOUT_DIRECTION_LTR; import static android.view.View.LAYOUT_DIRECTION_RTL; import static android.view.View.VISIBLE; import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT; @@ -46,6 +48,8 @@ import android.annotation.SuppressLint; import android.app.ActivityManager; import android.app.Dialog; import android.app.KeyguardManager; +import android.bluetooth.BluetoothAdapter; +import android.bluetooth.BluetoothProfile; import android.content.ContentResolver; import android.content.Context; import android.content.DialogInterface; @@ -66,6 +70,9 @@ import android.graphics.drawable.LayerDrawable; import android.graphics.drawable.RotateDrawable; import android.media.AudioManager; import android.media.AudioSystem; +import android.media.session.MediaController; +import android.media.session.MediaSessionManager; +import android.media.session.PlaybackState; import android.os.Debug; import android.os.Handler; import android.os.Looper; @@ -76,6 +83,7 @@ import android.os.VibrationEffect; import android.provider.Settings; import android.provider.Settings.Global; import android.text.InputFilter; +import android.text.TextUtils; import android.util.FeatureFlagUtils; import android.util.Log; import android.util.Slog; @@ -126,6 +134,7 @@ import com.android.systemui.plugins.VolumeDialog; import com.android.systemui.plugins.VolumeDialogController; import com.android.systemui.plugins.VolumeDialogController.State; import com.android.systemui.plugins.VolumeDialogController.StreamState; +import com.android.systemui.statusbar.phone.ExpandableIndicator; import com.android.systemui.statusbar.policy.AccessibilityManagerWrapper; import com.android.systemui.statusbar.policy.ConfigurationController; import com.android.systemui.statusbar.policy.DevicePostureController; @@ -243,6 +252,8 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable, private CaptionsToggleImageButton mODICaptionsIcon; private View mSettingsView; private ImageButton mSettingsIcon; + private View mExpandRowsView; + private ExpandableIndicator mExpandRows; private FrameLayout mZenIcon; private final List<VolumeRow> mRows = new ArrayList<>(); private ConfigurableTexts mConfigurableTexts; @@ -280,9 +291,21 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable, private Consumer<Boolean> mCrossWindowBlurEnabledListener; private BackgroundBlurDrawable mDialogRowsViewBackground; private final InteractionJankMonitor mInteractionJankMonitor; + private final boolean mVolumePanelOnLeft; private int mWindowGravity; + // Variable to track the default row with which the panel is initially shown + private VolumeRow mDefaultRow = null; + + private FrameLayout mRoundedBorderBottom; + + // Volume panel expand state + private boolean mExpanded; + + // Number of animating rows + private int mAnimatingRows = 0; + @VisibleForTesting final int mVolumeRingerIconDrawableId = R.drawable.ic_speaker_on; @VisibleForTesting @@ -335,6 +358,8 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable, mUseBackgroundBlur = mContext.getResources().getBoolean(R.bool.config_volumeDialogUseBackgroundBlur); mInteractionJankMonitor = interactionJankMonitor; + mVolumePanelOnLeft = + mContext.getResources().getBoolean(R.bool.config_audioPanelOnLeftSide); dumpManager.registerDumpable("VolumeDialogImpl", this); @@ -440,27 +465,75 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable, final int[] locInWindow = new int[2]; view.getLocationInWindow(locInWindow); - float x = locInWindow[0]; - float y = locInWindow[1]; + float xExtraSize = 0; + float yExtraSize = 0; // The ringer and rows container has extra height at the top to fit the expanded ringer // drawer. This area should not be touchable unless the ringer drawer is open. // In landscape the ringer expands to the left and it has to be ensured that if there // are multiple rows they are touchable. - if (view == mTopContainer && !mIsRingerDrawerOpen) { + // The invisible expandable rows reserve space if the panel is not expanded, this space + // needs to be touchable. + if (view == mTopContainer) { if (!isLandscape()) { - y += getRingerDrawerOpenExtraSize(); - } else if (getRingerDrawerOpenExtraSize() > getVisibleRowsExtraSize()) { - x += (getRingerDrawerOpenExtraSize() - getVisibleRowsExtraSize()); + if (!mIsRingerDrawerOpen) { + yExtraSize = getRingerDrawerOpenExtraSize(); + } + if (!mExpanded) { + xExtraSize = getExpandableRowsExtraSize(); + } + } else { + if (!mIsRingerDrawerOpen && !mExpanded) { + xExtraSize = + Math.max(getRingerDrawerOpenExtraSize(), getExpandableRowsExtraSize()); + } else if (!mIsRingerDrawerOpen) { + if (getRingerDrawerOpenExtraSize() > getVisibleRowsExtraSize()) { + xExtraSize = getRingerDrawerOpenExtraSize() - getVisibleRowsExtraSize(); + } + } else if (!mExpanded) { + if ((getVisibleRowsExtraSize() + getExpandableRowsExtraSize()) + > getRingerDrawerOpenExtraSize()) { + xExtraSize = (getVisibleRowsExtraSize() + getExpandableRowsExtraSize()) + - getRingerDrawerOpenExtraSize(); + } + } } } - mTouchableRegion.op( - (int) x, - (int) y, - locInWindow[0] + view.getWidth(), - locInWindow[1] + view.getHeight(), - Region.Op.UNION); + if (isWindowGravityLeft()) { + mTouchableRegion.op( + locInWindow[0], + locInWindow[1] + (int) yExtraSize, + locInWindow[0] + view.getWidth() - (int) xExtraSize, + locInWindow[1] + view.getHeight(), + Region.Op.UNION); + } else { + mTouchableRegion.op( + locInWindow[0] + (int) xExtraSize, + locInWindow[1] + (int) yExtraSize, + locInWindow[0] + view.getWidth(), + locInWindow[1] + view.getHeight(), + Region.Op.UNION); + } + } + + // Helper to set gravity. + private void setGravity(ViewGroup viewGroup, int gravity) { + if (viewGroup instanceof LinearLayout) { + ((LinearLayout) viewGroup).setGravity(gravity); + } + } + + // Helper to set layout gravity. + private void setLayoutGravity(ViewGroup viewGroup, int gravity) { + if (viewGroup != null) { + Object obj = viewGroup.getLayoutParams(); + if (obj instanceof FrameLayout.LayoutParams) { + ((FrameLayout.LayoutParams) obj).gravity = gravity; + } else if (obj instanceof LinearLayout.LayoutParams) { + ((LinearLayout.LayoutParams) obj).gravity = gravity; + } + } } private void initDialog(int lockTaskModeState) { @@ -471,6 +544,7 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable, mConfigurableTexts = new ConfigurableTexts(mContext); mHovering = false; mShowing = false; + mExpanded = false; mWindow = mDialog.getWindow(); mWindow.requestFeature(Window.FEATURE_NO_TITLE); mWindow.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); @@ -490,6 +564,11 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable, lp.windowAnimations = -1; mOriginalGravity = mContext.getResources().getInteger(R.integer.volume_dialog_gravity); + if (!mShowActiveStreamOnly) { + // Clear the pre-defined gravity for left or right, this is handled by mVolumePanelOnLeft + mOriginalGravity &= ~(Gravity.LEFT | Gravity.RIGHT); + mOriginalGravity |= mVolumePanelOnLeft ? Gravity.LEFT : Gravity.RIGHT; + } mWindowGravity = Gravity.getAbsoluteGravity(mOriginalGravity, mContext.getResources().getConfiguration().getLayoutDirection()); lp.gravity = mWindowGravity; @@ -499,6 +578,8 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable, mDialog.setContentView(R.layout.volume_dialog); mDialogView = mDialog.findViewById(R.id.volume_dialog); mDialogView.setAlpha(0); + mDialogView.setLayoutDirection( + mVolumePanelOnLeft ? LAYOUT_DIRECTION_LTR : LAYOUT_DIRECTION_RTL); mDialog.setCanceledOnTouchOutside(true); mDialog.setOnShowListener(dialog -> { mDialogView.getViewTreeObserver().addOnComputeInternalInsetsListener(this); @@ -600,6 +681,9 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable, updateBackgroundForDrawerClosedAmount(); setTopContainerBackgroundDrawable(); + + // Rows need to be updated after mRingerAndDrawerContainerBackground is set + updateRowsH(getActiveRow()); } }); } @@ -644,6 +728,32 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable, mSettingsView = mDialog.findViewById(R.id.settings_container); mSettingsIcon = mDialog.findViewById(R.id.settings); + mRoundedBorderBottom = mDialog.findViewById(R.id.rounded_border_bottom); + + mExpandRowsView = mDialog.findViewById(R.id.expandable_indicator_container); + mExpandRows = mDialog.findViewById(R.id.expandable_indicator); + + if (isWindowGravityLeft()) { + ViewGroup container = mDialog.findViewById(R.id.volume_dialog_container); + setGravity(container, Gravity.LEFT); + + setGravity(mDialogView, Gravity.LEFT); + + setGravity((ViewGroup) mTopContainer, Gravity.LEFT); + + setLayoutGravity(mRingerDrawerNewSelectionBg, Gravity.BOTTOM | Gravity.LEFT); + + setLayoutGravity(mSelectedRingerContainer, Gravity.BOTTOM | Gravity.LEFT); + + setGravity(mRinger, Gravity.LEFT); + + setGravity(mDialogRowsViewContainer, Gravity.LEFT); + + setGravity(mODICaptionsView, Gravity.LEFT); + + mExpandRows.setRotation(-90); + } + if (mRows.isEmpty()) { if (!AudioSystem.isSingleVolume(mContext)) { addRow(STREAM_ACCESSIBILITY, R.drawable.ic_volume_accessibility, @@ -656,6 +766,8 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable, addRow(AudioManager.STREAM_RING, R.drawable.ic_ring_volume, R.drawable.ic_ring_volume_off, true, false); + addRow(AudioManager.STREAM_NOTIFICATION, R.drawable.ic_notifications_alert, + R.drawable.ic_notifications_silence, true, false); addRow(STREAM_ALARM, R.drawable.ic_alarm, R.drawable.ic_volume_alarm_mute, true, false); @@ -717,10 +829,7 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable, Configuration.ORIENTATION_LANDSCAPE; } - private boolean isRtl() { - return mContext.getResources().getConfiguration().getLayoutDirection() - == LAYOUT_DIRECTION_RTL; - } + private boolean isRtl() { return mDialogView.getLayoutDirection() == LAYOUT_DIRECTION_RTL; } public void setStreamImportant(int stream, boolean important) { mHandler.obtainMessage(H.SET_STREAM_IMPORTANT, stream, important ? 1 : 0).sendToTarget(); @@ -911,6 +1020,12 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable, mDialogView.getPaddingTop(), mDialogView.getPaddingRight(), mDialogView.getPaddingBottom() + getRingerDrawerOpenExtraSize()); + } else if (isWindowGravityLeft()) { + mDialogView.setPadding( + mDialogView.getPaddingLeft(), + mDialogView.getPaddingTop(), + mDialogView.getPaddingRight() + getRingerDrawerOpenExtraSize(), + mDialogView.getPaddingBottom()); } else { mDialogView.setPadding( mDialogView.getPaddingLeft() + getRingerDrawerOpenExtraSize(), @@ -980,15 +1095,16 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable, } /** - * Translation to apply form the origin (either top or left) to overlap the selection background - * with the given mode in the drawer. + * Translation to apply form the origin (either top or left/right) to overlap the selection + * background with the given mode in the drawer. */ private float getTranslationInDrawerForRingerMode(int mode) { - return mode == RINGER_MODE_VIBRATE - ? -mRingerDrawerItemSize * 2 - : mode == RINGER_MODE_SILENT - ? -mRingerDrawerItemSize - : 0; + final int distantRinger = ((isLandscape() && isWindowGravityLeft()) ? RINGER_MODE_NORMAL + : RINGER_MODE_VIBRATE); + return (mode == distantRinger ? mRingerDrawerItemSize * 2 + : mode == RINGER_MODE_SILENT ? mRingerDrawerItemSize + : 0) + * ((isLandscape() && isWindowGravityLeft()) ? 1 : -1); } /** Animates in the ringer drawer. */ @@ -1019,12 +1135,13 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable, getTranslationInDrawerForRingerMode(mState.ringerModeInternal)); } - // Move the drawer so that the top/rightmost ringer choice overlaps with the selected ringer + // Move the drawer so that the top/outmost ringer choice overlaps with the selected ringer // icon. if (!isLandscape()) { mRingerDrawerContainer.setTranslationY(mRingerDrawerItemSize * (mRingerCount - 1)); } else { - mRingerDrawerContainer.setTranslationX(mRingerDrawerItemSize * (mRingerCount - 1)); + mRingerDrawerContainer.setTranslationX( + (isWindowGravityLeft() ? -1 : 1) * mRingerDrawerItemSize * (mRingerCount - 1)); } mRingerDrawerContainer.setAlpha(0f); mRingerDrawerContainer.setVisibility(VISIBLE); @@ -1106,7 +1223,7 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable, .start(); } else { mRingerDrawerContainer.animate() - .translationX(mRingerDrawerItemSize * 2) + .translationX((isWindowGravityLeft() ? -1 : 1) * mRingerDrawerItemSize * 2) .start(); } @@ -1127,24 +1244,102 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable, mIsRingerDrawerOpen = false; } + /** + * Returns a {@link MediaController} that state is playing and type is local playback, + * and also have active sessions. + */ + @Nullable + private MediaController getActiveLocalMediaController() { + MediaSessionManager mediaSessionManager = + mContext.getSystemService(MediaSessionManager.class); + MediaController localController = null; + final List<String> remoteMediaSessionLists = new ArrayList<>(); + for (MediaController controller : mediaSessionManager.getActiveSessions(null)) { + final MediaController.PlaybackInfo pi = controller.getPlaybackInfo(); + if (pi == null) { + // do nothing + continue; + } + final PlaybackState playbackState = controller.getPlaybackState(); + if (playbackState == null) { + // do nothing + continue; + } + if (D.BUG) { + Log.d(TAG, + "getActiveLocalMediaController() package name : " + + controller.getPackageName() + + ", play back type : " + pi.getPlaybackType() + + ", play back state : " + playbackState.getState()); + } + if (playbackState.getState() != PlaybackState.STATE_PLAYING) { + // do nothing + continue; + } + if (pi.getPlaybackType() == MediaController.PlaybackInfo.PLAYBACK_TYPE_REMOTE) { + if (localController != null + && TextUtils.equals( + localController.getPackageName(), controller.getPackageName())) { + localController = null; + } + if (!remoteMediaSessionLists.contains(controller.getPackageName())) { + remoteMediaSessionLists.add(controller.getPackageName()); + } + continue; + } + if (pi.getPlaybackType() == MediaController.PlaybackInfo.PLAYBACK_TYPE_LOCAL) { + if (localController == null + && !remoteMediaSessionLists.contains(controller.getPackageName())) { + localController = controller; + } + } + } + return localController; + } + + private boolean isBluetoothA2dpConnected() { + final BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); + return mBluetoothAdapter != null && mBluetoothAdapter.isEnabled() + && mBluetoothAdapter.getProfileConnectionState(BluetoothProfile.A2DP) + == BluetoothProfile.STATE_CONNECTED; + } + + private boolean isMediaControllerAvailable() { + final MediaController mediaController = getActiveLocalMediaController(); + return mediaController != null && !TextUtils.isEmpty(mediaController.getPackageName()); + } + private void initSettingsH(int lockTaskModeState) { + final boolean showSettings = mDeviceProvisionedController.isCurrentUserSetup() + && lockTaskModeState == LOCK_TASK_MODE_NONE; + if (mRoundedBorderBottom != null) { + mRoundedBorderBottom.setVisibility(!showSettings ? VISIBLE : GONE); + } if (mSettingsView != null) { mSettingsView.setVisibility( - mDeviceProvisionedController.isCurrentUserSetup() && - lockTaskModeState == LOCK_TASK_MODE_NONE ? VISIBLE : GONE); + showSettings && (isMediaControllerAvailable() || isBluetoothA2dpConnected()) + ? VISIBLE + : GONE); } if (mSettingsIcon != null) { mSettingsIcon.setOnClickListener(v -> { Events.writeEvent(Events.EVENT_SETTINGS_CLICK); + String packageName = isMediaControllerAvailable() + ? getActiveLocalMediaController().getPackageName() + : ""; + mMediaOutputDialogFactory.create(packageName, true, mDialogView); dismissH(DISMISS_REASON_SETTINGS_CLICKED); - mMediaOutputDialogFactory.dismiss(); - if (FeatureFlagUtils.isEnabled(mContext, - FeatureFlagUtils.SETTINGS_VOLUME_PANEL_IN_SYSTEMUI)) { - mVolumePanelFactory.create(true /* aboveStatusBar */, null); - } else { - mActivityStarter.startActivity(new Intent(Settings.Panel.ACTION_VOLUME), - true /* dismissShade */); - } + }); + } + + if (mExpandRowsView != null) { + mExpandRowsView.setVisibility(showSettings ? VISIBLE : GONE); + } + if (mExpandRows != null) { + mExpandRows.setOnClickListener(v -> { + mExpanded = !mExpanded; + updateRowsH(mDefaultRow, true); + mExpandRows.setExpanded(mExpanded); }); } } @@ -1410,6 +1605,10 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable, mConfigChanged = false; } + if (mDefaultRow == null) { + mDefaultRow = getActiveRow(); + } + initSettingsH(lockTaskModeState); mShowing = true; mIsAnimatingDismiss = false; @@ -1471,6 +1670,10 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable, protected void dismissH(int reason) { Trace.beginSection("VolumeDialogImpl#dismissH"); + // Avoid multiple animation calls on touch spams. + if (!mShowing) { + return; + } Log.i(TAG, "mDialog.dismiss() reason: " + Events.DISMISS_REASONS[reason] + " from: " + Debug.getCaller()); @@ -1511,6 +1714,12 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable, mDialog.dismiss(); } tryToRemoveCaptionsTooltip(); + mExpanded = false; + if (mExpandRows != null) { + mExpandRows.setExpanded(mExpanded); + } + mAnimatingRows = 0; + mDefaultRow = null; mIsAnimatingDismiss = false; hideRingerDrawer(); @@ -1538,6 +1747,13 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable, || mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_TELEVISION); } + private boolean isExpandableRowH(VolumeRow row) { + return row != null && row != mDefaultRow && !row.defaultStream + && (row.stream == STREAM_RING + || row.stream == STREAM_NOTIFICATION + || row.stream == STREAM_ALARM + || row.stream == STREAM_MUSIC); + } private boolean shouldBeVisibleH(VolumeRow row, VolumeRow activeRow) { boolean isActive = row.stream == activeRow.stream; @@ -1557,10 +1773,18 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable, return true; } - if (row.defaultStream) { + if (mExpanded && isExpandableRowH(row)) { + return true; + } + + // if the row is the default stream or the row with which this panel was created, + // show it additonally to the active row if it is one of the following streams + if (row.defaultStream || mDefaultRow == row) { return activeRow.stream == STREAM_RING + || activeRow.stream == STREAM_NOTIFICATION || activeRow.stream == STREAM_ALARM || activeRow.stream == STREAM_VOICE_CALL + || activeRow.stream == STREAM_MUSIC || activeRow.stream == STREAM_ACCESSIBILITY || mDynamic.get(activeRow.stream); } @@ -1571,29 +1795,39 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable, private void updateRowsH(final VolumeRow activeRow) { Trace.beginSection("VolumeDialogImpl#updateRowsH"); + updateRowsH(activeRow, false); + } + + private void updateRowsH(final VolumeRow activeRow, boolean animate) { if (D.BUG) Log.d(TAG, "updateRowsH"); if (!mShowing) { trimObsoleteH(); } + boolean isOutmostIndexMax = isWindowGravityLeft() ? isRtl() : !isRtl(); + // Index of the last row that is actually visible. - int rightmostVisibleRowIndex = !isRtl() ? -1 : Short.MAX_VALUE; + int outmostVisibleRowIndex = isOutmostIndexMax ? -1 : Short.MAX_VALUE; // apply changes to all rows for (final VolumeRow row : mRows) { final boolean isActive = row == activeRow; + final boolean isExpandableRow = isExpandableRowH(row); final boolean shouldBeVisible = shouldBeVisibleH(row, activeRow); - Util.setVisOrGone(row.view, shouldBeVisible); - if (shouldBeVisible && mRingerAndDrawerContainerBackground != null) { - // For RTL, the rightmost row has the lowest index since child views are laid out + if (!isExpandableRow) { + Util.setVisOrGone(row.view, shouldBeVisible); + } else if (!mExpanded) { + row.view.setVisibility(View.INVISIBLE); + } + + if ((shouldBeVisible || isExpandableRow) + && mRingerAndDrawerContainerBackground != null) { + // For RTL, the outmost row has the lowest index since child views are laid out // from right to left. - rightmostVisibleRowIndex = - !isRtl() - ? Math.max(rightmostVisibleRowIndex, - mDialogRowsView.indexOfChild(row.view)) - : Math.min(rightmostVisibleRowIndex, - mDialogRowsView.indexOfChild(row.view)); + outmostVisibleRowIndex = isOutmostIndexMax + ? Math.max(outmostVisibleRowIndex, mDialogRowsView.indexOfChild(row.view)) + : Math.min(outmostVisibleRowIndex, mDialogRowsView.indexOfChild(row.view)); // Add spacing between each of the visible rows - we'll remove the spacing from the // last row after the loop. @@ -1601,12 +1835,13 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable, if (layoutParams instanceof LinearLayout.LayoutParams) { final LinearLayout.LayoutParams linearLayoutParams = ((LinearLayout.LayoutParams) layoutParams); - if (!isRtl()) { + if (isOutmostIndexMax) { linearLayoutParams.setMarginEnd(mRingerRowsPadding); } else { linearLayoutParams.setMarginStart(mRingerRowsPadding); } } + row.view.setLayoutParams(layoutParams); // Set the background on each of the rows. We'll remove this from the last row after // the loop, since the last row's background is drawn by the main volume container. @@ -1614,13 +1849,13 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable, mContext.getDrawable(R.drawable.volume_row_rounded_background)); } - if (row.view.isShown()) { + if (row.view.isShown() || isExpandableRow) { updateVolumeRowTintH(row, isActive); } } - if (rightmostVisibleRowIndex > -1 && rightmostVisibleRowIndex < Short.MAX_VALUE) { - final View lastVisibleChild = mDialogRowsView.getChildAt(rightmostVisibleRowIndex); + if (outmostVisibleRowIndex > -1 && outmostVisibleRowIndex < Short.MAX_VALUE) { + final View lastVisibleChild = mDialogRowsView.getChildAt(outmostVisibleRowIndex); final ViewGroup.LayoutParams layoutParams = lastVisibleChild.getLayoutParams(); // Remove the spacing on the last row, and remove its background since the container is // drawing a background for this row. @@ -1629,8 +1864,106 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable, ((LinearLayout.LayoutParams) layoutParams); linearLayoutParams.setMarginStart(0); linearLayoutParams.setMarginEnd(0); + lastVisibleChild.setLayoutParams(linearLayoutParams); lastVisibleChild.setBackgroundColor(Color.TRANSPARENT); } + + int elevationCount = 0; + if (animate) { + // Increase the elevation of the outmost row so that other rows animate behind it. + lastVisibleChild.setElevation(1f / ++elevationCount); + + // Add a solid background to the outmost row temporary so that other rows animate + // behind it + lastVisibleChild.setBackgroundDrawable( + mContext.getDrawable(R.drawable.volume_background)); + } + + int[] lastVisibleChildLocation = new int[2]; + lastVisibleChild.getLocationInWindow(lastVisibleChildLocation); + + // Track previous rows to calculate translations + int visibleRowsCount = 0; + int hiddenRowsCount = 0; + int rowWidth = mDialogWidth + mRingerRowsPadding; + + for (final VolumeRow row : mRows) { + final boolean isExpandableRow = isExpandableRowH(row); + final boolean shouldBeVisible = shouldBeVisibleH(row, activeRow); + + if (shouldBeVisible) { + visibleRowsCount++; + } else if (isExpandableRow) { + hiddenRowsCount++; + } + + // Only move rows that are either expandable or visible and not the default stream + if ((!isExpandableRow && !shouldBeVisible) || row.defaultStream) { + continue; + } + + // Cancel any ongoing animations + row.view.animate().cancel(); + + // Expandable rows need to animate behind the last visible row, an additional + // always visible stream animates next to the default stream + float translationX = (isWindowGravityLeft() ? -1 : 1) * hiddenRowsCount * rowWidth; + + if (animate) { + // If the translation is not set and the panel is expanding start the + // animation behind the main row + if (isExpandableRow && mExpanded && row.view.getTranslationX() == 0f) { + row.view.setTranslationX( + (isWindowGravityLeft() ? -1 : 1) * visibleRowsCount * rowWidth); + } + + // The elevation should decrease from the outmost row to the inner rows, so that + // every row animates behind the outer rows + row.view.setElevation(1f / ++elevationCount); + + row.view.setVisibility(View.VISIBLE); + + // Track how many rows are animating to avoid running animation end actions + // if there is still a row animating + mAnimatingRows++; + row.view.animate() + .translationX(translationX) + .setDuration(mExpanded ? mDialogShowAnimationDurationMs + : mDialogHideAnimationDurationMs) + .setInterpolator(mExpanded + ? new SystemUIInterpolators.LogDecelerateInterpolator() + : new SystemUIInterpolators.LogAccelerateInterpolator()) + .setListener(new AnimatorListenerAdapter() { + @Override + public void onAnimationCancel(Animator animation) { + mAnimatingRows--; + animation.removeAllListeners(); + } + + @Override + public void onAnimationEnd(Animator animation) { + row.view.setElevation(0); + if (!shouldBeVisible) { + row.view.setVisibility(View.INVISIBLE); + } + mAnimatingRows--; + if (mAnimatingRows == 0) { + // Restore the elevation and background + lastVisibleChild.setElevation(0); + lastVisibleChild.setBackgroundColor(Color.TRANSPARENT); + // Set the active stream to ensure the volume keys change + // the volume of the tinted row. The tint was set before + // already, but setting the active row cancels ongoing + // animations. + mController.setActiveStream(activeRow.stream); + } + } + }); + } else { + row.view.setTranslationX(translationX); + row.view.setVisibility(shouldBeVisible ? View.VISIBLE : View.INVISIBLE); + } + } } updateBackgroundForDrawerClosedAmount(); @@ -1753,7 +2086,7 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable, protected void onStateChangedH(State state) { if (D.BUG) Log.d(TAG, "onStateChangedH() state: " + state.toString()); - if (mState != null && state != null + if (mShowing && mState != null && state != null && mState.ringerModeInternal != -1 && mState.ringerModeInternal != state.ringerModeInternal && state.ringerModeInternal == AudioManager.RINGER_MODE_VIBRATE) { @@ -1806,6 +2139,7 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable, final boolean isVoiceCallStream = row.stream == AudioManager.STREAM_VOICE_CALL; final boolean isA11yStream = row.stream == STREAM_ACCESSIBILITY; final boolean isRingStream = row.stream == AudioManager.STREAM_RING; + final boolean isNotificationStream = row.stream == AudioManager.STREAM_NOTIFICATION; final boolean isSystemStream = row.stream == AudioManager.STREAM_SYSTEM; final boolean isAlarmStream = row.stream == STREAM_ALARM; final boolean isMusicStream = row.stream == AudioManager.STREAM_MUSIC; @@ -1813,6 +2147,7 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable, && mState.ringerModeInternal == AudioManager.RINGER_MODE_VIBRATE; final boolean isRingSilent = isRingStream && mState.ringerModeInternal == AudioManager.RINGER_MODE_SILENT; + final boolean isNotificationMuted = isNotificationStream && ss.muted; final boolean isZenPriorityOnly = mState.zenMode == Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS; final boolean isZenAlarms = mState.zenMode == Global.ZEN_MODE_ALARMS; final boolean isZenNone = mState.zenMode == Global.ZEN_MODE_NO_INTERRUPTIONS; @@ -1845,7 +2180,7 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable, final int iconRes; if (isRingVibrate) { iconRes = R.drawable.ic_volume_ringer_vibrate; - } else if (isRingSilent || zenMuted) { + } else if (isRingSilent || isNotificationMuted || zenMuted) { iconRes = row.iconMuteRes; } else if (ss.routedToBluetooth) { if (isVoiceCallStream) { @@ -2149,6 +2484,21 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable, return (visibleRows - 1) * (mDialogWidth + mRingerRowsPadding); } + /** + * Return the size of invisible rows. + * Expandable rows are invisible while the panel is not expanded. + */ + private int getExpandableRowsExtraSize() { + VolumeRow activeRow = getActiveRow(); + int expandableRows = 0; + for (final VolumeRow row : mRows) { + if (isExpandableRowH(row)) { + expandableRows++; + } + } + return expandableRows * (mDialogWidth + mRingerRowsPadding); + } + private void updateBackgroundForDrawerClosedAmount() { if (mRingerAndDrawerContainerBackground == null) { return; @@ -2157,6 +2507,9 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable, final Rect bounds = mRingerAndDrawerContainerBackground.copyBounds(); if (!isLandscape()) { bounds.top = (int) (mRingerDrawerClosedAmount * getRingerDrawerOpenExtraSize()); + } else if (isWindowGravityLeft()) { + bounds.right = (int) ((mDialogCornerRadius / 2) + mRingerDrawerItemSize + + (1f - mRingerDrawerClosedAmount) * getRingerDrawerOpenExtraSize()); } else { bounds.left = (int) (mRingerDrawerClosedAmount * getRingerDrawerOpenExtraSize()); } @@ -2164,7 +2517,7 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable, } /* - * The top container is responsible for drawing the solid color background behind the rightmost + * The top container is responsible for drawing the solid color background behind the outmost * (primary) volume row. This is because the volume drawer animates in from below, initially * overlapping the primary row. We need the drawer to draw below the row's SeekBar, since it * looks strange to overlap it, but above the row's background color, since otherwise it will be @@ -2198,8 +2551,9 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable, ? mDialogRowsViewContainer.getTop() : mDialogRowsViewContainer.getTop() - mDialogCornerRadius); - // Set gravity to top-right, since additional rows will be added on the left. - background.setLayerGravity(0, Gravity.TOP | Gravity.RIGHT); + // Set gravity to top and opposite side where additional rows will be added. + background.setLayerGravity( + 0, isWindowGravityLeft() ? Gravity.TOP | Gravity.LEFT : Gravity.TOP | Gravity.RIGHT); // In landscape, the ringer drawer animates out to the left (instead of down). Since the // drawer comes from the right (beyond the bounds of the dialog), we should clip it so it @@ -2248,7 +2602,6 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable, @Override public void onLayoutDirectionChanged(int layoutDirection) { - mDialogView.setLayoutDirection(layoutDirection); } @Override @@ -2380,9 +2733,12 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable, @Override public boolean onTouchEvent(@NonNull MotionEvent event) { if (mShowing) { - if (event.getAction() == MotionEvent.ACTION_OUTSIDE) { - dismissH(Events.DISMISS_REASON_TOUCH_OUTSIDE); - return true; + switch(event.getAction()){ + case MotionEvent.ACTION_OUTSIDE: + case MotionEvent.ACTION_DOWN: + // Touches inside won't trigger onTouchEvent + dismissH(Events.DISMISS_REASON_TOUCH_OUTSIDE); + return false; } } return false; diff --git a/packages/SystemUI/tests/src/com/android/systemui/controls/controller/ControlActionCoordinatorImplTest.kt b/packages/SystemUI/tests/src/com/android/systemui/controls/controller/ControlActionCoordinatorImplTest.kt index 38372a33f1e6..044ece8ea158 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/controls/controller/ControlActionCoordinatorImplTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/controls/controller/ControlActionCoordinatorImplTest.kt @@ -133,16 +133,6 @@ class ControlActionCoordinatorImplTest : SysuiTestCase() { verify(coordinator).bouncerOrRun(action) verify(activityStarter).dismissKeyguardThenExecute(any(), any(), anyBoolean()) verify(action, never()).invoke() - - // Simulate a refresh call from a Publisher, which will trigger a call to runPendingAction - reset(action) - coordinator.runPendingAction(ID) - verify(action, never()).invoke() - - `when`(keyguardStateController.isUnlocked()).thenReturn(true) - reset(action) - coordinator.runPendingAction(ID) - verify(action).invoke() } @Test diff --git a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java index 4e9ec90199a2..74f950f6681a 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java @@ -614,7 +614,8 @@ public class NotificationPanelViewControllerBaseTest extends SysuiTestCase { mKeyguardInteractor, mActivityStarter, mEmergencyButtonControllerFactory, - mKeyguardFaceAuthInteractor); + mKeyguardFaceAuthInteractor, + mTunerService); mNotificationPanelViewController.initDependencies( mCentralSurfaces, null, |