From 008f6f073b0bf04fd04d0f352a5b53460ca0e2ef Mon Sep 17 00:00:00 2001 From: Roshan Pius Date: Mon, 25 Nov 2019 14:06:54 -0800 Subject: wifi: Create apex mainline module Bug: 144722612 Test: Device boots up and connects to wifi networks. Change-Id: I35d7f349b7baaa389fbaf7368eeca22e20274e96 --- Android.bp | 2 + service/CleanSpec.mk | 4 ++ service/apex/Android.bp | 45 ++++++++++++++++++ service/apex/AndroidManifest.xml | 24 ++++++++++ service/apex/apex_manifest.json | 5 ++ service/apex/com.android.wifi.avbpubkey | Bin 0 -> 1032 bytes service/apex/com.android.wifi.pem | 51 +++++++++++++++++++++ service/apex/com.android.wifi.pk8 | Bin 0 -> 2375 bytes service/apex/com.android.wifi.x509.pem | 35 ++++++++++++++ .../java/com/android/server/wifi/WifiNative.java | 10 +++- 10 files changed, 174 insertions(+), 2 deletions(-) create mode 100644 service/apex/Android.bp create mode 100644 service/apex/AndroidManifest.xml create mode 100644 service/apex/apex_manifest.json create mode 100644 service/apex/com.android.wifi.avbpubkey create mode 100644 service/apex/com.android.wifi.pem create mode 100644 service/apex/com.android.wifi.pk8 create mode 100644 service/apex/com.android.wifi.x509.pem diff --git a/Android.bp b/Android.bp index 7c74fcb3e..5c41f75c7 100644 --- a/Android.bp +++ b/Android.bp @@ -16,5 +16,7 @@ subdirs = [ "libwifi_system", "libwifi_system_iface", "service", + "service/apex", + "service/proto", "tests", ] diff --git a/service/CleanSpec.mk b/service/CleanSpec.mk index da0481f51..603ba73bd 100644 --- a/service/CleanSpec.mk +++ b/service/CleanSpec.mk @@ -50,6 +50,10 @@ $(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/etc/init/wifi.rc) $(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/priv-app/WifiStack) $(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/etc/init/wifi_inprocess.rc) $(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/priv-app/InProcessWifiStack) +$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/framework/wifi-service.jar) +$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/priv-app/wifi-service-resources) +$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/lib64/libwifi-jni.so) +$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/lib/libwifi-jni.so) # ************************************************ # NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST # ************************************************ diff --git a/service/apex/Android.bp b/service/apex/Android.bp new file mode 100644 index 000000000..fff3f2455 --- /dev/null +++ b/service/apex/Android.bp @@ -0,0 +1,45 @@ +// +// Copyright (C) 2019 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. +// + +// Mainline wifi apex module. +apex { + name: "com.android.wifi", + manifest: "apex_manifest.json", + native_shared_libs: ["libwifi-jni"], + java_libs: ["wifi-service"], + apps: ["wifi-service-resources"], + + required: [ + "cacerts_wfa", + "services", + ], + + init_rc: ["../wifi.rc"], + + key: "com.android.wifi.key", + certificate: ":com.android.wifi.certificate", +} + +apex_key { + name: "com.android.wifi.key", + public_key: "com.android.wifi.avbpubkey", + private_key: "com.android.wifi.pem", +} + +android_app_certificate { + name: "com.android.wifi.certificate", + certificate: "com.android.wifi", +} diff --git a/service/apex/AndroidManifest.xml b/service/apex/AndroidManifest.xml new file mode 100644 index 000000000..efc8cc0f0 --- /dev/null +++ b/service/apex/AndroidManifest.xml @@ -0,0 +1,24 @@ + + + + + + + + + diff --git a/service/apex/apex_manifest.json b/service/apex/apex_manifest.json new file mode 100644 index 000000000..a5792552c --- /dev/null +++ b/service/apex/apex_manifest.json @@ -0,0 +1,5 @@ +{ + "name": "com.android.wifi", + "version": 1 +} + diff --git a/service/apex/com.android.wifi.avbpubkey b/service/apex/com.android.wifi.avbpubkey new file mode 100644 index 000000000..e98ee34db Binary files /dev/null and b/service/apex/com.android.wifi.avbpubkey differ diff --git a/service/apex/com.android.wifi.pem b/service/apex/com.android.wifi.pem new file mode 100644 index 000000000..3d080f1e7 --- /dev/null +++ b/service/apex/com.android.wifi.pem @@ -0,0 +1,51 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIJKQIBAAKCAgEAzIaI6k0LMCiFu60Bh8vO4CSjbDbZvk9V7Nkguu7G4KL2nQel +9M+zph5lmvqMguAoWbLfwIOOlrOMb2BDO65HtuCZO8gBvoHRPI1DWTJViLjpyW0F +0vHRZGe8nQfEhhL7RSVO1A/hJkyMPVEc/IOXIssiW8VIaT27li5pTF/u9zkihwtc +tWKgC5Tc+qrfGvtjF+1mNtbf3AOR+8/a0UnYmmw7OJkH8g9qio1EBKM3YNBl04Df +pF1tkspo30sY5sxKOz4sihq/fXDaIm9N8CoESXUuicPZ5Ko2uh9q9pHK8jDpNxyJ +vUbWO7CSupvtonWVd0rD/CuaBHt8vMDHbnXsrUJRQEZzyYDZmQKrxQz0l/+5+Xn9 +x6/qE5EHt9ektg+nlFpcclCvro8ir6K7GtUJSMhdYfIyP9t/yb6A2b0O5ja48XFN +mFfosHHOSJ9IB2n2cQ+N+Gb03kJge4cO34c3Pl7ohIc5ZYErMHknF5Ode9b2gv5R +gnHnWV/LEmTxW/PyTtgZYPfuFKU0bhC9xsdRzFdU+fEYREGGRR8O7gY7A62s4JR0 +ment24/SMrND5lzK44e/u6R6lwI0ajZFlaKFPIBtZNXThSke0jgkpld7dBX5uFQX +8VV7cNdZxbzEZZRfAr2KRDWZQ2fNpdMMHUI4mvbn7H6q7QvSg7zkvENnLl8CAwEA +AQKCAgBrXEvOwjaXRw48YCqngALOgi0PBxPx5G90bt3Rgrn+/Ux7TaJ+CfGBx/8K +BW9w2/4SZ+Uwh154GTQk2uEwGOIoS2nkia7ws/CD2pt53QQtSv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H+5cbDT50PpOnXff6+h0 +fhrMElXYu4wg6ZPZ4BYt/PY+qhiRZ47MtAqw3byaCe2+sLNSpU/tt+klIYuWvTyV +pE/suflS3/JnJCzs8MrP0mX73AoILauqGEsc8+hsf5X2Rra2sllV4YfiGKSUoISq +u9wRjoGkB8SSg1GywotyXFJc3dQoLtMCk0ABBQCM9zp+xjdB9AeWS4tjSBO3 +-----END RSA PRIVATE KEY----- diff --git a/service/apex/com.android.wifi.pk8 b/service/apex/com.android.wifi.pk8 new file mode 100644 index 000000000..a47b169eb Binary files /dev/null and b/service/apex/com.android.wifi.pk8 differ diff --git a/service/apex/com.android.wifi.x509.pem b/service/apex/com.android.wifi.x509.pem new file mode 100644 index 000000000..fbc798dfc --- /dev/null +++ b/service/apex/com.android.wifi.x509.pem @@ -0,0 +1,35 @@ +-----BEGIN CERTIFICATE----- +MIIGJzCCBA+gAwIBAgIUYfh1Zzu3M79bdOVvnEraqzmHwFAwDQYJKoZIhvcNAQEL +BQAwgaExCzAJBgNVBAYTAlVTMRMwEQYDVQQIDApDYWxpZm9ybmlhMRYwFAYDVQQH +DA1Nb3VudGFpbiBWaWV3MQ8wDQYDVQQKDAZHb29nbGUxEDAOBgNVBAsMB0FuZHJv +aWQxFTATBgNVBAMMDGFuZHJvaWQtd2lmaTErMCkGCSqGSIb3DQEJARYcYW5kcm9p +ZC13aWZpLXRlYW1AZ29vZ2xlLmNvbTAgFw0xOTExMjExNzIwMzZaGA80NzU3MTAx +NzE3MjAzNlowgaExCzAJBgNVBAYTAlVTMRMwEQYDVQQIDApDYWxpZm9ybmlhMRYw +FAYDVQQHDA1Nb3VudGFpbiBWaWV3MQ8wDQYDVQQKDAZHb29nbGUxEDAOBgNVBAsM +B0FuZHJvaWQxFTATBgNVBAMMDGFuZHJvaWQtd2lmaTErMCkGCSqGSIb3DQEJARYc +YW5kcm9pZC13aWZpLXRlYW1AZ29vZ2xlLmNvbTCCAiIwDQYJKoZIhvcNAQEBBQAD +ggIPADCCAgoC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K/VRFDGrZF2p2C7DXmMOE66lY3iyRP +ynKVbzoI0dyyVl/BZ/9dGCCgvhJWo3oUfwRLxqwOt81DOiDUT2DV2XB2TEPFLTwQ +gwlw5Lkmd7ecj7J0E4QIkAPsQYLI/fVelC6QUeqvbKORur4vvkVdhOj2GBpb/6tQ +F5i8osLk1kqBwMpnDZCGKSS22JqY7lBPmlkCPCfRd3uVmK42ItAUpYcdLk7lb90o +wO5OgpOPajl6ImYe8kpqoeLBUK4E6qrve3MLMukhCSwR8hrteAEL86R631P6A747 +mkZUgbKPqkeUSFd+0AfzLTjvaevgfIEF/wz5HDHGAloWkd45m5Tdd5I06fqPVu/2 +rxzqZChKW2XHtwaTl5qkYUHi6pqkq+oWhpjWCS84wCNmlX8j4lrZ5mumoOaPpElK +Tbj1WZ16OOPDXWONclE29gfC/+XaOKLLhjdfh0+ZEJ7BZSCBCMyQWXxbcQ== +-----END CERTIFICATE----- diff --git a/service/java/com/android/server/wifi/WifiNative.java b/service/java/com/android/server/wifi/WifiNative.java index eeef34fc3..21abbd254 100644 --- a/service/java/com/android/server/wifi/WifiNative.java +++ b/service/java/com/android/server/wifi/WifiNative.java @@ -72,6 +72,8 @@ import java.util.TimeZone; */ public class WifiNative { private static final String TAG = "WifiNative"; + private static final String JNI_LIB = "/apex/com.android.wifi/lib64/libwifi-jni.so"; + private final SupplicantStaIfaceHal mSupplicantStaIfaceHal; private final HostapdHal mHostapdHal; private final WifiVendorHal mWifiVendorHal; @@ -3365,8 +3367,12 @@ public class WifiNative { /* Register native functions */ static { /* Native functions are defined in libwifi-jni.so */ - System.loadLibrary("wifi-jni"); - registerNatives(); + try { + System.load(JNI_LIB); + registerNatives(); + } catch (UnsatisfiedLinkError e) { + Log.wtf(TAG, "Failed to load jni library", e); + } } private static native int registerNatives(); -- cgit v1.2.3