The beginnings of the new status bar.

There is a lot of rough stuff still, but most of the functionality is here again.

Change-Id: I4b1241e61270f1434e798481afa83634233ee670
This commit is contained in:
Joe Onorato
2010-11-10 18:00:52 -08:00
parent 645336a742
commit fd52b18d9b
90 changed files with 1270 additions and 1093 deletions

View File

@@ -1,22 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2010 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"
>
<alpha android:fromAlpha="0.0" android:toAlpha="1.0"
android:duration="@android:integer/config_longAnimTime"
/>
</set>

View File

@@ -1,22 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2010 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"
>
<alpha android:toAlpha="0.0" android:fromAlpha="1.0"
android:duration="@android:integer/config_longAnimTime"
/>
</set>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 348 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 885 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 239 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.1 KiB

View File

@@ -1,33 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/* //device/apps/common/res/drawable/stat_sys_battery.xml
**
** Copyright 2007, 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.
*/
-->
<level-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:maxLevel="01" android:drawable="@drawable/sysbar_battery_0" />
<item android:maxLevel="10" android:drawable="@drawable/sysbar_battery_10" />
<item android:maxLevel="20" android:drawable="@drawable/sysbar_battery_20" />
<item android:maxLevel="30" android:drawable="@drawable/sysbar_battery_30" />
<item android:maxLevel="40" android:drawable="@drawable/sysbar_battery_40" />
<item android:maxLevel="50" android:drawable="@drawable/sysbar_battery_50" />
<item android:maxLevel="60" android:drawable="@drawable/sysbar_battery_60" />
<item android:maxLevel="70" android:drawable="@drawable/sysbar_battery_70" />
<item android:maxLevel="80" android:drawable="@drawable/sysbar_battery_80" />
<item android:maxLevel="90" android:drawable="@drawable/sysbar_battery_90" />
<item android:maxLevel="101" android:drawable="@drawable/sysbar_battery_100" />
</level-list>

View File

@@ -1,29 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/* //device/apps/common/res/drawable/stat_sys_battery.xml
**
** Copyright 2007, 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.
*/
-->
<clip xmlns:android="http://schemas.android.com/apk/res/android"
android:clipOrientation="horizontal"
android:maxLevel="100"
android:gravity="left">
<level-list>
<item android:maxLevel="1500" android:drawable="@drawable/sysbar_batterymini_red" />
<item android:maxLevel="10000" android:drawable="@drawable/sysbar_batterymini_100" />
</level-list>
</clip>

View File

@@ -1,33 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/* //device/apps/common/res/drawable/stat_sys_battery.xml
**
** Copyright 2007, 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.
*/
-->
<level-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:maxLevel="01" android:drawable="@drawable/sysbar_signal_0" />
<item android:maxLevel="10" android:drawable="@drawable/sysbar_signal_10" />
<item android:maxLevel="20" android:drawable="@drawable/sysbar_signal_20" />
<item android:maxLevel="30" android:drawable="@drawable/sysbar_signal_30" />
<item android:maxLevel="40" android:drawable="@drawable/sysbar_signal_40" />
<item android:maxLevel="50" android:drawable="@drawable/sysbar_signal_50" />
<item android:maxLevel="60" android:drawable="@drawable/sysbar_signal_60" />
<item android:maxLevel="70" android:drawable="@drawable/sysbar_signal_70" />
<item android:maxLevel="80" android:drawable="@drawable/sysbar_signal_80" />
<item android:maxLevel="90" android:drawable="@drawable/sysbar_signal_90" />
<item android:maxLevel="101" android:drawable="@drawable/sysbar_signal_100" />
</level-list>

View File

@@ -1,25 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/* //device/apps/common/res/drawable/stat_sys_battery.xml
**
** Copyright 2007, 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.
*/
-->
<clip xmlns:android="http://schemas.android.com/apk/res/android"
android:clipOrientation="horizontal"
android:gravity="right"
android:maxLevel="10000"
android:drawable="@drawable/sysbar_signalmini_100" />

View File

@@ -1,33 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/* //device/apps/common/res/drawable/stat_sys_battery.xml
**
** Copyright 2007, 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.
*/
-->
<level-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:maxLevel="01" android:drawable="@drawable/sysbar_signal_0" />
<item android:maxLevel="10" android:drawable="@drawable/sysbar_signal_10" />
<item android:maxLevel="20" android:drawable="@drawable/sysbar_signal_20" />
<item android:maxLevel="30" android:drawable="@drawable/sysbar_signal_30" />
<item android:maxLevel="40" android:drawable="@drawable/sysbar_signal_40" />
<item android:maxLevel="50" android:drawable="@drawable/sysbar_signal_50" />
<item android:maxLevel="60" android:drawable="@drawable/sysbar_signal_60" />
<item android:maxLevel="70" android:drawable="@drawable/sysbar_signal_70" />
<item android:maxLevel="80" android:drawable="@drawable/sysbar_signal_80" />
<item android:maxLevel="90" android:drawable="@drawable/sysbar_signal_90" />
<item android:maxLevel="101" android:drawable="@drawable/sysbar_signal_100" />
</level-list>

View File

@@ -1,25 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/* //device/apps/common/res/drawable/stat_sys_battery.xml
**
** Copyright 2007, 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.
*/
-->
<clip xmlns:android="http://schemas.android.com/apk/res/android"
android:clipOrientation="horizontal"
android:gravity="right"
android:maxLevel="100"
android:drawable="@drawable/sysbar_signalmini_100" />

View File

@@ -25,84 +25,9 @@
android:id="@+id/bar_contents"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:animateLayoutChanges="true"
>
<ImageView
android:id="@+id/notificationTrigger"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:layout_marginLeft="6dip"
android:src="@drawable/ic_sysbar_noti_none"
android:background="@drawable/ic_sysbar_icon_bg"
android:gravity="center"
/>
<LinearLayout
android:id="@+id/notificationButtons"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_toLeftOf="@+id/notificationTrigger"
android:gravity="center_vertical"
android:orientation="horizontal"
android:visibility="gone"
>
<TextView android:id="@+id/clear_all_button"
style="?android:attr/textAppearance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right|center_vertical"
android:layout_marginTop="2dip"
android:layout_marginBottom="1dip"
android:layout_marginRight="10dip"
android:padding="6dip"
android:textSize="14sp"
android:text="@string/status_bar_clear_all_button"
/>
<TextView android:id="@+id/do_not_disturb"
style="?android:attr/textAppearance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right|center_vertical"
android:layout_marginTop="2dip"
android:layout_marginBottom="1dip"
android:layout_marginRight="10dip"
android:padding="6dip"
android:textSize="14sp"
android:text="@string/status_bar_do_not_disturb_button"
/>
</LinearLayout>
<com.android.systemui.statusbar.tablet.NotificationIconArea
android:id="@+id/notificationIcons"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_toLeftOf="@+id/notificationTrigger"
android:gravity="center_vertical"
android:orientation="horizontal"
>
<com.android.systemui.statusbar.tablet.InputMethodButton
android:id="@+id/imeButton"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="8dip"
android:src="@drawable/ic_sysbar_ime_default"
android:background="@drawable/ic_sysbar_icon_bg"
android:visibility="invisible"
/>
<view
class="com.android.systemui.statusbar.tablet.NotificationIconArea$IconLayout"
android:id="@+id/icons"
android:layout_width="wrap_content"
android:layout_height="@*android:dimen/status_bar_icon_size"
android:layout_marginLeft="8dip"
/>
</com.android.systemui.statusbar.tablet.NotificationIconArea>
<FrameLayout
android:id="@+id/ticker"
android:layout_width="wrap_content"
@@ -114,11 +39,60 @@
android:animateLayoutChanges="true"
/>
<include layout="@layout/status_bar_center"
android:layout_width="256dip"
<LinearLayout
android:id="@+id/notificationArea"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_centerInParent="true"
/>
android:layout_alignParentRight="true"
android:orientation="horizontal"
>
<com.android.systemui.statusbar.tablet.NotificationIconArea
android:id="@+id/notificationIcons"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:orientation="horizontal"
>
<view
class="com.android.systemui.statusbar.tablet.NotificationIconArea$IconLayout"
android:id="@+id/icons"
android:layout_width="wrap_content"
android:layout_height="@*android:dimen/status_bar_icon_size"
android:layout_marginLeft="8dip"
/>
</com.android.systemui.statusbar.tablet.NotificationIconArea>
<LinearLayout
android:id="@+id/notificationTrigger"
android:layout_width="wrap_content"
android:layout_height="match_parent"
>
<com.android.systemui.statusbar.policy.Clock
style="@*android:style/TextAppearance.StatusBar.Icon"
android:id="@+id/clock"
android:layout_width="64dip"
android:layout_height="48dip"
android:singleLine="true"
android:gravity="center"
android:textSize="16sp"
android:textStyle="bold"
android:padding="2dip"
/>
<ImageView
android:id="@+id/battery"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_gravity="center_vertical"
/>
<ImageView
android:id="@+id/network"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_gravity="center_vertical"
android:src="@drawable/ic_sysbar_wifi_mini"
/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/navigationArea"
@@ -126,9 +100,10 @@
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:orientation="horizontal"
android:animateLayoutChanges="true"
>
<com.android.systemui.statusbar.KeyButtonView android:id="@+id/back"
<com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/back"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:paddingLeft="15dip"
@@ -137,7 +112,7 @@
android:background="@drawable/ic_sysbar_icon_bg"
systemui:keyCode="4"
/>
<com.android.systemui.statusbar.KeyButtonView android:id="@+id/home"
<com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/home"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:paddingLeft="15dip"
@@ -154,7 +129,7 @@
android:paddingLeft="15dip"
android:paddingRight="15dip"
/>
<com.android.systemui.statusbar.KeyButtonView android:id="@+id/menu"
<com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/menu"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:paddingLeft="15dip"
@@ -185,6 +160,15 @@
android:gravity="center"
/>
</com.android.systemui.statusbar.tablet.ShirtPocket>
<com.android.systemui.statusbar.tablet.InputMethodButton
android:id="@+id/imeButton"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="8dip"
android:src="@drawable/ic_sysbar_ime_default"
android:background="@drawable/ic_sysbar_icon_bg"
android:visibility="invisible"
/>
</LinearLayout>
</RelativeLayout>

View File

@@ -1,72 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2010 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.
-->
<!-- Center of status bar: System info display, system info panel trigger -->
<RelativeLayout android:id="@+id/systemInfo"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:clickable="true"
>
<com.android.systemui.statusbar.Clock
style="@*android:style/TextAppearance.StatusBar.Icon"
android:id="@+id/clock"
android:layout_width="64dip"
android:layout_height="48dip"
android:layout_centerInParent="true"
android:singleLine="true"
android:gravity="center"
android:textSize="16sp"
android:textStyle="bold"
android:padding="2dip"
/>
<ImageView
android:id="@+id/battery"
android:layout_width="64dip"
android:layout_height="16dip"
android:layout_toLeftOf="@id/clock"
android:layout_centerInParent="true"
android:background="@drawable/sysbar_minimeter_bg"
/>
<ImageView
android:id="@+id/signal"
android:layout_width="64dip"
android:layout_height="16dip"
android:layout_toRightOf="@id/clock"
android:layout_centerInParent="true"
android:background="@drawable/sysbar_minimeter_bg"
/>
<ImageView
android:id="@+id/battery_icon"
android:layout_height="30dip"
android:layout_width="30dip"
android:layout_toLeftOf="@id/battery"
android:layout_centerInParent="true"
android:src="@drawable/ic_sysbar_battery_mini"
/>
<ImageView
android:id="@+id/signal_icon"
android:layout_height="30dip"
android:layout_width="30dip"
android:layout_toRightOf="@id/signal"
android:layout_centerInParent="true"
android:src="@drawable/ic_sysbar_wifi_mini"
/>
</RelativeLayout>

View File

@@ -28,11 +28,76 @@
android:animateLayoutChanges="true"
>
<com.android.systemui.statusbar.policy.Clock
android:id="@+id/clock"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_alignParentTop="true"
android:gravity="right"
/>
<com.android.systemui.statusbar.policy.DateView
android:id="@+id/date"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_below="@id/clock"
android:gravity="right"
/>
<Button
android:id="@+id/settings_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/date"
android:layout_alignParentRight="true"
android:text="@string/system_panel_settings_button"
/>
<ImageView
android:id="@+id/battery"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignBaseline="@id/settings_button"
android:src="@drawable/ic_sysbar_battery_mini"
android:baseline="17dp"
/>
<TextView
android:id="@+id/battery_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/battery"
android:layout_alignBaseline="@id/settings_button"
android:singleLine="true"
android:text="@string/system_panel_settings_button"
/>
<ImageView
android:id="@+id/network"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_toRightOf="@id/battery_text"
android:layout_alignBaseline="@id/settings_button"
android:src="@drawable/ic_sysbar_wifi_mini"
android:baseline="21dp"
/>
<TextView
android:id="@+id/network_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/network"
android:layout_alignBaseline="@id/settings_button"
android:singleLine="true"
android:text="@string/system_panel_settings_button"
/>
<ScrollView
android:id="@+id/notificationScroller"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:animateLayoutChanges="true"
android:layout_below="@id/settings_button"
>
<LinearLayout
android:id="@+id/content"

View File

@@ -95,7 +95,6 @@
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:scaleType="centerCrop"
android:src="@drawable/sysbar_battery"
/>
<TextView android:id="@+id/battery_info"
style="@style/TextAppearance.StatusBar.SystemPanel"
@@ -106,7 +105,7 @@
/>
</RelativeLayout>
<com.android.systemui.statusbar.Clock
<com.android.systemui.statusbar.policy.Clock
style="@style/TextAppearance.StatusBar.SystemPanel"
android:id="@+id/clock"
android:layout_width="wrap_content"
@@ -130,7 +129,6 @@
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:scaleType="centerCrop"
android:src="@drawable/sysbar_signal"
/>
<TextView android:id="@+id/signal_info"
@@ -200,7 +198,7 @@
>
<!-- TODO: alarm -->
<!-- TODO: sync -->
<com.android.systemui.statusbar.DateView
<com.android.systemui.statusbar.policy.DateView
android:id="@+id/date"
style="@style/TextAppearance.StatusBar.SystemPanel"
android:layout_width="wrap_content"

View File

@@ -19,7 +19,7 @@
-->
<!-- android:background="@drawable/status_bar_closed_default_background" -->
<com.android.systemui.statusbar.StatusBarView
<com.android.systemui.statusbar.phone.PhoneStatusBarView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui"
android:background="@drawable/status_bar_background"
@@ -33,7 +33,7 @@
android:layout_height="match_parent"
android:orientation="horizontal">
<com.android.systemui.statusbar.IconMerger android:id="@+id/notificationIcons"
<com.android.systemui.statusbar.phone.IconMerger android:id="@+id/notificationIcons"
android:layout_width="0dip"
android:layout_weight="1"
android:layout_height="match_parent"
@@ -50,7 +50,7 @@
android:gravity="center_vertical"
android:orientation="horizontal"/>
<com.android.systemui.statusbar.Clock
<com.android.systemui.statusbar.policy.Clock
android:textAppearance="@*android:style/TextAppearance.StatusBar.Icon"
android:layout_width="wrap_content"
android:layout_height="match_parent"
@@ -82,7 +82,7 @@
android:layout_height="25dip"
/>
</ImageSwitcher>
<com.android.systemui.statusbar.TickerView android:id="@+id/tickerText"
<com.android.systemui.statusbar.phone.TickerView android:id="@+id/tickerText"
android:layout_width="0dip"
android:layout_weight="1"
android:layout_height="wrap_content"
@@ -100,10 +100,10 @@
android:layout_height="wrap_content"
android:singleLine="true"
/>
</com.android.systemui.statusbar.TickerView>
</com.android.systemui.statusbar.phone.TickerView>
</LinearLayout>
<com.android.systemui.statusbar.DateView android:id="@+id/date"
<com.android.systemui.statusbar.policy.DateView android:id="@+id/date"
android:textAppearance="@*android:style/TextAppearance.StatusBar.Icon"
android:layout_width="wrap_content"
android:layout_height="match_parent"
@@ -113,4 +113,4 @@
android:paddingRight="6px"
android:background="@drawable/status_bar_background"
/>
</com.android.systemui.statusbar.StatusBarView>
</com.android.systemui.statusbar.phone.PhoneStatusBarView>

View File

@@ -18,7 +18,7 @@
*/
-->
<com.android.systemui.statusbar.ExpandedView xmlns:android="http://schemas.android.com/apk/res/android"
<com.android.systemui.statusbar.phone.ExpandedView xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:focusable="true"
android:descendantFocusability="afterDescendants"
@@ -33,7 +33,7 @@
android:paddingRight="3dp"
android:background="@drawable/shade_header_background"
>
<com.android.systemui.statusbar.CarrierLabel
<com.android.systemui.statusbar.phone.CarrierLabel
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
@@ -72,7 +72,7 @@
android:layout_height="match_parent"
android:fadingEdge="none"
>
<com.android.systemui.statusbar.NotificationLinearLayout
<LinearLayout
android:id="@+id/notificationLinearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -115,7 +115,7 @@
android:layout_height="wrap_content"
android:orientation="vertical"
/>
</com.android.systemui.statusbar.NotificationLinearLayout>
</LinearLayout>
</ScrollView>
<ImageView
@@ -126,4 +126,4 @@
/>
</FrameLayout>
</com.android.systemui.statusbar.ExpandedView>
</com.android.systemui.statusbar.phone.ExpandedView>

View File

@@ -15,7 +15,7 @@
limitations under the License.
-->
<com.android.systemui.statusbar.TrackingView
<com.android.systemui.statusbar.phone.TrackingView
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:visibility="gone"
@@ -26,13 +26,13 @@
android:paddingRight="0px"
>
<com.android.systemui.statusbar.TrackingPatternView
<com.android.systemui.statusbar.phone.TrackingPatternView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
/>
<com.android.systemui.statusbar.CloseDragHandle android:id="@+id/close"
<com.android.systemui.statusbar.phone.CloseDragHandle android:id="@+id/close"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
@@ -45,6 +45,6 @@
android:src="@drawable/shade_handlebar"
/>
</com.android.systemui.statusbar.CloseDragHandle>
</com.android.systemui.statusbar.phone.CloseDragHandle>
</com.android.systemui.statusbar.TrackingView>
</com.android.systemui.statusbar.phone.TrackingView>

View File

@@ -24,7 +24,7 @@
<!-- Component to be used as the status bar service. Must implement the IStatusBar
interface. This name is in the ComponentName flattened format (package/class) -->
<string name="config_statusBarComponent">com.android.systemui.statusbar.tablet.TabletStatusBarService</string>
<string name="config_statusBarComponent">com.android.systemui.statusbar.tablet.TabletStatusBar</string>
</resources>

View File

@@ -23,13 +23,6 @@
<!-- System panel ("Quick Settings") -->
<!-- Text to display underneath the graphical battery meter. Should
include the word for "battery" and a place for the percentage charge
available. [CHAR LIMIT=20] -->
<string name="system_panel_battery_meter_format">
Battery: <xliff:g id="number">%d</xliff:g><xliff:g id="percent">%%</xliff:g>
</string>
<!-- Text to display underneath the graphical signal strength meter when
no connection is available. [CHAR LIMIT=20] -->
<string name="system_panel_signal_meter_disconnected">
@@ -38,10 +31,9 @@
<!-- Text to display underneath the graphical signal strength meter when
it is displaying information about a connected, named Wi-Fi network.
Should include the word for "Wi-Fi" and a placeholder for the
wireless network's SSID. [CHAR LIMIT=20] -->
[CHAR LIMIT=20] -->
<string name="system_panel_signal_meter_wifi_ssid_format">
Wi-Fi: <xliff:g id="ssid">%s</xliff:g>
<xliff:g id="ssid">%s</xliff:g>
</string>
<!-- Text to display underneath the graphical signal strength meter when

View File

@@ -33,7 +33,7 @@
<!-- Component to be used as the status bar service. Must implement the IStatusBar
interface. This name is in the ComponentName flattened format (package/class) -->
<string name="config_statusBarComponent" translatable="false">com.android.systemui.statusbar.PhoneStatusBarService</string>
<string name="config_statusBarComponent" translatable="false">com.android.systemui.statusbar.phone.PhoneStatusBar</string>
</resources>

View File

@@ -18,7 +18,7 @@
-->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<!-- Name of the status bar as seen in the applications info settings page. [CHAR LIMIT=12] -->
<string name="app_label">Status Bar</string>
<string name="app_label">System UI</string>
<!-- The text for the button in the notification window-shade that clears
all of the currently visible notifications. [CHAR LIMIT=10]-->
@@ -74,6 +74,10 @@
<!-- Name of the button that links to the Settings app. [CHAR LIMIT=NONE] -->
<string name="system_panel_settings_button">Settings</string>
<!-- Text to display next to the graphical battery meter. [CHAR LIMIT=3] -->
<string name="system_panel_battery_meter_format" translatable="false">
<xliff:g id="number">%d</xliff:g><xliff:g id="percent">%%</xliff:g>
</string>
<!-- Recent Tasks dialog: title [CHAR LIMIT=30] -->
<string name="recent_tasks_title">Recent</string>

View File

@@ -39,4 +39,17 @@
<item name="android:textStyle">normal</item>
<item name="android:textColor">#FFFFFFFF</item>
</style>
<style name="Animation" />
<style name="Animation.ShirtPocketPanel">
<item name="android:windowEnterAnimation">@*android:anim/grow_fade_in_from_bottom</item>
<item name="android:windowExitAnimation">@*android:anim/shrink_fade_out_from_bottom</item>
</style>
<style name="Animation.RecentPanel">
<item name="android:windowEnterAnimation">@*android:anim/grow_fade_in_from_bottom</item>
<item name="android:windowExitAnimation">@*android:anim/shrink_fade_out_from_bottom</item>
</style>
</resources>

View File

@@ -34,7 +34,6 @@ import android.view.WindowManagerImpl;
import java.util.ArrayList;
import com.android.internal.statusbar.IStatusBar;
import com.android.internal.statusbar.IStatusBarService;
import com.android.internal.statusbar.StatusBarIcon;
import com.android.internal.statusbar.StatusBarIconList;
@@ -43,8 +42,8 @@ import com.android.internal.statusbar.StatusBarNotification;
import com.android.systemui.SystemUI;
import com.android.systemui.R;
public abstract class StatusBarService extends SystemUI implements CommandQueue.Callbacks {
static final String TAG = "StatusBarService";
public abstract class StatusBar extends SystemUI implements CommandQueue.Callbacks {
static final String TAG = "StatusBar";
private static final boolean SPEW = false;
protected CommandQueue mCommandQueue;

View File

@@ -84,7 +84,7 @@ public class StatusBarIconView extends AnimatedImageView {
if (!iconEquals) {
Drawable drawable = getIcon(icon);
if (drawable == null) {
Slog.w(StatusBarService.TAG, "No icon for slot " + mSlot);
Slog.w(StatusBar.TAG, "No icon for slot " + mSlot);
return false;
}
setImageDrawable(drawable);
@@ -130,7 +130,7 @@ public class StatusBarIconView extends AnimatedImageView {
try {
r = context.getPackageManager().getResourcesForApplication(icon.iconPackage);
} catch (PackageManager.NameNotFoundException ex) {
Slog.e(StatusBarService.TAG, "Icon package not found: " + icon.iconPackage);
Slog.e(StatusBar.TAG, "Icon package not found: " + icon.iconPackage);
return null;
}
} else {
@@ -144,7 +144,7 @@ public class StatusBarIconView extends AnimatedImageView {
try {
return r.getDrawable(icon.iconId);
} catch (RuntimeException e) {
Slog.w(StatusBarService.TAG, "Icon not found in "
Slog.w(StatusBar.TAG, "Icon not found in "
+ (icon.iconPackage != null ? icon.iconId : "<system>")
+ ": " + Integer.toHexString(icon.iconId));
}

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package com.android.systemui.statusbar;
package com.android.systemui.statusbar.phone;
import android.content.BroadcastReceiver;
import android.content.Context;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package com.android.systemui.statusbar;
package com.android.systemui.statusbar.phone;
import android.content.Context;
import android.util.AttributeSet;
@@ -23,7 +23,7 @@ import android.widget.LinearLayout;
public class CloseDragHandle extends LinearLayout {
PhoneStatusBarService mService;
PhoneStatusBar mService;
public CloseDragHandle(Context context, AttributeSet attrs) {
super(context, attrs);

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package com.android.systemui.statusbar;
package com.android.systemui.statusbar.phone;
import android.content.Context;
import android.util.AttributeSet;
@@ -27,7 +27,7 @@ import android.util.Slog;
public class ExpandedView extends LinearLayout {
PhoneStatusBarService mService;
PhoneStatusBar mService;
int mPrevHeight = -1;
public ExpandedView(Context context, AttributeSet attrs) {
@@ -50,10 +50,10 @@ public class ExpandedView extends LinearLayout {
super.onLayout(changed, left, top, right, bottom);
int height = bottom - top;
if (height != mPrevHeight) {
//Slog.d(StatusBarService.TAG, "height changed old=" + mPrevHeight
//Slog.d(StatusBar.TAG, "height changed old=" + mPrevHeight
// + " new=" + height);
mPrevHeight = height;
mService.updateExpandedViewPos(PhoneStatusBarService.EXPANDED_LEAVE_ALONE);
mService.updateExpandedViewPos(PhoneStatusBar.EXPANDED_LEAVE_ALONE);
}
}
}

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package com.android.systemui.statusbar;
package com.android.systemui.statusbar.phone;
import android.content.Context;
import android.os.Handler;
@@ -26,7 +26,7 @@ import android.widget.LinearLayout;
import com.android.internal.statusbar.StatusBarIcon;
import com.android.systemui.R;
import com.android.systemui.statusbar.StatusBarIconView;
public class IconMerger extends LinearLayout {
private static final String TAG = "IconMerger";

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package com.android.systemui.statusbar;
package com.android.systemui.statusbar.phone;
import android.app.Service;
import android.app.ActivityManagerNative;
@@ -66,19 +66,19 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.Set;
import com.android.internal.statusbar.IStatusBar;
import com.android.internal.statusbar.IStatusBarService;
import com.android.internal.statusbar.StatusBarIcon;
import com.android.internal.statusbar.StatusBarIconList;
import com.android.internal.statusbar.StatusBarNotification;
import com.android.systemui.R;
import com.android.systemui.statusbar.policy.StatusBarPolicy;
import com.android.systemui.statusbar.NotificationData;
import com.android.systemui.statusbar.StatusBar;
import com.android.systemui.statusbar.StatusBarIconView;
import com.android.systemui.statusbar.policy.DateView;
public class PhoneStatusBarService extends StatusBarService {
static final String TAG = "PhoneStatusBarService";
public class PhoneStatusBar extends StatusBar {
static final String TAG = "PhoneStatusBar";
static final boolean SPEW = false;
public static final String ACTION_STATUSBAR_START
@@ -95,12 +95,12 @@ public class PhoneStatusBarService extends StatusBarService {
// will likely move to a resource or other tunable param at some point
private static final int INTRUDER_ALERT_DECAY_MS = 10000;
StatusBarPolicy mIconPolicy;
PhoneStatusBarPolicy mIconPolicy;
int mIconSize;
Display mDisplay;
StatusBarView mStatusBarView;
PhoneStatusBarView mStatusBarView;
int mPixelFormat;
H mHandler = new H();
Object mQueueLock = new Object();
@@ -202,7 +202,7 @@ public class PhoneStatusBarService extends StatusBarService {
addIntruderView();
// Lastly, call to the icon policy to install/update all the icons.
mIconPolicy = new StatusBarPolicy(mContext);
mIconPolicy = new PhoneStatusBarPolicy(mContext);
}
// ================================================================================
@@ -223,7 +223,8 @@ public class PhoneStatusBarService extends StatusBarService {
mIntruderAlertView.setVisibility(View.GONE);
mIntruderAlertView.setClickable(true);
StatusBarView sb = (StatusBarView)View.inflate(context, R.layout.status_bar, null);
PhoneStatusBarView sb = (PhoneStatusBarView)View.inflate(context,
R.layout.status_bar, null);
sb.mService = this;
// figure out which pixel-format to use for the status bar.
@@ -1304,7 +1305,6 @@ public class PhoneStatusBarService extends StatusBarService {
}
void setDateViewVisibility(boolean visible, int anim) {
mDateView.setUpdates(visible);
mDateView.setVisibility(visible ? View.VISIBLE : View.INVISIBLE);
mDateView.startAnimation(loadAnim(anim, null));
}

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package com.android.systemui.statusbar.policy;
package com.android.systemui.statusbar.phone;
import android.app.StatusBarManager;
import android.bluetooth.BluetoothAdapter;
@@ -71,8 +71,8 @@ import com.android.systemui.R;
* bar at boot time. It goes through the normal API for icons, even though it probably
* strictly doesn't need to.
*/
public class StatusBarPolicy {
private static final String TAG = "StatusBarPolicy";
public class PhoneStatusBarPolicy {
private static final String TAG = "PhoneStatusBarPolicy";
// message codes for the handler
private static final int EVENT_BATTERY_CLOSE = 4;
@@ -368,7 +368,7 @@ public class StatusBarPolicy {
}
};
public StatusBarPolicy(Context context) {
public PhoneStatusBarPolicy(Context context) {
mContext = context;
mService = (StatusBarManager)context.getSystemService(Context.STATUS_BAR_SERVICE);
mSignalStrength = new SignalStrength();

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package com.android.systemui.statusbar;
package com.android.systemui.statusbar.phone;
import android.content.Context;
import android.content.res.Configuration;
@@ -29,13 +29,14 @@ import android.view.ViewParent;
import android.widget.FrameLayout;
import com.android.systemui.R;
import com.android.systemui.statusbar.policy.FixedSizeDrawable;
public class StatusBarView extends FrameLayout {
private static final String TAG = "StatusBarView";
public class PhoneStatusBarView extends FrameLayout {
private static final String TAG = "PhoneStatusBarView";
static final int DIM_ANIM_TIME = 400;
PhoneStatusBarService mService;
PhoneStatusBar mService;
boolean mTracking;
int mStartX, mStartY;
ViewGroup mNotificationIcons;
@@ -50,7 +51,7 @@ public class StatusBarView extends FrameLayout {
Rect mButtonBounds = new Rect();
boolean mCapturingEvents = true;
public StatusBarView(Context context, AttributeSet attrs) {
public PhoneStatusBarView(Context context, AttributeSet attrs) {
super(context, attrs);
}
@@ -98,7 +99,7 @@ public class StatusBarView extends FrameLayout {
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
mService.updateExpandedViewPos(PhoneStatusBarService.EXPANDED_LEAVE_ALONE);
mService.updateExpandedViewPos(PhoneStatusBar.EXPANDED_LEAVE_ALONE);
}
@Override

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package com.android.systemui.statusbar;
package com.android.systemui.statusbar.phone;
import android.content.Context;
import android.graphics.drawable.Drawable;
@@ -36,7 +36,9 @@ import java.util.ArrayList;
import com.android.internal.statusbar.StatusBarIcon;
import com.android.internal.statusbar.StatusBarNotification;
import com.android.internal.util.CharSequences;
import com.android.systemui.R;
import com.android.systemui.statusbar.StatusBarIconView;
public abstract class Ticker {
private static final int TICKER_SEGMENT_DELAY = 3000;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package com.android.systemui.statusbar;
package com.android.systemui.statusbar.phone;
import android.content.Context;
import android.util.AttributeSet;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package com.android.systemui.statusbar;
package com.android.systemui.statusbar.phone;
import android.content.Context;
import android.content.res.TypedArray;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package com.android.systemui.statusbar;
package com.android.systemui.statusbar.phone;
import android.content.Context;
import android.util.AttributeSet;
@@ -26,7 +26,7 @@ import android.widget.LinearLayout;
public class TrackingView extends LinearLayout {
final Display mDisplay;
PhoneStatusBarService mService;
PhoneStatusBar mService;
boolean mTracking;
int mStartX, mStartY;

View File

@@ -0,0 +1,74 @@
/*
* Copyright (C) 2010 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.systemui.statusbar.policy;
import java.util.ArrayList;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.BatteryManager;
import android.util.Slog;
import android.widget.ImageView;
import android.widget.TextView;
import com.android.systemui.R;
public class BatteryController extends BroadcastReceiver {
private static final String TAG = "StatusBar.BatteryController";
private Context mContext;
private ArrayList<ImageView> mIconViews = new ArrayList<ImageView>();
private ArrayList<TextView> mLabelViews = new ArrayList<TextView>();
public BatteryController(Context context) {
mContext = context;
IntentFilter filter = new IntentFilter();
filter.addAction(Intent.ACTION_BATTERY_CHANGED);
context.registerReceiver(this, filter);
}
public void addIconView(ImageView v) {
mIconViews.add(v);
}
public void addLabelView(TextView v) {
mLabelViews.add(v);
}
public void onReceive(Context context, Intent intent) {
final String action = intent.getAction();
if (action.equals(Intent.ACTION_BATTERY_CHANGED)) {
final int level = intent.getIntExtra(BatteryManager.EXTRA_LEVEL, 0);
int N = mIconViews.size();
for (int i=0; i<N; i++) {
final int icon = intent.getIntExtra(BatteryManager.EXTRA_ICON_SMALL, 0);
ImageView v = mIconViews.get(i);
v.setImageResource(icon);
v.setImageLevel(level);
}
N = mLabelViews.size();
for (int i=0; i<N; i++) {
//final boolean plugged = intent.getIntExtra(BatteryManager.EXTRA_PLUGGED, 0) != 0;
TextView v = mLabelViews.get(i);
v.setText(mContext.getString(R.string.system_panel_battery_meter_format, level));
}
}
}
}

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package com.android.systemui.statusbar;
package com.android.systemui.statusbar.policy;
import android.content.BroadcastReceiver;
import android.content.Context;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package com.android.systemui.statusbar;
package com.android.systemui.statusbar.policy;
import android.content.BroadcastReceiver;
import android.content.Context;
@@ -24,6 +24,8 @@ import android.util.AttributeSet;
import android.util.Slog;
import android.widget.TextView;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewParent;
import java.text.DateFormat;
import java.util.Date;
@@ -31,7 +33,9 @@ import java.util.Date;
public final class DateView extends TextView {
private static final String TAG = "DateView";
private boolean mUpdating = false;
private boolean mAttachedToWindow;
private boolean mWindowVisible;
private boolean mUpdating;
private BroadcastReceiver mIntentReceiver = new BroadcastReceiver() {
@Override
@@ -51,12 +55,28 @@ public final class DateView extends TextView {
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
mAttachedToWindow = true;
setUpdates();
}
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
setUpdates(false);
mAttachedToWindow = false;
setUpdates();
}
@Override
protected void onWindowVisibilityChanged(int visibility) {
super.onWindowVisibilityChanged(visibility);
mWindowVisible = visibility == VISIBLE;
setUpdates();
}
@Override
protected void onVisibilityChanged(View changedView, int visibility) {
super.onVisibilityChanged(changedView, visibility);
setUpdates();
}
@Override
@@ -67,10 +87,26 @@ public final class DateView extends TextView {
private final void updateClock() {
Date now = new Date();
setText(DateFormat.getDateInstance(DateFormat.LONG).format(now));
setText(DateFormat.getDateInstance(DateFormat.FULL).format(now));
}
public void setUpdates(boolean update) {
private boolean isVisible() {
View v = this;
while (true) {
if (v.getVisibility() != VISIBLE) {
return false;
}
final ViewParent parent = v.getParent();
if (parent instanceof View) {
v = (View)parent;
} else {
return true;
}
}
}
private void setUpdates() {
boolean update = mAttachedToWindow && mWindowVisible && isVisible();
if (update != mUpdating) {
mUpdating = update;
if (update) {

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package com.android.systemui.statusbar;
package com.android.systemui.statusbar.policy;
import android.graphics.drawable.Drawable;
import android.graphics.Canvas;
@@ -22,14 +22,14 @@ import android.graphics.ColorFilter;
import android.graphics.Rect;
import android.util.Slog;
class FixedSizeDrawable extends Drawable {
public class FixedSizeDrawable extends Drawable {
Drawable mDrawable;
int mLeft;
int mTop;
int mRight;
int mBottom;
FixedSizeDrawable(Drawable that) {
public FixedSizeDrawable(Drawable that) {
mDrawable = that;
}

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package com.android.systemui.statusbar;
package com.android.systemui.statusbar.policy;
import android.content.Context;
import android.content.res.TypedArray;
@@ -37,6 +37,8 @@ import android.widget.RemoteViews.RemoteView;
import com.android.systemui.R;
public class KeyButtonView extends ImageView {
private static final String TAG = "StatusBar.KeyButtonView";
IWindowManager mWindowManager;
long mDownTime;
boolean mSending, mLongPressed;
@@ -68,8 +70,7 @@ public class KeyButtonView extends ImageView {
mCode = a.getInteger(R.styleable.KeyButtonView_keyCode, 0);
if (mCode == 0) {
Slog.w(StatusBarService.TAG, "KeyButtonView without key code id=0x"
+ Integer.toHexString(getId()));
Slog.w(TAG, "KeyButtonView without key code id=0x" + Integer.toHexString(getId()));
}
a.recycle();
@@ -132,7 +133,7 @@ public class KeyButtonView extends ImageView {
final KeyEvent ev = new KeyEvent(mDownTime, when, action, mCode, mRepeat,
0, 0, 0, flags, InputDevice.SOURCE_KEYBOARD);
try {
//Slog.d(StatusBarService.TAG, "injecting event " + ev);
//Slog.d(TAG, "injecting event " + ev);
mWindowManager.injectInputEventNoWait(ev);
} catch (RemoteException ex) {
// System process is dead

View File

@@ -0,0 +1,623 @@
/*
* Copyright (C) 2010 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.systemui.statusbar.policy;
import java.util.ArrayList;
import java.util.List;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.wifi.SupplicantState;
import android.net.wifi.WifiConfiguration;
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
import android.os.Binder;
import android.os.RemoteException;
import android.provider.Settings;
import android.telephony.PhoneStateListener;
import android.telephony.ServiceState;
import android.telephony.SignalStrength;
import android.telephony.TelephonyManager;
import android.util.Slog;
import android.widget.ImageView;
import android.widget.TextView;
import com.android.internal.app.IBatteryStats;
import com.android.internal.telephony.IccCard;
import com.android.internal.telephony.TelephonyIntents;
import com.android.internal.telephony.cdma.EriInfo;
import com.android.server.am.BatteryStatsService;
import com.android.systemui.R;
public class NetworkController extends BroadcastReceiver {
// debug
static final String TAG = "StatusBar.NetworkController";
static final boolean DEBUG = false;
// telephony
boolean mHspaDataDistinguishable;
final TelephonyManager mPhone;
boolean mDataConnected;
int mPhoneSignalIconId;
int mDataIconId;
IccCard.State mSimState = IccCard.State.READY;
int mPhoneState = TelephonyManager.CALL_STATE_IDLE;
int mDataState = TelephonyManager.DATA_DISCONNECTED;
int mDataActivity = TelephonyManager.DATA_ACTIVITY_NONE;
ServiceState mServiceState;
SignalStrength mSignalStrength;
int[] mDataIconList = TelephonyIcons.DATA_G[0];
// wifi
final WifiManager mWifiManager;
boolean mWifiEnabled, mWifiConnected;
int mWifiLevel;
String mWifiSsid;
int mWifiIconId;
// data connectivity (regardless of state, can we access the internet?)
// state of inet connection - 0 not connected, 100 connected
private int mInetCondition = 0;
private static final int INET_CONDITION_THRESHOLD = 50;
// our ui
Context mContext;
ArrayList<ImageView> mPhoneIconViews = new ArrayList<ImageView>();
ArrayList<ImageView> mDataIconViews = new ArrayList<ImageView>();
ArrayList<TextView> mLabelViews = new ArrayList<TextView>();
int mLastPhoneSignalIconId = -1;
int mLastCombinedDataIconId = -1;
String mLastLabel = "";
// yuck -- stop doing this here and put it in the framework
IBatteryStats mBatteryStats;
/**
* Construct this controller object and register for updates.
*/
public NetworkController(Context context) {
mContext = context;
// telephony
mPhone = (TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE);
mPhone.listen(mPhoneStateListener,
PhoneStateListener.LISTEN_SERVICE_STATE
| PhoneStateListener.LISTEN_SIGNAL_STRENGTHS
| PhoneStateListener.LISTEN_CALL_STATE
| PhoneStateListener.LISTEN_DATA_CONNECTION_STATE
| PhoneStateListener.LISTEN_DATA_ACTIVITY);
mHspaDataDistinguishable = mContext.getResources().getBoolean(
R.bool.config_hspa_data_distinguishable);
// wifi
mWifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
// broadcasts
IntentFilter filter = new IntentFilter();
filter.addAction(WifiManager.RSSI_CHANGED_ACTION);
filter.addAction(WifiManager.WIFI_STATE_CHANGED_ACTION);
filter.addAction(WifiManager.SUPPLICANT_STATE_CHANGED_ACTION);
filter.addAction(WifiManager.NETWORK_STATE_CHANGED_ACTION);
filter.addAction(TelephonyIntents.ACTION_SIM_STATE_CHANGED);
context.registerReceiver(this, filter);
// yuck
mBatteryStats = BatteryStatsService.getService();
}
public void addPhoneIconView(ImageView v) {
mPhoneIconViews.add(v);
}
public void addCombinedDataIconView(ImageView v) {
mDataIconViews.add(v);
}
public void addLabelView(TextView v) {
mLabelViews.add(v);
}
public void onReceive(Context context, Intent intent) {
final String action = intent.getAction();
if (action.equals(WifiManager.RSSI_CHANGED_ACTION)
|| action.equals(WifiManager.WIFI_STATE_CHANGED_ACTION)
|| action.equals(WifiManager.SUPPLICANT_STATE_CHANGED_ACTION)
|| action.equals(WifiManager.NETWORK_STATE_CHANGED_ACTION)) {
updateWifiState(intent);
refreshViews();
} else if (action.equals(TelephonyIntents.ACTION_SIM_STATE_CHANGED)) {
updateSimState(intent);
updateDataIcon();
refreshViews();
} else if (action.equals(ConnectivityManager.CONNECTIVITY_ACTION) ||
action.equals(ConnectivityManager.INET_CONDITION_ACTION)) {
updateConnectivity(intent);
refreshViews();
}
}
// ===== Telephony ==============================================================
PhoneStateListener mPhoneStateListener = new PhoneStateListener() {
@Override
public void onSignalStrengthsChanged(SignalStrength signalStrength) {
if (DEBUG) {
Slog.d(TAG, "onSignalStrengthsChanged signalStrength=" + signalStrength);
}
mSignalStrength = signalStrength;
updateTelephonySignalStrength();
refreshViews();
}
@Override
public void onServiceStateChanged(ServiceState state) {
if (DEBUG) {
Slog.d(TAG, "onServiceStateChanged state=" + state.getState());
}
mServiceState = state;
updateTelephonySignalStrength();
updateDataIcon();
refreshViews();
}
@Override
public void onCallStateChanged(int state, String incomingNumber) {
if (DEBUG) {
Slog.d(TAG, "onCallStateChanged state=" + state);
}
// In cdma, if a voice call is made, RSSI should switch to 1x.
if (isCdma()) {
updateTelephonySignalStrength();
refreshViews();
}
}
@Override
public void onDataConnectionStateChanged(int state, int networkType) {
if (DEBUG) {
Slog.d(TAG, "onDataConnectionStateChanged: state=" + state
+ " type=" + networkType);
}
mDataState = state;
updateDataNetType(networkType);
updateDataIcon();
refreshViews();
}
@Override
public void onDataActivity(int direction) {
if (DEBUG) {
Slog.d(TAG, "onDataActivity: direction=" + direction);
}
mDataActivity = direction;
updateDataIcon();
refreshViews();
}
};
private final void updateSimState(Intent intent) {
String stateExtra = intent.getStringExtra(IccCard.INTENT_KEY_ICC_STATE);
if (IccCard.INTENT_VALUE_ICC_ABSENT.equals(stateExtra)) {
mSimState = IccCard.State.ABSENT;
}
else if (IccCard.INTENT_VALUE_ICC_READY.equals(stateExtra)) {
mSimState = IccCard.State.READY;
}
else if (IccCard.INTENT_VALUE_ICC_LOCKED.equals(stateExtra)) {
final String lockedReason = intent.getStringExtra(IccCard.INTENT_KEY_LOCKED_REASON);
if (IccCard.INTENT_VALUE_LOCKED_ON_PIN.equals(lockedReason)) {
mSimState = IccCard.State.PIN_REQUIRED;
}
else if (IccCard.INTENT_VALUE_LOCKED_ON_PUK.equals(lockedReason)) {
mSimState = IccCard.State.PUK_REQUIRED;
}
else {
mSimState = IccCard.State.NETWORK_LOCKED;
}
} else {
mSimState = IccCard.State.UNKNOWN;
}
}
private boolean isCdma() {
return (mSignalStrength != null) && !mSignalStrength.isGsm();
}
private boolean isEvdo() {
return ((mServiceState != null)
&& ((mServiceState.getRadioTechnology() == ServiceState.RADIO_TECHNOLOGY_EVDO_0)
|| (mServiceState.getRadioTechnology() == ServiceState.RADIO_TECHNOLOGY_EVDO_A)
|| (mServiceState.getRadioTechnology() == ServiceState.RADIO_TECHNOLOGY_EVDO_B)));
}
private boolean hasService() {
if (mServiceState != null) {
switch (mServiceState.getState()) {
case ServiceState.STATE_OUT_OF_SERVICE:
case ServiceState.STATE_POWER_OFF:
return false;
default:
return true;
}
} else {
return false;
}
}
private int getCdmaLevel() {
if (mSignalStrength == null) return 0;
final int cdmaDbm = mSignalStrength.getCdmaDbm();
final int cdmaEcio = mSignalStrength.getCdmaEcio();
int levelDbm = 0;
int levelEcio = 0;
if (cdmaDbm >= -75) levelDbm = 4;
else if (cdmaDbm >= -85) levelDbm = 3;
else if (cdmaDbm >= -95) levelDbm = 2;
else if (cdmaDbm >= -100) levelDbm = 1;
else levelDbm = 0;
// Ec/Io are in dB*10
if (cdmaEcio >= -90) levelEcio = 4;
else if (cdmaEcio >= -110) levelEcio = 3;
else if (cdmaEcio >= -130) levelEcio = 2;
else if (cdmaEcio >= -150) levelEcio = 1;
else levelEcio = 0;
return (levelDbm < levelEcio) ? levelDbm : levelEcio;
}
private int getEvdoLevel() {
if (mSignalStrength == null) return 0;
int evdoDbm = mSignalStrength.getEvdoDbm();
int evdoSnr = mSignalStrength.getEvdoSnr();
int levelEvdoDbm = 0;
int levelEvdoSnr = 0;
if (evdoDbm >= -65) levelEvdoDbm = 4;
else if (evdoDbm >= -75) levelEvdoDbm = 3;
else if (evdoDbm >= -90) levelEvdoDbm = 2;
else if (evdoDbm >= -105) levelEvdoDbm = 1;
else levelEvdoDbm = 0;
if (evdoSnr >= 7) levelEvdoSnr = 4;
else if (evdoSnr >= 5) levelEvdoSnr = 3;
else if (evdoSnr >= 3) levelEvdoSnr = 2;
else if (evdoSnr >= 1) levelEvdoSnr = 1;
else levelEvdoSnr = 0;
return (levelEvdoDbm < levelEvdoSnr) ? levelEvdoDbm : levelEvdoSnr;
}
private final void updateTelephonySignalStrength() {
// Display signal strength while in "emergency calls only" mode
if (mServiceState == null || (!hasService() && !mServiceState.isEmergencyOnly())) {
//Slog.d(TAG, "updateTelephonySignalStrength: no service");
if (Settings.System.getInt(mContext.getContentResolver(),
Settings.System.AIRPLANE_MODE_ON, 0) == 1) {
mPhoneSignalIconId = R.drawable.stat_sys_signal_flightmode;
} else {
mPhoneSignalIconId = R.drawable.stat_sys_signal_null;
}
} else {
if (isCdma()) {
// If 3G(EV) and 1x network are available than 3G should be
// displayed, displayed RSSI should be from the EV side.
// If a voice call is made then RSSI should switch to 1x.
int iconLevel;
if ((mPhoneState == TelephonyManager.CALL_STATE_IDLE) && isEvdo()){
iconLevel = getEvdoLevel();
} else {
iconLevel = getCdmaLevel();
}
int[] iconList;
if (isCdmaEri()) {
iconList = TelephonyIcons.TELEPHONY_SIGNAL_STRENGTH_ROAMING[mInetCondition];
} else {
iconList = TelephonyIcons.TELEPHONY_SIGNAL_STRENGTH[mInetCondition];
}
mPhoneSignalIconId = iconList[iconLevel];
} else {
int asu = mSignalStrength.getGsmSignalStrength();
// ASU ranges from 0 to 31 - TS 27.007 Sec 8.5
// asu = 0 (-113dB or less) is very weak
// signal, its better to show 0 bars to the user in such cases.
// asu = 99 is a special case, where the signal strength is unknown.
int iconLevel;
if (asu <= 2 || asu == 99) iconLevel = 0;
else if (asu >= 12) iconLevel = 4;
else if (asu >= 8) iconLevel = 3;
else if (asu >= 5) iconLevel = 2;
else iconLevel = 1;
// Though mPhone is a Manager, this call is not an IPC
int[] iconList;
if (mPhone.isNetworkRoaming()) {
iconList = TelephonyIcons.TELEPHONY_SIGNAL_STRENGTH_ROAMING[mInetCondition];
} else {
iconList = TelephonyIcons.TELEPHONY_SIGNAL_STRENGTH[mInetCondition];
}
mPhoneSignalIconId = iconList[iconLevel];
}
}
}
private final void updateDataNetType(int net) {
switch (net) {
case TelephonyManager.NETWORK_TYPE_EDGE:
mDataIconList = TelephonyIcons.DATA_E[mInetCondition];
break;
case TelephonyManager.NETWORK_TYPE_UMTS:
mDataIconList = TelephonyIcons.DATA_3G[mInetCondition];
break;
case TelephonyManager.NETWORK_TYPE_HSDPA:
case TelephonyManager.NETWORK_TYPE_HSUPA:
case TelephonyManager.NETWORK_TYPE_HSPA:
if (mHspaDataDistinguishable) {
mDataIconList = TelephonyIcons.DATA_H[mInetCondition];
} else {
mDataIconList = TelephonyIcons.DATA_3G[mInetCondition];
}
break;
case TelephonyManager.NETWORK_TYPE_CDMA:
// display 1xRTT for IS95A/B
mDataIconList = TelephonyIcons.DATA_1X[mInetCondition];
break;
case TelephonyManager.NETWORK_TYPE_1xRTT:
mDataIconList = TelephonyIcons.DATA_1X[mInetCondition];
break;
case TelephonyManager.NETWORK_TYPE_EVDO_0: //fall through
case TelephonyManager.NETWORK_TYPE_EVDO_A:
case TelephonyManager.NETWORK_TYPE_EVDO_B:
mDataIconList = TelephonyIcons.DATA_3G[mInetCondition];
break;
// TODO - add support for NETWORK_TYPE_LTE and NETWORK_TYPE_EHRPD
default:
mDataIconList = TelephonyIcons.DATA_G[mInetCondition];
break;
}
}
boolean isCdmaEri() {
final int iconIndex = mServiceState.getCdmaEriIconIndex();
if (iconIndex != EriInfo.ROAMING_INDICATOR_OFF) {
final int iconMode = mServiceState.getCdmaEriIconMode();
if (iconMode == EriInfo.ROAMING_ICON_MODE_NORMAL
|| iconMode == EriInfo.ROAMING_ICON_MODE_FLASH) {
return true;
}
}
return false;
}
private final void updateDataIcon() {
int iconId;
boolean visible = true;
if (!isCdma()) {
// GSM case, we have to check also the sim state
if (mSimState == IccCard.State.READY || mSimState == IccCard.State.UNKNOWN) {
if (hasService() && mDataState == TelephonyManager.DATA_CONNECTED) {
switch (mDataActivity) {
case TelephonyManager.DATA_ACTIVITY_IN:
iconId = mDataIconList[1];
break;
case TelephonyManager.DATA_ACTIVITY_OUT:
iconId = mDataIconList[2];
break;
case TelephonyManager.DATA_ACTIVITY_INOUT:
iconId = mDataIconList[3];
break;
default:
iconId = mDataIconList[0];
break;
}
mDataIconId = iconId;
} else {
iconId = 0;
visible = false;
}
} else {
iconId = R.drawable.stat_sys_no_sim;
}
} else {
// CDMA case, mDataActivity can be also DATA_ACTIVITY_DORMANT
if (hasService() && mDataState == TelephonyManager.DATA_CONNECTED) {
switch (mDataActivity) {
case TelephonyManager.DATA_ACTIVITY_IN:
iconId = mDataIconList[1];
break;
case TelephonyManager.DATA_ACTIVITY_OUT:
iconId = mDataIconList[2];
break;
case TelephonyManager.DATA_ACTIVITY_INOUT:
iconId = mDataIconList[3];
break;
case TelephonyManager.DATA_ACTIVITY_DORMANT:
default:
iconId = mDataIconList[0];
break;
}
} else {
iconId = 0;
visible = false;
}
}
// yuck - this should NOT be done by the status bar
long ident = Binder.clearCallingIdentity();
try {
mBatteryStats.notePhoneDataConnectionState(mPhone.getNetworkType(), visible);
} catch (RemoteException e) {
} finally {
Binder.restoreCallingIdentity(ident);
}
mDataIconId = iconId;
mDataConnected = visible;
}
// ===== Wifi ===================================================================
private void updateWifiState(Intent intent) {
final String action = intent.getAction();
if (action.equals(WifiManager.WIFI_STATE_CHANGED_ACTION)) {
mWifiEnabled = intent.getIntExtra(WifiManager.EXTRA_WIFI_STATE,
WifiManager.WIFI_STATE_UNKNOWN) == WifiManager.WIFI_STATE_ENABLED;
} else if (action.equals(WifiManager.NETWORK_STATE_CHANGED_ACTION)
|| action.equals(WifiManager.SUPPLICANT_STATE_CHANGED_ACTION)) {
final NetworkInfo networkInfo = (NetworkInfo)
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) {
WifiInfo info = mWifiManager.getConnectionInfo();
if (info != null) {
mWifiLevel = WifiManager.calculateSignalLevel(info.getRssi(), 101);
mWifiSsid = huntForSsid(info);
} else {
mWifiLevel = 0;
mWifiSsid = null;
}
} else if (!mWifiConnected) {
mWifiLevel = 0;
mWifiSsid = null;
}
} else if (action.equals(WifiManager.RSSI_CHANGED_ACTION)) {
if (mWifiConnected) {
final int newRssi = intent.getIntExtra(WifiManager.EXTRA_NEW_RSSI, -200);
mWifiLevel = WifiManager.calculateSignalLevel(newRssi, 101);
}
}
updateWifiIcons();
}
private void updateWifiIcons() {
if (mWifiConnected) {
mWifiIconId = WifiIcons.WIFI_SIGNAL_STRENGTH[mInetCondition][mWifiLevel];
} else {
mWifiIconId = WifiIcons.WIFI_SIGNAL_STRENGTH[0][0];
}
}
private String huntForSsid(WifiInfo info) {
String ssid = info.getSSID();
if (ssid != null) {
return ssid;
}
// OK, it's not in the connectionInfo; we have to go hunting for it
List<WifiConfiguration> networks = mWifiManager.getConfiguredNetworks();
for (WifiConfiguration net : networks) {
if (net.networkId == info.getNetworkId()) {
return net.SSID;
}
}
return null;
}
// ===== Full or limited Internet connectivity ==================================
private void updateConnectivity(Intent intent) {
NetworkInfo info = (NetworkInfo)(intent.getParcelableExtra(
ConnectivityManager.EXTRA_NETWORK_INFO));
int connectionStatus = intent.getIntExtra(ConnectivityManager.EXTRA_INET_CONDITION, 0);
int inetCondition = (connectionStatus > INET_CONDITION_THRESHOLD ? 1 : 0);
switch (info.getType()) {
case ConnectivityManager.TYPE_MOBILE:
mInetCondition = inetCondition;
updateDataNetType(info.getSubtype());
updateDataIcon();
updateTelephonySignalStrength(); // apply any change in connectionStatus
break;
case ConnectivityManager.TYPE_WIFI:
mInetCondition = inetCondition;
updateWifiIcons();
break;
}
}
// ===== Update the views =======================================================
// figure out what to show: first wifi, then 3G, then nothing
void refreshViews() {
Context context = mContext;
int combinedDataIconId;
String label;
if (mWifiConnected) {
if (mWifiSsid == null) {
label = context.getString(R.string.system_panel_signal_meter_wifi_nossid);
} else {
label = context.getString(R.string.system_panel_signal_meter_wifi_ssid_format,
mWifiSsid);
}
combinedDataIconId = mWifiIconId;
} else if (mDataConnected) {
label = context.getString(R.string.system_panel_signal_meter_data_connected);
combinedDataIconId = mDataIconId;
} else {
label = context.getString(R.string.system_panel_signal_meter_disconnected);
combinedDataIconId = 0;
}
int N;
if (mLastPhoneSignalIconId != mPhoneSignalIconId) {
mLastPhoneSignalIconId = mPhoneSignalIconId;
N = mPhoneIconViews.size();
for (int i=0; i<N; i++) {
ImageView v = mPhoneIconViews.get(i);
v.setImageResource(mPhoneSignalIconId);
}
}
if (mLastCombinedDataIconId != combinedDataIconId) {
mLastCombinedDataIconId = combinedDataIconId;
N = mDataIconViews.size();
for (int i=0; i<N; i++) {
ImageView v = mDataIconViews.get(i);
v.setImageResource(combinedDataIconId);
}
}
if (!mLastLabel.equals(label)) {
mLastLabel = label;
N = mLabelViews.size();
for (int i=0; i<N; i++) {
TextView v = mLabelViews.get(i);
v.setText(label);
}
}
}
}

View File

@@ -0,0 +1,113 @@
/*
* Copyright (C) 2008 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.systemui.statusbar.policy;
import com.android.systemui.R;
class TelephonyIcons {
//***** Signal strength icons
//GSM/UMTS
static final int[][] TELEPHONY_SIGNAL_STRENGTH = {
{ R.drawable.stat_sys_signal_0,
R.drawable.stat_sys_signal_1,
R.drawable.stat_sys_signal_2,
R.drawable.stat_sys_signal_3,
R.drawable.stat_sys_signal_4 },
{ R.drawable.stat_sys_signal_0_fully,
R.drawable.stat_sys_signal_1_fully,
R.drawable.stat_sys_signal_2_fully,
R.drawable.stat_sys_signal_3_fully,
R.drawable.stat_sys_signal_4_fully }
};
static final int[][] TELEPHONY_SIGNAL_STRENGTH_ROAMING = {
{ R.drawable.stat_sys_r_signal_0,
R.drawable.stat_sys_r_signal_1,
R.drawable.stat_sys_r_signal_2,
R.drawable.stat_sys_r_signal_3,
R.drawable.stat_sys_r_signal_4 },
{ R.drawable.stat_sys_r_signal_0_fully,
R.drawable.stat_sys_r_signal_1_fully,
R.drawable.stat_sys_r_signal_2_fully,
R.drawable.stat_sys_r_signal_3_fully,
R.drawable.stat_sys_r_signal_4_fully }
};
//***** Data connection icons
//GSM/UMTS
static final int[][] DATA_G = {
{ R.drawable.stat_sys_data_connected_g,
R.drawable.stat_sys_data_in_g,
R.drawable.stat_sys_data_out_g,
R.drawable.stat_sys_data_inandout_g },
{ R.drawable.stat_sys_data_fully_connected_g,
R.drawable.stat_sys_data_fully_in_g,
R.drawable.stat_sys_data_fully_out_g,
R.drawable.stat_sys_data_fully_inandout_g }
};
static final int[][] DATA_3G = {
{ R.drawable.stat_sys_data_connected_3g,
R.drawable.stat_sys_data_in_3g,
R.drawable.stat_sys_data_out_3g,
R.drawable.stat_sys_data_inandout_3g },
{ R.drawable.stat_sys_data_fully_connected_3g,
R.drawable.stat_sys_data_fully_in_3g,
R.drawable.stat_sys_data_fully_out_3g,
R.drawable.stat_sys_data_fully_inandout_3g }
};
static final int[][] DATA_E = {
{ R.drawable.stat_sys_data_connected_e,
R.drawable.stat_sys_data_in_e,
R.drawable.stat_sys_data_out_e,
R.drawable.stat_sys_data_inandout_e },
{ R.drawable.stat_sys_data_fully_connected_e,
R.drawable.stat_sys_data_fully_in_e,
R.drawable.stat_sys_data_fully_out_e,
R.drawable.stat_sys_data_fully_inandout_e }
};
//3.5G
static final int[][] DATA_H = {
{ R.drawable.stat_sys_data_connected_h,
R.drawable.stat_sys_data_in_h,
R.drawable.stat_sys_data_out_h,
R.drawable.stat_sys_data_inandout_h },
{ R.drawable.stat_sys_data_fully_connected_h,
R.drawable.stat_sys_data_fully_in_h,
R.drawable.stat_sys_data_fully_out_h,
R.drawable.stat_sys_data_fully_inandout_h }
};
//CDMA
// Use 3G icons for EVDO data and 1x icons for 1XRTT data
static final int[][] DATA_1X = {
{ R.drawable.stat_sys_data_connected_1x,
R.drawable.stat_sys_data_in_1x,
R.drawable.stat_sys_data_out_1x,
R.drawable.stat_sys_data_inandout_1x },
{ R.drawable.stat_sys_data_fully_connected_1x,
R.drawable.stat_sys_data_fully_in_1x,
R.drawable.stat_sys_data_fully_out_1x,
R.drawable.stat_sys_data_fully_inandout_1x }
};
}

View File

@@ -14,16 +14,19 @@
* limitations under the License.
*/
package com.android.systemui.statusbar;
package com.android.systemui.statusbar.policy;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.LinearLayout;
import com.android.systemui.R;
public class NotificationLinearLayout extends LinearLayout {
public NotificationLinearLayout(Context context, AttributeSet attrs) {
super(context, attrs);
}
class WifiIcons {
static final int[][] WIFI_SIGNAL_STRENGTH = {
{ R.drawable.stat_sys_wifi_signal_1,
R.drawable.stat_sys_wifi_signal_2,
R.drawable.stat_sys_wifi_signal_3,
R.drawable.stat_sys_wifi_signal_4 },
{ R.drawable.stat_sys_wifi_signal_1_fully,
R.drawable.stat_sys_wifi_signal_2_fully,
R.drawable.stat_sys_wifi_signal_3_fully,
R.drawable.stat_sys_wifi_signal_4_fully }
};
}

View File

@@ -17,11 +17,14 @@
package com.android.systemui.statusbar.tablet;
import android.content.Context;
import android.widget.LinearLayout;
import android.util.AttributeSet;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
public class NotificationPanel extends LinearLayout implements StatusBarPanel {
import com.android.systemui.R;
public class NotificationPanel extends RelativeLayout implements StatusBarPanel {
public NotificationPanel(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}

View File

@@ -45,11 +45,11 @@ import com.android.systemui.R;
public class RecentAppsPanel extends LinearLayout implements StatusBarPanel, OnClickListener {
private static final String TAG = "RecentAppsPanel";
private static final boolean DEBUG = TabletStatusBarService.DEBUG;
private static final boolean DEBUG = TabletStatusBar.DEBUG;
private static final int DISPLAY_TASKS = 4; // number of recent tasks to display
private static final int MAX_TASKS = 2 * DISPLAY_TASKS; // give some slack for non-apps
private static final boolean DBG = true;
private TabletStatusBarService mBar;
private TabletStatusBar mBar;
private TextView mNoRecents;
private LinearLayout mRecentsContainer;
private ArrayList<ActivityDescription> mActivityDescriptions;
@@ -100,7 +100,7 @@ public class RecentAppsPanel extends LinearLayout implements StatusBarPanel, OnC
return x >= l && x < r && y >= t && y < b;
}
public void setBar(TabletStatusBarService bar) {
public void setBar(TabletStatusBar bar) {
mBar = bar;
}

View File

@@ -206,7 +206,7 @@ public class ShirtPocket extends FrameLayout {
// lp.x = pos[1];
// lp.y = 0;
lp.setTitle("ShirtPocket");
lp.windowAnimations = com.android.internal.R.style.Animation_SlidingCard;
lp.windowAnimations = R.style.Animation_ShirtPocketPanel;
WindowManagerImpl.getDefault().addView(mWindow, lp);

View File

@@ -16,60 +16,31 @@
package com.android.systemui.statusbar.tablet;
import android.app.Notification;
import android.app.PendingIntent;
import android.app.Service;
import android.app.StatusBarManager;
import android.bluetooth.BluetoothAdapter;
import android.content.BroadcastReceiver;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.res.Resources;
import android.graphics.PixelFormat;
import android.graphics.Rect;
import android.location.LocationManager;
import android.media.AudioManager;
import android.net.NetworkInfo;
import android.net.wifi.SupplicantState;
import android.net.wifi.WifiConfiguration;
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
import android.os.AsyncTask;
import android.os.Handler;
import android.os.IBinder;
import android.telephony.PhoneStateListener;
import android.telephony.ServiceState;
import android.os.IPowerManager;
import android.os.Message;
import android.os.RemoteException;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.provider.Settings;
import android.telephony.PhoneStateListener;
import android.telephony.ServiceState;
import android.telephony.SignalStrength;
import android.telephony.TelephonyManager;
import android.util.AttributeSet;
import android.util.Slog;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.IWindowManager;
import android.view.WindowManager;
import android.view.WindowManagerImpl;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RemoteViews;
import android.widget.ScrollView;
import android.widget.TextSwitcher;
import android.widget.TextView;
import android.widget.Toast;
import java.util.List;
import com.android.internal.telephony.IccCard;
import com.android.internal.telephony.TelephonyIntents;
import com.android.internal.telephony.cdma.EriInfo;
@@ -82,14 +53,13 @@ import com.android.systemui.R;
public class SystemPanel extends LinearLayout implements StatusBarPanel {
private static final String TAG = "SystemPanel";
private static final boolean DEBUG = TabletStatusBarService.DEBUG;
private static final boolean DEBUG_SIGNAL = false;
private static final boolean DEBUG = TabletStatusBar.DEBUG;
private static final int MINIMUM_BACKLIGHT = android.os.Power.BRIGHTNESS_DIM + 5;
private static final int MAXIMUM_BACKLIGHT = android.os.Power.BRIGHTNESS_ON;
private static final int DEFAULT_BACKLIGHT = (int) (android.os.Power.BRIGHTNESS_ON * 0.4f);
private TabletStatusBarService mBar;
private TabletStatusBar mBar;
private boolean mAirplaneMode;
private ImageButton mBrightnessButton;
@@ -99,34 +69,11 @@ public class SystemPanel extends LinearLayout implements StatusBarPanel {
private ImageButton mGpsButton;
private ImageButton mBluetoothButton;
private ImageView mBatteryMeter;
private ImageView mSignalMeter;
private TextView mBatteryText;
private TextView mSignalText;
private final IWindowManager mWM;
private final AudioManager mAudioManager;
private final WifiManager mWifiManager;
private final TelephonyManager mPhone;
private final BluetoothAdapter mBluetoothAdapter;
// state trackers for telephony code
IccCard.State mSimState = IccCard.State.READY;
int mPhoneState = TelephonyManager.CALL_STATE_IDLE;
int mDataState = TelephonyManager.DATA_DISCONNECTED;
ServiceState mServiceState;
SignalStrength mSignalStrength;
// state for the meters
boolean mWifiEnabled, mWifiConnected;
int mWifiLevel;
String mWifiSsid;
boolean mDataEnabled, mDataConnected, mDataRoaming;
int mDataLevel;
public boolean isInContentArea(int x, int y) {
final int l = getPaddingLeft();
final int r = getWidth() - getPaddingRight();
@@ -141,260 +88,16 @@ public class SystemPanel extends LinearLayout implements StatusBarPanel {
final String action = intent.getAction();
if (action.equals(AudioManager.RINGER_MODE_CHANGED_ACTION)) {
refreshSound();
} else if (action.equals(Intent.ACTION_BATTERY_CHANGED)) {
updateBattery(intent);
} else if (action.equals(WifiManager.RSSI_CHANGED_ACTION)
|| action.equals(WifiManager.WIFI_STATE_CHANGED_ACTION)
|| action.equals(WifiManager.SUPPLICANT_STATE_CHANGED_ACTION)
|| action.equals(WifiManager.NETWORK_STATE_CHANGED_ACTION)) {
updateWifiState(intent);
} else if (action.equals(TelephonyIntents.ACTION_SIM_STATE_CHANGED)) {
updateSimState(intent);
} else if (action.equals(BluetoothAdapter.ACTION_STATE_CHANGED)) {
refreshBluetooth();
}
}
};
private final void updateSimState(Intent intent) {
String stateExtra = intent.getStringExtra(IccCard.INTENT_KEY_ICC_STATE);
if (IccCard.INTENT_VALUE_ICC_ABSENT.equals(stateExtra)) {
mSimState = IccCard.State.ABSENT;
}
else if (IccCard.INTENT_VALUE_ICC_READY.equals(stateExtra)) {
mSimState = IccCard.State.READY;
}
else if (IccCard.INTENT_VALUE_ICC_LOCKED.equals(stateExtra)) {
final String lockedReason = intent.getStringExtra(IccCard.INTENT_KEY_LOCKED_REASON);
if (IccCard.INTENT_VALUE_LOCKED_ON_PIN.equals(lockedReason)) {
mSimState = IccCard.State.PIN_REQUIRED;
}
else if (IccCard.INTENT_VALUE_LOCKED_ON_PUK.equals(lockedReason)) {
mSimState = IccCard.State.PUK_REQUIRED;
}
else {
mSimState = IccCard.State.NETWORK_LOCKED;
}
} else {
mSimState = IccCard.State.UNKNOWN;
}
updateDataState();
}
private boolean isCdma() {
return (mSignalStrength != null) && !mSignalStrength.isGsm();
}
private boolean isEvdo() {
return ( (mServiceState != null)
&& ((mServiceState.getRadioTechnology()
== ServiceState.RADIO_TECHNOLOGY_EVDO_0)
|| (mServiceState.getRadioTechnology()
== ServiceState.RADIO_TECHNOLOGY_EVDO_A)
|| (mServiceState.getRadioTechnology()
== ServiceState.RADIO_TECHNOLOGY_EVDO_B)));
}
private boolean hasService() {
if (mServiceState != null) {
switch (mServiceState.getState()) {
case ServiceState.STATE_OUT_OF_SERVICE:
case ServiceState.STATE_POWER_OFF:
return false;
default:
return true;
}
} else {
return false;
}
}
private int getCdmaLevel() {
if (mSignalStrength == null) return 0;
final int cdmaDbm = mSignalStrength.getCdmaDbm();
final int cdmaEcio = mSignalStrength.getCdmaEcio();
int levelDbm = 0;
int levelEcio = 0;
if (cdmaDbm >= -75) levelDbm = 4;
else if (cdmaDbm >= -85) levelDbm = 3;
else if (cdmaDbm >= -95) levelDbm = 2;
else if (cdmaDbm >= -100) levelDbm = 1;
else levelDbm = 0;
// Ec/Io are in dB*10
if (cdmaEcio >= -90) levelEcio = 4;
else if (cdmaEcio >= -110) levelEcio = 3;
else if (cdmaEcio >= -130) levelEcio = 2;
else if (cdmaEcio >= -150) levelEcio = 1;
else levelEcio = 0;
return (levelDbm < levelEcio) ? levelDbm : levelEcio;
}
private int getEvdoLevel() {
if (mSignalStrength == null) return 0;
int evdoDbm = mSignalStrength.getEvdoDbm();
int evdoSnr = mSignalStrength.getEvdoSnr();
int levelEvdoDbm = 0;
int levelEvdoSnr = 0;
if (evdoDbm >= -65) levelEvdoDbm = 4;
else if (evdoDbm >= -75) levelEvdoDbm = 3;
else if (evdoDbm >= -90) levelEvdoDbm = 2;
else if (evdoDbm >= -105) levelEvdoDbm = 1;
else levelEvdoDbm = 0;
if (evdoSnr >= 7) levelEvdoSnr = 4;
else if (evdoSnr >= 5) levelEvdoSnr = 3;
else if (evdoSnr >= 3) levelEvdoSnr = 2;
else if (evdoSnr >= 1) levelEvdoSnr = 1;
else levelEvdoSnr = 0;
return (levelEvdoDbm < levelEvdoSnr) ? levelEvdoDbm : levelEvdoSnr;
}
private void updateDataState() {
mDataConnected = hasService() && (mDataState == TelephonyManager.DATA_CONNECTED);
if (isCdma()) {
// these functions return a value from 0 to 4, inclusive
if ((mPhoneState == TelephonyManager.CALL_STATE_IDLE) && isEvdo()){
mDataLevel = getEvdoLevel() * 25;
} else {
mDataLevel = getCdmaLevel() * 25;
}
} else {
// GSM
int asu = (mSignalStrength == null) ? 0 : mSignalStrength.getGsmSignalStrength();
// asu on [0,31]; 99 = unknown
// Android has historically shown anything >=12 as "full"
// XXX: tune this based on Industry Best Practices(TM)
if (asu <= 2 || asu == 99) mDataLevel = 0;
else mDataLevel = (int)(((float)Math.max(asu, 15) / 15) * 100);
mDataRoaming = mPhone.isNetworkRoaming();
mDataConnected = mDataConnected
&& (mSimState == IccCard.State.READY || mSimState == IccCard.State.UNKNOWN);
}
if (DEBUG_SIGNAL || DEBUG) {
Slog.d(TAG, "updateDataState: connected=" + mDataConnected
+ " level=" + mDataLevel
+ " isEvdo=" + isEvdo()
+ " isCdma=" + isCdma()
+ " mPhoneState=" + mPhoneState
+ " mDataState=" + mDataState
);
}
refreshSignalMeters();
}
private void updateWifiState(Intent intent) {
if (DEBUG)
Slog.d(TAG, "updateWifiState: " + intent);
final String action = intent.getAction();
final boolean wasConnected = mWifiConnected;
if (action.equals(WifiManager.WIFI_STATE_CHANGED_ACTION)) {
mWifiEnabled = intent.getIntExtra(WifiManager.EXTRA_WIFI_STATE,
WifiManager.WIFI_STATE_UNKNOWN) == WifiManager.WIFI_STATE_ENABLED;
} else if (action.equals(WifiManager.NETWORK_STATE_CHANGED_ACTION)) {
final NetworkInfo networkInfo = (NetworkInfo)
intent.getParcelableExtra(WifiManager.EXTRA_NETWORK_INFO);
mWifiConnected = networkInfo != null && networkInfo.isConnected();
} else if (action.equals(WifiManager.SUPPLICANT_STATE_CHANGED_ACTION)) {
final NetworkInfo.DetailedState detailedState = WifiInfo.getDetailedStateOf(
(SupplicantState)intent.getParcelableExtra(WifiManager.EXTRA_NEW_STATE));
mWifiConnected = detailedState == NetworkInfo.DetailedState.CONNECTED;
} else if (action.equals(WifiManager.RSSI_CHANGED_ACTION)) {
final int newRssi = intent.getIntExtra(WifiManager.EXTRA_NEW_RSSI, -200);
int newSignalLevel = WifiManager.calculateSignalLevel(newRssi, 101);
mWifiLevel = mWifiConnected ? newSignalLevel : 0;
}
if (mWifiConnected && !wasConnected) {
WifiInfo info = mWifiManager.getConnectionInfo();
if (DEBUG)
Slog.d(TAG, "updateWifiState: just connected: info=" + info);
if (info != null) {
// grab the initial signal strength
mWifiLevel = WifiManager.calculateSignalLevel(info.getRssi(), 101);
// find the SSID
mWifiSsid = info.getSSID();
if (mWifiSsid == null) {
// OK, it's not in the connectionInfo; we have to go hunting for it
List<WifiConfiguration> networks = mWifiManager.getConfiguredNetworks();
for (WifiConfiguration net : networks) {
if (net.networkId == info.getNetworkId()) {
mWifiSsid = net.SSID;
break;
}
}
}
}
}
refreshSignalMeters();
}
// figure out what to show: first wifi, then 3G, then nothing
void refreshSignalMeters() {
if (mSignalMeter == null) return; // no UI yet
Context ctxt = getContext();
String text = null;
int level = 0;
if (mWifiConnected) {
if (mWifiSsid == null) {
text = ctxt.getString(R.string.system_panel_signal_meter_wifi_nossid);
} else {
text = ctxt.getString(R.string.system_panel_signal_meter_wifi_ssid_format,
mWifiSsid);
}
level = mWifiLevel;
} else if (mDataConnected) {
text = ctxt.getString(R.string.system_panel_signal_meter_data_connected);
level = mDataLevel;
} else {
text = ctxt.getString(R.string.system_panel_signal_meter_disconnected);
level = 0;
}
mSignalMeter.setImageResource(R.drawable.sysbar_signal);
mSignalMeter.setImageLevel(level);
mSignalText.setText(text);
// hack for now
mBar.setSignalMeter(level, mWifiConnected);
}
public void setBar(TabletStatusBarService bar) {
public void setBar(TabletStatusBar bar) {
mBar = bar;
}
public void updateBattery(Intent intent) {
final int level = intent.getIntExtra("level", 0);
final boolean plugged = intent.getIntExtra("plugged", 0) != 0;
mBatteryMeter.setImageResource(R.drawable.sysbar_battery);
mBatteryMeter.setImageLevel(level);
mBatteryText.setText(getContext()
.getString(R.string.system_panel_battery_meter_format, level));
// hack for now
mBar.setBatteryMeter(level, plugged);
}
public SystemPanel(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
@@ -406,34 +109,14 @@ public class SystemPanel extends LinearLayout implements StatusBarPanel {
mWM = IWindowManager.Stub.asInterface(
ServiceManager.getService("window"));
// get notified of phone state changes
TelephonyManager telephonyManager =
(TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
telephonyManager.listen(mPhoneStateListener,
PhoneStateListener.LISTEN_SERVICE_STATE
| PhoneStateListener.LISTEN_SIGNAL_STRENGTHS
| PhoneStateListener.LISTEN_CALL_STATE
| PhoneStateListener.LISTEN_DATA_CONNECTION_STATE
| PhoneStateListener.LISTEN_DATA_ACTIVITY);
// wifi status info
mWifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
// audio status
mAudioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
// mobile data
mPhone = (TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE);
// Bluetooth
mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
}
public void onAttachedToWindow() {
DateView date = (DateView)findViewById(R.id.date);
date.setUpdates(true);
TextView settingsButton = (TextView)findViewById(R.id.settings_button);
settingsButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
@@ -508,26 +191,9 @@ public class SystemPanel extends LinearLayout implements StatusBarPanel {
// register for broadcasts
IntentFilter filter = new IntentFilter();
filter.addAction(AudioManager.RINGER_MODE_CHANGED_ACTION);
filter.addAction(Intent.ACTION_BATTERY_CHANGED);
filter.addAction(WifiManager.WIFI_STATE_CHANGED_ACTION);
filter.addAction(WifiManager.SUPPLICANT_STATE_CHANGED_ACTION);
filter.addAction(WifiManager.NETWORK_STATE_CHANGED_ACTION);
filter.addAction(WifiManager.RSSI_CHANGED_ACTION);
filter.addAction(TelephonyIntents.ACTION_SIM_STATE_CHANGED);
filter.addAction(BluetoothAdapter.ACTION_STATE_CHANGED);
getContext().registerReceiver(mReceiver, filter);
mBatteryMeter = (ImageView)findViewById(R.id.battery_meter);
mBatteryMeter.setImageResource(R.drawable.sysbar_battery);
mBatteryMeter.setImageLevel(0);
mSignalMeter = (ImageView)findViewById(R.id.signal_meter);
mBatteryMeter.setImageResource(R.drawable.sysbar_signal);
mBatteryMeter.setImageLevel(0);
mBatteryText = (TextView)findViewById(R.id.battery_info);
mSignalText = (TextView)findViewById(R.id.signal_info);
refreshSignalMeters();
refreshBluetooth();
refreshGps();
}
@@ -615,10 +281,9 @@ public class SystemPanel extends LinearLayout implements StatusBarPanel {
PhoneStateListener mPhoneStateListener = new PhoneStateListener() {
@Override
public void onServiceStateChanged(ServiceState serviceState) {
if (DEBUG_SIGNAL || DEBUG) {
if (DEBUG) {
Slog.d(TAG, "phone service state changed: " + serviceState.getState());
}
mServiceState = serviceState;
mAirplaneMode = serviceState.getState() == ServiceState.STATE_POWER_OFF;
if (mAirplaneButton != null) {
mAirplaneButton.setImageResource(mAirplaneMode
@@ -628,34 +293,6 @@ public class SystemPanel extends LinearLayout implements StatusBarPanel {
? R.drawable.sysbar_toggle_bg_on
: R.drawable.sysbar_toggle_bg_off);
}
updateDataState();
}
@Override
public void onSignalStrengthsChanged(SignalStrength signalStrength) {
if (DEBUG_SIGNAL || DEBUG) {
Slog.d(TAG, "onSignalStrengthsChanged: " + signalStrength);
}
mSignalStrength = signalStrength;
updateDataState();
}
@Override
public void onCallStateChanged(int state, String incomingNumber) {
mPhoneState = state;
// In cdma, if a voice call is made, RSSI should switch to 1x.
if (isCdma()) {
updateDataState();
}
}
@Override
public void onDataConnectionStateChanged(int state, int networkType) {
if (DEBUG_SIGNAL || DEBUG) {
Slog.d(TAG, "onDataConnectionStateChanged: state=" + state
+ " type=" + networkType);
}
mDataState = state;
// updateDataNetType(networkType);
updateDataState();
}
};
@@ -745,7 +382,7 @@ public class SystemPanel extends LinearLayout implements StatusBarPanel {
} else {
mWM.freezeRotation();
}
} catch (android.os.RemoteException exc) {
} catch (RemoteException exc) {
}
}
@@ -759,7 +396,7 @@ public class SystemPanel extends LinearLayout implements StatusBarPanel {
int getDisplayRotation() {
try {
return mWM.getRotation();
} catch (android.os.RemoteException exc) {
} catch (RemoteException exc) {
return 0;
}
}

View File

@@ -59,20 +59,20 @@ import android.widget.TextView;
import com.android.internal.statusbar.StatusBarIcon;
import com.android.internal.statusbar.StatusBarNotification;
import com.android.systemui.statusbar.*;
import com.android.systemui.recent.RecentApplicationsActivity;
import com.android.systemui.R;
import com.android.systemui.statusbar.*;
import com.android.systemui.statusbar.policy.BatteryController;
import com.android.systemui.statusbar.policy.NetworkController;
import com.android.systemui.recent.RecentApplicationsActivity;
public class TabletStatusBarService extends StatusBarService {
public class TabletStatusBar extends StatusBar {
public static final boolean DEBUG = false;
public static final String TAG = "TabletStatusBarService";
public static final String TAG = "TabletStatusBar";
public static final int MSG_OPEN_NOTIFICATION_PANEL = 1000;
public static final int MSG_CLOSE_NOTIFICATION_PANEL = 1001;
public static final int MSG_OPEN_NOTIFICATION_PEEK = 1002;
public static final int MSG_CLOSE_NOTIFICATION_PEEK = 1003;
public static final int MSG_OPEN_SYSTEM_PANEL = 1010;
public static final int MSG_CLOSE_SYSTEM_PANEL = 1011;
public static final int MSG_OPEN_RECENTS_PANEL = 1020;
public static final int MSG_CLOSE_RECENTS_PANEL = 1021;
public static final int MSG_LIGHTS_ON = 1030;
@@ -89,10 +89,9 @@ public class TabletStatusBarService extends StatusBarService {
private NotificationData mNotns = new NotificationData();
TabletStatusBarView mStatusBarView;
ImageView mNotificationTrigger;
View mNotificationArea;
View mNotificationTrigger;
NotificationIconArea mNotificationIconArea;
View mNotificationButtons;
View mSystemInfo;
View mNavigationArea;
View mMenuButton;
View mRecentButton;
@@ -100,7 +99,6 @@ public class TabletStatusBarService extends StatusBarService {
InputMethodButton mInputMethodButton;
NotificationPanel mNotificationPanel;
SystemPanel mSystemPanel;
NotificationPanel mNotificationPeekWindow;
ViewGroup mNotificationPeekRow;
int mNotificationPeekIndex;
@@ -110,12 +108,9 @@ public class TabletStatusBarService extends StatusBarService {
int mNotificationFlingVelocity;
ViewGroup mPile;
TextView mClearButton;
TextView mDoNotDisturbButton;
ImageView mBatteryMeter;
ImageView mSignalMeter;
ImageView mSignalIcon;
BatteryController mBatteryController;
NetworkController mNetworkController;
View mBarContents;
View mCurtains;
@@ -146,6 +141,15 @@ public class TabletStatusBarService extends StatusBarService {
mNotificationPanel.setOnTouchListener(
new TouchOutsideListener(MSG_CLOSE_NOTIFICATION_PANEL, mNotificationPanel));
// the battery and network icons
mBatteryController.addIconView((ImageView)mNotificationPanel.findViewById(R.id.battery));
mBatteryController.addLabelView(
(TextView)mNotificationPanel.findViewById(R.id.battery_text));
mNetworkController.addCombinedDataIconView(
(ImageView)mNotificationPanel.findViewById(R.id.network));
mNetworkController.addLabelView(
(TextView)mNotificationPanel.findViewById(R.id.network_text));
mStatusBarView.setIgnoreChildren(0, mNotificationTrigger, mNotificationPanel);
WindowManager.LayoutParams lp = new WindowManager.LayoutParams(
@@ -158,7 +162,6 @@ public class TabletStatusBarService extends StatusBarService {
PixelFormat.TRANSLUCENT);
lp.gravity = Gravity.BOTTOM | Gravity.RIGHT;
lp.setTitle("NotificationPanel");
lp.windowAnimations = com.android.internal.R.style.Animation_SlidingCard;
WindowManagerImpl.getDefault().addView(mNotificationPanel, lp);
@@ -198,29 +201,6 @@ public class TabletStatusBarService extends StatusBarService {
WindowManagerImpl.getDefault().addView(mNotificationPeekWindow, lp);
// System Panel
mSystemPanel = (SystemPanel) View.inflate(context, R.layout.sysbar_panel_system, null);
mSystemPanel.setVisibility(View.GONE);
mSystemPanel.setOnTouchListener(new TouchOutsideListener(MSG_CLOSE_SYSTEM_PANEL,
mSystemPanel));
mStatusBarView.setIgnoreChildren(1, mSystemInfo, mSystemPanel);
lp = new WindowManager.LayoutParams(
800,
ViewGroup.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.TYPE_STATUS_BAR_PANEL,
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
| WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM
| WindowManager.LayoutParams.FLAG_SPLIT_TOUCH,
PixelFormat.TRANSLUCENT);
lp.gravity = Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL;
lp.setTitle("SystemPanel");
lp.windowAnimations = com.android.internal.R.style.Animation_SlidingCard;
WindowManagerImpl.getDefault().addView(mSystemPanel, lp);
mSystemPanel.setBar(this);
// Recents Panel
if (USE_2D_RECENTS) {
mRecentsPanel = (RecentAppsPanel) View.inflate(context, R.layout.sysbar_panel_recent,
@@ -240,7 +220,7 @@ public class TabletStatusBarService extends StatusBarService {
PixelFormat.TRANSLUCENT);
lp.gravity = Gravity.BOTTOM | Gravity.LEFT;
lp.setTitle("RecentsPanel");
lp.windowAnimations = com.android.internal.R.style.Animation_SlidingCard;
lp.windowAnimations = R.style.Animation_RecentPanel;
WindowManagerImpl.getDefault().addView(mRecentsPanel, lp);
mRecentsPanel.setBar(this);
@@ -266,10 +246,6 @@ public class TabletStatusBarService extends StatusBarService {
mBarContents = sb.findViewById(R.id.bar_contents);
mCurtains = sb.findViewById(R.id.lights_out);
mSystemInfo = sb.findViewById(R.id.systemInfo);
mRecentButton = sb.findViewById(R.id.recent_apps);
mSystemInfo.setOnTouchListener(new ClockTouchListener());
mRecentButton = sb.findViewById(R.id.recent_apps);
mRecentButton.setOnClickListener(mOnClickListener);
@@ -278,20 +254,16 @@ public class TabletStatusBarService extends StatusBarService {
mCurtains.setOnClickListener(on);
mCurtains.setOnLongClickListener(on);
// the whole right-hand side of the bar
mNotificationArea = sb.findViewById(R.id.notificationArea);
// the button to open the notification area
mNotificationTrigger = (ImageView) sb.findViewById(R.id.notificationTrigger);
mNotificationTrigger = sb.findViewById(R.id.notificationTrigger);
mNotificationTrigger.setOnClickListener(mOnClickListener);
// the more notifications icon
mNotificationIconArea = (NotificationIconArea)sb.findViewById(R.id.notificationIcons);
// the clear and dnd buttons
mNotificationButtons = sb.findViewById(R.id.notificationButtons);
mClearButton = (TextView)mNotificationButtons.findViewById(R.id.clear_all_button);
mClearButton.setOnClickListener(mOnClickListener);
mDoNotDisturbButton = (TextView)mNotificationButtons.findViewById(R.id.do_not_disturb);
mDoNotDisturbButton.setOnClickListener(mOnClickListener);
// where the icons go
mIconLayout = (NotificationIconArea.IconLayout) sb.findViewById(R.id.icons);
mIconLayout.setOnTouchListener(new NotificationIconTouchListener());
@@ -302,10 +274,11 @@ public class TabletStatusBarService extends StatusBarService {
mTicker = new TabletTicker(context, (FrameLayout)sb.findViewById(R.id.ticker));
// System info (center)
mBatteryMeter = (ImageView) sb.findViewById(R.id.battery);
mSignalMeter = (ImageView) sb.findViewById(R.id.signal);
mSignalIcon = (ImageView) sb.findViewById(R.id.signal_icon);
// The icons
mBatteryController = new BatteryController(mContext);
mBatteryController.addIconView((ImageView)sb.findViewById(R.id.battery));
mNetworkController = new NetworkController(mContext);
mNetworkController.addCombinedDataIconView((ImageView)sb.findViewById(R.id.network));
// The navigation buttons
mNavigationArea = sb.findViewById(R.id.navigationArea);
@@ -388,36 +361,17 @@ public class TabletStatusBarService extends StatusBarService {
if (mNotificationPanel.getVisibility() == View.GONE) {
mNotificationPeekWindow.setVisibility(View.GONE);
mDoNotDisturbButton.setText(mNotificationsOn
? R.string.status_bar_do_not_disturb_button
: R.string.status_bar_please_disturb_button);
mNotificationPanel.setVisibility(View.VISIBLE);
setViewVisibility(mNotificationIconArea, View.GONE,
R.anim.notification_icons_out);
setViewVisibility(mNotificationButtons, View.VISIBLE,
R.anim.notification_buttons_in);
refreshNotificationTrigger();
mNotificationArea.setVisibility(View.GONE);
}
break;
case MSG_CLOSE_NOTIFICATION_PANEL:
if (DEBUG) Slog.d(TAG, "closing notifications panel");
if (mNotificationPanel.getVisibility() == View.VISIBLE) {
mNotificationPanel.setVisibility(View.GONE);
setViewVisibility(mNotificationIconArea, View.VISIBLE,
R.anim.notification_icons_in);
setViewVisibility(mNotificationButtons, View.GONE,
R.anim.notification_buttons_out);
refreshNotificationTrigger();
mNotificationArea.setVisibility(View.VISIBLE);
}
break;
case MSG_OPEN_SYSTEM_PANEL:
if (DEBUG) Slog.d(TAG, "opening system panel");
mSystemPanel.setVisibility(View.VISIBLE);
break;
case MSG_CLOSE_SYSTEM_PANEL:
if (DEBUG) Slog.d(TAG, "closing system panel");
mSystemPanel.setVisibility(View.GONE);
break;
case MSG_OPEN_RECENTS_PANEL:
if (DEBUG) Slog.d(TAG, "opening recents panel");
if (mRecentsPanel != null) mRecentsPanel.setVisibility(View.VISIBLE);
@@ -440,6 +394,7 @@ public class TabletStatusBarService extends StatusBarService {
}
public void refreshNotificationTrigger() {
/*
if (mNotificationTrigger == null) return;
int resId;
@@ -452,29 +407,8 @@ public class TabletStatusBarService extends StatusBarService {
} else {
resId = panel ? R.drawable.ic_sysbar_noti_none_open : R.drawable.ic_sysbar_noti_none;
}
mNotificationTrigger.setImageResource(resId);
}
public void setBatteryMeter(int level, boolean plugged) {
if (DEBUG) Slog.d(TAG, "battery=" + level + (plugged ? " - plugged" : " - unplugged"));
mBatteryMeter.setImageResource(R.drawable.sysbar_batterymini);
// adjust percent to permyriad for ClipDrawable's sake
mBatteryMeter.setImageLevel(level * (MAX_IMAGE_LEVEL / 100));
}
public void setSignalMeter(int level, boolean isWifi) {
if (DEBUG) Slog.d(TAG, "signal=" + level);
if (level < 0) {
mSignalMeter.setImageDrawable(null);
mSignalMeter.setImageLevel(0);
mSignalIcon.setImageDrawable(null);
} else {
mSignalMeter.setImageResource(R.drawable.sysbar_wifimini);
// adjust to permyriad
mSignalMeter.setImageLevel(level * (MAX_IMAGE_LEVEL / 100));
mSignalIcon.setImageResource(isWifi ? R.drawable.ic_sysbar_wifi_mini
: R.drawable.ic_sysbar_wifi_mini); // XXX
}
//mNotificationTrigger.setImageResource(resId);
*/
}
public void addIcon(String slot, int index, int viewIndex, StatusBarIcon icon) {
@@ -599,9 +533,6 @@ public class TabletStatusBarService extends StatusBarService {
public void disable(int state) {
int old = mDisabled;
int diff = state ^ old;
Slog.d(TAG, "disable... old=0x" + Integer.toHexString(old)
+ " diff=0x" + Integer.toHexString(diff)
+ " state=0x" + Integer.toHexString(state));
mDisabled = state;
// act accordingly
@@ -614,39 +545,24 @@ public class TabletStatusBarService extends StatusBarService {
if ((diff & StatusBarManager.DISABLE_NOTIFICATION_ICONS) != 0) {
if ((state & StatusBarManager.DISABLE_NOTIFICATION_ICONS) != 0) {
Slog.d(TAG, "DISABLE_NOTIFICATION_ICONS: yes");
setViewVisibility(mNotificationTrigger, View.GONE,
R.anim.notification_icons_out);
setViewVisibility(mNotificationIconArea, View.GONE,
R.anim.notification_icons_out);
mNotificationIconArea.setVisibility(View.GONE);
mTicker.halt();
} else {
Slog.d(TAG, "DISABLE_NOTIFICATION_ICONS: no");
setViewVisibility(mNotificationTrigger, View.VISIBLE,
R.anim.notification_icons_in);
setViewVisibility(mNotificationIconArea, View.VISIBLE,
R.anim.notification_icons_in);
mNotificationIconArea.setVisibility(View.VISIBLE);
}
} else if ((diff & StatusBarManager.DISABLE_NOTIFICATION_TICKER) != 0) {
if ((state & StatusBarManager.DISABLE_NOTIFICATION_TICKER) != 0) {
mTicker.halt();
}
}
if ((diff & StatusBarManager.DISABLE_SYSTEM_INFO) != 0) {
if ((state & StatusBarManager.DISABLE_SYSTEM_INFO) != 0) {
Slog.d(TAG, "DISABLE_SYSTEM_INFO: yes");
setViewVisibility(mSystemInfo, View.GONE, R.anim.navigation_out);
} else {
Slog.d(TAG, "DISABLE_SYSTEM_INFO: no");
setViewVisibility(mSystemInfo, View.VISIBLE, R.anim.navigation_in);
}
}
if ((diff & StatusBarManager.DISABLE_NAVIGATION) != 0) {
if ((state & StatusBarManager.DISABLE_NAVIGATION) != 0) {
Slog.d(TAG, "DISABLE_NAVIGATION: yes");
setViewVisibility(mNavigationArea, View.GONE, R.anim.navigation_out);
mNavigationArea.setVisibility(View.GONE);
} else {
Slog.d(TAG, "DISABLE_NAVIGATION: no");
setViewVisibility(mNavigationArea, View.VISIBLE, R.anim.navigation_in);
mNavigationArea.setVisibility(View.VISIBLE);
}
}
}
@@ -682,13 +598,11 @@ public class TabletStatusBarService extends StatusBarService {
public void animateCollapse() {
mHandler.removeMessages(MSG_CLOSE_NOTIFICATION_PANEL);
mHandler.sendEmptyMessage(MSG_CLOSE_NOTIFICATION_PANEL);
mHandler.removeMessages(MSG_CLOSE_SYSTEM_PANEL);
mHandler.sendEmptyMessage(MSG_CLOSE_SYSTEM_PANEL);
mHandler.removeMessages(MSG_CLOSE_RECENTS_PANEL);
mHandler.sendEmptyMessage(MSG_CLOSE_RECENTS_PANEL);
}
// called by StatusBarService
// called by StatusBar
@Override
public void setLightsOn(boolean on) {
mHandler.removeMessages(MSG_LIGHTS_OUT);
@@ -700,9 +614,7 @@ public class TabletStatusBarService extends StatusBarService {
if (DEBUG) {
Slog.d(TAG, (visible?"showing":"hiding") + " the MENU button");
}
setViewVisibility(mMenuButton,
visible ? View.VISIBLE : View.INVISIBLE,
visible ? R.anim.navigation_in : R.anim.navigation_out);
mMenuButton.setVisibility(visible ? View.VISIBLE : View.INVISIBLE);
}
public void setIMEButtonVisible(boolean visible) {
@@ -717,24 +629,6 @@ public class TabletStatusBarService extends StatusBarService {
//Slog.d(TAG, "setAreThereNotifications hasClerable=" + hasClearable);
// Show or hide the "Clear all" button. Note that we don't do an animation
// if it's not on screen, so that if someone opens the bar right then they
// don't see the animation in progress.
// (no ongoing notifications are clearable)
if (hasClearable) {
if (mNotificationButtons.getVisibility() == View.VISIBLE) {
setViewVisibility(mClearButton, View.VISIBLE, R.anim.notification_buttons_in);
} else {
mClearButton.setVisibility(View.VISIBLE);
}
} else {
if (mNotificationButtons.getVisibility() == View.VISIBLE) {
setViewVisibility(mClearButton, View.GONE, R.anim.notification_buttons_out);
} else {
mClearButton.setVisibility(View.GONE);
}
}
/*
mOngoingTitle.setVisibility(ongoing ? View.VISIBLE : View.GONE);
mLatestTitle.setVisibility(latest ? View.VISIBLE : View.GONE);
@@ -759,55 +653,9 @@ public class TabletStatusBarService extends StatusBarService {
}
}
private class ClockTouchListener implements View.OnTouchListener {
VelocityTracker mVT = null;
int mInitX, mInitY;
public boolean onTouch (View v, MotionEvent event) {
final int x = (int) event.getX();
final int y = (int) event.getY();
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
mVT = VelocityTracker.obtain();
mInitX = x;
mInitY = y;
mHandler.sendEmptyMessageDelayed(MSG_LIGHTS_OUT,
ViewConfiguration.getLongPressTimeout());
break;
case MotionEvent.ACTION_OUTSIDE:
case MotionEvent.ACTION_MOVE:
final Rect r = new Rect();
final float radius = mSystemInfo.getHeight() / 2;
if (Math.abs(x - mInitX) > radius || Math.abs(y - mInitY) > radius) {
mHandler.removeMessages(MSG_LIGHTS_OUT);
}
if (mVT == null) break;
mVT.addMovement(event);
mVT.computeCurrentVelocity(1000);
if (mVT.getYVelocity() < -200 && mSystemPanel.getVisibility() == View.GONE) {
mHandler.removeMessages(MSG_OPEN_SYSTEM_PANEL);
mHandler.sendEmptyMessage(MSG_OPEN_SYSTEM_PANEL);
} else if (mVT.getYVelocity() > 200) {
mHandler.sendEmptyMessage(MSG_LIGHTS_OUT);
}
return true;
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_CANCEL:
mVT.recycle();
mVT = null;
mHandler.removeMessages(MSG_LIGHTS_OUT);
return true;
}
return false;
}
}
private View.OnClickListener mOnClickListener = new View.OnClickListener() {
public void onClick(View v) {
if (v == mClearButton) {
onClickClearButton();
} else if (v == mDoNotDisturbButton) {
onClickDoNotDisturb();
} else if (v == mNotificationTrigger) {
if (v == mNotificationTrigger) {
onClickNotificationTrigger();
} else if (v == mRecentButton) {
onClickRecentButton();
@@ -815,23 +663,6 @@ public class TabletStatusBarService extends StatusBarService {
}
};
void onClickClearButton() {
try {
mBarService.onClearAllNotifications();
} catch (RemoteException ex) {
// system process is dead if we're here.
}
animateCollapse();
refreshNotificationTrigger();
}
void onClickDoNotDisturb() {
mNotificationsOn = !mNotificationsOn;
mIconLayout.setVisibility(mNotificationsOn ? View.VISIBLE : View.INVISIBLE); // TODO: animation
animateCollapse();
refreshNotificationTrigger();
}
public void onClickNotificationTrigger() {
if (DEBUG) Slog.d(TAG, "clicked notification icons");
if ((mDisabled & StatusBarManager.DISABLE_EXPAND) == 0) {
@@ -849,17 +680,6 @@ public class TabletStatusBarService extends StatusBarService {
}
}
public void onClickSystemInfo() {
if (DEBUG) Slog.d(TAG, "clicked system info");
if ((mDisabled & StatusBarManager.DISABLE_EXPAND) == 0) {
int msg = (mSystemPanel.getVisibility() == View.GONE)
? MSG_OPEN_SYSTEM_PANEL
: MSG_CLOSE_SYSTEM_PANEL;
mHandler.removeMessages(msg);
mHandler.sendEmptyMessage(msg);
}
}
public void onClickRecentButton() {
if (DEBUG) Slog.d(TAG, "clicked recent apps");
if (mRecentsPanel == null) {

View File

@@ -40,12 +40,10 @@ public class TabletStatusBarView extends FrameLayout {
public boolean onInterceptTouchEvent(MotionEvent ev) {
if (ev.getAction() == MotionEvent.ACTION_DOWN) {
mHandler.removeMessages(TabletStatusBarService.MSG_CLOSE_NOTIFICATION_PANEL);
mHandler.sendEmptyMessage(TabletStatusBarService.MSG_CLOSE_NOTIFICATION_PANEL);
mHandler.removeMessages(TabletStatusBarService.MSG_CLOSE_SYSTEM_PANEL);
mHandler.sendEmptyMessage(TabletStatusBarService.MSG_CLOSE_SYSTEM_PANEL);
mHandler.removeMessages(TabletStatusBarService.MSG_CLOSE_RECENTS_PANEL);
mHandler.sendEmptyMessage(TabletStatusBarService.MSG_CLOSE_RECENTS_PANEL);
mHandler.removeMessages(TabletStatusBar.MSG_CLOSE_NOTIFICATION_PANEL);
mHandler.sendEmptyMessage(TabletStatusBar.MSG_CLOSE_NOTIFICATION_PANEL);
mHandler.removeMessages(TabletStatusBar.MSG_CLOSE_RECENTS_PANEL);
mHandler.sendEmptyMessage(TabletStatusBar.MSG_CLOSE_RECENTS_PANEL);
for (int i=0; i < mPanels.length; i++) {
if (mPanels[i] != null && mPanels[i].getVisibility() == View.VISIBLE) {