Merge "Double list in Bluetooth Settings"
diff --git a/res/xml/security_settings_misc.xml b/res/xml/security_settings_misc.xml
index 3a88d0b..9f78820 100644
--- a/res/xml/security_settings_misc.xml
+++ b/res/xml/security_settings_misc.xml
@@ -59,7 +59,7 @@
<Preference android:title="@string/trusted_credentials"
android:summary="@string/trusted_credentials_summary"
android:persistent="false"
- android:fragment="com.android.settings.TrustedCredentials"/>
+ android:fragment="com.android.settings.TrustedCredentialsSettings"/>
<Preference android:title="@string/credentials_install"
android:summary="@string/credentials_install_summary"
diff --git a/res/xml/settings_headers.xml b/res/xml/settings_headers.xml
index 532bf7d..7e80db4 100644
--- a/res/xml/settings_headers.xml
+++ b/res/xml/settings_headers.xml
@@ -42,17 +42,6 @@
android:title="@string/data_usage_summary_title"
android:icon="@drawable/ic_settings_data_usage" />
- <!-- Call settings - this is in the phone process -->
- <header
- android:id="@+id/call_settings"
- android:icon="@drawable/ic_settings_call"
- android:title="@string/call_settings_title">
- <intent
- android:action="android.intent.action.MAIN"
- android:targetPackage="com.android.phone"
- android:targetClass="com.android.phone.CallFeaturesSetting" />
- </header>
-
<!-- Operator hook -->
<header
android:fragment="com.android.settings.WirelessSettings"
diff --git a/src/com/android/settings/Settings.java b/src/com/android/settings/Settings.java
index c63d061..69e6fad 100644
--- a/src/com/android/settings/Settings.java
+++ b/src/com/android/settings/Settings.java
@@ -305,9 +305,6 @@
target.remove(header);
} else if (id == R.id.operator_settings || id == R.id.manufacturer_settings) {
Utils.updateHeaderToSpecificActivityFromMetaDataOrRemove(this, target, header);
- } else if (id == R.id.call_settings) {
- if (!Utils.isVoiceCapable(this))
- target.remove(header);
} else if (id == R.id.wifi_settings) {
// Remove WiFi Settings if WiFi service is not available.
if (!getPackageManager().hasSystemFeature(PackageManager.FEATURE_WIFI)) {
diff --git a/src/com/android/settings/TrustedCredentials.java b/src/com/android/settings/TrustedCredentialsSettings.java
similarity index 98%
rename from src/com/android/settings/TrustedCredentials.java
rename to src/com/android/settings/TrustedCredentialsSettings.java
index 987d2dc..340e93d 100644
--- a/src/com/android/settings/TrustedCredentials.java
+++ b/src/com/android/settings/TrustedCredentialsSettings.java
@@ -46,9 +46,9 @@
import java.util.Set;
import org.apache.harmony.xnet.provider.jsse.TrustedCertificateStore;
-public class TrustedCredentials extends Fragment {
+public class TrustedCredentialsSettings extends Fragment {
- private static final String TAG = "TrustedCredentials";
+ private static final String TAG = "TrustedCredentialsSettings";
private enum Tab {
SYSTEM("system",
diff --git a/src/com/android/settings/vpn2/VpnDialog.java b/src/com/android/settings/vpn2/VpnDialog.java
index b3e417b..92ad362 100644
--- a/src/com/android/settings/vpn2/VpnDialog.java
+++ b/src/com/android/settings/vpn2/VpnDialog.java
@@ -36,15 +36,15 @@
import android.widget.TextView;
class VpnDialog extends AlertDialog implements TextWatcher, OnItemSelectedListener {
- private static final String DUMMY = "\r\r\r\r";
+ private static final String DUMMY = "\r";
private static String getDummy(String secret) {
return secret.isEmpty() ? "" : DUMMY;
}
- private static String getSecret(TextView dummy) {
- String secret = dummy.getText().toString();
- return DUMMY.equals(secret) ? "" : secret;
+ private static String getSecret(String oldSecret, TextView view) {
+ String newSecret = view.getText().toString();
+ return DUMMY.equals(newSecret) ? oldSecret : newSecret;
}
private final KeyStore mKeyStore = KeyStore.getInstance();
@@ -116,7 +116,7 @@
mIpsecSecret.setText(getDummy(mProfile.ipsecSecret));
loadCertificates(mIpsecUserCert, Credentials.USER_CERTIFICATE,
0, mProfile.ipsecUserCert);
- loadCertificates(mIpsecUserCert, Credentials.CA_CERTIFICATE,
+ loadCertificates(mIpsecCaCert, Credentials.CA_CERTIFICATE,
R.string.vpn_no_ca_cert, mProfile.ipsecCaCert);
mSaveLogin.setChecked(mProfile.saveLogin);
@@ -186,7 +186,7 @@
if (parent == mType) {
changeType(position);
}
- getButton(DialogInterface.BUTTON_POSITIVE).setEnabled(validate(false));
+ getButton(DialogInterface.BUTTON_POSITIVE).setEnabled(validate(mEditing));
}
@Override
@@ -252,24 +252,24 @@
private void loadCertificates(Spinner spinner, String prefix, int firstId, String selected) {
Context context = getContext();
String first = (firstId == 0) ? "" : context.getString(firstId);
- String[] certs = mKeyStore.saw(prefix);
+ String[] certificates = mKeyStore.saw(prefix);
- if (certs == null || certs.length == 0) {
- certs = new String[] {first};
+ if (certificates == null || certificates.length == 0) {
+ certificates = new String[] {first};
} else {
- String[] array = new String[certs.length + 1];
+ String[] array = new String[certificates.length + 1];
array[0] = first;
- System.arraycopy(certs, 0, array, 1, certs.length);
- certs = array;
+ System.arraycopy(certificates, 0, array, 1, certificates.length);
+ certificates = array;
}
ArrayAdapter<String> adapter = new ArrayAdapter<String>(
- context, android.R.layout.simple_spinner_item, certs);
+ context, android.R.layout.simple_spinner_item, certificates);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner.setAdapter(adapter);
- for (int i = 1; i < certs.length; ++i) {
- if (certs[i].equals(selected)) {
+ for (int i = 1; i < certificates.length; ++i) {
+ if (certificates[i].equals(selected)) {
spinner.setSelection(i);
break;
}
@@ -287,7 +287,7 @@
profile.type = mType.getSelectedItemPosition();
profile.server = mServer.getText().toString().trim();
profile.username = mUsername.getText().toString();
- profile.password = getSecret(mPassword);
+ profile.password = getSecret(mProfile.password, mPassword);
profile.domains = mDomains.getText().toString().trim();
profile.routes = mRoutes.getText().toString().trim();
@@ -298,14 +298,14 @@
break;
case VpnProfile.TYPE_L2TP_IPSEC_PSK:
- profile.l2tpSecret = getSecret(mL2tpSecret);
+ profile.l2tpSecret = getSecret(mProfile.l2tpSecret, mL2tpSecret);
// fall through
case VpnProfile.TYPE_IPSEC_XAUTH_PSK:
- profile.ipsecSecret = getSecret(mIpsecSecret);
+ profile.ipsecSecret = getSecret(mProfile.ipsecSecret, mIpsecSecret);
break;
case VpnProfile.TYPE_L2TP_IPSEC_RSA:
- profile.l2tpSecret = getSecret(mL2tpSecret);
+ profile.l2tpSecret = getSecret(mProfile.l2tpSecret, mL2tpSecret);
// fall through
case VpnProfile.TYPE_IPSEC_XAUTH_RSA:
if (mIpsecCaCert.getSelectedItemPosition() != 0) {
diff --git a/src/com/android/settings/vpn2/VpnSettings.java b/src/com/android/settings/vpn2/VpnSettings.java
index 6662dd9..56fb983 100644
--- a/src/com/android/settings/vpn2/VpnSettings.java
+++ b/src/com/android/settings/vpn2/VpnSettings.java
@@ -20,9 +20,11 @@
import android.content.Context;
import android.content.DialogInterface;
+import android.net.IConnectivityManager;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
+import android.os.ServiceManager;
import android.preference.Preference;
import android.preference.PreferenceGroup;
import android.security.Credentials;
@@ -57,8 +59,11 @@
private HashMap<String, VpnPreference> mPreferences;
private VpnDialog mDialog;
+
+ private Handler mUpdater;
+
+ // The key of the profile for the current ContextMenu.
private String mSelectedKey;
- private Handler mHandler;
@Override
public void onCreate(Bundle savedState) {
@@ -145,10 +150,10 @@
}
// Start monitoring.
- if (mHandler == null) {
- mHandler = new Handler(this);
+ if (mUpdater == null) {
+ mUpdater = new Handler(this);
}
- mHandler.sendEmptyMessage(0);
+ mUpdater.sendEmptyMessage(0);
// Register for context menu. Hmmm, getListView() is hidden?
registerForContextMenu(getListView());
@@ -194,7 +199,7 @@
// If we are not editing, connect!
if (!mDialog.isEditing()) {
- connect(profile.key);
+ connect(profile);
}
}
}
@@ -274,19 +279,74 @@
@Override
public boolean handleMessage(Message message) {
- mHandler.removeMessages(0);
+ mUpdater.removeMessages(0);
if (isResumed()) {
- mHandler.sendEmptyMessageDelayed(0, 1000);
+ mUpdater.sendEmptyMessageDelayed(0, 1000);
}
return true;
}
- private void connect(String key) {
+ private static IConnectivityManager getService() {
+ return IConnectivityManager.Stub.asInterface(
+ ServiceManager.getService(Context.CONNECTIVITY_SERVICE));
+ }
+
+ private void connect(VpnProfile profile) {
+ String[] racoon = null;
+ switch (profile.type) {
+ case VpnProfile.TYPE_L2TP_IPSEC_PSK:
+ racoon = new String[] {
+ profile.server, "1701", profile.ipsecSecret,
+ };
+ break;
+ case VpnProfile.TYPE_L2TP_IPSEC_RSA:
+ racoon = new String[] {
+ profile.server, "1701",
+ Credentials.USER_PRIVATE_KEY + profile.ipsecUserCert,
+ Credentials.USER_CERTIFICATE + profile.ipsecUserCert,
+ Credentials.CA_CERTIFICATE + profile.ipsecCaCert,
+ };
+ break;
+ case VpnProfile.TYPE_IPSEC_XAUTH_PSK:
+ break;
+ case VpnProfile.TYPE_IPSEC_XAUTH_RSA:
+ break;
+ case VpnProfile.TYPE_IPSEC_HYBRID_RSA:
+ break;
+ }
+
+ String[] mtpd = null;
+ switch (profile.type) {
+ case VpnProfile.TYPE_PPTP:
+ mtpd = new String[] {
+ "pptp", profile.server, "1723",
+ "name", profile.username, "password", profile.password,
+ "linkname", "vpn", "refuse-eap", "nodefaultroute",
+ "usepeerdns", "idle", "1800", "mtu", "1400", "mru", "1400",
+ (profile.mppe ? "+mppe" : "nomppe"),
+ };
+ break;
+ case VpnProfile.TYPE_L2TP_IPSEC_PSK:
+ case VpnProfile.TYPE_L2TP_IPSEC_RSA:
+ mtpd = new String[] {
+ "l2tp", profile.server, "1701", profile.l2tpSecret,
+ "name", profile.username, "password", profile.password,
+ "linkname", "vpn", "refuse-eap", "nodefaultroute",
+ "usepeerdns", "idle", "1800", "mtu", "1400", "mru", "1400",
+ };
+ break;
+ }
+
+ try {
+// getService().doLegacyVpn(racoon, mtpd);
+ } catch (Exception e) {
+ Log.e(TAG, "connect", e);
+ }
}
private void disconnect(String key) {
@@ -331,7 +391,7 @@
@Override
public int compareTo(Preference preference) {
- int result = 1;
+ int result = -1;
if (preference instanceof VpnPreference) {
VpnPreference another = (VpnPreference) preference;