Merge change I61c28c5f into eclair

* changes:
  Use radio hunting time in addition to signal strength for cell standby computation. Fixes #2176141
diff --git a/src/com/android/settings/BrightnessPreference.java b/src/com/android/settings/BrightnessPreference.java
index 2bba814..994546d 100644
--- a/src/com/android/settings/BrightnessPreference.java
+++ b/src/com/android/settings/BrightnessPreference.java
@@ -101,7 +101,8 @@
     }
 
     public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
-        setMode(isChecked ? 1 : 0);
+        setMode(isChecked ? Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC
+                : Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL);
         if (!isChecked) {
             setBrightness(mSeekBar.getProgress() + MINIMUM_BACKLIGHT);
         }
@@ -115,11 +116,6 @@
             Settings.System.putInt(getContext().getContentResolver(), 
                     Settings.System.SCREEN_BRIGHTNESS,
                     mSeekBar.getProgress() + MINIMUM_BACKLIGHT);
-            if (mAutomaticAvailable) {
-                Settings.System.putInt(getContext().getContentResolver(),
-                        Settings.System.SCREEN_BRIGHTNESS_MODE,
-                        mCheckBox.isChecked() ? 1 : 0);
-            }
         } else {
             if (mAutomaticAvailable) {
                 setMode(mOldAutomatic);
@@ -141,20 +137,14 @@
         }        
     }
 
-    private void setMode(int automatic) {
-        if (automatic != 0) {
+    private void setMode(int mode) {
+        if (mode == Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC) {
             mSeekBar.setVisibility(View.GONE);
         } else {
             mSeekBar.setVisibility(View.VISIBLE);
         }
-        try {
-            IPowerManager power = IPowerManager.Stub.asInterface(
-                    ServiceManager.getService("power"));
-            if (power != null) {
-                power.setAutoBrightness(automatic != 0);
-            }
-        } catch (RemoteException doe) {
-        }
+        Settings.System.putInt(getContext().getContentResolver(),
+                Settings.System.SCREEN_BRIGHTNESS_MODE, mode);
     }
 }
 
diff --git a/src/com/android/settings/InstalledAppDetails.java b/src/com/android/settings/InstalledAppDetails.java
index 5a4e672..d05014b 100644
--- a/src/com/android/settings/InstalledAppDetails.java
+++ b/src/com/android/settings/InstalledAppDetails.java
@@ -323,7 +323,8 @@
         try {
             mAppInfo = mPm.getApplicationInfo(mAppInfo.packageName, 
                     PackageManager.GET_UNINSTALLED_PACKAGES);
-            pkgInfo = mPm.getPackageInfo(mAppInfo.packageName, 0);
+            pkgInfo = mPm.getPackageInfo(mAppInfo.packageName,
+                    PackageManager.GET_UNINSTALLED_PACKAGES);
         } catch (NameNotFoundException e) {
             Log.e(TAG, "Exception when retrieving package:" + mAppInfo.packageName, e);
             showDialogInner(DLG_APP_NOT_FOUND);
diff --git a/src/com/android/settings/widget/SettingsAppWidgetProvider.java b/src/com/android/settings/widget/SettingsAppWidgetProvider.java
index d652e80..2ac3bfa 100644
--- a/src/com/android/settings/widget/SettingsAppWidgetProvider.java
+++ b/src/com/android/settings/widget/SettingsAppWidgetProvider.java
@@ -393,10 +393,9 @@
                 if (context.getResources().getBoolean(
                         com.android.internal.R.bool.config_automatic_brightness_available)) {
                     // Disable automatic brightness
-                    power.setAutoBrightness(false);
                     Settings.System.putInt(context.getContentResolver(),
                             Settings.System.SCREEN_BRIGHTNESS_MODE,
-                            0);
+                            Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL);
                     // Set it again in case auto brightness was on
                     power.setBacklightBrightness(brightness);
                 }