Merge https://android.googlesource.com/platform/packages/apps/Settings into jb-mr1
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index f2e51a1..19c0a73 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -61,6 +61,7 @@
     <uses-permission android:name="android.permission.MANAGE_USERS" />
     <uses-permission android:name="android.permission.READ_PROFILE" />
     <uses-permission android:name="android.permission.CONFIGURE_WIFI_DISPLAY" />
+    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
 
     <application android:label="@string/settings_label"
             android:icon="@mipmap/ic_launcher_settings"
@@ -690,7 +691,7 @@
             <meta-data android:name="com.android.settings.TOP_LEVEL_HEADER_ID"
                 android:resource="@id/application_settings" />
         </activity-alias>
-        
+
         <!-- Provide direct entry into manage apps showing storage usage for apps.
              This is for compatibility with old shortcuts. -->
         <activity-alias android:name=".applications.StorageUse"
@@ -950,6 +951,8 @@
             </intent-filter>
         </activity>
 
+        <activity android:name="ChooseLockPatternSize" android:exported="false"/>
+
         <activity android:name="ChooseLockPattern" android:exported="false"/>
 
         <activity android:name="ChooseLockPassword" android:exported="false"
@@ -1059,7 +1062,7 @@
         </activity-alias>
 
         <activity android:name=".AppPicker" android:label="@string/select_application"
-                android:theme="@android:style/Theme.Holo.Dialog" />
+                android:theme="@*android:style/Theme.Holo.Dialog" />
 
         <activity android:name="Settings$UsbSettingsActivity"
                 android:label="@string/storage_title_usb"
@@ -1178,7 +1181,7 @@
 
         <activity android:name="ActivityPicker"
                 android:label="@string/activity_picker_label"
-                android:theme="@*android:style/Theme.Dialog.Alert"
+                android:theme="@*android:style/Theme.Holo.Dialog"
                 android:finishOnCloseSystemDialogs="true">
             <intent-filter>
                 <action android:name="android.intent.action.PICK_ACTIVITY" />
@@ -1297,7 +1300,7 @@
         <!-- Standard picker for widgets -->
         <activity android:name="AppWidgetPickActivity"
                 android:label="@string/widget_picker_title"
-                android:theme="@*android:style/Theme.Holo.Dialog.Alert"
+                android:theme="@*android:style/Theme.Holo.Dialog"
                 android:finishOnCloseSystemDialogs="true">
             <intent-filter>
                 <action android:name="android.appwidget.action.APPWIDGET_PICK" />
@@ -1306,7 +1309,7 @@
         </activity>
 
         <activity android:name="AllowBindAppWidgetActivity"
-                android:theme="@*android:style/Theme.Holo.Dialog.Alert"
+                android:theme="@*android:style/Theme.Holo.Dialog"
                 android:finishOnCloseSystemDialogs="true"
                 android:excludeFromRecents="true">
             <intent-filter>
@@ -1487,6 +1490,8 @@
             </intent-filter>
         </receiver>
 
+		<activity android:name=".th.LockscreenTargets" />
+
         <!-- Watch for ContactsContract.Profile changes and update the user's photo.  -->
         <receiver android:name=".users.ProfileUpdateReceiver">
             <intent-filter>
@@ -1494,5 +1499,18 @@
             </intent-filter>
         </receiver>
 
+        <!-- Performance Settings -->
+        <activity android:name=".performance.PowerWidget" />
+        <activity android:name=".performance.SystemSettings" />
+        <activity android:name=".performance.PerformanceSettings" />
+
+        <receiver android:name=".performance.BootReceiver" android:enabled="true">
+            <intent-filter>
+                <action android:name="android.intent.action.BOOT_COMPLETED" />
+            </intent-filter>
+        </receiver>
+
+        <activity android:name=".performance.VoltageControlSettings" />
+
     </application>
 </manifest>
diff --git a/res/drawable-hdpi/ic_empty.png b/res/drawable-hdpi/ic_empty.png
new file mode 100644
index 0000000..a45c6cf
--- /dev/null
+++ b/res/drawable-hdpi/ic_empty.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_menu_save.png b/res/drawable-hdpi/ic_menu_save.png
new file mode 100644
index 0000000..2b29557
--- /dev/null
+++ b/res/drawable-hdpi/ic_menu_save.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_settings_launcher.png b/res/drawable-hdpi/ic_settings_launcher.png
new file mode 100644
index 0000000..6b4c06e
--- /dev/null
+++ b/res/drawable-hdpi/ic_settings_launcher.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_settings_performance.png b/res/drawable-hdpi/ic_settings_performance.png
new file mode 100644
index 0000000..aa61cf5
--- /dev/null
+++ b/res/drawable-hdpi/ic_settings_performance.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_settings_rom_settings.png b/res/drawable-hdpi/ic_settings_rom_settings.png
new file mode 100644
index 0000000..96f0adb
--- /dev/null
+++ b/res/drawable-hdpi/ic_settings_rom_settings.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_settings_themes.png b/res/drawable-hdpi/ic_settings_themes.png
new file mode 100644
index 0000000..d1c06ec
--- /dev/null
+++ b/res/drawable-hdpi/ic_settings_themes.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_settings_performance.png b/res/drawable-mdpi/ic_settings_performance.png
new file mode 100644
index 0000000..aa61cf5
--- /dev/null
+++ b/res/drawable-mdpi/ic_settings_performance.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_settings_rom_settings.png b/res/drawable-mdpi/ic_settings_rom_settings.png
new file mode 100644
index 0000000..299b148
--- /dev/null
+++ b/res/drawable-mdpi/ic_settings_rom_settings.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_settings_themes.png b/res/drawable-mdpi/ic_settings_themes.png
new file mode 100644
index 0000000..d1c06ec
--- /dev/null
+++ b/res/drawable-mdpi/ic_settings_themes.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_empty.png b/res/drawable-xhdpi/ic_empty.png
new file mode 100644
index 0000000..5742d13
--- /dev/null
+++ b/res/drawable-xhdpi/ic_empty.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_menu_save.png b/res/drawable-xhdpi/ic_menu_save.png
new file mode 100644
index 0000000..c403206
--- /dev/null
+++ b/res/drawable-xhdpi/ic_menu_save.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_settings_launcher.png b/res/drawable-xhdpi/ic_settings_launcher.png
new file mode 100644
index 0000000..6cc9cc4
--- /dev/null
+++ b/res/drawable-xhdpi/ic_settings_launcher.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_settings_performance.png b/res/drawable-xhdpi/ic_settings_performance.png
new file mode 100644
index 0000000..aa61cf5
--- /dev/null
+++ b/res/drawable-xhdpi/ic_settings_performance.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_settings_rom_settings.png b/res/drawable-xhdpi/ic_settings_rom_settings.png
new file mode 100644
index 0000000..89db08e
--- /dev/null
+++ b/res/drawable-xhdpi/ic_settings_rom_settings.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_settings_themes.png b/res/drawable-xhdpi/ic_settings_themes.png
new file mode 100644
index 0000000..babdcce
--- /dev/null
+++ b/res/drawable-xhdpi/ic_settings_themes.png
Binary files differ
diff --git a/res/drawable/activities_icon.png b/res/drawable/activities_icon.png
new file mode 100644
index 0000000..abd62e2
--- /dev/null
+++ b/res/drawable/activities_icon.png
Binary files differ
diff --git a/res/layout-land/lockscreen_targets.xml b/res/layout-land/lockscreen_targets.xml
new file mode 100644
index 0000000..22f0d4a
--- /dev/null
+++ b/res/layout-land/lockscreen_targets.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:prvandroid="http://schemas.android.com/apk/prv/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="vertical">
+
+    <TextView
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:background="@android:color/holo_blue_light"
+        android:layout_marginRight="8dip"
+        android:layout_marginLeft="8dip"
+        android:padding="4dip"
+        android:gravity="center_horizontal"
+        android:textColor="#FFFFFF"
+        android:textAppearance="?android:attr/textAppearanceSmall"
+        android:text="@string/lockscreen_target_info" />
+
+    <View
+        android:layout_width="match_parent"
+        android:layout_height="0dp"
+        android:layout_weight="1" />
+
+    <com.android.internal.widget.multiwaveview.GlowPadView
+        android:id="@+id/lock_target"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_gravity="center"
+        android:orientation="horizontal"
+        android:gravity="@*android:integer/kg_selector_gravity"
+        android:contentDescription="@*android:string/keyguard_accessibility_slide_area"
+        prvandroid:targetDrawables="@*android:array/lockscreen_targets_unlock_only"
+        prvandroid:targetDescriptions="@*android:array/lockscreen_target_descriptions_unlock_only"
+        prvandroid:directionDescriptions="@*android:array/lockscreen_direction_descriptions"
+        prvandroid:handleDrawable="@*android:drawable/ic_lockscreen_handle"
+        prvandroid:outerRingDrawable="@*android:drawable/ic_lockscreen_outerring"
+        prvandroid:outerRadius="@*android:dimen/glowpadview_target_placement_radius"
+        prvandroid:innerRadius="@*android:dimen/glowpadview_inner_radius"
+        prvandroid:snapMargin="@*android:dimen/glowpadview_snap_margin"
+        prvandroid:firstItemOffset="@*android:integer/kg_glowpad_rotation_offset"
+        prvandroid:magneticTargets="false"
+        prvandroid:feedbackCount="1"
+        prvandroid:vibrationDuration="20"
+        prvandroid:glowRadius="@*android:dimen/glowpadview_glow_radius"
+        prvandroid:pointDrawable="@*android:drawable/ic_lockscreen_glowdot"
+        prvandroid:allowScaling="true" />
+
+</LinearLayout>
diff --git a/res/layout-sw600dp/lockscreen_targets.xml b/res/layout-sw600dp/lockscreen_targets.xml
new file mode 100644
index 0000000..22f0d4a
--- /dev/null
+++ b/res/layout-sw600dp/lockscreen_targets.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:prvandroid="http://schemas.android.com/apk/prv/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="vertical">
+
+    <TextView
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:background="@android:color/holo_blue_light"
+        android:layout_marginRight="8dip"
+        android:layout_marginLeft="8dip"
+        android:padding="4dip"
+        android:gravity="center_horizontal"
+        android:textColor="#FFFFFF"
+        android:textAppearance="?android:attr/textAppearanceSmall"
+        android:text="@string/lockscreen_target_info" />
+
+    <View
+        android:layout_width="match_parent"
+        android:layout_height="0dp"
+        android:layout_weight="1" />
+
+    <com.android.internal.widget.multiwaveview.GlowPadView
+        android:id="@+id/lock_target"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_gravity="center"
+        android:orientation="horizontal"
+        android:gravity="@*android:integer/kg_selector_gravity"
+        android:contentDescription="@*android:string/keyguard_accessibility_slide_area"
+        prvandroid:targetDrawables="@*android:array/lockscreen_targets_unlock_only"
+        prvandroid:targetDescriptions="@*android:array/lockscreen_target_descriptions_unlock_only"
+        prvandroid:directionDescriptions="@*android:array/lockscreen_direction_descriptions"
+        prvandroid:handleDrawable="@*android:drawable/ic_lockscreen_handle"
+        prvandroid:outerRingDrawable="@*android:drawable/ic_lockscreen_outerring"
+        prvandroid:outerRadius="@*android:dimen/glowpadview_target_placement_radius"
+        prvandroid:innerRadius="@*android:dimen/glowpadview_inner_radius"
+        prvandroid:snapMargin="@*android:dimen/glowpadview_snap_margin"
+        prvandroid:firstItemOffset="@*android:integer/kg_glowpad_rotation_offset"
+        prvandroid:magneticTargets="false"
+        prvandroid:feedbackCount="1"
+        prvandroid:vibrationDuration="20"
+        prvandroid:glowRadius="@*android:dimen/glowpadview_glow_radius"
+        prvandroid:pointDrawable="@*android:drawable/ic_lockscreen_glowdot"
+        prvandroid:allowScaling="true" />
+
+</LinearLayout>
diff --git a/res/layout/bluetooth_mas_access.xml b/res/layout/bluetooth_mas_access.xml
new file mode 100644
index 0000000..dc7c2d5
--- /dev/null
+++ b/res/layout/bluetooth_mas_access.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2009, The Android Open Source Project
+** Copyright (c) 2011, Code Aurora Forum. All rights reserved.
+**
+** 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_height="match_parent"
+    android:layout_width="match_parent">
+
+    <LinearLayout
+        android:layout_height="match_parent"
+        android:layout_width="match_parent"
+        android:orientation="vertical">
+
+        <TextView
+            android:id="@+id/message"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginLeft="20dip"
+            android:layout_marginRight="20dip"
+            android:gravity="center_horizontal"
+            android:textAppearance="?android:attr/textAppearanceMedium" />
+
+        <CheckBox android:id="@+id/bluetooth_mas_remember_choice"
+            style="?android:attr/textAppearanceMedium"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="2dip"
+            android:text="@string/bluetooth_mas_remember_choice" />
+
+    </LinearLayout>
+
+</ScrollView>
diff --git a/res/layout/list_volt.xml b/res/layout/list_volt.xml
new file mode 100644
index 0000000..a8aa838
--- /dev/null
+++ b/res/layout/list_volt.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="fill_parent"
+    android:orientation="vertical"
+    android:layout_height="wrap_content"
+    android:layout_gravity="center_vertical">
+
+    <TextView
+        android:layout_width="fill_parent"
+        android:layout_height="wrap_content"
+        android:id="@+id/Freq"
+        android:textSize="18sp"
+        android:textColor="#FF177bbd"
+        android:text="@string/freq" />
+
+    <TextView
+        android:layout_width="fill_parent"
+        android:layout_height="wrap_content"
+        android:id="@+id/mVCurrent"
+        android:textSize="18sp"
+        android:textColor="#FFFFFFFF"
+        android:text="@string/current" />
+
+    <TextView
+        android:layout_width="fill_parent"
+        android:layout_height="wrap_content"
+        android:id="@+id/mVSaved"
+        android:textSize="18sp"
+        android:textColor="#FFA8A8A8"
+        android:text="@string/saved" />
+
+</LinearLayout>
diff --git a/res/layout/lockscreen_shortcut_dialog.xml b/res/layout/lockscreen_shortcut_dialog.xml
new file mode 100644
index 0000000..91d18b9
--- /dev/null
+++ b/res/layout/lockscreen_shortcut_dialog.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:minHeight="?android:attr/listPreferredItemHeight"
+    android:layout_height="wrap_content"
+    android:paddingBottom="5dp"
+    android:paddingLeft="8dp"
+    android:gravity="center_vertical"
+    android:orientation="horizontal">
+    <ImageButton
+        android:padding="5dp"
+        android:layout_width="@android:dimen/app_icon_size"
+        style="?android:attr/borderlessButtonStyle"
+        android:id="@+id/icon"
+        android:layout_height="@android:dimen/app_icon_size" />
+    <View
+        android:layout_width="2dp"
+        android:layout_height="match_parent"
+        android:layout_marginTop="5dp"
+        android:layout_marginBottom="5dp"
+        android:layout_marginRight="5dp"
+        android:layout_marginLeft="5dp"
+        android:background="@android:drawable/divider_horizontal_dark" />
+    <Button
+        android:layout_width="match_parent"
+        style="?android:attr/borderlessButtonStyle"
+        android:gravity="left|center_vertical"
+        android:paddingLeft="5dp"
+        android:layout_height="wrap_content"
+        android:id="@+id/label" />
+</LinearLayout>
diff --git a/res/layout/lockscreen_targets.xml b/res/layout/lockscreen_targets.xml
new file mode 100644
index 0000000..cff327c
--- /dev/null
+++ b/res/layout/lockscreen_targets.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:prvandroid="http://schemas.android.com/apk/prv/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="vertical">
+
+    <TextView
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:background="@android:color/holo_blue_light"
+        android:layout_marginRight="8dip"
+        android:layout_marginLeft="8dip"
+        android:padding="4dip"
+        android:gravity="center_horizontal"
+        android:textColor="#FFFFFF"
+        android:textAppearance="?android:attr/textAppearanceSmall"
+        android:text="@string/lockscreen_target_info" />
+
+    <View
+        android:layout_width="match_parent"
+        android:layout_height="0dp"
+        android:layout_weight="0.4" />
+
+    <com.android.internal.widget.multiwaveview.GlowPadView
+        android:id="@+id/lock_target"
+        android:layout_width="match_parent"
+        android:layout_height="0dp"
+        android:layout_weight="0.6"
+        android:orientation="horizontal"
+        android:gravity="top"
+        android:contentDescription="@*android:string/keyguard_accessibility_slide_area"
+        prvandroid:targetDrawables="@*android:array/lockscreen_targets_unlock_only"
+        prvandroid:targetDescriptions="@*android:array/lockscreen_target_descriptions_unlock_only"
+        prvandroid:directionDescriptions="@*android:array/lockscreen_direction_descriptions"
+        prvandroid:handleDrawable="@*android:drawable/ic_lockscreen_handle"
+        prvandroid:outerRingDrawable="@*android:drawable/ic_lockscreen_outerring"
+        prvandroid:outerRadius="@*android:dimen/glowpadview_target_placement_radius"
+        prvandroid:innerRadius="@*android:dimen/glowpadview_inner_radius"
+        prvandroid:snapMargin="@*android:dimen/glowpadview_snap_margin"
+        prvandroid:firstItemOffset="@*android:integer/kg_glowpad_rotation_offset"
+        prvandroid:magneticTargets="false"
+        prvandroid:feedbackCount="1"
+        prvandroid:vibrationDuration="20"
+        prvandroid:glowRadius="@*android:dimen/glowpadview_glow_radius"
+        prvandroid:pointDrawable="@*android:drawable/ic_lockscreen_glowdot"
+        prvandroid:allowScaling="true" />
+
+</LinearLayout>
diff --git a/res/layout/pick_item.xml b/res/layout/pick_item.xml
index d85edc4..e937d7b 100755
--- a/res/layout/pick_item.xml
+++ b/res/layout/pick_item.xml
@@ -17,9 +17,9 @@
 <TextView xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
-    android:minHeight="?android:attr/listPreferredItemHeightSmall"
-    android:textAppearance="?android:attr/textAppearanceMedium"
+    android:minHeight="?android:attr/listPreferredItemHeight"
+    android:textAppearance="?android:attr/textAppearanceLarge"
     android:gravity="center_vertical"
-    android:drawablePadding="8dip"
-    android:paddingStart="11dip"
-    android:paddingEnd="11dip" />
+    android:drawablePadding="14dip"
+    android:paddingLeft="15dip"
+    android:paddingRight="15dip" />
diff --git a/res/layout/preference_dialog_increasing_ring.xml b/res/layout/preference_dialog_increasing_ring.xml
new file mode 100644
index 0000000..25bb683
--- /dev/null
+++ b/res/layout/preference_dialog_increasing_ring.xml
@@ -0,0 +1,71 @@
+<?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.
+-->
+
+<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent">
+
+    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:orientation="vertical"
+            android:gravity="center_horizontal"
+            android:padding="10dip">
+
+        <ImageView android:id="@android:id/icon"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content" />
+
+        <CheckBox android:id="@+id/increasing_ring"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:text="@string/checkbox_increasing_ring"
+                android:textAppearance="?android:attr/textAppearanceSmall" />
+
+        <TextView android:id="@+id/increasing_ring_min_volume_title"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:text="@string/increasing_ring_min_volume_title" />
+
+        <SeekBar android:id="@*android:id/seekbar"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:paddingTop="2dip"
+                android:paddingLeft="14dip"
+                android:paddingRight="14dip" />
+
+        <TextView android:id="@+id/increasing_ring_volume_notice"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:text="@string/increasing_ring_volume_notice"
+                android:paddingTop="8dip" />
+
+        <TextView android:id="@+id/increasing_ring_interval_title"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:text="@string/increasing_ring_interval_title"
+                android:paddingTop="8dip" />
+
+        <Spinner android:id="@+id/increasing_ring_interval"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:prompt="@string/increasing_ring_interval_title"
+                android:entries="@array/increasing_ring_interval_entries"
+                android:paddingTop="6dip"
+                android:paddingBottom="6dip" />
+    </LinearLayout>
+
+</ScrollView>
\ No newline at end of file
diff --git a/res/layout/preference_dialog_ringervolume.xml b/res/layout/preference_dialog_ringervolume.xml
index 1643cab..68cdb47 100644
--- a/res/layout/preference_dialog_ringervolume.xml
+++ b/res/layout/preference_dialog_ringervolume.xml
@@ -159,6 +159,26 @@
 
         </LinearLayout>
 
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:gravity="center_vertical"
+            android:orientation="vertical"
+            android:paddingLeft="8dip" >
+
+            <CheckBox
+                android:id="@+id/link_ring_and_volume"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:text="@string/link_volume_ringtones" />
+
+            <CheckBox
+                android:id="@+id/link_mutes"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:text="@string/link_volume_mutes" />
+        </LinearLayout>
+
         <TextView
                 android:textAppearance="?android:attr/textAppearanceSmall"
                 android:layout_width="wrap_content"
diff --git a/res/layout/preference_time_range.xml b/res/layout/preference_time_range.xml
new file mode 100644
index 0000000..0392636
--- /dev/null
+++ b/res/layout/preference_time_range.xml
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:minHeight="?android:attr/listPreferredItemHeight"
+    android:gravity="center_vertical">
+
+        <LinearLayout
+            android:id="@+id/start_time"
+            android:layout_width="fill_parent"
+            android:layout_height="match_parent"
+            android:layout_weight="1"
+            android:orientation="vertical"
+            android:clickable="true"
+            android:focusable="true"
+            android:background="?android:attr/selectableItemBackground">
+
+            <TextView
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:orientation="vertical"
+                android:paddingLeft="16dip"
+                android:paddingTop="6dip"
+                android:text="@string/start_time_title"
+                android:focusable="false"
+                android:textAppearance="?android:attr/textAppearanceSmall" />
+
+            <TextView
+                android:id="@+id/start_time_text"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:gravity="center_horizontal"
+                android:orientation="vertical"
+                android:paddingBottom="6dip"
+                android:focusable="false"
+                android:textAppearance="?android:attr/textAppearanceMedium" />
+
+        </LinearLayout>
+
+        <View
+            android:layout_width="1dip"
+            android:layout_height="match_parent"
+            android:layout_marginTop="5dip"
+            android:layout_marginBottom="5dip"
+            android:background="@android:drawable/divider_horizontal_dark" />
+
+        <LinearLayout
+            android:id="@+id/end_time"
+            android:layout_width="fill_parent"
+            android:layout_height="match_parent"
+            android:layout_weight="1"
+            android:orientation="vertical"
+            android:clickable="true"
+            android:focusable="true"
+            android:background="?android:attr/selectableItemBackground">
+
+            <TextView
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:orientation="vertical"
+                android:paddingLeft="16dip"
+                android:paddingTop="6dip"
+                android:text="@string/end_time_title"
+                android:focusable="false"
+                android:textAppearance="?android:attr/textAppearanceSmall" />
+
+            <TextView
+                android:id="@+id/end_time_text"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:gravity="center_horizontal"
+                android:orientation="vertical"
+                android:paddingBottom="6dip"
+                android:focusable="false"
+                android:textAppearance="?android:attr/textAppearanceMedium" />
+
+        </LinearLayout>
+
+</LinearLayout>
diff --git a/res/layout/voltage_dialog.xml b/res/layout/voltage_dialog.xml
new file mode 100644
index 0000000..045620a
--- /dev/null
+++ b/res/layout/voltage_dialog.xml
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ScrollView android:id="@+id/layout_root"
+    android:layout_width="fill_parent"
+    android:layout_height="fill_parent"
+    xmlns:android="http://schemas.android.com/apk/res/android">
+
+    <LinearLayout
+        android:orientation="vertical"
+        android:padding="10.0dip"
+        android:layout_width="fill_parent"
+        android:layout_height="fill_parent"
+        xmlns:android="http://schemas.android.com/apk/res/android">
+
+        <RelativeLayout android:id="@+id/voltageDialogLayout"
+            android:paddingTop="10.0dip"
+            android:layout_width="fill_parent"
+            android:layout_height="wrap_content"
+            android:layout_below="@+id/conditionText"
+            xmlns:android="http://schemas.android.com/apk/res/android">
+
+            <EditText android:id="@+id/voltageEdit"
+                android:paddingTop="10.0dip"
+                android:paddingRight="5.0dip"
+                android:layout_width="60.0dip"
+                android:layout_height="wrap_content"
+                android:maxLength="4"
+                android:layout_toRightOf="@+id/negativeText"
+                android:inputType="number" />
+
+            <SeekBar android:id="@+id/voltageSeek"
+                android:paddingLeft="10.0dip"
+                android:paddingTop="12.0dip"
+                android:layout_width="fill_parent"
+                android:layout_height="wrap_content"
+                android:max="100"
+                android:progress="50"
+                android:layout_toRightOf="@+id/voltageEdit" />
+
+           <TextView android:textSize="18.0dip"
+                android:typeface="monospace"
+                android:textColor="#ffffffff"
+                android:id="@+id/voltageMeter"
+                android:paddingLeft="14.0dip"
+                android:paddingTop="40.0dip"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:shadowColor="#ffffffff"
+                android:shadowRadius="3.0"
+                android:layout_alignLeft="@+id/voltageSeek" />
+        </RelativeLayout>
+    </LinearLayout>
+</ScrollView>
diff --git a/res/layout/wifi_dialog.xml b/res/layout/wifi_dialog.xml
index ff003c4..f4b9118 100644
--- a/res/layout/wifi_dialog.xml
+++ b/res/layout/wifi_dialog.xml
@@ -167,6 +167,15 @@
             </LinearLayout>
         </LinearLayout>
 
+        <LinearLayout android:id="@+id/wifi_auto_connect_toggle"
+                    style="@style/wifi_item"
+                    android:visibility="gone">
+            <CheckBox android:id="@+id/wifi_auto_connect_togglebox"
+                    style="@style/wifi_item_content"
+                    android:textSize="14sp"
+                    android:text="@string/wifi_auto_connect" />
+        </LinearLayout>
+
         <LinearLayout android:id="@+id/wifi_advanced_toggle"
                     style="@style/wifi_item"
                     android:visibility="gone">
diff --git a/res/values-cs/strings.xml b/res/values-cs/strings.xml
index 28353d7..08645ac 100644
--- a/res/values-cs/strings.xml
+++ b/res/values-cs/strings.xml
@@ -1834,4 +1834,16 @@
     <string name="user_picture_title" msgid="7297782792000291692">"ID fotografie"</string>
     <string name="cell_broadcast_settings" msgid="8415582011920085222">"Hromadné zasílání zpráv v rámci buňky"</string>
     <string name="cell_broadcast_settings_summary" msgid="3301339398950905913">"Vyberte typy mimořádných upozornění, která chcete zobrazovat."</string>
+    <string name="increasing_ring_title">Vzrůstající vyzvánění</string>
+    <string name="checkbox_increasing_ring">Zapnout</string>
+    <string name="increasing_ring_min_volume_title">Počáteční hlasitost vyzvánění</string>
+    <string name="increasing_ring_volume_notice">Upozornění:\nPokud je počáteční hlasitost nastavena na vyšší hodnotu než hlasitost normální, bude při vyzvýnění použita normální (nevzrůstající) hlasitost.</string>
+    <string name="increasing_ring_interval_title">Interval vzrůstání</string>
+    <string name="increasing_ring_interval_eachring">Při každém zazvonění</string>
+    <string name="increasing_ring_interval_half_second">0,5 sekundy</string>
+    <string name="increasing_ring_interval_1second">1 sekunda</string>
+    <string name="increasing_ring_interval_2seconds">2 sekundy</string>
+    <string name="increasing_ring_interval_3seconds">3 sekundy</string>
+    <string name="increasing_ring_interval_5seconds">5 sekund</string>
+    <string name="increasing_ring_interval_10seconds">10 sekund</string>
 </resources>
diff --git a/res/values/arrays.xml b/res/values/arrays.xml
index 88c8323..ea00eb6 100644
--- a/res/values/arrays.xml
+++ b/res/values/arrays.xml
@@ -461,6 +461,19 @@
         <item>Vibrate</item>
     </string-array>
 
+    <!-- NFC settings. -->
+    <string-array name="nfc_polling_mode_entries">
+       <item>@string/nfc_polling_mode_screen_off</item>
+       <item>@string/nfc_polling_mode_screen_locked</item>
+       <item>@string/nfc_polling_mode_screen_unlocked</item>
+    </string-array>
+
+    <string-array name="nfc_polling_mode_values">
+       <item>1</item>
+       <item>2</item>
+       <item>3</item>
+    </string-array>
+
     <!-- Do not translate. -->
     <string-array name="emergency_tone_values">
         <item>0</item>
@@ -770,4 +783,127 @@
         <!-- Always allow app to send to premium SMS short code. -->
         <item>Always allow</item>
     </string-array>
+    
+    <string-array name="increasing_ring_interval_entries" translatable="false">
+        <item>@string/increasing_ring_interval_eachring</item>
+        <item>@string/increasing_ring_interval_half_second</item>
+        <item>@string/increasing_ring_interval_1second</item>
+        <item>@string/increasing_ring_interval_2seconds</item>
+        <item>@string/increasing_ring_interval_3seconds</item>
+        <item>@string/increasing_ring_interval_5seconds</item>
+        <item>@string/increasing_ring_interval_10seconds</item>
+    </string-array>
+    
+    <integer-array name="increasing_ring_interval_values" translatable="false">
+        <item>0</item>
+        <item>500</item>
+        <item>1000</item>
+        <item>2000</item>
+        <item>3000</item>
+        <item>5000</item>
+        <item>10000</item>
+    </integer-array>
+
+<string-array name="lockscreen_icon_picker_labels" translatable="false">
+        <item>@string/icon_picker_alarm</item>
+        <item>@string/icon_picker_browser</item>
+        <item>@string/icon_picker_calendar</item>
+        <item>@string/icon_picker_camera</item>
+        <item>@string/icon_picker_email</item>
+        <item>@string/icon_picker_email2</item>
+        <item>@string/icon_picker_facebook</item>
+        <item>@string/icon_picker_gallery</item>
+        <item>@string/icon_picker_google_small</item>
+        <item>@string/icon_picker_googleplus</item>
+        <item>@string/icon_picker_googletalk</item>
+        <item>@string/icon_picker_maps</item>
+        <item>@string/icon_picker_sms</item>
+        <item>@string/icon_picker_movie</item>
+        <item>@string/icon_picker_music</item>
+        <item>@string/icon_picker_nav_normal</item>
+        <item>@string/icon_picker_phone</item>
+        <item>@string/icon_picker_podcast</item>
+        <item>@string/icon_picker_rss</item>
+        <item>@string/icon_picker_search</item>
+        <item>@string/icon_picker_twitter</item>
+    </string-array>
+
+    <string-array name="lockscreen_icon_picker_icons" translatable="false">
+        <item>@*android:drawable/ic_lockscreen_alarm_normal</item>
+        <item>@*android:drawable/ic_lockscreen_browser_normal</item>
+        <item>@*android:drawable/ic_lockscreen_calendar_normal</item>
+        <item>@*android:drawable/ic_lockscreen_camera_normal</item>
+        <item>@*android:drawable/ic_lockscreen_email_normal</item>
+        <item>@*android:drawable/ic_lockscreen_email2_normal</item>
+        <item>@*android:drawable/ic_lockscreen_facebook_normal</item>
+        <item>@*android:drawable/ic_lockscreen_gallery_normal</item>
+        <item>@*android:drawable/ic_lockscreen_google_small_normal</item>
+        <item>@*android:drawable/ic_lockscreen_gplus_normal</item>
+        <item>@*android:drawable/ic_lockscreen_gtalk_normal</item>
+        <item>@*android:drawable/ic_lockscreen_maps_normal</item>
+        <item>@*android:drawable/ic_lockscreen_sms_normal</item>
+        <item>@*android:drawable/ic_lockscreen_movie_normal</item>
+        <item>@*android:drawable/ic_lockscreen_music_normal</item>
+        <item>@*android:drawable/ic_lockscreen_nav_normal</item>
+        <item>@*android:drawable/ic_lockscreen_phone_normal</item>
+        <item>@*android:drawable/ic_lockscreen_podcast_normal</item>
+        <item>@*android:drawable/ic_lockscreen_rss_normal</item>
+        <item>@*android:drawable/ic_lockscreen_google_normal</item>
+        <item>@*android:drawable/ic_lockscreen_twitter_normal</item>
+    </string-array>
+
+	<!--- Volume key cursor control -->
+    <string-array name="volume_key_cursor_control_entries">
+        <item>@string/volume_key_cursor_control_off</item>
+        <item>@string/volume_key_cursor_control_on</item>
+        <item>@string/volume_key_cursor_control_on_reverse</item>
+    </string-array>
+
+    <string-array name="volume_key_cursor_control_values">
+        <item>0</item>
+        <item>1</item>
+        <item>2</item>
+    </string-array>
+
+    <!-- Performance settings -->
+    <string-array name="pref_zram_size_entries">
+        <item>Disabled</item>
+        <item>10%</item>
+        <item>18% (default)</item>
+        <item>26%</item>
+    </string-array>
+
+    <string-array name="pref_zram_size_values" translatable="false">
+        <item>0</item>
+        <item>10</item>
+        <item>18</item>
+        <item>26</item>
+    </string-array>
+
+    <string-array name="dithering_entries" translatable="false">
+        <item>@string/dithering_no_dither</item>
+        <item>@string/dithering_color_banding</item>
+        <item>@string/dithering_blur_effect</item>
+    </string-array>
+
+    <string-array name="dithering_values" translatable="false">
+        <item>0</item>
+        <item>1</item>
+        <item>2</item>
+    </string-array>
+
+    <!--- Sms security limit -->
+    <string-array name="sms_security_check_limit_entries" translatable="false">
+        <item>@string/sms_security_check_limit_default</item>
+        <item>50</item>
+        <item>100</item>
+        <item>200</item>
+    </string-array>
+
+    <string-array name="sms_security_check_limit_values" translatable="false">
+        <item>30</item>
+        <item>50</item>
+        <item>100</item>
+        <item>200</item>
+    </string-array>
 </resources>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 91f293c..d094af7 100755
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -31,7 +31,8 @@
 
     <dimen name="data_usage_chart_height">252dip</dimen>
     <dimen name="data_usage_chart_optimalWidth">440dip</dimen>
-
+	
+	<dimen name="shortcut_picker_left_padding">70dip</dimen>
     <dimen name="volume_seekbar_side_margin">8dip</dimen>
 
     <dimen name="crypt_clock_size">100sp</dimen>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index d6abe94..c923e59 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -354,6 +354,15 @@
     <!-- Bluetooth phone book permission Alert Activity checkbox text [CHAR LIMIT=none] -->
     <string name="bluetooth_pb_remember_choice">Don\'t ask again</string>
 
+    <!-- Activity label of BluetoothMasPermissionActivity, also used as Strings in the permission dialog [CHAR LIMIT=none] -->
+    <string name="bluetooth_mas_request">"Message Access request"</string>
+
+    <!-- Bluetooth MAS permission Alert Activity text [CHAR LIMIT=none] -->
+    <string name="bluetooth_mas_acceptance_dialog_text">%1$s would like to access your messages. Give access to %2$s?</string>
+
+    <!-- Bluetooth MAS permission Alert Activity checkbox text [CHAR LIMIT=none] -->
+    <string name="bluetooth_mas_remember_choice">Don\'t ask again</string>
+
     <!-- Date & time settings screen title -->
     <string name="date_and_time">Date &amp; time settings</string>
     <!-- The title of the activity to pick a time zone. -->
@@ -866,6 +875,12 @@
     <!-- Summary for "Configure lockscreen" when security password is enabled [CHAR LIMIT=45] -->
     <string name="unlock_set_unlock_mode_password">Password</string>
 
+    <!-- Sizes for pattern lockscreen -->
+    <string name="lock_pattern_size_3">3x3</string>
+    <string name="lock_pattern_size_4">4x4</string>
+    <string name="lock_pattern_size_5">5x5</string>
+    <string name="lock_pattern_size_6">6x6</string>
+
     <!-- Title for option to turn of password/pin/pattern unlock. [CHAR LIMIT=22] -->
     <string name="unlock_disable_lock_title">Turn off screen lock</string>
 
@@ -1227,6 +1242,10 @@
     <string name="android_beam_label">Android Beam</string>
     <!-- Explanation of the Android Beam feature in the Android Beam settings panel. The use of "beam" here is as a verb and not considered trademarked. [CHAR LIMIT=NONE] -->
     <string name="android_beam_explained">When this feature is turned on, you can beam app content to another NFC-capable device by holding the devices close together. For example, you can beam Browser pages, YouTube videos, People contacts, and more.\n\nJust bring the devices together (typically back to back) and then touch your screen. The app determines what gets beamed.</string>
+    <string name="nfc_polling_mode_title">NFC polling mode</string>
+    <string name="nfc_polling_mode_screen_off">Screen off</string>
+    <string name="nfc_polling_mode_screen_locked">Screen on, locked</string>
+    <string name="nfc_polling_mode_screen_unlocked">Screen on, unlocked (default)</string>
 
     <!-- Network service discovery settings -->
     <!-- Used in the 1st-level settings screen to turn on NSD -->
@@ -1311,6 +1330,8 @@
     <string name="wifi_required_info_text">To complete setup, your tablet needs access to Wi-Fi. After setup, you can switch between mobile data and Wi-Fi.</string>
 
     <!-- Dialog for Access Points --> <skip />
+    <!-- Label for automatically_connect -->
+    <string name="wifi_auto_connect">Automatically connect</string>
     <!-- Label to show/hide advanced options -->
     <string name="wifi_show_advanced">Show advanced options</string>
     <!-- Title for the WPS setup dialog [CHAR LIMIT=50] -->
@@ -1858,6 +1879,22 @@
     <!-- About phone screen, list item summary.  Takes the user to the screen for seeing and installing system updates. -->
     <string name="system_update_settings_list_item_summary">""</string>
 
+    <!--  About device screen, Hardware info -->
+    <string name="hardware_info">Hardware info</string>
+    <!--  About device Screen, hardware info, rear camera -->
+    <string name="device_rear_camera">Rear camera</string>
+    <!--  About device Screen, hardware info, front camera -->
+    <string name="device_front_camera">Front facing camera</string>
+    <!--  About device Screen, hardware info, screen res -->
+    <string name="device_screen_resolution">Screen resolution</string>
+    <!--  About device Screen, hardware info, GPU info -->
+    <string name="gpu_info">GPU</string>
+    <!-- About device screen, Cpu info. -->
+    <string name="cpu_info">CPU</string>
+    <!-- About device screen, Chipset info -->
+    <string name="chipset_info">Chipset</string>
+    <!-- About phone screen, Free memory info -->
+    <string name="mem_info">Memory</string>
     <!-- About phone screen, status item label -->
     <string name="firmware_version">Android version</string>
     <!-- About phone screen, status item label-->
@@ -1872,6 +1909,9 @@
     <string name="build_number">Build number</string>
     <!-- About phone screen,  setting option name-->
     <string name="selinux_status">SELinux status</string>
+	<!-- About phone screen,  setting option name-->
+    <string name="mod_version">XeHD version</string>
+	<string name="mod_version_default">Unknown</string>
 
     <!-- About phone screen, show when a value of some status item is unavailable. -->
     <string name="device_info_not_available">Not available</string>
@@ -2996,6 +3036,9 @@
     <string name="enable_adb_summary">Debug mode when USB is connected</string>
     <!-- [CHAR LIMIT=NONE] Setting checkbox title for Whether to include bug report item in power menu. -->
     <string name="bugreport_in_power">Power menu bug reports</string>
+    <!-- Setting checkbox summary for displaying USB debugging notification -->
+    <string name="adb_notify">USB debugging notify</string>
+    <string name="adb_notify_summary">Display a notification when USB debugging is connected</string>
     <!-- [CHAR LIMIT=NONE] Setting checkbox summary for Whether to include bug report item in power -->
     <string name="bugreport_in_power_summary">Include option in power menu for taking a bug report</string>
     <!-- Setting Checkbox title whether to keep the screen on when plugged in to a power source -->
@@ -4395,4 +4438,207 @@
     <string name="cell_broadcast_settings">Cell broadcasts</string>
     <!-- Cell Broadcast settings description [CHAR LIMIT=100] -->
     <string name="cell_broadcast_settings_summary">Select the types of emergency alerts to display.</string>
+
+	<string name="xenonhd_extras_title">Extras</string>
+
+	<string name="quick_links_title">Quick Links</string>
+
+	<!-- Volume rocker wake -->
+    <string name="pref_volume_wake_title">Volume rocker wake</string>
+    <string name="pref_volume_wake_summary">Pressing the volume up/down wakes the device.</string>
+
+	<!-- Volume rocker controls -->
+	<string name="volbtn_music_controls_title">Volume rocker music controls</string>
+	<string name="volbtn_music_controls_summary">When screen off, long-pressing the volume rockers will seek music tracks</string>
+
+	 <!-- Theme chooser -->
+    <string name="themes_title">Themes</string>
+
+    <!-- Hostname setting -->
+    <string name="device_hostname">Device hostname</string>
+
+	 <!-- Quiet hours #CM -->
+    <string name="quiet_hours_title">Quiet hours</string>
+    <string name="quiet_hours_summary">Configure the hours the device should be quiet</string>
+    <string name="quiet_hours_enabled_title">Enable quiet hours</string>
+    <string name="quiet_hours_start">Start of quiet hours</string>
+    <string name="quiet_hours_start_summary">When to start enforcing quiet hours</string>
+    <string name="quiet_hours_end">End of quiet hours</string>
+    <string name="quiet_hours_end_summary">When to stop enforcing quiet hours</string>
+    <string name="quiet_hours_notifications_title">Mute notification sounds</string>
+    <string name="quiet_hours_ringer_title">Mute phone ringtones</string>
+    <string name="quiet_hours_still_title">Disable vibrations</string>
+    <string name="quiet_hours_dim_title">Disable notification light</string>
+    <string name="quiet_hours_active_from">Active from</string>
+    <string name="quiet_hours_active_to">to</string>
+
+    <!-- time range preference -->
+    <string name="start_time_title">Start</string>
+    <string name="end_time_title">End</string>
+
+	<!-- Rom Settings -->
+    <string name="rom_control_title">ROM Settings</string>
+
+    <string name="vibration_title">Phone vibration</string>
+
+    <string name="link_volume_ringtones">Link volumes</string>
+    <string name="link_volume_mutes">Link mute states</string>
+    
+    <string name="increasing_ring_title">Ascending ringtone</string>
+    <string name="checkbox_increasing_ring">Enable</string>
+    <string name="increasing_ring_min_volume_title">Ringing start volume</string>
+    <string name="increasing_ring_volume_notice">Notice:\nAs the start volume is set higher than the ringer volume, the ring tone will be played using the ringer volume.</string>
+    <string name="increasing_ring_interval_title">Increase interval</string>
+    <string name="increasing_ring_interval_eachring">On each ring</string>
+    <string name="increasing_ring_interval_half_second">0.5 seconds</string>
+    <string name="increasing_ring_interval_1second">1 second</string>
+    <string name="increasing_ring_interval_2seconds">2 seconds</string>
+    <string name="increasing_ring_interval_3seconds">3 seconds</string>
+    <string name="increasing_ring_interval_5seconds">5 seconds</string>
+    <string name="increasing_ring_interval_10seconds">10 seconds</string>
+
+    <string name="volume_adjust_sounds_enable_title">Volume adjust sound</string>
+    <!-- Sound settings screen, setting check box summary -->
+    <string name="volume_adjust_sounds_enable_summary">Play sound when adjusting volume with hard keys</string>
+
+	<!-- Lock Screen Shortcuts -->
+    <string name="lockscreen_target_info">Drag the slider to targets to assign shortcuts</string>
+    <string name="lockscreen_target_title">Slider shortcuts</string>
+    <string name="lockscreen_target_summary">View or change custom lock screen shortcuts</string>
+    <string name="lockscreen_target_reset">Lock screen shortcuts reset to default</string>
+    <string name="lockscreen_target_save">Lock screen shortcuts saved</string>
+    <string name="lockscreen_target_reset_title">Reset</string>
+    <string name="lockscreen_target_reset_message">Delete all user created lock screen shortcuts and restore to default?</string>
+    <string name="lockscreen_target_empty">Empty</string>
+    <string name="lockscreen_target_edit_title">Edit shortcut and icon</string>
+    <string name="lockscreen_target_edit_msg">Select or change the desired application or activity and the associated icon</string>
+	<string name="ok">OK</string>
+	<string name="profile_applist_title">Applications</string>
+	<string name="profile_reset_title">Reset</string>
+	<string name="profile_reset_message">Delete all user created profiles and application groups and restore them to default?</string>
+
+	<!-- Lock screen shortcuts -->
+    <string name="picker_activities">Activities</string>
+    <string name="select_custom_app_title">Select custom application</string>
+    <string name="select_custom_activity_title">Select custom activity</string>
+    <string name="icon_picker_choose_icon_title">Choose icon</string>
+    <string name="icon_picker_alarm">Alarm</string>
+    <string name="icon_picker_browser">Browser</string>
+    <string name="icon_picker_calendar">Calendar</string>
+    <string name="icon_picker_camera">Camera</string>
+    <string name="icon_picker_chrome">Chrome</string>
+    <string name="icon_picker_email">Email</string>
+    <string name="icon_picker_email2">Email Holo</string>
+    <string name="icon_picker_facebook">Facebook</string>
+    <string name="icon_picker_gallery">Gallery</string>
+    <string name="icon_picker_google_small">Google (small)</string>
+    <string name="icon_picker_googleplus">Google Plus</string>
+    <string name="icon_picker_googletalk">Google Talk</string>
+    <string name="icon_picker_maps">Maps</string>
+    <string name="icon_picker_movie">Movie</string>
+    <string name="icon_picker_music">Music</string>
+    <string name="icon_picker_nav_normal">Navigation</string>
+    <string name="icon_picker_phone">Phone</string>
+    <string name="icon_picker_podcast">Podcast</string>
+    <string name="icon_picker_rss">Rss</string>
+    <string name="icon_picker_search">Search</string>
+    <string name="icon_picker_sms">Messaging</string>
+    <string name="icon_picker_twitter">Twitter</string>
+
+    <!-- String for IconPicker -->
+    <string name="icon_picker_title">Choose icon source</string>
+    <string name="icon_picker_system_icons_title">System icons</string>
+    <string name="icon_picker_gallery_title">Gallery</string>
+    <string name="icon_picker_pack_title">Icon pack</string>
+
+	<!--- Volume key cursor control -->
+    <string name="volume_key_cursor_control_title">Volume key cursor control</string>
+    <string name="volume_key_cursor_control_off">Disabled</string>
+    <string name="volume_key_cursor_control_on">Volume up/down moves cursor left/right</string>
+    <string name="volume_key_cursor_control_on_reverse">Volume up/down moves cursor right/left</string>
+
+	<!-- Performance settings  -->
+    <string name="performance_settings_title">Performance</string>
+
+    <!-- Performance Settings : Processor settings title -->
+    <string name="processor_title">Processor</string>
+    <!-- Performance Settings : Processor settings summary. -->
+    <string name="processor_summary">Change CPU governor and clock speed</string>
+
+    <!-- Performance Settings : Processor settings sub items -->
+    <string name="cpu_cur_freq_title">Current CPU frequency</string>
+    <string name="cpu_governors_title">CPU governor</string>
+    <string name="cpu_governors_summary">%S</string>
+    <string name="cpu_min_freq_title">Minimum CPU frequency</string>
+    <string name="cpu_min_freq_summary">%s</string>
+    <string name="cpu_max_freq_title">Maximum CPU frequency</string>
+    <string name="cpu_max_freq_summary">%s</string>
+    <string name="cpu_set_on_boot">Set on boot</string>
+    <string name="cpu_set_on_boot_summary">Restore the processor settings on boot</string>
+
+    <!-- Memory Management -->
+    <string name="memory_management_title">Memory management</string>
+    <string name="memory_management_summary">Customize the usage of memory to alter system performance</string>
+    <!-- zRam -->
+    <string name="pref_zram_title">zRam</string>
+    <string name="pref_zram_summary">Compress memory for increased virtual capacity (requires reboot)</string>
+    <!-- KSM -->
+    <string name="pref_ksm_title">Kernel samepage merging</string>
+    <string name="pref_ksm_summary">KSM reduces physical memory requirements and improves performance</string>
+    <!-- Purgeable Assets -->
+    <string name="pref_purgeable_assets_title">Allow purging of assets</string>
+    <string name="pref_purgeable_assets_summary">Purging of bitmap memory assets allows the freeing of more RAM when needed (requires reboot)</string>
+
+    <!-- Performance Settings : I/O scheduler settings summary. -->
+    <string name="io_scheds_summary">Change I/O scheduler</string>
+
+    <!-- Performance Settings : I/O scheduler settings sub items -->
+    <string name="io_sched_title">I/O scheduler</string>
+    <string name="io_sched_summary">%S</string>
+    <string name="io_sched_set_on_boot">Set on boot</string>
+    <string name="io_sched_set_on_boot_summary">Restore the I/O scheduler settings on boot</string>
+
+    <!-- Performance Settings : Dithering -->
+    <string name="pref_use_dithering_title">Surface improvement</string>
+    <string name="dithering_no_dither">Disable dithering</string>
+    <string name="dithering_color_banding">Fix color banding (default)</string>
+    <string name="dithering_blur_effect">Fix color banding and blur effect</string>
+
+    <!-- Performance Settings : 16bpp Alpha -->
+    <string name="pref_use_16bpp_alpha_title">16bit transparency</string>
+    <string name="pref_use_16bpp_alpha_summary">Better graphics performance, but lower quality and may cause visual artifacts (requires reboot)</string>
+
+    <!-- Performance | Voltage Control -->
+    <string name="cpu_voltage">Voltage control</string>
+    <string name="cpu_voltage_summary">Change CPU voltage of each frequency</string>
+    <string name="ps_volt_mhz_voltage">" MHz Voltage"</string>
+    <string name="ps_volt_save">"Save"</string>
+    <string name="ps_volt_current_voltage">"Current voltage: "</string>
+    <string name="ps_volt_setting_to_apply">"Setting to apply: "</string>
+    <string name="pt_volt_control">Voltage control</string>
+    <string name="ps_volt_control">Set voltages for each frequency</string>
+    <string name="not_supported">Your kernel does not support voltage control</string>
+    <string name="apply_values">Apply values</string>
+    <string name="freq">Frequency</string>
+    <string name="current">mV current</string>
+    <string name="saved">mV saved</string>
+    <string name="sob">Set on boot</string>
+
+	<string name="headset_category_title">Headset</string>
+	<string name="headset_connect_player_title">Launch music app on connect</string>
+	<string name="safe_headset_volume_title">Safe headset volume</string>
+
+	<!--- Chronus -->
+	<string name="lock_clock_title">Clock widget</string>
+	<string name="lock_clock_summary">View or change how the \'Chronus\' Home and Lock screen widgets will display</string>
+
+	<!-- Launcher settings  -->
+    <string name="launcher_settings_title">Launcher</string>
+
+    <!--- Sms security limit -->
+    <string name="app_security_title">App security</string>
+    <string name="sms_security_check_limit_title">SMS message limit</string>
+    <string name="sms_security_check_limit_summary">Display an alert dialog to prevent applications from sending SMS messages too frequently. Current limit: %d messages in 15 minutes</string>
+    <string name="sms_security_check_limit_default">30 (Default)</string>
+
 </resources>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index dda22d9..e0fa6b1 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -56,7 +56,6 @@
         <item name="android:layout_width">match_parent</item>
     </style>
 
-
     <style name="TextAppearance" parent="android:TextAppearance">
     </style>
 
diff --git a/res/xml/development_prefs.xml b/res/xml/development_prefs.xml
index e67aad1..8ca9eca 100644
--- a/res/xml/development_prefs.xml
+++ b/res/xml/development_prefs.xml
@@ -57,6 +57,23 @@
             android:title="@string/enable_adb"
             android:summary="@string/enable_adb_summary"/>
 
+        <com.android.settings.HostnamePreference
+            android:key="device_hostname"
+            android:title="@string/device_hostname"
+            android:dialogTitle="@string/device_hostname"
+            android:positiveButtonText="@string/wifi_save"
+            android:negativeButtonText="@string/wifi_cancel"
+            android:selectAllOnFocus="true"
+            android:imeOptions="actionDone"
+            android:inputType="textNoSuggestions"
+            android:persistent="false" />
+
+        <CheckBoxPreference
+            android:key="adb_notify"
+            android:title="@string/adb_notify"
+            android:summary="@string/adb_notify_summary"
+            android:dependency="enable_adb"/>
+
         <CheckBoxPreference
             android:key="bugreport_in_power"
             android:title="@string/bugreport_in_power"
diff --git a/res/xml/device_info_settings.xml b/res/xml/device_info_settings.xml
index 03f1e78..068d5b0 100644
--- a/res/xml/device_info_settings.xml
+++ b/res/xml/device_info_settings.xml
@@ -18,11 +18,11 @@
         android:title="@string/about_settings">
 
         <!-- System update settings - launches activity -->
-        <PreferenceScreen android:key="system_update_settings"
+      <!--  <PreferenceScreen android:key="system_update_settings"
                 android:title="@string/system_update_settings_list_item_title" 
                 android:summary="@string/system_update_settings_list_item_summary">
             <intent android:action="android.settings.SYSTEM_UPDATE_SETTINGS" />
-        </PreferenceScreen>
+        </PreferenceScreen> -->
 
 
         <PreferenceScreen android:key="additional_system_update_settings"
@@ -73,7 +73,50 @@
             </PreferenceScreen>
 
         </PreferenceScreen>
-        
+
+        <PreferenceScreen
+            android:key="hardware_info"
+            android:title="@string/hardware_info">
+            <!-- Device chipset -->
+            <Preference android:key="device_chipset"
+                style="?android:preferenceInformationStyle"
+                android:title="@string/chipset_info"
+                android:summary="@string/device_info_default"/>
+
+            <!-- Device cpu info -->
+            <Preference android:key="device_cpu"
+                style="?android:preferenceInformationStyle"
+                android:title="@string/cpu_info"
+                android:summary="@string/device_info_default"/>
+
+            <!-- Device gpu info -->
+            <Preference android:key="device_gpu"
+                style="?android:preferenceInformationStyle"
+                android:title="@string/gpu_info"
+                android:summary="@string/device_info_default"/>
+
+            <!-- Device mem info -->
+            <Preference android:key="device_memory"
+                style="?android:preferenceInformationStyle"
+                android:title="@string/mem_info"
+                android:summary="@string/device_info_default"/>
+
+            <!-- Device rear camera -->
+            <Preference android:key="device_rear_camera"
+                style="?android:preferenceInformationStyle"
+                android:title="@string/device_rear_camera"/>
+
+            <!-- Device front camera -->
+            <Preference android:key="device_front_camera"
+                style="?android:preferenceInformationStyle"
+                android:title="@string/device_front_camera"/>
+
+            <!-- Device screen resolution -->
+            <Preference android:key="device_screen_resolution"
+                style="?android:preferenceInformationStyle"
+                android:title="@string/device_screen_resolution"/>
+        </PreferenceScreen>
+
         <PreferenceScreen
                 android:key="safetylegal"
                 android:title="@string/settings_safetylegal_title">
@@ -122,6 +165,12 @@
                 android:title="@string/kernel_version"
                 android:summary="@string/device_info_default"/>
 
+		<!-- Mod version -->
+        <Preference android:key="mod_version"
+                style="?android:preferenceInformationStyle"
+                android:title="@string/mod_version"
+                android:summary="@string/mod_version_default" />
+
         <!-- Detailed build version -->
         <Preference android:key="build_number" 
                 style="?android:preferenceInformationStyle"
diff --git a/res/xml/display_settings.xml b/res/xml/display_settings.xml
index d14446c..ae89dd3 100644
--- a/res/xml/display_settings.xml
+++ b/res/xml/display_settings.xml
@@ -58,6 +58,31 @@
             android:title="@string/notification_pulse_title"
             android:persistent="false" />
 
+				<PreferenceCategory android:title="@string/xenonhd_extras_title" />
+
+		<!-- Volume rocker wake -->
+        <CheckBoxPreference
+             android:key="pref_volume_wake"
+             android:title="@string/pref_volume_wake_title"
+             android:summary="@string/pref_volume_wake_summary"
+             android:defaultValue="false" />
+
+		<CheckBoxPreference
+            android:key="volbtn_music_controls"
+            android:title="@string/volbtn_music_controls_title"
+            android:summary="@string/volbtn_music_controls_summary"
+            android:persistent="false" />
+
+		<!-- Chronus -->
+    	<PreferenceScreen
+        	android:key="lock_clock"
+        	android:title="@string/lock_clock_title"
+        	android:summary="@string/lock_clock_summary">
+        <intent android:action="android.intent.action.MAIN"
+                android:targetPackage="com.cyanogenmod.lockclock"
+                android:targetClass="com.cyanogenmod.lockclock.preference.Preferences" />
+    	</PreferenceScreen>
+
         <PreferenceScreen
                 android:key="wifi_display"
                 android:title="@string/wifi_display_settings_title"
diff --git a/res/xml/ioscheduler_settings.xml b/res/xml/ioscheduler_settings.xml
new file mode 100644
index 0000000..600767e
--- /dev/null
+++ b/res/xml/ioscheduler_settings.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2012 The CyanogenMod 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"
+    android:title="@string/io_sched_title"
+    xmlns:settings="http://schemas.android.com/apk/res/com.android.settings">
+
+    <ListPreference
+        android:key="pref_io_sched"
+        android:dialogTitle="@string/io_sched_title"
+        android:title="@string/io_sched_title" />
+
+    <CheckBoxPreference
+        android:key="pref_io_sched_set_on_boot"
+        android:title="@string/io_sched_set_on_boot"
+        android:summary="@string/io_sched_set_on_boot_summary" />
+
+</PreferenceScreen>
diff --git a/res/xml/language_settings.xml b/res/xml/language_settings.xml
index f001486..f289675 100644
--- a/res/xml/language_settings.xml
+++ b/res/xml/language_settings.xml
@@ -67,6 +67,14 @@
                 android:persistent="false"/>
     </PreferenceCategory>
 
+	<ListPreference
+            android:key="volume_key_cursor_control"
+            android:persistent="false"
+            android:dialogTitle="@string/volume_key_cursor_control_title"
+            android:title="@string/volume_key_cursor_control_title"
+            android:entries="@array/volume_key_cursor_control_entries"
+            android:entryValues="@array/volume_key_cursor_control_values" />
+
     <PreferenceCategory android:key="voice_category"
             android:title="@string/voice_category" >
 
diff --git a/res/xml/memory_management.xml b/res/xml/memory_management.xml
new file mode 100644
index 0000000..187c815
--- /dev/null
+++ b/res/xml/memory_management.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2012 The CyanogenMod 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"
+    android:title="@string/memory_management_title"
+    xmlns:settings="http://schemas.android.com/apk/res/com.android.settings">
+
+    <ListPreference
+        android:key="pref_zram_size"
+        android:dialogTitle="@string/pref_zram_title"
+        android:title="@string/pref_zram_title"
+        android:summary="@string/pref_zram_summary"
+        android:entries="@array/pref_zram_size_entries"
+        android:entryValues="@array/pref_zram_size_values" />
+
+    <CheckBoxPreference
+        android:key="pref_purgeable_assets"
+        android:title="@string/pref_purgeable_assets_title"
+        android:summary="@string/pref_purgeable_assets_summary" />
+
+    <CheckBoxPreference
+        android:key="pref_ksm"
+        android:title="@string/pref_ksm_title"
+        android:summary="@string/pref_ksm_summary" />
+
+</PreferenceScreen>
diff --git a/res/xml/performance_settings.xml b/res/xml/performance_settings.xml
new file mode 100644
index 0000000..ef203e2
--- /dev/null
+++ b/res/xml/performance_settings.xml
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2012 The CyanogenMod 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"
+    android:title="@string/performance_settings_title"
+    xmlns:settings="http://schemas.android.com/apk/res/com.android.settings">
+
+    <PreferenceScreen
+        android:key="processor"
+        android:fragment="com.android.settings.performance.Processor"
+        android:title="@string/processor_title"
+        android:summary="@string/processor_summary" />
+
+    <PreferenceScreen
+        android:key="memory_management"
+        android:fragment="com.android.settings.performance.MemoryManagement"
+        android:title="@string/memory_management_title"
+        android:summary="@string/memory_management_summary" />
+
+    <PreferenceScreen
+        android:key="ioscheduler"
+        android:fragment="com.android.settings.performance.IOScheduler"
+        android:title="@string/io_sched_title"
+        android:summary="@string/io_scheds_summary" />
+
+    <PreferenceScreen
+        android:key="volt_control"
+        android:fragment="com.android.settings.performance.VoltageControlSettings"
+        android:title="@string/cpu_voltage"
+        android:summary="@string/cpu_voltage_summary" />
+
+    <CheckBoxPreference
+        android:key="pref_use_16bpp_alpha"
+        android:title="@string/pref_use_16bpp_alpha_title"
+        android:summary="@string/pref_use_16bpp_alpha_summary" />
+
+    <ListPreference
+        android:key="pref_use_dithering"
+        android:persistent="false"
+        android:dialogTitle="@string/pref_use_dithering_title"
+        android:title="@string/pref_use_dithering_title"
+        android:entries="@array/dithering_entries"
+        android:entryValues="@array/dithering_values" />
+
+</PreferenceScreen>
diff --git a/res/xml/processor_settings.xml b/res/xml/processor_settings.xml
new file mode 100644
index 0000000..8f22ff8
--- /dev/null
+++ b/res/xml/processor_settings.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2012 The CyanogenMod 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"
+    android:title="@string/processor_title"
+    xmlns:settings="http://schemas.android.com/apk/res/com.android.settings">
+
+    <Preference
+        android:key="pref_cpu_freq_cur"
+        style="?android:preferenceInformationStyle"
+        android:title="@string/cpu_cur_freq_title"
+        android:selectable="false" />
+
+    <ListPreference
+        android:key="pref_cpu_freq_max"
+        android:dialogTitle="@string/cpu_max_freq_title"
+        android:title="@string/cpu_max_freq_title" />
+
+    <ListPreference
+        android:key="pref_cpu_freq_min"
+        android:dialogTitle="@string/cpu_min_freq_title"
+        android:title="@string/cpu_min_freq_title" />
+
+    <ListPreference
+        android:key="pref_cpu_gov"
+        android:dialogTitle="@string/cpu_governors_title"
+        android:title="@string/cpu_governors_title" />
+
+    <CheckBoxPreference
+        android:key="pref_cpu_set_on_boot"
+        android:title="@string/cpu_set_on_boot"
+        android:summary="@string/cpu_set_on_boot_summary" />
+
+</PreferenceScreen>
diff --git a/res/xml/quiet_hours_settings.xml b/res/xml/quiet_hours_settings.xml
new file mode 100644
index 0000000..a7ae549
--- /dev/null
+++ b/res/xml/quiet_hours_settings.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Copyright (C) 2012 The CyanogenMod 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"
+    android:title="@string/quiet_hours_title"
+    xmlns:settings="http://schemas.android.com/apk/res/com.android.settings">
+
+    <CheckBoxPreference
+        android:key="quiet_hours_enabled"
+        android:title="@string/quiet_hours_enabled_title"
+        android:defaultValue="false" />
+
+    <com.android.settings.TimeRangePreference
+        android:key="quiet_hours_timerange"
+        android:dependency="quiet_hours_enabled" />
+
+    <CheckBoxPreference
+        android:key="quiet_hours_notifications"
+        android:title="@string/quiet_hours_notifications_title"
+        android:dependency="quiet_hours_enabled" />
+
+    <CheckBoxPreference
+        android:key="quiet_hours_ringer"
+        android:title="@string/quiet_hours_ringer_title"
+        android:dependency="quiet_hours_enabled" />
+
+    <CheckBoxPreference
+        android:key="quiet_hours_still"
+        android:title="@string/quiet_hours_still_title"
+        android:dependency="quiet_hours_enabled" />
+
+    <CheckBoxPreference
+        android:key="quiet_hours_dim"
+        android:title="@string/quiet_hours_dim_title"
+        android:dependency="quiet_hours_enabled" />
+
+</PreferenceScreen>
diff --git a/res/xml/security_settings_app_cyanogenmod.xml b/res/xml/security_settings_app_cyanogenmod.xml
new file mode 100644
index 0000000..8aaddcd
--- /dev/null
+++ b/res/xml/security_settings_app_cyanogenmod.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2012 The CyanogenMod 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:key="app_security"
+        android:title="@string/app_security_title">
+
+        <ListPreference
+            android:key="sms_security_check_limit"
+            android:dialogTitle="@string/sms_security_check_limit_title"
+            android:title="@string/sms_security_check_limit_title"
+            android:entries="@array/sms_security_check_limit_entries"
+            android:entryValues="@array/sms_security_check_limit_values"
+            android:defaultValue="30" />
+
+    </PreferenceCategory>
+
+</PreferenceScreen>
diff --git a/res/xml/security_settings_chooser.xml b/res/xml/security_settings_chooser.xml
index 60d3a9f..f1fd193 100644
--- a/res/xml/security_settings_chooser.xml
+++ b/res/xml/security_settings_chooser.xml
@@ -26,12 +26,30 @@
             android:summary="@string/unlock_set_unlock_mode_none"
             android:persistent="false"/>
 
+        <ListPreference
+            android:key="lock_after_timeout"
+            android:title="@string/lock_after_timeout"
+            android:summary="@string/lock_after_timeout_summary"
+            android:entries="@array/lock_after_timeout_entries"
+            android:entryValues="@array/lock_after_timeout_values"
+            android:persistent="false"/>
+
+        <CheckBoxPreference
+            android:key="power_button_instantly_locks"
+            android:title="@string/lockpattern_settings_enable_power_button_instantly_locks"/>
+
         <PreferenceScreen
             android:fragment="com.android.settings.OwnerInfoSettings"
             android:key="owner_info_settings"
             android:title="@string/owner_info_settings_title"
             android:summary="@string/owner_info_settings_summary"/>
 
+		<Preference
+		android:fragment="com.android.settings.th.LockscreenTargets"
+        android:key="lockscreen_targets"
+		android:summary="@string/lockscreen_target_summary"
+		android:title="@string/lockscreen_target_title" />
+
     </PreferenceCategory>
 
 </PreferenceScreen>
diff --git a/res/xml/security_settings_pattern_size.xml b/res/xml/security_settings_pattern_size.xml
new file mode 100644
index 0000000..458efb6
--- /dev/null
+++ b/res/xml/security_settings_pattern_size.xml
@@ -0,0 +1,36 @@
+<!-- Copyright (C) 2012 The CyanogenMod 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">
+    <PreferenceScreen
+        android:key="lock_pattern_size_3"
+        android:title="@string/lock_pattern_size_3"
+        android:persistent="false"/>
+
+    <PreferenceScreen
+        android:key="lock_pattern_size_4"
+        android:title="@string/lock_pattern_size_4"
+        android:persistent="false"/>
+
+    <PreferenceScreen
+        android:key="lock_pattern_size_5"
+        android:title="@string/lock_pattern_size_5"
+        android:persistent="false"/>
+
+    <PreferenceScreen
+        android:key="lock_pattern_size_6"
+        android:title="@string/lock_pattern_size_6"
+        android:persistent="false"/>
+</PreferenceScreen>
diff --git a/res/xml/settings_headers.xml b/res/xml/settings_headers.xml
index 05fa31f..d9a226d 100644
--- a/res/xml/settings_headers.xml
+++ b/res/xml/settings_headers.xml
@@ -57,6 +57,33 @@
         android:breadCrumbTitle="@string/wireless_networks_settings_title"
         android:fragment="com.android.settings.WirelessSettings"
         android:icon="@drawable/empty_icon" />
+	
+	<!-- Quick Links -->
+	<header android:title="@string/quick_links_title" />
+	
+	<!-- ROM Settings -->
+	<header android:icon="@drawable/ic_settings_rom_settings"
+            android:title="@string/rom_control_title">
+        <intent
+                android:action="android.intent.action.MAIN"
+                android:targetClass="com.aokp.romcontrol.ROMControlActivity"
+                android:targetPackage="com.aokp.romcontrol" />
+    </header>
+
+	<!-- Launcher -->
+    <header
+        android:id="@+id/launcher_settings"
+        android:title="@string/launcher_settings_title"
+        android:icon="@drawable/ic_settings_launcher" />
+
+	<!-- Theme chooser -->
+    <header android:icon="@drawable/ic_settings_themes"
+            android:title="@string/themes_title">
+        <intent
+                android:action="android.intent.action.MAIN"
+                android:targetPackage="com.tmobile.themechooser"
+                android:targetClass="com.tmobile.themechooser.ThemeChooser" />
+    </header>
 
     <!-- DEVICE -->
     <header android:id="@+id/device_section"
@@ -182,6 +209,13 @@
         android:icon="@drawable/ic_settings_development"
         android:title="@string/development_settings_title" />
 
+	<!-- Performance -->
+    <header
+        android:id="@+id/performance_settings"
+        android:fragment="com.android.settings.performance.PerformanceSettings"
+        android:icon="@drawable/ic_settings_performance"
+        android:title="@string/performance_settings_title" />
+
     <!-- About Device -->
     <header
         android:id="@+id/about_settings"
diff --git a/res/xml/sound_settings.xml b/res/xml/sound_settings.xml
index 26e2e20..ca2be90 100644
--- a/res/xml/sound_settings.xml
+++ b/res/xml/sound_settings.xml
@@ -26,6 +26,16 @@
             android:persistent="false"
             android:streamType="ring" />
 
+	<PreferenceScreen
+            android:key="quiet_hours"
+            android:fragment="com.android.settings.QuietHours"
+            android:title="@string/quiet_hours_title" />
+
+	<CheckBoxPreference
+			android:key="safe_headset_volume"
+			android:title="@string/safe_headset_volume_title"
+			android:defaultValue="true" />
+
     <Preference
             android:key="musicfx"
             android:title="@string/musicfx_title">
@@ -50,6 +60,28 @@
          android:title="@string/vibrate_when_ringing_title"
          android:persistent="false" />
 
+    <Preference
+            android:key="vibration"
+            android:title="@string/vibration_title"
+            android:dependency="vibrate_when_ringing"
+            android:persistent="false"
+            android:defaultValue="false" />
+
+    <com.android.settings.IncreasingRingPreference
+            android:key="increasing_ring"
+            android:title="@string/increasing_ring_title"
+            android:dialogTitle="@string/increasing_ring_title"
+            android:persistent="false"
+            android:streamType="ring" />
+
+	<PreferenceCategory
+            android:title="@string/headset_category_title"/>
+
+    <CheckBoxPreference
+            android:key="headset_connect_player"
+            android:title="@string/headset_connect_player_title"
+            android:persistent="false" />
+    
     <PreferenceCategory
             android:title="@string/sound_category_system_title"/>
 
@@ -82,6 +114,12 @@
             android:title="@string/haptic_feedback_enable_title"
             android:defaultValue="true" />
 
+    <CheckBoxPreference
+            android:key="volume_adjust_sounds"
+            android:title="@string/volume_adjust_sounds_enable_title"
+            android:summary="@string/volume_adjust_sounds_enable_summary"
+            android:persistent="true" />
+
     <ListPreference
             android:key="emergency_tone"
             android:title="@string/emergency_tone_title"
diff --git a/res/xml/voltage_settings.xml b/res/xml/voltage_settings.xml
new file mode 100644
index 0000000..8bd94a3
--- /dev/null
+++ b/res/xml/voltage_settings.xml
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="fill_parent"
+    android:layout_height="fill_parent">
+
+    <ListView
+        android:id="@+id/ListView"
+        android:layout_width="fill_parent"
+        android:layout_height="fill_parent"
+        android:cacheColorHint="#00000000"
+        android:layout_above="@+id/BottomBar">
+    </ListView>
+
+    <TextView
+        android:id="@+id/emptyList"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_centerInParent="true"
+        android:text="@string/not_supported"
+        android:visibility="gone" />
+
+    <LinearLayout
+        android:id="@+id/BottomBar"
+        android:layout_width="fill_parent"
+        android:layout_height="wrap_content"
+        android:layout_alignParentBottom="true"
+        android:orientation="horizontal"
+        android:gravity="center_horizontal">
+
+        <TextView
+            android:id="@+id/set_on_boot_voltage"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="@string/sob"
+            android:textSize="14sp"
+            android:layout_marginTop="10dip"
+            android:layout_marginLeft="10dip"
+            android:layout_marginRight="10dip"
+            android:gravity="center_vertical" />
+
+        <Switch
+            android:id="@+id/applyAtBoot"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="10dip" />
+
+        <Button
+            android:id="@+id/applyBtn"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="@string/apply_values"
+            android:layout_gravity="right"
+            android:layout_marginLeft="25dp"
+            android:layout_marginRight="10dip"
+            android:layout_marginBottom="10dip"
+            android:textSize="14sp"
+            android:paddingLeft="25dp"
+            android:paddingRight="25dp" />
+    </LinearLayout>
+</RelativeLayout>
diff --git a/res/xml/wireless_settings.xml b/res/xml/wireless_settings.xml
index 3cd72b3..fc1dd02 100644
--- a/res/xml/wireless_settings.xml
+++ b/res/xml/wireless_settings.xml
@@ -54,6 +54,13 @@
         android:key="android_beam_settings"
         android:title="@string/android_beam_settings_title" />
 
+    <ListPreference
+        android:key="nfc_polling_mode"
+        android:title="@string/nfc_polling_mode_title"
+        android:entries="@array/nfc_polling_mode_entries"
+        android:entryValues="@array/nfc_polling_mode_values"
+        android:persistent="false" />
+
     <PreferenceScreen
         android:key="mobile_network_settings"
         android:title="@string/network_settings_title"
diff --git a/src/com/android/settings/ChooseLockGeneric.java b/src/com/android/settings/ChooseLockGeneric.java
index 6854305..f191079 100644
--- a/src/com/android/settings/ChooseLockGeneric.java
+++ b/src/com/android/settings/ChooseLockGeneric.java
@@ -385,9 +385,7 @@
             } else if (quality == DevicePolicyManager.PASSWORD_QUALITY_SOMETHING) {
                 boolean showTutorial = !mChooseLockSettingsHelper.utils().isPatternEverChosen();
                 Intent intent = new Intent();
-                intent.setClass(getActivity(), showTutorial
-                        ? ChooseLockPatternTutorial.class
-                        : ChooseLockPattern.class);
+                intent.setClass(getActivity(), ChooseLockPatternSize.class);
                 intent.putExtra("key_lock_method", "pattern");
                 intent.putExtra(CONFIRM_CREDENTIALS, false);
                 intent.putExtra(LockPatternUtils.LOCKSCREEN_BIOMETRIC_WEAK_FALLBACK,
diff --git a/src/com/android/settings/ChooseLockPattern.java b/src/com/android/settings/ChooseLockPattern.java
index f9c01b6..b7c14dd 100644
--- a/src/com/android/settings/ChooseLockPattern.java
+++ b/src/com/android/settings/ChooseLockPattern.java
@@ -103,16 +103,12 @@
         private TextView mFooterRightButton;
         protected List<LockPatternView.Cell> mChosenPattern = null;
 
+        private byte mPatternSize = LockPatternUtils.PATTERN_SIZE_DEFAULT;
+
         /**
          * The patten used during the help screen to show how to draw a pattern.
          */
-        private final List<LockPatternView.Cell> mAnimatePattern =
-                Collections.unmodifiableList(Lists.newArrayList(
-                        LockPatternView.Cell.of(0, 0),
-                        LockPatternView.Cell.of(0, 1),
-                        LockPatternView.Cell.of(1, 1),
-                        LockPatternView.Cell.of(2, 1)
-                ));
+        private List<LockPatternView.Cell> mAnimatePattern;
 
         @Override
         public void onActivityResult(int requestCode, int resultCode,
@@ -307,6 +303,15 @@
         public View onCreateView(LayoutInflater inflater, ViewGroup container,
                 Bundle savedInstanceState) {
 
+            mPatternSize = getActivity().getIntent().getByteExtra("pattern_size", LockPatternUtils.PATTERN_SIZE_DEFAULT);
+            LockPatternView.Cell.updateSize(mPatternSize);
+            mAnimatePattern = Collections.unmodifiableList(Lists.newArrayList(
+                    LockPatternView.Cell.of(0, 0, mPatternSize),
+                    LockPatternView.Cell.of(0, 1, mPatternSize),
+                    LockPatternView.Cell.of(1, 1, mPatternSize),
+                    LockPatternView.Cell.of(2, 1, mPatternSize)
+                    ));
+
             // setupViews()
             View view = inflater.inflate(R.layout.choose_lock_pattern, null);
             mHeaderText = (TextView) view.findViewById(R.id.headerText);
@@ -314,6 +319,7 @@
             mLockPatternView.setOnPatternListener(mChooseNewLockPatternListener);
             mLockPatternView.setTactileFeedbackEnabled(
                     mChooseLockSettingsHelper.utils().isTactileFeedbackEnabled());
+            mLockPatternView.setLockPatternSize(mPatternSize);
 
             mFooterText = (TextView) view.findViewById(R.id.footerText);
 
@@ -351,7 +357,8 @@
                 // restore from previous state
                 final String patternString = savedInstanceState.getString(KEY_PATTERN_CHOICE);
                 if (patternString != null) {
-                    mChosenPattern = LockPatternUtils.stringToPattern(patternString);
+                    LockPatternUtils utils = mChooseLockSettingsHelper.utils();
+                    mChosenPattern = utils.stringToPattern(patternString);
                 }
                 updateStage(Stage.values()[savedInstanceState.getInt(KEY_UI_STAGE)]);
             }
@@ -417,8 +424,9 @@
 
             outState.putInt(KEY_UI_STAGE, mUiStage.ordinal());
             if (mChosenPattern != null) {
+                LockPatternUtils utils = mChooseLockSettingsHelper.utils();
                 outState.putString(KEY_PATTERN_CHOICE,
-                        LockPatternUtils.patternToString(mChosenPattern));
+                        utils.patternToString(mChosenPattern));
             }
         }
 
@@ -516,6 +524,7 @@
 
             final boolean isFallback = getActivity().getIntent()
                 .getBooleanExtra(LockPatternUtils.LOCKSCREEN_BIOMETRIC_WEAK_FALLBACK, false);
+            utils.setLockPatternSize(mPatternSize);
             utils.saveLockPattern(mChosenPattern, isFallback);
             utils.setLockPatternEnabled(true);
 
diff --git a/src/com/android/settings/ChooseLockPatternSize.java b/src/com/android/settings/ChooseLockPatternSize.java
new file mode 100644
index 0000000..f6f25c2
--- /dev/null
+++ b/src/com/android/settings/ChooseLockPatternSize.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 2012 The CyanogenMod 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.settings;
+
+import android.content.Intent;
+import android.os.Bundle;
+import android.preference.Preference;
+import android.preference.PreferenceActivity;
+import android.preference.PreferenceScreen;
+
+import com.android.internal.widget.LockPatternUtils;
+
+public class ChooseLockPatternSize extends PreferenceActivity {
+
+    @Override
+    public Intent getIntent() {
+        Intent modIntent = new Intent(super.getIntent());
+        modIntent.putExtra(EXTRA_SHOW_FRAGMENT, ChooseLockPatternSizeFragment.class.getName());
+        modIntent.putExtra(EXTRA_NO_HEADERS, true);
+        return modIntent;
+    }
+
+    public static class ChooseLockPatternSizeFragment extends SettingsPreferenceFragment {
+        private ChooseLockSettingsHelper mChooseLockSettingsHelper;
+
+        @Override
+        public void onCreate(Bundle savedInstanceState) {
+            super.onCreate(savedInstanceState);
+            mChooseLockSettingsHelper = new ChooseLockSettingsHelper(this.getActivity());
+            addPreferencesFromResource(R.xml.security_settings_pattern_size);
+        }
+
+        @Override
+        public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen,
+                Preference preference) {
+            final String key = preference.getKey();
+
+            byte patternSize;
+            if ("lock_pattern_size_4".equals(key)) {
+                patternSize = 4;
+            } else if ("lock_pattern_size_5".equals(key)) {
+                patternSize = 5;
+            } else if ("lock_pattern_size_6".equals(key)) {
+                patternSize = 6;
+            } else {
+                patternSize = 3;
+            }
+
+            final boolean isFallback = getActivity().getIntent()
+                .getBooleanExtra(LockPatternUtils.LOCKSCREEN_BIOMETRIC_WEAK_FALLBACK, false);
+            boolean showTutorial = !mChooseLockSettingsHelper.utils().isPatternEverChosen();
+
+            Intent intent = new Intent();
+            intent.setClass(getActivity(), showTutorial
+                    ? ChooseLockPatternTutorial.class
+                    : ChooseLockPattern.class);
+            intent.putExtra("pattern_size", patternSize);
+            intent.putExtra("key_lock_method", "pattern");
+            intent.putExtra("confirm_credentials", false);
+            intent.putExtra(LockPatternUtils.LOCKSCREEN_BIOMETRIC_WEAK_FALLBACK,
+                    isFallback);
+            intent.addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT);
+                    startActivity(intent);
+
+            finish();
+            return true;
+        }
+    }
+}
diff --git a/src/com/android/settings/ChooseLockPatternTutorial.java b/src/com/android/settings/ChooseLockPatternTutorial.java
index 5dbd616..66e40c1 100644
--- a/src/com/android/settings/ChooseLockPatternTutorial.java
+++ b/src/com/android/settings/ChooseLockPatternTutorial.java
@@ -57,12 +57,15 @@
         private View mSkipButton;
         private LockPatternView mPatternView;
 
+        private byte mPatternSize = LockPatternUtils.PATTERN_SIZE_DEFAULT;
+
         @Override
         public void onCreate(Bundle savedInstanceState) {
             super.onCreate(savedInstanceState);
             // Don't show the tutorial if the user has seen it before.
             LockPatternUtils lockPatternUtils = new LockPatternUtils(getActivity());
             if (savedInstanceState == null && lockPatternUtils.isPatternEverChosen()) {
+                mPatternSize = getActivity().getIntent().getByteExtra("pattern_size", LockPatternUtils.PATTERN_SIZE_DEFAULT);
                 Intent intent = new Intent(getActivity(), ChooseLockPattern.class);
                 intent.setFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT);
                 intent.putExtra("confirm_credentials", false);
@@ -70,6 +73,7 @@
                     .getBooleanExtra(LockPatternUtils.LOCKSCREEN_BIOMETRIC_WEAK_FALLBACK, false);
                 intent.putExtra(LockPatternUtils.LOCKSCREEN_BIOMETRIC_WEAK_FALLBACK,
                                 isFallback);
+                intent.putExtra("pattern_size", mPatternSize);
                 startActivity(intent);
                 getActivity().finish();
             }
@@ -84,13 +88,17 @@
             mSkipButton = view.findViewById(R.id.skip_button);
             mSkipButton.setOnClickListener(this);
 
+            mPatternSize = getActivity().getIntent().getByteExtra("pattern_size", LockPatternUtils.PATTERN_SIZE_DEFAULT);
+
             // Set up LockPatternView to be a non-interactive demo animation
-            mPatternView = (LockPatternView) view.findViewById(R.id.lockPattern);
+            LockPatternView.Cell.updateSize(mPatternSize);
             ArrayList<LockPatternView.Cell> demoPattern = new ArrayList<LockPatternView.Cell>();
-            demoPattern.add(LockPatternView.Cell.of(0,0));
-            demoPattern.add(LockPatternView.Cell.of(0,1));
-            demoPattern.add(LockPatternView.Cell.of(1,1));
-            demoPattern.add(LockPatternView.Cell.of(2,1));
+            demoPattern.add(LockPatternView.Cell.of(0,0, mPatternSize));
+            demoPattern.add(LockPatternView.Cell.of(0,1, mPatternSize));
+            demoPattern.add(LockPatternView.Cell.of(1,1, mPatternSize));
+            demoPattern.add(LockPatternView.Cell.of(2,1, mPatternSize));
+            mPatternView = (LockPatternView) view.findViewById(R.id.lockPattern);
+            mPatternView.setLockPatternSize(mPatternSize);
             mPatternView.setPattern(LockPatternView.DisplayMode.Animate, demoPattern);
             mPatternView.disableInput();
 
@@ -109,6 +117,7 @@
                 intent.addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT);
                 intent.putExtra(LockPatternUtils.LOCKSCREEN_BIOMETRIC_WEAK_FALLBACK,
                                 isFallback);
+                intent.putExtra("pattern_size", mPatternSize);
                 startActivity(intent);
                 getActivity().overridePendingTransition(0, 0); // no animation
                 getActivity().finish();
diff --git a/src/com/android/settings/ConfirmLockPattern.java b/src/com/android/settings/ConfirmLockPattern.java
index dd375cc..b2cd568 100644
--- a/src/com/android/settings/ConfirmLockPattern.java
+++ b/src/com/android/settings/ConfirmLockPattern.java
@@ -131,6 +131,7 @@
             }
 
             mLockPatternView.setTactileFeedbackEnabled(mLockPatternUtils.isTactileFeedbackEnabled());
+            mLockPatternView.setLockPatternSize(mLockPatternUtils.getLockPatternSize());
             mLockPatternView.setOnPatternListener(mConfirmExistingLockPatternListener);
             updateStage(Stage.NeedToUnlock);
 
@@ -262,7 +263,7 @@
 
                     Intent intent = new Intent();
                     intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_PASSWORD,
-                                    LockPatternUtils.patternToString(pattern));
+                                    mLockPatternUtils.patternToString(pattern));
 
                     getActivity().setResult(Activity.RESULT_OK, intent);
                     getActivity().finish();
diff --git a/src/com/android/settings/DevelopmentSettings.java b/src/com/android/settings/DevelopmentSettings.java
index aeedb0c..635fee4 100644
--- a/src/com/android/settings/DevelopmentSettings.java
+++ b/src/com/android/settings/DevelopmentSettings.java
@@ -86,6 +86,8 @@
     public static final String PREF_SHOW = "show";
 
     private static final String ENABLE_ADB = "enable_adb";
+    private static final String ADB_NOTIFY = "adb_notify";
+
     private static final String KEEP_SCREEN_ON = "keep_screen_on";
     private static final String ALLOW_MOCK_LOCATION = "allow_mock_location";
     private static final String HDCP_CHECKING_KEY = "hdcp_checking";
@@ -145,6 +147,7 @@
     private boolean mDontPokeProperties;
 
     private CheckBoxPreference mEnableAdb;
+    private CheckBoxPreference mAdbNotify;
     private Preference mBugreport;
     private CheckBoxPreference mBugreportInPower;
     private CheckBoxPreference mKeepScreenOn;
@@ -205,6 +208,7 @@
         addPreferencesFromResource(R.xml.development_prefs);
 
         mEnableAdb = findAndInitCheckboxPref(ENABLE_ADB);
+        mAdbNotify = findAndInitCheckboxPref(ADB_NOTIFY);
         mBugreport = findPreference(BUGREPORT);
         mBugreportInPower = findAndInitCheckboxPref(BUGREPORT_IN_POWER_KEY);
         mKeepScreenOn = findAndInitCheckboxPref(KEEP_SCREEN_ON);
@@ -390,6 +394,8 @@
         mHaveDebugSettings = false;
         updateCheckBox(mEnableAdb, Settings.Global.getInt(cr,
                 Settings.Global.ADB_ENABLED, 0) != 0);
+        mAdbNotify.setChecked(Settings.Secure.getInt(cr,
+                Settings.Secure.ADB_NOTIFY, 1) != 0);
         updateCheckBox(mBugreportInPower, Settings.Secure.getInt(cr,
                 Settings.Secure.BUGREPORT_IN_POWER_MENU, 0) != 0);
         updateCheckBox(mKeepScreenOn, Settings.Global.getInt(cr,
@@ -1013,6 +1019,10 @@
                 mVerifyAppsOverUsb.setChecked(false);
                 updateBugreportOptions();
             }
+        } else if (preference == mAdbNotify) {
+            Settings.Secure.putInt(getActivity().getContentResolver(),
+                    Settings.Secure.ADB_NOTIFY,
+                    mAdbNotify.isChecked() ? 1 : 0);
         } else if (preference == mBugreportInPower) {
             Settings.Secure.putInt(getActivity().getContentResolver(),
                     Settings.Secure.BUGREPORT_IN_POWER_MENU, 
diff --git a/src/com/android/settings/DeviceInfoSettings.java b/src/com/android/settings/DeviceInfoSettings.java
index a4abfea..2626f53 100644
--- a/src/com/android/settings/DeviceInfoSettings.java
+++ b/src/com/android/settings/DeviceInfoSettings.java
@@ -34,6 +34,7 @@
 import java.io.BufferedReader;
 import java.io.FileReader;
 import java.io.IOException;
+import java.io.InputStreamReader;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
@@ -43,6 +44,8 @@
 
     private static final String FILENAME_PROC_VERSION = "/proc/version";
     private static final String FILENAME_MSV = "/sys/board_properties/soc/msv";
+    private static final String FILENAME_PROC_MEMINFO = "/proc/meminfo";
+    private static final String FILENAME_PROC_CPUINFO = "/proc/cpuinfo";
 
     private static final String KEY_CONTAINER = "container";
     private static final String KEY_TEAM = "team";
@@ -56,6 +59,7 @@
     private static final String PROPERTY_SELINUX_STATUS = "ro.build.selinux";
     private static final String KEY_KERNEL_VERSION = "kernel_version";
     private static final String KEY_BUILD_NUMBER = "build_number";
+	private static final String KEY_MOD_VERSION = "mod_version";
     private static final String KEY_DEVICE_MODEL = "device_model";
     private static final String KEY_SELINUX_STATUS = "selinux_status";
     private static final String KEY_BASEBAND_VERSION = "baseband_version";
@@ -66,6 +70,14 @@
 
     static final int TAPS_TO_BE_A_DEVELOPER = 7;
 
+    private static final String KEY_DEVICE_CHIPSET = "device_chipset";
+    private static final String KEY_DEVICE_CPU = "device_cpu";
+    private static final String KEY_DEVICE_GPU = "device_gpu";
+    private static final String KEY_DEVICE_MEMORY = "device_memory";
+    private static final String KEY_DEVICE_REAR_CAMERA = "device_rear_camera";
+    private static final String KEY_DEVICE_FRONT_CAMERA = "device_front_camera";
+    private static final String KEY_DEVICE_SCREEN_RESOLUTION = "device_screen_resolution";
+
     long[] mHits = new long[3];
     int mDevHitCountdown;
     Toast mDevHitToast;
@@ -85,6 +97,8 @@
         setStringSummary(KEY_BUILD_NUMBER, Build.DISPLAY);
         findPreference(KEY_BUILD_NUMBER).setEnabled(true);
         findPreference(KEY_KERNEL_VERSION).setSummary(getFormattedKernelVersion());
+		setValueSummary(KEY_MOD_VERSION, "ro.modversion");
+		findPreference(KEY_MOD_VERSION).setEnabled(true);
 
         if (!SELinux.isSELinuxEnabled()) {
             String status = getResources().getString(R.string.selinux_status_disabled);
@@ -98,6 +112,20 @@
         removePreferenceIfPropertyMissing(getPreferenceScreen(), KEY_SELINUX_STATUS,
                 PROPERTY_SELINUX_STATUS);
 
+        addStringPreference(KEY_DEVICE_CHIPSET,
+                SystemProperties.get("ro.device.chipset", null));
+        addStringPreference(KEY_DEVICE_CPU,
+                SystemProperties.get("ro.device.cpu", getCPUInfo()));
+        addStringPreference(KEY_DEVICE_GPU,
+                SystemProperties.get("ro.device.gpu", null));
+        addStringPreference(KEY_DEVICE_MEMORY, getMemInfo());
+        addStringPreference(KEY_DEVICE_FRONT_CAMERA,
+                SystemProperties.get("ro.device.front_cam", null));
+        addStringPreference(KEY_DEVICE_REAR_CAMERA,
+                SystemProperties.get("ro.device.rear_cam", null));
+        addStringPreference(KEY_DEVICE_SCREEN_RESOLUTION,
+                SystemProperties.get("ro.device.screen_res", null));
+
         // Remove Safety information preference if PROPERTY_URL_SAFETYLEGAL is not set
         removePreferenceIfPropertyMissing(getPreferenceScreen(), "safetylegal",
                 PROPERTY_URL_SAFETYLEGAL);
@@ -186,6 +214,20 @@
                     mDevHitToast = Toast.makeText(getActivity(), R.string.show_dev_on,
                             Toast.LENGTH_LONG);
                     mDevHitToast.show();
+				} else if (preference.getKey().equals(KEY_MOD_VERSION)) {
+            System.arraycopy(mHits, 1, mHits, 0, mHits.length-1);
+            mHits[mHits.length-1] = SystemClock.uptimeMillis();
+            if (mHits[0] >= (SystemClock.uptimeMillis()-500)) {
+                Intent intent = new Intent(Intent.ACTION_MAIN);
+                intent.putExtra("is_cid", true);
+                intent.setClassName("android",
+                        com.android.internal.app.PlatLogoActivity.class.getName());
+                try {
+                    startActivity(intent);
+                } catch (Exception e) {
+                    Log.e(LOG_TAG, "Unable to start activity " + intent.toString());
+                }
+            }
                 } else if (mDevHitCountdown > 0
                         && mDevHitCountdown < (TAPS_TO_BE_A_DEVELOPER-2)) {
                     if (mDevHitToast != null) {
@@ -325,4 +367,52 @@
         }
         return "";
     }
+
+    private String getMemInfo() {
+        String result = null;
+        BufferedReader reader = null;
+
+        try {
+            /* /proc/meminfo entries follow this format:
+             * MemTotal:         362096 kB
+             * MemFree:           29144 kB
+             * Buffers:            5236 kB
+             * Cached:            81652 kB
+             */
+            String firstLine = readLine(FILENAME_PROC_MEMINFO);
+            if (firstLine != null) {
+                String parts[] = firstLine.split("\\s+");
+                if (parts.length == 3) {
+                    result = Long.parseLong(parts[1])/1024 + " MB";
+                }
+            }
+        } catch (IOException e) {}
+
+        return result;
+    }
+
+    private String getCPUInfo() {
+        String result = null;
+
+        try {
+            /* The expected /proc/cpuinfo output is as follows:
+             * Processor	: ARMv7 Processor rev 2 (v7l)
+             * BogoMIPS	: 272.62
+             */
+            String firstLine = readLine(FILENAME_PROC_CPUINFO);
+            if (firstLine != null) {
+                result = firstLine.split(":")[1].trim();
+            }
+        } catch (IOException e) {}
+
+        return result;
+    }
+
+    private void addStringPreference(String key, String value) {
+        if (value != null) {
+            setStringSummary(key, value);
+        } else {
+            getPreferenceScreen().removePreference(findPreference(key));
+        }
+    }
 }
diff --git a/src/com/android/settings/DisplaySettings.java b/src/com/android/settings/DisplaySettings.java
index fb839a7..1f6e6e8 100644
--- a/src/com/android/settings/DisplaySettings.java
+++ b/src/com/android/settings/DisplaySettings.java
@@ -26,13 +26,16 @@
 import android.content.Context;
 import android.content.Intent;
 import android.content.IntentFilter;
+import android.content.pm.PackageManager.NameNotFoundException;
 import android.content.res.Configuration;
 import android.content.res.Resources;
+import android.database.ContentObserver;
 import android.hardware.display.DisplayManager;
 import android.hardware.display.WifiDisplay;
 import android.hardware.display.WifiDisplayStatus;
 import android.os.Bundle;
 import android.os.RemoteException;
+import android.os.Handler;
 import android.preference.CheckBoxPreference;
 import android.preference.ListPreference;
 import android.preference.Preference;
@@ -48,6 +51,9 @@
 
 import java.util.ArrayList;
 
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
 public class DisplaySettings extends SettingsPreferenceFragment implements
         Preference.OnPreferenceChangeListener, OnPreferenceClickListener {
     private static final String TAG = "DisplaySettings";
@@ -61,6 +67,9 @@
     private static final String KEY_NOTIFICATION_PULSE = "notification_pulse";
     private static final String KEY_SCREEN_SAVER = "screensaver";
     private static final String KEY_WIFI_DISPLAY = "wifi_display";
+	private static final String KEY_VOLUME_WAKE = "pref_volume_wake";
+	private static final String KEY_VOLBTN_MUSIC_CTRL = "volbtn_music_controls";
+	private static final String KEY_LOCK_CLOCK = "lock_clock";
 
     private static final int DLG_GLOBAL_CHANGE_WARNING = 1;
 
@@ -69,6 +78,8 @@
     private CheckBoxPreference mAccelerometer;
     private WarnedListPreference mFontSizePref;
     private CheckBoxPreference mNotificationPulse;
+	private CheckBoxPreference mVolumeWake;
+	private CheckBoxPreference mVolBtnMusicCtrl;
 
     private final Configuration mCurConfig = new Configuration();
     
@@ -108,6 +119,10 @@
             getPreferenceScreen().removePreference(mScreenSaverPreference);
         }
         
+		mVolBtnMusicCtrl = (CheckBoxPreference) findPreference(KEY_VOLBTN_MUSIC_CTRL);
+        mVolBtnMusicCtrl.setChecked(Settings.System.getInt(resolver,
+                Settings.System.VOLBTN_MUSIC_CONTROLS, 1) != 0);
+
         mScreenTimeoutPreference = (ListPreference) findPreference(KEY_SCREEN_TIMEOUT);
         final long currentTimeout = Settings.System.getLong(resolver, SCREEN_OFF_TIMEOUT,
                 FALLBACK_SCREEN_TIMEOUT_VALUE);
@@ -142,8 +157,17 @@
                 == WifiDisplayStatus.FEATURE_STATE_UNAVAILABLE) {
             getPreferenceScreen().removePreference(mWifiDisplayPreference);
             mWifiDisplayPreference = null;
+
+		// Dont display the lock clock preference if its not installed
+        removePreferenceIfPackageNotInstalled(findPreference(KEY_LOCK_CLOCK));
+
+		mVolumeWake = (CheckBoxPreference) findPreference(KEY_VOLUME_WAKE);
+            if (mVolumeWake != null) {
+                mVolumeWake.setChecked(Settings.System.getInt(resolver,
+                    Settings.System.VOLUME_WAKE_SCREEN, 0) == 1);
+                }
+            }
         }
-    }
 
     private void updateTimeoutPreferenceDescription(long currentTimeout) {
         ListPreference preference = mScreenTimeoutPreference;
@@ -335,6 +359,14 @@
             boolean value = mNotificationPulse.isChecked();
             Settings.System.putInt(getContentResolver(), Settings.System.NOTIFICATION_LIGHT_PULSE,
                     value ? 1 : 0);
+
+		} else if (preference == mVolBtnMusicCtrl) {
+                Settings.System.putInt(getContentResolver(), Settings.System.VOLBTN_MUSIC_CONTROLS,
+                        mVolBtnMusicCtrl.isChecked() ? 1 : 0);
+
+		} else if (preference == mVolumeWake) {
+            Settings.System.putInt(getContentResolver(), Settings.System.VOLUME_WAKE_SCREEN,
+                    mVolumeWake.isChecked() ? 1 : 0);
             return true;
         }
         return super.onPreferenceTreeClick(preferenceScreen, preference);
@@ -369,6 +401,24 @@
         }
     };
 
+	private boolean removePreferenceIfPackageNotInstalled(Preference preference) {
+        String intentUri = ((PreferenceScreen) preference).getIntent().toUri(1);
+        Pattern pattern = Pattern.compile("component=([^/]+)/");
+        Matcher matcher = pattern.matcher(intentUri);
+
+        String packageName = matcher.find() ? matcher.group(1) : null;
+        if (packageName != null) {
+            try {
+                getPackageManager().getPackageInfo(packageName, 0);
+            } catch (NameNotFoundException e) {
+                Log.e(TAG, "package " + packageName + " not installed, hiding preference.");
+                getPreferenceScreen().removePreference(preference);
+                return true;
+            }
+        }
+        return false;
+    }
+
     @Override
     public boolean onPreferenceClick(Preference preference) {
         if (preference == mFontSizePref) {
diff --git a/src/com/android/settings/HostnamePreference.java b/src/com/android/settings/HostnamePreference.java
new file mode 100644
index 0000000..e44ea17
--- /dev/null
+++ b/src/com/android/settings/HostnamePreference.java
@@ -0,0 +1,111 @@
+package com.android.settings;
+
+import android.content.Context;
+import android.os.SystemProperties;
+import android.preference.EditTextPreference;
+import android.provider.Settings;
+import android.text.InputFilter;
+import android.text.Spanned;
+import android.util.AttributeSet;
+import android.util.Log;
+
+public class HostnamePreference extends EditTextPreference {
+
+    private static final String TAG = "HostnamePreference";
+
+    private static final String PROP_HOSTNAME = "net.hostname";
+
+    private final String DEFAULT_HOSTNAME;
+
+    InputFilter mHostnameInputFilter = new InputFilter() {
+        @Override
+        public CharSequence filter(CharSequence source, int start, int end,
+                Spanned dest, int dstart, int dend) {
+
+            if (source.length() == 0)
+                return null;
+
+            // remove any character that is not alphanumeric, period, or hyphen
+            return source.subSequence(start, end).toString().replaceAll("[^-.a-zA-Z0-9]", "");
+        }
+    };
+
+    public HostnamePreference(Context context, AttributeSet attrs, int defStyle) {
+        super(context, attrs, defStyle);
+
+        // determine the default hostname
+        String id = Settings.Secure.getString(getContext().getContentResolver(),
+                Settings.Secure.ANDROID_ID);
+        if (id != null && id.length() > 0) {
+            DEFAULT_HOSTNAME =  "android-".concat(id);
+        } else {
+            DEFAULT_HOSTNAME = "";
+        }
+
+        setSummary(getText());
+        getEditText().setFilters(new InputFilter[] { mHostnameInputFilter });
+        getEditText().setHint(DEFAULT_HOSTNAME);
+    }
+
+    public HostnamePreference(Context context, AttributeSet attrs) {
+        this(context, attrs, com.android.internal.R.attr.editTextPreferenceStyle);
+    }
+
+    public HostnamePreference(Context context) {
+        this(context, null);
+    }
+
+    @Override
+    protected void onDialogClosed(boolean positiveResult) {
+        if (positiveResult) {
+            String hostname = getEditText().getText().toString();
+
+            // remove any preceding or succeeding periods or hyphens
+            hostname = hostname.replaceAll("(?:\\.|-)+$", "");
+            hostname = hostname.replaceAll("^(?:\\.|-)+", "");
+
+            if (hostname.length() == 0) {
+                if (DEFAULT_HOSTNAME.length() != 0) {
+                    // if no hostname is given, use the default
+                    hostname = DEFAULT_HOSTNAME;
+                } else {
+                    // if no other name can be determined
+                    // fall back on the current hostname
+                    hostname = getText();
+                }
+            }
+            setText(hostname);
+        }
+    }
+
+    @Override
+    public void setText(String text) {
+        if (text == null) {
+            Log.e(TAG, "tried to set null hostname, request ignored");
+            return;
+        } else if (text.length() == 0) {
+            Log.w(TAG, "setting empty hostname");
+        } else {
+            Log.i(TAG, "hostname has been set: " + text);
+        }
+        SystemProperties.set(PROP_HOSTNAME, text);
+        persistHostname(text);
+        setSummary(text);
+    }
+
+    @Override
+    public String getText() {
+        return SystemProperties.get(PROP_HOSTNAME);
+    }
+
+    @Override
+    public void onSetInitialValue(boolean restoreValue, Object defaultValue) {
+        String hostname = getText();
+        persistHostname(hostname);
+    }
+
+    public void persistHostname(String hostname) {
+        Settings.Secure.putString(getContext().getContentResolver(),
+                Settings.Secure.DEVICE_HOSTNAME, hostname);
+    }
+}
diff --git a/src/com/android/settings/IncreasingRingPreference.java b/src/com/android/settings/IncreasingRingPreference.java
new file mode 100644
index 0000000..fbf83ae
--- /dev/null
+++ b/src/com/android/settings/IncreasingRingPreference.java
@@ -0,0 +1,211 @@
+/*
+ * 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.
+ */
+
+package com.android.settings;
+
+import android.app.Dialog;
+import android.content.Context;
+import android.content.ContentResolver;
+import android.media.AudioManager;
+import android.os.Parcel;
+import android.os.Parcelable;
+import android.preference.VolumePreference;
+import android.provider.Settings;
+import android.util.AttributeSet;
+import android.view.MotionEvent;
+import android.view.View;
+import android.widget.CheckBox;
+import android.widget.CompoundButton;
+import android.widget.SeekBar;
+import android.widget.Spinner;
+import android.widget.TextView;
+
+public class IncreasingRingPreference extends VolumePreference implements
+        CheckBox.OnCheckedChangeListener {
+    private static final String TAG = "IncreasingRingPreference";
+
+    private CheckBox mEnabledCheckbox;
+
+    private TextView mMinVolumeTitle;
+    private SeekBar mMinVolumeSeekBar;
+    private TextView mRingVolumeNotice;
+
+    private TextView mIntervalTitle;
+    private Spinner mInterval;
+    private int[] mIntervalValues;
+
+    public IncreasingRingPreference(Context context, AttributeSet attrs) {
+        super(context, attrs);
+
+        setStreamType(AudioManager.STREAM_RING);
+
+        setDialogLayoutResource(R.layout.preference_dialog_increasing_ring);
+        setDialogIcon(R.drawable.ic_settings_sound);
+    }
+
+    @Override
+    protected void onBindDialogView(View view) {
+        super.onBindDialogView(view);
+
+        ContentResolver cr = getContext().getContentResolver();
+
+        mEnabledCheckbox = (CheckBox) view.findViewById(R.id.increasing_ring);
+        mMinVolumeTitle = (TextView) view.findViewById(R.id.increasing_ring_min_volume_title);
+        mMinVolumeSeekBar = (SeekBar) view.findViewById(com.android.internal.R.id.seekbar);
+        mRingVolumeNotice = (TextView) view.findViewById(R.id.increasing_ring_volume_notice);
+        mIntervalTitle = (TextView) view.findViewById(R.id.increasing_ring_interval_title);
+        mInterval = (Spinner) view.findViewById(R.id.increasing_ring_interval);
+        mIntervalValues = getContext().getResources().getIntArray(R.array.increasing_ring_interval_values);
+
+        mEnabledCheckbox.setOnCheckedChangeListener(this);
+        mEnabledCheckbox.setChecked(Settings.System.getInt(cr, Settings.System.INCREASING_RING, 0) == 1);
+        mMinVolumeSeekBar.setProgress(Settings.System.getInt(
+                    cr, Settings.System.INCREASING_RING_MIN_VOLUME, 1));
+        int interval = Settings.System.getInt(cr, Settings.System.INCREASING_RING_INTERVAL, 0);
+        int index = 0;
+
+        for (int i = 0; i < mIntervalValues.length; i++) {
+            if (mIntervalValues[i] == interval) {
+                index = i;
+                break;
+            }
+        }
+        mInterval.setSelection(index);
+
+        AudioManager am = (AudioManager) getContext().getSystemService(Context.AUDIO_SERVICE);
+        mMinVolumeSeekBar.setSecondaryProgress(am.getStreamVolume(AudioManager.STREAM_RING));
+
+        updateVolumeNoticeVisibility(mMinVolumeSeekBar.getProgress());
+        updateEnabledStates();
+    }
+
+    @Override
+    protected void onDialogClosed(boolean positiveResult) {
+        super.onDialogClosed(false);
+
+        if (positiveResult) {
+            boolean checked = mEnabledCheckbox.isChecked();
+            ContentResolver cr = getContext().getContentResolver();
+
+            Settings.System.putInt(cr, Settings.System.INCREASING_RING, checked ? 1 : 0);
+            Settings.System.putInt(cr, Settings.System.INCREASING_RING_INTERVAL,
+                    mIntervalValues[mInterval.getSelectedItemPosition()]);
+            Settings.System.putInt(cr,
+                    Settings.System.INCREASING_RING_MIN_VOLUME,
+                    mMinVolumeSeekBar.getProgress());
+        }
+    }
+
+    public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+        updateVolumeNoticeVisibility(mMinVolumeSeekBar.getProgress());
+        updateEnabledStates();
+    }
+
+    @Override
+    public boolean onVolumeChange(SeekBarVolumizer volumizer, int value) {
+        boolean result = super.onVolumeChange(volumizer, value);
+        if (result) {
+            updateVolumeNoticeVisibility(value);
+        }
+        return result;
+    }
+
+    private void updateVolumeNoticeVisibility(int value) {
+        boolean visible = value > mMinVolumeSeekBar.getSecondaryProgress();
+        if (!mEnabledCheckbox.isChecked()) {
+            visible = false;
+        }
+        mRingVolumeNotice.setVisibility(visible ? View.VISIBLE : View.GONE);
+    }
+
+    private void updateEnabledStates() {
+        boolean enable = mEnabledCheckbox.isChecked();
+        mMinVolumeTitle.setEnabled(enable);
+        mMinVolumeSeekBar.setEnabled(enable);
+        mRingVolumeNotice.setEnabled(enable);
+        mIntervalTitle.setEnabled(enable);
+        mInterval.setEnabled(enable);
+    }
+
+    @Override
+    protected Parcelable onSaveInstanceState() {
+        final Parcelable superState = super.onSaveInstanceState();
+        if (isPersistent()) {
+            // No need to save instance state since it's persistent
+            return superState;
+        }
+
+        final SavedState myState = new SavedState(superState);
+        if (mEnabledCheckbox != null) {
+            myState.mEnabled = mEnabledCheckbox.isChecked();
+        }
+        if (mInterval != null) {
+            myState.mIntervalSelection = mInterval.getSelectedItemPosition();
+        }
+        return myState;
+    }
+
+    @Override
+    protected void onRestoreInstanceState(Parcelable state) {
+        if (state == null || !state.getClass().equals(SavedState.class)) {
+            // Didn't save state for us in onSaveInstanceState
+            super.onRestoreInstanceState(state);
+            return;
+        }
+
+        SavedState myState = (SavedState) state;
+        super.onRestoreInstanceState(myState.getSuperState());
+        if (mEnabledCheckbox != null) {
+            mEnabledCheckbox.setChecked(myState.mEnabled);
+        }
+        if (mInterval != null) {
+            mInterval.setSelection(myState.mIntervalSelection);
+        }
+    }
+
+    private static class SavedState extends BaseSavedState {
+        boolean mEnabled;
+        int mIntervalSelection;
+
+        public SavedState(Parcel source) {
+            super(source);
+            mEnabled = source.readInt() != 0;
+            mIntervalSelection = source.readInt();
+        }
+
+        @Override
+        public void writeToParcel(Parcel dest, int flags) {
+            super.writeToParcel(dest, flags);
+            dest.writeInt(mEnabled ? 1 : 0);
+            dest.writeInt(mIntervalSelection);
+        }
+
+        public SavedState(Parcelable superState) {
+            super(superState);
+        }
+
+        public static final Parcelable.Creator<SavedState> CREATOR =
+                new Parcelable.Creator<SavedState>() {
+            public SavedState createFromParcel(Parcel in) {
+                return new SavedState(in);
+            }
+
+            public SavedState[] newArray(int size) {
+                return new SavedState[size];
+            }
+        };
+    }
+}
\ No newline at end of file
diff --git a/src/com/android/settings/QuietHours.java b/src/com/android/settings/QuietHours.java
new file mode 100644
index 0000000..7e514a7
--- /dev/null
+++ b/src/com/android/settings/QuietHours.java
@@ -0,0 +1,134 @@
+/*
+ * Copyright (C) 2012 The CyanogenMod 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.settings;
+
+import android.content.ContentResolver;
+import android.os.Bundle;
+import android.preference.CheckBoxPreference;
+import android.preference.Preference;
+import android.preference.PreferenceScreen;
+import android.provider.Settings;
+
+import com.android.settings.R;
+import com.android.settings.SettingsPreferenceFragment;
+
+public class QuietHours extends SettingsPreferenceFragment implements
+        Preference.OnPreferenceChangeListener  {
+
+    private static final String TAG = "QuietHours";
+
+    private static final String KEY_QUIET_HOURS_ENABLED = "quiet_hours_enabled";
+
+    private static final String KEY_QUIET_HOURS_NOTIFICATIONS = "quiet_hours_notifications";
+    
+    private static final String KEY_QUIET_HOURS_RINGER = "quiet_hours_ringer";
+
+    private static final String KEY_QUIET_HOURS_STILL = "quiet_hours_still";
+
+    private static final String KEY_QUIET_HOURS_DIM = "quiet_hours_dim";
+
+    private static final String KEY_QUIET_HOURS_TIMERANGE = "quiet_hours_timerange";
+
+    private CheckBoxPreference mQuietHoursEnabled;
+
+    private CheckBoxPreference mQuietHoursNotifications;
+    
+    private CheckBoxPreference mQuietHoursRinger;
+
+    private CheckBoxPreference mQuietHoursStill;
+
+    private CheckBoxPreference mQuietHoursDim;
+
+    private TimeRangePreference mQuietHoursTimeRange;
+
+    @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+
+        if (getPreferenceManager() != null) {
+            addPreferencesFromResource(R.xml.quiet_hours_settings);
+
+            ContentResolver resolver = getActivity().getApplicationContext().getContentResolver();
+
+            PreferenceScreen prefSet = getPreferenceScreen();
+
+            // Load the preferences
+            mQuietHoursEnabled = (CheckBoxPreference) prefSet.findPreference(KEY_QUIET_HOURS_ENABLED);
+            mQuietHoursTimeRange = (TimeRangePreference) prefSet.findPreference(KEY_QUIET_HOURS_TIMERANGE);
+            mQuietHoursNotifications = (CheckBoxPreference) prefSet.findPreference(KEY_QUIET_HOURS_NOTIFICATIONS);
+            mQuietHoursRinger = (CheckBoxPreference) prefSet.findPreference(KEY_QUIET_HOURS_RINGER);
+            mQuietHoursStill = (CheckBoxPreference) prefSet.findPreference(KEY_QUIET_HOURS_STILL);
+            mQuietHoursDim = (CheckBoxPreference) findPreference(KEY_QUIET_HOURS_DIM);
+
+            // Set the preference state and listeners where applicable
+            mQuietHoursEnabled.setChecked(Settings.System.getInt(resolver, Settings.System.QUIET_HOURS_ENABLED, 0) == 1);
+            mQuietHoursTimeRange.setTimeRange(Settings.System.getInt(resolver, Settings.System.QUIET_HOURS_START, 0),
+                    Settings.System.getInt(resolver, Settings.System.QUIET_HOURS_END, 0));
+            mQuietHoursTimeRange.setOnPreferenceChangeListener(this);
+            mQuietHoursNotifications.setChecked(Settings.System.getInt(resolver, Settings.System.QUIET_HOURS_NOTIFICATIONS, 0) == 1);
+            mQuietHoursRinger.setChecked(Settings.System.getInt(resolver, Settings.System.QUIET_HOURS_RINGER, 0) == 1);
+            mQuietHoursStill.setChecked(Settings.System.getInt(resolver, Settings.System.QUIET_HOURS_STILL, 0) == 1);
+
+            // Remove the notification light setting if the device does not support it 
+            if (mQuietHoursDim != null && getResources().getBoolean(com.android.internal.R.bool.config_intrusiveNotificationLed) == false) {
+                getPreferenceScreen().removePreference(mQuietHoursDim);
+            } else {
+                mQuietHoursDim.setChecked(Settings.System.getInt(resolver, Settings.System.QUIET_HOURS_DIM, 0) == 1);
+            }
+        }
+    }
+
+    @Override
+    public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
+        ContentResolver resolver = getActivity().getApplicationContext().getContentResolver();
+
+        if (preference == mQuietHoursEnabled) {
+            Settings.System.putInt(resolver, Settings.System.QUIET_HOURS_ENABLED,
+                    mQuietHoursEnabled.isChecked() ? 1 : 0);
+            return true;
+        } else if (preference == mQuietHoursNotifications) {
+            Settings.System.putInt(resolver, Settings.System.QUIET_HOURS_NOTIFICATIONS,
+                    mQuietHoursNotifications.isChecked() ? 1 : 0);
+            return true;
+        } else if (preference == mQuietHoursRinger) {
+            Settings.System.putInt(resolver, Settings.System.QUIET_HOURS_RINGER,
+                    mQuietHoursRinger.isChecked() ? 1 : 0);
+            return true;
+        } else if (preference == mQuietHoursStill) {
+            Settings.System.putInt(resolver, Settings.System.QUIET_HOURS_STILL,
+                    mQuietHoursStill.isChecked() ? 1 : 0);
+            return true;
+        } else if (preference == mQuietHoursDim) {
+            Settings.System.putInt(resolver, Settings.System.QUIET_HOURS_DIM,
+                    mQuietHoursDim.isChecked() ? 1 : 0);
+            return true;
+        }
+        return super.onPreferenceTreeClick(preferenceScreen, preference);
+    }
+
+    public boolean onPreferenceChange(Preference preference, Object newValue) {
+        ContentResolver resolver = getActivity().getApplicationContext().getContentResolver();
+        if (preference == mQuietHoursTimeRange) {
+            Settings.System.putInt(resolver, Settings.System.QUIET_HOURS_START,
+                    mQuietHoursTimeRange.getStartTime());
+            Settings.System.putInt(resolver, Settings.System.QUIET_HOURS_END,
+                    mQuietHoursTimeRange.getEndTime());
+            return true;
+        }
+        return false;
+    }
+}
diff --git a/src/com/android/settings/RingerVolumePreference.java b/src/com/android/settings/RingerVolumePreference.java
index 954213d..d47ae95 100644
--- a/src/com/android/settings/RingerVolumePreference.java
+++ b/src/com/android/settings/RingerVolumePreference.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008 The Android Open Source Project
+ , * 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.
@@ -197,15 +197,66 @@
             getContext().registerReceiver(mRingModeChangedReceiver, filter);
         }
 
-        // Disable either ringer+notifications or notifications
-        int id;
-        if (!Utils.isVoiceCapable(getContext())) {
-            id = R.id.ringer_section;
+        // Separate ringtone and notification streams
+        final CheckBox linkCheckBox = (CheckBox) view.findViewById(R.id.link_ring_and_volume);
+        final CheckBox linkMuteStates = (CheckBox) view.findViewById(R.id.link_mutes);
+        final View ringerSection = view.findViewById(R.id.ringer_section);
+        final View notificationSection = view.findViewById(R.id.notification_section);
+        if (Utils.isVoiceCapable(getContext())) {
+            if ((getCurrentMutableStreams(getContext()) & AudioSystem.STREAM_NOTIFICATION) != 0) {
+                linkMuteStates.setChecked(true);
+            } else {
+                linkMuteStates.setChecked(false);
+            }
+
+            linkMuteStates.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+                @Override
+                public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+                    int mutedStreams = getCurrentMutableStreams(getContext());
+                    if (isChecked) {
+                        mutedStreams |= (1 << AudioSystem.STREAM_NOTIFICATION);
+                    } else {
+                        mutedStreams &= ~(1 << AudioSystem.STREAM_NOTIFICATION);
+                    }
+                    Settings.System
+                    .putInt(buttonView.getContext().getContentResolver(),
+                            Settings.System.MODE_RINGER_STREAMS_AFFECTED,
+                            mutedStreams);
+                }
+            });
+
+            if (System.getInt(getContext().getContentResolver(),
+                    System.VOLUME_LINK_NOTIFICATION, 1) == 1) {
+                linkCheckBox.setChecked(true);
+                notificationSection.setVisibility(View.GONE);
+            } else {
+                linkCheckBox.setChecked(false);
+                notificationSection.setVisibility(View.VISIBLE);
+            }
+
+            linkCheckBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+                @Override
+                public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+                    if (isChecked) {
+                        Settings.System
+                                .putInt(buttonView.getContext().getContentResolver(),
+                                        Settings.System.VOLUME_LINK_NOTIFICATION,
+                                        1);
+                        notificationSection.setVisibility(View.GONE);
+                        mAudioManager.setStreamVolume(AudioManager.STREAM_NOTIFICATION, mAudioManager.getStreamVolume(AudioManager.STREAM_RING), 0);
+                    } else {
+                        Settings.System
+                                .putInt(buttonView.getContext().getContentResolver(),
+                                        Settings.System.VOLUME_LINK_NOTIFICATION,
+                                        0);
+                        notificationSection.setVisibility(View.VISIBLE);
+                    }
+                    updateSlidersAndMutedStates();
+                }
+            });
         } else {
-            id = R.id.notification_section;
+            ringerSection.setVisibility(View.GONE);
         }
-        View hideSection = view.findViewById(id);
-        hideSection.setVisibility(View.GONE);
     }
 
     private Uri getMediaVolumeUri(Context context) {
@@ -359,4 +410,11 @@
             }
         };
     }
+
+    private static int getCurrentMutableStreams(Context c) {
+        final int defaultMuteStreams = ((1 << AudioSystem.STREAM_RING)|(1 << AudioSystem.STREAM_NOTIFICATION)|
+                (1 << AudioSystem.STREAM_SYSTEM)|(1 << AudioSystem.STREAM_SYSTEM_ENFORCED));
+        return Settings.System.getInt(c.getContentResolver(),
+                Settings.System.MODE_RINGER_STREAMS_AFFECTED, defaultMuteStreams);
+    }
 }
diff --git a/src/com/android/settings/SecuritySettings.java b/src/com/android/settings/SecuritySettings.java
index 59cd110..02aca5d 100644
--- a/src/com/android/settings/SecuritySettings.java
+++ b/src/com/android/settings/SecuritySettings.java
@@ -79,12 +79,14 @@
     private static final String KEY_POWER_INSTANTLY_LOCKS = "power_button_instantly_locks";
     private static final String KEY_CREDENTIALS_MANAGER = "credentials_management";
     private static final String PACKAGE_MIME_TYPE = "application/vnd.android.package-archive";
+    private static final String KEY_SMS_SECURITY_CHECK_PREF = "sms_security_check_limit";
 
     DevicePolicyManager mDPM;
 
     private ChooseLockSettingsHelper mChooseLockSettingsHelper;
     private LockPatternUtils mLockPatternUtils;
     private ListPreference mLockAfter;
+    private ListPreference mSmsSecurityCheck;
 
     private CheckBoxPreference mBiometricWeakLiveliness;
     private CheckBoxPreference mVisiblePattern;
@@ -119,6 +121,9 @@
         addPreferencesFromResource(R.xml.security_settings);
         root = getPreferenceScreen();
 
+        // Add package manager to check if features are available
+        PackageManager pm = getPackageManager();
+
         // Add options for lock/unlock screen
         int resid = 0;
         if (!mLockPatternUtils.isSecure()) {
@@ -259,6 +264,15 @@
             }
         }
 
+        boolean isTelephony = pm.hasSystemFeature(PackageManager.FEATURE_TELEPHONY);
+        if (isTelephony) {
+            addPreferencesFromResource(R.xml.security_settings_app_cyanogenmod);
+            mSmsSecurityCheck = (ListPreference) root.findPreference(KEY_SMS_SECURITY_CHECK_PREF);
+            mSmsSecurityCheck.setOnPreferenceChangeListener(this);
+            int smsSecurityCheck = Integer.valueOf(mSmsSecurityCheck.getValue());
+            updateSmsSecuritySummary(smsSecurityCheck);
+         }
+
         return root;
     }
 
@@ -320,6 +334,11 @@
         }
     }
 
+    private void updateSmsSecuritySummary(int i) {
+        String message = getString(R.string.sms_security_check_limit_summary, i);
+        mSmsSecurityCheck.setSummary(message);
+    }
+
     private void setupLockAfterPreference() {
         // Compatible with pre-Froyo
         long currentTimeout = Settings.Secure.getLong(getContentResolver(),
@@ -515,6 +534,11 @@
                 Log.e("SecuritySettings", "could not persist lockAfter timeout setting", e);
             }
             updateLockAfterPreferenceSummary();
+        } else if (preference == mSmsSecurityCheck) {
+            int smsSecurityCheck = Integer.valueOf((String) value);
+            Settings.Global.putInt(getContentResolver(), Settings.Global.SMS_OUTGOING_CHECK_MAX_COUNT,
+                     smsSecurityCheck);
+            updateSmsSecuritySummary(smsSecurityCheck);
         }
         return true;
     }
diff --git a/src/com/android/settings/Settings.java b/src/com/android/settings/Settings.java
index f045db0..c52760f 100644
--- a/src/com/android/settings/Settings.java
+++ b/src/com/android/settings/Settings.java
@@ -39,6 +39,7 @@
 import android.content.pm.ActivityInfo;
 import android.content.pm.PackageManager;
 import android.content.pm.PackageManager.NameNotFoundException;
+import android.content.pm.ResolveInfo;
 import android.graphics.drawable.Drawable;
 import android.os.Bundle;
 import android.os.INetworkManagementService;
@@ -414,7 +415,7 @@
     private void updateHeaderList(List<Header> target) {
         final boolean showDev = mDevelopmentPreferences.getBoolean(
                 DevelopmentSettings.PREF_SHOW,
-                android.os.Build.TYPE.equals("eng"));
+                android.os.Build.TYPE.equals("eng") || android.os.Build.TYPE.equals("userdebug"));
         int i = 0;
 
         mHeaderIndexMap.clear();
@@ -424,6 +425,23 @@
             int id = (int) header.id;
             if (id == R.id.operator_settings || id == R.id.manufacturer_settings) {
                 Utils.updateHeaderToSpecificActivityFromMetaDataOrRemove(this, target, header);
+			} else if (id == R.id.launcher_settings) {
+                Intent launcherIntent = new Intent(Intent.ACTION_MAIN);
+                launcherIntent.addCategory(Intent.CATEGORY_HOME);
+                launcherIntent.addCategory(Intent.CATEGORY_DEFAULT);
+
+                Intent launcherPreferencesIntent = new Intent(Intent.ACTION_MAIN);
+                launcherPreferencesIntent.addCategory("com.cyanogenmod.category.LAUNCHER_PREFERENCES");
+
+                ActivityInfo defaultLauncher = getPackageManager().resolveActivity(launcherIntent, PackageManager.MATCH_DEFAULT_ONLY).activityInfo;
+                launcherPreferencesIntent.setPackage(defaultLauncher.packageName);
+                ResolveInfo launcherPreferences = getPackageManager().resolveActivity(launcherPreferencesIntent, 0);
+                if (launcherPreferences != null) {
+                    header.intent = new Intent().setClassName(launcherPreferences.activityInfo.packageName,
+                            launcherPreferences.activityInfo.name);
+                } else {
+                    target.remove(header);
+                }
             } else if (id == R.id.wifi_settings) {
                 // Remove WiFi Settings if WiFi service is not available.
                 if (!getPackageManager().hasSystemFeature(PackageManager.FEATURE_WIFI)) {
diff --git a/src/com/android/settings/SoundSettings.java b/src/com/android/settings/SoundSettings.java
index 7e46171..8868437 100644
--- a/src/com/android/settings/SoundSettings.java
+++ b/src/com/android/settings/SoundSettings.java
@@ -18,9 +18,12 @@
 
 import com.android.settings.bluetooth.DockEventReceiver;
 
+import android.content.BroadcastReceiver;
 import android.app.AlertDialog;
 import android.app.Dialog;
 import android.bluetooth.BluetoothDevice;
+import android.app.DialogFragment;
+import android.app.VibrationPickerDialog;
 import android.content.BroadcastReceiver;
 import android.content.ContentResolver;
 import android.content.Context;
@@ -32,6 +35,7 @@
 import android.database.sqlite.SQLiteException;
 import android.media.AudioManager;
 import android.media.RingtoneManager;
+import android.media.VibrationPattern;
 import android.media.audiofx.AudioEffect;
 import android.net.Uri;
 import android.os.Bundle;
@@ -46,8 +50,11 @@
 import android.provider.MediaStore;
 import android.provider.Settings;
 import android.telephony.TelephonyManager;
+import android.text.format.DateFormat;
 import android.util.Log;
 
+import java.util.Calendar;
+import java.util.Date;
 import java.util.List;
 
 public class SoundSettings extends SettingsPreferenceFragment implements
@@ -60,7 +67,9 @@
     private static final int FALLBACK_EMERGENCY_TONE_VALUE = 0;
 
     private static final String KEY_VIBRATE = "vibrate_when_ringing";
+    private static final String KEY_VIBRATION = "vibration";
     private static final String KEY_RING_VOLUME = "ring_volume";
+    private static final String KEY_INCREASING_RING = "increasing_ring";
     private static final String KEY_MUSICFX = "musicfx";
     private static final String KEY_DTMF_TONE = "dtmf_tone";
     private static final String KEY_SOUND_EFFECTS = "sound_effects";
@@ -75,14 +84,20 @@
     private static final String KEY_DOCK_AUDIO_SETTINGS = "dock_audio";
     private static final String KEY_DOCK_SOUNDS = "dock_sounds";
     private static final String KEY_DOCK_AUDIO_MEDIA_ENABLED = "dock_audio_media_enabled";
+	private static final String KEY_QUIET_HOURS = "quiet_hours";
+    private static final String KEY_VOLUME_ADJUST_SOUNDS = "volume_adjust_sounds";
+	private static final String KEY_SAFE_HEADSET_VOLUME = "safe_headset_volume";
+	private static final String KEY_HEADSET_CONNECT_PLAYER = "headset_connect_player";
 
     private static final String[] NEED_VOICE_CAPABILITY = {
             KEY_RINGTONE, KEY_DTMF_TONE, KEY_CATEGORY_CALLS,
-            KEY_EMERGENCY_TONE
+            KEY_EMERGENCY_TONE, KEY_INCREASING_RING
     };
 
     private static final int MSG_UPDATE_RINGTONE_SUMMARY = 1;
     private static final int MSG_UPDATE_NOTIFICATION_SUMMARY = 2;
+    private static final int VIB_OK = 10;
+    private static final int VIB_CANCEL = 11;
 
     private CheckBoxPreference mVibrateWhenRinging;
     private CheckBoxPreference mDtmfTone;
@@ -91,7 +106,12 @@
     private Preference mMusicFx;
     private CheckBoxPreference mLockSounds;
     private Preference mRingtonePreference;
+    private Preference mVibrationPreference;
     private Preference mNotificationPreference;
+	private PreferenceScreen mQuietHours;
+    private CheckBoxPreference mVolumeAdjustSounds;
+	private CheckBoxPreference mSafeHeadsetVolume;
+	private CheckBoxPreference mHeadsetConnectPlayer;
 
     private Runnable mRingtoneLookupRunnable;
 
@@ -111,6 +131,18 @@
             case MSG_UPDATE_NOTIFICATION_SUMMARY:
                 mNotificationPreference.setSummary((CharSequence) msg.obj);
                 break;
+            case VIB_OK:
+                VibrationPattern mPattern = (VibrationPattern) msg.obj;
+                if (mPattern == null) {
+                    break;
+                }
+                mVibrationPreference.setSummary(mPattern.getName());
+                Settings.System.putString(getContentResolver(),
+                        Settings.System.PHONE_VIBRATION, mPattern.getUri().toString());
+                break;
+            case VIB_CANCEL:
+            default:
+                break;
             }
         }
     };
@@ -124,6 +156,7 @@
         }
     };
 
+	
     private PreferenceGroup mSoundSettings;
 
     @Override
@@ -149,6 +182,7 @@
         mVibrateWhenRinging.setPersistent(false);
         mVibrateWhenRinging.setChecked(Settings.System.getInt(resolver,
                 Settings.System.VIBRATE_WHEN_RINGING, 0) != 0);
+		mVibrateWhenRinging.setOnPreferenceChangeListener(this);
 
         mDtmfTone = (CheckBoxPreference) findPreference(KEY_DTMF_TONE);
         mDtmfTone.setPersistent(false);
@@ -162,21 +196,47 @@
         mHapticFeedback.setPersistent(false);
         mHapticFeedback.setChecked(Settings.System.getInt(resolver,
                 Settings.System.HAPTIC_FEEDBACK_ENABLED, 1) != 0);
+        mVolumeAdjustSounds = (CheckBoxPreference) findPreference(KEY_VOLUME_ADJUST_SOUNDS);
+        mVolumeAdjustSounds.setPersistent(false);
+        mVolumeAdjustSounds.setChecked(Settings.System.getInt(resolver,
+                Settings.System.VOLUME_ADJUST_SOUNDS_ENABLED, 1) != 0);
         mLockSounds = (CheckBoxPreference) findPreference(KEY_LOCK_SOUNDS);
         mLockSounds.setPersistent(false);
         mLockSounds.setChecked(Settings.System.getInt(resolver,
                 Settings.System.LOCKSCREEN_SOUNDS_ENABLED, 1) != 0);
 
         mRingtonePreference = findPreference(KEY_RINGTONE);
+        mVibrationPreference = findPreference(KEY_VIBRATION);
         mNotificationPreference = findPreference(KEY_NOTIFICATION_SOUND);
 
+		mQuietHours = (PreferenceScreen) findPreference(KEY_QUIET_HOURS);
+        if (Settings.System.getInt(resolver, Settings.System.QUIET_HOURS_ENABLED, 0) == 1) {
+            mQuietHours.setSummary(getString(R.string.quiet_hours_active_from) + " " + 
+                    returnTime(Settings.System.getString(resolver, Settings.System.QUIET_HOURS_START)) 
+                    + " " + getString(R.string.quiet_hours_active_to) + " " +
+                    returnTime(Settings.System.getString(resolver, Settings.System.QUIET_HOURS_END)));
+        } else {
+            mQuietHours.setSummary(getString(R.string.quiet_hours_summary));
+        }
+
+		mSafeHeadsetVolume = (CheckBoxPreference) findPreference(KEY_SAFE_HEADSET_VOLUME);
+        mSafeHeadsetVolume.setPersistent(false);
+        mSafeHeadsetVolume.setChecked(Settings.System.getBoolean(resolver,
+                Settings.System.MANUAL_SAFE_MEDIA_VOLUME, true));
+
+		mHeadsetConnectPlayer = (CheckBoxPreference) findPreference(KEY_HEADSET_CONNECT_PLAYER);
+        mHeadsetConnectPlayer.setChecked(Settings.System.getInt(resolver,
+                Settings.System.HEADSET_CONNECT_PLAYER, 0) != 0);
+
         Vibrator vibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
         if (vibrator == null || !vibrator.hasVibrator()) {
             removePreference(KEY_VIBRATE);
             removePreference(KEY_HAPTIC_FEEDBACK);
+            removePreference(KEY_VIBRATION);
         }
         if (!Utils.isVoiceCapable(getActivity())) {
             removePreference(KEY_VIBRATE);
+            removePreference(KEY_VIBRATION);
         }
 
         if (TelephonyManager.PHONE_TYPE_CDMA == activePhoneType) {
@@ -225,16 +285,20 @@
         };
 
         initDockSettings();
+        lookupVibrationName();
     }
 
     @Override
     public void onResume() {
         super.onResume();
 
+		updateState(true);
         lookupRingtoneNames();
+        lookupVibrationName();
 
         IntentFilter filter = new IntentFilter(Intent.ACTION_DOCK_EVENT);
         getActivity().registerReceiver(mReceiver, filter);
+
     }
 
     @Override
@@ -244,6 +308,25 @@
         getActivity().unregisterReceiver(mReceiver);
     }
 
+    // updateState in fact updates the UI to reflect the system state
+    private void updateState(boolean force) {
+        if (getActivity() == null) return;
+        ContentResolver resolver = getContentResolver();
+
+		mVibrateWhenRinging.setChecked(Settings.System.getInt(resolver,
+			Settings.System.VIBRATE_WHEN_RINGING, 0) != 0);
+        
+        if (Settings.System.getInt(resolver, Settings.System.QUIET_HOURS_ENABLED, 0) == 1) {
+            mQuietHours.setSummary(getString(R.string.quiet_hours_active_from) + " " +
+                    returnTime(Settings.System.getString(resolver, Settings.System.QUIET_HOURS_START))
+                    + " " + getString(R.string.quiet_hours_active_to) + " " +
+                    returnTime(Settings.System.getString(resolver, Settings.System.QUIET_HOURS_END)));
+        } else {
+            mQuietHours.setSummary(getString(R.string.quiet_hours_summary));
+        }
+
+		}
+
     private void updateRingtoneName(int type, Preference preference, int msg) {
         if (preference == null) return;
         Context context = getActivity();
@@ -297,13 +380,26 @@
             Settings.System.putInt(getContentResolver(), Settings.System.HAPTIC_FEEDBACK_ENABLED,
                     mHapticFeedback.isChecked() ? 1 : 0);
 
+        } else if (preference == mVolumeAdjustSounds) {
+            Settings.System.putInt(getContentResolver(), Settings.System.VOLUME_ADJUST_SOUNDS_ENABLED ,
+                    mVolumeAdjustSounds.isChecked() ? 1 : 0);
+
         } else if (preference == mLockSounds) {
             Settings.System.putInt(getContentResolver(), Settings.System.LOCKSCREEN_SOUNDS_ENABLED,
                     mLockSounds.isChecked() ? 1 : 0);
 
+		} else if (preference == mSafeHeadsetVolume) {
+            Settings.System.putBoolean(getContentResolver(), Settings.System.MANUAL_SAFE_MEDIA_VOLUME,
+                    mSafeHeadsetVolume.isChecked());
+
+		} else if (preference == mHeadsetConnectPlayer) {
+            Settings.System.putInt(getContentResolver(), Settings.System.HEADSET_CONNECT_PLAYER,
+                    mHeadsetConnectPlayer.isChecked() ? 1 : 0);
+
         } else if (preference == mMusicFx) {
             // let the framework fire off the intent
             return false;
+
         } else if (preference == mDockAudioSettings) {
             int dockState = mDockIntent != null
                     ? mDockIntent.getIntExtra(Intent.EXTRA_DOCK_STATE, 0)
@@ -334,6 +430,14 @@
         } else if (preference == mDockAudioMediaEnabled) {
             Settings.Global.putInt(getContentResolver(), Settings.Global.DOCK_AUDIO_MEDIA_ENABLED,
                     mDockAudioMediaEnabled.isChecked() ? 1 : 0);
+        } else if (preference == mVibrationPreference) {
+            String uriString = VibrationPattern.getPhoneVibration(getActivity());
+            DialogFragment newFragment = VibrationPickerDialog.newInstance(mHandler, false, uriString);
+            newFragment.show(getFragmentManager(), "dialog");
+            return true;
+        } else {
+            // If we didn't handle it, let preferences handle it.
+            return super.onPreferenceTreeClick(preferenceScreen, preference);
         }
         return true;
     }
@@ -439,5 +543,26 @@
         ab.setPositiveButton(android.R.string.ok, null);
         return ab.create();
     }
+
+	private String returnTime(String t) {
+        if (t == null || t.equals("")) {
+            return "";
+        }
+        int hr = Integer.parseInt(t.trim());
+        int mn = hr;
+
+        hr = hr / 60;
+        mn = mn % 60;
+        Calendar cal = Calendar.getInstance();
+        cal.set(Calendar.HOUR_OF_DAY, hr);
+        cal.set(Calendar.MINUTE, mn);
+        Date date = cal.getTime();
+        return DateFormat.getTimeFormat(getActivity().getApplicationContext()).format(date);
+    }
+
+    private void lookupVibrationName() {
+        String uriString = VibrationPattern.getPhoneVibration(getActivity());
+        mVibrationPreference.setSummary(new VibrationPattern(Uri.parse(uriString), getActivity()).getName());
+    }
 }
 
diff --git a/src/com/android/settings/TimeRangePreference.java b/src/com/android/settings/TimeRangePreference.java
new file mode 100644
index 0000000..1c9f399
--- /dev/null
+++ b/src/com/android/settings/TimeRangePreference.java
@@ -0,0 +1,190 @@
+/*
+ * Copyright (C) 2012 The CyanogenMod 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.settings;
+
+import java.util.Calendar;
+import java.util.Date;
+
+import android.app.TimePickerDialog;
+import android.content.Context;
+import android.preference.Preference;
+import android.text.format.DateFormat;
+import android.util.AttributeSet;
+import android.view.View;
+import android.widget.CheckBox;
+import android.widget.CompoundButton;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+import android.widget.TimePicker;
+
+import com.android.settings.R;
+
+public class TimeRangePreference extends Preference implements
+    View.OnClickListener {
+    private static final String TAG = TimeRangePreference.class.getSimpleName();
+
+    private static final int DIALOG_START_TIME = 1;
+
+    private static final int DIALOG_END_TIME = 2;
+
+    private TextView mStartTimeText;
+
+    private TextView mEndTimeText;
+
+    private int mStartTime;
+
+    private int mEndTime;
+
+    /**
+     * @param context
+     * @param attrs
+     */
+    public TimeRangePreference(Context context, AttributeSet attrs) {
+        super(context, attrs);
+        init();
+    }
+
+    /**
+     * @param context
+     * @param stime
+     * @param etime
+     */
+    public TimeRangePreference(Context context, int stime, int etime) {
+        super(context);
+        mStartTime = stime;
+        mEndTime = etime;
+        init();
+    }
+
+    @Override
+    protected void onBindView(View view) {
+        super.onBindView(view);
+
+        View startTimeLayout = view.findViewById(R.id.start_time);
+        if ((startTimeLayout != null) && startTimeLayout instanceof LinearLayout) {
+            startTimeLayout.setOnClickListener(this);
+        }
+
+        View endTimeLayout = view.findViewById(R.id.end_time);
+        if ((endTimeLayout != null) && endTimeLayout instanceof LinearLayout) {
+            endTimeLayout.setOnClickListener(this);
+        }
+
+        mStartTimeText = (TextView) view.findViewById(R.id.start_time_text);
+        mEndTimeText = (TextView) view.findViewById(R.id.end_time_text);
+
+        updatePreferenceViews();
+    }
+
+    private void init() {
+        setLayoutResource(R.layout.preference_time_range);
+    }
+
+    private void updatePreferenceViews() {
+        if (mStartTimeText != null) {
+            mStartTimeText.setText(returnTime(mStartTime));
+        }
+        if (mEndTimeText != null) {
+            mEndTimeText.setText(returnTime(mEndTime));
+        }
+    }
+
+    public void setStartTime(int time) {
+        mStartTime = time;
+        updatePreferenceViews();
+    }
+
+    public void setEndTime(int time) {
+        mEndTime = time;
+        updatePreferenceViews();
+    }
+
+    public void setTimeRange(int stime, int etime) {
+        mStartTime = stime;
+        mEndTime = etime;
+        updatePreferenceViews();
+    }
+
+    public int getStartTime() {
+        return(mStartTime);
+    }
+
+    public int getEndTime() {
+        return(mEndTime);
+    }
+
+    @Override
+    public void onClick(android.view.View v) {
+        if (v != null) {
+            if (R.id.start_time == v.getId()) {
+                TimePicker(DIALOG_START_TIME);
+            } else if (R.id.end_time == v.getId()) {
+                TimePicker(DIALOG_END_TIME);
+            }
+        }
+    }
+
+    private void TimePicker(final int key) {
+        int hour;
+        int minutes;
+        int value = (key == DIALOG_START_TIME ? mStartTime : mEndTime);
+
+        if (value < 0) {
+            Calendar calendar = Calendar.getInstance();
+            hour = calendar.get(Calendar.HOUR_OF_DAY);
+            minutes = calendar.get(Calendar.MINUTE);
+        } else {
+            hour = value / 60;
+            minutes = value % 60;
+        }
+
+        Context context = getContext();
+        TimePickerDialog dlg = new TimePickerDialog(context,
+        new TimePickerDialog.OnTimeSetListener() {
+            @Override
+            public void onTimeSet(TimePicker v, int hours, int minutes) {
+                int time = hours * 60 + minutes;
+                if (key == DIALOG_START_TIME) {
+                    mStartTime = time;
+                    mStartTimeText.setText(returnTime(time));
+                } else {
+                    mEndTime = time;
+                    mEndTimeText.setText(returnTime(time));
+                }
+                callChangeListener(this);
+            };
+        }, hour, minutes, DateFormat.is24HourFormat(context));
+        dlg.show();
+    }
+
+    private String returnTime(int t) {
+        if (t < 0) {
+            return "";
+        }
+
+        int hr = t;
+        int mn = t;
+
+        hr = hr / 60;
+        mn = mn % 60;
+        Calendar cal = Calendar.getInstance();
+        cal.set(Calendar.HOUR_OF_DAY, hr);
+        cal.set(Calendar.MINUTE, mn);
+        Date date = cal.getTime();
+        return DateFormat.getTimeFormat(getContext()).format(date);
+    }
+}
diff --git a/src/com/android/settings/Utils.java b/src/com/android/settings/Utils.java
index 4b0a753..ccf24d0 100644
--- a/src/com/android/settings/Utils.java
+++ b/src/com/android/settings/Utils.java
@@ -56,14 +56,21 @@
 import android.provider.ContactsContract.RawContacts;
 import android.telephony.TelephonyManager;
 import android.text.TextUtils;
+import android.util.DisplayMetrics;
 import android.util.Log;
+import android.view.DisplayInfo;
 import android.view.View;
 import android.view.ViewGroup;
+import android.view.WindowManager;
 import android.widget.ListView;
 import android.widget.TabWidget;
 
 import com.android.settings.users.ProfileUpdateReceiver;
 
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
@@ -74,6 +81,8 @@
 
 public class Utils {
 
+    private static final String TAG = "Utils";
+
     /**
      * Set the preference's title to the matching activity's label.
      */
@@ -102,6 +111,14 @@
      */
     private static final String META_DATA_PREFERENCE_SUMMARY = "com.android.settings.summary";
 
+    // Device types
+    private static final int DEVICE_PHONE = 0;
+    private static final int DEVICE_HYBRID = 1;
+    private static final int DEVICE_TABLET = 2;
+
+    // Device type reference
+    private static int mDeviceType = -1;
+
     /**
      * Finds a matching activity for a preference's intent. If a matching
      * activity is not found, it will remove the preference.
@@ -476,6 +493,43 @@
         }
     }
 
+    public static boolean fileExists(String filename) {
+        return new File(filename).exists();
+    }
+
+    public static String fileReadOneLine(String fname) {
+        BufferedReader br;
+        String line = null;
+
+        try {
+            br = new BufferedReader(new FileReader(fname), 512);
+            try {
+                line = br.readLine();
+            } finally {
+                br.close();
+            }
+        } catch (Exception e) {
+            Log.e(TAG, "IO Exception when reading /sys/ file", e);
+        }
+        return line;
+    }
+
+    public static boolean fileWriteOneLine(String fname, String value) {
+        try {
+            FileWriter fw = new FileWriter(fname);
+            try {
+                fw.write(value);
+            } finally {
+                fw.close();
+            }
+        } catch (IOException e) {
+            String Error = "Error writing to " + fname + ". Exception: ";
+            Log.e(TAG, Error, e);
+            return false;
+        }
+        return true;
+    }
+
     /* Used by UserSettings as well. Call this on a non-ui thread. */
     public static boolean copyMeProfilePhoto(Context context, UserInfo user) {
         Uri contactUri = Profile.CONTENT_URI;
@@ -592,4 +646,37 @@
         return ((UserManager) context.getSystemService(Context.USER_SERVICE))
                 .getUsers().size() > 1;
     }
+
+    private static int getScreenType(Context con) {
+        if (mDeviceType == -1) {
+            WindowManager wm = (WindowManager)con.getSystemService(Context.WINDOW_SERVICE);
+            DisplayInfo outDisplayInfo = new DisplayInfo();
+            wm.getDefaultDisplay().getDisplayInfo(outDisplayInfo);
+            int shortSize = Math.min(outDisplayInfo.logicalHeight, outDisplayInfo.logicalWidth);
+            int shortSizeDp = shortSize * DisplayMetrics.DENSITY_DEFAULT / outDisplayInfo.logicalDensityDpi;
+            if (shortSizeDp < 600) {
+                // 0-599dp: "phone" UI with a separate status & navigation bar
+                mDeviceType =  DEVICE_PHONE;
+            } else if (shortSizeDp < 720) {
+                // 600-719dp: "phone" UI with modifications for larger screens
+                mDeviceType = DEVICE_HYBRID;
+            } else {
+                // 720dp: "tablet" UI with a single combined status & navigation bar
+                mDeviceType = DEVICE_TABLET;
+            }
+        }
+        return mDeviceType;
+    }
+
+    public static boolean isPhone(Context con) {
+        return getScreenType(con) == DEVICE_PHONE;
+    }
+
+    public static boolean isHybrid(Context con) {
+        return getScreenType(con) == DEVICE_HYBRID;
+    }
+
+    public static boolean isTablet(Context con) {
+        return getScreenType(con) == DEVICE_TABLET;
+    }
 }
diff --git a/src/com/android/settings/WirelessSettings.java b/src/com/android/settings/WirelessSettings.java
index 10d9214..6f63c25 100644
--- a/src/com/android/settings/WirelessSettings.java
+++ b/src/com/android/settings/WirelessSettings.java
@@ -28,6 +28,7 @@
 import android.os.SystemProperties;
 import android.os.UserHandle;
 import android.preference.CheckBoxPreference;
+import android.preference.ListPreference;
 import android.preference.Preference;
 import android.preference.PreferenceScreen;
 import android.provider.Settings;
@@ -40,7 +41,8 @@
 import com.android.settings.nfc.NfcEnabler;
 import com.android.settings.NsdEnabler;
 
-public class WirelessSettings extends SettingsPreferenceFragment {
+public class WirelessSettings extends SettingsPreferenceFragment
+    implements Preference.OnPreferenceChangeListener {
 
     private static final String KEY_TOGGLE_AIRPLANE = "toggle_airplane";
     private static final String KEY_TOGGLE_NFC = "toggle_nfc";
@@ -52,6 +54,7 @@
     private static final String KEY_MOBILE_NETWORK_SETTINGS = "mobile_network_settings";
     private static final String KEY_TOGGLE_NSD = "toggle_nsd"; //network service discovery
     private static final String KEY_CELL_BROADCAST_SETTINGS = "cell_broadcast_settings";
+    private static final String KEY_NFC_POLLING_MODE = "nfc_polling_mode";
 
     public static final String EXIT_ECM_RESULT = "exit_ecm_result";
     public static final int REQUEST_CODE_EXIT_ECM = 1;
@@ -61,6 +64,7 @@
     private NfcEnabler mNfcEnabler;
     private NfcAdapter mNfcAdapter;
     private NsdEnabler mNsdEnabler;
+    private ListPreference mNfcPollingMode;
 
     /**
      * Invoked on each preference click in this hierarchy, overrides
@@ -81,6 +85,18 @@
         return super.onPreferenceTreeClick(preferenceScreen, preference);
     }
 
+    @Override
+    public boolean onPreferenceChange(Preference preference, Object newValue) {
+        if (preference == mNfcPollingMode) {
+            int newVal = Integer.parseInt((String) newValue);
+            Settings.System.putInt(getActivity().getContentResolver(),
+                    Settings.System.NFC_POLLING_MODE, newVal);
+            updateNfcPolling();
+            return true;
+        }
+        return false;
+    }
+
     public static boolean isRadioAllowed(Context context, String type) {
         if (!AirplaneModeEnabler.isAirplaneModeOn(context)) {
             return true;
@@ -105,8 +121,14 @@
         PreferenceScreen androidBeam = (PreferenceScreen) findPreference(KEY_ANDROID_BEAM_SETTINGS);
         CheckBoxPreference nsd = (CheckBoxPreference) findPreference(KEY_TOGGLE_NSD);
 
+        mNfcPollingMode = (ListPreference) findPreference(KEY_NFC_POLLING_MODE);
+        mNfcPollingMode.setOnPreferenceChangeListener(this);
+        mNfcPollingMode.setValue((Settings.System.getInt(activity.getContentResolver(),
+                Settings.System.NFC_POLLING_MODE, 3)) + "");
+        updateNfcPolling();
+
         mAirplaneModeEnabler = new AirplaneModeEnabler(activity, mAirplaneModePreference);
-        mNfcEnabler = new NfcEnabler(activity, nfc, androidBeam);
+        mNfcEnabler = new NfcEnabler(activity, nfc, androidBeam, mNfcPollingMode);
 
         // Remove NSD checkbox by default
         getPreferenceScreen().removePreference(nsd);
@@ -152,6 +174,7 @@
         mNfcAdapter = NfcAdapter.getDefaultAdapter(activity);
         if (mNfcAdapter == null) {
             getPreferenceScreen().removePreference(nfc);
+            getPreferenceScreen().removePreference(mNfcPollingMode);
             getPreferenceScreen().removePreference(androidBeam);
             mNfcEnabler = null;
         }
@@ -200,6 +223,25 @@
         }
     }
 
+    private void updateNfcPolling() {
+        int resId;
+        String value = Settings.System.getString(getContentResolver(),
+                Settings.System.NFC_POLLING_MODE);
+        String[] pollingArray = getResources().getStringArray(R.array.nfc_polling_mode_values);
+
+        if (pollingArray[0].equals(value)) {
+            resId = R.string.nfc_polling_mode_screen_off;
+            mNfcPollingMode.setValueIndex(0);
+        } else if (pollingArray[1].equals(value)) {
+            resId = R.string.nfc_polling_mode_screen_locked;
+            mNfcPollingMode.setValueIndex(1);
+        } else {
+            resId = R.string.nfc_polling_mode_screen_unlocked;
+            mNfcPollingMode.setValueIndex(2);
+        }
+        mNfcPollingMode.setSummary(getResources().getString(resId));
+    }
+
     @Override
     public void onResume() {
         super.onResume();
diff --git a/src/com/android/settings/applications/InstalledAppDetails.java b/src/com/android/settings/applications/InstalledAppDetails.java
index 7241fdc..c11fde7 100644
--- a/src/com/android/settings/applications/InstalledAppDetails.java
+++ b/src/com/android/settings/applications/InstalledAppDetails.java
@@ -345,16 +345,15 @@
     private void initUninstallButtons() {
         mUpdatedSysApp = (mAppEntry.info.flags & ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) != 0;
         boolean enabled = true;
+        boolean specialDisable = false;
         if (mUpdatedSysApp) {
             mUninstallButton.setText(R.string.app_factory_reset);
-            boolean specialDisable = false;
             if ((mAppEntry.info.flags & ApplicationInfo.FLAG_SYSTEM) != 0) {
+                specialDisable = true;
                 specialDisable = handleDisableable(mSpecialDisableButton);
                 mSpecialDisableButton.setOnClickListener(this);
             }
-            mMoreControlButtons.setVisibility(specialDisable ? View.VISIBLE : View.GONE);
         } else {
-            mMoreControlButtons.setVisibility(View.GONE);
             if ((mAppEntry.info.flags & ApplicationInfo.FLAG_SYSTEM) != 0) {
                 enabled = handleDisableable(mUninstallButton);
             } else if ((mPackageInfo.applicationInfo.flags
@@ -366,8 +365,16 @@
                 enabled = false;
             } else {
                 mUninstallButton.setText(R.string.uninstall_text);
+                // regular app
+                if(enabled = handleDisableable(mSpecialDisableButton)) {
+                    // enabled will be false if its a launcher or signed with system cert, for safety.
+                    specialDisable = true;
+                    mSpecialDisableButton.setOnClickListener(this);
+                }
             }
         }
+        mMoreControlButtons.setVisibility(specialDisable ? View.VISIBLE : View.GONE);
+
         // If this is a device admin, it can't be uninstall or disabled.
         // We do this here so the text of the button is still set correctly.
         if (mDpm.packageHasActiveAdmins(mPackageInfo.packageName)) {
@@ -1132,7 +1139,9 @@
                     .setPositiveButton(R.string.dlg_ok,
                         new DialogInterface.OnClickListener() {
                         public void onClick(DialogInterface dialog, int which) {
-                            // Disable the app
+                            // Force stop, why keep it around if we're disabling it?
+                            getOwner().forceStopPackage(getOwner().mAppEntry.info.packageName);
+                            // Then disable the app
                             new DisableChanger(getOwner(), getOwner().mAppEntry.info,
                                     PackageManager.COMPONENT_ENABLED_STATE_DISABLED_USER)
                             .execute((Object)null);
@@ -1300,7 +1309,13 @@
                 }
             }
         } else if(v == mSpecialDisableButton) {
-            showDialogInner(DLG_SPECIAL_DISABLE, 0);
+            if((mAppEntry.info.flags & ApplicationInfo.FLAG_INSTALLED) != 0 && mAppEntry.info.enabled) {
+                showDialogInner(DLG_DISABLE, 0);
+            } else {
+                new DisableChanger(this, mAppEntry.info,
+                        PackageManager.COMPONENT_ENABLED_STATE_DEFAULT)
+                .execute((Object)null);
+            }
         } else if(v == mActivitiesButton) {
             mPm.clearPackagePreferredActivities(packageName);
             try {
diff --git a/src/com/android/settings/bluetooth/BluetoothPermissionActivity.java b/src/com/android/settings/bluetooth/BluetoothPermissionActivity.java
index 16476fa..363d694 100755
--- a/src/com/android/settings/bluetooth/BluetoothPermissionActivity.java
+++ b/src/com/android/settings/bluetooth/BluetoothPermissionActivity.java
@@ -98,6 +98,8 @@
             showConnectionDialog();
         } else if (requestType == BluetoothDevice.REQUEST_TYPE_PHONEBOOK_ACCESS) {
             showPhonebookDialog();
+        } else if (requestType == BluetoothDevice.REQUEST_TYPE_MESSAGE_ACCESS) {
+            showMasDialog();
         } else {
             Log.e(TAG, "Error: bad request type: " + requestType);
             finish();
@@ -134,6 +136,19 @@
         setupAlert();
     }
 
+    private void showMasDialog() {
+        final AlertController.AlertParams p = mAlertParams;
+        p.mIconId = android.R.drawable.ic_dialog_info;
+        p.mTitle = getString(R.string.bluetooth_mas_request);
+        p.mView = createMasDialogView();
+        p.mPositiveButtonText = getString(android.R.string.yes);
+        p.mPositiveButtonListener = this;
+        p.mNegativeButtonText = getString(android.R.string.no);
+        p.mNegativeButtonListener = this;
+        mOkButton = mAlert.getButton(DialogInterface.BUTTON_POSITIVE);
+        setupAlert();
+    }
+
     private String createConnectionDisplayText() {
         String mRemoteName = mDevice != null ? mDevice.getAliasName() : null;
 
@@ -152,6 +167,15 @@
         return mMessage1;
     }
 
+    private String createMasDisplayText() {
+        String mRemoteName = mDevice != null ? mDevice.getAliasName() : null;
+
+        if (mRemoteName == null) mRemoteName = getString(R.string.unknown);
+        String mMessage1 = getString(R.string.bluetooth_mas_acceptance_dialog_text,
+                                     mRemoteName, mRemoteName);
+        return mMessage1;
+    }
+
     private View createConnectionDialogView() {
         mView = getLayoutInflater().inflate(R.layout.bluetooth_connection_access, null);
         messageView = (TextView)mView.findViewById(R.id.message);
@@ -177,6 +201,24 @@
         return mView;
     }
 
+    private View createMasDialogView() {
+        mView = getLayoutInflater().inflate(R.layout.bluetooth_mas_access, null);
+        messageView = (TextView)mView.findViewById(R.id.message);
+        messageView.setText(createMasDisplayText());
+        mRememberChoice = (CheckBox)mView.findViewById(R.id.bluetooth_mas_remember_choice);
+        mRememberChoice.setChecked(false);
+        mRememberChoice.setOnCheckedChangeListener(new OnCheckedChangeListener() {
+            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+                if (isChecked) {
+                    mRememberChoiceValue = true;
+                } else {
+                    mRememberChoiceValue = false;
+                }
+            }
+            });
+        return mView;
+    }
+
     private void onPositive() {
         if (DEBUG) Log.d(TAG, "onPositive mRememberChoiceValue: " + mRememberChoiceValue);
 
diff --git a/src/com/android/settings/bluetooth/RequestPermissionActivity.java b/src/com/android/settings/bluetooth/RequestPermissionActivity.java
index 08c10fb..f843848 100644
--- a/src/com/android/settings/bluetooth/RequestPermissionActivity.java
+++ b/src/com/android/settings/bluetooth/RequestPermissionActivity.java
@@ -227,6 +227,7 @@
             returnCode = RESULT_OK;
         } else if (mLocalAdapter.setScanMode(
                 BluetoothAdapter.SCAN_MODE_CONNECTABLE_DISCOVERABLE, mTimeout)) {
+            mLocalAdapter.setDiscoverableTimeout(mTimeout);
             // If already in discoverable mode, this will extend the timeout.
             long endTime = System.currentTimeMillis() + (long) mTimeout * 1000;
             LocalBluetoothPreferences.persistDiscoverableEndTimestamp(
diff --git a/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java b/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java
index c2ff0d9..ddf6b74 100644
--- a/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java
+++ b/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java
@@ -62,6 +62,7 @@
     private static final String KEY_USER_DICTIONARY_SETTINGS = "key_user_dictionary_settings";
     // false: on ICS or later
     private static final boolean SHOW_INPUT_METHOD_SWITCHER_SETTINGS = false;
+	private static final String VOLUME_KEY_CURSOR_CONTROL = "volume_key_cursor_control";
 
     private static final String[] sSystemSettingNames = {
         System.TEXT_AUTO_REPLACE, System.TEXT_AUTO_CAPS, System.TEXT_AUTO_PUNCTUATE,
@@ -89,6 +90,7 @@
     @SuppressWarnings("unused")
     private SettingsObserver mSettingsObserver;
     private Intent mIntentWaitingForResult;
+	private ListPreference mVolumeKeyCursorControl;
 
     @Override
     public void onCreate(Bundle icicle) {
@@ -178,6 +180,14 @@
             scp.setFragmentIntent(this, intent);
         }
 
+		mVolumeKeyCursorControl = (ListPreference) findPreference(VOLUME_KEY_CURSOR_CONTROL);
+        if(mVolumeKeyCursorControl != null) {
+            mVolumeKeyCursorControl.setOnPreferenceChangeListener(this);
+            mVolumeKeyCursorControl.setValue(Integer.toString(Settings.System.getInt(getActivity()
+                    .getContentResolver(), Settings.System.VOLUME_KEY_CURSOR_CONTROL, 0)));
+            mVolumeKeyCursorControl.setSummary(mVolumeKeyCursorControl.getEntry());
+        }
+
         mHandler = new Handler();
         mSettingsObserver = new SettingsObserver(mHandler, getActivity());
     }
@@ -377,6 +387,15 @@
                 }
             }
         }
+		if (preference == mVolumeKeyCursorControl) {
+            String volumeKeyCursorControl = (String) value;
+            int val = Integer.parseInt(volumeKeyCursorControl);
+            Settings.System.putInt(getActivity().getContentResolver(),
+                    Settings.System.VOLUME_KEY_CURSOR_CONTROL, val);
+            int index = mVolumeKeyCursorControl.findIndexOfValue(volumeKeyCursorControl);
+            mVolumeKeyCursorControl.setSummary(mVolumeKeyCursorControl.getEntries()[index]);
+            return true;
+        }
         return false;
     }
 
diff --git a/src/com/android/settings/nfc/NfcEnabler.java b/src/com/android/settings/nfc/NfcEnabler.java
index 018b8ae..38e14a4 100644
--- a/src/com/android/settings/nfc/NfcEnabler.java
+++ b/src/com/android/settings/nfc/NfcEnabler.java
@@ -23,6 +23,7 @@
 import android.nfc.NfcAdapter;
 import android.preference.CheckBoxPreference;
 import android.preference.Preference;
+import android.preference.ListPreference;
 import android.preference.PreferenceScreen;
 
 import com.android.settings.R;
@@ -36,6 +37,7 @@
     private final Context mContext;
     private final CheckBoxPreference mCheckbox;
     private final PreferenceScreen mAndroidBeam;
+    private final ListPreference mNfcPollingMode;
     private final NfcAdapter mNfcAdapter;
     private final IntentFilter mIntentFilter;
 
@@ -51,16 +53,18 @@
     };
 
     public NfcEnabler(Context context, CheckBoxPreference checkBoxPreference,
-            PreferenceScreen androidBeam) {
+            PreferenceScreen androidBeam, ListPreference nfcPollingMode) {
         mContext = context;
         mCheckbox = checkBoxPreference;
         mAndroidBeam = androidBeam;
+        mNfcPollingMode = nfcPollingMode;
         mNfcAdapter = NfcAdapter.getDefaultAdapter(context);
 
         if (mNfcAdapter == null) {
             // NFC is not supported
             mCheckbox.setEnabled(false);
             mAndroidBeam.setEnabled(false);
+            mNfcPollingMode.setEnabled(false);
             mIntentFilter = null;
             return;
         }
@@ -106,11 +110,13 @@
             mCheckbox.setEnabled(true);
             mAndroidBeam.setEnabled(false);
             mAndroidBeam.setSummary(R.string.android_beam_disabled_summary);
+            mNfcPollingMode.setEnabled(false);
             break;
         case NfcAdapter.STATE_ON:
             mCheckbox.setChecked(true);
             mCheckbox.setEnabled(true);
             mAndroidBeam.setEnabled(true);
+            mNfcPollingMode.setEnabled(true);
             if (mNfcAdapter.isNdefPushEnabled()) {
                 mAndroidBeam.setSummary(R.string.android_beam_on_summary);
             } else {
@@ -121,11 +127,13 @@
             mCheckbox.setChecked(true);
             mCheckbox.setEnabled(false);
             mAndroidBeam.setEnabled(false);
+            mNfcPollingMode.setEnabled(false);
             break;
         case NfcAdapter.STATE_TURNING_OFF:
             mCheckbox.setChecked(false);
             mCheckbox.setEnabled(false);
             mAndroidBeam.setEnabled(false);
+            mNfcPollingMode.setEnabled(false);
             break;
         }
     }
diff --git a/src/com/android/settings/performance/BootReceiver.java b/src/com/android/settings/performance/BootReceiver.java
new file mode 100644
index 0000000..7a939c4
--- /dev/null
+++ b/src/com/android/settings/performance/BootReceiver.java
@@ -0,0 +1,124 @@
+/*
+ * Copyright (C) 2012 The CyanogenMod 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.settings.performance;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.os.SystemProperties;
+import android.preference.PreferenceManager;
+import android.util.Log;
+
+import com.android.settings.Utils;
+
+import java.util.Arrays;
+import java.util.List;
+
+public class BootReceiver extends BroadcastReceiver {
+
+    private static final String TAG = "BootReceiver";
+
+    private static final String CPU_SETTINGS_PROP = "sys.cpufreq.restored";
+    private static final String IOSCHED_SETTINGS_PROP = "sys.iosched.restored";
+
+    @Override
+    public void onReceive(Context ctx, Intent intent) {
+        if (SystemProperties.getBoolean(CPU_SETTINGS_PROP, false) == false
+                && intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED)) {
+            SystemProperties.set(CPU_SETTINGS_PROP, "true");
+            configureCPU(ctx);
+        } else {
+            SystemProperties.set(CPU_SETTINGS_PROP, "false");
+        }
+
+        if (SystemProperties.getBoolean(IOSCHED_SETTINGS_PROP, false) == false
+                && intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED)) {
+            SystemProperties.set(IOSCHED_SETTINGS_PROP, "true");
+            configureIOSched(ctx);
+        } else {
+            SystemProperties.set(IOSCHED_SETTINGS_PROP, "false");
+        }
+    }
+
+    private void configureCPU(Context ctx) {
+        SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(ctx);
+
+        if (prefs.getBoolean(Processor.SOB_PREF, false) == false) {
+            Log.i(TAG, "Restore disabled by user preference.");
+            return;
+        }
+
+        String governor = prefs.getString(Processor.GOV_PREF, null);
+        String minFrequency = prefs.getString(Processor.FREQ_MIN_PREF, null);
+        String maxFrequency = prefs.getString(Processor.FREQ_MAX_PREF, null);
+        String availableFrequenciesLine = Utils.fileReadOneLine(Processor.FREQ_LIST_FILE);
+        String availableGovernorsLine = Utils.fileReadOneLine(Processor.GOV_LIST_FILE);
+        boolean noSettings = ((availableGovernorsLine == null) || (governor == null)) &&
+                             ((availableFrequenciesLine == null) || ((minFrequency == null) && (maxFrequency == null)));
+        List<String> frequencies = null;
+        List<String> governors = null;
+
+        if (noSettings) {
+            Log.d(TAG, "No CPU settings saved. Nothing to restore.");
+        } else {
+            if (availableGovernorsLine != null){
+                governors = Arrays.asList(availableGovernorsLine.split(" "));
+            }
+            if (availableFrequenciesLine != null){
+                frequencies = Arrays.asList(availableFrequenciesLine.split(" "));
+            }
+            if (governor != null && governors != null && governors.contains(governor)) {
+                Utils.fileWriteOneLine(Processor.GOV_FILE, governor);
+            }
+            if (maxFrequency != null && frequencies != null && frequencies.contains(maxFrequency)) {
+                Utils.fileWriteOneLine(Processor.FREQ_MAX_FILE, maxFrequency);
+            }
+            if (minFrequency != null && frequencies != null && frequencies.contains(minFrequency)) {
+                Utils.fileWriteOneLine(Processor.FREQ_MIN_FILE, minFrequency);
+            }
+            Log.d(TAG, "CPU settings restored.");
+        }
+    }
+
+    private void configureIOSched(Context ctx) {
+        SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(ctx);
+
+        if (prefs.getBoolean(IOScheduler.SOB_PREF, false) == false) {
+            Log.i(TAG, "Restore disabled by user preference.");
+            return;
+        }
+
+        String ioscheduler = prefs.getString(IOScheduler.IOSCHED_PREF, null);
+        String availableIOSchedulersLine = Utils.fileReadOneLine(IOScheduler.IOSCHED_LIST_FILE);
+        boolean noSettings = ((availableIOSchedulersLine == null) || (ioscheduler == null));
+        List<String> ioschedulers = null;
+
+        if (noSettings) {
+            Log.d(TAG, "No I/O scheduler settings saved. Nothing to restore.");
+        } else {
+            if (availableIOSchedulersLine != null){
+                ioschedulers = Arrays.asList(availableIOSchedulersLine.replace("[", "").replace("]", "").split(" "));
+            }
+            if (ioscheduler != null && ioschedulers != null && ioschedulers.contains(ioscheduler)) {
+                Utils.fileWriteOneLine(IOScheduler.IOSCHED_LIST_FILE, ioscheduler);
+            }
+            Log.d(TAG, "I/O scheduler settings restored.");
+        }
+    }
+
+}
diff --git a/src/com/android/settings/performance/CMDProcessor.java b/src/com/android/settings/performance/CMDProcessor.java
new file mode 100644
index 0000000..796a110
--- /dev/null
+++ b/src/com/android/settings/performance/CMDProcessor.java
@@ -0,0 +1,134 @@
+package com.android.settings.performance;
+
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.InputStream;
+
+import android.util.Log;
+
+public class CMDProcessor {
+
+    private static final String TAG = "CMD Processor";
+    private Boolean can_su;
+    public SH sh;
+    public SH su;
+
+    public CMDProcessor() {
+        sh = new SH("sh");
+        su = new SH("su");
+    }
+
+    public SH suOrSH() {
+        return canSU() ? su : sh;
+    }
+
+    public boolean canSU() {
+        return canSU(false);
+    }
+
+    public class CommandResult {
+        public final String stdout;
+        public final String stderr;
+        public final Integer exit_value;
+
+        CommandResult(final Integer exit_value_in) {
+            this(exit_value_in, null, null);
+        }
+
+        CommandResult(final Integer exit_value_in, final String stdout_in,
+                final String stderr_in) {
+            exit_value = exit_value_in;
+            stdout = stdout_in;
+            stderr = stderr_in;
+        }
+
+        public boolean success() {
+            return exit_value != null && exit_value == 0;
+        }
+    }
+
+    public class SH {
+        private String SHELL = "sh";
+
+        public SH(final String SHELL_in) {
+            SHELL = SHELL_in;
+        }
+
+        private String getStreamLines(final InputStream is) {
+            String out = null;
+            StringBuffer buffer = null;
+            final DataInputStream dis = new DataInputStream(is);
+
+            try {
+                if (dis.available() > 0) {
+                    buffer = new StringBuffer(dis.readLine());
+                    while (dis.available() > 0) {
+                        buffer.append("\n").append(dis.readLine());
+                    }
+                }
+                dis.close();
+            } catch (final Exception ex) {
+                Log.e(TAG, ex.getMessage());
+            }
+            if (buffer != null) {
+                out = buffer.toString();
+            }
+            return out;
+        }
+
+        public Process run(final String s) {
+            Process process = null;
+            try {
+                process = Runtime.getRuntime().exec(SHELL);
+                final DataOutputStream toProcess = new DataOutputStream(
+                        process.getOutputStream());
+                toProcess.writeBytes("exec " + s + "\n");
+                toProcess.flush();
+            } catch (final Exception e) {
+                Log.e(TAG, "Exception while trying to run: '" + s + "' "
+                        + e.getMessage());
+                process = null;
+            }
+            return process;
+        }
+
+        public CommandResult runWaitFor(final String s) {
+            final Process process = run(s);
+            Integer exit_value = null;
+            String stdout = null;
+            String stderr = null;
+            if (process != null) {
+                try {
+                    exit_value = process.waitFor();
+
+                    stdout = getStreamLines(process.getInputStream());
+                    stderr = getStreamLines(process.getErrorStream());
+
+                } catch (final InterruptedException e) {
+                    Log.e(TAG, "runWaitFor " + e.toString());
+                } catch (final NullPointerException e) {
+                    Log.e(TAG, "runWaitFor " + e.toString());
+                }
+            }
+            return new CommandResult(exit_value, stdout, stderr);
+        }
+    }
+
+    public boolean canSU(final boolean force_check) {
+        if (can_su == null || force_check) {
+            final CommandResult r = su.runWaitFor("id");
+            final StringBuilder out = new StringBuilder();
+
+            if (r.stdout != null) {
+                out.append(r.stdout).append(" ; ");
+            }
+            if (r.stderr != null) {
+                out.append(r.stderr);
+            }
+
+            Log.d(TAG, "canSU() su[" + r.exit_value + "]: " + out);
+            can_su = r.success();
+        }
+        return can_su;
+    }
+}
diff --git a/src/com/android/settings/performance/IOScheduler.java b/src/com/android/settings/performance/IOScheduler.java
new file mode 100644
index 0000000..0bf8a7d
--- /dev/null
+++ b/src/com/android/settings/performance/IOScheduler.java
@@ -0,0 +1,124 @@
+/*
+ * Copyright (C) 2012 The CyanogenMod 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.settings.performance;
+
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Message;
+import android.preference.ListPreference;
+import android.preference.Preference;
+import android.preference.PreferenceScreen;
+
+import com.android.settings.R;
+import com.android.settings.SettingsPreferenceFragment;
+import com.android.settings.Utils;
+
+//
+// I/O Scheduler Related Settings
+//
+public class IOScheduler extends SettingsPreferenceFragment implements
+        Preference.OnPreferenceChangeListener {
+
+    public static final String IOSCHED_PREF = "pref_io_sched";
+    public static final String IOSCHED_LIST_FILE = "/sys/block/mmcblk0/queue/scheduler";
+
+    public static final String SOB_PREF = "pref_io_sched_set_on_boot";
+
+    private static final String TAG = "IOScheduler";
+
+    private String mIOSchedulerFormat;
+
+    private ListPreference mIOSchedulerPref;
+
+    @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+
+        mIOSchedulerFormat = getString(R.string.io_sched_summary);
+
+        String[] availableIOSchedulers = new String[0];
+        String availableIOSchedulersLine;
+        int bropen, brclose;
+        String currentIOScheduler = null;
+
+        addPreferencesFromResource(R.xml.ioscheduler_settings);
+
+        PreferenceScreen prefScreen = getPreferenceScreen();
+
+        mIOSchedulerPref = (ListPreference) prefScreen.findPreference(IOSCHED_PREF);
+
+        /* I/O scheduler
+        Some systems might not use I/O schedulers */
+        if (!Utils.fileExists(IOSCHED_LIST_FILE) ||
+            (availableIOSchedulersLine = Utils.fileReadOneLine(IOSCHED_LIST_FILE)) == null) {
+            prefScreen.removePreference(mIOSchedulerPref);
+
+        } else {
+            availableIOSchedulers = availableIOSchedulersLine.replace("[", "").replace("]", "").split(" ");
+            bropen = availableIOSchedulersLine.indexOf("[");
+            brclose = availableIOSchedulersLine.lastIndexOf("]");
+            if (bropen >= 0 && brclose >= 0)
+                currentIOScheduler = availableIOSchedulersLine.substring(bropen + 1, brclose);
+
+            mIOSchedulerPref.setEntryValues(availableIOSchedulers);
+            mIOSchedulerPref.setEntries(availableIOSchedulers);
+            if (currentIOScheduler != null)
+                mIOSchedulerPref.setValue(currentIOScheduler);
+            mIOSchedulerPref.setSummary(String.format(mIOSchedulerFormat, currentIOScheduler));
+            mIOSchedulerPref.setOnPreferenceChangeListener(this);
+        }
+    }
+
+    @Override
+    public void onResume() {
+        String availableIOSchedulersLine;
+        int bropen, brclose;
+        String currentIOScheduler;
+
+        super.onResume();
+
+        if (Utils.fileExists(IOSCHED_LIST_FILE) &&
+            (availableIOSchedulersLine = Utils.fileReadOneLine(IOSCHED_LIST_FILE)) != null) {
+            bropen = availableIOSchedulersLine.indexOf("[");
+            brclose = availableIOSchedulersLine.lastIndexOf("]");
+            if (bropen >= 0 && brclose >= 0) {
+                currentIOScheduler = availableIOSchedulersLine.substring(bropen + 1, brclose);
+                mIOSchedulerPref.setSummary(String.format(mIOSchedulerFormat, currentIOScheduler));
+            }
+        }
+    }
+
+    public boolean onPreferenceChange(Preference preference, Object newValue) {
+        String fname = "";
+
+        if (newValue != null) {
+            if (preference == mIOSchedulerPref) {
+                fname = IOSCHED_LIST_FILE;
+            }
+
+            if (Utils.fileWriteOneLine(fname, (String) newValue)) {
+                if (preference == mIOSchedulerPref) {
+                    mIOSchedulerPref.setSummary(String.format(mIOSchedulerFormat, (String) newValue));
+                }
+                return true;
+            } else {
+                return false;
+            }
+        }
+        return false;
+    }
+}
diff --git a/src/com/android/settings/performance/MemoryManagement.java b/src/com/android/settings/performance/MemoryManagement.java
new file mode 100644
index 0000000..5c76711
--- /dev/null
+++ b/src/com/android/settings/performance/MemoryManagement.java
@@ -0,0 +1,137 @@
+/*
+ * Copyright (C) 2012 The CyanogenMod 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.settings.performance;
+
+import java.io.File;
+
+import android.os.Bundle;
+import android.os.SystemProperties;
+import android.preference.CheckBoxPreference;
+import android.preference.ListPreference;
+import android.preference.Preference;
+import android.preference.Preference.OnPreferenceChangeListener;
+import android.preference.PreferenceScreen;
+
+import com.android.settings.R;
+import com.android.settings.SettingsPreferenceFragment;
+import com.android.settings.Utils;
+
+public class MemoryManagement extends SettingsPreferenceFragment implements
+        OnPreferenceChangeListener {
+
+    public static final String KSM_RUN_FILE = "/sys/kernel/mm/ksm/run";
+
+    public static final String KSM_PREF = "pref_ksm";
+
+    public static final String KSM_PREF_DISABLED = "0";
+
+    public static final String KSM_PREF_ENABLED = "1";
+
+    private static final String ZRAM_PREF = "pref_zram_size";
+
+    private static final String ZRAM_PERSIST_PROP = "persist.service.zram"; // was compcache
+
+    private static final String ZRAM_DEFAULT = SystemProperties.get("ro.zram.default"); // was compcache
+
+    private static final String PURGEABLE_ASSETS_PREF = "pref_purgeable_assets";
+
+    private static final String PURGEABLE_ASSETS_PERSIST_PROP = "persist.sys.purgeable_assets";
+
+    private static final String PURGEABLE_ASSETS_DEFAULT = "0";
+
+    private ListPreference mzRAM;
+
+    private CheckBoxPreference mPurgeableAssetsPref;
+
+    private CheckBoxPreference mKSMPref;
+
+    private int swapAvailable = -1;
+
+    @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+
+        if (getPreferenceManager() != null) {
+
+            addPreferencesFromResource(R.xml.memory_management);
+
+            PreferenceScreen prefSet = getPreferenceScreen();
+
+            mzRAM = (ListPreference) prefSet.findPreference(ZRAM_PREF);
+            mPurgeableAssetsPref = (CheckBoxPreference) prefSet.findPreference(PURGEABLE_ASSETS_PREF);
+            mKSMPref = (CheckBoxPreference) prefSet.findPreference(KSM_PREF);
+
+            if (isSwapAvailable()) {
+                if (SystemProperties.get(ZRAM_PERSIST_PROP) == "1")
+                    SystemProperties.set(ZRAM_PERSIST_PROP, ZRAM_DEFAULT);
+                mzRAM.setValue(SystemProperties.get(ZRAM_PERSIST_PROP, ZRAM_DEFAULT));
+                mzRAM.setOnPreferenceChangeListener(this);
+            } else {
+                prefSet.removePreference(mzRAM);
+            }
+
+            if (Utils.fileExists(KSM_RUN_FILE)) {
+                mKSMPref.setChecked(KSM_PREF_ENABLED.equals(Utils.fileReadOneLine(KSM_RUN_FILE)));
+            } else {
+                prefSet.removePreference(mKSMPref);
+            }
+
+            String purgeableAssets = SystemProperties.get(PURGEABLE_ASSETS_PERSIST_PROP,
+                    PURGEABLE_ASSETS_DEFAULT);
+            mPurgeableAssetsPref.setChecked("1".equals(purgeableAssets));
+
+        }
+    }
+
+    @Override
+    public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
+
+        if (preference == mPurgeableAssetsPref) {
+            SystemProperties.set(PURGEABLE_ASSETS_PERSIST_PROP,
+                    mPurgeableAssetsPref.isChecked() ? "1" : "0");
+            return true;
+        }
+
+        if (preference == mKSMPref) {
+            Utils.fileWriteOneLine(KSM_RUN_FILE, mKSMPref.isChecked() ? "1" : "0");
+            return true;
+        }
+
+        return false;
+    }
+
+    public boolean onPreferenceChange(Preference preference, Object newValue) {
+        if (preference == mzRAM) {
+            if (newValue != null) {
+                SystemProperties.set(ZRAM_PERSIST_PROP, (String) newValue);
+                return true;
+            }
+        }
+
+        return false;
+    }
+
+    /**
+     * Check if swap support is available on the system
+     */
+    private boolean isSwapAvailable() {
+        if (swapAvailable < 0) {
+            swapAvailable = new File("/proc/swaps").exists() ? 1 : 0;
+        }
+        return swapAvailable > 0;
+    }
+}
diff --git a/src/com/android/settings/performance/PerformanceSettings.java b/src/com/android/settings/performance/PerformanceSettings.java
new file mode 100644
index 0000000..f9fc5e5
--- /dev/null
+++ b/src/com/android/settings/performance/PerformanceSettings.java
@@ -0,0 +1,94 @@
+/*
+ * Copyright (C) 2012 The CyanogenMod 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.settings.performance;
+
+import android.app.AlertDialog;
+import android.content.DialogInterface;
+import android.os.Bundle;
+import android.os.SystemProperties;
+import android.preference.CheckBoxPreference;
+import android.preference.Preference;
+import android.preference.ListPreference;
+import android.preference.PreferenceScreen;
+import android.preference.Preference.OnPreferenceChangeListener;
+import android.preference.Preference;
+
+import com.android.settings.R;
+import com.android.settings.SettingsPreferenceFragment;
+
+public class PerformanceSettings extends SettingsPreferenceFragment implements Preference.OnPreferenceChangeListener {
+    private static final String TAG = "PerformanceSettings";
+
+    private static final String USE_DITHERING_PREF = "pref_use_dithering";
+    private static final String USE_DITHERING_PERSIST_PROP = "persist.sys.use_dithering";
+    private static final String USE_DITHERING_DEFAULT = "1";
+
+    private static final String USE_16BPP_ALPHA_PREF = "pref_use_16bpp_alpha";
+    private static final String USE_16BPP_ALPHA_PROP = "persist.sys.use_16bpp_alpha";
+
+    private ListPreference mUseDitheringPref;
+
+    private CheckBoxPreference mUse16bppAlphaPref;
+
+    @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+
+        if (getPreferenceManager() != null) {
+
+            addPreferencesFromResource(R.xml.performance_settings);
+
+            PreferenceScreen prefSet = getPreferenceScreen();
+
+            String useDithering = SystemProperties.get(USE_DITHERING_PERSIST_PROP, USE_DITHERING_DEFAULT);
+            mUseDitheringPref = (ListPreference) prefSet.findPreference(USE_DITHERING_PREF);
+            mUseDitheringPref.setOnPreferenceChangeListener(this);
+            mUseDitheringPref.setValue(useDithering);
+            mUseDitheringPref.setSummary(mUseDitheringPref.getEntry());
+
+            mUse16bppAlphaPref = (CheckBoxPreference) prefSet.findPreference(USE_16BPP_ALPHA_PREF);
+            String use16bppAlpha = SystemProperties.get(USE_16BPP_ALPHA_PROP, "0");
+            mUse16bppAlphaPref.setChecked("1".equals(use16bppAlpha));
+
+        }
+    }
+
+    @Override
+    public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
+        if (preference == mUse16bppAlphaPref) {
+            SystemProperties.set(USE_16BPP_ALPHA_PROP,
+                    mUse16bppAlphaPref.isChecked() ? "1" : "0");
+        } else {
+            // If we didn't handle it, let preferences handle it.
+            return super.onPreferenceTreeClick(preferenceScreen, preference);
+        }
+//        return true;
+        return false;
+
+    }
+
+    public boolean onPreferenceChange(Preference preference, Object newValue) {
+        if (preference == mUseDitheringPref) {
+            String newVal = (String) newValue;
+            int index = mUseDitheringPref.findIndexOfValue(newVal);
+            SystemProperties.set(USE_DITHERING_PERSIST_PROP, newVal);
+            mUseDitheringPref.setSummary(mUseDitheringPref.getEntries()[index]);
+        }
+        return true;
+    }
+
+}
diff --git a/src/com/android/settings/performance/Processor.java b/src/com/android/settings/performance/Processor.java
new file mode 100644
index 0000000..791f1a9
--- /dev/null
+++ b/src/com/android/settings/performance/Processor.java
@@ -0,0 +1,247 @@
+/*
+ * Copyright (C) 2012 The CyanogenMod 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.settings.performance;
+
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Message;
+import android.preference.ListPreference;
+import android.preference.Preference;
+import android.preference.PreferenceScreen;
+
+import com.android.settings.R;
+import com.android.settings.SettingsPreferenceFragment;
+import com.android.settings.Utils;
+
+//
+// CPU Related Settings
+//
+public class Processor extends SettingsPreferenceFragment implements
+        Preference.OnPreferenceChangeListener {
+
+    public static final String FREQ_CUR_PREF = "pref_cpu_freq_cur";
+    public static final String SCALE_CUR_FILE = "/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq";
+    public static final String FREQINFO_CUR_FILE = "/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq";
+    private static String FREQ_CUR_FILE = SCALE_CUR_FILE;
+    public static final String GOV_PREF = "pref_cpu_gov";
+    public static final String GOV_LIST_FILE = "/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors";
+    public static final String GOV_FILE = "/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor";
+    public static final String FREQ_MIN_PREF = "pref_cpu_freq_min";
+    public static final String FREQ_MAX_PREF = "pref_cpu_freq_max";
+    public static final String FREQ_LIST_FILE = "/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies";
+    public static final String FREQ_MAX_FILE = "/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq";
+    public static final String FREQ_MIN_FILE = "/sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq";
+    public static final String SOB_PREF = "pref_cpu_set_on_boot";
+
+    private static final String TAG = "CPUSettings";
+
+    private String mGovernorFormat;
+    private String mMinFrequencyFormat;
+    private String mMaxFrequencyFormat;
+
+    private Preference mCurFrequencyPref;
+    private ListPreference mGovernorPref;
+    private ListPreference mMinFrequencyPref;
+    private ListPreference mMaxFrequencyPref;
+
+    private class CurCPUThread extends Thread {
+        private boolean mInterrupt = false;
+
+        public void interrupt() {
+            mInterrupt = true;
+        }
+
+        @Override
+        public void run() {
+            try {
+                while (!mInterrupt) {
+                    sleep(500);
+                    final String curFreq = Utils.fileReadOneLine(FREQ_CUR_FILE);
+                    if (curFreq != null)
+                        mCurCPUHandler.sendMessage(mCurCPUHandler.obtainMessage(0, curFreq));
+                }
+            } catch (InterruptedException e) {
+            }
+        }
+    };
+
+    private CurCPUThread mCurCPUThread = new CurCPUThread();
+
+    private Handler mCurCPUHandler = new Handler() {
+        public void handleMessage(Message msg) {
+            mCurFrequencyPref.setSummary(toMHz((String) msg.obj));
+        }
+    };
+
+    @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+
+        mGovernorFormat = getString(R.string.cpu_governors_summary);
+        mMinFrequencyFormat = getString(R.string.cpu_min_freq_summary);
+        mMaxFrequencyFormat = getString(R.string.cpu_max_freq_summary);
+
+        String[] availableFrequencies = new String[0];
+        String[] availableGovernors = new String[0];
+        String[] frequencies;
+        String availableGovernorsLine;
+        String availableFrequenciesLine;
+        String temp;
+
+        addPreferencesFromResource(R.xml.processor_settings);
+
+        PreferenceScreen prefScreen = getPreferenceScreen();
+
+        mGovernorPref = (ListPreference) prefScreen.findPreference(GOV_PREF);
+        mCurFrequencyPref = (Preference) prefScreen.findPreference(FREQ_CUR_PREF);
+        mMinFrequencyPref = (ListPreference) prefScreen.findPreference(FREQ_MIN_PREF);
+        mMaxFrequencyPref = (ListPreference) prefScreen.findPreference(FREQ_MAX_PREF);
+
+        /* Governor
+        Some systems might not use governors */
+        if (!Utils.fileExists(GOV_LIST_FILE) || !Utils.fileExists(GOV_FILE) || (temp = Utils.fileReadOneLine(GOV_FILE)) == null || (availableGovernorsLine = Utils.fileReadOneLine(GOV_LIST_FILE)) == null) {
+            prefScreen.removePreference(mGovernorPref);
+
+        } else {
+            availableGovernors = availableGovernorsLine.split(" ");
+
+            mGovernorPref.setEntryValues(availableGovernors);
+            mGovernorPref.setEntries(availableGovernors);
+            mGovernorPref.setValue(temp);
+            mGovernorPref.setSummary(String.format(mGovernorFormat, temp));
+            mGovernorPref.setOnPreferenceChangeListener(this);
+        }
+
+        // Disable the min/max list if we dont have a list file
+        if (!Utils.fileExists(FREQ_LIST_FILE) || (availableFrequenciesLine = Utils.fileReadOneLine(FREQ_LIST_FILE)) == null) {
+            mMinFrequencyPref.setEnabled(false);
+            mMaxFrequencyPref.setEnabled(false);
+
+        } else {
+            availableFrequencies = availableFrequenciesLine.split(" ");
+
+            frequencies = new String[availableFrequencies.length];
+            for (int i = 0; i < frequencies.length; i++) {
+                frequencies[i] = toMHz(availableFrequencies[i]);
+            }
+
+            // Min frequency
+            if (!Utils.fileExists(FREQ_MIN_FILE) || (temp = Utils.fileReadOneLine(FREQ_MIN_FILE)) == null) {
+                mMinFrequencyPref.setEnabled(false);
+
+            } else {
+                mMinFrequencyPref.setEntryValues(availableFrequencies);
+                mMinFrequencyPref.setEntries(frequencies);
+                mMinFrequencyPref.setValue(temp);
+                mMinFrequencyPref.setSummary(String.format(mMinFrequencyFormat, toMHz(temp)));
+                mMinFrequencyPref.setOnPreferenceChangeListener(this);
+            }
+
+            // Max frequency
+            if (!Utils.fileExists(FREQ_MAX_FILE) || (temp = Utils.fileReadOneLine(FREQ_MAX_FILE)) == null) {
+                mMaxFrequencyPref.setEnabled(false);
+
+            } else {
+                mMaxFrequencyPref.setEntryValues(availableFrequencies);
+                mMaxFrequencyPref.setEntries(frequencies);
+                mMaxFrequencyPref.setValue(temp);
+                mMaxFrequencyPref.setSummary(String.format(mMaxFrequencyFormat, toMHz(temp)));
+                mMaxFrequencyPref.setOnPreferenceChangeListener(this);
+            }
+        }
+
+        // Cur frequency
+        if (!Utils.fileExists(FREQ_CUR_FILE)) {
+            FREQ_CUR_FILE = FREQINFO_CUR_FILE;
+        }
+
+        if (!Utils.fileExists(FREQ_CUR_FILE) || (temp = Utils.fileReadOneLine(FREQ_CUR_FILE)) == null) {
+            mCurFrequencyPref.setEnabled(false);
+
+        } else {
+            mCurFrequencyPref.setSummary(toMHz(temp));
+
+            mCurCPUThread.start();
+        }
+    }
+
+    @Override
+    public void onResume() {
+        String temp;
+
+        super.onResume();
+
+        if (Utils.fileExists(FREQ_MIN_FILE) && (temp = Utils.fileReadOneLine(FREQ_MIN_FILE)) != null) {
+            mMinFrequencyPref.setValue(temp);
+            mMinFrequencyPref.setSummary(String.format(mMinFrequencyFormat, toMHz(temp)));
+        }
+
+        if (Utils.fileExists(FREQ_MAX_FILE) && (temp = Utils.fileReadOneLine(FREQ_MAX_FILE)) != null) {
+            mMaxFrequencyPref.setValue(temp);
+            mMaxFrequencyPref.setSummary(String.format(mMaxFrequencyFormat, toMHz(temp)));
+        }
+
+        if (Utils.fileExists(GOV_FILE) && (temp = Utils.fileReadOneLine(GOV_FILE)) != null) {
+            mGovernorPref.setSummary(String.format(mGovernorFormat, temp));
+        }
+    }
+
+    @Override
+    public void onDestroy() {
+        super.onDestroy();
+        mCurCPUThread.interrupt();
+        try {
+            mCurCPUThread.join();
+        } catch (InterruptedException e) {
+        }
+    }
+
+    public boolean onPreferenceChange(Preference preference, Object newValue) {
+        String fname = "";
+
+        if (newValue != null) {
+            if (preference == mGovernorPref) {
+                fname = GOV_FILE;
+            } else if (preference == mMinFrequencyPref) {
+                fname = FREQ_MIN_FILE;
+            } else if (preference == mMaxFrequencyPref) {
+                fname = FREQ_MAX_FILE;
+            }
+
+            if (Utils.fileWriteOneLine(fname, (String) newValue)) {
+                if (preference == mGovernorPref) {
+                    mGovernorPref.setSummary(String.format(mGovernorFormat, (String) newValue));
+                } else if (preference == mMinFrequencyPref) {
+                    mMinFrequencyPref.setSummary(String.format(mMinFrequencyFormat,
+                            toMHz((String) newValue)));
+                } else if (preference == mMaxFrequencyPref) {
+                    mMaxFrequencyPref.setSummary(String.format(mMaxFrequencyFormat,
+                            toMHz((String) newValue)));
+                }
+                return true;
+            } else {
+                return false;
+            }
+        }
+        return false;
+    }
+
+    private String toMHz(String mhzString) {
+        return new StringBuilder().append(Integer.valueOf(mhzString) / 1000).append(" MHz")
+                .toString();
+    }
+}
diff --git a/src/com/android/settings/performance/Voltage.java b/src/com/android/settings/performance/Voltage.java
new file mode 100644
index 0000000..07b45b9
--- /dev/null
+++ b/src/com/android/settings/performance/Voltage.java
@@ -0,0 +1,31 @@
+package com.android.settings.performance;
+
+public class Voltage {
+    private String freq;
+    private String currentMv;
+    private String savedMv;
+
+    public void setFreq(final String freq) {
+        this.freq = freq;
+    }
+
+    public String getFreq() {
+        return freq;
+    }
+
+    public void setCurrentMV(final String currentMv) {
+        this.currentMv = currentMv;
+    }
+
+    public String getCurrentMv() {
+        return currentMv;
+    }
+
+    public void setSavedMV(final String savedMv) {
+        this.savedMv = savedMv;
+    }
+
+    public String getSavedMV() {
+        return savedMv;
+    }
+}
diff --git a/src/com/android/settings/performance/VoltageControlSettings.java b/src/com/android/settings/performance/VoltageControlSettings.java
new file mode 100644
index 0000000..db3021f
--- /dev/null
+++ b/src/com/android/settings/performance/VoltageControlSettings.java
@@ -0,0 +1,382 @@
+package com.android.settings.performance;
+
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.app.Dialog;
+import android.app.DialogFragment;
+import android.app.Fragment;
+import android.app.FragmentManager;
+import android.app.FragmentTransaction;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.DialogInterface.OnCancelListener;
+import android.content.SharedPreferences;
+import android.os.Bundle;
+import android.preference.PreferenceManager;
+import android.text.Editable;
+import android.text.TextWatcher;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.view.ViewGroup;
+import android.widget.AdapterView;
+import android.widget.AdapterView.OnItemClickListener;
+import android.widget.BaseAdapter;
+import android.widget.Button;
+import android.widget.CompoundButton;
+import android.widget.CompoundButton.OnCheckedChangeListener;
+import android.widget.EditText;
+import android.widget.LinearLayout;
+import android.widget.ListView;
+import android.widget.SeekBar;
+import android.widget.SeekBar.OnSeekBarChangeListener;
+import android.widget.TextView;
+import android.widget.Switch;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import com.android.settings.R;
+
+import com.android.settings.performance.CMDProcessor;
+
+public class VoltageControlSettings extends Fragment {
+
+    private static final String TAG = "VoltageControlActivity";
+
+    public static final String KEY_APPLY_BOOT = "apply_voltages_at_boot";
+    public static final String MV_TABLE0 = "/sys/devices/system/cpu/cpu0/cpufreq/UV_mV_table";
+    public static final String MV_TABLE1 = "/sys/devices/system/cpu/cpu1/cpufreq/UV_mV_table";
+    public static final int DIALOG_EDIT_VOLT = 0;
+    private List<Voltage> mVoltages;
+    private ListAdapter mAdapter;
+    private static SharedPreferences preferences;
+    private Voltage mVoltage;
+    private Activity mActivity;
+
+    @Override
+    public View onCreateView(LayoutInflater inflater, ViewGroup root, Bundle savedInstanceState) {
+        mActivity = getActivity();
+        View view = inflater.inflate(R.xml.voltage_settings, root, false);
+        preferences = PreferenceManager.getDefaultSharedPreferences(mActivity);
+
+        final ListView listView = (ListView) view.findViewById(R.id.ListView);
+        final Switch setOnBoot = (Switch) view.findViewById(R.id.applyAtBoot);
+        mAdapter = new ListAdapter(mActivity);
+        mVoltages = getVolts(preferences);
+
+        if (mVoltages.isEmpty()) {
+            ((TextView) view.findViewById(R.id.emptyList))
+                    .setVisibility(View.VISIBLE);
+            ((LinearLayout) view.findViewById(R.id.BottomBar))
+                    .setVisibility(View.GONE);
+        }
+
+        setOnBoot.setChecked(preferences.getBoolean(KEY_APPLY_BOOT, false));
+        setOnBoot.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+            @Override
+            public void onCheckedChanged(CompoundButton buttonView,
+                    boolean isChecked) {
+                final SharedPreferences.Editor editor = preferences.edit();
+                editor.putBoolean(KEY_APPLY_BOOT, isChecked);
+                editor.commit();
+            }
+        });
+
+        ((Button) view.findViewById(R.id.applyBtn))
+                .setOnClickListener(new OnClickListener() {
+            @Override
+            public void onClick(View arg0) {
+                final StringBuilder sb = new StringBuilder();
+                for (final Voltage volt : mVoltages) {
+                    sb.append(volt.getSavedMV() + " ");
+                }
+                new CMDProcessor().su.runWaitFor("busybox echo "
+                        + sb.toString() + " > "
+                        + MV_TABLE0);
+                if (new File(MV_TABLE1).exists()) {
+                    new CMDProcessor().su.runWaitFor("busybox echo "
+                            + sb.toString()
+                            + " > " + MV_TABLE1);
+                }
+                final List<Voltage> volts = getVolts(preferences);
+                mVoltages.clear();
+                mVoltages.addAll(volts);
+                mAdapter.notifyDataSetChanged();
+            }
+        });
+
+        mAdapter.setListItems(mVoltages);
+        listView.setAdapter(mAdapter);
+        listView.setOnItemClickListener(new OnItemClickListener() {
+            @Override
+            public void onItemClick(AdapterView<?> parent, View view, int position,
+                    long id) {
+                mVoltage = mVoltages.get(position);
+                showDialog(DIALOG_EDIT_VOLT);
+            }
+        });
+
+        return view;
+    }
+
+    public static List<Voltage> getVolts(final SharedPreferences preferences) {
+        final List<Voltage> volts = new ArrayList<Voltage>();
+        try {
+            BufferedReader br = new BufferedReader(new FileReader(MV_TABLE0), 256);
+            String line = "";
+            while ((line = br.readLine()) != null) {
+                final String[] values = line.split("\\s+");
+                if (values != null) {
+                    if (values.length >= 2) {
+                        final String freq = values[0].replace("mhz:", "");
+                        final String currentMv = values[1];
+                        final String savedMv = preferences.getString(freq, currentMv);
+                        final Voltage voltage = new Voltage();
+                        voltage.setFreq(freq);
+                        voltage.setCurrentMV(currentMv);
+                        voltage.setSavedMV(savedMv);
+                        volts.add(voltage);
+                    }
+                }
+            }
+            br.close();
+        } catch (FileNotFoundException e) {
+            Log.d(TAG, MV_TABLE0 + " does not exist");
+        } catch (IOException e) {
+            Log.d(TAG, "Error reading " + MV_TABLE0);
+        }
+        return volts;
+    }
+
+    private static final int[] STEPS = new int[] {
+            600, 625, 650, 675, 700, 725, 750, 775, 800, 825, 850,
+            875, 900, 925, 950, 975, 1000, 1025, 1050, 1075, 1100,
+            1125, 1150, 1175, 1200, 1225, 1250, 1275, 1300, 1325,
+            1350, 1375, 1400, 1425, 1450, 1475, 1500, 1525, 1550,
+            1575, 1600
+    };
+
+    private static int getNearestStepIndex(final int value) {
+        int index = 0;
+        for (int i = 0; i < STEPS.length; i++) {
+            if (value > STEPS[i]) {
+                index++;
+            } else {
+                break;
+            }
+        }
+        return index;
+    }
+
+    protected void showDialog(final int id) {
+        AlertDialog dialog = null;
+        switch (id) {
+            case DIALOG_EDIT_VOLT:
+                final LayoutInflater factory = LayoutInflater.from(mActivity);
+                final View voltageDialog = factory.inflate(R.layout.voltage_dialog, null);
+
+                final EditText voltageEdit = (EditText) voltageDialog
+                        .findViewById(R.id.voltageEdit);
+                final SeekBar voltageSeek = (SeekBar) voltageDialog.findViewById(R.id.voltageSeek);
+                final TextView voltageMeter = (TextView) voltageDialog
+                        .findViewById(R.id.voltageMeter);
+
+                final String savedMv = mVoltage.getSavedMV();
+                final int savedVolt = Integer.parseInt(savedMv);
+                voltageEdit.setText(savedMv);
+                voltageEdit.addTextChangedListener(new TextWatcher() {
+                    @Override
+                    public void afterTextChanged(Editable arg0) {
+                        // TODO Auto-generated method stub
+                    }
+
+                    @Override
+                    public void beforeTextChanged(CharSequence arg0, int arg1,
+                            int arg2, int arg3) {
+                        // TODO Auto-generated method stub
+                    }
+
+                    @Override
+                    public void onTextChanged(CharSequence arg0, int arg1,
+                            int arg2, int arg3) {
+                        final String text = voltageEdit.getText().toString();
+                        int value = 0;
+                        try {
+                            value = Integer.parseInt(text);
+                        } catch (NumberFormatException nfe) {
+                            return;
+                        }
+                        voltageMeter.setText(text + " mV");
+                        final int index = getNearestStepIndex(value);
+                        voltageSeek.setProgress(index);
+                    }
+
+                });
+
+                voltageMeter.setText(savedMv + " mV");
+                voltageSeek.setMax(40);
+                voltageSeek.setProgress(getNearestStepIndex(savedVolt));
+                voltageSeek.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {
+                    @Override
+                    public void onProgressChanged(SeekBar sb, int progress,
+                            boolean fromUser) {
+                        if (fromUser) {
+                            final String volt = Integer.toString(STEPS[progress]);
+                            voltageMeter.setText(volt + " mV");
+                            voltageEdit.setText(volt);
+                        }
+                    }
+
+                    @Override
+                    public void onStartTrackingTouch(SeekBar seekBar) {
+                        // TODO Auto-generated method stub
+
+                    }
+
+                    @Override
+                    public void onStopTrackingTouch(SeekBar seekBar) {
+                        // TODO Auto-generated method stub
+
+                    }
+
+                });
+
+                dialog = new AlertDialog.Builder(mActivity)
+                        .setTitle(mVoltage.getFreq() + getResources().getString(R.string.ps_volt_mhz_voltage))
+                        .setView(voltageDialog)
+                        .setPositiveButton(getResources().getString(R.string.ps_volt_save), new DialogInterface.OnClickListener() {
+                    public void onClick(DialogInterface dialog, int whichButton) {
+                        removeDialog(id);
+                        final String value = voltageEdit.getText().toString();
+                        SharedPreferences.Editor editor = preferences.edit();
+                        editor.putString(mVoltage.getFreq(), value);
+                        editor.commit();
+                        mVoltage.setSavedMV(value);
+                        mAdapter.notifyDataSetChanged();
+                    }
+                })
+                .setNegativeButton(null,
+                        new  DialogInterface.OnClickListener() {
+                    public void onClick(DialogInterface dialog,
+                            int whichButton) {
+                        removeDialog(id);
+                    }
+                }).create();
+                break;
+            default:
+                break;
+        }
+
+        if (dialog != null) {
+            FragmentManager fm = getActivity().getFragmentManager();
+            FragmentTransaction ftr = fm.beginTransaction();
+            CustomDialogFragment newFragment = CustomDialogFragment.newInstance(dialog);
+            DialogFragment fragmentDialog = (DialogFragment) fm.findFragmentByTag("" + id);
+            if (fragmentDialog != null) {
+                ftr.remove(fragmentDialog);
+                ftr.commit();
+            }
+            newFragment.show(fm, "" + id);
+        }
+    }
+
+    protected void removeDialog(int pDialogId) {
+        FragmentManager fm = mActivity.getFragmentManager();
+        FragmentTransaction ftr = fm.beginTransaction();
+        DialogFragment fragmentDialog = null;
+        fragmentDialog = (DialogFragment) fm.findFragmentByTag("" + pDialogId);
+        if (fragmentDialog != null) {
+            FragmentTransaction f = ftr.remove(fragmentDialog);
+            f.commit();
+        }
+    }
+
+    protected static class CustomDialogFragment extends DialogFragment {
+        private Dialog mDialog;
+
+        public static CustomDialogFragment newInstance(Dialog dialog) {
+            CustomDialogFragment frag = new CustomDialogFragment();
+            frag.mDialog = dialog;
+            return frag;
+        }
+
+        public Dialog onCreateDialog(Bundle savedInstanceState) {
+            return mDialog;
+        }
+    }
+
+    public class ListAdapter extends BaseAdapter {
+        private LayoutInflater mInflater;
+        private List<Voltage> results;
+
+        public ListAdapter(Context context) {
+            mInflater = LayoutInflater.from(context);
+        }
+
+        @Override
+        public int getCount() {
+            return results.size();
+        }
+
+        @Override
+        public Object getItem(int position) {
+            return results.get(position);
+        }
+
+        @Override
+        public long getItemId(int position) {
+            return position;
+        }
+
+        @Override
+        public View getView(final int position, View convertView, ViewGroup parent) {
+
+            final ViewHolder holder;
+            if (convertView == null) {
+                convertView = mInflater.inflate(R.layout.list_volt, null);
+                holder = new ViewHolder();
+                holder.mFreq = (TextView) convertView.findViewById(R.id.Freq);
+                holder.mCurrentMV = (TextView) convertView.findViewById(R.id.mVCurrent);
+                holder.mSavedMV = (TextView) convertView.findViewById(R.id.mVSaved);
+                convertView.setTag(holder);
+            } else {
+                holder = (ViewHolder) convertView.getTag();
+            }
+
+            final Voltage voltage = mVoltages.get(position);
+            holder.setFreq(voltage.getFreq());
+            holder.setCurrentMV(voltage.getCurrentMv());
+            holder.setSavedMV(voltage.getSavedMV());
+            return convertView;
+        }
+
+        public void setListItems(List<Voltage> mVoltages) {
+            results = mVoltages;
+        }
+
+        public class ViewHolder {
+            private TextView mFreq;
+            private TextView mCurrentMV;
+            private TextView mSavedMV;
+
+            public void setFreq(final String freq) {
+                mFreq.setText(freq + " MHz");
+            }
+
+            public void setCurrentMV(final String currentMv) {
+               mCurrentMV.setText(getResources().getString(R.string.ps_volt_current_voltage) + currentMv + " mV");
+            }
+
+            public void setSavedMV(final String savedMv) {
+               mSavedMV.setText(getResources().getString(R.string.ps_volt_setting_to_apply) + savedMv + " mV");
+            }
+        }
+    }
+}
diff --git a/src/com/android/settings/th/IconPicker.java b/src/com/android/settings/th/IconPicker.java
new file mode 100644
index 0000000..abe7c15
--- /dev/null
+++ b/src/com/android/settings/th/IconPicker.java
@@ -0,0 +1,201 @@
+/*
+ * Copyright (C) 2012 The CyanogenMod 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.settings.th;
+
+import java.io.File;
+import java.util.ArrayList;
+
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.app.Dialog;
+import android.app.Fragment;
+import android.content.ActivityNotFoundException;
+import android.content.ComponentName;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.content.res.Resources;
+import android.content.res.TypedArray;
+import android.graphics.Bitmap;
+import android.graphics.drawable.Drawable;
+import android.net.Uri;
+import android.provider.MediaStore;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.AdapterView;
+import android.widget.AdapterView.OnItemClickListener;
+import android.widget.BaseAdapter;
+import android.widget.ListView;
+import android.widget.TextView;
+
+import com.android.settings.R;
+
+public class IconPicker {
+
+    private Activity mParent;
+    private Resources mResources;
+    private OnIconPickListener mIconListener;
+    private static final String ICON_ACTION = "com.cyanogenmod.ACTION_PICK_ICON";
+    public static final String RESOURCE_NAME = "resource_name";
+    public static final String PACKAGE_NAME = "package_name";
+    public static final int REQUEST_PICK_SYSTEM = 0;
+    public static final int REQUEST_PICK_GALLERY = 1;
+    public static final int REQUEST_PICK_ICON_PACK = 2;
+
+    public interface OnIconPickListener {
+        void iconPicked(int requestCode, int resultCode, Intent in);
+    }
+
+    public IconPicker(Activity parent, OnIconPickListener listener) {
+        mParent = parent;
+        mResources = parent.getResources();
+        mIconListener = listener;
+    }
+
+    public void onActivityResult(int requestCode, int resultCode, Intent data) {
+        mIconListener.iconPicked(requestCode, resultCode, data);
+    }
+
+    public void pickIcon(final int fragmentId, final File image) {
+        Intent iconPack = new Intent(ICON_ACTION);
+        ArrayList<String> items = new ArrayList<String>();
+        items.add(mResources.getString(R.string.icon_picker_system_icons_title));
+        items.add(mResources.getString(R.string.icon_picker_gallery_title));
+        ComponentName aInfo = iconPack.resolveActivity(mParent.getPackageManager());
+        if (aInfo != null) {
+            items.add(mResources.getString(R.string.icon_picker_pack_title));
+        }
+        new AlertDialog.Builder(mParent)
+        .setTitle(R.string.icon_picker_title)
+        .setItems(items.toArray(new String[items.size()]), new DialogInterface.OnClickListener() {
+            public void onClick(DialogInterface dialog, int item) {
+                showChosen(item, image, fragmentId);
+            }
+        }).show();
+    }
+
+    private void startFragmentOrActivityForResult(Intent pickIntent, int requestCode, int fragmentId) {
+        if (fragmentId == 0) {
+            mParent.startActivityForResult(pickIntent, requestCode);
+        } else {
+            Fragment cFrag = mParent.getFragmentManager().findFragmentById(fragmentId);
+            if (cFrag != null) {
+                mParent.startActivityFromFragment(cFrag, pickIntent, requestCode);
+            }
+        }
+    }
+
+    private void showChosen(final int type, File image, int fragmentId) {
+        if (type == REQUEST_PICK_SYSTEM) {
+            ListView listie = new ListView(mParent);
+            listie.setAdapter(new IconAdapter());
+            final Dialog dialog = new Dialog(mParent);
+            dialog.setTitle(R.string.icon_picker_choose_icon_title);
+            dialog.setContentView(listie);
+            listie.setOnItemClickListener(new OnItemClickListener(){
+                @Override
+                public void onItemClick(AdapterView<?> parent, View view,
+                        int position, long id) {
+                    Intent in = new Intent();
+                    in.putExtra("resource_name", ((IconAdapter) parent.getAdapter()).getItemReference(position));
+                    mIconListener.iconPicked(type, Activity.RESULT_OK, in);
+                    dialog.dismiss();
+                }
+            });
+            dialog.show();
+        } else if (type == REQUEST_PICK_GALLERY) {
+            Intent intent = new Intent(Intent.ACTION_GET_CONTENT, null);
+            intent.setType("image/*");
+            intent.putExtra("crop", "true");
+            intent.putExtra("scale", true);
+            intent.putExtra("scaleUpIfNeeded", false);
+            intent.putExtra("outputFormat", Bitmap.CompressFormat.PNG.toString());
+            intent.putExtra("aspectX", 1);
+            intent.putExtra("aspectY", 1);
+            intent.putExtra("outputX", 162);
+            intent.putExtra("outputY", 162);
+            try {
+                intent.putExtra(MediaStore.EXTRA_OUTPUT,Uri.fromFile(image));
+                intent.putExtra("return-data", false);
+                startFragmentOrActivityForResult(intent, type, fragmentId);
+            } catch (ActivityNotFoundException e) {
+                e.printStackTrace();
+            }
+        } else if (type == REQUEST_PICK_ICON_PACK) {
+            Intent iconPack = new Intent(ICON_ACTION);
+            startFragmentOrActivityForResult(iconPack, type, fragmentId);
+        }
+    }
+
+    class IconAdapter extends BaseAdapter {
+
+        String[] labels;
+        TypedArray icons;
+
+        public IconAdapter() {
+            labels = mResources.getStringArray(R.array.lockscreen_icon_picker_labels);
+            icons = mResources.obtainTypedArray(R.array.lockscreen_icon_picker_icons);
+        }
+
+        @Override
+        public int getCount() {
+            return labels.length;
+        }
+
+        @Override
+        public Object getItem(int position) {
+            return icons.getDrawable(position);
+        }
+
+        public String getItemReference(int position) {
+            String name = icons.getString(position);
+            int separatorIndex = name.lastIndexOf(File.separator);
+            int periodIndex = name.lastIndexOf('.');
+            return name.substring(separatorIndex + 1, periodIndex);
+        }
+
+        @Override
+        public long getItemId(int position) {
+            return 0;
+        }
+
+        @Override
+        public View getView(int position, View convertView, ViewGroup parent) {
+            View iView = convertView;
+            if (convertView == null) {
+                iView = View.inflate(mParent, android.R.layout.simple_list_item_1, null);
+            }
+            TextView tt = (TextView) iView.findViewById(android.R.id.text1);
+            tt.setText(labels[position]);
+            Drawable ic = ((Drawable) getItem(position)).mutate();
+            int bound = mParent.getResources().getDimensionPixelSize(R.dimen.shortcut_picker_left_padding);
+            ic.setBounds(0,  0, bound, bound);
+            tt.setCompoundDrawables(ic, null, null, null);
+            return iView;
+        }
+
+    }
+
+    class IconItem {
+        String label;
+        int id;
+        IconItem(String l, int i) {
+            label = l;
+            id = i;
+        }
+    }
+
+}
diff --git a/src/com/android/settings/th/LockscreenTargets.java b/src/com/android/settings/th/LockscreenTargets.java
new file mode 100644
index 0000000..7e05f8c
--- /dev/null
+++ b/src/com/android/settings/th/LockscreenTargets.java
@@ -0,0 +1,575 @@
+/*
+ * Copyright (C) 2012 The CyanogenMod 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.settings.th;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.app.Fragment;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.content.Intent.ShortcutIconResource;
+import android.content.pm.ActivityInfo;
+import android.content.pm.PackageManager;
+import android.content.pm.PackageManager.NameNotFoundException;
+import android.content.res.Configuration;
+import android.content.res.Resources;
+import android.content.res.Resources.NotFoundException;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import android.graphics.drawable.BitmapDrawable;
+import android.graphics.drawable.Drawable;
+import android.graphics.drawable.InsetDrawable;
+import android.graphics.drawable.LayerDrawable;
+import android.graphics.drawable.StateListDrawable;
+import android.os.Bundle;
+import android.provider.Settings;
+import android.view.LayoutInflater;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.Button;
+import android.widget.ImageButton;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import com.android.internal.widget.multiwaveview.GlowPadView;
+import com.android.internal.widget.multiwaveview.TargetDrawable;
+import com.android.settings.R;
+import com.android.settings.Utils;
+import com.android.settings.th.IconPicker.OnIconPickListener;
+
+public class LockscreenTargets extends Fragment implements ShortcutPickHelper.OnPickListener,
+    GlowPadView.OnTriggerListener, OnIconPickListener {
+
+    private GlowPadView mWaveView;
+    private ImageButton mDialogIcon;
+    private Button mDialogLabel;
+    private ShortcutPickHelper mPicker;
+    private IconPicker mIconPicker;
+    private ArrayList<TargetInfo> mTargetStore = new ArrayList<TargetInfo>();
+    private int mTargetOffset;
+    private int mTargetInset;
+    private boolean mIsLandscape;
+    private boolean mIsScreenLarge;
+    private ViewGroup mContainer;
+    private Activity mActivity;
+    private Resources mResources;
+    private File mImageTmp;
+    private int mTargetIndex = 0;
+    private static final int MENU_RESET = Menu.FIRST;
+    private static final int MENU_SAVE = Menu.FIRST + 1;
+    private static String EMPTY_LABEL;
+
+    class TargetInfo {
+        String uri, pkgName;
+        StateListDrawable icon;
+        Drawable defaultIcon;
+        String iconType;
+        String iconSource;
+        TargetInfo(StateListDrawable target) {
+            icon = target;
+        }
+        TargetInfo(String in, StateListDrawable target, String iType, String iSource, Drawable dI) {
+            uri = in;
+            icon = target;
+            defaultIcon = dI;
+            iconType = iType;
+            iconSource = iSource;
+        }
+    }
+
+    @Override
+    public View onCreateView(LayoutInflater inflater, ViewGroup container,
+            Bundle savedInstanceState) {
+        mContainer = container;
+        setHasOptionsMenu(true);
+        mActivity = getActivity();
+        mIsScreenLarge = !Utils.isPhone(mActivity);
+        mResources = getResources();
+        mIsLandscape = mResources.getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE;
+        mTargetOffset = mIsLandscape && !mIsScreenLarge ? 2 : 0;
+        mTargetInset = mResources.getDimensionPixelSize(com.android.internal.R.dimen.lockscreen_target_inset);
+        mIconPicker = new IconPicker(mActivity, this);
+        mPicker = new ShortcutPickHelper(mActivity, this);
+        mImageTmp = new File(mActivity.getCacheDir() + "/target.tmp");
+        EMPTY_LABEL = mActivity.getResources().getString(R.string.lockscreen_target_empty);
+        return inflater.inflate(R.layout.lockscreen_targets, container, false);
+    }
+
+    @Override
+    public void onActivityCreated(Bundle savedInstanceState) {
+        super.onActivityCreated(savedInstanceState);
+        mWaveView = ((GlowPadView) mActivity.findViewById(R.id.lock_target));
+        mWaveView.setOnTriggerListener(this);
+        initializeView(Settings.System.getString(mActivity.getContentResolver(), Settings.System.LOCKSCREEN_TARGETS));
+    }
+
+    /**
+     * Create a layered drawable
+     * @param back - Background image to use when target is active
+     * @param front - Front image to use for target
+     * @param inset - Target inset padding
+     * @param frontBlank - Whether the front image for active target should be blank
+     * @return StateListDrawable
+     */
+    private StateListDrawable getLayeredDrawable(Drawable back, Drawable front, int inset, boolean frontBlank) {
+        front.mutate();
+        back.mutate();
+        InsetDrawable[] inactivelayer = new InsetDrawable[2];
+        InsetDrawable[] activelayer = new InsetDrawable[2];
+        Drawable activeFront = frontBlank ? mResources.getDrawable(android.R.color.transparent) : front;
+        Drawable inactiveBack = mResources.getDrawable(com.android.internal.R.drawable.ic_lockscreen_lock_pressed);
+        inactivelayer[0] = new InsetDrawable(inactiveBack, 0, 0, 0, 0);
+        inactivelayer[1] = new InsetDrawable(front, inset, inset, inset, inset);
+        activelayer[0] = new InsetDrawable(back, 0, 0, 0, 0);
+        activelayer[1] = new InsetDrawable(activeFront, inset, inset, inset, inset);
+        StateListDrawable states = new StateListDrawable();
+        LayerDrawable inactiveLayerDrawable = new LayerDrawable(inactivelayer);
+        inactiveLayerDrawable.setId(0, 0);
+        inactiveLayerDrawable.setId(1, 1);
+        LayerDrawable activeLayerDrawable = new LayerDrawable(activelayer);
+        activeLayerDrawable.setId(0, 0);
+        activeLayerDrawable.setId(1, 1);
+        states.addState(TargetDrawable.STATE_INACTIVE, inactiveLayerDrawable);
+        states.addState(TargetDrawable.STATE_ACTIVE, activeLayerDrawable);
+        states.addState(TargetDrawable.STATE_FOCUSED, activeLayerDrawable);
+        return states;
+    }
+
+    private void initializeView(String input) {
+        if (input == null) {
+            input = GlowPadView.EMPTY_TARGET;
+        }
+        mTargetStore.clear();
+        final int maxTargets = mIsScreenLarge ? GlowPadView.MAX_TABLET_TARGETS : GlowPadView.MAX_PHONE_TARGETS;
+        final PackageManager packMan = mActivity.getPackageManager();
+        final Drawable activeBack = mResources.getDrawable(com.android.internal.R.drawable.ic_lockscreen_target_activated);
+        final String[] targetStore = input.split("\\|");
+        //Shift by 2 targets for phones in landscape
+        if (mIsLandscape && !mIsScreenLarge) {
+            mTargetStore.add(new TargetInfo(null));
+            mTargetStore.add(new TargetInfo(null));
+        }
+        //Add the unlock icon
+        Drawable unlockFront = mResources.getDrawable(com.android.internal.R.drawable.ic_lockscreen_unlock_normal);
+        Drawable unlockBack = mResources.getDrawable(com.android.internal.R.drawable.ic_lockscreen_unlock_activated);
+        mTargetStore.add(new TargetInfo(getLayeredDrawable(unlockBack, unlockFront, 0, true)));
+        for (int cc = 0; cc < 8 - mTargetOffset - 1; cc++) {
+            String uri = GlowPadView.EMPTY_TARGET;
+            Drawable front = null;
+            Drawable back = activeBack;
+            boolean frontBlank = false;
+            String iconType = null;
+            String iconSource = null;
+            int tmpInset = mTargetInset;
+            if (cc < targetStore.length && cc < maxTargets) {
+                uri = targetStore[cc];
+                if (!uri.equals(GlowPadView.EMPTY_TARGET)) {
+                    try {
+                        Intent in = Intent.parseUri(uri, 0);
+                        if (in.hasExtra(GlowPadView.ICON_FILE)) {
+                            String rSource = in.getStringExtra(GlowPadView.ICON_FILE);
+                            File fPath = new File(rSource);
+                            if (fPath != null) {
+                                if (fPath.exists()) {
+                                    front = new BitmapDrawable(getResources(), BitmapFactory.decodeFile(rSource));
+                                }
+                            }
+                        } else if (in.hasExtra(GlowPadView.ICON_RESOURCE)) {
+                            String rSource = in.getStringExtra(GlowPadView.ICON_RESOURCE);
+                            String rPackage = in.getStringExtra(GlowPadView.ICON_PACKAGE);
+                            if (rSource != null) {
+                                if (rPackage != null) {
+                                    try {
+                                        Context rContext = mActivity.createPackageContext(rPackage, 0);
+                                        int id = rContext.getResources().getIdentifier(rSource, "drawable", rPackage);
+                                        front = rContext.getResources().getDrawable(id);
+                                        id = rContext.getResources().getIdentifier(rSource.replaceAll("_normal", "_activated"),
+                                                "drawable", rPackage);
+                                        back = rContext.getResources().getDrawable(id);
+                                        tmpInset = 0;
+                                        frontBlank = true;
+                                    } catch (NameNotFoundException e) {
+                                        e.printStackTrace();
+                                    } catch (NotFoundException e) {
+                                        e.printStackTrace();
+                                    }
+                                } else {
+                                    front = mResources.getDrawable(mResources.getIdentifier(rSource, "drawable", "android"));
+                                    back = mResources.getDrawable(mResources.getIdentifier(
+                                            rSource.replaceAll("_normal", "_activated"), "drawable", "android"));
+                                    tmpInset = 0;
+                                    frontBlank = true;
+                                }
+                            }
+                        }
+                        if (front == null) {
+                            ActivityInfo aInfo = in.resolveActivityInfo(packMan, PackageManager.GET_ACTIVITIES);
+                            if (aInfo != null) {
+                                front = aInfo.loadIcon(packMan);
+                            } else {
+                                front = mResources.getDrawable(android.R.drawable.sym_def_app_icon).mutate();
+                            }
+                        }
+                    } catch (Exception e) {
+                    }
+                }
+            } else if (cc >= maxTargets) {
+                mTargetStore.add(new TargetInfo(null));
+                continue;
+            }
+            if (back == null || front == null) {
+                Drawable emptyIcon = mResources.getDrawable(R.drawable.ic_empty).mutate();
+                front = emptyIcon;
+            }
+            mTargetStore.add(new TargetInfo(uri, getLayeredDrawable(back,front, tmpInset, frontBlank), iconType,
+                    iconSource, front.getConstantState().newDrawable().mutate()));
+        }
+        ArrayList<TargetDrawable> tDraw = new ArrayList<TargetDrawable>();
+        for (TargetInfo i : mTargetStore) {
+            if (i != null) {
+                tDraw.add(new TargetDrawable(mResources, i.icon));
+            } else {
+                tDraw.add(new TargetDrawable(mResources, null));
+            }
+        }
+        mWaveView.setTargetResources(tDraw);
+    }
+
+    @Override
+    public void onResume() {
+        super.onResume();
+        // If running on a phone, remove padding around container
+        if (!mIsScreenLarge) {
+            mContainer.setPadding(0, 0, 0, 0);
+        }
+    }
+
+    @Override
+    public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
+        menu.add(0, MENU_RESET, 0, R.string.profile_reset_title)
+            .setIcon(R.drawable.ic_settings_backup) // use the backup icon
+            .setAlphabeticShortcut('r')
+            .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM |
+                MenuItem.SHOW_AS_ACTION_WITH_TEXT);
+        menu.add(0, MENU_SAVE, 0, R.string.wifi_save)
+            .setIcon(R.drawable.ic_menu_save)
+            .setAlphabeticShortcut('s')
+            .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM |
+                MenuItem.SHOW_AS_ACTION_WITH_TEXT);
+    }
+
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+        switch (item.getItemId()) {
+            case MENU_RESET:
+                resetAll();
+                return true;
+            case MENU_SAVE:
+                saveAll();
+                Toast.makeText(mActivity, R.string.lockscreen_target_save, Toast.LENGTH_LONG).show();
+                return true;
+            default:
+                return false;
+        }
+    }
+
+    /**
+     * Resets the target layout to stock
+     */
+    private void resetAll() {
+        new AlertDialog.Builder(mActivity)
+        .setTitle(R.string.lockscreen_target_reset_title)
+        .setIconAttribute(android.R.attr.alertDialogIcon)
+        .setMessage(R.string.lockscreen_target_reset_message)
+        .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
+            public void onClick(DialogInterface dialog, int id) {
+                initializeView(null);
+                Settings.System.putString(mActivity.getContentResolver(), Settings.System.LOCKSCREEN_TARGETS, null);
+                Toast.makeText(mActivity, R.string.lockscreen_target_reset, Toast.LENGTH_LONG).show();
+            }
+        }).setNegativeButton(R.string.cancel, null)
+        .create().show();
+    }
+
+    /**
+     * Save targets to settings provider
+     */
+    private void saveAll() {
+        StringBuilder targetLayout = new StringBuilder();
+        ArrayList<String> existingImages = new ArrayList<String>();
+        final int maxTargets = mIsScreenLarge ? GlowPadView.MAX_TABLET_TARGETS : GlowPadView.MAX_PHONE_TARGETS;
+        for (int i = mTargetOffset + 1; i <= mTargetOffset + maxTargets; i++) {
+            String uri = mTargetStore.get(i).uri;
+            String type = mTargetStore.get(i).iconType;
+            String source = mTargetStore.get(i).iconSource;
+            existingImages.add(source);
+            if (!uri.equals(GlowPadView.EMPTY_TARGET) && type != null) {
+                try {
+                    Intent in = Intent.parseUri(uri, 0);
+                    in.putExtra(type, source);
+                    String pkgName = mTargetStore.get(i).pkgName;
+                    if (pkgName != null) {
+                        in.putExtra(GlowPadView.ICON_PACKAGE, mTargetStore.get(i).pkgName);
+                    } else {
+                        in.removeExtra(GlowPadView.ICON_PACKAGE);
+                    }
+                    uri = in.toUri(0);
+                } catch (URISyntaxException e) {
+                }
+            }
+            targetLayout.append(uri);
+            targetLayout.append("|");
+        }
+        targetLayout.deleteCharAt(targetLayout.length() - 1);
+        Settings.System.putString(mActivity.getContentResolver(), Settings.System.LOCKSCREEN_TARGETS, targetLayout.toString());
+        for (File pic : mActivity.getFilesDir().listFiles()) {
+            if (pic.getName().startsWith("lockscreen_") && !existingImages.contains(pic.toString())) {
+                pic.delete();
+            }
+        }
+    }
+
+    /**
+     * Updates a target in the GlowPadView
+     */
+    private void setTarget(int position, String uri, Drawable draw, String iconType, String iconSource, String pkgName) {
+        TargetInfo item = mTargetStore.get(position);
+        StateListDrawable state = (StateListDrawable) item.icon;
+        LayerDrawable inActiveLayer = (LayerDrawable) state.getStateDrawable(0);
+        LayerDrawable activeLayer = (LayerDrawable) state.getStateDrawable(1);
+        inActiveLayer.setDrawableByLayerId(1, draw);
+        boolean isSystem = iconType != null && iconType.equals(GlowPadView.ICON_RESOURCE);
+        if (!isSystem) {
+            final Drawable activeBack = mResources.getDrawable(com.android.internal.R.drawable.ic_lockscreen_target_activated);
+            activeLayer.setDrawableByLayerId(0, new InsetDrawable(activeBack, 0, 0, 0, 0));
+            activeLayer.setDrawableByLayerId(1, draw);
+        } else {
+            InsetDrawable empty = new InsetDrawable(mResources.getDrawable(android.R.color.transparent), 0, 0, 0, 0);
+            activeLayer.setDrawableByLayerId(1, empty);
+            int activeId = mResources.getIdentifier(iconSource.replaceAll("_normal", "_activated"), "drawable", "android");
+            Drawable back = null;
+            if (activeId != 0) {
+                back = mResources.getDrawable(activeId);
+                activeLayer.setDrawableByLayerId(0, back);
+            } else {
+                final Drawable activeBack = mResources.getDrawable(com.android.internal.R.drawable.ic_lockscreen_target_activated);
+                activeLayer.setDrawableByLayerId(0, new InsetDrawable(activeBack, 0, 0, 0, 0));
+            }
+        }
+        item.defaultIcon = mDialogIcon.getDrawable().getConstantState().newDrawable().mutate();
+        item.uri = uri;
+        item.iconType = iconType;
+        item.iconSource = iconSource;
+        item.pkgName = pkgName;
+    }
+
+    @Override
+    public void shortcutPicked(String uri, String friendlyName, boolean isApplication) {
+        try {
+            Intent i = Intent.parseUri(uri, 0);
+            PackageManager pm = mActivity.getPackageManager();
+            ActivityInfo aInfo = i.resolveActivityInfo(pm, PackageManager.GET_ACTIVITIES);
+            Drawable icon = null;
+            if (aInfo != null) {
+                icon = aInfo.loadIcon(pm).mutate();
+            } else {
+                icon = mResources.getDrawable(android.R.drawable.sym_def_app_icon);
+            }
+            mDialogLabel.setText(friendlyName);
+            mDialogLabel.setTag(uri);
+            mDialogIcon.setImageDrawable(resizeForDialog(icon));
+            mDialogIcon.setTag(null);
+        } catch (Exception e) {
+        }
+    }
+
+    private Drawable resizeForDialog(Drawable image) {
+        int size = (int) mResources.getDimension(android.R.dimen.app_icon_size);
+        Bitmap d = ((BitmapDrawable)image).getBitmap();
+        Bitmap bitmapOrig = Bitmap.createScaledBitmap(d, size, size, false);
+        return new BitmapDrawable(mResources, bitmapOrig);
+    }
+
+    @Override
+    public void onActivityResult(int requestCode, int resultCode, Intent data) {
+        String shortcut_name = null;
+        if (data != null) {
+            shortcut_name = data.getStringExtra(Intent.EXTRA_SHORTCUT_NAME);
+        }
+        if (shortcut_name != null && shortcut_name.equals(EMPTY_LABEL)) {
+            mDialogLabel.setText(EMPTY_LABEL);
+            mDialogLabel.setTag(GlowPadView.EMPTY_TARGET);
+            mDialogIcon.setImageResource(R.drawable.ic_empty);
+        } else if (requestCode == IconPicker.REQUEST_PICK_SYSTEM || requestCode == IconPicker.REQUEST_PICK_GALLERY
+                || requestCode == IconPicker.REQUEST_PICK_ICON_PACK) {
+            mIconPicker.onActivityResult(requestCode, resultCode, data);
+        } else if (requestCode != Activity.RESULT_CANCELED && resultCode != Activity.RESULT_CANCELED) {
+            mPicker.onActivityResult(requestCode, resultCode, data);
+        }
+    }
+
+    @Override
+    public void onGrabbed(View v, int handle) {
+    }
+
+    @Override
+    public void onReleased(View v, int handle) {
+    }
+
+	@Override
+	public void onTargetChange(View view, final int target) {
+	}
+
+    @Override
+    public void onTrigger(View v, final int target) {
+        mTargetIndex = target;
+        if ((target != 0 && (mIsScreenLarge || !mIsLandscape)) || (target != 2 && !mIsScreenLarge && mIsLandscape)) {
+            AlertDialog.Builder builder = new AlertDialog.Builder(mActivity);
+            builder.setTitle(R.string.lockscreen_target_edit_title);
+            builder.setMessage(R.string.lockscreen_target_edit_msg);
+            View view = View.inflate(mActivity, R.layout.lockscreen_shortcut_dialog, null);
+            view.findViewById(R.id.icon).setOnClickListener(new View.OnClickListener() {
+                @Override
+                public void onClick(View v) {
+                    if (!mDialogLabel.getText().equals(EMPTY_LABEL)) {
+                        try {
+                            mImageTmp.createNewFile();
+                            mImageTmp.setWritable(true, false);
+                            mIconPicker.pickIcon(getId(), mImageTmp);
+                        } catch (IOException e) {
+                        }
+                    }
+                }
+            });
+            view.findViewById(R.id.label).setOnClickListener(new View.OnClickListener() {
+                @Override
+                public void onClick(View v) {
+                    mPicker.pickShortcut(new String[] {EMPTY_LABEL}, new ShortcutIconResource[] {
+                            ShortcutIconResource.fromContext(mActivity, android.R.drawable.ic_delete) }, getId());
+                }
+            });
+            mDialogIcon = ((ImageButton) view.findViewById(R.id.icon));
+            mDialogLabel = ((Button) view.findViewById(R.id.label));
+            TargetInfo item = mTargetStore.get(target);
+            mDialogIcon.setImageDrawable(mTargetStore.get(target).defaultIcon.mutate());
+            TargetInfo tmpIcon = new TargetInfo(null);
+            tmpIcon.iconType = item.iconType;
+            tmpIcon.iconSource = item.iconSource;
+            tmpIcon.pkgName = item.pkgName;
+            mDialogIcon.setTag(tmpIcon);
+            if (mTargetStore.get(target).uri.equals(GlowPadView.EMPTY_TARGET)) {
+                mDialogLabel.setText(EMPTY_LABEL);
+            } else {
+                mDialogLabel.setText(mPicker.getFriendlyNameForUri(mTargetStore.get(target).uri));
+            }
+            mDialogLabel.setTag(mTargetStore.get(target).uri);
+            builder.setView(view);
+            builder.setPositiveButton(R.string.ok,  new DialogInterface.OnClickListener() {
+                @Override
+                public void onClick(DialogInterface dialog, int which) {
+                    TargetInfo vObject = (TargetInfo) mDialogIcon.getTag();
+                    String type = null, source = null, pkgName = null;
+                    int targetInset = mTargetInset;
+                    if (vObject != null) {
+                        type = vObject.iconType;
+                        source = vObject.iconSource;
+                        pkgName = vObject.pkgName;
+                    }
+                    if (type != null && type.equals(GlowPadView.ICON_RESOURCE)) {
+                        targetInset = 0;
+                    }
+                    InsetDrawable pD = new InsetDrawable(mDialogIcon.getDrawable(), targetInset,
+                            targetInset, targetInset, targetInset);
+                    setTarget(mTargetIndex, mDialogLabel.getTag().toString(), pD, type, source, pkgName);
+                }
+            });
+            builder.setNegativeButton(R.string.cancel, null);
+            builder.setCancelable(false);
+            AlertDialog dialog = builder.create();
+            dialog.show();
+            ((TextView)dialog.findViewById(android.R.id.message)).setTextAppearance(mActivity,
+                    android.R.style.TextAppearance_DeviceDefault_Small);
+        }
+    }
+
+    @Override
+    public void onGrabbedStateChange(View v, int handle) {
+    }
+
+    @Override
+    public void iconPicked(int requestCode, int resultCode, Intent in) {
+        Drawable ic = null;
+        String iconType = null;
+        String pkgName = null;
+        String iconSource = null;
+        if (requestCode == IconPicker.REQUEST_PICK_GALLERY) {
+            if (resultCode == Activity.RESULT_OK) {
+                File mImage = new File(mActivity.getFilesDir() + "/lockscreen_" + System.currentTimeMillis() + ".png");
+                if (mImageTmp.exists()) {
+                    mImageTmp.renameTo(mImage);
+                }
+                mImage.setReadOnly();
+                iconType = GlowPadView.ICON_FILE;
+                iconSource = mImage.toString();
+                ic = new BitmapDrawable(getResources(), BitmapFactory.decodeFile(mImage.toString()));
+            } else {
+                if (mImageTmp.exists()) {
+                    mImageTmp.delete();
+                }
+                return;
+            }
+        } else if (requestCode == IconPicker.REQUEST_PICK_SYSTEM) {
+            String resourceName = in.getStringExtra(IconPicker.RESOURCE_NAME);
+            ic = mResources.getDrawable(mResources.getIdentifier(resourceName, "drawable", "android")).mutate();
+            iconType = GlowPadView.ICON_RESOURCE;
+            iconSource = resourceName;
+        } else if (requestCode == IconPicker.REQUEST_PICK_ICON_PACK && resultCode == Activity.RESULT_OK) {
+            String resourceName = in.getStringExtra(IconPicker.RESOURCE_NAME);
+            pkgName = in.getStringExtra(IconPicker.PACKAGE_NAME);
+            try {
+                Context rContext = mActivity.createPackageContext(pkgName, 0);
+                int id = rContext.getResources().getIdentifier(resourceName, "drawable", pkgName);
+                ic = rContext.getResources().getDrawable(id);
+            } catch (NameNotFoundException e) {
+                e.printStackTrace();
+            }
+            iconType = GlowPadView.ICON_RESOURCE;
+            iconSource = resourceName;
+        } else {
+            return;
+        }
+        TargetInfo tmpIcon = new TargetInfo(null);
+        tmpIcon.iconType = iconType;
+        tmpIcon.iconSource = iconSource;
+        tmpIcon.pkgName = pkgName;
+        mDialogIcon.setTag(tmpIcon);
+        mDialogIcon.setImageDrawable(ic);
+    }
+
+    @Override
+    public void onFinishFinalAnimation() {
+    }
+}
diff --git a/src/com/android/settings/th/ShortcutPickHelper.java b/src/com/android/settings/th/ShortcutPickHelper.java
new file mode 100644
index 0000000..9ef7a65
--- /dev/null
+++ b/src/com/android/settings/th/ShortcutPickHelper.java
@@ -0,0 +1,324 @@
+/*
+ * Copyright (C) 2011 The CyanogenMod 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.settings.th;
+
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.app.AlertDialog.Builder;
+import android.app.Fragment;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.content.Intent.ShortcutIconResource;
+import android.content.pm.ActivityInfo;
+import android.content.pm.PackageInfo;
+import android.content.pm.PackageManager;
+import android.os.Bundle;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.BaseExpandableListAdapter;
+import android.widget.ExpandableListView;
+import android.widget.TextView;
+
+import com.android.settings.R;
+import com.android.settings.th.ShortcutPickHelper.AppExpandableAdapter.GroupInfo;
+
+public class ShortcutPickHelper {
+
+    private Activity mParent;
+    private AlertDialog mAlertDialog;
+    private OnPickListener mListener;
+    private PackageManager mPackageManager;
+    private static final int REQUEST_PICK_SHORTCUT = 100;
+    private static final int REQUEST_PICK_APPLICATION = 101;
+    private static final int REQUEST_CREATE_SHORTCUT = 102;
+    private int lastFragmentId;
+
+    public interface OnPickListener {
+        void shortcutPicked(String uri, String friendlyName, boolean isApplication);
+    }
+
+    public ShortcutPickHelper(Activity parent, OnPickListener listener) {
+        mParent = parent;
+        mPackageManager = mParent.getPackageManager();
+        mListener = listener;
+    }
+
+    public void onActivityResult(int requestCode, int resultCode, Intent data) {
+        if (resultCode == Activity.RESULT_OK) {
+            switch (requestCode) {
+            case REQUEST_PICK_APPLICATION:
+                completeSetCustomApp(data);
+                break;
+            case REQUEST_CREATE_SHORTCUT:
+                completeSetCustomShortcut(data);
+                break;
+            case REQUEST_PICK_SHORTCUT:
+                processShortcut(data, REQUEST_PICK_APPLICATION, REQUEST_CREATE_SHORTCUT);
+                break;
+            }
+        }
+    }
+
+    public void pickShortcut(String[] names, ShortcutIconResource[] icons, int fragmentId) {
+        Bundle bundle = new Bundle();
+
+        ArrayList<String> shortcutNames = new ArrayList<String>();
+        if (names != null) {
+            for (String s : names) {
+                shortcutNames.add(s);
+            }
+        }
+        shortcutNames.add(mParent.getString(R.string.profile_applist_title));
+        shortcutNames.add(mParent.getString(R.string.picker_activities));
+        bundle.putStringArrayList(Intent.EXTRA_SHORTCUT_NAME, shortcutNames);
+
+        ArrayList<ShortcutIconResource> shortcutIcons = new ArrayList<ShortcutIconResource>();
+        if (icons != null) {
+            for (ShortcutIconResource s : icons) {
+                shortcutIcons.add(s);
+            }
+        }
+        shortcutIcons.add(ShortcutIconResource.fromContext(mParent, android.R.drawable.sym_def_app_icon));
+        shortcutIcons.add(ShortcutIconResource.fromContext(mParent, R.drawable.activities_icon));
+        bundle.putParcelableArrayList(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, shortcutIcons);
+
+        Intent pickIntent = new Intent(Intent.ACTION_PICK_ACTIVITY);
+        pickIntent.putExtra(Intent.EXTRA_INTENT, new Intent(Intent.ACTION_CREATE_SHORTCUT));
+        pickIntent.putExtra(Intent.EXTRA_TITLE, mParent.getText(R.string.select_custom_app_title));
+        pickIntent.putExtras(bundle);
+        lastFragmentId = fragmentId;
+        startFragmentOrActivity(pickIntent, REQUEST_PICK_SHORTCUT);
+    }
+
+    private void startFragmentOrActivity(Intent pickIntent, int requestCode) {
+        if (lastFragmentId == 0) {
+            mParent.startActivityForResult(pickIntent, requestCode);
+        } else {
+            Fragment cFrag = mParent.getFragmentManager().findFragmentById(lastFragmentId);
+            if (cFrag != null) {
+                mParent.startActivityFromFragment(cFrag, pickIntent, requestCode);
+            }
+        }
+    }
+
+    private void processShortcut(final Intent intent, int requestCodeApplication, int requestCodeShortcut) {
+        // Handle case where user selected "Applications"
+        String applicationName = mParent.getString(R.string.profile_applist_title);
+        String application2name = mParent.getString(R.string.picker_activities);
+        String shortcutName = intent.getStringExtra(Intent.EXTRA_SHORTCUT_NAME);
+        if (applicationName != null && applicationName.equals(shortcutName)) {
+            Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
+            mainIntent.addCategory(Intent.CATEGORY_LAUNCHER);
+
+            Intent pickIntent = new Intent(Intent.ACTION_PICK_ACTIVITY);
+            pickIntent.putExtra(Intent.EXTRA_INTENT, mainIntent);
+            startFragmentOrActivity(pickIntent, requestCodeApplication);
+        } else if (application2name != null && application2name.equals(shortcutName)){
+            final List<PackageInfo> pInfos = mPackageManager.getInstalledPackages(PackageManager.GET_ACTIVITIES);
+            ExpandableListView appListView = new ExpandableListView(mParent);
+            AppExpandableAdapter appAdapter = new AppExpandableAdapter(pInfos, mParent);
+            appListView.setAdapter(appAdapter);
+            appListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {
+                @Override
+                public boolean onChildClick(ExpandableListView parent, View v,
+                        int groupPosition, int childPosition, long id) {
+                    Intent shortIntent = new Intent(Intent.ACTION_MAIN);
+                    String pkgName = ((GroupInfo)parent.getExpandableListAdapter().getGroup(groupPosition))
+                            .info.packageName;
+                    String actName = ((GroupInfo)parent.getExpandableListAdapter().getGroup(groupPosition))
+                            .info.activities[childPosition].name;
+                    shortIntent.setClassName(pkgName, actName);
+                    completeSetCustomApp(shortIntent);
+                    mAlertDialog.dismiss();
+                    return true;
+                }
+            });
+            Builder builder = new Builder(mParent);
+            builder.setView(appListView);
+            mAlertDialog = builder.create();
+            mAlertDialog.setTitle(mParent.getString(R.string.select_custom_activity_title));
+            mAlertDialog.show();
+            mAlertDialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
+                @Override
+                public void onCancel(DialogInterface dialog) {
+                    mListener.shortcutPicked(null, null, false);
+                }
+            });
+        } else {
+            startFragmentOrActivity(intent, requestCodeShortcut);
+        }
+    }
+
+    public class AppExpandableAdapter extends BaseExpandableListAdapter {
+
+        ArrayList<GroupInfo> allList = new ArrayList<GroupInfo>();
+        final int groupPadding;
+
+        public class LabelCompare implements Comparator<GroupInfo>{
+            @Override
+            public int compare(GroupInfo item1, GroupInfo item2) {
+                String rank1 = item1.label.toLowerCase();
+                String rank2 = item2.label.toLowerCase();
+                int result = rank1.compareTo(rank2);
+                if(result == 0) {
+                    return 0;
+                } else if(result < 0) {
+                    return -1;
+                } else {
+                    return +1;
+                }
+            }
+        }
+
+        class GroupInfo {
+            String label;
+            PackageInfo info;
+            GroupInfo (String l, PackageInfo p) {
+                label = l;
+                info = p;
+            }
+        }
+
+        public AppExpandableAdapter(List<PackageInfo> pInfos, Context context) {
+            for (PackageInfo i : pInfos) {
+                allList.add(new GroupInfo(i.applicationInfo.loadLabel(mPackageManager).toString(), i));
+            }
+            Collections.sort(allList, new LabelCompare());
+            groupPadding = context.getResources().getDimensionPixelSize(R.dimen.shortcut_picker_left_padding);
+        }
+
+        public String getChild(int groupPosition, int childPosition) {
+            return allList.get(groupPosition).info.activities[childPosition].name;
+        }
+
+        public long getChildId(int groupPosition, int childPosition) {
+            return childPosition;
+        }
+
+        public int getChildrenCount(int groupPosition) {
+            if (allList.get(groupPosition).info.activities != null) {
+                return allList.get(groupPosition).info.activities.length;
+            } else {
+                return 0;
+            }
+        }
+
+
+        public View getChildView(int groupPosition, int childPosition, boolean isLastChild,
+                View convertView, ViewGroup parent) {
+            if (convertView == null) {
+                convertView = View.inflate(mParent, android.R.layout.simple_list_item_1, null);
+                convertView.setPadding(groupPadding, 0, 0, 0);
+
+            }
+            TextView textView = (TextView)convertView.findViewById(android.R.id.text1);
+            textView.setText(getChild(groupPosition, childPosition).replaceFirst(allList.get(groupPosition).info.packageName + ".", ""));
+            return convertView;
+        }
+
+        public GroupInfo getGroup(int groupPosition) {
+            return allList.get(groupPosition);
+        }
+
+        public int getGroupCount() {
+            return allList.size();
+        }
+
+        public long getGroupId(int groupPosition) {
+            return groupPosition;
+        }
+
+        public View getGroupView(int groupPosition, boolean isExpanded, View convertView,
+                ViewGroup parent) {
+            if (convertView == null) {
+                convertView = View.inflate(mParent, android.R.layout.simple_list_item_1, null);
+                convertView.setPadding(70, 0, 0, 0);
+            }
+            TextView textView = (TextView)convertView.findViewById(android.R.id.text1);
+            textView.setText(getGroup(groupPosition).label.toString());
+            return convertView;
+        }
+
+        public boolean isChildSelectable(int groupPosition, int childPosition) {
+            return true;
+        }
+
+        public boolean hasStableIds() {
+            return true;
+        }
+
+    }
+
+    private void completeSetCustomApp(Intent data) {
+        mListener.shortcutPicked(data.toUri(0), getFriendlyActivityName(data, false), true);
+    }
+
+    private void completeSetCustomShortcut(Intent data) {
+        Intent intent = data.getParcelableExtra(Intent.EXTRA_SHORTCUT_INTENT);
+        /* preserve shortcut name, we want to restore it later */
+        intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, data.getStringExtra(Intent.EXTRA_SHORTCUT_NAME));
+        String appUri = intent.toUri(0);
+        appUri = appUri.replaceAll("com.android.contacts.action.QUICK_CONTACT", "android.intent.action.VIEW");
+        mListener.shortcutPicked(appUri, getFriendlyShortcutName(intent), false);
+    }
+
+    private String getFriendlyActivityName(Intent intent, boolean labelOnly) {
+        ActivityInfo ai = intent.resolveActivityInfo(mPackageManager, PackageManager.GET_ACTIVITIES);
+        String friendlyName = null;
+        if (ai != null) {
+            friendlyName = ai.loadLabel(mPackageManager).toString();
+            if (friendlyName == null && !labelOnly) {
+                friendlyName = ai.name;
+            }
+        }
+        return friendlyName != null || labelOnly ? friendlyName : intent.toUri(0);
+    }
+
+    private String getFriendlyShortcutName(Intent intent) {
+        String activityName = getFriendlyActivityName(intent, true);
+        String name = intent.getStringExtra(Intent.EXTRA_SHORTCUT_NAME);
+
+        if (activityName != null && name != null) {
+            return activityName + ": " + name;
+        }
+        return name != null ? name : intent.toUri(0);
+    }
+
+    public String getFriendlyNameForUri(String uri) {
+        if (uri == null) {
+            return null;
+        }
+
+        try {
+            Intent intent = Intent.parseUri(uri, 0);
+            if (Intent.ACTION_MAIN.equals(intent.getAction())) {
+                return getFriendlyActivityName(intent, false);
+            }
+            return getFriendlyShortcutName(intent);
+        } catch (URISyntaxException e) {
+        }
+
+        return uri;
+    }
+}
diff --git a/src/com/android/settings/wifi/AccessPoint.java b/src/com/android/settings/wifi/AccessPoint.java
index 5a7a768..4a73543 100644
--- a/src/com/android/settings/wifi/AccessPoint.java
+++ b/src/com/android/settings/wifi/AccessPoint.java
@@ -61,6 +61,7 @@
     String bssid;
     int security;
     int networkId;
+    boolean autoConnect;
     boolean wpsAvailable = false;
 
     PskType pskType = PskType.UNKNOWN;
@@ -187,6 +188,7 @@
         bssid = config.BSSID;
         security = getSecurity(config);
         networkId = config.networkId;
+        autoConnect = config.autoConnect;
         mRssi = Integer.MAX_VALUE;
         mConfig = config;
     }
@@ -199,6 +201,7 @@
         if (security == SECURITY_PSK)
             pskType = getPskType(result);
         networkId = -1;
+        autoConnect = true;
         mRssi = result.level;
         mScanResult = result;
     }
diff --git a/src/com/android/settings/wifi/WifiConfigController.java b/src/com/android/settings/wifi/WifiConfigController.java
index 2598a0e..ae0a0ff 100644
--- a/src/com/android/settings/wifi/WifiConfigController.java
+++ b/src/com/android/settings/wifi/WifiConfigController.java
@@ -118,6 +118,7 @@
     private IpAssignment mIpAssignment = IpAssignment.UNASSIGNED;
     private ProxySettings mProxySettings = ProxySettings.UNASSIGNED;
     private LinkProperties mLinkProperties = new LinkProperties();
+    private boolean mAutoConnect;
 
     // True when this instance is used in SetupWizard XL context.
     private final boolean mInXlSetupWizard;
@@ -160,6 +161,9 @@
         mProxySettingsSpinner = (Spinner) mView.findViewById(R.id.proxy_settings);
         mProxySettingsSpinner.setOnItemSelectedListener(this);
 
+        boolean showAutoConnectField = false;
+        boolean showAutoConnectFieldValue = false;
+
         if (mAccessPoint == null) { // new network
             mConfigUi.setTitle(R.string.wifi_add_network);
 
@@ -182,6 +186,9 @@
 
             showIpConfigFields();
             showProxyFields();
+            mView.findViewById(R.id.wifi_auto_connect_toggle).setVisibility(View.VISIBLE);
+            ((CheckBox) mView.findViewById(R.id.wifi_auto_connect_togglebox)).setChecked(true);
+            mView.findViewById(R.id.wifi_auto_connect_togglebox).setOnClickListener(this);
             mView.findViewById(R.id.wifi_advanced_toggle).setVisibility(View.VISIBLE);
             mView.findViewById(R.id.wifi_advanced_togglebox).setOnClickListener(this);
 
@@ -230,12 +237,25 @@
                 } else {
                     mProxySettingsSpinner.setSelection(PROXY_NONE);
                 }
+
+                showAutoConnectField = true;
+                showAutoConnectFieldValue = config.autoConnect;
             }
 
             if (mAccessPoint.networkId == INVALID_NETWORK_ID || mEdit) {
                 showSecurityFields();
                 showIpConfigFields();
                 showProxyFields();
+                mView.findViewById(R.id.wifi_auto_connect_toggle).setVisibility(View.VISIBLE);
+                WifiConfiguration config = mAccessPoint.getConfig();
+                if (mEdit) {
+                    showAutoConnectField = false;
+                    ((CheckBox) mView.findViewById(R.id.wifi_auto_connect_togglebox)).setChecked(config.autoConnect);
+                } else {
+                    mAutoConnect = true;
+                    ((CheckBox) mView.findViewById(R.id.wifi_auto_connect_togglebox)).setChecked(true);
+                }
+                mView.findViewById(R.id.wifi_auto_connect_togglebox).setOnClickListener(this);
                 mView.findViewById(R.id.wifi_advanced_toggle).setVisibility(View.VISIBLE);
                 mView.findViewById(R.id.wifi_advanced_togglebox).setOnClickListener(this);
                 if (showAdvancedFields) {
@@ -244,6 +264,10 @@
                 }
             }
 
+            if (showAutoConnectField) {
+                addRow(group, R.string.wifi_auto_connect, (showAutoConnectFieldValue ? context.getString(R.string.yes) : context.getString(R.string.no)));
+            }
+
             if (mEdit) {
                 mConfigUi.setSubmitButton(context.getString(R.string.wifi_save));
             } else {
@@ -388,6 +412,7 @@
         config.proxySettings = mProxySettings;
         config.ipAssignment = mIpAssignment;
         config.linkProperties = new LinkProperties(mLinkProperties);
+        config.autoConnect = mAutoConnect;
 
         return config;
     }
@@ -752,6 +777,8 @@
             } else {
                 mView.findViewById(R.id.wifi_advanced_fields).setVisibility(View.GONE);
             }
+        } else if (view.getId() == R.id.wifi_auto_connect_togglebox) {
+            mAutoConnect = ((CheckBox) view).isChecked();
         }
     }