diff options
45 files changed, 2637 insertions, 27 deletions
diff --git a/BoardConfig.mk b/BoardConfig.mk index b07c668..b8151f3 100644 --- a/BoardConfig.mk +++ b/BoardConfig.mk @@ -37,6 +37,12 @@ TARGET_NO_BOOTLOADER := true BOARD_KERNEL_BASE := 0x80000000 # BOARD_KERNEL_CMDLINE := +# Define kernel config for inline building +TARGET_KERNEL_CONFIG := cyanogenmod_tuna_defconfig +TARGET_KERNEL_SOURCE := kernel/samsung/tuna + +TARGET_PREBUILT_KERNEL := device/samsung/tuna/kernel + TARGET_NO_RADIOIMAGE := true TARGET_BOARD_PLATFORM := omap4 TARGET_BOOTLOADER_BOARD_NAME := tuna @@ -82,6 +88,15 @@ WIFI_DRIVER_FW_PATH_AP := "/vendor/firmware/fw_bcmdhd_apsta.bin" BOARD_HAVE_BLUETOOTH := true BOARD_HAVE_BLUETOOTH_BCM := true +# Boot animation +TARGET_BOOTANIMATION_PRELOAD := true +TARGET_BOOTANIMATION_TEXTURE_CACHE := true +TARGET_BOOTANIMATION_USE_RGB565 := true + BOARD_LIB_DUMPSTATE := libdumpstate.tuna BOARD_USES_SECURE_SERVICES := true + +BOARD_HAS_NO_SELECT_BUTTON := true +BOARD_CUSTOM_RECOVERY_KEYMAPPING := ../../device/samsung/tuna/recovery_keys.c +BOARD_USE_CUSTOM_RECOVERY_FONT := \"roboto_15x24.h\" diff --git a/GNexusParts/Android.mk b/GNexusParts/Android.mk new file mode 100644 index 0000000..e934402 --- /dev/null +++ b/GNexusParts/Android.mk @@ -0,0 +1,15 @@ +LOCAL_PATH:= $(call my-dir) +include $(CLEAR_VARS) + +LOCAL_MODULE_TAGS := optional + +LOCAL_STATIC_JAVA_LIBRARIES := android-support-v13 + +LOCAL_SRC_FILES := $(call all-java-files-under, src) + +LOCAL_PACKAGE_NAME := GNexusParts +LOCAL_CERTIFICATE := platform + +include $(BUILD_PACKAGE) + +include $(call all-makefiles-under,$(LOCAL_PATH)) diff --git a/GNexusParts/AndroidManifest.xml b/GNexusParts/AndroidManifest.xml new file mode 100644 index 0000000..fcb7369 --- /dev/null +++ b/GNexusParts/AndroidManifest.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="utf-8"?> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="com.cyanogenmod.settings.device" + android:sharedUserId="android.uid.system" > + + <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> + <uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" /> + + <application android:label="@string/app_name" > + <activity + android:name="com.cyanogenmod.settings.device.DeviceSettings" + android:icon="@drawable/ic_launcher_cmdevicesettings" + android:label="@string/app_name" > + <intent-filter> + <action android:name="com.cyanogenmod.action.LAUNCH_DEVICE_SETTINGS" /> + <action android:name="android.intent.action.MAIN" /> + </intent-filter> + </activity> + + <receiver android:name=".Startup" > + <intent-filter android:priority="100" > + <action android:name="android.intent.action.BOOT_COMPLETED" /> + </intent-filter> + </receiver> + </application> + +</manifest> diff --git a/GNexusParts/res/drawable/blue_tuning_preview.xml b/GNexusParts/res/drawable/blue_tuning_preview.xml new file mode 100755 index 0000000..98ea313 --- /dev/null +++ b/GNexusParts/res/drawable/blue_tuning_preview.xml @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="utf-8"?> +<shape + xmlns:android="http://schemas.android.com/apk/res/android" + android:shape="rectangle"> + <gradient + android:angle="0" + android:startColor="#000000" + android:endColor="#0000FF" /> +</shape>
\ No newline at end of file diff --git a/GNexusParts/res/drawable/color_tuning_preview.xml b/GNexusParts/res/drawable/color_tuning_preview.xml new file mode 100644 index 0000000..2d83c10 --- /dev/null +++ b/GNexusParts/res/drawable/color_tuning_preview.xml @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="utf-8"?> +<shape + xmlns:android="http://schemas.android.com/apk/res/android" + android:shape="rectangle"> + <gradient + android:angle="0" + android:startColor="#000000" + android:endColor="#FFFFFF" /> +</shape>
\ No newline at end of file diff --git a/GNexusParts/res/drawable/green_tuning_preview.xml b/GNexusParts/res/drawable/green_tuning_preview.xml new file mode 100755 index 0000000..4f09471 --- /dev/null +++ b/GNexusParts/res/drawable/green_tuning_preview.xml @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="utf-8"?> +<shape + xmlns:android="http://schemas.android.com/apk/res/android" + android:shape="rectangle"> + <gradient + android:angle="0" + android:startColor="#000000" + android:endColor="#00FF00" /> +</shape>
\ No newline at end of file diff --git a/GNexusParts/res/drawable/ic_launcher_cmdevicesettings.png b/GNexusParts/res/drawable/ic_launcher_cmdevicesettings.png Binary files differnew file mode 100755 index 0000000..66de9c3 --- /dev/null +++ b/GNexusParts/res/drawable/ic_launcher_cmdevicesettings.png diff --git a/GNexusParts/res/drawable/red_tuning_preview.xml b/GNexusParts/res/drawable/red_tuning_preview.xml new file mode 100755 index 0000000..a55ea12 --- /dev/null +++ b/GNexusParts/res/drawable/red_tuning_preview.xml @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="utf-8"?> +<shape + xmlns:android="http://schemas.android.com/apk/res/android" + android:shape="rectangle"> + <gradient + android:angle="0" + android:startColor="#000000" + android:endColor="#FF0000" /> +</shape>
\ No newline at end of file diff --git a/GNexusParts/res/layout/preference_colorgamma_presets.xml b/GNexusParts/res/layout/preference_colorgamma_presets.xml new file mode 100755 index 0000000..af85740 --- /dev/null +++ b/GNexusParts/res/layout/preference_colorgamma_presets.xml @@ -0,0 +1,134 @@ +<?xml version="1.0" encoding="utf-8"?> + +<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <RelativeLayout + android:layout_width="match_parent" + android:layout_height="match_parent" + android:gravity="center_horizontal" + android:paddingBottom="20dip"> + + <ImageView + android:id="@+id/imageView0" + android:layout_width="match_parent" + android:layout_height="200dp" + android:paddingLeft="20dip" + android:paddingRight="20dip" + android:paddingTop="5dip" + android:src="@drawable/color_tuning_preview" /> + + <ImageView + android:id="@+id/imageView1" + android:layout_width="match_parent" + android:layout_height="50dp" + android:paddingLeft="20dip" + android:paddingRight="20dip" + android:paddingTop="5dip" + android:src="@drawable/red_tuning_preview" /> + + <ImageView + android:id="@+id/imageView2" + android:layout_width="match_parent" + android:layout_height="50dp" + android:layout_below="@+id/imageView1" + android:paddingLeft="20dip" + android:paddingRight="20dip" + android:paddingTop="5dip" + android:src="@drawable/green_tuning_preview" /> + + <ImageView + android:id="@+id/imageView3" + android:layout_width="match_parent" + android:layout_height="50dp" + android:layout_below="@+id/imageView2" + android:paddingLeft="20dip" + android:paddingRight="20dip" + android:paddingTop="5dip" + android:src="@drawable/blue_tuning_preview" /> + + <LinearLayout + android:id="@+id/linearLayout1" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_weight="1" + android:layout_below="@+id/imageView0" + android:gravity="center_horizontal" > + + <Button + android:id="@+id/btnPreset1" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/preset1_default_title" + android:textSize="12dp" + android:width="100dp"/> + + <Button + android:id="@+id/btnPreset2" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/preset2_default_title" + android:textSize="12dp" + android:width="100dp"/> + + <Button + android:id="@+id/btnPreset3" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/preset3_default_title" + android:textSize="12dp" + android:width="100dp"/> + </LinearLayout> + + <LinearLayout + android:id="@+id/linearLayout2" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_below="@+id/linearLayout1" + android:gravity="center_horizontal" > + + <Button + android:id="@+id/btnPreset4" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/preset4_default_title" + android:textSize="12dp" + android:width="100dp"/> + + <Button + android:id="@+id/btnPreset5" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/preset5_default_title" + android:textSize="12dp" + android:width="100dp"/> + + <Button + android:id="@+id/btnPreset6" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/preset6_default_title" + android:textSize="12dp" + android:width="100dp"/> + </LinearLayout> + + <LinearLayout + android:layout_width="320dp" + android:layout_height="wrap_content" + android:layout_weight="1" + android:layout_below="@+id/linearLayout2" > + + <TextView + android:id="@+id/textView1" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:paddingLeft="10dip" + android:text="@string/credits_presets" + android:textSize="12dp"/> + + </LinearLayout> + + </RelativeLayout> + +</ScrollView> diff --git a/GNexusParts/res/layout/preference_dialog_color_tuning.xml b/GNexusParts/res/layout/preference_dialog_color_tuning.xml new file mode 100644 index 0000000..51883d1 --- /dev/null +++ b/GNexusParts/res/layout/preference_dialog_color_tuning.xml @@ -0,0 +1,142 @@ +<?xml version="1.0" encoding="utf-8"?> + +<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <RelativeLayout + android:layout_width="match_parent" + android:layout_height="match_parent" + android:gravity="center_horizontal" + android:paddingBottom="20dip"> + + <TextView android:id="@+id/color_red_text" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/color_red_title" + android:paddingTop="10dip" + android:paddingLeft="20dip" + android:paddingRight="20dip" /> + <TextView android:id="@+id/color_red_value" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentRight="true" + android:paddingTop="10dip" + android:paddingLeft="20dip" + android:paddingRight="20dip" /> + <SeekBar android:id="@+id/color_red_seekbar" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_below="@id/color_red_text" + android:paddingTop="2dip" + android:paddingLeft="20dip" + android:paddingRight="20dip" /> + + <TextView android:id="@+id/color_green_text" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_below="@id/color_red_seekbar" + android:text="@string/color_green_title" + android:paddingTop="10dip" + android:paddingLeft="20dip" + android:paddingRight="20dip" /> + <TextView android:id="@+id/color_green_value" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_below="@id/color_red_seekbar" + android:layout_alignParentRight="true" + android:paddingTop="10dip" + android:paddingLeft="20dip" + android:paddingRight="20dip" /> + <SeekBar android:id="@+id/color_green_seekbar" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_below="@id/color_green_text" + android:paddingTop="2dip" + android:paddingLeft="20dip" + android:paddingRight="20dip" /> + + <TextView android:id="@+id/color_blue_text" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_below="@id/color_green_seekbar" + android:text="@string/color_blue_title" + android:paddingTop="10dip" + android:paddingLeft="20dip" + android:paddingRight="20dip" /> + <TextView android:id="@+id/color_blue_value" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_below="@id/color_green_seekbar" + android:layout_alignParentRight="true" + android:paddingTop="10dip" + android:paddingLeft="20dip" + android:paddingRight="20dip" /> + <SeekBar android:id="@+id/color_blue_seekbar" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_below="@id/color_blue_text" + android:paddingTop="2dip" + android:paddingLeft="20dip" + android:paddingRight="20dip" /> + + <ImageView android:id="@+id/black_scale_picture_color" + android:src="@drawable/color_tuning_preview" + android:layout_width="match_parent" + android:layout_height="40dip" + android:layout_below="@id/color_blue_seekbar" + android:paddingTop="20dip" + android:paddingLeft="20dip" + android:paddingRight="20dip" /> + + <LinearLayout + android:id="@+id/linearLayout1" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:gravity="center_horizontal" + android:layout_below="@+id/black_scale_picture_color" > + + <Button + android:id="@+id/btnColor1" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/color1_title" + android:textSize="12dp" + android:width="100dp"/> + + <Button + android:id="@+id/btnColor2" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/color2_title" + android:textSize="12dp" + android:width="100dp"/> + + <Button + android:id="@+id/btnColor3" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/color3_title" + android:textSize="12dp" + android:width="100dp"/> + + </LinearLayout> + + <LinearLayout + android:layout_width="320dp" + android:layout_height="wrap_content" + android:layout_weight="1" + android:layout_below="@+id/linearLayout1"> + + <TextView + android:id="@+id/textView1" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:paddingLeft="10dip" + android:text="@string/color_warning" + android:textSize="12dp"/> + + </LinearLayout> + + </RelativeLayout> +</ScrollView> diff --git a/GNexusParts/res/layout/preference_dialog_gamma_tuning.xml b/GNexusParts/res/layout/preference_dialog_gamma_tuning.xml new file mode 100644 index 0000000..c18682f --- /dev/null +++ b/GNexusParts/res/layout/preference_dialog_gamma_tuning.xml @@ -0,0 +1,150 @@ +<?xml version="1.0" encoding="utf-8"?> + +<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <RelativeLayout + android:layout_width="match_parent" + android:layout_height="match_parent" + android:gravity="center_horizontal" + android:paddingBottom="20dip"> + + <TextView android:id="@+id/gamma_red_text" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/color_red_title" + android:paddingTop="10dip" + android:paddingLeft="20dip" + android:paddingRight="20dip" /> + <TextView android:id="@+id/gamma_red_value" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentRight="true" + android:paddingTop="10dip" + android:paddingLeft="20dip" + android:paddingRight="20dip" /> + <SeekBar android:id="@+id/gamma_red_seekbar" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_below="@id/gamma_red_text" + android:paddingTop="2dip" + android:paddingLeft="20dip" + android:paddingRight="20dip" /> + + <TextView android:id="@+id/gamma_green_text" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_below="@id/gamma_red_seekbar" + android:text="@string/color_green_title" + android:paddingTop="10dip" + android:paddingLeft="20dip" + android:paddingRight="20dip" /> + <TextView android:id="@+id/gamma_green_value" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_below="@id/gamma_red_seekbar" + android:layout_alignParentRight="true" + android:paddingTop="10dip" + android:paddingLeft="20dip" + android:paddingRight="20dip" /> + <SeekBar android:id="@+id/gamma_green_seekbar" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_below="@id/gamma_green_text" + android:paddingTop="2dip" + android:paddingLeft="20dip" + android:paddingRight="20dip" /> + + <TextView android:id="@+id/gamma_blue_text" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_below="@id/gamma_green_seekbar" + android:text="@string/color_blue_title" + android:paddingTop="10dip" + android:paddingLeft="20dip" + android:paddingRight="20dip" /> + <TextView android:id="@+id/gamma_blue_value" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_below="@id/gamma_green_seekbar" + android:layout_alignParentRight="true" + android:paddingTop="10dip" + android:paddingLeft="20dip" + android:paddingRight="20dip" /> + <SeekBar android:id="@+id/gamma_blue_seekbar" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_below="@id/gamma_blue_text" + android:paddingTop="2dip" + android:paddingLeft="20dip" + android:paddingRight="20dip" /> + + <TextView android:id="@+id/gamma_dss_text" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_below="@id/gamma_blue_seekbar" + android:text="@string/gamma_dss_title" + android:paddingTop="10dip" + android:paddingLeft="20dip" + android:paddingRight="20dip" /> + <TextView android:id="@+id/gamma_dss_value" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_below="@id/gamma_blue_seekbar" + android:layout_alignParentRight="true" + android:paddingTop="10dip" + android:paddingLeft="20dip" + android:paddingRight="20dip" /> + <SeekBar android:id="@+id/gamma_dss_seekbar" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_below="@id/gamma_dss_text" + android:paddingTop="2dip" + android:paddingLeft="20dip" + android:paddingRight="20dip" /> + + <ImageView android:id="@+id/black_scale_picture" + android:src="@drawable/color_tuning_preview" + android:layout_width="match_parent" + android:layout_height="40dip" + android:layout_below="@id/gamma_dss_seekbar" + android:paddingTop="20dip" + android:paddingLeft="20dip" + android:paddingRight="20dip" /> + + <LinearLayout + android:id="@+id/linearLayout1" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:gravity="center_horizontal" + android:layout_below="@+id/black_scale_picture" > + + <Button + android:id="@+id/btnGamma1" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/gamma1_title" + android:textSize="12dp" + android:width="100dp"/> + + <Button + android:id="@+id/btnGamma2" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/gamma2_title" + android:textSize="12dp" + android:width="100dp"/> + + <Button + android:id="@+id/btnGamma3" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/gamma3_title" + android:textSize="12dp" + android:width="100dp"/> + + </LinearLayout> + + </RelativeLayout> +</ScrollView> diff --git a/GNexusParts/res/layout/preference_dialog_vibrator_tuning.xml b/GNexusParts/res/layout/preference_dialog_vibrator_tuning.xml new file mode 100644 index 0000000..9ffc414 --- /dev/null +++ b/GNexusParts/res/layout/preference_dialog_vibrator_tuning.xml @@ -0,0 +1,61 @@ +<?xml version="1.0" encoding="utf-8"?> + +<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <RelativeLayout + android:layout_width="match_parent" + android:layout_height="match_parent" + android:gravity="center_horizontal" + android:paddingBottom="20dip"> + + <TextView android:id="@+id/vibrator_text" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/vibrator_title" + android:paddingTop="10dip" + android:paddingLeft="20dip" + android:paddingRight="20dip" /> + <TextView android:id="@+id/vibrator_value" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentRight="true" + android:paddingTop="10dip" + android:paddingLeft="20dip" + android:paddingRight="20dip" /> + <SeekBar android:id="@+id/vibrator_seekbar" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_below="@id/vibrator_text" + android:paddingTop="2dip" + android:paddingLeft="20dip" + android:paddingRight="20dip" /> + + <LinearLayout + android:id="@+id/linearLayout1" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:gravity="center_horizontal" + android:layout_below="@+id/vibrator_seekbar" > + + <Button + android:id="@+id/btnvibratorDefault" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/vibrator_default_title" + android:textSize="12dp" + android:width="100dp" /> + + <Button + android:id="@+id/btnvibratorTest" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/vibrator_test_title" + android:textSize="12dp" + android:width="100dp" /> + + </LinearLayout> + + </RelativeLayout> +</ScrollView> diff --git a/GNexusParts/res/layout/top.xml b/GNexusParts/res/layout/top.xml new file mode 100755 index 0000000..744b568 --- /dev/null +++ b/GNexusParts/res/layout/top.xml @@ -0,0 +1,5 @@ +<android.support.v4.view.ViewPager xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/viewPager" + android:layout_width="match_parent" + android:layout_height="match_parent" /> + diff --git a/GNexusParts/res/values-de/strings.xml b/GNexusParts/res/values-de/strings.xml new file mode 100644 index 0000000..89d6fc3 --- /dev/null +++ b/GNexusParts/res/values-de/strings.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + <string name="app_name">Galaxy Nexus Einstellungen</string> + + <string name="color_tuning_title_head">Farbmultiplikator</string> + <string name="color_tuning_summary_head">Farbmultiplikator einstellen</string> + <string name="gamma_tuning_title_head">Gammakorrektur</string> + <string name="gamma_tuning_summary_head">Gammawert einstellen</string> + <string name="color_hack_presets_title_head">Farb-Voreinstellungen</string> + <string name="color_hack_presets_summary_head">Voreinstellungen für Gammakorrektur und Farbmultiplikator</string> + <string name="color_red_title">Rot</string> + <string name="color_green_title">Grün</string> + <string name="color_blue_title">Blau</string> + <string name="gamma1_title">Standard</string> + <string name="gamma2_title">CM</string> + <string name="gamma3_title">Natural</string> + <string name="color1_title">Standard</string> + <string name="color2_title">CM</string> + <string name="color3_title">Natural</string> + <string name="gamma_dss_title">DSS Gammawert</string> + + <string name="preset1_default_title">Standard</string> + <string name="preset2_default_title">Maximal</string> + <string name="preset3_default_title">Real</string> + <string name="preset4_default_title">Warm</string> + <string name="preset5_default_title">Kalt</string> + <string name="preset6_default_title">Natürlich</string> + <string name="credits_presets">Dank an: ale.landra91 cpaixao provolinoo</string> + + <string name="category_radio_title">Mobilfunk</string> + <string name="hspa_title_head">HSPA</string> + <string name="hspa_summary_head">HSDPA/HSUPA aktivieren</string> + +</resources> diff --git a/GNexusParts/res/values-es/arrays.xml b/GNexusParts/res/values-es/arrays.xml new file mode 100644 index 0000000..5279aa3 --- /dev/null +++ b/GNexusParts/res/values-es/arrays.xml @@ -0,0 +1,7 @@ +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string-array name="gpu_overclock_entries"> + <item>307,2 MHz (por defecto)</item> + <item>384,0 MHz</item> + <item>512,0 MHz</item> + </string-array> +</resources> diff --git a/GNexusParts/res/values-es/strings.xml b/GNexusParts/res/values-es/strings.xml new file mode 100644 index 0000000..bea15f1 --- /dev/null +++ b/GNexusParts/res/values-es/strings.xml @@ -0,0 +1,51 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + <string name="app_name">Ajustes Galaxy Nexus</string> + + <string name="category_display_title">Pantalla</string> + <string name="color_tuning_title_head">Multiplicadores del color</string> + <string name="color_tuning_summary_head">Calibrar los multiplicadores del color</string> + <string name="gamma_tuning_title_head">Gamma</string> + <string name="gamma_tuning_summary_head">Calibrar la corrección gamma</string> + <string name="color_hack_presets_title_head">Ajustes preconfigurados</string> + <string name="color_hack_presets_summary_head">Ajustes de gamma y multiplicadores probados por otros usuarios</string> + <string name="color_red_title">Rojo</string> + <string name="color_green_title">Verde</string> + <string name="color_blue_title">Azul</string> + <string name="gamma1_title">Predet.</string> + <string name="gamma2_title">Cyanogen</string> + <string name="gamma3_title">Natural</string> + <string name="color1_title">Predet.</string> + <string name="color2_title">Cyanogen</string> + <string name="color3_title">Natural</string> + <string name="color_warning">No son recomendables valores mayores de 200</string> + <string name="gamma_dss_title">Gamma DSS</string> + + <string name="category_hardware_title">Sistema</string> + <string name="vibrator_tuning_title_head">Respuesta háptica</string> + <string name="vibrator_tuning_summary_head">Establece la fuerza predeterminada para la respuesta háptica (vibración)</string> + + <string name="vibrator_title">Vibración %</string> + <string name="vibrator_default_title">Predet.</string> + <string name="vibrator_test_title">Probar</string> + + <string name="preset1_default_title">Predet.</string> + <string name="preset2_default_title">Máximo</string> + <string name="preset3_default_title">Real</string> + <string name="preset4_default_title">Cálido</string> + <string name="preset5_default_title">Frío</string> + <string name="preset6_default_title">Natural</string> + <string name="credits_presets">Créditos: ale.landra91, cpaixao, provolinoo</string> + + <string name="category_touchkey_title">Teclas táctiles</string> + <string name="touchkey_notification_title_head">Notificaciones luminosas</string> + <string name="touchkey_notification_summary_head">El teclado táctil se activará cuando haya una notificación</string> + + <string name="category_radio_title">Radio</string> + <string name="hspa_title_head">HSPA</string> + <string name="hspa_summary_head">Habilitar HSDPA/HSUPA</string> + + <string name="category_gpu_title">GPU</string> + <string name="gpu_overclock_title">Velocidad del procesador gráfico</string> + +</resources> diff --git a/GNexusParts/res/values-fr/strings.xml b/GNexusParts/res/values-fr/strings.xml new file mode 100644 index 0000000..fd86175 --- /dev/null +++ b/GNexusParts/res/values-fr/strings.xml @@ -0,0 +1,51 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + <string name="app_name">Paramètres du Galaxy Nexus</string> + + <string name="category_display_title">Affichage</string> + <string name="color_tuning_title_head">Réglage des multiplcateurs de couleur de l\'écran</string> + <string name="color_tuning_summary_head">Régle les multiplcateurs de couleur de l\'écran</string> + <string name="gamma_tuning_title_head">Réglage de la Correction Gamma</string> + <string name="gamma_tuning_summary_head">Règle la correction Gamma</string> + <string name="color_hack_presets_title_head">Préréglage des couleurs</string> + <string name="color_hack_presets_summary_head">Préréglages du Gamma et des multiplicateurs testés par d\'autres utilisateurs</string> + <string name="color_red_title">Rouge</string> + <string name="color_green_title">Vert</string> + <string name="color_blue_title">Bleu</string> + <string name="gamma1_title">Défaut</string> + <string name="gamma2_title">Params. CM</string> + <string name="gamma3_title">Naturel</string> + <string name="color1_title">Défaut</string> + <string name="color2_title">Params. CM</string> + <string name="color3_title">Naturel</string> + <string name="color_warning">Les valeurs supérieures à 200 ne sont pas recommandées</string> + <string name="gamma_dss_title">Régl. Gamma DSS</string> + + <string name="category_hardware_title">Matériel</string> + <string name="vibrator_tuning_title_head">Paramétrage du vibreur</string> + <string name="vibrator_tuning_summary_head">Définir l\'intensité du vibreur</string> + + <string name="vibrator_title">Vibreur %</string> + <string name="vibrator_default_title">Défaut</string> + <string name="vibrator_test_title">Test</string> + + <string name="preset1_default_title">Défaut</string> + <string name="preset2_default_title">Maximum</string> + <string name="preset3_default_title">Réel</string> + <string name="preset4_default_title">Chaud</string> + <string name="preset5_default_title">Foncé/froid</string> + <string name="preset6_default_title">Naturel</string> + <string name="credits_presets">Crédits: ale.landra91, cpaixao, provolinoo</string> + + <string name="category_touchkey_title">Touches tactiles</string> + <string name="touchkey_notification_title_head">Notifications par rétro-éclairage</string> + <string name="touchkey_notification_summary_head">Le rétroéclairage des touches tactiles s\'allumera lorsqu\'il y aura une notification</string> + + <string name="category_radio_title">Radio</string> + <string name="hspa_title_head">HSPA</string> + <string name="hspa_summary_head">Activer HSDPA/HSUPA</string> + + <string name="category_gpu_title">GPU</string> + <string name="gpu_overclock_title">Fréquence d\'horloge du GPU</string> + +</resources> diff --git a/GNexusParts/res/values-ja/strings.xml b/GNexusParts/res/values-ja/strings.xml new file mode 100644 index 0000000..4fc5f26 --- /dev/null +++ b/GNexusParts/res/values-ja/strings.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + <string name="app_name">Galaxy Nexus 設定</string> + + <string name="color_tuning_title_head">カラーマルチプライヤチューニング</string> + <string name="color_tuning_summary_head">画面の色味を調整する</string> + <string name="gamma_tuning_title_head">カラーガンマ調整</string> + <string name="gamma_tuning_summary_head">カラーガンマ値を調整する</string> + <string name="color_red_title">赤</string> + <string name="color_green_title">緑</string> + <string name="color_blue_title">青</string> + + <string name="category_radio_title">ラジオ</string> + <string name="hspa_title_head">HSPA</string> + <string name="hspa_summary_head">HSDPA/HSUPAを有効にする</string> + +</resources> diff --git a/GNexusParts/res/values-nl/strings.xml b/GNexusParts/res/values-nl/strings.xml new file mode 100644 index 0000000..0e2718f --- /dev/null +++ b/GNexusParts/res/values-nl/strings.xml @@ -0,0 +1,26 @@ +<?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. +--> +<resources> + <string name="app_name">Galaxy Nexus-instellingen</string> + <string name="color_tuning_title_head">Kleurenmultiplicatoren afstemmen</string> + <string name="color_tuning_summary_head">Kalibreer multiplicatoren van schermkleur</string> + <string name="gamma_tuning_title_head">Kleurengamma afstemmen</string> + <string name="gamma_tuning_summary_head">Kalibreer correctie van kleurengamma</string> + <string name="color_red_title">Rood</string> + <string name="color_green_title">Groen</string> + <string name="color_blue_title">Blauw</string> + <string name="hspa_summary_head">Schakel HSDPA/HSUPA in/uit</string> +</resources> diff --git a/GNexusParts/res/values-pt/strings.xml b/GNexusParts/res/values-pt/strings.xml new file mode 100755 index 0000000..af5be55 --- /dev/null +++ b/GNexusParts/res/values-pt/strings.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + <string name="app_name">Configurações Galaxy Nexus</string> + <string name="color_tuning_title_head">Ajustar Multiplicadores de Cor</string> + <string name="color_tuning_summary_head">Calibrar multiplicadores de cor de tela</string> + <string name="gamma_tuning_title_head">Ajustar Cor Gama</string> + <string name="gamma_tuning_summary_head">Calibrar correção de cor gama</string> + <string name="color_hack_presets_title_head">Predefinir hack de cor</string> + <string name="color_hack_presets_summary_head">Predefinições para gama e multiplicadores testado por alguns usuários</string> + <string name="color_red_title">Vermelho</string> + <string name="color_green_title">Verde</string> + <string name="color_blue_title">Azul</string> + <string name="gamma1_title">Padrão</string> + <string name="gamma2_title">Conf. CM</string> + <string name="gamma3_title">Natural</string> + <string name="color1_title">Padrão</string> + <string name="color2_title">Conf. CM</string> + <string name="color3_title">Natural</string> + <string name="color_warning">Dos valores recomendados não são maiores do que 200</string> + <string name="gamma_dss_title">Conf. DSS Gama</string> + <string name="preset1_default_title">Padrão.</string> + <string name="preset2_default_title">Máximo</string> + <string name="preset3_default_title">Real</string> + <string name="preset4_default_title">Quente</string> + <string name="preset5_default_title">Frio</string> + <string name="preset6_default_title">Natural</string> + <string name="credits_presets">Créditos: ale.landra91, cpaixao, provolinoo</string> + <string name="category_touchkey_title">Teclas sensíveis ao toque</string> + <string name="touchkey_notification_title_head">Notificações de luz de fundo</string> + <string name="touchkey_notification_summary_head">A luz de fundo das teclas irão acender quando haver uma notificação.</string> + <string name="category_radio_title">Radio</string> + <string name="hspa_title_head">HSPA</string> + <string name="hspa_summary_head">Ativar HSDPA/HSUPA</string> +</resources> diff --git a/GNexusParts/res/values-ru/arrays.xml b/GNexusParts/res/values-ru/arrays.xml new file mode 100644 index 0000000..8e7f3b6 --- /dev/null +++ b/GNexusParts/res/values-ru/arrays.xml @@ -0,0 +1,8 @@ +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string-array name="gpu_overclock_entries"> + <item>307,2 МГц (по умолчанию)</item> + <item>384,0 МГц</item> + <item>512,0 МГц</item> + </string-array> + +</resources> diff --git a/GNexusParts/res/values-ru/strings.xml b/GNexusParts/res/values-ru/strings.xml new file mode 100644 index 0000000..25c993b --- /dev/null +++ b/GNexusParts/res/values-ru/strings.xml @@ -0,0 +1,49 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + <string name="app_name">Настройки Galaxy Nexus</string> + + <string name="category_display_title">Дисплей</string> + <string name="color_tuning_title_head">Настройка цвета мультипликатора</string> + <string name="color_tuning_summary_head">Калибровка цвета мультипликатора</string> + <string name="gamma_tuning_title_head">Настройка цветовой гаммы</string> + <string name="gamma_tuning_summary_head">Калибровка коррекции цветовой гаммы</string> + <string name="color_hack_presets_title_head">Предустановки настроек</string> + <string name="color_hack_presets_summary_head">Установки для цветовой гаммы и мультипликатора проверенные некоторыми пользователями</string> + <string name="color_red_title">Красный</string> + <string name="color_green_title">Зелёный</string> + <string name="color_blue_title">Синий</string> + <string name="gamma1_title">По умолч.</string> + <string name="gamma2_title">Настр. CM</string> + <string name="gamma3_title">Натур-ый</string> + <string name="color1_title">По умолч.</string> + <string name="color2_title">Настр. CM</string> + <string name="color3_title">Натур-ый</string> + <string name="color_warning">Установка значений выше 200 не рекомендуется</string> + <string name="gamma_dss_title">Настр. DSS гаммы</string> + + <string name="category_hardware_title">Железо</string> + <string name="vibrator_tuning_title_head">Настройка виброотклика</string> + <string name="vibrator_tuning_summary_head">Настройка умолчания силы виброотклика</string> + + <string name="vibrator_title">% вибрации</string> + <string name="vibrator_default_title">По умолч.</string> + <string name="vibrator_test_title">Тест</string> + + <string name="preset1_default_title">По умолч.</string> + <string name="preset2_default_title">Mаксим-ый</string> + <string name="preset3_default_title">Pеальный</string> + <string name="preset4_default_title">Тёплый</string> + <string name="preset5_default_title">Хол. тёмный</string> + <string name="preset6_default_title">Натур-ый</string> + <string name="credits_presets">Участники: ale.landra91, cpaixao, provolinoo</string> + + <string name="category_touchkey_title">Сенсорные копки</string> + <string name="touchkey_notification_title_head">Подсветка уведомлений</string> + <string name="touchkey_notification_summary_head">Подсветка сенсорных клавиш включена, когда есть уведомления</string> + + <string name="category_radio_title">Радио</string> + <string name="hspa_summary_head">Включить HSDPA/HSUPA</string> + + <string name="category_gpu_title">Графический процессор</string> + <string name="gpu_overclock_title">Тактовая частота</string> +</resources> diff --git a/GNexusParts/res/values/arrays.xml b/GNexusParts/res/values/arrays.xml new file mode 100644 index 0000000..9dc3111 --- /dev/null +++ b/GNexusParts/res/values/arrays.xml @@ -0,0 +1,13 @@ +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string-array name="gpu_overclock_entries"> + <item>307,2 MHz (default)</item> + <item>384,0 MHz</item> + <item>512,0 MHz</item> + </string-array> + + <string-array name="gpu_overclock_values" translatable="false"> + <item>0</item> + <item>1</item> + <item>2</item> + </string-array> +</resources> diff --git a/GNexusParts/res/values/strings.xml b/GNexusParts/res/values/strings.xml new file mode 100644 index 0000000..70c1125 --- /dev/null +++ b/GNexusParts/res/values/strings.xml @@ -0,0 +1,51 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + <string name="app_name">Galaxy Nexus Settings</string> + + <string name="category_display_title">Display</string> + <string name="color_tuning_title_head">Color Multipliers Tuning</string> + <string name="color_tuning_summary_head">Calibrate multipliers screen color</string> + <string name="gamma_tuning_title_head">Color Gamma Tuning</string> + <string name="gamma_tuning_summary_head">Calibrate gamma color correction</string> + <string name="color_hack_presets_title_head">Color hack presets</string> + <string name="color_hack_presets_summary_head">Presets for gamma and multipliers tested by some users</string> + <string name="color_red_title">Red</string> + <string name="color_green_title">Green</string> + <string name="color_blue_title">Blue</string> + <string name="gamma1_title">Default</string> + <string name="gamma2_title">CM Sett.</string> + <string name="gamma3_title">Natural</string> + <string name="color1_title">Default</string> + <string name="color2_title">CM Sett.</string> + <string name="color3_title">Natural</string> + <string name="color_warning">Values higher than 200 are not recommended</string> + <string name="gamma_dss_title">DSS Gamma Set.</string> + + <string name="category_hardware_title">Hardware</string> + <string name="vibrator_tuning_title_head">Vibrator feedback tuning</string> + <string name="vibrator_tuning_summary_head">Controls the default power of vibrator feedback</string> + + <string name="vibrator_title">Vibration %</string> + <string name="vibrator_default_title">Default</string> + <string name="vibrator_test_title">Test</string> + + <string name="preset1_default_title">Default</string> + <string name="preset2_default_title">Maximum</string> + <string name="preset3_default_title">Real</string> + <string name="preset4_default_title">Warm</string> + <string name="preset5_default_title">Dark Cold</string> + <string name="preset6_default_title">Natural</string> + <string name="credits_presets">Credits: ale.landra91, cpaixao, provolinoo</string> + + <string name="category_touchkey_title">Touch Keys</string> + <string name="touchkey_notification_title_head">Backlight Notifications</string> + <string name="touchkey_notification_summary_head">The touch key backlights will turn on when there is a notification</string> + + <string name="category_radio_title">Radio</string> + <string name="hspa_title_head">HSPA</string> + <string name="hspa_summary_head">Enable HSDPA/HSUPA</string> + + <string name="category_gpu_title">GPU</string> + <string name="gpu_overclock_title">Clock Speed</string> + +</resources> diff --git a/GNexusParts/res/xml/preferences.xml b/GNexusParts/res/xml/preferences.xml new file mode 100644 index 0000000..a71d274 --- /dev/null +++ b/GNexusParts/res/xml/preferences.xml @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="UTF-8"?> +<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" + android:title="@string/app_name"> + + <!-- Color tuning --> + <PreferenceCategory + android:key="category_display" + android:title="@string/category_display_title" > + <com.cyanogenmod.settings.device.ColorTuningPreference + android:key="color_tuning" + android:title="@string/color_tuning_title_head" + android:summary="@string/color_tuning_summary_head" /> + <com.cyanogenmod.settings.device.GammaTuningPreference + android:key="gamma_tuning" + android:title="@string/gamma_tuning_title_head" + android:summary="@string/gamma_tuning_summary_head" /> + <com.cyanogenmod.settings.device.ColorHackPresets + android:key="colorgamma_presets" + android:title="@string/color_hack_presets_title_head" + android:summary="@string/color_hack_presets_summary_head" /> + </PreferenceCategory> + + <!-- General settings --> + <PreferenceCategory android:key="category_hardware" + android:title="@string/category_hardware_title"> + <com.cyanogenmod.settings.device.VibratorTuningPreference + android:key="vibrator_tuning" + android:title="@string/vibrator_tuning_title_head" + android:summary="@string/vibrator_tuning_summary_head" /> + </PreferenceCategory> + + <!-- GPU --> + <PreferenceCategory android:key="category_gpu" + android:title="@string/category_gpu_title"> + <ListPreference + android:key="gpu_overclock" + android:title="@string/gpu_overclock_title" + android:entries="@array/gpu_overclock_entries" + android:entryValues="@array/gpu_overclock_values" + android:defaultValue="0" /> + </PreferenceCategory> +</PreferenceScreen> diff --git a/GNexusParts/src/com/cyanogenmod/settings/device/ColorHackPresets.java b/GNexusParts/src/com/cyanogenmod/settings/device/ColorHackPresets.java new file mode 100644 index 0000000..94a638d --- /dev/null +++ b/GNexusParts/src/com/cyanogenmod/settings/device/ColorHackPresets.java @@ -0,0 +1,224 @@ +/* + * 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.cyanogenmod.settings.device; + +import android.content.Context; +import android.content.SharedPreferences; +import android.content.SharedPreferences.Editor; +import android.preference.DialogPreference; +import android.preference.PreferenceManager; +import android.util.AttributeSet; +import android.view.View; +import android.view.View.OnClickListener; +import android.widget.TextView; +import android.widget.Button; +import android.util.Log; + +/** + * Special preference type that allows configuration of both the ring volume and + * notification volume. + */ +public class ColorHackPresets extends DialogPreference implements OnClickListener { + + private static final String TAG = "PRESETS..."; + + private static final String[] FILE_PATH_GAMMA = new String[] { + "/sys/class/misc/samoled_color/red_v1_offset", + "/sys/class/misc/samoled_color/green_v1_offset", + "/sys/class/misc/samoled_color/blue_v1_offset", + "/sys/devices/platform/omapdss/manager0/gamma" + }; + + private static final String[] FILE_PATH_MULTI = new String[] { + "/sys/class/misc/samoled_color/red_multiplier", + "/sys/class/misc/samoled_color/green_multiplier", + "/sys/class/misc/samoled_color/blue_multiplier" + }; + + // Track instances to know when to restore original color + // (when the orientation changes, a new dialog is created before the old one + // is destroyed) + private static int sInstances = 0; + + // Align MAX_VALUE with Voodoo Control settings + private static final int MAX_VALUE = 2000000000; + + public ColorHackPresets(Context context, AttributeSet attrs) { + super(context, attrs); + + setDialogLayoutResource(R.layout.preference_colorgamma_presets); + } + + @Override + protected void onBindDialogView(View view) { + super.onBindDialogView(view); + + sInstances++; + + SetupButtonClickListeners(view); + } + + private void SetupButtonClickListeners(View view) { + Button[] mPresets = new Button[6]; + + mPresets[0] = (Button)view.findViewById(R.id.btnPreset1); + mPresets[1] = (Button)view.findViewById(R.id.btnPreset2); + mPresets[2] = (Button)view.findViewById(R.id.btnPreset3); + mPresets[3] = (Button)view.findViewById(R.id.btnPreset4); + mPresets[4] = (Button)view.findViewById(R.id.btnPreset5); + mPresets[5] = (Button)view.findViewById(R.id.btnPreset6); + for (int i = 0; i < 6; i++) { + mPresets[i].setOnClickListener(this); + } + } + + @Override + protected void onDialogClosed(boolean positiveResult) { + super.onDialogClosed(positiveResult); + + sInstances--; + + } + + /** + * Restore screen color tuning from SharedPreferences. (Write to kernel.) + * + * @param context The context to read the SharedPreferences from + */ + public static void restore(Context context) { + if (!isSupported()) { + return; + } + + } + + /** + * Check whether the running kernel supports color tuning or not. + * + * @return Whether color tuning is supported or not + */ + public static boolean isSupported() { + boolean supported = true; + for (String filePath : FILE_PATH_MULTI) { + if (!Utils.fileExists(filePath)) { + supported = false; + } + } + for (String filePath : FILE_PATH_GAMMA) { + if (!Utils.fileExists(filePath)) { + supported = false; + } + } + + return supported; + } + + public void onClick(View v) { + switch(v.getId()){ + case R.id.btnPreset1: + Preset1(); + break; + case R.id.btnPreset2: + Preset2(); + break; + case R.id.btnPreset3: + Preset3(); + break; + case R.id.btnPreset4: + Preset4(); + break; + case R.id.btnPreset5: + Preset5(); + break; + case R.id.btnPreset6: + Preset6(); + break; + } + } + + private void WriteMultiplier(Double fValue , int iPos) { + int iValue = (int) ((double) MAX_VALUE * fValue); + Utils.writeColor(FILE_PATH_MULTI[iPos], iValue); + Log.i(TAG,"KalimAz: Multiplier: " + iPos+ " Value " + iValue ); + } + + private void WriteGamma(int iValue , int iPos) { + Utils.writeValue(FILE_PATH_GAMMA[iPos], String.valueOf((long) iValue)); + Log.i(TAG,"KalimAz: Gamma: " + iPos+ " Value " + iValue ); + } + + private void Preset1() { + WriteMultiplier(0.5, 0); + WriteMultiplier(0.5, 1); + WriteMultiplier(0.5, 2); + WriteGamma(0, 0); + WriteGamma(0, 1); + WriteGamma(0, 2); + WriteGamma(0, 3); + } + + private void Preset2() { + WriteMultiplier(1.0, 0); + WriteMultiplier(1.0, 1); + WriteMultiplier(1.0, 2); + WriteGamma(0, 0); + WriteGamma(0, 1); + WriteGamma(0, 2); + WriteGamma(0, 3); + } + + private void Preset3() { + WriteMultiplier(0.35, 0); + WriteMultiplier(0.38, 1); + WriteMultiplier(0.5, 2); + WriteGamma(0, 0); + WriteGamma(0, 1); + WriteGamma(0, 2); + WriteGamma(0, 3); + } + + private void Preset4() { + WriteMultiplier(0.7231, 0); + WriteMultiplier(0.7016, 1); + WriteMultiplier(0.6532, 2); + WriteGamma(-31, 0); + WriteGamma(-30, 1); + WriteGamma(-14, 2); + WriteGamma(0, 3); + } + + private void Preset5() { + WriteMultiplier(0.6666, 0); + WriteMultiplier(0.6666, 1); + WriteMultiplier(0.8333, 2); + WriteGamma(-44, 0); + WriteGamma(-44, 1); + WriteGamma(-7, 2); + WriteGamma(0, 3); + } + + private void Preset6() { + WriteMultiplier(0.45, 0); + WriteMultiplier(0.48, 1); + WriteMultiplier(0.5, 2); + WriteGamma(-4, 0); + WriteGamma(0, 1); + WriteGamma(5, 2); + WriteGamma(0, 3); + } + +} diff --git a/GNexusParts/src/com/cyanogenmod/settings/device/ColorTuningPreference.java b/GNexusParts/src/com/cyanogenmod/settings/device/ColorTuningPreference.java new file mode 100644 index 0000000..25cbeb7 --- /dev/null +++ b/GNexusParts/src/com/cyanogenmod/settings/device/ColorTuningPreference.java @@ -0,0 +1,264 @@ +/* + * 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.cyanogenmod.settings.device; + +import android.content.Context; +import android.content.SharedPreferences; +import android.content.SharedPreferences.Editor; +import android.preference.DialogPreference; +import android.preference.PreferenceManager; +import android.util.AttributeSet; +import android.view.View; +import android.view.View.OnClickListener; +import android.widget.SeekBar; +import android.widget.TextView; +import android.util.Log; +import android.widget.Button; + +/** + * Special preference type that allows configuration of both the ring volume and + * notification volume. + */ +public class ColorTuningPreference extends DialogPreference implements OnClickListener { + + private static final String TAG = "COLOR..."; + + enum Colors { + RED, GREEN, BLUE + }; + + private static final int[] SEEKBAR_ID = new int[] { + R.id.color_red_seekbar, R.id.color_green_seekbar, R.id.color_blue_seekbar + }; + + private static final int[] VALUE_DISPLAY_ID = new int[] { + R.id.color_red_value, R.id.color_green_value, R.id.color_blue_value + }; + + private static final String[] FILE_PATH = new String[] { + "/sys/class/misc/samoled_color/red_multiplier", + "/sys/class/misc/samoled_color/green_multiplier", + "/sys/class/misc/samoled_color/blue_multiplier" + }; + + private ColorSeekBar mSeekBars[] = new ColorSeekBar[3]; + + // Align MAX_VALUE with Voodoo Control settings + private static final int MAX_VALUE = 2000000000; + + // Track instances to know when to restore original color + // (when the orientation changes, a new dialog is created before the old one + // is destroyed) + private static int sInstances = 0; + + public ColorTuningPreference(Context context, AttributeSet attrs) { + super(context, attrs); + + setDialogLayoutResource(R.layout.preference_dialog_color_tuning); + } + + @Override + protected void onBindDialogView(View view) { + super.onBindDialogView(view); + + sInstances++; + + for (int i = 0; i < SEEKBAR_ID.length; i++) { + SeekBar seekBar = (SeekBar) view.findViewById(SEEKBAR_ID[i]); + TextView valueDisplay = (TextView) view.findViewById(VALUE_DISPLAY_ID[i]); + mSeekBars[i] = new ColorSeekBar(seekBar, valueDisplay, FILE_PATH[i]); + } + SetupButtonClickListeners(view); + } + + private void SetupButtonClickListeners(View view) { + Button mButton1 = (Button)view.findViewById(R.id.btnColor1); + Button mButton2 = (Button)view.findViewById(R.id.btnColor2); + Button mButton3 = (Button)view.findViewById(R.id.btnColor3); + mButton1.setOnClickListener(this); + mButton2.setOnClickListener(this); + mButton3.setOnClickListener(this); + } + + @Override + protected void onDialogClosed(boolean positiveResult) { + super.onDialogClosed(positiveResult); + + sInstances--; + + if (positiveResult) { + for (ColorSeekBar csb : mSeekBars) { + csb.save(); + } + } else if (sInstances == 0) { + for (ColorSeekBar csb : mSeekBars) { + csb.reset(); + } + } + } + + /** + * Restore screen color tuning from SharedPreferences. (Write to kernel.) + * + * @param context The context to read the SharedPreferences from + */ + public static void restore(Context context) { + if (!isSupported()) { + return; + } + + int iValue, iValue2; + SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context); + + for (String filePath : FILE_PATH) { + String sDefaultValue = Utils.readOneLine(filePath); + Log.d(TAG,"INIT: " + sDefaultValue); + try { + iValue2 = Integer.parseInt(sDefaultValue); + } catch (NumberFormatException e) { + iValue2 = MAX_VALUE; + } + try { + iValue = sharedPrefs.getInt(filePath, iValue2); + Log.d(TAG, "restore: iValue: " + iValue + " File: " + filePath); + } catch (NumberFormatException e) { + iValue = iValue2; + Log.e(TAG, "restore ERROR: iValue: " + iValue + " File: " + filePath); + } + Utils.writeColor(filePath, (int) iValue); + } + } + + /** + * Check whether the running kernel supports color tuning or not. + * + * @return Whether color tuning is supported or not + */ + public static boolean isSupported() { + boolean supported = true; + for (String filePath : FILE_PATH) { + if (!Utils.fileExists(filePath)) { + supported = false; + } + } + + return supported; + } + + class ColorSeekBar implements SeekBar.OnSeekBarChangeListener { + + private String mFilePath; + + private int mOriginal; + + private SeekBar mSeekBar; + + private TextView mValueDisplay; + + public ColorSeekBar(SeekBar seekBar, TextView valueDisplay, String filePath) { + int iValue; + + mSeekBar = seekBar; + mValueDisplay = valueDisplay; + mFilePath = filePath; + + SharedPreferences sharedPreferences = getSharedPreferences(); + + // Read original value + if (Utils.fileExists(mFilePath)) { + String sDefaultValue = Utils.readOneLine(mFilePath); + iValue = (int) (Long.valueOf(sDefaultValue) / 2); + } else { + iValue = sharedPreferences.getInt(mFilePath, MAX_VALUE); + } + mOriginal = iValue; + + mSeekBar.setMax(MAX_VALUE); + reset(); + mSeekBar.setOnSeekBarChangeListener(this); + } + + public void reset() { + mSeekBar.setProgress(mOriginal); + updateValue(mOriginal); + } + + public void save() { + Editor editor = getEditor(); + editor.putInt(mFilePath, mSeekBar.getProgress()); + editor.commit(); + } + + @Override + public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { + Utils.writeColor(mFilePath, progress); + updateValue(progress); + } + + @Override + public void onStartTrackingTouch(SeekBar seekBar) { + // Do nothing + } + + @Override + public void onStopTrackingTouch(SeekBar seekBar) { + // Do nothing + } + + private void updateValue(int progress) { + mValueDisplay.setText(String.format("%d", (int) progress / 5000000)); + } + + public void SetNewValue(int iValue) { + mOriginal = iValue; + reset(); + } + + } + + public void onClick(View v) { + switch(v.getId()){ + case R.id.btnColor1: + SetSettings1(); + break; + case R.id.btnColor2: + SetSettings2(); + break; + case R.id.btnColor3: + SetSettings3(); + break; + } + } + + private void SetSettings1() { + mSeekBars[0].SetNewValue(1000000000); + mSeekBars[1].SetNewValue(1000000000); + mSeekBars[2].SetNewValue(1000000000); + } + + private void SetSettings2() { + mSeekBars[0].SetNewValue(1750000000); + mSeekBars[1].SetNewValue(1750000000); + mSeekBars[2].SetNewValue(1750000000); + } + + private void SetSettings3() { + mSeekBars[0].SetNewValue(900000000); + mSeekBars[1].SetNewValue(960000000); + mSeekBars[2].SetNewValue(1000000000); + } +} diff --git a/GNexusParts/src/com/cyanogenmod/settings/device/DevicePreferenceActivity.java b/GNexusParts/src/com/cyanogenmod/settings/device/DevicePreferenceActivity.java new file mode 100644 index 0000000..957883b --- /dev/null +++ b/GNexusParts/src/com/cyanogenmod/settings/device/DevicePreferenceActivity.java @@ -0,0 +1,88 @@ +/* + * 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.cyanogenmod.settings.device; + +import android.app.ActionBar; +import android.app.ActionBar.Tab; +import android.app.ActionBar.TabListener; +import android.app.Activity; +import android.app.Fragment; +import android.app.FragmentManager; +import android.app.FragmentTransaction; +import android.content.ComponentName; +import android.content.Context; +import android.content.Intent; +import android.content.ServiceConnection; +import android.os.Bundle; +import android.os.IBinder; +import android.preference.ListPreference; +import android.preference.PreferenceActivity; +import android.preference.PreferenceFragment; +import android.preference.PreferenceScreen; +import android.support.v13.app.FragmentPagerAdapter; +import android.support.v4.app.FragmentActivity; +import android.support.v4.view.ViewPager; +import android.view.MenuItem; + +import com.cyanogenmod.settings.device.R; + +import java.util.ArrayList; + +public class DevicePreferenceActivity extends PreferenceFragment { + + public static final String SHARED_PREFERENCES_BASENAME = "com.cyanogenmod.settings.device"; + public static final String ACTION_UPDATE_PREFERENCES = "com.cyanogenmod.settings.device.UPDATE"; + public static final String KEY_COLOR_TUNING = "color_tuning"; + public static final String KEY_GAMMA_TUNING = "gamma_tuning"; + public static final String KEY_COLORGAMMA_PRESETS = "colorgamma_presets"; + public static final String KEY_VIBRATOR_TUNING = "vibrator_tuning"; + public static final String KEY_CATEGORY_RADIO = "category_radio"; + public static final String KEY_HSPA = "hspa"; + public static final String KEY_GPU_OVERCLOCK = "gpu_overclock"; + + private ColorTuningPreference mColorTuning; + private GammaTuningPreference mGammaTuning; + private ColorHackPresets mColorHackPresets; + private VibratorTuningPreference mVibratorTuning; + private ListPreference mGpuOverclock; + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + addPreferencesFromResource(R.xml.preferences); + + mColorTuning = (ColorTuningPreference) findPreference(KEY_COLOR_TUNING); + mColorTuning.setEnabled(ColorTuningPreference.isSupported()); + + mGammaTuning = (GammaTuningPreference) findPreference(KEY_GAMMA_TUNING); + mGammaTuning.setEnabled(GammaTuningPreference.isSupported()); + + mColorHackPresets = (ColorHackPresets) findPreference(KEY_COLORGAMMA_PRESETS); + mColorHackPresets.setEnabled(ColorHackPresets.isSupported()); + + mVibratorTuning = (VibratorTuningPreference) findPreference(KEY_VIBRATOR_TUNING); + mVibratorTuning.setEnabled(VibratorTuningPreference.isSupported()); + + PreferenceScreen prefSet = getPreferenceScreen(); + + mGpuOverclock = (ListPreference) findPreference(KEY_GPU_OVERCLOCK); + mGpuOverclock.setEnabled(GpuOverclock.isSupported()); + mGpuOverclock.setOnPreferenceChangeListener(new GpuOverclock()); + GpuOverclock.updateSummary(mGpuOverclock, Integer.parseInt(mGpuOverclock.getValue())); + } +} diff --git a/GNexusParts/src/com/cyanogenmod/settings/device/DeviceSettings.java b/GNexusParts/src/com/cyanogenmod/settings/device/DeviceSettings.java new file mode 100644 index 0000000..772e557 --- /dev/null +++ b/GNexusParts/src/com/cyanogenmod/settings/device/DeviceSettings.java @@ -0,0 +1,30 @@ +package com.cyanogenmod.settings.device; + +import android.app.ActionBar; +import android.app.Activity; +import android.os.Bundle; +import android.view.MenuItem; + +public class DeviceSettings extends Activity { + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + ActionBar actionBar = getActionBar(); + actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE, ActionBar.DISPLAY_SHOW_TITLE); + actionBar.setDisplayHomeAsUpEnabled(true); + + getFragmentManager().beginTransaction().replace(android.R.id.content, + new DevicePreferenceActivity()).commit(); + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + switch (item.getItemId()) { + case android.R.id.home: + DeviceSettings.this.onBackPressed(); + default: + return super.onOptionsItemSelected(item); + } + } +} diff --git a/GNexusParts/src/com/cyanogenmod/settings/device/GammaTuningPreference.java b/GNexusParts/src/com/cyanogenmod/settings/device/GammaTuningPreference.java new file mode 100644 index 0000000..3c5aef0 --- /dev/null +++ b/GNexusParts/src/com/cyanogenmod/settings/device/GammaTuningPreference.java @@ -0,0 +1,286 @@ +/* + * 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.cyanogenmod.settings.device; + +import android.content.Context; +import android.content.SharedPreferences; +import android.content.SharedPreferences.Editor; +import android.preference.DialogPreference; +import android.preference.PreferenceManager; +import android.util.AttributeSet; +import android.view.View; +import android.view.View.OnClickListener; +import android.widget.SeekBar; +import android.widget.TextView; +import android.widget.Button; +import android.util.Log; + +/** + * Special preference type that allows configuration of both the ring volume and + * notification volume. + */ +public class GammaTuningPreference extends DialogPreference implements OnClickListener { + + private static final String TAG = "GAMMA..."; + + enum Colors { + RED, GREEN, BLUE + }; + + private static final int[] SEEKBAR_ID = new int[] { + R.id.gamma_red_seekbar, R.id.gamma_green_seekbar, R.id.gamma_blue_seekbar, R.id.gamma_dss_seekbar + }; + + private static final int[] VALUE_DISPLAY_ID = new int[] { + R.id.gamma_red_value, R.id.gamma_green_value, R.id.gamma_blue_value, R.id.gamma_dss_value + }; + + private static final String[] FILE_PATH = new String[] { + "/sys/class/misc/samoled_color/red_v1_offset", + "/sys/class/misc/samoled_color/green_v1_offset", + "/sys/class/misc/samoled_color/blue_v1_offset", + "/sys/devices/platform/omapdss/manager0/gamma" + }; + + private GammaSeekBar mSeekBars[] = new GammaSeekBar[4]; + + private static final int MAX_VALUE = 200; + + private static final int OFFSET_VALUE = 100; + + // Track instances to know when to restore original color + // (when the orientation changes, a new dialog is created before the old one + // is destroyed) + private static int sInstances = 0; + + public GammaTuningPreference(Context context, AttributeSet attrs) { + super(context, attrs); + + setDialogLayoutResource(R.layout.preference_dialog_gamma_tuning); + } + + @Override + protected void onBindDialogView(View view) { + super.onBindDialogView(view); + + sInstances++; + + for (int i = 0; i < SEEKBAR_ID.length; i++) { + SeekBar seekBar = (SeekBar) view.findViewById(SEEKBAR_ID[i]); + TextView valueDisplay = (TextView) view.findViewById(VALUE_DISPLAY_ID[i]); + if (i < 3) + mSeekBars[i] = new GammaSeekBar(seekBar, valueDisplay, FILE_PATH[i], OFFSET_VALUE, MAX_VALUE); + else + mSeekBars[i] = new GammaSeekBar(seekBar, valueDisplay, FILE_PATH[i], 0, 10); + } + SetupButtonClickListeners(view); + } + + private void SetupButtonClickListeners(View view) { + Button mButton1 = (Button)view.findViewById(R.id.btnGamma1); + Button mButton2 = (Button)view.findViewById(R.id.btnGamma2); + Button mButton3 = (Button)view.findViewById(R.id.btnGamma3); + mButton1.setOnClickListener(this); + mButton2.setOnClickListener(this); + mButton3.setOnClickListener(this); + } + + @Override + protected void onDialogClosed(boolean positiveResult) { + super.onDialogClosed(positiveResult); + + sInstances--; + + if (positiveResult) { + for (GammaSeekBar csb : mSeekBars) { + csb.save(); + } + } else if (sInstances == 0) { + for (GammaSeekBar csb : mSeekBars) { + csb.reset(); + } + } + } + + /** + * Restore screen color tuning from SharedPreferences. (Write to kernel.) + * + * @param context The context to read the SharedPreferences from + */ + public static void restore(Context context) { + if (!isSupported()) { + return; + } + + int iValue; + SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context); + + Boolean bFirstTime = sharedPrefs.getBoolean("FirstTimeGamma", true); + for (String filePath : FILE_PATH) { + String sDefaultValue = Utils.readOneLine(filePath); + iValue = sharedPrefs.getInt(filePath, Integer.valueOf(sDefaultValue)); + if (bFirstTime) + Utils.writeValue(filePath, "0"); + else + Utils.writeValue(filePath, String.valueOf((long) iValue)); + } + if (bFirstTime) + { + SharedPreferences.Editor editor = sharedPrefs.edit(); + editor.putBoolean("FirstTimeGamma", false); + editor.commit(); + } + } + + /** + * Check whether the running kernel supports color tuning or not. + * + * @return Whether color tuning is supported or not + */ + public static boolean isSupported() { + boolean supported = true; + for (String filePath : FILE_PATH) { + if (!Utils.fileExists(filePath)) { + supported = false; + } + } + + return supported; + } + + class GammaSeekBar implements SeekBar.OnSeekBarChangeListener { + + private String mFilePath; + + private int mOriginal; + + private SeekBar mSeekBar; + + private TextView mValueDisplay; + + private int iOffset; + + private int iMax; + + public GammaSeekBar(SeekBar seekBar, TextView valueDisplay, String filePath, Integer offsetValue, Integer maxValue) { + int iValue; + + mSeekBar = seekBar; + mValueDisplay = valueDisplay; + mFilePath = filePath; + iOffset = offsetValue; + iMax = maxValue; + + SharedPreferences sharedPreferences = getSharedPreferences(); + + // Read original value + if (Utils.fileExists(mFilePath)) { + String sDefaultValue = Utils.readOneLine(mFilePath); + iValue = Integer.valueOf(sDefaultValue); + } else { + iValue = iMax - iOffset; + } + mOriginal = iValue; + + mSeekBar.setMax(iMax); + + reset(); + mSeekBar.setOnSeekBarChangeListener(this); + } + + public void reset() { + int iValue; + + iValue = mOriginal + iOffset; + mSeekBar.setProgress(iValue); + updateValue(mOriginal); + } + + public void save() { + int iValue; + + iValue = mSeekBar.getProgress() - iOffset; + Editor editor = getEditor(); + editor.putInt(mFilePath, iValue); + editor.commit(); + } + + @Override + public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { + int iValue; + + iValue = progress - iOffset; + Utils.writeValue(mFilePath, String.valueOf((long) iValue)); + updateValue(iValue); + } + + @Override + public void onStartTrackingTouch(SeekBar seekBar) { + // Do nothing + } + + @Override + public void onStopTrackingTouch(SeekBar seekBar) { + // Do nothing + } + + private void updateValue(int progress) { + mValueDisplay.setText(String.format("%d", (int) progress)); + } + + public void SetNewValue(int iValue) { + mOriginal = iValue; + reset(); + } + + } + + public void onClick(View v) { + switch(v.getId()){ + case R.id.btnGamma1: + SetSettings1(); + break; + case R.id.btnGamma2: + SetSettings2(); + break; + case R.id.btnGamma3: + SetSettings3(); + break; + } + } + + private void SetSettings1() { + mSeekBars[0].SetNewValue(0); + mSeekBars[1].SetNewValue(0); + mSeekBars[2].SetNewValue(0); + mSeekBars[3].SetNewValue(0); + } + + private void SetSettings2() { + mSeekBars[0].SetNewValue(2); + mSeekBars[1].SetNewValue(15); + mSeekBars[2].SetNewValue(5); + mSeekBars[3].SetNewValue(8); + } + + private void SetSettings3() { + mSeekBars[0].SetNewValue(-4); + mSeekBars[1].SetNewValue(0); + mSeekBars[2].SetNewValue(5); + mSeekBars[3].SetNewValue(0); + } +} diff --git a/GNexusParts/src/com/cyanogenmod/settings/device/GpuOverclock.java b/GNexusParts/src/com/cyanogenmod/settings/device/GpuOverclock.java new file mode 100644 index 0000000..9dba113 --- /dev/null +++ b/GNexusParts/src/com/cyanogenmod/settings/device/GpuOverclock.java @@ -0,0 +1,61 @@ +/* + * 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.cyanogenmod.settings.device; + +import android.content.Context; +import android.content.SharedPreferences; +import android.preference.ListPreference; +import android.preference.Preference; +import android.preference.Preference.OnPreferenceChangeListener; +import android.preference.PreferenceManager; + +public class GpuOverclock implements OnPreferenceChangeListener { + + private static final String FILE = "/sys/devices/system/cpu/cpu0/cpufreq/gpu_oc"; + + public static boolean isSupported() { + return Utils.fileExists(FILE); + } + + public static void restore(Context context) { + if (!isSupported()) { + return; + } + + SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context); + Utils.writeValue(FILE, sharedPrefs.getString(DevicePreferenceActivity.KEY_GPU_OVERCLOCK, "0")); + } + + public boolean onPreferenceChange(Preference preference, Object newValue) { + Utils.writeValue(FILE, (String) newValue); + updateSummary((ListPreference) preference, Integer.parseInt(newValue.toString())); + return true; + } + + public static void updateSummary(ListPreference preference, int value) { + final CharSequence[] entries = preference.getEntries(); + final CharSequence[] values = preference.getEntryValues(); + int best = 0; + for (int i = 0; i < values.length; i++) { + int summaryValue = Integer.parseInt(values[i].toString()); + if (value >= summaryValue) { + best = i; + } + } + preference.setSummary(entries[best].toString()); + } +} diff --git a/GNexusParts/src/com/cyanogenmod/settings/device/Hspa.java b/GNexusParts/src/com/cyanogenmod/settings/device/Hspa.java new file mode 100644 index 0000000..d2cf641 --- /dev/null +++ b/GNexusParts/src/com/cyanogenmod/settings/device/Hspa.java @@ -0,0 +1,57 @@ +package com.cyanogenmod.settings.device; + +import android.content.Context; +import android.content.Intent; +import android.content.SharedPreferences; +import android.os.SystemProperties; +import android.preference.Preference; +import android.preference.Preference.OnPreferenceChangeListener; +import android.preference.PreferenceManager; + +public class Hspa implements OnPreferenceChangeListener { + + private static final String APK_FILE = "/system/app/SamsungServiceMode.apk"; + private static final String HSPA_PROP = "ro.gnexusparts.rild.hspa"; + private static final String HSPA_PROP_ENABLED = "1"; + + private Context mCtx; + + public Hspa(Context context) { + mCtx = context; + } + + public static boolean isSupported() { + String mHspa = SystemProperties.get(HSPA_PROP,"0"); + if (mHspa.equals(HSPA_PROP_ENABLED)) { + return true; + } else { + return false; + } + } + + /** + * Restore HSPA setting from SharedPreferences. (Write to kernel.) + * @param context The context to read the SharedPreferences from + */ + public static void restore(Context context) { + if (!isSupported()) { + return; + } + + SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context); + sendIntent(context, sharedPrefs.getString(DevicePreferenceActivity.KEY_HSPA, "23")); + } + + @Override + public boolean onPreferenceChange(Preference preference, Object newValue) { + sendIntent(mCtx, (String) newValue); + return true; + } + + private static void sendIntent(Context context, String value) { + Intent i = new Intent("com.cyanogenmod.SamsungServiceMode.EXECUTE"); + i.putExtra("sub_type", 20); // HSPA Setting + i.putExtra("data", value); + context.sendBroadcast(i); + } +} diff --git a/GNexusParts/src/com/cyanogenmod/settings/device/Startup.java b/GNexusParts/src/com/cyanogenmod/settings/device/Startup.java new file mode 100644 index 0000000..f1cd2ad --- /dev/null +++ b/GNexusParts/src/com/cyanogenmod/settings/device/Startup.java @@ -0,0 +1,19 @@ +package com.cyanogenmod.settings.device; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; + +public class Startup extends BroadcastReceiver { + + @Override + public void onReceive(final Context context, final Intent bootintent) { + ColorTuningPreference.restore(context); + GammaTuningPreference.restore(context); + VibratorTuningPreference.restore(context); + GpuOverclock.restore(context); + if (Hspa.isSupported()) { + Hspa.restore(context); + } + } +} diff --git a/GNexusParts/src/com/cyanogenmod/settings/device/Utils.java b/GNexusParts/src/com/cyanogenmod/settings/device/Utils.java new file mode 100644 index 0000000..dbf2947 --- /dev/null +++ b/GNexusParts/src/com/cyanogenmod/settings/device/Utils.java @@ -0,0 +1,149 @@ +/* + * 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.cyanogenmod.settings.device; + +import android.util.Log; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.FileReader; +import java.io.IOException; +import java.io.SyncFailedException; + +public class Utils { + private static final String TAG = "GNexusParts_Utils"; + private static final String TAG_READ = "GNexusParts_Utils_Read"; + private static final String TAG_WRITE = "GNexusParts_Utils_Write"; + + /** + * Write a string value to the specified file. + * + * @param filename The filename + * @param value The value + */ + public static void writeValue(String filename, String value) { + FileOutputStream fos = null; + try { + fos = new FileOutputStream(new File(filename), false); + fos.write(value.getBytes()); + fos.flush(); + // fos.getFD().sync(); + } catch (FileNotFoundException ex) { + Log.w(TAG, "file " + filename + " not found: " + ex); + } catch (SyncFailedException ex) { + Log.w(TAG, "file " + filename + " sync failed: " + ex); + } catch (IOException ex) { + Log.w(TAG, "IOException trying to sync " + filename + ": " + ex); + } catch (RuntimeException ex) { + Log.w(TAG, "exception while syncing file: ", ex); + } finally { + if (fos != null) { + try { + Log.w(TAG_WRITE, "file " + filename + ": " + value); + fos.close(); + } catch (IOException ex) { + Log.w(TAG, "IOException while closing synced file: ", ex); + } catch (RuntimeException ex) { + Log.w(TAG, "exception while closing file: ", ex); + } + } + } + + } + + /** + * Write a string value to the specified file. + * + * @param filename The filename + * @param value The value + */ + public static void writeValue(String filename, Boolean value) { + FileOutputStream fos = null; + String sEnvia; + try { + fos = new FileOutputStream(new File(filename), false); + if (value) + sEnvia = "1"; + else + sEnvia = "0"; + fos.write(sEnvia.getBytes()); + fos.flush(); + // fos.getFD().sync(); + } catch (FileNotFoundException ex) { + Log.w(TAG, "file " + filename + " not found: " + ex); + } catch (SyncFailedException ex) { + Log.w(TAG, "file " + filename + " sync failed: " + ex); + } catch (IOException ex) { + Log.w(TAG, "IOException trying to sync " + filename + ": " + ex); + } catch (RuntimeException ex) { + Log.w(TAG, "exception while syncing file: ", ex); + } finally { + if (fos != null) { + try { + Log.w(TAG_WRITE, "file " + filename + ": " + value); + fos.close(); + } catch (IOException ex) { + Log.w(TAG, "IOException while closing synced file: ", ex); + } catch (RuntimeException ex) { + Log.w(TAG, "exception while closing file: ", ex); + } + } + } + } + + /** + * Write the "color value" to the specified file. The value is scaled from + * an integer to an unsigned integer by multiplying by 2. + * + * @param filename The filename + * @param value The value of max value Integer.MAX + */ + public static void writeColor(String filename, int value) { + writeValue(filename, String.valueOf((long) value * 2)); + } + + /** + * Check if the specified file exists. + * + * @param filename The filename + * @return Whether the file exists or not + */ + public static boolean fileExists(String filename) { + return new File(filename).exists(); + } + + // Read value from sysfs interface + public static String readOneLine(String sFile) { + BufferedReader brBuffer; + String sLine = null; + + try { + brBuffer = new BufferedReader(new FileReader(sFile), 512); + try { + sLine = brBuffer.readLine(); + } finally { + Log.w(TAG_READ, "file " + sFile + ": " + sLine); + brBuffer.close(); + } + } catch (Exception e) { + Log.e(TAG_READ, "IO Exception when reading /sys/ file", e); + } + return sLine; + } +} diff --git a/GNexusParts/src/com/cyanogenmod/settings/device/VibratorTuningPreference.java b/GNexusParts/src/com/cyanogenmod/settings/device/VibratorTuningPreference.java new file mode 100644 index 0000000..f8aec17 --- /dev/null +++ b/GNexusParts/src/com/cyanogenmod/settings/device/VibratorTuningPreference.java @@ -0,0 +1,277 @@ +/* + * 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.cyanogenmod.settings.device; + +import android.content.Context; +import android.content.SharedPreferences; +import android.content.SharedPreferences.Editor; +import android.preference.DialogPreference; +import android.preference.PreferenceManager; +import android.util.AttributeSet; +import android.view.View; +import android.view.View.OnClickListener; +import android.widget.SeekBar; +import android.widget.TextView; +import android.widget.Button; +import android.util.Log; +import android.os.Vibrator; + +/** + * Special preference type that allows configuration of both the ring volume and + * notification volume. + */ +public class VibratorTuningPreference extends DialogPreference implements OnClickListener { + + private static final String TAG = "vibrator..."; + + private static final int[] SEEKBAR_ID = new int[] { + R.id.vibrator_seekbar + }; + + private static final int[] VALUE_DISPLAY_ID = new int[] { + R.id.vibrator_value + }; + + private static final String[] FILE_PATH = new String[] { + "/sys/vibrator/pwmvalue", + }; + + private vibratorSeekBar mSeekBars[] = new vibratorSeekBar[1]; + + private static final int MAX_VALUE = 100; + + private static final int OFFSET_VALUE = 0; + + // Track instances to know when to restore original color + // (when the orientation changes, a new dialog is created before the old one + // is destroyed) + private static int sInstances = 0; + + public VibratorTuningPreference(Context context, AttributeSet attrs) { + super(context, attrs); + + setDialogLayoutResource(R.layout.preference_dialog_vibrator_tuning); + } + + @Override + protected void onBindDialogView(View view) { + super.onBindDialogView(view); + + sInstances++; + + for (int i = 0; i < SEEKBAR_ID.length; i++) { + SeekBar seekBar = (SeekBar) view.findViewById(SEEKBAR_ID[i]); + TextView valueDisplay = (TextView) view.findViewById(VALUE_DISPLAY_ID[i]); + if (i < 3) + mSeekBars[i] = new vibratorSeekBar(seekBar, valueDisplay, FILE_PATH[i], OFFSET_VALUE, MAX_VALUE); + else + mSeekBars[i] = new vibratorSeekBar(seekBar, valueDisplay, FILE_PATH[i], 0, 10); + } + SetupButtonClickListeners(view); + } + + private void SetupButtonClickListeners(View view) { + Button mDefaultButton = (Button)view.findViewById(R.id.btnvibratorDefault); + mDefaultButton.setOnClickListener(this); + + Button mTestButton = (Button)view.findViewById(R.id.btnvibratorTest); + mTestButton.setOnClickListener(this); + } + + @Override + protected void onDialogClosed(boolean positiveResult) { + super.onDialogClosed(positiveResult); + + sInstances--; + + if (positiveResult) { + for (vibratorSeekBar csb : mSeekBars) { + csb.save(); + } + } else if (sInstances == 0) { + for (vibratorSeekBar csb : mSeekBars) { + csb.reset(); + } + } + } + + /** + * Restore screen color tuning from SharedPreferences. (Write to kernel.) + * + * @param context The context to read the SharedPreferences from + */ + public static void restore(Context context) { + if (!isSupported()) { + return; + } + + SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context); + + Boolean bFirstTime = sharedPrefs.getBoolean("FirstTimevibrator", true); + for (String filePath : FILE_PATH) { + String sDefaultValue = Utils.readOneLine(filePath); + int iValue = sharedPrefs.getInt(filePath, Integer.valueOf(sDefaultValue)); + if (bFirstTime) + Utils.writeValue(filePath, "100"); + else + Utils.writeValue(filePath, String.valueOf((long) iValue)); + } + if (bFirstTime) + { + SharedPreferences.Editor editor = sharedPrefs.edit(); + editor.putBoolean("FirstTimevibrator", false); + editor.commit(); + } + } + + /** + * Check whether the running kernel supports color tuning or not. + * + * @return Whether color tuning is supported or not + */ + public static boolean isSupported() { + boolean supported = true; + for (String filePath : FILE_PATH) { + if (!Utils.fileExists(filePath)) { + supported = false; + } + } + + return supported; + } + + class vibratorSeekBar implements SeekBar.OnSeekBarChangeListener { + + private String mFilePath; + + private int mOriginal; + + private SeekBar mSeekBar; + + private TextView mValueDisplay; + + private int iOffset; + + private int iMax; + + public vibratorSeekBar(SeekBar seekBar, TextView valueDisplay, String filePath, Integer offsetValue, Integer maxValue) { + int iValue; + + mSeekBar = seekBar; + mValueDisplay = valueDisplay; + mFilePath = filePath; + iOffset = offsetValue; + iMax = maxValue; + + SharedPreferences sharedPreferences = getSharedPreferences(); + + // Read original value + if (Utils.fileExists(mFilePath)) { + String sDefaultValue = Utils.readOneLine(mFilePath); + iValue = convertVibratorToAverage(Integer.valueOf(sDefaultValue)); + } else { + iValue = iMax - iOffset; + } + mOriginal = iValue; + + mSeekBar.setMax(iMax); + + reset(); + mSeekBar.setOnSeekBarChangeListener(this); + } + + public void reset() { + int iValue; + + iValue = mOriginal + iOffset; + mSeekBar.setProgress(iValue); + updateValue(mOriginal); + } + + public void save() { + int iValue; + + iValue = mSeekBar.getProgress() - iOffset; + Editor editor = getEditor(); + editor.putInt(mFilePath, convertAverageToVibrator(iValue)); + editor.commit(); + } + + @Override + public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { + int iValue; + + iValue = progress - iOffset; + Utils.writeValue(mFilePath, String.valueOf((long) convertAverageToVibrator(iValue))); + updateValue(iValue); + } + + @Override + public void onStartTrackingTouch(SeekBar seekBar) { + // Do nothing + } + + @Override + public void onStopTrackingTouch(SeekBar seekBar) { + // Do nothing + } + + private void updateValue(int progress) { + mValueDisplay.setText(String.format("%d", (int) progress)); + } + + public void setNewValue(int iValue) { + mOriginal = iValue; + reset(); + } + + private int convertAverageToVibrator(int averageValue) { + int resultVibrator; + + resultVibrator = (averageValue * 127) / 100; + return resultVibrator; + } + + private int convertVibratorToAverage(int resultVibrator) { + int averageValue; + + averageValue = (resultVibrator * 100) / 127; + return averageValue; + } + + } + + public void onClick(View v) { + switch(v.getId()){ + case R.id.btnvibratorDefault: + setDefaultSettings(); + break; + case R.id.btnvibratorTest: + testVibration(); + break; + } + } + + private void setDefaultSettings() { + mSeekBars[0].setNewValue(100); + } + + private void testVibration() { + Vibrator vib = (Vibrator) this.getContext().getSystemService(Context.VIBRATOR_SERVICE); + vib.vibrate(1000); + } +} diff --git a/audio/audio_hw.c b/audio/audio_hw.c index 66a6da7..0ee17e1 100644 --- a/audio/audio_hw.c +++ b/audio/audio_hw.c @@ -1,4 +1,5 @@ /* + * Portions Copyright (C) 2012 VMware, Inc. All Rights Reserved. * Copyright (C) 2011 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -261,8 +262,8 @@ #define VOICE_CALL_HEADSET_MIC_VOLUME 8 /* use-case specific output volumes */ -#define NORMAL_SPEAKER_VOLUME_TORO 6 -#define NORMAL_SPEAKER_VOLUME_MAGURO 2 +#define NORMAL_SPEAKER_VOLUME_TORO 9 +#define NORMAL_SPEAKER_VOLUME_MAGURO 7 #define NORMAL_HEADSET_VOLUME_TORO -12 #define NORMAL_HEADSET_VOLUME_MAGURO -12 #define NORMAL_HEADPHONE_VOLUME_TORO -6 /* allow louder output for headphones */ @@ -271,7 +272,7 @@ #define NORMAL_EARPIECE_VOLUME_MAGURO -2 #define VOICE_CALL_SPEAKER_VOLUME_TORO 9 -#define VOICE_CALL_SPEAKER_VOLUME_MAGURO 6 +#define VOICE_CALL_SPEAKER_VOLUME_MAGURO 7 #define VOICE_CALL_HEADSET_VOLUME_TORO -6 #define VOICE_CALL_HEADSET_VOLUME_MAGURO 0 #define VOICE_CALL_EARPIECE_VOLUME_TORO 2 @@ -785,7 +786,7 @@ static int is_device_toro(void) property_get(PRODUCT_DEVICE_PROPERTY, property, PRODUCT_DEVICE_TORO); /* return true if the property matches the given value */ - return strcmp(property, PRODUCT_DEVICE_TORO) == 0; + return strncmp(property, PRODUCT_DEVICE_TORO, 4) == 0; } /* The enable flag when 0 makes the assumption that enums are disabled by @@ -19,12 +19,6 @@ # # Everything in this directory will become public -ifeq ($(TARGET_PREBUILT_KERNEL),) -LOCAL_KERNEL := device/samsung/tuna/kernel -else -LOCAL_KERNEL := $(TARGET_PREBUILT_KERNEL) -endif - DEVICE_PACKAGE_OVERLAYS := device/samsung/tuna/overlay # This device is xhdpi. However the platform doesn't @@ -66,7 +60,6 @@ PRODUCT_PACKAGES += \ # keystore.tuna PRODUCT_COPY_FILES += \ - $(LOCAL_KERNEL):kernel \ device/samsung/tuna/init.tuna.rc:root/init.tuna.rc \ device/samsung/tuna/init.tuna.usb.rc:root/init.tuna.usb.rc \ device/samsung/tuna/fstab.tuna:root/fstab.tuna \ @@ -94,6 +87,10 @@ PRODUCT_PROPERTY_OVERRIDES += \ PRODUCT_DEFAULT_PROPERTY_OVERRIDES += \ persist.sys.usb.config=mtp +# Torch +PRODUCT_PACKAGES += \ + Torch + # NFC PRODUCT_PACKAGES += \ libnfc \ @@ -210,3 +207,7 @@ $(call inherit-product-if-exists, vendor/samsung/tuna/device-vendor.mk) BOARD_WLAN_DEVICE_REV := bcm4330_b2 WIFI_BAND := 802_11_ABG $(call inherit-product-if-exists, hardware/broadcom/wlan/bcmdhd/firmware/bcm4330/device-bcm.mk) + +# vold +PRODUCT_COPY_FILES += \ + device/samsung/tuna/vold.fstab:system/etc/vold.fstab diff --git a/init.tuna.rc b/init.tuna.rc index 466ee7c..374e425 100755 --- a/init.tuna.rc +++ b/init.tuna.rc @@ -69,6 +69,9 @@ on fs chmod 0777 /dev/tiler chmod 0777 /dev/dmm +# change permissions for gamma settings + chmod 0666 /sys/devices/platform/omapdss/manager0/gamma + # change permissions for ION driver chmod 0777 /dev/ion @@ -79,6 +82,9 @@ on fs # add symlink for HDCP key symlink /factory/hdcp.keys /system/vendor/firmware/hdcp.keys +# allow to modify Wifi power behaviour in terms of battery/speed at sleep time + chown root system sys/module/bcmdhd/parameters/uiFastWifi + # nfc setprop ro.nfc.port "COM4" chmod 0600 /dev/ttyO3 @@ -217,11 +223,12 @@ service iprenew_bnep0 /system/bin/dhcpcd -n oneshot # bugreport is triggered by holding down volume down, volume up and power -service bugreport /system/bin/bugmailer.sh -v - class main - disabled - oneshot - keycodes 114 115 116 +# it's easy to trigger when wanting to take screenshots. let's disable it +#service bugreport /system/bin/bugmailer.sh -v +# class main +# disabled +# oneshot +# keycodes 114 115 116 service battery_charger /charger class charger diff --git a/overlay/frameworks/base/core/res/res/values/config.xml b/overlay/frameworks/base/core/res/res/values/config.xml index 2cd1c67..52cd198 100644 --- a/overlay/frameworks/base/core/res/res/values/config.xml +++ b/overlay/frameworks/base/core/res/res/values/config.xml @@ -232,6 +232,13 @@ <!-- Boolean indicating whether the wifi chipset has background scan support --> <bool translatable="false" name="config_wifi_background_scan_support">true</bool> + <!-- Boolean indicating whether the wifi chipset has p2p support --> + <bool translatable="false" name="config_wifi_p2p_support">true</bool> + + <!-- Device type information conforming to Annex B format in WiFi Direct specification. + The default represents a dual-mode smartphone --> + <string translatable="false" name="config_wifi_p2p_device_type">10-0050F204-5</string> + <bool name="config_ui_enableFadingMarquee">false</bool> <!-- Is the notification LED intrusive? Used to decide if there should be a disable option --> diff --git a/overlay/packages/apps/Settings/res/values/config.xml b/overlay/packages/apps/Settings/res/values/config.xml new file mode 100644 index 0000000..b314f7a --- /dev/null +++ b/overlay/packages/apps/Settings/res/values/config.xml @@ -0,0 +1,24 @@ +<?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. +--> + +<resources xmlns:xliff="urnasis:names:tc:xliff:document:1.2 "> + <!-- LED Flashlight --> + <bool name="has_led_flash">true</bool> + + <!-- Show Expanded Desktop preference --> + <bool name="config_show_expandedDesktop">true</bool> +</resources> diff --git a/overlay/packages/apps/Torch/res/values/config.xml b/overlay/packages/apps/Torch/res/values/config.xml new file mode 100644 index 0000000..593661a --- /dev/null +++ b/overlay/packages/apps/Torch/res/values/config.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** Copyright 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. +*/ +--> + +<!-- These resources are around just to allow their values to be customized + for different hardware and product builds. --> +<resources> + <!-- If there is no sysfs-based control mechanism, enable this --> + <bool name="useCameraInterface">true</bool> +</resources>
\ No newline at end of file diff --git a/power/power_tuna.c b/power/power_tuna.c index 7d06093..455137d 100644 --- a/power/power_tuna.c +++ b/power/power_tuna.c @@ -25,8 +25,19 @@ #include <hardware/hardware.h> #include <hardware/power.h> +#define SCALINGMAXFREQ_PATH "/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq" +#define SCREENOFFMAXFREQ_PATH "/sys/devices/system/cpu/cpu0/cpufreq/screen_off_max_freq" #define BOOSTPULSE_PATH "/sys/devices/system/cpu/cpufreq/interactive/boostpulse" +#define MAX_BUF_SZ 10 + +/* initialize to something safe */ +static char screen_off_max_freq[MAX_BUF_SZ] = "700000"; +static char scaling_max_freq[MAX_BUF_SZ] = "1200000"; + +/* for tracking previous screen state */ +static int previous_state = 0; + struct tuna_power_module { struct power_module base; pthread_mutex_t lock; @@ -55,6 +66,23 @@ static void sysfs_write(char *path, char *s) close(fd); } +int sysfs_read(const char *path, char *buf, size_t size) +{ + int fd, len; + + fd = open(path, O_RDONLY); + if (fd < 0) + return -1; + + do { + len = read(fd, buf, size); + } while (len < 0 && errno == EINTR); + + close(fd); + + return len; +} + static void tuna_power_init(struct power_module *module) { /* @@ -99,12 +127,43 @@ static int boostpulse_open(struct tuna_power_module *tuna) static void tuna_power_set_interactive(struct power_module *module, int on) { /* - * Lower maximum frequency when screen is off. CPU 0 and 1 share a - * cpufreq policy. + * Lower maximum frequency when screen changes from on to off. + * Return it to previous value when screen changes from off to on. + * CPU 0 and 1 share a cpufreq policy. */ - sysfs_write("/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq", - on ? "1200000" : "700000"); + //screen state has changed since last call + if (on != previous_state) + { + char buf_screen_off_max[MAX_BUF_SZ], buf_scaling_max[MAX_BUF_SZ]; + int screen_off_max, scaling_max; + + previous_state = on; + + //read value of screen-off max from sysfs, and convert to int for comparison + if (sysfs_read(SCREENOFFMAXFREQ_PATH, buf_screen_off_max, sizeof(buf_screen_off_max)) != -1) + screen_off_max = atoi(buf_screen_off_max); + + //read value of max from sysfs, and convert to int for comparison + if (sysfs_read(SCALINGMAXFREQ_PATH, buf_scaling_max, sizeof(buf_scaling_max)) != -1) + scaling_max = atoi(buf_scaling_max); + + /* If scaling_max_freq > screen_off_max_freq, then scaling_max_freq is really the maximum frequency, so save it for the next time the screen comes on. + * If screen_off_max_freq == 0, then we're just going to write our saved scalin_max_freq back to sysfs no matter what + * If scaling_max_freq == screen_off_max_freq, then scaling_max_freq has the screen_off_max in it, so DON'T SAVE IT TO OUR MAX VARIABLE! + */ + if (scaling_max > screen_off_max) + memcpy(scaling_max_freq, + (scaling_max > screen_off_max) ? buf_scaling_max : buf_screen_off_max, + strlen((scaling_max > screen_off_max) ? buf_scaling_max : buf_screen_off_max)); + + memcpy(screen_off_max_freq, + (scaling_max <= screen_off_max && screen_off_max > 0) ? buf_scaling_max : buf_screen_off_max, + strlen((scaling_max <= screen_off_max && screen_off_max > 0) ? buf_scaling_max : buf_screen_off_max)); + + //write the appropriate value for scaling_max back to sysfs + sysfs_write(SCALINGMAXFREQ_PATH, on?scaling_max_freq:screen_off_max_freq); + } } static void tuna_power_hint(struct power_module *module, power_hint_t hint, @@ -113,17 +172,23 @@ static void tuna_power_hint(struct power_module *module, power_hint_t hint, struct tuna_power_module *tuna = (struct tuna_power_module *) module; char buf[80]; int len; + int duration = 1; switch (hint) { case POWER_HINT_INTERACTION: + case POWER_HINT_CPU_BOOST: + if (data != NULL) + duration = (int) data; + if (boostpulse_open(tuna) >= 0) { - len = write(tuna->boostpulse_fd, "1", 1); + snprintf(buf, sizeof(buf), "%d", duration); + len = write(tuna->boostpulse_fd, buf, strlen(buf)); - if (len < 0) { - strerror_r(errno, buf, sizeof(buf)); - ALOGE("Error writing to %s: %s\n", BOOSTPULSE_PATH, buf); - } - } + if (len < 0) { + strerror_r(errno, buf, sizeof(buf)); + ALOGE("Error writing to %s: %s\n", BOOSTPULSE_PATH, buf); + } + } break; case POWER_HINT_VSYNC: diff --git a/recovery.fstab b/recovery.fstab index 6e33ce7..f5ba6dc 100644 --- a/recovery.fstab +++ b/recovery.fstab @@ -1,6 +1,6 @@ # mount point fstype device -/sdcard vfat /dev/block/sda1 +/sdcard datamedia /dev/null /system ext4 /dev/block/platform/omap/omap_hsmmc.0/by-name/system /cache ext4 /dev/block/platform/omap/omap_hsmmc.0/by-name/cache /data ext4 /dev/block/platform/omap/omap_hsmmc.0/by-name/userdata diff --git a/recovery_keys.c b/recovery_keys.c new file mode 100644 index 0000000..013c169 --- /dev/null +++ b/recovery_keys.c @@ -0,0 +1,41 @@ +#include <linux/input.h> + +#include "recovery_ui.h" +#include "common.h" +#include "extendedcommands.h" + + +int device_toggle_display(volatile char* key_pressed, int key_code) { + int alt = key_pressed[KEY_LEFTALT] || key_pressed[KEY_RIGHTALT]; + if (alt && key_code == KEY_L) + return 1; + // allow toggling of the display if the correct key is pressed, and the display toggle is allowed or the display is currently off + if (ui_get_showing_back_button()) { + return 0; + //return get_allow_toggle_display() && (key_code == KEY_HOME || key_code == KEY_MENU || key_code == KEY_END); + } + return get_allow_toggle_display() && (key_code == KEY_HOME || key_code == KEY_MENU || key_code == KEY_POWER || key_code == KEY_END); +} + +int device_handle_key(int key_code, int visible) { + if (visible) { + switch (key_code) { + case KEY_VOLUMEDOWN: + return HIGHLIGHT_DOWN; + + case KEY_VOLUMEUP: + return HIGHLIGHT_UP; + + case KEY_POWER: + if (ui_get_showing_back_button()) { + return SELECT_ITEM; + } + if (!get_allow_toggle_display()) + return GO_BACK; + break; + return SELECT_ITEM; + } + } + + return NO_ACTION; +} diff --git a/vold.fstab b/vold.fstab new file mode 100644 index 0000000..25dee80 --- /dev/null +++ b/vold.fstab @@ -0,0 +1,16 @@ +## Vold 2.0 Generic fstab +## - San Mehat (san@android.com) +## + +####################### +## Regular device mount +## +## Format: dev_mount <label> <mount_point> <part> <sysfs_path1...> +## label - Label for the volume +## mount_point - Where the volume will be mounted +## part - Partition # (1 based), or 'auto' for first usable partition. +## <sysfs_path> - List of sysfs paths to source devices +###################### + +# USB storage device +dev_mount usbdisk /storage/usbdisk auto /devices/platform/omap/musb-omap2430 |