Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3a27b29e authored by Android (Google) Code Review's avatar Android (Google) Code Review
Browse files

Merge change 7069 into donut

* changes:
  Make VPN connect even when DNS is not present and other fixes.
parents 8af55ca4 85646c1d
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -84,6 +84,7 @@ public class AndroidServiceProxy extends ProcessProxy {
                throw new RuntimeException(e);
            }
        }
        Log.d(mTag, "-----  Stop: " + mServiceName);
        SystemProperties.set(SVC_STOP_CMD, mServiceName);
    }

@@ -105,7 +106,7 @@ public class AndroidServiceProxy extends ProcessProxy {
    @Override
    protected void performTask() throws IOException {
        String svc = mServiceName;
        Log.d(mTag, "+++++  Execute: " + svc);
        Log.d(mTag, "+++++  Start: " + svc);
        SystemProperties.set(SVC_START_CMD, svc);

        boolean success = blockUntil(SVC_STATE_RUNNING, WAITING_TIME);
+6 −4
Original line number Diff line number Diff line
@@ -299,12 +299,12 @@ abstract class VpnService<E extends VpnProfile> {

    private void saveVpnDnsProperties() {
        mOriginalDns1 = mOriginalDns2 = "";
        for (int i = 0; i < 10; i++) {
        for (int i = 0; i < 5; i++) {
            mVpnDns1 = SystemProperties.get(VPN_DNS1);
            mVpnDns2 = SystemProperties.get(VPN_DNS2);
            if (mOriginalDns1.equals(mVpnDns1)) {
                Log.d(TAG, "wait for vpn dns to settle in..." + i);
                sleep(500);
                sleep(200);
            } else {
                mOriginalDns1 = SystemProperties.get(DNS1);
                mOriginalDns2 = SystemProperties.get(DNS2);
@@ -317,7 +317,9 @@ abstract class VpnService<E extends VpnProfile> {
                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() {
@@ -374,7 +376,7 @@ abstract class VpnService<E extends VpnProfile> {
    private void checkDnsProperties() {
        String dns1 = SystemProperties.get(DNS1);
        if (!mVpnDns1.equals(dns1)) {
            Log.w(TAG, "   @@ !!!    dns being overridden");
            Log.w(TAG, "   dns being overridden by: " + dns1);
            onError();
        }
    }
+6 −1
Original line number Diff line number Diff line
@@ -26,8 +26,13 @@ package android.net.vpn;
 * {@link DISCONNECTING} and then {@link IDLE}.
 * {@link CANCELLED} is a state when a VPN connection attempt is aborted, and
 * 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}
 */
public enum VpnState {
    CONNECTING, DISCONNECTING, CANCELLED, CONNECTED, IDLE
    CONNECTING, DISCONNECTING, CANCELLED, CONNECTED, IDLE, UNUSABLE, UNKNOWN
}