summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xres/values/config.xml5
-rw-r--r--src/com/android/settings/cyanogenmod/BootReceiver.java10
-rw-r--r--src/com/android/settings/cyanogenmod/Processor.java20
3 files changed, 33 insertions, 2 deletions
diff --git a/res/values/config.xml b/res/values/config.xml
index 5ce3b9a..e73a9ad 100755
--- a/res/values/config.xml
+++ b/res/values/config.xml
@@ -42,5 +42,10 @@
<!-- Volume rocker support. Some devices does not have volume rocker. -->
<bool name="has_volume_rocker">true</bool>
+
+ <!-- Processor menu, freq cap files -->
+ <string name="max_cpu_freq_file" translatable="false">/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq</string>
+ <string name="min_cpu_freq_file" translatable="false">/sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq</string>
+
<!-- **** CYANOGENMOD ADDITIONS END **** -->
</resources>
diff --git a/src/com/android/settings/cyanogenmod/BootReceiver.java b/src/com/android/settings/cyanogenmod/BootReceiver.java
index 6916b9d..4311168 100644
--- a/src/com/android/settings/cyanogenmod/BootReceiver.java
+++ b/src/com/android/settings/cyanogenmod/BootReceiver.java
@@ -24,6 +24,7 @@ import android.os.SystemProperties;
import android.preference.PreferenceManager;
import android.util.Log;
+import com.android.settings.R;
import com.android.settings.Utils;
import java.util.Arrays;
@@ -66,6 +67,14 @@ public class BootReceiver extends BroadcastReceiver {
}
}
+ private void initFreqCapFiles(Context ctx)
+ {
+ if (Processor.freqCapFilesInitialized) return;
+ Processor.FREQ_MAX_FILE = ctx.getResources().getString(R.string.max_cpu_freq_file);
+ Processor.FREQ_MIN_FILE = ctx.getResources().getString(R.string.min_cpu_freq_file);
+ Processor.freqCapFilesInitialized = true;
+ }
+
private void configureCPU(Context ctx) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(ctx);
@@ -87,6 +96,7 @@ public class BootReceiver extends BroadcastReceiver {
if (noSettings) {
Log.d(TAG, "No CPU settings saved. Nothing to restore.");
} else {
+ initFreqCapFiles(ctx);
if (availableGovernorsLine != null){
governors = Arrays.asList(availableGovernorsLine.split(" "));
}
diff --git a/src/com/android/settings/cyanogenmod/Processor.java b/src/com/android/settings/cyanogenmod/Processor.java
index ce2c404..6f21e30 100644
--- a/src/com/android/settings/cyanogenmod/Processor.java
+++ b/src/com/android/settings/cyanogenmod/Processor.java
@@ -43,10 +43,12 @@ public class Processor extends SettingsPreferenceFragment implements
public static final String FREQ_MIN_PREF = "pref_cpu_freq_min";
public static final String FREQ_MAX_PREF = "pref_cpu_freq_max";
public static final String FREQ_LIST_FILE = "/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies";
- public static final String FREQ_MAX_FILE = "/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq";
- public static final String FREQ_MIN_FILE = "/sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq";
+ public static String FREQ_MAX_FILE = null;
+ public static String FREQ_MIN_FILE = null;
public static final String SOB_PREF = "pref_cpu_set_on_boot";
+ protected static boolean freqCapFilesInitialized = false;
+
private static final String TAG = "CPUSettings";
private String mGovernorFormat;
@@ -87,10 +89,20 @@ public class Processor extends SettingsPreferenceFragment implements
}
};
+ private void initFreqCapFiles()
+ {
+ if (freqCapFilesInitialized) return;
+ FREQ_MAX_FILE = getString(R.string.max_cpu_freq_file);
+ FREQ_MIN_FILE = getString(R.string.min_cpu_freq_file);
+ freqCapFilesInitialized = true;
+ }
+
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+ initFreqCapFiles();
+
mGovernorFormat = getString(R.string.cpu_governors_summary);
mMinFrequencyFormat = getString(R.string.cpu_min_freq_summary);
mMaxFrequencyFormat = getString(R.string.cpu_max_freq_summary);
@@ -185,6 +197,8 @@ public class Processor extends SettingsPreferenceFragment implements
super.onResume();
+ initFreqCapFiles();
+
if (Utils.fileExists(FREQ_MIN_FILE) && (temp = Utils.fileReadOneLine(FREQ_MIN_FILE)) != null) {
mMinFrequencyPref.setValue(temp);
mMinFrequencyPref.setSummary(String.format(mMinFrequencyFormat, toMHz(temp)));
@@ -211,6 +225,8 @@ public class Processor extends SettingsPreferenceFragment implements
}
public boolean onPreferenceChange(Preference preference, Object newValue) {
+ initFreqCapFiles();
+
String fname = "";
if (newValue != null) {