Merge "Send broadcast when default dialer changes" into mnc-dev
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 358eae9..d792b5c 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -956,6 +956,10 @@
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="package" />
</intent-filter>
+ <intent-filter android:priority="1">
+ <action android:name="android.settings.IGNORE_BATTERY_OPTIMIZATION_SETTINGS" />
+ <category android:name="android.intent.category.DEFAULT" />
+ </intent-filter>
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
android:value="com.android.settings.applications.ManageApplications" />
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
@@ -1900,16 +1904,6 @@
</intent-filter>
</receiver>
- <activity android:name="BatteryInfo" android:label="@string/battery_info_label"
- android:taskAffinity="com.android.settings"
- android:parentActivityName="Settings">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.DEVELOPMENT_PREFERENCE" />
- <category android:name="android.intent.category.VOICE_LAUNCH" />
- </intent-filter>
- </activity>
-
<activity android:name="Display" android:label="@string/display_label"
android:configChanges="fontScale"
android:taskAffinity="com.android.settings"
diff --git a/res/drawable/ic_eject_24dp.xml b/res/drawable/ic_eject_24dp.xml
new file mode 100644
index 0000000..1bb351a
--- /dev/null
+++ b/res/drawable/ic_eject_24dp.xml
@@ -0,0 +1,24 @@
+<!--
+Copyright (C) 2015 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0">
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M5 17h14v2H5zm7,-12L5.33 15h13.34z"/>
+</vector>
diff --git a/res/drawable/ic_eject_48dp.xml b/res/drawable/ic_eject_48dp.xml
new file mode 100644
index 0000000..38b7ddd
--- /dev/null
+++ b/res/drawable/ic_eject_48dp.xml
@@ -0,0 +1,24 @@
+<!--
+Copyright (C) 2015 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="48dp"
+ android:height="48dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0">
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M5 17h14v2H5zm7,-12L5.33 15h13.34z"/>
+</vector>
diff --git a/res/drawable/ic_warning_24dp.xml b/res/drawable/ic_warning_24dp.xml
new file mode 100644
index 0000000..8e9fee3
--- /dev/null
+++ b/res/drawable/ic_warning_24dp.xml
@@ -0,0 +1,24 @@
+<!--
+Copyright (C) 2015 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="48.0"
+ android:viewportHeight="48.0">
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M2 42h44L24 4 2 42zm24,-6h-4v-4h4v4zm0,-8h-4v-8h4v8z"/>
+</vector>
diff --git a/res/drawable/ic_warning_48dp.xml b/res/drawable/ic_warning_48dp.xml
new file mode 100644
index 0000000..b213ec9
--- /dev/null
+++ b/res/drawable/ic_warning_48dp.xml
@@ -0,0 +1,24 @@
+<!--
+Copyright (C) 2015 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="48dp"
+ android:height="48dp"
+ android:viewportWidth="48.0"
+ android:viewportHeight="48.0">
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M2 42h44L24 4 2 42zm24,-6h-4v-4h4v4zm0,-8h-4v-8h4v8z"/>
+</vector>
diff --git a/res/layout/app_percentage_item.xml b/res/layout/app_item.xml
similarity index 67%
rename from res/layout/app_percentage_item.xml
rename to res/layout/app_item.xml
index 64146d9..26f2b1e 100644
--- a/res/layout/app_percentage_item.xml
+++ b/res/layout/app_item.xml
@@ -17,19 +17,19 @@
<GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:minHeight="?android:attr/listPreferredItemHeight"
- android:paddingTop="14dp"
- android:paddingBottom="14dp"
+ android:minHeight="72dp"
+ android:paddingTop="16dp"
+ android:paddingBottom="16dp"
android:columnCount="3">
<ImageView
android:id="@android:id/icon"
- android:layout_width="40dp"
- android:layout_height="40dp"
+ android:layout_width="@dimen/app_icon_size"
+ android:layout_height="@dimen/app_icon_size"
android:layout_gravity="center"
android:scaleType="fitXY"
android:layout_rowSpan="3"
- android:layout_marginEnd="8dip"
+ android:layout_marginEnd="16dip"
android:contentDescription="@null" />
<TextView
@@ -44,30 +44,18 @@
android:textAlignment="viewStart" />
<TextView
- android:id="@android:id/text1"
+ android:id="@android:id/summary"
android:layout_marginStart="6dip"
android:layout_marginTop="2dip"
+ android:singleLine="true"
+ android:ellipsize="marquee"
android:textAppearance="@android:style/TextAppearance.Material.Subhead"
android:textColor="?android:attr/textColorSecondary" />
- <ProgressBar
- android:id="@android:id/progress"
+ <FrameLayout
+ android:id="@android:id/widget_frame"
android:layout_height="wrap_content"
android:layout_columnSpan="2"
- android:layout_gravity="fill_horizontal|top"
- android:layout_marginTop="4dip"
- android:max="100"
- android:progressBackgroundTint="@android:color/transparent"
- style="?android:attr/progressBarStyleHorizontal" />
-
- <TextView
- android:id="@android:id/summary"
- android:layout_width="0dip"
- android:layout_gravity="fill_horizontal|top"
- android:layout_columnSpan="2"
- android:layout_marginTop="6dip"
- android:visibility="gone"
- android:maxLines="2"
- android:textAppearance="?android:attr/textAppearanceSmall" />
+ android:layout_gravity="fill_horizontal|top" />
</GridLayout>
diff --git a/res/layout/app_item_linear_color.xml b/res/layout/app_item_linear_color.xml
deleted file mode 100755
index 7a4aad5..0000000
--- a/res/layout/app_item_linear_color.xml
+++ /dev/null
@@ -1,79 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright (C) 2015 The Android Open Source Project
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at"+
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:minHeight="?android:attr/listPreferredItemHeight"
- android:paddingStart="?android:attr/listPreferredItemPaddingStart"
- android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
- android:paddingTop="8dip"
- android:paddingBottom="8dip">
-
- <ImageView
- android:id="@android:id/icon"
- android:layout_width="@android:dimen/app_icon_size"
- android:layout_height="@android:dimen/app_icon_size"
- android:layout_marginEnd="8dip"
- android:scaleType="centerInside"
- android:contentDescription="@null"
- android:duplicateParentState="true" />
-
- <LinearLayout
- android:id="@+id/text_area"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_alignParentTop="true"
- android:layout_toEndOf="@android:id/icon"
- android:orientation="horizontal"
- android:duplicateParentState="true">
-
- <TextView
- android:id="@android:id/title"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:layout_marginTop="2dip"
- android:singleLine="true"
- android:ellipsize="marquee"
- android:textAppearance="@android:style/TextAppearance.Material.Subhead"
- android:textAlignment="viewStart"
- android:duplicateParentState="true" />
-
- <TextView
- android:id="@android:id/summary"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:textAppearance="@android:style/TextAppearance.Material.Body1"
- android:textColor="?android:attr/textColorSecondary"
- android:gravity="end|bottom"
- android:duplicateParentState="true" />
-
- </LinearLayout>
-
- <com.android.settings.applications.LinearColorBar
- android:id="@+id/linear_color_bar"
- android:layout_width="match_parent"
- android:layout_height="10dp"
- android:layout_marginTop="7dp"
- android:layout_marginBottom="5dp"
- android:layout_toEndOf="@android:id/icon"
- android:layout_below="@id/text_area"
- android:duplicateParentState="true" />
-
-</RelativeLayout>
diff --git a/res/layout/app_ops_details.xml b/res/layout/app_ops_details.xml
index e3209ca..fc3c1de 100644
--- a/res/layout/app_ops_details.xml
+++ b/res/layout/app_ops_details.xml
@@ -41,7 +41,7 @@
<!-- Application snippet label, version and icon -->
<include
- layout="@layout/manage_applications_item"
+ layout="@layout/app_item"
android:id="@+id/app_snippet" />
</LinearLayout>
diff --git a/res/layout/battery_info.xml b/res/layout/battery_info.xml
deleted file mode 100644
index 1016ad1..0000000
--- a/res/layout/battery_info.xml
+++ /dev/null
@@ -1,78 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/* //device/apps/Settings/assets/res/any/layout/battery_info.xml
-**
-** Copyright 2006, 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.
-*/
--->
-
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" style="@style/info_layout">
-
- <!-- Battery Status -->
- <LinearLayout style="@style/entry_layout">
- <TextView android:text="@string/battery_info_status_label" style="@style/info_label" />
- <TextView android:id="@+id/status" style="@style/info_value" />
- </LinearLayout>
-
- <!-- Battery Status -->
- <LinearLayout style="@style/entry_layout">
- <TextView android:text="@string/battery_info_power_label" style="@style/info_label" />
- <TextView android:id="@+id/power" style="@style/info_value" />
- </LinearLayout>
-
- <!-- Battery Level -->
- <LinearLayout style="@style/entry_layout">
- <TextView android:text="@string/battery_info_level_label" style="@style/info_label" />
- <TextView android:id="@+id/level" style="@style/info_value" />
- </LinearLayout>
-
- <!-- Battery Scale -->
- <LinearLayout style="@style/entry_layout">
- <TextView android:text="@string/battery_info_scale_label" style="@style/info_label" />
- <TextView android:id="@+id/scale" style="@style/info_value" />
- </LinearLayout>
-
- <!-- Battery Health -->
- <LinearLayout style="@style/entry_layout">
- <TextView android:text="@string/battery_info_health_label" style="@style/info_label" />
- <TextView android:id="@+id/health" style="@style/info_value" />
- </LinearLayout>
-
- <!-- Battery Voltage -->
- <LinearLayout style="@style/entry_layout">
- <TextView android:text="@string/battery_info_voltage_label" style="@style/info_label" />
- <TextView android:id="@+id/voltage" style="@style/info_value" />
- </LinearLayout>
-
- <!-- Battery Temperature -->
- <LinearLayout style="@style/entry_layout">
- <TextView android:text="@string/battery_info_temperature_label" style="@style/info_label" />
- <TextView android:id="@+id/temperature" style="@style/info_value" />
- </LinearLayout>
-
- <!-- Battery Technology -->
- <LinearLayout style="@style/entry_layout">
- <TextView android:text="@string/battery_info_technology_label" style="@style/info_label" />
- <TextView android:id="@+id/technology" style="@style/info_value" />
- </LinearLayout>
-
- <!-- Uptime -->
- <LinearLayout style="@style/entry_layout">
- <TextView android:text="@string/battery_info_uptime" style="@style/info_label" />
- <TextView android:id="@+id/uptime" style="@style/info_value" />
- </LinearLayout>
-
-</LinearLayout>
-
diff --git a/res/layout/bluetooth_pin_confirm.xml b/res/layout/bluetooth_pin_confirm.xml
index 08f5d9f..2968b38 100644
--- a/res/layout/bluetooth_pin_confirm.xml
+++ b/res/layout/bluetooth_pin_confirm.xml
@@ -86,16 +86,15 @@
android:textColor="@*android:color/secondary_text_material_light"
android:visibility="gone" />
- <TextView
- android:id="@+id/phonebook_sharing_message"
+ <CheckBox
+ android:id="@+id/phonebook_sharing_message_confirm_pin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/bluetooth_dialog_padding"
android:layout_marginEnd="@dimen/bluetooth_dialog_padding"
- android:layout_marginBottom="@dimen/bluetooth_dialog_padding"
android:gravity="center_vertical"
- android:text="@string/bluetooth_pairing_will_share_phonebook"
- android:textSize="12sp" />
+ android:text="@string/bluetooth_pairing_shares_phonebook"
+ android:textAppearance="?android:attr/textAppearanceSmall" />
</LinearLayout>
diff --git a/res/layout/bluetooth_pin_entry.xml b/res/layout/bluetooth_pin_entry.xml
index 6f50cd4..aa9f187 100644
--- a/res/layout/bluetooth_pin_entry.xml
+++ b/res/layout/bluetooth_pin_entry.xml
@@ -87,16 +87,15 @@
android:textAppearance="@android:style/TextAppearance.Material.Subhead"
android:textColor="@*android:color/secondary_text_material_light"/>
- <TextView
- android:id="@+id/phonebook_sharing_message"
+ <CheckBox
+ android:id="@+id/phonebook_sharing_message_entry_pin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/bluetooth_dialog_padding"
android:layout_marginEnd="@dimen/bluetooth_dialog_padding"
- android:layout_marginBottom="@dimen/bluetooth_dialog_padding"
android:gravity="center_vertical"
- android:text="@string/bluetooth_pairing_will_share_phonebook"
- android:textSize="12sp" />
+ android:text="@string/bluetooth_pairing_shares_phonebook"
+ android:textAppearance="?android:attr/textAppearanceSmall" />
</LinearLayout>
diff --git a/res/layout/data_usage_item.xml b/res/layout/data_usage_item.xml
index 6f496d5..5e931f9 100644
--- a/res/layout/data_usage_item.xml
+++ b/res/layout/data_usage_item.xml
@@ -20,6 +20,6 @@
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd">
- <include layout="@layout/app_percentage_item" />
+ <include layout="@layout/app_item" />
</FrameLayout>
diff --git a/res/layout/installed_app_details.xml b/res/layout/installed_app_details.xml
index b703ec0..fd98ec3 100644
--- a/res/layout/installed_app_details.xml
+++ b/res/layout/installed_app_details.xml
@@ -37,7 +37,7 @@
<!-- Application snippet label, version and icon -->
<include
- layout="@layout/manage_applications_item"
+ layout="@layout/app_item"
android:id="@+id/app_snippet" />
<Space
diff --git a/res/layout/manage_applications_item.xml b/res/layout/manage_applications_item.xml
deleted file mode 100755
index 6d24114..0000000
--- a/res/layout/manage_applications_item.xml
+++ /dev/null
@@ -1,85 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-** Copyright 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.
-*/
--->
-
-<GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:minHeight="72dp"
- android:paddingStart="?android:attr/listPreferredItemPaddingStart"
- android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
- android:paddingTop="16dip"
- android:paddingBottom="16dip"
- android:columnCount="4">
-
- <ImageView
- android:id="@+id/app_icon"
- android:layout_width="@dimen/app_icon_size"
- android:layout_height="@dimen/app_icon_size"
- android:layout_rowSpan="2"
- android:layout_marginEnd="16dip"
- android:scaleType="centerInside"
- android:contentDescription="@null"
- android:duplicateParentState="true" />
-
- <TextView
- android:id="@+id/app_name"
- android:layout_width="0dip"
- android:layout_columnSpan="2"
- android:layout_gravity="fill_horizontal"
- android:layout_marginTop="2dip"
- android:singleLine="true"
- android:ellipsize="marquee"
- android:textAppearance="@android:style/TextAppearance.Material.Subhead"
- android:textAlignment="viewStart"
- android:duplicateParentState="true" />
-
- <CheckBox android:id="@+id/app_on_sdcard"
- android:layout_marginStart="8dip"
- android:layout_gravity="center_vertical"
- android:layout_rowSpan="2"
- android:visibility="gone"
- android:clickable="false"
- android:focusable="false"
- android:duplicateParentState="true" />
-
- <TextView
- android:id="@+id/app_summary"
- android:layout_column="1"
- android:layout_row="1"
- android:layout_gravity="fill_horizontal|top"
- android:textAppearance="@android:style/TextAppearance.Material.Body1"
- android:textColor="?android:attr/textColorSecondary"
- android:textAlignment="viewStart"
- android:singleLine="true"
- android:ellipsize="marquee"
- android:duplicateParentState="true" />
-
- <TextView
- android:id="@+id/app_disabled"
- android:layout_width="0dip"
- android:layout_marginStart="8dip"
- android:layout_gravity="fill_horizontal|top"
- android:textAppearance="@android:style/TextAppearance.Material.Body1"
- android:textColor="?android:attr/textColorSecondary"
- android:textAlignment="viewEnd"
- android:singleLine="true"
- android:ellipsize="marquee"
- android:duplicateParentState="true" />
-
-</GridLayout>
diff --git a/res/layout/preference_app_percentage.xml b/res/layout/preference_app.xml
similarity index 94%
rename from res/layout/preference_app_percentage.xml
rename to res/layout/preference_app.xml
index 7dc9d46..da348fd 100644
--- a/res/layout/preference_app_percentage.xml
+++ b/res/layout/preference_app.xml
@@ -20,6 +20,6 @@
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd">
- <include layout="@layout/app_percentage_item" />
+ <include layout="@layout/app_item" />
</LinearLayout>
diff --git a/res/layout/preference_material_settings.xml b/res/layout/preference_material_settings.xml
new file mode 100644
index 0000000..f2dd2e1
--- /dev/null
+++ b/res/layout/preference_material_settings.xml
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2015 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<!-- Based off frameworks/base/core/res/res/layout/preference_material.xml
+ except that this has the negative margin on the image removed. -->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:minHeight="?android:attr/listPreferredItemHeightSmall"
+ android:gravity="center_vertical"
+ android:paddingStart="?android:attr/listPreferredItemPaddingStart"
+ android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
+ android:background="?android:attr/activatedBackgroundIndicator"
+ android:clipToPadding="false">
+
+ <LinearLayout
+ android:id="@*android:id/icon_frame"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:minWidth="60dp"
+ android:gravity="start|center_vertical"
+ android:orientation="horizontal"
+ android:paddingEnd="12dp"
+ android:paddingTop="4dp"
+ android:paddingBottom="4dp">
+ <com.android.internal.widget.PreferenceImageView
+ android:id="@android:id/icon"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:maxWidth="48dp"
+ android:maxHeight="48dp" />
+ </LinearLayout>
+
+ <RelativeLayout
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:paddingTop="16dp"
+ android:paddingBottom="16dp">
+
+ <TextView android:id="@android:id/title"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:singleLine="true"
+ android:textAppearance="?android:attr/textAppearanceListItem"
+ android:ellipsize="marquee" />
+
+ <TextView android:id="@android:id/summary"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_below="@android:id/title"
+ android:layout_alignStart="@android:id/title"
+ android:textAppearance="?android:attr/textAppearanceListItemSecondary"
+ android:textColor="?android:attr/textColorSecondary"
+ android:maxLines="10" />
+
+ </RelativeLayout>
+
+ <!-- Preference should place its actual preference widget here. -->
+ <LinearLayout android:id="@android:id/widget_frame"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:gravity="end|center_vertical"
+ android:paddingStart="16dp"
+ android:orientation="vertical" />
+
+</LinearLayout>
diff --git a/res/layout/preference_storage_action.xml b/res/layout/preference_storage_action.xml
index 10f138b..19d7763 100644
--- a/res/layout/preference_storage_action.xml
+++ b/res/layout/preference_storage_action.xml
@@ -20,7 +20,7 @@
android:layout_height="match_parent"
android:orientation="horizontal">
- <TextView
+ <ImageView
android:id="@+id/unmount"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
@@ -29,19 +29,7 @@
android:contentDescription="@string/storage_menu_unmount"
android:layout_gravity="center"
android:gravity="center"
- android:textSize="30sp"
+ android:src="@drawable/ic_eject_24dp"
android:background="?android:attr/selectableItemBackground" />
- <!--
- <ImageView
- android:id="@+id/eject"
- android:layout_width="wrap_content"
- android:layout_height="fill_parent"
- android:paddingStart="16dip"
- android:paddingEnd="16dip"
- android:src="@drawable/ic_sync_green_holo"
- android:contentDescription="@string/storage_menu_eject"
- android:layout_gravity="center"
- android:background="?android:attr/selectableItemBackground" />
- -->
</LinearLayout>
diff --git a/res/layout/storage_summary.xml b/res/layout/storage_summary.xml
new file mode 100644
index 0000000..cd63671
--- /dev/null
+++ b/res/layout/storage_summary.xml
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2015 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:minHeight="?android:attr/listPreferredItemHeightSmall"
+ android:gravity="center_vertical"
+ android:paddingStart="?android:attr/listPreferredItemPaddingStart"
+ android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
+ android:paddingTop="16dip"
+ android:paddingBottom="16dip"
+ android:background="?android:attr/selectableItemBackground">
+
+ <TextView
+ android:id="@+android:id/title"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:singleLine="true"
+ android:textAlignment="viewStart"
+ android:textAppearance="@android:style/TextAppearance.Material.Subhead"
+ android:textColor="#ff607d8b"
+ android:textSize="36sp"
+ android:ellipsize="marquee"
+ android:fadingEdge="horizontal" />
+
+ <TextView
+ android:id="@android:id/summary"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textAlignment="viewStart"
+ android:textAppearance="@android:style/TextAppearance.Material.Body1"
+ android:textColor="#8a000000"
+ android:maxLines="10" />
+
+ <ProgressBar
+ android:id="@android:id/progress"
+ android:layout_width="match_parent"
+ android:layout_height="8dp"
+ android:layout_marginTop="16dp"
+ android:layout_marginBottom="8dp"
+ android:visibility="gone"
+ android:max="100"
+ style="?android:attr/progressBarStyleHorizontal" />
+
+</LinearLayout>
diff --git a/res/layout/storage_volume.xml b/res/layout/storage_volume.xml
new file mode 100644
index 0000000..570cec6
--- /dev/null
+++ b/res/layout/storage_volume.xml
@@ -0,0 +1,89 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2015 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:minHeight="?android:attr/listPreferredItemHeightSmall"
+ android:gravity="center_vertical"
+ android:paddingStart="?android:attr/listPreferredItemPaddingStart"
+ android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
+ android:background="?android:attr/activatedBackgroundIndicator"
+ android:clipToPadding="false">
+
+ <LinearLayout
+ android:id="@+id/icon_frame"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="-4dp"
+ android:minWidth="60dp"
+ android:gravity="start|center_vertical"
+ android:orientation="horizontal"
+ android:paddingEnd="12dp"
+ android:paddingTop="4dp"
+ android:paddingBottom="4dp">
+ <com.android.internal.widget.PreferenceImageView
+ android:id="@android:id/icon"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:maxWidth="48dp"
+ android:maxHeight="48dp" />
+ </LinearLayout>
+
+ <RelativeLayout
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:paddingTop="16dp"
+ android:paddingBottom="16dp">
+
+ <TextView android:id="@android:id/title"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:singleLine="true"
+ android:textAppearance="?android:attr/textAppearanceListItem"
+ android:ellipsize="marquee" />
+
+ <TextView android:id="@android:id/summary"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_below="@android:id/title"
+ android:layout_alignStart="@android:id/title"
+ android:textAppearance="?android:attr/textAppearanceListItemSecondary"
+ android:textColor="?android:attr/textColorSecondary"
+ android:maxLines="10" />
+
+ <ProgressBar
+ android:id="@android:id/progress"
+ android:layout_width="match_parent"
+ android:layout_height="8dp"
+ android:layout_marginTop="8dp"
+ android:layout_below="@android:id/summary"
+ android:layout_alignStart="@android:id/summary"
+ android:max="100"
+ style="?android:attr/progressBarStyleHorizontal" />
+
+ </RelativeLayout>
+
+ <!-- Preference should place its actual preference widget here. -->
+ <LinearLayout android:id="@android:id/widget_frame"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:gravity="end|center_vertical"
+ android:paddingStart="16dp"
+ android:orientation="vertical" />
+
+</LinearLayout>
diff --git a/res/layout/preference_app_percentage.xml b/res/layout/widget_progress_bar.xml
similarity index 63%
copy from res/layout/preference_app_percentage.xml
copy to res/layout/widget_progress_bar.xml
index 7dc9d46..a2a5154 100644
--- a/res/layout/preference_app_percentage.xml
+++ b/res/layout/widget_progress_bar.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 The Android Open Source Project
+<!-- Copyright (C) 2015 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -14,12 +14,10 @@
limitations under the License.
-->
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<ProgressBar xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@android:id/progress"
android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:paddingStart="?android:attr/listPreferredItemPaddingStart"
- android:paddingEnd="?android:attr/listPreferredItemPaddingEnd">
-
- <include layout="@layout/app_percentage_item" />
-
-</LinearLayout>
+ android:layout_height="wrap_content"
+ android:layout_marginTop="4dp"
+ android:max="100"
+ style="?android:attr/progressBarStyleHorizontal" />
diff --git a/res/layout/widget_text_views.xml b/res/layout/widget_text_views.xml
new file mode 100644
index 0000000..2e029e8
--- /dev/null
+++ b/res/layout/widget_text_views.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2015 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal">
+
+ <TextView
+ android:id="@+id/widget_text1"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:layout_gravity="fill_horizontal|top"
+ android:textAppearance="@android:style/TextAppearance.Material.Body1"
+ android:textColor="?android:attr/textColorSecondary"
+ android:textAlignment="viewStart"
+ android:singleLine="true"
+ android:ellipsize="marquee"
+ android:duplicateParentState="true" />
+
+ <TextView
+ android:id="@+id/widget_text2"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:layout_marginStart="8dip"
+ android:layout_gravity="fill_horizontal|top"
+ android:textAppearance="@android:style/TextAppearance.Material.Body1"
+ android:textColor="?android:attr/textColorSecondary"
+ android:textAlignment="viewEnd"
+ android:singleLine="true"
+ android:ellipsize="marquee"
+ android:duplicateParentState="true" />
+
+</LinearLayout>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 6a61aa0..3d74e5d 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -164,35 +164,6 @@
<!-- Title for a notification shown. -->
<string name="sdcard_setting" product="default">SD card</string>
- <!-- Battery Info screen. Label for a status item. Used for diagnostic info screens, precise translation isn't needed -->
- <string name="battery_info_status_label">Battery status:</string>
- <!-- Battery Info screen. Label for a status item. Used for diagnostic info screens, precise translation isn't needed -->
- <string name="battery_info_power_label">Power plug:</string>
- <!-- Battery Info screen. Label for a status item. Used for diagnostic info screens, precise translation isn't needed -->
- <string name="battery_info_scale_label">Battery scale:</string>
- <!-- Battery Info screen. Label for a status item. Used for diagnostic info screens, precise translation isn't needed -->
- <string name="battery_info_level_label">Battery level:</string>
- <!-- Battery Info screen. Label for a status item. Used for diagnostic info screens, precise translation isn't needed -->
- <string name="battery_info_health_label">Battery health:</string>
- <!-- Battery Info screen. Label for a status item. Used for diagnostic info screens, precise translation isn't needed -->
- <string name="battery_info_technology_label">Battery technology:</string>
- <!-- Battery Info screen. Label for a status item. Used for diagnostic info screens, precise translation isn't needed -->
- <string name="battery_info_voltage_label">Battery voltage:</string>
- <!-- Battery Info screen. Units shown after a value. Used for diagnostic info screens, precise translation isn't needed -->
- <string name="battery_info_voltage_units">mV</string>
- <!-- Battery Info screen. Label for a status item. Used for diagnostic info screens, precise translation isn't needed -->
- <string name="battery_info_temperature_label">Battery temperature:</string>
- <!-- Battery Info screen. Units shown after a value. Used for diagnostic info screens, precise translation isn't needed -->
- <string name="battery_info_temperature_units">\u00B0 C</string>
- <!-- Battery Info screen. Label for a status item. Used for diagnostic info screens, precise translation isn't needed -->
- <string name="battery_info_uptime">Time since boot:</string>
- <!-- Battery Info screen. Label for a status item. Used for diagnostic info screens, precise translation isn't needed -->
- <string name="battery_info_awake_battery">Awake time on battery:</string>
- <!-- Battery Info screen. Label for a status item. Used for diagnostic info screens, precise translation isn't needed -->
- <string name="battery_info_awake_plugged">Awake time when charging:</string>
- <!-- Battery Info screen. Label for a status item. Used for diagnostic info screens, precise translation isn't needed -->
- <string name="battery_info_screen_on">Screen ON time:</string>
-
<!-- Battery Info screen. Value for a status item. Used for diagnostic info screens, precise translation isn't needed -->
<string name="battery_info_status_unknown">Unknown</string>
<!-- [CHAR_LIMIT=20] Battery use screen. Battery status shown in chart label when charging from an unknown source. -->
@@ -210,29 +181,6 @@
<!-- Battery Info screen. Value for a status item. Used for diagnostic info screens, precise translation isn't needed -->
<string name="battery_info_status_full">Full</string>
- <!-- Battery Info screen. Units shown after a value. Used for diagnostic info screens, precise translation isn't needed -->
- <string name="battery_info_power_unplugged">Unplugged</string>
- <string name="battery_info_power_ac">AC</string>
- <string name="battery_info_power_usb">USB</string>
- <string name="battery_info_power_wireless">wireless</string>
- <string name="battery_info_power_ac_usb">AC+USB</string>
- <string name="battery_info_power_unknown">Unknown</string>
-
- <!-- Battery Info screen. Value for a status item. Used for diagnostic info screens, precise translation isn't needed -->
- <string name="battery_info_health_unknown">Unknown</string>
- <!-- Battery Info screen. Value for a status item. Used for diagnostic info screens, precise translation isn't needed -->
- <string name="battery_info_health_good">Good</string>
- <!-- Battery Info screen. Value for a status item. Used for diagnostic info screens, precise translation isn't needed -->
- <string name="battery_info_health_overheat">Overheat</string>
- <!-- Battery Info screen. Value for a status item. Used for diagnostic info screens, precise translation isn't needed -->
- <string name="battery_info_health_dead">Dead</string>
- <!-- Battery Info screen. Value for a status item. Used for diagnostic info screens, precise translation isn't needed -->
- <string name="battery_info_health_over_voltage">Over voltage</string>
- <!-- Battery Info screen. Value for a status item. Used for diagnostic info screens, precise translation isn't needed -->
- <string name="battery_info_health_unspecified_failure">Unknown error</string>
- <!-- Battery Info screen. Value for a status item. Used for diagnostic info screens, precise translation isn't needed -->
- <string name="battery_info_health_cold">Cold</string>
-
<!-- Used as setting title (for checkbox) on second screen after selecting Bluetooth settings -->
<string name="bluetooth">Bluetooth</string>
<!-- Bluetooth settings screen, summary after selecting Discoverable check box [CHAR LIMIT=50] -->
@@ -572,8 +520,6 @@
<string name="debug_intent_sender_label">Debug intent sender</string>
<!-- The title of the activity to see random device info. -->
<string name="device_info_label">Device info</string>
- <!-- The title of the activity to see battery info. -->
- <string name="battery_info_label">Battery info</string>
<!-- The title of the activity to adjust display settings -->
<string name="display_label">Screen</string>
<!-- The title of the activity to see phone info -->
@@ -749,11 +695,11 @@
<!-- Fingerprint managment category title - configuration options for managing enrolled fingerprints [CHAR LIMIT=22] -->
<string name="fingerprint_manage_category_title">Manage fingerprints</string>
<!-- Fingerprint category title - configuration options for managing fingerprint enrollment [CHAR LIMIT=22] -->
- <string name="fingerprint_usage_category_title">Use fingerprint for</string>
- <!-- Preference to add another fingerprint -->
- <string name="fingerprint_add_title">Add fingerprint</string>
- <!-- switch for allowing fingerprint to be used for keyguard -->
- <string name="fingerprint_enable_keyguard_toggle_title">screen lock</string>
+ <string name="fingerprint_usage_category_title">Use fingerprint for</string>
+ <!-- Preference to add another fingerprint -->
+ <string name="fingerprint_add_title">Add fingerprint</string>
+ <!-- switch for allowing fingerprint to be used for keyguard -->
+ <string name="fingerprint_enable_keyguard_toggle_title">screen lock</string>
<!-- message shown for menu item that launches fingerprint settings or enrollment -->
<plurals name="security_settings_fingerprint_preference_summary">
<item quantity="one"><xliff:g id="count">%1$d</xliff:g> fingerprint set up</item>
@@ -826,6 +772,9 @@
<!-- Text shown in fingerprint enroll when we didn't observe progress for a few seconds. [CHAR LIMIT=100] -->
<string name="security_settings_fingerprint_enroll_lift_touch_again">Lift finger, then touch sensor again</string>
+ <!-- Text shown when "Add fingerprint" button is disabled -->
+ <string name="fingerprint_add_max">You can add up to <xliff:g id="count" example="5">%d</xliff:g> fingerprints</string>
+
<!-- Title of the preferences category for preference items to control encryption -->
<string name="crypt_keeper_settings_title">Encryption</string>
@@ -1206,8 +1155,6 @@
<!-- Message when bluetooth dialog when passkey or pin needs to be displayed. -->
<string name="bluetooth_display_passkey_pin_msg">To pair with:<xliff:g id="bold1"><br><b></xliff:g><xliff:g id="device_name">%1$s</xliff:g><xliff:g id="end_bold1"></b><br><br></xliff:g>Type on it:<xliff:g id="bold2"><br><b></xliff:g><xliff:g id="passkey">%2$s</xliff:g><xliff:g id="end_bold2"></b></xliff:g>, then press Return or Enter.</string>
- <!-- Message in pairing dialogs. [CHAR LIMIT=NONE] -->
- <string name="bluetooth_pairing_will_share_phonebook">Pairing grants access to your contacts and call history when connected.</string>
<!-- Checkbox message in pairing dialogs. [CHAR LIMIT=NONE] -->
<string name="bluetooth_pairing_shares_phonebook">Grant access to your contacts and call history when connected.</string>
@@ -2363,7 +2310,7 @@
<!-- Summary of a single storage volume, constrasting available and total storage space. [CHAR LIMIT=48]-->
<string name="storage_volume_summary"><xliff:g id="used" example="1.2GB">%1$s</xliff:g> used of <xliff:g id="total" example="32GB">%2$s</xliff:g></string>
<!-- Summary of a single storage volume used space. [CHAR LIMIT=24] -->
- <string name="storage_size_large"><xliff:g id="number" example="128">^1</xliff:g> <small><small><xliff:g id="unit" example="KB">^2</xliff:g></small></small></string>
+ <string name="storage_size_large"><xliff:g id="number" example="128">^1</xliff:g><small><small> <xliff:g id="unit" example="KB">^2</xliff:g></small></small></string>
<!-- Summary of a single storage volume total space. [CHAR LIMIT=48]-->
<string name="storage_volume_used">Used of <xliff:g id="total" example="32GB">%1$s</xliff:g></string>
<!-- Summary of a single storage volume total space. [CHAR LIMIT=48]-->
@@ -3552,8 +3499,6 @@
<string name="testing_phone_info" product="tablet">Tablet information</string>
<!-- In the Testing screen. The item title of the activity that shows a bunch of phone-related information. -->
<string name="testing_phone_info" product="default">Phone information</string>
- <!-- In the Testing screen. The item title of the activity that shows a bunch of battery-related information. -->
- <string name="testing_battery_info">Battery information</string>
<!-- Do not translate. In the Testing screen. The item title of the activity that shows a bunch of SIM-related operations. -->
<string name="testing_sim_toolkit">SIM toolkit</string>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 1b7caf7..d24337f 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -93,6 +93,10 @@
<item name="android:windowContentOverlay">@null</item>
</style>
+ <style name="Preference">
+ <item name="android:layout">@layout/preference_material_settings</item>
+ </style>
+
<style name="PreferenceHeaderPanelSinglePane">
<item name="android:layout_marginStart">0dp</item>
<item name="android:layout_marginEnd">0dp</item>
@@ -339,4 +343,4 @@
<item name="android:textSize">16sp</item>
<item name="android:textColor">?android:attr/textColorPrimary</item>
</style>
-</resources>
\ No newline at end of file
+</resources>
diff --git a/res/values/themes.xml b/res/values/themes.xml
index 08b8de3..e6621a8 100644
--- a/res/values/themes.xml
+++ b/res/values/themes.xml
@@ -80,6 +80,7 @@
<style name="Theme.SettingsBase" parent="@android:style/Theme.Material.Settings" />
<style name="Theme.Settings" parent="Theme.SettingsBase">
+ <item name="@*android:preferenceStyle">@style/Preference</item>
<item name="@*android:preferenceHeaderPanelStyle">@style/PreferenceHeaderPanelSinglePane</item>
<item name="@*android:preferencePanelStyle">@style/PreferencePanelSinglePane</item>
<item name="@*android:preferenceListStyle">@style/PreferenceHeaderListSinglePane</item>
diff --git a/res/xml/testing_settings.xml b/res/xml/testing_settings.xml
index c55cb46..d8d7705 100644
--- a/res/xml/testing_settings.xml
+++ b/res/xml/testing_settings.xml
@@ -23,14 +23,6 @@
android:targetPackage="com.android.settings"
android:targetClass="com.android.settings.RadioInfo" />
</PreferenceScreen>
-
- <PreferenceScreen
- android:title="@string/testing_battery_info">
- <intent android:action="android.intent.action.MAIN"
- android:targetPackage="com.android.settings"
- android:targetClass="com.android.settings.BatteryInfo" />
- </PreferenceScreen>
-
<PreferenceScreen
android:title="@string/testing_usage_stats">
diff --git a/src/com/android/settings/AppPicker.java b/src/com/android/settings/AppPicker.java
index 2447bcb..04e48ff 100644
--- a/src/com/android/settings/AppPicker.java
+++ b/src/com/android/settings/AppPicker.java
@@ -164,7 +164,6 @@
holder.summary.setText("");
}
holder.disabled.setVisibility(View.GONE);
- holder.checkBox.setVisibility(View.GONE);
return convertView;
}
}
diff --git a/src/com/android/settings/AppProgressPreference.java b/src/com/android/settings/AppProgressPreference.java
new file mode 100644
index 0000000..cd157d1
--- /dev/null
+++ b/src/com/android/settings/AppProgressPreference.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.android.settings;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.view.View;
+import android.widget.ProgressBar;
+
+public class AppProgressPreference extends TintablePreference {
+
+ private int mProgress;
+
+ public AppProgressPreference(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ setLayoutResource(R.layout.preference_app);
+ setWidgetLayoutResource(R.layout.widget_progress_bar);
+ }
+
+ public void setProgress(int amount) {
+ mProgress = amount;
+ notifyChanged();
+ }
+
+ @Override
+ protected void onBindView(View view) {
+ super.onBindView(view);
+
+ final ProgressBar progress = (ProgressBar) view.findViewById(android.R.id.progress);
+ progress.setProgress(mProgress);
+ }
+}
diff --git a/src/com/android/settings/BatteryInfo.java b/src/com/android/settings/BatteryInfo.java
deleted file mode 100644
index d35771f..0000000
--- a/src/com/android/settings/BatteryInfo.java
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- * Copyright (C) 2006 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.settings;
-
-import android.app.Activity;
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.os.BatteryManager;
-import android.os.BatteryStats;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.IPowerManager;
-import android.os.Message;
-import android.os.ServiceManager;
-import android.os.SystemClock;
-import android.text.format.DateUtils;
-import android.widget.TextView;
-
-import com.android.internal.app.IBatteryStats;
-
-public class BatteryInfo extends Activity {
- private TextView mStatus;
- private TextView mPower;
- private TextView mLevel;
- private TextView mScale;
- private TextView mHealth;
- private TextView mVoltage;
- private TextView mTemperature;
- private TextView mTechnology;
- private TextView mUptime;
- private IBatteryStats mBatteryStats;
- private IPowerManager mScreenStats;
-
- private static final int EVENT_TICK = 1;
-
- private Handler mHandler = new Handler() {
- @Override
- public void handleMessage(Message msg) {
- switch (msg.what) {
- case EVENT_TICK:
- updateBatteryStats();
- sendEmptyMessageDelayed(EVENT_TICK, 1000);
-
- break;
- }
- }
- };
-
- /**
- * Format a number of tenths-units as a decimal string without using a
- * conversion to float. E.g. 347 -> "34.7", -99 -> "-9.9"
- */
- private final String tenthsToFixedString(int x) {
- int tens = x / 10;
- // use Math.abs to avoid "-9.-9" about -99
- return Integer.toString(tens) + "." + Math.abs(x - 10 * tens);
- }
-
- /**
- *Listens for intent broadcasts
- */
- private IntentFilter mIntentFilter;
-
- private BroadcastReceiver mIntentReceiver = new BroadcastReceiver() {
- @Override
- public void onReceive(Context context, Intent intent) {
- String action = intent.getAction();
- if (action.equals(Intent.ACTION_BATTERY_CHANGED)) {
- int plugType = intent.getIntExtra("plugged", 0);
-
- mLevel.setText("" + intent.getIntExtra("level", 0));
- mScale.setText("" + intent.getIntExtra("scale", 0));
- mVoltage.setText("" + intent.getIntExtra("voltage", 0) + " "
- + getString(R.string.battery_info_voltage_units));
- mTemperature.setText("" + tenthsToFixedString(intent.getIntExtra("temperature", 0))
- + getString(R.string.battery_info_temperature_units));
- mTechnology.setText("" + intent.getStringExtra("technology"));
-
- mStatus.setText(Utils.getBatteryStatus(getResources(), intent));
-
- switch (plugType) {
- case 0:
- mPower.setText(getString(R.string.battery_info_power_unplugged));
- break;
- case BatteryManager.BATTERY_PLUGGED_AC:
- mPower.setText(getString(R.string.battery_info_power_ac));
- break;
- case BatteryManager.BATTERY_PLUGGED_USB:
- mPower.setText(getString(R.string.battery_info_power_usb));
- break;
- case BatteryManager.BATTERY_PLUGGED_WIRELESS:
- mPower.setText(getString(R.string.battery_info_power_wireless));
- break;
- case (BatteryManager.BATTERY_PLUGGED_AC|BatteryManager.BATTERY_PLUGGED_USB):
- mPower.setText(getString(R.string.battery_info_power_ac_usb));
- break;
- default:
- mPower.setText(getString(R.string.battery_info_power_unknown));
- break;
- }
-
- int health = intent.getIntExtra("health", BatteryManager.BATTERY_HEALTH_UNKNOWN);
- String healthString;
- if (health == BatteryManager.BATTERY_HEALTH_GOOD) {
- healthString = getString(R.string.battery_info_health_good);
- } else if (health == BatteryManager.BATTERY_HEALTH_OVERHEAT) {
- healthString = getString(R.string.battery_info_health_overheat);
- } else if (health == BatteryManager.BATTERY_HEALTH_DEAD) {
- healthString = getString(R.string.battery_info_health_dead);
- } else if (health == BatteryManager.BATTERY_HEALTH_OVER_VOLTAGE) {
- healthString = getString(R.string.battery_info_health_over_voltage);
- } else if (health == BatteryManager.BATTERY_HEALTH_UNSPECIFIED_FAILURE) {
- healthString = getString(R.string.battery_info_health_unspecified_failure);
- } else if (health == BatteryManager.BATTERY_HEALTH_COLD) {
- healthString = getString(R.string.battery_info_health_cold);
- } else {
- healthString = getString(R.string.battery_info_health_unknown);
- }
- mHealth.setText(healthString);
- }
- }
- };
-
- @Override
- public void onCreate(Bundle icicle) {
- super.onCreate(icicle);
-
- setContentView(R.layout.battery_info);
-
- // create the IntentFilter that will be used to listen
- // to battery status broadcasts
- mIntentFilter = new IntentFilter();
- mIntentFilter.addAction(Intent.ACTION_BATTERY_CHANGED);
- }
-
- @Override
- public void onResume() {
- super.onResume();
-
- mStatus = (TextView)findViewById(R.id.status);
- mPower = (TextView)findViewById(R.id.power);
- mLevel = (TextView)findViewById(R.id.level);
- mScale = (TextView)findViewById(R.id.scale);
- mHealth = (TextView)findViewById(R.id.health);
- mTechnology = (TextView)findViewById(R.id.technology);
- mVoltage = (TextView)findViewById(R.id.voltage);
- mTemperature = (TextView)findViewById(R.id.temperature);
- mUptime = (TextView) findViewById(R.id.uptime);
-
- // Get awake time plugged in and on battery
- mBatteryStats = IBatteryStats.Stub.asInterface(ServiceManager.getService(
- BatteryStats.SERVICE_NAME));
- mScreenStats = IPowerManager.Stub.asInterface(ServiceManager.getService(POWER_SERVICE));
- mHandler.sendEmptyMessageDelayed(EVENT_TICK, 1000);
-
- registerReceiver(mIntentReceiver, mIntentFilter);
- }
-
- @Override
- public void onPause() {
- super.onPause();
- mHandler.removeMessages(EVENT_TICK);
-
- // we are no longer on the screen stop the observers
- unregisterReceiver(mIntentReceiver);
- }
-
- private void updateBatteryStats() {
- long uptime = SystemClock.elapsedRealtime();
- mUptime.setText(DateUtils.formatElapsedTime(uptime / 1000));
- }
-
-}
diff --git a/src/com/android/settings/DataUsageSummary.java b/src/com/android/settings/DataUsageSummary.java
index 744ed3f..4b3a7f7 100644
--- a/src/com/android/settings/DataUsageSummary.java
+++ b/src/com/android/settings/DataUsageSummary.java
@@ -588,7 +588,7 @@
final MenuItem help = menu.findItem(R.id.data_usage_menu_help);
String helpUrl;
if (!TextUtils.isEmpty(helpUrl = getResources().getString(R.string.help_url_data_usage))) {
- HelpUtils.prepareHelpMenuItem(context, help, helpUrl, getClass().getName());
+ HelpUtils.prepareHelpMenuItem(getActivity(), help, helpUrl, getClass().getName());
} else {
help.setVisible(false);
}
@@ -1882,10 +1882,10 @@
@Override
public View getView(int position, View convertView, ViewGroup parent) {
final AppItem item = mItems.get(position);
+ LayoutInflater inflater = LayoutInflater.from(parent.getContext());
if (getItemViewType(position) == 1) {
if (convertView == null) {
- convertView = Utils.inflateCategoryHeader(LayoutInflater.from(
- parent.getContext()), parent);
+ convertView = Utils.inflateCategoryHeader(inflater, parent);
}
final TextView title = (TextView) convertView.findViewById(android.R.id.title);
@@ -1893,8 +1893,9 @@
} else {
if (convertView == null) {
- convertView = LayoutInflater.from(parent.getContext()).inflate(
- R.layout.data_usage_item, parent, false);
+ convertView = inflater.inflate(R.layout.data_usage_item, parent, false);
+ inflater.inflate(R.layout.widget_progress_bar,
+ (ViewGroup) convertView.findViewById(android.R.id.widget_frame));
if (mInsetSide > 0) {
convertView.setPaddingRelative(mInsetSide, 0, mInsetSide, 0);
@@ -1903,7 +1904,7 @@
final Context context = parent.getContext();
- final TextView text1 = (TextView) convertView.findViewById(android.R.id.text1);
+ final TextView summary = (TextView) convertView.findViewById(android.R.id.summary);
final ProgressBar progress = (ProgressBar) convertView.findViewById(
android.R.id.progress);
@@ -1911,10 +1912,10 @@
UidDetailTask.bindView(mProvider, item, convertView);
if (item.restricted && item.total <= 0) {
- text1.setText(R.string.data_usage_app_restricted);
+ summary.setText(R.string.data_usage_app_restricted);
progress.setVisibility(View.GONE);
} else {
- text1.setText(Formatter.formatFileSize(context, item.total));
+ summary.setText(Formatter.formatFileSize(context, item.total));
progress.setVisibility(View.VISIBLE);
}
diff --git a/src/com/android/settings/DeviceInfoSettings.java b/src/com/android/settings/DeviceInfoSettings.java
index e1df499..76b4635 100644
--- a/src/com/android/settings/DeviceInfoSettings.java
+++ b/src/com/android/settings/DeviceInfoSettings.java
@@ -24,6 +24,7 @@
import android.content.pm.ResolveInfo;
import android.os.Build;
import android.os.Bundle;
+import android.os.PersistableBundle;
import android.os.SELinux;
import android.os.SystemClock;
import android.os.SystemProperties;
@@ -34,6 +35,7 @@
import android.preference.PreferenceScreen;
import android.provider.SearchIndexableResource;
import android.provider.Settings;
+import android.telephony.CarrierConfigManager;
import android.text.TextUtils;
import android.util.Log;
import android.widget.Toast;
@@ -181,6 +183,12 @@
System.arraycopy(mHits, 1, mHits, 0, mHits.length-1);
mHits[mHits.length-1] = SystemClock.uptimeMillis();
if (mHits[0] >= (SystemClock.uptimeMillis()-500)) {
+ UserManager um = (UserManager) getActivity().getSystemService(Context.USER_SERVICE);
+ if (um.hasUserRestriction(UserManager.DISALLOW_FUN)) {
+ Log.d(LOG_TAG, "Sorry, no fun for you!");
+ return false;
+ }
+
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.setClassName("android",
com.android.internal.app.PlatLogoActivity.class.getName());
@@ -234,10 +242,39 @@
}
} else if (preference.getKey().equals(KEY_DEVICE_FEEDBACK)) {
sendFeedback();
+ } else if(preference.getKey().equals(KEY_SYSTEM_UPDATE_SETTINGS)) {
+ CarrierConfigManager configManager =
+ (CarrierConfigManager) getSystemService(Context.CARRIER_CONFIG_SERVICE);
+ PersistableBundle b = configManager.getConfig();
+ if (b.getBoolean(CarrierConfigManager.KEY_CI_ACTION_ON_SYS_UPDATE_BOOL)) {
+ ciActionOnSysUpdate(b);
+ }
}
return super.onPreferenceTreeClick(preferenceScreen, preference);
}
+ /**
+ * Trigger client initiated action (send intent) on system update
+ */
+ private void ciActionOnSysUpdate(PersistableBundle b) {
+ String intentStr = b.getString(CarrierConfigManager.
+ KEY_CI_ACTION_ON_SYS_UPDATE_INTENT_STRING);
+ if (!TextUtils.isEmpty(intentStr)) {
+ String extra = b.getString(CarrierConfigManager.
+ KEY_CI_ACTION_ON_SYS_UPDATE_EXTRA_STRING);
+ String extraVal = b.getString(CarrierConfigManager.
+ KEY_CI_ACTION_ON_SYS_UPDATE_EXTRA_VAL_STRING);
+
+ Intent intent = new Intent(intentStr);
+ if (!TextUtils.isEmpty(extra)) {
+ intent.putExtra(extra, extraVal);
+ }
+ Log.d(LOG_TAG, "ciActionOnSysUpdate: broadcasting intent " + intentStr +
+ " with extra " + extra + ", " + extraVal);
+ getActivity().getApplicationContext().sendBroadcast(intent);
+ }
+ }
+
private void removePreferenceIfPropertyMissing(PreferenceGroup preferenceGroup,
String preference, String property ) {
if (SystemProperties.get(property).equals("")) {
diff --git a/src/com/android/settings/HelpUtils.java b/src/com/android/settings/HelpUtils.java
index 0e79c6d..3c36edb 100644
--- a/src/com/android/settings/HelpUtils.java
+++ b/src/com/android/settings/HelpUtils.java
@@ -16,6 +16,7 @@
package com.android.settings;
+import android.app.Activity;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
@@ -28,6 +29,7 @@
import android.util.TypedValue;
import android.view.Menu;
import android.view.MenuItem;
+import android.view.MenuItem.OnMenuItemClickListener;
import java.net.URISyntaxException;
import java.util.Locale;
@@ -65,16 +67,16 @@
/** Static helper that is not instantiable*/
private HelpUtils() { }
- public static boolean prepareHelpMenuItem(Context context, Menu menu, String helpUri,
+ public static boolean prepareHelpMenuItem(Activity activity, Menu menu, String helpUri,
String backupContext) {
MenuItem helpItem = menu.add(0, MENU_HELP, 0, R.string.help_label);
- return prepareHelpMenuItem(context, helpItem, helpUri, backupContext);
+ return prepareHelpMenuItem(activity, helpItem, helpUri, backupContext);
}
- public static boolean prepareHelpMenuItem(Context context, Menu menu, int helpUriResource,
+ public static boolean prepareHelpMenuItem(Activity activity, Menu menu, int helpUriResource,
String backupContext) {
MenuItem helpItem = menu.add(0, MENU_HELP, 0, R.string.help_label);
- return prepareHelpMenuItem(context, helpItem, context.getString(helpUriResource),
+ return prepareHelpMenuItem(activity, helpItem, activity.getString(helpUriResource),
backupContext);
}
@@ -86,7 +88,7 @@
*
* @return returns whether the help menu item has been made visible.
*/
- public static boolean prepareHelpMenuItem(Context context, MenuItem helpMenuItem,
+ public static boolean prepareHelpMenuItem(final Activity activity, MenuItem helpMenuItem,
String helpUriString, String backupContext) {
if (TextUtils.isEmpty(helpUriString)) {
// The help url string is empty or null, so set the help menu item to be invisible.
@@ -95,12 +97,18 @@
// return that the help menu item is not visible (i.e. false)
return false;
} else {
- Intent intent = getHelpIntent(context, helpUriString, backupContext);
+ final Intent intent = getHelpIntent(activity, helpUriString, backupContext);
// Set the intent to the help menu item, show the help menu item in the overflow
// menu, and make it visible.
if (intent != null) {
- helpMenuItem.setIntent(intent);
+ helpMenuItem.setOnMenuItemClickListener(new OnMenuItemClickListener() {
+ @Override
+ public boolean onMenuItemClick(MenuItem item) {
+ activity.startActivityForResult(intent, 0);
+ return true;
+ }
+ });
helpMenuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
helpMenuItem.setVisible(true);
} else {
diff --git a/src/com/android/settings/SettingsActivity.java b/src/com/android/settings/SettingsActivity.java
index f376644..226ea0e 100644
--- a/src/com/android/settings/SettingsActivity.java
+++ b/src/com/android/settings/SettingsActivity.java
@@ -73,6 +73,7 @@
import com.android.settings.applications.InstalledAppDetails;
import com.android.settings.applications.ManageApplications;
import com.android.settings.applications.ManageAssist;
+import com.android.settings.applications.ProcessStatsSummary;
import com.android.settings.applications.ProcessStatsUi;
import com.android.settings.applications.UsageAccessDetails;
import com.android.settings.bluetooth.BluetoothSettings;
@@ -346,6 +347,7 @@
ZenModeExternalRuleSettings.class.getName(),
ProcessStatsUi.class.getName(),
PowerUsageDetail.class.getName(),
+ ProcessStatsSummary.class.getName(),
};
diff --git a/src/com/android/settings/applications/AppOpsDetails.java b/src/com/android/settings/applications/AppOpsDetails.java
index 0643b56..a8320b1 100644
--- a/src/com/android/settings/applications/AppOpsDetails.java
+++ b/src/com/android/settings/applications/AppOpsDetails.java
@@ -27,6 +27,7 @@
import android.content.pm.PermissionGroupInfo;
import android.content.pm.PermissionInfo;
import android.content.res.Resources;
+import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
@@ -57,29 +58,15 @@
private PackageInfo mPackageInfo;
private LayoutInflater mInflater;
private View mRootView;
- private TextView mAppVersion;
private LinearLayout mOperationsSection;
// Utility method to set application label and icon.
private void setAppLabelAndIcon(PackageInfo pkgInfo) {
final View appSnippet = mRootView.findViewById(R.id.app_snippet);
- appSnippet.setPaddingRelative(0, appSnippet.getPaddingTop(), 0, appSnippet.getPaddingBottom());
-
- ImageView icon = (ImageView) appSnippet.findViewById(R.id.app_icon);
- icon.setImageDrawable(mPm.getApplicationIcon(pkgInfo.applicationInfo));
- // Set application name.
- TextView label = (TextView) appSnippet.findViewById(R.id.app_name);
- label.setText(mPm.getApplicationLabel(pkgInfo.applicationInfo));
- // Version number of application
- mAppVersion = (TextView) appSnippet.findViewById(R.id.app_summary);
-
- if (pkgInfo.versionName != null) {
- mAppVersion.setVisibility(View.VISIBLE);
- mAppVersion.setText(getActivity().getString(R.string.version_text,
- String.valueOf(pkgInfo.versionName)));
- } else {
- mAppVersion.setVisibility(View.INVISIBLE);
- }
+ CharSequence label = mPm.getApplicationLabel(pkgInfo.applicationInfo);
+ Drawable icon = mPm.getApplicationIcon(pkgInfo.applicationInfo);
+ InstalledAppDetails.setupAppSnippet(appSnippet, label, icon,
+ pkgInfo != null ? pkgInfo.versionName : null);
}
private String retrieveAppEntry() {
diff --git a/src/com/android/settings/applications/AppStatePowerBridge.java b/src/com/android/settings/applications/AppStatePowerBridge.java
index 3b1707f..069c901 100644
--- a/src/com/android/settings/applications/AppStatePowerBridge.java
+++ b/src/com/android/settings/applications/AppStatePowerBridge.java
@@ -19,6 +19,7 @@
import com.android.settingslib.applications.ApplicationsState;
import com.android.settingslib.applications.ApplicationsState.AppEntry;
import com.android.settingslib.applications.ApplicationsState.AppFilter;
+import com.android.settingslib.applications.ApplicationsState.CompoundFilter;
import java.util.ArrayList;
@@ -54,7 +55,8 @@
public boolean isSystemHighPower;
}
- public static final AppFilter FILTER_POWER_WHITELISTED = new AppFilter() {
+ public static final AppFilter FILTER_POWER_WHITELISTED = new CompoundFilter(
+ ApplicationsState.FILTER_PERSONAL, new AppFilter() {
@Override
public void init() {
}
@@ -63,17 +65,5 @@
public boolean filterApp(AppEntry info) {
return info.extraInfo == Boolean.TRUE;
}
- };
-
- public static final AppFilter FILTER_POWER_NOT_WHITELISTED = new AppFilter() {
- @Override
- public void init() {
- }
-
- @Override
- public boolean filterApp(AppEntry info) {
- return info.extraInfo == Boolean.FALSE;
- }
- };
-
+ });
}
diff --git a/src/com/android/settings/applications/AppViewHolder.java b/src/com/android/settings/applications/AppViewHolder.java
index f58cf06..9771427 100644
--- a/src/com/android/settings/applications/AppViewHolder.java
+++ b/src/com/android/settings/applications/AppViewHolder.java
@@ -19,6 +19,7 @@
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
+import android.view.ViewGroup;
import android.widget.CheckBox;
import android.widget.ImageView;
import android.widget.TextView;
@@ -34,21 +35,21 @@
public ImageView appIcon;
public TextView summary;
public TextView disabled;
- public CheckBox checkBox;
static public AppViewHolder createOrRecycle(LayoutInflater inflater, View convertView) {
if (convertView == null) {
- convertView = inflater.inflate(R.layout.manage_applications_item, null);
+ convertView = inflater.inflate(R.layout.preference_app, null);
+ inflater.inflate(R.layout.widget_text_views,
+ (ViewGroup) convertView.findViewById(android.R.id.widget_frame));
// Creates a ViewHolder and store references to the two children views
// we want to bind data to.
AppViewHolder holder = new AppViewHolder();
holder.rootView = convertView;
- holder.appName = (TextView) convertView.findViewById(R.id.app_name);
- holder.appIcon = (ImageView) convertView.findViewById(R.id.app_icon);
- holder.summary = (TextView) convertView.findViewById(R.id.app_summary);
- holder.disabled = (TextView) convertView.findViewById(R.id.app_disabled);
- holder.checkBox = (CheckBox) convertView.findViewById(R.id.app_on_sdcard);
+ holder.appName = (TextView) convertView.findViewById(android.R.id.title);
+ holder.appIcon = (ImageView) convertView.findViewById(android.R.id.icon);
+ holder.summary = (TextView) convertView.findViewById(R.id.widget_text1);
+ holder.disabled = (TextView) convertView.findViewById(R.id.widget_text2);
convertView.setTag(holder);
return holder;
} else {
diff --git a/src/com/android/settings/applications/DefaultAssistPreference.java b/src/com/android/settings/applications/DefaultAssistPreference.java
index 260d4b9..0bd729e 100644
--- a/src/com/android/settings/applications/DefaultAssistPreference.java
+++ b/src/com/android/settings/applications/DefaultAssistPreference.java
@@ -21,15 +21,15 @@
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
+import android.os.UserHandle;
import android.provider.Settings;
import android.service.voice.VoiceInteractionService;
import android.service.voice.VoiceInteractionServiceInfo;
import android.speech.RecognitionService;
import android.util.AttributeSet;
import android.util.Log;
-import android.view.View;
-import android.view.ViewGroup;
+import com.android.internal.app.AssistUtils;
import com.android.settings.AppListPreferenceWithSettings;
import com.android.settings.R;
@@ -42,10 +42,13 @@
private final List<Info> mAvailableAssistants = new ArrayList<>();
+ private final AssistUtils mAssistUtils;
+
public DefaultAssistPreference(Context context, AttributeSet attrs) {
super(context, attrs);
setShowItemNone(true);
setDialogTitle(R.string.choose_assist_title);
+ mAssistUtils = new AssistUtils(context);
}
@Override
@@ -169,9 +172,7 @@
}
public ComponentName getCurrentAssist() {
- String currentSetting = Settings.Secure.getString(getContext().getContentResolver(),
- Settings.Secure.ASSISTANT);
- return currentSetting == null ? null : ComponentName.unflattenFromString(currentSetting);
+ return mAssistUtils.getAssistComponentForUser(UserHandle.myUserId());
}
public void refreshAssistApps() {
diff --git a/src/com/android/settings/applications/InstalledAppDetails.java b/src/com/android/settings/applications/InstalledAppDetails.java
index 9649d27..b344644 100755
--- a/src/com/android/settings/applications/InstalledAppDetails.java
+++ b/src/com/android/settings/applications/InstalledAppDetails.java
@@ -36,6 +36,7 @@
import android.content.pm.UserInfo;
import android.content.res.Resources;
import android.icu.text.ListFormatter;
+import android.graphics.drawable.Drawable;
import android.net.INetworkStatsService;
import android.net.INetworkStatsSession;
import android.net.NetworkTemplate;
@@ -49,13 +50,16 @@
import android.os.UserHandle;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceClickListener;
+import android.text.TextUtils;
import android.text.format.DateUtils;
import android.text.format.Formatter;
import android.util.Log;
+import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
+import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
@@ -130,7 +134,6 @@
private LayoutPreference mHeader;
private Button mUninstallButton;
private boolean mUpdatedSysApp = false;
- private TextView mAppVersion;
private Button mForceStopButton;
private Preference mNotificationPreference;
private Preference mStoragePreference;
@@ -424,25 +427,9 @@
// Utility method to set application label and icon.
private void setAppLabelAndIcon(PackageInfo pkgInfo) {
final View appSnippet = mHeader.findViewById(R.id.app_snippet);
- appSnippet.setPaddingRelative(0, appSnippet.getPaddingTop(), 0,
- appSnippet.getPaddingBottom());
-
- ImageView icon = (ImageView) appSnippet.findViewById(R.id.app_icon);
mState.ensureIcon(mAppEntry);
- icon.setImageDrawable(mAppEntry.icon);
- // Set application name.
- TextView label = (TextView) appSnippet.findViewById(R.id.app_name);
- label.setText(mAppEntry.label);
- // Version number of application
- mAppVersion = (TextView) appSnippet.findViewById(R.id.app_summary);
-
- if (pkgInfo != null && pkgInfo.versionName != null) {
- mAppVersion.setVisibility(View.VISIBLE);
- mAppVersion.setText(getActivity().getString(R.string.version_text,
- String.valueOf(pkgInfo.versionName)));
- } else {
- mAppVersion.setVisibility(View.INVISIBLE);
- }
+ setupAppSnippet(appSnippet, mAppEntry.label, mAppEntry.icon,
+ pkgInfo != null ? pkgInfo.versionName : null);
}
private boolean signaturesMatch(String pkg1, String pkg2) {
@@ -757,6 +744,28 @@
return true;
}
+ public static void setupAppSnippet(View appSnippet, CharSequence label, Drawable icon,
+ CharSequence versionName) {
+ LayoutInflater.from(appSnippet.getContext()).inflate(R.layout.widget_text_views,
+ (ViewGroup) appSnippet.findViewById(android.R.id.widget_frame));
+
+ ImageView iconView = (ImageView) appSnippet.findViewById(android.R.id.icon);
+ iconView.setImageDrawable(icon);
+ // Set application name.
+ TextView labelView = (TextView) appSnippet.findViewById(android.R.id.title);
+ labelView.setText(label);
+ // Version number of application
+ TextView appVersion = (TextView) appSnippet.findViewById(R.id.widget_text1);
+
+ if (!TextUtils.isEmpty(versionName)) {
+ appVersion.setVisibility(View.VISIBLE);
+ appVersion.setText(appSnippet.getContext().getString(R.string.version_text,
+ String.valueOf(versionName)));
+ } else {
+ appVersion.setVisibility(View.INVISIBLE);
+ }
+ }
+
private static NetworkTemplate getTemplate(Context context) {
if (DataUsageSummary.hasReadyMobileRadio(context)) {
return NetworkTemplate.buildTemplateMobileWildcard();
diff --git a/src/com/android/settings/applications/LayoutPreference.java b/src/com/android/settings/applications/LayoutPreference.java
index 75387d3..f0c7e4a 100644
--- a/src/com/android/settings/applications/LayoutPreference.java
+++ b/src/com/android/settings/applications/LayoutPreference.java
@@ -58,6 +58,11 @@
return mRootView;
}
+ @Override
+ protected void onBindView(View view) {
+ // Do nothing.
+ }
+
public View findViewById(int id) {
return mRootView.findViewById(id);
}
diff --git a/src/com/android/settings/applications/ManageApplications.java b/src/com/android/settings/applications/ManageApplications.java
index 8281885..c1566d0 100644
--- a/src/com/android/settings/applications/ManageApplications.java
+++ b/src/com/android/settings/applications/ManageApplications.java
@@ -112,21 +112,23 @@
// Filter options used for displayed list of applications
// The order which they appear is the order they will show when spinner is present.
public static final int FILTER_APPS_POWER_WHITELIST = 0;
- public static final int FILTER_APPS_ALL = 1;
- public static final int FILTER_APPS_ENABLED = 2;
- public static final int FILTER_APPS_DISABLED = 3;
- public static final int FILTER_APPS_BLOCKED = 4;
- public static final int FILTER_APPS_PRIORITY = 5;
- public static final int FILTER_APPS_NO_PEEKING = 6;
- public static final int FILTER_APPS_SENSITIVE = 7;
- public static final int FILTER_APPS_PERSONAL = 8;
- public static final int FILTER_APPS_WORK = 9;
- public static final int FILTER_APPS_WITH_DOMAIN_URLS = 10;
- public static final int FILTER_APPS_USAGE_ACCESS = 11;
+ public static final int FILTER_APPS_POWER_WHITELIST_ALL = 1;
+ public static final int FILTER_APPS_ALL = 2;
+ public static final int FILTER_APPS_ENABLED = 3;
+ public static final int FILTER_APPS_DISABLED = 4;
+ public static final int FILTER_APPS_BLOCKED = 5;
+ public static final int FILTER_APPS_PRIORITY = 6;
+ public static final int FILTER_APPS_NO_PEEKING = 7;
+ public static final int FILTER_APPS_SENSITIVE = 8;
+ public static final int FILTER_APPS_PERSONAL = 9;
+ public static final int FILTER_APPS_WORK = 10;
+ public static final int FILTER_APPS_WITH_DOMAIN_URLS = 11;
+ public static final int FILTER_APPS_USAGE_ACCESS = 12;
// This is the string labels for the filter modes above, the order must be kept in sync.
public static final int[] FILTER_LABELS = new int[] {
- R.string.high_power_filter_on, // High power whitelist, on
+ R.string.high_power_filter_on, // High power whitelist, on
+ R.string.filter_all_apps, // All apps label, but personal filter (for high power);
R.string.filter_all_apps, // All apps
R.string.filter_enabled_apps, // Enabled
R.string.filter_apps_disabled, // Disabled
@@ -143,6 +145,7 @@
// be kept in sync.
public static final AppFilter[] FILTERS = new AppFilter[] {
AppStatePowerBridge.FILTER_POWER_WHITELISTED, // High power whitelist, on
+ ApplicationsState.FILTER_PERSONAL, // All apps label, but personal filter
ApplicationsState.FILTER_EVERYTHING, // All apps
ApplicationsState.FILTER_ALL_ENABLED, // Enabled
ApplicationsState.FILTER_DISABLED, // Disabled
@@ -184,6 +187,7 @@
private String mCurrentPkgName;
private int mCurrentUid;
+ private boolean mFinishAfterDialog;
private Menu mOptionsMenu;
@@ -240,12 +244,13 @@
mListType = LIST_TYPE_HIGH_POWER;
// Default to showing system.
mShowSystem = true;
- if (intent != null && Settings.ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS
- .equals(intent.getAction())) {
+ if (Settings.ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS.equals(intent.getAction())
+ && intent.getData() != null) {
mCurrentPkgName = intent.getData().getSchemeSpecificPart();
if (mCurrentPkgName != null) {
mCurrentUid = mApplicationsState.getEntry(mCurrentPkgName,
UserHandle.myUserId()).info.uid;
+ mFinishAfterDialog = true;
startApplicationDetailsActivity();
}
}
@@ -331,7 +336,7 @@
mFilterAdapter.enableFilter(FILTER_APPS_NO_PEEKING);
}
if (mListType == LIST_TYPE_HIGH_POWER) {
- mFilterAdapter.enableFilter(FILTER_APPS_ALL);
+ mFilterAdapter.enableFilter(FILTER_APPS_POWER_WHITELIST_ALL);
}
if (mListType == LIST_TYPE_STORAGE) {
mApplications.setOverrideFilter(new VolumeFilter(mVolumeUuid));
@@ -427,6 +432,12 @@
if (requestCode == INSTALLED_APP_DETAILS && mCurrentPkgName != null) {
if (mListType == LIST_TYPE_NOTIFICATION) {
mApplications.mExtraInfoBridge.forceUpdate(mCurrentPkgName, mCurrentUid);
+ } else if (mListType == LIST_TYPE_HIGH_POWER) {
+ if (mFinishAfterDialog) {
+ getActivity().onBackPressed();
+ } else {
+ mApplications.mExtraInfoBridge.forceUpdate(mCurrentPkgName, mCurrentUid);
+ }
} else {
mApplicationsState.requestSize(mCurrentPkgName, UserHandle.getUserId(mCurrentUid));
}
@@ -450,7 +461,8 @@
startAppInfoFragment(AppStorageSettings.class, R.string.storage_settings);
break;
case LIST_TYPE_HIGH_POWER:
- HighPowerDetail.show(getActivity(), mCurrentPkgName);
+ HighPowerDetail.show(this, mCurrentPkgName, INSTALLED_APP_DETAILS,
+ mFinishAfterDialog);
break;
// TODO: Figure out if there is a way where we can spin up the profile's settings
// process ahead of time, to avoid a long load of data when user clicks on a managed app.
@@ -984,7 +996,6 @@
} else {
holder.disabled.setVisibility(View.GONE);
}
- holder.checkBox.setVisibility(View.GONE);
}
mActive.remove(convertView);
mActive.add(convertView);
diff --git a/src/com/android/settings/applications/ProcessStatsMemDetail.java b/src/com/android/settings/applications/ProcessStatsMemDetail.java
index 7ae2824..6a4f470 100644
--- a/src/com/android/settings/applications/ProcessStatsMemDetail.java
+++ b/src/com/android/settings/applications/ProcessStatsMemDetail.java
@@ -105,8 +105,9 @@
private void addDetailsItem(ViewGroup parent, CharSequence title,
float level, CharSequence value) {
LayoutInflater inflater = getActivity().getLayoutInflater();
- ViewGroup item = (ViewGroup) inflater.inflate(R.layout.app_percentage_item,
- null);
+ ViewGroup item = (ViewGroup) inflater.inflate(R.layout.app_item, null);
+ inflater.inflate(R.layout.widget_progress_bar,
+ (ViewGroup) item.findViewById(android.R.id.widget_frame));
parent.addView(item);
item.findViewById(android.R.id.icon).setVisibility(View.GONE);
TextView titleView = (TextView) item.findViewById(android.R.id.title);
diff --git a/src/com/android/settings/applications/ProcessStatsPreference.java b/src/com/android/settings/applications/ProcessStatsPreference.java
index 48c6a9f..996ed15 100644
--- a/src/com/android/settings/applications/ProcessStatsPreference.java
+++ b/src/com/android/settings/applications/ProcessStatsPreference.java
@@ -19,40 +19,17 @@
import android.content.Context;
import android.content.pm.PackageManager;
import android.graphics.drawable.ColorDrawable;
-import android.preference.Preference;
import android.text.TextUtils;
import android.text.format.Formatter;
-import android.util.AttributeSet;
-import android.view.View;
-import com.android.settings.R;
+import com.android.settings.AppProgressPreference;
-public class ProcessStatsPreference extends Preference {
+public class ProcessStatsPreference extends AppProgressPreference {
private ProcStatsPackageEntry mEntry;
- private final int mColor;
- private final int mRemainingColor;
- private float mRatio;
- private float mRemainingRatio;
public ProcessStatsPreference(Context context) {
- this(context, null);
- }
-
- public ProcessStatsPreference(Context context, AttributeSet attrs) {
- this(context, attrs, 0);
- }
-
- public ProcessStatsPreference(Context context, AttributeSet attrs, int defStyleAttr) {
- this(context, attrs, defStyleAttr, 0);
- }
-
- public ProcessStatsPreference(Context context, AttributeSet attrs, int defStyleAttr,
- int defStyleRes) {
- super(context, attrs, defStyleAttr, defStyleRes);
- setLayoutResource(R.layout.app_item_linear_color);
- mColor = context.getColor(R.color.memory_max_use);
- mRemainingColor = context.getColor(R.color.memory_remaining);
+ super(context, null);
}
public void init(ProcStatsPackageEntry entry, PackageManager pm, double maxMemory,
@@ -68,20 +45,10 @@
double amount = avg ? (statsForeground ? entry.mRunWeight : entry.mBgWeight) * weightToRam
: (statsForeground ? entry.mMaxRunMem : entry.mMaxBgMem) * totalScale * 1024;
setSummary(Formatter.formatShortFileSize(getContext(), (long) amount));
- mRatio = (float) (amount / maxMemory);
- mRemainingRatio = 1 - mRatio;
+ setProgress((int) (100 * amount / maxMemory));
}
public ProcStatsPackageEntry getEntry() {
return mEntry;
}
-
- @Override
- protected void onBindView(View view) {
- super.onBindView(view);
-
- LinearColorBar linearColorBar = (LinearColorBar) view.findViewById(R.id.linear_color_bar);
- linearColorBar.setColors(mColor, mColor, mRemainingColor);
- linearColorBar.setRatios(mRatio, 0, mRemainingRatio);
- }
}
diff --git a/src/com/android/settings/applications/ProcessStatsSummary.java b/src/com/android/settings/applications/ProcessStatsSummary.java
index 29d864c..dc24c73 100644
--- a/src/com/android/settings/applications/ProcessStatsSummary.java
+++ b/src/com/android/settings/applications/ProcessStatsSummary.java
@@ -19,11 +19,12 @@
import android.os.Bundle;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceClickListener;
+import android.text.TextUtils;
import android.text.format.Formatter;
+import android.text.format.Formatter.BytesResult;
import android.widget.TextView;
import com.android.internal.logging.MetricsLogger;
-import com.android.settings.InstrumentedFragment;
import com.android.settings.R;
import com.android.settings.Utils;
import com.android.settings.applications.ProcStatsData.MemInfo;
@@ -76,7 +77,8 @@
double usedRam = memInfo.realUsedRam;
double totalRam = memInfo.realTotalRam;
double freeRam = memInfo.realFreeRam;
- String usedString = Formatter.formatShortFileSize(context, (long) usedRam);
+ BytesResult usedResult = Formatter.formatBytes(context.getResources(), (long) usedRam,
+ Formatter.FLAG_SHORTER);
String totalString = Formatter.formatShortFileSize(context, (long) totalRam);
String freeString = Formatter.formatShortFileSize(context, (long) freeRam);
CharSequence memString;
@@ -87,7 +89,8 @@
} else {
memString = memStatesStr[memStatesStr.length - 1];
}
- mMemStatus.setText(usedString);
+ mMemStatus.setText(TextUtils.expandTemplate(getText(R.string.storage_size_large),
+ usedResult.value, usedResult.units));
float usedRatio = (float)(usedRam / (freeRam + usedRam));
mColors.setRatios(usedRatio, 0, 1 - usedRatio);
diff --git a/src/com/android/settings/applications/UsageAccessDetails.java b/src/com/android/settings/applications/UsageAccessDetails.java
index f65c4be..6d5995b 100644
--- a/src/com/android/settings/applications/UsageAccessDetails.java
+++ b/src/com/android/settings/applications/UsageAccessDetails.java
@@ -17,6 +17,7 @@
import android.app.AlertDialog;
import android.app.AppOpsManager;
+import android.app.admin.DevicePolicyManager;
import android.content.ActivityNotFoundException;
import android.content.ComponentName;
import android.content.Context;
@@ -33,7 +34,6 @@
import android.util.Log;
import com.android.internal.logging.MetricsLogger;
-import com.android.settings.InstrumentedFragment;
import com.android.settings.R;
import com.android.settings.applications.AppStateUsageBridge.UsageState;
@@ -51,6 +51,7 @@
private Preference mUsagePrefs;
private Intent mSettingsIntent;
private UsageState mUsageState;
+ private DevicePolicyManager mDpm;
@Override
public void onCreate(Bundle savedInstanceState) {
@@ -59,6 +60,7 @@
Context context = getActivity();
mUsageBridge = new AppStateUsageBridge(context, mState, null);
mAppOpsManager = (AppOpsManager) context.getSystemService(Context.APP_OPS_SERVICE);
+ mDpm = context.getSystemService(DevicePolicyManager.class);
addPreferencesFromResource(R.xml.usage_access_details);
mSwitchPref = (SwitchPreference) findPreference(KEY_USAGE_SWITCH);
@@ -91,6 +93,14 @@
public boolean onPreferenceChange(Preference preference, Object newValue) {
if (preference == mSwitchPref) {
if (mUsageState != null && (Boolean) newValue != mUsageState.hasAccess()) {
+ if (mUsageState.hasAccess() && mDpm.isProfileOwnerApp(mPackageName)) {
+ new AlertDialog.Builder(getContext())
+ .setIcon(com.android.internal.R.drawable.ic_dialog_alert_material)
+ .setTitle(android.R.string.dialog_alert_title)
+ .setMessage(R.string.work_profile_usage_access_warning)
+ .setPositiveButton(R.string.okay, null)
+ .show();
+ }
setHasAccess(!mUsageState.hasAccess());
refreshUi();
}
diff --git a/src/com/android/settings/backup/ToggleBackupSettingFragment.java b/src/com/android/settings/backup/ToggleBackupSettingFragment.java
index bc85bf3..6942a42 100644
--- a/src/com/android/settings/backup/ToggleBackupSettingFragment.java
+++ b/src/com/android/settings/backup/ToggleBackupSettingFragment.java
@@ -10,6 +10,7 @@
import android.os.ServiceManager;
import android.preference.Preference;
import android.preference.PreferenceScreen;
+import android.provider.Settings;
import android.util.Log;
import android.view.View;
import android.widget.TextView;
@@ -31,6 +32,11 @@
private static final String BACKUP_TOGGLE = "toggle_backup";
+ // System setting that governs whether the user is eligible for full app-data backup,
+ // based on whether they have been presented with the details of what that backup entails
+ // (usually surfaced somewhere like device setup)
+ private static final String USER_FULL_DATA_BACKUP_AWARE = "user_full_data_backup_aware";
+
private IBackupManager mBackupManager;
protected SwitchBar mSwitchBar;
@@ -74,7 +80,14 @@
mToggleSwitch = mSwitchBar.getSwitch();
// Set up UI.
- mSummaryPreference.setSummary(R.string.fullbackup_data_summary);
+ // If the user has not seen legal text for full data backup (if they OTA from L to M) then
+ // full data backup will be off and here we want to show the old summary here that does
+ // not mention full data backup
+ if (Settings.Secure.getInt(getContentResolver(), USER_FULL_DATA_BACKUP_AWARE, 0) != 0) {
+ mSummaryPreference.setSummary(R.string.fullbackup_data_summary);
+ } else {
+ mSummaryPreference.setSummary(R.string.backup_data_summary);
+ }
try {
boolean backupEnabled = mBackupManager == null ?
false : mBackupManager.isBackupEnabled();
@@ -155,7 +168,16 @@
}
private void showEraseBackupDialog() {
- CharSequence msg = getResources().getText(R.string.fullbackup_erase_dialog_message);
+ CharSequence msg;
+
+ // If the user has not seen legal text for full data backup (if they OTA from L to M) then
+ // full data backup will be off and here we want to show the old erase_dialog_message here
+ // that does not mention full data backup
+ if (Settings.Secure.getInt(getContentResolver(), USER_FULL_DATA_BACKUP_AWARE, 0) != 0) {
+ msg = getResources().getText(R.string.fullbackup_erase_dialog_message);
+ } else {
+ msg = getResources().getText(R.string.backup_erase_dialog_message);
+ }
mWaitingForConfirmationDialog = true;
diff --git a/src/com/android/settings/bluetooth/BluetoothPairingDialog.java b/src/com/android/settings/bluetooth/BluetoothPairingDialog.java
index ffe4945..29cac62 100755
--- a/src/com/android/settings/bluetooth/BluetoothPairingDialog.java
+++ b/src/com/android/settings/bluetooth/BluetoothPairingDialog.java
@@ -16,6 +16,7 @@
package com.android.settings.bluetooth;
+import android.bluetooth.BluetoothClass;
import android.bluetooth.BluetoothDevice;
import android.content.BroadcastReceiver;
import android.content.Context;
@@ -186,6 +187,24 @@
TextView messageViewContent = (TextView) view.findViewById(R.id.message_subhead);
TextView messageView2 = (TextView) view.findViewById(R.id.message_below_pin);
CheckBox alphanumericPin = (CheckBox) view.findViewById(R.id.alphanumeric_pin);
+ CheckBox contactSharing = (CheckBox) view.findViewById(
+ R.id.phonebook_sharing_message_entry_pin);
+ contactSharing.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+ @Override
+ public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked) {
+ if (isChecked) {
+ mDevice.setPhonebookAccessPermission(BluetoothDevice.ACCESS_ALLOWED);
+ } else {
+ mDevice.setPhonebookAccessPermission(BluetoothDevice.ACCESS_REJECTED);
+ }
+ }
+ });
+ if (mDevice.getBluetoothClass().getDeviceClass()
+ == BluetoothClass.Device.AUDIO_VIDEO_HANDSFREE) {
+ contactSharing.setVisibility(View.VISIBLE);
+ } else {
+ contactSharing.setVisibility(View.GONE);
+ }
mPairingView = (EditText) view.findViewById(R.id.text);
mPairingView.addTextChangedListener(this);
alphanumericPin.setOnCheckedChangeListener(this);
@@ -238,6 +257,24 @@
TextView pairingViewCaption = (TextView) view.findViewById(R.id.pairing_caption);
TextView pairingViewContent = (TextView) view.findViewById(R.id.pairing_subhead);
TextView messagePairing = (TextView) view.findViewById(R.id.pairing_code_message);
+ CheckBox contactSharing = (CheckBox) view.findViewById(
+ R.id.phonebook_sharing_message_confirm_pin);
+ contactSharing.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+ @Override
+ public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked) {
+ if (isChecked) {
+ mDevice.setPhonebookAccessPermission(BluetoothDevice.ACCESS_ALLOWED);
+ } else {
+ mDevice.setPhonebookAccessPermission(BluetoothDevice.ACCESS_REJECTED);
+ }
+ }
+ });
+ if (mDevice.getBluetoothClass().getDeviceClass()
+ == BluetoothClass.Device.AUDIO_VIDEO_HANDSFREE) {
+ contactSharing.setVisibility(View.VISIBLE);
+ } else {
+ contactSharing.setVisibility(View.GONE);
+ }
String messageCaption = null;
String pairingContent = null;
diff --git a/src/com/android/settings/deviceinfo/PrivateVolumeSettings.java b/src/com/android/settings/deviceinfo/PrivateVolumeSettings.java
index 9944c08..799121b 100644
--- a/src/com/android/settings/deviceinfo/PrivateVolumeSettings.java
+++ b/src/com/android/settings/deviceinfo/PrivateVolumeSettings.java
@@ -21,7 +21,7 @@
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
-import android.app.DownloadManager;
+import android.app.Fragment;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.DialogInterface;
@@ -34,15 +34,16 @@
import android.os.Environment;
import android.os.UserHandle;
import android.os.UserManager;
-import android.os.storage.DiskInfo;
import android.os.storage.StorageEventListener;
import android.os.storage.StorageManager;
import android.os.storage.VolumeInfo;
import android.os.storage.VolumeRecord;
import android.preference.Preference;
import android.preference.PreferenceScreen;
-import android.provider.MediaStore;
+import android.provider.DocumentsContract;
+import android.text.TextUtils;
import android.text.format.Formatter;
+import android.text.format.Formatter.BytesResult;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
@@ -79,8 +80,12 @@
// TODO: warn when mounted read-only
private static final String TAG_RENAME = "rename";
+ private static final String TAG_OTHER_INFO = "otherInfo";
+ private static final String TAG_USER_INFO = "userInfo";
private static final String TAG_CONFIRM_CLEAR_CACHE = "confirmClearCache";
+ private static final String AUTHORITY_MEDIA = "com.android.providers.media.documents";
+
private StorageManager mStorageManager;
private UserManager mUserManager;
@@ -94,19 +99,16 @@
private int mNextOrder = 0;
- private UsageBarPreference mGraph;
- private StorageItemPreference mTotal;
- private StorageItemPreference mAvailable;
+ private StorageSummaryPreference mSummary;
private StorageItemPreference mApps;
- private StorageItemPreference mDcim;
- private StorageItemPreference mMusic;
- private StorageItemPreference mDownloads;
+ private StorageItemPreference mImages;
+ private StorageItemPreference mVideos;
+ private StorageItemPreference mAudio;
+ private StorageItemPreference mOther;
private StorageItemPreference mCache;
- private StorageItemPreference mMisc;
private List<StorageItemPreference> mUsers = Lists.newArrayList();
- private long mTotalSize;
- private long mAvailSize;
+ private Preference mExplore;
@Override
protected int getMetricsCategory() {
@@ -136,28 +138,26 @@
mMeasure = new StorageMeasurement(context, mVolume, mSharedVolume);
mMeasure.setReceiver(mReceiver);
- mGraph = buildGraph();
- mTotal = buildItem(R.string.memory_size, 0);
- mAvailable = buildItem(R.string.memory_available, R.color.memory_avail);
+ mSummary = new StorageSummaryPreference(context);
- mApps = buildItem(R.string.memory_apps_usage, R.color.memory_apps_usage);
- mDcim = buildItem(R.string.memory_dcim_usage, R.color.memory_dcim);
- mMusic = buildItem(R.string.memory_music_usage, R.color.memory_music);
- mDownloads = buildItem(R.string.memory_downloads_usage, R.color.memory_downloads);
- mCache = buildItem(R.string.memory_media_cache_usage, R.color.memory_cache);
- mMisc = buildItem(R.string.memory_media_misc_usage, R.color.memory_misc);
+ mApps = buildItem(R.string.storage_detail_apps);
+ mImages = buildItem(R.string.storage_detail_images);
+ mVideos = buildItem(R.string.storage_detail_videos);
+ mAudio = buildItem(R.string.storage_detail_audio);
+ mOther = buildItem(R.string.storage_detail_other);
+ mCache = buildItem(R.string.storage_detail_cached);
mCurrentUser = mUserManager.getUserInfo(UserHandle.myUserId());
final List<UserInfo> otherUsers = getUsersExcluding(mCurrentUser);
for (int i = 0; i < otherUsers.size(); i++) {
final UserInfo user = otherUsers.get(i);
- final int colorRes = i % 2 == 0 ? R.color.memory_user_light
- : R.color.memory_user_dark;
final StorageItemPreference userPref = new StorageItemPreference(
- context, user.name, colorRes, user.id);
+ context, user.name, user.id);
mUsers.add(userPref);
}
+ mExplore = buildAction(R.string.storage_menu_explore);
+
setHasOptionsMenu(true);
}
@@ -178,22 +178,25 @@
return;
}
- screen.addPreference(mGraph);
- screen.addPreference(mTotal);
- screen.addPreference(mAvailable);
+ screen.addPreference(mSummary);
final boolean showUsers = !mUsers.isEmpty();
+ final boolean showShared = (mSharedVolume != null) && mSharedVolume.isMountedReadable();
+
if (showUsers) {
screen.addPreference(new PreferenceHeader(context, mCurrentUser.name));
}
-
screen.addPreference(mApps);
- screen.addPreference(mDcim);
- screen.addPreference(mMusic);
- screen.addPreference(mDownloads);
+ if (showShared) {
+ screen.addPreference(mImages);
+ screen.addPreference(mVideos);
+ screen.addPreference(mAudio);
+ screen.addPreference(mOther);
+ }
screen.addPreference(mCache);
- screen.addPreference(mMisc);
-
+ if (showShared) {
+ screen.addPreference(mExplore);
+ }
if (showUsers) {
screen.addPreference(new PreferenceHeader(context, R.string.storage_other_users));
for (Preference pref : mUsers) {
@@ -209,29 +212,29 @@
}
final File file = mVolume.getPath();
- mTotalSize = file.getTotalSpace();
- mAvailSize = file.getFreeSpace();
+ final long totalBytes = file.getTotalSpace();
+ final long freeBytes = file.getFreeSpace();
+ final long usedBytes = totalBytes - freeBytes;
- mTotal.setSummary(Formatter.formatFileSize(context, mTotalSize));
- mAvailable.setSummary(Formatter.formatFileSize(context, mAvailSize));
-
- mGraph.clear();
- mGraph.addEntry(0, (mTotalSize - mAvailSize) / (float) mTotalSize,
- android.graphics.Color.GRAY);
- mGraph.commit();
+ final BytesResult result = Formatter.formatBytes(getResources(), usedBytes, 0);
+ mSummary.setTitle(TextUtils.expandTemplate(getText(R.string.storage_size_large),
+ result.value, result.units));
+ mSummary.setSummary(getString(R.string.storage_volume_used,
+ Formatter.formatFileSize(context, totalBytes)));
+ mSummary.setPercent((int) ((usedBytes * 100) / totalBytes));
mMeasure.forceMeasure();
}
- private UsageBarPreference buildGraph() {
- final UsageBarPreference pref = new UsageBarPreference(getActivity());
+ private StorageItemPreference buildItem(int titleRes) {
+ final StorageItemPreference pref = new StorageItemPreference(getActivity(), titleRes);
pref.setOrder(mNextOrder++);
return pref;
}
- private StorageItemPreference buildItem(int titleRes, int colorRes) {
- final StorageItemPreference pref = new StorageItemPreference(getActivity(), titleRes,
- colorRes);
+ private Preference buildAction(int titleRes) {
+ final Preference pref = new Preference(getActivity());
+ pref.setTitle(titleRes);
pref.setOrder(mNextOrder++);
return pref;
}
@@ -341,27 +344,40 @@
intent = Utils.onBuildStartFragmentIntent(getActivity(),
ManageApplications.class.getName(), args, null, R.string.apps_storage, null,
false);
- } else if (pref == mDownloads) {
- intent = new Intent(DownloadManager.ACTION_VIEW_DOWNLOADS).putExtra(
- DownloadManager.INTENT_EXTRAS_SORT_BY_SIZE, true);
- } else if (pref == mMusic) {
- intent = new Intent(Intent.ACTION_GET_CONTENT);
- intent.setType("audio/mp3");
+ } else if (pref == mImages) {
+ intent = new Intent(DocumentsContract.ACTION_BROWSE_DOCUMENT_ROOT);
+ intent.setData(DocumentsContract.buildRootUri(AUTHORITY_MEDIA, "images_root"));
+ intent.addCategory(Intent.CATEGORY_DEFAULT);
- } else if (pref == mDcim) {
- intent = new Intent(Intent.ACTION_VIEW);
- intent.putExtra(Intent.EXTRA_LOCAL_ONLY, true);
- intent.setData(MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
+ } else if (pref == mVideos) {
+ intent = new Intent(DocumentsContract.ACTION_BROWSE_DOCUMENT_ROOT);
+ intent.setData(DocumentsContract.buildRootUri(AUTHORITY_MEDIA, "videos_root"));
+ intent.addCategory(Intent.CATEGORY_DEFAULT);
+
+ } else if (pref == mAudio) {
+ intent = new Intent(DocumentsContract.ACTION_BROWSE_DOCUMENT_ROOT);
+ intent.setData(DocumentsContract.buildRootUri(AUTHORITY_MEDIA, "audio_root"));
+ intent.addCategory(Intent.CATEGORY_DEFAULT);
+
+ } else if (pref == mOther) {
+ OtherInfoFragment.show(this, mStorageManager.getBestVolumeDescription(mVolume),
+ mSharedVolume);
+ return true;
} else if (pref == mCache) {
ConfirmClearCacheFragment.show(this);
return true;
- } else if (pref == mMisc) {
+ } else if (pref == mExplore) {
intent = mSharedVolume.buildBrowseIntent();
}
+ if (mUsers.contains(pref)) {
+ UserInfoFragment.show(this, pref.getTitle(), pref.getSummary());
+ return true;
+ }
+
if (intent != null) {
try {
startActivity(intent);
@@ -381,39 +397,31 @@
};
private void updateDetails(MeasurementDetails details) {
- mGraph.clear();
-
updatePreference(mApps, details.appsSize);
- final long dcimSize = totalValues(details.mediaSize, Environment.DIRECTORY_DCIM,
+ final long imagesSize = totalValues(details.mediaSize, Environment.DIRECTORY_DCIM,
Environment.DIRECTORY_MOVIES, Environment.DIRECTORY_PICTURES);
- updatePreference(mDcim, dcimSize);
+ updatePreference(mImages, imagesSize);
- final long musicSize = totalValues(details.mediaSize, Environment.DIRECTORY_MUSIC,
+ final long videosSize = totalValues(details.mediaSize, Environment.DIRECTORY_MOVIES);
+ updatePreference(mVideos, videosSize);
+
+ final long audioSize = totalValues(details.mediaSize, Environment.DIRECTORY_MUSIC,
Environment.DIRECTORY_ALARMS, Environment.DIRECTORY_NOTIFICATIONS,
Environment.DIRECTORY_RINGTONES, Environment.DIRECTORY_PODCASTS);
- updatePreference(mMusic, musicSize);
-
- final long downloadsSize = totalValues(details.mediaSize, Environment.DIRECTORY_DOWNLOADS);
- updatePreference(mDownloads, downloadsSize);
+ updatePreference(mAudio, audioSize);
updatePreference(mCache, details.cacheSize);
- updatePreference(mMisc, details.miscSize);
+ updatePreference(mOther, details.miscSize);
for (StorageItemPreference userPref : mUsers) {
final long userSize = details.usersSize.get(userPref.userHandle);
updatePreference(userPref, userSize);
}
-
- mGraph.commit();
}
private void updatePreference(StorageItemPreference pref, long size) {
pref.setSummary(Formatter.formatFileSize(getActivity(), size));
- if (size > 0) {
- final int order = pref.getOrder();
- mGraph.addEntry(order, size / (float) mTotalSize, pref.color);
- }
}
/**
@@ -507,11 +515,78 @@
}
}
+ public static class OtherInfoFragment extends DialogFragment {
+ public static void show(Fragment parent, String title, VolumeInfo sharedVol) {
+ if (!parent.isAdded()) return;
+
+ final OtherInfoFragment dialog = new OtherInfoFragment();
+ dialog.setTargetFragment(parent, 0);
+ final Bundle args = new Bundle();
+ args.putString(Intent.EXTRA_TITLE, title);
+ args.putParcelable(Intent.EXTRA_INTENT, sharedVol.buildBrowseIntent());
+ dialog.setArguments(args);
+ dialog.show(parent.getFragmentManager(), TAG_OTHER_INFO);
+ }
+
+ @Override
+ public Dialog onCreateDialog(Bundle savedInstanceState) {
+ final Context context = getActivity();
+
+ final String title = getArguments().getString(Intent.EXTRA_TITLE);
+ final Intent intent = getArguments().getParcelable(Intent.EXTRA_INTENT);
+
+ final AlertDialog.Builder builder = new AlertDialog.Builder(context);
+ builder.setMessage(
+ TextUtils.expandTemplate(getText(R.string.storage_detail_dialog_other), title));
+
+ builder.setPositiveButton(R.string.storage_menu_explore,
+ new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ startActivity(intent);
+ }
+ });
+ builder.setNegativeButton(android.R.string.cancel, null);
+
+ return builder.create();
+ }
+ }
+
+ public static class UserInfoFragment extends DialogFragment {
+ public static void show(Fragment parent, CharSequence userLabel, CharSequence userSize) {
+ if (!parent.isAdded()) return;
+
+ final UserInfoFragment dialog = new UserInfoFragment();
+ dialog.setTargetFragment(parent, 0);
+ final Bundle args = new Bundle();
+ args.putCharSequence(Intent.EXTRA_TITLE, userLabel);
+ args.putCharSequence(Intent.EXTRA_SUBJECT, userSize);
+ dialog.setArguments(args);
+ dialog.show(parent.getFragmentManager(), TAG_USER_INFO);
+ }
+
+ @Override
+ public Dialog onCreateDialog(Bundle savedInstanceState) {
+ final Context context = getActivity();
+
+ final CharSequence userLabel = getArguments().getCharSequence(Intent.EXTRA_TITLE);
+ final CharSequence userSize = getArguments().getCharSequence(Intent.EXTRA_SUBJECT);
+
+ final AlertDialog.Builder builder = new AlertDialog.Builder(context);
+ builder.setMessage(TextUtils.expandTemplate(
+ getText(R.string.storage_detail_dialog_user), userLabel, userSize));
+
+ builder.setPositiveButton(android.R.string.ok, null);
+
+ return builder.create();
+ }
+ }
+
/**
* Dialog to request user confirmation before clearing all cache data.
*/
public static class ConfirmClearCacheFragment extends DialogFragment {
- public static void show(PrivateVolumeSettings parent) {
+ public static void show(Fragment parent) {
if (!parent.isAdded()) return;
final ConfirmClearCacheFragment dialog = new ConfirmClearCacheFragment();
diff --git a/src/com/android/settings/deviceinfo/PublicVolumeSettings.java b/src/com/android/settings/deviceinfo/PublicVolumeSettings.java
index 677a99b..08117ba 100644
--- a/src/com/android/settings/deviceinfo/PublicVolumeSettings.java
+++ b/src/com/android/settings/deviceinfo/PublicVolumeSettings.java
@@ -30,7 +30,9 @@
import android.preference.Preference;
import android.preference.PreferenceScreen;
import android.provider.DocumentsContract;
+import android.text.TextUtils;
import android.text.format.Formatter;
+import android.text.format.Formatter.BytesResult;
import android.util.Log;
import com.android.internal.logging.MetricsLogger;
@@ -58,18 +60,13 @@
private int mNextOrder = 0;
- private UsageBarPreference mGraph;
- private StorageItemPreference mTotal;
- private StorageItemPreference mAvailable;
+ private StorageSummaryPreference mSummary;
private Preference mMount;
private Preference mUnmount;
private Preference mFormatPublic;
private Preference mFormatPrivate;
- private long mTotalSize;
- private long mAvailSize;
-
@Override
protected int getMetricsCategory() {
return MetricsLogger.DEVICEINFO_STORAGE;
@@ -103,9 +100,7 @@
addPreferencesFromResource(R.xml.device_info_storage_volume);
- mGraph = buildGraph();
- mTotal = buildItem(R.string.memory_size, 0);
- mAvailable = buildItem(R.string.memory_available, R.color.memory_avail);
+ mSummary = new StorageSummaryPreference(context);
mMount = buildAction(R.string.storage_menu_mount);
mUnmount = buildAction(R.string.storage_menu_unmount);
@@ -128,21 +123,19 @@
}
if (mVolume.isMountedReadable()) {
- screen.addPreference(mGraph);
- screen.addPreference(mTotal);
- screen.addPreference(mAvailable);
+ screen.addPreference(mSummary);
final File file = mVolume.getPath();
- mTotalSize = file.getTotalSpace();
- mAvailSize = file.getFreeSpace();
+ final long totalBytes = file.getTotalSpace();
+ final long freeBytes = file.getFreeSpace();
+ final long usedBytes = totalBytes - freeBytes;
- mTotal.setSummary(Formatter.formatFileSize(context, mTotalSize));
- mAvailable.setSummary(Formatter.formatFileSize(context, mAvailSize));
-
- mGraph.clear();
- mGraph.addEntry(0, (mTotalSize - mAvailSize) / (float) mTotalSize,
- android.graphics.Color.GRAY);
- mGraph.commit();
+ final BytesResult result = Formatter.formatBytes(getResources(), usedBytes, 0);
+ mSummary.setTitle(TextUtils.expandTemplate(getText(R.string.storage_size_large),
+ result.value, result.units));
+ mSummary.setSummary(getString(R.string.storage_volume_used,
+ Formatter.formatFileSize(context, totalBytes)));
+ mSummary.setPercent((int) ((usedBytes * 100) / totalBytes));
}
if (mVolume.getState() == VolumeInfo.STATE_UNMOUNTED) {
@@ -157,19 +150,6 @@
}
}
- private UsageBarPreference buildGraph() {
- final UsageBarPreference pref = new UsageBarPreference(getActivity());
- pref.setOrder(mNextOrder++);
- return pref;
- }
-
- private StorageItemPreference buildItem(int titleRes, int colorRes) {
- final StorageItemPreference pref = new StorageItemPreference(getActivity(), titleRes,
- colorRes);
- pref.setOrder(mNextOrder++);
- return pref;
- }
-
private Preference buildAction(int titleRes) {
final Preference pref = new Preference(getActivity());
pref.setTitle(titleRes);
diff --git a/src/com/android/settings/deviceinfo/StorageItemPreference.java b/src/com/android/settings/deviceinfo/StorageItemPreference.java
index 8d48cf0..41d84c6 100644
--- a/src/com/android/settings/deviceinfo/StorageItemPreference.java
+++ b/src/com/android/settings/deviceinfo/StorageItemPreference.java
@@ -17,52 +17,27 @@
package com.android.settings.deviceinfo;
import android.content.Context;
-import android.content.res.Resources;
-import android.graphics.Color;
-import android.graphics.drawable.ShapeDrawable;
-import android.graphics.drawable.shapes.RectShape;
import android.os.UserHandle;
import android.preference.Preference;
import com.android.settings.R;
public class StorageItemPreference extends Preference {
- public final int color;
public final int userHandle;
- public StorageItemPreference(Context context, int titleRes, int colorRes) {
- this(context, context.getText(titleRes), colorRes, UserHandle.USER_NULL);
+ public StorageItemPreference(Context context, int titleRes) {
+ this(context, context.getText(titleRes), UserHandle.USER_NULL);
}
- public StorageItemPreference(
- Context context, CharSequence title, int colorRes, int userHandle) {
+ public StorageItemPreference(Context context, CharSequence title, int userHandle) {
super(context);
- if (colorRes != 0) {
- this.color = context.getColor(colorRes);
-
- final Resources res = context.getResources();
- final int width = res.getDimensionPixelSize(R.dimen.device_memory_usage_button_width);
- final int height = res.getDimensionPixelSize(R.dimen.device_memory_usage_button_height);
- setIcon(createRectShape(width, height, this.color));
- } else {
- this.color = Color.MAGENTA;
- }
-
setTitle(title);
setSummary(R.string.memory_calculating_size);
this.userHandle = userHandle;
}
- private static ShapeDrawable createRectShape(int width, int height, int color) {
- ShapeDrawable shape = new ShapeDrawable(new RectShape());
- shape.setIntrinsicHeight(height);
- shape.setIntrinsicWidth(width);
- shape.getPaint().setColor(color);
- return shape;
- }
-
public void setLoading() {
setSummary(R.string.memory_calculating_size);
}
diff --git a/src/com/android/settings/deviceinfo/StorageSettings.java b/src/com/android/settings/deviceinfo/StorageSettings.java
index 546c716..b1745ec 100644
--- a/src/com/android/settings/deviceinfo/StorageSettings.java
+++ b/src/com/android/settings/deviceinfo/StorageSettings.java
@@ -23,9 +23,9 @@
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
+import android.graphics.Color;
import android.os.AsyncTask;
import android.os.Bundle;
-import android.os.UserManager;
import android.os.storage.DiskInfo;
import android.os.storage.StorageEventListener;
import android.os.storage.StorageManager;
@@ -35,6 +35,8 @@
import android.preference.PreferenceCategory;
import android.preference.PreferenceScreen;
import android.text.TextUtils;
+import android.text.format.Formatter;
+import android.text.format.Formatter.BytesResult;
import android.util.Log;
import android.widget.Toast;
@@ -45,6 +47,7 @@
import com.android.settings.search.Indexable;
import com.android.settings.search.SearchIndexableRaw;
+import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -59,14 +62,24 @@
private static final String TAG_VOLUME_UNMOUNTED = "volume_unmounted";
private static final String TAG_DISK_INIT = "disk_init";
- // TODO: badging to indicate devices running low on storage
+ static final int COLOR_PUBLIC = Color.parseColor("#ff9e9e9e");
+ static final int COLOR_WARNING = Color.parseColor("#fff4511e");
- private UserManager mUserManager;
+ static final int[] COLOR_PRIVATE = new int[] {
+ Color.parseColor("#ff26a69a"),
+ Color.parseColor("#ffab47bc"),
+ Color.parseColor("#fff2a600"),
+ Color.parseColor("#ffec407a"),
+ Color.parseColor("#ffc0ca33"),
+ };
+
private StorageManager mStorageManager;
private PreferenceCategory mInternalCategory;
private PreferenceCategory mExternalCategory;
+ private StorageSummaryPreference mInternalSummary;
+
@Override
protected int getMetricsCategory() {
return MetricsLogger.DEVICEINFO_STORAGE;
@@ -83,8 +96,6 @@
final Context context = getActivity();
- mUserManager = context.getSystemService(UserManager.class);
-
mStorageManager = context.getSystemService(StorageManager.class);
mStorageManager.registerListener(mStorageListener);
@@ -93,7 +104,7 @@
mInternalCategory = (PreferenceCategory) findPreference("storage_internal");
mExternalCategory = (PreferenceCategory) findPreference("storage_external");
- // TODO: if only one volume visible, shortcut into it
+ mInternalSummary = new StorageSummaryPreference(context);
setHasOptionsMenu(true);
}
@@ -124,14 +135,28 @@
mInternalCategory.removeAll();
mExternalCategory.removeAll();
+ mInternalCategory.addPreference(mInternalSummary);
+
+ int privateCount = 0;
+ long privateUsedBytes = 0;
+ long privateTotalBytes = 0;
+
final List<VolumeInfo> volumes = mStorageManager.getVolumes();
Collections.sort(volumes, VolumeInfo.getDescriptionComparator());
for (VolumeInfo vol : volumes) {
if (vol.getType() == VolumeInfo.TYPE_PRIVATE) {
- mInternalCategory.addPreference(new StorageVolumePreference(context, vol));
+ final int color = COLOR_PRIVATE[privateCount++ % COLOR_PRIVATE.length];
+ mInternalCategory.addPreference(
+ new StorageVolumePreference(context, vol, color));
+ if (vol.isMountedReadable()) {
+ final File path = vol.getPath();
+ privateUsedBytes += path.getTotalSpace() - path.getFreeSpace();
+ privateTotalBytes += path.getTotalSpace();
+ }
} else if (vol.getType() == VolumeInfo.TYPE_PUBLIC) {
- mExternalCategory.addPreference(new StorageVolumePreference(context, vol));
+ mExternalCategory.addPreference(
+ new StorageVolumePreference(context, vol, COLOR_PUBLIC));
}
}
@@ -162,12 +187,28 @@
}
}
+ final BytesResult result = Formatter.formatBytes(getResources(), privateUsedBytes, 0);
+ mInternalSummary.setTitle(TextUtils.expandTemplate(getText(R.string.storage_size_large),
+ result.value, result.units));
+ mInternalSummary.setSummary(getString(R.string.storage_volume_used_total,
+ Formatter.formatFileSize(context, privateTotalBytes)));
+
if (mInternalCategory.getPreferenceCount() > 0) {
getPreferenceScreen().addPreference(mInternalCategory);
}
if (mExternalCategory.getPreferenceCount() > 0) {
getPreferenceScreen().addPreference(mExternalCategory);
}
+
+ if (mInternalCategory.getPreferenceCount() == 2
+ && mExternalCategory.getPreferenceCount() == 0) {
+ // Only showing primary internal storage, so just shortcut
+ final Bundle args = new Bundle();
+ args.putString(VolumeInfo.EXTRA_VOLUME_ID, VolumeInfo.ID_PRIVATE_INTERNAL);
+ startFragment(this, PrivateVolumeSettings.class.getCanonicalName(),
+ -1, 0, args);
+ finish();
+ }
}
@Override
diff --git a/src/com/android/settings/deviceinfo/StorageSummaryPreference.java b/src/com/android/settings/deviceinfo/StorageSummaryPreference.java
new file mode 100644
index 0000000..4a1d1b2
--- /dev/null
+++ b/src/com/android/settings/deviceinfo/StorageSummaryPreference.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.deviceinfo;
+
+import android.content.Context;
+import android.preference.Preference;
+import android.view.View;
+import android.widget.ProgressBar;
+
+import com.android.settings.R;
+
+public class StorageSummaryPreference extends Preference {
+ private int mPercent = -1;
+
+ public StorageSummaryPreference(Context context) {
+ super(context);
+
+ setLayoutResource(R.layout.storage_summary);
+ setEnabled(false);
+ }
+
+ public void setPercent(int percent) {
+ mPercent = percent;
+ }
+
+ @Override
+ protected void onBindView(View view) {
+ final ProgressBar progress = (ProgressBar) view.findViewById(android.R.id.progress);
+ if (mPercent != -1) {
+ progress.setVisibility(View.VISIBLE);
+ progress.setProgress(mPercent);
+ } else {
+ progress.setVisibility(View.GONE);
+ }
+
+ super.onBindView(view);
+ }
+}
diff --git a/src/com/android/settings/deviceinfo/StorageVolumePreference.java b/src/com/android/settings/deviceinfo/StorageVolumePreference.java
index e122bf8..f535b85 100644
--- a/src/com/android/settings/deviceinfo/StorageVolumePreference.java
+++ b/src/com/android/settings/deviceinfo/StorageVolumePreference.java
@@ -17,12 +17,17 @@
package com.android.settings.deviceinfo;
import android.content.Context;
+import android.content.res.ColorStateList;
+import android.graphics.Color;
+import android.graphics.drawable.Drawable;
import android.os.storage.StorageManager;
import android.os.storage.VolumeInfo;
import android.preference.Preference;
import android.text.format.Formatter;
import android.view.View;
import android.view.View.OnClickListener;
+import android.widget.ImageView;
+import android.widget.ProgressBar;
import android.widget.TextView;
import com.android.settings.R;
@@ -38,32 +43,53 @@
private final StorageManager mStorageManager;
private final VolumeInfo mVolume;
- public StorageVolumePreference(Context context, VolumeInfo volume) {
+ private int mColor;
+ private int mUsedPercent = -1;
+
+ public StorageVolumePreference(Context context, VolumeInfo volume, int color) {
super(context);
mStorageManager = context.getSystemService(StorageManager.class);
mVolume = volume;
+ mColor = color;
+
+ setLayoutResource(R.layout.storage_volume);
setKey(volume.getId());
setTitle(mStorageManager.getBestVolumeDescription(volume));
+ Drawable icon;
+ if (VolumeInfo.ID_PRIVATE_INTERNAL.equals(volume.getId())) {
+ icon = context.getDrawable(R.drawable.ic_settings_storage);
+ } else {
+ icon = context.getDrawable(R.drawable.ic_sim_sd);
+ }
+
if (volume.isMountedReadable()) {
// TODO: move statfs() to background thread
final File path = volume.getPath();
- final long usedBytes = path.getTotalSpace() - path.getFreeSpace();
+ final long freeBytes = path.getFreeSpace();
+ final long totalBytes = path.getTotalSpace();
+ final long usedBytes = totalBytes - freeBytes;
+
final String used = Formatter.formatFileSize(context, usedBytes);
- final String total = Formatter.formatFileSize(context, path.getTotalSpace());
+ final String total = Formatter.formatFileSize(context, totalBytes);
setSummary(context.getString(R.string.storage_volume_summary, used, total));
+ mUsedPercent = (int) ((usedBytes * 100) / totalBytes);
+
+ if (freeBytes < mStorageManager.getStorageLowBytes(path)) {
+ mColor = StorageSettings.COLOR_WARNING;
+ icon = context.getDrawable(R.drawable.ic_warning_24dp);
+ }
+
} else {
setSummary(volume.getStateDescription());
+ mUsedPercent = -1;
}
- // TODO: better icons
- if (VolumeInfo.ID_PRIVATE_INTERNAL.equals(volume.getId())) {
- setIcon(context.getDrawable(R.drawable.ic_settings_storage));
- } else {
- setIcon(context.getDrawable(R.drawable.ic_sim_sd));
- }
+ icon.mutate();
+ icon.setTint(mColor);
+ setIcon(icon);
if (volume.getType() == VolumeInfo.TYPE_PUBLIC
&& volume.isMountedReadable()) {
@@ -73,12 +99,21 @@
@Override
protected void onBindView(View view) {
- final TextView unmount = (TextView) view.findViewById(R.id.unmount);
+ final ImageView unmount = (ImageView) view.findViewById(R.id.unmount);
if (unmount != null) {
- unmount.setText("\u23CF");
+ unmount.getDrawable().setTint(Color.parseColor("#8a000000"));
unmount.setOnClickListener(mUnmountListener);
}
+ final ProgressBar progress = (ProgressBar) view.findViewById(android.R.id.progress);
+ if (mVolume.getType() == VolumeInfo.TYPE_PRIVATE && mUsedPercent != -1) {
+ progress.setVisibility(View.VISIBLE);
+ progress.setProgress(mUsedPercent);
+ progress.setProgressTintList(ColorStateList.valueOf(mColor));
+ } else {
+ progress.setVisibility(View.GONE);
+ }
+
super.onBindView(view);
}
diff --git a/src/com/android/settings/deviceinfo/UsageBarPreference.java b/src/com/android/settings/deviceinfo/UsageBarPreference.java
deleted file mode 100644
index 4763b79..0000000
--- a/src/com/android/settings/deviceinfo/UsageBarPreference.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * 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.settings.deviceinfo;
-
-import android.content.Context;
-import android.preference.Preference;
-import android.util.AttributeSet;
-import android.view.View;
-
-import com.android.settings.R;
-import com.google.android.collect.Lists;
-
-import java.util.Collections;
-import java.util.List;
-
-/**
- * Creates a percentage bar chart inside a preference.
- */
-public class UsageBarPreference extends Preference {
- private PercentageBarChart mChart = null;
-
- private final List<PercentageBarChart.Entry> mEntries = Lists.newArrayList();
-
- public UsageBarPreference(Context context) {
- this(context, null);
- }
-
- public UsageBarPreference(Context context, AttributeSet attrs) {
- this(context, attrs, 0);
- }
-
- public UsageBarPreference(Context context, AttributeSet attrs, int defStyle) {
- this(context, attrs, defStyle, 0);
- }
-
- public UsageBarPreference(Context context, AttributeSet attrs, int defStyleAttr,
- int defStyleRes) {
- super(context, attrs, defStyleAttr, defStyleRes);
- setLayoutResource(R.layout.preference_memoryusage);
- }
-
- public void addEntry(int order, float percentage, int color) {
- mEntries.add(PercentageBarChart.createEntry(order, percentage, color));
- Collections.sort(mEntries);
- }
-
- @Override
- protected void onBindView(View view) {
- super.onBindView(view);
-
- mChart = (PercentageBarChart) view.findViewById(R.id.percentage_bar_chart);
- mChart.setEntries(mEntries);
- }
-
- public void commit() {
- if (mChart != null) {
- mChart.invalidate();
- }
- }
-
- public void clear() {
- mEntries.clear();
- }
-}
diff --git a/src/com/android/settings/fingerprint/FingerprintEnrollFinish.java b/src/com/android/settings/fingerprint/FingerprintEnrollFinish.java
index b87e029..d45f3c2 100644
--- a/src/com/android/settings/fingerprint/FingerprintEnrollFinish.java
+++ b/src/com/android/settings/fingerprint/FingerprintEnrollFinish.java
@@ -16,10 +16,18 @@
package com.android.settings.fingerprint;
+import android.content.Context;
+import android.hardware.fingerprint.Fingerprint;
+import android.hardware.fingerprint.FingerprintManager;
import android.os.Bundle;
+import android.preference.Preference;
import android.view.View;
+import android.widget.Button;
import com.android.settings.R;
+import com.android.settings.fingerprint.FingerprintSettings.FingerprintPreference;
+
+import java.util.List;
/**
* Activity which concludes fingerprint enrollment.
@@ -31,7 +39,18 @@
super.onCreate(savedInstanceState);
setContentView(R.layout.fingerprint_enroll_finish);
setHeaderText(R.string.security_settings_fingerprint_enroll_finish_title);
- findViewById(R.id.add_another_button).setOnClickListener(this);
+ Button addButton = (Button) findViewById(R.id.add_another_button);
+
+ FingerprintManager fpm = (FingerprintManager) getSystemService(Context.FINGERPRINT_SERVICE);
+ int enrolled = fpm.getEnrolledFingerprints().size();
+ int max = getResources().getInteger(
+ com.android.internal.R.integer.config_fingerprintMaxTemplatesPerUser);
+ if (enrolled >= max) {
+ /* Don't show "Add" button if too many fingerprints already added */
+ addButton.setVisibility(View.INVISIBLE);
+ } else {
+ addButton.setOnClickListener(this);
+ }
}
@Override
diff --git a/src/com/android/settings/fingerprint/FingerprintSettings.java b/src/com/android/settings/fingerprint/FingerprintSettings.java
index 5cbab66..b81607b 100644
--- a/src/com/android/settings/fingerprint/FingerprintSettings.java
+++ b/src/com/android/settings/fingerprint/FingerprintSettings.java
@@ -179,6 +179,7 @@
switch (msg.what) {
case MSG_REFRESH_FINGERPRINT_TEMPLATES:
removeFingerprintPreference(msg.arg1);
+ updateAddPreference();
break;
case MSG_FINGER_AUTH_SUCCESS:
mFingerprintCancel = null;
@@ -330,6 +331,19 @@
addPreference.setIcon(R.drawable.ic_add_24dp);
root.addPreference(addPreference);
addPreference.setOnPreferenceChangeListener(this);
+ updateAddPreference();
+ }
+
+ private void updateAddPreference() {
+ /* Disable preference if too many fingerprints added */
+ final int max = getContext().getResources().getInteger(
+ com.android.internal.R.integer.config_fingerprintMaxTemplatesPerUser);
+ boolean tooMany = mFingerprintManager.getEnrolledFingerprints().size() >= max;
+ CharSequence maxSummary = tooMany ?
+ getContext().getString(R.string.fingerprint_add_max, max) : "";
+ Preference addPreference = findPreference(KEY_FINGERPRINT_ADD);
+ addPreference.setSummary(maxSummary);
+ addPreference.setEnabled(!tooMany);
}
private static String genKey(int id) {
@@ -562,7 +576,7 @@
Context ctx = widget.getContext();
Intent intent = HelpUtils.getHelpIntent(ctx, getURL(), ctx.getClass().getName());
try {
- ctx.startActivity(intent);
+ ((Activity) ctx).startActivityForResult(intent, 0);
} catch (ActivityNotFoundException e) {
Log.w(FingerprintSettingsFragment.TAG,
"Actvity was not found for intent, " + intent.toString());
diff --git a/src/com/android/settings/fuelgauge/HighPowerDetail.java b/src/com/android/settings/fuelgauge/HighPowerDetail.java
index f6964af..c57a461 100644
--- a/src/com/android/settings/fuelgauge/HighPowerDetail.java
+++ b/src/com/android/settings/fuelgauge/HighPowerDetail.java
@@ -20,6 +20,7 @@
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
+import android.app.Fragment;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
@@ -39,10 +40,13 @@
public class HighPowerDetail extends DialogFragment implements OnClickListener {
+ private static final String ARG_DEFAULT_ON = "default_on";
+
private final PowerWhitelistBackend mBackend = PowerWhitelistBackend.getInstance();
private String mPackageName;
private CharSequence mLabel;
+ private boolean mDefaultOn;
private Adapter mAdapter;
private int mSelectedIndex;
@@ -57,12 +61,13 @@
} catch (NameNotFoundException e) {
mLabel = mPackageName;
}
+ mDefaultOn = getArguments().getBoolean(ARG_DEFAULT_ON);
mAdapter = new Adapter(getContext(), R.layout.radio_with_summary);
mAdapter.add(new Pair<String, String>(getString(R.string.ignore_optimizations_on),
getString(R.string.ignore_optimizations_on_desc)));
mAdapter.add(new Pair<String, String>(getString(R.string.ignore_optimizations_off),
getString(R.string.ignore_optimizations_off_desc)));
- mSelectedIndex = mBackend.isWhitelisted(mPackageName) ? 0 : 1;
+ mSelectedIndex = mDefaultOn || mBackend.isWhitelisted(mPackageName) ? 0 : 1;
if (mBackend.isSysWhitelisted(mPackageName)) {
mAdapter.setEnabled(1, false);
}
@@ -97,6 +102,15 @@
}
}
+ @Override
+ public void onDismiss(DialogInterface dialog) {
+ super.onDismiss(dialog);
+ Fragment target = getTargetFragment();
+ if (target != null) {
+ target.onActivityResult(getTargetRequestCode(), 0, null);
+ }
+ }
+
public static CharSequence getSummary(Context context, AppEntry entry) {
return getSummary(context, entry.info.packageName);
}
@@ -106,12 +120,15 @@
? R.string.high_power_on : R.string.high_power_off);
}
- public static void show(Activity activity, String packageName) {
+ public static void show(Fragment caller, String packageName, int requestCode,
+ boolean defaultToOn) {
HighPowerDetail fragment = new HighPowerDetail();
Bundle args = new Bundle();
args.putString(AppInfoBase.ARG_PACKAGE_NAME, packageName);
+ args.putBoolean(ARG_DEFAULT_ON, defaultToOn);
fragment.setArguments(args);
- fragment.show(activity.getFragmentManager(), HighPowerDetail.class.getSimpleName());
+ fragment.setTargetFragment(caller, requestCode);
+ fragment.show(caller.getFragmentManager(), HighPowerDetail.class.getSimpleName());
}
private class Adapter extends ArrayAdapter<Pair<String, String>> {
diff --git a/src/com/android/settings/fuelgauge/PowerGaugePreference.java b/src/com/android/settings/fuelgauge/PowerGaugePreference.java
index e80f492..0be73d8 100644
--- a/src/com/android/settings/fuelgauge/PowerGaugePreference.java
+++ b/src/com/android/settings/fuelgauge/PowerGaugePreference.java
@@ -19,38 +19,31 @@
import android.content.Context;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
-import android.preference.Preference;
import android.view.View;
-import android.widget.ProgressBar;
import android.widget.TextView;
-import com.android.settings.R;
-import com.android.settings.TintablePreference;
+import com.android.settings.AppProgressPreference;
import com.android.settings.Utils;
/**
* Custom preference for displaying power consumption as a bar and an icon on
* the left for the subsystem/app type.
*/
-public class PowerGaugePreference extends TintablePreference {
+public class PowerGaugePreference extends AppProgressPreference {
private BatteryEntry mInfo;
- private int mProgress;
- private CharSequence mProgressText;
private final CharSequence mContentDescription;
public PowerGaugePreference(Context context, Drawable icon, CharSequence contentDescription,
BatteryEntry info) {
super(context, null);
- setLayoutResource(R.layout.preference_app_percentage);
setIcon(icon != null ? icon : new ColorDrawable(0));
mInfo = info;
mContentDescription = contentDescription;
}
public void setPercent(double percentOfMax, double percentOfTotal) {
- mProgress = (int) Math.ceil(percentOfMax);
- mProgressText = Utils.formatPercentage((int) (percentOfTotal + 0.5));
- notifyChanged();
+ setProgress((int) Math.ceil(percentOfMax));
+ setSummary(Utils.formatPercentage((int) (percentOfTotal + 0.5)));
}
BatteryEntry getInfo() {
@@ -61,12 +54,6 @@
protected void onBindView(View view) {
super.onBindView(view);
- final ProgressBar progress = (ProgressBar) view.findViewById(android.R.id.progress);
- progress.setProgress(mProgress);
-
- final TextView text1 = (TextView) view.findViewById(android.R.id.text1);
- text1.setText(mProgressText);
-
if (mContentDescription != null) {
final TextView titleView = (TextView) view.findViewById(android.R.id.title);
titleView.setContentDescription(mContentDescription);
diff --git a/src/com/android/settings/widget/ChartDataUsageView.java b/src/com/android/settings/widget/ChartDataUsageView.java
index c20a8db..cc9acd6 100644
--- a/src/com/android/settings/widget/ChartDataUsageView.java
+++ b/src/com/android/settings/widget/ChartDataUsageView.java
@@ -16,7 +16,6 @@
package com.android.settings.widget;
-import static android.net.TrafficStats.GB_IN_BYTES;
import static android.net.TrafficStats.MB_IN_BYTES;
import android.content.Context;
@@ -29,8 +28,11 @@
import android.text.SpannableStringBuilder;
import android.text.TextUtils;
import android.text.format.DateUtils;
+import android.text.format.Formatter;
+import android.text.format.Formatter.BytesResult;
import android.text.format.Time;
import android.util.AttributeSet;
+import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
@@ -533,33 +535,11 @@
@Override
public long buildLabel(Resources res, SpannableStringBuilder builder, long value) {
-
- final CharSequence unit;
- final long unitFactor;
- if (value < 1000 * MB_IN_BYTES) {
- unit = res.getText(com.android.internal.R.string.megabyteShort);
- unitFactor = MB_IN_BYTES;
- } else {
- unit = res.getText(com.android.internal.R.string.gigabyteShort);
- unitFactor = GB_IN_BYTES;
- }
-
- final double result = (double) value / unitFactor;
- final double resultRounded;
- final CharSequence size;
-
- if (result < 10) {
- size = String.format("%.1f", result);
- resultRounded = (unitFactor * Math.round(result * 10)) / 10;
- } else {
- size = String.format("%.0f", result);
- resultRounded = unitFactor * Math.round(result);
- }
-
- setText(builder, sSpanSize, size, "^1");
- setText(builder, sSpanUnit, unit, "^2");
-
- return (long) resultRounded;
+ final BytesResult result = Formatter.formatBytes(res, value,
+ Formatter.FLAG_SHORTER | Formatter.FLAG_CALCULATE_ROUNDED);
+ setText(builder, sSpanSize, result.value, "^1");
+ setText(builder, sSpanUnit, result.units, "^2");
+ return result.roundedBytes;
}
@Override