summaryrefslogtreecommitdiffstats
path: root/AriesParts/src/com/cyanogenmod/settings/device/Hspa.java
diff options
context:
space:
mode:
authorShawn Alty <shawn.alty@gmail.com>2011-12-27 21:22:49 -0600
committerShawn Alty <shawn.alty@gmail.com>2011-12-27 21:22:49 -0600
commitc5a2454a28e87a779873c369053078e7cc81c663 (patch)
treeea2efe4375597a21e66deeca2e014f6dd4a7297d /AriesParts/src/com/cyanogenmod/settings/device/Hspa.java
parent8e76d3645d1d41511e82d4554e49444c51049b22 (diff)
downloaddevice_samsung_aries-common-c5a2454a28e87a779873c369053078e7cc81c663.zip
device_samsung_aries-common-c5a2454a28e87a779873c369053078e7cc81c663.tar.gz
device_samsung_aries-common-c5a2454a28e87a779873c369053078e7cc81c663.tar.bz2
Mass rename of com.cyanogenmod.AriesParts to com.cyanogenmod.settings.device
Needed (possibly?) for "Device Settings" to work.
Diffstat (limited to 'AriesParts/src/com/cyanogenmod/settings/device/Hspa.java')
-rw-r--r--AriesParts/src/com/cyanogenmod/settings/device/Hspa.java48
1 files changed, 48 insertions, 0 deletions
diff --git a/AriesParts/src/com/cyanogenmod/settings/device/Hspa.java b/AriesParts/src/com/cyanogenmod/settings/device/Hspa.java
new file mode 100644
index 0000000..779e733
--- /dev/null
+++ b/AriesParts/src/com/cyanogenmod/settings/device/Hspa.java
@@ -0,0 +1,48 @@
+package com.cyanogenmod.settings.device;
+
+import android.content.Context;
+import android.content.Intent;
+import android.content.SharedPreferences;
+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 Context mCtx;
+
+ public Hspa(Context context) {
+ mCtx = context;
+ }
+
+ public static boolean isSupported() {
+ return Utils.fileExists(APK_FILE);
+ }
+
+ /**
+ * 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(AriesParts.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);
+ }
+}