summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings/ApplicationSettings.java
diff options
context:
space:
mode:
authorJoe Onorato <joeo@google.com>2011-04-06 18:26:20 -0700
committerJoe Onorato <joeo@google.com>2011-04-06 18:26:20 -0700
commit4c0c2bea9e813cff0622968a9281e0c715af8349 (patch)
tree26c72c64f64176281a1e86f5c5ac9bfe28802911 /src/com/android/settings/ApplicationSettings.java
parent7c792996722c6b1f50367cd108c789b7ae7e3c7d (diff)
downloadpackages_apps_Settings-4c0c2bea9e813cff0622968a9281e0c715af8349.zip
packages_apps_Settings-4c0c2bea9e813cff0622968a9281e0c715af8349.tar.gz
packages_apps_Settings-4c0c2bea9e813cff0622968a9281e0c715af8349.tar.bz2
advanced settings
Change-Id: Ibc3889e2ab0569f851ec46fe4d1cb1b4920ea5be
Diffstat (limited to 'src/com/android/settings/ApplicationSettings.java')
-rw-r--r--src/com/android/settings/ApplicationSettings.java39
1 files changed, 35 insertions, 4 deletions
diff --git a/src/com/android/settings/ApplicationSettings.java b/src/com/android/settings/ApplicationSettings.java
index da417ec..bb0f66f 100644
--- a/src/com/android/settings/ApplicationSettings.java
+++ b/src/com/android/settings/ApplicationSettings.java
@@ -18,6 +18,7 @@ package com.android.settings;
import android.app.AlertDialog;
import android.content.DialogInterface;
+import android.content.Intent;
import android.content.res.Configuration;
import android.os.Bundle;
import android.preference.CheckBoxPreference;
@@ -26,11 +27,13 @@ import android.preference.Preference;
import android.preference.PreferenceScreen;
import android.preference.Preference.OnPreferenceChangeListener;
import android.provider.Settings;
+import android.util.Log;
public class ApplicationSettings extends SettingsPreferenceFragment implements
DialogInterface.OnClickListener {
private static final String KEY_TOGGLE_INSTALL_APPLICATIONS = "toggle_install_applications";
+ private static final String KEY_TOGGLE_ADVANCED_SETTINGS = "toggle_advanced_settings";
private static final String KEY_APP_INSTALL_LOCATION = "app_install_location";
// App installation location. Default is ask the user.
@@ -43,9 +46,8 @@ public class ApplicationSettings extends SettingsPreferenceFragment implements
private static final String APP_INSTALL_AUTO_ID = "auto";
private CheckBoxPreference mToggleAppInstallation;
-
+ private CheckBoxPreference mToggleAdvancedSettings;
private ListPreference mInstallLocation;
-
private DialogInterface mWarnInstallApps;
@Override
@@ -54,9 +56,19 @@ public class ApplicationSettings extends SettingsPreferenceFragment implements
addPreferencesFromResource(R.xml.application_settings);
- mToggleAppInstallation = (CheckBoxPreference) findPreference(KEY_TOGGLE_INSTALL_APPLICATIONS);
+ mToggleAppInstallation = (CheckBoxPreference)findPreference(
+ KEY_TOGGLE_INSTALL_APPLICATIONS);
mToggleAppInstallation.setChecked(isNonMarketAppsAllowed());
+ mToggleAdvancedSettings = (CheckBoxPreference)findPreference(
+ KEY_TOGGLE_ADVANCED_SETTINGS);
+ mToggleAdvancedSettings.setChecked(isAdvancedSettingsEnabled());
+
+ // not ready for prime time yet
+ if (false) {
+ getPreferenceScreen().removePreference(mInstallLocation);
+ }
+
mInstallLocation = (ListPreference) findPreference(KEY_APP_INSTALL_LOCATION);
// Is app default install location set?
boolean userSetInstLocation = (Settings.System.getInt(getContentResolver(),
@@ -110,6 +122,9 @@ public class ApplicationSettings extends SettingsPreferenceFragment implements
} else {
setNonMarketAppsAllowed(false);
}
+ } else if (preference == mToggleAdvancedSettings) {
+ boolean value = mToggleAdvancedSettings.isChecked();
+ setAdvancedSettingsEnabled(value);
}
return super.onPreferenceTreeClick(preferenceScreen, preference);
@@ -127,7 +142,23 @@ public class ApplicationSettings extends SettingsPreferenceFragment implements
Settings.Secure.putInt(getContentResolver(), Settings.Secure.INSTALL_NON_MARKET_APPS,
enabled ? 1 : 0);
}
-
+
+ private boolean isAdvancedSettingsEnabled() {
+ return Settings.System.getInt(getContentResolver(),
+ Settings.System.ADVANCED_SETTINGS,
+ Settings.System.ADVANCED_SETTINGS_DEFAULT) > 0;
+ }
+
+ private void setAdvancedSettingsEnabled(boolean enabled) {
+ int value = enabled ? 1 : 0;
+ // Change the system setting
+ Settings.Secure.putInt(getContentResolver(), Settings.System.ADVANCED_SETTINGS, value);
+ // TODO: the settings thing should broadcast this for thread safety purposes.
+ Intent intent = new Intent(Intent.ACTION_ADVANCED_SETTINGS_CHANGED);
+ intent.putExtra("state", value);
+ getActivity().sendBroadcast(intent);
+ }
+
private boolean isNonMarketAppsAllowed() {
return Settings.Secure.getInt(getContentResolver(),
Settings.Secure.INSTALL_NON_MARKET_APPS, 0) > 0;