Merge "Changed Settings application theme"
diff --git a/res/values/arrays.xml b/res/values/arrays.xml
index 3c2bdd3..157a6c4 100644
--- a/res/values/arrays.xml
+++ b/res/values/arrays.xml
@@ -48,30 +48,6 @@
         <item>yyyy-MM-dd</item>
     </string-array>
 
-    <!-- Display settings.  The type of animations to show. -->
-    <string-array name="animations_entries">
-        <item>No animations</item>
-        <item>Some animations</item>
-        <item>All animations</item>
-    </string-array>
-
-    <!-- Display settings.  Summary for each type of animation. -->
-    <string-array name="animations_summaries">
-        <item>No window animations are shown</item>
-        <item>Some window animations are shown</item>
-        <item>All window animations are shown</item>
-    </string-array>
-
-    <!-- Do not translate. -->
-    <string-array name="animations_values">
-        <!-- Do not translate. -->
-        <item>00</item>
-        <!-- Do not translate. -->
-        <item>01</item>
-        <!-- Do not translate. -->
-        <item>11</item>
-    </string-array>
-
     <!-- Display settings.  The delay in inactivity before the screen is turned off. These are shown in a list dialog. -->
     <string-array name="screen_timeout_entries">
         <item>15 seconds</item>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index f8d38a2..94524da 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1476,12 +1476,6 @@
     <!-- Display settings -->
     <!-- Sound & display settings screen, section header for settings related to display -->
     <string name="display_settings">Screen settings</string>
-    <!-- Sound & display settings screen, animations check box label -->
-    <string name="animations_title">Animation</string>
-    <!-- Sound & display settings screen, animations option summary text when check box is selected -->
-    <string name="animations_summary_on">Show animation when opening &amp; closing windows</string>
-    <!-- Sound & display settings screen, animations option summary text when check box is clear -->
-    <string name="animations_summary_off">Show animation when opening &amp; closing windows</string>
     <!-- Sound & display settings screen, accelerometer-based rotation check box label -->
     <string name="accelerometer_title">Auto-rotate screen</string>
     <!-- Sound & display settings screen, accelerometer-based rotation summary text when check box is selected -->
diff --git a/res/xml/display_settings.xml b/res/xml/display_settings.xml
index b0abd9a..c13a107 100644
--- a/res/xml/display_settings.xml
+++ b/res/xml/display_settings.xml
@@ -23,18 +23,16 @@
                 android:title="@string/brightness"
                 android:dialogTitle="@string/brightness" />
 
+        <PreferenceScreen
+                android:key="wallpaper"
+                android:title="@string/wallpaper_settings_title"
+                android:fragment="com.android.settings.WallpaperTypeSettings" />
+
         <CheckBoxPreference
             android:key="accelerometer"
             android:title="@string/accelerometer_title"/>
 
         <ListPreference
-            android:key="animations"
-            android:title="@string/animations_title"
-            android:persistent="false"
-            android:entries="@array/animations_entries"
-            android:entryValues="@array/animations_values" />
-
-        <ListPreference
                 android:key="screen_timeout"
                 android:title="@string/screen_timeout"
                 android:summary="@string/screen_timeout_summary"
@@ -42,18 +40,10 @@
                 android:entries="@array/screen_timeout_entries"
                 android:entryValues="@array/screen_timeout_values" />
 
-        <PreferenceScreen
-                android:key="wallpaper"
-                android:title="@string/wallpaper_settings_title"
-                android:fragment="com.android.settings.WallpaperTypeSettings"
-            />
-
         <PreferenceScreen 
                 android:title="@string/dream_settings_title" 
                 android:summary="@string/dream_settings_summary"
-                android:fragment="com.android.settings.DreamSettings"
-                >
-        </PreferenceScreen>
+                android:fragment="com.android.settings.DreamSettings" />
 
         <ListPreference
                 android:key="font_size"
diff --git a/src/com/android/settings/DisplaySettings.java b/src/com/android/settings/DisplaySettings.java
index 682184e..6ab88d0 100644
--- a/src/com/android/settings/DisplaySettings.java
+++ b/src/com/android/settings/DisplaySettings.java
@@ -23,24 +23,16 @@
 import android.content.ContentResolver;
 import android.content.Context;
 import android.content.res.Configuration;
-
-import android.app.ActivityManagerNative;
-import android.app.admin.DevicePolicyManager;
-import android.content.ContentResolver;
-import android.content.Context;
-import android.content.res.Configuration;
 import android.database.ContentObserver;
 import android.os.Bundle;
 import android.os.Handler;
 import android.os.RemoteException;
-import android.os.ServiceManager;
 import android.preference.CheckBoxPreference;
 import android.preference.ListPreference;
 import android.preference.Preference;
 import android.preference.PreferenceScreen;
 import android.provider.Settings;
 import android.util.Log;
-import android.view.IWindowManager;
 
 import java.util.ArrayList;
 
@@ -52,19 +44,14 @@
     private static final int FALLBACK_SCREEN_TIMEOUT_VALUE = 30000;
 
     private static final String KEY_SCREEN_TIMEOUT = "screen_timeout";
-    private static final String KEY_ANIMATIONS = "animations";
     private static final String KEY_ACCELEROMETER = "accelerometer";
     private static final String KEY_FONT_SIZE = "font_size";
 
-    private ListPreference mAnimations;
     private CheckBoxPreference mAccelerometer;
-    private float[] mAnimationScales;
     private ListPreference mFontSizePref;
 
     private final Configuration mCurConfig = new Configuration();
     
-    private IWindowManager mWindowManager;
-
     private ListPreference mScreenTimeoutPreference;
 
     private ContentObserver mAccelerometerRotationObserver = new ContentObserver(new Handler()) {
@@ -78,18 +65,9 @@
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         ContentResolver resolver = getActivity().getContentResolver();
-        mWindowManager = IWindowManager.Stub.asInterface(ServiceManager.getService("window"));
 
         addPreferencesFromResource(R.xml.display_settings);
 
-        // Fetch this once before attaching a listener for changes.
-        try {
-            mAnimationScales = mWindowManager.getAnimationScales();
-        } catch (RemoteException e) {
-            // Shouldn't happen and not much can be done anyway.
-        }
-        mAnimations = (ListPreference) findPreference(KEY_ANIMATIONS);
-        mAnimations.setOnPreferenceChangeListener(this);
         mAccelerometer = (CheckBoxPreference) findPreference(KEY_ACCELEROMETER);
         mAccelerometer.setPersistent(false);
 
@@ -99,7 +77,7 @@
         mScreenTimeoutPreference.setValue(String.valueOf(currentTimeout));
         mScreenTimeoutPreference.setOnPreferenceChangeListener(this);
         disableUnusableTimeouts(mScreenTimeoutPreference);
-        updateTimeoutPreferenceDescription(resolver, mScreenTimeoutPreference,
+        updateTimeoutPreferenceDescription(mScreenTimeoutPreference,
                 R.string.screen_timeout_summary, currentTimeout);
 
         mFontSizePref = (ListPreference) findPreference(KEY_FONT_SIZE);
@@ -107,15 +85,14 @@
     }
 
     private void updateTimeoutPreferenceDescription(
-            ContentResolver resolver,
-            ListPreference pref, 
+            ListPreference pref,
             int summaryStrings,
             long currentTimeout) {
-        updateTimeoutPreferenceDescription(resolver, pref, summaryStrings, 0, currentTimeout);
+        updateTimeoutPreferenceDescription(pref, summaryStrings, 0, currentTimeout);
     }
+
     private void updateTimeoutPreferenceDescription(
-            ContentResolver resolver,
-            ListPreference pref, 
+            ListPreference pref,
             int summaryStrings,
             int zeroString,
             long currentTimeout) {
@@ -188,19 +165,18 @@
     
     public void readFontSizePreference(ListPreference pref) {
         try {
-            mCurConfig.updateFrom(
-                ActivityManagerNative.getDefault().getConfiguration());
+            mCurConfig.updateFrom(ActivityManagerNative.getDefault().getConfiguration());
         } catch (RemoteException e) {
+            Log.w(TAG, "Unable to retrieve font size");
         }
-        pref.setValueIndex(floatToIndex(mCurConfig.fontScale,
-                R.array.entryvalues_font_size));
+        pref.setValueIndex(floatToIndex(mCurConfig.fontScale, R.array.entryvalues_font_size));
     }
     
     @Override
     public void onResume() {
         super.onResume();
 
-        updateState(true);
+        updateState();
         getContentResolver().registerContentObserver(
                 Settings.System.getUriFor(Settings.System.ACCELEROMETER_ROTATION), true,
                 mAccelerometerRotationObserver);
@@ -213,33 +189,7 @@
         getContentResolver().unregisterContentObserver(mAccelerometerRotationObserver);
     }
 
-    private void updateState(boolean force) {
-        int animations = 0;
-        try {
-            mAnimationScales = mWindowManager.getAnimationScales();
-        } catch (RemoteException e) {
-            // Shouldn't happen and not much can be done anyway.
-        }
-        if (mAnimationScales != null) {
-            if (mAnimationScales.length >= 1) {
-                animations = ((int)(mAnimationScales[0]+.5f)) % 10;
-            }
-            if (mAnimationScales.length >= 2) {
-                animations += (((int)(mAnimationScales[1]+.5f)) & 0x7) * 10;
-            }
-        }
-        int idx = 0;
-        int best = 0;
-        CharSequence[] aents = mAnimations.getEntryValues();
-        for (int i=0; i<aents.length; i++) {
-            int val = Integer.parseInt(aents[i].toString());
-            if (val <= animations && val > best) {
-                best = val;
-                idx = i;
-            }
-        }
-        mAnimations.setValueIndex(idx);
-        updateAnimationsSummary(mAnimations.getValue());
+    private void updateState() {
         updateAccelerometerRotationCheckbox();
         readFontSizePreference(mFontSizePref);
     }
@@ -250,24 +200,12 @@
                 Settings.System.ACCELEROMETER_ROTATION, 0) != 0);
     }
 
-    private void updateAnimationsSummary(Object value) {
-        CharSequence[] summaries = getResources().getTextArray(R.array.animations_summaries);
-        CharSequence[] values = mAnimations.getEntryValues();
-        for (int i=0; i<values.length; i++) {
-            //Log.i("foo", "Comparing entry "+ values[i] + " to current "
-            //        + mAnimations.getValue());
-            if (values[i].equals(value)) {
-                mAnimations.setSummary(summaries[i]);
-                break;
-            }
-        }
-    }
-
     public void writeFontSizePreference(Object objValue) {
         try {
             mCurConfig.fontScale = Float.parseFloat(objValue.toString());
             ActivityManagerNative.getDefault().updateConfiguration(mCurConfig);
         } catch (RemoteException e) {
+            Log.w(TAG, "Unable to save font size");
         }
     }
     
@@ -283,31 +221,12 @@
 
     public boolean onPreferenceChange(Preference preference, Object objValue) {
         final String key = preference.getKey();
-        if (KEY_ANIMATIONS.equals(key)) {
-            try {
-                int value = Integer.parseInt((String) objValue);
-                if (mAnimationScales.length >= 1) {
-                    mAnimationScales[0] = value%10;
-                }
-                if (mAnimationScales.length >= 2) {
-                    mAnimationScales[1] = (value/10)%10;
-                }
-                try {
-                    mWindowManager.setAnimationScales(mAnimationScales);
-                } catch (RemoteException e) {
-                }
-                updateAnimationsSummary(objValue);
-            } catch (NumberFormatException e) {
-                Log.e(TAG, "could not persist animation setting", e);
-            }
-
-        }
         if (KEY_SCREEN_TIMEOUT.equals(key)) {
             int value = Integer.parseInt((String) objValue);
             try {
                 Settings.System.putInt(getContentResolver(),
                         SCREEN_OFF_TIMEOUT, value);
-                updateTimeoutPreferenceDescription(getContentResolver(), mScreenTimeoutPreference,
+                updateTimeoutPreferenceDescription(mScreenTimeoutPreference,
                         R.string.screen_timeout_summary, value);
             } catch (NumberFormatException e) {
                 Log.e(TAG, "could not persist screen timeout setting", e);