Merge change 7069 into donut

* changes:
  Make VPN connect even when DNS is not present and other fixes.
This commit is contained in:
Android (Google) Code Review
2009-07-14 01:53:56 -07:00
3 changed files with 14 additions and 6 deletions

View File

@@ -84,6 +84,7 @@ public class AndroidServiceProxy extends ProcessProxy {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
} }
Log.d(mTag, "----- Stop: " + mServiceName);
SystemProperties.set(SVC_STOP_CMD, mServiceName); SystemProperties.set(SVC_STOP_CMD, mServiceName);
} }
@@ -105,7 +106,7 @@ public class AndroidServiceProxy extends ProcessProxy {
@Override @Override
protected void performTask() throws IOException { protected void performTask() throws IOException {
String svc = mServiceName; String svc = mServiceName;
Log.d(mTag, "+++++ Execute: " + svc); Log.d(mTag, "+++++ Start: " + svc);
SystemProperties.set(SVC_START_CMD, svc); SystemProperties.set(SVC_START_CMD, svc);
boolean success = blockUntil(SVC_STATE_RUNNING, WAITING_TIME); boolean success = blockUntil(SVC_STATE_RUNNING, WAITING_TIME);

View File

@@ -299,12 +299,12 @@ abstract class VpnService<E extends VpnProfile> {
private void saveVpnDnsProperties() { private void saveVpnDnsProperties() {
mOriginalDns1 = mOriginalDns2 = ""; mOriginalDns1 = mOriginalDns2 = "";
for (int i = 0; i < 10; i++) { for (int i = 0; i < 5; i++) {
mVpnDns1 = SystemProperties.get(VPN_DNS1); mVpnDns1 = SystemProperties.get(VPN_DNS1);
mVpnDns2 = SystemProperties.get(VPN_DNS2); mVpnDns2 = SystemProperties.get(VPN_DNS2);
if (mOriginalDns1.equals(mVpnDns1)) { if (mOriginalDns1.equals(mVpnDns1)) {
Log.d(TAG, "wait for vpn dns to settle in..." + i); Log.d(TAG, "wait for vpn dns to settle in..." + i);
sleep(500); sleep(200);
} else { } else {
mOriginalDns1 = SystemProperties.get(DNS1); mOriginalDns1 = SystemProperties.get(DNS1);
mOriginalDns2 = SystemProperties.get(DNS2); mOriginalDns2 = SystemProperties.get(DNS2);
@@ -317,7 +317,9 @@ abstract class VpnService<E extends VpnProfile> {
return; return;
} }
} }
Log.e(TAG, "saveVpnDnsProperties(): DNS not updated??"); Log.d(TAG, "saveVpnDnsProperties(): DNS not updated??");
mOriginalDns1 = mVpnDns1 = SystemProperties.get(DNS1);
mOriginalDns2 = mVpnDns2 = SystemProperties.get(DNS2);
} }
private void saveAndSetDomainSuffices() { private void saveAndSetDomainSuffices() {
@@ -374,7 +376,7 @@ abstract class VpnService<E extends VpnProfile> {
private void checkDnsProperties() { private void checkDnsProperties() {
String dns1 = SystemProperties.get(DNS1); String dns1 = SystemProperties.get(DNS1);
if (!mVpnDns1.equals(dns1)) { if (!mVpnDns1.equals(dns1)) {
Log.w(TAG, " @@ !!! dns being overridden"); Log.w(TAG, " dns being overridden by: " + dns1);
onError(); onError();
} }
} }

View File

@@ -26,8 +26,13 @@ package android.net.vpn;
* {@link DISCONNECTING} and then {@link IDLE}. * {@link DISCONNECTING} and then {@link IDLE}.
* {@link CANCELLED} is a state when a VPN connection attempt is aborted, and * {@link CANCELLED} is a state when a VPN connection attempt is aborted, and
* is in transition to {@link IDLE}. * is in transition to {@link IDLE}.
* The {@link UNUSABLE} state indicates that the profile is not in a state for
* connecting due to possibly the integrity of the fields or another profile is
* connecting etc.
* The {@link UNKNOWN} state indicates that the profile state is to be
* determined.
* {@hide} * {@hide}
*/ */
public enum VpnState { public enum VpnState {
CONNECTING, DISCONNECTING, CANCELLED, CONNECTED, IDLE CONNECTING, DISCONNECTING, CANCELLED, CONNECTED, IDLE, UNUSABLE, UNKNOWN
} }