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

Commit 9fd7ac1e authored by Jeff Sharkey's avatar Jeff Sharkey
Browse files

Always-on VPN.

Adds support for always-on VPN profiles. Users pick an always-on VPN
from list of existing VPN profiles, which must use an IP address for
both VPN server and DNS.  Moved "add" operation into action bar.

Bug: 5756357
Change-Id: I4c7ed7f2a3b027be1baf65c08213336a61f3acfe
parent 5e61ba55
Loading
Loading
Loading
Loading
+38 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2012 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.
-->

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content">

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:paddingLeft="16dip"
        android:paddingRight="16dip"
        android:paddingTop="8dip"
        android:paddingBottom="8dip"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:text="@string/vpn_lockdown_summary" />

    <ListView
        android:id="@android:id/list"
        android:layout_width="match_parent"
        android:layout_height="0dip"
        android:layout_weight="1" />

</LinearLayout>

res/menu/vpn.xml

0 → 100644
+27 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2012 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.
-->

<menu xmlns:android="http://schemas.android.com/apk/res/android">
    <item
        android:id="@+id/vpn_create"
        android:title="@string/vpn_create"
        android:icon="@drawable/ic_menu_add"
        android:showAsAction="always" />
    <item
        android:id="@+id/vpn_lockdown"
        android:title="@string/vpn_menu_lockdown"
        android:showAsAction="never" />
</menu>
+9 −0
Original line number Diff line number Diff line
@@ -4034,6 +4034,15 @@
    <string name="vpn_menu_edit">Edit profile</string>
    <!-- Menu item to delete a VPN profile. [CHAR LIMIT=40] -->
    <string name="vpn_menu_delete">Delete profile</string>
    <!-- Menu item to select always-on VPN profile. [CHAR LIMIT=40] -->
    <string name="vpn_menu_lockdown">Always-on VPN</string>

    <!-- Summary describing the always-on VPN feature. [CHAR LIMIT=NONE] -->
    <string name="vpn_lockdown_summary">Select a VPN profile to always remain connected to. Network traffic will only be allowed when connected to this VPN.</string>
    <!-- List item indicating that no always-on VPN is selected. [CHAR LIMIT=64] -->
    <string name="vpn_lockdown_none">None</string>
    <!-- Error indicating that the selected VPN doesn't meet requirements. [CHAR LIMIT=NONE] -->
    <string name="vpn_lockdown_config_error">Always-on VPN requires an IP address for both server and DNS.</string>

    <!-- Toast message when there is no network connection to start VPN. [CHAR LIMIT=100] -->
    <string name="vpn_no_network">There is no network connection. Please try again later.</string>
+0 −4
Original line number Diff line number Diff line
@@ -16,8 +16,4 @@

<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
        android:title="@string/vpn_title">
    <Preference android:key="add_network"
            android:title="@string/vpn_create"
            android:order="1"
            android:persistent="false"/>
</PreferenceScreen>
+3 −1
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import com.android.settings.applications.ManageApplications;
import com.android.settings.bluetooth.BluetoothEnabler;
import com.android.settings.deviceinfo.Memory;
import com.android.settings.fuelgauge.PowerUsageSummary;
import com.android.settings.vpn2.VpnSettings;
import com.android.settings.wifi.WifiEnabler;

import android.accounts.Account;
@@ -361,7 +362,8 @@ public class Settings extends PreferenceActivity
                WirelessSettings.class.getName().equals(fragmentName) ||
                SoundSettings.class.getName().equals(fragmentName) ||
                PrivacySettings.class.getName().equals(fragmentName) ||
                ManageAccountsSettings.class.getName().equals(fragmentName)) {
                ManageAccountsSettings.class.getName().equals(fragmentName) ||
                VpnSettings.class.getName().equals(fragmentName)) {
            intent.putExtra(EXTRA_CLEAR_UI_OPTIONS, true);
        }

Loading