Merge "Power control widget holofied"
diff --git a/res/layout-sw600dp/accessibility_tutorial_container.xml b/res/layout-sw600dp/accessibility_tutorial_container.xml
index d649354..f5da706 100644
--- a/res/layout-sw600dp/accessibility_tutorial_container.xml
+++ b/res/layout-sw600dp/accessibility_tutorial_container.xml
@@ -57,7 +57,8 @@
         <View
             style="@style/AccessibilityTutorialDivider" />
 
-        <TextView
+        <view
+            class="com.android.settings.AccessibilityTutorialActivity$TutorialTextView"
             android:id="@+id/instructions"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
diff --git a/res/layout/accessibility_tutorial_container.xml b/res/layout/accessibility_tutorial_container.xml
index 4ee72f5..6566cff 100644
--- a/res/layout/accessibility_tutorial_container.xml
+++ b/res/layout/accessibility_tutorial_container.xml
@@ -47,7 +47,8 @@
             android:focusable="false"
             android:clickable="false" />
 
-        <TextView
+        <view
+            class="com.android.settings.AccessibilityTutorialActivity$TutorialTextView"
             android:id="@+id/instructions"
             android:layout_width="fill_parent"
             android:layout_height="wrap_content"
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 87be0e6..29ba1d3 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -3398,6 +3398,11 @@
     <!-- UI debug setting: show pointer location summary [CHAR LIMIT=50] -->
     <string name="pointer_location_summary">Screen overlay showing current touch data</string>
 
+    <!-- UI debug setting: show touches? [CHAR LIMIT=25] -->
+    <string name="show_touches">Show touches</string>
+    <!-- UI debug setting: show touches location summary [CHAR LIMIT=50] -->
+    <string name="show_touches_summary">Show visual feedback for touches</string>
+
     <!-- UI debug setting: show where screen updates happen? [CHAR LIMIT=25] -->
     <string name="show_screen_updates">Show screen updates</string>
     <!-- UI debug setting: show screen updates summary [CHAR LIMIT=50] -->
@@ -3492,7 +3497,7 @@
     <!-- Button title for launching application-specific data usage settings. [CHAR LIMIT=32] -->
     <string name="data_usage_app_settings">View application settings</string>
     <!-- Checkbox label that restricts background data usage of a specific application. [CHAR LIMIT=32] -->
-    <string name="data_usage_app_restrict_background">Restrict background data usage</string>
+    <string name="data_usage_app_restrict_background">Restrict background data</string>
     <!-- Summary message for checkbox that restricts background data usage of a specific application. [CHAR LIMIT=64] -->
     <string name="data_usage_app_restrict_background_summary">Disable background data on networks that you\'ve chosen to limit (<xliff:g id="networks" example="Mobile, Wi-Fi">%1$s</xliff:g>).</string>
     <!-- Title of dialog shown when user restricts background data usage of a specific application. [CHAR LIMIT=48] -->
diff --git a/res/xml/development_prefs.xml b/res/xml/development_prefs.xml
index 0f8dfbc..b65c2e5 100644
--- a/res/xml/development_prefs.xml
+++ b/res/xml/development_prefs.xml
@@ -64,6 +64,11 @@
             android:summary="@string/pointer_location_summary"/>
 
         <CheckBoxPreference
+            android:key="show_touches"
+            android:title="@string/show_touches"
+            android:summary="@string/show_touches_summary"/>
+
+        <CheckBoxPreference
             android:key="show_screen_updates"
             android:title="@string/show_screen_updates"
             android:summary="@string/show_screen_updates_summary"/>
diff --git a/src/com/android/settings/AccessibilityTutorialActivity.java b/src/com/android/settings/AccessibilityTutorialActivity.java
index da8350c..5039970 100644
--- a/src/com/android/settings/AccessibilityTutorialActivity.java
+++ b/src/com/android/settings/AccessibilityTutorialActivity.java
@@ -27,6 +27,7 @@
 import android.os.Handler;
 import android.os.Message;
 import android.provider.Settings;
+import android.util.AttributeSet;
 import android.view.LayoutInflater;
 import android.view.MotionEvent;
 import android.view.View;
@@ -661,4 +662,13 @@
             mFinish.setVisibility(visible ? VISIBLE : GONE);
         }
     }
+
+    /**
+     * Provides a tutorial-specific class name for fired accessibility events.
+     */
+    public static class TutorialTextView extends TextView {
+        public TutorialTextView(Context context, AttributeSet attrs) {
+            super(context, attrs);
+        }
+    }
 }
diff --git a/src/com/android/settings/DevelopmentSettings.java b/src/com/android/settings/DevelopmentSettings.java
index d93c333..bdbec97 100644
--- a/src/com/android/settings/DevelopmentSettings.java
+++ b/src/com/android/settings/DevelopmentSettings.java
@@ -59,6 +59,7 @@
 
     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 WINDOW_ANIMATION_SCALE_KEY = "window_animation_scale";
@@ -80,6 +81,7 @@
 
     private CheckBoxPreference mStrictMode;
     private CheckBoxPreference mPointerLocation;
+    private CheckBoxPreference mShowTouches;
     private CheckBoxPreference mShowScreenUpdates;
     private CheckBoxPreference mShowCpuUsage;
     private ListPreference mWindowAnimationScale;
@@ -112,6 +114,7 @@
 
         mStrictMode = (CheckBoxPreference) findPreference(STRICT_MODE_KEY);
         mPointerLocation = (CheckBoxPreference) findPreference(POINTER_LOCATION_KEY);
+        mShowTouches = (CheckBoxPreference) findPreference(SHOW_TOUCHES_KEY);
         mShowScreenUpdates = (CheckBoxPreference) findPreference(SHOW_SCREEN_UPDATES_KEY);
         mShowCpuUsage = (CheckBoxPreference) findPreference(SHOW_CPU_USAGE_KEY);
         mWindowAnimationScale = (ListPreference) findPreference(WINDOW_ANIMATION_SCALE_KEY);
@@ -155,6 +158,7 @@
         updatePasswordSummary();
         updateStrictModeVisualOptions();
         updatePointerLocationOptions();
+        updateShowTouchesOptions();
         updateFlingerOptions();
         updateCpuUsageOptions();
         updateAnimationScaleOptions();
@@ -229,6 +233,16 @@
                 Settings.System.POINTER_LOCATION, 0) != 0);
     }
 
+    private void writeShowTouchesOptions() {
+        Settings.System.putInt(getActivity().getContentResolver(),
+                Settings.System.SHOW_TOUCHES, mShowTouches.isChecked() ? 1 : 0);
+    }
+
+    private void updateShowTouchesOptions() {
+        mShowTouches.setChecked(Settings.System.getInt(getActivity().getContentResolver(),
+                Settings.System.SHOW_TOUCHES, 0) != 0);
+    }
+
     private void updateFlingerOptions() {
         // magic communication with surface flinger.
         try {
@@ -406,6 +420,8 @@
             writeStrictModeVisualOptions();
         } else if (preference == mPointerLocation) {
             writePointerLocationOptions();
+        } else if (preference == mShowTouches) {
+            writeShowTouchesOptions();
         } else if (preference == mShowScreenUpdates) {
             writeFlingerOptions();
         } else if (preference == mShowCpuUsage) {
diff --git a/src/com/android/settings/applications/ApplicationsState.java b/src/com/android/settings/applications/ApplicationsState.java
index e0899cb..799b34a 100644
--- a/src/com/android/settings/applications/ApplicationsState.java
+++ b/src/com/android/settings/applications/ApplicationsState.java
@@ -153,6 +153,9 @@
         private final Collator sCollator = Collator.getInstance();
         @Override
         public int compare(AppEntry object1, AppEntry object2) {
+            if (object1.info.enabled != object2.info.enabled) {
+                return object1.info.enabled ? -1 : 1;
+            }
             return sCollator.compare(object1.label, object2.label);
         }
     };
diff --git a/src/com/android/settings/applications/ManageApplications.java b/src/com/android/settings/applications/ManageApplications.java
index 747b406..c2e68dd 100644
--- a/src/com/android/settings/applications/ManageApplications.java
+++ b/src/com/android/settings/applications/ManageApplications.java
@@ -628,10 +628,6 @@
                 .setIndicator(getActivity().getString(R.string.filter_apps_third_party),
                         getActivity().getResources().getDrawable(R.drawable.ic_tab_download))
                 .setContent(this));
-        tabHost.addTab(tabHost.newTabSpec(TAB_ALL)
-                .setIndicator(getActivity().getString(R.string.filter_apps_all),
-                        getActivity().getResources().getDrawable(R.drawable.ic_tab_all))
-                .setContent(this));
         if (!Environment.isExternalStorageEmulated()) {
             tabHost.addTab(tabHost.newTabSpec(TAB_SDCARD)
                     .setIndicator(getActivity().getString(R.string.filter_apps_onsdcard),
@@ -642,6 +638,10 @@
                 .setIndicator(getActivity().getString(R.string.filter_apps_running),
                         getActivity().getResources().getDrawable(R.drawable.ic_tab_running))
                 .setContent(this));
+        tabHost.addTab(tabHost.newTabSpec(TAB_ALL)
+                .setIndicator(getActivity().getString(R.string.filter_apps_all),
+                        getActivity().getResources().getDrawable(R.drawable.ic_tab_all))
+                .setContent(this));
         tabHost.setCurrentTabByTag(mDefaultTab);
         tabHost.setOnTabChangedListener(this);