Merge "Include Add Network button for Setup Wizard" into jb-dev
diff --git a/res/layout-h720dp/tab_widget.xml b/res/layout-sw720dp/tab_widget.xml
similarity index 75%
rename from res/layout-h720dp/tab_widget.xml
rename to res/layout-sw720dp/tab_widget.xml
index 5a4e580..4cd4547 100644
--- a/res/layout-h720dp/tab_widget.xml
+++ b/res/layout-sw720dp/tab_widget.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2011 The Android Open Source Project
+<!-- Copyright (C) 2012 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.
@@ -17,13 +17,16 @@
 <HorizontalScrollView xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
-    android:scrollbars="none">
+    android:scrollbars="none"
+    android:fillViewport="true">
 
     <TabWidget
         android:id="@android:id/tabs"
-        android:layout_width="wrap_content"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:orientation="horizontal"
+        android:paddingLeft="@*android:dimen/preference_fragment_padding_side"
+        android:paddingRight="@*android:dimen/preference_fragment_padding_side"
         style="?android:attr/tabWidgetStyle" />
 
 </HorizontalScrollView>
diff --git a/res/layout-w720dp/tab_widget.xml b/res/layout-w720dp/tab_widget.xml
deleted file mode 100644
index 5a4e580..0000000
--- a/res/layout-w720dp/tab_widget.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?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.
--->
-
-<HorizontalScrollView xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="match_parent"
-    android:layout_height="wrap_content"
-    android:scrollbars="none">
-
-    <TabWidget
-        android:id="@android:id/tabs"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:orientation="horizontal"
-        style="?android:attr/tabWidgetStyle" />
-
-</HorizontalScrollView>
diff --git a/res/layout/manage_applications.xml b/res/layout/manage_applications.xml
index 7df2f54..da56c99 100755
--- a/res/layout/manage_applications.xml
+++ b/res/layout/manage_applications.xml
@@ -49,7 +49,9 @@
                 android:paddingTop="30dp"
                 android:paddingLeft="4dp"
                 android:paddingRight="4dp"
-                android:paddingBottom="1dp">
+                android:paddingBottom="1dp"
+                android:layout_marginLeft="@*android:dimen/preference_fragment_padding_side"
+                android:layout_marginRight="@*android:dimen/preference_fragment_padding_side">
             <TextView android:id="@+id/usedStorageText"
                 android:layout_width="0px"
                 android:layout_height="wrap_content"
@@ -91,6 +93,8 @@
             android:orientation="vertical"
             android:layout_width="match_parent"
             android:layout_height="match_parent"
+            android:layout_marginLeft="@*android:dimen/preference_fragment_padding_side"
+            android:layout_marginRight="@*android:dimen/preference_fragment_padding_side"
             android:visibility="gone"
             android:gravity="center">
 
diff --git a/res/layout/manage_apps_tab_content.xml b/res/layout/manage_apps_tab_content.xml
index 3898227..b36501b 100644
--- a/res/layout/manage_apps_tab_content.xml
+++ b/res/layout/manage_apps_tab_content.xml
@@ -27,9 +27,10 @@
     <LinearLayout
         android:orientation="vertical"
         android:layout_width="match_parent"
-        android:layout_height="match_parent">
-        
-        <include layout="@layout/tab_widget" />
+        android:layout_height="match_parent"
+        >
+
+        <include layout="@layout/tab_widget"/>
 
         <FrameLayout
             android:id="@android:id/tabcontent"
diff --git a/res/layout/running_processes_view.xml b/res/layout/running_processes_view.xml
index 3558e92..e23de16 100644
--- a/res/layout/running_processes_view.xml
+++ b/res/layout/running_processes_view.xml
@@ -26,7 +26,10 @@
         <ListView android:id="@android:id/list"
                 android:layout_width="match_parent" 
                 android:layout_height="match_parent"
+                android:paddingLeft="@*android:dimen/preference_fragment_padding_side"
+                android:paddingRight="@*android:dimen/preference_fragment_padding_side"
                 android:drawSelectorOnTop="false"
+                android:scrollbarStyle="outsideOverlay"
                 android:fastScrollEnabled="true" />
         <TextView android:id="@android:id/empty"
                 android:layout_width="match_parent"
@@ -46,7 +49,9 @@
             android:paddingTop="30dp"
             android:paddingLeft="4dp"
             android:paddingRight="4dp"
-            android:paddingBottom="1dp">
+            android:paddingBottom="1dp"
+            android:layout_marginLeft="@*android:dimen/preference_fragment_padding_side"
+            android:layout_marginRight="@*android:dimen/preference_fragment_padding_side">
         <TextView android:id="@+id/foregroundText"
             android:layout_width="0px"
             android:layout_height="wrap_content"
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 1380386..163a069 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1180,7 +1180,7 @@
     <!-- Summary text of the Wi-fi settings screen -->
     <string name="wifi_settings_summary">Set up &amp; manage wireless access points</string>
     <!-- Used in the 1st-level settings screen to turn on Wi-Fi  [CHAR LIMIT=NONE] -->
-    <string name="wifi_setup_wizard_title">Select Wi-Fi network</string>
+    <string name="wifi_setup_wizard_title">Wi-Fi network</string>
     <!-- Summary text when turning Wi-Fi or bluetooth on -->
     <string name="wifi_starting">Turning Wi-Fi on\u2026</string>
     <!-- Summary text when turning Wi-Fi or bluetooth off -->
diff --git a/src/com/android/settings/BrightnessPreference.java b/src/com/android/settings/BrightnessPreference.java
index 9023ea3..6d609ff 100644
--- a/src/com/android/settings/BrightnessPreference.java
+++ b/src/com/android/settings/BrightnessPreference.java
@@ -110,6 +110,9 @@
             mOldAutomatic = getBrightnessMode(0);
             mAutomaticMode = mOldAutomatic == Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC;
             mCheckBox.setChecked(mAutomaticMode);
+            mSeekBar.setEnabled(!mAutomaticMode);
+        } else {
+            mSeekBar.setEnabled(true);
         }
         mSeekBar.setOnSeekBarChangeListener(this);
     }
@@ -131,12 +134,13 @@
         setMode(isChecked ? Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC
                 : Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL);
         mSeekBar.setProgress(getBrightness());
+        mSeekBar.setEnabled(!mAutomaticMode);
     }
 
     private int getBrightness() {
         int mode = getBrightnessMode(0);
         float brightness = 0;
-        if (mode == Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC) {
+        if (false && mode == Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC) {
             brightness = Settings.System.getFloat(getContext().getContentResolver(),
                     Settings.System.SCREEN_AUTO_BRIGHTNESS_ADJ, 0);
             brightness = (brightness+1)/2;
@@ -168,6 +172,7 @@
                 == Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC;
         mCheckBox.setChecked(checked);
         mSeekBar.setProgress(getBrightness());
+        mSeekBar.setEnabled(!checked);
     }
 
     @Override
@@ -198,19 +203,21 @@
 
     private void setBrightness(int brightness, boolean write) {
         if (mAutomaticMode) {
-            float valf = (((float)brightness*2)/SEEK_BAR_RANGE) - 1.0f;
-            try {
-                IPowerManager power = IPowerManager.Stub.asInterface(
-                        ServiceManager.getService("power"));
-                if (power != null) {
-                    power.setAutoBrightnessAdjustment(valf);
+            if (false) {
+                float valf = (((float)brightness*2)/SEEK_BAR_RANGE) - 1.0f;
+                try {
+                    IPowerManager power = IPowerManager.Stub.asInterface(
+                            ServiceManager.getService("power"));
+                    if (power != null) {
+                        power.setAutoBrightnessAdjustment(valf);
+                    }
+                    if (write) {
+                        final ContentResolver resolver = getContext().getContentResolver();
+                        Settings.System.putFloat(resolver,
+                                Settings.System.SCREEN_AUTO_BRIGHTNESS_ADJ, valf);
+                    }
+                } catch (RemoteException doe) {
                 }
-                if (write) {
-                    final ContentResolver resolver = getContext().getContentResolver();
-                    Settings.System.putFloat(resolver,
-                            Settings.System.SCREEN_AUTO_BRIGHTNESS_ADJ, valf);
-                }
-            } catch (RemoteException doe) {
             }
         } else {
             int range = (MAXIMUM_BACKLIGHT - mScreenBrightnessDim);
diff --git a/src/com/android/settings/DevelopmentSettings.java b/src/com/android/settings/DevelopmentSettings.java
index fc5a0b6..e5fea54 100644
--- a/src/com/android/settings/DevelopmentSettings.java
+++ b/src/com/android/settings/DevelopmentSettings.java
@@ -30,6 +30,7 @@
 import android.content.Intent;
 import android.content.pm.ApplicationInfo;
 import android.content.pm.PackageManager;
+import android.os.AsyncTask;
 import android.os.BatteryManager;
 import android.os.Build;
 import android.os.Bundle;
@@ -49,6 +50,7 @@
 import android.preference.Preference.OnPreferenceChangeListener;
 import android.provider.Settings;
 import android.text.TextUtils;
+import android.util.Log;
 import android.view.Gravity;
 import android.view.HardwareRenderer;
 import android.view.IWindowManager;
@@ -103,6 +105,7 @@
     private Switch mEnabledSwitch;
     private boolean mLastEnabledState;
     private boolean mHaveDebugSettings;
+    private boolean mDontPokeProperties;
 
     private CheckBoxPreference mEnableAdb;
     private CheckBoxPreference mKeepScreenOn;
@@ -327,6 +330,7 @@
     }
 
     private void resetDangerousOptions() {
+        mDontPokeProperties = true;
         for (int i=0; i<mResetCbPrefs.size(); i++) {
             CheckBoxPreference cb = mResetCbPrefs.get(i);
             if (cb.isChecked()) {
@@ -342,6 +346,8 @@
         writeAppProcessLimitOptions(null);
         mHaveDebugSettings = false;
         updateAllOptions();
+        mDontPokeProperties = false;
+        pokeSystemProperties();
     }
 
     private void updateHdcpValues() {
@@ -526,6 +532,7 @@
     
     private void writeHardwareUiOptions() {
         SystemProperties.set(HARDWARE_UI_PROPERTY, mForceHardwareUi.isChecked() ? "true" : "false");
+        pokeSystemProperties();
     }
 
     private void updateTrackFrameTimeOptions() {
@@ -536,6 +543,7 @@
     private void writeTrackFrameTimeOptions() {
         SystemProperties.set(HardwareRenderer.PROFILE_PROPERTY,
                 mTrackFrameTime.isChecked() ? "true" : "false");
+        pokeSystemProperties();
     }
 
     private void updateShowHwScreenUpdatesOptions() {
@@ -546,6 +554,7 @@
     private void writeShowHwScreenUpdatesOptions() {
         SystemProperties.set(HardwareRenderer.DEBUG_DIRTY_REGIONS_PROPERTY,
                 mShowHwScreenUpdates.isChecked() ? "true" : "false");
+        pokeSystemProperties();
     }
 
     private void updateDebugLayoutOptions() {
@@ -556,6 +565,7 @@
     private void writeDebugLayoutOptions() {
         SystemProperties.set(View.DEBUG_LAYOUT_PROPERTY,
                 mDebugLayout.isChecked() ? "true" : "false");
+        pokeSystemProperties();
     }
 
     private void updateCpuUsageOptions() {
@@ -705,6 +715,7 @@
     private void writeEnableTracesOptions(long value) {
         SystemProperties.set(Trace.PROPERTY_TRACE_TAG_ENABLEFLAGS,
                 "0x" + Long.toString(value, 16));
+        pokeSystemProperties();
     }
 
     @Override
@@ -817,6 +828,7 @@
         if (HDCP_CHECKING_KEY.equals(preference.getKey())) {
             SystemProperties.set(HDCP_CHECKING_PROPERTY, newValue.toString());
             updateHdcpValues();
+            pokeSystemProperties();
             return true;
         } else if (preference == mWindowAnimationScale) {
             writeAnimationScaleOption(0, mWindowAnimationScale, newValue);
@@ -892,4 +904,34 @@
         dismissDialogs();
         super.onDestroy();
     }
+
+    void pokeSystemProperties() {
+        if (!mDontPokeProperties) {
+            (new SystemPropPoker()).execute();
+        }
+    }
+
+    static class SystemPropPoker extends AsyncTask<Void, Void, Void> {
+        @Override
+        protected Void doInBackground(Void... params) {
+            String[] services;
+            try {
+                services = ServiceManager.listServices();
+            } catch (RemoteException e) {
+                return null;
+            }
+            for (String service : services) {
+                IBinder obj = ServiceManager.checkService(service);
+                if (obj != null) {
+                    Parcel data = Parcel.obtain();
+                    try {
+                        obj.transact(IBinder.SYSPROPS_TRANSACTION, data, null, 0);
+                    } catch (RemoteException e) {
+                    }
+                    data.recycle();
+                }
+            }
+            return null;
+        }
+    }
 }
diff --git a/src/com/android/settings/Utils.java b/src/com/android/settings/Utils.java
index f28500e..460a182 100644
--- a/src/com/android/settings/Utils.java
+++ b/src/com/android/settings/Utils.java
@@ -407,7 +407,7 @@
             final int paddingBottom = res.getDimensionPixelSize(
                     com.android.internal.R.dimen.preference_fragment_padding_bottom);
 
-            final int effectivePaddingSide = ignoreSidePadding ? 0 : paddingBottom;
+            final int effectivePaddingSide = ignoreSidePadding ? 0 : paddingSide;
             list.setPadding(effectivePaddingSide, 0, effectivePaddingSide, paddingBottom);
         }
     }
diff --git a/src/com/android/settings/applications/ManageApplications.java b/src/com/android/settings/applications/ManageApplications.java
index c0e91af..eee9c43 100644
--- a/src/com/android/settings/applications/ManageApplications.java
+++ b/src/com/android/settings/applications/ManageApplications.java
@@ -737,6 +737,9 @@
         } else if (menuId == SHOW_BACKGROUND_PROCESSES) {
             mShowBackground = true;
             mRunningProcessesView.mAdapter.setShowBackground(true);
+        } else {
+            // Handle the home button
+            return false;
         }
         updateOptionsMenu();
         return true;