<string name="quick_launch_no_shortcut">No shortcut</string>
<!-- On the Quick launch settings screen, summary text under the item for each assigned letter. -->
<string name="quick_launch_shortcut">Search + <xliff:g id="shortcut_letter">%1$s</xliff:g></string>
- <!-- On the Quick launch settings screen, title of "Clear shortcut" confirmation dialog. This is reached by longpressing an item for a shortcut letter. This allows the user to clear the assigned applicatino for that shortcut letter. -->
+ <!-- On the Quick launch settings screen, title of "Clear shortcut" confirmation dialog. This is reached by longpressing an item for a shortcut letter. This allows the user to clear the assigned application for that shortcut letter. -->
<string name="quick_launch_clear_dialog_title">Clear</string>
<!-- On the Quick launch settings screen, message in the "Clear shortcut" confirmation dialog. See the title for this dialog for more info. -->
<string name="quick_launch_clear_dialog_message">Your shortcut for <xliff:g id="shortcut_letter">%1$s</xliff:g> (<xliff:g id="application_name">%2$s</xliff:g>) will be cleared.</string>
<string name="allow_mock_location">Allow mock locations</string>
<!-- setting Checkbox summary whether to allow mock locations -->
<string name="allow_mock_location_summary">Allow mock locations</string>
+ <!-- Title of warning dialog about the implications of enabling USB debugging -->
+ <string name="adb_warning_title">Enable USB debugging?</string>
+ <!-- Warning text to user about the implications of enabling USB debugging -->
+ <string name="adb_warning_message">USB debugging is intended for development purposes only. It can be used to copy data between your computer and your device, install applications on your device without notification, and read log data.</string>
<!-- Title for the screen that lets the user choose a gadget to add to the home screen
(or other screens that can host gadgets). Note to translators: we're still determining
package com.android.settings;
+import android.app.AlertDialog;
+import android.content.DialogInterface;
import android.os.BatteryManager;
import android.os.Bundle;
import android.os.SystemProperties;
/*
* Displays preferences for application developers.
*/
-public class DevelopmentSettings extends PreferenceActivity {
+public class DevelopmentSettings extends PreferenceActivity
+ implements DialogInterface.OnClickListener, DialogInterface.OnDismissListener {
private static final String ENABLE_ADB = "enable_adb";
private static final String KEEP_SCREEN_ON = "keep_screen_on";
private CheckBoxPreference mKeepScreenOn;
private CheckBoxPreference mAllowMockLocation;
+ // To track whether Yes was clicked in the adb warning dialog
+ private boolean mOkClicked;
+
@Override
protected void onCreate(Bundle icicle) {
super.onCreate(icicle);
}
if (preference == mEnableAdb) {
- Settings.Secure.putInt(getContentResolver(), Settings.Secure.ADB_ENABLED,
- mEnableAdb.isChecked() ? 1 : 0);
+ if (mEnableAdb.isChecked()) {
+ mOkClicked = false;
+ new AlertDialog.Builder(this).setMessage(
+ getResources().getString(R.string.adb_warning_message))
+ .setTitle(R.string.adb_warning_title)
+ .setIcon(android.R.drawable.ic_dialog_alert)
+ .setPositiveButton(android.R.string.yes, this)
+ .setNegativeButton(android.R.string.no, this)
+ .show()
+ .setOnDismissListener(this);
+ } else {
+ Settings.Secure.putInt(getContentResolver(), Settings.Secure.ADB_ENABLED, 0);
+ }
} else if (preference == mKeepScreenOn) {
Settings.System.putInt(getContentResolver(), Settings.System.STAY_ON_WHILE_PLUGGED_IN,
mKeepScreenOn.isChecked() ?
return false;
}
+
+ public void onClick(DialogInterface dialog, int which) {
+ if (which == DialogInterface.BUTTON_POSITIVE) {
+ mOkClicked = true;
+ Settings.Secure.putInt(getContentResolver(), Settings.Secure.ADB_ENABLED, 1);
+ } else {
+ // Reset the toggle
+ mEnableAdb.setChecked(false);
+ }
+ }
+
+ public void onDismiss(DialogInterface dialog) {
+ // Assuming that onClick gets called first
+ if (!mOkClicked) {
+ mEnableAdb.setChecked(false);
+ }
+ }
}