summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYvonne Wong <ywong@cyngn.com>2015-09-30 03:33:44 -0700
committerAdnan Begovic <adnan@cyngn.com>2015-10-14 12:40:40 -0700
commitf29f92dcac6ee1eb711c20f6eb40325e61278e8f (patch)
treef74bcd02e51b85eaf3c8e362fcafef6eeb7e6844
parent56ccf8676f86becc19481bb4d395cf77d2e8328f (diff)
downloadpackages_apps_SetupWizard-f29f92dcac6ee1eb711c20f6eb40325e61278e8f.zip
packages_apps_SetupWizard-f29f92dcac6ee1eb711c20f6eb40325e61278e8f.tar.gz
packages_apps_SetupWizard-f29f92dcac6ee1eb711c20f6eb40325e61278e8f.tar.bz2
Switch SetupWizard to use CMSettings for settings unrelated to bootclasspath
Issue-Id: CYNGNOS-831 Change-Id: Iba8ab05f327360332383c6e93f6a0401e57e846e
-rw-r--r--AndroidManifest.xml2
-rw-r--r--src/com/cyanogenmod/setupwizard/cmstats/StatsUtils.java7
-rw-r--r--src/com/cyanogenmod/setupwizard/setup/CyanogenSettingsPage.java19
3 files changed, 17 insertions, 11 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 5052a0f..5821eba 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -49,6 +49,8 @@
<uses-permission android:name="cyanogenmod.permission.LEGALESE" />
<uses-permission android:name="com.cyngn.stats.SEND_ANALYTICS" />
<uses-permission android:name="com.cyanogen.permission.REQUEST_KILL_SWITCH_OP" />
+ <uses-permission android:name="cyanogenmod.permission.WRITE_SETTINGS"/>
+ <uses-permission android:name="cyanogenmod.permission.WRITE_SECURE_SETTINGS"/>
<permission
android:name="cyanogenmod.permission.PROTECTED_APP"
diff --git a/src/com/cyanogenmod/setupwizard/cmstats/StatsUtils.java b/src/com/cyanogenmod/setupwizard/cmstats/StatsUtils.java
index b8c58c1..8be8fad 100644
--- a/src/com/cyanogenmod/setupwizard/cmstats/StatsUtils.java
+++ b/src/com/cyanogenmod/setupwizard/cmstats/StatsUtils.java
@@ -21,14 +21,15 @@ import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
-import android.provider.Settings;
+
+import cyanogenmod.providers.CMSettings;
public class StatsUtils {
private static final String STATS_PACKAGE = "com.cyngn.stats";
public static boolean isStatsCollectionEnabled(Context context) {
- return Settings.Secure.getInt(context.getContentResolver(),
- Settings.Secure.STATS_COLLECTION, 1) != 0;
+ return CMSettings.Secure.getInt(context.getContentResolver(),
+ CMSettings.Secure.STATS_COLLECTION, 1) != 0;
}
public static boolean isStatsPackageInstalled(Context context) {
diff --git a/src/com/cyanogenmod/setupwizard/setup/CyanogenSettingsPage.java b/src/com/cyanogenmod/setupwizard/setup/CyanogenSettingsPage.java
index 89b7438..b117898 100644
--- a/src/com/cyanogenmod/setupwizard/setup/CyanogenSettingsPage.java
+++ b/src/com/cyanogenmod/setupwizard/setup/CyanogenSettingsPage.java
@@ -54,6 +54,8 @@ import com.cyanogenmod.setupwizard.ui.WebViewDialogFragment;
import com.cyanogenmod.setupwizard.util.SetupWizardUtils;
import com.cyanogenmod.setupwizard.util.WhisperPushUtils;
+import cyanogenmod.providers.CMSettings;
+
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesUtil;
@@ -114,18 +116,18 @@ public class CyanogenSettingsPage extends SetupPage {
SharedPreferences.Editor editor = prefs.edit();
if (enabled) {
- int currentBrightness = Settings.Secure.getInt(context.getContentResolver(),
- Settings.Secure.BUTTON_BRIGHTNESS, defaultBrightness);
+ int currentBrightness = CMSettings.Secure.getInt(context.getContentResolver(),
+ CMSettings.Secure.BUTTON_BRIGHTNESS, defaultBrightness);
if (!prefs.contains("pre_navbar_button_backlight")) {
editor.putInt("pre_navbar_button_backlight", currentBrightness);
}
- Settings.Secure.putInt(context.getContentResolver(),
- Settings.Secure.BUTTON_BRIGHTNESS, 0);
+ CMSettings.Secure.putInt(context.getContentResolver(),
+ CMSettings.Secure.BUTTON_BRIGHTNESS, 0);
} else {
int oldBright = prefs.getInt("pre_navbar_button_backlight", -1);
if (oldBright != -1) {
- Settings.Secure.putInt(context.getContentResolver(),
- Settings.Secure.BUTTON_BRIGHTNESS, oldBright);
+ CMSettings.Secure.putInt(context.getContentResolver(),
+ CMSettings.Secure.BUTTON_BRIGHTNESS, oldBright);
editor.remove("pre_navbar_button_backlight");
}
}
@@ -169,8 +171,9 @@ public class CyanogenSettingsPage extends SetupPage {
Bundle privacyData = getData();
if (privacyData != null
&& privacyData.containsKey(KEY_SEND_METRICS)) {
- Settings.Secure.putInt(mContext.getContentResolver(), Settings.Secure.STATS_COLLECTION,
- privacyData.getBoolean(KEY_SEND_METRICS) ? 1 : 0);
+ CMSettings.Secure.putInt(mContext.getContentResolver(),
+ CMSettings.Secure.STATS_COLLECTION, privacyData.getBoolean(KEY_SEND_METRICS)
+ ? 1 : 0);
}
}