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

Commit 55567efc authored by Hung-ying Tyan's avatar Hung-ying Tyan
Browse files

First-time check-in of the VPN APIs.

Patch Set 2:
- Fixed style issues raised by cywang.
Patch Set 3:
- Hide everything
- Make VpnProfile parcelable
Patch Set 4:
- Add license notice
parent bac43254
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -152,6 +152,7 @@ LOCAL_SRC_FILES += \
	tts/java/android/tts/ITts.aidl \
	wifi/java/android/net/wifi/IWifiManager.aidl \
	telephony/java/com/android/internal/telephony/IExtendedNetworkService.aidl
	vpn/java/android/net/vpn/IVpnService.aidl \

# FRAMEWORKS_BASE_JAVA_SRC_DIRS comes from build/core/pathmap.mk
LOCAL_AIDL_INCLUDES += $(FRAMEWORKS_BASE_JAVA_SRC_DIRS)
@@ -222,6 +223,7 @@ aidl_files := \
	frameworks/base/telephony/java/android/telephony/ServiceState.aidl \
	frameworks/base/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl \
	frameworks/base/telephony/java/com/android/internal/telephony/ITelephony.aidl
	frameworks/base/vpn/java/android/net/vpn/IVpnService.aidl \

gen := $(TARGET_OUT_COMMON_INTERMEDIATES)/framework.aidl
$(gen): PRIVATE_SRC_FILES := $(aidl_files)
+43 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2007, 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 android.net.vpn;

import android.net.vpn.VpnProfile;

/**
 * Interface to access a VPN service.
 * {@hide}
 */
interface IVpnService {
    /**
     * Sets up the VPN connection.
     * @param profile the profile object
     * @param username the username for authentication
     * @param password the corresponding password for authentication
     */
    boolean connect(in VpnProfile profile, String username, String password);

    /**
     * Tears down the VPN connection.
     */
    void disconnect();

    /**
     * Makes the service broadcast the connectivity state.
     */
    void checkStatus(in VpnProfile profile);
}
+74 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2007, 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 android.net.vpn;

import android.os.Parcel;

/**
 * The profile for L2TP-over-IPSec type of VPN.
 * {@hide}
 */
public class L2tpIpsecProfile extends SingleServerProfile {
    private String mUserCertificate;
    private String mCaCertificate;
    private String mUserkey;

    @Override
    public VpnType getType() {
        return VpnType.L2TP_IPSEC;
    }

    public void setCaCertificate(String name) {
        mCaCertificate = name;
    }

    public String getCaCertificate() {
        return mCaCertificate;
    }

    public void setUserCertificate(String name) {
        mUserCertificate = name;
    }

    public String getUserCertificate() {
        return mUserCertificate;
    }

    public void setUserkey(String name) {
        mUserkey = name;
    }

    public String getUserkey() {
        return mUserkey;
    }

    @Override
    protected void readFromParcel(Parcel in) {
        super.readFromParcel(in);
        mCaCertificate = in.readString();
        mUserCertificate = in.readString();
        mUserkey = in.readString();
    }

    @Override
    public void writeToParcel(Parcel parcel, int flags) {
        super.writeToParcel(parcel, flags);
        parcel.writeString(mCaCertificate);
        parcel.writeString(mUserCertificate);
        parcel.writeString(mUserkey);
    }
}
+28 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2007, 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 android.net.vpn;

/**
 * The profile for L2TP type of VPN.
 * {@hide}
 */
public class L2tpProfile extends SingleServerProfile {
    @Override
    public VpnType getType() {
        return VpnType.L2TP;
    }
}
+47 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2007, 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 android.net.vpn;

import android.os.Parcel;

/**
 * The profile for single-server type of VPN.
 * {@hide}
 */
public abstract class SingleServerProfile extends VpnProfile {
    private String mServerName;

    public void setServerName(String name) {
        mServerName = name;
    }

    public String getServerName() {
        return mServerName;
    }

    @Override
    protected void readFromParcel(Parcel in) {
        super.readFromParcel(in);
        mServerName = in.readString();
    }

    @Override
    public void writeToParcel(Parcel parcel, int flags) {
        super.writeToParcel(parcel, flags);
        parcel.writeString(mServerName);
    }
}
Loading