Change keyguard theme when wallpaper colors change
Bug: 38163994
Bug: 37014702
Bug: 62053168
Test: visual
Change-Id: I5a2da4ef2ad6fc1dab71588f2d0f5bd207731900
diff --git a/packages/SystemUI/AndroidManifest.xml b/packages/SystemUI/AndroidManifest.xml
index 3ee451a..e322acc 100644
--- a/packages/SystemUI/AndroidManifest.xml
+++ b/packages/SystemUI/AndroidManifest.xml
@@ -195,6 +195,9 @@
<!-- to access instant apps -->
<uses-permission android:name="android.permission.ACCESS_INSTANT_APPS" />
+ <!-- to change themes - light or dark -->
+ <uses-permission android:name="android.permission.CHANGE_OVERLAY_PACKAGES" />
+
<application
android:name=".SystemUIApplication"
android:persistent="true"
diff --git a/packages/SystemUI/res-keyguard/drawable/pin_divider.xml b/packages/SystemUI/res-keyguard/drawable/pin_divider.xml
new file mode 100644
index 0000000..39104b5
--- /dev/null
+++ b/packages/SystemUI/res-keyguard/drawable/pin_divider.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ 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
+ -->
+
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+ <solid android:color="@color/pin_divider_color" />
+</shape>
\ No newline at end of file
diff --git a/packages/SystemUI/res-keyguard/layout/keyguard_password_view.xml b/packages/SystemUI/res-keyguard/layout/keyguard_password_view.xml
index 29c93d5..26a179a 100644
--- a/packages/SystemUI/res-keyguard/layout/keyguard_password_view.xml
+++ b/packages/SystemUI/res-keyguard/layout/keyguard_password_view.xml
@@ -54,6 +54,7 @@
android:textStyle="normal"
android:inputType="textPassword"
android:textSize="16sp"
+ android:textColor="?attr/bgProtectTextColor"
android:textAppearance="?android:attr/textAppearanceMedium"
android:imeOptions="flagForceAscii|actionDone"
android:maxLength="500"
@@ -67,6 +68,7 @@
android:contentDescription="@string/accessibility_ime_switch_button"
android:clickable="true"
android:padding="8dip"
+ android:tint="@color/background_protected"
android:layout_gravity="end|center_vertical"
android:background="?android:attr/selectableItemBackground"
android:visibility="gone"
diff --git a/packages/SystemUI/res-keyguard/layout/keyguard_pin_view.xml b/packages/SystemUI/res-keyguard/layout/keyguard_pin_view.xml
index e75f3c15..9a97162 100644
--- a/packages/SystemUI/res-keyguard/layout/keyguard_pin_view.xml
+++ b/packages/SystemUI/res-keyguard/layout/keyguard_pin_view.xml
@@ -54,6 +54,7 @@
android:layout_centerHorizontal="true"
android:layout_marginRight="72dp"
androidprv:scaledTextSize="28"
+ android:textColor="?attr/bgProtectTextColor"
android:contentDescription="@string/keyguard_accessibility_pin_area"
/>
<ImageButton
@@ -65,19 +66,20 @@
android:clickable="true"
android:paddingTop="8dip"
android:paddingBottom="8dip"
- android:paddingRight="8dp"
+ android:paddingRight="0dp"
android:paddingLeft="24dp"
android:background="@drawable/ripple_drawable"
android:contentDescription="@string/keyboardview_keycode_delete"
android:layout_alignEnd="@+id/pinEntry"
android:layout_alignParentRight="true"
+ android:tint="@color/pin_delete_color"
/>
<View
android:id="@+id/divider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_alignParentBottom="true"
- android:background="#28FFFFFF"
+ android:background="@drawable/pin_divider"
/>
</com.android.keyguard.AlphaOptimizedRelativeLayout>
<LinearLayout
@@ -203,6 +205,7 @@
android:layout_weight="1"
android:paddingBottom="11sp"
android:src="@drawable/ic_done_wht"
+ style="@style/Keyguard.ImageButton.NumPadEnter"
android:background="@drawable/ripple_drawable"
android:contentDescription="@string/keyboardview_keycode_enter"
/>
diff --git a/packages/SystemUI/res-keyguard/layout/keyguard_sim_pin_view.xml b/packages/SystemUI/res-keyguard/layout/keyguard_sim_pin_view.xml
index fd681ca..7d47881 100644
--- a/packages/SystemUI/res-keyguard/layout/keyguard_sim_pin_view.xml
+++ b/packages/SystemUI/res-keyguard/layout/keyguard_sim_pin_view.xml
@@ -66,6 +66,7 @@
android:layout_centerHorizontal="true"
android:layout_marginRight="72dp"
androidprv:scaledTextSize="28"
+ android:textColor="?attr/bgProtectTextColor"
android:contentDescription="@string/keyguard_accessibility_sim_pin_area"
/>
<ImageButton
@@ -77,19 +78,20 @@
android:clickable="true"
android:paddingTop="8dip"
android:paddingBottom="8dip"
- android:paddingRight="8dp"
+ android:paddingRight="0dp"
android:paddingLeft="24dp"
android:background="@drawable/ripple_drawable"
android:contentDescription="@string/keyboardview_keycode_delete"
android:layout_alignEnd="@+id/pinEntry"
android:layout_alignParentRight="true"
+ android:tint="@color/pin_delete_color"
/>
<View
android:id="@+id/divider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_alignParentBottom="true"
- android:background="#28FFFFFF"
+ android:background="@drawable/pin_divider"
/>
</RelativeLayout>
<LinearLayout
@@ -211,6 +213,7 @@
android:layout_weight="1"
android:paddingBottom="11sp"
android:src="@drawable/ic_done_wht"
+ style="@style/Keyguard.ImageButton.NumPadEnter"
android:background="@drawable/ripple_drawable"
android:contentDescription="@string/keyboardview_keycode_enter"
/>
diff --git a/packages/SystemUI/res-keyguard/layout/keyguard_sim_puk_view.xml b/packages/SystemUI/res-keyguard/layout/keyguard_sim_puk_view.xml
index 040b429..aaa53ee 100644
--- a/packages/SystemUI/res-keyguard/layout/keyguard_sim_puk_view.xml
+++ b/packages/SystemUI/res-keyguard/layout/keyguard_sim_puk_view.xml
@@ -67,6 +67,7 @@
android:layout_centerHorizontal="true"
android:layout_marginRight="72dp"
androidprv:scaledTextSize="28"
+ android:textColor="?attr/bgProtectTextColor"
android:contentDescription="@string/keyguard_accessibility_sim_puk_area"
/>
<ImageButton
@@ -78,19 +79,20 @@
android:clickable="true"
android:paddingTop="8dip"
android:paddingBottom="8dip"
- android:paddingRight="8dp"
+ android:paddingRight="0dp"
android:paddingLeft="24dp"
android:background="@drawable/ripple_drawable"
android:contentDescription="@string/keyboardview_keycode_delete"
android:layout_alignEnd="@+id/pinEntry"
android:layout_alignParentRight="true"
+ android:tint="@color/pin_delete_color"
/>
<View
android:id="@+id/divider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_alignParentBottom="true"
- android:background="#28FFFFFF"
+ android:background="@drawable/pin_divider"
/>
</RelativeLayout>
<LinearLayout
@@ -212,6 +214,7 @@
android:layout_weight="1"
android:paddingBottom="11sp"
android:src="@drawable/ic_done_wht"
+ style="@style/Keyguard.ImageButton.NumPadEnter"
android:background="@drawable/ripple_drawable"
android:contentDescription="@string/keyboardview_keycode_enter"
/>
diff --git a/packages/SystemUI/res-keyguard/values/attrs.xml b/packages/SystemUI/res-keyguard/values/attrs.xml
index 7cfe631..d3d60a1e 100644
--- a/packages/SystemUI/res-keyguard/values/attrs.xml
+++ b/packages/SystemUI/res-keyguard/values/attrs.xml
@@ -35,9 +35,13 @@
<attr name="android:gravity" />
<attr name="dotSize" format="dimension" />
<attr name="charPadding" format="dimension" />
+ <attr name="android:textColor" format="color" />
</declare-styleable>
<declare-styleable name="CarrierText">
<attr name="allCaps" format="boolean" />
</declare-styleable>
+
+ <attr name="pinDividerColor" format="color" />
+ <attr name="pinDeleteColor" format="color" />
</resources>
diff --git a/packages/SystemUI/res-keyguard/values/colors.xml b/packages/SystemUI/res-keyguard/values/colors.xml
deleted file mode 100644
index 5071594..0000000
--- a/packages/SystemUI/res-keyguard/values/colors.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2012 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.
--->
-<resources>
- <color name="keyguard_numpad_divider_light">#80FFFFFF</color> <!-- 50% white -->
- <color name="keyguard_numpad_divider_dark">#FF9FA4A6</color>
- <color name="keyguard_numpad_delete_light">#FFFFFFFF</color>
- <color name="keyguard_numpad_delete_dark">@color/material_grey_600</color>
-</resources>
diff --git a/packages/SystemUI/res-keyguard/values/styles.xml b/packages/SystemUI/res-keyguard/values/styles.xml
index 53a559f..d7ff349 100644
--- a/packages/SystemUI/res-keyguard/values/styles.xml
+++ b/packages/SystemUI/res-keyguard/values/styles.xml
@@ -20,11 +20,11 @@
<resources>
<!-- Keyguard PIN pad styles -->
<style name="Keyguard.TextView" parent="@android:style/Widget.DeviceDefault.TextView">
- <item name="android:textColor">@*android:color/primary_device_default_light</item>
+ <item name="android:textColor">?attr/bgProtectSecondaryTextColor</item>
<item name="android:textSize">@dimen/kg_status_line_font_size</item>
</style>
<style name="Keyguard.TextView.EmergencyButton" parent="@android:style/DeviceDefault.ButtonBar">
- <item name="android:textColor">@*android:color/primary_device_default_light</item>
+ <item name="android:textColor">?attr/bgProtectSecondaryTextColor</item>
<item name="android:textSize">@dimen/kg_status_line_font_size</item>
<item name="android:background">@null</item>
</style>
@@ -34,13 +34,16 @@
<item name="android:background">@null</item>
<item name="android:textSize">36sp</item>
<item name="android:fontFamily">sans-serif-light</item>
- <item name="android:textColor">#ffffffff</item>
+ <item name="android:textColor">?attr/bgProtectTextColor</item>
<item name="android:paddingBottom">-16dp</item>
</style>
+ <style name="Keyguard.ImageButton.NumPadEnter" parent="@android:style/Widget.ImageButton">
+ <item name="android:tint">?attr/bgProtectTextColor</item>
+ </style>
<style name="Widget.TextView.NumPadKey.Klondike" parent="Widget.TextView.NumPadKey">
<item name="android:textSize">12sp</item>
<item name="android:fontFamily">sans-serif</item>
- <item name="android:textColor">#80ffffff</item>
+ <item name="android:textColor">?attr/bgProtectSecondaryTextColor</item>
<item name="android:paddingBottom">0dp</item>
</style>
@@ -58,8 +61,9 @@
</style>
<style name="PasswordTheme" parent="@android:style/Theme.DeviceDefault">
- <item name="android:colorControlNormal">#80ffffff</item>
- <item name="android:colorControlActivated">#80ffffff</item>
+ <item name="android:textColor">?attr/bgProtectTextColor</item>
+ <item name="android:colorControlNormal">?attr/bgProtectTextColor</item>
+ <item name="android:colorControlActivated">?attr/bgProtectTextColor</item>
</style>
<style name="keyguard_presentation_theme" parent="@android:style/Theme.Material.NoActionBar.Fullscreen">
diff --git a/packages/SystemUI/res/color/background_protect_secondary.xml b/packages/SystemUI/res/color/background_protect_secondary.xml
new file mode 100644
index 0000000..26dc151
--- /dev/null
+++ b/packages/SystemUI/res/color/background_protect_secondary.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ 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
+ -->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:color="?attr/bgProtectSecondaryTextColor" />
+</selector>
\ No newline at end of file
diff --git a/packages/SystemUI/res/color/background_protected.xml b/packages/SystemUI/res/color/background_protected.xml
new file mode 100644
index 0000000..ab8ed87
--- /dev/null
+++ b/packages/SystemUI/res/color/background_protected.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ 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
+ -->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:color="?attr/bgProtectTextColor" />
+</selector>
\ No newline at end of file
diff --git a/packages/SystemUI/res/color/pin_delete_color.xml b/packages/SystemUI/res/color/pin_delete_color.xml
new file mode 100644
index 0000000..bb8b8e3
--- /dev/null
+++ b/packages/SystemUI/res/color/pin_delete_color.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ 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
+ -->
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:alpha="0.61" android:color="?attr/bgProtectTextColor" />
+</selector>
\ No newline at end of file
diff --git a/packages/SystemUI/res/color/pin_divider_color.xml b/packages/SystemUI/res/color/pin_divider_color.xml
new file mode 100644
index 0000000..ca5f431
--- /dev/null
+++ b/packages/SystemUI/res/color/pin_divider_color.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ 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
+ -->
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:alpha="0.45" android:color="?attr/bgProtectSecondaryTextColor" />
+</selector>
\ No newline at end of file
diff --git a/packages/SystemUI/res/drawable/qs_background_primary.xml b/packages/SystemUI/res/drawable/qs_background_primary.xml
index 03bba53..4165830 100644
--- a/packages/SystemUI/res/drawable/qs_background_primary.xml
+++ b/packages/SystemUI/res/drawable/qs_background_primary.xml
@@ -15,6 +15,6 @@
-->
<inset xmlns:android="http://schemas.android.com/apk/res/android">
<shape>
- <solid android:color="@color/qs_background_dark"/>
+ <solid android:color="?android:attr/colorBackgroundFloating"/>
</shape>
</inset>
diff --git a/packages/SystemUI/res/layout/keyguard_status_bar.xml b/packages/SystemUI/res/layout/keyguard_status_bar.xml
index c5f2f4a..71a681c 100644
--- a/packages/SystemUI/res/layout/keyguard_status_bar.xml
+++ b/packages/SystemUI/res/layout/keyguard_status_bar.xml
@@ -63,7 +63,7 @@
android:gravity="center_vertical"
android:ellipsize="marquee"
android:textAppearance="?android:attr/textAppearanceSmall"
- android:textColor="#ffffff"
+ android:textColor="?attr/bgProtectSecondaryTextColor"
android:singleLine="true" />
</com.android.systemui.statusbar.phone.KeyguardStatusBarView>
diff --git a/packages/SystemUI/res/layout/qs_panel.xml b/packages/SystemUI/res/layout/qs_panel.xml
index fb4ac04..62a1756 100644
--- a/packages/SystemUI/res/layout/qs_panel.xml
+++ b/packages/SystemUI/res/layout/qs_panel.xml
@@ -18,7 +18,6 @@
android:id="@+id/quick_settings_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:background="?android:attr/colorPrimaryDark"
android:clipToPadding="false"
android:clipChildren="false">
@@ -27,6 +26,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/qs_background_primary"
+ android:alpha="0.8"
android:elevation="4dp" />
<com.android.systemui.qs.QSPanel
diff --git a/packages/SystemUI/res/layout/signal_cluster_view.xml b/packages/SystemUI/res/layout/signal_cluster_view.xml
index 2e22943..25c87d3 100644
--- a/packages/SystemUI/res/layout/signal_cluster_view.xml
+++ b/packages/SystemUI/res/layout/signal_cluster_view.xml
@@ -32,6 +32,7 @@
android:layout_width="wrap_content"
android:paddingEnd="6dp"
android:src="@drawable/stat_sys_vpn_ic"
+ android:tint="@color/background_protect_secondary"
android:contentDescription="@string/accessibility_vpn_on"
/>
<FrameLayout
diff --git a/packages/SystemUI/res/layout/status_bar_expanded.xml b/packages/SystemUI/res/layout/status_bar_expanded.xml
index 07a9a60..bef0830 100644
--- a/packages/SystemUI/res/layout/status_bar_expanded.xml
+++ b/packages/SystemUI/res/layout/status_bar_expanded.xml
@@ -27,7 +27,6 @@
<include
layout="@layout/keyguard_status_view"
- android:layout_height="wrap_content"
android:visibility="gone" />
<com.android.systemui.statusbar.phone.NotificationsQuickSettingsContainer
diff --git a/packages/SystemUI/res/layout/status_bar_no_notifications.xml b/packages/SystemUI/res/layout/status_bar_no_notifications.xml
index 6f87184..ed4bc67 100644
--- a/packages/SystemUI/res/layout/status_bar_no_notifications.xml
+++ b/packages/SystemUI/res/layout/status_bar_no_notifications.xml
@@ -27,7 +27,7 @@
android:layout_height="64dp"
android:paddingTop="28dp"
android:gravity="top|center_horizontal"
- android:textColor="#e6ffffff"
+ android:textColor="?attr/bgProtectTextColor"
android:textSize="16sp"
android:text="@string/empty_shade_text"/>
</com.android.systemui.statusbar.EmptyShadeView>
diff --git a/packages/SystemUI/res/layout/status_bar_notification_dismiss_all.xml b/packages/SystemUI/res/layout/status_bar_notification_dismiss_all.xml
index efb273f..eefa9bc 100644
--- a/packages/SystemUI/res/layout/status_bar_notification_dismiss_all.xml
+++ b/packages/SystemUI/res/layout/status_bar_notification_dismiss_all.xml
@@ -30,5 +30,6 @@
android:focusable="true"
android:contentDescription="@string/accessibility_clear_all"
android:text="@string/clear_all_notifications_text"
+ android:textColor="?attr/bgProtectTextColor"
android:textAllCaps="true"/>
</com.android.systemui.statusbar.DismissView>
diff --git a/packages/SystemUI/res/values/attrs.xml b/packages/SystemUI/res/values/attrs.xml
index ce57bf9..81f0138 100644
--- a/packages/SystemUI/res/values/attrs.xml
+++ b/packages/SystemUI/res/values/attrs.xml
@@ -127,5 +127,7 @@
<attr name="lightIconTheme" format="reference" />
<attr name="darkIconTheme" format="reference" />
+ <attr name="bgProtectTextColor" format="color" />
+ <attr name="bgProtectSecondaryTextColor" format="color" />
</resources>
diff --git a/packages/SystemUI/res/values/styles.xml b/packages/SystemUI/res/values/styles.xml
index b046256..5d8d389 100644
--- a/packages/SystemUI/res/values/styles.xml
+++ b/packages/SystemUI/res/values/styles.xml
@@ -293,7 +293,18 @@
<style name="systemui_theme" parent="@*android:style/Theme.DeviceDefault.QuickSettings">
<item name="lightIconTheme">@style/DualToneLightTheme</item>
<item name="darkIconTheme">@style/DualToneDarkTheme</item>
+ <item name="bgProtectTextColor">?android:attr/textColorPrimaryInverse</item>
+ <item name="bgProtectSecondaryTextColor">?android:attr/textColorSecondaryInverse</item>
+ <item name="pinDividerColor">@color/pin_divider_color</item>
+ <item name="pinDeleteColor">@color/pin_delete_color</item>
+ <item name="*android:lockPatternStyle">@style/LockPatternStyle</item>
</style>
+
+ <style name="LockPatternStyle">
+ <item name="*android:regularColor">?android:attr/textColorPrimaryInverse</item>
+ <item name="*android:successColor">?android:attr/textColorPrimaryInverse</item>
+ </style>
+
<style name="qs_theme" parent="systemui_theme">
<item name="lightIconTheme">@style/QSIconTheme</item>
<item name="darkIconTheme">@style/QSIconTheme</item>
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java
index 616e5b9..165ca2a 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java
@@ -75,8 +75,7 @@
}
public KeyguardSecurityContainer(Context context, AttributeSet attrs, int defStyle) {
- super(new ContextThemeWrapper(context, android.R.style.Theme_DeviceDefault), attrs,
- defStyle);
+ super(context, attrs, defStyle);
mSecurityModel = new KeyguardSecurityModel(context);
mLockPatternUtils = new LockPatternUtils(context);
mUpdateMonitor = KeyguardUpdateMonitor.getInstance(mContext);
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java
index 988ab04..15b766d 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java
@@ -191,6 +191,10 @@
((MarginLayoutParams) mClockView.getLayoutParams()).bottomMargin;
}
+ public float getClockTextSize() {
+ return mClockView.getTextSize();
+ }
+
public static String formatNextAlarm(Context context, AlarmManager.AlarmClockInfo info) {
if (info == null) {
return "";
diff --git a/packages/SystemUI/src/com/android/keyguard/PasswordTextView.java b/packages/SystemUI/src/com/android/keyguard/PasswordTextView.java
index c43820d..7e81173 100644
--- a/packages/SystemUI/src/com/android/keyguard/PasswordTextView.java
+++ b/packages/SystemUI/src/com/android/keyguard/PasswordTextView.java
@@ -23,6 +23,7 @@
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
+import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.Typeface;
@@ -127,12 +128,13 @@
mCharPadding = a.getDimensionPixelSize(R.styleable.PasswordTextView_charPadding,
getContext().getResources().getDimensionPixelSize(
R.dimen.password_char_padding));
+ int textColor = a.getColor(R.styleable.PasswordTextView_android_textColor, Color.WHITE);
+ mDrawPaint.setColor(textColor);
} finally {
a.recycle();
}
mDrawPaint.setFlags(Paint.SUBPIXEL_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG);
mDrawPaint.setTextAlign(Paint.Align.CENTER);
- mDrawPaint.setColor(0xffffffff);
mDrawPaint.setTypeface(Typeface.create("sans-serif-light", 0));
mShowPassword = Settings.System.getInt(mContext.getContentResolver(),
Settings.System.TEXT_SHOW_PASSWORD, 1) == 1;
diff --git a/packages/SystemUI/src/com/android/systemui/BatteryMeterView.java b/packages/SystemUI/src/com/android/systemui/BatteryMeterView.java
index cf8747e..6476416 100644
--- a/packages/SystemUI/src/com/android/systemui/BatteryMeterView.java
+++ b/packages/SystemUI/src/com/android/systemui/BatteryMeterView.java
@@ -71,6 +71,7 @@
private int mLightModeBackgroundColor;
private int mLightModeFillColor;
+ private float mDarkIntensity;
public BatteryMeterView(Context context) {
this(context, null, 0);
@@ -238,6 +239,7 @@
@Override
public void onDarkChanged(Rect area, float darkIntensity, int tint) {
+ mDarkIntensity = darkIntensity;
float intensity = DarkIconDispatcher.isInArea(area, this) ? darkIntensity : 0;
int foreground = getColorForDarkIntensity(intensity, mLightModeFillColor,
mDarkModeFillColor);
@@ -254,6 +256,14 @@
}
}
+ public void setFillColor(int color) {
+ if (mLightModeFillColor == color) {
+ return;
+ }
+ mLightModeFillColor = color;
+ onDarkChanged(new Rect(), mDarkIntensity, DarkIconDispatcher.DEFAULT_ICON_TINT);
+ }
+
private int getColorForDarkIntensity(float darkIntensity, int lightColor, int darkColor) {
return (int) ArgbEvaluator.getInstance().evaluate(darkIntensity, lightColor, darkColor);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java
index aa32623..25ef478 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java
@@ -65,16 +65,16 @@
private static final long TRANSIENT_FP_ERROR_TIMEOUT = 1300;
private final Context mContext;
- private final ViewGroup mIndicationArea;
- private final KeyguardIndicationTextView mTextView;
- private final KeyguardIndicationTextView mDisclosure;
+ private ViewGroup mIndicationArea;
+ private KeyguardIndicationTextView mTextView;
+ private KeyguardIndicationTextView mDisclosure;
private final UserManager mUserManager;
private final IBatteryStats mBatteryInfo;
private final SettableWakeLock mWakeLock;
private final int mSlowThreshold;
private final int mFastThreshold;
- private final LockIcon mLockIcon;
+ private LockIcon mLockIcon;
private StatusBarKeyguardViewManager mStatusBarKeyguardViewManager;
private String mRestingIndication;
@@ -115,7 +115,7 @@
mIndicationArea = indicationArea;
mTextView = (KeyguardIndicationTextView) indicationArea.findViewById(
R.id.keyguard_indication_text);
- mInitialTextColor = mTextView.getCurrentTextColor();
+ mInitialTextColor = mTextView != null ? mTextView.getCurrentTextColor() : Color.WHITE;
mDisclosure = (KeyguardIndicationTextView) indicationArea.findViewById(
R.id.keyguard_indication_enterprise_disclosure);
mLockIcon = lockIcon;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ConfigurationControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ConfigurationControllerImpl.java
index 020dc25..e0f577d 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ConfigurationControllerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ConfigurationControllerImpl.java
@@ -15,36 +15,76 @@
package com.android.systemui.statusbar.phone;
import android.content.Context;
+import android.content.om.IOverlayManager;
import android.content.res.Configuration;
+import android.os.RemoteException;
+import android.os.ServiceManager;
+import android.os.UserHandle;
import com.android.systemui.ConfigurationChangedReceiver;
import com.android.systemui.statusbar.policy.ConfigurationController;
import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
public class ConfigurationControllerImpl implements ConfigurationController,
ConfigurationChangedReceiver {
private final ArrayList<ConfigurationListener> mListeners = new ArrayList<>();
+ private final IOverlayManager mOverlayManager;
private int mDensity;
private float mFontScale;
+ private Map mActiveOverlays;
public ConfigurationControllerImpl(Context context) {
Configuration currentConfig = context.getResources().getConfiguration();
+ mOverlayManager = IOverlayManager.Stub.asInterface(
+ ServiceManager.getService(Context.OVERLAY_SERVICE));
mFontScale = currentConfig.fontScale;
mDensity = currentConfig.densityDpi;
+ try {
+ mActiveOverlays = mOverlayManager.getAllOverlays(UserHandle.getCallingUserId());
+ } catch (RemoteException e) {
+ mActiveOverlays = new HashMap();
+ }
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
- mListeners.forEach(l -> l.onConfigChanged(newConfig));
+ // Avoid concurrent modification exception
+ ArrayList<ConfigurationListener> listeners = new ArrayList<>(mListeners);
+
+ listeners.forEach(l -> {
+ if (mListeners.contains(l)) {
+ l.onConfigChanged(newConfig);
+ }
+ });
final float fontScale = newConfig.fontScale;
final int density = newConfig.densityDpi;
if (density != mDensity || mFontScale != fontScale) {
- mListeners.forEach(l -> l.onDensityOrFontScaleChanged());
+ listeners.forEach(l -> {
+ if (mListeners.contains(l)) {
+ l.onDensityOrFontScaleChanged();
+ }
+ });
mDensity = density;
mFontScale = fontScale;
}
+
+ try {
+ Map activeOverlays = mOverlayManager.getAllOverlays(UserHandle.getCallingUserId());
+ if (!mActiveOverlays.equals(activeOverlays)) {
+ mActiveOverlays = activeOverlays;
+ listeners.forEach(l -> {
+ if (mListeners.contains(l)) {
+ l.onOverlayChanged();
+ }
+ });
+ }
+ } catch (RemoteException e) {
+ e.rethrowAsRuntimeException();
+ }
}
@Override
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarView.java
index 42b09df..6d6250e 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarView.java
@@ -16,9 +16,12 @@
package com.android.systemui.statusbar.phone;
+import android.annotation.ColorInt;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
+import android.content.res.TypedArray;
+import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.util.TypedValue;
@@ -28,6 +31,7 @@
import android.widget.RelativeLayout;
import android.widget.TextView;
+import com.android.settingslib.Utils;
import com.android.systemui.BatteryMeterView;
import com.android.systemui.Dependency;
import com.android.systemui.Interpolators;
@@ -312,4 +316,10 @@
public boolean hasOverlappingRendering() {
return false;
}
+
+ public void onOverlayChanged() {
+ @ColorInt int textColor = Utils.getColorAttr(mContext, R.attr.bgProtectTextColor);
+ mCarrierLabel.setTextColor(textColor);
+ mBatteryView.setFillColor(textColor);
+ }
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java
index 52838b0..b888e8c 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java
@@ -235,4 +235,9 @@
v.setDecorColor(mIconTint);
}
}
+
+ public void setDark(boolean dark) {
+ mNotificationIcons.setDark(dark, false, 0);
+ mShelfIcons.setDark(dark, false, 0);
+ }
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
index 4009db6e..e2b9da0 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
@@ -34,6 +34,7 @@
import android.util.AttributeSet;
import android.util.FloatProperty;
import android.util.MathUtils;
+import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.VelocityTracker;
import android.view.View;
@@ -47,8 +48,10 @@
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.keyguard.KeyguardStatusView;
import com.android.systemui.DejankUtils;
+import com.android.systemui.Dependency;
import com.android.systemui.Interpolators;
import com.android.systemui.R;
+import com.android.systemui.SystemUIFactory;
import com.android.systemui.classifier.FalsingManager;
import com.android.systemui.fragments.FragmentHostManager;
import com.android.systemui.fragments.FragmentHostManager.FragmentListener;
@@ -58,6 +61,7 @@
import com.android.systemui.statusbar.FlingAnimationUtils;
import com.android.systemui.statusbar.GestureRecorder;
import com.android.systemui.statusbar.KeyguardAffordanceView;
+import com.android.systemui.statusbar.KeyguardIndicationController;
import com.android.systemui.statusbar.NotificationData;
import com.android.systemui.statusbar.NotificationShelf;
import com.android.systemui.statusbar.StatusBarState;
@@ -65,6 +69,7 @@
import com.android.systemui.statusbar.policy.HeadsUpManager;
import com.android.systemui.statusbar.policy.KeyguardUserSwitcher;
import com.android.systemui.statusbar.policy.OnHeadsUpChangedListener;
+import com.android.systemui.statusbar.policy.UserInfoController;
import com.android.systemui.statusbar.stack.NotificationStackScrollLayout;
import com.android.systemui.statusbar.stack.StackStateAnimator;
@@ -112,7 +117,6 @@
private QS mQs;
private FrameLayout mQsFrame;
private KeyguardStatusView mKeyguardStatusView;
- private TextView mClockView;
private View mReserveNotificationSpace;
private View mQsNavbarScrim;
protected NotificationsQuickSettingsContainer mNotificationContainerParent;
@@ -232,6 +236,8 @@
private LockscreenGestureLogger mLockscreenGestureLogger = new LockscreenGestureLogger();
private boolean mNoVisibleNotifications = true;
private ValueAnimator mDarkAnimator;
+ private StatusBarKeyguardViewManager mStatusBarKeyguardViewManager;
+ private boolean mUserSetupComplete;
public NotificationPanelView(Context context, AttributeSet attrs) {
super(context, attrs);
@@ -243,6 +249,7 @@
public void setStatusBar(StatusBar bar) {
mStatusBar = bar;
+ mKeyguardBottomArea.setStatusBar(mStatusBar);
}
@Override
@@ -250,7 +257,6 @@
super.onFinishInflate();
mKeyguardStatusBar = findViewById(R.id.keyguard_header);
mKeyguardStatusView = findViewById(R.id.keyguard_status_view);
- mClockView = findViewById(R.id.clock_view);
mNotificationContainerParent = (NotificationsQuickSettingsContainer)
findViewById(R.id.notification_container_parent);
@@ -261,10 +267,10 @@
mNotificationStackScroller.setOnEmptySpaceClickListener(this);
mKeyguardBottomArea = findViewById(R.id.keyguard_bottom_area);
mQsNavbarScrim = findViewById(R.id.qs_navbar_scrim);
- mAffordanceHelper = new KeyguardAffordanceHelper(this, getContext());
- mKeyguardBottomArea.setAffordanceHelper(mAffordanceHelper);
mLastOrientation = getResources().getConfiguration().orientation;
+ initBottomArea();
+
mQsFrame = findViewById(R.id.qs_frame);
}
@@ -324,6 +330,38 @@
}
}
+ public void onOverlayChanged() {
+ // Re-inflate the status view group.
+ int index = indexOfChild(mKeyguardStatusView);
+ removeView(mKeyguardStatusView);
+ mKeyguardStatusView = (KeyguardStatusView) LayoutInflater.from(mContext).inflate(
+ R.layout.keyguard_status_view,
+ this,
+ false);
+ addView(mKeyguardStatusView, index);
+
+ // Update keyguard bottom area
+ index = indexOfChild(mKeyguardBottomArea);
+ removeView(mKeyguardBottomArea);
+ mKeyguardBottomArea = (KeyguardBottomAreaView) LayoutInflater.from(mContext).inflate(
+ R.layout.keyguard_bottom_area,
+ this,
+ false);
+ addView(mKeyguardBottomArea, index);
+ initBottomArea();
+ }
+
+ private void initBottomArea() {
+ mAffordanceHelper = new KeyguardAffordanceHelper(this, getContext());
+ mKeyguardBottomArea.setAffordanceHelper(mAffordanceHelper);
+ mKeyguardBottomArea.setStatusBar(mStatusBar);
+ mKeyguardBottomArea.setUserSetupComplete(mUserSetupComplete);
+ }
+
+ public void setKeyguardIndicationController(KeyguardIndicationController indicationController) {
+ mKeyguardBottomArea.setKeyguardIndicationController(indicationController);
+ }
+
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
super.onLayout(changed, left, top, right, bottom);
@@ -331,7 +369,8 @@
// Update Clock Pivot
mKeyguardStatusView.setPivotX(getWidth() / 2);
- mKeyguardStatusView.setPivotY((FONT_HEIGHT - CAP_HEIGHT) / 2048f * mClockView.getTextSize());
+ mKeyguardStatusView.setPivotY((FONT_HEIGHT - CAP_HEIGHT) / 2048f *
+ mKeyguardStatusView.getClockTextSize());
// Calculate quick setting heights.
int oldMaxHeight = mQsMaxExpansionHeight;
@@ -2571,4 +2610,31 @@
mStatusBar.updateKeyguardMaxNotifications();
}
}
+
+ public void refreshTime() {
+ mKeyguardStatusView.refreshTime();
+ }
+
+ public void setStatusAccessibilityImportance(int mode) {
+ mKeyguardStatusView.setImportantForAccessibility(mode);
+ }
+
+ /**
+ * TODO: this should be removed.
+ * It's not correct to pass this view forward because other classes will end up adding
+ * children to it. Theme will be out of sync.
+ * @return bottom area view
+ */
+ public KeyguardBottomAreaView getKeyguardBottomAreaView() {
+ return mKeyguardBottomArea;
+ }
+
+ public void setUserSetupComplete(boolean userSetupComplete) {
+ mUserSetupComplete = userSetupComplete;
+ mKeyguardBottomArea.setUserSetupComplete(userSetupComplete);
+ }
+
+ public LockIcon getLockIcon() {
+ return mKeyguardBottomArea.getLockIcon();
+ }
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
index 8ce86ff..3418e07 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
@@ -49,6 +49,7 @@
import android.app.RemoteInput;
import android.app.StatusBarManager;
import android.app.TaskStackBuilder;
+import android.app.WallpaperManager;
import android.app.admin.DevicePolicyManager;
import android.content.BroadcastReceiver;
import android.content.ComponentCallbacks2;
@@ -57,6 +58,8 @@
import android.content.Intent;
import android.content.IntentFilter;
import android.content.IntentSender;
+import android.content.om.IOverlayManager;
+import android.content.om.OverlayInfo;
import android.content.pm.ApplicationInfo;
import android.content.pm.IPackageManager;
import android.content.pm.PackageManager;
@@ -150,7 +153,6 @@
import com.android.internal.util.NotificationMessagingUtil;
import com.android.internal.widget.LockPatternUtils;
import com.android.keyguard.KeyguardHostView.OnDismissAction;
-import com.android.keyguard.KeyguardStatusView;
import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.keyguard.KeyguardUpdateMonitorCallback;
import com.android.keyguard.ViewMediatorCallback;
@@ -243,6 +245,8 @@
import com.android.systemui.util.leak.LeakDetector;
import com.android.systemui.volume.VolumeComponent;
+import com.google.android.colorextraction.ColorExtractor;
+
import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.io.StringWriter;
@@ -262,7 +266,8 @@
OnHeadsUpChangedListener, VisualStabilityManager.Callback, CommandQueue.Callbacks,
ActivatableNotificationView.OnActivatedListener,
ExpandableNotificationRow.ExpansionLogger, NotificationData.Environment,
- ExpandableNotificationRow.OnExpandClickListener, InflationCallback {
+ ExpandableNotificationRow.OnExpandClickListener, InflationCallback,
+ ColorExtractor.OnColorsChangedListener {
public static final boolean MULTIUSER_DEBUG = false;
public static final boolean ENABLE_REMOTE_INPUT =
@@ -300,7 +305,7 @@
private static final String NOTIFICATION_UNLOCKED_BY_WORK_CHALLENGE_ACTION
= "com.android.systemui.statusbar.work_challenge_unlocked_notification_action";
public static final String TAG = "StatusBar";
- public static final boolean DEBUG = false;
+ public static final boolean DEBUG = true;
public static final boolean SPEW = false;
public static final boolean DUMPTRUCK = true; // extra dumpsys info
public static final boolean DEBUG_GESTURES = false;
@@ -426,6 +431,7 @@
Object mQueueLock = new Object();
protected StatusBarIconController mIconController;
+ private IconManager mIconManager;
// expanded notifications
protected NotificationPanelView mNotificationPanel; // the sliding/resizing panel within the notification window
@@ -444,8 +450,6 @@
// top bar
protected KeyguardStatusBarView mKeyguardStatusBar;
- KeyguardStatusView mKeyguardStatusView;
- KeyguardBottomAreaView mKeyguardBottomArea;
boolean mLeaveOpenOnKeyguardHide;
KeyguardIndicationController mKeyguardIndicationController;
@@ -512,8 +516,8 @@
mUserSetup = userSetup;
if (!mUserSetup && mStatusBarView != null)
animateCollapseQuickSettings();
- if (mKeyguardBottomArea != null) {
- mKeyguardBottomArea.setUserSetupComplete(mUserSetup);
+ if (mNotificationPanel != null) {
+ mNotificationPanel.setUserSetupComplete(mUserSetup);
}
updateQsExpansionEnabled();
}
@@ -722,6 +726,7 @@
private KeyguardMonitorImpl mKeyguardMonitor;
private BatteryController mBatteryController;
protected boolean mPanelExpanded;
+ private IOverlayManager mOverlayManager;
private boolean mKeyguardRequested;
private boolean mIsKeyguard;
private LogMaker mStatusBarStateLog;
@@ -732,6 +737,7 @@
private HashMap<String, Entry> mPendingNotifications = new HashMap<>();
private boolean mClearAllEnabled;
@Nullable private View mAmbientIndicationContainer;
+ private ColorExtractor mColorExtractor;
private void recycleAllVisibilityObjects(ArraySet<NotificationVisibility> array) {
final int N = array.size();
@@ -774,6 +780,11 @@
mAssistManager = Dependency.get(AssistManager.class);
mDeviceProvisionedController = Dependency.get(DeviceProvisionedController.class);
mSystemServicesProxy = SystemServicesProxy.getInstance(mContext);
+ mOverlayManager = IOverlayManager.Stub.asInterface(
+ ServiceManager.getService(Context.OVERLAY_SERVICE));
+
+ mColorExtractor = Dependency.get(ColorExtractor.class);
+ mColorExtractor.addOnColorsChangedListener(this);
mWindowManager = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
mDisplay = mWindowManager.getDefaultDisplay();
@@ -970,8 +981,16 @@
public void onDensityOrFontScaleChanged() {
StatusBar.this.onDensityOrFontScaleChanged();
}
+
+ @Override
+ public void onOverlayChanged() {
+ StatusBar.this.onOverlayChanged();
+ }
};
Dependency.get(ConfigurationController.class).addCallback(mConfigurationListener);
+
+ // Make sure that we're using the correct theme
+ onOverlayChanged();
}
protected void createIconController() {
@@ -1020,8 +1039,8 @@
.replace(R.id.status_bar_container, new CollapsedStatusBarFragment(),
CollapsedStatusBarFragment.TAG)
.commit();
- Dependency.get(StatusBarIconController.class).addIconGroup(
- new IconManager((ViewGroup) mKeyguardStatusBar.findViewById(R.id.statusIcons)));
+ mIconManager = new IconManager(mKeyguardStatusBar.findViewById(R.id.statusIcons));
+ Dependency.get(StatusBarIconController.class).addIconGroup(mIconManager);
mIconController = Dependency.get(StatusBarIconController.class);
mHeadsUpManager = new HeadsUpManager(context, mStatusBarWindow, mGroupManager);
@@ -1073,15 +1092,12 @@
mLockscreenWallpaper = new LockscreenWallpaper(mContext, this, mHandler);
}
- mKeyguardStatusView =
- (KeyguardStatusView) mStatusBarWindow.findViewById(R.id.keyguard_status_view);
- mKeyguardBottomArea =
- (KeyguardBottomAreaView) mStatusBarWindow.findViewById(R.id.keyguard_bottom_area);
mKeyguardIndicationController =
SystemUIFactory.getInstance().createKeyguardIndicationController(mContext,
(ViewGroup) mStatusBarWindow.findViewById(R.id.keyguard_indication_area),
- mKeyguardBottomArea.getLockIcon());
- mKeyguardBottomArea.setKeyguardIndicationController(mKeyguardIndicationController);
+ mNotificationPanel.getLockIcon());
+ mNotificationPanel.setKeyguardIndicationController(mKeyguardIndicationController);
+
mAmbientIndicationContainer = mStatusBarWindow.findViewById(
R.id.ambient_indication_container);
@@ -1134,8 +1150,7 @@
// Other icons
mVolumeComponent = getComponent(VolumeComponent.class);
- mKeyguardBottomArea.setStatusBar(this);
- mKeyguardBottomArea.setUserSetupComplete(mUserSetup);
+ mNotificationPanel.setUserSetupComplete(mUserSetup);
if (UserManager.get(mContext).isUserSwitcherEnabled()) {
createUserSwitcher();
}
@@ -1285,12 +1300,6 @@
if (mBrightnessMirrorController != null) {
mBrightnessMirrorController.onDensityOrFontScaleChanged();
}
- inflateSignalClusters();
- mNotificationIconAreaController.onDensityOrFontScaleChanged(mContext);
- inflateDismissView();
- updateClearAll();
- inflateEmptyShadeView();
- updateEmptyShadeView();
mStatusBarKeyguardViewManager.onDensityOrFontScaleChanged();
// TODO: Bring these out of StatusBar.
((UserInfoControllerImpl) Dependency.get(UserInfoController.class))
@@ -1299,6 +1308,44 @@
if (mKeyguardUserSwitcher != null) {
mKeyguardUserSwitcher.onDensityOrFontScaleChanged();
}
+ mNotificationIconAreaController.onDensityOrFontScaleChanged(mContext);
+
+ reevaluateStyles();
+ }
+
+ protected void onOverlayChanged() {
+ final boolean usingDarkTheme = isUsingDarkTheme();
+ if (DEBUG) {
+ Log.d(TAG, "Updating theme because overlay changed. Is theme dark? " + usingDarkTheme);
+ }
+ reevaluateStyles();
+
+ // Clock and bottom icons
+ mNotificationPanel.onOverlayChanged();
+
+ // Recreate Indication controller because internal references changed
+ // TODO: unregister callbacks before recreating
+ mKeyguardIndicationController =
+ SystemUIFactory.getInstance().createKeyguardIndicationController(mContext,
+ mStatusBarWindow.findViewById(R.id.keyguard_indication_area),
+ mNotificationPanel.getLockIcon());
+ mNotificationPanel.setKeyguardIndicationController(mKeyguardIndicationController);
+ mKeyguardIndicationController
+ .setStatusBarKeyguardViewManager(mStatusBarKeyguardViewManager);
+ mKeyguardIndicationController.setVisible(mState == StatusBarState.KEYGUARD);
+ mKeyguardIndicationController.setDozing(mDozing);
+
+ // Top status bar with system icons and clock
+ mKeyguardStatusBar.onOverlayChanged();
+ mIconManager.onOverlayChanged();
+ }
+
+ protected void reevaluateStyles() {
+ inflateSignalClusters();
+ inflateDismissView();
+ updateClearAll();
+ inflateEmptyShadeView();
+ updateEmptyShadeView();
}
private void updateNotificationsOnDensityOrFontScaleChanged() {
@@ -1347,20 +1394,20 @@
}
private void inflateEmptyShadeView() {
+ if (mStackScroller == null) {
+ return;
+ }
mEmptyShadeView = (EmptyShadeView) LayoutInflater.from(mContext).inflate(
R.layout.status_bar_no_notifications, mStackScroller, false);
mStackScroller.setEmptyShadeView(mEmptyShadeView);
}
private void inflateDismissView() {
- if (!mClearAllEnabled) {
+ if (!mClearAllEnabled || mStackScroller == null) {
return;
}
- // Always inflate with a dark theme, since this sits on the scrim.
- ContextThemeWrapper themedContext = new ContextThemeWrapper(mContext,
- style.Theme_DeviceDefault);
- mDismissView = (DismissView) LayoutInflater.from(themedContext).inflate(
+ mDismissView = (DismissView) LayoutInflater.from(mContext).inflate(
R.layout.status_bar_notification_dismiss_all, mStackScroller, false);
mDismissView.setOnButtonClickListener(new View.OnClickListener() {
@Override
@@ -1476,10 +1523,8 @@
mStatusBarKeyguardViewManager = keyguardViewMediator.registerStatusBar(this,
getBouncerContainer(), mScrimController,
mFingerprintUnlockController);
- mKeyguardIndicationController.setStatusBarKeyguardViewManager(
- mStatusBarKeyguardViewManager);
- mKeyguardIndicationController.setUserInfoController(
- Dependency.get(UserInfoController.class));
+ mKeyguardIndicationController
+ .setStatusBarKeyguardViewManager(mStatusBarKeyguardViewManager);
mFingerprintUnlockController.setStatusBarKeyguardViewManager(mStatusBarKeyguardViewManager);
mRemoteInputController.addCallback(mStatusBarKeyguardViewManager);
@@ -2589,7 +2634,7 @@
public void setQsExpanded(boolean expanded) {
mStatusBarWindowManager.setQsExpanded(expanded);
- mKeyguardStatusView.setImportantForAccessibility(expanded
+ mNotificationPanel.setStatusAccessibilityImportance(expanded
? View.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS
: View.IMPORTANT_FOR_ACCESSIBILITY_AUTO);
}
@@ -2783,8 +2828,20 @@
return mNotificationPanel.hideStatusBarIconsWhenExpanded();
}
- public KeyguardIndicationController getKeyguardIndicationController() {
- return mKeyguardIndicationController;
+ @Override
+ public void onColorsChanged(ColorExtractor.GradientColors colors, int which) {
+ updateTheme();
+ }
+
+ public boolean isUsingDarkTheme() {
+ OverlayInfo themeInfo = null;
+ try {
+ themeInfo = mOverlayManager.getOverlayInfo("com.android.systemui.theme.dark",
+ mCurrentUserId);
+ } catch (RemoteException e) {
+ e.printStackTrace();
+ }
+ return themeInfo != null && themeInfo.isEnabled();
}
@Nullable
@@ -4426,6 +4483,7 @@
mScrimController.setKeyguardShowing(false);
}
mNotificationPanel.setBarState(mState, mKeyguardFadingAway, goingToFullShade);
+ updateTheme();
updateDozingState();
updatePublicMode();
updateStackScrollerState(goingToFullShade, fromShadeLocked);
@@ -4438,6 +4496,35 @@
Trace.endSection();
}
+ /**
+ * Switches theme from light to dark and vice-versa.
+ */
+ private void updateTheme() {
+ boolean useDarkTheme;
+ if (mState == StatusBarState.KEYGUARD || mState == StatusBarState.SHADE_LOCKED) {
+ useDarkTheme = mColorExtractor.getColors(WallpaperManager.FLAG_LOCK)
+ .supportsDarkText();
+ } else {
+ useDarkTheme = mColorExtractor.getColors(WallpaperManager.FLAG_SYSTEM)
+ .supportsDarkText();
+ }
+
+ // Enable/Disable dark overlay
+ if (isUsingDarkTheme() != useDarkTheme) {
+ if (DEBUG) {
+ Log.d(TAG, "Switching theme to: " + (useDarkTheme ? "Dark" : "Light"));
+ }
+ try {
+ mOverlayManager.setEnabled("com.android.systemui.theme.dark",
+ useDarkTheme, mCurrentUserId);
+ } catch (RemoteException e) {
+ Log.w(TAG, "Can't change theme", e);
+ return;
+ }
+ mStatusBarWindowManager.setKeyguardDark(useDarkTheme);
+ }
+ }
+
private void updateDozingState() {
Trace.beginSection("StatusBar#updateDozingState");
boolean animate = !mDozing && mDozeServiceHost.shouldAnimateWakeup();
@@ -4585,6 +4672,7 @@
mStackScroller.setStatusBarState(state);
updateReportRejectedTouchVisibility();
updateDozing();
+ updateTheme();
mNotificationShelf.setStatusBarState(state);
}
@@ -4665,8 +4753,12 @@
return mNavigationBarView;
}
+ /**
+ * TODO: Remove this method. Views should not be passed forward. Will cause theme issues.
+ * @return bottom area view
+ */
public KeyguardBottomAreaView getKeyguardBottomAreaView() {
- return mKeyguardBottomArea;
+ return mNotificationPanel.getKeyguardBottomAreaView();
}
// ---------------------- DragDownHelper.OnDragDownListener ------------------------------------
@@ -5177,7 +5269,7 @@
@Override
public void dozeTimeTick() {
- mKeyguardStatusView.refreshTime();
+ mNotificationPanel.refreshTime();
}
@Override
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconController.java
index a3ef91d..64b21b4 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconController.java
@@ -14,7 +14,10 @@
package com.android.systemui.statusbar.phone;
+import android.annotation.ColorInt;
import android.content.Context;
+import android.content.res.TypedArray;
+import android.graphics.Color;
import android.support.annotation.VisibleForTesting;
import android.text.TextUtils;
import android.util.ArraySet;
@@ -26,6 +29,7 @@
import android.widget.LinearLayout.LayoutParams;
import com.android.internal.statusbar.StatusBarIcon;
+import com.android.settingslib.Utils;
import com.android.systemui.Dependency;
import com.android.systemui.R;
import com.android.systemui.statusbar.StatusBarIconView;
@@ -57,7 +61,6 @@
return ret;
}
-
/**
* Version of ViewGroup that observers state from the DarkIconDispatcher.
*/
@@ -165,6 +168,17 @@
}
}
+ protected void onOverlayChanged() {
+ @ColorInt int iconColor = Utils.getColorAttr(mContext, R.attr.bgProtectTextColor);
+ for (int i = 0; i < mGroup.getChildCount(); i++) {
+ View child = mGroup.getChildAt(i);
+ if (child instanceof StatusBarIconView) {
+ StatusBarIconView icon = (StatusBarIconView) child;
+ icon.setStaticDrawableColor(iconColor);
+ }
+ }
+ }
+
private void setHeightAndCenter(ImageView imageView, int height) {
ViewGroup.LayoutParams params = imageView.getLayoutParams();
params.height = height;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowManager.java
index 0326e40..93dc6de 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowManager.java
@@ -111,6 +111,18 @@
mLpChanged.copyFrom(mLp);
}
+ public void setKeyguardDark(boolean dark) {
+ int vis = mStatusBarView.getSystemUiVisibility();
+ if (dark) {
+ vis = vis | View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR;
+ vis = vis | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
+ } else {
+ vis = vis & ~View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR;
+ vis = vis & ~View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
+ }
+ mStatusBarView.setSystemUiVisibility(vis);
+ }
+
private void applyKeyguardFlags(State state) {
if (state.keyguardShowing) {
mLpChanged.privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_KEYGUARD;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/ConfigurationController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/ConfigurationController.java
index 788fda8..418c48e 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/ConfigurationController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/ConfigurationController.java
@@ -27,5 +27,6 @@
interface ConfigurationListener {
default void onConfigChanged(Configuration newConfig) {}
default void onDensityOrFontScaleChanged() {}
+ default void onOverlayChanged() {}
}
}
diff --git a/packages/SysuiDarkThemeOverlay/Android.mk b/packages/SysuiDarkThemeOverlay/Android.mk
new file mode 100644
index 0000000..4b83058
--- /dev/null
+++ b/packages/SysuiDarkThemeOverlay/Android.mk
@@ -0,0 +1,13 @@
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_RRO_THEME := SysuiDarkTheme
+LOCAL_CERTIFICATE := platform
+
+LOCAL_SRC_FILES := $(call all-subdir-java-files)
+
+LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
+
+LOCAL_PACKAGE_NAME := SysuiDarkThemeOverlay
+
+include $(BUILD_RRO_PACKAGE)
diff --git a/packages/SysuiDarkThemeOverlay/AndroidManifest.xml b/packages/SysuiDarkThemeOverlay/AndroidManifest.xml
new file mode 100644
index 0000000..ba1c91c
--- /dev/null
+++ b/packages/SysuiDarkThemeOverlay/AndroidManifest.xml
@@ -0,0 +1,8 @@
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.android.systemui.theme.dark"
+ android:versionCode="1"
+ android:versionName="1.0">
+ <overlay android:targetPackage="android" android:priority="1"/>
+
+ <application android:label="@string/sysui_overlay_dark" android:hasCode="false"/>
+</manifest>
diff --git a/packages/SysuiDarkThemeOverlay/res/values/strings.xml b/packages/SysuiDarkThemeOverlay/res/values/strings.xml
new file mode 100644
index 0000000..71f48d6
--- /dev/null
+++ b/packages/SysuiDarkThemeOverlay/res/values/strings.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/**
+ * 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.
+ */
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+
+ <string name="sysui_overlay_dark">Dark</string>
+
+</resources>
+
diff --git a/packages/SysuiDarkThemeOverlay/res/values/themes_device_defaults.xml b/packages/SysuiDarkThemeOverlay/res/values/themes_device_defaults.xml
new file mode 100644
index 0000000..28ecfa0
--- /dev/null
+++ b/packages/SysuiDarkThemeOverlay/res/values/themes_device_defaults.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <!-- Dark theme for a window that should look like the Settings app. -->
+ <style name="Theme.DeviceDefault.QuickSettings" parent="android:Theme.DeviceDefault">
+ <!-- Color palette -->
+ <item name="android:colorPrimary">@*android:color/primary_device_default_settings</item>
+ <item name="android:colorPrimaryDark">@*android:color/primary_dark_device_default_settings</item>
+ <item name="android:textColorPrimaryInverse">@*android:color/primary_text_material_light</item>
+ <item name="android:textColorSecondaryInverse">@*android:color/secondary_text_material_light</item>
+ <item name="android:colorSecondary">@*android:color/secondary_device_default_settings</item>
+ <item name="android:colorAccent">@*android:color/accent_device_default_dark</item>
+ <item name="android:colorControlNormal">?android:attr/textColorPrimary</item>
+ <item name="android:colorBackgroundFloating">#000</item>
+ </style>
+</resources>
\ No newline at end of file