summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorJoe Onorato <joeo@google.com>2011-04-06 14:05:14 -0700
committerJoe Onorato <joeo@google.com>2011-04-06 14:05:14 -0700
commit0b980dd0e558c4a23765e2b728a2f0ebae8f2067 (patch)
tree650ca6d5f69541c0b51daf4170c5e34c22c94c7e /apps
parent59e35f19722dfbb9e97064903532979a2c2ad59d (diff)
downloadandroid_development-0b980dd0e558c4a23765e2b728a2f0ebae8f2067.tar.gz
android_development-0b980dd0e558c4a23765e2b728a2f0ebae8f2067.tar.bz2
android_development-0b980dd0e558c4a23765e2b728a2f0ebae8f2067.zip
Moving spare parts to its own project.
Change-Id: I77a6b5f355b1750dfa7dfa6a3e21371a6769f4c4
Diffstat (limited to 'apps')
-rw-r--r--apps/SpareParts/Android.mk10
-rw-r--r--apps/SpareParts/AndroidManifest.xml35
-rw-r--r--apps/SpareParts/NOTICE190
-rw-r--r--apps/SpareParts/res/layout/spare_parts.xml44
-rwxr-xr-xapps/SpareParts/res/mipmap-hdpi/app_icon.pngbin5141 -> 0 bytes
-rw-r--r--apps/SpareParts/res/mipmap-mdpi/app_icon.pngbin3133 -> 0 bytes
-rw-r--r--apps/SpareParts/res/values/arrays.xml68
-rw-r--r--apps/SpareParts/res/values/strings.xml68
-rw-r--r--apps/SpareParts/res/xml/spare_parts.xml105
-rw-r--r--apps/SpareParts/src/com/android/spare_parts/SpareParts.java265
10 files changed, 0 insertions, 785 deletions
diff --git a/apps/SpareParts/Android.mk b/apps/SpareParts/Android.mk
deleted file mode 100644
index 1a1ea0a5f..000000000
--- a/apps/SpareParts/Android.mk
+++ /dev/null
@@ -1,10 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := eng
-
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-
-LOCAL_PACKAGE_NAME := SpareParts
-
-include $(BUILD_PACKAGE)
diff --git a/apps/SpareParts/AndroidManifest.xml b/apps/SpareParts/AndroidManifest.xml
deleted file mode 100644
index 137f9073a..000000000
--- a/apps/SpareParts/AndroidManifest.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2008 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.
--->
-
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.android.spare_parts">
- <uses-permission android:name="android.permission.SET_ANIMATION_SCALE" />
- <uses-permission android:name="android.permission.CHANGE_CONFIGURATION" />
- <uses-permission android:name="android.permission.WRITE_SETTINGS" />
-
- <application android:label="@string/app_label"
- android:icon="@mipmap/app_icon">
-
- <activity android:name="SpareParts">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.DEFAULT" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
-
- </application>
-</manifest>
diff --git a/apps/SpareParts/NOTICE b/apps/SpareParts/NOTICE
deleted file mode 100644
index c5b1efa7a..000000000
--- a/apps/SpareParts/NOTICE
+++ /dev/null
@@ -1,190 +0,0 @@
-
- Copyright (c) 2005-2008, 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.
-
- 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.
-
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
diff --git a/apps/SpareParts/res/layout/spare_parts.xml b/apps/SpareParts/res/layout/spare_parts.xml
deleted file mode 100644
index c1cd3c80a..000000000
--- a/apps/SpareParts/res/layout/spare_parts.xml
+++ /dev/null
@@ -1,44 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/* //device/apps/Settings/assets/res/any/layout/keyboard_version.xml
-**
-** Copyright 2006, 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.
-*/
--->
-<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="match_parent">
-
- <RelativeLayout
- android:layout_width="match_parent"
- android:layout_height="match_parent">
-
- <Spinner android:id="@+id/window_animation_scale"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_alignParentLeft="true">
- </Spinner>
-
- <Spinner android:id="@+id/transition_animation_scale"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_below="@id/window_animation_scale"
- android:layout_alignParentLeft="true">
- </Spinner>
-
- </RelativeLayout>
-
-</ScrollView>
-
diff --git a/apps/SpareParts/res/mipmap-hdpi/app_icon.png b/apps/SpareParts/res/mipmap-hdpi/app_icon.png
deleted file mode 100755
index 60fbdf5d0..000000000
--- a/apps/SpareParts/res/mipmap-hdpi/app_icon.png
+++ /dev/null
Binary files differ
diff --git a/apps/SpareParts/res/mipmap-mdpi/app_icon.png b/apps/SpareParts/res/mipmap-mdpi/app_icon.png
deleted file mode 100644
index cb40a1988..000000000
--- a/apps/SpareParts/res/mipmap-mdpi/app_icon.png
+++ /dev/null
Binary files differ
diff --git a/apps/SpareParts/res/values/arrays.xml b/apps/SpareParts/res/values/arrays.xml
deleted file mode 100644
index e6026dac2..000000000
--- a/apps/SpareParts/res/values/arrays.xml
+++ /dev/null
@@ -1,68 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- * Copyright (C) 2007 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.
- -->
-
-<resources>
- <string-array name="entries_animations">
- <item>Off</item>
- <item>Fast</item>
- <item>Normal</item>
- <item>Slow</item>
- <item>Very Slow</item>
- </string-array>
-
- <string-array name="entryvalues_animations">
- <item>0.0</item>
- <item>0.5</item>
- <item>1.0</item>
- <item>1.5</item>
- <item>2.0</item>
- </string-array>
-
- <string-array name="entries_font_size">
- <item>Extremely Small</item>
- <item>Extra Small</item>
- <item>Small</item>
- <item>Normal</item>
- <item>Large</item>
- <item>Extra Large</item>
- <item>Extremely Large</item>
- </string-array>
-
- <string-array name="entryvalues_font_size">
- <item>0.70</item>
- <item>0.85</item>
- <item>0.95</item>
- <item>1.0</item>
- <item>1.05</item>
- <item>1.15</item>
- <item>1.30</item>
- </string-array>
-
- <string-array name="entries_end_button">
- <item>Nothing</item>
- <item>Go to home</item>
- <item>Go to sleep</item>
- <item>Home, then sleep</item>
- </string-array>
-
- <string-array name="entryvalues_end_button">
- <item>0</item>
- <item>1</item>
- <item>2</item>
- <item>3</item>
- </string-array>
-</resources>
diff --git a/apps/SpareParts/res/values/strings.xml b/apps/SpareParts/res/values/strings.xml
deleted file mode 100644
index e1577307a..000000000
--- a/apps/SpareParts/res/values/strings.xml
+++ /dev/null
@@ -1,68 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/* //device/apps/common/assets/res/any/strings.xml
-**
-** Copyright 2006, 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.
-*/
--->
-<resources>
- <string name="app_label">Spare Parts</string>
-
- <string name="device_info_title">Device info</string>
-
- <string name="title_battery_history">Battery history</string>
- <string name="summary_battery_history">Summary of how battery has been used</string>
-
- <string name="title_battery_information">Battery information</string>
- <string name="summary_battery_information">Current battery status information</string>
-
- <string name="title_usage_statistics">Usage statistics</string>
- <string name="summary_usage_statistics">Summary of application usage</string>
-
- <string name="general_title">General</string>
-
- <string name="title_window_animations">Window animations</string>
- <string name="summary_window_animations">Speed of animations in individual windows</string>
- <string name="dialog_title_window_animations">Select window speed</string>
-
- <string name="title_transition_animations">Transition animations</string>
- <string name="summary_transition_animations">Speed of animations moving between screens</string>
- <string name="dialog_title_transition_animations">Select transition speed</string>
-
- <string name="title_fancy_ime_animations">Fancy input animations</string>
- <string name="summary_on_fancy_ime_animations">Use fancier animations for input method windows</string>
- <string name="summary_off_fancy_ime_animations">Use normal animations for input method windows</string>
-
- <string name="title_haptic_feedback">Haptic feedback</string>
- <string name="summary_on_haptic_feedback">Use haptic feedback with user interaction</string>
- <string name="summary_off_haptic_feedback">Use haptic feedback with user interaction</string>
-
- <string name="title_font_size">Font size</string>
- <string name="summary_font_size">Overall size of fonts</string>
- <string name="dialog_title_font_size">Select font size</string>
-
- <string name="title_end_button">End button behavior</string>
- <string name="summary_end_button">Select End (red) button action</string>
- <string name="dialog_title_end_button">Select End button</string>
-
- <string name="applications_title">Applications</string>
-
- <!-- Sound & display settings screen, compatibility mode check box label -->
- <string name="compatibility_mode_title">Compatibility Mode</string>
- <!-- Sound & display settings screen, compatibility mode option summary text when check box is selected -->
- <string name="compatibility_mode_summary_on">Run older apps in Compatibility mode. This require rebooting. </string>
- <!-- Sound & display settings screen, compatibility mode option summary text when check box is clear -->
- <string name="compatibility_mode_summary_off">Run older apps in Compatibility mode. This require rebooting. </string>
-</resources>
diff --git a/apps/SpareParts/res/xml/spare_parts.xml b/apps/SpareParts/res/xml/spare_parts.xml
deleted file mode 100644
index 0d06e26b4..000000000
--- a/apps/SpareParts/res/xml/spare_parts.xml
+++ /dev/null
@@ -1,105 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/*
- * Copyright 2008, 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.
- */
--->
-<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
-
- <PreferenceCategory
- android:title="@string/device_info_title">
-
- <PreferenceScreen android:key="battery_history_settings"
- android:title="@string/title_battery_history"
- android:summary="@string/summary_battery_history">
- <intent android:action="android.intent.action.MAIN"
- android:targetPackage="com.android.settings"
- android:targetClass="com.android.settings.fuelgauge.PowerUsageSummary" />
- </PreferenceScreen>
-
- <PreferenceScreen android:key="battery_information_settings"
- android:title="@string/title_battery_information"
- android:summary="@string/summary_battery_information">
- <intent android:action="android.intent.action.MAIN"
- android:targetPackage="com.android.settings"
- android:targetClass="com.android.settings.BatteryInfo" />
- </PreferenceScreen>
-
- <PreferenceScreen android:key="usage_statistics_settings"
- android:title="@string/title_usage_statistics"
- android:summary="@string/summary_usage_statistics">
- <intent android:action="android.intent.action.MAIN"
- android:targetPackage="com.android.settings"
- android:targetClass="com.android.settings.UsageStats" />
- </PreferenceScreen>
-
- </PreferenceCategory>
-
- <PreferenceCategory
- android:title="@string/general_title">
-
- <ListPreference
- android:key="window_animations"
- android:title="@string/title_window_animations"
- android:summary="@string/summary_window_animations"
- android:entries="@array/entries_animations"
- android:entryValues="@array/entryvalues_animations"
- android:dialogTitle="@string/dialog_title_window_animations" />
-
- <ListPreference
- android:key="transition_animations"
- android:title="@string/title_transition_animations"
- android:summary="@string/summary_transition_animations"
- android:entries="@array/entries_animations"
- android:entryValues="@array/entryvalues_animations"
- android:dialogTitle="@string/dialog_title_transition_animations" />
-
- <CheckBoxPreference
- android:key="fancy_ime_animations"
- android:title="@string/title_fancy_ime_animations"
- android:summaryOn="@string/summary_on_fancy_ime_animations"
- android:summaryOff="@string/summary_off_fancy_ime_animations"/>
-
- <ListPreference
- android:key="font_size"
- android:title="@string/title_font_size"
- android:summary="@string/summary_font_size"
- android:entries="@array/entries_font_size"
- android:entryValues="@array/entryvalues_font_size"
- android:dialogTitle="@string/dialog_title_font_size" />
-
- <ListPreference
- android:key="end_button"
- android:title="@string/title_end_button"
- android:summary="@string/summary_end_button"
- android:entries="@array/entries_end_button"
- android:entryValues="@array/entryvalues_end_button"
- android:dialogTitle="@string/dialog_title_end_button" />
-
- <CheckBoxPreference
- android:key="haptic_feedback"
- android:title="@string/title_haptic_feedback"
- android:summaryOn="@string/summary_on_haptic_feedback"
- android:summaryOff="@string/summary_off_haptic_feedback"/>
-
-
- <CheckBoxPreference
- android:key="compatibility_mode"
- android:title="@string/compatibility_mode_title"
- android:summaryOn="@string/compatibility_mode_summary_on"
- android:summaryOff="@string/compatibility_mode_summary_off" />
- </PreferenceCategory>
-
-</PreferenceScreen>
diff --git a/apps/SpareParts/src/com/android/spare_parts/SpareParts.java b/apps/SpareParts/src/com/android/spare_parts/SpareParts.java
deleted file mode 100644
index 099f27a9b..000000000
--- a/apps/SpareParts/src/com/android/spare_parts/SpareParts.java
+++ /dev/null
@@ -1,265 +0,0 @@
-/* //device/apps/Settings/src/com/android/settings/Keyguard.java
-**
-** Copyright 2006, 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.
-*/
-
-package com.android.spare_parts;
-
-import android.app.ActivityManagerNative;
-import android.content.Context;
-import android.content.Intent;
-import android.content.SharedPreferences;
-import android.content.pm.ApplicationInfo;
-import android.content.pm.PackageManager;
-import android.content.pm.ResolveInfo;
-import android.content.pm.PackageManager.NameNotFoundException;
-import android.content.res.Configuration;
-import android.os.RemoteException;
-import android.os.ServiceManager;
-import android.preference.CheckBoxPreference;
-import android.preference.ListPreference;
-import android.preference.Preference;
-import android.preference.PreferenceActivity;
-import android.preference.PreferenceGroup;
-import android.preference.PreferenceScreen;
-import android.provider.Settings;
-import android.provider.Settings.SettingNotFoundException;
-import android.os.Bundle;
-import android.util.Log;
-import android.view.IWindowManager;
-
-import java.util.List;
-
-public class SpareParts extends PreferenceActivity
- implements Preference.OnPreferenceChangeListener,
- SharedPreferences.OnSharedPreferenceChangeListener {
- private static final String TAG = "SpareParts";
-
- private static final String BATTERY_HISTORY_PREF = "battery_history_settings";
- private static final String BATTERY_INFORMATION_PREF = "battery_information_settings";
- private static final String USAGE_STATISTICS_PREF = "usage_statistics_settings";
-
- private static final String WINDOW_ANIMATIONS_PREF = "window_animations";
- private static final String TRANSITION_ANIMATIONS_PREF = "transition_animations";
- private static final String FANCY_IME_ANIMATIONS_PREF = "fancy_ime_animations";
- private static final String HAPTIC_FEEDBACK_PREF = "haptic_feedback";
- private static final String FONT_SIZE_PREF = "font_size";
- private static final String END_BUTTON_PREF = "end_button";
- private static final String KEY_COMPATIBILITY_MODE = "compatibility_mode";
-
- private final Configuration mCurConfig = new Configuration();
-
- private ListPreference mWindowAnimationsPref;
- private ListPreference mTransitionAnimationsPref;
- private CheckBoxPreference mFancyImeAnimationsPref;
- private CheckBoxPreference mHapticFeedbackPref;
- private ListPreference mFontSizePref;
- private ListPreference mEndButtonPref;
- private CheckBoxPreference mCompatibilityMode;
-
- private IWindowManager mWindowManager;
-
- public static boolean updatePreferenceToSpecificActivityOrRemove(Context context,
- PreferenceGroup parentPreferenceGroup, String preferenceKey, int flags) {
-
- Preference preference = parentPreferenceGroup.findPreference(preferenceKey);
- if (preference == null) {
- return false;
- }
-
- Intent intent = preference.getIntent();
- if (intent != null) {
- // Find the activity that is in the system image
- PackageManager pm = context.getPackageManager();
- List<ResolveInfo> list = pm.queryIntentActivities(intent, 0);
- int listSize = list.size();
- for (int i = 0; i < listSize; i++) {
- ResolveInfo resolveInfo = list.get(i);
- if ((resolveInfo.activityInfo.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM)
- != 0) {
-
- // Replace the intent with this specific activity
- preference.setIntent(new Intent().setClassName(
- resolveInfo.activityInfo.packageName,
- resolveInfo.activityInfo.name));
-
- return true;
- }
- }
- }
-
- // Did not find a matching activity, so remove the preference
- parentPreferenceGroup.removePreference(preference);
-
- return true;
- }
-
- @Override
- public void onCreate(Bundle icicle) {
- super.onCreate(icicle);
- addPreferencesFromResource(R.xml.spare_parts);
-
- PreferenceScreen prefSet = getPreferenceScreen();
-
- mWindowAnimationsPref = (ListPreference) prefSet.findPreference(WINDOW_ANIMATIONS_PREF);
- mWindowAnimationsPref.setOnPreferenceChangeListener(this);
- mTransitionAnimationsPref = (ListPreference) prefSet.findPreference(TRANSITION_ANIMATIONS_PREF);
- mTransitionAnimationsPref.setOnPreferenceChangeListener(this);
- mFancyImeAnimationsPref = (CheckBoxPreference) prefSet.findPreference(FANCY_IME_ANIMATIONS_PREF);
- mHapticFeedbackPref = (CheckBoxPreference) prefSet.findPreference(HAPTIC_FEEDBACK_PREF);
- mFontSizePref = (ListPreference) prefSet.findPreference(FONT_SIZE_PREF);
- mFontSizePref.setOnPreferenceChangeListener(this);
- mEndButtonPref = (ListPreference) prefSet.findPreference(END_BUTTON_PREF);
- mEndButtonPref.setOnPreferenceChangeListener(this);
- mCompatibilityMode = (CheckBoxPreference) findPreference(KEY_COMPATIBILITY_MODE);
- mCompatibilityMode.setPersistent(false);
- mCompatibilityMode.setChecked(Settings.System.getInt(getContentResolver(),
- Settings.System.COMPATIBILITY_MODE, 1) != 0);
-
- mWindowManager = IWindowManager.Stub.asInterface(ServiceManager.getService("window"));
-
- final PreferenceGroup parentPreference = getPreferenceScreen();
- updatePreferenceToSpecificActivityOrRemove(this, parentPreference,
- BATTERY_HISTORY_PREF, 0);
- updatePreferenceToSpecificActivityOrRemove(this, parentPreference,
- BATTERY_INFORMATION_PREF, 0);
- updatePreferenceToSpecificActivityOrRemove(this, parentPreference,
- USAGE_STATISTICS_PREF, 0);
-
- parentPreference.getSharedPreferences().registerOnSharedPreferenceChangeListener(this);
- }
-
- private void updateToggles() {
- mFancyImeAnimationsPref.setChecked(Settings.System.getInt(
- getContentResolver(),
- Settings.System.FANCY_IME_ANIMATIONS, 0) != 0);
- mHapticFeedbackPref.setChecked(Settings.System.getInt(
- getContentResolver(),
- Settings.System.HAPTIC_FEEDBACK_ENABLED, 0) != 0);
- }
-
- public boolean onPreferenceChange(Preference preference, Object objValue) {
- if (preference == mWindowAnimationsPref) {
- writeAnimationPreference(0, objValue);
- } else if (preference == mTransitionAnimationsPref) {
- writeAnimationPreference(1, objValue);
- } else if (preference == mFontSizePref) {
- writeFontSizePreference(objValue);
- } else if (preference == mEndButtonPref) {
- writeEndButtonPreference(objValue);
- }
- // always let the preference setting proceed.
- return true;
- }
-
- @Override
- public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
- if (preference == mCompatibilityMode) {
- Settings.System.putInt(getContentResolver(),
- Settings.System.COMPATIBILITY_MODE,
- mCompatibilityMode.isChecked() ? 1 : 0);
- return true;
- }
- return false;
- }
-
- public void writeAnimationPreference(int which, Object objValue) {
- try {
- float val = Float.parseFloat(objValue.toString());
- mWindowManager.setAnimationScale(which, val);
- } catch (NumberFormatException e) {
- } catch (RemoteException e) {
- }
- }
-
- public void writeFontSizePreference(Object objValue) {
- try {
- mCurConfig.fontScale = Float.parseFloat(objValue.toString());
- ActivityManagerNative.getDefault().updateConfiguration(mCurConfig);
- } catch (RemoteException e) {
- }
- }
-
- public void writeEndButtonPreference(Object objValue) {
- try {
- int val = Integer.parseInt(objValue.toString());
- Settings.System.putInt(getContentResolver(),
- Settings.System.END_BUTTON_BEHAVIOR, val);
- } catch (NumberFormatException e) {
- }
- }
-
- int floatToIndex(float val, int resid) {
- String[] indices = getResources().getStringArray(resid);
- float lastVal = Float.parseFloat(indices[0]);
- for (int i=1; i<indices.length; i++) {
- float thisVal = Float.parseFloat(indices[i]);
- if (val < (lastVal + (thisVal-lastVal)*.5f)) {
- return i-1;
- }
- lastVal = thisVal;
- }
- return indices.length-1;
- }
-
- public void readAnimationPreference(int which, ListPreference pref) {
- try {
- float scale = mWindowManager.getAnimationScale(which);
- pref.setValueIndex(floatToIndex(scale,
- R.array.entryvalues_animations));
- } catch (RemoteException e) {
- }
- }
-
- public void readFontSizePreference(ListPreference pref) {
- try {
- mCurConfig.updateFrom(
- ActivityManagerNative.getDefault().getConfiguration());
- } catch (RemoteException e) {
- }
- pref.setValueIndex(floatToIndex(mCurConfig.fontScale,
- R.array.entryvalues_font_size));
- }
-
- public void readEndButtonPreference(ListPreference pref) {
- try {
- pref.setValueIndex(Settings.System.getInt(getContentResolver(),
- Settings.System.END_BUTTON_BEHAVIOR));
- } catch (SettingNotFoundException e) {
- }
- }
-
- public void onSharedPreferenceChanged(SharedPreferences preferences, String key) {
- if (FANCY_IME_ANIMATIONS_PREF.equals(key)) {
- Settings.System.putInt(getContentResolver(),
- Settings.System.FANCY_IME_ANIMATIONS,
- mFancyImeAnimationsPref.isChecked() ? 1 : 0);
- } else if (HAPTIC_FEEDBACK_PREF.equals(key)) {
- Settings.System.putInt(getContentResolver(),
- Settings.System.HAPTIC_FEEDBACK_ENABLED,
- mHapticFeedbackPref.isChecked() ? 1 : 0);
- }
- }
-
- @Override
- public void onResume() {
- super.onResume();
- readAnimationPreference(0, mWindowAnimationsPref);
- readAnimationPreference(1, mTransitionAnimationsPref);
- readFontSizePreference(mFontSizePref);
- readEndButtonPreference(mEndButtonPref);
- updateToggles();
- }
-}