Merge \\"Fix tethering re-enable after edit.\\" into nyc-dev am: dbb5a0b918
am: cd2d94b2d1
Change-Id: Ifa46a3dce735778e99c115ac6499c71d05a2068b
diff --git a/Android.mk b/Android.mk
index 61734fb..537004e 100644
--- a/Android.mk
+++ b/Android.mk
@@ -1,6 +1,16 @@
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
+LOCAL_SRC_FILES := \
+ $(call all-logtags-files-under, src)
+
+LOCAL_MODULE := settings-logtags
+
+include $(BUILD_STATIC_JAVA_LIBRARY)
+
+# Build the Settings APK
+include $(CLEAR_VARS)
+
LOCAL_JAVA_LIBRARIES := bouncycastle core-oj telephony-common ims-common
LOCAL_STATIC_JAVA_LIBRARIES := \
android-support-v4 \
@@ -9,13 +19,13 @@
android-support-v7-preference \
android-support-v7-appcompat \
android-support-v14-preference \
- jsr305
+ jsr305 \
+ settings-logtags
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES := \
- $(call all-java-files-under, src) \
- src/com/android/settings/EventLogTags.logtags
+ $(call all-java-files-under, src)
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res \
frameworks/support/v7/preference/res \
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 48e8c03..cd061fc 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -81,6 +81,7 @@
<uses-permission android:name="android.permission.CHANGE_APP_IDLE_STATE" />
<uses-permission android:name="android.permission.PEERS_MAC_ADDRESS"/>
<uses-permission android:name="android.permission.MANAGE_NOTIFICATIONS"/>
+ <uses-permission android:name="android.permission.DELETE_PACKAGES"/>
<application android:label="@string/settings_label"
android:icon="@mipmap/ic_launcher_settings"
@@ -119,6 +120,7 @@
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
+ <meta-data android:name="android.app.shortcuts" android:resource="@xml/shortcuts"/>
</activity-alias>
<activity android:name=".Settings$WirelessSettings"
@@ -851,29 +853,23 @@
android:label="@string/wallpaper_settings_fragment_title"
android:icon="@drawable/ic_wallpaper"
android:taskAffinity="">
- <intent-filter android:priority="1">
- <action android:name="android.settings.WALLPAPER_SETTINGS" />
- <category android:name="android.intent.category.DEFAULT" />
- </intent-filter>
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
android:value="com.android.settings.WallpaperTypeSettings" />
</activity>
- <activity android:name="Settings$WallpaperSuggestionActivity"
- android:label="@string/wallpaper_settings_title"
- android:exported="true"
- android:icon="@drawable/ic_wallpaper"
- android:taskAffinity="">
+ <activity android:name="WallpaperSuggestionActivity"
+ android:label="@string/wallpaper_settings_title"
+ android:icon="@drawable/ic_wallpaper"
+ android:exported="true"
+ android:theme="@android:style/Theme.NoDisplay">
<intent-filter android:priority="1">
<action android:name="android.intent.action.MAIN" />
<category android:name="com.android.settings.suggested.category.SETTINGS_ONLY" />
</intent-filter>
- <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
- android:value="com.android.settings.WallpaperTypeSettings" />
<meta-data android:name="com.android.settings.title"
- android:resource="@string/wallpaper_suggestion_title" />
+ android:resource="@string/wallpaper_suggestion_title" />
<meta-data android:name="com.android.settings.summary"
- android:resource="@string/wallpaper_suggestion_summary" />
+ android:resource="@string/wallpaper_suggestion_summary" />
</activity>
<activity android:name="Settings$ZenModeScheduleRuleSettingsActivity"
@@ -1585,7 +1581,7 @@
android:enabled="false"
android:exported="true"
android:taskAffinity="com.android.wizard"
- android:theme="@style/SetupWizardDisableAppStartingTheme"
+ android:theme="@style/SuwThemeGlif.Light"
android:icon="@drawable/ic_suggested_notifications">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@@ -1599,7 +1595,8 @@
android:resource="@string/notification_suggestion_summary" />
</activity>
- <activity android:name=".notification.RedactionInterstitial"/>
+ <activity android:name=".notification.RedactionInterstitial"
+ android:theme="@style/SetupWizardTheme.Light" />
<activity android:name=".notification.RedactionSettingsStandalone"
android:exported="true">
@@ -1646,7 +1643,7 @@
<activity android:name=".fingerprint.SetupFingerprintEnrollIntroduction"
android:exported="true"
android:permission="android.permission.MANAGE_FINGERPRINT"
- android:theme="@style/SetupWizardDisableAppStartingTheme">
+ android:theme="@style/SetupWizardTheme.Light">
<intent-filter>
<action android:name="android.settings.FINGERPRINT_SETUP" />
<category android:name="android.intent.category.DEFAULT" />
@@ -1666,7 +1663,7 @@
<activity android:name="SetupChooseLockGeneric"
android:taskAffinity="com.android.wizard"
- android:theme="@style/SetupWizardDisableAppStartingTheme"
+ android:theme="@style/SetupWizardTheme.Light"
android:label="@string/lock_settings_picker_title">
<intent-filter android:priority="1">
<action android:name="com.android.settings.SETUP_LOCK_SCREEN" />
@@ -1724,25 +1721,30 @@
<activity android:name="SetupChooseLockPattern"
android:exported="false"
android:taskAffinity="com.android.wizard"
- android:theme="@style/SetupWizardDisableAppStartingTheme" />
+ android:theme="@style/SetupWizardTheme.Light" />
- <activity android:name="ChooseLockPattern" android:exported="false"/>
+ <activity android:name="ChooseLockPattern"
+ android:exported="false"
+ android:theme="@style/SetupWizardTheme.Light" />
<activity android:name="SetupChooseLockPassword"
android:exported="false"
android:taskAffinity="com.android.wizard"
- android:theme="@style/SetupWizardDisableAppStartingTheme"
+ android:theme="@style/SetupWizardTheme.Light"
android:windowSoftInputMode="stateVisible|adjustResize" />
- <activity android:name="ChooseLockPassword" android:exported="false"
+ <activity android:name="ChooseLockPassword"
+ android:exported="false"
+ android:theme="@style/SetupWizardTheme.Light"
android:windowSoftInputMode="stateVisible|adjustResize"/>
<activity android:name=".SetupEncryptionInterstitial"
android:label="@string/encryption_interstitial_header"
android:taskAffinity="com.android.wizard"
- android:theme="@style/SetupWizardDisableAppStartingTheme"/>
+ android:theme="@style/SetupWizardTheme.Light"/>
- <activity android:name=".EncryptionInterstitial"/>
+ <activity android:name=".EncryptionInterstitial"
+ android:theme="@style/SetupWizardTheme.Light" />
<!-- Runs in the phone process since it needs access to the Phone object -->
<activity android:name=".Settings$StatusActivity"
@@ -2687,7 +2689,7 @@
<!-- Show regulatory info (from settings item or dialing "*#07#") -->
<activity android:name="RegulatoryInfoDisplayActivity"
- android:label="@string/regulatory_information"
+ android:label="@string/regulatory_labels"
android:taskAffinity=""
android:enabled="@bool/config_show_regulatory_info">
<intent-filter>
@@ -2919,6 +2921,35 @@
android:value="true" />
</activity>
+ <activity android:name="Settings$DeletionHelperActivity"
+ android:label="@string/deletion_helper_title"
+ android:taskAffinity="">
+ <intent-filter android:priority="1">
+ <action android:name="android.settings.DELETION_HELPER_SETTINGS" />
+ <category android:name="android.intent.category.DEFAULT" />
+ </intent-filter>
+ <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
+ android:value="com.android.settings.deletionhelper.DeletionHelperFragment" />
+ </activity>
+
+ <!-- activity for gesture settings -->
+ <activity android:name="Settings$GestureSettingsActivity"
+ android:label="@string/gesture_preference_title"
+ android:icon="@drawable/ic_settings_gestures"
+ android:taskAffinity="">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="com.android.settings.SHORTCUT" />
+ </intent-filter>
+ <intent-filter>
+ <action android:name="com.android.settings.action.SETTINGS" />
+ </intent-filter>
+ <meta-data android:name="com.android.settings.category"
+ android:value="com.android.settings.category.device" />
+ <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
+ android:value="com.android.settings.gestures.GestureSettings" />
+ </activity>
+
<service
android:name=".SettingsDumpService"
android:exported="true"
@@ -2978,6 +3009,22 @@
<action android:name="android.service.quicksettings.action.QS_TILE" />
</intent-filter>
</service>
+
+ <!-- Automatic storage management tasks. -->
+ <service
+ android:name=".deletionhelper.AutomaticStorageManagementJobService"
+ android:label="@string/automatic_storage_manager_service_label"
+ android:permission="android.permission.BIND_JOB_SERVICE"
+ android:enabled="@bool/enable_automatic_storage_management"
+ android:exported="false"/>
+
+ <receiver android:name=".deletionhelper.AutomaticStorageBroadcastReceiver"
+ android:enabled="@bool/enable_automatic_storage_management">
+ <intent-filter>
+ <action android:name="android.intent.action.BOOT_COMPLETED" />
+ </intent-filter>
+ </receiver>
+
<!-- This is the longest AndroidManifest.xml ever. -->
</application>
</manifest>
diff --git a/proguard.flags b/proguard.flags
index 3c3300e..f3c218a 100644
--- a/proguard.flags
+++ b/proguard.flags
@@ -17,6 +17,7 @@
-keep class com.android.settings.users.*
-keep class com.android.settings.nfc.*
-keep class com.android.settings.notification.*
+-keep class com.android.settings.overlay.FeatureFactoryImpl
-keep class com.android.settings.accessibility.*FragmentForSetupWizard
-keep class com.android.settings.display.*FragmentForSetupWizard
diff --git a/res/values-sw360dp/aliases.xml b/res/color/sliding_tab_title_text_color.xml
similarity index 69%
copy from res/values-sw360dp/aliases.xml
copy to res/color/sliding_tab_title_text_color.xml
index a10585b..925ab97 100644
--- a/res/values-sw360dp/aliases.xml
+++ b/res/color/sliding_tab_title_text_color.xml
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2016 The Android Open Source Project
+<!--
+ Copyright (C) 2016 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,7 +15,8 @@
limitations under the License.
-->
-<resources>
- <item name="setup_choose_lock_pattern_template" type="layout">@layout/suw_template</item>
-</resources>
-
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:state_selected="false"
+ android:color="#b3ffffff"/>
+ <item android:color="@android:color/white"/>
+</selector>
diff --git a/res/drawable-hdpi/ic_bt_config.png b/res/drawable-hdpi/ic_bt_config.png
deleted file mode 100644
index a204936..0000000
--- a/res/drawable-hdpi/ic_bt_config.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/ic_bt_imaging.png b/res/drawable-hdpi/ic_bt_imaging.png
deleted file mode 100644
index 62624ee..0000000
--- a/res/drawable-hdpi/ic_bt_imaging.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/ic_bt_laptop.png b/res/drawable-hdpi/ic_bt_laptop.png
deleted file mode 100644
index 42c3dc5..0000000
--- a/res/drawable-hdpi/ic_bt_laptop.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/ic_menu_add_dark.png b/res/drawable-hdpi/ic_menu_add_dark.png
deleted file mode 100644
index 40a26b1..0000000
--- a/res/drawable-hdpi/ic_menu_add_dark.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/ic_menu_add_light.png b/res/drawable-hdpi/ic_menu_add_light.png
deleted file mode 100644
index 91b0354..0000000
--- a/res/drawable-hdpi/ic_menu_add_light.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/ic_menu_add_white.png b/res/drawable-hdpi/ic_menu_add_white.png
deleted file mode 100644
index 7638c64..0000000
--- a/res/drawable-hdpi/ic_menu_add_white.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/ic_sysbar_quicksettings.png b/res/drawable-hdpi/ic_sysbar_quicksettings.png
deleted file mode 100644
index a204936..0000000
--- a/res/drawable-hdpi/ic_sysbar_quicksettings.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/ic_bt_config.png b/res/drawable-mdpi/ic_bt_config.png
deleted file mode 100644
index d266b39..0000000
--- a/res/drawable-mdpi/ic_bt_config.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/ic_bt_imaging.png b/res/drawable-mdpi/ic_bt_imaging.png
deleted file mode 100644
index 76234a6..0000000
--- a/res/drawable-mdpi/ic_bt_imaging.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/ic_bt_laptop.png b/res/drawable-mdpi/ic_bt_laptop.png
deleted file mode 100644
index 792e8df..0000000
--- a/res/drawable-mdpi/ic_bt_laptop.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/ic_menu_add_dark.png b/res/drawable-mdpi/ic_menu_add_dark.png
deleted file mode 100644
index d7aa774..0000000
--- a/res/drawable-mdpi/ic_menu_add_dark.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/ic_menu_add_light.png b/res/drawable-mdpi/ic_menu_add_light.png
deleted file mode 100644
index 8b55810..0000000
--- a/res/drawable-mdpi/ic_menu_add_light.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/ic_menu_add_white.png b/res/drawable-mdpi/ic_menu_add_white.png
deleted file mode 100644
index 40cdc82..0000000
--- a/res/drawable-mdpi/ic_menu_add_white.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/ic_sysbar_quicksettings.png b/res/drawable-mdpi/ic_sysbar_quicksettings.png
deleted file mode 100644
index d266b39..0000000
--- a/res/drawable-mdpi/ic_sysbar_quicksettings.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xhdpi/ic_bt_config.png b/res/drawable-xhdpi/ic_bt_config.png
deleted file mode 100644
index 46077be..0000000
--- a/res/drawable-xhdpi/ic_bt_config.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xhdpi/ic_bt_imaging.png b/res/drawable-xhdpi/ic_bt_imaging.png
deleted file mode 100644
index 9ea3b85..0000000
--- a/res/drawable-xhdpi/ic_bt_imaging.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xhdpi/ic_bt_laptop.png b/res/drawable-xhdpi/ic_bt_laptop.png
deleted file mode 100644
index 1c053c8..0000000
--- a/res/drawable-xhdpi/ic_bt_laptop.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xhdpi/ic_menu_add_dark.png b/res/drawable-xhdpi/ic_menu_add_dark.png
deleted file mode 100644
index 2f00b96..0000000
--- a/res/drawable-xhdpi/ic_menu_add_dark.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xhdpi/ic_menu_add_light.png b/res/drawable-xhdpi/ic_menu_add_light.png
deleted file mode 100644
index 4109b2c..0000000
--- a/res/drawable-xhdpi/ic_menu_add_light.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xhdpi/ic_menu_add_white.png b/res/drawable-xhdpi/ic_menu_add_white.png
deleted file mode 100644
index 1d53989..0000000
--- a/res/drawable-xhdpi/ic_menu_add_white.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xhdpi/ic_sysbar_quicksettings.png b/res/drawable-xhdpi/ic_sysbar_quicksettings.png
deleted file mode 100644
index 46077be..0000000
--- a/res/drawable-xhdpi/ic_sysbar_quicksettings.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_bt_config.png b/res/drawable-xxhdpi/ic_bt_config.png
deleted file mode 100644
index ad964b4..0000000
--- a/res/drawable-xxhdpi/ic_bt_config.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_bt_imaging.png b/res/drawable-xxhdpi/ic_bt_imaging.png
deleted file mode 100644
index a0058dc..0000000
--- a/res/drawable-xxhdpi/ic_bt_imaging.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_bt_laptop.png b/res/drawable-xxhdpi/ic_bt_laptop.png
deleted file mode 100644
index bca7145..0000000
--- a/res/drawable-xxhdpi/ic_bt_laptop.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_menu_add_dark.png b/res/drawable-xxhdpi/ic_menu_add_dark.png
deleted file mode 100644
index 0ab6a40..0000000
--- a/res/drawable-xxhdpi/ic_menu_add_dark.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_menu_add_light.png b/res/drawable-xxhdpi/ic_menu_add_light.png
deleted file mode 100644
index 767b808..0000000
--- a/res/drawable-xxhdpi/ic_menu_add_light.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_menu_add_white.png b/res/drawable-xxhdpi/ic_menu_add_white.png
deleted file mode 100644
index 16a8b8a..0000000
--- a/res/drawable-xxhdpi/ic_menu_add_white.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_sysbar_quicksettings.png b/res/drawable-xxhdpi/ic_sysbar_quicksettings.png
deleted file mode 100644
index ad964b4..0000000
--- a/res/drawable-xxhdpi/ic_sysbar_quicksettings.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xxxhdpi/ic_bt_config.png b/res/drawable-xxxhdpi/ic_bt_config.png
deleted file mode 100644
index e89d484..0000000
--- a/res/drawable-xxxhdpi/ic_bt_config.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xxxhdpi/ic_bt_imaging.png b/res/drawable-xxxhdpi/ic_bt_imaging.png
deleted file mode 100644
index f0ffb52..0000000
--- a/res/drawable-xxxhdpi/ic_bt_imaging.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xxxhdpi/ic_bt_laptop.png b/res/drawable-xxxhdpi/ic_bt_laptop.png
deleted file mode 100644
index 2d758bd..0000000
--- a/res/drawable-xxxhdpi/ic_bt_laptop.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xxxhdpi/ic_menu_add_dark.png b/res/drawable-xxxhdpi/ic_menu_add_dark.png
deleted file mode 100644
index 01f53fe..0000000
--- a/res/drawable-xxxhdpi/ic_menu_add_dark.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xxxhdpi/ic_menu_add_white.png b/res/drawable-xxxhdpi/ic_menu_add_white.png
deleted file mode 100644
index 27a15f5..0000000
--- a/res/drawable-xxxhdpi/ic_menu_add_white.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xxxhdpi/ic_sysbar_quicksettings.png b/res/drawable-xxxhdpi/ic_sysbar_quicksettings.png
deleted file mode 100644
index e89d484..0000000
--- a/res/drawable-xxxhdpi/ic_sysbar_quicksettings.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable/ic_bt_imaging.xml b/res/drawable/ic_bt_imaging.xml
new file mode 100644
index 0000000..01e78c0
--- /dev/null
+++ b/res/drawable/ic_bt_imaging.xml
@@ -0,0 +1,27 @@
+<!--
+ Copyright (C) 2016 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0"
+ android:tint="?android:attr/colorAccent">
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M19,8L5,8c-1.66,0 -3,1.34 -3,3v6h4v4h12v-4h4v-6c0,-1.66 -1.34,-3
+ -3,-3zM16,19L8,19v-5h8v5zM19,12c-0.55,0 -1,-0.45 -1,-1s0.45,-1 1,-1 1,0.45 1,1 -0.45,1
+ -1,1zM18,3L6,3v4h12L18,3z"/>
+</vector>
\ No newline at end of file
diff --git a/res/drawable/ic_bt_laptop.xml b/res/drawable/ic_bt_laptop.xml
new file mode 100644
index 0000000..bf2fd49
--- /dev/null
+++ b/res/drawable/ic_bt_laptop.xml
@@ -0,0 +1,26 @@
+<!--
+ Copyright (C) 2016 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0"
+ android:tint="?android:attr/colorAccent">
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M20,18c1.1,0 2,-0.9 2,-2V6c0,-1.1 -0.9,-2 -2,-2H4c-1.1,0
+ -2,0.9 -2,2v10c0,1.1 0.9,2 2,2H0v2h24v-2h-4zM4,6h16v10H4V6z"/>
+</vector>
\ No newline at end of file
diff --git a/res/drawable/ic_fingerprint_header.xml b/res/drawable/ic_fingerprint_header.xml
new file mode 100644
index 0000000..e7ac81a
--- /dev/null
+++ b/res/drawable/ic_fingerprint_header.xml
@@ -0,0 +1,38 @@
+<!--
+ Copyright (C) 2016 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License
+-->
+
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="32dp"
+ android:height="32dp"
+ android:tint="?android:attr/colorPrimary"
+ android:viewportHeight="32.0"
+ android:viewportWidth="32.0">
+ <path
+ android:fillColor="#ffffff"
+ android:pathData="M23.7,5.9c-0.1,0.0 -0.2,0.0 -0.3,-0.1C21.0,4.5 18.6,3.9 16.0,3.9c-2.5,0.0 -4.6,0.6 -6.9,1.9C8.8,6.0 8.3,5.9 8.1,5.5C7.9,5.2 8.0,4.7 8.4,4.5c2.5,-1.4 4.9,-2.1 7.7,-2.1c2.8,0.0 5.4,0.7 8.0,2.1c0.4,0.2 0.5,0.6 0.3,1.0C24.2,5.7 24.0,5.9 23.7,5.9z" />
+ <path
+ android:fillColor="#ffffff"
+ android:pathData="M5.3,13.2c-0.1,0.0 -0.3,0.0 -0.4,-0.1c-0.3,-0.2 -0.4,-0.7 -0.2,-1.0c1.3,-1.9 2.9,-3.4 4.9,-4.5c4.1,-2.2 9.3,-2.2 13.4,0.0c1.9,1.1 3.6,2.5 4.9,4.4c0.2,0.3 0.1,0.8 -0.2,1.0c-0.3,0.2 -0.8,0.1 -1.0,-0.2c-1.2,-1.7 -2.6,-3.0 -4.3,-4.0c-3.7,-2.0 -8.3,-2.0 -12.0,0.0c-1.7,0.9 -3.2,2.3 -4.3,4.0C5.7,13.1 5.5,13.2 5.3,13.2z" />
+ <path
+ android:fillColor="#ffffff"
+ android:pathData="M13.3,29.6c-0.2,0.0 -0.4,-0.1 -0.5,-0.2c-1.1,-1.2 -1.7,-2.0 -2.6,-3.6c-0.9,-1.7 -1.4,-3.7 -1.4,-5.9c0.0,-4.1 3.3,-7.4 7.4,-7.4c4.1,0.0 7.4,3.3 7.4,7.4c0.0,0.4 -0.3,0.7 -0.7,0.7s-0.7,-0.3 -0.7,-0.7c0.0,-3.3 -2.7,-5.9 -5.9,-5.9c-3.3,0.0 -5.9,2.7 -5.9,5.9c0.0,2.0 0.4,3.8 1.2,5.2c0.8,1.6 1.4,2.2 2.4,3.3c0.3,0.3 0.3,0.8 0.0,1.0C13.7,29.5 13.5,29.6 13.3,29.6z" />
+ <path
+ android:fillColor="#ffffff"
+ android:pathData="M22.6,27.1c-1.6,0.0 -2.9,-0.4 -4.1,-1.2c-1.9,-1.4 -3.1,-3.6 -3.1,-6.0c0.0,-0.4 0.3,-0.7 0.7,-0.7s0.7,0.3 0.7,0.7c0.0,1.9 0.9,3.7 2.5,4.8c0.9,0.6 1.9,1.0 3.2,1.0c0.3,0.0 0.8,0.0 1.3,-0.1c0.4,-0.1 0.8,0.2 0.8,0.6c0.1,0.4 -0.2,0.8 -0.6,0.8C23.4,27.1 22.8,27.1 22.6,27.1z" />
+ <path
+ android:fillColor="#ffffff"
+ android:pathData="M20.0,29.9c-0.1,0.0 -0.1,0.0 -0.2,0.0c-2.1,-0.6 -3.4,-1.4 -4.8,-2.9c-1.8,-1.9 -2.8,-4.4 -2.8,-7.1c0.0,-2.2 1.8,-4.1 4.1,-4.1c2.2,0.0 4.1,1.8 4.1,4.1c0.0,1.4 1.2,2.6 2.6,2.6c1.4,0.0 2.6,-1.2 2.6,-2.6c0.0,-5.1 -4.2,-9.3 -9.3,-9.3c-3.6,0.0 -6.9,2.1 -8.4,5.4C7.3,17.1 7.0,18.4 7.0,19.8c0.0,1.1 0.1,2.7 0.9,4.9c0.1,0.4 -0.1,0.8 -0.4,0.9c-0.4,0.1 -0.8,-0.1 -0.9,-0.4c-0.6,-1.8 -0.9,-3.6 -0.9,-5.4c0.0,-1.6 0.3,-3.1 0.9,-4.4c1.7,-3.8 5.6,-6.3 9.8,-6.3c5.9,0.0 10.7,4.8 10.7,10.7c0.0,2.2 -1.8,4.1 -4.1,4.1s-4.0,-1.8 -4.0,-4.1c0.0,-1.4 -1.2,-2.6 -2.6,-2.6c-1.4,0.0 -2.6,1.2 -2.6,2.6c0.0,2.3 0.9,4.5 2.4,6.1c1.2,1.3 2.4,2.0 4.2,2.5c0.4,0.1 0.6,0.5 0.5,0.9C20.6,29.7 20.3,29.9 20.0,29.9z" />
+</vector>
diff --git a/res/drawable/ic_gesture_play_button.xml b/res/drawable/ic_gesture_play_button.xml
new file mode 100644
index 0000000..e2fa6e0
--- /dev/null
+++ b/res/drawable/ic_gesture_play_button.xml
@@ -0,0 +1,25 @@
+<!--
+ Copyright (C) 2016 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0">
+ <path
+ android:fillColor="#FFFFFFFF"
+ android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM10,
+ 16.5v-9l6,4.5 -6,4.5z"/>
+</vector>
\ No newline at end of file
diff --git a/res/drawable/ic_help_24dp.xml b/res/drawable/ic_help_24dp.xml
new file mode 100644
index 0000000..57c6ee8
--- /dev/null
+++ b/res/drawable/ic_help_24dp.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2016 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<vector
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0"
+ android:tint="?android:attr/colorControlNormal">
+ <path
+ android:fillColor="#FFFFFFFF"
+ android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48
+ 10,-10S17.52,2 12,2zm1,17h-2v-2h2v2zm2.07,-7.75l-0.9,0.92C13.45,12.9 13,13.5
+ 13,15h-2v-0.5c0,-1.1 0.45,-2.1 1.17,-2.83l1.24,-1.26c0.37,-0.36 0.59,-0.86 0.59,-1.41
+ 0,-1.1 -0.9,-2 -2,-2s-2,0.9 -2,2H8c0,-2.21 1.79,-4 4,-4s4,1.79 4,4c0,0.88
+ -0.36,1.68 -0.93,2.25z"/>
+</vector>
\ No newline at end of file
diff --git a/res/drawable/ic_keyboard_arrow_down_black_32.xml b/res/drawable/ic_keyboard_arrow_down_black_32.xml
new file mode 100644
index 0000000..12ce9c2
--- /dev/null
+++ b/res/drawable/ic_keyboard_arrow_down_black_32.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2016 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="32dp"
+ android:height="32dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0">
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M7.41,7.84L12,12.42l4.59,-4.58L18,9.25l-6,6 -6,-6z"/>
+</vector>
\ No newline at end of file
diff --git a/res/drawable/ic_keyboard_arrow_up_black_32.xml b/res/drawable/ic_keyboard_arrow_up_black_32.xml
new file mode 100644
index 0000000..d419800
--- /dev/null
+++ b/res/drawable/ic_keyboard_arrow_up_black_32.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2016 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="32dp"
+ android:height="32dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0">
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M7.41,15.41L12,10.83l4.59,4.58L18,14l-6,-6 -6,6z"/>
+</vector>
\ No newline at end of file
diff --git a/res/drawable/ic_lightbulb_outline_24.xml b/res/drawable/ic_lightbulb_outline_24.xml
new file mode 100644
index 0000000..4590d43
--- /dev/null
+++ b/res/drawable/ic_lightbulb_outline_24.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2016 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<vector
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0"
+ android:tint="?android:attr/colorControlNormal">
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M9,21c0,0.55 0.45,1 1,1h4c0.55,0 1,-0.45 1,-1v-1L9,20v1zM12,2C8.14,2
+ 5,5.14 5,9c0,2.38 1.19,4.47 3,5.74L8,17c0,0.55 0.45,1 1,1h6c0.55,0 1,-0.45
+ 1,-1v-2.26c1.81,-1.27 3,-3.36 3,-5.74 0,-3.86 -3.14,-7
+ -7,-7zM14.85,13.1l-0.85,0.6L14,16h-4v-2.3l-0.85,-0.6C7.8,12.16 7,10.63 7,9c0,-2.76
+ 2.24,-5 5,-5s5,2.24 5,5c0,1.63 -0.8,3.16 -2.15,4.1z"/>
+</vector>
\ No newline at end of file
diff --git a/res/drawable/ic_lock.xml b/res/drawable/ic_lock.xml
new file mode 100644
index 0000000..975cbf5
--- /dev/null
+++ b/res/drawable/ic_lock.xml
@@ -0,0 +1,24 @@
+<!--
+ Copyright (C) 2016 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="32dp"
+ android:height="32dp"
+ android:viewportHeight="24.0"
+ android:viewportWidth="24.0">
+ <path
+ android:fillColor="?android:attr/colorPrimary"
+ android:pathData="M18,8h-1L17,6c0,-2.76 -2.24,-5 -5,-5S7,3.24 7,6v2L6,8c-1.1,0 -2,0.9 -2,2v10c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2L20,10c0,-1.1 -0.9,-2 -2,-2zM12,17c-1.1,0 -2,-0.9 -2,-2s0.9,-2 2,-2 2,0.9 2,2 -0.9,2 -2,2zM15.1,8L8.9,8L8.9,6c0,-1.71 1.39,-3.1 3.1,-3.1 1.71,0 3.1,1.39 3.1,3.1v2z" />
+</vector>
diff --git a/res/drawable/ic_menu_add.xml b/res/drawable/ic_menu_add.xml
index ed58072..3387f29 100644
--- a/res/drawable/ic_menu_add.xml
+++ b/res/drawable/ic_menu_add.xml
@@ -15,6 +15,13 @@
limitations under the License.
-->
-<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
- android:src="@drawable/ic_menu_add_white"
- android:tint="?android:attr/colorAccent" />
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0"
+ android:tint="?android:attr/colorAccent">
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M19,13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/>
+</vector>
diff --git a/res/values-sw360dp/aliases.xml b/res/drawable/ic_menu_add_white.xml
similarity index 62%
copy from res/values-sw360dp/aliases.xml
copy to res/drawable/ic_menu_add_white.xml
index a10585b..9a06d5c 100644
--- a/res/values-sw360dp/aliases.xml
+++ b/res/drawable/ic_menu_add_white.xml
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2016 The Android Open Source Project
+<!--
+ Copyright (C) 2016 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -14,7 +15,12 @@
limitations under the License.
-->
-<resources>
- <item name="setup_choose_lock_pattern_template" type="layout">@layout/suw_template</item>
-</resources>
-
+<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="#FFFFFFFF"
+ android:pathData="M19,13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/>
+</vector>
diff --git a/res/drawable/ic_settings.xml b/res/drawable/ic_settings.xml
new file mode 100644
index 0000000..439c1a7
--- /dev/null
+++ b/res/drawable/ic_settings.xml
@@ -0,0 +1,36 @@
+<!--
+ Copyright (C) 2016 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0"
+ android:tint="?android:attr/colorAccent">
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M19.43,12.98c0.04,-0.32 0.07,-0.64 0.07,-0.98s-0.03,-0.66
+ -0.07,-0.98l2.11,-1.65c0.19,-0.15 0.24,-0.42 0.12,-0.64l-2,-3.46c-0.12,-0.22 -0.39,-0.3
+ -0.61,-0.22l-2.49,1c-0.52,-0.4 -1.08,-0.73 -1.69,-0.98l-0.38,-2.65C14.46,2.18 14.25,2
+ 14,2h-4c-0.25,0 -0.46,0.18 -0.49,0.42l-0.38,2.65c-0.61,0.25 -1.17,0.59
+ -1.69,0.98l-2.49,-1c-0.23,-0.09 -0.49,0 -0.61,0.22l-2,3.46c-0.13,0.22 -0.07,0.49
+ 0.12,0.64l2.11,1.65c-0.04,0.32 -0.07,0.65 -0.07,0.98s0.03,0.66
+ 0.07,0.98l-2.11,1.65c-0.19,0.15 -0.24,0.42 -0.12,0.64l2,3.46c0.12,0.22 0.39,0.3
+ 0.61,0.22l2.49,-1c0.52,0.4 1.08,0.73 1.69,0.98l0.38,2.65c0.03,0.24 0.24,0.42
+ 0.49,0.42h4c0.25,0 0.46,-0.18 0.49,-0.42l0.38,-2.65c0.61,-0.25
+ 1.17,-0.59 1.69,-0.98l2.49,1c0.23,0.09 0.49,0 0.61,-0.22l2,-3.46c0.12,-0.22 0.07,-0.49
+ -0.12,-0.64l-2.11,-1.65zM12,15.5c-1.93,0 -3.5,-1.57
+ -3.5,-3.5s1.57,-3.5 3.5,-3.5 3.5,1.57 3.5,3.5 -1.57,3.5 -3.5,3.5z"/>
+</vector>
diff --git a/res/drawable/ic_settings_gestures.xml b/res/drawable/ic_settings_gestures.xml
new file mode 100644
index 0000000..9537bed
--- /dev/null
+++ b/res/drawable/ic_settings_gestures.xml
@@ -0,0 +1,25 @@
+<!--
+ Copyright (C) 2016 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0"
+ android:tint="?android:attr/colorAccent">
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M9,11.24L9,7.5C9,6.12 10.12,5 11.5,5S14,6.12 14,7.5v3.74c1.21,-0.81 2,-2.18 2,-3.74C16,5.01 13.99,3 11.5,3S7,5.01 7,7.5c0,1.56 0.79,2.93 2,3.74zM18.84,15.87l-4.54,-2.26c-0.17,-0.07 -0.35,-0.11 -0.54,-0.11L13,13.5v-6c0,-0.83 -0.67,-1.5 -1.5,-1.5S10,6.67 10,7.5v10.74l-3.43,-0.72c-0.08,-0.01 -0.15,-0.03 -0.24,-0.03 -0.31,0 -0.59,0.13 -0.79,0.33l-0.79,0.8 4.94,4.94c0.27,0.27 0.65,0.44 1.06,0.44h6.79c0.75,0 1.33,-0.55 1.44,-1.28l0.75,-5.27c0.01,-0.07 0.02,-0.14 0.02,-0.2 0,-0.62 -0.38,-1.16 -0.91,-1.38z"/>
+</vector>
\ No newline at end of file
diff --git a/res/drawable/ic_shortcut_battery.xml b/res/drawable/ic_shortcut_battery.xml
new file mode 100644
index 0000000..36bffa2
--- /dev/null
+++ b/res/drawable/ic_shortcut_battery.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2016 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License
+ -->
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
+ <item>
+ <bitmap android:src="@drawable/shortcut_base" />
+ </item>
+ <item>
+ <inset android:inset="19.2dp">
+ <vector android:width="24.0dp"
+ android:height="24.0dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0">
+ <path
+ android:fillColor="@color/icon_accent"
+ android:pathData="M15.67,4.0L14.0,4.0L14.0,2.0l-4.0,0.0l0.0,2.0L8.33,4.0C7.6,4.0 7.0,4.6 7.0,5.33l0.0,15.33C7.0,21.4 7.6,22.0 8.33,22.0l7.33,0.0c0.74,0.0 1.34,-0.6 1.34,-1.33L17.0,5.33C17.0,4.6 16.4,4.0 15.67,4.0z
+ M16,5l0,5.5l-8,0l0,-5.5l3,0l0,-2l2,0l0,2l3,0z"/>
+ </vector>
+ </inset>
+ </item>
+</layer-list>
\ No newline at end of file
diff --git a/res/drawable/ic_shortcut_data_usage.xml b/res/drawable/ic_shortcut_data_usage.xml
new file mode 100644
index 0000000..d1d4cac
--- /dev/null
+++ b/res/drawable/ic_shortcut_data_usage.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2016 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License
+ -->
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
+ <item>
+ <bitmap android:src="@drawable/shortcut_base" />
+ </item>
+ <item>
+ <inset android:inset="19.2dp">
+ <vector android:width="24.0dp"
+ android:height="24.0dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0">
+ <path
+ android:fillColor="@color/icon_accent"
+ android:pathData="M26.0,4.1
+ l0.0,6.06
+ c6.7,0.97 12.0,6.79 12.0,13.84
+ 0.0,1.79 -0.35,3.5 -0.96,5.07
+ l5.2,3.07
+ C43.35,29.65 44.0,26.91 44.0,24.0
+ c0.0,-10.37 -7.89,-18.89 -18.0,-19.9z
+ M24.0,38.0
+ c-7.73,0.0 -14.0,-6.27 -14.0,-14.0 0.0,-7.05 5.22,-12.87 12.0,-13.84
+ l0.0,-6
+ C11.88,5.1 4.0,13.63 4.0,24.0
+ c0.0,11.05 8.94,20.0 19.99,20.0 6.62,0.0 12.47,-3.23 16.11,-8.18
+ l-5.19,-3.06
+ C32.35,35.95 28.42,38.0 24.0,38.0z"/>
+ </vector>
+ </inset>
+ </item>
+</layer-list>
\ No newline at end of file
diff --git a/res/drawable/ic_shortcut_display.xml b/res/drawable/ic_shortcut_display.xml
new file mode 100644
index 0000000..9053f5f
--- /dev/null
+++ b/res/drawable/ic_shortcut_display.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2016 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License
+ -->
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
+ <item>
+ <bitmap android:src="@drawable/shortcut_base" />
+ </item>
+ <item>
+ <inset android:inset="19.2dp">
+ <vector android:width="24.0dp"
+ android:height="24.0dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0">
+ <path
+ android:fillColor="@color/icon_accent"
+ android:pathData="M20.0,15.31L23.31,12.0 20.0,8.69L20.0,4.0l-4.69,0.0L12.0,0.69 8.69,4.0L4.0,4.0l0.0,4.69L0.69,12.0 4.0,15.31L4.0,20.0l4.69,0.0L12.0,23.31 15.31,20.0L20.0,20.0l0.0,-4.69zM12.0,18.0L12.0,6.0c3.31,0.0 6.0,2.69 6.0,6.0s-2.69,6.0 -6.0,6.0z"/>
+ </vector>
+ </inset>
+ </item>
+</layer-list>
\ No newline at end of file
diff --git a/res/drawable/ic_shortcut_storage.xml b/res/drawable/ic_shortcut_storage.xml
new file mode 100644
index 0000000..0729d1d
--- /dev/null
+++ b/res/drawable/ic_shortcut_storage.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2016 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License
+ -->
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
+ <item>
+ <bitmap android:src="@drawable/shortcut_base" />
+ </item>
+ <item>
+ <inset android:inset="19.2dp">
+ <vector android:width="24.0dp"
+ android:height="24.0dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0">
+ <path
+ android:fillColor="@color/icon_accent"
+ android:pathData="M2.0,20.0l20.0,0.0l0.0,-4.0L2.0,16.0l0.0,4.0zm2.0,-3.0l2.0,0.0l0.0,2.0L4.0,19.0l0.0,-2.0zM2.0,4.0l0.0,4.0l20.0,0.0L22.0,4.0L2.0,4.0zm4.0,3.0L4.0,7.0L4.0,5.0l2.0,0.0l0.0,2.0zm-4.0,7.0l20.0,0.0l0.0,-4.0L2.0,10.0l0.0,4.0zm2.0,-3.0l2.0,0.0l0.0,2.0L4.0,13.0l0.0,-2.0z"/>
+ </vector>
+ </inset>
+ </item>
+</layer-list>
\ No newline at end of file
diff --git a/res/drawable/ic_shortcut_wireless.xml b/res/drawable/ic_shortcut_wireless.xml
new file mode 100644
index 0000000..1c4d1d7
--- /dev/null
+++ b/res/drawable/ic_shortcut_wireless.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2016 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License
+ -->
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
+ <item>
+ <bitmap android:src="@drawable/shortcut_base" />
+ </item>
+ <item>
+ <inset android:inset="19.2dp">
+ <vector android:width="24.0dp"
+ android:height="24.0dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0">
+ <path
+ android:fillColor="@color/icon_accent"
+ android:pathData="M9.01,15.99l8.8,-10.96C17.47,4.77 14.08,2.0 9.0,2.0S0.53,4.7 0.19,5.03l8.8,10.96l0.02,0.0z"/>
+ </vector>
+ </inset>
+ </item>
+</layer-list>
\ No newline at end of file
diff --git a/res/values-sw360dp/aliases.xml b/res/drawable/selectable_card_grey.xml
similarity index 69%
copy from res/values-sw360dp/aliases.xml
copy to res/drawable/selectable_card_grey.xml
index a10585b..e4c73ba 100644
--- a/res/values-sw360dp/aliases.xml
+++ b/res/drawable/selectable_card_grey.xml
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2016 The Android Open Source Project
+<!--
+ Copyright (C) 2016 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -14,7 +15,8 @@
limitations under the License.
-->
-<resources>
- <item name="setup_choose_lock_pattern_template" type="layout">@layout/suw_template</item>
-</resources>
-
+<ripple
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:color="?android:attr/colorControlHighlight">
+ <item android:drawable="@color/card_background_grey"/>
+</ripple>
diff --git a/res/drawable/switchbar_background.xml b/res/drawable/switchbar_background.xml
index ac340be..3d729fd 100644
--- a/res/drawable/switchbar_background.xml
+++ b/res/drawable/switchbar_background.xml
@@ -16,6 +16,6 @@
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="?android:attr/colorControlHighlight">
- <item android:drawable="@color/switchbar_background_color" />
+ <item android:drawable="?attr/colorSecondary" />
</ripple>
diff --git a/res/layout-land/choose_lock_password.xml b/res/layout-land/choose_lock_password.xml
deleted file mode 100644
index f79de61..0000000
--- a/res/layout-land/choose_lock_password.xml
+++ /dev/null
@@ -1,100 +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.
-*/
--->
-<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:fillViewport="true">
-
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical"
- android:gravity="center_horizontal">
-
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="horizontal">
- <!-- "Enter PIN(Password) to unlock" -->
- <TextView android:id="@+id/headerText"
- android:layout_width="0dip"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:orientation="horizontal"
- android:layout_marginEnd="6dip"
- android:layout_marginStart="6dip"
- android:layout_marginTop="10dip"
- android:layout_marginBottom="10dip"
- android:gravity="start"
- android:ellipsize="marquee"
- android:textAppearance="?android:attr/textAppearanceMedium"
- />
-
- <!-- Password entry field -->
- <EditText android:id="@+id/password_entry"
- android:layout_width="0dip"
- android:layout_height="wrap_content"
- android:layout_marginTop="5dip"
- android:layout_marginBottom="5dip"
- android:layout_gravity="center"
- android:layout_weight="1"
- android:inputType="textPassword"
- android:imeOptions="actionNext|flagNoExtractUi"
- android:gravity="center"
- android:textSize="24sp"
- style="@style/TextAppearance.PasswordEntry"
- />
- </LinearLayout>
-
- <!-- Alphanumeric keyboard -->
- <com.android.internal.widget.PasswordEntryKeyboardView android:id="@+id/keyboard"
- android:layout_alignParentBottom="true"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:background="#00000000"
- android:keyBackground="@*android:drawable/btn_keyboard_key_fulltrans"
- android:visibility="gone"
- />
-
- <RelativeLayout
- android:layout_width="match_parent"
- android:layout_height="0dip"
- android:layout_weight="1">
- <LinearLayout
- style="@style/SecurityPreferenceButtonContainer"
- android:orientation="horizontal"
- android:layout_alignParentEnd="true"
- android:layout_alignParentBottom="true">
-
- <!-- left : cancel -->
- <Button android:id="@+id/cancel_button"
- style="@style/SecurityPreferenceButton"
- android:text="@string/lockpassword_cancel_label"/>
-
- <!-- right : continue -->
- <Button android:id="@+id/next_button"
- style="@style/SecurityPreferenceButton"
- android:text="@string/lockpassword_continue_label"/>
-
- </LinearLayout>
- </RelativeLayout>
-
- </LinearLayout>
-
-</ScrollView>
diff --git a/res/layout-land/choose_lock_pattern.xml b/res/layout-land/choose_lock_pattern.xml
index f048ba2..89e3d57 100644
--- a/res/layout-land/choose_lock_pattern.xml
+++ b/res/layout-land/choose_lock_pattern.xml
@@ -1,94 +1,141 @@
<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2008 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.
- You may obtain a copy of the License at
+ 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
+ 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.
+ 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.
-->
-<com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/topLayout"
- android:orientation="horizontal"
+<com.android.setupwizardlib.GlifLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:settings="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
- android:layout_height="match_parent">
+ android:layout_height="match_parent"
+ android:icon="@drawable/ic_lock"
+ android:layout="@layout/suw_glif_blank_template"
+ settings:suwHeaderText="@string/lock_settings_picker_title">
- <!-- left side: instructions and messages -->
- <LinearLayout
- android:orientation="vertical"
+ <com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient
+ android:id="@+id/topLayout"
+ android:clipChildren="false"
+ android:clipToPadding="false"
+ android:orientation="horizontal"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ <!-- left side: instructions and messages -->
+ <LinearLayout
android:layout_width="0dip"
android:layout_height="match_parent"
android:layout_weight="1.0"
- >
+ android:layout_marginStart="?attr/suwMarginSides"
+ android:layout_marginBottom="@dimen/suw_content_frame_padding_bottom"
+ android:orientation="vertical">
- <!-- header message -->
- <TextView android:id="@+id/headerText"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="16dp"
- android:gravity="center"
- android:textSize="18sp"/>
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
- <!-- footer can show a message, or confirm / restart buttons -->
- <RelativeLayout
+ <ImageView
+ android:id="@+id/suw_layout_icon"
+ style="@style/SuwGlifIcon"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="0dp"
+ android:layout_marginEnd="0dp"
+ android:src="@drawable/ic_lock" />
+
+ <TextView
+ android:id="@+id/suw_layout_title"
+ style="@style/SuwGlifHeaderTitle"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="0dp"
+ android:layout_marginEnd="0dp" />
+
+ </LinearLayout>
+
+ <!-- header message -->
+ <TextView android:id="@+id/headerText"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="16dp"
+ android:gravity="start|bottom"
+ android:textSize="18sp" />
+
+ <!-- footer can show a message, or confirm / restart buttons -->
+ <RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="1.0">
- <!-- confirm / restart buttons -->
- <LinearLayout android:id="@+id/buttonContainer"
- style="@style/SecurityPreferenceButtonContainer"
- android:layout_centerHorizontal="true"
- android:layout_alignParentBottom="true"
- android:orientation="horizontal">
-
- <!-- left / top button: skip, or re-try -->
- <Button android:id="@+id/footerLeftButton"
- style="@style/SecurityPreferenceButton"
+ <!-- confirm / restart buttons -->
+ <LinearLayout android:id="@+id/buttonContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:text="@string/lockpattern_restart_button_text"/>
+ android:layout_centerHorizontal="true"
+ android:layout_alignParentBottom="true"
+ android:orientation="horizontal">
- <!-- right / bottom button: confirm or ok -->
- <Button android:id="@+id/footerRightButton"
- style="@style/SecurityPreferenceButton"
- android:layout_width="match_parent"
+ <!-- left / top button: skip, or re-try -->
+ <Button android:id="@+id/footerLeftButton"
+ style="@style/SetupWizardButton.Negative"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/lockpattern_restart_button_text" />
+
+ <Space
+ android:layout_width="0dp"
+ android:layout_height="0dp"
+ android:layout_weight="1" />
+
+ <!-- right / bottom button: confirm or ok -->
+ <Button android:id="@+id/footerRightButton"
+ style="@style/SetupWizardButton.Positive"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/lockpattern_confirm_button_text" />
+
+ </LinearLayout>
+
+ <!-- message above buttons -->
+ <TextView android:id="@+id/footerText"
+ android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:text="@string/lockpattern_confirm_button_text"/>
+ android:layout_above="@+id/buttonContainer"
+ android:layout_centerHorizontal="true"
+ android:layout_marginBottom="4dip"
+ android:textSize="14sp"
+ android:visibility="gone" />
- </LinearLayout>
+ </RelativeLayout>
- <!-- message above buttons -->
- <TextView android:id="@+id/footerText"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_above="@+id/buttonContainer"
- android:layout_centerHorizontal="true"
- android:layout_marginBottom="4dip"
- android:textSize="14sp"/>
+ </LinearLayout>
- </RelativeLayout>
- </LinearLayout>
+ <!-- right side: lock pattern -->
+ <FrameLayout
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_weight="1.0">
- <View
- android:background="@*android:drawable/code_lock_left"
- android:layout_width="2dip"
- android:layout_height="match_parent" />
+ <com.android.internal.widget.LockPatternView android:id="@+id/lockPattern"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_gravity="center"
+ android:background="@color/lock_pattern_background" />
- <!-- right side: lock pattern -->
- <com.android.internal.widget.LockPatternView android:id="@+id/lockPattern"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:background="@color/lock_pattern_background" />
+ </FrameLayout>
+ </com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient>
-</com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient>
-
+</com.android.setupwizardlib.GlifLayout>
diff --git a/res/layout-land/fingerprint_enroll_enrolling.xml b/res/layout-land/fingerprint_enroll_enrolling.xml
index c72c029..8154d0c 100644
--- a/res/layout-land/fingerprint_enroll_enrolling.xml
+++ b/res/layout-land/fingerprint_enroll_enrolling.xml
@@ -15,7 +15,7 @@
~ limitations under the License
-->
-<com.android.setupwizardlib.SetupWizardLayout
+<com.android.setupwizardlib.GlifLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/setup_wizard_layout"
android:layout_width="match_parent"
@@ -33,17 +33,17 @@
<!-- Both texts are kept as separate text views so it doesn't jump around in portrait.
See layouts/fingerprint_enroll_enrolling_base.xml. -->
- <FrameLayout
+ <RelativeLayout
android:layout_width="0dp"
android:layout_weight="1"
- android:layout_height="wrap_content"
- android:layout_gravity="center_vertical">
+ android:layout_height="wrap_content">
<TextView
style="@style/TextAppearance.FingerprintMessage"
android:id="@+id/start_message"
android:layout_width="match_parent"
android:layout_height="wrap_content"
+ android:layout_alignParentTop="true"
android:text="@string/security_settings_fingerprint_enroll_start_message"/>
<TextView
@@ -51,10 +51,21 @@
android:id="@+id/repeat_message"
android:layout_width="match_parent"
android:layout_height="wrap_content"
+ android:layout_alignParentTop="true"
android:text="@string/security_settings_fingerprint_enroll_repeat_message"
android:visibility="invisible"/>
- </FrameLayout>
+ <Button
+ android:id="@+id/skip_button"
+ style="@style/SetupWizardButton.Negative"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_alignParentBottom="true"
+ android:layout_marginBottom="8dp"
+ android:text="@string/skip_label"
+ android:visibility="gone" />
+
+ </RelativeLayout>
<FrameLayout
android:layout_width="0dp"
@@ -79,4 +90,4 @@
</LinearLayout>
-</com.android.setupwizardlib.SetupWizardLayout>
+</com.android.setupwizardlib.GlifLayout>
diff --git a/res/layout-land/fingerprint_enroll_find_sensor.xml b/res/layout-land/fingerprint_enroll_find_sensor.xml
index 81d1dac..1d923fa 100644
--- a/res/layout-land/fingerprint_enroll_find_sensor.xml
+++ b/res/layout-land/fingerprint_enroll_find_sensor.xml
@@ -15,7 +15,7 @@
~ limitations under the License
-->
-<com.android.setupwizardlib.SetupWizardLayout
+<com.android.setupwizardlib.GlifLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/setup_wizard_layout"
android:layout_width="match_parent"
@@ -45,13 +45,11 @@
android:text="@string/security_settings_fingerprint_enroll_find_sensor_message"/>
<Button
- style="@style/Button.FingerprintButton"
+ style="@style/SetupWizardButton.Positive"
android:id="@+id/next_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
- android:layout_marginStart="-12dp"
- android:gravity="start|center_vertical"
android:text="@string/fingerprint_enroll_button_next" />
</LinearLayout>
@@ -70,4 +68,4 @@
</LinearLayout>
-</com.android.setupwizardlib.SetupWizardLayout>
+</com.android.setupwizardlib.GlifLayout>
diff --git a/res/layout-land/fingerprint_enroll_finish.xml b/res/layout-land/fingerprint_enroll_finish.xml
index e051f15..664123d 100644
--- a/res/layout-land/fingerprint_enroll_finish.xml
+++ b/res/layout-land/fingerprint_enroll_finish.xml
@@ -15,7 +15,7 @@
~ limitations under the License
-->
-<com.android.setupwizardlib.SetupWizardLayout
+<com.android.setupwizardlib.GlifLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/setup_wizard_layout"
android:layout_width="match_parent"
@@ -50,29 +50,32 @@
style="@style/TextAppearance.FingerprintMessage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginTop="@dimen/suw_description_margin_top"
+ android:layout_marginTop="@dimen/suw_description_glif_margin_top"
android:text="@string/setup_fingerprint_enroll_finish_message_secondary"
android:textColor="?android:attr/textColorSecondary"
android:visibility="gone" />
<LinearLayout
- android:layout_width="wrap_content"
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
- android:layout_marginStart="-12dp"
android:orientation="horizontal">
<Button
- style="@style/Button.FingerprintButton"
+ style="@style/SetupWizardButton.Negative"
android:id="@+id/add_another_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
- android:gravity="start|center_vertical"
android:text="@string/fingerprint_enroll_button_add" />
+ <Space
+ android:layout_width="0dp"
+ android:layout_height="0dp"
+ android:layout_weight="1" />
+
<Button
- style="@style/Button.FingerprintButton"
+ style="@style/SetupWizardButton.Positive"
android:id="@+id/next_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@@ -100,4 +103,4 @@
</LinearLayout>
-</com.android.setupwizardlib.SetupWizardLayout>
+</com.android.setupwizardlib.GlifLayout>
diff --git a/res/layout-land/setup_choose_lock_pattern.xml b/res/layout-land/setup_choose_lock_pattern.xml
deleted file mode 100644
index 6ee8e81..0000000
--- a/res/layout-land/setup_choose_lock_pattern.xml
+++ /dev/null
@@ -1,113 +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.
--->
-
-<com.android.setupwizardlib.SetupWizardLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:settings="http://schemas.android.com/apk/res-auto"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- settings:suwBackgroundTile="@drawable/setup_illustration_tile"
- settings:suwHeaderText="@string/wifi_setup_wizard_title"
- settings:suwIllustrationHorizontalTile="@drawable/setup_illustration_horizontal_tile"
- settings:suwIllustrationImage="@drawable/setup_illustration_lock_screen">
-
- <com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient
- android:id="@+id/topLayout"
- style="@style/SuwContentFrame"
- android:clipChildren="false"
- android:clipToPadding="false"
- android:orientation="horizontal"
- android:layout_width="match_parent"
- android:layout_height="match_parent">
-
- <!-- left side: instructions and messages -->
- <LinearLayout
- android:layout_width="0dip"
- android:layout_height="match_parent"
- android:layout_weight="1.0"
- android:orientation="vertical">
-
- <!-- header message -->
- <TextView android:id="@+id/headerText"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="16dp"
- android:gravity="start|bottom"
- android:textSize="18sp" />
-
- <Button android:id="@+id/retryButton"
- style="@android:style/Widget.Material.Button.Borderless.Colored"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="start"
- android:layout_marginStart="-12dp"
- android:minWidth="0dp"
- android:text="@string/lockpattern_retry_button_text" />
-
- <!-- footer can show a message, or confirm / restart buttons -->
- <RelativeLayout
- android:layout_width="match_parent"
- android:layout_height="0dip"
- android:layout_weight="1.0"
- android:visibility="gone">
-
- <!-- confirm / restart buttons -->
- <LinearLayout android:id="@+id/buttonContainer"
- style="@style/SecurityPreferenceButtonContainer"
- android:layout_centerHorizontal="true"
- android:layout_alignParentBottom="true"
- android:orientation="horizontal">
-
- <!-- left / top button: skip, or re-try -->
- <Button android:id="@+id/footerLeftButton"
- style="@style/SecurityPreferenceButton"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="@string/lockpattern_restart_button_text" />
-
- <!-- right / bottom button: confirm or ok -->
- <Button android:id="@+id/footerRightButton"
- style="@style/SecurityPreferenceButton"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="@string/lockpattern_confirm_button_text" />
-
- </LinearLayout>
-
- <!-- message above buttons -->
- <TextView android:id="@+id/footerText"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_above="@+id/buttonContainer"
- android:layout_centerHorizontal="true"
- android:layout_marginBottom="4dip"
- android:textSize="14sp"
- android:visibility="gone" />
-
- </RelativeLayout>
-
- </LinearLayout>
-
- <!-- right side: lock pattern -->
- <com.android.internal.widget.LockPatternView android:id="@+id/lockPattern"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:background="@color/lock_pattern_background" />
-
- </com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient>
-
-</com.android.setupwizardlib.SetupWizardLayout>
diff --git a/res/layout-land/setup_fingerprint_enroll_find_sensor.xml b/res/layout-land/setup_fingerprint_enroll_find_sensor.xml
index 3873e00..8a81d15 100644
--- a/res/layout-land/setup_fingerprint_enroll_find_sensor.xml
+++ b/res/layout-land/setup_fingerprint_enroll_find_sensor.xml
@@ -15,7 +15,7 @@
~ limitations under the License
-->
-<com.android.setupwizardlib.SetupWizardLayout
+<com.android.setupwizardlib.GlifLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/setup_wizard_layout"
android:layout_width="match_parent"
@@ -45,13 +45,11 @@
android:text="@string/security_settings_fingerprint_enroll_find_sensor_message"/>
<Button
- style="@style/Button.FingerprintButton"
+ style="@style/SetupWizardButton.Positive"
android:id="@+id/next_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
- android:layout_marginStart="-12dp"
- android:gravity="start|center_vertical"
android:text="@string/fingerprint_enroll_button_next" />
</LinearLayout>
@@ -70,4 +68,4 @@
</LinearLayout>
-</com.android.setupwizardlib.SetupWizardLayout>
+</com.android.setupwizardlib.GlifLayout>
diff --git a/res/layout-sw600dp-land/choose_lock_password.xml b/res/layout-sw600dp-land/choose_lock_password.xml
deleted file mode 100644
index 199c9ac..0000000
--- a/res/layout-sw600dp-land/choose_lock_password.xml
+++ /dev/null
@@ -1,90 +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.
-*/
--->
-
-<RelativeLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent">
-
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="20dip"
- android:orientation="horizontal">
-
- <!-- "Enter PIN(Password) to unlock" -->
- <TextView android:id="@+id/headerText"
- android:layout_width="0dip"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:orientation="horizontal"
- android:layout_marginEnd="6dip"
- android:layout_marginStart="6dip"
- android:layout_marginTop="10dip"
- android:layout_marginBottom="10dip"
- android:gravity="start"
- android:ellipsize="marquee"
- android:textAppearance="?android:attr/textAppearanceLarge"
- />
-
- <!-- Password entry field -->
- <EditText android:id="@+id/password_entry"
- android:layout_width="0dip"
- android:layout_height="wrap_content"
- android:layout_marginTop="5dip"
- android:layout_marginBottom="5dip"
- android:layout_gravity="center"
- android:layout_weight="1"
- android:inputType="textPassword"
- android:imeOptions="actionNext"
- android:gravity="center"
- android:textSize="24sp"
- style="@style/TextAppearance.PasswordEntry"
- />
- </LinearLayout>
-
- <!-- confirm / restart buttons -->
- <LinearLayout
- style="@style/SecurityPreferenceButtonContainer"
- android:layout_alignParentEnd="true"
- android:layout_alignParentBottom="true"
- android:orientation="horizontal">
-
- <!-- left / top button: skip, or re-try -->
- <Button android:id="@+id/cancel_button"
- style="@style/SecurityPreferenceButton"
- android:text="@string/lockpassword_cancel_label"/>
-
- <!-- right / bottom button: confirm or ok -->
- <Button android:id="@+id/next_button"
- style="@style/SecurityPreferenceButton"
- android:text="@string/lockpassword_continue_label"/>
-
- </LinearLayout>
- <!-- Alphanumeric keyboard -->
- <com.android.internal.widget.PasswordEntryKeyboardView android:id="@+id/keyboard"
- android:layout_alignParentBottom="true"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:background="#00000000"
- android:keyBackground="@*android:drawable/btn_keyboard_key_fulltrans"
- android:visibility="gone"
- />
-
-</RelativeLayout>
\ No newline at end of file
diff --git a/res/layout-sw600dp-land/choose_lock_pattern.xml b/res/layout-sw600dp-land/choose_lock_pattern.xml
deleted file mode 100644
index e0d9667..0000000
--- a/res/layout-sw600dp-land/choose_lock_pattern.xml
+++ /dev/null
@@ -1,88 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2008 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/topLayout"
- android:orientation="vertical"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:gravity="center_horizontal">
-
- <!-- header message -->
- <ScrollView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:gravity="center"
- android:layout_marginTop="14dip">
-
- <TextView android:id="@+id/headerText"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:gravity="center"
- android:textAppearance="?android:attr/textAppearanceMedium"/>
-
- </ScrollView>
-
- <View
- android:layout_width="match_parent"
- android:layout_height="0dip"
- android:layout_weight="0.6"/>
-
- <!-- lock pattern widget -->
- <com.android.internal.widget.LockPatternView android:id="@+id/lockPattern"
- android:layout_width="354dip"
- android:layout_height="354dip"
- android:background="@color/lock_pattern_background"
- aspect="square"/>
-
- <View
- android:layout_width="match_parent"
- android:layout_height="0dip"
- android:layout_weight="1"/>
-
- <!-- footer message -->
- <TextView android:id="@+id/footerText"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_below="@id/headerText"
- android:layout_marginTop="16dip"
- android:layout_toEndOf="@id/lockPattern"
- android:layout_marginStart="100dip"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:visibility="gone"/>
-
- <!-- confirm / restart buttons -->
- <LinearLayout android:id="@+id/buttonContainer"
- style="@style/SecurityPreferenceButtonContainer"
- android:layout_alignParentEnd="true"
- android:layout_alignParentBottom="true"
- android:orientation="horizontal">
-
- <!-- left / top button: skip, or re-try -->
- <Button android:id="@+id/footerLeftButton"
- style="@style/SecurityPreferenceButton"
- android:text="@string/lockpattern_restart_button_text"/>
-
- <!-- right / bottom button: confirm or ok -->
- <Button android:id="@+id/footerRightButton"
- style="@style/SecurityPreferenceButton"
- android:text="@string/lockpattern_confirm_button_text"/>
-
- </LinearLayout>
-
-</com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient>
-
diff --git a/res/layout-sw600dp/choose_lock_password.xml b/res/layout-sw600dp/choose_lock_password.xml
deleted file mode 100644
index ca8975e..0000000
--- a/res/layout-sw600dp/choose_lock_password.xml
+++ /dev/null
@@ -1,91 +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.
-*/
--->
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:orientation="vertical"
- android:gravity="center_horizontal">
-
- <!-- header text ('Enter Pin') -->
- <TextView android:id="@+id/headerText"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:gravity="center"
- android:lines="2"
- android:textAppearance="?android:attr/textAppearanceLarge"/>
-
- <!-- Password entry field -->
- <EditText android:id="@+id/password_entry"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="15dip"
- android:layout_marginStart="30dip"
- android:layout_marginEnd="30dip"
- android:layout_gravity="center"
- android:inputType="textPassword"
- android:imeOptions="actionNext"
- android:gravity="center"
- android:textSize="32sp"
- style="@style/TextAppearance.PasswordEntry"
- />
-
- <!-- Spacer between password entry and keyboard -->
- <View
- android:layout_width="match_parent"
- android:layout_height="0dip"
- android:layout_weight="1" />
-
- <!-- Alphanumeric keyboard -->
- <com.android.internal.widget.PasswordEntryKeyboardView android:id="@+id/keyboard"
- android:layout_alignParentBottom="true"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:background="#00000000"
- android:layout_marginBottom="30dip"
- android:keyBackground="@*android:drawable/btn_keyboard_key_fulltrans"
- android:visibility="gone"
- />
-
- <View
- android:layout_width="match_parent"
- android:layout_height="0dip"
- />
-
- <RelativeLayout
- android:layout_height="wrap_content"
- android:layout_width="match_parent">
-
- <LinearLayout
- style="@style/SecurityPreferenceButtonContainer"
- android:layout_alignParentEnd="true"
- android:orientation="horizontal">
-
- <Button android:id="@+id/cancel_button"
- style="@style/SecurityPreferenceButton"
- android:text="@string/lockpassword_cancel_label"/>
-
- <Button android:id="@+id/next_button"
- style="@style/SecurityPreferenceButton"
- android:text="@string/lockpassword_continue_label"/>
-
- </LinearLayout>
-
- </RelativeLayout>
-
-</LinearLayout>
diff --git a/res/layout-sw600dp/choose_lock_pattern.xml b/res/layout-sw600dp/choose_lock_pattern.xml
deleted file mode 100644
index 7733184..0000000
--- a/res/layout-sw600dp/choose_lock_pattern.xml
+++ /dev/null
@@ -1,85 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2008 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/topLayout"
- android:orientation="vertical"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:gravity="center_horizontal">
-
- <!-- top: instructions and buttons -->
-
- <!-- header message -->
- <ScrollView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:gravity="center"
- android:layout_marginTop="96dip">
-
- <TextView android:id="@+id/headerText"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:gravity="center"
- android:textAppearance="?android:attr/textAppearanceMedium"/>
-
- </ScrollView>
-
- <!-- footer message -->
- <TextView android:id="@+id/footerText"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginTop="16dip"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:visibility="gone"/>
-
- <!-- bottom: lock pattern -->
- <com.android.internal.widget.LockPatternView android:id="@+id/lockPattern"
- android:layout_width="354dip"
- android:layout_height="354dip"
- android:layout_marginTop="80dip"
- android:background="@color/lock_pattern_background"
- aspect="square"/>
-
- <View
- android:layout_width="match_parent"
- android:layout_height="0dip"
- android:layout_weight="1"/>
-
- <RelativeLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content">
-
- <LinearLayout
- style="@style/SecurityPreferenceButtonContainer"
- android:layout_alignParentEnd="true"
- android:orientation="horizontal">
-
- <!-- left / top button: skip, or re-try -->
- <Button android:id="@+id/footerLeftButton"
- style="@style/SecurityPreferenceButton"
- android:text="@string/lockpattern_restart_button_text"/>
-
- <!-- right / bottom button: confirm or ok -->
- <Button android:id="@+id/footerRightButton"
- style="@style/SecurityPreferenceButton"
- android:text="@string/lockpattern_confirm_button_text"/>
-
- </LinearLayout>
-
- </RelativeLayout>
-
-</com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient>
diff --git a/res/layout/accessibility_settings_for_suw.xml b/res/layout/accessibility_settings_for_suw.xml
deleted file mode 100644
index d566811..0000000
--- a/res/layout/accessibility_settings_for_suw.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright (C) 2016 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="vertical">
-
- <FrameLayout
- android:id="@+id/suw_main_content"
- android:layout_width="match_parent"
- android:layout_height="0dp"
- android:layout_weight="1" />
-
- <com.android.setupwizardlib.view.NavigationBar
- android:id="@+id/suw_navigation_bar"
- style="@style/SuwNavBarTheme"
- android:layout_width="match_parent"
- android:layout_height="@dimen/suw_navbar_height"
- android:accessibilityTraversalAfter="@id/suw_main_content" />
-
-</LinearLayout>
diff --git a/res/layout/app_item.xml b/res/layout/app_item.xml
index ea0008e..15a9014 100644
--- a/res/layout/app_item.xml
+++ b/res/layout/app_item.xml
@@ -60,6 +60,14 @@
android:textColor="?android:attr/textColorSecondary"
android:duplicateParentState="true" />
+ <Switch
+ android:id="@android:id/switch_widget"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_alignParentRight="true"
+ android:background="@null"
+ android:visibility="gone"/>
+
<FrameLayout
android:id="@android:id/widget_frame"
android:layout_width="wrap_content"
diff --git a/res/layout/choose_lock_password.xml b/res/layout/choose_lock_password.xml
index c13d150..99657b4 100644
--- a/res/layout/choose_lock_password.xml
+++ b/res/layout/choose_lock_password.xml
@@ -1,79 +1,97 @@
<?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.
-*/
+ Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License")
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
-->
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:orientation="vertical"
- android:gravity="center_horizontal">
- <!-- header text ('Enter Pin') -->
- <TextView android:id="@+id/headerText"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:gravity="center"
- android:lines="2"
- android:textAppearance="?android:attr/textAppearanceMedium"/>
-
- <!-- Password entry field -->
- <EditText android:id="@+id/password_entry"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_gravity="center"
- android:layout_marginStart="30dip"
- android:layout_marginEnd="30dip"
- android:inputType="textPassword"
- android:imeOptions="actionNext"
- android:gravity="center"
- android:textSize="24sp"
- style="@style/TextAppearance.PasswordEntry"
- />
-
- <!-- Spacer between password entry and keyboard -->
- <View
- android:layout_width="match_parent"
- android:layout_height="0dip"
- android:layout_weight="1" />
+<com.android.setupwizardlib.GlifLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:settings="http://schemas.android.com/apk/res-auto"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:icon="@drawable/ic_lock"
+ settings:suwHeaderText="@string/lockpassword_choose_your_password_header">
<LinearLayout
- style="@style/SecurityPreferenceButtonContainer"
- android:orientation="horizontal">
+ style="@style/SuwContentFrame"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:gravity="center_horizontal"
+ android:orientation="vertical">
- <!-- left : cancel -->
- <Button android:id="@+id/cancel_button"
- style="@style/SecurityPreferenceButton"
- android:text="@string/lockpassword_cancel_label"/>
+ <!-- header text ('Enter Pin') -->
+ <TextView android:id="@+id/headerText"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center"
+ android:lines="2"
+ android:textAppearance="?android:attr/textAppearanceMedium"/>
- <!-- right : continue -->
- <Button android:id="@+id/next_button"
- style="@style/SecurityPreferenceButton"
- android:text="@string/lockpassword_continue_label"/>
+ <!-- Password entry field -->
+ <EditText android:id="@+id/password_entry"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:gravity="center"
+ android:inputType="textPassword"
+ android:imeOptions="actionNext|flagNoExtractUi"
+ android:textSize="24sp"
+ style="@style/TextAppearance.PasswordEntry"/>
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:clipChildren="false"
+ android:clipToPadding="false"
+ android:gravity="end"
+ android:orientation="horizontal">
+
+ <!-- left : cancel -->
+ <Button android:id="@+id/cancel_button"
+ style="@style/SetupWizardButton.Negative"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/lockpassword_cancel_label" />
+
+ <Space
+ android:layout_width="0dp"
+ android:layout_height="0dp"
+ android:layout_weight="1" />
+
+ <!-- right : continue -->
+ <Button android:id="@+id/next_button"
+ style="@style/SetupWizardButton.Positive"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/lockpassword_continue_label" />
+
+ </LinearLayout>
+
+ <!-- Spacer between password entry and keyboard -->
+ <View
+ android:layout_width="match_parent"
+ android:layout_height="0dip"
+ android:layout_weight="1"/>
+
+ <!-- Alphanumeric keyboard -->
+ <com.android.internal.widget.PasswordEntryKeyboardView android:id="@+id/keyboard"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:background="#00000000"
+ android:keyBackground="@*android:drawable/btn_keyboard_key_fulltrans"
+ android:visibility="gone"/>
</LinearLayout>
- <!-- Alphanumeric keyboard -->
- <com.android.internal.widget.PasswordEntryKeyboardView android:id="@+id/keyboard"
- android:layout_alignParentBottom="true"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:background="#00000000"
- android:keyBackground="@*android:drawable/btn_keyboard_key_fulltrans"
- android:visibility="gone"
- />
-
-</LinearLayout>
+</com.android.setupwizardlib.GlifLayout>
diff --git a/res/layout/choose_lock_pattern.xml b/res/layout/choose_lock_pattern.xml
deleted file mode 100644
index 94eecef..0000000
--- a/res/layout/choose_lock_pattern.xml
+++ /dev/null
@@ -1,78 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2008 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/topLayout"
- android:orientation="vertical"
- android:layout_width="wrap_content"
- android:layout_height="match_parent">
-
- <!-- takes up all space above button bar at bottom -->
- <com.android.settings.widget.MatchParentShrinkingLinearLayout
- android:orientation="vertical"
- android:layout_width="match_parent"
- android:layout_height="0dip"
- android:layout_weight="1">
-
- <TextView android:id="@+id/headerText"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:minLines="2"
- android:gravity="center"
- android:textSize="18sp" />
-
- <View
- android:background="@*android:drawable/code_lock_top"
- android:layout_width="match_parent"
- android:layout_height="2dip" />
-
- <com.android.internal.widget.LockPatternView android:id="@+id/lockPattern"
- android:layout_width="match_parent"
- android:layout_height="match_parent" />
-
- <!-- bottom line looks bad when button bar is their too, omit in this case -->
- <!--View
- android:background="@*android:drawable/code_lock_bottom"
- android:layout_width="match_parent"
- android:layout_height="8dip" /-->
-
- <TextView android:id="@+id/footerText"
- android:layout_width="match_parent"
- android:layout_height="0dip"
- android:layout_weight="1"
- android:gravity="center"
- android:textSize="14sp"/>
-
- </com.android.settings.widget.MatchParentShrinkingLinearLayout>
-
- <LinearLayout
- style="@style/SecurityPreferenceButtonContainer"
- android:orientation="horizontal">
-
- <!-- left : cancel, or re-try -->
- <Button android:id="@+id/footerLeftButton"
- style="@style/SecurityPreferenceButton"
- android:text="@string/lockpattern_tutorial_cancel_label"/>
-
- <!-- right : confirm or ok -->
- <Button android:id="@+id/footerRightButton"
- style="@style/SecurityPreferenceButton"
- android:text="@string/lockpattern_tutorial_continue_label"/>
-
- </LinearLayout>
-
-</com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient>
diff --git a/res/layout/choose_lock_pattern_common.xml b/res/layout/choose_lock_pattern_common.xml
new file mode 100644
index 0000000..6557e6a
--- /dev/null
+++ b/res/layout/choose_lock_pattern_common.xml
@@ -0,0 +1,94 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License")
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<!-- Used in phone portrait and tablet, as referenced in alias.xml. -->
+<com.android.setupwizardlib.GlifLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:settings="http://schemas.android.com/apk/res-auto"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:icon="@drawable/ic_lock"
+ settings:suwHeaderText="@string/wifi_setup_wizard_title">
+
+ <com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient
+ android:id="@+id/topLayout"
+ style="@style/SuwContentFrame"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical">
+
+ <!-- takes up all space above button bar at bottom -->
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="0dip"
+ android:layout_weight="1"
+ android:gravity="center"
+ android:orientation="vertical">
+
+ <TextView android:id="@+id/headerText"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:minLines="2"
+ android:gravity="center"
+ android:textSize="18sp" />
+
+ <com.android.internal.widget.LockPatternView android:id="@+id/lockPattern"
+ android:layout_width="match_parent"
+ android:layout_height="0dip"
+ android:layout_weight="4" />
+
+ <!-- Buttons are hidden during setup, and use the buttons in setup navigation bar instead -->
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal">
+
+ <!-- left : cancel, or re-try -->
+ <Button android:id="@+id/footerLeftButton"
+ style="@style/SetupWizardButton.Negative"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/lockpattern_tutorial_cancel_label" />
+
+ <Space
+ android:layout_width="0dp"
+ android:layout_height="0dp"
+ android:layout_weight="1" />
+
+ <!-- right : confirm or ok -->
+ <Button android:id="@+id/footerRightButton"
+ style="@style/SetupWizardButton.Positive"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/lockpattern_tutorial_continue_label" />
+
+ </LinearLayout>
+
+ </LinearLayout>
+
+ <TextView android:id="@+id/footerText"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_horizontal"
+ android:minHeight="50dip"
+ android:textSize="14sp"
+ android:visibility="gone"/>
+
+ </com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient>
+
+</com.android.setupwizardlib.GlifLayout>
diff --git a/res/layout/condition_card.xml b/res/layout/condition_card.xml
index 5c82c7e..c911f03 100644
--- a/res/layout/condition_card.xml
+++ b/res/layout/condition_card.xml
@@ -42,7 +42,7 @@
android:id="@android:id/icon"
android:layout_width="24dp"
android:layout_height="wrap_content"
- android:layout_marginEnd="36dp"
+ android:layout_marginEnd="32dp"
android:tint="?android:attr/textColorPrimaryInverse" />
<TextView
@@ -69,7 +69,7 @@
android:id="@+id/detail_group"
android:layout_width="match_parent"
android:layout_height="0dp"
- android:paddingStart="60dp"
+ android:paddingStart="56dp"
android:visibility="gone"
android:orientation="vertical">
diff --git a/res/layout/dashboard_category.xml b/res/layout/dashboard_category.xml
index 7019a9c..b3500b2 100644
--- a/res/layout/dashboard_category.xml
+++ b/res/layout/dashboard_category.xml
@@ -21,8 +21,7 @@
android:orientation="vertical"
android:paddingBottom="8dip"
android:background="@color/card_background"
- android:importantForAccessibility="noHideDescendants"
- android:elevation="@dimen/dashboard_category_elevation" >
+ android:importantForAccessibility="noHideDescendants">
<TextView android:id="@android:id/title"
android:layout_width="match_parent"
diff --git a/res/values-sw360dp/aliases.xml b/res/layout/dashboard_container.xml
similarity index 74%
rename from res/values-sw360dp/aliases.xml
rename to res/layout/dashboard_container.xml
index a10585b..4cab75c 100644
--- a/res/values-sw360dp/aliases.xml
+++ b/res/layout/dashboard_container.xml
@@ -14,7 +14,8 @@
limitations under the License.
-->
-<resources>
- <item name="setup_choose_lock_pattern_template" type="layout">@layout/suw_template</item>
-</resources>
-
+<android.support.v4.view.ViewPager
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/pager"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"/>
diff --git a/res/values-sw360dp/aliases.xml b/res/layout/dashboard_container_header.xml
similarity index 66%
copy from res/values-sw360dp/aliases.xml
copy to res/layout/dashboard_container_header.xml
index a10585b..a12f249 100644
--- a/res/values-sw360dp/aliases.xml
+++ b/res/layout/dashboard_container_header.xml
@@ -14,7 +14,10 @@
limitations under the License.
-->
-<resources>
- <item name="setup_choose_lock_pattern_template" type="layout">@layout/suw_template</item>
-</resources>
-
+<com.android.settings.widget.SlidingTabLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ android:id="@+id/sliding_tabs"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:background="?android:attr/colorPrimary"/>
diff --git a/res/layout/dashboard_spacer.xml b/res/layout/dashboard_spacer.xml
index 19ef8ff..8d58c80 100644
--- a/res/layout/dashboard_spacer.xml
+++ b/res/layout/dashboard_spacer.xml
@@ -14,6 +14,8 @@
limitations under the License.
-->
-<View xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="6dp" />
+<View
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="8dp"
+ android:background="@color/card_background_grey"/>
diff --git a/res/layout/dashboard_tile.xml b/res/layout/dashboard_tile.xml
index a588ed4..7a0cfbb 100644
--- a/res/layout/dashboard_tile.xml
+++ b/res/layout/dashboard_tile.xml
@@ -23,8 +23,7 @@
android:minHeight="@dimen/dashboard_tile_minimum_height"
android:clickable="true"
android:focusable="true"
- android:background="@drawable/selectable_card"
- android:elevation="@dimen/dashboard_category_elevation" >
+ android:background="@drawable/selectable_card">
<ImageView
android:id="@android:id/icon"
diff --git a/res/layout/dream_info_row.xml b/res/layout/dream_info_row.xml
index 1a4dc8e..fd70ad5 100644
--- a/res/layout/dream_info_row.xml
+++ b/res/layout/dream_info_row.xml
@@ -89,6 +89,6 @@
android:padding="8dip"
android:clickable="true"
android:focusable="true"
- android:src="@drawable/ic_bt_config" />
+ android:src="@drawable/ic_settings" />
</LinearLayout>
diff --git a/res/layout/encryption_interstitial_header.xml b/res/layout/encryption_interstitial_header.xml
index 8d36432..9601fa8 100644
--- a/res/layout/encryption_interstitial_header.xml
+++ b/res/layout/encryption_interstitial_header.xml
@@ -20,8 +20,9 @@
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:minHeight="56dp"
- android:paddingTop="16dp"
+ android:paddingBottom="@dimen/suw_description_glif_margin_bottom_lists"
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
- android:paddingBottom="16dp"
- android:textAppearance="?android:attr/textAppearanceMedium" />
+ android:paddingTop="@dimen/suw_description_glif_margin_top"
+ android:lineSpacingExtra="@dimen/suw_description_line_spacing_extra"
+ android:textAppearance="?android:attr/textAppearanceListItem" />
diff --git a/res/layout/fingerprint_enroll_enrolling_base.xml b/res/layout/fingerprint_enroll_enrolling_base.xml
index c93de4e..e9e3385 100644
--- a/res/layout/fingerprint_enroll_enrolling_base.xml
+++ b/res/layout/fingerprint_enroll_enrolling_base.xml
@@ -15,7 +15,7 @@
~ limitations under the License
-->
-<com.android.setupwizardlib.SetupWizardLayout
+<com.android.setupwizardlib.GlifLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/setup_wizard_layout"
android:layout_width="match_parent"
@@ -35,7 +35,7 @@
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginTop="@dimen/suw_description_margin_top">
+ android:layout_marginTop="@dimen/suw_description_glif_margin_top">
<TextView
style="@style/TextAppearance.FingerprintMessage"
@@ -70,6 +70,14 @@
android:accessibilityLiveRegion="polite"
android:visibility="invisible"/>
+ <Button
+ android:id="@+id/skip_button"
+ style="@style/SetupWizardButton.Negative"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/skip_label"
+ android:visibility="gone" />
+
</LinearLayout>
-</com.android.setupwizardlib.SetupWizardLayout>
+</com.android.setupwizardlib.GlifLayout>
diff --git a/res/layout/fingerprint_enroll_find_sensor_base.xml b/res/layout/fingerprint_enroll_find_sensor_base.xml
index 3f69a0a..d38818b 100644
--- a/res/layout/fingerprint_enroll_find_sensor_base.xml
+++ b/res/layout/fingerprint_enroll_find_sensor_base.xml
@@ -15,7 +15,7 @@
~ limitations under the License
-->
-<com.android.setupwizardlib.SetupWizardLayout
+<com.android.setupwizardlib.GlifLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/setup_wizard_layout"
android:layout_width="match_parent"
@@ -47,7 +47,7 @@
style="@style/TextAppearance.FingerprintMessage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginTop="@dimen/suw_description_margin_top"
+ android:layout_marginTop="@dimen/suw_description_glif_margin_top"
android:text="@string/security_settings_fingerprint_enroll_find_sensor_message"/>
<View
@@ -56,16 +56,14 @@
android:layout_weight="1"/>
<Button
- style="@style/Button.FingerprintButton"
+ style="@style/SetupWizardButton.Positive"
android:id="@+id/next_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
- android:layout_marginEnd="-12dp"
android:layout_gravity="end"
- android:gravity="end|center_vertical"
android:text="@string/fingerprint_enroll_button_next" />
</LinearLayout>
</FrameLayout>
-</com.android.setupwizardlib.SetupWizardLayout>
+</com.android.setupwizardlib.GlifLayout>
diff --git a/res/layout/fingerprint_enroll_finish_base.xml b/res/layout/fingerprint_enroll_finish_base.xml
index 15ee22a..bcbbadf 100644
--- a/res/layout/fingerprint_enroll_finish_base.xml
+++ b/res/layout/fingerprint_enroll_finish_base.xml
@@ -15,7 +15,7 @@
~ limitations under the License
-->
-<com.android.setupwizardlib.SetupWizardLayout
+<com.android.setupwizardlib.GlifLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/setup_wizard_layout"
android:layout_width="match_parent"
@@ -35,7 +35,7 @@
style="@style/TextAppearance.FingerprintMessage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginTop="@dimen/suw_description_margin_top"
+ android:layout_marginTop="@dimen/suw_description_glif_margin_top"
android:text="@string/security_settings_fingerprint_enroll_finish_message"/>
<TextView
@@ -43,7 +43,7 @@
style="@style/TextAppearance.FingerprintMessage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginTop="@dimen/suw_description_margin_top"
+ android:layout_marginTop="@dimen/suw_description_glif_margin_top"
android:text="@string/setup_fingerprint_enroll_finish_message_secondary"
android:textColor="?android:attr/textColorSecondary"
android:visibility="gone" />
@@ -72,30 +72,32 @@
android:layout_weight="1"/>
<LinearLayout
- android:layout_width="wrap_content"
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginEnd="-12dp"
android:layout_marginBottom="4dp"
- android:layout_gravity="end"
android:orientation="horizontal">
<Button
- style="@style/Button.FingerprintButton"
+ style="@style/SetupWizardButton.Negative"
android:id="@+id/add_another_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/fingerprint_enroll_button_add" />
+ <Space
+ android:layout_width="0dp"
+ android:layout_height="0dp"
+ android:layout_weight="1" />
+
<Button
- style="@style/Button.FingerprintButton"
+ style="@style/SetupWizardButton.Positive"
android:id="@+id/next_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:gravity="end|center_vertical"
android:text="@string/security_settings_fingerprint_enroll_done" />
</LinearLayout>
</LinearLayout>
-</com.android.setupwizardlib.SetupWizardLayout>
+</com.android.setupwizardlib.GlifLayout>
diff --git a/res/layout/fingerprint_enroll_introduction.xml b/res/layout/fingerprint_enroll_introduction.xml
index f43bdb6..6d1c699 100644
--- a/res/layout/fingerprint_enroll_introduction.xml
+++ b/res/layout/fingerprint_enroll_introduction.xml
@@ -15,10 +15,10 @@
limitations under the License
-->
-<com.android.setupwizardlib.SetupWizardRecyclerLayout
+<com.android.setupwizardlib.GlifRecyclerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
+ style="?attr/fingerprint_layout_theme"
android:id="@+id/setup_wizard_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:entries="@xml/fingerprint_enroll_introduction_items"
- style="?attr/fingerprint_layout_theme" />
+ android:entries="@xml/fingerprint_enroll_introduction_items" />
diff --git a/res/layout/gesture_preference.xml b/res/layout/gesture_preference.xml
new file mode 100644
index 0000000..5f413fe
--- /dev/null
+++ b/res/layout/gesture_preference.xml
@@ -0,0 +1,103 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2016 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<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:background="?android:attr/activatedBackgroundIndicator"
+ android:clipToPadding="false"
+ android:orientation="vertical">
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ android:paddingTop="16dp"
+ android:paddingBottom="16dp"
+ android:paddingStart="?android:attr/listPreferredItemPaddingStart"
+ android:paddingEnd="?android:attr/listPreferredItemPaddingEnd">
+
+ <TextView
+ android:id="@android:id/title"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:singleLine="true"
+ android:textAppearance="?android:attr/textAppearanceListItem"
+ android:ellipsize="marquee"/>
+
+ <Switch
+ android:id="@android:id/switch_widget"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:gravity="end|center_vertical"/>
+
+ </LinearLayout>
+
+ <LinearLayout
+ android:id="@+id/gesture_detail"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:background="@color/gestures_setting_backgroud_color"
+ android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
+ android:orientation="horizontal">
+
+ <FrameLayout
+ android:id="@+id/gesture_animation_frame"
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_weight="1">
+
+ <TextureView
+ android:id="@+id/gesture_video"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_gravity="center"/>
+
+ <ImageView
+ android:id="@+id/gesture_image"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:visibility="gone"/>
+
+ <ImageView
+ android:id="@+id/gesture_play_button"
+ android:layout_width="@dimen/gestures_play_button_size"
+ android:layout_height="@dimen/gestures_play_button_size"
+ android:src="@drawable/ic_gesture_play_button"
+ android:gravity="center"
+ android:layout_gravity="center"
+ android:visibility="gone"/>
+
+ </FrameLayout>
+
+ <TextView
+ android:id="@android:id/summary"
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_weight="1"
+ android:paddingTop="@dimen/gestures_settings_padding_top_bottom"
+ android:paddingStart="?android:attr/listPreferredItemPaddingStart"
+ android:textAppearance="?android:attr/textAppearanceListItemSecondary"
+ android:textColor="?android:attr/textColorSecondary"
+ android:maxLines="10"
+ android:ellipsize="end"/>
+
+ </LinearLayout>
+
+</LinearLayout>
diff --git a/res/layout/preference_app_restrictions.xml b/res/layout/preference_app_restrictions.xml
index fe575a2..d571b5f 100644
--- a/res/layout/preference_app_restrictions.xml
+++ b/res/layout/preference_app_restrictions.xml
@@ -83,7 +83,7 @@
android:layout_height="fill_parent"
android:paddingStart="12dip"
android:paddingEnd="12dp"
- android:src="@drawable/ic_sysbar_quicksettings"
+ android:src="@drawable/ic_settings"
android:contentDescription="@string/apps_with_restrictions_settings_button"
android:layout_gravity="center"
android:clickable="true"
diff --git a/res/layout/preference_bluetooth.xml b/res/layout/preference_bluetooth.xml
index 17ee70c..c339e67 100644
--- a/res/layout/preference_bluetooth.xml
+++ b/res/layout/preference_bluetooth.xml
@@ -27,7 +27,7 @@
android:layout_gravity="center_vertical"
android:padding="8dip"
android:background="?android:attr/selectableItemBackground"
- android:src="@drawable/ic_bt_config"
+ android:src="@drawable/ic_settings"
android:contentDescription="@string/bluetooth_device_details" />
</LinearLayout>
diff --git a/res/layout/preference_importance_slider.xml b/res/layout/preference_importance_slider.xml
index ddbcd30..3861807 100644
--- a/res/layout/preference_importance_slider.xml
+++ b/res/layout/preference_importance_slider.xml
@@ -58,8 +58,8 @@
android:focusable="true"
android:background="#00ffffff"
android:progressBackgroundTint="@color/importance_secondary_slider_color"
- android:thumbTint="@color/importance_slider_color"
- android:progressTint="@color/importance_slider_color"
+ android:thumbTint="?android:attr/colorAccent"
+ android:progressTint="?android:attr/colorAccent"
style="@android:style/Widget.Material.SeekBar.Discrete"
android:tickMarkTint="@android:color/black" />
diff --git a/res/layout/preference_list_fragment.xml b/res/layout/preference_list_fragment.xml
index 9f1e076..6e540c4 100644
--- a/res/layout/preference_list_fragment.xml
+++ b/res/layout/preference_list_fragment.xml
@@ -83,6 +83,7 @@
android:visibility="gone">
<Button android:id="@+id/back_button"
+ style="?android:attr/buttonBarButtonStyle"
android:layout_width="150dip"
android:layout_height="wrap_content"
android:layout_margin="5dip"
@@ -97,7 +98,8 @@
android:layout_alignParentEnd="true">
<Button android:id="@+id/skip_button"
- android:layout_width="150dip"
+ style="?android:attr/buttonBarButtonStyle"
+ android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dip"
android:text="@*android:string/skip_button_label"
@@ -105,7 +107,8 @@
/>
<Button android:id="@+id/next_button"
- android:layout_width="150dip"
+ style="?android:attr/buttonBarButtonStyle"
+ android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dip"
android:text="@*android:string/next_button_label"
diff --git a/res/layout/preference_tts_engine.xml b/res/layout/preference_tts_engine.xml
index fe8e967..277fc23 100644
--- a/res/layout/preference_tts_engine.xml
+++ b/res/layout/preference_tts_engine.xml
@@ -41,7 +41,7 @@
android:layout_height="match_parent"
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
- android:src="@drawable/ic_sysbar_quicksettings"
+ android:src="@drawable/ic_settings"
android:contentDescription="@string/tts_engine_settings_button"
android:layout_centerVertical="true"
android:clickable="true"
diff --git a/res/layout/preference_widget_settings.xml b/res/layout/preference_widget_settings.xml
index 6d9ac2fe..dfeca1a 100644
--- a/res/layout/preference_widget_settings.xml
+++ b/res/layout/preference_widget_settings.xml
@@ -27,7 +27,7 @@
android:layout_gravity="center_vertical"
android:padding="8dip"
android:background="?android:attr/selectableItemBackground"
- android:src="@drawable/ic_sysbar_quicksettings"
+ android:src="@drawable/ic_settings"
android:contentDescription="@string/settings_button" />
</LinearLayout>
diff --git a/res/layout/redaction_interstitial.xml b/res/layout/redaction_interstitial.xml
index ec0c249..1aa8af4 100644
--- a/res/layout/redaction_interstitial.xml
+++ b/res/layout/redaction_interstitial.xml
@@ -1,68 +1,79 @@
<?xml version="1.0" encoding="utf-8"?>
-
<!--
- ~ Copyright (C) 2014 The Android Open Source Project
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License
- -->
+ Copyright (C) 2015 The Android Open Source Project
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
+ 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
+-->
+
+<com.android.setupwizardlib.GlifLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:settings="http://schemas.android.com/apk/res-auto"
+ android:id="@+id/setup_wizard_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:paddingStart="?attr/side_margin"
- android:paddingEnd="?attr/side_margin">
+ android:icon="@drawable/ic_lock"
+ settings:suwHeaderText="@string/lock_screen_notifications_interstitial_title">
- <TextView
- android:id="@+id/message"
+ <LinearLayout
+ style="@style/SuwContentFrame"
android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="@dimen/redaction_vertical_margins"
- android:layout_marginStart="?android:attr/listPreferredItemPaddingStart"
- android:layout_marginEnd="?android:attr/listPreferredItemPaddingEnd"
- android:text="@string/lock_screen_notifications_interstitial_message"
- android:textAppearance="?android:attr/textAppearanceMedium" />
+ android:layout_height="match_parent"
+ android:orientation="vertical">
- <RadioGroup
- android:id="@+id/radio_group"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginTop="@dimen/redaction_vertical_margins"
- android:layout_marginStart="?android:attr/listPreferredItemPaddingStart"
- android:layout_marginEnd="?android:attr/listPreferredItemPaddingEnd"
- android:checkedButton="@+id/redact_sensitive">
-
- <com.android.settings.RestrictedRadioButton
- android:id="@+id/show_all"
+ <TextView
+ style="@style/SuwDescription.Glif"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- style="@style/RedactionItemAndLabel"
- android:text="@string/lock_screen_notifications_summary_show" />
+ android:text="@string/lock_screen_notifications_interstitial_message" />
- <com.android.settings.RestrictedRadioButton
- android:id="@+id/redact_sensitive"
+ <RadioGroup
+ android:id="@+id/radio_group"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- style="@style/RedactionItemAndLabel"
- android:text="@string/lock_screen_notifications_summary_hide" />
+ android:layout_marginTop="@dimen/redaction_vertical_margins"
+ android:checkedButton="@+id/redact_sensitive">
- <RadioButton
- android:id="@+id/hide_all"
- android:layout_width="match_parent"
+ <com.android.settings.RestrictedRadioButton
+ android:id="@+id/show_all"
+ style="@style/SuwRadioButton"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/lock_screen_notifications_summary_show" />
+
+ <com.android.settings.RestrictedRadioButton
+ android:id="@+id/redact_sensitive"
+ style="@style/SuwRadioButton"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/lock_screen_notifications_summary_hide" />
+
+ <RadioButton
+ android:id="@+id/hide_all"
+ style="@style/SuwRadioButton"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/lock_screen_notifications_summary_disable" />
+
+ </RadioGroup>
+
+ <Button
+ android:id="@+id/redaction_done_button"
+ style="@style/SetupWizardButton.Positive"
+ android:layout_width="wrap_content"
android:layout_height="wrap_content"
- style="@style/RedactionItemAndLabel"
- android:text="@string/lock_screen_notifications_summary_disable" />
+ android:layout_gravity="end"
+ android:text="@string/app_notifications_dialog_done" />
- </RadioGroup>
+ </LinearLayout>
-</LinearLayout>
\ No newline at end of file
+</com.android.setupwizardlib.GlifLayout>
diff --git a/res/layout/restricted_preference_user_delete_widget.xml b/res/layout/restricted_preference_user_delete_widget.xml
index 7ffb0e4..7fd5d88 100644
--- a/res/layout/restricted_preference_user_delete_widget.xml
+++ b/res/layout/restricted_preference_user_delete_widget.xml
@@ -35,7 +35,7 @@
android:layout_height="fill_parent"
android:paddingStart="16dip"
android:paddingEnd="16dip"
- android:src="@drawable/ic_sysbar_quicksettings"
+ android:src="@drawable/ic_settings"
android:contentDescription="@string/settings_label"
android:layout_gravity="center"
android:background="?android:attr/selectableItemBackground" />
diff --git a/res/layout/running_processes_header.xml b/res/layout/running_processes_header.xml
index 38ff614..615d30e 100644
--- a/res/layout/running_processes_header.xml
+++ b/res/layout/running_processes_header.xml
@@ -97,7 +97,7 @@
android:layout_height="16sp"
android:layout_gravity="center"
android:scaleType="centerInside"
- android:src="@color/running_processes_apps_ram"
+ android:src="?android:attr/colorAccent"
android:contentDescription="@null" />
<LinearLayout
android:layout_width="match_parent"
diff --git a/res/layout/setup_choose_lock_generic_fingerprint_header.xml b/res/layout/setup_choose_lock_generic_fingerprint_header.xml
index d16aec4..b19bec1 100644
--- a/res/layout/setup_choose_lock_generic_fingerprint_header.xml
+++ b/res/layout/setup_choose_lock_generic_fingerprint_header.xml
@@ -20,10 +20,10 @@
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:minHeight="56dp"
- android:paddingBottom="@dimen/suw_description_margin_bottom_lists"
+ android:paddingBottom="@dimen/suw_description_glif_margin_bottom_lists"
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
- android:paddingTop="@dimen/suw_description_margin_top"
+ android:paddingTop="@dimen/suw_description_glif_margin_top"
android:text="@string/setup_lock_settings_picker_fingerprint_message"
android:lineSpacingExtra="@dimen/suw_description_line_spacing_extra"
android:textAppearance="?android:attr/textAppearanceListItem" />
diff --git a/res/layout/setup_choose_lock_generic_header.xml b/res/layout/setup_choose_lock_generic_header.xml
index 78cd618..9a3547d 100644
--- a/res/layout/setup_choose_lock_generic_header.xml
+++ b/res/layout/setup_choose_lock_generic_header.xml
@@ -20,10 +20,10 @@
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:minHeight="56dp"
- android:paddingBottom="@dimen/suw_description_margin_bottom_lists"
+ android:paddingBottom="@dimen/suw_description_glif_margin_bottom_lists"
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
- android:paddingTop="@dimen/suw_description_margin_top"
+ android:paddingTop="@dimen/suw_description_glif_margin_top"
android:text="@string/setup_lock_settings_picker_message"
android:lineSpacingExtra="@dimen/suw_description_line_spacing_extra"
android:textAppearance="?android:attr/textAppearanceListItem" />
diff --git a/res/layout/setup_choose_lock_password.xml b/res/layout/setup_choose_lock_password.xml
deleted file mode 100644
index 164233c..0000000
--- a/res/layout/setup_choose_lock_password.xml
+++ /dev/null
@@ -1,97 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright (C) 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License")
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<com.android.setupwizardlib.SetupWizardLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:settings="http://schemas.android.com/apk/res-auto"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- settings:suwBackgroundTile="@drawable/setup_illustration_tile"
- settings:suwHeaderText="@string/wifi_setup_wizard_title"
- settings:suwIllustrationHorizontalTile="@drawable/setup_illustration_horizontal_tile"
- settings:suwIllustrationImage="@drawable/setup_illustration_lock_screen">
-
- <LinearLayout
- style="@style/SuwContentFrame"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:gravity="center_horizontal"
- android:orientation="vertical">
-
- <!-- header text ('Enter Pin') -->
- <TextView android:id="@+id/headerText"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:gravity="center"
- android:lines="2"
- android:textAppearance="?android:attr/textAppearanceMedium"/>
-
- <!-- Password entry field -->
- <EditText android:id="@+id/password_entry"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_gravity="center"
- android:layout_marginStart="30dip"
- android:layout_marginEnd="30dip"
- android:gravity="center"
- android:inputType="textPassword"
- android:imeOptions="actionNext|flagNoExtractUi"
- android:textSize="24sp"
- style="@style/TextAppearance.PasswordEntry"/>
-
- <!-- Spacer between password entry and keyboard -->
- <View
- android:layout_width="match_parent"
- android:layout_height="0dip"
- android:layout_weight="1"/>
-
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- android:visibility="gone"
- style="@style/SecurityPreferenceButtonContainer">
-
- <!-- left : cancel -->
- <Button android:id="@+id/cancel_button"
- android:layout_width="0dip"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:text="@string/lockpassword_cancel_label"
- style="@style/SecurityPreferenceButton"/>
-
- <!-- right : continue -->
- <Button android:id="@+id/next_button"
- android:layout_width="0dip"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:text="@string/lockpassword_continue_label"
- style="@style/SecurityPreferenceButton"/>
-
- </LinearLayout>
-
- <!-- Alphanumeric keyboard -->
- <com.android.internal.widget.PasswordEntryKeyboardView android:id="@+id/keyboard"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:background="#00000000"
- android:keyBackground="@*android:drawable/btn_keyboard_key_fulltrans"
- android:visibility="gone"/>
-
- </LinearLayout>
-
-</com.android.setupwizardlib.SetupWizardLayout>
diff --git a/res/layout/setup_choose_lock_pattern_common.xml b/res/layout/setup_choose_lock_pattern_common.xml
deleted file mode 100644
index 0a38637..0000000
--- a/res/layout/setup_choose_lock_pattern_common.xml
+++ /dev/null
@@ -1,103 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright (C) 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License")
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<!-- Used in phone portrait and tablet, as referenced in alias.xml. -->
-<com.android.setupwizardlib.SetupWizardLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:settings="http://schemas.android.com/apk/res-auto"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout="@layout/setup_choose_lock_pattern_template"
- settings:suwBackgroundTile="@drawable/setup_illustration_tile"
- settings:suwHeaderText="@string/wifi_setup_wizard_title"
- settings:suwIllustrationHorizontalTile="@drawable/setup_illustration_horizontal_tile"
- settings:suwIllustrationImage="@drawable/setup_illustration_lock_screen">
-
- <com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient
- android:id="@+id/topLayout"
- style="@style/SuwContentFrame"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="vertical">
-
- <!-- takes up all space above button bar at bottom -->
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="0dip"
- android:layout_weight="1"
- android:gravity="center"
- android:orientation="vertical">
-
- <TextView android:id="@+id/headerText"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:minLines="2"
- android:gravity="center"
- android:textSize="18sp" />
-
- <Button android:id="@+id/retryButton"
- style="@android:style/Widget.Material.Button.Borderless.Colored"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center_horizontal"
- android:text="@string/lockpattern_retry_button_text"/>
-
- <com.android.internal.widget.LockPatternView android:id="@+id/lockPattern"
- android:layout_width="match_parent"
- android:layout_height="0dip"
- android:layout_weight="4" />
-
- </LinearLayout>
-
- <TextView android:id="@+id/footerText"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center_horizontal"
- android:minHeight="50dip"
- android:textSize="14sp"
- android:visibility="gone"/>
-
- <!-- Buttons are hidden during setup, and use the buttons in setup navigation bar instead -->
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- android:visibility="gone"
- style="@style/SecurityPreferenceButtonContainer">
-
- <!-- left : cancel, or re-try -->
- <Button android:id="@+id/footerLeftButton"
- android:layout_width="0dip"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:text="@string/lockpattern_tutorial_cancel_label"
- style="@style/SecurityPreferenceButton"/>
-
- <!-- right : confirm or ok -->
- <Button android:id="@+id/footerRightButton"
- android:layout_width="0dip"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:text="@string/lockpattern_tutorial_continue_label"
- style="@style/SecurityPreferenceButton"/>
-
- </LinearLayout>
-
- </com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient>
-
-</com.android.setupwizardlib.SetupWizardLayout>
diff --git a/res/layout/setup_encryption_interstitial_header.xml b/res/layout/setup_encryption_interstitial_header.xml
index a6e7c30..9601fa8 100644
--- a/res/layout/setup_encryption_interstitial_header.xml
+++ b/res/layout/setup_encryption_interstitial_header.xml
@@ -20,9 +20,9 @@
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:minHeight="56dp"
- android:paddingBottom="@dimen/suw_description_margin_bottom_lists"
+ android:paddingBottom="@dimen/suw_description_glif_margin_bottom_lists"
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
- android:paddingTop="@dimen/suw_description_margin_top"
+ android:paddingTop="@dimen/suw_description_glif_margin_top"
android:lineSpacingExtra="@dimen/suw_description_line_spacing_extra"
android:textAppearance="?android:attr/textAppearanceListItem" />
diff --git a/res/layout/setup_fingerprint_enroll_find_sensor_base.xml b/res/layout/setup_fingerprint_enroll_find_sensor_base.xml
index 184d6b9..2455896 100644
--- a/res/layout/setup_fingerprint_enroll_find_sensor_base.xml
+++ b/res/layout/setup_fingerprint_enroll_find_sensor_base.xml
@@ -15,7 +15,7 @@
limitations under the License
-->
-<com.android.setupwizardlib.SetupWizardLayout
+<com.android.setupwizardlib.GlifLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/setup_wizard_layout"
android:layout_width="match_parent"
@@ -47,7 +47,7 @@
style="@style/TextAppearance.FingerprintMessage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginTop="@dimen/suw_description_margin_top"
+ android:layout_marginTop="@dimen/suw_description_glif_margin_top"
android:text="@string/security_settings_fingerprint_enroll_find_sensor_message"/>
<View
@@ -56,16 +56,14 @@
android:layout_weight="1"/>
<Button
- style="@style/Button.FingerprintButton"
+ style="@style/SetupWizardButton.Positive"
android:id="@+id/next_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
- android:layout_marginEnd="-12dp"
android:layout_gravity="end"
- android:gravity="end|center_vertical"
android:text="@string/fingerprint_enroll_button_next" />
</LinearLayout>
</FrameLayout>
-</com.android.setupwizardlib.SetupWizardLayout>
+</com.android.setupwizardlib.GlifLayout>
diff --git a/res/layout/setup_preference.xml b/res/layout/setup_preference.xml
index f5496f4..298bc9a 100644
--- a/res/layout/setup_preference.xml
+++ b/res/layout/setup_preference.xml
@@ -15,11 +15,8 @@
limitations under the License.
-->
-<com.android.setupwizardlib.SetupWizardPreferenceLayout
+<com.android.setupwizardlib.GlifPreferenceLayout
xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:settings="http://schemas.android.com/apk/res-auto"
android:id="@android:id/list_container"
android:layout_width="match_parent"
- android:layout_height="match_parent"
- settings:suwBackgroundTile="@drawable/setup_illustration_tile"
- settings:suwIllustrationHorizontalTile="@drawable/setup_illustration_horizontal_tile" />
+ android:layout_height="match_parent" />
diff --git a/res/layout/setup_redaction_interstitial.xml b/res/layout/setup_redaction_interstitial.xml
deleted file mode 100644
index e99756a..0000000
--- a/res/layout/setup_redaction_interstitial.xml
+++ /dev/null
@@ -1,78 +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
--->
-
-<com.android.setupwizardlib.SetupWizardLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:settings="http://schemas.android.com/apk/res-auto"
- android:id="@+id/setup_wizard_layout"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- settings:suwBackgroundTile="@drawable/setup_illustration_tile"
- settings:suwHeaderText="@string/lock_screen_notifications_interstitial_title"
- settings:suwIllustrationHorizontalTile="@drawable/setup_illustration_horizontal_tile"
- settings:suwIllustrationImage="@drawable/setup_illustration_lock_screen">
-
- <LinearLayout
- style="@style/SuwContentFrame"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="vertical"
- android:paddingStart="?attr/side_margin"
- android:paddingEnd="?attr/side_margin">
-
- <TextView
- style="@style/SuwDescription"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginStart="?android:attr/listPreferredItemPaddingStart"
- android:layout_marginEnd="?android:attr/listPreferredItemPaddingEnd"
- android:text="@string/lock_screen_notifications_interstitial_message" />
-
- <RadioGroup
- android:id="@+id/radio_group"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="@dimen/redaction_vertical_margins"
- android:layout_marginStart="?android:attr/listPreferredItemPaddingStart"
- android:layout_marginEnd="?android:attr/listPreferredItemPaddingEnd"
- android:checkedButton="@+id/redact_sensitive">
-
- <com.android.settings.RestrictedRadioButton
- android:id="@+id/show_all"
- style="@style/SuwRadioButton"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/lock_screen_notifications_summary_show" />
-
- <com.android.settings.RestrictedRadioButton
- android:id="@+id/redact_sensitive"
- style="@style/SuwRadioButton"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/lock_screen_notifications_summary_hide" />
-
- <RadioButton
- android:id="@+id/hide_all"
- style="@style/SuwRadioButton"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/lock_screen_notifications_summary_disable" />
- </RadioGroup>
-
- </LinearLayout>
-
-</com.android.setupwizardlib.SetupWizardLayout>
diff --git a/res/values-sw360dp/aliases.xml b/res/layout/sliding_tab_indicator_view.xml
similarity index 64%
copy from res/values-sw360dp/aliases.xml
copy to res/layout/sliding_tab_indicator_view.xml
index a10585b..b594c8b 100644
--- a/res/values-sw360dp/aliases.xml
+++ b/res/layout/sliding_tab_indicator_view.xml
@@ -14,7 +14,10 @@
limitations under the License.
-->
-<resources>
- <item name="setup_choose_lock_pattern_template" type="layout">@layout/suw_template</item>
-</resources>
-
+<View
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/sliding_tab_selected_indicator"
+ android:layout_width="wrap_content"
+ android:layout_height="@dimen/pager_tabs_selected_indicator_height"
+ android:background="?android:attr/colorAccent"
+ android:theme="@*android:style/ThemeOverlay.DeviceDefault.Accent" />
diff --git a/res/layout/sliding_tab_title_view.xml b/res/layout/sliding_tab_title_view.xml
new file mode 100644
index 0000000..5df8378
--- /dev/null
+++ b/res/layout/sliding_tab_title_view.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2016 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.
+-->
+
+<TextView
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="0dp"
+ android:layout_weight="1"
+ android:layout_height="wrap_content"
+ android:background="?android:attr/selectableItemBackground"
+ android:ellipsize="end"
+ android:fontFamily="sans-serif-medium"
+ android:gravity="center"
+ android:maxLines="1"
+ android:padding="@dimen/pager_tabs_title_padding"
+ android:textColor="@color/sliding_tab_title_text_color"
+ android:textAllCaps="true"/>
diff --git a/res/layout/suggestion_header.xml b/res/layout/suggestion_header.xml
index c48553e..69ebedc 100644
--- a/res/layout/suggestion_header.xml
+++ b/res/layout/suggestion_header.xml
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2016 The Android Open Source Project
+<!--
+ Copyright (C) 2016 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -20,27 +21,32 @@
android:layout_height="@dimen/dashboard_category_height"
android:clickable="true"
android:focusable="true"
- android:background="@drawable/selectable_card"
- android:elevation="@dimen/dashboard_category_elevation"
- android:gravity="center_vertical" >
-
- <TextView android:id="@android:id/title"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:paddingStart="16dp"
- android:singleLine="true"
- android:textAppearance="@style/TextAppearance.TileTitle"
- android:textColor="?android:attr/colorAccent"
- android:alpha=".87"
- android:ellipsize="marquee"
- android:fadingEdge="horizontal" />
-
- <ImageView android:id="@android:id/icon"
+ android:background="@drawable/selectable_card_grey"
+ android:gravity="center_vertical"
+ android:paddingTop="4dp">
+ <ImageView
+ android:id="@android:id/icon"
android:layout_width="@dimen/dashboard_tile_image_size"
android:layout_height="@dimen/dashboard_tile_image_size"
- android:layout_marginStart="@dimen/suggestion_arrow_margin"
- android:layout_marginEnd="@dimen/suggestion_arrow_margin"
- android:src="@drawable/ic_expand_more" />
-
+ android:layout_marginStart="@dimen/dashboard_tile_image_margin_start"
+ android:layout_marginEnd="@dimen/dashboard_tile_image_margin_end"
+ android:src="@drawable/ic_expand_more"/>
+ <TextView
+ android:id="@android:id/title"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:singleLine="true"
+ android:textAppearance="@style/TextAppearance.SuggestionTitle"
+ android:textColor="?android:attr/colorAccent"
+ android:ellipsize="marquee"
+ android:fadingEdge="horizontal"/>
+ <TextView
+ android:id="@android:id/summary"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:gravity="end"
+ android:paddingEnd="20dp"
+ android:textAppearance="@style/TextAppearance.SuggestionTitle"
+ android:textColor="?android:attr/colorAccent"/>
</LinearLayout>
diff --git a/res/layout/suggestion_tile.xml b/res/layout/suggestion_tile.xml
index 10c9558..80de8ff 100644
--- a/res/layout/suggestion_tile.xml
+++ b/res/layout/suggestion_tile.xml
@@ -18,70 +18,48 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
+ android:background="@drawable/selectable_card_grey"
android:clickable="true"
android:focusable="true"
- android:background="@drawable/selectable_card"
- android:elevation="@dimen/dashboard_category_elevation"
- android:orientation="vertical" >
+ android:gravity="center_vertical"
+ android:minHeight="@dimen/dashboard_tile_minimum_height">
- <View
- android:layout_width="match_parent"
- android:layout_height="1dp"
- android:background="?android:attr/listDivider" />
+ <ImageView
+ android:id="@android:id/icon"
+ android:layout_width="@dimen/dashboard_tile_image_size"
+ android:layout_height="@dimen/dashboard_tile_image_size"
+ android:layout_marginStart="@dimen/dashboard_tile_image_margin_start"
+ android:layout_marginEnd="@dimen/dashboard_tile_image_margin_end"
+ android:scaleType="centerInside"/>
- <LinearLayout
- android:layout_width="match_parent"
+ <RelativeLayout
+ android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:gravity="center_vertical"
- android:minHeight="@dimen/dashboard_tile_minimum_height">
+ android:layout_weight="1">
- <ImageView
- android:id="@android:id/icon"
- android:layout_width="@dimen/dashboard_tile_image_size"
- android:layout_height="@dimen/dashboard_tile_image_size"
- android:scaleType="centerInside"
- android:layout_marginStart="@dimen/dashboard_tile_image_margin_start"
- android:layout_marginEnd="@dimen/dashboard_tile_image_margin_end" />
+ <TextView android:id="@android:id/title"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:singleLine="true"
+ android:textAppearance="@style/TextAppearance.TileTitle"
+ android:ellipsize="marquee"
+ android:fadingEdge="horizontal"/>
- <RelativeLayout
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_weight="1">
+ <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="@style/TextAppearance.Small"
+ android:textColor="?android:attr/textColorSecondary"/>
- <TextView android:id="@android:id/title"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:singleLine="true"
- android:textAppearance="@style/TextAppearance.TileTitle"
- android:ellipsize="marquee"
- android:fadingEdge="horizontal" />
+ </RelativeLayout>
- <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="@style/TextAppearance.Small"
- android:textColor="?android:attr/textColorSecondary" />
+ <ImageView
+ android:id="@+id/overflow"
+ style="?android:attr/actionOverflowButtonStyle"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:padding="16dp"/>
- </RelativeLayout>
-
- <FrameLayout
- android:layout_width="wrap_content"
- android:layout_height="match_parent">
-
- <ImageView android:id="@+id/overflow"
- android:layout_width="44dp"
- android:layout_height="44dp"
- android:paddingStart="16dp"
- android:paddingBottom="16dp"
- android:paddingTop="12dp"
- android:paddingEnd="12dp"
- android:gravity="top"
- style="?android:attr/actionOverflowButtonStyle" />
-
- </FrameLayout>
-
- </LinearLayout>
-
-</LinearLayout>
+</LinearLayout>
\ No newline at end of file
diff --git a/res/layout/support_disclaimer_content.xml b/res/layout/support_disclaimer_content.xml
new file mode 100644
index 0000000..4fed865
--- /dev/null
+++ b/res/layout/support_disclaimer_content.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2016 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:padding="24dp">
+
+ <TextView
+ android:id="@+id/support_disclaimer_text"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingBottom="24dp"
+ android:text="@string/support_disclaimer_content"/>
+
+ <CheckBox
+ android:id="@+id/support_disclaimer_do_not_show_again"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/support_disclaimer_do_not_show"
+ android:textColor="?android:attr/textColorSecondary"/>
+
+</LinearLayout>
diff --git a/res/layout/support_escalation_options.xml b/res/layout/support_escalation_options.xml
new file mode 100644
index 0000000..6b88908
--- /dev/null
+++ b/res/layout/support_escalation_options.xml
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2016 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:background="@color/card_background_grey"
+ android:gravity="center_horizontal"
+ android:paddingBottom="40dp">
+ <LinearLayout
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="8dp"
+ android:layout_marginEnd="8dp"
+ android:gravity="center_horizontal"
+ android:orientation="vertical">
+ <Button
+ android:id="@android:id/text1"
+ style="@style/SupportPrimaryButton"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_margin="8dp"/>
+ <TextView
+ android:id="@+id/summary1"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="14dp"
+ android:textAppearance="@style/TextAppearance.Small"
+ android:textColor="?android:attr/textColorSecondary"/>
+ </LinearLayout>
+ <LinearLayout
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="8dp"
+ android:layout_marginEnd="8dp"
+ android:gravity="center_horizontal"
+ android:orientation="vertical">
+ <Button
+ android:id="@android:id/text2"
+ style="@style/SupportPrimaryButton"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_margin="8dp"/>
+ <TextView
+ android:id="@+id/summary2"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="14dp"
+ android:textAppearance="@style/TextAppearance.Small"
+ android:textColor="?android:attr/textColorSecondary"/>
+ </LinearLayout>
+</LinearLayout>
diff --git a/res/values-sw360dp/aliases.xml b/res/layout/support_fragment.xml
similarity index 68%
copy from res/values-sw360dp/aliases.xml
copy to res/layout/support_fragment.xml
index a10585b..481a548 100644
--- a/res/values-sw360dp/aliases.xml
+++ b/res/layout/support_fragment.xml
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2016 The Android Open Source Project
+<!--
+ Copyright (C) 2016 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -14,7 +15,8 @@
limitations under the License.
-->
-<resources>
- <item name="setup_choose_lock_pattern_template" type="layout">@layout/suw_template</item>
-</resources>
-
+<android.support.v7.widget.RecyclerView
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/support_items"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"/>
\ No newline at end of file
diff --git a/res/layout/support_item_title.xml b/res/layout/support_item_title.xml
new file mode 100644
index 0000000..0110da0
--- /dev/null
+++ b/res/layout/support_item_title.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2016 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:background="@color/card_background_grey"
+ android:paddingTop="40dp"
+ android:paddingBottom="42dp"
+ android:paddingStart="56dp"
+ android:paddingEnd="56dp"
+ android:orientation="vertical">
+ <TextView
+ android:id="@android:id/text1"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center_horizontal"
+ android:textAppearance="@style/TextAppearance.SupportTitle"/>
+ <TextView
+ android:id="@android:id/text2"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center_horizontal"
+ android:paddingTop="8dp"
+ android:textAppearance="@style/TextAppearance.Small"
+ android:textColor="?android:attr/textColorSecondary"/>
+</LinearLayout>
\ No newline at end of file
diff --git a/res/layout/support_sign_in_button.xml b/res/layout/support_sign_in_button.xml
new file mode 100644
index 0000000..fb789e8
--- /dev/null
+++ b/res/layout/support_sign_in_button.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2016 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:background="@color/card_background_grey"
+ android:gravity="center_horizontal"
+ android:orientation="vertical">
+ <Button
+ android:id="@android:id/text1"
+ style="@style/SupportPrimaryButton"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_margin="8dp"/>
+ <Button
+ android:id="@android:id/text2"
+ style="@style/SupportSecondaryButton"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="16dp"
+ android:minHeight="48dp"/>
+</LinearLayout>
\ No newline at end of file
diff --git a/res/layout/support_tile.xml b/res/layout/support_tile.xml
new file mode 100644
index 0000000..e07e173
--- /dev/null
+++ b/res/layout/support_tile.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2016 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:background="?android:attr/selectableItemBackground"
+ android:gravity="center_vertical"
+ android:minHeight="@dimen/dashboard_tile_minimum_height"
+ android:orientation="horizontal">
+ <ImageView
+ android:id="@android:id/icon"
+ android:layout_width="@dimen/dashboard_tile_image_size"
+ android:layout_height="@dimen/dashboard_tile_image_size"
+ android:scaleType="centerInside"
+ android:layout_marginStart="@dimen/dashboard_tile_image_margin_start"
+ android:layout_marginEnd="@dimen/dashboard_tile_image_margin_end"/>
+ <TextView
+ android:id="@android:id/text1"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:singleLine="true"
+ android:textAppearance="@style/TextAppearance.TileTitle"
+ android:ellipsize="end"
+ android:fadingEdge="horizontal"/>
+</LinearLayout>
\ No newline at end of file
diff --git a/res/layout/suw_item_link_description.xml b/res/layout/suw_item_link_description.xml
deleted file mode 100644
index 5396de1e..0000000
--- a/res/layout/suw_item_link_description.xml
+++ /dev/null
@@ -1,71 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright (C) 2016 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- style="@style/SuwItemContainer"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- android:paddingTop="@dimen/suw_description_margin_top"
- android:paddingBottom="@dimen/suw_description_margin_bottom_lists">
-
- <FrameLayout
- android:id="@+id/suw_items_icon_container"
- android:layout_width="@dimen/suw_items_icon_container_width"
- android:layout_height="wrap_content"
- android:layout_gravity="center_vertical"
- android:gravity="start">
-
- <ImageView
- android:id="@+id/suw_items_icon"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- tools:ignore="ContentDescription" />
-
- </FrameLayout>
-
- <LinearLayout
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:orientation="vertical">
-
- <com.android.settings.widget.LinkTextView
- android:id="@+id/suw_items_title"
- style="@style/SuwItemTitle"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:gravity="start"
- android:lineSpacingExtra="@dimen/suw_description_line_spacing_extra"
- android:textAlignment="viewStart"
- android:textAppearance="@style/TextAppearance.SuwDescription"
- tools:ignore="UnusedAttribute" />
-
- <com.android.settings.widget.LinkTextView
- android:id="@+id/suw_items_summary"
- style="@style/SuwItemSummary"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:gravity="start"
- android:textAlignment="viewStart"
- android:visibility="gone"
- tools:ignore="UnusedAttribute" />
-
- </LinearLayout>
-
-</LinearLayout>
diff --git a/res/layout/switch_bar.xml b/res/layout/switch_bar.xml
index a31bd3e..8b69a1d 100644
--- a/res/layout/switch_bar.xml
+++ b/res/layout/switch_bar.xml
@@ -44,7 +44,7 @@
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:background="@null"
- android:theme="@style/ThemeOverlay.SwitchBar" />
+ android:theme="@style/ThemeOverlay.SwitchBar.Settings" />
</merge>
diff --git a/res/layout/wifi_display_preference.xml b/res/layout/wifi_display_preference.xml
index d8c4729..99cb89c 100644
--- a/res/layout/wifi_display_preference.xml
+++ b/res/layout/wifi_display_preference.xml
@@ -37,7 +37,7 @@
android:layout_gravity="center_vertical"
android:padding="8dip"
android:background="?android:attr/selectableItemBackground"
- android:src="@drawable/ic_bt_config"
+ android:src="@drawable/ic_settings"
android:contentDescription="@string/wifi_display_details" />
</LinearLayout>
diff --git a/res/menu/storage_volume.xml b/res/menu/storage_volume.xml
index efa468c..bf9f985 100644
--- a/res/menu/storage_volume.xml
+++ b/res/menu/storage_volume.xml
@@ -30,4 +30,7 @@
<item
android:id="@+id/storage_migrate"
android:title="@string/storage_menu_migrate" />
+ <item
+ android:id="@+id/storage_free"
+ android:title="@string/storage_menu_free" />
</menu>
diff --git a/res/raw/gesture_ambient_move_lift.mp4 b/res/raw/gesture_ambient_move_lift.mp4
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/res/raw/gesture_ambient_move_lift.mp4
diff --git a/res/raw/gesture_ambient_tap.mp4 b/res/raw/gesture_ambient_tap.mp4
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/res/raw/gesture_ambient_tap.mp4
diff --git a/res/raw/gesture_double_tap.mp4 b/res/raw/gesture_double_tap.mp4
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/res/raw/gesture_double_tap.mp4
diff --git a/res/raw/gesture_fingerprint_swipe.mp4 b/res/raw/gesture_fingerprint_swipe.mp4
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/res/raw/gesture_fingerprint_swipe.mp4
diff --git a/res/raw/gesture_twist.mp4 b/res/raw/gesture_twist.mp4
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/res/raw/gesture_twist.mp4
diff --git a/res/values-sw600dp/aliases.xml b/res/values-sw600dp/aliases.xml
index 51ee5bc..a3bf39a 100644
--- a/res/values-sw600dp/aliases.xml
+++ b/res/values-sw600dp/aliases.xml
@@ -19,7 +19,7 @@
<item name="fingerprint_enroll_find_sensor" type="layout">@layout/fingerprint_enroll_find_sensor_base</item>
<item name="fingerprint_enroll_enrolling" type="layout">@layout/fingerprint_enroll_enrolling_base</item>
<item name="fingerprint_enroll_finish" type="layout">@layout/fingerprint_enroll_finish_base</item>
- <item name="setup_choose_lock_pattern" type="layout">@layout/setup_choose_lock_pattern_common</item>
+ <item name="choose_lock_pattern" type="layout">@layout/choose_lock_pattern_common</item>
<item name="setup_fingerprint_enroll_find_sensor" type="layout">@layout/setup_fingerprint_enroll_find_sensor_base</item>
</resources>
diff --git a/res/values/aliases.xml b/res/values/aliases.xml
index a783c79..12f2710 100644
--- a/res/values/aliases.xml
+++ b/res/values/aliases.xml
@@ -21,8 +21,7 @@
<item name="fingerprint_enroll_find_sensor" type="layout">@layout/fingerprint_enroll_find_sensor_base</item>
<item name="fingerprint_enroll_enrolling" type="layout">@layout/fingerprint_enroll_enrolling_base</item>
<item name="fingerprint_enroll_finish" type="layout">@layout/fingerprint_enroll_finish_base</item>
- <item name="setup_choose_lock_pattern" type="layout">@layout/setup_choose_lock_pattern_common</item>
+ <item name="choose_lock_pattern" type="layout">@layout/choose_lock_pattern_common</item>
<item name="setup_fingerprint_enroll_find_sensor" type="layout">@layout/setup_fingerprint_enroll_find_sensor_base</item>
- <item name="setup_choose_lock_pattern_template" type="layout">@layout/suw_template_short</item>
</resources>
diff --git a/res/values/arrays.xml b/res/values/arrays.xml
index 8adf331..6827e5b 100644
--- a/res/values/arrays.xml
+++ b/res/values/arrays.xml
@@ -1031,4 +1031,18 @@
<item>Red</item>
</string-array>
+ <!-- Automatic storage management settings. The amount of days for the automatic storage manager
+ to retain. These are shown in a list dialog. [CHAR LIMIT=70] -->
+ <string-array name="automatic_storage_management_days">
+ <item>Over 30 days old</item>
+ <item>Over 60 days old</item>
+ <item>Over 90 days old</item>
+ </string-array>
+
+ <string-array name="automatic_storage_management_days_values" translatable="false">
+ <item>30</item>
+ <item>60</item>
+ <item>90</item>
+ </string-array>
+
</resources>
diff --git a/res/values/attrs.xml b/res/values/attrs.xml
index 0a072ae..ffc233b 100644
--- a/res/values/attrs.xml
+++ b/res/values/attrs.xml
@@ -121,6 +121,8 @@
<attr name="switchBarMarginEnd" format="dimension" />
<attr name="switchBarBackgroundColor" format="color" />
+ <attr name="colorSecondary" format="color" />
+
<attr name="preferenceBackgroundColor" format="color" />
<!-- Confirm device credentials screen -->
@@ -135,4 +137,10 @@
<attr name="allowDividerAbove" format="boolean" />
<attr name="allowDividerBelow" format="boolean" />
</declare-styleable>
+
+ <!-- For GesturePreference -->
+ <declare-styleable name="GesturePreference">
+ <attr name="animation" format="reference" />
+ </declare-styleable>
+
</resources>
diff --git a/res/values/bools.xml b/res/values/bools.xml
index 5ee0f7c..15706df 100644
--- a/res/values/bools.xml
+++ b/res/values/bools.xml
@@ -40,4 +40,7 @@
<!-- Whether none security option is hide or not (country specific). -->
<bool name="config_hide_none_security_option">false</bool>
+
+ <!-- Whether the automatic storage management job should be scheduled. -->
+ <bool name="enable_automatic_storage_management">false</bool>
</resources>
diff --git a/res/values/colors.xml b/res/values/colors.xml
index a9756ad..ccc521c 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -69,19 +69,14 @@
<color name="fingerprint_indicator_background_resting">#12000000</color>
<color name="running_processes_system_ram">#ff384248</color>
- <color name="running_processes_apps_ram">#ff009587</color>
<color name="running_processes_free_ram">#ffced7db</color>
<color name="card_background">#ffffffff</color>
- <color name="switchbar_background_color">#ff37474f</color>
- <color name="switch_accent_color">#ff7fcac3</color>
-
<color name="wifi_divider">#ffe0e0e0</color>
<color name="sim_noitification">@*android:color/material_deep_teal_500</color>
<color name="warning">#ff5621</color>
- <color name="confirm_device_credential_dark_background">#263238</color>
<color name="confirm_device_credential_transparent_black">#60000000</color>
<color name="fab_ripple">#1fffffff</color><!-- 12% white -->
<color name="fab_shape">?android:attr/colorAccent</color>
@@ -101,9 +96,6 @@
<!-- Accent color that matches the settings launcher icon -->
<color name="icon_accent">#ffabffec</color>
- <color name="summary_default_start">#ff009587</color>
- <color name="summary_default_end">#ffced7db</color>
-
<color name="importance_icon_tint">#8a000000</color>
<color name="importance_disabled_tint">#4d000000</color>
@@ -125,10 +117,16 @@
<color name="seek_bar_preference_preview_text">#fff</color>
- <color name="importance_slider_color">@*android:color/material_deep_teal_500</color>
<color name="importance_disabled_slider_color">@*android:color/material_grey_300</color>
<color name="importance_secondary_slider_color">#858383</color>
<color name="usage_graph_dots">#B0BEC5</color>
+ <color name="card_background_grey">#eeeeee</color>
+
+ <color name="secondary_color">#ff37474f</color>
+
+ <!-- Gestures settings -->
+ <color name="gestures_setting_backgroud_color">#f5f5f5</color>
+
</resources>
diff --git a/res/values/config.xml b/res/values/config.xml
index 3f25fc6..2c7a2de 100755
--- a/res/values/config.xml
+++ b/res/values/config.xml
@@ -38,4 +38,10 @@
<!-- When true enable color temperature setting. -->
<bool name="config_enableColorTemperature">false</bool>
+ <!-- Fully-qualified class name for the implementation of the FeatureFactory to be instantiated. -->
+ <string name="config_featureFactory" translatable="false">com.android.settings.overlay.FeatureFactoryImpl</string>
+
+ <!-- Package name and fully-qualified class name for the wallpaper picker activity. -->
+ <string name="config_wallpaper_picker_package" translatable="false">com.android.settings</string>
+ <string name="config_wallpaper_picker_class" translatable="false">com.android.settings.Settings$WallpaperSettingsActivity</string>
</resources>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index ef7efa2..9a97d30 100755
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -59,6 +59,8 @@
<dimen name="appwidget_min_height">40dip</dimen>
<dimen name="pager_tabs_padding">0dp</dimen>
+ <dimen name="pager_tabs_title_padding">16dp</dimen>
+ <dimen name="pager_tabs_selected_indicator_height">3dp</dimen>
<!-- Minimum width for the popup for updating a user's photo. -->
<dimen name="update_user_photo_popup_min_width">300dip</dimen>
@@ -117,8 +119,6 @@
<dimen name="dashboard_tile_image_margin_start">16dp</dimen>
<dimen name="dashboard_tile_image_margin_end">32dp</dimen>
- <dimen name="suggestion_arrow_margin">16dp</dimen>
-
<!-- SwitchBar margin start / end -->
<dimen name="switchbar_margin_start">16dp</dimen>
<dimen name="switchbar_margin_end">16dp</dimen>
@@ -296,4 +296,7 @@
<!-- Padding between the radio buttons/checkbox and text on the redaction interstitial -->
<dimen name="redaction_padding_start">16dp</dimen>
+ <!-- Padding for Gestures settings screen -->
+ <dimen name="gestures_settings_padding_top_bottom">20dp</dimen>
+ <dimen name="gestures_play_button_size">36dp</dimen>
</resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 3a37705..cc16240 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -741,7 +741,7 @@
<!-- Introduction title shown in fingerprint enrollment to introduce the fingerprint feature[CHAR LIMIT=29] -->
<string name="security_settings_fingerprint_enroll_introduction_title">Unlock with fingerprint</string>
<!-- Introduction detail message shown in fingerprint enrollment dialog [CHAR LIMIT=NONE]-->
- <string name="security_settings_fingerprint_enroll_introduction_message">Just touch the fingerprint sensor to unlock your phone, authorize purchases, or sign in to apps. Be careful whose fingerprints you add. Even one added print can do any of these things.\n\nNote: Your fingerprint may be less secure than a strong pattern or PIN. <annotation id="url">Learn more</annotation></string>
+ <string name="security_settings_fingerprint_enroll_introduction_message">Just touch the fingerprint sensor to unlock your phone, authorize purchases, or sign in to apps. Be careful whose fingerprints you add. Even one added print can do any of these things.\n\nNote: Your fingerprint may be less secure than a strong pattern or PIN.</string>
<!-- Button text to cancel enrollment from the introduction [CHAR LIMIT=22] -->
<string name="security_settings_fingerprint_enroll_introduction_cancel">Cancel</string>
<!-- Button text to continue to the next screen from the introduction [CHAR LIMIT=22] -->
@@ -784,7 +784,7 @@
<!-- Message shown in fingerprint enrollment dialog to begin enrollment [CHAR LIMIT=NONE] -->
<string name="security_settings_fingerprint_enroll_start_message">Put your finger on the sensor and lift after you feel a vibration</string>
<!-- Title shown in fingerprint enrollment dialog to repeat touching the fingerprint sensor [CHAR LIMIT=29] -->
- <string name="security_settings_fingerprint_enroll_repeat_title">Great! Now repeat</string>
+ <string name="security_settings_fingerprint_enroll_repeat_title">Keep going</string>
<!-- Message shown in fingerprint enrollment dialog to repeat touching the fingerprint sensor [CHAR LIMIT=NONE] -->
<string name="security_settings_fingerprint_enroll_repeat_message">Move your finger slightly to add all the different parts of your fingerprint</string>
<!-- Title shown in fingerprint enrollment dialog once enrollment is completed [CHAR LIMIT=29] -->
@@ -794,7 +794,7 @@
<!-- Message shown when fingerprint enrollment is completed during setup wizard [CHAR LIMIT=NONE] -->
<string name="setup_fingerprint_enroll_finish_message">Just touch the fingerprint sensor to wake and unlock your device.</string>
<!-- Message shown when fingerprint enrollment is completed, telling user about the fingerprint icon that will be shown whenever they can use their fingerprint [CHAR LIMIT=NONE] -->
- <string name="setup_fingerprint_enroll_finish_message_secondary">When you see this icon, you can use your fingerprint.</string>
+ <string name="setup_fingerprint_enroll_finish_message_secondary">When you see this icon, you can also authorize purchases or sign in to apps.</string>
<!-- Title of the dialog shown when the user tries to skip fingerprint setup, asking them to confirm the action [CHAR LIMIT=40] -->
<string name="setup_fingerprint_enroll_enrolling_skip_title">Skip fingerprint setup?</string>
<!-- Content of the dialog shown when the user tries to skip fingerprint setup, asking them to confirm the action [CHAR LIMIT=NONE] -->
@@ -1983,6 +1983,9 @@
</string-array>
<!-- Wi-Fi Calling settings. Text displayed when Wi-Fi Calling is off -->
<string name="wifi_calling_off_explanation">When Wi-Fi calling is on, your phone can route calls via Wi-Fi networks or your carrier\u2019s network, depending on your preference and which signal is stronger. Before turning on this feature, check with your carrier regarding fees and other details.</string>
+ <string name="emergency_address_title">Update Emergency Address</string>
+ <string name="emergency_address_summary">Address used by emergency services as your location if you make a 911 call using WiFi</string>
+
<!-- Sound and alerts settings -->
<skip/>
@@ -2456,6 +2459,10 @@
<string name="storage_menu_set_up">Set up</string>
<!-- Storage setting. Menu option for exploring a storage device [CHAR LIMIT=30]-->
<string name="storage_menu_explore">Explore</string>
+ <!-- Storage setting. Menu option for using the deletion helper. [CHAR LIMIT=30] -->
+ <string name="storage_menu_free">Free up space</string>
+ <!-- Storage setting. Menu option for accessing the storage manager settings. [CHAR LIMIT=30] -->
+ <string name="storage_menu_manage">Manage storage</string>
<!-- Storage setting. Title for USB transfer settings [CHAR LIMIT=30]-->
<string name="storage_title_usb">USB computer connection</string>
@@ -2556,6 +2563,8 @@
<string name="storage_detail_cached">Cached data</string>
<!-- Item title describing storage used by other data [CHAR LIMIT=48]-->
<string name="storage_detail_other">Other</string>
+ <!-- Item title describing internal storage used by the Android System [CHAR LIMIT=48]-->
+ <string name="storage_detail_system">System</string>
<!-- Item title that will launch a file explorer [CHAR LIMIT=48]-->
<string name="storage_detail_explore">Explore <xliff:g id="name" example="SD card">^1</xliff:g></string>
@@ -2563,6 +2572,10 @@
<string name="storage_detail_dialog_other">Other includes shared files saved by apps, files downloaded from the Internet or Bluetooth, Android files, and so on.
\n\nTo see the entire contents of this <xliff:g id="name" example="SD card">^1</xliff:g>, tap Explore.</string>
+ <!-- Body of dialog informing user about the storage used by the Android System [CHAR LIMIT=NONE]-->
+ <string name="storage_detail_dialog_system">System includes files used internally by the Android operating system.
+\n\nThese files can\u2019t be viewed individually.</string>
+
<!-- Body of dialog informing user about other users on a storage device [CHAR LIMIT=NONE]-->
<string name="storage_detail_dialog_user"><xliff:g id="user" example="Guest user">^1</xliff:g> may have saved photos, music, movies, apps, or other data that is taking up <xliff:g id="size" example="1.2 GB">^2</xliff:g> of storage.
\n\nTo view details, switch to <xliff:g id="user" example="Guest user">^1</xliff:g>.</string>
@@ -3005,8 +3018,10 @@
<string name="contributors_title">Contributors</string>
<!-- About phone settings screen, setting option name to show Manual [CHAR LIMIT=25] -->
<string name="manual">Manual</string>
- <!-- About phone settings screen, setting option name to show regulatory information [CHAR LIMIT=25] -->
- <string name="regulatory_information">Regulatory information</string>
+ <!-- About phone settings screen, setting option name to show regulatory labels [CHAR LIMIT=25] -->
+ <string name="regulatory_labels">Regulatory labels</string>
+ <!-- About phone settings screen, setting option name to show safety and regulatory information [CHAR LIMIT=40] -->
+ <string name="safety_and_regulatory_info">Safety & regulatory information</string>
<!-- Note: this may be replaced by a more-specific title of the activity that will get launched --> <skip />
<!-- About phone settings screen, setting option name to see copyright-related info -->
<string name="copyright_title">Copyright</string>
@@ -5535,8 +5550,6 @@
<!-- Help URI, Default [DO NOT TRANSLATE] -->
<string name="help_uri_default" translatable="false"></string>
- <!-- Help URI, Dashboard [DO NOT TRANSLATE] -->
- <string name="help_uri_dashboard" translatable="false"></string>
<!-- Help URI, Android beam [DO NOT TRANSLATE] -->
<string name="help_uri_beam" translatable="false"></string>
<!-- Help URI, Display [DO NOT TRANSLATE] -->
@@ -5834,6 +5847,7 @@
<string name="keywords_lockscreen">slide to unlock, password, pattern, PIN</string>
<string name="keywords_profile_challenge">work challenge, work, profile</string>
<string name="keywords_unification">work profile, managed profile, unify, unification, work, profile</string>
+ <string name="keywords_gesture">gesture</string>
<!-- NFC Wi-Fi pairing/setup strings-->
@@ -7202,7 +7216,10 @@
<string name="condition_work_summary">Apps, background sync, and other features related to your work profile are turned off.</string>
<!-- Title for the suggestions section on the dashboard [CHAR LIMIT=30] -->
- <string name="suggestions_title">Suggestions (<xliff:g name="count" example="3">%1$d</xliff:g>)</string>
+ <string name="suggestions_title">Suggestions</string>
+
+ <!-- Summary for the suggestions section on the dashboard, representing number of suggestions. [CHAR LIMIT=10] -->
+ <string name="suggestions_summary">+<xliff:g name="count" example="3">%1$d</xliff:g></string>
<!-- Name of option to remove a suggestion from the list [CHAR LIMIT=30] -->
<string name="suggestion_remove">Remove</string>
@@ -7450,6 +7467,10 @@
<string name="notification_suggestion_title">Control lock screen notifications</string>
<!-- Summary of notification suggestion during optional steps of setup. [CHAR_LIMIT=80] -->
<string name="notification_suggestion_summary">Show or hide notification content</string>
+ <!-- Setting tab title for all setting options. [CHAR LIMIT=20] -->
+ <string name="page_tab_title_summary">All</string>
+ <!-- Setting tab title for support setting options. [CHAR LIMIT=20] -->
+ <string name="page_tab_title_support">Support</string>
<!-- Summary of developer options to set the smallest width of the screen [CHAR LIMIT=60]-->
<string name="developer_density_summary"><xliff:g name="count" example="320">%d</xliff:g> dp</string>
@@ -7472,6 +7493,74 @@
<!-- [CHAR LIMIT=60] Name of dev option called demo mode -->
<string name="demo_mode">Demo mode</string>
+ <!-- Activity title for deletion helper. [CHAR LIMIT=25] -->
+ <string name="deletion_helper_title">Remove from Device</string>
+ <!-- Summary of how much storage an app is using and the number of days since last use. [CHAR LIMIT=NONE]-->
+ <string name="deletion_helper_app_summary"><xliff:g id="used" example="1.2GB">%1$s</xliff:g> • Last used <xliff:g id="days" example="67">%2$d</xliff:g> days ago</string>
+ <!-- Summary of how much storage an app is using when it has never been used before. [CHAR LIMIT=NONE]-->
+ <string name="deletion_helper_app_summary_never_used"><xliff:g id="used" example="1.2GB">%1$s</xliff:g> • Never used before</string>
+ <!-- Summary of how much storage an app is using when its last use is unknown. [CHAR LIMIT=NONE]-->
+ <string name="deletion_helper_app_summary_unknown_used"><xliff:g id="used" example="1.2GB">%1$s</xliff:g> • Not sure when last used</string>
+ <!-- Button which clears out storage in the deletion helper. [CHAR LIMIT=60]-->
+ <string name="deletion_helper_free_button">Free up <xliff:g id="freeable" example="1.2GB">%1$s</xliff:g></string>
+
+ <!-- Title text for connecting to customer support [CHAR LIMIT=80]-->
+ <string name="support_escalation_title">We\'re here to help</string>
+
+ <!-- Title text for connecting to 24/7 available customer support [CHAR LIMIT=80]-->
+ <string name="support_escalation_24_7_title">We\'re here for you 24/7</string>
+
+ <!-- Title text when customer support is closed [CHAR LIMIT=80]-->
+ <string name="support_escalation_closed_title">Live support closed</string>
+
+ <!-- Summary text for connecting to customer support [CHAR LIMIT=NONE]-->
+ <string name="support_escalation_summary">Our support team is here to address any issues as soon as we can.</string>
+
+ <!-- Summary text for connecting to 24/7 customer support [CHAR LIMIT=NONE]-->
+ <string name="support_escalation_24_7_summary">Our support team is here all day, every day.</string>
+
+ <!-- Summary text when customer support is closed. [CHAR LIMIT=NONE]-->
+ <string name="support_escalation_closed_summary">Come back again during support hours.</string>
+
+ <!-- Title text that indicates there is not internet connection. [CHAR LIMIT=80]-->
+ <string name="support_offline_title">You\'re offline</string>
+
+ <!-- Summary text telling user to connect to Internet in order to request customer support. [CHAR LIMIT=NONE]-->
+ <string name="support_offline_summary">To reach support, first connect to Wi-Fi or data.</string>
+
+ <!-- Button label for contacting customer support by phone [CHAR LIMIT=20]-->
+ <string name="support_escalation_by_phone">Support call</string>
+
+ <!-- Button label for contacting customer support by email [CHAR LIMIT=20]-->
+ <string name="support_escalation_by_email">Support email</string>
+
+ <!-- Button label for contacting customer support by chat [CHAR LIMIT=20]-->
+ <string name="support_escalation_by_chat">Support chat</string>
+
+ <!-- Button label for visiting the tips & tricks site [CHAR LIMIT=60]-->
+ <string name="support_tips_and_tricks_title">Tips & tricks</string>
+
+ <!-- Title text that indicates user needs to sign in to get customer support. [CHAR LIMIT=80]-->
+ <string name="support_sign_in_required_title">Sign in for support</string>
+
+ <!-- Summary text that indicates user needs to sign-in to get real time customer support. [CHAR LIMIT=NONE]-->
+ <string name="support_sign_in_required_summary" translatable="false"></string>
+
+ <!-- Button label for signing in an account [CHAR LIMIT=40]-->
+ <string name="support_sign_in_button_text">Sign in</string>
+
+ <!-- Button label that redirects user who needs help for signin to help screen [CHAR LIMIT=NONE]-->
+ <string name="support_sign_in_required_help">Can\'t access your account?</string>
+
+ <!-- Dialog title displayed before initiating real time support [CHAR LIMIT=80]-->
+ <string name="support_disclaimer_title">Send system information</string>
+
+ <!-- Dialog content displayed before initiating real time support [CHAR LIMIT=NONE]-->
+ <string name="support_disclaimer_content">To help address your issue quickly, we need system information for diagnosis.</string>
+
+ <!-- Checkbox text, when checked dialog will not show again [CHAR LIMIT=80] -->
+ <string name="support_disclaimer_do_not_show">Do not show again</string>
+
<!-- [CHAR LIMIT=60] Title of work profile setting page -->
<string name="managed_profile_settings_title">Work profile settings</string>
<!-- [CHAR LIMIT=60] The preference title for enabling cross-profile remote contact search -->
@@ -7479,6 +7568,27 @@
<!-- [CHAR LIMIT=NONE] The preference summary for enabling cross-profile remote contact search -->
<string name="managed_profile_contact_search_summary">Allow contact searches by your organization to identify callers and contacts</string>
+ <!-- Time in hours -->
+ <plurals name="hours">
+ <item quantity="one">1 hour</item>
+ <item quantity="other"><xliff:g id="number" example="7">%s</xliff:g> hours</item>
+ </plurals>
+
+ <!-- Time in minutes -->
+ <plurals name="minutes">
+ <item quantity="one">1 minute</item>
+ <item quantity="other"><xliff:g id="number" example="7">%s</xliff:g> minutes</item>
+ </plurals>
+
+ <!-- Time in seconds -->
+ <plurals name="seconds">
+ <item quantity="one">1 second</item>
+ <item quantity="other"><xliff:g id="number" example="7">%s</xliff:g> seconds</item>
+ </plurals>
+
+ <!-- Estimated wait time range for real time supports -->
+ <string name="support_estimated_wait_time">~<xliff:g id="ESTIMATE" example="2 minutes">%1$s</xliff:g> wait</string>
+
<!-- Message for telling the user the kind of BT device being displayed in list. -->
<string name="bluetooth_talkback_computer">Computer</string>
@@ -7499,4 +7609,96 @@
<!-- Message for telling the user the kind of BT device being displayed in list. -->
<string name="bluetooth_talkback_bluetooth">Bluetooth</string>
+
+ <!-- Preference group title for the photos and videos deletion service. [CHAR LIMIT=40]-->
+ <string name="deletion_helper_photos_title">Photos & Videos (<xliff:g id="num_items">%1$d</xliff:g>)</string>
+
+ <!-- Summary of how much backed up storage that photos and videos service can clear from the local device. [CHAR LIMIT=NONE]-->
+ <string name="deletion_helper_photos_summary"><xliff:g id="used" example="1.2GB">%1$s</xliff:g> • Older than <xliff:g id="days">%2$d</xliff:g> days</string>
+
+ <!-- Preference title for the downloads deletion service. [CHAR LIMIT=40]-->
+ <string name="deletion_helper_downloads_title">Downloads (<xliff:g id="numItems" example="67">%1$d</xliff:g>)</string>
+
+ <!-- Summary of how much stale data can be cleared from the local download folder. [CHAR LIMIT=NONE]-->
+ <string name="deletion_helper_downloads_summary"><xliff:g id="used" example="1.2GB">%1$s</xliff:g> • Last modified <xliff:g id="days">%2$s</xliff:g></string>
+
+ <!-- Summary for when when there is nothing in the downloads folder to clear. [CHAR LIMIT=NONE]-->
+ <string name="deletion_helper_downloads_summary_empty"><xliff:g id="used" example="1.2GB">%1$s</xliff:g></string>
+
+ <!-- Message to warn the user before clearing space in the deletion helper. [CHAR LIMIT=NONE] -->
+ <string name="deletion_helper_clear_dialog_message">Remove <xliff:g id="clearable_bytes" example="1.2GB">%1$s</xliff:g> from your device.</string>
+
+ <!-- Button label for the dialog prompt for clearing data in deletion helper. [CHAR LIMIT=40] -->
+ <string name="deletion_helper_clear_dialog_remove">Remove</string>
+
+ <!-- Used as title on the automatic storage manager settings. [CHAR LIMIT=60] -->
+ <string name="automatic_storage_manager_settings">Storage manager</string>
+
+ <!-- Used as wall of text to describe the feature. [CHAR LIMIT=NONE] -->
+ <string name="automatic_storage_manager_text">To help free up storage space, storage manager removes backed up photos and videos from your device.</string>
+
+ <!-- Dropdown preference title for dropdown describing how many days of data to retain.-->
+ <string name="automatic_storage_manager_days_title">Remove photos & videos</string>
+
+ <!-- Title for the dialog to up sell the storage manager. [CHAR LIMIT=NONE] -->
+ <string name="deletion_helper_upsell_title"><xliff:g id="used" example="1.2GB">%1$s</xliff:g> now free. Manage storage automatically?</string>
+ <!-- Summary for the dialog to up sell the storage manager. [CHAR LIMIT=NONE] -->
+ <string name="deletion_helper_upsell_summary">Let Storage manager automatically free up space by removing backed up content from your device?</string>
+ <!-- Button to delay turning on the storage manager on the storage manager upsell. [CHAR LIMIT=20]-->
+ <string name="deletion_helper_upsell_cancel">No thanks</string>
+ <!-- Button to activate the storage manager on the storage manager upsell. [CHAR LIMIT=20]-->
+ <string name="deletion_helper_upsell_activate">Turn on</string>
+
+ <!-- Title for the apps category in the deletion helper, showing how many apps to delete. [CHAR LIMIT=40]-->
+ <string name="deletion_helper_apps_group_title">Apps (<xliff:g id="num_items">%1$d</xliff:g>)</string>
+
+ <!-- Summary for the apps category in the deletion helper, showing how many space to clear. [CHAR LIMIT=NONE]-->
+ <string name="deletion_helper_apps_group_summary"><xliff:g id="used" example="1.2GB">%1$s</xliff:g> • Last used <xliff:g id="days">%2$d</xliff:g> days ago</string>
+
+ <!-- Category title for the automatic settings in the storage manager settings. [CHAR LIMIT=40] -->
+ <string name="deletion_helper_automatic_title">Automatic</string>
+
+ <!-- Category title for the manual settings in the storage manager settings. [CHAR LIMIT=40] -->
+ <string name="deletion_helper_manual_title">Manual</string>
+
+ <!-- Preference menu title for accessing the deletion helper from the storage manager settings. [CHAR LIMIT=30]-->
+ <string name="deletion_helper_preference_title">Free space now</string>
+
+ <!-- Preference title for the automatic storage manager toggle. [CHAR LIMIT=60]-->
+ <string name="automatic_storage_manager_preference_title">Storage manager</string>
+
+ <!-- Automatic storage management service label. [CHAR LIMIT=40]-->
+ <string name="automatic_storage_manager_service_label">Automatic Storage Management Service</string>
+
+ <!-- Preference title for gesture settings [CHAR LIMIT=25]-->
+ <string name="gesture_preference_title">Gestures</string>
+
+ <!-- Title text for double tap power for camera [CHAR LIMIT=60]-->
+ <string name="double_tap_power_for_camera_title">Jump to Camera</string>
+
+ <!-- Summary text for double tap power for camera [CHAR LIMIT=160]-->
+ <string name="double_tap_power_for_camera_summary">To quickly open camera, just double-tap the power button. Works from any screen.</string>
+
+ <!-- Title text for double twist for camera mode [CHAR LIMIT=60]-->
+ <string name="double_twist_for_camera_mode_title">Flip camera</string>
+
+ <!-- Summary text for double twist for camera mode [CHAR LIMIT=160]-->
+ <string name="double_twist_for_camera_mode_summary">To switch between front and back cameras, double-twist.</string>
+
+ <!-- Title text for ambient display [CHAR LIMIT=60]-->
+ <string name="ambient_display_title">Quick screen check</string>
+
+ <!-- Summary text for ambient display [CHAR LIMIT=160]-->
+ <string name="ambient_display_summary">To check your phone without waking it up fully, nudge or pick it up.</string>
+
+ <!-- Title text for fingerprint swipe for notifications [CHAR LIMIT=60]-->
+ <string name="fingerprint_swipe_for_notifications_title">Swipe for notifications</string>
+
+ <!-- Summary text for fingerprint swipe for notifications [CHAR LIMIT=160]-->
+ <string name="fingerprint_swipe_for_notifications_summary">To check your notifications from any screen, swipe down on the fingerprint sensor.</string>
+
+ <!-- Switch text for each gesture setting state -->
+ <string name="gesture_setting_on">On</string>
+ <string name="gesture_setting_off">Off</string>
+
</resources>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index bfe2d1c..1942a4c 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -286,6 +286,15 @@
<item name="android:singleLine">true</item>
</style>
+ <style name="SetupWizardButton.Negative" parent="@android:style/TextAppearance.Widget.TextView">
+ <item name="android:background">@null</item>
+ <item name="android:minWidth">0dp</item>
+ <item name="android:textAllCaps">false</item>
+ <item name="android:textColor">?android:attr/colorControlActivated</item>
+ </style>
+
+ <style name="SetupWizardButton.Positive" parent="@android:style/Widget.Material.Button.Colored" />
+
<style name="vpn_label">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
@@ -329,6 +338,12 @@
<style name="TextAppearance.RecentsTitle" parent="TextAppearance.CategoryTitle" />
<style name="TextAppearance.ResultTitle" parent="TextAppearance.CategoryTitle" />
+ <style name="TextAppearance.SuggestionTitle"
+ parent="@android:style/TextAppearance.Material.Subhead">
+ <item name="android:fontFamily">sans-serif-medium</item>
+ <item name="android:textSize">14sp</item>
+ </style>
+
<style name="TextAppearance.FingerprintMessage"
parent="android:TextAppearance.Material.Subhead">
<item name="android:lineSpacingExtra">@dimen/suw_description_line_spacing_extra</item>
@@ -350,16 +365,23 @@
<item name="android:textColor">@color/warning</item>
</style>
- <style name="FingerprintLayoutTheme">
- <item name="suwBackground">@drawable/fp_enrollment_header</item>
- <item name="suwIllustrationAspectRatio">@dimen/fingerprint_illustration_aspect_ratio</item>
- <item name="suwDecorPaddingTop">@dimen/fingerprint_decor_padding_top</item>
+ <style name="TextAppearance.SupportTitle"
+ parent="@android:style/TextAppearance.Material.Subhead">
+ <item name="android:textColor">?android:attr/colorAccent</item>
+ <item name="android:textSize">24sp</item>
</style>
- <style name="SetupWizardFingerprintLayoutTheme">
- <item name="suwBackgroundTile">@drawable/setup_illustration_tile</item>
- <item name="suwIllustration">@drawable/setup_illustration_lock_screen</item>
- <item name="suwIllustrationHorizontalTile">@drawable/setup_illustration_horizontal_tile</item>
+ <style name="TextAppearance.SupportSummary" parent="TextAppearance.CategoryTitle"/>
+
+ <style name="SupportPrimaryButton" parent="android:Widget.Material.Button.Colored"/>
+
+ <style name="SupportSecondaryButton"
+ parent="android:Widget.Material.Button.Borderless.Colored">
+ <item name="android:textSize">12sp</item>
+ </style>
+
+ <style name="FingerprintLayoutTheme">
+ <item name="android:icon">@drawable/ic_fingerprint_header</item>
</style>
<style name="TextAppearance.ConfirmDeviceCredentialsErrorText"
diff --git a/res/values/themes.xml b/res/values/themes.xml
index ef9e1e0..1268e4d 100644
--- a/res/values/themes.xml
+++ b/res/values/themes.xml
@@ -18,7 +18,6 @@
<attr name="fingerprint_layout_theme" format="reference" />
<attr name="fingerprint_progress_bar_size" format="reference|dimension" />
<attr name="fingerprint_ring_radius" format="reference|dimension" />
- <attr name="ic_menu_add" format="reference" />
<attr name="ic_menu_moreoverflow" format="reference" />
<attr name="ic_wps" format="reference" />
<attr name="setup_divider_color" format="reference" />
@@ -32,18 +31,15 @@
<item name="android:windowBackground">@null</item>
</style>
- <style name="SetupWizardTheme" parent="SuwThemeMaterial">
+ <style name="SetupWizardTheme" parent="SuwThemeGlif">
<!-- For all Alert Dialogs -->
<item name="android:alertDialogTheme">@style/ThemeOverlay.AlertDialog</item>
<item name="android:colorPrimary">@color/suw_color_accent_dark</item>
- <item name="android:listPreferredItemPaddingEnd">@dimen/suw_layout_margin_sides</item>
- <item name="android:listPreferredItemPaddingStart">@dimen/suw_layout_margin_sides</item>
<item name="android:windowBackground">?android:attr/colorBackground</item>
<item name="@*android:preferencePanelStyle">@*android:style/PreferencePanel.Dialog</item>
- <item name="fingerprint_layout_theme">@style/SetupWizardFingerprintLayoutTheme</item>
+ <item name="fingerprint_layout_theme">@style/FingerprintLayoutTheme</item>
<item name="fingerprint_progress_bar_size">@dimen/setup_fingerprint_progress_bar_size</item>
<item name="fingerprint_ring_radius">@dimen/setup_fingerprint_ring_radius</item>
- <item name="ic_menu_add">@drawable/ic_menu_add_dark</item>
<item name="ic_menu_moreoverflow">@*android:drawable/ic_menu_moreoverflow_material</item>
<item name="ic_wps">@drawable/ic_wps_dark</item>
<item name="setup_divider_color">@color/setup_divider_color_dark</item>
@@ -59,18 +55,15 @@
<item name="@*android:errorColor">@color/setup_lock_pattern_view_error_color_dark</item>
</style>
- <style name="SetupWizardTheme.Light" parent="SuwThemeMaterial.Light">
+ <style name="SetupWizardTheme.Light" parent="SuwThemeGlif.Light">
<!-- For all Alert Dialogs -->
<item name="android:alertDialogTheme">@style/ThemeOverlay.AlertDialog</item>
<item name="android:colorPrimary">@color/suw_color_accent_light</item>
- <item name="android:listPreferredItemPaddingEnd">@dimen/suw_layout_margin_sides</item>
- <item name="android:listPreferredItemPaddingStart">@dimen/suw_layout_margin_sides</item>
<item name="android:windowBackground">?android:attr/colorBackground</item>
<item name="@*android:preferencePanelStyle">@*android:style/PreferencePanel.Dialog</item>
- <item name="fingerprint_layout_theme">@style/SetupWizardFingerprintLayoutTheme</item>
+ <item name="fingerprint_layout_theme">@style/FingerprintLayoutTheme</item>
<item name="fingerprint_progress_bar_size">@dimen/setup_fingerprint_progress_bar_size</item>
<item name="fingerprint_ring_radius">@dimen/setup_fingerprint_ring_radius</item>
- <item name="ic_menu_add">@drawable/ic_menu_add_light</item>
<item name="ic_menu_moreoverflow">@*android:drawable/ic_menu_moreoverflow_material</item>
<item name="ic_wps">@drawable/ic_wps_light</item>
<item name="setup_divider_color">@color/setup_divider_color_light</item>
@@ -78,7 +71,7 @@
<item name="wifi_signal_color">@color/setup_wizard_wifi_color_light</item>
<item name="wifi_signal">@drawable/wifi_signal</item>
<item name="preferenceBackgroundColor">?android:attr/colorBackground</item>
- <item name="preferenceTheme">@style/PreferenceTheme.SetupWizard</item>
+ <item name="preferenceTheme">@style/PreferenceTheme.SetupWizard.Light</item>
<!-- LockPatternView colors -->
<item name="@*android:regularColor">@color/setup_lock_pattern_view_regular_color_light</item>
@@ -100,7 +93,7 @@
<item name="android:windowAnimationStyle">@null</item>
</style>
- <style name="PreferenceTheme" parent="@android:style/Theme.DeviceDefault.Settings">
+ <style name="PreferenceTheme" parent="Theme.SettingsBase">
<item name="@android:preferenceStyle">@style/Preference</item>
<item name="@android:editTextPreferenceStyle">@style/EditTextPreference</item>
<item name="@dropdownPreferenceStyle">@style/Preference.DropDown.Material</item>
@@ -108,9 +101,11 @@
<item name="apnPreferenceStyle">@style/ApnPreference</item>
</style>
- <style name="PreferenceTheme.SetupWizard">
- <item name="android:listPreferredItemPaddingEnd">@dimen/suw_layout_margin_sides</item>
- <item name="android:listPreferredItemPaddingStart">@dimen/suw_layout_margin_sides</item>
+ <style name="PreferenceTheme.SetupWizard" parent="SetupWizardTheme">
+ <item name="preferenceFragmentStyle">@style/SetupWizardPreferenceFragmentStyle</item>
+ </style>
+
+ <style name="PreferenceTheme.SetupWizard.Light" parent="SetupWizardTheme.Light">
<item name="preferenceFragmentStyle">@style/SetupWizardPreferenceFragmentStyle</item>
</style>
@@ -134,7 +129,9 @@
layouts against a remote context using our local theme colors. Due to the implementation
details of Theme, we can't reference any local resources and MUST instead use the values
directly. So use #ff263238 instead of @color/theme_primary and so on. -->
- <style name="Theme.SettingsBase" parent="@android:style/Theme.Material.Settings" />
+ <style name="Theme.SettingsBase" parent="@android:style/Theme.DeviceDefault.Settings">
+ <item name="colorSecondary">@color/secondary_color</item>
+ </style>
<style name="Theme.Settings" parent="Theme.SettingsBase">
<item name="preferenceTheme">@style/PreferenceTheme</item>
@@ -147,7 +144,6 @@
<item name="fingerprint_layout_theme">@style/FingerprintLayoutTheme</item>
<item name="fingerprint_progress_bar_size">@dimen/fingerprint_progress_bar_size</item>
<item name="fingerprint_ring_radius">@dimen/fingerprint_ring_radius</item>
- <item name="ic_menu_add">@drawable/ic_menu_add_dark</item>
<item name="ic_menu_moreoverflow">@*android:drawable/ic_menu_moreoverflow_holo_dark</item>
<item name="ic_wps">@drawable/ic_wps_light</item>
<item name="wifi_signal">@drawable/wifi_signal</item>
@@ -197,19 +193,20 @@
<item name="android:contentInsetStart">@dimen/actionbar_subsettings_contentInsetStart</item>
</style>
- <style name="ThemeOverlay.SwitchBar.Settings" parent="@android:style/ThemeOverlay.Material.Dark.ActionBar">
+ <style name="ThemeOverlay.SwitchBar.Settings" parent="@*android:style/ThemeOverlay.DeviceDefault.Dark.ActionBar.Accent">
<item name="switchBarMarginStart">@dimen/switchbar_subsettings_margin_start</item>
<item name="switchBarMarginEnd">@dimen/switchbar_subsettings_margin_end</item>
- <item name="switchBarBackgroundColor">@color/switchbar_background_color</item>
+ <item name="switchBarBackgroundColor">?attr/colorSecondary</item>
</style>
<style name="ThemeOverlay.SwitchBar.SubSettings" parent="@android:style/ThemeOverlay.Material.Dark.ActionBar">
<item name="switchBarMarginStart">@dimen/switchbar_subsettings_margin_start</item>
<item name="switchBarMarginEnd">@dimen/switchbar_subsettings_margin_end</item>
- <item name="switchBarBackgroundColor">@color/switchbar_background_color</item>
+ <item name="switchBarBackgroundColor">?attr/colorSecondary</item>
</style>
- <style name="Theme.DialogWhenLarge" parent="@*android:style/Theme.Material.Settings.DialogWhenLarge">
+ <style name="Theme.DialogWhenLarge" parent="@*android:style/Theme.DeviceDefault.Settings.DialogWhenLarge">
+ <item name="colorSecondary">@color/secondary_color</item>
<!-- Redefine the ActionBar style for contentInsetStart -->
<item name="android:actionBarStyle">@style/Theme.ActionBar</item>
@@ -240,7 +237,7 @@
<item name="android:windowSoftInputMode">adjustResize</item>
</style>
- <style name="Theme.AlertDialog" parent="@*android:style/Theme.Material.Settings.Dialog.Alert">
+ <style name="Theme.AlertDialog" parent="@*android:style/Theme.DeviceDefault.Settings.Dialog.Alert">
<item name="android:windowSoftInputMode">adjustResize</item>
<!-- Redefine the ActionBar style for contentInsetStart -->
@@ -255,24 +252,15 @@
<item name="preferenceBackgroundColor">@android:color/transparent</item>
</style>
- <!-- Used to color the switch bar controls -->
- <style name="ThemeOverlay.SwitchBar" parent="@android:style/ThemeOverlay">
- <!-- Used by controls, e.g. CheckBox, ProgressBar, etc. -->
- <item name="android:colorAccent">@color/switch_accent_color</item>
- <item name="switchBarBackgroundColor">@color/switchbar_background_color</item>
- </style>
-
<style name="Theme.ConfirmDeviceCredentials" parent="Theme.SubSettings">
<item name="confirmDeviceCredentialsSideMargin">16dp</item>
<item name="confirmDeviceCredentialsTopMargin">16dp</item>
</style>
- <style name="Theme.ConfirmDeviceCredentialsDark" parent="@android:style/Theme.Material">
- <item name="android:colorPrimary">@*android:color/material_blue_grey_900</item>
- <item name="android:colorPrimaryDark">@*android:color/material_blue_grey_950</item>
+ <style name="Theme.ConfirmDeviceCredentialsDark" parent="@android:style/Theme.DeviceDefault">
<item name="android:windowActionBar">false</item>
<item name="android:windowNoTitle">true</item>
- <item name="android:windowBackground">@color/confirm_device_credential_dark_background</item>
+ <item name="android:windowBackground">?android:attr/colorPrimary</item>
<item name="confirmDeviceCredentialsSideMargin">32dp</item>
<item name="confirmDeviceCredentialsTopMargin">32dp</item>
@@ -289,17 +277,11 @@
<item name="android:colorAccent">@*android:color/white</item>
</style>
- <style name="Theme.FingerprintEnroll" parent="@*android:style/Theme.Material.Settings.NoActionBar">
- <item name="android:listPreferredItemHeight">@dimen/suw_items_preferred_height</item>
- <item name="android:listPreferredItemPaddingEnd">@dimen/suw_layout_margin_sides</item>
- <item name="android:listPreferredItemPaddingStart">@dimen/suw_layout_margin_sides</item>
+ <style name="Theme.FingerprintEnroll" parent="SuwThemeGlif.Light">
<item name="android:textAppearanceListItemSmall">@android:style/TextAppearance.Material.Body1</item>
- <item name="android:windowAnimationStyle">@style/Animation.SuwWindowAnimation</item>
- <item name="selectableItemBackground">?android:attr/selectableItemBackground</item>
<item name="suwDividerCondition">both</item>
<item name="suwListItemIconColor">?android:attr/colorAccent</item>
- <item name="suwMarginSides">@dimen/suw_layout_margin_sides</item>
</style>
<style name="FallbackHome" parent="@android:style/Theme.DeviceDefault.Light.NoActionBar">
diff --git a/res/xml/automatic_storage_management_settings.xml b/res/xml/automatic_storage_management_settings.xml
new file mode 100644
index 0000000..282f89a
--- /dev/null
+++ b/res/xml/automatic_storage_management_settings.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2016 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:settings="http://schemas.android.com/apk/res-auto"
+ android:title="@string/automatic_storage_manager_settings" >
+
+ <PreferenceCategory
+ android:key="automatic"
+ android:title="@string/deletion_helper_automatic_title">
+
+ <SwitchPreference
+ android:key="storage_manager_active"
+ android:title="@string/automatic_storage_manager_preference_title"
+ android:summary="@string/automatic_storage_manager_text"/>
+
+ <DropDownPreference
+ android:key="days"
+ android:summary="%s"
+ android:title="@string/automatic_storage_manager_days_title"
+ android:entries="@array/automatic_storage_management_days"
+ android:entryValues="@array/automatic_storage_management_days_values"/>
+
+ </PreferenceCategory>
+
+ <PreferenceCategory
+ android:key="manual"
+ android:title="@string/deletion_helper_manual_title">
+
+ <Preference
+ android:key="deletion_helper"
+ android:title="@string/deletion_helper_preference_title"/>
+
+ </PreferenceCategory>
+
+</PreferenceScreen>
\ No newline at end of file
diff --git a/res/xml/deletion_helper_list.xml b/res/xml/deletion_helper_list.xml
new file mode 100644
index 0000000..64bd3b5
--- /dev/null
+++ b/res/xml/deletion_helper_list.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2016 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
+ android:title="@string/deletion_helper_title">
+
+ <com.android.settings.PhotosDeletionPreference
+ android:key="delete_photos" />
+
+ <com.android.settings.deletionhelper.DownloadsDeletionPreferenceGroup
+ android:key="delete_downloads"
+ android:icon="@drawable/ic_keyboard_arrow_down_black_32"/>
+
+ <com.android.settings.CollapsibleCheckboxPreferenceGroup
+ android:key="apps_group"
+ android:icon="@drawable/ic_keyboard_arrow_down_black_32"/>
+
+</PreferenceScreen>
diff --git a/res/xml/development_prefs.xml b/res/xml/development_prefs.xml
index d8f1395..375b9ef 100644
--- a/res/xml/development_prefs.xml
+++ b/res/xml/development_prefs.xml
@@ -51,10 +51,11 @@
android:title="@string/bt_hci_snoop_log"
android:summary="@string/bt_hci_snoop_log_summary"/>
- <SwitchPreference
+ <com.android.settingslib.RestrictedSwitchPreference
android:key="oem_unlock_enable"
android:title="@string/oem_unlock_enable"
- android:summary="@string/oem_unlock_enable_summary"/>
+ android:summary="@string/oem_unlock_enable_summary"
+ settings:useAdditionalSummary="true"/>
<PreferenceScreen
android:key="running_apps"
diff --git a/res/xml/device_info_settings.xml b/res/xml/device_info_settings.xml
index 5638f4f..74f873b 100644
--- a/res/xml/device_info_settings.xml
+++ b/res/xml/device_info_settings.xml
@@ -56,10 +56,16 @@
<PreferenceScreen
android:key="regulatory_info"
- android:title="@string/regulatory_information">
+ android:title="@string/regulatory_labels">
<intent android:action="android.settings.SHOW_REGULATORY_INFO" />
</PreferenceScreen>
+ <PreferenceScreen
+ android:key="safety_info"
+ android:title="@string/safety_and_regulatory_info">
+ <intent android:action="android.settings.SHOW_SAFETY_AND_REGULATORY_INFO" />
+ </PreferenceScreen>
+
<!-- Feedback on the device -->
<PreferenceScreen android:key="device_feedback"
android:title="@string/device_feedback">
diff --git a/res/xml/display_settings.xml b/res/xml/display_settings.xml
index 816f27b..cb1fac5 100644
--- a/res/xml/display_settings.xml
+++ b/res/xml/display_settings.xml
@@ -45,8 +45,11 @@
android:key="wallpaper"
android:title="@string/wallpaper_settings_title"
settings:keywords="@string/keywords_display_wallpaper"
- android:fragment="com.android.settings.WallpaperTypeSettings"
- settings:useAdminDisabledSummary="true" />
+ settings:useAdminDisabledSummary="true" >
+ <intent
+ android:targetPackage="@string/config_wallpaper_picker_package"
+ android:targetClass="@string/config_wallpaper_picker_class" />
+ </com.android.settingslib.RestrictedPreference>
<com.android.settings.TimeoutListPreference
android:key="screen_timeout"
@@ -60,11 +63,6 @@
android:title="@string/camera_gesture_title"
android:summary="@string/camera_gesture_desc" />
- <SwitchPreference
- android:key="camera_double_tap_power_gesture"
- android:title="@string/camera_double_tap_power_gesture_title"
- android:summary="@string/camera_double_tap_power_gesture_desc" />
-
<PreferenceScreen
android:key="screensaver"
android:title="@string/screensaver_settings_title"
@@ -74,10 +72,14 @@
android:key="lift_to_wake"
android:title="@string/lift_to_wake_title" />
- <SwitchPreference
+ <PreferenceScreen
android:key="doze"
android:title="@string/doze_title"
- android:summary="@string/doze_summary" />
+ android:summary="@string/doze_summary"
+ android:fragment="com.android.settings.gestures.GestureSettings" >
+ <extra android:name=":settings:fragment_args_key"
+ android:value="gesture_pick_up_and_nudge" />
+ </PreferenceScreen>
<SwitchPreference
android:key="tap_to_wake"
diff --git a/res/xml/fingerprint_enroll_introduction_items.xml b/res/xml/fingerprint_enroll_introduction_items.xml
index 4cb18a6..28a3f6b 100644
--- a/res/xml/fingerprint_enroll_introduction_items.xml
+++ b/res/xml/fingerprint_enroll_introduction_items.xml
@@ -20,7 +20,7 @@
<Item
android:enabled="false"
android:id="@+id/fingerprint_introduction_message"
- android:layout="@layout/suw_item_link_description"/>
+ android:layout="@layout/suw_items_description" />
<Item
android:id="@+id/next_button"
diff --git a/res/xml/gesture_settings.xml b/res/xml/gesture_settings.xml
new file mode 100644
index 0000000..5adc311
--- /dev/null
+++ b/res/xml/gesture_settings.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2016 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:settings="http://schemas.android.com/apk/res-auto"
+ android:title="@string/gesture_preference_title"
+ settings:keywords="@string/keywords_gesture">
+
+ <com.android.settings.gestures.GesturePreference
+ android:key="gesture_double_tap_power"
+ android:title="@string/double_tap_power_for_camera_title"
+ android:summary="@string/double_tap_power_for_camera_summary"
+ settings:animation="@raw/gesture_double_tap"/>
+
+ <com.android.settings.gestures.GesturePreference
+ android:key="gesture_double_twist"
+ android:title="@string/double_twist_for_camera_mode_title"
+ android:summary="@string/double_twist_for_camera_mode_summary"
+ settings:animation="@raw/gesture_twist"/>
+
+ <com.android.settings.gestures.GesturePreference
+ android:key="gesture_swipe_down_fingerprint"
+ android:title="@string/fingerprint_swipe_for_notifications_title"
+ android:summary="@string/fingerprint_swipe_for_notifications_summary"
+ settings:animation="@raw/gesture_fingerprint_swipe"/>
+
+ <com.android.settings.gestures.GesturePreference
+ android:key="gesture_pick_up_and_nudge"
+ android:title="@string/ambient_display_title"
+ android:summary="@string/ambient_display_summary"
+ settings:animation="@raw/gesture_ambient_move_lift"/>
+
+</PreferenceScreen>
\ No newline at end of file
diff --git a/res/xml/privacy_settings.xml b/res/xml/privacy_settings.xml
index 8c66fe1..f2af8f3 100644
--- a/res/xml/privacy_settings.xml
+++ b/res/xml/privacy_settings.xml
@@ -50,15 +50,6 @@
android:enabled="false"
android:selectable="false" />
- <!-- Network reset -->
- <com.android.settingslib.RestrictedPreference
- android:key="network_reset"
- android:title="@string/reset_network_title"
- settings:keywords="@string/keywords_network_reset"
- settings:userRestriction="no_network_reset"
- settings:useAdminDisabledSummary="true"
- android:fragment="com.android.settings.ResetNetwork" />
-
<!-- Factory reset -->
<com.android.settingslib.RestrictedPreference
android:key="factory_reset"
diff --git a/res/xml/shortcuts.xml b/res/xml/shortcuts.xml
new file mode 100644
index 0000000..e12c935
--- /dev/null
+++ b/res/xml/shortcuts.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2016 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License
+ -->
+<shortcuts xmlns:android="http://schemas.android.com/apk/res/android" >
+ <shortcut
+ android:shortcutId="manifest-shortcut-wifi"
+ android:icon="@drawable/ic_shortcut_wireless"
+ android:shortcutShortLabel="@string/wifi_settings" >
+ <intent android:action="android.settings.WIFI_SETTINGS" />
+ </shortcut>
+ <shortcut
+ android:shortcutId="manifest-shortcut-data-usage"
+ android:icon="@drawable/ic_shortcut_data_usage"
+ android:shortcutShortLabel="@string/data_usage_summary_title">
+ <intent
+ android:action="android.intent.action.MAIN"
+ android:targetPackage="com.android.settings"
+ android:targetClass="com.android.settings.Settings$DataUsageSummaryActivity" />
+ </shortcut>
+ <shortcut
+ android:shortcutId="manifest-shortcut-display"
+ android:icon="@drawable/ic_shortcut_display"
+ android:shortcutShortLabel="@string/display_settings">
+ <intent android:action="com.android.settings.DISPLAY_SETTINGS" />
+ </shortcut>
+ <shortcut
+ android:shortcutId="manifest-shortcut-battery"
+ android:icon="@drawable/ic_shortcut_battery"
+ android:shortcutShortLabel="@string/power_usage_summary_title" >
+ <intent android:action="android.intent.action.POWER_USAGE_SUMMARY" />
+ </shortcut>
+ <shortcut
+ android:shortcutId="manifest-shortcut-storage"
+ android:icon="@drawable/ic_shortcut_storage"
+ android:shortcutShortLabel="@string/storage_settings" >
+ <intent android:action="android.settings.INTERNAL_STORAGE_SETTINGS" />
+ </shortcut>
+</shortcuts>
\ No newline at end of file
diff --git a/res/xml/user_settings.xml b/res/xml/user_settings.xml
index cd0103d..1375ed4 100644
--- a/res/xml/user_settings.xml
+++ b/res/xml/user_settings.xml
@@ -26,7 +26,7 @@
<com.android.settings.DimmableIconPreference
android:key="user_add"
android:title="@string/user_add_user_or_profile_menu"
- android:icon="@drawable/ic_menu_add_dark" />
+ android:icon="@drawable/ic_menu_add" />
<PreferenceCategory
android:key="lock_screen_settings"
diff --git a/res/xml/wifi_calling_settings.xml b/res/xml/wifi_calling_settings.xml
index ca4e560..c32582c 100644
--- a/res/xml/wifi_calling_settings.xml
+++ b/res/xml/wifi_calling_settings.xml
@@ -26,4 +26,10 @@
android:entryValues="@array/wifi_calling_mode_values"
android:dialogTitle="@string/wifi_calling_mode_dialog_title" />
+ <Preference
+ android:key="emergency_address_key"
+ android:title="@string/emergency_address_title"
+ android:summary="@string/emergency_address_summary">
+ </Preference>
+
</PreferenceScreen>
diff --git a/res/xml/wireless_settings.xml b/res/xml/wireless_settings.xml
index 0461bf8..e94db56 100644
--- a/res/xml/wireless_settings.xml
+++ b/res/xml/wireless_settings.xml
@@ -89,4 +89,13 @@
android:key="proxy_settings"
android:title="@string/proxy_settings_title" />
+ <!-- Network reset -->
+ <com.android.settingslib.RestrictedPreference
+ android:key="network_reset"
+ android:title="@string/reset_network_title"
+ settings:keywords="@string/keywords_network_reset"
+ settings:userRestriction="no_network_reset"
+ settings:useAdminDisabledSummary="true"
+ android:fragment="com.android.settings.ResetNetwork" />
+
</PreferenceScreen>
diff --git a/src/com/android/settings/ChooseLockGeneric.java b/src/com/android/settings/ChooseLockGeneric.java
index 5eb5132..6db6f76 100644
--- a/src/com/android/settings/ChooseLockGeneric.java
+++ b/src/com/android/settings/ChooseLockGeneric.java
@@ -32,7 +32,6 @@
import android.hardware.fingerprint.FingerprintManager;
import android.hardware.fingerprint.FingerprintManager.RemovalCallback;
import android.os.Bundle;
-import android.os.Process;
import android.os.UserHandle;
import android.os.UserManager;
import android.os.storage.StorageManager;
@@ -42,9 +41,7 @@
import android.text.TextUtils;
import android.util.EventLog;
import android.util.Log;
-import android.view.View;
import android.view.accessibility.AccessibilityManager;
-import android.widget.Toast;
import com.android.internal.logging.MetricsProto.MetricsEvent;
import com.android.internal.widget.LockPatternUtils;
diff --git a/src/com/android/settings/ChooseLockPassword.java b/src/com/android/settings/ChooseLockPassword.java
index b3826b7..5a8960c 100644
--- a/src/com/android/settings/ChooseLockPassword.java
+++ b/src/com/android/settings/ChooseLockPassword.java
@@ -25,7 +25,6 @@
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
-import android.os.UserHandle;
import android.text.Editable;
import android.text.InputType;
import android.text.Selection;
@@ -40,6 +39,7 @@
import android.view.ViewGroup;
import android.view.inputmethod.EditorInfo;
import android.widget.Button;
+import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.TextView.OnEditorActionListener;
@@ -50,6 +50,7 @@
import com.android.internal.widget.PasswordEntryKeyboardView;
import com.android.internal.widget.TextViewInputDisabler;
import com.android.settings.notification.RedactionInterstitial;
+import com.android.setupwizardlib.GlifLayout;
public class ChooseLockPassword extends SettingsActivity {
public static final String PASSWORD_MIN_KEY = "lockscreen.password_min";
@@ -143,6 +144,8 @@
super.onCreate(savedInstanceState);
CharSequence msg = getText(R.string.lockpassword_choose_your_password_header);
setTitle(msg);
+ LinearLayout layout = (LinearLayout) findViewById(R.id.content_parent);
+ layout.setFitsSystemWindows(false);
}
public static class ChooseLockPasswordFragment extends InstrumentedFragment
@@ -287,7 +290,10 @@
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
- return inflater.inflate(R.layout.choose_lock_password, container, false);
+ GlifLayout layout = (GlifLayout) inflater.inflate(
+ R.layout.choose_lock_password, container, false);
+ layout.setHeaderText(getActivity().getTitle());
+ return layout;
}
@Override
diff --git a/src/com/android/settings/ChooseLockPattern.java b/src/com/android/settings/ChooseLockPattern.java
index 2e9f767..59fa2c7 100644
--- a/src/com/android/settings/ChooseLockPattern.java
+++ b/src/com/android/settings/ChooseLockPattern.java
@@ -21,12 +21,12 @@
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
-import android.os.UserHandle;
import android.util.Log;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
+import android.widget.LinearLayout;
import android.widget.TextView;
import com.android.internal.logging.MetricsProto.MetricsEvent;
@@ -37,6 +37,7 @@
import com.android.internal.widget.LockPatternView.Cell;
import com.android.internal.widget.LockPatternView.DisplayMode;
import com.android.settings.notification.RedactionInterstitial;
+import com.android.setupwizardlib.GlifLayout;
import com.google.android.collect.Lists;
import java.util.ArrayList;
@@ -113,6 +114,8 @@
super.onCreate(savedInstanceState);
CharSequence msg = getText(R.string.lockpassword_choose_your_pattern_header);
setTitle(msg);
+ LinearLayout layout = (LinearLayout) findViewById(R.id.content_parent);
+ layout.setFitsSystemWindows(false);
}
@Override
@@ -391,7 +394,10 @@
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
- return inflater.inflate(R.layout.choose_lock_pattern, container, false);
+ final GlifLayout layout = (GlifLayout) inflater.inflate(
+ R.layout.choose_lock_pattern, container, false);
+ layout.setHeaderText(getActivity().getTitle());
+ return layout;
}
@Override
diff --git a/src/com/android/settings/CollapsibleCheckboxPreferenceGroup.java b/src/com/android/settings/CollapsibleCheckboxPreferenceGroup.java
new file mode 100644
index 0000000..a0f9d98
--- /dev/null
+++ b/src/com/android/settings/CollapsibleCheckboxPreferenceGroup.java
@@ -0,0 +1,147 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings;
+
+import android.content.Context;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceGroup;
+import android.support.v7.preference.PreferenceViewHolder;
+import android.util.AttributeSet;
+
+import android.util.Log;
+import android.util.TypedValue;
+import android.view.View;
+import android.widget.Checkable;
+import android.widget.TextView;
+
+import java.util.LinkedHashMap;
+
+/**
+ * CollapsibleCheckboxPreferenceGroup is a preference group that can be expanded or collapsed and
+ * also has a checkbox.
+ */
+public class CollapsibleCheckboxPreferenceGroup extends PreferenceGroup implements
+ View.OnClickListener {
+ private boolean mCollapsed;
+ private boolean mChecked;
+
+ public CollapsibleCheckboxPreferenceGroup(Context context) {
+ this(context, null);
+ }
+
+ public CollapsibleCheckboxPreferenceGroup(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ setWidgetLayoutResource(com.android.settings.R.layout.preference_widget_checkbox);
+ }
+
+ @Override
+ public void onBindViewHolder(PreferenceViewHolder holder) {
+ super.onBindViewHolder(holder);
+ View checkbox = holder.findViewById(com.android.internal.R.id.checkbox);
+ if (checkbox != null && checkbox instanceof Checkable) {
+ ((Checkable) checkbox).setChecked(mChecked);
+ checkbox.setClickable(true);
+ checkbox.setFocusable(true);
+ checkbox.setOnClickListener(this);
+ }
+
+ final TextView titleView = (TextView) holder.findViewById(android.R.id.title);
+ if (titleView != null) {
+ Context context = getContext();
+ TypedValue value = new TypedValue();
+ context.getTheme().resolveAttribute(android.R.attr.colorAccent, value, true);
+ titleView.setTextColor(context.getColor(value.resourceId));
+ }
+ }
+
+ @Override
+ public boolean addPreference(Preference p) {
+ super.addPreference(p);
+ p.setVisible(!isCollapsed());
+ return true;
+ }
+
+ // The preference click handler.
+ @Override
+ protected void onClick() {
+ super.onClick();
+ setCollapse(!isCollapsed());
+ }
+
+ // The checkbox view click handler.
+ @Override
+ public void onClick(View v) {
+ setChecked(!isChecked());
+ }
+
+ /**
+ * Return if the view is collapsed.
+ */
+ public boolean isCollapsed() {
+ return mCollapsed;
+ }
+
+ /**
+ * Returns the checked state of the preference.
+ */
+ public boolean isChecked() {
+ return mChecked;
+ }
+
+ /**
+ * Sets the checked state and notifies listeners of the state change.
+ */
+ public void setChecked(boolean checked) {
+ if (mChecked != checked) {
+ mChecked = checked;
+
+ callChangeListener(checked);
+ notifyDependencyChange(shouldDisableDependents());
+ notifyChanged();
+ }
+ }
+
+ private void setCollapse(boolean isCollapsed) {
+ if (mCollapsed == isCollapsed) {
+ return;
+ }
+
+ mCollapsed = isCollapsed;
+ if (isCollapsed) {
+ hideDropdownPreferences();
+ } else {
+ showDropdownPreferences();
+ }
+ }
+
+ private void showDropdownPreferences() {
+ setAllPreferencesVisibility(true);
+ setIcon(R.drawable.ic_keyboard_arrow_down_black_32);
+ }
+
+ private void hideDropdownPreferences() {
+ setAllPreferencesVisibility(false);
+ setIcon(R.drawable.ic_keyboard_arrow_up_black_32);
+ }
+
+ private void setAllPreferencesVisibility(boolean visible) {
+ for (int i = 0; i < getPreferenceCount(); i++) {
+ Preference p = getPreference(i);
+ p.setVisible(visible);
+ }
+ }
+}
diff --git a/src/com/android/settings/DeletionPreference.java b/src/com/android/settings/DeletionPreference.java
new file mode 100644
index 0000000..93d76e6
--- /dev/null
+++ b/src/com/android/settings/DeletionPreference.java
@@ -0,0 +1,117 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings;
+
+import android.content.Context;
+import android.content.res.Resources;
+import android.graphics.drawable.Drawable;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.Preference.OnPreferenceChangeListener;
+import android.support.v7.preference.CheckBoxPreference;
+import android.support.v7.preference.PreferenceViewHolder;
+import android.util.AttributeSet;
+import android.util.TypedValue;
+import android.text.format.Formatter;
+import android.widget.TextView;
+import com.android.settings.deletionhelper.DeletionType;
+
+/**
+ * Preference to handle the deletion of various data types in the Deletion Helper.
+ */
+public abstract class DeletionPreference extends CheckBoxPreference implements
+ DeletionType.FreeableChangedListener, OnPreferenceChangeListener {
+ private DeletionType.FreeableChangedListener mListener;
+ private boolean mChecked;
+ private long mFreeableBytes;
+ private int mFreeableItems;
+ private DeletionType mDeletionService;
+
+ public DeletionPreference(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ setOnPreferenceChangeListener(this);
+ }
+
+ @Override
+ public void onBindViewHolder(PreferenceViewHolder holder) {
+ super.onBindViewHolder(holder);
+ final TextView titleView = (TextView) holder.findViewById(android.R.id.title);
+ if (titleView != null) {
+ titleView.setTextColor(getTintColor(getContext()));
+ }
+ }
+
+ /**
+ * Returns the number of bytes which can be cleared by the deletion service.
+ * @return The number of bytes.
+ */
+ public long getFreeableBytes() {
+ return mChecked ? mFreeableBytes : 0;
+ }
+
+ /**
+ * Register a listener to be called back on when the freeable bytes have changed.
+ * @param listener The callback listener.
+ */
+ public void registerFreeableChangedListener(DeletionType.FreeableChangedListener listener) {
+ mListener = listener;
+ }
+
+ /**
+ * Registers a deletion service to update the preference's information.
+ * @param deletionService A photo/video deletion service.
+ */
+ public void registerDeletionService(DeletionType deletionService) {
+ mDeletionService = deletionService;
+ if (mDeletionService != null) {
+ mDeletionService.registerFreeableChangedListener(this);
+ }
+ }
+
+ /**
+ * Returns the deletion service powering the preference.
+ * @return The deletion service.
+ */
+ public DeletionType getDeletionService() {
+ return mDeletionService;
+ }
+
+ @Override
+ public void onFreeableChanged(int numItems, long freeableBytes) {
+ mFreeableItems = numItems;
+ mFreeableBytes = freeableBytes;
+ maybeUpdateListener();
+ }
+
+ @Override
+ public boolean onPreferenceChange(Preference preference, Object newValue) {
+ mChecked = (boolean) newValue;
+ maybeUpdateListener();
+ return true;
+ }
+
+ private int getTintColor(Context context) {
+ TypedValue value = new TypedValue();
+ context.getTheme().resolveAttribute(android.R.attr.colorAccent, value, true);
+ return context.getColor(value.resourceId);
+ }
+
+ private void maybeUpdateListener() {
+ if (mListener != null) {
+ mListener.onFreeableChanged(mFreeableItems, getFreeableBytes());
+ }
+ }
+}
diff --git a/src/com/android/settings/DevelopmentSettings.java b/src/com/android/settings/DevelopmentSettings.java
index 305592e..6405215 100644
--- a/src/com/android/settings/DevelopmentSettings.java
+++ b/src/com/android/settings/DevelopmentSettings.java
@@ -243,7 +243,7 @@
private SwitchPreference mBugreportInPower;
private RestrictedSwitchPreference mKeepScreenOn;
private SwitchPreference mBtHciSnoopLog;
- private SwitchPreference mEnableOemUnlock;
+ private RestrictedSwitchPreference mEnableOemUnlock;
private SwitchPreference mDebugViewAttributes;
private SwitchPreference mForceAllowOnExternal;
@@ -379,7 +379,7 @@
mBugreportInPower = findAndInitSwitchPref(BUGREPORT_IN_POWER_KEY);
mKeepScreenOn = (RestrictedSwitchPreference) findAndInitSwitchPref(KEEP_SCREEN_ON);
mBtHciSnoopLog = findAndInitSwitchPref(BT_HCI_SNOOP_LOG);
- mEnableOemUnlock = findAndInitSwitchPref(ENABLE_OEM_UNLOCK);
+ mEnableOemUnlock = (RestrictedSwitchPreference) findAndInitSwitchPref(ENABLE_OEM_UNLOCK);
if (!showEnableOemUnlockPreference()) {
removePreference(mEnableOemUnlock);
mEnableOemUnlock = null;
@@ -1032,12 +1032,28 @@
flashLockState = mOemUnlockManager.getFlashLockState();
}
- return flashLockState != PersistentDataBlockManager.FLASH_LOCK_UNLOCKED;
+ return flashLockState != PersistentDataBlockManager.FLASH_LOCK_UNLOCKED
+ && Settings.Global.getInt(getActivity().getContentResolver(),
+ Settings.Global.OEM_UNLOCK_DISALLOWED, 0) == 0;
}
private void updateOemUnlockOptions() {
if (mEnableOemUnlock != null) {
+ // Showing mEnableOemUnlock preference as device has persistent data block.
+ mEnableOemUnlock.setDisabledByAdmin(null);
mEnableOemUnlock.setEnabled(enableOemUnlockPreference());
+ if (mEnableOemUnlock.isEnabled()) {
+ // mEnableOemUnlock is enabled as device's flash lock is unlocked.
+ if (RestrictedLockUtils.hasBaseUserRestriction(getActivity(),
+ UserManager.DISALLOW_FACTORY_RESET, UserHandle.myUserId())) {
+ // Set mEnableOemUnlock to disabled as restriction is set, but not by admin.
+ mEnableOemUnlock.setEnabled(false);
+ } else {
+ // Check restriction, disable mEnableOemUnlock and apply policy transparency.
+ mEnableOemUnlock
+ .checkRestrictionAndSetDisabled(UserManager.DISALLOW_FACTORY_RESET);
+ }
+ }
}
}
diff --git a/src/com/android/settings/DeviceInfoSettings.java b/src/com/android/settings/DeviceInfoSettings.java
index ff7334b..19c4a3f 100644
--- a/src/com/android/settings/DeviceInfoSettings.java
+++ b/src/com/android/settings/DeviceInfoSettings.java
@@ -175,14 +175,12 @@
// Remove manual entry if none present.
removePreferenceIfBoolFalse(KEY_MANUAL, R.bool.config_show_manual);
- // Remove regulatory information if none present.
- final Intent intent = new Intent(Settings.ACTION_SHOW_REGULATORY_INFO);
- if (getPackageManager().queryIntentActivities(intent, 0).isEmpty()) {
- Preference pref = findPreference(KEY_REGULATORY_INFO);
- if (pref != null) {
- getPreferenceScreen().removePreference(pref);
- }
- }
+ // Remove regulatory labels if no activity present to handle intent.
+ removePreferenceIfActivityMissing(
+ KEY_REGULATORY_INFO, Settings.ACTION_SHOW_REGULATORY_INFO);
+
+ removePreferenceIfActivityMissing(
+ "safety_info", "android.settings.SHOW_SAFETY_AND_REGULATORY_INFO");
}
@Override
@@ -327,6 +325,16 @@
}
}
+ private void removePreferenceIfActivityMissing(String preferenceKey, String action) {
+ final Intent intent = new Intent(action);
+ if (getPackageManager().queryIntentActivities(intent, 0).isEmpty()) {
+ Preference pref = findPreference(preferenceKey);
+ if (pref != null) {
+ getPreferenceScreen().removePreference(pref);
+ }
+ }
+ }
+
private void removePreferenceIfBoolFalse(String preference, int resId) {
if (!getResources().getBoolean(resId)) {
Preference pref = findPreference(preference);
diff --git a/src/com/android/settings/DisplaySettings.java b/src/com/android/settings/DisplaySettings.java
index 8e389a9..bb10570 100644
--- a/src/com/android/settings/DisplaySettings.java
+++ b/src/com/android/settings/DisplaySettings.java
@@ -57,7 +57,6 @@
import java.util.ArrayList;
import java.util.List;
-import static android.provider.Settings.Secure.CAMERA_DOUBLE_TAP_POWER_GESTURE_DISABLED;
import static android.provider.Settings.Secure.CAMERA_GESTURE_DISABLED;
import static android.provider.Settings.Secure.DOUBLE_TAP_TO_WAKE;
import static android.provider.Settings.Secure.DOZE_ENABLED;
@@ -86,8 +85,6 @@
private static final String KEY_AUTO_ROTATE = "auto_rotate";
private static final String KEY_NIGHT_MODE = "night_mode";
private static final String KEY_CAMERA_GESTURE = "camera_gesture";
- private static final String KEY_CAMERA_DOUBLE_TAP_POWER_GESTURE
- = "camera_double_tap_power_gesture";
private static final String KEY_WALLPAPER = "wallpaper";
private static final String KEY_VR_DISPLAY_PREF = "vr_display_pref";
@@ -97,11 +94,9 @@
private ListPreference mNightModePreference;
private Preference mScreenSaverPreference;
private SwitchPreference mLiftToWakePreference;
- private SwitchPreference mDozePreference;
private SwitchPreference mTapToWakePreference;
private SwitchPreference mAutoBrightnessPreference;
private SwitchPreference mCameraGesturePreference;
- private SwitchPreference mCameraDoubleTapPowerGesturePreference;
@Override
protected int getMetricsCategory() {
@@ -141,10 +136,7 @@
removePreference(KEY_LIFT_TO_WAKE);
}
- if (isDozeAvailable(activity)) {
- mDozePreference = (SwitchPreference) findPreference(KEY_DOZE);
- mDozePreference.setOnPreferenceChangeListener(this);
- } else {
+ if (!isDozeAvailable(activity)) {
removePreference(KEY_DOZE);
}
@@ -162,14 +154,6 @@
removePreference(KEY_CAMERA_GESTURE);
}
- if (isCameraDoubleTapPowerGestureAvailable(getResources())) {
- mCameraDoubleTapPowerGesturePreference
- = (SwitchPreference) findPreference(KEY_CAMERA_DOUBLE_TAP_POWER_GESTURE);
- mCameraDoubleTapPowerGesturePreference.setOnPreferenceChangeListener(this);
- } else {
- removePreference(KEY_CAMERA_DOUBLE_TAP_POWER_GESTURE);
- }
-
if (RotationPolicy.isRotationLockToggleVisible(activity)) {
DropDownPreference rotatePreference =
(DropDownPreference) findPreference(KEY_AUTO_ROTATE);
@@ -288,11 +272,6 @@
!SystemProperties.getBoolean("gesture.disable_camera_launch", false);
}
- private static boolean isCameraDoubleTapPowerGestureAvailable(Resources res) {
- return res.getBoolean(
- com.android.internal.R.bool.config_cameraDoubleTapPowerGestureEnabled);
- }
-
private static boolean isVrDisplayModeAvailable(Context context) {
PackageManager pm = context.getPackageManager();
return pm.hasSystemFeature(PackageManager.FEATURE_VR_MODE_HIGH_PERFORMANCE);
@@ -365,12 +344,6 @@
mLiftToWakePreference.setChecked(value != 0);
}
- // Update doze if it is available.
- if (mDozePreference != null) {
- int value = Settings.Secure.getInt(getContentResolver(), DOZE_ENABLED, 1);
- mDozePreference.setChecked(value != 0);
- }
-
// Update tap to wake if it is available.
if (mTapToWakePreference != null) {
int value = Settings.Secure.getInt(getContentResolver(), DOUBLE_TAP_TO_WAKE, 0);
@@ -382,13 +355,6 @@
int value = Settings.Secure.getInt(getContentResolver(), CAMERA_GESTURE_DISABLED, 0);
mCameraGesturePreference.setChecked(value == 0);
}
-
- // Update camera gesture #2 if it is available.
- if (mCameraDoubleTapPowerGesturePreference != null) {
- int value = Settings.Secure.getInt(
- getContentResolver(), CAMERA_DOUBLE_TAP_POWER_GESTURE_DISABLED, 0);
- mCameraDoubleTapPowerGesturePreference.setChecked(value == 0);
- }
}
private void updateScreenSaverSummary() {
@@ -431,10 +397,6 @@
boolean value = (Boolean) objValue;
Settings.Secure.putInt(getContentResolver(), WAKE_GESTURE_ENABLED, value ? 1 : 0);
}
- if (preference == mDozePreference) {
- boolean value = (Boolean) objValue;
- Settings.Secure.putInt(getContentResolver(), DOZE_ENABLED, value ? 1 : 0);
- }
if (preference == mTapToWakePreference) {
boolean value = (Boolean) objValue;
Settings.Secure.putInt(getContentResolver(), DOUBLE_TAP_TO_WAKE, value ? 1 : 0);
@@ -444,11 +406,6 @@
Settings.Secure.putInt(getContentResolver(), CAMERA_GESTURE_DISABLED,
value ? 0 : 1 /* Backwards because setting is for disabling */);
}
- if (preference == mCameraDoubleTapPowerGesturePreference) {
- boolean value = (Boolean) objValue;
- Settings.Secure.putInt(getContentResolver(), CAMERA_DOUBLE_TAP_POWER_GESTURE_DISABLED,
- value ? 0 : 1 /* Backwards because setting is for disabling */);
- }
if (preference == mNightModePreference) {
try {
final int value = Integer.parseInt((String) objValue);
@@ -554,9 +511,6 @@
if (!isCameraGestureAvailable(context.getResources())) {
result.add(KEY_CAMERA_GESTURE);
}
- if (!isCameraDoubleTapPowerGestureAvailable(context.getResources())) {
- result.add(KEY_CAMERA_DOUBLE_TAP_POWER_GESTURE);
- }
if (!isVrDisplayModeAvailable(context)) {
result.add(KEY_VR_DISPLAY_PREF);
}
diff --git a/src/com/android/settings/EncryptionInterstitial.java b/src/com/android/settings/EncryptionInterstitial.java
index e9e2a7c..d34b456 100644
--- a/src/com/android/settings/EncryptionInterstitial.java
+++ b/src/com/android/settings/EncryptionInterstitial.java
@@ -23,19 +23,26 @@
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
+import android.content.res.Resources;
import android.os.Bundle;
import android.support.v7.preference.Preference;
+import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
import android.view.accessibility.AccessibilityManager;
+import android.widget.LinearLayout;
import android.widget.TextView;
import com.android.internal.logging.MetricsProto.MetricsEvent;
+import com.android.settings.utils.SettingsDividerItemDecoration;
+import com.android.setupwizardlib.GlifPreferenceLayout;
import java.util.List;
public class EncryptionInterstitial extends SettingsActivity {
- private final static String TAG = EncryptionInterstitial.class.getSimpleName();
+ private static final String TAG = EncryptionInterstitial.class.getSimpleName();
protected static final String EXTRA_PASSWORD_QUALITY = "extra_password_quality";
protected static final String EXTRA_UNLOCK_METHOD_INTENT = "extra_unlock_method_intent";
@@ -63,6 +70,13 @@
.putExtra(EXTRA_UNLOCK_METHOD_INTENT, unlockMethodIntent);
}
+ @Override
+ protected void onCreate(Bundle savedInstance) {
+ super.onCreate(savedInstance);
+ LinearLayout layout = (LinearLayout) findViewById(R.id.content_parent);
+ layout.setFitsSystemWindows(false);
+ }
+
public static class EncryptionInterstitialFragment extends SettingsPreferenceFragment
implements DialogInterface.OnClickListener {
@@ -126,7 +140,8 @@
disableId = R.string.encrypt_dont_require_password;
break;
}
- TextView message = createHeaderView();
+ TextView message = (TextView) LayoutInflater.from(getActivity()).inflate(
+ R.layout.encryption_interstitial_header, null, false);
message.setText(msgId);
setHeaderView(message);
@@ -138,10 +153,25 @@
EXTRA_REQUIRE_PASSWORD, true));
}
- protected TextView createHeaderView() {
- TextView message = (TextView) LayoutInflater.from(getActivity()).inflate(
- R.layout.encryption_interstitial_header, null, false);
- return message;
+ @Override
+ public void onViewCreated(View view, Bundle savedInstanceState) {
+ super.onViewCreated(view, savedInstanceState);
+ GlifPreferenceLayout layout = (GlifPreferenceLayout) view;
+ layout.setDividerItemDecoration(new SettingsDividerItemDecoration(getContext()));
+
+ layout.setIcon(getContext().getDrawable(R.drawable.ic_lock));
+ layout.setHeaderText(getActivity().getTitle());
+
+ // Use the dividers in SetupWizardRecyclerLayout. Suppress the dividers in
+ // PreferenceFragment.
+ setDivider(null);
+ }
+
+ @Override
+ public RecyclerView onCreateRecyclerView(LayoutInflater inflater, ViewGroup parent,
+ Bundle savedInstanceState) {
+ GlifPreferenceLayout layout = (GlifPreferenceLayout) parent;
+ return layout.onCreateRecyclerView(inflater, parent, savedInstanceState);
}
protected void startLockIntent() {
diff --git a/src/com/android/settings/InstrumentedFragment.java b/src/com/android/settings/InstrumentedFragment.java
index 0e3528a..8bab2cf 100644
--- a/src/com/android/settings/InstrumentedFragment.java
+++ b/src/com/android/settings/InstrumentedFragment.java
@@ -16,11 +16,11 @@
package com.android.settings;
-import com.android.internal.logging.MetricsLogger;
-
import android.os.Bundle;
import android.support.v14.preference.PreferenceFragment;
+import com.android.internal.logging.MetricsLogger;
+
/**
* Instrumented fragment that logs visibility state.
*/
diff --git a/src/com/android/settings/PhotosDeletionPreference.java b/src/com/android/settings/PhotosDeletionPreference.java
new file mode 100644
index 0000000..643b3f1
--- /dev/null
+++ b/src/com/android/settings/PhotosDeletionPreference.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings;
+
+import android.content.Context;
+import android.content.res.Resources;
+import android.graphics.drawable.Drawable;
+import android.util.AttributeSet;
+import android.text.format.Formatter;
+
+/**
+ * Preference to handle the deletion of photos and videos in the Deletion Helper.
+ */
+public class PhotosDeletionPreference extends DeletionPreference {
+ public static final int DAYS_TO_KEEP = 30;
+
+ public PhotosDeletionPreference(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ setIcon(getIcon(context));
+ updatePreferenceText(0, 0);
+ }
+
+ /**
+ * Updates the title and summary of the preference with fresh information.
+ */
+ public void updatePreferenceText(int items, long bytes) {
+ Context context = getContext();
+ setTitle(context.getString(R.string.deletion_helper_photos_title, items));
+ setSummary(context.getString(R.string.deletion_helper_photos_summary,
+ Formatter.formatFileSize(context, bytes), DAYS_TO_KEEP));
+ }
+
+ @Override
+ public void onFreeableChanged(int items, long bytes) {
+ super.onFreeableChanged(items, bytes);
+ updatePreferenceText(items, bytes);
+ }
+
+ private Drawable getIcon(Context context) {
+ final Drawable iconDrawable;
+ try {
+ Resources resources = context.getResources();
+ final int resId = resources.getIdentifier("ic_photos_black_24", "drawable",
+ context.getPackageName());
+ iconDrawable = context.getDrawable(resId);
+ } catch (Resources.NotFoundException e) {
+ return null;
+ }
+ return iconDrawable;
+ }
+}
diff --git a/src/com/android/settings/PrivacySettings.java b/src/com/android/settings/PrivacySettings.java
index 7732837..9a2d14a 100644
--- a/src/com/android/settings/PrivacySettings.java
+++ b/src/com/android/settings/PrivacySettings.java
@@ -61,7 +61,6 @@
private static final String CONFIGURE_ACCOUNT = "configure_account";
private static final String DATA_MANAGEMENT = "data_management";
private static final String BACKUP_INACTIVE = "backup_inactive";
- private static final String NETWORK_RESET = "network_reset";
private static final String FACTORY_RESET = "factory_reset";
private static final String TAG = "PrivacySettings";
private IBackupManager mBackupManager;
@@ -331,9 +330,5 @@
UserManager.DISALLOW_FACTORY_RESET, UserHandle.myUserId())) {
nonVisibleKeys.add(FACTORY_RESET);
}
- if (RestrictedLockUtils.hasBaseUserRestriction(context,
- UserManager.DISALLOW_NETWORK_RESET, UserHandle.myUserId())) {
- nonVisibleKeys.add(NETWORK_RESET);
- }
}
}
diff --git a/src/com/android/settings/RegulatoryInfoDisplayActivity.java b/src/com/android/settings/RegulatoryInfoDisplayActivity.java
index c674f13..fd94b67 100644
--- a/src/com/android/settings/RegulatoryInfoDisplayActivity.java
+++ b/src/com/android/settings/RegulatoryInfoDisplayActivity.java
@@ -56,7 +56,7 @@
}
AlertDialog.Builder builder = new AlertDialog.Builder(this)
- .setTitle(R.string.regulatory_information)
+ .setTitle(R.string.regulatory_labels)
.setOnDismissListener(this);
boolean regulatoryInfoDrawableExists = false;
diff --git a/src/com/android/settings/Settings.java b/src/com/android/settings/Settings.java
index 3c589cc..2e8d399 100644
--- a/src/com/android/settings/Settings.java
+++ b/src/com/android/settings/Settings.java
@@ -84,6 +84,7 @@
public static class AccountSyncSettingsActivity extends SettingsActivity { /* empty */ }
public static class AccountSettingsActivity extends SettingsActivity { /* empty */ }
public static class AccountSyncSettingsInAddAccountActivity extends SettingsActivity { /* empty */ }
+ public static class GestureSettingsActivity extends SettingsActivity { /* empty */ }
public static class CryptKeeperSettingsActivity extends SettingsActivity { /* empty */ }
public static class DeviceAdminSettingsActivity extends SettingsActivity { /* empty */ }
public static class DataUsageSummaryActivity extends SettingsActivity { /* empty */ }
@@ -131,7 +132,6 @@
public static class WifiCallingSuggestionActivity extends SettingsActivity { /* empty */ }
public static class ZenModeAutomationSuggestionActivity extends SettingsActivity { /* empty */ }
- public static class WallpaperSuggestionActivity extends SettingsActivity { /* empty */ }
public static class FingerprintSuggestionActivity extends FingerprintSettings { /* empty */ }
public static class FingerprintEnrollSuggestionActivity extends FingerprintEnrollIntroduction {
/* empty */
@@ -139,6 +139,7 @@
public static class ScreenLockSuggestionActivity extends ChooseLockGeneric { /* empty */ }
public static class WallpaperSettingsActivity extends SettingsActivity { /* empty */ }
public static class ManagedProfileSettingsActivity extends SettingsActivity { /* empty */ }
+ public static class DeletionHelperActivity extends SettingsActivity { /* empty */ }
public static class ApnEditorActivity extends SettingsActivity { /* empty */ }
public static class ChooseAccountActivity extends SettingsActivity { /* empty */ }
diff --git a/src/com/android/settings/SettingsActivity.java b/src/com/android/settings/SettingsActivity.java
index c597d16..8b21697 100644
--- a/src/com/android/settings/SettingsActivity.java
+++ b/src/com/android/settings/SettingsActivity.java
@@ -49,6 +49,7 @@
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.SearchView;
+
import com.android.internal.util.ArrayUtils;
import com.android.settings.Settings.WifiSettingsActivity;
import com.android.settings.accessibility.AccessibilitySettings;
@@ -70,9 +71,10 @@
import com.android.settings.applications.WriteSettingsDetails;
import com.android.settings.applications.VrListenerSettings;
import com.android.settings.bluetooth.BluetoothSettings;
-import com.android.settings.dashboard.DashboardSummary;
+import com.android.settings.dashboard.DashboardContainerFragment;
import com.android.settings.dashboard.SearchResultsSummary;
import com.android.settings.datausage.DataUsageSummary;
+import com.android.settings.deletionhelper.DeletionHelperFragment;
import com.android.settings.deviceinfo.ImeiInformation;
import com.android.settings.deviceinfo.PrivateVolumeForget;
import com.android.settings.deviceinfo.PrivateVolumeSettings;
@@ -83,6 +85,7 @@
import com.android.settings.fuelgauge.BatterySaverSettings;
import com.android.settings.fuelgauge.PowerUsageDetail;
import com.android.settings.fuelgauge.PowerUsageSummary;
+import com.android.settings.gestures.GestureSettings;
import com.android.settings.inputmethod.AvailableVirtualKeyboardFragment;
import com.android.settings.inputmethod.InputMethodAndLanguageSettings;
import com.android.settings.inputmethod.KeyboardLayoutPickerFragment;
@@ -107,6 +110,7 @@
import com.android.settings.notification.ZenModeScheduleRuleSettings;
import com.android.settings.notification.ZenModeSettings;
import com.android.settings.notification.ZenModeVisualInterruptionSettings;
+import com.android.settings.overlay.FeatureFactory;
import com.android.settings.print.PrintJobSettingsFragment;
import com.android.settings.print.PrintSettingsFragment;
import com.android.settings.qstile.DevelopmentTiles;
@@ -239,6 +243,7 @@
Settings.StorageSettingsActivity.class.getName(),
Settings.ManageApplicationsActivity.class.getName(),
Settings.PowerUsageSummaryActivity.class.getName(),
+ Settings.GestureSettingsActivity.class.getName(),
//personal_section
Settings.LocationSettingsActivity.class.getName(),
Settings.SecuritySettingsActivity.class.getName(),
@@ -298,6 +303,7 @@
PowerUsageSummary.class.getName(),
AccountSyncSettings.class.getName(),
AccountSettings.class.getName(),
+ GestureSettings.class.getName(),
CryptKeeperSettings.class.getName(),
DataUsageSummary.class.getName(),
DreamSettings.class.getName(),
@@ -337,6 +343,7 @@
WallpaperTypeSettings.class.getName(),
VrListenerSettings.class.getName(),
ManagedProfileSettings.class.getName(),
+ DeletionHelperFragment.class.getName(),
ChooseAccountActivity.class.getName(),
IccLockSettings.class.getName(),
ImeiInformation.class.getName(),
@@ -396,7 +403,6 @@
private boolean mIsShowingDashboard;
private boolean mIsShortcut;
- private int mMainContentId = R.id.main_content;
private ViewGroup mContent;
private SearchView mSearchView;
@@ -421,12 +427,7 @@
@Override
public boolean onPreferenceStartFragment(PreferenceFragment caller, Preference pref) {
- // Override the fragment title for Wallpaper settings
- CharSequence title = pref.getTitle();
- if (pref.getFragment().equals(WallpaperTypeSettings.class.getName())) {
- title = getString(R.string.wallpaper_settings_fragment_title);
- }
- startPreferencePanel(pref.getFragment(), pref.getExtras(), -1, title,
+ startPreferencePanel(pref.getFragment(), pref.getExtras(), -1, pref.getTitle(),
null, 0);
return true;
}
@@ -443,6 +444,15 @@
}
@Override
+ protected void onStart() {
+ super.onStart();
+
+ if (mNeedToRevertToInitialFragment) {
+ revertToInitialFragment();
+ }
+ }
+
+ @Override
public boolean onCreateOptionsMenu(Menu menu) {
if (!mDisplaySearch) {
return false;
@@ -565,7 +575,7 @@
setContentView(mIsShowingDashboard ?
R.layout.settings_main_dashboard : R.layout.settings_main_prefs);
- mContent = (ViewGroup) findViewById(mMainContentId);
+ mContent = (ViewGroup) findViewById(R.id.main_content);
getFragmentManager().addOnBackStackChangedListener(this);
@@ -621,7 +631,7 @@
// Show Search affordance
mDisplaySearch = true;
mInitialTitleResId = R.string.dashboard_title;
- switchToFragment(DashboardSummary.class.getName(), null, false, false,
+ switchToFragment(DashboardContainerFragment.class.getName(), null, false, false,
mInitialTitleResId, mInitialTitle, false);
}
}
@@ -694,14 +704,6 @@
+ " ms");
}
- /**
- * Sets the id of the view continaing the main content. Should be called before calling super's
- * onCreate.
- */
- protected void setMainContentId(int contentId) {
- mMainContentId = contentId;
- }
-
private void setTitleFromIntent(Intent intent) {
final int initialTitleResId = intent.getIntExtra(EXTRA_SHOW_FRAGMENT_TITLE_RESID, -1);
if (initialTitleResId > 0) {
@@ -737,7 +739,7 @@
setTitleFromBackStack();
}
- private int setTitleFromBackStack() {
+ private void setTitleFromBackStack() {
final int count = getFragmentManager().getBackStackEntryCount();
if (count == 0) {
@@ -746,13 +748,11 @@
} else {
setTitle(mInitialTitle);
}
- return 0;
+ return;
}
FragmentManager.BackStackEntry bse = getFragmentManager().getBackStackEntryAt(count - 1);
setTitleFromBackStackEntry(bse);
-
- return count;
}
private void setTitleFromBackStackEntry(FragmentManager.BackStackEntry bse) {
@@ -794,12 +794,8 @@
}
@Override
- protected void onStart() {
- super.onStart();
-
- if (mNeedToRevertToInitialFragment) {
- revertToInitialFragment();
- }
+ protected void onResume() {
+ super.onResume();
mDevelopmentPreferencesListener = new SharedPreferences.OnSharedPreferenceChangeListener() {
@Override
@@ -823,8 +819,8 @@
}
@Override
- protected void onStop() {
- super.onStop();
+ protected void onPause() {
+ super.onPause();
unregisterReceiver(mBatteryInfoReceiver);
unregisterReceiver(mUserAddRemoveReceiver);
mDynamicIndexableContentMonitor.unregister();
@@ -988,7 +984,7 @@
*/
public void startPreferenceFragment(Fragment fragment, boolean push) {
FragmentTransaction transaction = getFragmentManager().beginTransaction();
- transaction.replace(mMainContentId, fragment);
+ transaction.replace(R.id.main_content, fragment);
if (push) {
transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
transaction.addToBackStack(BACK_STACK_PREFS);
@@ -1009,7 +1005,7 @@
}
Fragment f = Fragment.instantiate(this, fragmentName, args);
FragmentTransaction transaction = getFragmentManager().beginTransaction();
- transaction.replace(mMainContentId, f);
+ transaction.replace(R.id.main_content, f);
if (withTransition) {
TransitionManager.beginDelayedTransition(mContent);
}
@@ -1199,10 +1195,11 @@
if (mSearchResultsFragment != null) {
return;
}
- Fragment current = getFragmentManager().findFragmentById(mMainContentId);
+ Fragment current = getFragmentManager().findFragmentById(R.id.main_content);
if (current != null && current instanceof SearchResultsSummary) {
mSearchResultsFragment = (SearchResultsSummary) current;
} else {
+ setContentHeaderView(null);
mSearchResultsFragment = (SearchResultsSummary) switchToFragment(
SearchResultsSummary.class.getName(), null, false, true,
R.string.search_results_title, null, true);
diff --git a/src/com/android/settings/SetupChooseLockGeneric.java b/src/com/android/settings/SetupChooseLockGeneric.java
index bc3a2ec..71679f3 100644
--- a/src/com/android/settings/SetupChooseLockGeneric.java
+++ b/src/com/android/settings/SetupChooseLockGeneric.java
@@ -16,7 +16,6 @@
package com.android.settings;
-import android.app.Activity;
import android.app.admin.DevicePolicyManager;
import android.content.ComponentName;
import android.content.Context;
@@ -25,20 +24,18 @@
import android.content.res.Resources;
import android.os.Bundle;
import android.os.UserHandle;
-import android.support.v7.preference.Preference;
import android.support.v14.preference.PreferenceFragment;
+import android.support.v7.preference.Preference;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
-import android.widget.Button;
import android.widget.LinearLayout;
import com.android.internal.widget.LockPatternUtils;
import com.android.settings.fingerprint.SetupSkipDialog;
-import com.android.setupwizardlib.SetupWizardLayout;
-import com.android.setupwizardlib.SetupWizardPreferenceLayout;
-import com.android.setupwizardlib.view.NavigationBar;
+import com.android.settings.utils.SettingsDividerItemDecoration;
+import com.android.setupwizardlib.GlifPreferenceLayout;
/**
* Setup Wizard's version of ChooseLockGeneric screen. It inherits the logic and basic structure
@@ -74,8 +71,7 @@
layout.setFitsSystemWindows(false);
}
- public static class SetupChooseLockGenericFragment extends ChooseLockGenericFragment
- implements NavigationBar.NavigationBarListener {
+ public static class SetupChooseLockGenericFragment extends ChooseLockGenericFragment {
public static final String EXTRA_PASSWORD_QUALITY = ":settings:password_quality";
@@ -83,25 +79,20 @@
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
- SetupWizardUtils.setImmersiveMode(getActivity());
-
- SetupWizardPreferenceLayout layout = (SetupWizardPreferenceLayout) view;
+ GlifPreferenceLayout layout = (GlifPreferenceLayout) view;
+ layout.setDividerItemDecoration(new SettingsDividerItemDecoration(getContext()));
layout.setDividerInset(getContext().getResources().getDimensionPixelSize(
- R.dimen.suw_items_text_divider_inset));
- final NavigationBar navigationBar = layout.getNavigationBar();
- Button nextButton = navigationBar.getNextButton();
- nextButton.setText(null);
- nextButton.setEnabled(false);
- navigationBar.setNavigationBarListener(this);
+ R.dimen.suw_items_glif_text_divider_inset));
- layout.setIllustration(R.drawable.setup_illustration_lock_screen,
- R.drawable.setup_illustration_horizontal_tile);
- if (!mForFingerprint) {
- layout.setHeaderText(R.string.setup_lock_settings_picker_title);
- } else {
- layout.setHeaderText(R.string.lock_settings_picker_title);
+ layout.setIcon(getContext().getDrawable(R.drawable.ic_lock));
+
+ int titleResource = mForFingerprint ?
+ R.string.lock_settings_picker_title : R.string.setup_lock_settings_picker_title;
+ if (getActivity() != null) {
+ getActivity().setTitle(titleResource);
}
+ layout.setHeaderText(titleResource);
// Use the dividers in SetupWizardRecyclerLayout. Suppress the dividers in
// PreferenceFragment.
setDivider(null);
@@ -143,7 +134,7 @@
@Override
public RecyclerView onCreateRecyclerView(LayoutInflater inflater, ViewGroup parent,
Bundle savedInstanceState) {
- SetupWizardPreferenceLayout layout = (SetupWizardPreferenceLayout) parent;
+ GlifPreferenceLayout layout = (GlifPreferenceLayout) parent;
return layout.onCreateRecyclerView(inflater, parent, savedInstanceState);
}
@@ -251,17 +242,5 @@
SetupWizardUtils.copySetupExtras(getActivity().getIntent(), intent);
return intent;
}
-
- @Override
- public void onNavigateBack() {
- Activity activity = getActivity();
- if (activity != null) {
- activity.onBackPressed();
- }
- }
-
- @Override
- public void onNavigateNext() {
- }
}
}
diff --git a/src/com/android/settings/SetupChooseLockPassword.java b/src/com/android/settings/SetupChooseLockPassword.java
index d483d8f..f0a9a26 100644
--- a/src/com/android/settings/SetupChooseLockPassword.java
+++ b/src/com/android/settings/SetupChooseLockPassword.java
@@ -16,21 +16,13 @@
package com.android.settings;
-import android.app.Activity;
import android.app.Fragment;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
import android.widget.LinearLayout;
-import com.android.setupwizardlib.SetupWizardLayout;
-import com.android.setupwizardlib.util.SystemBarHelper;
-import com.android.setupwizardlib.view.NavigationBar;
-
/**
* Setup Wizard's version of ChooseLockPassword screen. It inherits the logic and basic structure
* from ChooseLockPassword class, and should remain similar to that behaviorally. This class should
@@ -91,56 +83,11 @@
super.onApplyThemeResource(theme, resid, first);
}
- public static class SetupChooseLockPasswordFragment extends ChooseLockPasswordFragment
- implements NavigationBar.NavigationBarListener {
-
- private SetupWizardLayout mLayout;
- private NavigationBar mNavigationBar;
-
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
- mLayout = (SetupWizardLayout) inflater.inflate(
- R.layout.setup_choose_lock_password, container, false);
- mNavigationBar = mLayout.getNavigationBar();
- mNavigationBar.setNavigationBarListener(this);
- return mLayout;
- }
-
- @Override
- public void onViewCreated(View view, Bundle savedInstanceState) {
- super.onViewCreated(view, savedInstanceState);
- SystemBarHelper.setImeInsetView(mLayout);
- SetupWizardUtils.setImmersiveMode(getActivity());
- mLayout.setHeaderText(getActivity().getTitle());
- }
+ public static class SetupChooseLockPasswordFragment extends ChooseLockPasswordFragment {
@Override
protected Intent getRedactionInterstitialIntent(Context context) {
return null;
}
-
- @Override
- protected void setNextEnabled(boolean enabled) {
- mNavigationBar.getNextButton().setEnabled(enabled);
- }
-
- @Override
- protected void setNextText(int text) {
- mNavigationBar.getNextButton().setText(text);
- }
-
- @Override
- public void onNavigateBack() {
- final Activity activity = getActivity();
- if (activity != null) {
- activity.onBackPressed();
- }
- }
-
- @Override
- public void onNavigateNext() {
- handleNext();
- }
}
}
diff --git a/src/com/android/settings/SetupChooseLockPattern.java b/src/com/android/settings/SetupChooseLockPattern.java
index 8a7842d..09b951e 100644
--- a/src/com/android/settings/SetupChooseLockPattern.java
+++ b/src/com/android/settings/SetupChooseLockPattern.java
@@ -16,21 +16,11 @@
package com.android.settings;
-import android.app.Activity;
import android.app.Fragment;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
-import android.os.Bundle;
import android.os.UserHandle;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.Button;
-import android.widget.LinearLayout;
-
-import com.android.setupwizardlib.SetupWizardLayout;
-import com.android.setupwizardlib.view.NavigationBar;
/**
* Setup Wizard's version of ChooseLockPattern screen. It inherits the logic and basic structure
@@ -74,99 +64,16 @@
}
@Override
- protected void onCreate(Bundle savedInstance) {
- super.onCreate(savedInstance);
- LinearLayout layout = (LinearLayout) findViewById(R.id.content_parent);
- layout.setFitsSystemWindows(false);
- }
-
- @Override
protected void onApplyThemeResource(Resources.Theme theme, int resid, boolean first) {
resid = SetupWizardUtils.getTheme(getIntent());
super.onApplyThemeResource(theme, resid, first);
}
- public static class SetupChooseLockPatternFragment extends ChooseLockPatternFragment
- implements NavigationBar.NavigationBarListener {
-
- private NavigationBar mNavigationBar;
- private Button mRetryButton;
-
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
- final SetupWizardLayout layout = (SetupWizardLayout) inflater.inflate(
- R.layout.setup_choose_lock_pattern, container, false);
- mNavigationBar = layout.getNavigationBar();
- mNavigationBar.setNavigationBarListener(this);
- layout.setHeaderText(getActivity().getTitle());
- return layout;
- }
-
- @Override
- public void onViewCreated(View view, Bundle savedInstanceState) {
- mRetryButton = (Button) view.findViewById(R.id.retryButton);
- mRetryButton.setOnClickListener(this);
- super.onViewCreated(view, savedInstanceState);
- SetupWizardUtils.setImmersiveMode(getActivity());
- }
+ public static class SetupChooseLockPatternFragment extends ChooseLockPatternFragment {
@Override
protected Intent getRedactionInterstitialIntent(Context context) {
return null;
}
-
- @Override
- public void onClick(View v) {
- if (v == mRetryButton) {
- handleLeftButton();
- } else {
- super.onClick(v);
- }
- }
-
- @Override
- protected void setRightButtonEnabled(boolean enabled) {
- mNavigationBar.getNextButton().setEnabled(enabled);
- }
-
- @Override
- protected void setRightButtonText(int text) {
- mNavigationBar.getNextButton().setText(text);
- }
-
- @Override
- protected void updateStage(Stage stage) {
- super.updateStage(stage);
- // Only enable the button for retry
- mRetryButton.setEnabled(stage == Stage.FirstChoiceValid);
-
- switch (stage) {
- case Introduction:
- case HelpScreen:
- case ChoiceTooShort:
- case FirstChoiceValid:
- mRetryButton.setVisibility(View.VISIBLE);
- break;
- case NeedToConfirm:
- case ConfirmWrong:
- case ChoiceConfirmed:
- mRetryButton.setVisibility(View.INVISIBLE);
- break;
- }
- }
-
- @Override
- public void onNavigateBack() {
- final Activity activity = getActivity();
- if (activity != null) {
- activity.onBackPressed();
- }
- }
-
- @Override
- public void onNavigateNext() {
- handleRightButton();
- }
}
}
diff --git a/src/com/android/settings/SetupEncryptionInterstitial.java b/src/com/android/settings/SetupEncryptionInterstitial.java
index 39c8af1..59e4d07 100644
--- a/src/com/android/settings/SetupEncryptionInterstitial.java
+++ b/src/com/android/settings/SetupEncryptionInterstitial.java
@@ -16,7 +16,6 @@
package com.android.settings;
-import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
@@ -25,13 +24,10 @@
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
-import android.widget.Button;
import android.widget.LinearLayout;
-import android.widget.TextView;
-import com.android.setupwizardlib.SetupWizardLayout;
-import com.android.setupwizardlib.SetupWizardPreferenceLayout;
-import com.android.setupwizardlib.view.NavigationBar;
+import com.android.settings.utils.SettingsDividerItemDecoration;
+import com.android.setupwizardlib.GlifPreferenceLayout;
/**
* Setup Wizard's version of EncryptionInterstitial screen. It inherits the logic and basic
@@ -78,30 +74,19 @@
layout.setFitsSystemWindows(false);
}
- public static class SetupEncryptionInterstitialFragment extends EncryptionInterstitialFragment
- implements NavigationBar.NavigationBarListener {
+ public static class SetupEncryptionInterstitialFragment extends EncryptionInterstitialFragment {
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
- final SetupWizardPreferenceLayout layout = (SetupWizardPreferenceLayout) view;
+ final GlifPreferenceLayout layout = (GlifPreferenceLayout) view;
+ layout.setDividerItemDecoration(new SettingsDividerItemDecoration(getContext()));
layout.setDividerInset(getContext().getResources().getDimensionPixelSize(
- R.dimen.suw_items_icon_divider_inset));
- layout.setIllustration(R.drawable.setup_illustration_lock_screen,
- R.drawable.setup_illustration_horizontal_tile);
-
- final NavigationBar navigationBar = layout.getNavigationBar();
- navigationBar.setNavigationBarListener(this);
- Button nextButton = navigationBar.getNextButton();
- nextButton.setText(null);
- nextButton.setEnabled(false);
+ R.dimen.suw_items_glif_icon_divider_inset));
+ layout.setIcon(getContext().getDrawable(R.drawable.ic_lock));
layout.setHeaderText(R.string.encryption_interstitial_header);
- Activity activity = getActivity();
- if (activity != null) {
- SetupWizardUtils.setImmersiveMode(activity);
- }
// Use the dividers in SetupWizardRecyclerLayout. Suppress the dividers in
// PreferenceFragment.
@@ -109,30 +94,10 @@
}
@Override
- protected TextView createHeaderView() {
- TextView message = (TextView) LayoutInflater.from(getActivity()).inflate(
- R.layout.setup_encryption_interstitial_header, null, false);
- return message;
- }
-
- @Override
public RecyclerView onCreateRecyclerView(LayoutInflater inflater, ViewGroup parent,
Bundle savedInstanceState) {
- SetupWizardPreferenceLayout layout = (SetupWizardPreferenceLayout) parent;
+ GlifPreferenceLayout layout = (GlifPreferenceLayout) parent;
return layout.onCreateRecyclerView(inflater, parent, savedInstanceState);
}
-
- @Override
- public void onNavigateBack() {
- final Activity activity = getActivity();
- if (activity != null) {
- activity.onBackPressed();
- }
- }
-
- @Override
- public void onNavigateNext() {
- // next is handled via the onPreferenceTreeClick method in EncryptionInterstitial
- }
}
}
diff --git a/src/com/android/settings/SetupRedactionInterstitial.java b/src/com/android/settings/SetupRedactionInterstitial.java
index e487a50..d527585 100644
--- a/src/com/android/settings/SetupRedactionInterstitial.java
+++ b/src/com/android/settings/SetupRedactionInterstitial.java
@@ -16,20 +16,13 @@
package com.android.settings;
-import android.app.Activity;
-import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
-import android.os.UserHandle;
-import android.view.LayoutInflater;
import android.view.View;
-import android.view.ViewGroup;
-import android.widget.LinearLayout;
+import android.widget.Button;
import com.android.settings.notification.RedactionInterstitial;
-import com.android.setupwizardlib.SetupWizardLayout;
-import com.android.setupwizardlib.view.NavigationBar;
/**
* Setup Wizard's version of RedactionInterstitial screen. It inherits the logic and basic structure
@@ -59,49 +52,8 @@
super.onApplyThemeResource(theme, resid, first);
}
- @Override
- protected void onCreate(Bundle savedInstance) {
- super.onCreate(savedInstance);
- LinearLayout layout = (LinearLayout) findViewById(R.id.content_parent);
- layout.setFitsSystemWindows(false);
- }
+ public static class SetupRedactionInterstitialFragment extends RedactionInterstitialFragment {
- public static class SetupRedactionInterstitialFragment extends RedactionInterstitialFragment
- implements NavigationBar.NavigationBarListener {
-
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
- return inflater.inflate(R.layout.setup_redaction_interstitial, container, false);
- }
-
- @Override
- public void onViewCreated(View view, Bundle savedInstanceState) {
- super.onViewCreated(view, savedInstanceState);
- final SetupWizardLayout layout =
- (SetupWizardLayout) view.findViewById(R.id.setup_wizard_layout);
-
- final NavigationBar navigationBar = layout.getNavigationBar();
- navigationBar.setNavigationBarListener(this);
- navigationBar.getBackButton().setVisibility(View.GONE);
- SetupWizardUtils.setImmersiveMode(getActivity());
- }
-
- @Override
- public void onNavigateBack() {
- final Activity activity = getActivity();
- if (activity != null) {
- activity.onBackPressed();
- }
- }
-
- @Override
- public void onNavigateNext() {
- final SetupRedactionInterstitial activity = (SetupRedactionInterstitial) getActivity();
- if (activity != null) {
- activity.setResult(RESULT_OK, activity.getResultIntentData());
- finish();
- }
- }
+ // Setup wizard specific UI customizations can be done here
}
}
diff --git a/src/com/android/settings/SetupWizardUtils.java b/src/com/android/settings/SetupWizardUtils.java
index 71501b1..5563c3b 100644
--- a/src/com/android/settings/SetupWizardUtils.java
+++ b/src/com/android/settings/SetupWizardUtils.java
@@ -24,14 +24,6 @@
import com.android.setupwizardlib.util.WizardManagerHelper;
public class SetupWizardUtils {
- private static final String TAG = "SetupWizardUtils";
-
- // From WizardManager (must match constants maintained there)
- public static final String EXTRA_SCRIPT_URI = "scriptUri";
-
- public static boolean isUsingWizardManager(Activity activity) {
- return activity.getIntent().hasExtra(EXTRA_SCRIPT_URI);
- }
public static int getTheme(Intent intent) {
if (WizardManagerHelper.isLightTheme(intent, true)) {
diff --git a/src/com/android/settings/SummaryPreference.java b/src/com/android/settings/SummaryPreference.java
index 0943a2b..38449b1 100644
--- a/src/com/android/settings/SummaryPreference.java
+++ b/src/com/android/settings/SummaryPreference.java
@@ -33,6 +33,7 @@
private String mUnits;
private int mLeft, mMiddle, mRight;
+ private boolean mColorsSet = false;
private float mLeftRatio, mMiddleRatio, mRightRatio;
private String mStartLabel;
private String mEndLabel;
@@ -40,8 +41,6 @@
public SummaryPreference(Context context, AttributeSet attrs) {
super(context, attrs);
setLayoutResource(R.layout.settings_summary_preference);
- mLeft = context.getColor(R.color.summary_default_start);
- mRight = context.getColor(R.color.summary_default_end);
}
public void setAmount(String amount) {
@@ -77,6 +76,7 @@
mLeft = left;
mMiddle = middle;
mRight = right;
+ mColorsSet = true;
notifyChanged();
}
@@ -86,7 +86,9 @@
LinearColorBar colorBar = (LinearColorBar) holder.itemView.findViewById(R.id.color_bar);
colorBar.setRatios(mLeftRatio, mMiddleRatio, mRightRatio);
- colorBar.setColors(mLeft, mMiddle, mRight);
+ if (mColorsSet) {
+ colorBar.setColors(mLeft, mMiddle, mRight);
+ }
if (!TextUtils.isEmpty(mStartLabel) || !TextUtils.isEmpty(mEndLabel)) {
holder.findViewById(R.id.label_bar).setVisibility(View.VISIBLE);
diff --git a/src/com/android/settings/UserDictionarySettings.java b/src/com/android/settings/UserDictionarySettings.java
index 19d34ef..bdeab92 100644
--- a/src/com/android/settings/UserDictionarySettings.java
+++ b/src/com/android/settings/UserDictionarySettings.java
@@ -160,7 +160,7 @@
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
MenuItem actionItem =
menu.add(0, OPTIONS_MENU_ADD, 0, R.string.user_dict_settings_add_menu_title)
- .setIcon(R.drawable.ic_menu_add_dark);
+ .setIcon(R.drawable.ic_menu_add_white);
actionItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM |
MenuItem.SHOW_AS_ACTION_WITH_TEXT);
}
diff --git a/src/com/android/settings/Utils.java b/src/com/android/settings/Utils.java
index d309867..90dd9e0 100644
--- a/src/com/android/settings/Utils.java
+++ b/src/com/android/settings/Utils.java
@@ -761,9 +761,13 @@
* devices allow users to flash other OSes to them.
*/
static void setOemUnlockEnabled(Context context, boolean enabled) {
- PersistentDataBlockManager manager =(PersistentDataBlockManager)
- context.getSystemService(Context.PERSISTENT_DATA_BLOCK_SERVICE);
- manager.setOemUnlockEnabled(enabled);
+ try {
+ PersistentDataBlockManager manager = (PersistentDataBlockManager)
+ context.getSystemService(Context.PERSISTENT_DATA_BLOCK_SERVICE);
+ manager.setOemUnlockEnabled(enabled);
+ } catch (SecurityException e) {
+ Log.e(TAG, "Fail to set oem unlock.", e);
+ }
}
/**
diff --git a/src/com/android/settings/WallpaperSuggestionActivity.java b/src/com/android/settings/WallpaperSuggestionActivity.java
new file mode 100644
index 0000000..d264e4a
--- /dev/null
+++ b/src/com/android/settings/WallpaperSuggestionActivity.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+package com.android.settings;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.os.Bundle;
+
+public class WallpaperSuggestionActivity extends Activity {
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ Intent intent = new Intent()
+ .setClassName(getString(R.string.config_wallpaper_picker_package),
+ getString(R.string.config_wallpaper_picker_class))
+ .addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT);
+ startActivity(intent);
+ finish();
+ }
+}
diff --git a/src/com/android/settings/WifiCallingSettings.java b/src/com/android/settings/WifiCallingSettings.java
index 3602295..352e317 100644
--- a/src/com/android/settings/WifiCallingSettings.java
+++ b/src/com/android/settings/WifiCallingSettings.java
@@ -19,6 +19,7 @@
import android.app.Activity;
import android.app.AlertDialog;
import android.content.BroadcastReceiver;
+import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
@@ -26,10 +27,12 @@
import android.os.PersistableBundle;
import android.support.v7.preference.ListPreference;
import android.support.v7.preference.Preference;
+import android.support.v7.preference.Preference.OnPreferenceClickListener;
import android.support.v7.preference.PreferenceScreen;
import android.telephony.CarrierConfigManager;
import android.telephony.PhoneStateListener;
import android.telephony.TelephonyManager;
+import android.text.TextUtils;
import android.util.Log;
import android.widget.Switch;
import android.widget.TextView;
@@ -53,11 +56,20 @@
//String keys for preference lookup
private static final String BUTTON_WFC_MODE = "wifi_calling_mode";
+ private static final String PREFERENCE_EMERGENCY_ADDRESS = "emergency_address_key";
+
+ private static final int REQUEST_CHECK_WFC_EMERGENCY_ADDRESS = 1;
+
+ public static final String EXTRA_LAUNCH_CARRIER_APP = "EXTRA_LAUNCH_CARRIER_APP";
+
+ public static final int LAUCH_APP_ACTIVATE = 0;
+ public static final int LAUCH_APP_UPDATE = 1;
//UI objects
private SwitchBar mSwitchBar;
private Switch mSwitch;
private ListPreference mButtonWfcMode;
+ private Preference mUpdateAddress;
private TextView mEmptyView;
private boolean mValidListener = false;
@@ -90,6 +102,23 @@
}
};
+ private final OnPreferenceClickListener mUpdateAddressListener =
+ new OnPreferenceClickListener() {
+ /*
+ * Launch carrier emergency address managemnent activity
+ */
+ @Override
+ public boolean onPreferenceClick(Preference preference) {
+ final Context context = getActivity();
+ Intent carrierAppIntent = getCarrierActivityIntent(context);
+ if (carrierAppIntent != null) {
+ carrierAppIntent.putExtra(EXTRA_LAUNCH_CARRIER_APP, LAUCH_APP_UPDATE);
+ startActivity(carrierAppIntent);
+ }
+ return true;
+ }
+ };
+
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
@@ -163,6 +192,9 @@
mButtonWfcMode = (ListPreference) findPreference(BUTTON_WFC_MODE);
mButtonWfcMode.setOnPreferenceChangeListener(this);
+ mUpdateAddress = (Preference) findPreference(PREFERENCE_EMERGENCY_ADDRESS);
+ mUpdateAddress.setOnPreferenceClickListener(mUpdateAddressListener);
+
mIntentFilter = new IntentFilter();
mIntentFilter.addAction(ImsManager.ACTION_IMS_REGISTRATION_ERROR);
@@ -239,27 +271,93 @@
@Override
public void onSwitchChanged(Switch switchView, boolean isChecked) {
final Context context = getActivity();
+ Log.d(TAG, "onSwitchChanged(" + isChecked + ")");
- ImsManager.setWfcSetting(context, isChecked);
+ if (!isChecked) {
+ updateWfcMode(context, false);
+ return;
+ }
+
+ // Call address management activity before turning on WFC
+ Intent carrierAppIntent = getCarrierActivityIntent(context);
+ if (carrierAppIntent != null) {
+ carrierAppIntent.putExtra(EXTRA_LAUNCH_CARRIER_APP, LAUCH_APP_ACTIVATE);
+ startActivityForResult(carrierAppIntent, REQUEST_CHECK_WFC_EMERGENCY_ADDRESS);
+ } else {
+ updateWfcMode(context, true);
+ }
+ }
+
+ /*
+ * Get the Intent to launch carrier emergency address management activity.
+ * Return null when no activity found.
+ */
+ private static Intent getCarrierActivityIntent(Context context) {
+ // Retrive component name from carrirt config
+ CarrierConfigManager configManager = context.getSystemService(CarrierConfigManager.class);
+ if (configManager == null) return null;
+
+ PersistableBundle bundle = configManager.getConfig();
+ if (bundle == null) return null;
+
+ String carrierApp = bundle.getString(
+ CarrierConfigManager.KEY_WFC_EMERGENCY_ADDRESS_CARRIER_APP_STRING);
+ if (TextUtils.isEmpty(carrierApp)) return null;
+
+ ComponentName componentName = ComponentName.unflattenFromString(carrierApp);
+ if (componentName == null) return null;
+
+ // Build and return intent
+ Intent intent = new Intent();
+ intent.setComponent(componentName);
+ return intent;
+ }
+
+ /*
+ * Turn on/off WFC mode with ImsManager and update UI accordingly
+ */
+ private void updateWfcMode(Context context, boolean wfcEnabled) {
+ Log.i(TAG, "updateWfcMode(" + wfcEnabled + ")");
+ ImsManager.setWfcSetting(context, wfcEnabled);
int wfcMode = ImsManager.getWfcMode(context);
- updateButtonWfcMode(context, isChecked, wfcMode);
- if (isChecked) {
+ updateButtonWfcMode(context, wfcEnabled, wfcMode);
+ if (wfcEnabled) {
MetricsLogger.action(getActivity(), getMetricsCategory(), wfcMode);
} else {
MetricsLogger.action(getActivity(), getMetricsCategory(), -1);
}
}
+ @Override
+ public void onActivityResult(int requestCode, int resultCode, Intent data) {
+ super.onActivityResult(requestCode, resultCode, data);
+
+ final Context context = getActivity();
+
+ if (requestCode == REQUEST_CHECK_WFC_EMERGENCY_ADDRESS) {
+ Log.d(TAG, "WFC emergency address activity result = " + resultCode);
+
+ if (resultCode == Activity.RESULT_OK) {
+ updateWfcMode(context, true);
+ }
+ }
+ }
+
private void updateButtonWfcMode(Context context, boolean wfcEnabled, int wfcMode) {
mButtonWfcMode.setSummary(getWfcModeSummary(context, wfcMode));
mButtonWfcMode.setEnabled(wfcEnabled);
final PreferenceScreen preferenceScreen = getPreferenceScreen();
+ boolean updateAddressEnabled = (getCarrierActivityIntent(context) != null);
if (wfcEnabled) {
preferenceScreen.addPreference(mButtonWfcMode);
+ if (updateAddressEnabled) {
+ preferenceScreen.addPreference(mUpdateAddress);
+ }
} else {
preferenceScreen.removePreference(mButtonWfcMode);
+ preferenceScreen.removePreference(mUpdateAddress);
}
preferenceScreen.setEnabled(mEditableWfcMode);
}
diff --git a/src/com/android/settings/WirelessSettings.java b/src/com/android/settings/WirelessSettings.java
index 5b1d644..722a861 100644
--- a/src/com/android/settings/WirelessSettings.java
+++ b/src/com/android/settings/WirelessSettings.java
@@ -72,6 +72,7 @@
private static final String KEY_MOBILE_NETWORK_SETTINGS = "mobile_network_settings";
private static final String KEY_MANAGE_MOBILE_PLAN = "manage_mobile_plan";
private static final String KEY_WFC_SETTINGS = "wifi_calling_settings";
+ private static final String KEY_NETWORK_RESET = "network_reset";
public static final String EXIT_ECM_RESULT = "exit_ecm_result";
public static final int REQUEST_CODE_EXIT_ECM = 1;
@@ -336,6 +337,12 @@
p.setEnabled(!TetherSettings
.isProvisioningNeededButUnavailable(getActivity()));
}
+
+ // Remove network reset if not allowed
+ if (RestrictedLockUtils.hasBaseUserRestriction(activity,
+ UserManager.DISALLOW_NETWORK_RESET, UserHandle.myUserId())) {
+ removePreference(KEY_NETWORK_RESET);
+ }
}
@Override
@@ -349,7 +356,8 @@
// update WFC setting
final Context context = getActivity();
- if (ImsManager.isWfcEnabledByPlatform(context)) {
+ if (ImsManager.isWfcEnabledByPlatform(context) &&
+ ImsManager.isWfcProvisionedOnDevice(context)) {
getPreferenceScreen().addPreference(mButtonWfc);
mButtonWfc.setSummary(WifiCallingSettings.getWfcModeSummary(
@@ -466,10 +474,16 @@
result.add(KEY_TETHER_SETTINGS);
}
- if (!ImsManager.isWfcEnabledByPlatform(context)) {
+ if (!ImsManager.isWfcEnabledByPlatform(context) ||
+ !ImsManager.isWfcProvisionedOnDevice(context)) {
result.add(KEY_WFC_SETTINGS);
}
+ if (RestrictedLockUtils.hasBaseUserRestriction(context,
+ UserManager.DISALLOW_NETWORK_RESET, UserHandle.myUserId())) {
+ result.add(KEY_NETWORK_RESET);
+ }
+
return result;
}
};
diff --git a/src/com/android/settings/accessibility/AccessibilitySettingsForSetupWizardActivity.java b/src/com/android/settings/accessibility/AccessibilitySettingsForSetupWizardActivity.java
index edc0282..0ccf6d8 100644
--- a/src/com/android/settings/accessibility/AccessibilitySettingsForSetupWizardActivity.java
+++ b/src/com/android/settings/accessibility/AccessibilitySettingsForSetupWizardActivity.java
@@ -42,46 +42,11 @@
@Override
protected void onCreate(Bundle savedState) {
- // Main content frame id should be set before calling super as that is where the first
- // Fragment is inflated.
- setMainContentId(R.id.suw_main_content);
super.onCreate(savedState);
// Finish configuring the content view.
- FrameLayout parentLayout = (FrameLayout) findViewById(R.id.main_content);
- LayoutInflater.from(this)
- .inflate(R.layout.accessibility_settings_for_suw, parentLayout);
-
getActionBar().setDisplayHomeAsUpEnabled(true);
setIsDrawerPresent(false);
-
- // Hide System Nav Bar.
- SystemBarHelper.hideSystemBars(getWindow());
- LinearLayout parentView = (LinearLayout) findViewById(R.id.content_parent);
- parentView.setFitsSystemWindows(false);
- // Adjust for the Status Bar.
- parentView.setOnApplyWindowInsetsListener(new View.OnApplyWindowInsetsListener() {
- @Override
- public WindowInsets onApplyWindowInsets(View v, WindowInsets insets) {
- parentView.setPadding(0, insets.getSystemWindowInsetTop(), 0, 0);
- return insets;
- }
- });
-
- // Show SUW Nav Bar.
- NavigationBar navigationBar = (NavigationBar) findViewById(R.id.suw_navigation_bar);
- navigationBar.getNextButton().setVisibility(View.GONE);
- navigationBar.setNavigationBarListener(new NavigationBar.NavigationBarListener() {
- @Override
- public void onNavigateBack() {
- onNavigateUp();
- }
-
- @Override
- public void onNavigateNext() {
- // Do nothing. We don't show this button.
- }
- });
}
@Override
diff --git a/src/com/android/settings/accessibility/ToggleAccessibilityServicePreferenceFragment.java b/src/com/android/settings/accessibility/ToggleAccessibilityServicePreferenceFragment.java
index 4e2ebce..e37de68 100644
--- a/src/com/android/settings/accessibility/ToggleAccessibilityServicePreferenceFragment.java
+++ b/src/com/android/settings/accessibility/ToggleAccessibilityServicePreferenceFragment.java
@@ -34,6 +34,9 @@
import android.provider.Settings;
import android.text.TextUtils;
import android.view.LayoutInflater;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.accessibility.AccessibilityManager;
@@ -80,6 +83,21 @@
}
@Override
+ public void onCreateOptionsMenu(Menu menu, MenuInflater infalter) {
+ // Do not call super. We don't want to see the "Help & feedback" option on this page so as
+ // not to confuse users who think they might be able to send feedback about a specific
+ // accessibility service from this page.
+
+ // We still want to show the "Settings" menu.
+ if (mSettingsTitle != null && mSettingsIntent != null) {
+ MenuItem menuItem = menu.add(mSettingsTitle);
+ menuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
+ menuItem.setIntent(mSettingsIntent);
+ }
+
+ }
+
+ @Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mLockPatternUtils = new LockPatternUtils(getActivity());
diff --git a/src/com/android/settings/accounts/AccountSettings.java b/src/com/android/settings/accounts/AccountSettings.java
index 22c9de7..eb74034 100644
--- a/src/com/android/settings/accounts/AccountSettings.java
+++ b/src/com/android/settings/accounts/AccountSettings.java
@@ -350,7 +350,7 @@
private Preference newManagedProfileSettings() {
Preference preference = new Preference(getPrefContext());
preference.setTitle(R.string.managed_profile_settings_title);
- preference.setIcon(R.drawable.ic_sysbar_quicksettings);
+ preference.setIcon(R.drawable.ic_settings);
preference.setOnPreferenceClickListener(this);
preference.setOrder(ORDER_NEXT_TO_LAST);
return preference;
diff --git a/src/com/android/settings/applications/LinearColorBar.java b/src/com/android/settings/applications/LinearColorBar.java
index 158a625..b637671 100644
--- a/src/com/android/settings/applications/LinearColorBar.java
+++ b/src/com/android/settings/applications/LinearColorBar.java
@@ -14,10 +14,10 @@
import android.util.DisplayMetrics;
import android.view.MotionEvent;
import android.widget.LinearLayout;
+import com.android.settings.Utils;
public class LinearColorBar extends LinearLayout {
- static final int LEFT_COLOR = 0xff009688;
- static final int MIDDLE_COLOR = 0xff009688;
+
static final int RIGHT_COLOR = 0xffced7db;
static final int GRAY_COLOR = 0xff555555;
static final int WHITE_COLOR = 0xffffffff;
@@ -26,8 +26,8 @@
private float mYellowRatio;
private float mGreenRatio;
- private int mLeftColor = LEFT_COLOR;
- private int mMiddleColor = MIDDLE_COLOR;
+ private int mLeftColor;
+ private int mMiddleColor;
private int mRightColor = RIGHT_COLOR;
private boolean mShowIndicator = true;
@@ -70,7 +70,7 @@
? 2 : 1;
mEdgeGradientPaint.setStrokeWidth(mLineWidth);
mEdgeGradientPaint.setAntiAlias(true);
-
+ mLeftColor = mMiddleColor = Utils.getColorAccent(context);
}
public void setOnRegionTappedListener(OnRegionTappedListener listener) {
diff --git a/src/com/android/settings/applications/ProcessStatsSummary.java b/src/com/android/settings/applications/ProcessStatsSummary.java
index 30701dc..01dbf09 100644
--- a/src/com/android/settings/applications/ProcessStatsSummary.java
+++ b/src/com/android/settings/applications/ProcessStatsSummary.java
@@ -53,10 +53,6 @@
addPreferencesFromResource(R.xml.process_stats_summary);
mSummaryPref = (SummaryPreference) findPreference(KEY_STATUS_HEADER);
- int memColor = getContext().getColor(R.color.running_processes_apps_ram);
- mSummaryPref.setColors(memColor, memColor,
- getContext().getColor(R.color.running_processes_free_ram));
-
mPerformance = findPreference(KEY_PERFORMANCE);
mTotalMemory = findPreference(KEY_TOTAL_MEMORY);
mAverageUsed = findPreference(KEY_AVERAGY_USED);
diff --git a/src/com/android/settings/applications/RunningProcessesView.java b/src/com/android/settings/applications/RunningProcessesView.java
index af60996..7ba83c2 100644
--- a/src/com/android/settings/applications/RunningProcessesView.java
+++ b/src/com/android/settings/applications/RunningProcessesView.java
@@ -42,6 +42,7 @@
import com.android.internal.util.MemInfoReader;
import com.android.settings.R;
import com.android.settings.SettingsActivity;
+import com.android.settings.Utils;
import java.util.ArrayList;
import java.util.Collections;
@@ -450,7 +451,7 @@
mColorBar = (LinearColorBar)mHeader.findViewById(R.id.color_bar);
final Context context = getContext();
mColorBar.setColors(context.getColor(R.color.running_processes_system_ram),
- context.getColor(R.color.running_processes_apps_ram),
+ Utils.getColorAccent(context),
context.getColor(R.color.running_processes_free_ram));
mBackgroundProcessPrefix = (TextView)mHeader.findViewById(R.id.freeSizePrefix);
mAppsProcessPrefix = (TextView)mHeader.findViewById(R.id.appsSizePrefix);
diff --git a/src/com/android/settings/dashboard/DashboardAdapter.java b/src/com/android/settings/dashboard/DashboardAdapter.java
index c54311a..7c76794 100644
--- a/src/com/android/settings/dashboard/DashboardAdapter.java
+++ b/src/com/android/settings/dashboard/DashboardAdapter.java
@@ -163,10 +163,7 @@
countItem(null, R.layout.suggestion_header, hasSuggestions, NS_SPACER);
resetCount();
if (mSuggestions != null) {
- int maxSuggestions = mSuggestionMode == SUGGESTION_MODE_DEFAULT
- ? Math.min(DEFAULT_SUGGESTION_COUNT, mSuggestions.size())
- : mSuggestionMode == SUGGESTION_MODE_EXPANDED ? mSuggestions.size()
- : 0;
+ int maxSuggestions = getDisplayableSuggestionCount();
for (int i = 0; i < mSuggestions.size(); i++) {
countItem(mSuggestions.get(i), R.layout.suggestion_tile, i < maxSuggestions,
NS_SUGGESTION);
@@ -208,6 +205,14 @@
mId++;
}
+ private int getDisplayableSuggestionCount() {
+ final int suggestionSize = mSuggestions.size();
+ return mSuggestionMode == SUGGESTION_MODE_DEFAULT
+ ? Math.min(DEFAULT_SUGGESTION_COUNT, suggestionSize)
+ : mSuggestionMode == SUGGESTION_MODE_EXPANDED
+ ? suggestionSize : 0;
+ }
+
@Override
public DashboardItemHolder onCreateViewHolder(ViewGroup parent, int viewType) {
return new DashboardItemHolder(LayoutInflater.from(parent.getContext()).inflate(
@@ -299,6 +304,14 @@
holder.icon.setImageResource(hasMoreSuggestions() ? R.drawable.ic_expand_more
: R.drawable.ic_expand_less);
holder.title.setText(mContext.getString(R.string.suggestions_title, mSuggestions.size()));
+ final int undisplayedSuggestionCount =
+ mSuggestions.size() - getDisplayableSuggestionCount();
+ if (undisplayedSuggestionCount == 0) {
+ holder.summary.setText(null);
+ } else {
+ holder.summary.setText(
+ mContext.getString(R.string.suggestions_summary, undisplayedSuggestionCount));
+ }
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
diff --git a/src/com/android/settings/dashboard/DashboardContainerFragment.java b/src/com/android/settings/dashboard/DashboardContainerFragment.java
new file mode 100644
index 0000000..b33063d
--- /dev/null
+++ b/src/com/android/settings/dashboard/DashboardContainerFragment.java
@@ -0,0 +1,162 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.dashboard;
+
+import android.app.Activity;
+import android.app.Fragment;
+import android.app.FragmentManager;
+import android.content.Context;
+import android.os.Bundle;
+import android.support.v13.app.FragmentPagerAdapter;
+import android.support.v4.view.ViewPager;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+import com.android.internal.logging.MetricsLogger;
+import com.android.internal.logging.MetricsProto;
+import com.android.settings.InstrumentedFragment;
+import com.android.settings.R;
+import com.android.settings.overlay.FeatureFactory;
+import com.android.settings.overlay.SupportFeatureProvider;
+import com.android.settings.widget.SlidingTabLayout;
+import com.android.settingslib.drawer.SettingsDrawerActivity;
+
+/**
+ * Container for Dashboard fragments.
+ */
+public final class DashboardContainerFragment extends InstrumentedFragment {
+
+ private static final int INDEX_SUMMARY_FRAGMENT = 0;
+ private static final int INDEX_SUPPORT_FRAGMENT = 1;
+
+ private ViewPager mViewPager;
+ private View mHeaderView;
+ private DashboardViewPagerAdapter mPagerAdapter;
+
+ @Override
+ protected int getMetricsCategory() {
+ return MetricsProto.MetricsEvent.DASHBOARD_CONTAINER;
+ }
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setHasOptionsMenu(true);
+ }
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState) {
+ final View content = inflater.inflate(R.layout.dashboard_container, parent, false);
+ final Context context = getContext();
+ mViewPager = (ViewPager) content.findViewById(R.id.pager);
+ mPagerAdapter = new DashboardViewPagerAdapter(context, getChildFragmentManager());
+ mViewPager.setAdapter(mPagerAdapter);
+ mViewPager.addOnPageChangeListener(new TabInstrumentationListener(context));
+ mHeaderView = inflater.inflate(R.layout.dashboard_container_header, parent, false);
+ ((SlidingTabLayout) mHeaderView).setViewPager(mViewPager);
+ return content;
+ }
+
+ @Override
+ public void onResume() {
+ super.onResume();
+ if (mPagerAdapter.getCount() > 1) {
+ final Activity activity = getActivity();
+ if (activity instanceof SettingsDrawerActivity) {
+ ((SettingsDrawerActivity) getActivity()).setContentHeaderView(mHeaderView);
+ }
+ }
+ }
+
+ private static final class DashboardViewPagerAdapter extends FragmentPagerAdapter {
+
+ private final Context mContext;
+ private final SupportFeatureProvider mSupportFeatureProvider;
+
+ public DashboardViewPagerAdapter(Context context, FragmentManager fragmentManager) {
+ super(fragmentManager);
+ mContext = context;
+ mSupportFeatureProvider =
+ FeatureFactory.getFactory(context).getSupportFeatureProvider(context);
+ }
+
+ @Override
+ public CharSequence getPageTitle(int position) {
+ switch (position) {
+ case INDEX_SUMMARY_FRAGMENT:
+ return mContext.getString(R.string.page_tab_title_summary);
+ case INDEX_SUPPORT_FRAGMENT:
+ return mContext.getString(R.string.page_tab_title_support);
+ }
+ return super.getPageTitle(position);
+ }
+
+ @Override
+ public Fragment getItem(int position) {
+ switch (position) {
+ case INDEX_SUMMARY_FRAGMENT:
+ return new DashboardSummary();
+ case INDEX_SUPPORT_FRAGMENT:
+ return new SupportFragment();
+ default:
+ throw new IllegalArgumentException(
+ String.format(
+ "Position %d does not map to a valid dashboard fragment",
+ position));
+ }
+ }
+
+ @Override
+ public int getCount() {
+ return mSupportFeatureProvider == null ? 1 : 2;
+ }
+ }
+
+ private static final class TabInstrumentationListener
+ implements ViewPager.OnPageChangeListener {
+
+ private final Context mContext;
+
+ public TabInstrumentationListener(Context context) {
+ mContext = context;
+ }
+
+ @Override
+ public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
+ // Do nothing.
+ }
+
+ @Override
+ public void onPageScrollStateChanged(int state) {
+ // Do nothing
+ }
+
+ @Override
+ public void onPageSelected(int position) {
+ switch (position) {
+ case INDEX_SUMMARY_FRAGMENT:
+ MetricsLogger.action(mContext, MetricsProto.MetricsEvent.ACTION_SELECT_SUMMARY);
+ break;
+ case INDEX_SUPPORT_FRAGMENT:
+ MetricsLogger.action(
+ mContext, MetricsProto.MetricsEvent.ACTION_SELECT_SUPPORT_FRAGMENT);
+ break;
+ }
+ }
+ }
+}
diff --git a/src/com/android/settings/dashboard/DashboardSummary.java b/src/com/android/settings/dashboard/DashboardSummary.java
index a53f41b..0e47897 100644
--- a/src/com/android/settings/dashboard/DashboardSummary.java
+++ b/src/com/android/settings/dashboard/DashboardSummary.java
@@ -22,10 +22,9 @@
import android.support.v7.widget.LinearLayoutManager;
import android.util.Log;
import android.view.LayoutInflater;
-import android.view.Menu;
-import android.view.MenuInflater;
import android.view.View;
import android.view.ViewGroup;
+
import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.MetricsProto.MetricsEvent;
import com.android.settings.InstrumentedFragment;
@@ -85,7 +84,6 @@
List<DashboardCategory> categories =
((SettingsActivity) getActivity()).getDashboardCategories();
mSummaryLoader = new SummaryLoader(getActivity(), categories);
- setHasOptionsMenu(true);
Context context = getContext();
mConditionManager = ConditionManager.get(context, false);
mSuggestionParser = new SuggestionParser(context,
@@ -102,17 +100,9 @@
}
@Override
- public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
- super.onCreateOptionsMenu(menu, inflater);
- if (getActivity() == null) return;
- HelpUtils.prepareHelpMenuItem(getActivity(), menu, R.string.help_uri_dashboard,
- getClass().getName());
- }
-
- @Override
- public void onStart() {
+ public void onResume() {
long startTime = System.currentTimeMillis();
- super.onStart();
+ super.onResume();
((SettingsDrawerActivity) getActivity()).addCategoryListener(this);
mSummaryLoader.setListening(true);
@@ -127,13 +117,13 @@
DashboardAdapter.getSuggestionIdentifier(getContext(), suggestion));
}
}
- if (DEBUG_TIMING) Log.d(TAG, "onStart took " + (System.currentTimeMillis() - startTime)
+ if (DEBUG_TIMING) Log.d(TAG, "onResume took " + (System.currentTimeMillis() - startTime)
+ " ms");
}
@Override
- public void onStop() {
- super.onStop();
+ public void onPause() {
+ super.onPause();
((SettingsDrawerActivity) getActivity()).remCategoryListener(this);
mSummaryLoader.setListening(false);
diff --git a/src/com/android/settings/dashboard/SuggestionsChecks.java b/src/com/android/settings/dashboard/SuggestionsChecks.java
index 0ce82ad..5f140ba 100644
--- a/src/com/android/settings/dashboard/SuggestionsChecks.java
+++ b/src/com/android/settings/dashboard/SuggestionsChecks.java
@@ -32,9 +32,9 @@
import com.android.settings.Settings.FingerprintEnrollSuggestionActivity;
import com.android.settings.Settings.FingerprintSuggestionActivity;
import com.android.settings.Settings.ScreenLockSuggestionActivity;
-import com.android.settings.Settings.WallpaperSuggestionActivity;
import com.android.settings.Settings.WifiCallingSuggestionActivity;
import com.android.settings.Settings.ZenModeAutomationSuggestionActivity;
+import com.android.settings.WallpaperSuggestionActivity;
import com.android.settingslib.drawer.Tile;
import java.util.Collection;
@@ -78,7 +78,8 @@
}
public boolean isWifiCallingUnavailableOrEnabled() {
- if (!ImsManager.isWfcEnabledByPlatform(mContext)) {
+ if (!ImsManager.isWfcEnabledByPlatform(mContext) ||
+ !ImsManager.isWfcProvisionedOnDevice(mContext)) {
return true;
}
return ImsManager.isWfcEnabledByUser(mContext)
diff --git a/src/com/android/settings/dashboard/SupportFragment.java b/src/com/android/settings/dashboard/SupportFragment.java
new file mode 100644
index 0000000..5e9a623
--- /dev/null
+++ b/src/com/android/settings/dashboard/SupportFragment.java
@@ -0,0 +1,160 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.dashboard;
+
+import android.accounts.Account;
+import android.accounts.AccountManager;
+import android.accounts.OnAccountsUpdateListener;
+import android.app.Activity;
+import android.content.Context;
+import android.net.ConnectivityManager;
+import android.net.Network;
+import android.net.NetworkCapabilities;
+import android.net.NetworkInfo;
+import android.net.NetworkRequest;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Looper;
+import android.support.v7.widget.LinearLayoutManager;
+import android.support.v7.widget.RecyclerView;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+import com.android.internal.logging.MetricsProto;
+import com.android.settings.InstrumentedFragment;
+import com.android.settings.R;
+import com.android.settings.overlay.FeatureFactory;
+import com.android.settings.overlay.SupportFeatureProvider;
+
+/**
+ * Fragment for support tab in SettingsGoogle.
+ */
+public final class SupportFragment extends InstrumentedFragment implements View.OnClickListener,
+ OnAccountsUpdateListener {
+
+ private final Handler mHandler = new Handler(Looper.getMainLooper());
+ private final ConnectivityManager.NetworkCallback mNetworkCallback =
+ new ConnectivityManager.NetworkCallback() {
+
+ @Override
+ public void onCapabilitiesChanged(Network network,
+ NetworkCapabilities capabilities) {
+ postConnectivityChanged();
+ }
+
+ @Override
+ public void onAvailable(Network network) {
+ postConnectivityChanged();
+ }
+
+ @Override
+ public void onLost(Network network) {
+ postConnectivityChanged();
+ }
+ };
+
+ private Activity mActivity;
+ private View mContent;
+ private RecyclerView mRecyclerView;
+ private SupportItemAdapter mSupportItemAdapter;
+ private AccountManager mAccountManager;
+ private SupportFeatureProvider mSupportFeatureProvider;
+ private ConnectivityManager mConnectivityManager;
+
+ @Override
+ protected int getMetricsCategory() {
+ return MetricsProto.MetricsEvent.SUPPORT_FRAGMENT;
+ }
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ mActivity = getActivity();
+ mAccountManager = AccountManager.get(mActivity);
+ mSupportFeatureProvider =
+ FeatureFactory.getFactory(mActivity).getSupportFeatureProvider(mActivity);
+ mSupportItemAdapter = new SupportItemAdapter(mActivity, mSupportFeatureProvider,
+ this /* itemClickListener */);
+ mConnectivityManager =
+ (ConnectivityManager) mActivity.getSystemService(Context.CONNECTIVITY_SERVICE);
+ }
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+ mContent = inflater.inflate(R.layout.support_fragment, container, false);
+ mRecyclerView = (RecyclerView) mContent.findViewById(R.id.support_items);
+ mRecyclerView.setLayoutManager(new LinearLayoutManager(
+ getActivity(), LinearLayoutManager.VERTICAL, false /* reverseLayout */));
+ mRecyclerView.setAdapter(mSupportItemAdapter);
+ return mContent;
+ }
+
+ @Override
+ public void onResume() {
+ super.onResume();
+ // Monitor account change.
+ mAccountManager.addOnAccountsUpdatedListener(
+ this /* listener */, null /* handler */, true /* updateImmediately */);
+ // Monitor connectivity
+ mConnectivityManager.registerNetworkCallback(
+ new NetworkRequest.Builder()
+ .addCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET)
+ .build(),
+ mNetworkCallback);
+ }
+
+ @Override
+ public void onPause() {
+ super.onPause();
+ // Stop monitor account change.
+ mAccountManager.removeOnAccountsUpdatedListener(this /* listener */);
+ // Stop monitor connectivity.
+ mConnectivityManager.unregisterNetworkCallback(mNetworkCallback);
+ }
+
+ @Override
+ public void onAccountsUpdated(Account[] accounts) {
+ // Account changed, update support items.
+ mSupportItemAdapter.setAccount(
+ mSupportFeatureProvider.getSupportEligibleAccount(mActivity));
+ }
+
+ @Override
+ public void onClick(View v) {
+ final SupportItemAdapter.ViewHolder vh =
+ (SupportItemAdapter.ViewHolder) mRecyclerView.getChildViewHolder(v);
+ mSupportItemAdapter.onItemClicked(vh.getAdapterPosition());
+ }
+
+ private void postConnectivityChanged() {
+ mHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ if (mSupportItemAdapter != null) {
+ mSupportItemAdapter.setHasInternet(hasInternet());
+ }
+ }
+ });
+ }
+
+ private boolean hasInternet() {
+ final NetworkInfo activeNetwork = mConnectivityManager.getActiveNetworkInfo();
+ return activeNetwork != null && activeNetwork.isConnectedOrConnecting();
+ }
+}
diff --git a/src/com/android/settings/dashboard/SupportItemAdapter.java b/src/com/android/settings/dashboard/SupportItemAdapter.java
new file mode 100644
index 0000000..a4d0571
--- /dev/null
+++ b/src/com/android/settings/dashboard/SupportItemAdapter.java
@@ -0,0 +1,440 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.android.settings.dashboard;
+
+import android.accounts.Account;
+import android.annotation.DrawableRes;
+import android.annotation.LayoutRes;
+import android.annotation.StringRes;
+import android.app.Activity;
+import android.app.DialogFragment;
+import android.content.Intent;
+import android.support.v7.widget.RecyclerView;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import com.android.internal.logging.MetricsLogger;
+import com.android.internal.logging.MetricsProto;
+import com.android.settings.R;
+import com.android.settings.overlay.SupportFeatureProvider;
+import com.android.settings.support.SupportDisclaimerDialogFragment;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+
+import static com.android.settings.overlay.SupportFeatureProvider.SupportType.CHAT;
+import static com.android.settings.overlay.SupportFeatureProvider.SupportType.PHONE;
+
+/**
+ * Item adapter for support tiles.
+ */
+public final class SupportItemAdapter extends RecyclerView.Adapter<SupportItemAdapter.ViewHolder> {
+
+ private static final int TYPE_TITLE = R.layout.support_item_title;
+ private static final int TYPE_ESCALATION_OPTIONS = R.layout.support_escalation_options;
+ private static final int TYPE_SUPPORT_TILE = R.layout.support_tile;
+ private static final int TYPE_SIGN_IN_BUTTON = R.layout.support_sign_in_button;
+
+ private final Activity mActivity;
+ private final EscalationClickListener mEscalationClickListener;
+ private final SupportFeatureProvider mSupportFeatureProvider;
+ private final View.OnClickListener mItemClickListener;
+ private final List<SupportData> mSupportData;
+
+ private boolean mHasInternet;
+ private Account mAccount;
+
+ public SupportItemAdapter(Activity activity, SupportFeatureProvider supportFeatureProvider,
+ View.OnClickListener itemClickListener) {
+ mActivity = activity;
+ mSupportFeatureProvider = supportFeatureProvider;
+ mItemClickListener = itemClickListener;
+ mEscalationClickListener = new EscalationClickListener();
+ mSupportData = new ArrayList<>();
+ // Optimistically assume we have Internet access. It will be updated later to correct value.
+ mHasInternet = true;
+ setAccount(mSupportFeatureProvider.getSupportEligibleAccount(mActivity));
+ refreshData();
+ }
+
+ @Override
+ public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
+ return new ViewHolder(LayoutInflater.from(parent.getContext()).inflate(
+ viewType, parent, false));
+ }
+
+ @Override
+ public void onBindViewHolder(ViewHolder holder, int position) {
+ final SupportData data = mSupportData.get(position);
+ switch (holder.getItemViewType()) {
+ case TYPE_SIGN_IN_BUTTON:
+ bindSignInPromoTile(holder, data);
+ break;
+ case TYPE_ESCALATION_OPTIONS:
+ bindEscalationOptions(holder, data);
+ break;
+ default:
+ bindSupportTile(holder, data);
+ break;
+ }
+ }
+
+ @Override
+ public int getItemViewType(int position) {
+ return mSupportData.get(position).type;
+ }
+
+ @Override
+ public int getItemCount() {
+ return mSupportData.size();
+ }
+
+ /**
+ * Called when a support item is clicked.
+ */
+ public void onItemClicked(int position) {
+ if (position >= 0 && position < mSupportData.size()) {
+ final SupportData data = mSupportData.get(position);
+ if (data.intent != null) {
+ if (data.metricsEvent >= 0) {
+ MetricsLogger.action(mActivity, data.metricsEvent);
+ }
+ mActivity.startActivityForResult(data.intent, 0);
+ }
+ }
+ }
+
+ public void setHasInternet(boolean hasInternet) {
+ if (mHasInternet != hasInternet) {
+ mHasInternet = hasInternet;
+ refreshData();
+ }
+ }
+
+ public void setAccount(Account account) {
+ if (!Objects.equals(mAccount, account)) {
+ mAccount = account;
+ refreshData();
+ }
+ }
+
+ /**
+ * Create data for the adapter. If there is already data in the adapter, they will be
+ * destroyed and recreated.
+ */
+ private void refreshData() {
+ mSupportData.clear();
+ if (mAccount == null) {
+ addSignInPromo();
+ } else {
+ addEscalationCards();
+ }
+ addMoreHelpItems();
+ notifyDataSetChanged();
+ }
+
+ private void addEscalationCards() {
+ if (mHasInternet) {
+ if (mSupportFeatureProvider.isAlwaysOperating(PHONE)
+ || mSupportFeatureProvider.isAlwaysOperating(CHAT)) {
+ mSupportData.add(new SupportData.Builder(TYPE_TITLE)
+ .setText1(R.string.support_escalation_24_7_title)
+ .setText2(R.string.support_escalation_24_7_summary)
+ .build());
+ } else if (mSupportFeatureProvider.isOperatingNow(PHONE)
+ || mSupportFeatureProvider.isOperatingNow(CHAT)) {
+ mSupportData.add(new SupportData.Builder(TYPE_TITLE)
+ .setText1(R.string.support_escalation_title)
+ .setText2(R.string.support_escalation_summary)
+ .build());
+ } else {
+ mSupportData.add(new SupportData.Builder(TYPE_TITLE)
+ .setText1(R.string.support_escalation_closed_title)
+ .setText2(R.string.support_escalation_closed_summary)
+ .build());
+ }
+ } else {
+ mSupportData.add(new SupportData.Builder(TYPE_TITLE)
+ .setText1(R.string.support_offline_title)
+ .setText2(R.string.support_offline_summary)
+ .build());
+ }
+ final SupportData.Builder builder = new SupportData.Builder(TYPE_ESCALATION_OPTIONS);
+ if (mSupportFeatureProvider.isSupportTypeEnabled(mActivity, PHONE)) {
+ builder.setText1(R.string.support_escalation_by_phone);
+ builder.setSummary1(mSupportFeatureProvider.getEstimatedWaitTime(mActivity, PHONE));
+ builder.setEnabled1(mSupportFeatureProvider.isOperatingNow(PHONE));
+ }
+ if (mSupportFeatureProvider.isSupportTypeEnabled(mActivity, CHAT)) {
+ builder.setText2(R.string.support_escalation_by_chat);
+ builder.setSummary2(mSupportFeatureProvider.getEstimatedWaitTime(mActivity, CHAT));
+ builder.setEnabled2(mSupportFeatureProvider.isOperatingNow(CHAT));
+ }
+ mSupportData.add(builder.build());
+ }
+
+ private void addSignInPromo() {
+ mSupportData.add(new SupportData.Builder(TYPE_TITLE)
+ .setText1(R.string.support_sign_in_required_title)
+ .setText2(R.string.support_sign_in_required_summary)
+ .build());
+ mSupportData.add(new SupportData.Builder(TYPE_SIGN_IN_BUTTON)
+ .setText1(R.string.support_sign_in_button_text)
+ .setText2(R.string.support_sign_in_required_help)
+ .build());
+ }
+
+ private void addMoreHelpItems() {
+ mSupportData.add(new SupportData.Builder(TYPE_SUPPORT_TILE)
+ .setIcon(R.drawable.ic_lightbulb_outline_24)
+ .setText1(R.string.support_tips_and_tricks_title)
+ .setIntent(mSupportFeatureProvider.getTipsAndTricksIntent(mActivity))
+ .setMetricsEvent(MetricsProto.MetricsEvent.ACTION_SUPPORT_TIPS_AND_TRICKS)
+ .build());
+ mSupportData.add(new SupportData.Builder(TYPE_SUPPORT_TILE)
+ .setIcon(R.drawable.ic_help_24dp)
+ .setText1(R.string.help_feedback_label)
+ .setIntent(mSupportFeatureProvider.getHelpIntent(mActivity))
+ .setMetricsEvent(MetricsProto.MetricsEvent.ACTION_SUPPORT_HELP_AND_FEEDBACK)
+ .build());
+ }
+
+ private void bindEscalationOptions(ViewHolder holder, SupportData data) {
+ if (data.text1 == 0) {
+ holder.text1View.setVisibility(View.GONE);
+ } else {
+ holder.text1View.setText(data.text1);
+ holder.text1View.setOnClickListener(mEscalationClickListener);
+ holder.text1View.setEnabled(data.enabled1 && mHasInternet);
+ holder.text1View.setVisibility(View.VISIBLE);
+ }
+ if (data.text2 == 0) {
+ holder.text2View.setVisibility(View.GONE);
+ } else {
+ holder.text2View.setText(data.text2);
+ holder.text2View.setOnClickListener(mEscalationClickListener);
+ holder.text2View.setEnabled(data.enabled2 && mHasInternet);
+ holder.text2View.setVisibility(View.VISIBLE);
+ }
+ if (holder.summary1View != null) {
+ holder.summary1View.setText(data.summary1);
+ holder.summary1View.setVisibility(mHasInternet ? View.VISIBLE : View.GONE);
+ }
+ if (holder.summary2View != null) {
+ holder.summary2View.setText(data.summary2);
+ holder.summary2View.setVisibility(mHasInternet ? View.VISIBLE : View.GONE);
+ }
+ }
+
+ private void bindSignInPromoTile(ViewHolder holder, SupportData data) {
+ holder.text1View.setText(data.text1);
+ holder.text2View.setText(data.text2);
+ holder.text1View.setOnClickListener(mEscalationClickListener);
+ holder.text2View.setOnClickListener(mEscalationClickListener);
+ }
+
+ private void bindSupportTile(ViewHolder holder, SupportData data) {
+ if (holder.iconView != null) {
+ holder.iconView.setImageResource(data.icon);
+ }
+ if (holder.text1View != null) {
+ holder.text1View.setText(data.text1);
+ }
+ if (holder.text2View != null) {
+ holder.text2View.setText(data.text2);
+ }
+ holder.itemView.setOnClickListener(mItemClickListener);
+ }
+
+ /**
+ * Show a disclaimer dialog and start support action after disclaimer has been acknowledged.
+ */
+ private void tryStartDisclaimerAndSupport(final @SupportFeatureProvider.SupportType int type) {
+ if (mSupportFeatureProvider.shouldShowDisclaimerDialog(mActivity)) {
+ DialogFragment fragment = SupportDisclaimerDialogFragment.newInstance(mAccount, type);
+ fragment.show(mActivity.getFragmentManager(), SupportDisclaimerDialogFragment.TAG);
+ return;
+ }
+ mSupportFeatureProvider.startSupport(mActivity, mAccount, type);
+ }
+
+ /**
+ * Click handler for starting escalation options.
+ */
+ private final class EscalationClickListener implements View.OnClickListener {
+ @Override
+ public void onClick(final View v) {
+ if (mAccount == null) {
+ switch (v.getId()) {
+ case android.R.id.text1:
+ MetricsLogger.action(mActivity,
+ MetricsProto.MetricsEvent.ACTION_SUPPORT_SIGN_IN);
+ mActivity.startActivityForResult(
+ mSupportFeatureProvider.getAccountLoginIntent(),
+ 0 /* requestCode */);
+ break;
+ case android.R.id.text2:
+ mActivity.startActivityForResult(
+ mSupportFeatureProvider.getSignInHelpIntent(mActivity),
+ 0 /* requestCode */);
+ break;
+ }
+ } else {
+ switch (v.getId()) {
+ case android.R.id.text1:
+ MetricsLogger.action(mActivity,
+ MetricsProto.MetricsEvent.ACTION_SUPPORT_PHONE);
+ tryStartDisclaimerAndSupport(PHONE);
+ break;
+ case android.R.id.text2:
+ MetricsLogger.action(mActivity,
+ MetricsProto.MetricsEvent.ACTION_SUPPORT_CHAT);
+ tryStartDisclaimerAndSupport(CHAT);
+ break;
+ }
+ }
+ }
+ }
+
+ /**
+ * {@link RecyclerView.ViewHolder} for support items.
+ */
+ static final class ViewHolder extends RecyclerView.ViewHolder {
+
+ final ImageView iconView;
+ final TextView text1View;
+ final TextView text2View;
+ final TextView summary1View;
+ final TextView summary2View;
+
+ ViewHolder(View itemView) {
+ super(itemView);
+ iconView = (ImageView) itemView.findViewById(android.R.id.icon);
+ text1View = (TextView) itemView.findViewById(android.R.id.text1);
+ text2View = (TextView) itemView.findViewById(android.R.id.text2);
+ summary1View = (TextView) itemView.findViewById(R.id.summary1);
+ summary2View = (TextView) itemView.findViewById(R.id.summary2);
+ }
+ }
+
+ /**
+ * Data for a single support item.
+ */
+ private static final class SupportData {
+
+ final Intent intent;
+ final int metricsEvent;
+ @LayoutRes
+ final int type;
+ @DrawableRes
+ final int icon;
+ @StringRes
+ final int text1;
+ @StringRes
+ final int text2;
+ final boolean enabled1;
+ final boolean enabled2;
+ final String summary1;
+ final String summary2;
+
+ private SupportData(Builder builder) {
+ this.type = builder.mType;
+ this.icon = builder.mIcon;
+ this.text1 = builder.mText1;
+ this.text2 = builder.mText2;
+ this.summary1 = builder.mSummary1;
+ this.summary2 = builder.mSummary2;
+ this.enabled1 = builder.mEnabled1;
+ this.enabled2 = builder.mEnabled2;
+ this.intent = builder.mIntent;
+ this.metricsEvent = builder.mMetricsEvent;
+ }
+
+ static final class Builder {
+ @LayoutRes
+ private final int mType;
+ @DrawableRes
+ private int mIcon;
+ private boolean mEnabled1;
+ private boolean mEnabled2;
+ @StringRes
+ private int mText1;
+ @StringRes
+ private int mText2;
+ private String mSummary1;
+ private String mSummary2;
+ private Intent mIntent;
+ private int mMetricsEvent = -1;
+
+ Builder(@LayoutRes int type) {
+ mType = type;
+ }
+
+ Builder setIcon(@DrawableRes int icon) {
+ mIcon = icon;
+ return this;
+ }
+
+ Builder setEnabled1(boolean enabled) {
+ mEnabled1 = enabled;
+ return this;
+ }
+
+ Builder setText1(@StringRes int text1) {
+ mText1 = text1;
+ return this;
+ }
+
+ Builder setSummary1(String summary1) {
+ mSummary1 = summary1;
+ return this;
+ }
+
+ Builder setEnabled2(boolean enabled) {
+ mEnabled2 = enabled;
+ return this;
+ }
+
+ Builder setText2(@StringRes int text2) {
+ mText2 = text2;
+ return this;
+ }
+
+ Builder setSummary2(String summary2) {
+ mSummary2 = summary2;
+ return this;
+ }
+
+ Builder setMetricsEvent(int metricsEvent) {
+ mMetricsEvent = metricsEvent;
+ return this;
+ }
+
+ Builder setIntent(Intent intent) {
+ mIntent = intent;
+ return this;
+ }
+
+ SupportData build() {
+ return new SupportData(this);
+ }
+ }
+ }
+}
diff --git a/src/com/android/settings/deletionhelper/AppDeletionPreference.java b/src/com/android/settings/deletionhelper/AppDeletionPreference.java
new file mode 100644
index 0000000..97420c2
--- /dev/null
+++ b/src/com/android/settings/deletionhelper/AppDeletionPreference.java
@@ -0,0 +1,91 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package com.android.settings.deletionhelper;
+
+import android.content.Context;
+import android.support.v14.preference.SwitchPreference;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceViewHolder;
+import android.text.format.Formatter;
+import android.view.View;
+import android.widget.Switch;
+import android.widget.TextView;
+import com.android.settings.deletionhelper.AppStateUsageStatsBridge.UsageStatsState;
+import com.android.settings.R;
+
+import com.android.settingslib.applications.ApplicationsState;
+import com.android.settingslib.applications.ApplicationsState.AppEntry;
+
+/**
+ * Preference item for an app with a switch to signify if it should be uninstalled.
+ * This shows the name and icon of the app along with the days since its last use.
+ */
+public class AppDeletionPreference extends SwitchPreference {
+ private AppEntry mEntry;
+ private Context mContext;
+
+ public AppDeletionPreference(Context context, AppEntry item, ApplicationsState state) {
+ super(context);
+ mEntry = item;
+ mContext = context;
+ setLayoutResource(com.android.settings.R.layout.preference_app);
+ setWidgetLayoutResource(R.layout.widget_text_views);
+
+ synchronized (item) {
+ state.ensureIcon(item);
+ if (item.icon != null)
+ setIcon(item.icon);
+ if (item.label != null)
+ setTitle(item.label);
+ }
+ }
+
+ @Override
+ public void onBindViewHolder(PreferenceViewHolder holder) {
+ super.onBindViewHolder(holder);
+ Switch switchWidget = (Switch) holder.findViewById(com.android.internal.R.id.switch_widget);
+ switchWidget.setVisibility(View.VISIBLE);
+
+ TextView summary = (TextView) holder.findViewById(R.id.widget_text1);
+ updateSummaryText(summary);
+ }
+
+ public String getPackageName() {
+ return mEntry.label;
+ }
+
+ private void updateSummaryText(TextView summary) {
+ if (mEntry.extraInfo == null) return;
+ if (mEntry.size == ApplicationsState.SIZE_UNKNOWN ||
+ mEntry.size == ApplicationsState.SIZE_INVALID) {
+ return;
+ }
+
+ UsageStatsState extraData = (UsageStatsState) mEntry.extraInfo;
+ String fileSize = Formatter.formatFileSize(mContext, mEntry.size);
+ if (extraData.daysSinceLastUse == AppStateUsageStatsBridge.NEVER_USED) {
+ summary.setText(mContext.getString(R.string.deletion_helper_app_summary_never_used,
+ fileSize));
+ } else if (extraData.daysSinceLastUse == AppStateUsageStatsBridge.UNKNOWN_LAST_USE) {
+ summary.setText(mContext.getString(R.string.deletion_helper_app_summary_unknown_used,
+ fileSize));
+ } else {
+ summary.setText(mContext.getString(R.string.deletion_helper_app_summary,
+ fileSize,
+ extraData.daysSinceLastUse));
+ }
+ }
+
+}
diff --git a/src/com/android/settings/deletionhelper/AppStateUsageStatsBridge.java b/src/com/android/settings/deletionhelper/AppStateUsageStatsBridge.java
new file mode 100644
index 0000000..6f77a29
--- /dev/null
+++ b/src/com/android/settings/deletionhelper/AppStateUsageStatsBridge.java
@@ -0,0 +1,152 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.android.settings.deletionhelper;
+
+import android.app.usage.UsageStats;
+import android.app.usage.UsageStatsManager;
+import android.content.Context;
+import android.content.pm.ApplicationInfo;
+
+import android.content.pm.PackageInfo;
+import android.content.pm.PackageManager;
+import android.util.Log;
+import com.android.settings.applications.AppStateBaseBridge;
+import com.android.settingslib.applications.ApplicationsState;
+import com.android.settingslib.applications.ApplicationsState.AppEntry;
+import com.android.settingslib.applications.ApplicationsState.AppFilter;
+
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * Connects data from the UsageStatsManager to the ApplicationsState.
+ */
+public class AppStateUsageStatsBridge extends AppStateBaseBridge {
+ private static final String TAG = "AppStateUsageStatsBridge";
+ private UsageStatsManager mUsageStatsManager;
+ private PackageManager mPm;
+ public static final long NEVER_USED = -1;
+ public static final long UNKNOWN_LAST_USE = -2;
+ public static final long UNUSED_DAYS_DELETION_THRESHOLD = 60;
+
+ public AppStateUsageStatsBridge(Context context, ApplicationsState appState,
+ Callback callback) {
+ super(appState, callback);
+ mUsageStatsManager =
+ (UsageStatsManager) context.getSystemService(Context.USAGE_STATS_SERVICE);
+ mPm = context.getPackageManager();
+ }
+
+ @Override
+ protected void loadAllExtraInfo() {
+ ArrayList<AppEntry> apps = mAppSession.getAllApps();
+ if (apps == null) return;
+
+ final Map<String, UsageStats> map = mUsageStatsManager.queryAndAggregateUsageStats(0,
+ System.currentTimeMillis());
+ for (AppEntry entry : apps) {
+ UsageStats usageStats = map.get(entry.info.packageName);
+ entry.extraInfo = new UsageStatsState(getDaysSinceLastUse(usageStats),
+ getDaysSinceInstalled(entry.info.packageName));
+ }
+ }
+
+ @Override
+ protected void updateExtraInfo(AppEntry app, String pkg, int uid) {
+ Map<String, UsageStats> map = mUsageStatsManager.queryAndAggregateUsageStats(0,
+ System.currentTimeMillis());
+ UsageStats usageStats = map.get(app.info.packageName);
+ app.extraInfo = new UsageStatsState(getDaysSinceLastUse(usageStats),
+ getDaysSinceInstalled(app.info.packageName));
+ }
+
+ private long getDaysSinceLastUse(UsageStats stats) {
+ if (stats == null) {
+ return NEVER_USED;
+ }
+ long lastUsed = stats.getLastTimeUsed();
+ // Sometimes, a usage is recorded without a time and we don't know when the use was.
+ if (lastUsed == 0) {
+ return UNKNOWN_LAST_USE;
+ }
+ return TimeUnit.MILLISECONDS.toDays(System.currentTimeMillis() - lastUsed);
+ }
+
+ private long getDaysSinceInstalled(String packageName) {
+ PackageInfo pi = null;
+ try {
+ pi = mPm.getPackageInfo(packageName, 0);
+ } catch (PackageManager.NameNotFoundException e) {
+ Log.e(TAG, packageName + " was not found.");
+ }
+
+ if (pi == null) {
+ return NEVER_USED;
+ }
+
+ return (TimeUnit.MILLISECONDS.toDays(System.currentTimeMillis() - pi.firstInstallTime));
+ }
+
+ /**
+ * Filters only non-system apps which haven't been used in the last 60 days. If an app's last
+ * usage is unknown, it is skipped.
+ */
+ public static final AppFilter FILTER_USAGE_STATS = new AppFilter() {
+
+ @Override
+ public void init() {
+ }
+
+ @Override
+ public boolean filterApp(AppEntry info) {
+ if (info == null) return false;
+ return isExtraInfoValid(info.extraInfo) && !isBundled(info)
+ && !isPersistentProcess(info);
+ }
+
+ private boolean isExtraInfoValid(Object extraInfo) {
+ if (extraInfo == null || !(extraInfo instanceof UsageStatsState)) {
+ return false;
+ }
+
+ UsageStatsState state = (UsageStatsState) extraInfo;
+ long mostRecentUse = Math.max(state.daysSinceFirstInstall, state.daysSinceLastUse);
+ return mostRecentUse >= UNUSED_DAYS_DELETION_THRESHOLD || mostRecentUse == NEVER_USED;
+ }
+
+ private boolean isBundled(AppEntry info) {
+ return (info.info.flags & ApplicationInfo.FLAG_SYSTEM) != 0;
+ }
+
+ private boolean isPersistentProcess(AppEntry info) {
+ return (info.info.flags & ApplicationInfo.FLAG_PERSISTENT) != 0;
+ }
+ };
+
+ /**
+ * UsageStatsState contains the days since the last use and first install of a given app.
+ */
+ public static class UsageStatsState {
+ public long daysSinceLastUse;
+ public long daysSinceFirstInstall;
+
+ public UsageStatsState(long daysSinceLastUse, long daysSinceFirstInstall) {
+ this.daysSinceLastUse = daysSinceLastUse;
+ this.daysSinceFirstInstall = daysSinceFirstInstall;
+ }
+ }
+}
diff --git a/src/com/android/settings/deletionhelper/AutomaticStorageBroadcastReceiver.java b/src/com/android/settings/deletionhelper/AutomaticStorageBroadcastReceiver.java
new file mode 100644
index 0000000..e7b0469
--- /dev/null
+++ b/src/com/android/settings/deletionhelper/AutomaticStorageBroadcastReceiver.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.deletionhelper;
+
+import android.app.job.JobInfo;
+import android.app.job.JobScheduler;
+import android.content.BroadcastReceiver;
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.Intent;
+import android.text.format.DateUtils;
+
+/**
+ * A {@link BroadcastReceiver} listening for {@link Intent#ACTION_BOOT_COMPLETED} broadcasts to
+ * schedule an automatic storage management job. Automatic storage management jobs are only
+ * scheduled once a day for a plugged in device.
+ */
+public class AutomaticStorageBroadcastReceiver extends BroadcastReceiver {
+ private static final int AUTOMATIC_STORAGE_JOB_ID = 0;
+ private static final long PERIOD = DateUtils.DAY_IN_MILLIS;
+
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ JobScheduler jobScheduler =
+ (JobScheduler) context.getSystemService(Context.JOB_SCHEDULER_SERVICE);
+ ComponentName component = new ComponentName(context,
+ AutomaticStorageManagementJobService.class);
+ JobInfo job = new JobInfo.Builder(AUTOMATIC_STORAGE_JOB_ID, component)
+ .setRequiresCharging(true)
+ .setRequiresDeviceIdle(true)
+ .setPeriodic(PERIOD)
+ .build();
+ jobScheduler.schedule(job);
+ }
+}
diff --git a/src/com/android/settings/deletionhelper/AutomaticStorageManagementJobService.java b/src/com/android/settings/deletionhelper/AutomaticStorageManagementJobService.java
new file mode 100644
index 0000000..990e328
--- /dev/null
+++ b/src/com/android/settings/deletionhelper/AutomaticStorageManagementJobService.java
@@ -0,0 +1,90 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.deletionhelper;
+
+import android.app.job.JobParameters;
+import android.app.job.JobService;
+import android.content.Context;
+import android.content.SharedPreferences;
+import android.os.storage.StorageManager;
+import android.os.storage.VolumeInfo;
+import android.provider.Settings;
+import android.util.Log;
+import com.android.settings.overlay.FeatureFactory;
+import com.android.settings.overlay.StorageManagementJobProvider;
+
+import java.io.File;
+
+/**
+ * {@link JobService} class to start automatic storage clearing jobs to free up space. The job only
+ * starts if the device is under a certain percent of free storage.
+ */
+public class AutomaticStorageManagementJobService extends JobService {
+ private static final String TAG = "AsmJobService";
+ private static final String SHARED_PREFRENCES_NAME = "automatic_storage_manager_settings";
+ private static final String KEY_DAYS_TO_RETAIN = "days_to_retain";
+
+ private static final long DEFAULT_LOW_FREE_PERCENT = 15;
+
+ private StorageManagementJobProvider mProvider;
+
+ @Override
+ public boolean onStartJob(JobParameters args) {
+ boolean isEnabled =
+ Settings.Secure.getInt(getContentResolver(),
+ Settings.Secure.AUTOMATIC_STORAGE_MANAGER_ENABLED, 0) != 0;
+ if (!isEnabled) {
+ return false;
+ }
+
+ StorageManager manager = getSystemService(StorageManager.class);
+ VolumeInfo internalVolume = manager.findVolumeById(VolumeInfo.ID_PRIVATE_INTERNAL);
+
+ final File dataPath = internalVolume.getPath();
+ if (!volumeNeedsManagement(dataPath)) {
+ Log.i(TAG, "Skipping automatic storage management.");
+ return false;
+ }
+ mProvider = FeatureFactory.getFactory(this).getStorageManagementJobProvider();
+ if (mProvider != null) {
+ return mProvider.onStartJob(this, args, getDaysToRetain());
+ }
+
+ return false;
+ }
+
+ @Override
+ public boolean onStopJob(JobParameters args) {
+ if (mProvider != null) {
+ return mProvider.onStopJob(this, args);
+ }
+
+ return false;
+ }
+
+ private int getDaysToRetain() {
+ SharedPreferences sharedPreferences =
+ getSharedPreferences(SHARED_PREFRENCES_NAME, Context.MODE_PRIVATE);
+ return sharedPreferences.getInt(KEY_DAYS_TO_RETAIN,
+ AutomaticStorageManagerSettings.DEFAULT_DAYS_TO_RETAIN);
+ }
+
+ private boolean volumeNeedsManagement(final File dataPath) {
+ long lowStorageThreshold = (dataPath.getTotalSpace() * DEFAULT_LOW_FREE_PERCENT) / 100;
+ return dataPath.getFreeSpace() < lowStorageThreshold;
+ }
+}
\ No newline at end of file
diff --git a/src/com/android/settings/deletionhelper/AutomaticStorageManagerSettings.java b/src/com/android/settings/deletionhelper/AutomaticStorageManagerSettings.java
new file mode 100644
index 0000000..670eed1
--- /dev/null
+++ b/src/com/android/settings/deletionhelper/AutomaticStorageManagerSettings.java
@@ -0,0 +1,133 @@
+/**
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.deletionhelper;
+
+import android.app.Activity;
+import android.content.Context;
+import android.content.res.Resources;
+import android.os.Bundle;
+import android.provider.Settings;
+import android.util.Log;
+import android.view.View;
+import android.widget.Switch;
+import android.support.v14.preference.SwitchPreference;
+import android.support.v7.preference.DropDownPreference;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.Preference.OnPreferenceChangeListener;
+import android.support.v7.preference.PreferenceScreen;
+
+import com.android.internal.logging.MetricsProto.MetricsEvent;
+import com.android.settings.SettingsActivity;
+import com.android.settings.SettingsPreferenceFragment;
+import com.android.settings.R;
+import com.android.settings.widget.SwitchBar;
+import com.android.settings.widget.SwitchBar.OnSwitchChangeListener;
+
+/**
+ * AutomaticStorageManagerSettings is the Settings screen for configuration and management of the
+ * automatic storage manager.
+ */
+public class AutomaticStorageManagerSettings extends SettingsPreferenceFragment implements
+ OnPreferenceChangeListener, Preference.OnPreferenceClickListener {
+ public static final int DEFAULT_DAYS_TO_RETAIN = 90;
+
+ private static final String KEY_DAYS = "days";
+ private static final String KEY_DELETION_HELPER = "deletion_helper";
+ private static final String KEY_STORAGE_MANAGER_SWITCH = "storage_manager_active";
+
+ private DropDownPreference mDaysToRetain;
+ private Preference mDeletionHelper;
+ private SwitchPreference mStorageManagerSwitch;
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ addPreferencesFromResource(R.xml.automatic_storage_management_settings);
+ }
+
+ @Override
+ public void onActivityCreated(Bundle savedInstanceState) {
+ super.onActivityCreated(savedInstanceState);
+ mDaysToRetain = (DropDownPreference) findPreference(KEY_DAYS);
+ mDaysToRetain.setOnPreferenceChangeListener(this);
+
+ mDeletionHelper = findPreference(KEY_DELETION_HELPER);
+ mDeletionHelper.setOnPreferenceClickListener(this);
+
+ mStorageManagerSwitch = (SwitchPreference) findPreference(KEY_STORAGE_MANAGER_SWITCH);
+ mStorageManagerSwitch.setOnPreferenceChangeListener(this);
+
+ int value = Settings.Secure.getInt(getContentResolver(),
+ Settings.Secure.AUTOMATIC_STORAGE_MANAGER_DAYS_TO_RETAIN,
+ Settings.Secure.AUTOMATIC_STORAGE_MANAGER_DAYS_TO_RETAIN_DEFAULT);
+ String[] stringValues =
+ getResources().getStringArray(R.array.automatic_storage_management_days_values);
+ mDaysToRetain.setValue(stringValues[daysValueToIndex(value, stringValues)]);
+ }
+
+ @Override
+ public void onResume() {
+ super.onResume();
+ boolean isChecked =
+ Settings.Secure.getInt(getContentResolver(),
+ Settings.Secure.AUTOMATIC_STORAGE_MANAGER_ENABLED, 0) != 0;
+ mStorageManagerSwitch.setChecked(isChecked);
+ mDaysToRetain.setEnabled(isChecked);
+ }
+
+ @Override
+ public boolean onPreferenceChange(Preference preference, Object newValue) {
+ switch (preference.getKey()) {
+ case KEY_STORAGE_MANAGER_SWITCH:
+ boolean checked = (boolean) newValue;
+ mDaysToRetain.setEnabled(checked);
+ Settings.Secure.putInt(getContentResolver(),
+ Settings.Secure.AUTOMATIC_STORAGE_MANAGER_ENABLED, checked ? 1 : 0);
+ break;
+ case KEY_DAYS:
+ Settings.Secure.putInt(getContentResolver(),
+ Settings.Secure.AUTOMATIC_STORAGE_MANAGER_DAYS_TO_RETAIN,
+ Integer.parseInt((String) newValue));
+ break;
+ }
+ return true;
+ }
+
+ @Override
+ protected int getMetricsCategory() {
+ return MetricsEvent.STORAGE_MANAGER_SETTINGS;
+ }
+
+ @Override
+ public boolean onPreferenceClick(Preference preference) {
+ if (KEY_DELETION_HELPER.equals(preference.getKey())) {
+ startFragment(this, DeletionHelperFragment.class.getCanonicalName(),
+ R.string.deletion_helper_title, 0, null);
+ }
+ return true;
+ }
+
+ private static int daysValueToIndex(int value, String[] indices) {
+ for (int i = 0; i < indices.length; i++) {
+ int thisValue = Integer.parseInt(indices[i]);
+ if (value == thisValue) {
+ return i;
+ }
+ }
+ return indices.length - 1;
+ }
+}
diff --git a/src/com/android/settings/deletionhelper/ConfirmDeletionDialog.java b/src/com/android/settings/deletionhelper/ConfirmDeletionDialog.java
new file mode 100644
index 0000000..fc6033e
--- /dev/null
+++ b/src/com/android/settings/deletionhelper/ConfirmDeletionDialog.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.deletionhelper;
+
+import android.app.AlertDialog;
+import android.app.Dialog;
+import android.app.DialogFragment;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.os.Bundle;
+import android.text.format.Formatter;
+import com.android.settings.R;
+
+/**
+ * Fragment used to confirm that the user wishes to delete a certain amount of data.
+ */
+public class ConfirmDeletionDialog extends DialogFragment implements
+ DialogInterface.OnClickListener {
+ public static final String TAG = "ConfirmDeletionDialog";
+ private static final String ARG_TOTAL_SPACE = "total_freeable";
+
+ public static ConfirmDeletionDialog newInstance(long freeableBytes) {
+ Bundle args = new Bundle(1);
+ args.putLong(ARG_TOTAL_SPACE, freeableBytes);
+
+ ConfirmDeletionDialog dialog = new ConfirmDeletionDialog();
+ dialog.setArguments(args);
+
+ return dialog;
+ }
+
+ @Override
+ public Dialog onCreateDialog(Bundle savedInstanceState) {
+ final Bundle args = getArguments();
+ long totalFreeableSpace = args.getLong(ARG_TOTAL_SPACE);
+
+ final Context context = getContext();
+ return new AlertDialog.Builder(context)
+ .setMessage(context.getString(R.string.deletion_helper_clear_dialog_message,
+ Formatter.formatFileSize(context, totalFreeableSpace)))
+ .setPositiveButton(R.string.deletion_helper_clear_dialog_remove, this)
+ .setNegativeButton(android.R.string.cancel, null)
+ .create();
+ }
+
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ ((DeletionHelperFragment) getTargetFragment()).clearData();
+ }
+}
diff --git a/src/com/android/settings/deletionhelper/DeletionHelperFragment.java b/src/com/android/settings/deletionhelper/DeletionHelperFragment.java
new file mode 100644
index 0000000..9e1d0ea
--- /dev/null
+++ b/src/com/android/settings/deletionhelper/DeletionHelperFragment.java
@@ -0,0 +1,415 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.deletionhelper;
+
+import android.app.Activity;
+import android.app.Application;
+import android.content.Intent;
+import android.os.Bundle;
+import android.support.v7.preference.Preference;
+import android.text.format.Formatter;
+import android.util.ArraySet;
+import android.util.Log;
+import android.view.View;
+import android.widget.Button;
+import com.android.settings.CollapsibleCheckboxPreferenceGroup;
+import com.android.settings.PhotosDeletionPreference;
+import com.android.settings.SettingsPreferenceFragment;
+import com.android.settings.R;
+import com.android.internal.logging.MetricsProto.MetricsEvent;
+import com.android.settings.applications.AppStateBaseBridge;
+import com.android.settings.overlay.DeletionHelperFeatureProvider;
+import com.android.settings.overlay.FeatureFactory;
+import com.android.settingslib.applications.ApplicationsState;
+import com.android.settingslib.applications.ApplicationsState.AppEntry;
+import com.android.settingslib.applications.ApplicationsState.Callbacks;
+import com.android.settingslib.applications.ApplicationsState.Session;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+
+/**
+ * Settings screen for the deletion helper, which manually removes data which is not recently used.
+ */
+public class DeletionHelperFragment extends SettingsPreferenceFragment implements
+ ApplicationsState.Callbacks, AppStateBaseBridge.Callback,
+ Preference.OnPreferenceChangeListener, DeletionType.FreeableChangedListener,
+ View.OnClickListener {
+ public static final int CLEAR_DATA_RESULT = 1;
+ public static final String FREED_BYTES_KEY = "freed";
+
+ private static final String TAG = "DeletionHelperFragment";
+
+ private static final String EXTRA_HAS_BRIDGE = "hasBridge";
+ private static final String EXTRA_HAS_SIZES = "hasSizes";
+ private static final String EXTRA_CHECKED_SET = "checkedSet";
+
+ private static final String KEY_APPS_GROUP = "apps_group";
+ private static final String KEY_PHOTOS_VIDEOS_PREFERENCE = "delete_photos";
+ private static final String KEY_DOWNLOADS_PREFERENCE = "delete_downloads";
+
+ private static final int DOWNLOADS_LOADER_ID = 1;
+
+ private Button mCancel, mFree;
+ private CollapsibleCheckboxPreferenceGroup mApps;
+ private PhotosDeletionPreference mPhotoPreference;
+ private DownloadsDeletionPreferenceGroup mDownloadsPreference;
+
+ private ApplicationsState mState;
+ private Session mSession;
+ private HashSet<String> mCheckedApplications;
+ private AppStateUsageStatsBridge mDataUsageBridge;
+ private ArrayList<AppEntry> mAppEntries;
+ private boolean mHasReceivedAppEntries, mHasReceivedBridgeCallback, mFinishedLoading;
+ private DeletionHelperFeatureProvider mProvider;
+ private DeletionType mPhotoVideoDeletion;
+ private DownloadsDeletionType mDownloadsDeletion;
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setAnimationAllowed(true);
+ Application app = getActivity().getApplication();
+ mState = ApplicationsState.getInstance(app);
+ mSession = mState.newSession(this);
+ mCheckedApplications = new HashSet<>();
+ mDataUsageBridge = new AppStateUsageStatsBridge(getActivity(), mState, this);
+
+ addPreferencesFromResource(R.xml.deletion_helper_list);
+ mApps = (CollapsibleCheckboxPreferenceGroup) findPreference(KEY_APPS_GROUP);
+ mPhotoPreference = (PhotosDeletionPreference) findPreference(KEY_PHOTOS_VIDEOS_PREFERENCE);
+ mDownloadsPreference =
+ (DownloadsDeletionPreferenceGroup) findPreference(KEY_DOWNLOADS_PREFERENCE);
+ mProvider =
+ FeatureFactory.getFactory(app).getDeletionHelperFeatureProvider();
+ if (mProvider != null) {
+ mPhotoVideoDeletion = mProvider.createPhotoVideoDeletionType(getContext());
+ }
+ mDownloadsDeletion = new DownloadsDeletionType(getActivity());
+
+ if (savedInstanceState != null) {
+ mHasReceivedAppEntries =
+ savedInstanceState.getBoolean(EXTRA_HAS_SIZES, false);
+ mHasReceivedBridgeCallback =
+ savedInstanceState.getBoolean(EXTRA_HAS_BRIDGE, false);
+ mCheckedApplications =
+ (HashSet<String>) savedInstanceState.getSerializable(EXTRA_CHECKED_SET);
+ }
+ }
+
+ private void initializeButtons(View v) {
+ mCancel = (Button) v.findViewById(R.id.skip_button);
+ mCancel.setText(R.string.cancel);
+ mCancel.setOnClickListener(this);
+ mCancel.setVisibility(View.VISIBLE);
+
+ mFree = (Button) v.findViewById(R.id.next_button);
+ mFree.setText(R.string.storage_menu_free);
+ mFree.setOnClickListener(this);
+
+ Button back = (Button) v.findViewById(R.id.back_button);
+ back.setVisibility(View.GONE);
+ }
+
+ private void initializeDeletionPreferences() {
+ if (mProvider == null) {
+ getPreferenceScreen().removePreference(mPhotoPreference);
+ mPhotoPreference = null;
+ } else {
+ mPhotoPreference.registerFreeableChangedListener(this);
+ mPhotoPreference.registerDeletionService(mPhotoVideoDeletion);
+ }
+
+ mDownloadsPreference.registerFreeableChangedListener(this);
+ mDownloadsPreference.registerDeletionService(mDownloadsDeletion);
+ mApps.setOnPreferenceChangeListener(this);
+ }
+
+ @Override
+ public void onViewCreated(View v, Bundle savedInstanceState) {
+ super.onViewCreated(v, savedInstanceState);
+ initializeButtons(v);
+ initializeDeletionPreferences();
+ setLoading(true, false);
+ }
+
+ @Override
+ public void onResume() {
+ super.onResume();
+ mSession.resume();
+ mDataUsageBridge.resume();
+ mDownloadsDeletion.onResume();
+ getLoaderManager().initLoader(DOWNLOADS_LOADER_ID, new Bundle(), mDownloadsDeletion);
+
+ if (mPhotoVideoDeletion != null) {
+ mPhotoVideoDeletion.onResume();
+ }
+ }
+
+
+ @Override
+ public void onSaveInstanceState(Bundle outState) {
+ super.onSaveInstanceState(outState);
+ outState.putBoolean(EXTRA_HAS_SIZES, mHasReceivedAppEntries);
+ outState.putBoolean(EXTRA_HAS_BRIDGE, mHasReceivedBridgeCallback);
+ outState.putSerializable(EXTRA_CHECKED_SET, mCheckedApplications);
+ }
+
+
+ @Override
+ public void onPause() {
+ super.onPause();
+ mDataUsageBridge.pause();
+ mSession.pause();
+ mDownloadsDeletion.onPause();
+
+ if (mPhotoVideoDeletion != null) {
+ mPhotoVideoDeletion.onPause();
+ }
+ }
+
+ private void rebuild() {
+ // Only rebuild if we have the packages and their usage stats.
+ if (!mHasReceivedBridgeCallback || !mHasReceivedAppEntries) {
+ return;
+ }
+
+ final ArrayList<AppEntry> apps =
+ mSession.rebuild(AppStateUsageStatsBridge.FILTER_USAGE_STATS,
+ ApplicationsState.SIZE_COMPARATOR);
+ if (apps == null) return;
+ mAppEntries = apps;
+ refreshAppGroup(apps);
+
+ // All applications should be filled in if we've received the sizes.
+ // setLoading being called multiple times causes flickering, so we only do it once.
+ if (mHasReceivedAppEntries && !mFinishedLoading) {
+ mFinishedLoading = true;
+ setLoading(false, true);
+ getButtonBar().setVisibility(View.VISIBLE);
+ }
+ updateFreeButtonText();
+ }
+
+ private void updateFreeButtonText() {
+ mFree.setText(String.format(getActivity().getString(R.string.deletion_helper_free_button),
+ Formatter.formatFileSize(getActivity(), getTotalFreeableSpace())));
+ }
+
+ @Override
+ public void onRunningStateChanged(boolean running) {
+ // No-op.
+ }
+
+ @Override
+ public void onPackageListChanged() {
+ rebuild();
+ }
+
+ @Override
+ public void onRebuildComplete(ArrayList<AppEntry> apps) {
+ }
+
+ @Override
+ public void onPackageIconChanged() {
+ }
+
+ @Override
+ public void onPackageSizeChanged(String packageName) {
+ rebuild();
+ }
+
+ @Override
+ public void onAllSizesComputed() {
+ rebuild();
+ }
+
+ @Override
+ public void onLauncherInfoChanged() {
+ }
+
+ @Override
+ public void onLoadEntriesCompleted() {
+ mHasReceivedAppEntries = true;
+ rebuild();
+ }
+
+ @Override
+ public void onExtraInfoUpdated() {
+ mHasReceivedBridgeCallback = true;
+ rebuild();
+ }
+
+ @Override
+ protected int getMetricsCategory() {
+ return MetricsEvent.DEVICEINFO_STORAGE;
+ }
+
+ @Override
+ public boolean onPreferenceChange(Preference preference, Object newValue) {
+ boolean checked = (boolean) newValue;
+ if (preference.getKey().equals(mApps.getKey())) {
+ return toggleAllApps(checked);
+ }
+
+ String packageName = ((AppDeletionPreference) preference).getPackageName();
+ if (checked) {
+ mCheckedApplications.add(packageName);
+ } else {
+ mCheckedApplications.remove(packageName);
+
+ // We remove the preference change listener to avoid toggling every app on and off.
+ mApps.setOnPreferenceChangeListener(null);
+ mApps.setChecked(false);
+ mApps.setOnPreferenceChangeListener(this);
+ }
+ updateFreeButtonText();
+ return true;
+ }
+
+ @Override
+ public void onFreeableChanged(int numItems, long freeableBytes) {
+ updateFreeButtonText();
+ }
+
+ @Override
+ public void onClick(View v) {
+ if (v.getId() == mFree.getId()) {
+ ConfirmDeletionDialog dialog =
+ ConfirmDeletionDialog.newInstance(getTotalFreeableSpace());
+ // The 0 is a placeholder for an optional result code.
+ dialog.setTargetFragment(this, 0);
+ dialog.show(getFragmentManager(), ConfirmDeletionDialog.TAG);
+ } else {
+ finishFragment();
+ }
+ }
+
+ /**
+ * Clears out the selected apps and data from the device and closes the fragment.
+ */
+ protected void clearData() {
+ // This should be fine as long as there is only one extra deletion feature.
+ // In the future, this should be done in an async queue in order to not
+ // interfere with the simultaneous PackageDeletionTask.
+ if (mPhotoPreference != null && mPhotoPreference.isChecked()) {
+ mPhotoVideoDeletion.clearFreeableData();
+ }
+ mDownloadsDeletion.clearFreeableData();
+
+ ArraySet<String> apps = new ArraySet<>();
+ for (AppEntry entry : mAppEntries) {
+ if (mCheckedApplications.contains(entry.label)) {
+ synchronized (entry) {
+ apps.add(entry.info.packageName);
+ }
+ }
+ }
+ // TODO: If needed, add an action on the callback.
+ PackageDeletionTask task = new PackageDeletionTask(getActivity().getPackageManager(), apps,
+ new PackageDeletionTask.Callback() {
+ @Override
+ public void onSuccess() {
+ }
+
+ @Override
+ public void onError() {
+ Log.e(TAG, "An error occurred while uninstalling packages.");
+ }
+ });
+ Intent data = new Intent();
+ data.putExtra(FREED_BYTES_KEY, getTotalFreeableSpace());
+ getActivity().setResult(CLEAR_DATA_RESULT, data);
+
+ task.run();
+ finishFragment();
+ }
+
+ private long getTotalFreeableSpace() {
+ long freeableSpace = 0;
+ freeableSpace += getTotalAppsFreeableSpace(false);
+ if (mPhotoPreference != null) {
+ freeableSpace += mPhotoPreference.getFreeableBytes();
+ }
+ freeableSpace += mDownloadsDeletion.getFreeableBytes();
+ return freeableSpace;
+ }
+
+ private void refreshAppGroup(ArrayList<AppEntry> apps) {
+ int entryCount = apps.size();
+ cacheRemoveAllPrefs(mApps);
+ for (int i = 0; i < entryCount; i++) {
+ AppEntry entry = apps.get(i);
+ final String packageName = entry.label;
+ AppDeletionPreference preference =
+ (AppDeletionPreference) getCachedPreference(entry.label);
+ if (preference == null) {
+ preference = new AppDeletionPreference(getActivity(), entry, mState);
+ preference.setKey(packageName);
+ preference.setOnPreferenceChangeListener(this);
+ mApps.addPreference(preference);
+ }
+ preference.setChecked(mCheckedApplications.contains(packageName));
+ preference.setOrder(i);
+ }
+ removeCachedPrefs(mApps);
+ updateAppsGroupText();
+ }
+
+ private long getTotalAppsFreeableSpace(boolean countUnchecked) {
+ long freeableSpace = 0;
+ if (mAppEntries != null) {
+ for (int i = 0; i < mAppEntries.size(); i++) {
+ final AppEntry entry = mAppEntries.get(i);
+ long entrySize = mAppEntries.get(i).size;
+ // If the entrySize is negative, it is either an unknown size or an error occurred.
+ if ((countUnchecked ||
+ mCheckedApplications.contains(entry.label)) && entrySize > 0) {
+ freeableSpace += entrySize;
+ }
+ }
+ }
+
+ return freeableSpace;
+ }
+
+ private void updateAppsGroupText() {
+ if (mAppEntries != null) {
+ Activity app = getActivity();
+ mApps.setTitle(app.getString(R.string.deletion_helper_apps_group_title,
+ mAppEntries.size()));
+ mApps.setSummary(app.getString(R.string.deletion_helper_apps_group_summary,
+ Formatter.formatFileSize(app,
+ getTotalAppsFreeableSpace(true)),
+ AppStateUsageStatsBridge.UNUSED_DAYS_DELETION_THRESHOLD));
+ }
+ }
+
+ private boolean toggleAllApps(boolean checked) {
+ for (AppEntry entry : mAppEntries) {
+ final String packageName = entry.label;
+ if (checked) {
+ mCheckedApplications.add(packageName);
+ } else {
+ mCheckedApplications.remove(packageName);
+ }
+ }
+ refreshAppGroup(mAppEntries);
+ updateFreeButtonText();
+ return true;
+ }
+}
\ No newline at end of file
diff --git a/src/com/android/settings/deletionhelper/DeletionType.java b/src/com/android/settings/deletionhelper/DeletionType.java
new file mode 100644
index 0000000..ee1e0f7
--- /dev/null
+++ b/src/com/android/settings/deletionhelper/DeletionType.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.deletionhelper;
+
+import android.content.Context;
+import android.support.v7.preference.PreferenceGroup;
+import android.support.v7.preference.Preference;
+
+/**
+ * Helper for the Deletion Helper which can query, clear out, and visualize deletable data.
+ * This could represent a helper for deleting photos, downloads, movies, etc.
+ */
+public interface DeletionType {
+ /**
+ * Registers a callback to call when the amount of freeable space is updated.
+ * @param listener A callback.
+ */
+ void registerFreeableChangedListener(FreeableChangedListener listener);
+
+ /**
+ * Resumes an operation, intended to be called when the deletion fragment resumes.
+ */
+ void onResume();
+
+ /**
+ * Pauses the feature's operations, intended to be called when the deletion fragment is paused.
+ */
+ void onPause();
+
+ /**
+ * Asynchronously free up the freeable information for the feature.
+ */
+ void clearFreeableData();
+
+ /**
+ * Callback interface to listen for when a deletion feature's amount of freeable space updates.
+ */
+ interface FreeableChangedListener {
+ void onFreeableChanged(int numItems, long bytesFreeable);
+ }
+}
diff --git a/src/com/android/settings/deletionhelper/DownloadsDeletionPreferenceGroup.java b/src/com/android/settings/deletionhelper/DownloadsDeletionPreferenceGroup.java
new file mode 100644
index 0000000..440b962
--- /dev/null
+++ b/src/com/android/settings/deletionhelper/DownloadsDeletionPreferenceGroup.java
@@ -0,0 +1,157 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.deletionhelper;
+
+import android.content.Context;
+import android.support.v7.preference.Preference;
+import android.text.format.DateUtils;
+import android.text.format.Formatter;
+import android.util.ArrayMap;
+import android.util.AttributeSet;
+import com.android.settings.CollapsibleCheckboxPreferenceGroup;
+import com.android.settings.R;
+
+import java.io.File;
+import java.util.Set;
+
+/**
+ * DownloadsDeletionPreferenceGroup defines a checkable preference group which contains
+ * downloads file deletion preferences.
+ */
+public class DownloadsDeletionPreferenceGroup extends CollapsibleCheckboxPreferenceGroup
+ implements DeletionType.FreeableChangedListener, Preference.OnPreferenceChangeListener {
+ private DownloadsDeletionType mDeletionType;
+ private DeletionType.FreeableChangedListener mListener;
+
+ public DownloadsDeletionPreferenceGroup(Context context) {
+ this(context, null);
+ }
+
+ public DownloadsDeletionPreferenceGroup(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ setOrderingAsAdded(false);
+ setOnPreferenceChangeListener(this);
+ }
+
+ /**
+ * Set up a deletion type to get info for the preference group.
+ * @param type A {@link DownloadsDeletionType}.
+ */
+ public void registerDeletionService(DownloadsDeletionType type) {
+ mDeletionType = type;
+ mDeletionType.registerFreeableChangedListener(this);
+ }
+
+ /**
+ * Registers a callback to be called when the amount of freeable space updates.
+ * @param listener The callback listener.
+ */
+ public void registerFreeableChangedListener(DeletionType.FreeableChangedListener listener) {
+ mListener = listener;
+ }
+
+ @Override
+ public void onFreeableChanged(int numItems, long freeableBytes) {
+ updatePreferenceText(numItems, freeableBytes, mDeletionType.getMostRecentLastModified());
+ maybeUpdateListener(numItems, freeableBytes);
+ updateFiles();
+ }
+
+ @Override
+ public boolean onPreferenceChange(Preference preference, Object newValue) {
+ boolean checked = (boolean) newValue;
+ if (!checked) {
+ // Temporarily stop listening to avoid propagating the checked change to children.
+ setOnPreferenceChangeListener(null);
+ setChecked(false);
+ setOnPreferenceChangeListener(this);
+ }
+
+ // If the group checkbox changed, we need to toggle every child preference.
+ if (preference == this) {
+ for (int i = 0; i < getPreferenceCount(); i++) {
+ DownloadsFilePreference p = (DownloadsFilePreference) getPreference(i);
+ p.setOnPreferenceChangeListener(null);
+ mDeletionType.toggleFile(p.getFile(), checked);
+ p.setChecked(checked);
+ p.setOnPreferenceChangeListener(this);
+ }
+ maybeUpdateListener(mDeletionType.getFiles().size(), mDeletionType.getFreeableBytes());
+ return true;
+ }
+
+ // If a single DownloadFilePreference changed, we need to toggle just itself.
+ DownloadsFilePreference p = (DownloadsFilePreference) preference;
+ mDeletionType.toggleFile(p.getFile(), checked);
+ maybeUpdateListener(mDeletionType.getFiles().size(), mDeletionType.getFreeableBytes());
+ return true;
+ }
+
+
+ private void updatePreferenceText(int itemCount, long bytes, long mostRecent) {
+ Context context = getContext();
+ setTitle(context.getString(R.string.deletion_helper_downloads_title, itemCount));
+ // If there are no files to clear, show the empty text instead.
+ if (itemCount != 0) {
+ setSummary(context.getString(R.string.deletion_helper_downloads_summary,
+ Formatter.formatFileSize(context, bytes),
+ DateUtils.getRelativeTimeSpanString(mostRecent,
+ System.currentTimeMillis(),
+ DateUtils.DAY_IN_MILLIS,
+ DateUtils.FORMAT_ABBREV_RELATIVE)));
+ } else {
+ setSummary(context.getString(R.string.deletion_helper_downloads_summary_empty,
+ Formatter.formatFileSize(context, bytes)));
+ }
+ }
+
+ private void maybeUpdateListener(int numItems, long bytesFreeable) {
+ if (mListener != null) {
+ mListener.onFreeableChanged(numItems, bytesFreeable);
+ }
+ }
+
+ private void updateFiles() {
+ // TODO: Remove impl overlap with the cached preferences methods in
+ // SettingsPreferenceFragment.
+
+ // Cache the existing file preferences.
+ ArrayMap<String, Preference> cachedPreferences = new ArrayMap<>();
+ for (int i = 0; i < getPreferenceCount(); i++) {
+ Preference p = getPreference(i);
+ cachedPreferences.put(p.getKey(), p);
+ }
+
+ // Iterate over all of the files and re-use the old file preference, if it exists.
+ Set<File> files = mDeletionType.getFiles();
+ for (File file : files) {
+ DownloadsFilePreference filePreference =
+ (DownloadsFilePreference) cachedPreferences.remove(file.getPath());
+ if (filePreference == null) {
+ filePreference = new DownloadsFilePreference(getContext(), file);
+ filePreference.setChecked(isChecked());
+ filePreference.setOnPreferenceChangeListener(this);
+ }
+ addPreference(filePreference);
+ }
+
+ // Remove all of the unused preferences.
+ for (Preference p : cachedPreferences.values()) {
+ removePreference(p);
+ }
+ }
+}
diff --git a/src/com/android/settings/deletionhelper/DownloadsDeletionType.java b/src/com/android/settings/deletionhelper/DownloadsDeletionType.java
new file mode 100644
index 0000000..3a251eb
--- /dev/null
+++ b/src/com/android/settings/deletionhelper/DownloadsDeletionType.java
@@ -0,0 +1,149 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.deletionhelper;
+
+import android.app.LoaderManager.LoaderCallbacks;
+import android.content.Context;
+import android.content.Loader;
+import android.os.AsyncTask;
+import android.os.Bundle;
+import android.os.Environment;
+import android.util.ArrayMap;
+import android.util.ArraySet;
+import com.android.settings.deletionhelper.FetchDownloadsLoader.DownloadsResult;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * The DownloadsDeletionType provides stale download file information to the
+ * {@link DownloadsDeletionPreferenceGroup}.
+ */
+public class DownloadsDeletionType implements DeletionType, LoaderCallbacks<DownloadsResult> {
+ private long mBytes;
+ private long mMostRecent;
+ private FreeableChangedListener mListener;
+ private Context mContext;
+ private ArrayMap<File, Boolean> mFiles;
+
+ public DownloadsDeletionType(Context context) {
+ mContext = context;
+ mFiles = new ArrayMap<>();
+ }
+
+ @Override
+ public void registerFreeableChangedListener(FreeableChangedListener listener) {
+ mListener = listener;
+ if (mFiles != null) {
+ maybeUpdateListener();
+ }
+ }
+
+ @Override
+ public void onResume() {
+ }
+
+ @Override
+ public void onPause() {
+ }
+
+ @Override
+ public void clearFreeableData() {
+ if (mFiles != null) {
+ AsyncTask.execute(new Runnable() {
+ @Override
+ public void run() {
+ for (Map.Entry<File, Boolean> entry : mFiles.entrySet()) {
+ if (entry.getValue()) {
+ entry.getKey().delete();
+ }
+ }
+ }
+ });
+ }
+ }
+
+ @Override
+ public Loader<DownloadsResult> onCreateLoader(int id, Bundle args) {
+ return new FetchDownloadsLoader(mContext,
+ Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS));
+ }
+
+ @Override
+ public void onLoadFinished(Loader<DownloadsResult> loader, DownloadsResult data) {
+ mMostRecent = data.youngestLastModified;
+ for (File file : data.files) {
+ if (mFiles.containsKey(file)) {
+ continue;
+ }
+ mFiles.put(file, false);
+ }
+ mBytes = data.totalSize;
+ maybeUpdateListener();
+ }
+
+ @Override
+ public void onLoaderReset(Loader<DownloadsResult> loader) {
+ }
+
+ /**
+ * Returns the most recent last modified time for any clearable file.
+ * @return The last modified time.
+ */
+ public long getMostRecentLastModified() {
+ return mMostRecent;
+ }
+
+ /**
+ * Returns the files in the Downloads folder after the loader task finishes.
+ */
+ public Set<File> getFiles() {
+ if (mFiles == null) {
+ return null;
+ }
+ return mFiles.keySet();
+ }
+
+ /**
+ * Toggle if a file should be deleted when the service is asked to clear files.
+ */
+ public void toggleFile(File file, boolean checked) {
+ mFiles.put(file, checked);
+ }
+
+ /**
+ * Returns the number of bytes that would be cleared if the deletion tasks runs.
+ */
+ public long getFreeableBytes() {
+ long freedBytes = 0;
+ for (Map.Entry<File, Boolean> entry : mFiles.entrySet()) {
+ if (entry.getValue()) {
+ freedBytes += entry.getKey().length();
+ }
+ }
+ return freedBytes;
+ }
+
+ private void maybeUpdateListener() {
+ if (mListener != null) {
+ mListener.onFreeableChanged(mFiles.size(), mBytes);
+ }
+ }
+}
diff --git a/src/com/android/settings/deletionhelper/DownloadsFilePreference.java b/src/com/android/settings/deletionhelper/DownloadsFilePreference.java
new file mode 100644
index 0000000..af8f6b6
--- /dev/null
+++ b/src/com/android/settings/deletionhelper/DownloadsFilePreference.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.deletionhelper;
+
+import android.content.Context;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.CheckBoxPreference;
+import android.text.format.DateUtils;
+import android.text.format.Formatter;
+import com.android.settings.R;
+
+import java.io.File;
+
+/**
+ * DownloadsFilePreference is a preference representing a file in the Downloads folder
+ * with a checkbox that represents if the file should be deleted.
+ */
+public class DownloadsFilePreference extends CheckBoxPreference {
+ private File mFile;
+
+ public DownloadsFilePreference(Context context, File file) {
+ super(context);
+ mFile = file;
+ setKey(mFile.getPath());
+ setTitle(file.getName());
+ setSummary(context.getString(R.string.deletion_helper_downloads_summary,
+ Formatter.formatFileSize(getContext(), file.length()),
+ DateUtils.getRelativeTimeSpanString(mFile.lastModified(),
+ System.currentTimeMillis(),
+ DateUtils.DAY_IN_MILLIS,
+ DateUtils.FORMAT_ABBREV_RELATIVE)));
+ }
+
+ public File getFile() {
+ return mFile;
+ }
+
+ @Override
+ public int compareTo(Preference other) {
+ if (other == null) {
+ return 1;
+ }
+
+ if (other instanceof DownloadsFilePreference) {
+ DownloadsFilePreference preference = (DownloadsFilePreference) other;
+ return Long.compare(getFile().length(), preference.getFile().length());
+ } else {
+ // If a non-DownloadsFilePreference appears, consider ourselves to be greater.
+ // This means if a non-DownloadsFilePreference sneaks into a DownloadsPreferenceGroup
+ // then the DownloadsFilePreference will appear higher.
+ return 1;
+ }
+ }
+}
diff --git a/src/com/android/settings/deletionhelper/FetchDownloadsLoader.java b/src/com/android/settings/deletionhelper/FetchDownloadsLoader.java
new file mode 100644
index 0000000..86352c9
--- /dev/null
+++ b/src/com/android/settings/deletionhelper/FetchDownloadsLoader.java
@@ -0,0 +1,96 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.deletionhelper;
+
+import android.content.Context;
+import android.support.annotation.VisibleForTesting;
+import com.android.settings.utils.AsyncLoader;
+
+import java.io.File;
+import java.util.ArrayList;
+
+/**
+ * FetchDownloadsLoader is an asynchronous task which returns files in the Downloads
+ * directory which have not been modified in longer than 90 days.
+ */
+public class FetchDownloadsLoader extends
+ AsyncLoader<FetchDownloadsLoader.DownloadsResult> {
+ private File mDirectory;
+
+ /**
+ * Sets up a FetchDownloadsLoader in any directory.
+ * @param directory The directory to look into.
+ */
+ public FetchDownloadsLoader(Context context, File directory) {
+ super(context);
+ mDirectory = directory;
+ }
+
+ @Override
+ protected void onDiscardResult(DownloadsResult result) {}
+
+ @Override
+ public DownloadsResult loadInBackground() {
+ return collectFiles(mDirectory);
+ }
+
+ @VisibleForTesting
+ static DownloadsResult collectFiles(File dir) {
+ return collectFiles(dir, new DownloadsResult());
+ }
+
+ private static DownloadsResult collectFiles(File dir, DownloadsResult result) {
+ File downloadFiles[] = dir.listFiles();
+ if (downloadFiles == null) {
+ }
+ if (downloadFiles != null && downloadFiles.length > 0) {
+ for (File currentFile : downloadFiles) {
+ if (currentFile.isDirectory()) {
+ collectFiles(currentFile, result);
+ } else {
+ if (currentFile.lastModified() < result.youngestLastModified) {
+ result.youngestLastModified = currentFile.lastModified();
+ }
+ result.files.add(currentFile);
+ result.totalSize += currentFile.length();
+ }
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * The DownloadsResult is the result of a {@link FetchDownloadsLoader} with the files
+ * and the amount of space they use.
+ */
+ public static class DownloadsResult {
+ public long totalSize;
+ public long youngestLastModified;
+ public ArrayList<File> files;
+
+ public DownloadsResult() {
+ this(0, Long.MAX_VALUE, new ArrayList<File>());
+ }
+
+ public DownloadsResult(long totalSize, long youngestLastModified, ArrayList<File> files) {
+ this.totalSize = totalSize;
+ this.youngestLastModified = youngestLastModified;
+ this.files = files;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/com/android/settings/deletionhelper/PackageDeletionTask.java b/src/com/android/settings/deletionhelper/PackageDeletionTask.java
new file mode 100644
index 0000000..69e6a6c
--- /dev/null
+++ b/src/com/android/settings/deletionhelper/PackageDeletionTask.java
@@ -0,0 +1,58 @@
+package com.android.settings.deletionhelper;
+
+import android.content.pm.IPackageDeleteObserver;
+import android.content.pm.PackageManager;
+import android.os.UserHandle;
+
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicInteger;
+
+/**
+ * Deletes a specified set of apps as a specified user and calls back once done.
+ */
+public class PackageDeletionTask {
+ private Set<String> mPackages;
+ private Callback mCallback;
+ private PackageManager mPm;
+ private UserHandle mUser;
+
+ public PackageDeletionTask(PackageManager pm, Set<String> packageNames, Callback callback) {
+ mPackages = packageNames;
+ mCallback = callback;
+ mPm = pm;
+ mUser = android.os.Process.myUserHandle();
+ }
+
+ public void run() {
+ PackageDeletionObserver observer = new PackageDeletionObserver(mPackages.size());
+ for (String packageName : mPackages) {
+ mPm.deletePackageAsUser(packageName, observer, 0, mUser.getIdentifier());
+ }
+ }
+
+ private class PackageDeletionObserver extends IPackageDeleteObserver.Stub {
+ private final AtomicInteger mPackagesRemaining = new AtomicInteger(0);
+
+ public PackageDeletionObserver(int packages) {
+ mPackagesRemaining.set(packages);
+ }
+
+ @Override
+ public void packageDeleted(String packageName, int returnCode) {
+ if (returnCode != PackageManager.DELETE_SUCCEEDED) {
+ mCallback.onError();
+ return;
+ }
+
+ int remaining = mPackagesRemaining.decrementAndGet();
+ if (remaining == 0) {
+ mCallback.onSuccess();
+ }
+ }
+ }
+
+ public static abstract class Callback {
+ public abstract void onSuccess();
+ public abstract void onError();
+ }
+}
diff --git a/src/com/android/settings/deletionhelper/StorageManagerUpsellDialog.java b/src/com/android/settings/deletionhelper/StorageManagerUpsellDialog.java
new file mode 100644
index 0000000..e72933a
--- /dev/null
+++ b/src/com/android/settings/deletionhelper/StorageManagerUpsellDialog.java
@@ -0,0 +1,128 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package com.android.settings.deletionhelper;
+
+import android.app.AlertDialog;
+import android.app.Dialog;
+import android.app.DialogFragment;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.SharedPreferences;
+import android.os.Bundle;
+import android.text.format.Formatter;
+import com.android.settings.R;
+import android.util.Log;
+
+import java.util.concurrent.TimeUnit;
+
+/**
+ * Fragment for activating the storage manager after a manual clear.
+ */
+public class StorageManagerUpsellDialog extends DialogFragment
+ implements DialogInterface.OnClickListener, DialogInterface.OnDismissListener {
+ public static final String TAG = "StorageManagerUpsellDialog";
+ private static final String SHARED_PREFERENCES_NAME = "StorageManagerUpsellDialog";
+ private static final String NEXT_SHOW_TIME = "next_show_time";
+ private static final String DISMISSED_COUNT = "dismissed_count";
+ private static final String NO_THANKS_COUNT = "no_thanks_count";
+
+ private static final String ARGS_FREED_BYTES = "freed_bytes";
+
+ private static final long NEVER = -1;
+ private static final long DISMISS_SHORT_DELAY = TimeUnit.DAYS.toMillis(14);
+ private static final long DISMISS_LONG_DELAY = TimeUnit.DAYS.toMillis(90);
+ private static final int DISMISS_LONG_THRESHOLD = 9;
+ private static final long NO_THANKS_SHORT_DELAY = TimeUnit.DAYS.toMillis(90);
+ private static final long NO_THANKS_LONG_DELAY = NEVER;
+ private static final int NO_THANKS_LONG_THRESHOLD = 3;
+
+ public static StorageManagerUpsellDialog newInstance(long freedBytes) {
+ StorageManagerUpsellDialog dialog = new StorageManagerUpsellDialog();
+ Bundle args = new Bundle(1);
+ args.putLong(ARGS_FREED_BYTES, freedBytes);
+ dialog.setArguments(args);
+ return dialog;
+ }
+
+ @Override
+ public Dialog onCreateDialog(Bundle savedInstanceState) {
+ final Bundle args = getArguments();
+ long freedBytes = args.getLong(ARGS_FREED_BYTES);
+
+ final Context context = getContext();
+ return new AlertDialog.Builder(context)
+ .setTitle(context.getString(R.string.deletion_helper_upsell_title,
+ Formatter.formatFileSize(context, freedBytes)))
+ .setMessage(context.getString(R.string.deletion_helper_upsell_summary))
+ .setPositiveButton(R.string.deletion_helper_upsell_activate, this)
+ .setNegativeButton(R.string.deletion_helper_upsell_cancel, this)
+ .create();
+ }
+
+ @Override
+ public void onClick(DialogInterface dialog, int buttonId) {
+ if (buttonId == DialogInterface.BUTTON_POSITIVE) {
+ // TODO: Activate the storage manager once the storage manager is landed.
+ } else {
+ SharedPreferences sp = getSharedPreferences(getContext());
+ int noThanksCount = sp.getInt(NO_THANKS_COUNT, 0) + 1;
+ SharedPreferences.Editor editor = sp.edit();
+ editor.putInt(NO_THANKS_COUNT, noThanksCount);
+ editor.putLong(NEXT_SHOW_TIME,
+ System.currentTimeMillis() + getNoThanksDelay(noThanksCount));
+ editor.apply();
+ }
+ }
+
+ @Override
+ public void onCancel(DialogInterface dialog) {
+ SharedPreferences sp = getSharedPreferences(getContext());
+ int dismissCount = sp.getInt(DISMISSED_COUNT, 0) + 1;
+ SharedPreferences.Editor editor = sp.edit();
+ editor.putInt(DISMISSED_COUNT, dismissCount);
+ editor.putLong(NEXT_SHOW_TIME,
+ System.currentTimeMillis() + getDismissDelay(dismissCount));
+ editor.apply();
+ }
+
+ /**
+ * Returns if the dialog should be shown, given the delays between when it is shown.
+ * @param context Context to get shared preferences for determining the next show time.
+ */
+ public static boolean shouldShow(Context context) {
+ // TODO: If the Storage Manager is enabled, return false.
+ long nextTimeToShow = getSharedPreferences(context).getLong(NEXT_SHOW_TIME, 0);
+
+ if (nextTimeToShow == NEVER) {
+ return false;
+ }
+
+ return System.currentTimeMillis() > nextTimeToShow;
+ }
+
+ private static SharedPreferences getSharedPreferences(Context context) {
+ return context.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
+ }
+
+ private static long getNoThanksDelay(int noThanksCount) {
+ return (noThanksCount > NO_THANKS_LONG_THRESHOLD)
+ ? NO_THANKS_LONG_DELAY : NO_THANKS_SHORT_DELAY;
+ }
+
+ private static long getDismissDelay(int dismissCount) {
+ return (dismissCount > DISMISS_LONG_THRESHOLD)
+ ? DISMISS_LONG_DELAY : DISMISS_SHORT_DELAY;
+ }
+}
diff --git a/src/com/android/settings/deviceinfo/PrivateVolumeSettings.java b/src/com/android/settings/deviceinfo/PrivateVolumeSettings.java
index c9a1fb7..7633407 100644
--- a/src/com/android/settings/deviceinfo/PrivateVolumeSettings.java
+++ b/src/com/android/settings/deviceinfo/PrivateVolumeSettings.java
@@ -30,6 +30,7 @@
import android.content.pm.UserInfo;
import android.os.Bundle;
import android.os.Environment;
+import android.os.SystemProperties;
import android.os.UserHandle;
import android.os.UserManager;
import android.os.storage.StorageEventListener;
@@ -58,6 +59,9 @@
import com.android.settings.SettingsPreferenceFragment;
import com.android.settings.Utils;
import com.android.settings.applications.ManageApplications;
+import com.android.settings.deletionhelper.DeletionHelperFragment;
+import com.android.settings.deletionhelper.AutomaticStorageManagerSettings;
+import com.android.settings.deletionhelper.StorageManagerUpsellDialog;
import com.android.settings.deviceinfo.StorageSettings.MountTask;
import com.android.settingslib.deviceinfo.StorageMeasurement;
import com.android.settingslib.deviceinfo.StorageMeasurement.MeasurementDetails;
@@ -81,13 +85,19 @@
private static final String TAG_RENAME = "rename";
private static final String TAG_OTHER_INFO = "otherInfo";
+ private static final String TAG_SYSTEM_INFO = "systemInfo";
private static final String TAG_USER_INFO = "userInfo";
private static final String TAG_CONFIRM_CLEAR_CACHE = "confirmClearCache";
+ private static final String EXTRA_VOLUME_SIZE = "volume_size";
+
private static final String AUTHORITY_MEDIA = "com.android.providers.media.documents";
+ private static final String STORAGE_MANAGER_PROPERTY = "ro.storage_manager.enabled";
+
private static final int[] ITEMS_NO_SHOW_SHARED = new int[] {
R.string.storage_detail_apps,
+ R.string.storage_detail_system,
};
private static final int[] ITEMS_SHOW_SHARED = new int[] {
@@ -95,15 +105,21 @@
R.string.storage_detail_images,
R.string.storage_detail_videos,
R.string.storage_detail_audio,
- R.string.storage_detail_other
+ R.string.storage_detail_system,
+ R.string.storage_detail_other,
};
+ private static final int DELETION_HELPER_SETTINGS = 1;
+ private static final int DELETION_HELPER_CLEAR = 1;
+
private StorageManager mStorageManager;
private UserManager mUserManager;
private String mVolumeId;
private VolumeInfo mVolume;
private VolumeInfo mSharedVolume;
+ private long mTotalSize;
+ private long mSystemSize;
private StorageMeasurement mMeasure;
@@ -116,6 +132,7 @@
private int mItemPoolIndex;
private Preference mExplore;
+ private Preference mAutomaticStorageManagement;
private boolean mNeedsUpdate;
@@ -145,6 +162,14 @@
mVolumeId = getArguments().getString(VolumeInfo.EXTRA_VOLUME_ID);
mVolume = mStorageManager.findVolumeById(mVolumeId);
+ final long sharedDataSize = mVolume.getPath().getTotalSpace();
+ mTotalSize = getArguments().getLong(EXTRA_VOLUME_SIZE, 0);
+ mSystemSize = mTotalSize - sharedDataSize;
+ if (mTotalSize <= 0) {
+ mTotalSize = sharedDataSize;
+ mSystemSize = 0;
+ }
+
// Find the emulated shared storage layered above this private volume
mSharedVolume = mStorageManager.findEmulatedForPrivate(mVolume);
@@ -163,6 +188,7 @@
mCurrentUser = mUserManager.getUserInfo(UserHandle.myUserId());
mExplore = buildAction(R.string.storage_menu_explore);
+ mAutomaticStorageManagement = buildAction(R.string.storage_menu_manage);
mNeedsUpdate = true;
@@ -189,6 +215,9 @@
screen.removeAll();
+ if (SystemProperties.getBoolean(STORAGE_MANAGER_PROPERTY, false)) {
+ addPreference(screen, mAutomaticStorageManagement);
+ }
addPreference(screen, mSummary);
List<UserInfo> allUsers = mUserManager.getUsers();
@@ -229,17 +258,15 @@
addPreference(screen, mExplore);
}
- final File file = mVolume.getPath();
- final long totalBytes = file.getTotalSpace();
- final long freeBytes = file.getFreeSpace();
- final long usedBytes = totalBytes - freeBytes;
+ final long freeBytes = mVolume.getPath().getFreeSpace();
+ final long usedBytes = mTotalSize - freeBytes;
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));
+ Formatter.formatFileSize(context, mTotalSize)));
+ mSummary.setPercent((int) ((usedBytes * 100) / mTotalSize));
mMeasure.forceMeasure();
mNeedsUpdate = false;
@@ -274,6 +301,10 @@
}
private void addItem(PreferenceGroup group, int titleRes, CharSequence title, int userId) {
+ if (titleRes == R.string.storage_detail_system && mSystemSize <= 0) {
+ Log.w(TAG, "Skipping System storage because its size is " + mSystemSize);
+ return;
+ }
StorageItemPreference item;
if (mItemPoolIndex < mItemPreferencePool.size()) {
item = mItemPreferencePool.get(mItemPoolIndex);
@@ -306,6 +337,10 @@
return pref;
}
+ static void setVolumeSize(Bundle args, long size) {
+ args.putLong(EXTRA_VOLUME_SIZE, size);
+ }
+
@Override
public void onResume() {
super.onResume();
@@ -355,6 +390,7 @@
final MenuItem unmount = menu.findItem(R.id.storage_unmount);
final MenuItem format = menu.findItem(R.id.storage_format);
final MenuItem migrate = menu.findItem(R.id.storage_migrate);
+ final MenuItem manage = menu.findItem(R.id.storage_free);
// Actions live in menu for non-internal private volumes; they're shown
// as preference items for public volumes.
@@ -363,11 +399,13 @@
mount.setVisible(false);
unmount.setVisible(false);
format.setVisible(false);
+ manage.setVisible(SystemProperties.getBoolean(STORAGE_MANAGER_PROPERTY, false));
} else {
rename.setVisible(mVolume.getType() == VolumeInfo.TYPE_PRIVATE);
mount.setVisible(mVolume.getState() == VolumeInfo.STATE_UNMOUNTED);
unmount.setVisible(mVolume.isMountedReadable());
format.setVisible(true);
+ manage.setVisible(false);
}
format.setTitle(R.string.storage_menu_format_public);
@@ -406,6 +444,10 @@
intent.putExtra(VolumeInfo.EXTRA_VOLUME_ID, mVolume.getId());
startActivity(intent);
return true;
+ case R.id.storage_free:
+ startFragment(this, DeletionHelperFragment.class.getCanonicalName(),
+ R.string.deletion_helper_title, DELETION_HELPER_SETTINGS, args);
+ return true;
}
return super.onOptionsItemSelected(item);
}
@@ -453,6 +495,11 @@
intent.addCategory(Intent.CATEGORY_DEFAULT);
} break;
+ case R.string.storage_detail_system: {
+ SystemInfoFragment.show(this);
+ return true;
+
+ }
case R.string.storage_detail_other: {
OtherInfoFragment.show(this, mStorageManager.getBestVolumeDescription(mVolume),
mSharedVolume);
@@ -467,6 +514,11 @@
case R.string.storage_menu_explore: {
intent = mSharedVolume.buildBrowseIntent();
} break;
+ case R.string.storage_menu_manage: {
+ startFragment(this, AutomaticStorageManagerSettings.class.getCanonicalName(),
+ R.string.automatic_storage_manager_settings, 0, null);
+ return true;
+ }
case 0: {
UserInfoFragment.show(this, pref.getTitle(), pref.getSummary());
return true;
@@ -488,6 +540,18 @@
return super.onPreferenceTreeClick(pref);
}
+ @Override
+ public void onActivityResult(int requestCode, int resultCode, Intent data) {
+ super.onActivityResult(requestCode, resultCode, data);
+ if (requestCode == DELETION_HELPER_SETTINGS && resultCode == DELETION_HELPER_CLEAR &&
+ StorageManagerUpsellDialog.shouldShow(getActivity())) {
+ long freedBytes = data.getLongExtra(DeletionHelperFragment.FREED_BYTES_KEY, 0);
+ StorageManagerUpsellDialog dialog =
+ StorageManagerUpsellDialog.newInstance(freedBytes);
+ dialog.show(getFragmentManager(), StorageManagerUpsellDialog.TAG);
+ }
+ }
+
private final MeasurementReceiver mReceiver = new MeasurementReceiver() {
@Override
public void onDetailsChanged(MeasurementDetails details) {
@@ -506,6 +570,9 @@
itemTitleId = 0;
}
switch (itemTitleId) {
+ case R.string.storage_detail_system: {
+ updatePreference(item, mSystemSize);
+ } break;
case R.string.storage_detail_apps: {
updatePreference(item, details.appsSize.get(userId));
} break;
@@ -542,7 +609,7 @@
}
private void updatePreference(StorageItemPreference pref, long size) {
- pref.setStorageSize(size, mVolume.getPath().getTotalSpace());
+ pref.setStorageSize(size, mTotalSize);
}
private boolean isProfileOf(UserInfo user, UserInfo profile) {
@@ -633,6 +700,24 @@
}
}
+ public static class SystemInfoFragment extends DialogFragment {
+ public static void show(Fragment parent) {
+ if (!parent.isAdded()) return;
+
+ final SystemInfoFragment dialog = new SystemInfoFragment();
+ dialog.setTargetFragment(parent, 0);
+ dialog.show(parent.getFragmentManager(), TAG_SYSTEM_INFO);
+ }
+
+ @Override
+ public Dialog onCreateDialog(Bundle savedInstanceState) {
+ return new AlertDialog.Builder(getActivity())
+ .setMessage(R.string.storage_detail_dialog_system)
+ .setPositiveButton(android.R.string.ok, null)
+ .create();
+ }
+ }
+
public static class OtherInfoFragment extends DialogFragment {
public static void show(Fragment parent, String title, VolumeInfo sharedVol) {
if (!parent.isAdded()) return;
diff --git a/src/com/android/settings/deviceinfo/StorageSettings.java b/src/com/android/settings/deviceinfo/StorageSettings.java
index 5ae3986..8f0e91b 100644
--- a/src/com/android/settings/deviceinfo/StorageSettings.java
+++ b/src/com/android/settings/deviceinfo/StorageSettings.java
@@ -42,6 +42,7 @@
import android.text.format.Formatter.BytesResult;
import android.util.Log;
import android.widget.Toast;
+
import com.android.internal.logging.MetricsProto.MetricsEvent;
import com.android.settings.R;
import com.android.settings.SettingsPreferenceFragment;
@@ -50,7 +51,6 @@
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settings.search.Indexable;
import com.android.settings.search.SearchIndexableRaw;
-
import com.android.settingslib.RestrictedLockUtils;
import com.android.settingslib.drawer.SettingsDrawerActivity;
@@ -88,6 +88,7 @@
private PreferenceCategory mExternalCategory;
private StorageSummaryPreference mInternalSummary;
+ private static long sTotalInternalStorage;
@Override
protected int getMetricsCategory() {
@@ -108,6 +109,8 @@
mStorageManager = context.getSystemService(StorageManager.class);
mStorageManager.registerListener(mStorageListener);
+ sTotalInternalStorage = mStorageManager.getPrimaryStorageSize();
+
addPreferencesFromResource(R.xml.device_info_storage);
mInternalCategory = (PreferenceCategory) findPreference("storage_internal");
@@ -162,15 +165,16 @@
if (vol.getType() == VolumeInfo.TYPE_PRIVATE) {
final int color = COLOR_PRIVATE[privateCount++ % COLOR_PRIVATE.length];
mInternalCategory.addPreference(
- new StorageVolumePreference(context, vol, color));
+ new StorageVolumePreference(context, vol, color, sTotalInternalStorage));
if (vol.isMountedReadable()) {
final File path = vol.getPath();
privateUsedBytes += path.getTotalSpace() - path.getFreeSpace();
- privateTotalBytes += path.getTotalSpace();
+ privateTotalBytes += sTotalInternalStorage > 0
+ ? sTotalInternalStorage : path.getTotalSpace();
}
} else if (vol.getType() == VolumeInfo.TYPE_PUBLIC) {
mExternalCategory.addPreference(
- new StorageVolumePreference(context, vol, COLOR_PUBLIC));
+ new StorageVolumePreference(context, vol, COLOR_PUBLIC, 0));
}
}
@@ -224,6 +228,7 @@
// Only showing primary internal storage, so just shortcut
final Bundle args = new Bundle();
args.putString(VolumeInfo.EXTRA_VOLUME_ID, VolumeInfo.ID_PRIVATE_INTERNAL);
+ PrivateVolumeSettings.setVolumeSize(args, sTotalInternalStorage);
Intent intent = Utils.onBuildStartFragmentIntent(getActivity(),
PrivateVolumeSettings.class.getName(), args, null, R.string.apps_storage, null,
false);
@@ -268,6 +273,7 @@
if (vol.getType() == VolumeInfo.TYPE_PRIVATE) {
final Bundle args = new Bundle();
args.putString(VolumeInfo.EXTRA_VOLUME_ID, vol.getId());
+ PrivateVolumeSettings.setVolumeSize(args, sTotalInternalStorage);
startFragment(this, PrivateVolumeSettings.class.getCanonicalName(),
-1, 0, args);
return true;
@@ -491,7 +497,11 @@
continue;
}
privateUsedBytes += path.getTotalSpace() - path.getFreeSpace();
- privateTotalBytes += path.getTotalSpace();
+ if (info.getType() == VolumeInfo.TYPE_PRIVATE && sTotalInternalStorage > 0) {
+ privateTotalBytes = sTotalInternalStorage;
+ } else {
+ privateTotalBytes += path.getTotalSpace();
+ }
}
mLoader.setSummary(this, mContext.getString(R.string.storage_summary,
Formatter.formatFileSize(mContext, privateUsedBytes),
diff --git a/src/com/android/settings/deviceinfo/StorageVolumePreference.java b/src/com/android/settings/deviceinfo/StorageVolumePreference.java
index dba636c..2ef42fa 100644
--- a/src/com/android/settings/deviceinfo/StorageVolumePreference.java
+++ b/src/com/android/settings/deviceinfo/StorageVolumePreference.java
@@ -46,7 +46,8 @@
private int mColor;
private int mUsedPercent = -1;
- public StorageVolumePreference(Context context, VolumeInfo volume, int color) {
+ // TODO: ideally, VolumeInfo should have a total physical size.
+ public StorageVolumePreference(Context context, VolumeInfo volume, int color, long totalBytes) {
super(context);
mStorageManager = context.getSystemService(StorageManager.class);
@@ -68,8 +69,10 @@
if (volume.isMountedReadable()) {
// TODO: move statfs() to background thread
final File path = volume.getPath();
+ if (totalBytes <= 0) {
+ totalBytes = path.getTotalSpace();
+ }
final long freeBytes = path.getFreeSpace();
- final long totalBytes = path.getTotalSpace();
final long usedBytes = totalBytes - freeBytes;
final String used = Formatter.formatFileSize(context, usedBytes);
diff --git a/src/com/android/settings/fingerprint/FingerprintEnrollBase.java b/src/com/android/settings/fingerprint/FingerprintEnrollBase.java
index 150a01a..2aef37b 100644
--- a/src/com/android/settings/fingerprint/FingerprintEnrollBase.java
+++ b/src/com/android/settings/fingerprint/FingerprintEnrollBase.java
@@ -23,15 +23,13 @@
import android.os.UserHandle;
import android.text.TextUtils;
import android.view.View;
-import android.view.WindowManager;
import android.widget.Button;
import android.widget.TextView;
import com.android.settings.ChooseLockSettingsHelper;
import com.android.settings.InstrumentedActivity;
import com.android.settings.R;
-import com.android.setupwizardlib.SetupWizardLayout;
-import com.android.setupwizardlib.view.NavigationBar;
+import com.android.setupwizardlib.GlifLayout;
/**
* Base activity for all fingerprint enrollment steps.
@@ -71,38 +69,26 @@
}
protected void initViews() {
- getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS |
- WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN |
- WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR);
-
- getWindow().getDecorView().setSystemUiVisibility(
- View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
-
getWindow().setStatusBarColor(Color.TRANSPARENT);
- getNavigationBar().setVisibility(View.GONE);
Button nextButton = getNextButton();
if (nextButton != null) {
nextButton.setOnClickListener(this);
}
}
- protected NavigationBar getNavigationBar() {
- return (NavigationBar) findViewById(R.id.suw_layout_navigation_bar);
- }
-
- protected SetupWizardLayout getSetupWizardLayout() {
- return (SetupWizardLayout) findViewById(R.id.setup_wizard_layout);
+ protected GlifLayout getLayout() {
+ return (GlifLayout) findViewById(R.id.setup_wizard_layout);
}
protected void setHeaderText(int resId, boolean force) {
- TextView layoutTitle = getSetupWizardLayout().getHeaderTextView();
+ TextView layoutTitle = getLayout().getHeaderTextView();
CharSequence previousTitle = layoutTitle.getText();
CharSequence title = getText(resId);
if (previousTitle != title || force) {
if (!TextUtils.isEmpty(previousTitle)) {
layoutTitle.setAccessibilityLiveRegion(View.ACCESSIBILITY_LIVE_REGION_POLITE);
}
- getSetupWizardLayout().setHeaderText(title);
+ getLayout().setHeaderText(title);
setTitle(title);
}
}
diff --git a/src/com/android/settings/fingerprint/FingerprintEnrollIntroduction.java b/src/com/android/settings/fingerprint/FingerprintEnrollIntroduction.java
index 4cbf963..c1a0925 100644
--- a/src/com/android/settings/fingerprint/FingerprintEnrollIntroduction.java
+++ b/src/com/android/settings/fingerprint/FingerprintEnrollIntroduction.java
@@ -18,38 +18,32 @@
import android.app.admin.DevicePolicyManager;
import android.content.ActivityNotFoundException;
-import android.content.Context;
import android.content.Intent;
-import android.graphics.Typeface;
import android.hardware.fingerprint.FingerprintManager;
import android.os.Bundle;
import android.os.UserHandle;
import android.os.UserManager;
-import android.text.Annotation;
-import android.text.SpannableString;
-import android.text.SpannableStringBuilder;
-import android.text.TextPaint;
-import android.text.TextUtils;
-import android.text.style.URLSpan;
import android.util.Log;
-import android.view.View;
import com.android.internal.logging.MetricsProto.MetricsEvent;
import com.android.internal.util.CharSequences;
import com.android.settings.ChooseLockGeneric;
import com.android.settings.ChooseLockSettingsHelper;
-import com.android.settingslib.HelpUtils;
import com.android.settings.R;
-import com.android.setupwizardlib.SetupWizardRecyclerLayout;
+import com.android.settingslib.HelpUtils;
+import com.android.setupwizardlib.GlifRecyclerLayout;
import com.android.setupwizardlib.items.IItem;
import com.android.setupwizardlib.items.Item;
import com.android.setupwizardlib.items.RecyclerItemAdapter;
+import com.android.setupwizardlib.span.LinkSpan;
/**
* Onboarding activity for fingerprint enrollment.
*/
public class FingerprintEnrollIntroduction extends FingerprintEnrollBase
- implements RecyclerItemAdapter.OnItemSelectedListener {
+ implements RecyclerItemAdapter.OnItemSelectedListener, LinkSpan.OnClickListener {
+
+ private static final String TAG = "FingerprintIntro";
protected static final int CHOOSE_LOCK_GENERIC_REQUEST = 1;
protected static final int FINGERPRINT_FIND_SENSOR_REQUEST = 2;
@@ -63,19 +57,12 @@
super.onCreate(savedInstanceState);
setContentView(R.layout.fingerprint_enroll_introduction);
setHeaderText(R.string.security_settings_fingerprint_enroll_introduction_title);
- final SetupWizardRecyclerLayout layout =
- (SetupWizardRecyclerLayout) findViewById(R.id.setup_wizard_layout);
+ final GlifRecyclerLayout layout = (GlifRecyclerLayout) getLayout();
mUserManager = UserManager.get(this);
final RecyclerItemAdapter adapter = (RecyclerItemAdapter) layout.getAdapter();
adapter.setOnItemSelectedListener(this);
Item item = (Item) adapter.findItemById(R.id.fingerprint_introduction_message);
- item.setTitle(LearnMoreSpan.linkify(
- getText(R.string.security_settings_fingerprint_enroll_introduction_message),
- getString(R.string.help_url_fingerprint)));
- // setupwizard library automatically sets the divider inset to
- // R.dimen.suw_items_icon_divider_inset. We adjust this back to 0 as we do not want
- // an inset within settings.
- layout.setDividerInset(0);
+ item.setTitle(getText(R.string.security_settings_fingerprint_enroll_introduction_message));
updatePasswordQuality();
}
@@ -127,8 +114,7 @@
}
protected Intent getFindSensorIntent() {
- Intent intent = new Intent(this, FingerprintEnrollFindSensor.class);
- return intent;
+ return new Intent(this, FingerprintEnrollFindSensor.class);
}
@Override
@@ -149,6 +135,8 @@
launchFindSensor(token);
return;
}
+ } else if (requestCode == LEARN_MORE_REQUEST) {
+ overridePendingTransition(R.anim.suw_slide_back_in, R.anim.suw_slide_back_out);
}
super.onActivityResult(requestCode, resultCode, data);
}
@@ -174,57 +162,21 @@
finish();
}
- private static class LearnMoreSpan extends URLSpan {
- private static final String TAG = "LearnMoreSpan";
- private static final Typeface TYPEFACE_MEDIUM =
- Typeface.create("sans-serif-medium", Typeface.NORMAL);
-
- private LearnMoreSpan(String url) {
- super(url);
- }
-
- @Override
- public void onClick(View widget) {
- Context ctx = widget.getContext();
- Intent intent = HelpUtils.getHelpIntent(ctx, getURL(), ctx.getClass().getName());
+ @Override
+ public void onClick(LinkSpan span) {
+ if ("url".equals(span.getId())) {
+ String url = getString(R.string.help_url_fingerprint);
+ Intent intent = HelpUtils.getHelpIntent(this, url, getClass().getName());
+ if (intent == null) {
+ Log.w(TAG, "Null help intent.");
+ return;
+ }
try {
// This needs to be startActivityForResult even though we do not care about the
// actual result because the help app needs to know about who invoked it.
- widget.startActivityForResult(intent, LEARN_MORE_REQUEST);
+ startActivityForResult(intent, LEARN_MORE_REQUEST);
} catch (ActivityNotFoundException e) {
- Log.w(LearnMoreSpan.TAG,
- "Actvity was not found for intent, " + intent.toString());
- }
- }
-
- @Override
- public void updateDrawState(TextPaint ds) {
- super.updateDrawState(ds);
- ds.setUnderlineText(false);
- ds.setTypeface(TYPEFACE_MEDIUM);
- }
-
- public static CharSequence linkify(CharSequence rawText, String uri) {
- SpannableString msg = new SpannableString(rawText);
- Annotation[] spans = msg.getSpans(0, msg.length(), Annotation.class);
- if (TextUtils.isEmpty(uri)) {
- CharSequence ret = rawText;
- for (Annotation annotation : spans) {
- int start = msg.getSpanStart(annotation);
- int end = msg.getSpanEnd(annotation);
- ret = TextUtils.concat(ret.subSequence(0, start),
- msg.subSequence(end, msg.length()));
- }
- return ret;
- } else {
- SpannableStringBuilder builder = new SpannableStringBuilder(msg);
- for (Annotation annotation : spans) {
- int start = msg.getSpanStart(annotation);
- int end = msg.getSpanEnd(annotation);
- LearnMoreSpan link = new LearnMoreSpan(uri);
- builder.setSpan(link, start, end, msg.getSpanFlags(link));
- }
- return builder;
+ Log.w(TAG, "Activity was not found for intent, " + e);
}
}
}
diff --git a/src/com/android/settings/fingerprint/FingerprintLocationAnimationView.java b/src/com/android/settings/fingerprint/FingerprintLocationAnimationView.java
index cc1d4fd..a26883a 100644
--- a/src/com/android/settings/fingerprint/FingerprintLocationAnimationView.java
+++ b/src/com/android/settings/fingerprint/FingerprintLocationAnimationView.java
@@ -19,17 +19,18 @@
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ValueAnimator;
+import android.annotation.ColorInt;
import android.annotation.Nullable;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.util.AttributeSet;
-import android.util.TypedValue;
import android.view.View;
import android.view.animation.AnimationUtils;
import android.view.animation.Interpolator;
import com.android.settings.R;
+import com.android.settings.Utils;
/**
* View which plays an animation to indicate where the sensor is on the device.
@@ -61,13 +62,11 @@
R.fraction.fingerprint_sensor_location_fraction_x, 1, 1);
mFractionCenterY = getResources().getFraction(
R.fraction.fingerprint_sensor_location_fraction_y, 1, 1);
- TypedValue typedValue = new TypedValue();
- context.getTheme().resolveAttribute(android.R.attr.colorAccent, typedValue, true);
- int color = getResources().getColor(typedValue.resourceId, null);
+ @ColorInt int colorAccent = Utils.getColorAccent(context);
mDotPaint.setAntiAlias(true);
mPulsePaint.setAntiAlias(true);
- mDotPaint.setColor(color);
- mPulsePaint.setColor(color);
+ mDotPaint.setColor(colorAccent);
+ mPulsePaint.setColor(colorAccent);
mLinearOutSlowInInterpolator = AnimationUtils.loadInterpolator(context,
android.R.interpolator.linear_out_slow_in);
mFastOutSlowInInterpolator = AnimationUtils.loadInterpolator(context,
diff --git a/src/com/android/settings/fingerprint/SetupFingerprintEnrollEnrolling.java b/src/com/android/settings/fingerprint/SetupFingerprintEnrollEnrolling.java
index b037c2b..8bd495e 100644
--- a/src/com/android/settings/fingerprint/SetupFingerprintEnrollEnrolling.java
+++ b/src/com/android/settings/fingerprint/SetupFingerprintEnrollEnrolling.java
@@ -31,11 +31,8 @@
import com.android.internal.logging.MetricsProto.MetricsEvent;
import com.android.settings.R;
import com.android.settings.SetupWizardUtils;
-import com.android.setupwizardlib.util.SystemBarHelper;
-import com.android.setupwizardlib.view.NavigationBar;
-public class SetupFingerprintEnrollEnrolling extends FingerprintEnrollEnrolling
- implements NavigationBar.NavigationBarListener {
+public class SetupFingerprintEnrollEnrolling extends FingerprintEnrollEnrolling {
private static final String TAG_DIALOG = "dialog";
@@ -54,32 +51,21 @@
@Override
protected void initViews() {
- SetupWizardUtils.setImmersiveMode(this);
+ super.initViews();
+ final Button skipButton = (Button) findViewById(R.id.skip_button);
+ skipButton.setVisibility(View.VISIBLE);
+ skipButton.setOnClickListener(this);
+ }
- final View buttonBar = findViewById(R.id.button_bar);
- if (buttonBar != null) {
- buttonBar.setVisibility(View.GONE);
+ @Override
+ public void onClick(View v) {
+ switch (v.getId()) {
+ case R.id.skip_button:
+ new SkipDialog().show(getFragmentManager(), TAG_DIALOG);
+ break;
+ default:
+ super.onClick(v);
}
-
- final NavigationBar navigationBar = getNavigationBar();
- navigationBar.setNavigationBarListener(this);
- navigationBar.getNextButton().setText(R.string.skip_label);
- navigationBar.getBackButton().setVisibility(View.GONE);
- }
-
- @Override
- protected Button getNextButton() {
- return getNavigationBar().getNextButton();
- }
-
- @Override
- public void onNavigateBack() {
- onBackPressed();
- }
-
- @Override
- public void onNavigateNext() {
- new SkipDialog().show(getFragmentManager(), TAG_DIALOG);
}
@Override
@@ -102,7 +88,7 @@
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
- final AlertDialog dialog = new AlertDialog.Builder(getActivity())
+ return new AlertDialog.Builder(getActivity())
.setTitle(R.string.setup_fingerprint_enroll_enrolling_skip_title)
.setMessage(R.string.setup_fingerprint_enroll_enrolling_skip_message)
.setCancelable(false)
@@ -124,8 +110,6 @@
}
})
.create();
- SystemBarHelper.hideSystemBars(dialog);
- return dialog;
}
}
}
diff --git a/src/com/android/settings/fingerprint/SetupFingerprintEnrollFindSensor.java b/src/com/android/settings/fingerprint/SetupFingerprintEnrollFindSensor.java
index 9cf5369..bb78477 100644
--- a/src/com/android/settings/fingerprint/SetupFingerprintEnrollFindSensor.java
+++ b/src/com/android/settings/fingerprint/SetupFingerprintEnrollFindSensor.java
@@ -19,17 +19,13 @@
import android.content.Intent;
import android.content.res.Resources;
import android.os.UserHandle;
-import android.view.View;
-import android.widget.Button;
import com.android.internal.logging.MetricsProto.MetricsEvent;
import com.android.settings.ChooseLockSettingsHelper;
import com.android.settings.R;
import com.android.settings.SetupWizardUtils;
-import com.android.setupwizardlib.view.NavigationBar;
-public class SetupFingerprintEnrollFindSensor extends FingerprintEnrollFindSensor
- implements NavigationBar.NavigationBarListener {
+public class SetupFingerprintEnrollFindSensor extends FingerprintEnrollFindSensor {
@Override
protected int getContentView() {
@@ -54,34 +50,6 @@
}
@Override
- protected void initViews() {
- SetupWizardUtils.setImmersiveMode(this);
-
- final View nextButton = findViewById(R.id.next_button);
- if (nextButton != null) {
- nextButton.setVisibility(View.GONE);
- }
-
- getNavigationBar().setNavigationBarListener(this);
- getNavigationBar().getBackButton().setVisibility(View.GONE);
- }
-
- @Override
- protected Button getNextButton() {
- return getNavigationBar().getNextButton();
- }
-
- @Override
- public void onNavigateBack() {
- onBackPressed();
- }
-
- @Override
- public void onNavigateNext() {
- onNextButtonClick();
- }
-
- @Override
protected int getMetricsCategory() {
return MetricsEvent.FINGERPRINT_FIND_SENSOR_SETUP;
}
diff --git a/src/com/android/settings/fingerprint/SetupFingerprintEnrollFinish.java b/src/com/android/settings/fingerprint/SetupFingerprintEnrollFinish.java
index b17ed09..f6602f3 100644
--- a/src/com/android/settings/fingerprint/SetupFingerprintEnrollFinish.java
+++ b/src/com/android/settings/fingerprint/SetupFingerprintEnrollFinish.java
@@ -20,17 +20,14 @@
import android.content.res.Resources;
import android.os.UserHandle;
import android.view.View;
-import android.widget.Button;
import android.widget.TextView;
import com.android.internal.logging.MetricsProto.MetricsEvent;
import com.android.settings.ChooseLockSettingsHelper;
import com.android.settings.R;
import com.android.settings.SetupWizardUtils;
-import com.android.setupwizardlib.view.NavigationBar;
-public class SetupFingerprintEnrollFinish extends FingerprintEnrollFinish
- implements NavigationBar.NavigationBarListener {
+public class SetupFingerprintEnrollFinish extends FingerprintEnrollFinish {
@Override
protected Intent getEnrollingIntent() {
@@ -51,16 +48,7 @@
@Override
protected void initViews() {
- SetupWizardUtils.setImmersiveMode(this);
-
- final View nextButton = findViewById(R.id.next_button);
- if (nextButton != null) {
- nextButton.setVisibility(View.GONE);
- }
-
- final NavigationBar navigationBar = getNavigationBar();
- navigationBar.setNavigationBarListener(this);
- navigationBar.getBackButton().setVisibility(View.GONE);
+ super.initViews();
final TextView message = (TextView) findViewById(R.id.message);
message.setText(R.string.setup_fingerprint_enroll_finish_message);
@@ -70,21 +58,6 @@
}
@Override
- protected Button getNextButton() {
- return getNavigationBar().getNextButton();
- }
-
- @Override
- public void onNavigateBack() {
- onBackPressed();
- }
-
- @Override
- public void onNavigateNext() {
- onNextButtonClick();
- }
-
- @Override
protected int getMetricsCategory() {
return MetricsEvent.FINGERPRINT_ENROLL_FINISH_SETUP;
}
diff --git a/src/com/android/settings/fingerprint/SetupFingerprintEnrollIntroduction.java b/src/com/android/settings/fingerprint/SetupFingerprintEnrollIntroduction.java
index f816682..aac2057 100644
--- a/src/com/android/settings/fingerprint/SetupFingerprintEnrollIntroduction.java
+++ b/src/com/android/settings/fingerprint/SetupFingerprintEnrollIntroduction.java
@@ -19,20 +19,17 @@
import android.content.Intent;
import android.content.res.Resources;
import android.os.UserHandle;
-import android.widget.Button;
import com.android.internal.logging.MetricsProto.MetricsEvent;
import com.android.internal.widget.LockPatternUtils;
import com.android.settings.R;
import com.android.settings.SetupChooseLockGeneric;
import com.android.settings.SetupWizardUtils;
-import com.android.setupwizardlib.SetupWizardRecyclerLayout;
+import com.android.setupwizardlib.GlifRecyclerLayout;
import com.android.setupwizardlib.items.Item;
import com.android.setupwizardlib.items.RecyclerItemAdapter;
-import com.android.setupwizardlib.view.NavigationBar;
-public class SetupFingerprintEnrollIntroduction extends FingerprintEnrollIntroduction
- implements NavigationBar.NavigationBarListener {
+public class SetupFingerprintEnrollIntroduction extends FingerprintEnrollIntroduction {
@Override
protected Intent getChooseLockIntent() {
@@ -56,8 +53,7 @@
@Override
protected void initViews() {
- final SetupWizardRecyclerLayout layout =
- (SetupWizardRecyclerLayout) findViewById(R.id.setup_wizard_layout);
+ GlifRecyclerLayout layout = (GlifRecyclerLayout) getLayout();
final RecyclerItemAdapter adapter = (RecyclerItemAdapter) layout.getAdapter();
final Item nextItem = (Item) adapter.findItemById(R.id.next_button);
nextItem.setTitle(
@@ -66,14 +62,6 @@
final Item cancelItem = (Item) adapter.findItemById(R.id.cancel_button);
cancelItem.setTitle(
getText(R.string.security_settings_fingerprint_enroll_introduction_cancel_setup));
-
- SetupWizardUtils.setImmersiveMode(this);
- getNavigationBar().setNavigationBarListener(this);
- Button nextButton = getNavigationBar().getNextButton();
- nextButton.setText(null);
- nextButton.setEnabled(false);
- layout.setDividerInset(getResources().getDimensionPixelSize(
- R.dimen.suw_items_icon_divider_inset));
}
@Override
@@ -98,16 +86,6 @@
}
@Override
- public void onNavigateBack() {
- onBackPressed();
- }
-
- @Override
- public void onNavigateNext() {
- // next is handled via the onNextButtonClick method in FingerprintEnrollIntroduction
- }
-
- @Override
protected int getMetricsCategory() {
return MetricsEvent.FINGERPRINT_ENROLL_INTRO_SETUP;
}
diff --git a/src/com/android/settings/fingerprint/SetupSkipDialog.java b/src/com/android/settings/fingerprint/SetupSkipDialog.java
index 11e6936..c6e04d7 100644
--- a/src/com/android/settings/fingerprint/SetupSkipDialog.java
+++ b/src/com/android/settings/fingerprint/SetupSkipDialog.java
@@ -22,17 +22,10 @@
import android.app.DialogFragment;
import android.app.FragmentManager;
import android.content.DialogInterface;
-import android.os.Build.VERSION;
-import android.os.Build.VERSION_CODES;
import android.os.Bundle;
-import android.os.Handler;
import android.support.annotation.NonNull;
-import android.view.View;
-import android.view.Window;
-import android.view.WindowManager;
import com.android.settings.R;
-import com.android.setupwizardlib.util.SystemBarHelper;
public class SetupSkipDialog extends DialogFragment implements DialogInterface.OnClickListener {
@@ -52,10 +45,7 @@
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
- final AlertDialog dialog = onCreateDialogBuilder().create();
- // hide system status bar.
- SystemBarHelper.hideSystemBars(dialog);
- return dialog;
+ return onCreateDialogBuilder().create();
}
@NonNull
diff --git a/src/com/android/settings/gestures/GesturePreference.java b/src/com/android/settings/gestures/GesturePreference.java
new file mode 100644
index 0000000..ba7ce75
--- /dev/null
+++ b/src/com/android/settings/gestures/GesturePreference.java
@@ -0,0 +1,160 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package com.android.settings.gestures;
+
+import android.content.ContentResolver;
+import android.content.Context;
+import android.content.res.TypedArray;
+import android.graphics.Bitmap;
+import android.graphics.drawable.BitmapDrawable;
+import android.graphics.SurfaceTexture;
+import android.media.MediaMetadataRetriever;
+import android.media.MediaPlayer;
+import android.net.Uri;
+import android.support.v14.preference.SwitchPreference;
+import android.support.v7.preference.PreferenceViewHolder;
+import android.view.MotionEvent;
+import android.view.View;
+import android.view.Surface;
+import android.view.TextureView;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+import android.util.AttributeSet;
+import android.util.Log;
+
+import com.android.settings.R;
+
+/**
+ * Preference item for a gesture with a switch to signify if it should be enabled.
+ * This shows the title and description of the gesture along with an animation showing how to do
+ * the gesture
+ */
+public final class GesturePreference extends SwitchPreference {
+ private static final String TAG = "GesturePreference";
+ private final Context mContext;
+
+ private Uri mVideoPath;
+ private MediaPlayer mMediaPlayer;
+ private MediaMetadataRetriever mMediaMetadata;
+ private boolean animationAvailable;
+
+ public GesturePreference(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ mContext = context;
+ setLayoutResource(R.layout.gesture_preference);
+ TypedArray attributes = context.getTheme().obtainStyledAttributes(
+ attrs,
+ R.styleable.GesturePreference,
+ 0, 0);
+ try {
+ int animation = attributes.getResourceId(R.styleable.GesturePreference_animation, 0);
+ mVideoPath = new Uri.Builder().scheme(ContentResolver.SCHEME_ANDROID_RESOURCE)
+ .authority(context.getPackageName())
+ .appendPath(String.valueOf(animation))
+ .build();
+ mMediaMetadata = new MediaMetadataRetriever();
+ mMediaMetadata.setDataSource(mContext, mVideoPath);
+ animationAvailable = true;
+ } catch (Exception e) {
+ Log.w(TAG, "Animation resource not found. Will not show animation.");
+ } finally {
+ attributes.recycle();
+ }
+ }
+
+ @Override
+ public void onBindViewHolder(PreferenceViewHolder holder) {
+ super.onBindViewHolder(holder);
+ final TextureView video = (TextureView) holder.findViewById(R.id.gesture_video);
+ final ImageView imageView = (ImageView) holder.findViewById(R.id.gesture_image);
+ final ImageView playButton = (ImageView) holder.findViewById(R.id.gesture_play_button);
+ final View detailView = holder.findViewById(R.id.gesture_detail);
+ final View animationFrame = holder.findViewById(R.id.gesture_animation_frame);
+
+ if (!animationAvailable) {
+ animationFrame.setVisibility(View.GONE);
+ return;
+ }
+
+ Bitmap bitmap = mMediaMetadata.getFrameAtTime(0);
+ if (bitmap != null) {
+ imageView.setImageDrawable(new BitmapDrawable(bitmap));
+ }
+ imageView.setVisibility(View.VISIBLE);
+ playButton.setVisibility(View.VISIBLE);
+
+ video.setOnTouchListener(new View.OnTouchListener() {
+ @Override
+ public boolean onTouch(View v, MotionEvent event) {
+ if (event.getAction() == MotionEvent.ACTION_DOWN) {
+ if (mMediaPlayer != null) {
+ if (mMediaPlayer.isPlaying()) {
+ mMediaPlayer.pause();
+ playButton.setVisibility(View.VISIBLE);
+ } else {
+ mMediaPlayer.start();
+ playButton.setVisibility(View.GONE);
+ }
+ }
+ return true;
+ }
+ return false;
+ }
+ });
+
+ video.setSurfaceTextureListener(new TextureView.SurfaceTextureListener() {
+ @Override
+ public void onSurfaceTextureAvailable(SurfaceTexture surfaceTexture, int width,
+ int height) {
+ animationFrame.setLayoutParams(new LinearLayout.LayoutParams(width, width));
+ mMediaPlayer = MediaPlayer.create(mContext, mVideoPath);
+ if (mMediaPlayer != null) {
+ mMediaPlayer.setSurface(new Surface(surfaceTexture));
+ mMediaPlayer.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
+ @Override
+ public void onPrepared(MediaPlayer mediaPlayer) {
+ mediaPlayer.setLooping(true);
+ }
+ });
+ }
+ }
+
+ @Override
+ public void onSurfaceTextureSizeChanged(SurfaceTexture surfaceTexture, int width,
+ int height) {
+ }
+
+ @Override
+ public boolean onSurfaceTextureDestroyed(SurfaceTexture surfaceTexture) {
+ imageView.setVisibility(View.VISIBLE);
+ if (mMediaPlayer != null) {
+ mMediaPlayer.stop();
+ mMediaPlayer.reset();
+ mMediaPlayer.release();
+ }
+ return false;
+ }
+
+ @Override
+ public void onSurfaceTextureUpdated(SurfaceTexture surfaceTexture) {
+ if (mMediaPlayer.isPlaying() && imageView.getVisibility() == View.VISIBLE) {
+ imageView.setVisibility(View.GONE);
+ }
+ }
+ });
+
+ }
+
+}
diff --git a/src/com/android/settings/gestures/GestureSettings.java b/src/com/android/settings/gestures/GestureSettings.java
new file mode 100644
index 0000000..2aa4f43
--- /dev/null
+++ b/src/com/android/settings/gestures/GestureSettings.java
@@ -0,0 +1,172 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.gestures;
+
+import android.content.Context;
+import android.content.res.Resources;
+import android.os.Build;
+import android.os.Bundle;
+import android.os.SystemProperties;
+import android.provider.SearchIndexableResource;
+import android.provider.Settings.Global;
+import android.provider.Settings.Secure;
+import android.support.v7.preference.Preference;
+import android.text.TextUtils;
+import android.util.Log;
+
+import com.android.internal.logging.MetricsProto.MetricsEvent;
+import com.android.settings.R;
+import com.android.settings.search.BaseSearchIndexProvider;
+import com.android.settings.search.Indexable;
+import com.android.settings.SettingsPreferenceFragment;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Top level fragment for gesture settings.
+ * This will create individual switch preference for each gesture and handle updates when each
+ * preference is updated
+ */
+public class GestureSettings extends SettingsPreferenceFragment implements
+ Preference.OnPreferenceChangeListener, Indexable {
+
+ private static final String TAG = "GestureSettings";
+ private static final String PREF_KEY_DOUBLE_TAP_POWER = "gesture_double_tap_power";
+ private static final String PREF_KEY_DOUBLE_TWIST = "gesture_double_twist";
+ private static final String PREF_KEY_PICK_UP_AND_NUDGE = "gesture_pick_up_and_nudge";
+ private static final String PREF_KEY_SWIPE_DOWN_FINGERPRINT = "gesture_swipe_down_fingerprint";
+ private static final String DEBUG_DOZE_COMPONENT = "debug.doze.component";
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ addPreferencesFromResource(R.xml.gesture_settings);
+ Context context = getActivity();
+
+ // Double tap power for camera
+ if (isCameraDoubleTapPowerGestureAvailable(getResources())) {
+ int cameraDisabled = Secure.getInt(
+ getContentResolver(), Secure.CAMERA_DOUBLE_TAP_POWER_GESTURE_DISABLED, 1);
+ GesturePreference preference =
+ (GesturePreference) findPreference(PREF_KEY_DOUBLE_TAP_POWER);
+ preference.setChecked(cameraDisabled == 0);
+ preference.setOnPreferenceChangeListener(this);
+ } else {
+ removePreference(PREF_KEY_DOUBLE_TAP_POWER);
+ }
+
+ // Ambient Display
+ if (isDozeAvailable(context)) {
+ GesturePreference preference =
+ (GesturePreference) findPreference(PREF_KEY_PICK_UP_AND_NUDGE);
+ int dozeEnabled = Secure.getInt(getContentResolver(), Secure.DOZE_ENABLED, 0);
+ preference.setChecked(dozeEnabled != 0);
+ preference.setOnPreferenceChangeListener(this);
+ } else {
+ removePreference(PREF_KEY_PICK_UP_AND_NUDGE);
+ }
+
+ // Fingerprint slide for notifications
+ if (isSystemUINavigationAvailable(context)) {
+ GesturePreference preference =
+ (GesturePreference) findPreference(PREF_KEY_SWIPE_DOWN_FINGERPRINT);
+ preference.setChecked(isSystemUINavigationEnabled(context));
+ preference.setOnPreferenceChangeListener(this);
+ } else {
+ removePreference(PREF_KEY_SWIPE_DOWN_FINGERPRINT);
+ }
+
+ }
+
+ @Override
+ public boolean onPreferenceChange(Preference preference, Object newValue) {
+ boolean enabled = (boolean) newValue;
+ String key = preference.getKey();
+ if (PREF_KEY_DOUBLE_TAP_POWER.equals(key)) {
+ Secure.putInt(getContentResolver(),
+ Secure.CAMERA_DOUBLE_TAP_POWER_GESTURE_DISABLED, enabled ? 0 : 1);
+ } else if (PREF_KEY_PICK_UP_AND_NUDGE.equals(key)) {
+ Secure.putInt(getContentResolver(), Secure.DOZE_ENABLED, enabled ? 1 : 0);
+ } else if (PREF_KEY_SWIPE_DOWN_FINGERPRINT.equals(key)) {
+ Global.putInt(getContentResolver(),
+ Global.SYSTEM_NAVIGATION_KEYS_ENABLED, enabled ? 1 : 0);
+ }
+ return true;
+ }
+
+ @Override
+ protected int getMetricsCategory() {
+ return MetricsEvent.SETTINGS_GESTURES;
+ }
+
+ private static boolean isCameraDoubleTapPowerGestureAvailable(Resources res) {
+ return res.getBoolean(
+ com.android.internal.R.bool.config_cameraDoubleTapPowerGestureEnabled);
+ }
+
+ private static boolean isDozeAvailable(Context context) {
+ String name = Build.IS_DEBUGGABLE ? SystemProperties.get(DEBUG_DOZE_COMPONENT) : null;
+ if (TextUtils.isEmpty(name)) {
+ name = context.getResources().getString(
+ com.android.internal.R.string.config_dozeComponent);
+ }
+ return !TextUtils.isEmpty(name);
+ }
+
+ private static boolean isSystemUINavigationAvailable(Context context) {
+ return context.getResources().getBoolean(
+ com.android.internal.R.bool.config_supportSystemNavigationKeys);
+ }
+
+ private static boolean isSystemUINavigationEnabled(Context context) {
+ return Global.getInt(context.getContentResolver(), Global.SYSTEM_NAVIGATION_KEYS_ENABLED, 0)
+ == 1;
+ }
+
+ public static final Indexable.SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
+ new BaseSearchIndexProvider() {
+ @Override
+ public List<SearchIndexableResource> getXmlResourcesToIndex(Context context,
+ boolean enabled) {
+ ArrayList<SearchIndexableResource> result =
+ new ArrayList<SearchIndexableResource>();
+
+ SearchIndexableResource sir = new SearchIndexableResource(context);
+ sir.xmlResId = R.xml.gesture_settings;
+ result.add(sir);
+
+ return result;
+ }
+
+ @Override
+ public List<String> getNonIndexableKeys(Context context) {
+ ArrayList<String> result = new ArrayList<String>();
+ if (!isCameraDoubleTapPowerGestureAvailable(context.getResources())) {
+ result.add(PREF_KEY_DOUBLE_TAP_POWER);
+ }
+ if (!isDozeAvailable(context)) {
+ result.add(PREF_KEY_PICK_UP_AND_NUDGE);
+ }
+ if (!isSystemUINavigationAvailable(context)) {
+ result.add(PREF_KEY_SWIPE_DOWN_FINGERPRINT);
+ }
+ return result;
+ }
+ };
+
+}
\ No newline at end of file
diff --git a/src/com/android/settings/notification/ImportanceSeekBarPreference.java b/src/com/android/settings/notification/ImportanceSeekBarPreference.java
index b21f9ce..0617df9 100644
--- a/src/com/android/settings/notification/ImportanceSeekBarPreference.java
+++ b/src/com/android/settings/notification/ImportanceSeekBarPreference.java
@@ -31,6 +31,7 @@
import android.widget.ImageView;
import android.widget.SeekBar;
import android.widget.TextView;
+import com.android.settings.Utils;
/**
* A slider preference that controls notification importance.
@@ -55,8 +56,7 @@
int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
setLayoutResource(R.layout.preference_importance_slider);
- mActiveSliderTint = ColorStateList.valueOf(
- context.getColor(R.color.importance_slider_color));
+ mActiveSliderTint = ColorStateList.valueOf(Utils.getColorAccent(context));
mInactiveSliderTint = ColorStateList.valueOf(
context.getColor(R.color.importance_disabled_slider_color));
mHandler = new Handler();
diff --git a/src/com/android/settings/notification/RedactionInterstitial.java b/src/com/android/settings/notification/RedactionInterstitial.java
index 4aa5ec8..ab5d834 100644
--- a/src/com/android/settings/notification/RedactionInterstitial.java
+++ b/src/com/android/settings/notification/RedactionInterstitial.java
@@ -25,8 +25,9 @@
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
-import android.widget.CheckBox;
+import android.widget.Button;
import android.widget.CompoundButton;
+import android.widget.LinearLayout;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;
@@ -59,6 +60,13 @@
return RedactionInterstitialFragment.class.getName().equals(fragmentName);
}
+ @Override
+ protected void onCreate(Bundle savedInstance) {
+ super.onCreate(savedInstance);
+ LinearLayout layout = (LinearLayout) findViewById(R.id.content_parent);
+ layout.setFitsSystemWindows(false);
+ }
+
/**
* Create an intent for launching RedactionInterstitial.
* @return An intent to launch the activity is if is available, @null if the activity is not
@@ -66,10 +74,6 @@
*/
public static Intent createStartIntent(Context ctx, int userId) {
return new Intent(ctx, RedactionInterstitial.class)
- .putExtra(EXTRA_PREFS_SHOW_BUTTON_BAR, true)
- .putExtra(EXTRA_PREFS_SET_BACK_TEXT, (String) null)
- .putExtra(EXTRA_PREFS_SET_NEXT_TEXT, ctx.getString(
- R.string.app_notifications_dialog_done))
.putExtra(EXTRA_SHOW_FRAGMENT_TITLE_RESID,
Utils.isManagedProfile(UserManager.get(ctx), userId)
? R.string.lock_screen_notifications_interstitial_title_profile
@@ -78,7 +82,7 @@
}
public static class RedactionInterstitialFragment extends SettingsPreferenceFragment
- implements RadioGroup.OnCheckedChangeListener {
+ implements RadioGroup.OnCheckedChangeListener, View.OnClickListener {
private RadioGroup mRadioGroup;
private RestrictedRadioButton mShowAllButton;
@@ -116,6 +120,20 @@
((RadioButton) view.findViewById(R.id.hide_all))
.setText(R.string.lock_screen_notifications_summary_disable_profile);
}
+
+ final Button button = (Button) view.findViewById(R.id.redaction_done_button);
+ button.setOnClickListener(this);
+ }
+
+ @Override
+ public void onClick(View v) {
+ if (v.getId() == R.id.redaction_done_button) {
+ final RedactionInterstitial activity = (RedactionInterstitial) getActivity();
+ if (activity != null) {
+ activity.setResult(RESULT_OK, activity.getResultIntentData());
+ finish();
+ }
+ }
}
@Override
diff --git a/src/com/android/settings/overlay/DeletionHelperFeatureProvider.java b/src/com/android/settings/overlay/DeletionHelperFeatureProvider.java
new file mode 100644
index 0000000..15b5896
--- /dev/null
+++ b/src/com/android/settings/overlay/DeletionHelperFeatureProvider.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.overlay;
+
+import android.content.Context;
+import android.support.v7.preference.PreferenceGroup;
+import com.android.settings.deletionhelper.DeletionType;
+
+/**
+ * Feature provider for the manual deletion helper Settings page.
+ */
+public interface DeletionHelperFeatureProvider {
+ /**
+ * Creates a {@link DeletionType} for clearing out stored photos and videos on the device.
+ */
+ DeletionType createPhotoVideoDeletionType(Context context);
+}
diff --git a/src/com/android/settings/overlay/FeatureFactory.java b/src/com/android/settings/overlay/FeatureFactory.java
new file mode 100644
index 0000000..04f2f81
--- /dev/null
+++ b/src/com/android/settings/overlay/FeatureFactory.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.overlay;
+
+import android.content.Context;
+import android.text.TextUtils;
+import android.util.Log;
+
+import com.android.settings.R;
+
+/**
+ * Abstract class for creating feature controllers. Allows OEM implementations to define their own
+ * factories with their own controllers containing whatever code is needed to implement
+ * the features. To provide a factory implementation, implementors should override
+ * {@link R.string#config_featureFactory} in their override.
+ */
+public abstract class FeatureFactory {
+ private static final String LOG_TAG = "FeatureFactory";
+ private static final boolean DEBUG = false;
+
+ private static FeatureFactory sFactory;
+
+ /**
+ * Returns a factory for creating feature controllers. Creates the factory if it does not
+ * already exist. Uses the value of {@link R.string#config_featureFactory} to instantiate
+ * a factory implementation.
+ */
+ public static FeatureFactory getFactory(Context context) {
+ if (sFactory != null) {
+ return sFactory;
+ }
+
+ if (DEBUG) Log.d(LOG_TAG, "getFactory");
+ final String clsName = context.getString(R.string.config_featureFactory);
+ if (TextUtils.isEmpty(clsName)) {
+ throw new UnsupportedOperationException("No feature factory configured");
+ }
+ try {
+ sFactory = (FeatureFactory) context.getClassLoader().loadClass(clsName).newInstance();
+ } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) {
+ throw new FactoryNotFoundException(e);
+ }
+
+ if (DEBUG) Log.d(LOG_TAG, "started " + sFactory.getClass().getSimpleName());
+ return sFactory;
+ }
+
+ public abstract SupportFeatureProvider getSupportFeatureProvider(Context context);
+
+ /**
+ * Return a provider which adds additional deletion services to the Deletion Helper.
+ */
+ public abstract DeletionHelperFeatureProvider getDeletionHelperFeatureProvider();
+ public abstract StorageManagementJobProvider getStorageManagementJobProvider();
+
+ public static final class FactoryNotFoundException extends RuntimeException {
+ public FactoryNotFoundException(Throwable throwable) {
+ super("Unable to create factory. Did you misconfigure Proguard?", throwable);
+ }
+ }
+}
diff --git a/src/com/android/settings/overlay/FeatureFactoryImpl.java b/src/com/android/settings/overlay/FeatureFactoryImpl.java
new file mode 100644
index 0000000..0547247
--- /dev/null
+++ b/src/com/android/settings/overlay/FeatureFactoryImpl.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.overlay;
+
+import android.content.Context;
+
+/**
+ * {@link FeatureFactory} implementation for AOSP Settings.
+ */
+public final class FeatureFactoryImpl extends FeatureFactory {
+
+ @Override
+ public SupportFeatureProvider getSupportFeatureProvider(Context context) {
+ return null;
+ }
+
+ @Override
+ public DeletionHelperFeatureProvider getDeletionHelperFeatureProvider() {
+ return null;
+ }
+
+ @Override
+ public StorageManagementJobProvider getStorageManagementJobProvider() {
+ return null;
+ }
+
+}
diff --git a/src/com/android/settings/overlay/StorageManagementJobProvider.java b/src/com/android/settings/overlay/StorageManagementJobProvider.java
new file mode 100644
index 0000000..80f8737
--- /dev/null
+++ b/src/com/android/settings/overlay/StorageManagementJobProvider.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.overlay;
+
+import android.app.job.JobParameters;
+import android.content.Context;
+
+/**
+ * Feature provider for automatic storage management jobs.
+ */
+public interface StorageManagementJobProvider {
+ /**
+ * Starts an asynchronous deletion job to clear out storage older than
+ * @param params Standard JobService parameters.
+ * @param daysToRetain Number of days of information to retain on the device.
+ * @return If the job needs to process the work on a separate thread.
+ */
+ boolean onStartJob(Context context, JobParameters params, int daysToRetain);
+
+ /**
+ * Attempt to stop the execution of the job.
+ * @param params Parameters specifying info about this job.
+ * @return If the job should be rescheduled.
+ */
+ boolean onStopJob(Context context, JobParameters params);
+}
diff --git a/src/com/android/settings/overlay/SupportFeatureProvider.java b/src/com/android/settings/overlay/SupportFeatureProvider.java
new file mode 100644
index 0000000..af171da
--- /dev/null
+++ b/src/com/android/settings/overlay/SupportFeatureProvider.java
@@ -0,0 +1,104 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.overlay;
+
+import android.accounts.Account;
+import android.annotation.IntDef;
+import android.app.Activity;
+import android.content.Context;
+import android.content.Intent;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * Feature provider for support tab.
+ */
+public interface SupportFeatureProvider {
+
+ @IntDef({SupportType.EMAIL, SupportType.PHONE, SupportType.CHAT})
+ @Retention(RetentionPolicy.SOURCE)
+ @interface SupportType {
+ int EMAIL = 1;
+ int PHONE = 2;
+ int CHAT = 3;
+ }
+
+ /**
+ * Returns a intent that will open help & feedback.
+ */
+ Intent getHelpIntent(Context context);
+
+ /**
+ * Whether or not a support type is enabled.
+ */
+ boolean isSupportTypeEnabled(Context context, @SupportType int type);
+
+ /**
+ * Whether or not a support type is in operation 24/7.
+ */
+ boolean isAlwaysOperating(@SupportType int type);
+
+ /**
+ * Whether or not a support type is operating now.
+ */
+ boolean isOperatingNow(@SupportType int type);
+
+ /**
+ * Returns a localized string indicating estimated wait time for a support time.
+ */
+ String getEstimatedWaitTime(Context context, @SupportType int type);
+
+ /**
+ * Whether or not a disclaimer dialog should be displayed.
+ */
+ boolean shouldShowDisclaimerDialog(Context context);
+
+ /**
+ * Sets whether or not a disclaimer dialog should be displayed.
+ */
+ void setShouldShowDisclaimerDialog(Context context, boolean shouldShow);
+
+ /**
+ * Returns an {@link Account} that's eligible for support options.
+ */
+ Account getSupportEligibleAccount(Context context);
+
+ /**
+ * Starts support activity of specified type
+ *
+ * @param activity Calling activity
+ * @param account A account returned by {@link #getSupportEligibleAccount}
+ * @param type The type of support account needs.
+ */
+ void startSupport(Activity activity, Account account, @SupportType int type);
+
+ /**
+ * Returns an {@link Intent} that opens help and allow user get help on sign in.
+ */
+ Intent getSignInHelpIntent(Context context);
+
+ /**
+ * Returns an intent that will start the add account UI.
+ */
+ Intent getAccountLoginIntent();
+
+ /**
+ * Returns an intent that will launch the tips and tricks UI.
+ */
+ Intent getTipsAndTricksIntent(Context context);
+}
diff --git a/src/com/android/settings/support/SupportDisclaimerDialogFragment.java b/src/com/android/settings/support/SupportDisclaimerDialogFragment.java
new file mode 100644
index 0000000..db74f0f
--- /dev/null
+++ b/src/com/android/settings/support/SupportDisclaimerDialogFragment.java
@@ -0,0 +1,133 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.support;
+
+import android.accounts.Account;
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.app.Dialog;
+import android.app.DialogFragment;
+import android.content.DialogInterface;
+import android.os.Bundle;
+import android.text.Spannable;
+import android.text.TextPaint;
+import android.text.method.LinkMovementMethod;
+import android.text.style.URLSpan;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.widget.CheckBox;
+import android.widget.TextView;
+
+import com.android.internal.logging.MetricsLogger;
+import com.android.internal.logging.MetricsProto;
+import com.android.settings.R;
+import com.android.settings.overlay.FeatureFactory;
+import com.android.settings.overlay.SupportFeatureProvider;
+
+/**
+ * {@link DialogFragment} for support disclaimer.
+ */
+public final class SupportDisclaimerDialogFragment extends DialogFragment implements
+ DialogInterface.OnClickListener {
+
+ public static final String TAG = "SupportDisclaimerDialog";
+ private static final String EXTRA_TYPE = "extra_type";
+ private static final String EXTRA_ACCOUNT = "extra_account";
+
+ public static SupportDisclaimerDialogFragment newInstance(Account account,
+ @SupportFeatureProvider.SupportType int type) {
+ final SupportDisclaimerDialogFragment fragment = new SupportDisclaimerDialogFragment();
+ final Bundle bundle = new Bundle(2);
+ bundle.putParcelable(SupportDisclaimerDialogFragment.EXTRA_ACCOUNT, account);
+ bundle.putInt(SupportDisclaimerDialogFragment.EXTRA_TYPE, type);
+ fragment.setArguments(bundle);
+ return fragment;
+ }
+
+ @Override
+ public Dialog onCreateDialog(Bundle savedInstanceState) {
+ final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity())
+ .setTitle(R.string.support_disclaimer_title)
+ .setPositiveButton(android.R.string.ok, this)
+ .setNegativeButton(android.R.string.cancel, this);
+ final View content = LayoutInflater.from(builder.getContext())
+ .inflate(R.layout.support_disclaimer_content, null);
+ final TextView disclaimer = (TextView) content.findViewById(R.id.support_disclaimer_text);
+ disclaimer.setMovementMethod(LinkMovementMethod.getInstance());
+ stripUnderlines((Spannable) disclaimer.getText());
+ return builder
+ .setView(content)
+ .create();
+ }
+
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ if (which == Dialog.BUTTON_NEGATIVE) {
+ MetricsLogger.action(getContext(),
+ MetricsProto.MetricsEvent.ACTION_SUPPORT_DISCLAIMER_CANCEL);
+ return;
+ }
+ final Activity activity = getActivity();
+ final CheckBox doNotShow =
+ (CheckBox) getDialog().findViewById(R.id.support_disclaimer_do_not_show_again);
+ final SupportFeatureProvider supportFeatureProvider =
+ FeatureFactory.getFactory(activity).getSupportFeatureProvider(activity);
+ supportFeatureProvider.setShouldShowDisclaimerDialog(getContext(), !doNotShow.isChecked());
+ final Bundle bundle = getArguments();
+ MetricsLogger.action(activity, MetricsProto.MetricsEvent.ACTION_SUPPORT_DISCLAIMER_OK);
+ supportFeatureProvider.startSupport(getActivity(),
+ (Account) bundle.getParcelable(EXTRA_ACCOUNT), bundle.getInt(EXTRA_TYPE));
+ }
+
+ @Override
+ public void onCancel(DialogInterface dialog) {
+ super.onCancel(dialog);
+ MetricsLogger.action(getContext(),
+ MetricsProto.MetricsEvent.ACTION_SUPPORT_DISCLAIMER_CANCEL);
+ }
+
+ /**
+ * Removes the underlines of {@link android.text.style.URLSpan}s.
+ */
+ private static void stripUnderlines(Spannable input) {
+ final URLSpan[] urls = input.getSpans(0, input.length(), URLSpan.class);
+
+ for (URLSpan span : urls) {
+ final int start = input.getSpanStart(span);
+ final int end = input.getSpanEnd(span);
+ input.removeSpan(span);
+ input.setSpan(new NoUnderlineUrlSpan(span.getURL()), start, end,
+ Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
+ }
+ }
+
+ /**
+ * A {@link URLSpan} that doesn't decorate the link with underline.
+ */
+ public static class NoUnderlineUrlSpan extends URLSpan {
+
+ public NoUnderlineUrlSpan(String url) {
+ super(url);
+ }
+
+ @Override
+ public void updateDrawState(TextPaint ds) {
+ super.updateDrawState(ds);
+ ds.setUnderlineText(false);
+ }
+ }
+}
diff --git a/src/com/android/settings/utils/AsyncLoader.java b/src/com/android/settings/utils/AsyncLoader.java
new file mode 100644
index 0000000..76c99fa
--- /dev/null
+++ b/src/com/android/settings/utils/AsyncLoader.java
@@ -0,0 +1,109 @@
+/*
+ * Copyright (C) 2016 Google Inc.
+ * Licensed to 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.utils;
+
+import android.content.AsyncTaskLoader;
+import android.content.Context;
+
+/**
+ * This class fills in some boilerplate for AsyncTaskLoader to actually load things.
+ *
+ * Subclasses need to implement {@link AsyncLoader#loadInBackground()} to perform the actual
+ * background task, and {@link AsyncLoader#onDiscardResult(T)} to clean up previously loaded
+ * results.
+ *
+ * This loader is based on the MailAsyncTaskLoader from the AOSP EmailUnified repo.
+ */
+public abstract class AsyncLoader<T> extends AsyncTaskLoader<T> {
+ private T mResult;
+
+ public AsyncLoader(final Context context) {
+ super(context);
+ }
+
+ @Override
+ protected void onStartLoading() {
+ if (mResult != null) {
+ deliverResult(mResult);
+ }
+
+ if (takeContentChanged() || mResult == null) {
+ forceLoad();
+ }
+ }
+
+ @Override
+ protected void onStopLoading() {
+ cancelLoad();
+ }
+
+ @Override
+ public void deliverResult(final T data) {
+ if (isReset()) {
+ if (data != null) {
+ onDiscardResult(data);
+ }
+ return;
+ }
+
+ final T oldResult = mResult;
+ mResult = data;
+
+ if (isStarted()) {
+ super.deliverResult(data);
+ }
+
+ if (oldResult != null && oldResult != mResult) {
+ onDiscardResult(oldResult);
+ }
+ }
+
+ @Override
+ protected void onReset() {
+ super.onReset();
+
+ onStopLoading();
+
+ if (mResult != null) {
+ onDiscardResult(mResult);
+ }
+ mResult = null;
+ }
+
+ @Override
+ public void onCanceled(final T data) {
+ super.onCanceled(data);
+
+ if (data != null) {
+ onDiscardResult(data);
+ }
+ }
+
+ /**
+ * Called when discarding the load results so subclasses can take care of clean-up or
+ * recycling tasks. This is not called if the same result (by way of pointer equality) is
+ * returned again by a subsequent call to loadInBackground, or if result is null.
+ *
+ * Note that this may be called concurrently with loadInBackground(), and in some circumstances
+ * may be called more than once for a given object.
+ *
+ * @param result The value returned from {@link AsyncLoader#loadInBackground()} which
+ * is to be discarded.
+ */
+ protected abstract void onDiscardResult(final T result);
+}
diff --git a/src/com/android/settings/utils/SettingsDividerItemDecoration.java b/src/com/android/settings/utils/SettingsDividerItemDecoration.java
new file mode 100644
index 0000000..451d532
--- /dev/null
+++ b/src/com/android/settings/utils/SettingsDividerItemDecoration.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.utils;
+
+import android.content.Context;
+import android.support.v7.preference.PreferenceViewHolder;
+import android.support.v7.widget.RecyclerView;
+
+import com.android.setupwizardlib.DividerItemDecoration;
+
+public class SettingsDividerItemDecoration extends DividerItemDecoration {
+
+ public SettingsDividerItemDecoration(Context context) {
+ super(context);
+ }
+
+ @Override
+ protected boolean isDividerAllowedAbove(RecyclerView.ViewHolder viewHolder) {
+ if (viewHolder instanceof PreferenceViewHolder) {
+ return ((PreferenceViewHolder) viewHolder).isDividerAllowedAbove();
+ }
+ return super.isDividerAllowedAbove(viewHolder);
+ }
+
+ @Override
+ protected boolean isDividerAllowedBelow(RecyclerView.ViewHolder viewHolder) {
+ if (viewHolder instanceof PreferenceViewHolder) {
+ return ((PreferenceViewHolder) viewHolder).isDividerAllowedBelow();
+ }
+ return super.isDividerAllowedBelow(viewHolder);
+ }
+}
diff --git a/src/com/android/settings/widget/SlidingTabLayout.java b/src/com/android/settings/widget/SlidingTabLayout.java
new file mode 100644
index 0000000..219d37b
--- /dev/null
+++ b/src/com/android/settings/widget/SlidingTabLayout.java
@@ -0,0 +1,166 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.widget;
+
+import android.content.Context;
+import android.support.v4.view.PagerAdapter;
+import android.support.v4.view.ViewPager;
+import android.util.AttributeSet;
+import android.view.Gravity;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.widget.FrameLayout;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+
+import com.android.settings.R;
+
+/**
+ * To be used with ViewPager to provide a tab indicator component which give constant feedback as
+ * to the user's scroll progress.
+ */
+public final class SlidingTabLayout extends FrameLayout implements View.OnClickListener {
+
+ private final LinearLayout mTitleView;
+ private final View mIndicatorView;
+ private final LayoutInflater mLayoutInflater;
+
+ private ViewPager mViewPager;
+ private int mSelectedPosition;
+ private float mSelectionOffset;
+
+ public SlidingTabLayout(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ mLayoutInflater = LayoutInflater.from(context);
+ mTitleView = new LinearLayout(context);
+ mTitleView.setGravity(Gravity.CENTER_HORIZONTAL);
+ mIndicatorView = mLayoutInflater.inflate(R.layout.sliding_tab_indicator_view, this, false);
+
+ addView(mTitleView, LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
+ addView(mIndicatorView, mIndicatorView.getLayoutParams());
+ }
+
+ /**
+ * Sets the associated view pager. Note that the assumption here is that the pager content
+ * (number of tabs and tab titles) does not change after this call has been made.
+ */
+ public void setViewPager(ViewPager viewPager) {
+ mTitleView.removeAllViews();
+
+ mViewPager = viewPager;
+ if (viewPager != null) {
+ viewPager.addOnPageChangeListener(new InternalViewPagerListener());
+ populateTabStrip();
+ }
+ }
+
+ @Override
+ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+ super.onMeasure(widthMeasureSpec, heightMeasureSpec);
+ final int titleCount = mTitleView.getChildCount();
+ if (titleCount > 0) {
+ final int width = MeasureSpec.makeMeasureSpec(
+ mTitleView.getMeasuredWidth() / titleCount, MeasureSpec.EXACTLY);
+ final int height = MeasureSpec.makeMeasureSpec(
+ mIndicatorView.getMeasuredHeight(), MeasureSpec.EXACTLY);
+ mIndicatorView.measure(width, height);
+ }
+ }
+
+ @Override
+ protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
+ if (mTitleView.getChildCount() > 0) {
+ mTitleView.layout(0, 0, mTitleView.getMeasuredWidth(), mTitleView.getMeasuredHeight());
+ final int indicatorBottom = getMeasuredHeight();
+ final int indicatorHeight = mIndicatorView.getMeasuredHeight();
+ mIndicatorView.layout(0, indicatorBottom - indicatorHeight,
+ mIndicatorView.getMeasuredWidth(), indicatorBottom);
+ }
+ }
+
+ @Override
+ public void onClick(View v) {
+ final int titleCount = mTitleView.getChildCount();
+ for (int i = 0; i < titleCount; i++) {
+ if (v == mTitleView.getChildAt(i)) {
+ mViewPager.setCurrentItem(i);
+ return;
+ }
+ }
+ }
+
+ private void onViewPagerPageChanged(int position, float positionOffset) {
+ mSelectedPosition = position;
+ mSelectionOffset = positionOffset;
+ mIndicatorView.setTranslationX(getIndicatorLeft());
+ }
+
+ private void populateTabStrip() {
+ final PagerAdapter adapter = mViewPager.getAdapter();
+
+ for (int i = 0; i < adapter.getCount(); i++) {
+ final TextView tabTitleView = (TextView) mLayoutInflater.inflate(
+ R.layout.sliding_tab_title_view, mTitleView, false);
+
+ tabTitleView.setText(adapter.getPageTitle(i));
+ tabTitleView.setOnClickListener(this);
+
+ mTitleView.addView(tabTitleView);
+ tabTitleView.setSelected(i == mViewPager.getCurrentItem());
+ }
+ }
+
+ private int getIndicatorLeft() {
+ View selectedTitle = mTitleView.getChildAt(mSelectedPosition);
+ int left = selectedTitle.getLeft();
+ if (mSelectionOffset > 0f && mSelectedPosition < (getChildCount() - 1)) {
+ View nextTitle = mTitleView.getChildAt(mSelectedPosition + 1);
+ left = (int) (mSelectionOffset * nextTitle.getLeft()
+ + (1.0f - mSelectionOffset) * left);
+ }
+ return left;
+ }
+
+ private final class InternalViewPagerListener implements ViewPager.OnPageChangeListener {
+ private int mScrollState;
+
+ @Override
+ public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
+ final int titleCount = mTitleView.getChildCount();
+ if ((titleCount == 0) || (position < 0) || (position >= titleCount)) {
+ return;
+ }
+ onViewPagerPageChanged(position, positionOffset);
+ }
+
+ @Override
+ public void onPageScrollStateChanged(int state) {
+ mScrollState = state;
+ }
+
+ @Override
+ public void onPageSelected(int position) {
+ if (mScrollState == ViewPager.SCROLL_STATE_IDLE) {
+ onViewPagerPageChanged(position, 0f);
+ }
+ final int titleCount = mTitleView.getChildCount();
+ for (int i = 0; i < titleCount; i++) {
+ mTitleView.getChildAt(i).setSelected(position == i);
+ }
+ }
+ }
+}
diff --git a/tests/unit/src/com/android/settings/deletionhelper/FetchDownloadsLoaderTest.java b/tests/unit/src/com/android/settings/deletionhelper/FetchDownloadsLoaderTest.java
new file mode 100644
index 0000000..52312d1
--- /dev/null
+++ b/tests/unit/src/com/android/settings/deletionhelper/FetchDownloadsLoaderTest.java
@@ -0,0 +1,90 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.deletionhelper;
+
+import com.android.settings.deletionhelper.FetchDownloadsLoader.DownloadsResult;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.rules.TemporaryFolder;
+import org.junit.runners.JUnit4;
+
+import java.io.File;
+import java.io.FileWriter;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertEquals;
+
+@RunWith(JUnit4.class)
+public class FetchDownloadsLoaderTest {
+ @Rule
+ public TemporaryFolder temporaryFolder = new TemporaryFolder();
+
+ @Test
+ public void testEmptyDirectory() throws Exception {
+ DownloadsResult result =
+ FetchDownloadsLoader.collectFiles(temporaryFolder.getRoot());
+ assertNotNull(result);
+ assertEquals(0, result.totalSize);
+ assertEquals(0, result.files.size());
+ }
+
+ @Test
+ public void testFilesInDirectory() throws Exception {
+ temporaryFolder.newFile();
+ temporaryFolder.newFile();
+
+ DownloadsResult result =
+ FetchDownloadsLoader.collectFiles(temporaryFolder.getRoot());
+ assertNotNull(result);
+ assertEquals(0, result.totalSize);
+ assertEquals(2, result.files.size());
+ }
+
+ @Test
+ public void testNestedDirectories() throws Exception {
+ File tempDir = temporaryFolder.newFolder();
+
+ File testFile = File.createTempFile("test", null, tempDir);
+ testFile.deleteOnExit();
+ DownloadsResult result =
+ FetchDownloadsLoader.collectFiles(temporaryFolder.getRoot());
+ assertNotNull(result);
+ assertEquals(0, result.totalSize);
+ assertEquals(1, result.files.size());
+ }
+
+ @Test
+ public void testSumFileSizes() throws Exception {
+ File first = temporaryFolder.newFile();
+ FileWriter fileWriter = new FileWriter(first);
+ fileWriter.write("test");
+ fileWriter.close();
+
+ File second = temporaryFolder.newFile();
+ fileWriter = new FileWriter(second);
+ fileWriter.write("test2");
+ fileWriter.close();
+
+ DownloadsResult result =
+ FetchDownloadsLoader.collectFiles(temporaryFolder.getRoot());
+ assertNotNull(result);
+ assertEquals(9, result.totalSize);
+ assertEquals(2, result.files.size());
+ }
+}
diff --git a/tests/unit/src/com/android/settings/deletionhelper/PackageDeletionTaskTest.java b/tests/unit/src/com/android/settings/deletionhelper/PackageDeletionTaskTest.java
new file mode 100644
index 0000000..10ba585
--- /dev/null
+++ b/tests/unit/src/com/android/settings/deletionhelper/PackageDeletionTaskTest.java
@@ -0,0 +1,120 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.deletionhelper;
+
+import android.test.AndroidTestCase;
+import android.content.pm.IPackageDeleteObserver;
+import android.content.pm.PackageManager;
+import android.os.RemoteException;
+import android.test.mock.MockPackageManager;
+import android.test.suitebuilder.annotation.SmallTest;
+
+import com.android.settings.deletionhelper.PackageDeletionTask;
+import com.android.settings.deletionhelper.PackageDeletionTask.Callback;
+
+import java.util.Set;
+import java.util.HashSet;
+
+public class PackageDeletionTaskTest extends AndroidTestCase {
+ private FakePackageManager mPackageManager;
+ private Set<String> mDeletedApps;
+
+ @Override
+ protected void setUp() throws Exception {
+ mPackageManager = new FakePackageManager();
+ mDeletedApps = new HashSet<String>();
+ }
+
+ @SmallTest
+ public void testDeleteNoApps() throws Exception {
+ runTask(new HashSet<String>(), false);
+ }
+
+ @SmallTest
+ public void testDeleteOneApp() throws Exception {
+ HashSet<String> appsToDelete = new HashSet<String>();
+ appsToDelete.add("app.test1");
+ runTask(appsToDelete, false);
+ }
+
+ @SmallTest
+ public void testDeleteManyApps() throws Exception {
+ HashSet<String> appsToDelete = new HashSet<String>();
+ appsToDelete.add("app.test1");
+ appsToDelete.add("app.test2");
+ runTask(appsToDelete, false);
+ }
+
+ @SmallTest
+ public void testDeleteFails() throws Exception {
+ HashSet<String> appsToDelete = new HashSet<String>();
+ appsToDelete.add("app.test1");
+ mPackageManager.deletionSucceeds = false;
+ runTask(appsToDelete, true);
+ }
+
+ private void runTask(HashSet<String> appsToDelete, boolean shouldFail) {
+ PackageDeletionTask task = new PackageDeletionTask(mPackageManager, appsToDelete,
+ new VerifierCallback(appsToDelete, shouldFail));
+ task.run();
+ }
+
+ class FakePackageManager extends MockPackageManager {
+ public boolean deletionSucceeds = true;
+
+ @Override
+ public void deletePackageAsUser(String packageName, IPackageDeleteObserver observer,
+ int flags, int userId) {
+ int resultCode;
+ if (deletionSucceeds) {
+ resultCode = PackageManager.DELETE_SUCCEEDED;
+ mDeletedApps.add(packageName);
+ } else {
+ resultCode = PackageManager.DELETE_FAILED_INTERNAL_ERROR;
+ }
+
+ try {
+ observer.packageDeleted(packageName, resultCode);
+ } catch (RemoteException e) {
+ fail(e.toString());
+ }
+ }
+ }
+
+ class VerifierCallback extends Callback {
+ private Set<String> mExpectedDeletedApps;
+ private boolean mShouldFail;
+
+ public VerifierCallback(HashSet<String> expectedDeletedApps, boolean shouldFail) {
+ mExpectedDeletedApps = expectedDeletedApps;
+ mShouldFail = shouldFail;
+ }
+
+ @Override
+ public void onSuccess() {
+ System.out.println("lol");
+ assertFalse(mShouldFail);
+ assertEquals(mExpectedDeletedApps, mDeletedApps);
+ }
+
+ @Override
+ public void onError() {
+ assertTrue(mShouldFail);
+ }
+ }
+
+}