Merge "calling back SetupFaceLock to clean up temporary gallery"
diff --git a/res/layout/weak_biometric_fallback_header.xml b/res/layout/weak_biometric_fallback_header.xml
new file mode 100644
index 0000000..adbb613
--- /dev/null
+++ b/res/layout/weak_biometric_fallback_header.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2011 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.
+-->
+<TextView xmlns:android="http://schemas.android.com/apk/res/android"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:padding="8dip"
+        android:gravity="center"
+        android:textAppearance="?android:attr/textAppearanceMedium"
+        android:textColor="?android:attr/textColorSecondary"
+        android:text="@string/unlock_backup_info_summary"
+/>
\ No newline at end of file
diff --git a/res/values/strings.xml b/res/values/strings.xml
index f793d79..e0e0819 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -3357,11 +3357,11 @@
     <string name="sync_automatically">Auto-sync app data</string>
 
     <!-- Sync status messages on Accounts & Synchronization settings --><skip />
-    <!-- Sync status shown when sync is enabled [CHAR LIMIT=20] -->
+    <!-- Sync status shown when sync is enabled [CHAR LIMIT=25] -->
     <string name="sync_enabled">Sync is ON</string>
-    <!-- Sync status shown when sync is disabled [CHAR LIMIT=20] -->
+    <!-- Sync status shown when sync is disabled [CHAR LIMIT=25] -->
     <string name="sync_disabled">Sync is OFF</string>
-    <!-- Sync status shown when last sync resulted in an error [CHAR LIMIT=20] -->
+    <!-- Sync status shown when last sync resulted in an error [CHAR LIMIT=25] -->
     <string name="sync_error">Sync error</string>
 
     <!-- Data synchronization settings screen, setting option name -->
@@ -3474,6 +3474,11 @@
     <!-- UI debug setting: show cpu usage summary [CHAR LIMIT=50] -->
     <string name="show_cpu_usage_summary">Screen overlay showing current CPU usage</string>
 
+    <!-- UI debug setting: force hardware acceleration to render apps [CHAR LIMIT=25] -->
+    <string name="force_hw_ui">Force hardware acceleration</string>
+    <!-- UI debug setting: force hardware acceleration summary [CHAR LIMIT=50] -->
+    <string name="force_hw_ui_summary">Render applications using the GPU</string>
+
     <!-- UI debug setting: scaling factor for window animations [CHAR LIMIT=25] -->
     <string name="window_animation_scale_title">Window animation scale</string>
 
diff --git a/res/xml/development_prefs.xml b/res/xml/development_prefs.xml
index 76e50aa..68e24c4 100644
--- a/res/xml/development_prefs.xml
+++ b/res/xml/development_prefs.xml
@@ -85,6 +85,11 @@
             android:title="@string/show_cpu_usage"
             android:summary="@string/show_cpu_usage_summary"/>
 
+        <CheckBoxPreference
+            android:key="force_hw_ui"
+            android:title="@string/force_hw_ui"
+            android:summary="@string/force_hw_ui_summary"/>
+
         <ListPreference
             android:key="window_animation_scale"
             android:title="@string/window_animation_scale_title"
diff --git a/res/xml/security_settings_picker.xml b/res/xml/security_settings_picker.xml
index 2d0760c..87e69e0 100644
--- a/res/xml/security_settings_picker.xml
+++ b/res/xml/security_settings_picker.xml
@@ -16,53 +16,40 @@
 
 <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
 
-     <PreferenceCategory
-        android:key="security_picker_category"
-        android:title="@string/lock_settings_picker_title">
-
-<!-- TODO: find a better way to display this backup info -->
-        <PreferenceScreen
-            android:key="unlock_backup_info"
-            android:summary="@string/unlock_backup_info_summary"
-            android:selectable="false"
-            android:persistent="false"/>
-
-        <PreferenceScreen
+    <PreferenceScreen
             android:key="unlock_set_off"
             android:title="@string/unlock_set_unlock_off_title"
             android:summary="@string/unlock_set_unlock_off_summary"
             android:persistent="false"/>
 
-        <PreferenceScreen
+    <PreferenceScreen
             android:key="unlock_set_none"
             android:title="@string/unlock_set_unlock_none_title"
             android:summary="@string/unlock_set_unlock_none_summary"
             android:persistent="false"/>
 
-        <PreferenceScreen
+    <PreferenceScreen
             android:key="unlock_set_biometric_weak"
             android:title="@string/unlock_set_unlock_biometric_weak_title"
             android:summary="@string/unlock_set_unlock_biometric_weak_summary"
             android:persistent="false"/>
 
-        <PreferenceScreen
+    <PreferenceScreen
             android:key="unlock_set_pattern"
             android:title="@string/unlock_set_unlock_pattern_title"
             android:summary="@string/unlock_set_unlock_pattern_summary"
             android:persistent="false"/>
 
-        <PreferenceScreen
+    <PreferenceScreen
             android:key="unlock_set_pin"
             android:title="@string/unlock_set_unlock_pin_title"
             android:summary="@string/unlock_set_unlock_pin_summary"
             android:persistent="false"/>
 
-        <PreferenceScreen
+    <PreferenceScreen
             android:key="unlock_set_password"
             android:title="@string/unlock_set_unlock_password_title"
             android:summary="@string/unlock_set_unlock_password_summary"
             android:persistent="false"/>
 
-    </PreferenceCategory>
-
 </PreferenceScreen>
diff --git a/src/com/android/settings/ChooseLockGeneric.java b/src/com/android/settings/ChooseLockGeneric.java
index 5e966b1..2fbd10d 100644
--- a/src/com/android/settings/ChooseLockGeneric.java
+++ b/src/com/android/settings/ChooseLockGeneric.java
@@ -25,9 +25,12 @@
 import android.os.SystemProperties;
 import android.preference.Preference;
 import android.preference.PreferenceActivity;
-import android.preference.PreferenceCategory;
 import android.preference.PreferenceScreen;
 import android.security.KeyStore;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ListView;
 
 import com.android.internal.widget.LockPatternUtils;
 
@@ -119,6 +122,21 @@
         }
 
         @Override
+        public View onCreateView(LayoutInflater inflater, ViewGroup container,
+                Bundle savedInstanceState) {
+            View v = super.onCreateView(inflater, container, savedInstanceState);
+            final boolean onlyShowFallback = getActivity().getIntent()
+                    .getBooleanExtra(LockPatternUtils.LOCKSCREEN_BIOMETRIC_WEAK_FALLBACK, false);
+            if (onlyShowFallback) {
+                View header = v.inflate(getActivity(),
+                        R.layout.weak_biometric_fallback_header, null);
+                ((ListView) v.findViewById(android.R.id.list)).addHeaderView(header, null, false);
+            }
+
+            return v;
+        }
+
+        @Override
         public void onActivityResult(int requestCode, int resultCode, Intent data) {
             super.onActivityResult(requestCode, resultCode, data);
             if (requestCode == CONFIRM_EXISTING_REQUEST && resultCode == Activity.RESULT_OK) {
@@ -205,30 +223,18 @@
          * @param quality the requested quality.
          */
         private void disableUnusablePreferences(final int quality) {
-            final Preference picker =
-                    getPreferenceScreen().findPreference("security_picker_category");
-            final PreferenceCategory cat = (PreferenceCategory) picker;
-            final int preferenceCount = cat.getPreferenceCount();
+            final PreferenceScreen entries = getPreferenceScreen();
             final boolean onlyShowFallback = getActivity().getIntent()
                     .getBooleanExtra(LockPatternUtils.LOCKSCREEN_BIOMETRIC_WEAK_FALLBACK, false);
             final boolean weakBiometricAvailable = isBiometricSensorAvailable(
                     DevicePolicyManager.PASSWORD_QUALITY_BIOMETRIC_WEAK);
-            // TODO: This code can be removed once the second header is gone
-            if (onlyShowFallback) {
-                picker.setTitle(R.string.backup_lock_settings_picker_title);
-            } else {
-                picker.setTitle(R.string.lock_settings_picker_title);
-            }
-            for (int i = preferenceCount-1; i >= 0; --i) {
-                Preference pref = cat.getPreference(i);
+            for (int i = entries.getPreferenceCount() - 1; i >= 0; --i) {
+                Preference pref = entries.getPreference(i);
                 if (pref instanceof PreferenceScreen) {
                     final String key = ((PreferenceScreen) pref).getKey();
                     boolean enabled = true;
                     boolean visible = true;
-                    if (KEY_UNLOCK_BACKUP_INFO.equals(key)) {
-                        enabled = true;
-                        visible = onlyShowFallback;
-                    } else if (KEY_UNLOCK_SET_OFF.equals(key)) {
+                    if (KEY_UNLOCK_SET_OFF.equals(key)) {
                         enabled = quality <= DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED;
                     } else if (KEY_UNLOCK_SET_NONE.equals(key)) {
                         enabled = quality <= DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED;
@@ -243,7 +249,7 @@
                         enabled = quality <= DevicePolicyManager.PASSWORD_QUALITY_COMPLEX;
                     }
                     if (!visible || (onlyShowFallback && !allowedForFallback(key))) {
-                        cat.removePreference(pref);
+                        entries.removePreference(pref);
                     } else if (!enabled) {
                         pref.setSummary(R.string.unlock_set_unlock_disabled_summary);
                         pref.setEnabled(false);
diff --git a/src/com/android/settings/DevelopmentSettings.java b/src/com/android/settings/DevelopmentSettings.java
index c3725e4..2ffae19 100644
--- a/src/com/android/settings/DevelopmentSettings.java
+++ b/src/com/android/settings/DevelopmentSettings.java
@@ -60,12 +60,14 @@
     private static final String HDCP_CHECKING_KEY = "hdcp_checking";
     private static final String HDCP_CHECKING_PROPERTY = "persist.sys.hdcp_checking";
     private static final String LOCAL_BACKUP_PASSWORD = "local_backup_password";
+    private static final String HARDWARE_UI_PROPERTY = "persist.sys.ui.hw";
 
     private static final String STRICT_MODE_KEY = "strict_mode";
     private static final String POINTER_LOCATION_KEY = "pointer_location";
     private static final String SHOW_TOUCHES_KEY = "show_touches";
     private static final String SHOW_SCREEN_UPDATES_KEY = "show_screen_updates";
     private static final String SHOW_CPU_USAGE_KEY = "show_cpu_usage";
+    private static final String FORCE_HARDWARE_UI_KEY = "force_hw_ui";
     private static final String WINDOW_ANIMATION_SCALE_KEY = "window_animation_scale";
     private static final String TRANSITION_ANIMATION_SCALE_KEY = "transition_animation_scale";
 
@@ -88,6 +90,7 @@
     private CheckBoxPreference mShowTouches;
     private CheckBoxPreference mShowScreenUpdates;
     private CheckBoxPreference mShowCpuUsage;
+    private CheckBoxPreference mForceHardwareUi;
     private ListPreference mWindowAnimationScale;
     private ListPreference mTransitionAnimationScale;
 
@@ -121,6 +124,7 @@
         mShowTouches = (CheckBoxPreference) findPreference(SHOW_TOUCHES_KEY);
         mShowScreenUpdates = (CheckBoxPreference) findPreference(SHOW_SCREEN_UPDATES_KEY);
         mShowCpuUsage = (CheckBoxPreference) findPreference(SHOW_CPU_USAGE_KEY);
+        mForceHardwareUi = (CheckBoxPreference) findPreference(FORCE_HARDWARE_UI_KEY);
         mWindowAnimationScale = (ListPreference) findPreference(WINDOW_ANIMATION_SCALE_KEY);
         mWindowAnimationScale.setOnPreferenceChangeListener(this);
         mTransitionAnimationScale = (ListPreference) findPreference(TRANSITION_ANIMATION_SCALE_KEY);
@@ -172,6 +176,7 @@
         updateShowTouchesOptions();
         updateFlingerOptions();
         updateCpuUsageOptions();
+        updateHardwareUiOptions();
         updateAnimationScaleOptions();
         updateImmediatelyDestroyActivitiesOptions();
         updateAppProcessLimitOptions();
@@ -294,11 +299,19 @@
         }
     }
 
+    private void updateHardwareUiOptions() {
+        mForceHardwareUi.setChecked(SystemProperties.getBoolean(HARDWARE_UI_PROPERTY, false));
+    }
+    
+    private void writeHardwareUiOptions() {
+        SystemProperties.set(HARDWARE_UI_PROPERTY, mForceHardwareUi.isChecked() ? "true" : "false");
+    }
+
     private void updateCpuUsageOptions() {
         mShowCpuUsage.setChecked(Settings.System.getInt(getActivity().getContentResolver(),
                 Settings.System.SHOW_PROCESSES, 0) != 0);
     }
-
+    
     private void writeCpuUsageOptions() {
         boolean value = mShowCpuUsage.isChecked();
         Settings.System.putInt(getActivity().getContentResolver(),
@@ -441,6 +454,8 @@
             writeImmediatelyDestroyActivitiesOptions();
         } else if (preference == mShowAllANRs) {
             writeShowAllANRsOptions();
+        } else if (preference == mForceHardwareUi) {
+            writeHardwareUiOptions();
         }
 
         return false;