Merge change 9246
* changes:
2005382 Disable long press on Bluetooth device when BT is off 1930418 Grey BT device when BT is off
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 38813b7..ed37203 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1861,8 +1861,10 @@
<string name="vpn_confirm_edit_profile_cancellation">Are you sure you want to discard the changes made to this profile?</string>
<string name="vpn_confirm_reconnect">Unable to connect to the network. Do you want to try again?</string>
<string name="vpn_unknown_server_dialog_msg">Server name cannot be resolved. Do you want to check your server name setting?</string>
+ <string name="vpn_challenge_error_dialog_msg">Challenge error. Do you want to check your secret setting?</string>
<string name="vpn_secret_not_set_dialog_msg">One or more secrets are missing in this VPN configuration. Do you want to check your secret setting?</string>
<string name="vpn_auth_error_dialog_msg">The username or password you entered is incorrect. Do you want to try again?</string>
+ <string name="vpn_remote_hung_up_error_dialog_msg">Server hung up. The username or password you entered could be incorrect. Do you want to try again?</string>
<!-- VPN type selection activity title -->
<string name="vpn_type_title">Add VPN</string>
@@ -1908,6 +1910,8 @@
<!-- Complete term -->
<string name="vpn_l2tp_secret">L2TP secret</string>
<string name="vpn_a_l2tp_secret">an L2TP secret</string>
+ <string name="vpn_pptp_encryption_title">encryption</string>
+ <string name="vpn_pptp_encryption">PPTP encryption</string>
<!-- Preference title -->
<string name="vpn_ipsec_presharedkey_title">Set IPSec pre-shared key</string>
diff --git a/res/xml/device_info_settings.xml b/res/xml/device_info_settings.xml
index 80370e2..56810b4 100644
--- a/res/xml/device_info_settings.xml
+++ b/res/xml/device_info_settings.xml
@@ -76,12 +76,13 @@
</PreferenceScreen>
<!-- Contributors -->
+ <!--
<PreferenceScreen
android:key="contributors"
android:title="@string/contributors_title">
<intent android:action="android.settings.TEAM" />
</PreferenceScreen>
-
+ -->
<!-- System Tutorial - launches activity -->
<PreferenceScreen android:key="system_tutorial"
android:title="@string/system_tutorial_list_item_title"
diff --git a/src/com/android/settings/vpn/PptpEditor.java b/src/com/android/settings/vpn/PptpEditor.java
new file mode 100644
index 0000000..fafe6a7
--- /dev/null
+++ b/src/com/android/settings/vpn/PptpEditor.java
@@ -0,0 +1,75 @@
+/* * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.vpn;
+
+import com.android.settings.R;
+
+import android.content.Context;
+import android.net.vpn.PptpProfile;
+import android.preference.CheckBoxPreference;
+import android.preference.Preference;
+import android.preference.PreferenceGroup;
+
+/**
+ * The class for editing {@link PptpProfile}.
+ */
+class PptpEditor extends VpnProfileEditor {
+ private CheckBoxPreference mEncryption;
+
+ public PptpEditor(PptpProfile p) {
+ super(p);
+ }
+
+ @Override
+ protected void loadExtraPreferencesTo(PreferenceGroup subpanel) {
+ Context c = subpanel.getContext();
+ subpanel.addPreference(createEncryptionPreference(c));
+
+ PptpProfile profile = (PptpProfile) getProfile();
+ }
+
+ private Preference createEncryptionPreference(Context c) {
+ final PptpProfile profile = (PptpProfile) getProfile();
+ CheckBoxPreference encryption = mEncryption = new CheckBoxPreference(c);
+ boolean enabled = profile.isEncryptionEnabled();
+ setSecretTitle(encryption, R.string.vpn_pptp_encryption_title, enabled);
+ encryption.setChecked(enabled);
+ setEncryptionSummary(encryption, enabled);
+ encryption.setOnPreferenceChangeListener(
+ new Preference.OnPreferenceChangeListener() {
+ public boolean onPreferenceChange(
+ Preference pref, Object newValue) {
+ boolean enabled = (Boolean) newValue;
+ profile.setEncryptionEnabled(enabled);
+ setSecretTitle(mEncryption,
+ R.string.vpn_pptp_encryption_title, enabled);
+ setEncryptionSummary(mEncryption, enabled);
+ return true;
+ }
+ });
+ return encryption;
+ }
+
+ private void setEncryptionSummary(CheckBoxPreference encryption,
+ boolean enabled) {
+ Context c = encryption.getContext();
+ String formatString = c.getString(enabled
+ ? R.string.vpn_is_enabled
+ : R.string.vpn_is_disabled);
+ encryption.setSummary(String.format(
+ formatString, c.getString(R.string.vpn_pptp_encryption)));
+ }
+}
diff --git a/src/com/android/settings/vpn/VpnEditor.java b/src/com/android/settings/vpn/VpnEditor.java
index 162c129..497f4bf 100644
--- a/src/com/android/settings/vpn/VpnEditor.java
+++ b/src/com/android/settings/vpn/VpnEditor.java
@@ -24,6 +24,7 @@
import android.net.vpn.L2tpIpsecProfile;
import android.net.vpn.L2tpIpsecPskProfile;
import android.net.vpn.L2tpProfile;
+import android.net.vpn.PptpProfile;
import android.net.vpn.VpnProfile;
import android.net.vpn.VpnType;
import android.os.Bundle;
@@ -162,6 +163,9 @@
case L2TP:
return new L2tpEditor((L2tpProfile) p);
+ case PPTP:
+ return new PptpEditor((PptpProfile) p);
+
default:
return new VpnProfileEditor(p);
}
diff --git a/src/com/android/settings/vpn/VpnSettings.java b/src/com/android/settings/vpn/VpnSettings.java
index 0dc1719..4dda152 100644
--- a/src/com/android/settings/vpn/VpnSettings.java
+++ b/src/com/android/settings/vpn/VpnSettings.java
@@ -109,6 +109,8 @@
private static final int DIALOG_AUTH_ERROR = 3;
private static final int DIALOG_UNKNOWN_SERVER = 4;
private static final int DIALOG_SECRET_NOT_SET = 5;
+ private static final int DIALOG_CHALLENGE_ERROR = 6;
+ private static final int DIALOG_REMOTE_HUNG_UP_ERROR = 7;
private static final int NO_ERROR = 0;
@@ -204,6 +206,12 @@
case DIALOG_AUTH_ERROR:
return createAuthErrorDialog();
+ case DIALOG_REMOTE_HUNG_UP_ERROR:
+ return createRemoteHungUpErrorDialog();
+
+ case DIALOG_CHALLENGE_ERROR:
+ return createChallengeErrorDialog();
+
case DIALOG_UNKNOWN_SERVER:
return createUnknownServerDialog();
@@ -244,17 +252,22 @@
.setMessage(R.string.vpn_auth_error_dialog_msg)
.create();
}
- private Dialog createUnknownServerDialog() {
+
+ private Dialog createRemoteHungUpErrorDialog() {
return createCommonDialogBuilder()
+ .setMessage(R.string.vpn_remote_hung_up_error_dialog_msg)
+ .create();
+ }
+
+ private Dialog createChallengeErrorDialog() {
+ return createCommonEditDialogBuilder()
+ .setMessage(R.string.vpn_challenge_error_dialog_msg)
+ .create();
+ }
+
+ private Dialog createUnknownServerDialog() {
+ return createCommonEditDialogBuilder()
.setMessage(R.string.vpn_unknown_server_dialog_msg)
- .setPositiveButton(R.string.vpn_yes_button,
- new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int w) {
- VpnProfile p = mConnectingActor.getProfile();
- onIdle();
- startVpnEditor(p);
- }
- })
.create();
}
@@ -271,6 +284,18 @@
.create();
}
+ private AlertDialog.Builder createCommonEditDialogBuilder() {
+ return createCommonDialogBuilder()
+ .setPositiveButton(R.string.vpn_yes_button,
+ new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog, int w) {
+ VpnProfile p = mConnectingActor.getProfile();
+ onIdle();
+ startVpnEditor(p);
+ }
+ });
+ }
+
private AlertDialog.Builder createCommonDialogBuilder() {
return new AlertDialog.Builder(this)
.setTitle(android.R.string.dialog_alert_title)
@@ -723,6 +748,14 @@
showDialog(DIALOG_AUTH_ERROR);
break;
+ case VpnManager.VPN_ERROR_REMOTE_HUNG_UP:
+ showDialog(DIALOG_REMOTE_HUNG_UP_ERROR);
+ break;
+
+ case VpnManager.VPN_ERROR_CHALLENGE:
+ showDialog(DIALOG_CHALLENGE_ERROR);
+ break;
+
case VpnManager.VPN_ERROR_UNKNOWN_SERVER:
showDialog(DIALOG_UNKNOWN_SERVER);
break;
diff --git a/src/com/android/settings/wifi/AccessPointDialog.java b/src/com/android/settings/wifi/AccessPointDialog.java
index 7e516cc..c4984cd 100644
--- a/src/com/android/settings/wifi/AccessPointDialog.java
+++ b/src/com/android/settings/wifi/AccessPointDialog.java
@@ -134,7 +134,7 @@
private Spinner mSecuritySpinner;
private Spinner mWepTypeSpinner;
private CertTool mCertTool;
-
+
public AccessPointDialog(Context context, WifiLayer wifiLayer) {
super(context);
@@ -217,6 +217,14 @@
setTitle(getContext().getString(titleId));
}
+ public void enableEnterpriseFields() {
+ setEnterpriseFieldsVisible(true);
+ updateCertificateSelection();
+ setGenericPasswordVisible(true);
+ // Both WPA and WPA2 show the same caption, so either is ok
+ updatePasswordCaption(AccessPointState.WPA);
+ }
+
/** Called after flags are set, the dialog's layout/etc should be set up here */
private void onLayout() {
final Context context = getContext();
@@ -318,19 +326,26 @@
if (mMode == MODE_CONFIGURE ||
(mState.isEnterprise() && !mState.configured)) {
setEnterpriseFields(view);
- mPhase2Spinner.setSelection(getSelectionIndex(
- R.array.wifi_phase2_entries, mState.getPhase2()));
- mEapSpinner.setSelection(getSelectionIndex(
- R.array.wifi_eap_entries, mState.getEap()));
- mClientCertSpinner.setSelection(getSelectionIndex(
- getAllUserCertificateKeys(), mState.getEnterpriseField(
- AccessPointState.CLIENT_CERT)));
- mCaCertSpinner.setSelection(getSelectionIndex(
- getAllCaCertificateKeys(), mState.getEnterpriseField(
- AccessPointState.CA_CERT)));
+ updateCertificateSelection();
}
}
+ private void updateCertificateSelection() {
+ setSpinnerAdapter(mClientCertSpinner, getAllUserCertificateKeys());
+ setSpinnerAdapter(mCaCertSpinner, getAllCaCertificateKeys());
+
+ mPhase2Spinner.setSelection(getSelectionIndex(
+ R.array.wifi_phase2_entries, mState.getPhase2()));
+ mEapSpinner.setSelection(getSelectionIndex(
+ R.array.wifi_eap_entries, mState.getEap()));
+ mClientCertSpinner.setSelection(getSelectionIndex(
+ getAllUserCertificateKeys(), mState.getEnterpriseField(
+ AccessPointState.CLIENT_CERT)));
+ mCaCertSpinner.setSelection(getSelectionIndex(
+ getAllCaCertificateKeys(), mState.getEnterpriseField(
+ AccessPointState.CA_CERT)));
+ }
+
private String[] getAllCaCertificateKeys() {
return appendEmptyInSelection(mCertTool.getAllCaCertificateKeys());
}
@@ -788,13 +803,9 @@
if (Keystore.getInstance().getState() != Keystore.UNLOCKED) {
getContext().startActivity(new Intent(
SecuritySettings.ACTION_UNLOCK_CREDENTIAL_STORAGE));
- mSecuritySpinner.setSelection(0);
return;
}
- setEnterpriseFieldsVisible(true);
- setGenericPasswordVisible(true);
- // Both WPA and WPA2 show the same caption, so either is ok
- updatePasswordCaption(AccessPointState.WPA);
+ enableEnterpriseFields();
break;
}
}
diff --git a/src/com/android/settings/wifi/WifiSettings.java b/src/com/android/settings/wifi/WifiSettings.java
index d283fb3..adf4519 100644
--- a/src/com/android/settings/wifi/WifiSettings.java
+++ b/src/com/android/settings/wifi/WifiSettings.java
@@ -86,6 +86,9 @@
private Preference mAddOtherNetwork;
private WeakHashMap<AccessPointState, AccessPointPreference> mAps;
+
+ private AccessPointState mResumeState = null;
+ private int mResumeMode;
//============================
// Wifi member variables
@@ -152,8 +155,22 @@
super.onResume();
mWifiLayer.onResume();
mWifiEnabler.resume();
+ // do what we should have after keystore is unlocked.
+ if (mResumeState != null) {
+ if (Keystore.getInstance().getState() == Keystore.UNLOCKED) {
+ showAccessPointDialog(mResumeState, mResumeMode);
+ }
+ mResumeMode = -1;
+ mResumeState = null;
+ } else {
+ if (mResumeMode == AccessPointDialog.MODE_CONFIGURE) {
+ if (Keystore.getInstance().getState() == Keystore.UNLOCKED) {
+ ((AccessPointDialog) mDialog).enableEnterpriseFields();
+ }
+ }
+ }
}
-
+
@Override
protected void onPause() {
super.onPause();
@@ -231,6 +248,7 @@
public void onDismiss(DialogInterface dialog) {
if (dialog == mDialog) {
mDialog = null;
+ mResumeMode = -1;
}
}
@@ -350,6 +368,7 @@
dialog.setMode(AccessPointDialog.MODE_CONFIGURE);
dialog.setTitle(R.string.wifi_add_other_network);
dialog.setAutoSecurityAllowed(false);
+ mResumeMode = AccessPointDialog.MODE_CONFIGURE;
showDialog(dialog);
}
@@ -358,6 +377,8 @@
Keystore.getInstance().getState() != Keystore.UNLOCKED) {
startActivity(new Intent(
SecuritySettings.ACTION_UNLOCK_CREDENTIAL_STORAGE));
+ mResumeState = state;
+ mResumeMode = mode;
return;
}
AccessPointDialog dialog = new AccessPointDialog(this, mWifiLayer);