summaryrefslogtreecommitdiffstats
path: root/packages/SystemUI
diff options
context:
space:
mode:
Diffstat (limited to 'packages/SystemUI')
-rw-r--r--packages/SystemUI/res/anim/recents_launch_next_affiliated_task_bounce.xml59
-rw-r--r--packages/SystemUI/res/anim/recents_launch_next_affiliated_task_source.xml34
-rw-r--r--packages/SystemUI/res/anim/recents_launch_next_affiliated_task_target.xml28
-rw-r--r--packages/SystemUI/res/anim/recents_launch_prev_affiliated_task_bounce.xml33
-rw-r--r--packages/SystemUI/res/anim/recents_launch_prev_affiliated_task_source.xml27
-rw-r--r--packages/SystemUI/res/anim/recents_launch_prev_affiliated_task_target.xml36
-rw-r--r--packages/SystemUI/res/drawable/recents_button_bg.xml3
-rw-r--r--packages/SystemUI/res/drawable/stat_sys_vpn_ic.xml24
-rw-r--r--packages/SystemUI/res/layout/notification_public_default.xml77
-rw-r--r--packages/SystemUI/res/layout/recents_empty.xml2
-rw-r--r--packages/SystemUI/res/layout/signal_cluster_view.xml13
-rw-r--r--packages/SystemUI/res/layout/status_bar_notification_row.xml7
-rw-r--r--packages/SystemUI/res/values-sw600dp/config.xml6
-rw-r--r--packages/SystemUI/res/values-sw720dp/config.xml5
-rw-r--r--packages/SystemUI/res/values/config.xml11
-rw-r--r--packages/SystemUI/res/values/dimens.xml8
-rw-r--r--packages/SystemUI/res/values/strings.xml17
-rw-r--r--packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java3
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/QSDualTileLabel.java13
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/QSTile.java6
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/QSTileView.java2
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/SignalTileView.java13
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java10
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java3
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java27
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java25
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java12
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java52
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java8
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java235
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java30
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java1
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java55
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/StackScrollerDecorView.java1
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/ActivityStarter.java2
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java9
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/MultiUserSwitch.java15
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarViewTaskSwitchHelper.java9
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java57
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java31
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java10
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeaderView.java7
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java4
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpNotificationView.java10
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java8
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java3
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java69
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/policy/PreviewInflater.java15
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/policy/SecurityControllerImpl.java4
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/policy/TelephonyIcons.java11
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java39
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java11
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java10
-rw-r--r--packages/SystemUI/src/com/android/systemui/volume/VolumePanel.java6
-rw-r--r--packages/SystemUI/src/com/android/systemui/volume/VolumeUI.java3
-rw-r--r--packages/SystemUI/src/com/android/systemui/volume/ZenModePanel.java38
56 files changed, 967 insertions, 290 deletions
diff --git a/packages/SystemUI/res/anim/recents_launch_next_affiliated_task_bounce.xml b/packages/SystemUI/res/anim/recents_launch_next_affiliated_task_bounce.xml
new file mode 100644
index 0000000..a571cbc
--- /dev/null
+++ b/packages/SystemUI/res/anim/recents_launch_next_affiliated_task_bounce.xml
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 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.
+*/
+-->
+
+<set xmlns:android="http://schemas.android.com/apk/res/android"
+ android:background="#ff000000" android:shareInterpolator="false" android:zAdjustment="normal">
+
+ <alpha android:fromAlpha="1.0" android:toAlpha="0.6"
+ android:fillEnabled="true" android:fillBefore="true" android:fillAfter="true"
+ android:interpolator="@android:interpolator/accelerate_cubic"
+ android:duration="133"/>
+
+ <translate android:fromYDelta="0" android:toYDelta="10%"
+ android:fillEnabled="true" android:fillBefore="true" android:fillAfter="true"
+ android:interpolator="@android:interpolator/accelerate_cubic"
+ android:duration="350"/>
+
+ <scale android:fromXScale="1.0" android:toXScale="0.9"
+ android:fromYScale="1.0" android:toYScale="0.9"
+ android:fillEnabled="true" android:fillBefore="true" android:fillAfter="true"
+ android:pivotX="50%p" android:pivotY="50%p"
+ android:interpolator="@android:interpolator/fast_out_slow_in"
+ android:duration="350" />
+
+ <alpha android:fromAlpha="1.0" android:toAlpha="1.6666666666"
+ android:fillEnabled="true" android:fillBefore="false" android:fillAfter="true"
+ android:interpolator="@android:interpolator/decelerate_cubic"
+ android:startOffset="350"
+ android:duration="133"/>
+
+ <translate android:fromYDelta="0%" android:toYDelta="-8.8888888888%"
+ android:fillEnabled="true" android:fillBefore="false" android:fillAfter="true"
+ android:interpolator="@android:interpolator/decelerate_cubic"
+ android:startOffset="350"
+ android:duration="350"/>
+
+ <scale android:fromXScale="1.0" android:toXScale="1.1111111111"
+ android:fromYScale="1.0" android:toYScale="1.1111111111"
+ android:fillEnabled="true" android:fillBefore="false" android:fillAfter="true"
+ android:pivotX="50%p" android:pivotY="50%p"
+ android:interpolator="@android:interpolator/decelerate_cubic"
+ android:startOffset="350"
+ android:duration="350" />
+</set> \ No newline at end of file
diff --git a/packages/SystemUI/res/anim/recents_launch_next_affiliated_task_source.xml b/packages/SystemUI/res/anim/recents_launch_next_affiliated_task_source.xml
new file mode 100644
index 0000000..f0fd684
--- /dev/null
+++ b/packages/SystemUI/res/anim/recents_launch_next_affiliated_task_source.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 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.
+*/
+-->
+
+<set xmlns:android="http://schemas.android.com/apk/res/android"
+ android:background="#ff000000" android:shareInterpolator="false" android:zAdjustment="normal">
+
+ <alpha android:fromAlpha="1.0" android:toAlpha="0.6"
+ android:fillEnabled="true" android:fillBefore="true" android:fillAfter="true"
+ android:interpolator="@android:interpolator/accelerate_cubic"
+ android:duration="150"/>
+
+ <scale android:fromXScale="1.0" android:toXScale="0.9"
+ android:fromYScale="1.0" android:toYScale="0.9"
+ android:fillEnabled="true" android:fillBefore="true" android:fillAfter="true"
+ android:pivotX="50%p" android:pivotY="50%p"
+ android:interpolator="@android:interpolator/fast_out_slow_in"
+ android:duration="300" />
+</set> \ No newline at end of file
diff --git a/packages/SystemUI/res/anim/recents_launch_next_affiliated_task_target.xml b/packages/SystemUI/res/anim/recents_launch_next_affiliated_task_target.xml
new file mode 100644
index 0000000..170ac82
--- /dev/null
+++ b/packages/SystemUI/res/anim/recents_launch_next_affiliated_task_target.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 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.
+*/
+-->
+
+<set xmlns:android="http://schemas.android.com/apk/res/android"
+ android:background="#ff000000" android:shareInterpolator="false" android:zAdjustment="top">
+
+ <translate android:fromYDelta="110%" android:toYDelta="0%"
+ android:fillEnabled="true" android:fillBefore="true" android:fillAfter="true"
+ android:interpolator="@android:interpolator/decelerate_quint"
+ android:startOffset="50"
+ android:duration="250" />
+</set> \ No newline at end of file
diff --git a/packages/SystemUI/res/anim/recents_launch_prev_affiliated_task_bounce.xml b/packages/SystemUI/res/anim/recents_launch_prev_affiliated_task_bounce.xml
new file mode 100644
index 0000000..46045ac
--- /dev/null
+++ b/packages/SystemUI/res/anim/recents_launch_prev_affiliated_task_bounce.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 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.
+*/
+-->
+
+<set xmlns:android="http://schemas.android.com/apk/res/android"
+ android:background="#ff000000" android:shareInterpolator="false" android:zAdjustment="top">
+
+ <translate android:fromYDelta="0%" android:toYDelta="10%"
+ android:fillEnabled="true" android:fillBefore="true" android:fillAfter="true"
+ android:interpolator="@android:interpolator/decelerate_quint"
+ android:duration="300" />
+
+ <translate android:fromYDelta="10%" android:toYDelta="0%"
+ android:fillEnabled="true" android:fillBefore="false" android:fillAfter="true"
+ android:interpolator="@android:interpolator/accelerate_quint"
+ android:startOffset="300"
+ android:duration="300" />
+</set> \ No newline at end of file
diff --git a/packages/SystemUI/res/anim/recents_launch_prev_affiliated_task_source.xml b/packages/SystemUI/res/anim/recents_launch_prev_affiliated_task_source.xml
new file mode 100644
index 0000000..ad5341b
--- /dev/null
+++ b/packages/SystemUI/res/anim/recents_launch_prev_affiliated_task_source.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 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.
+*/
+-->
+
+<set xmlns:android="http://schemas.android.com/apk/res/android"
+ android:background="#ff000000" android:shareInterpolator="false" android:zAdjustment="top">
+
+ <translate android:fromYDelta="0%" android:toYDelta="110%"
+ android:fillEnabled="true" android:fillBefore="true" android:fillAfter="true"
+ android:interpolator="@android:interpolator/accelerate_quint"
+ android:duration="300" />
+</set> \ No newline at end of file
diff --git a/packages/SystemUI/res/anim/recents_launch_prev_affiliated_task_target.xml b/packages/SystemUI/res/anim/recents_launch_prev_affiliated_task_target.xml
new file mode 100644
index 0000000..7687f02
--- /dev/null
+++ b/packages/SystemUI/res/anim/recents_launch_prev_affiliated_task_target.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 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.
+*/
+-->
+
+<set xmlns:android="http://schemas.android.com/apk/res/android"
+ android:background="#ff000000" android:shareInterpolator="false" android:zAdjustment="normal">
+
+ <alpha android:fromAlpha="0.6" android:toAlpha="1.0"
+ android:fillEnabled="true" android:fillBefore="true" android:fillAfter="true"
+ android:interpolator="@android:interpolator/decelerate_cubic"
+ android:startOffset="75"
+ android:duration="150"/>
+
+ <scale android:fromXScale="0.9" android:toXScale="1.0"
+ android:fromYScale="0.9" android:toYScale="1.0"
+ android:fillEnabled="true" android:fillBefore="true" android:fillAfter="true"
+ android:interpolator="@android:interpolator/linear_out_slow_in"
+ android:pivotX="50%p" android:pivotY="50%p"
+ android:startOffset="75"
+ android:duration="225" />
+</set> \ No newline at end of file
diff --git a/packages/SystemUI/res/drawable/recents_button_bg.xml b/packages/SystemUI/res/drawable/recents_button_bg.xml
index a4cb088..7456365 100644
--- a/packages/SystemUI/res/drawable/recents_button_bg.xml
+++ b/packages/SystemUI/res/drawable/recents_button_bg.xml
@@ -15,4 +15,5 @@
-->
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
- android:color="?android:attr/colorControlHighlight" /> \ No newline at end of file
+ android:color="#40ffffff">
+</ripple>
diff --git a/packages/SystemUI/res/drawable/stat_sys_vpn_ic.xml b/packages/SystemUI/res/drawable/stat_sys_vpn_ic.xml
new file mode 100644
index 0000000..7ca8c40
--- /dev/null
+++ b/packages/SystemUI/res/drawable/stat_sys_vpn_ic.xml
@@ -0,0 +1,24 @@
+<!--
+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="17.0dp"
+ android:height="17.0dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0">
+ <path
+ android:fillColor="#FFFFFFFF"
+ android:pathData="M12.700000,10.000000c-0.800000,-2.300000 -3.000000,-4.000000 -5.700000,-4.000000c-3.300000,0.000000 -6.000000,2.700000 -6.000000,6.000000s2.700000,6.000000 6.000000,6.000000c2.600000,0.000000 4.800000,-1.700000 5.700000,-4.000000L17.000000,14.000000l0.000000,4.000000l4.000000,0.000000l0.000000,-4.000000l2.000000,0.000000l0.000000,-4.000000L12.700000,10.000000zM7.000000,14.000000c-1.100000,0.000000 -2.000000,-0.900000 -2.000000,-2.000000c0.000000,-1.100000 0.900000,-2.000000 2.000000,-2.000000s2.000000,0.900000 2.000000,2.000000C9.000000,13.100000 8.100000,14.000000 7.000000,14.000000z"/>
+</vector>
diff --git a/packages/SystemUI/res/layout/notification_public_default.xml b/packages/SystemUI/res/layout/notification_public_default.xml
new file mode 100644
index 0000000..acfc4bb
--- /dev/null
+++ b/packages/SystemUI/res/layout/notification_public_default.xml
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ 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
+ -->
+
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:internal="http://schemas.android.com/apk/prv/res/android"
+ android:id="@+id/status_bar_latest_event_content"
+ android:layout_width="match_parent"
+ android:layout_height="64dp"
+ internal:layout_minHeight="64dp"
+ internal:layout_maxHeight="64dp"
+ >
+ <ImageView android:id="@+id/icon"
+ android:layout_width="40dp"
+ android:layout_height="40dp"
+ android:layout_marginTop="12dp"
+ android:layout_marginStart="12dp"
+ android:layout_marginEnd="12dp"
+ android:scaleType="centerInside"
+ />
+ <DateTimeView android:id="@+id/time"
+ android:textAppearance="@android:style/TextAppearance.Material.Notification.Time"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginEnd="8dp"
+ android:layout_alignParentEnd="true"
+ android:layout_alignBaseline="@id/title"
+ android:singleLine="true"
+ android:gravity="center"
+ android:paddingStart="8dp"
+ android:visibility="gone"
+ />
+ <TextView android:id="@+id/title"
+ android:textAppearance="@android:style/TextAppearance.Material.Notification.Title"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_toEndOf="@id/icon"
+ android:layout_toStartOf="@id/time"
+ android:singleLine="true"
+ android:ellipsize="marquee"
+ android:fadingEdge="horizontal"
+ />
+ <ImageView android:id="@+id/profile_badge_line3"
+ android:layout_width="@*android:dimen/notification_badge_size"
+ android:layout_height="@*android:dimen/notification_badge_size"
+ android:layout_below="@id/title"
+ android:layout_marginStart="4dp"
+ android:layout_marginEnd="8dp"
+ android:layout_alignParentEnd="true"
+ android:scaleType="fitCenter"
+ android:visibility="gone"
+ />
+ <TextView android:id="@+id/text"
+ android:textAppearance="@android:style/TextAppearance.Material.Notification"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_alignStart="@id/title"
+ android:layout_below="@id/title"
+ android:layout_toStartOf="@id/profile_badge_line3"
+ android:singleLine="true"
+ android:ellipsize="marquee"
+ android:fadingEdge="horizontal"
+ />
+</RelativeLayout>
diff --git a/packages/SystemUI/res/layout/recents_empty.xml b/packages/SystemUI/res/layout/recents_empty.xml
index 1ef9cad..4b68e77 100644
--- a/packages/SystemUI/res/layout/recents_empty.xml
+++ b/packages/SystemUI/res/layout/recents_empty.xml
@@ -23,6 +23,6 @@
android:textSize="16sp"
android:textColor="#ffffffff"
android:text="@string/recents_empty_message"
- android:fontFamily="sans-serif-light"
+ android:fontFamily="sans-serif"
android:background="#80000000"
android:visibility="gone" /> \ No newline at end of file
diff --git a/packages/SystemUI/res/layout/signal_cluster_view.xml b/packages/SystemUI/res/layout/signal_cluster_view.xml
index 347c8a9..5889c55 100644
--- a/packages/SystemUI/res/layout/signal_cluster_view.xml
+++ b/packages/SystemUI/res/layout/signal_cluster_view.xml
@@ -25,6 +25,13 @@
android:gravity="center_vertical"
android:orientation="horizontal"
>
+ <ImageView
+ android:id="@+id/vpn"
+ android:layout_height="wrap_content"
+ android:layout_width="wrap_content"
+ android:paddingEnd="6dp"
+ android:src="@drawable/stat_sys_vpn_ic"
+ />
<FrameLayout
android:id="@+id/wifi_combo"
android:layout_height="wrap_content"
@@ -36,6 +43,12 @@
android:layout_width="wrap_content"
/>
</FrameLayout>
+ <View
+ android:id="@+id/wifi_signal_spacer"
+ android:layout_width="4dp"
+ android:layout_height="4dp"
+ android:visibility="gone"
+ />
<FrameLayout
android:layout_height="wrap_content"
android:layout_width="wrap_content"
diff --git a/packages/SystemUI/res/layout/status_bar_notification_row.xml b/packages/SystemUI/res/layout/status_bar_notification_row.xml
index 6b829e5..e9d86d6 100644
--- a/packages/SystemUI/res/layout/status_bar_notification_row.xml
+++ b/packages/SystemUI/res/layout/status_bar_notification_row.xml
@@ -52,9 +52,10 @@
android:paddingStart="8dp"
/>
- <include
- layout="@layout/notification_guts"
- android:id="@+id/notification_guts"
+ <ViewStub
+ android:layout="@layout/notification_guts"
+ android:id="@+id/notification_guts_stub"
+ android:inflatedId="@+id/notification_guts"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
diff --git a/packages/SystemUI/res/values-sw600dp/config.xml b/packages/SystemUI/res/values-sw600dp/config.xml
index 5aafb66..83477c0 100644
--- a/packages/SystemUI/res/values-sw600dp/config.xml
+++ b/packages/SystemUI/res/values-sw600dp/config.xml
@@ -33,6 +33,8 @@
<!-- Set to true to enable the user switcher on the keyguard. -->
<bool name="config_keyguardUserSwitcher">true</bool>
- <!-- Transposes the recents layout in landscape. -->
- <bool name="recents_transpose_layout_with_orientation">false</bool>
+ <!-- Transposes the search bar layout in landscape. -->
+ <bool name="recents_has_transposed_search_bar">true</bool>
+ <!-- Transposes the nav bar in landscape (only used for purposes of layout). -->
+ <bool name="recents_has_transposed_nav_bar">false</bool>
</resources>
diff --git a/packages/SystemUI/res/values-sw720dp/config.xml b/packages/SystemUI/res/values-sw720dp/config.xml
index d8bb8d7d..fbeadcd 100644
--- a/packages/SystemUI/res/values-sw720dp/config.xml
+++ b/packages/SystemUI/res/values-sw720dp/config.xml
@@ -39,5 +39,10 @@
<!-- The maximum count of notifications on Keyguard. The rest will be collapsed in an overflow
card. -->
<integer name="keyguard_max_notification_count">5</integer>
+
+ <!-- Transposes the search bar layout in landscape. -->
+ <bool name="recents_has_transposed_search_bar">false</bool>
+ <!-- Transposes the nav bar in landscape (only used for purposes of layout). -->
+ <bool name="recents_has_transposed_nav_bar">false</bool>
</resources>
diff --git a/packages/SystemUI/res/values/config.xml b/packages/SystemUI/res/values/config.xml
index 0e18979..5a1c318 100644
--- a/packages/SystemUI/res/values/config.xml
+++ b/packages/SystemUI/res/values/config.xml
@@ -134,10 +134,13 @@
<integer name="recents_animate_task_exit_to_home_duration">225</integer>
<!-- The min animation duration for animating the task bar out. -->
<integer name="recents_animate_task_bar_exit_duration">125</integer>
+ <!-- The animation delay for animating the first task in. This should roughly be the animation
+ duration of the transition in to recents from home. -->
+ <integer name="recents_animate_task_enter_from_home_delay">150</integer>
<!-- The min animation duration for animating the task in when transitioning from home. -->
<integer name="recents_animate_task_enter_from_home_duration">275</integer>
<!-- The animation stagger to apply to each task animation when transitioning from home. -->
- <integer name="recents_animate_task_enter_from_home_delay">10</integer>
+ <integer name="recents_animate_task_enter_from_home_stagger_delay">10</integer>
<!-- The short duration when animating in/out the lock to app button. -->
<integer name="recents_animate_lock_to_app_button_short_duration">150</integer>
<!-- The long duration when animating in/out the lock to app button. -->
@@ -152,8 +155,10 @@
<integer name="recents_max_task_stack_view_dim">96</integer>
<!-- The delay to enforce between each alt-tab key press. -->
<integer name="recents_alt_tab_key_delay">200</integer>
- <!-- Transposes the recents layout in landscape. -->
- <bool name="recents_transpose_layout_with_orientation">true</bool>
+ <!-- Transposes the search bar layout in landscape. -->
+ <bool name="recents_has_transposed_search_bar">true</bool>
+ <!-- Transposes the nav bar in landscape (only used for purposes of layout). -->
+ <bool name="recents_has_transposed_nav_bar">true</bool>
<!-- Whether to enable KeyguardService or not -->
<bool name="config_enableKeyguardService">true</bool>
diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml
index 8cd4ce6..4495318 100644
--- a/packages/SystemUI/res/values/dimens.xml
+++ b/packages/SystemUI/res/values/dimens.xml
@@ -476,4 +476,12 @@
<fraction name="battery_subpixel_smoothing_right">0%</fraction>
<dimen name="battery_margin_bottom">0dp</dimen>
+
+ <!-- Extra padding between the mobile data type icon and the strength indicator when the data
+ type icon is wide. -->
+ <dimen name="wide_type_icon_start_padding">2dp</dimen>
+
+ <!-- Extra padding between the mobile data type icon and the strength indicator when the data
+ type icon is wide for the tile in quick settings. -->
+ <dimen name="wide_type_icon_start_padding_qs">3dp</dimen>
</resources>
diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml
index 23d9748..0445fe8 100644
--- a/packages/SystemUI/res/values/strings.xml
+++ b/packages/SystemUI/res/values/strings.xml
@@ -736,9 +736,6 @@
<!-- Shows when people have clicked at the right edge of the screen to explain how to open the phone. In right-to-left languages, this is the opposite direction. [CHAR LIMIT=60] -->
<string name="camera_hint">Swipe left for camera</string>
- <!-- Zen mode condition: no exit criteria. [CHAR LIMIT=NONE] -->
- <string name="zen_mode_forever">Indefinitely</string>
-
<!-- Interruption level: None. [CHAR LIMIT=20] -->
<string name="interruption_level_none">None</string>
@@ -798,18 +795,12 @@
<!-- Notification when resuming an existing guest session: Action that continues with the current session [CHAR LIMIT=35] -->
<string name="guest_wipe_session_dontwipe">Yes, continue</string>
+ <!-- Title for add user confirmation dialog [CHAR LIMIT=30] -->
+ <string name="user_add_user_title" msgid="2108112641783146007">Add new user?</string>
- <!-- Zen mode condition: time duration in minutes. [CHAR LIMIT=NONE] -->
- <plurals name="zen_mode_duration_minutes">
- <item quantity="one">For one minute</item>
- <item quantity="other">For %d minutes</item>
- </plurals>
+ <!-- Message for add user confirmation dialog - short version. [CHAR LIMIT=none] -->
+ <string name="user_add_user_message_short" msgid="1511354412249044381">When you add a new user, that person needs to set up their space.\n\nAny user can update apps for all other users. </string>
- <!-- Zen mode condition: time duration in hours. [CHAR LIMIT=NONE] -->
- <plurals name="zen_mode_duration_hours">
- <item quantity="one">For one hour</item>
- <item quantity="other">For %d hours</item>
- </plurals>
<!-- Battery saver notification title. [CHAR LIMIT=60]-->
<string name="battery_saver_notification_title">Battery saver is on</string>
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
index 8d35eb0..50ba68e 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
@@ -17,6 +17,7 @@
package com.android.systemui.keyguard;
import android.app.Activity;
+import android.app.ActivityManager;
import android.app.ActivityManagerNative;
import android.app.AlarmManager;
import android.app.PendingIntent;
@@ -487,7 +488,7 @@ public class KeyguardViewMediator extends SystemUI {
mUpdateMonitor = KeyguardUpdateMonitor.getInstance(mContext);
mLockPatternUtils = new LockPatternUtils(mContext);
- mLockPatternUtils.setCurrentUser(UserHandle.USER_OWNER);
+ mLockPatternUtils.setCurrentUser(ActivityManager.getCurrentUser());
// Assume keyguard is showing (unless it's disabled) until we know for sure...
mShowing = (mUpdateMonitor.isDeviceProvisioned() || mLockPatternUtils.isSecure())
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSDualTileLabel.java b/packages/SystemUI/src/com/android/systemui/qs/QSDualTileLabel.java
index 377fcc0..a9fdc86 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QSDualTileLabel.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSDualTileLabel.java
@@ -23,7 +23,6 @@ import android.text.TextUtils;
import android.text.TextUtils.TruncateAt;
import android.view.Gravity;
import android.view.View;
-import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
@@ -41,7 +40,7 @@ import java.util.Objects;
* truncate.
* Second line: ellipsis if necessary
*/
-public class QSDualTileLabel extends FrameLayout {
+public class QSDualTileLabel extends LinearLayout {
private final Context mContext;
private final TextView mFirstLine;
@@ -54,12 +53,13 @@ public class QSDualTileLabel extends FrameLayout {
public QSDualTileLabel(Context context) {
super(context);
mContext = context;
+ setOrientation(LinearLayout.VERTICAL);
mHorizontalPaddingPx = mContext.getResources()
.getDimensionPixelSize(R.dimen.qs_dual_tile_padding_horizontal);
mFirstLine = initTextView();
- mFirstLine.setPadding(mHorizontalPaddingPx, 0, 0, 0);
+ mFirstLine.setPadding(mHorizontalPaddingPx, 0, mHorizontalPaddingPx, 0);
final LinearLayout firstLineLayout = new LinearLayout(mContext);
firstLineLayout.setPadding(0, 0, 0, 0);
firstLineLayout.setOrientation(LinearLayout.HORIZONTAL);
@@ -70,13 +70,13 @@ public class QSDualTileLabel extends FrameLayout {
mFirstLineCaret.setScaleType(ImageView.ScaleType.MATRIX);
mFirstLineCaret.setClickable(false);
firstLineLayout.addView(mFirstLineCaret);
- addView(firstLineLayout, newFrameLayoutParams());
+ addView(firstLineLayout, newLinearLayoutParams());
mSecondLine = initTextView();
mSecondLine.setPadding(mHorizontalPaddingPx, 0, mHorizontalPaddingPx, 0);
mSecondLine.setEllipsize(TruncateAt.END);
mSecondLine.setVisibility(GONE);
- addView(mSecondLine, newFrameLayoutParams());
+ addView(mSecondLine, newLinearLayoutParams());
addOnLayoutChangeListener(new OnLayoutChangeListener() {
@Override
@@ -89,7 +89,7 @@ public class QSDualTileLabel extends FrameLayout {
});
}
- private static LayoutParams newFrameLayoutParams() {
+ private static LayoutParams newLinearLayoutParams() {
final LayoutParams lp =
new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
lp.gravity = Gravity.CENTER_HORIZONTAL;
@@ -104,6 +104,7 @@ public class QSDualTileLabel extends FrameLayout {
lp.topMargin = h * 4 / 5;
mSecondLine.setLayoutParams(lp);
mFirstLine.setMinHeight(h);
+ mFirstLine.setPadding(mHorizontalPaddingPx, 0, 0, 0);
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSTile.java b/packages/SystemUI/src/com/android/systemui/qs/QSTile.java
index 2b071cc..cb685fe 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QSTile.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSTile.java
@@ -373,6 +373,7 @@ public abstract class QSTile<TState extends State> implements Listenable {
public boolean activityOut;
public int overlayIconId;
public boolean filter;
+ public boolean isOverlayIconWide;
@Override
public boolean copyTo(State other) {
@@ -380,13 +381,15 @@ public abstract class QSTile<TState extends State> implements Listenable {
final boolean changed = o.enabled != enabled
|| o.connected != connected || o.activityIn != activityIn
|| o.activityOut != activityOut
- || o.overlayIconId != overlayIconId;
+ || o.overlayIconId != overlayIconId
+ || o.isOverlayIconWide != isOverlayIconWide;
o.enabled = enabled;
o.connected = connected;
o.activityIn = activityIn;
o.activityOut = activityOut;
o.overlayIconId = overlayIconId;
o.filter = filter;
+ o.isOverlayIconWide = isOverlayIconWide;
return super.copyTo(other) || changed;
}
@@ -399,6 +402,7 @@ public abstract class QSTile<TState extends State> implements Listenable {
rt.insert(rt.length() - 1, ",activityOut=" + activityOut);
rt.insert(rt.length() - 1, ",overlayIconId=" + overlayIconId);
rt.insert(rt.length() - 1, ",filter=" + filter);
+ rt.insert(rt.length() - 1, ",wideOverlayIcon=" + isOverlayIconWide);
return rt;
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSTileView.java b/packages/SystemUI/src/com/android/systemui/qs/QSTileView.java
index e6175d2..8d7edb9 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QSTileView.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSTileView.java
@@ -230,7 +230,7 @@ public class QSTileView extends ViewGroup {
final int w = MeasureSpec.getSize(widthMeasureSpec);
final int h = MeasureSpec.getSize(heightMeasureSpec);
final int iconSpec = exactly(mIconSizePx);
- mIcon.measure(iconSpec, iconSpec);
+ mIcon.measure(MeasureSpec.makeMeasureSpec(w, MeasureSpec.AT_MOST), iconSpec);
labelView().measure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(h, MeasureSpec.AT_MOST));
if (mDual) {
mDivider.measure(widthMeasureSpec, exactly(mDivider.getLayoutParams().height));
diff --git a/packages/SystemUI/src/com/android/systemui/qs/SignalTileView.java b/packages/SystemUI/src/com/android/systemui/qs/SignalTileView.java
index 0ecdeaa..cfcd74e 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/SignalTileView.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/SignalTileView.java
@@ -37,11 +37,16 @@ public final class SignalTileView extends QSTileView {
private ImageView mIn;
private ImageView mOut;
+ private int mWideOverlayIconStartPadding;
+
public SignalTileView(Context context) {
super(context);
mIn = addTrafficView(R.drawable.ic_qs_signal_in);
mOut = addTrafficView(R.drawable.ic_qs_signal_out);
+
+ mWideOverlayIconStartPadding = context.getResources().getDimensionPixelSize(
+ R.dimen.wide_type_icon_start_padding_qs);
}
private ImageView addTrafficView(int icon) {
@@ -106,6 +111,11 @@ public final class SignalTileView extends QSTileView {
} else {
mOverlay.setVisibility(GONE);
}
+ if (s.overlayIconId > 0 && s.isOverlayIconWide) {
+ mSignal.setPaddingRelative(mWideOverlayIconStartPadding, 0, 0, 0);
+ } else {
+ mSignal.setPaddingRelative(0, 0, 0, 0);
+ }
Drawable drawable = mSignal.getDrawable();
if (state.autoMirrorDrawable && drawable != null) {
drawable.setAutoMirrored(true);
@@ -122,10 +132,9 @@ public final class SignalTileView extends QSTileView {
view.animate()
.setDuration(visible ? SHORT_DURATION : DEFAULT_DURATION)
.alpha(newAlpha)
- .withLayer()
.start();
} else {
view.setAlpha(newAlpha);
}
}
-} \ No newline at end of file
+}
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java
index 8743207..359a259 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java
@@ -23,10 +23,8 @@ import android.content.res.Resources;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
-import android.widget.TextView;
import com.android.systemui.R;
-import com.android.systemui.qs.DataUsageGraph;
import com.android.systemui.qs.QSTile;
import com.android.systemui.qs.QSTileView;
import com.android.systemui.qs.SignalTileView;
@@ -34,8 +32,6 @@ import com.android.systemui.statusbar.policy.NetworkController;
import com.android.systemui.statusbar.policy.NetworkController.DataUsageInfo;
import com.android.systemui.statusbar.policy.NetworkController.NetworkSignalChangedCallback;
-import java.text.DecimalFormat;
-
/** Quick settings tile: Cellular **/
public class CellularTile extends QSTile<QSTile.SignalState> {
private static final Intent CELLULAR_SETTINGS = new Intent().setComponent(new ComponentName(
@@ -95,6 +91,7 @@ public class CellularTile extends QSTile<QSTile.SignalState> {
: !cb.enabled || cb.airplaneModeEnabled ? R.drawable.ic_qs_signal_disabled
: cb.mobileSignalIconId > 0 ? cb.mobileSignalIconId
: R.drawable.ic_qs_signal_no_signal;
+ state.isOverlayIconWide = cb.isDataTypeIconWide;
state.autoMirrorDrawable = !cb.noSim;
state.overlayIconId = cb.enabled && (cb.dataTypeIconId > 0) && !cb.wifiConnected
? cb.dataTypeIconId
@@ -142,6 +139,7 @@ public class CellularTile extends QSTile<QSTile.SignalState> {
boolean activityOut;
String enabledDesc;
boolean noSim;
+ boolean isDataTypeIconWide;
}
private final NetworkSignalChangedCallback mCallback = new NetworkSignalChangedCallback() {
@@ -162,7 +160,8 @@ public class CellularTile extends QSTile<QSTile.SignalState> {
int mobileSignalIconId,
String mobileSignalContentDescriptionId, int dataTypeIconId,
boolean activityIn, boolean activityOut,
- String dataTypeContentDescriptionId, String description, boolean noSim) {
+ String dataTypeContentDescriptionId, String description, boolean noSim,
+ boolean isDataTypeIconWide) {
final CallbackInfo info = new CallbackInfo(); // TODO pool?
info.enabled = enabled;
info.wifiEnabled = mWifiEnabled;
@@ -176,6 +175,7 @@ public class CellularTile extends QSTile<QSTile.SignalState> {
info.activityOut = activityOut;
info.enabledDesc = description;
info.noSim = noSim;
+ info.isDataTypeIconWide = isDataTypeIconWide;
refreshState(info);
}
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java
index 4fc2ee4..0985812 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java
@@ -206,7 +206,8 @@ public class WifiTile extends QSTile<QSTile.SignalState> {
int mobileSignalIconId,
String mobileSignalContentDescriptionId, int dataTypeIconId,
boolean activityIn, boolean activityOut,
- String dataTypeContentDescriptionId, String description, boolean noSim) {
+ String dataTypeContentDescriptionId, String description, boolean noSim,
+ boolean isDataTypeIconWide) {
// noop
}
diff --git a/packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java b/packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java
index 5fa9fa4..787de4e 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java
@@ -139,7 +139,8 @@ public class AlternateRecentsComponent implements ActivityOptions.OnAnimationSta
// Notify recents to hide itself
Intent intent = new Intent(ACTION_HIDE_RECENTS_ACTIVITY);
intent.setPackage(mContext.getPackageName());
- intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
+ intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT |
+ Intent.FLAG_RECEIVER_FOREGROUND);
intent.putExtra(EXTRA_TRIGGERED_FROM_ALT_TAB, triggeredFromAltTab);
intent.putExtra(EXTRA_TRIGGERED_FROM_HOME_KEY, triggeredFromHomeKey);
mContext.sendBroadcastAsUser(intent, UserHandle.CURRENT);
@@ -190,10 +191,14 @@ public class AlternateRecentsComponent implements ActivityOptions.OnAnimationSta
Task.TaskKey toTaskKey;
if (showNextTask) {
toTaskKey = group.getNextTaskInGroup(task);
- // XXX: We will actually set the appropriate launch animations here
+ launchOpts = ActivityOptions.makeCustomAnimation(mContext,
+ R.anim.recents_launch_next_affiliated_task_target,
+ R.anim.recents_launch_next_affiliated_task_source);
} else {
toTaskKey = group.getPrevTaskInGroup(task);
- // XXX: We will actually set the appropriate launch animations here
+ launchOpts = ActivityOptions.makeCustomAnimation(mContext,
+ R.anim.recents_launch_prev_affiliated_task_target,
+ R.anim.recents_launch_prev_affiliated_task_source);
}
if (toTaskKey != null) {
toTask = stack.findTaskWithId(toTaskKey.id);
@@ -204,7 +209,11 @@ public class AlternateRecentsComponent implements ActivityOptions.OnAnimationSta
// Return early if there is no next task
if (toTask == null) {
- // XXX: We will actually show a bounce animation here
+ if (showNextTask) {
+ // XXX: Show the next-task bounce animation
+ } else {
+ // XXX: Show the prev-task bounce animation
+ }
return;
}
@@ -243,8 +252,8 @@ public class AlternateRecentsComponent implements ActivityOptions.OnAnimationSta
mConfig = RecentsConfiguration.reinitialize(mContext, mSystemServicesProxy);
mConfig.updateOnConfigurationChange();
mConfig.getTaskStackBounds(mWindowRect.width(), mWindowRect.height(), mStatusBarHeight,
- mNavBarWidth, mTaskStackBounds);
- if (mConfig.isLandscape && mConfig.transposeRecentsLayoutWithOrientation) {
+ (mConfig.hasTransposedNavBar ? mNavBarWidth : 0), mTaskStackBounds);
+ if (mConfig.isLandscape && mConfig.hasTransposedNavBar) {
mSystemInsets.set(0, mStatusBarHeight, mNavBarWidth, 0);
} else {
mSystemInsets.set(0, mStatusBarHeight, 0, mNavBarHeight);
@@ -316,7 +325,8 @@ public class AlternateRecentsComponent implements ActivityOptions.OnAnimationSta
// Notify recents to toggle itself
Intent intent = new Intent(ACTION_TOGGLE_RECENTS_ACTIVITY);
intent.setPackage(mContext.getPackageName());
- intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
+ intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT |
+ Intent.FLAG_RECEIVER_FOREGROUND);
mContext.sendBroadcastAsUser(intent, UserHandle.CURRENT);
mLastToggleTime = System.currentTimeMillis();
return;
@@ -590,7 +600,8 @@ public class AlternateRecentsComponent implements ActivityOptions.OnAnimationSta
// Send the broadcast to notify Recents that the animation has started
Intent intent = new Intent(ACTION_START_ENTER_ANIMATION);
intent.setPackage(mContext.getPackageName());
- intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
+ intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT |
+ Intent.FLAG_RECEIVER_FOREGROUND);
mContext.sendOrderedBroadcastAsUser(intent, UserHandle.CURRENT, null,
fallbackReceiver, null, Activity.RESULT_CANCELED, null, null);
}
diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java
index 5d8181c..ed5c126 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java
@@ -57,7 +57,8 @@ public class RecentsConfiguration {
/** Layout */
boolean isLandscape;
- boolean transposeRecentsLayoutWithOrientation;
+ boolean hasTransposedSearchBar;
+ boolean hasTransposedNavBar;
/** Loading */
public int maxNumTasksToLoad;
@@ -74,8 +75,9 @@ public class RecentsConfiguration {
public float taskStackOverscrollPct;
/** Task view animation and styles */
- public int taskViewEnterFromHomeDuration;
public int taskViewEnterFromHomeDelay;
+ public int taskViewEnterFromHomeDuration;
+ public int taskViewEnterFromHomeStaggerDelay;
public int taskViewExitToHomeDuration;
public int taskViewRemoveAnimDuration;
public int taskViewRemoveAnimTranslationXPx;
@@ -173,8 +175,8 @@ public class RecentsConfiguration {
// Layout
isLandscape = res.getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE;
- transposeRecentsLayoutWithOrientation =
- res.getBoolean(R.bool.recents_transpose_layout_with_orientation);
+ hasTransposedSearchBar = res.getBoolean(R.bool.recents_has_transposed_search_bar);
+ hasTransposedNavBar = res.getBoolean(R.bool.recents_has_transposed_nav_bar);
// Insets
displayRect.set(0, 0, dm.widthPixels, dm.heightPixels);
@@ -209,10 +211,12 @@ public class RecentsConfiguration {
taskStackTopPaddingPx = res.getDimensionPixelSize(R.dimen.recents_stack_top_padding);
// Task view animation and styles
- taskViewEnterFromHomeDuration =
- res.getInteger(R.integer.recents_animate_task_enter_from_home_duration);
taskViewEnterFromHomeDelay =
res.getInteger(R.integer.recents_animate_task_enter_from_home_delay);
+ taskViewEnterFromHomeDuration =
+ res.getInteger(R.integer.recents_animate_task_enter_from_home_duration);
+ taskViewEnterFromHomeStaggerDelay =
+ res.getInteger(R.integer.recents_animate_task_enter_from_home_stagger_delay);
taskViewExitToHomeDuration =
res.getInteger(R.integer.recents_animate_task_exit_to_home_duration);
taskViewRemoveAnimDuration =
@@ -326,13 +330,12 @@ public class RecentsConfiguration {
/** Returns whether the nav bar scrim should be visible. */
public boolean hasNavBarScrim() {
// Only show the scrim if we have recent tasks, and if the nav bar is not transposed
- return !launchedWithNoRecentTasks &&
- (!transposeRecentsLayoutWithOrientation || !isLandscape);
+ return !launchedWithNoRecentTasks && (!hasTransposedNavBar || !isLandscape);
}
/** Returns whether the current layout is horizontal. */
public boolean hasHorizontalLayout() {
- return isLandscape && transposeRecentsLayoutWithOrientation;
+ return isLandscape && hasTransposedSearchBar;
}
/**
@@ -343,7 +346,7 @@ public class RecentsConfiguration {
Rect taskStackBounds) {
Rect searchBarBounds = new Rect();
getSearchBarBounds(windowWidth, windowHeight, topInset, searchBarBounds);
- if (isLandscape && transposeRecentsLayoutWithOrientation) {
+ if (isLandscape && hasTransposedSearchBar) {
// In landscape, the search bar appears on the left
taskStackBounds.set(searchBarBounds.right, topInset, windowWidth - rightInset, windowHeight);
} else {
@@ -364,7 +367,7 @@ public class RecentsConfiguration {
searchBarSize = 0;
}
- if (isLandscape && transposeRecentsLayoutWithOrientation) {
+ if (isLandscape && hasTransposedSearchBar) {
// In landscape, the search bar appears on the left
searchBarSpaceBounds.set(0, topInset, searchBarSize, windowHeight);
} else {
diff --git a/packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java b/packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java
index 887cbac..bbd0a0d 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java
@@ -56,6 +56,7 @@ import android.view.Display;
import android.view.DisplayInfo;
import android.view.SurfaceControl;
import android.view.WindowManager;
+import android.view.accessibility.AccessibilityManager;
import com.android.systemui.recents.Constants;
import java.io.IOException;
@@ -73,6 +74,7 @@ public class SystemServicesProxy {
final static BitmapFactory.Options sBitmapOptions;
+ AccessibilityManager mAccm;
ActivityManager mAm;
IActivityManager mIam;
AppWidgetManager mAwm;
@@ -97,6 +99,7 @@ public class SystemServicesProxy {
/** Private constructor */
public SystemServicesProxy(Context context) {
+ mAccm = AccessibilityManager.getInstance(context);
mAm = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
mIam = ActivityManagerNative.getDefault();
mAwm = AppWidgetManager.getInstance(context);
@@ -442,6 +445,15 @@ public class SystemServicesProxy {
}
/**
+ * Returns whether touch exploration is currently enabled.
+ */
+ public boolean isTouchExplorationEnabled() {
+ if (mAccm == null) return false;
+
+ return mAccm.isEnabled() && mAccm.isTouchExplorationEnabled();
+ }
+
+ /**
* Returns a global setting.
*/
public int getGlobalSetting(Context context, String setting) {
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java
index dbed136..895b9d1 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java
@@ -22,11 +22,15 @@ import android.graphics.Rect;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
+import android.view.accessibility.AccessibilityEvent;
+import android.view.accessibility.AccessibilityManager;
+import android.view.accessibility.AccessibilityNodeInfo;
import android.widget.FrameLayout;
import com.android.systemui.R;
import com.android.systemui.recents.Constants;
import com.android.systemui.recents.RecentsConfiguration;
import com.android.systemui.recents.misc.DozeTrigger;
+import com.android.systemui.recents.misc.SystemServicesProxy;
import com.android.systemui.recents.model.RecentsPackageMonitor;
import com.android.systemui.recents.model.RecentsTaskLoader;
import com.android.systemui.recents.model.Task;
@@ -67,6 +71,7 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
DebugOverlayView mDebugOverlay;
Rect mTaskStackBounds = new Rect();
int mFocusedTaskIndex = -1;
+ int mPrevAccessibilityFocusedIndex = -1;
// Optimizations
int mStackViewsAnimationDuration;
@@ -244,6 +249,9 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
/** Synchronizes the views with the model */
boolean synchronizeStackViewsWithModel() {
if (mStackViewsDirty) {
+ RecentsTaskLoader loader = RecentsTaskLoader.getInstance();
+ SystemServicesProxy ssp = loader.getSystemServicesProxy();
+
// Get all the task transforms
ArrayList<Task> tasks = mStack.getTasks();
float stackScroll = mStackScroller.getStackScroll();
@@ -293,6 +301,18 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
// Animate the task into place
tv.updateViewPropertiesToTaskTransform(mCurrentTaskTransforms.get(taskIndex),
mStackViewsAnimationDuration);
+
+ // Request accessibility focus on the next view if we removed the task
+ // that previously held accessibility focus
+ childCount = getChildCount();
+ if (childCount > 0 && ssp.isTouchExplorationEnabled()) {
+ TaskView atv = (TaskView) getChildAt(childCount - 1);
+ int indexOfTask = mStack.indexOfTask(atv.getTask());
+ if (mPrevAccessibilityFocusedIndex != indexOfTask) {
+ tv.requestAccessibilityFocus();
+ mPrevAccessibilityFocusedIndex = indexOfTask;
+ }
+ }
}
// Reset the request-synchronize params
@@ -432,6 +452,22 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
}
@Override
+ public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
+ super.onInitializeAccessibilityEvent(event);
+ int childCount = getChildCount();
+ if (childCount > 0) {
+ TaskView backMostTask = (TaskView) getChildAt(0);
+ TaskView frontMostTask = (TaskView) getChildAt(childCount - 1);
+ event.setFromIndex(mStack.indexOfTask(backMostTask.getTask()));
+ event.setToIndex(mStack.indexOfTask(frontMostTask.getTask()));
+ event.setContentDescription(frontMostTask.getTask().activityLabel);
+ }
+ event.setItemCount(mStack.getTaskCount());
+ event.setScrollY(mStackScroller.mScroller.getCurrY());
+ event.setMaxScrollY(mStackScroller.progressToScrollRange(mLayoutAlgorithm.mMaxScrollP));
+ }
+
+ @Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
return mTouchHandler.onInterceptTouchEvent(ev);
}
@@ -447,6 +483,8 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
// Synchronize the views
synchronizeStackViewsWithModel();
clipTaskViews();
+ // Notify accessibility
+ sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_SCROLLED);
}
/** Computes the stack and task rects */
@@ -623,6 +661,15 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
mStartEnterAnimationCompleted = true;
// Start dozing
mUIDozeTrigger.startDozing();
+ // Focus the first view if accessibility is enabled
+ RecentsTaskLoader loader = RecentsTaskLoader.getInstance();
+ SystemServicesProxy ssp = loader.getSystemServicesProxy();
+ int childCount = getChildCount();
+ if (childCount > 0 && ssp.isTouchExplorationEnabled()) {
+ TaskView tv = ((TaskView) getChildAt(childCount - 1));
+ tv.requestAccessibilityFocus();
+ mPrevAccessibilityFocusedIndex = mStack.indexOfTask(tv.getTask());
+ }
}
});
}
@@ -812,6 +859,11 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
public void prepareViewToEnterPool(TaskView tv) {
Task task = tv.getTask();
+ // Clear the accessibility focus for that view
+ if (tv.isAccessibilityFocused()) {
+ tv.clearAccessibilityFocus();
+ }
+
// Report that this tasks's data is no longer being used
RecentsTaskLoader.getInstance().unloadTaskData(task);
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java
index 49aa52b..4563597 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java
@@ -284,7 +284,7 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks,
float scaledWindowInsetTop = (int) (taskScale * windowInsetTop);
float scaledTranslationY = taskRect.top + transform.translationY -
(scaledWindowInsetTop + scaledYOffset);
- startDelay = mConfig.taskViewEnterFromHomeDelay;
+ startDelay = mConfig.taskViewEnterFromHomeStaggerDelay;
// Animate the top clip
mViewBounds.animateClipTop(windowInsetTop, duration,
@@ -410,8 +410,8 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks,
} else if (mConfig.launchedFromHome) {
// Animate the tasks up
int frontIndex = (ctx.currentStackViewCount - ctx.currentStackViewIndex - 1);
- int delay = mConfig.taskBarEnterAnimDelay +
- frontIndex * mConfig.taskViewEnterFromHomeDelay;
+ int delay = mConfig.taskViewEnterFromHomeDelay +
+ frontIndex * mConfig.taskViewEnterFromHomeStaggerDelay;
if (Constants.DebugFlags.App.EnableShadows) {
animate().translationZ(transform.translationZ);
}
@@ -840,7 +840,7 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks,
@Override
public void onClick(final View v) {
final TaskView tv = this;
- final boolean delayViewClick = (v != this);
+ final boolean delayViewClick = (v != this) && (v != mActionButtonView);
if (delayViewClick) {
// We purposely post the handler delayed to allow for the touch feedback to draw
postDelayed(new Runnable() {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
index 1c4556f..907a13f 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
@@ -39,6 +39,7 @@ import android.content.pm.UserInfo;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.database.ContentObserver;
+import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
import android.os.Build;
@@ -68,8 +69,10 @@ import android.view.View;
import android.view.ViewAnimationUtils;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
+import android.view.ViewStub;
import android.view.WindowManager;
import android.view.WindowManagerGlobal;
+import android.view.accessibility.AccessibilityManager;
import android.view.animation.AnimationUtils;
import android.widget.DateTimeView;
import android.widget.ImageView;
@@ -91,6 +94,7 @@ import com.android.systemui.statusbar.NotificationData.Entry;
import com.android.systemui.statusbar.phone.KeyguardTouchDelegate;
import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager;
import com.android.systemui.statusbar.policy.HeadsUpNotificationView;
+import com.android.systemui.statusbar.policy.PreviewInflater;
import com.android.systemui.statusbar.stack.NotificationStackScrollLayout;
import java.util.ArrayList;
@@ -159,6 +163,7 @@ public abstract class BaseStatusBar extends SystemUI implements
final protected SparseArray<UserInfo> mCurrentProfiles = new SparseArray<UserInfo>();
protected int mLayoutDirection = -1; // invalid
+ protected AccessibilityManager mAccessibilityManager;
private Locale mLocale;
private float mFontScale;
@@ -260,10 +265,12 @@ public abstract class BaseStatusBar extends SystemUI implements
final boolean isActivity = pendingIntent.isActivity();
if (isActivity) {
final boolean keyguardShowing = mStatusBarKeyguardViewManager.isShowing();
+ final boolean afterKeyguardGone = PreviewInflater.wouldLaunchResolverActivity(
+ mContext, pendingIntent.getIntent(), mCurrentUserId);
dismissKeyguardThenExecute(new OnDismissAction() {
@Override
public boolean onDismiss() {
- if (keyguardShowing) {
+ if (keyguardShowing && !afterKeyguardGone) {
try {
ActivityManagerNative.getDefault()
.keyguardWaitingForActivityDrawn();
@@ -277,7 +284,7 @@ public abstract class BaseStatusBar extends SystemUI implements
}
boolean handled = superOnClickHandler(view, pendingIntent, fillInIntent);
- overrideActivityPendingAppTransition(keyguardShowing);
+ overrideActivityPendingAppTransition(keyguardShowing && !afterKeyguardGone);
// close the shade if it was open
if (handled) {
@@ -287,7 +294,7 @@ public abstract class BaseStatusBar extends SystemUI implements
// Wait for activity start.
return handled;
}
- }, false /* afterKeyguardGone */);
+ }, afterKeyguardGone);
return true;
} else {
return super.onClickHandler(view, pendingIntent, fillInIntent);
@@ -438,6 +445,9 @@ public abstract class BaseStatusBar extends SystemUI implements
mNotificationData = new NotificationData(this);
+ mAccessibilityManager = (AccessibilityManager)
+ mContext.getSystemService(Context.ACCESSIBILITY_SERVICE);
+
mDreamManager = IDreamManager.Stub.asInterface(
ServiceManager.checkService(DreamService.DREAM_SERVICE));
mPowerManager = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE);
@@ -678,19 +688,11 @@ public abstract class BaseStatusBar extends SystemUI implements
protected void applyColorsAndBackgrounds(StatusBarNotification sbn,
NotificationData.Entry entry) {
- PackageManager pmUser = getPackageManagerForUser(
- entry.notification.getUser().getIdentifier());
- int version = 0;
- try {
- ApplicationInfo info = pmUser.getApplicationInfo(sbn.getPackageName(), 0);
- version = info.targetSdkVersion;
- } catch (NameNotFoundException ex) {
- Log.e(TAG, "Failed looking up ApplicationInfo for " + sbn.getPackageName(), ex);
- }
if (entry.expanded.getId() != com.android.internal.R.id.status_bar_latest_event_content) {
// Using custom RemoteViews
- if (version >= Build.VERSION_CODES.GINGERBREAD && version < Build.VERSION_CODES.L) {
+ if (entry.targetSdk >= Build.VERSION_CODES.GINGERBREAD
+ && entry.targetSdk < Build.VERSION_CODES.L) {
entry.row.setShowingLegacyBackground(true);
entry.legacy = true;
}
@@ -706,7 +708,7 @@ public abstract class BaseStatusBar extends SystemUI implements
}
if (entry.icon != null) {
- if (version >= Build.VERSION_CODES.L) {
+ if (entry.targetSdk >= Build.VERSION_CODES.L) {
entry.icon.setColorFilter(mContext.getResources().getColor(android.R.color.white));
} else {
entry.icon.setColorFilter(null);
@@ -763,17 +765,95 @@ public abstract class BaseStatusBar extends SystemUI implements
}, false /* afterKeyguardGone */);
}
+ private void inflateGuts(ExpandableNotificationRow row) {
+ ViewStub stub = (ViewStub) row.findViewById(R.id.notification_guts_stub);
+ if (stub != null) {
+ stub.inflate();
+ }
+ final StatusBarNotification sbn = row.getStatusBarNotification();
+ PackageManager pmUser = getPackageManagerForUser(
+ sbn.getUser().getIdentifier());
+ row.setTag(sbn.getPackageName());
+ final View guts = row.findViewById(R.id.notification_guts);
+ final String pkg = sbn.getPackageName();
+ String appname = pkg;
+ Drawable pkgicon = null;
+ int appUid = -1;
+ try {
+ final ApplicationInfo info = pmUser.getApplicationInfo(pkg,
+ PackageManager.GET_UNINSTALLED_PACKAGES
+ | PackageManager.GET_DISABLED_COMPONENTS);
+ if (info != null) {
+ appname = String.valueOf(pmUser.getApplicationLabel(info));
+ pkgicon = pmUser.getApplicationIcon(info);
+ appUid = info.uid;
+ }
+ } catch (NameNotFoundException e) {
+ // app is gone, just show package name and generic icon
+ pkgicon = pmUser.getDefaultActivityIcon();
+ }
+ ((ImageView) row.findViewById(android.R.id.icon)).setImageDrawable(pkgicon);
+ ((DateTimeView) row.findViewById(R.id.timestamp)).setTime(sbn.getPostTime());
+ ((TextView) row.findViewById(R.id.pkgname)).setText(appname);
+ final View settingsButton = guts.findViewById(R.id.notification_inspect_item);
+ final View appSettingsButton
+ = guts.findViewById(R.id.notification_inspect_app_provided_settings);
+ if (appUid >= 0) {
+ final int appUidF = appUid;
+ settingsButton.setOnClickListener(new View.OnClickListener() {
+ public void onClick(View v) {
+ startAppNotificationSettingsActivity(pkg, appUidF);
+ }
+ });
+
+ final Intent appSettingsQueryIntent
+ = new Intent(Intent.ACTION_MAIN)
+ .addCategory(Notification.INTENT_CATEGORY_NOTIFICATION_PREFERENCES)
+ .setPackage(pkg);
+ List<ResolveInfo> infos = pmUser.queryIntentActivities(appSettingsQueryIntent, 0);
+ if (infos.size() > 0) {
+ appSettingsButton.setVisibility(View.VISIBLE);
+ appSettingsButton.setContentDescription(
+ mContext.getResources().getString(
+ R.string.status_bar_notification_app_settings_title,
+ appname
+ ));
+ final Intent appSettingsLaunchIntent = new Intent(appSettingsQueryIntent)
+ .setClassName(pkg, infos.get(0).activityInfo.name);
+ appSettingsButton.setOnClickListener(new View.OnClickListener() {
+ public void onClick(View v) {
+ startAppOwnNotificationSettingsActivity(appSettingsLaunchIntent,
+ sbn.getId(),
+ sbn.getTag(),
+ appUidF);
+ }
+ });
+ } else {
+ appSettingsButton.setVisibility(View.GONE);
+ }
+ } else {
+ settingsButton.setVisibility(View.GONE);
+ appSettingsButton.setVisibility(View.GONE);
+ }
+
+ }
+
protected SwipeHelper.LongPressListener getNotificationLongClicker() {
return new SwipeHelper.LongPressListener() {
@Override
public boolean onLongPress(View v, int x, int y) {
dismissPopups();
+ if (!(v instanceof ExpandableNotificationRow)) {
+ return false;
+ }
if (v.getWindowToken() == null) {
Log.e(TAG, "Trying to show notification guts, but not attached to window");
return false;
}
+ inflateGuts((ExpandableNotificationRow) v);
+
// Assume we are a status_bar_notification_row
final NotificationGuts guts = (NotificationGuts) v.findViewById(
R.id.notification_guts);
@@ -1189,67 +1269,6 @@ public abstract class BaseStatusBar extends SystemUI implements
row.setExpansionLogger(this, entry.notification.getKey());
}
- // the notification inspector (see SwipeHelper.setLongPressListener)
- row.setTag(sbn.getPackageName());
- final View guts = row.findViewById(R.id.notification_guts);
- final String pkg = entry.notification.getPackageName();
- String appname = pkg;
- Drawable pkgicon = null;
- int appUid = -1;
- try {
- final ApplicationInfo info = pmUser.getApplicationInfo(pkg,
- PackageManager.GET_UNINSTALLED_PACKAGES | PackageManager.GET_DISABLED_COMPONENTS);
- if (info != null) {
- appname = String.valueOf(pmUser.getApplicationLabel(info));
- pkgicon = pmUser.getApplicationIcon(info);
- appUid = info.uid;
- }
- } catch (NameNotFoundException e) {
- // app is gone, just show package name and generic icon
- pkgicon = pmUser.getDefaultActivityIcon();
- }
- ((ImageView) row.findViewById(android.R.id.icon)).setImageDrawable(pkgicon);
- ((DateTimeView) row.findViewById(R.id.timestamp)).setTime(entry.notification.getPostTime());
- ((TextView) row.findViewById(R.id.pkgname)).setText(appname);
- final View settingsButton = guts.findViewById(R.id.notification_inspect_item);
- final View appSettingsButton
- = guts.findViewById(R.id.notification_inspect_app_provided_settings);
- if (appUid >= 0) {
- final int appUidF = appUid;
- settingsButton.setOnClickListener(new View.OnClickListener() {
- public void onClick(View v) {
- startAppNotificationSettingsActivity(pkg, appUidF);
- }
- });
-
- final Intent appSettingsQueryIntent
- = new Intent(Intent.ACTION_MAIN)
- .addCategory(Notification.INTENT_CATEGORY_NOTIFICATION_PREFERENCES)
- .setPackage(pkg);
- List<ResolveInfo> infos = pmUser.queryIntentActivities(appSettingsQueryIntent, 0);
- if (infos.size() > 0) {
- appSettingsButton.setVisibility(View.VISIBLE);
- appSettingsButton.setContentDescription(
- mContext.getResources().getString(
- R.string.status_bar_notification_app_settings_title,
- appname
- ));
- final Intent appSettingsLaunchIntent = new Intent(appSettingsQueryIntent)
- .setClassName(pkg, infos.get(0).activityInfo.name);
- appSettingsButton.setOnClickListener(new View.OnClickListener() {
- public void onClick(View v) {
- startAppOwnNotificationSettingsActivity(appSettingsLaunchIntent,
- sbn.getId(),
- sbn.getTag(),
- appUidF);
- }
- });
- }
- } else {
- settingsButton.setVisibility(View.GONE);
- appSettingsButton.setVisibility(View.GONE);
- }
-
workAroundBadLayerDrawableOpacity(row);
View vetoButton = updateNotificationVetoButton(row, sbn);
vetoButton.setContentDescription(mContext.getString(
@@ -1319,15 +1338,23 @@ public abstract class BaseStatusBar extends SystemUI implements
}
}
+ // Extract target SDK version.
+ try {
+ ApplicationInfo info = pmUser.getApplicationInfo(sbn.getPackageName(), 0);
+ entry.targetSdk = info.targetSdkVersion;
+ } catch (NameNotFoundException ex) {
+ Log.e(TAG, "Failed looking up ApplicationInfo for " + sbn.getPackageName(), ex);
+ }
+
if (publicViewLocal == null) {
// Add a basic notification template
publicViewLocal = LayoutInflater.from(mContext).inflate(
- com.android.internal.R.layout.notification_template_material_base,
+ R.layout.notification_public_default,
expandedPublic, false);
publicViewLocal.setIsRootNamespace(true);
expandedPublic.setContractedChild(publicViewLocal);
- final TextView title = (TextView) publicViewLocal.findViewById(com.android.internal.R.id.title);
+ final TextView title = (TextView) publicViewLocal.findViewById(R.id.title);
try {
title.setText(pmUser.getApplicationLabel(
pmUser.getApplicationInfo(entry.notification.getPackageName(), 0)));
@@ -1335,10 +1362,9 @@ public abstract class BaseStatusBar extends SystemUI implements
title.setText(entry.notification.getPackageName());
}
- final ImageView icon = (ImageView) publicViewLocal.findViewById(
- com.android.internal.R.id.icon);
+ final ImageView icon = (ImageView) publicViewLocal.findViewById(R.id.icon);
final ImageView profileBadge = (ImageView) publicViewLocal.findViewById(
- com.android.internal.R.id.profile_badge_line3);
+ R.id.profile_badge_line3);
final StatusBarIcon ic = new StatusBarIcon(entry.notification.getPackageName(),
entry.notification.getUser(),
@@ -1349,12 +1375,17 @@ public abstract class BaseStatusBar extends SystemUI implements
Drawable iconDrawable = StatusBarIconView.getIcon(mContext, ic);
icon.setImageDrawable(iconDrawable);
- if (mNotificationColorUtil.isGrayscaleIcon(iconDrawable)) {
+ if (entry.targetSdk >= Build.VERSION_CODES.L
+ || mNotificationColorUtil.isGrayscaleIcon(iconDrawable)) {
icon.setBackgroundResource(
com.android.internal.R.drawable.notification_icon_legacy_bg);
int padding = mContext.getResources().getDimensionPixelSize(
com.android.internal.R.dimen.notification_large_icon_circle_padding);
icon.setPadding(padding, padding, padding, padding);
+ if (sbn.getNotification().color != Notification.COLOR_DEFAULT) {
+ icon.getBackground().setColorFilter(
+ sbn.getNotification().color, PorterDuff.Mode.SRC_ATOP);
+ }
}
if (profileBadge != null) {
@@ -1369,16 +1400,13 @@ public abstract class BaseStatusBar extends SystemUI implements
}
final View privateTime = contentViewLocal.findViewById(com.android.internal.R.id.time);
+ final DateTimeView time = (DateTimeView) publicViewLocal.findViewById(R.id.time);
if (privateTime != null && privateTime.getVisibility() == View.VISIBLE) {
- final View timeStub = publicViewLocal.findViewById(com.android.internal.R.id.time);
- timeStub.setVisibility(View.VISIBLE);
- final DateTimeView dateTimeView = (DateTimeView)
- publicViewLocal.findViewById(com.android.internal.R.id.time);
- dateTimeView.setTime(entry.notification.getNotification().when);
+ time.setVisibility(View.VISIBLE);
+ time.setTime(entry.notification.getNotification().when);
}
- final TextView text = (TextView) publicViewLocal.findViewById(
- com.android.internal.R.id.text);
+ final TextView text = (TextView) publicViewLocal.findViewById(R.id.text);
if (text != null) {
text.setText(R.string.notification_hidden_text);
text.setTextAppearance(mContext,
@@ -1418,7 +1446,7 @@ public abstract class BaseStatusBar extends SystemUI implements
row.setUserExpanded(userExpanded);
}
row.setUserLocked(userLocked);
-
+ row.setStatusBarNotification(entry.notification);
return true;
}
@@ -1440,6 +1468,9 @@ public abstract class BaseStatusBar extends SystemUI implements
public void onClick(final View v) {
final boolean keyguardShowing = mStatusBarKeyguardViewManager.isShowing();
+ final boolean afterKeyguardGone = mIntent.isActivity()
+ && PreviewInflater.wouldLaunchResolverActivity(mContext, mIntent.getIntent(),
+ mCurrentUserId);
dismissKeyguardThenExecute(new OnDismissAction() {
public boolean onDismiss() {
if (mIsHeadsUp) {
@@ -1448,7 +1479,7 @@ public abstract class BaseStatusBar extends SystemUI implements
AsyncTask.execute(new Runnable() {
@Override
public void run() {
- if (keyguardShowing) {
+ if (keyguardShowing && !afterKeyguardGone) {
try {
ActivityManagerNative.getDefault()
.keyguardWaitingForActivityDrawn();
@@ -1472,7 +1503,8 @@ public abstract class BaseStatusBar extends SystemUI implements
// TODO: Dismiss Keyguard.
}
if (mIntent.isActivity()) {
- overrideActivityPendingAppTransition(keyguardShowing);
+ overrideActivityPendingAppTransition(keyguardShowing
+ && !afterKeyguardGone);
}
}
@@ -1490,7 +1522,7 @@ public abstract class BaseStatusBar extends SystemUI implements
return mIntent != null && mIntent.isActivity();
}
- }, false /* afterKeyguardGone */);
+ }, afterKeyguardGone);
}
}
@@ -1625,7 +1657,7 @@ public abstract class BaseStatusBar extends SystemUI implements
}
}
boolean showOnKeyguard = shouldShowOnKeyguard(entry.notification);
- if ((isLockscreenPublicMode() && !showOnKeyguard) ||
+ if ((isLockscreenPublicMode() && !mShowLockscreenNotifications) ||
(onKeyguard && (visibleNotifications >= maxKeyguardNotifications
|| !showOnKeyguard))) {
entry.row.setVisibility(View.GONE);
@@ -1776,7 +1808,7 @@ public abstract class BaseStatusBar extends SystemUI implements
oldEntry.notification.getNotification().tickerText);
final boolean shouldInterrupt = shouldInterrupt(notification);
- final boolean alertAgain = alertAgain(oldEntry);
+ final boolean alertAgain = alertAgain(oldEntry, n);
boolean updateSuccessful = false;
if (contentsUnchanged && bigContentsUnchanged && headsUpContentsUnchanged
&& publicUnchanged) {
@@ -1911,9 +1943,6 @@ public abstract class BaseStatusBar extends SystemUI implements
: null;
// Reapply the RemoteViews
- if (entry.row != null) {
- entry.row.resetHeight();
- }
contentView.reapply(mContext, entry.expanded, mOnClickHandler);
if (bigContentView != null && entry.getBigContentView() != null) {
bigContentView.reapply(mContext, entry.getBigContentView(),
@@ -1931,7 +1960,9 @@ public abstract class BaseStatusBar extends SystemUI implements
} else {
entry.row.setOnClickListener(null);
}
+ entry.row.setStatusBarNotification(notification);
entry.row.notifyContentUpdated();
+ entry.row.resetHeight();
}
protected void notifyHeadsUpScreenOn(boolean screenOn) {
@@ -1940,10 +1971,9 @@ public abstract class BaseStatusBar extends SystemUI implements
}
}
- private boolean alertAgain(Entry entry) {
- final StatusBarNotification sbn = entry.notification;
- return entry == null || !entry.hasInterrupted()
- || (sbn.getNotification().flags & Notification.FLAG_ONLY_ALERT_ONCE) == 0;
+ private boolean alertAgain(Entry oldEntry, Notification newNotification) {
+ return oldEntry == null || !oldEntry.hasInterrupted()
+ || (newNotification.flags & Notification.FLAG_ONLY_ALERT_ONCE) == 0;
}
protected boolean shouldInterrupt(StatusBarNotification sbn) {
@@ -1965,10 +1995,13 @@ public abstract class BaseStatusBar extends SystemUI implements
boolean hasTicker = mHeadsUpTicker && !TextUtils.isEmpty(notification.tickerText);
boolean isAllowed = notification.extras.getInt(Notification.EXTRA_AS_HEADS_UP,
Notification.HEADS_UP_ALLOWED) != Notification.HEADS_UP_NEVER;
+ boolean accessibilityForcesLaunch = isFullscreen
+ && mAccessibilityManager.isTouchExplorationEnabled();
final KeyguardTouchDelegate keyguard = KeyguardTouchDelegate.getInstance(mContext);
boolean interrupt = (isFullscreen || (isHighPriority && (isNoisy || hasTicker)))
&& isAllowed
+ && !accessibilityForcesLaunch
&& mPowerManager.isScreenOn()
&& !keyguard.isShowingAndNotOccluded()
&& !keyguard.isInputRestricted();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java
index c13593a..2ad6859 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java
@@ -20,9 +20,11 @@ import android.content.Context;
import android.graphics.drawable.AnimatedVectorDrawable;
import android.graphics.drawable.AnimationDrawable;
import android.graphics.drawable.Drawable;
+import android.service.notification.StatusBarNotification;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
+import android.view.ViewStub;
import android.view.accessibility.AccessibilityEvent;
import android.widget.ImageView;
@@ -67,6 +69,8 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
private boolean mWasReset;
private NotificationGuts mGuts;
+ private StatusBarNotification mStatusBarNotification;
+
public void setIconAnimationRunning(boolean running) {
setIconAnimationRunning(running, mPublicLayout);
setIconAnimationRunning(running, mPrivateLayout);
@@ -112,6 +116,14 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
}
}
+ public void setStatusBarNotification(StatusBarNotification statusBarNotification) {
+ mStatusBarNotification = statusBarNotification;
+ }
+
+ public StatusBarNotification getStatusBarNotification() {
+ return mStatusBarNotification;
+ }
+
public interface ExpansionLogger {
public void logNotificationExpansion(String key, boolean userAction, boolean expanded);
}
@@ -155,7 +167,15 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
super.onFinishInflate();
mPublicLayout = (NotificationContentView) findViewById(R.id.expandedPublic);
mPrivateLayout = (NotificationContentView) findViewById(R.id.expanded);
- mGuts = (NotificationGuts) findViewById(R.id.notification_guts);
+ ViewStub gutsStub = (ViewStub) findViewById(R.id.notification_guts_stub);
+ gutsStub.setOnInflateListener(new ViewStub.OnInflateListener() {
+ @Override
+ public void onInflate(ViewStub stub, View inflated) {
+ mGuts = (NotificationGuts) inflated;
+ mGuts.setClipTopAmount(getClipTopAmount());
+ mGuts.setActualHeight(getActualHeight());
+ }
+ });
mVetoButton = findViewById(R.id.veto);
}
@@ -421,7 +441,9 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
public void setActualHeight(int height, boolean notifyListeners) {
mPrivateLayout.setActualHeight(height);
mPublicLayout.setActualHeight(height);
- mGuts.setActualHeight(height);
+ if (mGuts != null) {
+ mGuts.setActualHeight(height);
+ }
invalidate();
super.setActualHeight(height, notifyListeners);
}
@@ -443,7 +465,9 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
super.setClipTopAmount(clipTopAmount);
mPrivateLayout.setClipTopAmount(clipTopAmount);
mPublicLayout.setClipTopAmount(clipTopAmount);
- mGuts.setClipTopAmount(clipTopAmount);
+ if (mGuts != null) {
+ mGuts.setClipTopAmount(clipTopAmount);
+ }
}
public void notifyContentUpdated() {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java
index ca1fbe0..34c458a 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java
@@ -48,6 +48,7 @@ public class NotificationData {
private boolean interruption;
public boolean autoRedacted; // whether the redacted notification was generated by us
public boolean legacy; // whether the notification has a legacy, dark background
+ public int targetSdk;
public Entry(StatusBarNotification n, StatusBarIconView ic) {
this.key = n.getKey();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java b/packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java
index 5883c26..18ef024 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java
@@ -27,17 +27,21 @@ import android.widget.LinearLayout;
import com.android.systemui.R;
import com.android.systemui.statusbar.policy.NetworkControllerImpl;
+import com.android.systemui.statusbar.policy.SecurityController;
// Intimately tied to the design of res/layout/signal_cluster_view.xml
public class SignalClusterView
extends LinearLayout
- implements NetworkControllerImpl.SignalCluster {
+ implements NetworkControllerImpl.SignalCluster,
+ SecurityController.SecurityControllerCallback {
static final String TAG = "SignalClusterView";
static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
NetworkControllerImpl mNC;
+ SecurityController mSC;
+ private boolean mVpnVisible = false;
private boolean mWifiVisible = false;
private int mWifiStrengthId = 0;
private boolean mMobileVisible = false;
@@ -46,10 +50,14 @@ public class SignalClusterView
private int mAirplaneIconId = 0;
private String mWifiDescription, mMobileDescription, mMobileTypeDescription;
private boolean mRoaming;
+ private boolean mIsMobileTypeIconWide;
ViewGroup mWifiGroup, mMobileGroup;
- ImageView mWifi, mMobile, mMobileType, mAirplane;
+ ImageView mVpn, mWifi, mMobile, mMobileType, mAirplane;
View mWifiAirplaneSpacer;
+ View mWifiSignalSpacer;
+
+ private int mWideTypeIconStartPadding;
public SignalClusterView(Context context) {
this(context, null);
@@ -68,10 +76,25 @@ public class SignalClusterView
mNC = nc;
}
+ public void setSecurityController(SecurityController sc) {
+ if (DEBUG) Log.d(TAG, "SecurityController=" + sc);
+ mSC = sc;
+ mSC.addCallback(this);
+ mVpnVisible = mSC.isVpnEnabled();
+ }
+
+ @Override
+ protected void onFinishInflate() {
+ super.onFinishInflate();
+ mWideTypeIconStartPadding = getContext().getResources().getDimensionPixelSize(
+ R.dimen.wide_type_icon_start_padding);
+ }
+
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
+ mVpn = (ImageView) findViewById(R.id.vpn);
mWifiGroup = (ViewGroup) findViewById(R.id.wifi_combo);
mWifi = (ImageView) findViewById(R.id.wifi_signal);
mMobileGroup = (ViewGroup) findViewById(R.id.mobile_combo);
@@ -79,12 +102,14 @@ public class SignalClusterView
mMobileType = (ImageView) findViewById(R.id.mobile_type);
mAirplane = (ImageView) findViewById(R.id.airplane);
mWifiAirplaneSpacer = findViewById(R.id.wifi_airplane_spacer);
+ mWifiSignalSpacer = findViewById(R.id.wifi_signal_spacer);
apply();
}
@Override
protected void onDetachedFromWindow() {
+ mVpn = null;
mWifiGroup = null;
mWifi = null;
mMobileGroup = null;
@@ -95,6 +120,18 @@ public class SignalClusterView
super.onDetachedFromWindow();
}
+ // From SecurityController.
+ @Override
+ public void onStateChanged() {
+ post(new Runnable() {
+ @Override
+ public void run() {
+ mVpnVisible = mSC.isVpnEnabled();
+ apply();
+ }
+ });
+ }
+
@Override
public void setWifiIndicators(boolean visible, int strengthIcon, String contentDescription) {
mWifiVisible = visible;
@@ -106,13 +143,15 @@ public class SignalClusterView
@Override
public void setMobileDataIndicators(boolean visible, int strengthIcon, int typeIcon,
- String contentDescription, String typeContentDescription, boolean roaming) {
+ String contentDescription, String typeContentDescription, boolean roaming,
+ boolean isTypeIconWide) {
mMobileVisible = visible;
mMobileStrengthId = strengthIcon;
mMobileTypeId = typeIcon;
mMobileDescription = contentDescription;
mMobileTypeDescription = typeContentDescription;
mRoaming = roaming;
+ mIsMobileTypeIconWide = isTypeIconWide;
apply();
}
@@ -168,6 +207,8 @@ public class SignalClusterView
private void apply() {
if (mWifiGroup == null) return;
+ mVpn.setVisibility(mVpnVisible ? View.VISIBLE : View.GONE);
+ if (DEBUG) Log.d(TAG, String.format("vpn: %s", mVpnVisible ? "VISIBLE" : "GONE"));
if (mWifiVisible) {
mWifi.setImageResource(mWifiStrengthId);
mWifiGroup.setContentDescription(mWifiDescription);
@@ -203,6 +244,14 @@ public class SignalClusterView
mWifiAirplaneSpacer.setVisibility(View.GONE);
}
+ if (mRoaming && mMobileVisible && mWifiVisible) {
+ mWifiSignalSpacer.setVisibility(View.VISIBLE);
+ } else {
+ mWifiSignalSpacer.setVisibility(View.GONE);
+ }
+
+ mMobile.setPaddingRelative(mIsMobileTypeIconWide ? mWideTypeIconStartPadding : 0, 0, 0, 0);
+
if (DEBUG) Log.d(TAG,
String.format("mobile: %s sig=%d typ=%d",
(mMobileVisible ? "VISIBLE" : "GONE"),
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/StackScrollerDecorView.java b/packages/SystemUI/src/com/android/systemui/statusbar/StackScrollerDecorView.java
index c620046..64d80cc 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/StackScrollerDecorView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/StackScrollerDecorView.java
@@ -90,7 +90,6 @@ public abstract class StackScrollerDecorView extends ExpandableView {
.alpha(endValue)
.setInterpolator(interpolator)
.setDuration(260)
- .withLayer()
.withEndAction(new Runnable() {
@Override
public void run() {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ActivityStarter.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ActivityStarter.java
index 9dfbb27..23810f9 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ActivityStarter.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ActivityStarter.java
@@ -24,5 +24,5 @@ import android.content.Intent;
* Keyguard.
*/
public interface ActivityStarter {
- public void startActivity(Intent intent, boolean dismissShade, boolean afterKeyguardGone);
+ public void startActivity(Intent intent, boolean dismissShade);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java
index f9da30f..e84ca52 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java
@@ -315,15 +315,15 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
public void launchCamera() {
mFlashlightController.killFlashlight();
Intent intent = getCameraIntent();
- boolean wouldLaunchResolverActivity = mPreviewInflater.wouldLaunchResolverActivity(intent);
+ boolean wouldLaunchResolverActivity = PreviewInflater.wouldLaunchResolverActivity(
+ mContext, intent, mLockPatternUtils.getCurrentUser());
if (intent == SECURE_CAMERA_INTENT && !wouldLaunchResolverActivity) {
mContext.startActivityAsUser(intent, UserHandle.CURRENT);
} else {
// We need to delay starting the activity because ResolverActivity finishes itself if
// launched behind lockscreen.
- mActivityStarter.startActivity(intent, false /* dismissShade */,
- wouldLaunchResolverActivity /* afterKeyguardGone */);
+ mActivityStarter.startActivity(intent, false /* dismissShade */);
}
}
@@ -337,8 +337,7 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
}
});
} else {
- mActivityStarter.startActivity(PHONE_INTENT, false /* dismissShade */,
- mPreviewInflater.wouldLaunchResolverActivity(PHONE_INTENT));
+ mActivityStarter.startActivity(PHONE_INTENT, false /* dismissShade */);
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/MultiUserSwitch.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/MultiUserSwitch.java
index dc49118..685c184 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/MultiUserSwitch.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/MultiUserSwitch.java
@@ -74,8 +74,10 @@ public class MultiUserSwitch extends FrameLayout implements View.OnClickListener
mKeyguardUserSwitcher.show(true /* animate */);
}
} else {
- mQsPanel.showDetailAdapter(true,
- mQsPanel.getHost().getUserSwitcherController().userDetailAdapter);
+ if (mQsPanel != null) {
+ mQsPanel.showDetailAdapter(true,
+ mQsPanel.getHost().getUserSwitcherController().userDetailAdapter);
+ }
}
} else {
Intent intent = ContactsContract.QuickContact.composeQuickContactsIntent(
@@ -93,9 +95,12 @@ public class MultiUserSwitch extends FrameLayout implements View.OnClickListener
final UserManager um = UserManager.get(getContext());
String text;
if (um.isUserSwitcherEnabled()) {
- UserSwitcherController controller = mQsPanel.getHost()
- .getUserSwitcherController();
- String currentUser = controller.getCurrentUserName(mContext);
+ String currentUser = null;
+ if (mQsPanel != null) {
+ UserSwitcherController controller = mQsPanel.getHost()
+ .getUserSwitcherController();
+ currentUser = controller.getCurrentUserName(mContext);
+ }
if (TextUtils.isEmpty(currentUser)) {
text = mContext.getString(R.string.accessibility_multi_user_switch_switcher);
} else {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarViewTaskSwitchHelper.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarViewTaskSwitchHelper.java
index b633453..79bb1cd 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarViewTaskSwitchHelper.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarViewTaskSwitchHelper.java
@@ -31,7 +31,6 @@ public class NavigationBarViewTaskSwitchHelper extends GestureDetector.SimpleOnG
private final GestureDetector mTaskSwitcherDetector;
private final int mScrollTouchSlop;
private final int mMinFlingVelocity;
- private boolean mInterceptTouches;
private int mTouchDownX;
private int mTouchDownY;
@@ -56,11 +55,11 @@ public class NavigationBarViewTaskSwitchHelper extends GestureDetector.SimpleOnG
// task switcher detector
mTaskSwitcherDetector.onTouchEvent(event);
int action = event.getAction();
+ boolean interceptTouches = false;
switch (action & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_DOWN: {
mTouchDownX = (int) event.getX();
mTouchDownY = (int) event.getY();
- mInterceptTouches = false;
break;
}
case MotionEvent.ACTION_MOVE: {
@@ -72,21 +71,19 @@ public class NavigationBarViewTaskSwitchHelper extends GestureDetector.SimpleOnG
? xDiff > mScrollTouchSlop && xDiff > yDiff
: yDiff > mScrollTouchSlop && yDiff > xDiff;
if (exceededTouchSlop) {
- mInterceptTouches = true;
+ interceptTouches = true;
return true;
}
break;
}
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
- mInterceptTouches = false;
break;
}
- return mInterceptTouches;
+ return interceptTouches;
}
public boolean onTouchEvent(MotionEvent event) {
- if (!mInterceptTouches) return false;
return mTaskSwitcherDetector.onTouchEvent(event);
}
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 cf5aebc..9585e17 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
@@ -23,6 +23,8 @@ import android.animation.PropertyValuesHolder;
import android.animation.ValueAnimator;
import android.content.Context;
import android.content.res.Configuration;
+import android.graphics.Color;
+import android.graphics.drawable.ColorDrawable;
import android.util.AttributeSet;
import android.util.MathUtils;
import android.view.MotionEvent;
@@ -60,6 +62,10 @@ public class NotificationPanelView extends PanelView implements
private static final float HEADER_RUBBERBAND_FACTOR = 2.05f;
private static final float LOCK_ICON_ACTIVE_SCALE = 1.2f;
+ private static final int DOZE_BACKGROUND_COLOR = 0xff000000;
+ private static final int TAG_KEY_ANIM = R.id.scrim;
+ private static final long DOZE_BACKGROUND_ANIM_DURATION = ScrimController.ANIMATION_DURATION;
+
private KeyguardAffordanceHelper mAfforanceHelper;
private StatusBarHeaderView mHeader;
private KeyguardUserSwitcher mKeyguardUserSwitcher;
@@ -559,7 +565,7 @@ public class NotificationPanelView extends PanelView implements
}
private boolean isBelowFalsingThreshold() {
- return !mQsTouchAboveFalsingThreshold && mStatusBar.isFalsingThresholdNeeded();
+ return !mQsTouchAboveFalsingThreshold && mStatusBarState == StatusBarState.KEYGUARD;
}
private float getQsExpansionFraction() {
@@ -1724,13 +1730,58 @@ public class NotificationPanelView extends PanelView implements
if (dozing == mDozing) return;
mDozing = dozing;
if (mDozing) {
- setBackgroundColor(0xff000000);
+ setBackgroundColorAlpha(this, DOZE_BACKGROUND_COLOR, 0xff, false /*animate*/);
} else {
- setBackground(null);
+ setBackgroundColorAlpha(this, DOZE_BACKGROUND_COLOR, 0, true /*animate*/);
}
updateKeyguardStatusBarVisibility();
}
+ private static void setBackgroundColorAlpha(final View target, int rgb, int targetAlpha,
+ boolean animate) {
+ int currentAlpha = getBackgroundAlpha(target);
+ if (currentAlpha == targetAlpha) {
+ return;
+ }
+ final int r = Color.red(rgb);
+ final int g = Color.green(rgb);
+ final int b = Color.blue(rgb);
+ Object runningAnim = target.getTag(TAG_KEY_ANIM);
+ if (runningAnim instanceof ValueAnimator) {
+ ((ValueAnimator) runningAnim).cancel();
+ }
+ if (!animate) {
+ target.setBackgroundColor(Color.argb(targetAlpha, r, g, b));
+ return;
+ }
+ ValueAnimator anim = ValueAnimator.ofInt(currentAlpha, targetAlpha);
+ anim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
+ @Override
+ public void onAnimationUpdate(ValueAnimator animation) {
+ int value = (int) animation.getAnimatedValue();
+ target.setBackgroundColor(Color.argb(value, r, g, b));
+ }
+ });
+ anim.setDuration(DOZE_BACKGROUND_ANIM_DURATION);
+ anim.addListener(new AnimatorListenerAdapter() {
+ @Override
+ public void onAnimationEnd(Animator animation) {
+ target.setTag(TAG_KEY_ANIM, null);
+ }
+ });
+ anim.start();
+ target.setTag(TAG_KEY_ANIM, anim);
+ }
+
+ private static int getBackgroundAlpha(View view) {
+ if (view.getBackground() instanceof ColorDrawable) {
+ ColorDrawable drawable = (ColorDrawable) view.getBackground();
+ return Color.alpha(drawable.getColor());
+ } else {
+ return 0;
+ }
+ }
+
public void setShadeEmpty(boolean shadeEmpty) {
mShadeEmpty = shadeEmpty;
updateEmptyShadeView();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
index 861bf4a..5d4c831 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -149,6 +149,7 @@ import com.android.systemui.statusbar.policy.KeyguardUserSwitcher;
import com.android.systemui.statusbar.policy.LocationControllerImpl;
import com.android.systemui.statusbar.policy.NetworkControllerImpl;
import com.android.systemui.statusbar.policy.NextAlarmController;
+import com.android.systemui.statusbar.policy.PreviewInflater;
import com.android.systemui.statusbar.policy.RotationLockControllerImpl;
import com.android.systemui.statusbar.policy.SecurityControllerImpl;
import com.android.systemui.statusbar.policy.UserInfoController;
@@ -786,8 +787,11 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
mNetworkController.addSignalCluster(signalCluster);
mNetworkController.addSignalCluster(signalClusterKeyguard);
mNetworkController.addSignalCluster(signalClusterQs);
+ signalCluster.setSecurityController(mSecurityController);
signalCluster.setNetworkController(mNetworkController);
+ signalClusterKeyguard.setSecurityController(mSecurityController);
signalClusterKeyguard.setNetworkController(mNetworkController);
+ signalClusterQs.setSecurityController(mSecurityController);
signalClusterQs.setNetworkController(mNetworkController);
final boolean isAPhone = mNetworkController.hasVoiceCallingFeature();
if (isAPhone) {
@@ -1078,7 +1082,6 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
};
private long mLastLockToAppLongPress;
- private AccessibilityManager mAccessibilityManager;
private View.OnLongClickListener mLongPressBackRecentsListener =
new View.OnLongClickListener() {
@Override
@@ -2067,8 +2070,8 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
}
@Override
- public void startActivity(Intent intent, boolean dismissShade, boolean afterKeyguardGone) {
- startActivityDismissingKeyguard(intent, false, dismissShade, afterKeyguardGone);
+ public void startActivity(Intent intent, boolean dismissShade) {
+ startActivityDismissingKeyguard(intent, false, dismissShade);
}
public ScrimController getScrimController() {
@@ -2957,9 +2960,11 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
}
public void startActivityDismissingKeyguard(final Intent intent, boolean onlyProvisioned,
- final boolean dismissShade, final boolean afterKeyguardGone) {
+ final boolean dismissShade) {
if (onlyProvisioned && !isDeviceProvisioned()) return;
+ final boolean afterKeyguardGone = PreviewInflater.wouldLaunchResolverActivity(
+ mContext, intent, mCurrentUserId);
final boolean keyguardShowing = mStatusBarKeyguardViewManager.isShowing();
dismissKeyguardThenExecute(new OnDismissAction() {
@Override
@@ -3308,8 +3313,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
}
private void handleStartSettingsActivity(Intent intent, boolean onlyProvisioned) {
- startActivityDismissingKeyguard(intent, onlyProvisioned, true /* dismissShade */,
- false /* afterKeyguardGone */);
+ startActivityDismissingKeyguard(intent, onlyProvisioned, true /* dismissShade */);
}
private static class FastColorDrawable extends Drawable {
@@ -3869,10 +3873,6 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
try {
boolean sendBackLongPress = false;
IActivityManager activityManager = ActivityManagerNative.getDefault();
- if (mAccessibilityManager == null) {
- mAccessibilityManager = (AccessibilityManager)
- mContext.getSystemService(Context.ACCESSIBILITY_SERVICE);
- }
boolean isAccessiblityEnabled = mAccessibilityManager.isEnabled();
if (activityManager.isInLockTaskMode() && !isAccessiblityEnabled) {
long time = System.currentTimeMillis();
@@ -3948,6 +3948,13 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
return !mNotificationData.getActiveNotifications().isEmpty();
}
+ public void wakeUpIfDozing(long time) {
+ if (mDozeServiceHost != null && mDozeServiceHost.isDozing()) {
+ PowerManager pm = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE);
+ pm.wakeUp(time);
+ }
+ }
+
private final class ShadeUpdates {
private final ArraySet<String> mVisibleNotifications = new ArraySet<String>();
private final ArraySet<String> mNewVisibleNotifications = new ArraySet<String>();
@@ -3992,6 +3999,10 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
+ mCurrentDozeService + "]";
}
+ public boolean isDozing() {
+ return mCurrentDozeService != null;
+ }
+
public void firePowerSaveChanged(boolean active) {
for (Callback callback : mCallbacks) {
callback.onPowerSaveChanged(active);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java
index 455c336..be48df7 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java
@@ -38,11 +38,12 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener {
private static final String TAG = "ScrimController";
private static final boolean DEBUG = false;
+ public static final long ANIMATION_DURATION = 220;
+
private static final float SCRIM_BEHIND_ALPHA = 0.62f;
private static final float SCRIM_BEHIND_ALPHA_KEYGUARD = 0.55f;
private static final float SCRIM_BEHIND_ALPHA_UNLOCKING = 0.2f;
private static final float SCRIM_IN_FRONT_ALPHA = 0.75f;
- private static final long ANIMATION_DURATION = 220;
private static final int TAG_KEY_ANIM = R.id.scrim;
private static final long PULSE_IN_ANIMATION_DURATION = 1000;
@@ -131,6 +132,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener {
mDozing = dozing;
if (!mDozing) {
cancelPulsing();
+ mAnimateChange = true;
}
scheduleUpdate();
}
@@ -163,7 +165,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener {
if (mAnimateKeyguardFadingOut) {
setScrimInFrontColor(0f);
setScrimBehindColor(0f);
- }else if (!mKeyguardShowing && !mBouncerShowing) {
+ } else if (!mKeyguardShowing && !mBouncerShowing) {
updateScrimNormal();
setScrimInFrontColor(0);
} else {
@@ -217,8 +219,8 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener {
mScrimInFront.setClickable(false);
} else {
- // Eat touch events.
- mScrimInFront.setClickable(true);
+ // Eat touch events (unless dozing).
+ mScrimInFront.setClickable(!mDozing);
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeaderView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeaderView.java
index eeb97e3..15a7229 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeaderView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeaderView.java
@@ -497,20 +497,19 @@ public class StatusBarHeaderView extends RelativeLayout implements View.OnClickL
} else if (v == mAlarmStatus && mNextAlarm != null) {
PendingIntent showIntent = mNextAlarm.getShowIntent();
if (showIntent != null && showIntent.isActivity()) {
- mActivityStarter.startActivity(showIntent.getIntent(), true /* dismissShade */,
- false /* afterKeyguardGone */);
+ mActivityStarter.startActivity(showIntent.getIntent(), true /* dismissShade */);
}
}
}
private void startSettingsActivity() {
mActivityStarter.startActivity(new Intent(android.provider.Settings.ACTION_SETTINGS),
- true /* dismissShade */, false /* afterKeyguardGone */);
+ true /* dismissShade */);
}
private void startBatteryActivity() {
mActivityStarter.startActivity(new Intent(Intent.ACTION_POWER_USAGE_SUMMARY),
- true /* dismissShade */, false /* afterKeyguardGone */);
+ true /* dismissShade */);
}
public void setQSPanel(QSPanel qsp) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java
index 1811d8d..a5217ab 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java
@@ -128,6 +128,10 @@ public class StatusBarWindowView extends FrameLayout {
&& mService.getBarState() == StatusBarState.KEYGUARD
&& !mService.isBouncerShowing()) {
intercept = mDragDownHelper.onInterceptTouchEvent(ev);
+ // wake up on a touch down event, if dozing
+ if (ev.getActionMasked() == MotionEvent.ACTION_DOWN) {
+ mService.wakeUpIfDozing(ev.getEventTime());
+ }
}
if (!intercept) {
super.onInterceptTouchEvent(ev);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpNotificationView.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpNotificationView.java
index b2009c3..7f155a1 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpNotificationView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpNotificationView.java
@@ -28,6 +28,7 @@ import android.view.ViewConfiguration;
import android.view.ViewGroup;
import android.view.ViewOutlineProvider;
import android.view.ViewTreeObserver;
+import android.view.accessibility.AccessibilityEvent;
import android.widget.FrameLayout;
import com.android.systemui.ExpandHelper;
@@ -111,6 +112,7 @@ public class HeadsUpNotificationView extends FrameLayout implements SwipeHelper.
mContentHolder.setVisibility(View.VISIBLE);
mContentHolder.setAlpha(mMaxAlpha);
mContentHolder.addView(mHeadsUp.row);
+ sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED);
mSwipeHelper.snapChild(mContentHolder, 1f);
mStartTouchTime = System.currentTimeMillis() + mTouchSensitivityDelay;
@@ -126,6 +128,14 @@ public class HeadsUpNotificationView extends FrameLayout implements SwipeHelper.
return true;
}
+ @Override
+ protected void onVisibilityChanged(View changedView, int visibility) {
+ super.onVisibilityChanged(changedView, visibility);
+ if (changedView.getVisibility() == VISIBLE) {
+ sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED);
+ }
+ }
+
public boolean isShowing(String key) {
return mHeadsUp != null && mHeadsUp.key.equals(key);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java
index d9a3e14..16c0e66 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java
@@ -18,10 +18,12 @@ package com.android.systemui.statusbar.policy;
import android.animation.Animator;
import android.animation.ObjectAnimator;
+import android.app.ActivityManager;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.hardware.input.InputManager;
+import android.media.AudioManager;
import android.os.Bundle;
import android.os.SystemClock;
import android.util.AttributeSet;
@@ -57,6 +59,7 @@ public class KeyButtonView extends ImageView {
private boolean mSupportsLongpress = true;
private Animator mAnimateToQuiescent = new ObjectAnimator();
private Drawable mBackground;
+ private AudioManager mAudioManager;
private final Runnable mCheckLongPress = new Runnable() {
public void run() {
@@ -99,6 +102,7 @@ public class KeyButtonView extends ImageView {
setClickable(true);
mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
+ mAudioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
}
@Override
@@ -251,6 +255,10 @@ public class KeyButtonView extends ImageView {
return true;
}
+ public void playSoundEffect(int soundConstant) {
+ mAudioManager.playSoundEffect(soundConstant, ActivityManager.getCurrentUser());
+ };
+
public void sendEvent(int action, int flags) {
sendEvent(action, flags, SystemClock.uptimeMillis());
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java
index b64dcbe..2ed9366 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java
@@ -30,7 +30,8 @@ public interface NetworkController {
void onMobileDataSignalChanged(boolean enabled, int mobileSignalIconId,
String mobileSignalContentDescriptionId, int dataTypeIconId,
boolean activityIn, boolean activityOut,
- String dataTypeContentDescriptionId, String description, boolean noSim);
+ String dataTypeContentDescriptionId, String description, boolean noSim,
+ boolean isDataTypeIconWide);
void onAirplaneModeChanged(boolean enabled);
void onMobileDataEnabled(boolean enabled);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java
index 4a6f1a8..5088089 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java
@@ -63,9 +63,6 @@ public class NetworkControllerImpl extends BroadcastReceiver
static final boolean DEBUG = false;
static final boolean CHATTY = false; // additional diagnostics, but not logspew
- private static final int FLIGHT_MODE_ICON = R.drawable.stat_sys_airplane_mode;
- private static final int ROAMING_ICON = R.drawable.stat_sys_data_fully_connected_roam;
-
// telephony
boolean mHspaDataDistinguishable;
final TelephonyManager mPhone;
@@ -165,7 +162,8 @@ public class NetworkControllerImpl extends BroadcastReceiver
public interface SignalCluster {
void setWifiIndicators(boolean visible, int strengthIcon, String contentDescription);
void setMobileDataIndicators(boolean visible, int strengthIcon, int typeIcon,
- String contentDescription, String typeContentDescription, boolean roaming);
+ String contentDescription, String typeContentDescription, boolean roaming,
+ boolean isTypeIconWide);
void setIsAirplaneMode(boolean is, int airplaneIcon);
}
@@ -358,6 +356,16 @@ public class NetworkControllerImpl extends BroadcastReceiver
mMobileDataController.setMobileDataEnabled(enabled);
}
+ private boolean isTypeIconWide(int iconId) {
+ return TelephonyIcons.ICON_LTE == iconId || TelephonyIcons.ICON_1X == iconId
+ || TelephonyIcons.ICON_3G == iconId || TelephonyIcons.ICON_4G == iconId;
+ }
+
+ private boolean isQsTypeIconWide(int iconId) {
+ return TelephonyIcons.QS_ICON_LTE == iconId || TelephonyIcons.QS_ICON_1X == iconId
+ || TelephonyIcons.QS_ICON_3G == iconId || TelephonyIcons.QS_ICON_4G == iconId;
+ }
+
public void refreshSignalCluster(SignalCluster cluster) {
if (mDemoMode) return;
cluster.setWifiIndicators(
@@ -374,7 +382,8 @@ public class NetworkControllerImpl extends BroadcastReceiver
mDataTypeIconId,
mContentDescriptionWimax,
mContentDescriptionDataType,
- mDataTypeIconId == ROAMING_ICON);
+ mDataTypeIconId == TelephonyIcons.ROAMING_ICON,
+ false /* isTypeIconWide */ );
} else {
// normal mobile data
cluster.setMobileDataIndicators(
@@ -383,7 +392,8 @@ public class NetworkControllerImpl extends BroadcastReceiver
mDataTypeIconId,
mContentDescriptionPhoneSignal,
mContentDescriptionDataType,
- mDataTypeIconId == ROAMING_ICON);
+ mDataTypeIconId == TelephonyIcons.ROAMING_ICON,
+ isTypeIconWide(mDataTypeIconId));
}
cluster.setIsAirplaneMode(mAirplaneMode, mAirplaneIconId);
}
@@ -409,18 +419,20 @@ public class NetworkControllerImpl extends BroadcastReceiver
if (isEmergencyOnly()) {
cb.onMobileDataSignalChanged(false, mQSPhoneSignalIconId,
mContentDescriptionPhoneSignal, mQSDataTypeIconId, mobileIn, mobileOut,
- mContentDescriptionDataType, null, mNoSim);
+ mContentDescriptionDataType, null, mNoSim, isQsTypeIconWide(mQSDataTypeIconId));
} else {
if (mIsWimaxEnabled && mWimaxConnected) {
// Wimax is special
cb.onMobileDataSignalChanged(true, mQSPhoneSignalIconId,
mContentDescriptionPhoneSignal, mQSDataTypeIconId, mobileIn, mobileOut,
- mContentDescriptionDataType, mNetworkName, mNoSim);
+ mContentDescriptionDataType, mNetworkName, mNoSim,
+ isQsTypeIconWide(mQSDataTypeIconId));
} else {
// Normal mobile data
cb.onMobileDataSignalChanged(mHasMobileDataFeature, mQSPhoneSignalIconId,
mContentDescriptionPhoneSignal, mQSDataTypeIconId, mobileIn, mobileOut,
- mContentDescriptionDataType, mNetworkName, mNoSim);
+ mContentDescriptionDataType, mNetworkName, mNoSim,
+ isQsTypeIconWide(mQSDataTypeIconId));
}
}
cb.onAirplaneModeChanged(mAirplaneMode);
@@ -754,7 +766,7 @@ public class NetworkControllerImpl extends BroadcastReceiver
R.string.accessibility_data_connection_4g);
} else {
mDataIconList = TelephonyIcons.DATA_LTE[mInetCondition];
- mDataTypeIconId = R.drawable.stat_sys_data_fully_connected_lte;
+ mDataTypeIconId = TelephonyIcons.ICON_LTE;
mQSDataTypeIconId = TelephonyIcons.QS_DATA_LTE[mInetCondition];
mContentDescriptionDataType = mContext.getString(
R.string.accessibility_data_connection_lte);
@@ -780,11 +792,11 @@ public class NetworkControllerImpl extends BroadcastReceiver
if (isCdma()) {
if (isCdmaEri()) {
- mDataTypeIconId = ROAMING_ICON;
+ mDataTypeIconId = TelephonyIcons.ROAMING_ICON;
mQSDataTypeIconId = TelephonyIcons.QS_DATA_R[mInetCondition];
}
} else if (mPhone.isNetworkRoaming()) {
- mDataTypeIconId = ROAMING_ICON;
+ mDataTypeIconId = TelephonyIcons.ROAMING_ICON;
mQSDataTypeIconId = TelephonyIcons.QS_DATA_R[mInetCondition];
}
}
@@ -928,8 +940,8 @@ public class NetworkControllerImpl extends BroadcastReceiver
intent.getParcelableExtra(WifiManager.EXTRA_NETWORK_INFO);
boolean wasConnected = mWifiConnected;
mWifiConnected = networkInfo != null && networkInfo.isConnected();
- // If we just connected, grab the inintial signal strength and ssid
- if (mWifiConnected && !wasConnected) {
+ // If Connected grab the signal strength and ssid
+ if (mWifiConnected) {
// try getting it out of the intent first
WifiInfo info = (WifiInfo) intent.getParcelableExtra(WifiManager.EXTRA_WIFI_INFO);
if (info == null) {
@@ -1164,7 +1176,7 @@ public class NetworkControllerImpl extends BroadcastReceiver
// look again; your radios are now airplanes
mContentDescriptionPhoneSignal = mContext.getString(
R.string.accessibility_airplane_mode);
- mAirplaneIconId = FLIGHT_MODE_ICON;
+ mAirplaneIconId = TelephonyIcons.FLIGHT_MODE_ICON;
mPhoneSignalIconId = mDataSignalIconId = mDataTypeIconId = mQSDataTypeIconId = 0;
mQSPhoneSignalIconId = 0;
@@ -1198,11 +1210,11 @@ public class NetworkControllerImpl extends BroadcastReceiver
mQSDataTypeIconId = 0;
if (isCdma()) {
if (isCdmaEri()) {
- mDataTypeIconId = ROAMING_ICON;
+ mDataTypeIconId = TelephonyIcons.ROAMING_ICON;
mQSDataTypeIconId = TelephonyIcons.QS_DATA_R[mInetCondition];
}
} else if (mPhone.isNetworkRoaming()) {
- mDataTypeIconId = ROAMING_ICON;
+ mDataTypeIconId = TelephonyIcons.ROAMING_ICON;
mQSDataTypeIconId = TelephonyIcons.QS_DATA_R[mInetCondition];
}
}
@@ -1509,7 +1521,7 @@ public class NetworkControllerImpl extends BroadcastReceiver
if (airplane != null) {
boolean show = airplane.equals("show");
for (SignalCluster cluster : mSignalClusters) {
- cluster.setIsAirplaneMode(show, FLIGHT_MODE_ICON);
+ cluster.setIsAirplaneMode(show, TelephonyIcons.FLIGHT_MODE_ICON);
}
}
String fully = args.getString("fully");
@@ -1540,23 +1552,23 @@ public class NetworkControllerImpl extends BroadcastReceiver
String datatype = args.getString("datatype");
if (datatype != null) {
mDemoDataTypeIconId =
- datatype.equals("1x") ? R.drawable.stat_sys_data_fully_connected_1x :
- datatype.equals("3g") ? R.drawable.stat_sys_data_fully_connected_3g :
- datatype.equals("4g") ? R.drawable.stat_sys_data_fully_connected_4g :
+ datatype.equals("1x") ? TelephonyIcons.ICON_1X :
+ datatype.equals("3g") ? TelephonyIcons.ICON_3G :
+ datatype.equals("4g") ? TelephonyIcons.ICON_4G :
datatype.equals("e") ? R.drawable.stat_sys_data_fully_connected_e :
datatype.equals("g") ? R.drawable.stat_sys_data_fully_connected_g :
datatype.equals("h") ? R.drawable.stat_sys_data_fully_connected_h :
- datatype.equals("lte") ? R.drawable.stat_sys_data_fully_connected_lte :
- datatype.equals("roam") ? ROAMING_ICON :
+ datatype.equals("lte") ? TelephonyIcons.ICON_LTE :
+ datatype.equals("roam") ? TelephonyIcons.ROAMING_ICON :
0;
mDemoQSDataTypeIconId =
- datatype.equals("1x") ? R.drawable.ic_qs_signal_1x :
- datatype.equals("3g") ? R.drawable.ic_qs_signal_3g :
- datatype.equals("4g") ? R.drawable.ic_qs_signal_4g :
+ datatype.equals("1x") ? TelephonyIcons.QS_ICON_1X :
+ datatype.equals("3g") ? TelephonyIcons.QS_ICON_3G :
+ datatype.equals("4g") ? TelephonyIcons.QS_ICON_4G :
datatype.equals("e") ? R.drawable.ic_qs_signal_e :
datatype.equals("g") ? R.drawable.ic_qs_signal_g :
datatype.equals("h") ? R.drawable.ic_qs_signal_h :
- datatype.equals("lte") ? R.drawable.ic_qs_signal_lte :
+ datatype.equals("lte") ? TelephonyIcons.QS_ICON_LTE :
datatype.equals("roam") ? R.drawable.ic_qs_signal_r :
0;
}
@@ -1575,7 +1587,8 @@ public class NetworkControllerImpl extends BroadcastReceiver
mDemoDataTypeIconId,
"Demo",
"Demo",
- mDemoDataTypeIconId == ROAMING_ICON);
+ mDemoDataTypeIconId == TelephonyIcons.ROAMING_ICON,
+ isTypeIconWide(mDemoDataTypeIconId));
}
refreshViews();
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/PreviewInflater.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/PreviewInflater.java
index cdbe494..030cd6d 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/PreviewInflater.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/PreviewInflater.java
@@ -20,14 +20,12 @@ import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
-import android.content.pm.UserInfo;
import android.os.UserHandle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import com.android.internal.widget.LockPatternUtils;
-import com.android.keyguard.KeyguardActivityLauncher;
import com.android.systemui.statusbar.phone.KeyguardPreviewContainer;
import java.util.List;
@@ -107,20 +105,21 @@ public class PreviewInflater {
return info;
}
- public boolean wouldLaunchResolverActivity(Intent intent) {
- PackageManager packageManager = mContext.getPackageManager();
+ public static boolean wouldLaunchResolverActivity(Context ctx, Intent intent,
+ int currentUserId) {
+ PackageManager packageManager = ctx.getPackageManager();
final List<ResolveInfo> appList = packageManager.queryIntentActivitiesAsUser(
- intent, PackageManager.MATCH_DEFAULT_ONLY, mLockPatternUtils.getCurrentUser());
+ intent, PackageManager.MATCH_DEFAULT_ONLY, currentUserId);
if (appList.size() == 0) {
return false;
}
ResolveInfo resolved = packageManager.resolveActivityAsUser(intent,
- PackageManager.MATCH_DEFAULT_ONLY | PackageManager.GET_META_DATA,
- mLockPatternUtils.getCurrentUser());
+ PackageManager.MATCH_DEFAULT_ONLY | PackageManager.GET_META_DATA, currentUserId);
return wouldLaunchResolverActivity(resolved, appList);
}
- private boolean wouldLaunchResolverActivity(ResolveInfo resolved, List<ResolveInfo> appList) {
+ private static boolean wouldLaunchResolverActivity(
+ ResolveInfo resolved, List<ResolveInfo> appList) {
// If the list contains the above resolved activity, then it can't be
// ResolverActivity itself.
for (int i = 0; i < appList.size(); i++) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/SecurityControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SecurityControllerImpl.java
index a15ddaf..2fbb812 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/SecurityControllerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SecurityControllerImpl.java
@@ -139,14 +139,14 @@ public class SecurityControllerImpl implements SecurityController {
}
@Override
- public void addCallback(SecurityControllerCallback callback) {
+ public void removeCallback(SecurityControllerCallback callback) {
if (callback == null) return;
if (DEBUG) Log.d(TAG, "removeCallback " + callback);
mCallbacks.remove(callback);
}
@Override
- public void removeCallback(SecurityControllerCallback callback) {
+ public void addCallback(SecurityControllerCallback callback) {
if (callback == null || mCallbacks.contains(callback)) return;
if (DEBUG) Log.d(TAG, "addCallback " + callback);
mCallbacks.add(callback);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/TelephonyIcons.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/TelephonyIcons.java
index 84c53ce..1f2b918 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/TelephonyIcons.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/TelephonyIcons.java
@@ -188,5 +188,16 @@ class TelephonyIcons {
R.drawable.ic_qs_signal_lte
};
+ static final int FLIGHT_MODE_ICON = R.drawable.stat_sys_airplane_mode;
+ static final int ROAMING_ICON = R.drawable.stat_sys_data_fully_connected_roam;
+ static final int ICON_LTE = R.drawable.stat_sys_data_fully_connected_lte;
+ static final int ICON_3G = R.drawable.stat_sys_data_fully_connected_3g;
+ static final int ICON_4G = R.drawable.stat_sys_data_fully_connected_4g;
+ static final int ICON_1X = R.drawable.stat_sys_data_fully_connected_1x;
+
+ static final int QS_ICON_LTE = R.drawable.ic_qs_signal_lte;
+ static final int QS_ICON_3G = R.drawable.ic_qs_signal_3g;
+ static final int QS_ICON_4G = R.drawable.ic_qs_signal_4g;
+ static final int QS_ICON_1X = R.drawable.ic_qs_signal_1x;
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java
index 52fa621..d02826f 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java
@@ -73,6 +73,7 @@ public class UserSwitcherController {
private ArrayList<UserRecord> mUsers = new ArrayList<>();
private Dialog mExitGuestDialog;
+ private Dialog mAddUserDialog;
private int mLastNonGuestUser = UserHandle.USER_OWNER;
private boolean mSimpleUserSwitcher;
private boolean mAddUsersWhenLocked;
@@ -228,8 +229,8 @@ public class UserSwitcherController {
// No guest user. Create one.
id = mUserManager.createGuest(mContext, mContext.getString(R.string.guest_nickname)).id;
} else if (record.isAddUser) {
- id = mUserManager.createUser(
- mContext.getString(R.string.user_new_user_name), 0 /* flags */).id;
+ showAddUserDialog();
+ return;
} else {
id = record.info.id;
}
@@ -260,6 +261,14 @@ public class UserSwitcherController {
mExitGuestDialog.show();
}
+ private void showAddUserDialog() {
+ if (mAddUserDialog != null && mAddUserDialog.isShowing()) {
+ mAddUserDialog.cancel();
+ }
+ mAddUserDialog = new AddUserDialog(mContext);
+ mAddUserDialog.show();
+ }
+
private void exitGuest(int id) {
int newId = UserHandle.USER_OWNER;
if (mLastNonGuestUser != UserHandle.USER_OWNER) {
@@ -534,4 +543,30 @@ public class UserSwitcherController {
}
}
}
+
+ private final class AddUserDialog extends SystemUIDialog implements
+ DialogInterface.OnClickListener {
+
+ public AddUserDialog(Context context) {
+ super(context);
+ setTitle(R.string.user_add_user_title);
+ setMessage(context.getString(R.string.user_add_user_message_short));
+ setButton(DialogInterface.BUTTON_NEGATIVE,
+ context.getString(android.R.string.cancel), this);
+ setButton(DialogInterface.BUTTON_POSITIVE,
+ context.getString(android.R.string.ok), this);
+ }
+
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ if (which == BUTTON_NEGATIVE) {
+ cancel();
+ } else {
+ dismiss();
+ int id = mUserManager.createUser(
+ mContext.getString(R.string.user_new_user_name), 0 /* flags */).id;
+ switchToUserId(id);
+ }
+ }
+ }
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java
index 6f477ef..67ba8d2 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java
@@ -40,6 +40,7 @@ import com.android.systemui.statusbar.EmptyShadeView;
import com.android.systemui.statusbar.ExpandableNotificationRow;
import com.android.systemui.statusbar.ExpandableView;
import com.android.systemui.statusbar.SpeedBumpView;
+import com.android.systemui.statusbar.StatusBarState;
import com.android.systemui.statusbar.phone.PhoneStatusBar;
import com.android.systemui.statusbar.policy.ScrollAdapter;
import com.android.systemui.statusbar.stack.StackScrollState.ViewState;
@@ -645,7 +646,7 @@ public class NotificationStackScrollLayout extends ViewGroup
@Override
public boolean isAntiFalsingNeeded() {
- return mPhoneStatusBar.isFalsingThresholdNeeded();
+ return mPhoneStatusBar.getBarState() == StatusBarState.KEYGUARD;
}
private void setSwipingInProgress(boolean isSwiped) {
@@ -1546,7 +1547,7 @@ public class NotificationStackScrollLayout extends ViewGroup
mStackScrollAlgorithm.notifyChildrenChanged(this);
((ExpandableView) child).setOnHeightChangedListener(this);
generateAddAnimation(child, false /* fromMoreCard */);
- updateAnimationState(mAnimationsEnabled && mIsExpanded, child);
+ updateAnimationState(child);
}
public void setAnimationsEnabled(boolean animationsEnabled) {
@@ -1563,6 +1564,11 @@ public class NotificationStackScrollLayout extends ViewGroup
}
}
+ private void updateAnimationState(View child) {
+ updateAnimationState(mAnimationsEnabled && mIsExpanded, child);
+ }
+
+
private void updateAnimationState(boolean running, View child) {
if (child instanceof ExpandableNotificationRow) {
ExpandableNotificationRow row = (ExpandableNotificationRow) child;
@@ -1960,6 +1966,7 @@ public class NotificationStackScrollLayout extends ViewGroup
mRequestViewResizeAnimationOnLayout = true;
}
mStackScrollAlgorithm.onReset(view);
+ updateAnimationState(view);
}
private void updateScrollPositionOnExpandInBottom(ExpandableView view) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java
index 7c4c0e8..e4a1c27 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java
@@ -40,8 +40,6 @@ public class StackScrollAlgorithm {
private static final int MAX_ITEMS_IN_BOTTOM_STACK = 3;
private static final int MAX_ITEMS_IN_TOP_STACK = 3;
- /** When a child is activated, the other cards' alpha fade to this value. */
- private static final float ACTIVATED_INVERSE_ALPHA = 0.9f;
public static final float DIMMED_SCALE = 0.95f;
private int mPaddingBetweenElements;
@@ -270,12 +268,8 @@ public class StackScrollAlgorithm {
childViewState.scale = !mScaleDimmed || !dimmed || isActivatedChild
? 1.0f
: DIMMED_SCALE;
- if (dimmed && activatedChild != null) {
- if (!isActivatedChild) {
- childViewState.alpha *= ACTIVATED_INVERSE_ALPHA;
- } else {
- childViewState.zTranslation += 2.0f * mZDistanceBetweenElements;
- }
+ if (dimmed && isActivatedChild) {
+ childViewState.zTranslation += 2.0f * mZDistanceBetweenElements;
}
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/volume/VolumePanel.java b/packages/SystemUI/src/com/android/systemui/volume/VolumePanel.java
index 367c31a..fa43f32 100644
--- a/packages/SystemUI/src/com/android/systemui/volume/VolumePanel.java
+++ b/packages/SystemUI/src/com/android/systemui/volume/VolumePanel.java
@@ -56,6 +56,7 @@ import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.view.WindowManager.LayoutParams;
+import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityManager;
import android.widget.ImageView;
import android.widget.SeekBar;
@@ -1081,6 +1082,7 @@ public class VolumePanel extends Handler {
if (mCallback != null) {
mCallback.onVisible(true);
}
+ announceDialogShown();
}
// Do a little vibrate if applicable (only when going into vibrate mode)
@@ -1097,6 +1099,10 @@ public class VolumePanel extends Handler {
}
}
+ private void announceDialogShown() {
+ mView.sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED);
+ }
+
private boolean isShowing() {
return mDialog.isShowing();
}
diff --git a/packages/SystemUI/src/com/android/systemui/volume/VolumeUI.java b/packages/SystemUI/src/com/android/systemui/volume/VolumeUI.java
index acb4827..0586a83 100644
--- a/packages/SystemUI/src/com/android/systemui/volume/VolumeUI.java
+++ b/packages/SystemUI/src/com/android/systemui/volume/VolumeUI.java
@@ -140,8 +140,7 @@ public class VolumeUI extends SystemUI {
@Override
public void run() {
getComponent(PhoneStatusBar.class).startActivityDismissingKeyguard(
- ZenModePanel.ZEN_SETTINGS, true /* onlyProvisioned */, true /* dismissShade */,
- false /* afterKeyguardGone */);
+ ZenModePanel.ZEN_SETTINGS, true /* onlyProvisioned */, true /* dismissShade */);
mPanel.postDismiss(mDismissDelay);
}
};
diff --git a/packages/SystemUI/src/com/android/systemui/volume/ZenModePanel.java b/packages/SystemUI/src/com/android/systemui/volume/ZenModePanel.java
index e4eecd3..f829994 100644
--- a/packages/SystemUI/src/com/android/systemui/volume/ZenModePanel.java
+++ b/packages/SystemUI/src/com/android/systemui/volume/ZenModePanel.java
@@ -60,7 +60,7 @@ public class ZenModePanel extends LinearLayout {
private static final int[] MINUTE_BUCKETS = DEBUG
? new int[] { 0, 1, 2, 5, 15, 30, 45, 60, 120, 180, 240, 480 }
- : new int[] { 15, 30, 45, 60, 120, 180, 240, 480 };
+ : ZenModeConfig.MINUTE_BUCKETS;
private static final int MIN_BUCKET_MINUTES = MINUTE_BUCKETS[0];
private static final int MAX_BUCKET_MINUTES = MINUTE_BUCKETS[MINUTE_BUCKETS.length - 1];
private static final int DEFAULT_BUCKET_INDEX = Arrays.binarySearch(MINUTE_BUCKETS, 60);
@@ -68,7 +68,6 @@ public class ZenModePanel extends LinearLayout {
private static final int TIME_CONDITION_INDEX = 1;
private static final int FIRST_CONDITION_INDEX = 2;
private static final float SILENT_HINT_PULSE_SCALE = 1.1f;
- private static final int ZERO_VALUE_MS = 20 * SECONDS_MS;
public static final Intent ZEN_SETTINGS = new Intent(Settings.ACTION_ZEN_MODE_SETTINGS);
@@ -217,7 +216,7 @@ public class ZenModePanel extends LinearLayout {
mBucketIndex = -1;
} else {
mBucketIndex = DEFAULT_BUCKET_INDEX;
- mTimeCondition = newTimeCondition(MINUTE_BUCKETS[mBucketIndex]);
+ mTimeCondition = ZenModeConfig.toTimeCondition(MINUTE_BUCKETS[mBucketIndex]);
}
if (DEBUG) Log.d(mTag, "Initial bucket index: " + mBucketIndex);
mConditions = null; // reset conditions
@@ -263,7 +262,7 @@ public class ZenModePanel extends LinearLayout {
}
private void refreshExitConditionText() {
- final String forever = mContext.getString(R.string.zen_mode_forever);
+ final String forever = mContext.getString(com.android.internal.R.string.zen_mode_forever);
if (mExitCondition == null) {
mExitConditionText = forever;
} else if (ZenModeConfig.isValidCountdownConditionId(mExitCondition.id)) {
@@ -339,24 +338,7 @@ public class ZenModePanel extends LinearLayout {
if (time == 0) return null;
final long span = time - System.currentTimeMillis();
if (span <= 0 || span > MAX_BUCKET_MINUTES * MINUTES_MS) return null;
- return timeCondition(time, Math.round(span / (float)MINUTES_MS));
- }
-
- private Condition newTimeCondition(int minutesFromNow) {
- final long now = System.currentTimeMillis();
- final long millis = minutesFromNow == 0 ? ZERO_VALUE_MS : minutesFromNow * MINUTES_MS;
- return timeCondition(now + millis, minutesFromNow);
- }
-
- private Condition timeCondition(long time, int minutes) {
- final int num = minutes < 60 ? minutes : Math.round(minutes / 60f);
- final int resId = minutes < 60
- ? R.plurals.zen_mode_duration_minutes
- : R.plurals.zen_mode_duration_hours;
- final String caption = mContext.getResources().getQuantityString(resId, num, num);
- final Uri id = ZenModeConfig.toCountdownConditionId(time);
- return new Condition(id, caption, "", "", 0, Condition.STATE_TRUE,
- Condition.FLAG_RELEVANT_NOW);
+ return ZenModeConfig.toTimeCondition(time, Math.round(span / (float) MINUTES_MS));
}
private void handleUpdateConditions(Condition[] conditions) {
@@ -410,7 +392,7 @@ public class ZenModePanel extends LinearLayout {
if (favoriteIndex == -1) {
getConditionTagAt(FOREVER_CONDITION_INDEX).rb.setChecked(true);
} else {
- mTimeCondition = newTimeCondition(MINUTE_BUCKETS[favoriteIndex]);
+ mTimeCondition = ZenModeConfig.toTimeCondition(MINUTE_BUCKETS[favoriteIndex]);
mBucketIndex = favoriteIndex;
bind(mTimeCondition, mZenConditions.getChildAt(TIME_CONDITION_INDEX));
getConditionTagAt(TIME_CONDITION_INDEX).rb.setChecked(true);
@@ -466,7 +448,7 @@ public class ZenModePanel extends LinearLayout {
});
final TextView title = (TextView) row.findViewById(android.R.id.title);
if (condition == null) {
- title.setText(R.string.zen_mode_forever);
+ title.setText(mContext.getString(com.android.internal.R.string.zen_mode_forever));
} else {
title.setText(condition.summary);
}
@@ -503,7 +485,7 @@ public class ZenModePanel extends LinearLayout {
} else {
final long span = time - System.currentTimeMillis();
button1.setEnabled(span > MIN_BUCKET_MINUTES * MINUTES_MS);
- final Condition maxCondition = newTimeCondition(MAX_BUCKET_MINUTES);
+ final Condition maxCondition = ZenModeConfig.toTimeCondition(MAX_BUCKET_MINUTES);
button2.setEnabled(!Objects.equals(condition.summary, maxCondition.summary));
}
@@ -529,18 +511,18 @@ public class ZenModePanel extends LinearLayout {
final long bucketTime = now + bucketMinutes * MINUTES_MS;
if (up && bucketTime > time || !up && bucketTime < time) {
mBucketIndex = j;
- newCondition = timeCondition(bucketTime, bucketMinutes);
+ newCondition = ZenModeConfig.toTimeCondition(bucketTime, bucketMinutes);
break;
}
}
if (newCondition == null) {
mBucketIndex = DEFAULT_BUCKET_INDEX;
- newCondition = newTimeCondition(MINUTE_BUCKETS[mBucketIndex]);
+ newCondition = ZenModeConfig.toTimeCondition(MINUTE_BUCKETS[mBucketIndex]);
}
} else {
// on a known index, simply increment or decrement
mBucketIndex = Math.max(0, Math.min(N - 1, mBucketIndex + (up ? 1 : -1)));
- newCondition = newTimeCondition(MINUTE_BUCKETS[mBucketIndex]);
+ newCondition = ZenModeConfig.toTimeCondition(MINUTE_BUCKETS[mBucketIndex]);
}
mTimeCondition = newCondition;
bind(mTimeCondition, row);