diff --git a/packages/VpnServices/res/drawable/vpn_connected.png b/core/res/res/drawable-hdpi/vpn_connected.png
similarity index 100%
rename from packages/VpnServices/res/drawable/vpn_connected.png
rename to core/res/res/drawable-hdpi/vpn_connected.png
diff --git a/packages/VpnServices/res/drawable/vpn_disconnected.png b/core/res/res/drawable-hdpi/vpn_disconnected.png
similarity index 100%
rename from packages/VpnServices/res/drawable/vpn_disconnected.png
rename to core/res/res/drawable-hdpi/vpn_disconnected.png
diff --git a/core/res/res/drawable-ldpi/vpn_connected.png b/core/res/res/drawable-ldpi/vpn_connected.png
new file mode 100644
index 0000000000000..65fc6db787bf0
Binary files /dev/null and b/core/res/res/drawable-ldpi/vpn_connected.png differ
diff --git a/core/res/res/drawable-ldpi/vpn_disconnected.png b/core/res/res/drawable-ldpi/vpn_disconnected.png
new file mode 100644
index 0000000000000..2440c6909ef55
Binary files /dev/null and b/core/res/res/drawable-ldpi/vpn_disconnected.png differ
diff --git a/core/res/res/drawable-mdpi/vpn_connected.png b/core/res/res/drawable-mdpi/vpn_connected.png
new file mode 100644
index 0000000000000..65fc6db787bf0
Binary files /dev/null and b/core/res/res/drawable-mdpi/vpn_connected.png differ
diff --git a/core/res/res/drawable-mdpi/vpn_disconnected.png b/core/res/res/drawable-mdpi/vpn_disconnected.png
new file mode 100644
index 0000000000000..2440c6909ef55
Binary files /dev/null and b/core/res/res/drawable-mdpi/vpn_disconnected.png differ
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index 9a1b42d9b705c..46e45dbf6dc02 100755
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -2677,4 +2677,11 @@
Undo the deletes.
Do nothing for now.
+
+
+ %s VPN connected
+
+ %s VPN disconnected
+
+ Touch to reconnect to a VPN.
diff --git a/packages/VpnServices/Android.mk b/packages/VpnServices/Android.mk
deleted file mode 100644
index 6cdf67438ed8b..0000000000000
--- a/packages/VpnServices/Android.mk
+++ /dev/null
@@ -1,16 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-
-LOCAL_JAVA_LIBRARIES :=
-
-LOCAL_PACKAGE_NAME := VpnServices
-LOCAL_CERTIFICATE := platform
-
-include $(BUILD_PACKAGE)
-
-########################
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/packages/VpnServices/AndroidManifest.xml b/packages/VpnServices/AndroidManifest.xml
deleted file mode 100644
index 6092e302c9bfa..0000000000000
--- a/packages/VpnServices/AndroidManifest.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/packages/VpnServices/MODULE_LICENSE_APACHE2 b/packages/VpnServices/MODULE_LICENSE_APACHE2
deleted file mode 100644
index e69de29bb2d1d..0000000000000
diff --git a/packages/VpnServices/NOTICE b/packages/VpnServices/NOTICE
deleted file mode 100644
index c5b1efa7aac76..0000000000000
--- a/packages/VpnServices/NOTICE
+++ /dev/null
@@ -1,190 +0,0 @@
-
- Copyright (c) 2005-2008, 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.
-
- 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.
-
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
diff --git a/packages/VpnServices/res/values-ar/strings.xml b/packages/VpnServices/res/values-ar/strings.xml
deleted file mode 100644
index 6bac1200a17a0..0000000000000
--- a/packages/VpnServices/res/values-ar/strings.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
- "خدمات الشبكة الظاهرية الخاصة (VPN)"
- "تم توصيل الشبكة الظاهرية الخاصة (VPN) لـ %s"
- "تم فصل الشبكة الظاهرية الخاصة (VPN) لـ %s"
- "يمكنك اللمس لإعادة الاتصال بالشبكة الظاهرية الخاصة (VPN)."
-
diff --git a/packages/VpnServices/res/values-bg/strings.xml b/packages/VpnServices/res/values-bg/strings.xml
deleted file mode 100644
index fdcbf640f4dd7..0000000000000
--- a/packages/VpnServices/res/values-bg/strings.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
- "VPN услуги"
- "Връзката с VPN %s бе установена"
- "Връзката с VPN %s бе прекъсната"
- "Докоснете за повторно свързване с VPN."
-
diff --git a/packages/VpnServices/res/values-ca/strings.xml b/packages/VpnServices/res/values-ca/strings.xml
deleted file mode 100644
index b37790ab55cc1..0000000000000
--- a/packages/VpnServices/res/values-ca/strings.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
- "Serveis VPN"
- "VPN %s connectada"
- "VPN %s desconnectada"
- "Toqueu-ho per tornar-vos a connectar a una VPN."
-
diff --git a/packages/VpnServices/res/values-cs/strings.xml b/packages/VpnServices/res/values-cs/strings.xml
deleted file mode 100644
index 96d4cc5362c49..0000000000000
--- a/packages/VpnServices/res/values-cs/strings.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
- "Služby VPN"
- "Síť VPN %s je připojena"
- "Síť VPN %s odpojena"
- "Dotykem se znovu připojíte k síti VPN."
-
diff --git a/packages/VpnServices/res/values-da/strings.xml b/packages/VpnServices/res/values-da/strings.xml
deleted file mode 100644
index 0f05bbc469383..0000000000000
--- a/packages/VpnServices/res/values-da/strings.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
- "VPN-tjenester"
- "%s VPN forbundet"
- "%s VPN afbrudt"
- "Tryk for at oprette forbindelse til et VPN igen."
-
diff --git a/packages/VpnServices/res/values-de/strings.xml b/packages/VpnServices/res/values-de/strings.xml
deleted file mode 100644
index b907be8b579f7..0000000000000
--- a/packages/VpnServices/res/values-de/strings.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
- "VPN-Dienste"
- "%s mit VPN verbunden"
- "%s von VPN getrennt"
- "Zur Wiederherstellung der Verbindung mit einem VPN berühren"
-
diff --git a/packages/VpnServices/res/values-el/strings.xml b/packages/VpnServices/res/values-el/strings.xml
deleted file mode 100644
index d96f3e015a042..0000000000000
--- a/packages/VpnServices/res/values-el/strings.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
- "Υπηρεσίες VPN"
- "Το VPN %s συνδέθηκε"
- "Το VPN %s αποσυνδέθηκε"
- "Πατήστε για να επανασυνδεθείτε σε ένα VPN."
-
diff --git a/packages/VpnServices/res/values-en-rGB/strings.xml b/packages/VpnServices/res/values-en-rGB/strings.xml
deleted file mode 100644
index 905c2652be5d9..0000000000000
--- a/packages/VpnServices/res/values-en-rGB/strings.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
- "VPN Services"
- "%s VPN connected"
- "%s VPN disconnected"
- "Touch to reconnect to a VPN."
-
diff --git a/packages/VpnServices/res/values-es-rUS/strings.xml b/packages/VpnServices/res/values-es-rUS/strings.xml
deleted file mode 100644
index 8f5053c15cf00..0000000000000
--- a/packages/VpnServices/res/values-es-rUS/strings.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
- "Servicios VPN"
- "%s VPN conectados"
- "%s VPN desconectada"
- "Tocar para volver a conectarse a una VPN."
-
diff --git a/packages/VpnServices/res/values-es/strings.xml b/packages/VpnServices/res/values-es/strings.xml
deleted file mode 100644
index 91824599a9583..0000000000000
--- a/packages/VpnServices/res/values-es/strings.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
- "Servicios VPN"
- "VPN %s conectada"
- "VPN %s desconectada"
- "Toca para volver a conectarte a una red VPN."
-
diff --git a/packages/VpnServices/res/values-fa/strings.xml b/packages/VpnServices/res/values-fa/strings.xml
deleted file mode 100644
index 7cee16d2fedfa..0000000000000
--- a/packages/VpnServices/res/values-fa/strings.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
- "سرویس های VPN"
- "%s VPN وصل شد"
- "%s VPN قطع شد"
- "برای اتصال مجدد به VPN لمس کنید."
-
diff --git a/packages/VpnServices/res/values-fi/strings.xml b/packages/VpnServices/res/values-fi/strings.xml
deleted file mode 100644
index b15202aae76cf..0000000000000
--- a/packages/VpnServices/res/values-fi/strings.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
- "VPN-palvelut"
- "%s: VPN-yhteys muodostettu"
- "%s: VPN-yhteys katkaistu"
- "Yhdistä VPN-verkkoon uudelleen koskettamalla."
-
diff --git a/packages/VpnServices/res/values-fr/strings.xml b/packages/VpnServices/res/values-fr/strings.xml
deleted file mode 100644
index 4a93e0ad7863c..0000000000000
--- a/packages/VpnServices/res/values-fr/strings.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
- "Services VPN"
- "VPN %s connecté"
- "VPN %s déconnecté"
- "Touchez l\'écran pour vous reconnecter à un VPN."
-
diff --git a/packages/VpnServices/res/values-hr/strings.xml b/packages/VpnServices/res/values-hr/strings.xml
deleted file mode 100644
index aedb536adf4d4..0000000000000
--- a/packages/VpnServices/res/values-hr/strings.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
- "VPN usluge"
- "%s VPN priključen"
- "%s VPN je isključen"
- "Dotaknite za ponovno povezivanje s VPN-om."
-
diff --git a/packages/VpnServices/res/values-hu/strings.xml b/packages/VpnServices/res/values-hu/strings.xml
deleted file mode 100644
index 44f542782a7e6..0000000000000
--- a/packages/VpnServices/res/values-hu/strings.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
- "VPN-szolgáltatások"
- "Kapcsolódva a(z) %s virtuális magánhálózathoz"
- "Kapcsolat bontva a(z) %s virtuális magánhálózattal"
- "Érintse meg az újracsatlakozáshoz."
-
diff --git a/packages/VpnServices/res/values-in/strings.xml b/packages/VpnServices/res/values-in/strings.xml
deleted file mode 100644
index 8b6b4c24663ae..0000000000000
--- a/packages/VpnServices/res/values-in/strings.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
- "Layanan VPN"
- "VPN %s terhubung"
- "VPN %s terputus"
- "Sentuh untuk terhubung kembali ke suatu VPN."
-
diff --git a/packages/VpnServices/res/values-it/strings.xml b/packages/VpnServices/res/values-it/strings.xml
deleted file mode 100644
index 1c7a5889a30b9..0000000000000
--- a/packages/VpnServices/res/values-it/strings.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
- "Servizi VPN"
- "VPN %s collegata"
- "VPN %s scollegata"
- "Tocca per riconnetterti a una rete VPN."
-
diff --git a/packages/VpnServices/res/values-iw/strings.xml b/packages/VpnServices/res/values-iw/strings.xml
deleted file mode 100644
index 74971d6d99cc1..0000000000000
--- a/packages/VpnServices/res/values-iw/strings.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
- "שירותי VPN"
- "VPN של %s מחובר"
- "VPN של %s נותק"
- "גע כדי להתחבר שוב ל-VPN."
-
diff --git a/packages/VpnServices/res/values-ja/strings.xml b/packages/VpnServices/res/values-ja/strings.xml
deleted file mode 100644
index 548d8a987e06e..0000000000000
--- a/packages/VpnServices/res/values-ja/strings.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
- "VPNサービス"
- "%s VPNが接続されました"
- "%s VPNが切断されました"
- "タップしてVPNに再接続してください。"
-
diff --git a/packages/VpnServices/res/values-ko/strings.xml b/packages/VpnServices/res/values-ko/strings.xml
deleted file mode 100644
index 4185291eb7ef1..0000000000000
--- a/packages/VpnServices/res/values-ko/strings.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
- "VPN 서비스"
- "%s VPN 연결됨"
- "%s VPN 연결 끊김"
- "VPN에 다시 연결하려면 터치하세요."
-
diff --git a/packages/VpnServices/res/values-lt/strings.xml b/packages/VpnServices/res/values-lt/strings.xml
deleted file mode 100644
index 58f1f58c0c93e..0000000000000
--- a/packages/VpnServices/res/values-lt/strings.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
- "VPT paslaugos"
- "%s VPT prijungtas"
- "%s VPT atjungtas"
- "Palieskite, kad būtų iš naujo sujungta su VPT."
-
diff --git a/packages/VpnServices/res/values-lv/strings.xml b/packages/VpnServices/res/values-lv/strings.xml
deleted file mode 100644
index cb80908c4b99e..0000000000000
--- a/packages/VpnServices/res/values-lv/strings.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
- "VPN pakalpojumi"
- "%s VPN ir savienots"
- "%s VPN ir atvienots"
- "Pieskarieties, lai atkārtoti izveidotu savienojumu ar VPN."
-
diff --git a/packages/VpnServices/res/values-nb/strings.xml b/packages/VpnServices/res/values-nb/strings.xml
deleted file mode 100644
index 4790600eba12f..0000000000000
--- a/packages/VpnServices/res/values-nb/strings.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
- "VPN-tjenester"
- "Koblet til VPNet %s"
- "Koblet fra VPNet %s"
- "Trykk for å koble til et VPN på nytt"
-
diff --git a/packages/VpnServices/res/values-nl/strings.xml b/packages/VpnServices/res/values-nl/strings.xml
deleted file mode 100644
index 175c7ddc324f0..0000000000000
--- a/packages/VpnServices/res/values-nl/strings.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
- "VPN-services"
- "%s verbonden via VPN"
- "VPN-verbinding met %s verbroken"
- "Raak aan om opnieuw verbinding te maken met een VPN."
-
diff --git a/packages/VpnServices/res/values-pl/strings.xml b/packages/VpnServices/res/values-pl/strings.xml
deleted file mode 100644
index 565d2497eabbf..0000000000000
--- a/packages/VpnServices/res/values-pl/strings.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
- "Usługi VPN"
- "Połączono z siecią VPN %s"
- "Rozłączono z siecią VPN %s"
- "Dotknij, aby ponownie połączyć się z siecią VPN."
-
diff --git a/packages/VpnServices/res/values-pt-rPT/strings.xml b/packages/VpnServices/res/values-pt-rPT/strings.xml
deleted file mode 100644
index 020188f3ed3d9..0000000000000
--- a/packages/VpnServices/res/values-pt-rPT/strings.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
- "Serviços VPN"
- "VPN %s ligado"
- "VPN %s desligado"
- "Toque para voltar a ligar a uma VPN."
-
diff --git a/packages/VpnServices/res/values-pt/strings.xml b/packages/VpnServices/res/values-pt/strings.xml
deleted file mode 100644
index f47652ac580bf..0000000000000
--- a/packages/VpnServices/res/values-pt/strings.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
- "Serviços de VPN"
- "VPN de %s conectada"
- "VPN de %s desconectada"
- "Toque para reconectar-se a uma VPN."
-
diff --git a/packages/VpnServices/res/values-rm/strings.xml b/packages/VpnServices/res/values-rm/strings.xml
deleted file mode 100644
index 80f281709be3d..0000000000000
--- a/packages/VpnServices/res/values-rm/strings.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
- "Servetschs VPN"
- "VPN %s connectà"
- "VPN %s deconnectà"
- "Tutgar per reconnectar ad in VPN."
-
diff --git a/packages/VpnServices/res/values-ro/strings.xml b/packages/VpnServices/res/values-ro/strings.xml
deleted file mode 100644
index a22792cb26044..0000000000000
--- a/packages/VpnServices/res/values-ro/strings.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
- "Servicii VPN"
- "VPN %s conectat"
- "VPN %s deconectat"
- "Atingeţi pentru a vă reconecta la o reţea VPN."
-
diff --git a/packages/VpnServices/res/values-ru/strings.xml b/packages/VpnServices/res/values-ru/strings.xml
deleted file mode 100644
index 8a839c3071127..0000000000000
--- a/packages/VpnServices/res/values-ru/strings.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
- "Службы VPN"
- "Сеть VPN (%s) подключена"
- "Сеть VPN (%s) отключена"
- "Нажмите, чтобы повторно подключиться к VPN."
-
diff --git a/packages/VpnServices/res/values-sk/strings.xml b/packages/VpnServices/res/values-sk/strings.xml
deleted file mode 100644
index 167b6f389e44a..0000000000000
--- a/packages/VpnServices/res/values-sk/strings.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
- "Služby VPN"
- "Sieť VPN %s je pripojená"
- "Sieť VPN %s odpojená"
- "Dotykom sa znova pripojíte k sieti VPN."
-
diff --git a/packages/VpnServices/res/values-sl/strings.xml b/packages/VpnServices/res/values-sl/strings.xml
deleted file mode 100644
index c5b72c4459e08..0000000000000
--- a/packages/VpnServices/res/values-sl/strings.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
- "Storitve VPN"
- "VPN profila %s je povezan"
- "VPN profila %s je izklopljen"
- "Dotaknite se, če želite preklopiti v navidezno zasebno omrežje."
-
diff --git a/packages/VpnServices/res/values-sr/strings.xml b/packages/VpnServices/res/values-sr/strings.xml
deleted file mode 100644
index bfe6cc88fc8a3..0000000000000
--- a/packages/VpnServices/res/values-sr/strings.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
- "VPN услуге"
- "%s VPN веза је успостављена"
- "%s VPN веза је прекинута"
- "Додирните да бисте се поново повезали са VPN-ом."
-
diff --git a/packages/VpnServices/res/values-sv/strings.xml b/packages/VpnServices/res/values-sv/strings.xml
deleted file mode 100644
index 24f9f58323e34..0000000000000
--- a/packages/VpnServices/res/values-sv/strings.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
- "VPN-tjänster"
- "%s VPN anslutet"
- "%s VPN frånkopplat"
- "Tryck här om du vill återansluta till ett VPN."
-
diff --git a/packages/VpnServices/res/values-th/strings.xml b/packages/VpnServices/res/values-th/strings.xml
deleted file mode 100644
index 3aa9c6ea88920..0000000000000
--- a/packages/VpnServices/res/values-th/strings.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
- "บริการ VPN"
- "%s เชื่อมต่อ VPN แล้ว"
- "%s ตัดการเชื่อมต่อ VPN แล้ว"
- "แตะเพื่อเชื่อมต่อกับ VPN อีกครั้ง"
-
diff --git a/packages/VpnServices/res/values-tl/strings.xml b/packages/VpnServices/res/values-tl/strings.xml
deleted file mode 100644
index bd988a1c3d1cf..0000000000000
--- a/packages/VpnServices/res/values-tl/strings.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
- "Mga serbisyo ng VPN"
- "Hindi konektado ang %s VPN"
- "Hindi konektado ang %s VPN"
- "Galawin upang muling kumonekta sa VPN."
-
diff --git a/packages/VpnServices/res/values-tr/strings.xml b/packages/VpnServices/res/values-tr/strings.xml
deleted file mode 100644
index 8666b35a7e37f..0000000000000
--- a/packages/VpnServices/res/values-tr/strings.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
- "VPN Hizmetleri"
- "%s VPN bağlandı"
- "%s VPN bağlantısı kesildi"
- "Bir VPN\'ye tekrar bağlanmak için dokunun."
-
diff --git a/packages/VpnServices/res/values-uk/strings.xml b/packages/VpnServices/res/values-uk/strings.xml
deleted file mode 100644
index 208659a40cb49..0000000000000
--- a/packages/VpnServices/res/values-uk/strings.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
- "Служби VPN"
- "%s підключ. ч-з VPN"
- "VPN %s роз\'єднано"
- "Натисн. для повт. з\'єдн. з VPN."
-
diff --git a/packages/VpnServices/res/values-vi/strings.xml b/packages/VpnServices/res/values-vi/strings.xml
deleted file mode 100644
index 3022c9c02494f..0000000000000
--- a/packages/VpnServices/res/values-vi/strings.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
- "Dịch vụ VPN"
- "Đã kết nối VPN %s"
- "Đã ngắt kết nối VPN %s"
- "Chạm để kết nối lại với VPN."
-
diff --git a/packages/VpnServices/res/values-zh-rCN/strings.xml b/packages/VpnServices/res/values-zh-rCN/strings.xml
deleted file mode 100644
index cad08e15366a9..0000000000000
--- a/packages/VpnServices/res/values-zh-rCN/strings.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
- "虚拟专用网服务"
- "VPN“%s”已连接"
- "VPN“%s”连接已断开"
- "轻触可重新连接到虚拟专用网。"
-
diff --git a/packages/VpnServices/res/values-zh-rTW/strings.xml b/packages/VpnServices/res/values-zh-rTW/strings.xml
deleted file mode 100644
index ee5a42b51c989..0000000000000
--- a/packages/VpnServices/res/values-zh-rTW/strings.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
- "VPN 服務"
- "%s VPN 已連線"
- "%s VPN 已中斷連線"
- "輕觸即可重新連線至 VPN。"
-
diff --git a/packages/VpnServices/res/values/strings.xml b/packages/VpnServices/res/values/strings.xml
deleted file mode 100755
index d82f52a69d45d..0000000000000
--- a/packages/VpnServices/res/values/strings.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
- VPN Services
-
- %s VPN connected
- %s VPN disconnected
- Touch to reconnect to a VPN.
-
-
diff --git a/packages/VpnServices/src/com/android/server/vpn/VpnServiceBinder.java b/packages/VpnServices/src/com/android/server/vpn/VpnServiceBinder.java
deleted file mode 100644
index eeafd5a1639cc..0000000000000
--- a/packages/VpnServices/src/com/android/server/vpn/VpnServiceBinder.java
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- * Copyright (C) 2009, 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 com.android.server.vpn;
-
-import android.app.Service;
-import android.content.Intent;
-import android.net.vpn.IVpnService;
-import android.net.vpn.L2tpIpsecProfile;
-import android.net.vpn.L2tpIpsecPskProfile;
-import android.net.vpn.L2tpProfile;
-import android.net.vpn.PptpProfile;
-import android.net.vpn.VpnManager;
-import android.net.vpn.VpnProfile;
-import android.net.vpn.VpnState;
-import android.os.Environment;
-import android.os.IBinder;
-import android.os.SystemProperties;
-import android.util.Log;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-
-/**
- * The service class for managing a VPN connection. It implements the
- * {@link IVpnService} binder interface.
- */
-public class VpnServiceBinder extends Service {
- private static final String TAG = VpnServiceBinder.class.getSimpleName();
- private static final boolean DBG = true;
-
- private static final String STATES_FILE_RELATIVE_PATH = "/misc/vpn/.states";
-
- // The actual implementation is delegated to the VpnService class.
- private VpnService extends VpnProfile> mService;
-
- // TODO(oam): Test VPN when EFS is enabled (will do later)...
- private static String getStateFilePath() {
- // This call will return the correcu directory whether Encrypted FS is enabled or not
- // Disabled: /data/misc/vpn/.states Enabled: /data/secure/misc/vpn/.states
- return Environment.getSecureDataDirectory().getPath() + STATES_FILE_RELATIVE_PATH;
- }
-
- private final IBinder mBinder = new IVpnService.Stub() {
- public boolean connect(VpnProfile p, String username, String password) {
- return VpnServiceBinder.this.connect(p, username, password);
- }
-
- public void disconnect() {
- VpnServiceBinder.this.disconnect();
- }
-
- public void checkStatus(VpnProfile p) {
- VpnServiceBinder.this.checkStatus(p);
- }
- };
-
- @Override
- public void onCreate() {
- super.onCreate();
- checkSavedStates();
- }
-
-
- @Override
- public void onStart(Intent intent, int startId) {
- super.onStart(intent, startId);
- }
-
- @Override
- public IBinder onBind(Intent intent) {
- return mBinder;
- }
-
- void saveStates() throws IOException {
- if (DBG) Log.d("VpnServiceBinder", " saving states");
- ObjectOutputStream oos =
- new ObjectOutputStream(new FileOutputStream(getStateFilePath()));
- oos.writeObject(mService);
- oos.close();
- }
-
- void removeStates() {
- try {
- File f = new File(getStateFilePath());
- if (f.exists()) f.delete();
- } catch (Throwable e) {
- if (DBG) Log.d("VpnServiceBinder", " remove states: " + e);
- }
- }
-
- private synchronized boolean connect(final VpnProfile p,
- final String username, final String password) {
- if (mService != null) return false;
- final VpnService s = mService = createService(p);
-
- new Thread(new Runnable() {
- public void run() {
- s.onConnect(username, password);
- }
- }).start();
- return true;
- }
-
- private synchronized void disconnect() {
- if (mService == null) return;
- final VpnService s = mService;
-
- new Thread(new Runnable() {
- public void run() {
- s.onDisconnect();
- }
- }).start();
- }
-
- private synchronized void checkStatus(VpnProfile p) {
- if ((mService == null)
- || (!p.getName().equals(mService.mProfile.getName()))) {
- broadcastConnectivity(p.getName(), VpnState.IDLE);
- } else {
- broadcastConnectivity(p.getName(), mService.getState());
- }
- }
-
- private void checkSavedStates() {
- try {
- ObjectInputStream ois = new ObjectInputStream(new FileInputStream(
- getStateFilePath()));
- mService = (VpnService extends VpnProfile>) ois.readObject();
- mService.recover(this);
- ois.close();
- } catch (FileNotFoundException e) {
- // do nothing
- } catch (Throwable e) {
- Log.i("VpnServiceBinder", "recovery error, remove states: " + e);
- removeStates();
- }
- }
-
- private VpnService extends VpnProfile> createService(VpnProfile p) {
- switch (p.getType()) {
- case L2TP:
- L2tpService l2tp = new L2tpService();
- l2tp.setContext(this, (L2tpProfile) p);
- return l2tp;
-
- case PPTP:
- PptpService pptp = new PptpService();
- pptp.setContext(this, (PptpProfile) p);
- return pptp;
-
- case L2TP_IPSEC_PSK:
- L2tpIpsecPskService psk = new L2tpIpsecPskService();
- psk.setContext(this, (L2tpIpsecPskProfile) p);
- return psk;
-
- case L2TP_IPSEC:
- L2tpIpsecService l2tpIpsec = new L2tpIpsecService();
- l2tpIpsec.setContext(this, (L2tpIpsecProfile) p);
- return l2tpIpsec;
-
- default:
- return null;
- }
- }
-
- private void broadcastConnectivity(String name, VpnState s) {
- new VpnManager(this).broadcastConnectivity(name, s);
- }
-}
diff --git a/services/java/com/android/server/ConnectivityService.java b/services/java/com/android/server/ConnectivityService.java
index d0df6cfe7512e..f98b7e94d7eac 100644
--- a/services/java/com/android/server/ConnectivityService.java
+++ b/services/java/com/android/server/ConnectivityService.java
@@ -32,6 +32,7 @@ import android.net.NetworkStateTracker;
import android.net.NetworkUtils;
import android.net.Proxy;
import android.net.ProxyProperties;
+import android.net.vpn.VpnManager;
import android.net.wifi.WifiStateTracker;
import android.os.Binder;
import android.os.Handler;
@@ -442,6 +443,8 @@ public class ConnectivityService extends IConnectivityManager.Stub {
mSettingsObserver.observe(mContext);
loadGlobalProxy();
+
+ VpnManager.startVpnService(context);
}
diff --git a/vpn/java/android/net/vpn/IVpnService.aidl b/vpn/java/android/net/vpn/IVpnService.aidl
index fedccb0d8795a..6bf3eddee5513 100644
--- a/vpn/java/android/net/vpn/IVpnService.aidl
+++ b/vpn/java/android/net/vpn/IVpnService.aidl
@@ -24,10 +24,11 @@ import android.net.vpn.VpnProfile;
*/
interface IVpnService {
/**
- * Sets up the VPN connection.
+ * Sets up a VPN connection.
* @param profile the profile object
* @param username the username for authentication
* @param password the corresponding password for authentication
+ * @return true if VPN is successfully connected
*/
boolean connect(in VpnProfile profile, String username, String password);
@@ -37,7 +38,13 @@ interface IVpnService {
void disconnect();
/**
- * Makes the service broadcast the connectivity state.
+ * Gets the the current connection state.
*/
- void checkStatus(in VpnProfile profile);
+ String getState(in VpnProfile profile);
+
+ /**
+ * Returns the idle state.
+ * @return true if the system is not connecting/connected to a VPN
+ */
+ boolean isIdle();
}
diff --git a/vpn/java/android/net/vpn/VpnManager.java b/vpn/java/android/net/vpn/VpnManager.java
index ce40b5d0c1227..02486bbab6118 100644
--- a/vpn/java/android/net/vpn/VpnManager.java
+++ b/vpn/java/android/net/vpn/VpnManager.java
@@ -16,17 +16,19 @@
package android.net.vpn;
-import java.io.File;
-
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
-import android.content.ServiceConnection;
import android.os.Environment;
+import android.os.IBinder;
+import android.os.RemoteException;
+import android.os.ServiceManager;
import android.os.SystemProperties;
import android.util.Log;
+import com.android.server.vpn.VpnServiceBinder;
+
/**
* The class provides interface to manage all VPN-related tasks, including:
*
@@ -40,8 +42,6 @@ import android.util.Log;
* {@hide}
*/
public class VpnManager {
- // Action for broadcasting a connectivity state.
- private static final String ACTION_VPN_CONNECTIVITY = "vpn.connectivity";
/** Key to the profile name of a connectivity broadcast event. */
public static final String BROADCAST_PROFILE_NAME = "profile_name";
/** Key to the connectivity state of a connectivity broadcast event. */
@@ -74,8 +74,10 @@ public class VpnManager {
private static final String PACKAGE_PREFIX =
VpnManager.class.getPackage().getName() + ".";
- // Action to start VPN service
- private static final String ACTION_VPN_SERVICE = PACKAGE_PREFIX + "SERVICE";
+ // Action for broadcasting a connectivity state.
+ private static final String ACTION_VPN_CONNECTIVITY = "vpn.connectivity";
+
+ private static final String VPN_SERVICE_NAME = "vpn";
// Action to start VPN settings
private static final String ACTION_VPN_SETTINGS =
@@ -96,13 +98,76 @@ public class VpnManager {
return VpnType.values();
}
+ public static void startVpnService(Context c) {
+ ServiceManager.addService(VPN_SERVICE_NAME, new VpnServiceBinder(c));
+ }
+
private Context mContext;
+ private IVpnService mVpnService;
/**
* Creates a manager object with the specified context.
*/
public VpnManager(Context c) {
mContext = c;
+ createVpnServiceClient();
+ }
+
+ private void createVpnServiceClient() {
+ IBinder b = ServiceManager.getService(VPN_SERVICE_NAME);
+ mVpnService = IVpnService.Stub.asInterface(b);
+ }
+
+ /**
+ * Sets up a VPN connection.
+ * @param profile the profile object
+ * @param username the username for authentication
+ * @param password the corresponding password for authentication
+ * @return true if VPN is successfully connected
+ */
+ public boolean connect(VpnProfile p, String username, String password) {
+ try {
+ return mVpnService.connect(p, username, password);
+ } catch (RemoteException e) {
+ Log.e(TAG, "connect()", e);
+ return false;
+ }
+ }
+
+ /**
+ * Tears down the VPN connection.
+ */
+ public void disconnect() {
+ try {
+ mVpnService.disconnect();
+ } catch (RemoteException e) {
+ Log.e(TAG, "disconnect()", e);
+ }
+ }
+
+ /**
+ * Gets the the current connection state.
+ */
+ public VpnState getState(VpnProfile p) {
+ try {
+ return Enum.valueOf(VpnState.class, mVpnService.getState(p));
+ } catch (RemoteException e) {
+ Log.e(TAG, "getState()", e);
+ return VpnState.IDLE;
+ }
+ }
+
+ /**
+ * Returns the idle state.
+ * @return true if the system is not connecting/connected to a VPN
+ */
+ public boolean isIdle() {
+ try {
+ return mVpnService.isIdle();
+ } catch (RemoteException e) {
+ Log.e(TAG, "isIdle()", e);
+ return true;
+ }
}
/**
@@ -134,33 +199,6 @@ public class VpnManager {
}
}
- /**
- * Starts the VPN service to establish VPN connection.
- */
- public void startVpnService() {
- mContext.startService(new Intent(ACTION_VPN_SERVICE));
- }
-
- /**
- * Stops the VPN service.
- */
- public void stopVpnService() {
- mContext.stopService(new Intent(ACTION_VPN_SERVICE));
- }
-
- /**
- * Binds the specified ServiceConnection with the VPN service.
- */
- public boolean bindVpnService(ServiceConnection c) {
- if (!mContext.bindService(new Intent(ACTION_VPN_SERVICE), c, 0)) {
- Log.w(TAG, "failed to connect to VPN service");
- return false;
- } else {
- Log.d(TAG, "succeeded to connect to VPN service");
- return true;
- }
- }
-
/** Broadcasts the connectivity state of the specified profile. */
public void broadcastConnectivity(String profileName, VpnState s) {
broadcastConnectivity(profileName, s, VPN_ERROR_NO_ERROR);
diff --git a/packages/VpnServices/src/com/android/server/vpn/DaemonProxy.java b/vpn/java/com/android/server/vpn/DaemonProxy.java
similarity index 100%
rename from packages/VpnServices/src/com/android/server/vpn/DaemonProxy.java
rename to vpn/java/com/android/server/vpn/DaemonProxy.java
diff --git a/packages/VpnServices/src/com/android/server/vpn/L2tpIpsecPskService.java b/vpn/java/com/android/server/vpn/L2tpIpsecPskService.java
similarity index 100%
rename from packages/VpnServices/src/com/android/server/vpn/L2tpIpsecPskService.java
rename to vpn/java/com/android/server/vpn/L2tpIpsecPskService.java
diff --git a/packages/VpnServices/src/com/android/server/vpn/L2tpIpsecService.java b/vpn/java/com/android/server/vpn/L2tpIpsecService.java
similarity index 100%
rename from packages/VpnServices/src/com/android/server/vpn/L2tpIpsecService.java
rename to vpn/java/com/android/server/vpn/L2tpIpsecService.java
diff --git a/packages/VpnServices/src/com/android/server/vpn/L2tpService.java b/vpn/java/com/android/server/vpn/L2tpService.java
similarity index 100%
rename from packages/VpnServices/src/com/android/server/vpn/L2tpService.java
rename to vpn/java/com/android/server/vpn/L2tpService.java
diff --git a/packages/VpnServices/src/com/android/server/vpn/PptpService.java b/vpn/java/com/android/server/vpn/PptpService.java
similarity index 100%
rename from packages/VpnServices/src/com/android/server/vpn/PptpService.java
rename to vpn/java/com/android/server/vpn/PptpService.java
diff --git a/packages/VpnServices/src/com/android/server/vpn/VpnConnectingError.java b/vpn/java/com/android/server/vpn/VpnConnectingError.java
similarity index 100%
rename from packages/VpnServices/src/com/android/server/vpn/VpnConnectingError.java
rename to vpn/java/com/android/server/vpn/VpnConnectingError.java
diff --git a/packages/VpnServices/src/com/android/server/vpn/VpnDaemons.java b/vpn/java/com/android/server/vpn/VpnDaemons.java
similarity index 100%
rename from packages/VpnServices/src/com/android/server/vpn/VpnDaemons.java
rename to vpn/java/com/android/server/vpn/VpnDaemons.java
diff --git a/packages/VpnServices/src/com/android/server/vpn/VpnService.java b/vpn/java/com/android/server/vpn/VpnService.java
similarity index 94%
rename from packages/VpnServices/src/com/android/server/vpn/VpnService.java
rename to vpn/java/com/android/server/vpn/VpnService.java
index a61842325627c..4966c060e52d7 100644
--- a/packages/VpnServices/src/com/android/server/vpn/VpnService.java
+++ b/vpn/java/com/android/server/vpn/VpnService.java
@@ -27,8 +27,9 @@ import android.os.SystemProperties;
import android.text.TextUtils;
import android.util.Log;
+import com.android.internal.R;
+
import java.io.IOException;
-import java.io.Serializable;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.net.NetworkInterface;
@@ -37,8 +38,7 @@ import java.net.UnknownHostException;
/**
* The service base class for managing a type of VPN connection.
*/
-abstract class VpnService implements Serializable {
- static final long serialVersionUID = 1L;
+abstract class VpnService {
private static final boolean DBG = true;
private static final int NOTIFICATION_ID = 1;
@@ -55,10 +55,8 @@ abstract class VpnService implements Serializable {
private final String TAG = VpnService.class.getSimpleName();
- // FIXME: profile is only needed in connecting phase, so we can just save
- // the profile name and service class name for recovery
E mProfile;
- transient VpnServiceBinder mContext;
+ transient Context mContext;
private VpnState mState = VpnState.IDLE;
private Throwable mError;
@@ -105,12 +103,8 @@ abstract class VpnService implements Serializable {
return InetAddress.getByName(hostName).getHostAddress();
}
- void setContext(VpnServiceBinder context, E profile) {
+ void setContext(Context context, E profile) {
mProfile = profile;
- recover(context);
- }
-
- void recover(VpnServiceBinder context) {
mContext = context;
mNotification = new NotificationHelper();
@@ -124,6 +118,10 @@ abstract class VpnService implements Serializable {
return mState;
}
+ boolean isIdle() {
+ return (mState == VpnState.IDLE);
+ }
+
synchronized boolean onConnect(String username, String password) {
try {
setState(VpnState.CONNECTING);
@@ -216,21 +214,12 @@ abstract class VpnService implements Serializable {
mStartTime = System.currentTimeMillis();
- // Correct order to make sure VpnService doesn't break when killed:
- // (1) set state to CONNECTED
- // (2) save states
- // (3) set DNS
setState(VpnState.CONNECTED);
- saveSelf();
setVpnDns();
startConnectivityMonitor();
}
- private void saveSelf() throws IOException {
- mContext.saveStates();
- }
-
private synchronized void onFinalCleanUp() {
if (DBG) Log.d(TAG, "onFinalCleanUp()");
@@ -243,10 +232,7 @@ abstract class VpnService implements Serializable {
restoreOriginalDomainSuffices();
setState(VpnState.IDLE);
- // stop the service itself
SystemProperties.set(VPN_STATUS, VPN_IS_DOWN);
- mContext.removeStates();
- mContext.stopSelf();
}
private boolean anyError() {
@@ -413,9 +399,6 @@ abstract class VpnService implements Serializable {
}
}
- private class DaemonHelper implements Serializable {
- }
-
// Helper class for showing, updating notification.
private class NotificationHelper {
private NotificationManager mNotificationManager = (NotificationManager)
diff --git a/vpn/java/com/android/server/vpn/VpnServiceBinder.java b/vpn/java/com/android/server/vpn/VpnServiceBinder.java
new file mode 100644
index 0000000000000..c474ff9bd8309
--- /dev/null
+++ b/vpn/java/com/android/server/vpn/VpnServiceBinder.java
@@ -0,0 +1,117 @@
+/*
+ * Copyright (C) 2009, 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 com.android.server.vpn;
+
+import android.app.Service;
+import android.content.Context;
+import android.content.Intent;
+import android.net.vpn.IVpnService;
+import android.net.vpn.L2tpIpsecProfile;
+import android.net.vpn.L2tpIpsecPskProfile;
+import android.net.vpn.L2tpProfile;
+import android.net.vpn.PptpProfile;
+import android.net.vpn.VpnManager;
+import android.net.vpn.VpnProfile;
+import android.net.vpn.VpnState;
+import android.util.Log;
+
+/**
+ * The service class for managing a VPN connection. It implements the
+ * {@link IVpnService} binder interface.
+ */
+public class VpnServiceBinder extends IVpnService.Stub {
+ private static final String TAG = VpnServiceBinder.class.getSimpleName();
+ private static final boolean DBG = true;
+
+ // The actual implementation is delegated to the VpnService class.
+ private VpnService extends VpnProfile> mService;
+
+ private Context mContext;
+
+ public VpnServiceBinder(Context context) {
+ mContext = context;
+ }
+
+ @Override
+ public synchronized boolean connect(VpnProfile p, final String username,
+ final String password) {
+ if ((mService != null) && !mService.isIdle()) return false;
+ final VpnService s = mService = createService(p);
+
+ new Thread(new Runnable() {
+ public void run() {
+ s.onConnect(username, password);
+ }
+ }).start();
+ return true;
+ }
+
+ @Override
+ public synchronized void disconnect() {
+ if (mService == null) return;
+ final VpnService s = mService;
+ mService = null;
+
+ new Thread(new Runnable() {
+ public void run() {
+ s.onDisconnect();
+ }
+ }).start();
+ }
+
+ @Override
+ public synchronized String getState(VpnProfile p) {
+ if ((mService == null)
+ || (!p.getName().equals(mService.mProfile.getName()))) {
+ return VpnState.IDLE.toString();
+ } else {
+ return mService.getState().toString();
+ }
+ }
+
+ @Override
+ public synchronized boolean isIdle() {
+ return (mService == null || mService.isIdle());
+ }
+
+ private VpnService extends VpnProfile> createService(VpnProfile p) {
+ switch (p.getType()) {
+ case L2TP:
+ L2tpService l2tp = new L2tpService();
+ l2tp.setContext(mContext, (L2tpProfile) p);
+ return l2tp;
+
+ case PPTP:
+ PptpService pptp = new PptpService();
+ pptp.setContext(mContext, (PptpProfile) p);
+ return pptp;
+
+ case L2TP_IPSEC_PSK:
+ L2tpIpsecPskService psk = new L2tpIpsecPskService();
+ psk.setContext(mContext, (L2tpIpsecPskProfile) p);
+ return psk;
+
+ case L2TP_IPSEC:
+ L2tpIpsecService l2tpIpsec = new L2tpIpsecService();
+ l2tpIpsec.setContext(mContext, (L2tpIpsecProfile) p);
+ return l2tpIpsec;
+
+ default:
+ return null;
+ }
+ }
+}