From: deadman96385 Date: Mon, 21 Mar 2016 19:21:38 +0000 (-0500) Subject: Move Advanced Display so exynos5/7 can use it X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=a6d5bd701d1118d2c3fc2b840296a4cad10f096f;p=GitHub%2FLineageOS%2Fandroid_hardware_samsung.git Move Advanced Display so exynos5/7 can use it Change-Id: Idc255301f30cff6b41d04db6f14fa421ee9eddb5 --- diff --git a/AdvancedDisplay/Android.mk b/AdvancedDisplay/Android.mk new file mode 100644 index 0000000..1ed8c10 --- /dev/null +++ b/AdvancedDisplay/Android.mk @@ -0,0 +1,13 @@ +LOCAL_PATH:= $(call my-dir) +include $(CLEAR_VARS) + +LOCAL_MODULE_TAGS := optional + +LOCAL_SRC_FILES := $(call all-java-files-under, src) + +LOCAL_PACKAGE_NAME := AdvancedDisplay +LOCAL_CERTIFICATE := platform + +include $(BUILD_PACKAGE) + +include $(call all-makefiles-under,$(LOCAL_PATH)) diff --git a/AdvancedDisplay/AndroidManifest.xml b/AdvancedDisplay/AndroidManifest.xml new file mode 100644 index 0000000..96798f3 --- /dev/null +++ b/AdvancedDisplay/AndroidManifest.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/AdvancedDisplay/res/drawable/ic_settings_advanced_display.xml b/AdvancedDisplay/res/drawable/ic_settings_advanced_display.xml new file mode 100644 index 0000000..61cb8dd --- /dev/null +++ b/AdvancedDisplay/res/drawable/ic_settings_advanced_display.xml @@ -0,0 +1,30 @@ + + + + + + + diff --git a/AdvancedDisplay/res/layout/framelayout.xml b/AdvancedDisplay/res/layout/framelayout.xml new file mode 100755 index 0000000..e2ab9ad --- /dev/null +++ b/AdvancedDisplay/res/layout/framelayout.xml @@ -0,0 +1,5 @@ + + diff --git a/AdvancedDisplay/res/values/arrays.xml b/AdvancedDisplay/res/values/arrays.xml new file mode 100644 index 0000000..be9f348 --- /dev/null +++ b/AdvancedDisplay/res/values/arrays.xml @@ -0,0 +1,65 @@ + + + + + CyanogenMod (default) + UI + Video + Video warm + Video cold + Camera + Navigation + Gallery + VT + + + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + + + + Dynamic (default) + Standard + Natural + Movie + + + + 0 + 1 + 2 + 3 + + + + Normal + Inverted + + + + 0 + 1 + + diff --git a/AdvancedDisplay/res/values/colors.xml b/AdvancedDisplay/res/values/colors.xml new file mode 100644 index 0000000..2a95ee2 --- /dev/null +++ b/AdvancedDisplay/res/values/colors.xml @@ -0,0 +1,22 @@ + + + + + #ff263238 + #ff21272b + #ff009688 + diff --git a/AdvancedDisplay/res/values/config.xml b/AdvancedDisplay/res/values/config.xml new file mode 100644 index 0000000..a26bed0 --- /dev/null +++ b/AdvancedDisplay/res/values/config.xml @@ -0,0 +1,26 @@ + + + + + + + + "/sys/class/mdnie/mdnie/scenario" + "/sys/class/mdnie/mdnie/mode" + "/sys/class/mdnie/mdnie/negative" + + diff --git a/AdvancedDisplay/res/values/dimens.xml b/AdvancedDisplay/res/values/dimens.xml new file mode 100644 index 0000000..62f1899 --- /dev/null +++ b/AdvancedDisplay/res/values/dimens.xml @@ -0,0 +1,20 @@ + + + + + 72dp + diff --git a/AdvancedDisplay/res/values/strings.xml b/AdvancedDisplay/res/values/strings.xml new file mode 100644 index 0000000..6e6d213 --- /dev/null +++ b/AdvancedDisplay/res/values/strings.xml @@ -0,0 +1,31 @@ + + + + Advanced display + + + Screen + Colors + + + Scenario + Set the mDNIe scenario + Mode + Set the mDNIe mode + Negative mode + Enable/disable inverted colors + diff --git a/AdvancedDisplay/res/values/styles.xml b/AdvancedDisplay/res/values/styles.xml new file mode 100644 index 0000000..af83c00 --- /dev/null +++ b/AdvancedDisplay/res/values/styles.xml @@ -0,0 +1,29 @@ + + + + + + + diff --git a/AdvancedDisplay/res/xml/screen_preferences.xml b/AdvancedDisplay/res/xml/screen_preferences.xml new file mode 100644 index 0000000..56e536c --- /dev/null +++ b/AdvancedDisplay/res/xml/screen_preferences.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + diff --git a/AdvancedDisplay/src/com/cyanogenmod/settings/device/DisplaySettings.java b/AdvancedDisplay/src/com/cyanogenmod/settings/device/DisplaySettings.java new file mode 100644 index 0000000..e5930c8 --- /dev/null +++ b/AdvancedDisplay/src/com/cyanogenmod/settings/device/DisplaySettings.java @@ -0,0 +1,70 @@ +/* + * 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.app.Activity; +import android.app.ActionBar; +import android.app.Activity; +import android.app.Fragment; +import android.app.FragmentTransaction; +import android.content.Context; +import android.os.Bundle; +import android.view.MenuItem; +import android.widget.FrameLayout; + +import com.cyanogenmod.settings.device.R; + +import java.util.ArrayList; + +public class DisplaySettings extends Activity { + + 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_MDNIE_SCENARIO = "mdnie_scenario"; + public static final String KEY_MDNIE_MODE = "mdnie_mode"; + public static final String KEY_MDNIE_NEGATIVE = "mdnie_negative"; + + ScreenFragmentActivity mFragment; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + mFragment = new ScreenFragmentActivity(); + setContentView(R.layout.framelayout); + getFragmentManager().beginTransaction().add(R.id.frameLayout, mFragment).commit(); + + final ActionBar bar = getActionBar(); + bar.setTitle(R.string.app_name); + bar.setDisplayHomeAsUpEnabled(true); + + } + + @Override + protected void onSaveInstanceState(Bundle outState) { + super.onSaveInstanceState(outState); + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + switch (item.getItemId()) { + case android.R.id.home: + DisplaySettings.this.onBackPressed(); + default: + return super.onOptionsItemSelected(item); + } + } +} diff --git a/AdvancedDisplay/src/com/cyanogenmod/settings/device/ScreenFragmentActivity.java b/AdvancedDisplay/src/com/cyanogenmod/settings/device/ScreenFragmentActivity.java new file mode 100644 index 0000000..7b64a4f --- /dev/null +++ b/AdvancedDisplay/src/com/cyanogenmod/settings/device/ScreenFragmentActivity.java @@ -0,0 +1,79 @@ +/* + * 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.res.Resources; +import android.content.SharedPreferences; +import android.os.Bundle; +import android.preference.CheckBoxPreference; +import android.preference.ListPreference; +import android.preference.Preference; +import android.preference.PreferenceActivity; +import android.preference.PreferenceCategory; +import android.preference.PreferenceFragment; +import android.preference.PreferenceManager; +import android.preference.PreferenceScreen; +import android.util.Log; + +import com.cyanogenmod.settings.device.R; + +public class ScreenFragmentActivity extends PreferenceFragment { + + private static final String PREF_ENABLED = "1"; + private static final String TAG = "DisplaySettings_Screen"; + private mDNIeScenario mmDNIeScenario; + private mDNIeMode mmDNIeMode; + private mDNIeNegative mmDNIeNegative; + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + addPreferencesFromResource(R.xml.screen_preferences); + PreferenceScreen preferenceScreen = getPreferenceScreen(); + Resources res = getResources(); + + /* mDNIe */ + mmDNIeScenario = (mDNIeScenario) findPreference(DisplaySettings.KEY_MDNIE_SCENARIO); + mmDNIeScenario.setEnabled(mDNIeScenario.isSupported(res.getString(R.string.mdnie_scenario_sysfs_file))); + + mmDNIeMode = (mDNIeMode) findPreference(DisplaySettings.KEY_MDNIE_MODE); + mmDNIeMode.setEnabled(mDNIeMode.isSupported(res.getString(R.string.mdnie_mode_sysfs_file))); + + mmDNIeNegative = (mDNIeNegative) findPreference(DisplaySettings.KEY_MDNIE_NEGATIVE); + mmDNIeNegative.setEnabled(mDNIeNegative.isSupported(res.getString(R.string.mdnie_negative_sysfs_file))); + + } + + @Override + public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) { + + String key = preference.getKey(); + Log.w(TAG, "key: " + key); + + return true; + } + + public static boolean isSupported(String FILE) { + return Utils.fileExists(FILE); + } + + public static void restore(Context context) { + SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context); + } +} diff --git a/AdvancedDisplay/src/com/cyanogenmod/settings/device/Startup.java b/AdvancedDisplay/src/com/cyanogenmod/settings/device/Startup.java new file mode 100644 index 0000000..2bada88 --- /dev/null +++ b/AdvancedDisplay/src/com/cyanogenmod/settings/device/Startup.java @@ -0,0 +1,32 @@ +/* + * 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.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; + +public class Startup extends BroadcastReceiver { + + @Override + public void onReceive(final Context context, final Intent bootintent) { + mDNIeScenario.restore(context); + mDNIeMode.restore(context); + mDNIeNegative.restore(context); + ScreenFragmentActivity.restore(context); + } +} diff --git a/AdvancedDisplay/src/com/cyanogenmod/settings/device/Utils.java b/AdvancedDisplay/src/com/cyanogenmod/settings/device/Utils.java new file mode 100644 index 0000000..552ece5 --- /dev/null +++ b/AdvancedDisplay/src/com/cyanogenmod/settings/device/Utils.java @@ -0,0 +1,83 @@ +/* + * Copyright (C) 2012 The CyanogenMod Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.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; +import android.app.AlertDialog; +import android.content.DialogInterface; +import android.content.Context; + +public class Utils { + + private static final String TAG = "DeviceSettings_Utils"; + private static final String TAG_READ = "DeviceSettings_Utils_Read"; + private static final String TAG_WRITE = "DeviceSettings_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); + } + } + } + + } + + /** + * 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(); + } + +} diff --git a/AdvancedDisplay/src/com/cyanogenmod/settings/device/mDNIeMode.java b/AdvancedDisplay/src/com/cyanogenmod/settings/device/mDNIeMode.java new file mode 100644 index 0000000..c777d72 --- /dev/null +++ b/AdvancedDisplay/src/com/cyanogenmod/settings/device/mDNIeMode.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.util.AttributeSet; +import android.preference.Preference; +import android.preference.ListPreference; +import android.preference.Preference.OnPreferenceChangeListener; +import android.preference.PreferenceManager; + +public class mDNIeMode extends ListPreference implements OnPreferenceChangeListener { + + private static String FILE = null; + + public mDNIeMode(Context context, AttributeSet attrs) { + super(context, attrs); + this.setOnPreferenceChangeListener(this); + FILE = context.getResources().getString(R.string.mdnie_mode_sysfs_file); + } + + public static boolean isSupported(String filePath) { + return Utils.fileExists(filePath); + } + + /** + * Restore mdnie user mode setting from SharedPreferences. (Write to kernel.) + * @param context The context to read the SharedPreferences from + */ + public static void restore(Context context) { + FILE = context.getResources().getString(R.string.mdnie_mode_sysfs_file); + if (!isSupported(FILE)) { + return; + } + + SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context); + Utils.writeValue(FILE, sharedPrefs.getString(DisplaySettings.KEY_MDNIE_MODE, "0")); + } + + public boolean onPreferenceChange(Preference preference, Object newValue) { + Utils.writeValue(FILE, (String) newValue); + return true; + } + +} diff --git a/AdvancedDisplay/src/com/cyanogenmod/settings/device/mDNIeNegative.java b/AdvancedDisplay/src/com/cyanogenmod/settings/device/mDNIeNegative.java new file mode 100644 index 0000000..bde9946 --- /dev/null +++ b/AdvancedDisplay/src/com/cyanogenmod/settings/device/mDNIeNegative.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 java.io.IOException; +import android.content.Context; +import android.util.AttributeSet; +import android.content.SharedPreferences; +import android.preference.Preference; +import android.preference.ListPreference; +import android.preference.Preference.OnPreferenceChangeListener; +import android.preference.PreferenceManager; + +public class mDNIeNegative extends ListPreference implements OnPreferenceChangeListener { + + private static String FILE = null; + + public mDNIeNegative(Context context, AttributeSet attrs) { + super(context, attrs); + this.setOnPreferenceChangeListener(this); + FILE = context.getResources().getString(R.string.mdnie_negative_sysfs_file); + } + + public static boolean isSupported(String filePath) { + return Utils.fileExists(filePath); + } + + /** + * Restore mdnie user mode setting from SharedPreferences. (Write to kernel.) + * @param context The context to read the SharedPreferences from + */ + public static void restore(Context context) { + FILE = context.getResources().getString(R.string.mdnie_negative_sysfs_file); + if (!isSupported(FILE)) { + return; + } + + SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context); + Utils.writeValue(FILE, sharedPrefs.getString(DisplaySettings.KEY_MDNIE_NEGATIVE, "0")); + } + + public boolean onPreferenceChange(Preference preference, Object newValue) { + Utils.writeValue(FILE, (String) newValue); + return true; + } + +} diff --git a/AdvancedDisplay/src/com/cyanogenmod/settings/device/mDNIeScenario.java b/AdvancedDisplay/src/com/cyanogenmod/settings/device/mDNIeScenario.java new file mode 100644 index 0000000..cbab69d --- /dev/null +++ b/AdvancedDisplay/src/com/cyanogenmod/settings/device/mDNIeScenario.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.util.AttributeSet; +import android.preference.Preference; +import android.preference.ListPreference; +import android.preference.Preference.OnPreferenceChangeListener; +import android.preference.PreferenceManager; + +public class mDNIeScenario extends ListPreference implements OnPreferenceChangeListener { + + private static String FILE = null; + + public mDNIeScenario(Context context, AttributeSet attrs) { + super(context,attrs); + this.setOnPreferenceChangeListener(this); + FILE = context.getResources().getString(R.string.mdnie_scenario_sysfs_file); + } + + public static boolean isSupported(String filePath) { + return Utils.fileExists(filePath); + } + + /** + * Restore mdnie "camera" setting from SharedPreferences. (Write to kernel.) + * @param context The context to read the SharedPreferences from + */ + public static void restore(Context context) { + FILE = context.getResources().getString(R.string.mdnie_scenario_sysfs_file); + if (!isSupported(FILE)) { + return; + } + + SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context); + Utils.writeValue(FILE, sharedPrefs.getString(DisplaySettings.KEY_MDNIE_SCENARIO, "0")); + } + + public boolean onPreferenceChange(Preference preference, Object newValue) { + Utils.writeValue(FILE, (String) newValue); + return true; + } + +} diff --git a/Android.mk b/Android.mk index 171f492..14e2527 100644 --- a/Android.mk +++ b/Android.mk @@ -36,6 +36,7 @@ include $(SAM_ROOT)/wifiloader/Android.mk endif ifeq ($(BOARD_VENDOR),samsung) +include $(SAM_ROOT)/AdvancedDisplay/Android.mk include $(SAM_ROOT)/liblights/Android.mk include $(SAM_ROOT)/modemloader/Android.mk include $(SAM_ROOT)/power/Android.mk diff --git a/exynos4/AdvancedDisplay/Android.mk b/exynos4/AdvancedDisplay/Android.mk deleted file mode 100644 index 1ed8c10..0000000 --- a/exynos4/AdvancedDisplay/Android.mk +++ /dev/null @@ -1,13 +0,0 @@ -LOCAL_PATH:= $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_MODULE_TAGS := optional - -LOCAL_SRC_FILES := $(call all-java-files-under, src) - -LOCAL_PACKAGE_NAME := AdvancedDisplay -LOCAL_CERTIFICATE := platform - -include $(BUILD_PACKAGE) - -include $(call all-makefiles-under,$(LOCAL_PATH)) diff --git a/exynos4/AdvancedDisplay/AndroidManifest.xml b/exynos4/AdvancedDisplay/AndroidManifest.xml deleted file mode 100644 index 96798f3..0000000 --- a/exynos4/AdvancedDisplay/AndroidManifest.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/exynos4/AdvancedDisplay/res/drawable/ic_settings_advanced_display.xml b/exynos4/AdvancedDisplay/res/drawable/ic_settings_advanced_display.xml deleted file mode 100644 index 61cb8dd..0000000 --- a/exynos4/AdvancedDisplay/res/drawable/ic_settings_advanced_display.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - diff --git a/exynos4/AdvancedDisplay/res/layout/framelayout.xml b/exynos4/AdvancedDisplay/res/layout/framelayout.xml deleted file mode 100755 index e2ab9ad..0000000 --- a/exynos4/AdvancedDisplay/res/layout/framelayout.xml +++ /dev/null @@ -1,5 +0,0 @@ - - diff --git a/exynos4/AdvancedDisplay/res/values/arrays.xml b/exynos4/AdvancedDisplay/res/values/arrays.xml deleted file mode 100644 index be9f348..0000000 --- a/exynos4/AdvancedDisplay/res/values/arrays.xml +++ /dev/null @@ -1,65 +0,0 @@ - - - - - CyanogenMod (default) - UI - Video - Video warm - Video cold - Camera - Navigation - Gallery - VT - - - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - - - - Dynamic (default) - Standard - Natural - Movie - - - - 0 - 1 - 2 - 3 - - - - Normal - Inverted - - - - 0 - 1 - - diff --git a/exynos4/AdvancedDisplay/res/values/colors.xml b/exynos4/AdvancedDisplay/res/values/colors.xml deleted file mode 100644 index 2a95ee2..0000000 --- a/exynos4/AdvancedDisplay/res/values/colors.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - #ff263238 - #ff21272b - #ff009688 - diff --git a/exynos4/AdvancedDisplay/res/values/config.xml b/exynos4/AdvancedDisplay/res/values/config.xml deleted file mode 100644 index a26bed0..0000000 --- a/exynos4/AdvancedDisplay/res/values/config.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - "/sys/class/mdnie/mdnie/scenario" - "/sys/class/mdnie/mdnie/mode" - "/sys/class/mdnie/mdnie/negative" - - diff --git a/exynos4/AdvancedDisplay/res/values/dimens.xml b/exynos4/AdvancedDisplay/res/values/dimens.xml deleted file mode 100644 index 62f1899..0000000 --- a/exynos4/AdvancedDisplay/res/values/dimens.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - 72dp - diff --git a/exynos4/AdvancedDisplay/res/values/strings.xml b/exynos4/AdvancedDisplay/res/values/strings.xml deleted file mode 100644 index 6e6d213..0000000 --- a/exynos4/AdvancedDisplay/res/values/strings.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - Advanced display - - - Screen - Colors - - - Scenario - Set the mDNIe scenario - Mode - Set the mDNIe mode - Negative mode - Enable/disable inverted colors - diff --git a/exynos4/AdvancedDisplay/res/values/styles.xml b/exynos4/AdvancedDisplay/res/values/styles.xml deleted file mode 100644 index af83c00..0000000 --- a/exynos4/AdvancedDisplay/res/values/styles.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - diff --git a/exynos4/AdvancedDisplay/res/xml/screen_preferences.xml b/exynos4/AdvancedDisplay/res/xml/screen_preferences.xml deleted file mode 100644 index 56e536c..0000000 --- a/exynos4/AdvancedDisplay/res/xml/screen_preferences.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/exynos4/AdvancedDisplay/src/com/cyanogenmod/settings/device/DisplaySettings.java b/exynos4/AdvancedDisplay/src/com/cyanogenmod/settings/device/DisplaySettings.java deleted file mode 100644 index e5930c8..0000000 --- a/exynos4/AdvancedDisplay/src/com/cyanogenmod/settings/device/DisplaySettings.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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.app.Activity; -import android.app.ActionBar; -import android.app.Activity; -import android.app.Fragment; -import android.app.FragmentTransaction; -import android.content.Context; -import android.os.Bundle; -import android.view.MenuItem; -import android.widget.FrameLayout; - -import com.cyanogenmod.settings.device.R; - -import java.util.ArrayList; - -public class DisplaySettings extends Activity { - - 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_MDNIE_SCENARIO = "mdnie_scenario"; - public static final String KEY_MDNIE_MODE = "mdnie_mode"; - public static final String KEY_MDNIE_NEGATIVE = "mdnie_negative"; - - ScreenFragmentActivity mFragment; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - mFragment = new ScreenFragmentActivity(); - setContentView(R.layout.framelayout); - getFragmentManager().beginTransaction().add(R.id.frameLayout, mFragment).commit(); - - final ActionBar bar = getActionBar(); - bar.setTitle(R.string.app_name); - bar.setDisplayHomeAsUpEnabled(true); - - } - - @Override - protected void onSaveInstanceState(Bundle outState) { - super.onSaveInstanceState(outState); - } - - @Override - public boolean onOptionsItemSelected(MenuItem item) { - switch (item.getItemId()) { - case android.R.id.home: - DisplaySettings.this.onBackPressed(); - default: - return super.onOptionsItemSelected(item); - } - } -} diff --git a/exynos4/AdvancedDisplay/src/com/cyanogenmod/settings/device/ScreenFragmentActivity.java b/exynos4/AdvancedDisplay/src/com/cyanogenmod/settings/device/ScreenFragmentActivity.java deleted file mode 100644 index 7b64a4f..0000000 --- a/exynos4/AdvancedDisplay/src/com/cyanogenmod/settings/device/ScreenFragmentActivity.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * 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.res.Resources; -import android.content.SharedPreferences; -import android.os.Bundle; -import android.preference.CheckBoxPreference; -import android.preference.ListPreference; -import android.preference.Preference; -import android.preference.PreferenceActivity; -import android.preference.PreferenceCategory; -import android.preference.PreferenceFragment; -import android.preference.PreferenceManager; -import android.preference.PreferenceScreen; -import android.util.Log; - -import com.cyanogenmod.settings.device.R; - -public class ScreenFragmentActivity extends PreferenceFragment { - - private static final String PREF_ENABLED = "1"; - private static final String TAG = "DisplaySettings_Screen"; - private mDNIeScenario mmDNIeScenario; - private mDNIeMode mmDNIeMode; - private mDNIeNegative mmDNIeNegative; - - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - addPreferencesFromResource(R.xml.screen_preferences); - PreferenceScreen preferenceScreen = getPreferenceScreen(); - Resources res = getResources(); - - /* mDNIe */ - mmDNIeScenario = (mDNIeScenario) findPreference(DisplaySettings.KEY_MDNIE_SCENARIO); - mmDNIeScenario.setEnabled(mDNIeScenario.isSupported(res.getString(R.string.mdnie_scenario_sysfs_file))); - - mmDNIeMode = (mDNIeMode) findPreference(DisplaySettings.KEY_MDNIE_MODE); - mmDNIeMode.setEnabled(mDNIeMode.isSupported(res.getString(R.string.mdnie_mode_sysfs_file))); - - mmDNIeNegative = (mDNIeNegative) findPreference(DisplaySettings.KEY_MDNIE_NEGATIVE); - mmDNIeNegative.setEnabled(mDNIeNegative.isSupported(res.getString(R.string.mdnie_negative_sysfs_file))); - - } - - @Override - public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) { - - String key = preference.getKey(); - Log.w(TAG, "key: " + key); - - return true; - } - - public static boolean isSupported(String FILE) { - return Utils.fileExists(FILE); - } - - public static void restore(Context context) { - SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context); - } -} diff --git a/exynos4/AdvancedDisplay/src/com/cyanogenmod/settings/device/Startup.java b/exynos4/AdvancedDisplay/src/com/cyanogenmod/settings/device/Startup.java deleted file mode 100644 index 2bada88..0000000 --- a/exynos4/AdvancedDisplay/src/com/cyanogenmod/settings/device/Startup.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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.BroadcastReceiver; -import android.content.Context; -import android.content.Intent; - -public class Startup extends BroadcastReceiver { - - @Override - public void onReceive(final Context context, final Intent bootintent) { - mDNIeScenario.restore(context); - mDNIeMode.restore(context); - mDNIeNegative.restore(context); - ScreenFragmentActivity.restore(context); - } -} diff --git a/exynos4/AdvancedDisplay/src/com/cyanogenmod/settings/device/Utils.java b/exynos4/AdvancedDisplay/src/com/cyanogenmod/settings/device/Utils.java deleted file mode 100644 index 552ece5..0000000 --- a/exynos4/AdvancedDisplay/src/com/cyanogenmod/settings/device/Utils.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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.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; -import android.app.AlertDialog; -import android.content.DialogInterface; -import android.content.Context; - -public class Utils { - - private static final String TAG = "DeviceSettings_Utils"; - private static final String TAG_READ = "DeviceSettings_Utils_Read"; - private static final String TAG_WRITE = "DeviceSettings_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); - } - } - } - - } - - /** - * 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(); - } - -} diff --git a/exynos4/AdvancedDisplay/src/com/cyanogenmod/settings/device/mDNIeMode.java b/exynos4/AdvancedDisplay/src/com/cyanogenmod/settings/device/mDNIeMode.java deleted file mode 100644 index c777d72..0000000 --- a/exynos4/AdvancedDisplay/src/com/cyanogenmod/settings/device/mDNIeMode.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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.util.AttributeSet; -import android.preference.Preference; -import android.preference.ListPreference; -import android.preference.Preference.OnPreferenceChangeListener; -import android.preference.PreferenceManager; - -public class mDNIeMode extends ListPreference implements OnPreferenceChangeListener { - - private static String FILE = null; - - public mDNIeMode(Context context, AttributeSet attrs) { - super(context, attrs); - this.setOnPreferenceChangeListener(this); - FILE = context.getResources().getString(R.string.mdnie_mode_sysfs_file); - } - - public static boolean isSupported(String filePath) { - return Utils.fileExists(filePath); - } - - /** - * Restore mdnie user mode setting from SharedPreferences. (Write to kernel.) - * @param context The context to read the SharedPreferences from - */ - public static void restore(Context context) { - FILE = context.getResources().getString(R.string.mdnie_mode_sysfs_file); - if (!isSupported(FILE)) { - return; - } - - SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context); - Utils.writeValue(FILE, sharedPrefs.getString(DisplaySettings.KEY_MDNIE_MODE, "0")); - } - - public boolean onPreferenceChange(Preference preference, Object newValue) { - Utils.writeValue(FILE, (String) newValue); - return true; - } - -} diff --git a/exynos4/AdvancedDisplay/src/com/cyanogenmod/settings/device/mDNIeNegative.java b/exynos4/AdvancedDisplay/src/com/cyanogenmod/settings/device/mDNIeNegative.java deleted file mode 100644 index bde9946..0000000 --- a/exynos4/AdvancedDisplay/src/com/cyanogenmod/settings/device/mDNIeNegative.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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 java.io.IOException; -import android.content.Context; -import android.util.AttributeSet; -import android.content.SharedPreferences; -import android.preference.Preference; -import android.preference.ListPreference; -import android.preference.Preference.OnPreferenceChangeListener; -import android.preference.PreferenceManager; - -public class mDNIeNegative extends ListPreference implements OnPreferenceChangeListener { - - private static String FILE = null; - - public mDNIeNegative(Context context, AttributeSet attrs) { - super(context, attrs); - this.setOnPreferenceChangeListener(this); - FILE = context.getResources().getString(R.string.mdnie_negative_sysfs_file); - } - - public static boolean isSupported(String filePath) { - return Utils.fileExists(filePath); - } - - /** - * Restore mdnie user mode setting from SharedPreferences. (Write to kernel.) - * @param context The context to read the SharedPreferences from - */ - public static void restore(Context context) { - FILE = context.getResources().getString(R.string.mdnie_negative_sysfs_file); - if (!isSupported(FILE)) { - return; - } - - SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context); - Utils.writeValue(FILE, sharedPrefs.getString(DisplaySettings.KEY_MDNIE_NEGATIVE, "0")); - } - - public boolean onPreferenceChange(Preference preference, Object newValue) { - Utils.writeValue(FILE, (String) newValue); - return true; - } - -} diff --git a/exynos4/AdvancedDisplay/src/com/cyanogenmod/settings/device/mDNIeScenario.java b/exynos4/AdvancedDisplay/src/com/cyanogenmod/settings/device/mDNIeScenario.java deleted file mode 100644 index cbab69d..0000000 --- a/exynos4/AdvancedDisplay/src/com/cyanogenmod/settings/device/mDNIeScenario.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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.util.AttributeSet; -import android.preference.Preference; -import android.preference.ListPreference; -import android.preference.Preference.OnPreferenceChangeListener; -import android.preference.PreferenceManager; - -public class mDNIeScenario extends ListPreference implements OnPreferenceChangeListener { - - private static String FILE = null; - - public mDNIeScenario(Context context, AttributeSet attrs) { - super(context,attrs); - this.setOnPreferenceChangeListener(this); - FILE = context.getResources().getString(R.string.mdnie_scenario_sysfs_file); - } - - public static boolean isSupported(String filePath) { - return Utils.fileExists(filePath); - } - - /** - * Restore mdnie "camera" setting from SharedPreferences. (Write to kernel.) - * @param context The context to read the SharedPreferences from - */ - public static void restore(Context context) { - FILE = context.getResources().getString(R.string.mdnie_scenario_sysfs_file); - if (!isSupported(FILE)) { - return; - } - - SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context); - Utils.writeValue(FILE, sharedPrefs.getString(DisplaySettings.KEY_MDNIE_SCENARIO, "0")); - } - - public boolean onPreferenceChange(Preference preference, Object newValue) { - Utils.writeValue(FILE, (String) newValue); - return true; - } - -}