summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--res/values/strings.xml4
-rw-r--r--res/xml/application_settings.xml7
-rw-r--r--src/com/android/settings/ApplicationSettings.java39
3 files changed, 46 insertions, 4 deletions
diff --git a/res/values/strings.xml b/res/values/strings.xml
index f36c8a2..d42be7c 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -2108,6 +2108,10 @@
from unknown sources. You agree that you are solely responsible for any
damage to your phone or loss of data that may result from using
these applications.</string>
+ <!-- Applications settings screen, setting check box title. If checked, applications show more settings options. -->
+ <string name="advanced_settings">Advanced settings</string>
+ <!-- Applications settings screen, setting check box summary. This is the summary for "Advanced settings" checkbox -->
+ <string name="advanced_settings_summary">Enable more settings options.</string>
<!-- Manage applications, individual application info screen title. For example, if they click on "Browser" in "Manage applications", the title of the next screen will be this -->
<string name="application_info_label">Application info</string>
<!-- Manage applications, individual application info screen, section heading for stuff relating to an app's storage settings. -->
diff --git a/res/xml/application_settings.xml b/res/xml/application_settings.xml
index 4e77a93..3ad1e5d 100644
--- a/res/xml/application_settings.xml
+++ b/res/xml/application_settings.xml
@@ -54,6 +54,13 @@
android:summaryOn="@string/install_unknown_applications"
android:persistent="false" />
+ <CheckBoxPreference
+ android:key="toggle_advanced_settings"
+ android:title="@string/advanced_settings"
+ android:summaryOff="@string/advanced_settings_summary"
+ android:summaryOn="@string/advanced_settings_summary"
+ android:persistent="false" />
+
<ListPreference
android:key="app_install_location"
android:title="@string/app_install_location_title"
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;