Merge "Network build flag is delivered to VSS not relying on JNI" into main
diff --git a/docs/custom_vm.md b/docs/custom_vm.md
index 1e15d16..4b027f1 100644
--- a/docs/custom_vm.md
+++ b/docs/custom_vm.md
@@ -222,67 +222,10 @@
$ adb shell pm grant com.google.android.virtualization.vmlauncher android.permission.USE_CUSTOM_VIRTUAL_MACHINE
$ adb unroot
```
-Then execute the below to set up the network. In the future, this step won't be necessary.
-```
-$ cat > setup_network.sh; adb push setup_network.sh /data/local/tmp
-#!/system/bin/sh
+Second, ensure your device is connected to the Internet.
-set -e
-
-TAP_IFACE=crosvm_tap
-TAP_ADDR=192.168.1.1
-TAP_NET=192.168.1.0
-
-function setup_network() {
- local WAN_IFACE=$(ip route get 8.8.8.8 2> /dev/null | awk -- '{printf $5}')
- if [ "${WAN_IFACE}" == "" ]; then
- echo "No network. Connect to a WiFi network and start again"
- return 1
- fi
-
- if ip link show ${TAP_IFACE} &> /dev/null ; then
- echo "TAP interface ${TAP_IFACE} already exists"
- return 1
- fi
-
- ip tuntap add mode tap group virtualmachine vnet_hdr ${TAP_IFACE}
- ip addr add ${TAP_ADDR}/24 dev ${TAP_IFACE}
- ip link set ${TAP_IFACE} up
- ip rule flush
- ip rule add from all lookup ${WAN_IFACE}
- ip route add ${TAP_NET}/24 dev ${TAP_IFACE} table ${WAN_IFACE}
- sysctl net.ipv4.ip_forward=1
- iptables -t filter -F
- iptables -t nat -A POSTROUTING -s ${TAP_NET}/24 -j MASQUERADE
-}
-
-function setup_if_necessary() {
- if [ "$(getprop ro.crosvm.network.setup.done)" == 1 ]; then
- return
- fi
- echo "Setting up..."
- check_privilege
- setup_network
- setenforce 0
- chmod 666 /dev/tun
- setprop ro.crosvm.network.setup.done 1
-}
-
-function check_privilege() {
- if [ "$(id -u)" -ne 0 ]; then
- echo "Run 'adb root' first"
- return 1
- fi
-}
-
-setup_if_necessary
-^D
-
-adb root; adb shell /data/local/tmp/setup_network.sh
-```
-
-Then, finally tap the VmLauncherApp app from the launcher UI. You will see
+Finally, tap the VmLauncherApp app from the launcher UI. You will see
Ferrochrome booting!
If it doesn’t work well, try
diff --git a/ferrochrome_app/Android.bp b/ferrochrome_app/Android.bp
new file mode 100644
index 0000000..182d289
--- /dev/null
+++ b/ferrochrome_app/Android.bp
@@ -0,0 +1,23 @@
+package {
+ default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
+android_app {
+ name: "FerrochromeApp",
+ srcs: ["java/**/*.java"],
+ resource_dirs: ["res"],
+ platform_apis: true,
+ // TODO(b/348113995): move this app to product partition
+ system_ext_specific: true,
+ privileged: true,
+ init_rc: ["custom_vm_setup.rc"],
+ required: ["custom_vm_setup"],
+ certificate: "platform",
+}
+
+sh_binary {
+ name: "custom_vm_setup",
+ src: "custom_vm_setup.sh",
+ system_ext_specific: true,
+ host_supported: false,
+}
diff --git a/ferrochrome_app/AndroidManifest.xml b/ferrochrome_app/AndroidManifest.xml
new file mode 100644
index 0000000..d783bbc
--- /dev/null
+++ b/ferrochrome_app/AndroidManifest.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.android.virtualization.ferrochrome"
+ android:sharedUserId="android.uid.system" >
+
+ <uses-permission android:name="android.permission.INTERNET" />
+ <application
+ android:label="Ferrochrome">
+ <activity android:name=".FerrochromeActivity"
+ android:configChanges="orientation|screenSize|keyboard|keyboardHidden|navigation|uiMode"
+ android:theme="@style/MyTheme"
+ android:screenOrientation="landscape"
+ android:exported="true">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ </application>
+
+</manifest>
diff --git a/ferrochrome_app/custom_vm_setup.rc b/ferrochrome_app/custom_vm_setup.rc
new file mode 100644
index 0000000..f4244b7
--- /dev/null
+++ b/ferrochrome_app/custom_vm_setup.rc
@@ -0,0 +1,23 @@
+# Copyright (C) 2024 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.
+
+service custom_vm_setup /system_ext/bin/custom_vm_setup
+ user shell
+ group shell
+ disabled
+ oneshot
+ seclabel u:r:shell:s0
+
+on property:debug.custom_vm_setup.start=true
+ start custom_vm_setup
\ No newline at end of file
diff --git a/ferrochrome_app/custom_vm_setup.sh b/ferrochrome_app/custom_vm_setup.sh
new file mode 100644
index 0000000..d57ed7f
--- /dev/null
+++ b/ferrochrome_app/custom_vm_setup.sh
@@ -0,0 +1,15 @@
+#!/system/bin/sh
+
+function copy_files() {
+ cp -u /sdcard/vm_config.json /data/local/tmp
+ cp -u /sdcard/vmlinuz /data/local/tmp
+ cp -u /sdcard/chromiumos_test_image.bin /data/local/tmp
+ chmod 666 /data/local/tmp/vm_config.json
+ chmod 666 /data/local/tmp/chromiumos_test_image.bin
+ chmod 666 /data/local/tmp/vmlinuz
+}
+setprop debug.custom_vm_setup.done false
+copy_files
+pm grant com.google.android.virtualization.vmlauncher android.permission.USE_CUSTOM_VIRTUAL_MACHINE
+setprop debug.custom_vm_setup.start false
+setprop debug.custom_vm_setup.done true
\ No newline at end of file
diff --git a/ferrochrome_app/java/com/android/virtualization/ferrochrome/FerrochromeActivity.java b/ferrochrome_app/java/com/android/virtualization/ferrochrome/FerrochromeActivity.java
new file mode 100644
index 0000000..3629c85
--- /dev/null
+++ b/ferrochrome_app/java/com/android/virtualization/ferrochrome/FerrochromeActivity.java
@@ -0,0 +1,197 @@
+/*
+ * Copyright (C) 2024 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.virtualization.ferrochrome;
+
+import android.app.Activity;
+import android.app.ActivityManager;
+import android.content.Intent;
+import android.content.pm.PackageManager;
+import android.os.Bundle;
+import android.os.Environment;
+import android.os.SystemProperties;
+import android.util.Log;
+import android.view.WindowManager;
+import android.widget.TextView;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.StandardCopyOption;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
+
+public class FerrochromeActivity extends Activity {
+ ExecutorService executorService = Executors.newSingleThreadExecutor();
+ private static final String TAG = "FerrochromeActivity";
+ private static final String FERROCHROME_VERSION = "R127-15916.0.0";
+ private static final String EXTERNAL_STORAGE_DIR =
+ Environment.getExternalStorageDirectory().getPath() + File.separator;
+ private static final Path IMAGE_PATH =
+ Path.of(EXTERNAL_STORAGE_DIR + "chromiumos_test_image.bin");
+ private static final Path KERNEL_PATH = Path.of(EXTERNAL_STORAGE_DIR + "vmlinuz.bin");
+ private static final Path IMAGE_VERSION_INFO =
+ Path.of(EXTERNAL_STORAGE_DIR + "ferrochrome_image_version");
+ private static final Path VM_CONFIG_PATH = Path.of(EXTERNAL_STORAGE_DIR + "vm_config.json");
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_ferrochrome);
+ getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
+
+ // Clean up the existing vm launcher process if there is
+ ActivityManager am = getSystemService(ActivityManager.class);
+ am.killBackgroundProcesses(getVmLauncherAppPackageName());
+
+ executorService.execute(
+ () -> {
+ if (Files.notExists(IMAGE_PATH)
+ || Files.notExists(KERNEL_PATH)
+ || !FERROCHROME_VERSION.equals(getVersionInfo())) {
+
+ updateStatus("image doesn't exist");
+ updateStatus("download image");
+ if (download(FERROCHROME_VERSION)) {
+ updateStatus("download done");
+ } else {
+ updateStatus("download failed, check internet connection and retry");
+ return;
+ }
+ } else {
+ updateStatus("there are already downloaded images");
+ }
+ updateStatus("write down vm config");
+ copyVmConfigJson();
+ updateStatus("custom_vm_setup: copy files to /data/local/tmp");
+ SystemProperties.set("debug.custom_vm_setup.start", "true");
+ while (!SystemProperties.getBoolean("debug.custom_vm_setup.done", false)) {
+ // Wait for custom_vm_setup
+ try {
+ Thread.sleep(1000);
+ } catch (Exception e) {
+ Log.d(TAG, e.toString());
+ }
+ updateStatus("wait for custom_vm_setup");
+ }
+ updateStatus("enable vmlauncher");
+ updateStatus("ready for ferrochrome");
+ runOnUiThread(
+ () ->
+ startActivity(
+ new Intent()
+ .setClassName(
+ getVmLauncherAppPackageName(),
+ "com.android.virtualization.vmlauncher.MainActivity")));
+ });
+ }
+
+ private String getVmLauncherAppPackageName() {
+ PackageManager pm = getPackageManager();
+ for (String packageName :
+ new String[] {
+ "com.android.virtualization.vmlauncher",
+ "com.google.android.virtualization.vmlauncher"
+ }) {
+ try {
+ pm.getPackageInfo(packageName, 0);
+ return packageName;
+ } catch (PackageManager.NameNotFoundException e) {
+ continue;
+ }
+ }
+ return null;
+ }
+
+ private void updateStatus(String line) {
+ Log.d(TAG, line);
+ runOnUiThread(
+ () -> {
+ TextView statusView = findViewById(R.id.status_txt_view);
+ statusView.append(line + "\n");
+ });
+ }
+
+ private void copyVmConfigJson() {
+ if (Files.exists(VM_CONFIG_PATH)) {
+ return;
+ }
+ try (InputStream is = getResources().openRawResource(R.raw.vm_config)) {
+ Files.copy(is, VM_CONFIG_PATH, StandardCopyOption.REPLACE_EXISTING);
+ } catch (IOException e) {
+ updateStatus(e.toString());
+ }
+ }
+
+ private String getVersionInfo() {
+ try {
+ return new String(Files.readAllBytes(IMAGE_VERSION_INFO), StandardCharsets.UTF_8);
+ } catch (IOException e) {
+ return null;
+ }
+ }
+
+ private boolean updateVersionInfo(String version) {
+ try {
+ Files.write(IMAGE_VERSION_INFO, version.getBytes(StandardCharsets.UTF_8));
+ } catch (IOException e) {
+ Log.d(TAG, e.toString());
+ }
+ return true;
+ }
+
+ private boolean download(String version) {
+ String urlString =
+ "https://storage.googleapis.com/chromiumos-image-archive/ferrochrome-public/"
+ + version
+ + "/image.zip";
+ boolean hasKernel = false;
+ boolean hasImage = false;
+ try (InputStream is = (new URL(urlString)).openStream();
+ ZipInputStream zis = new ZipInputStream(is)) {
+ ZipEntry entry;
+ while ((entry = zis.getNextEntry()) != null) {
+ Path dest;
+ if (entry.getName().contains("chromiumos_test_image.bin")) {
+ dest = IMAGE_PATH;
+ hasImage = true;
+ } else if (entry.getName().contains("boot_images/vmlinuz-")) {
+ dest = KERNEL_PATH;
+ hasKernel = true;
+ } else {
+ continue;
+ }
+ updateStatus("copy " + entry.getName() + " start");
+ Files.copy(zis, dest, StandardCopyOption.REPLACE_EXISTING);
+ updateStatus("copy " + entry.getName() + " done");
+ if (hasImage && hasKernel) {
+ updateVersionInfo(version);
+ break;
+ }
+ }
+ } catch (Exception e) {
+ updateStatus(e.toString());
+ return false;
+ }
+ return true;
+ }
+}
diff --git a/ferrochrome_app/res/layout/activity_ferrochrome.xml b/ferrochrome_app/res/layout/activity_ferrochrome.xml
new file mode 100644
index 0000000..7d5e8aa
--- /dev/null
+++ b/ferrochrome_app/res/layout/activity_ferrochrome.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ tools:context=".FerrochromeActivity">
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:id="@+id/status_txt_view"/>
+
+</RelativeLayout>
\ No newline at end of file
diff --git a/ferrochrome_app/res/raw/vm_config.json b/ferrochrome_app/res/raw/vm_config.json
new file mode 100644
index 0000000..91071bb
--- /dev/null
+++ b/ferrochrome_app/res/raw/vm_config.json
@@ -0,0 +1,21 @@
+{
+ "name": "cros",
+ "kernel": "/data/local/tmp/vmlinuz",
+ "disks": [
+ {
+ "image": "/data/local/tmp/chromiumos_test_image.bin",
+ "partitions": [],
+ "writable": true
+ }
+ ],
+ "params": "root=/dev/vda3 rootwait noinitrd ro enforcing=0 cros_debug cros_secure",
+ "protected": false,
+ "cpu_topology": "match_host",
+ "platform_version": "~1.0",
+ "memory_mib": 8096,
+ "gpu": {
+ "backend": "virglrenderer",
+ "context_types": ["virgl2"]
+ },
+ "console_input_device": "ttyS0"
+}
\ No newline at end of file
diff --git a/ferrochrome_app/res/values/themes.xml b/ferrochrome_app/res/values/themes.xml
new file mode 100644
index 0000000..c9a9ed2
--- /dev/null
+++ b/ferrochrome_app/res/values/themes.xml
@@ -0,0 +1,4 @@
+<resources xmlns:tools="http://schemas.android.com/tools">
+ <style name="MyTheme" parent="@android:style/Theme.DeviceDefault.NoActionBar">
+ </style>
+</resources>
diff --git a/java/service/src/com/android/system/virtualmachine/VirtualizationSystemService.java b/java/service/src/com/android/system/virtualmachine/VirtualizationSystemService.java
index a97324f..241eef4 100644
--- a/java/service/src/com/android/system/virtualmachine/VirtualizationSystemService.java
+++ b/java/service/src/com/android/system/virtualmachine/VirtualizationSystemService.java
@@ -21,6 +21,9 @@
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
+import android.net.TetheringManager;
+import android.net.TetheringManager.StartTetheringCallback;
+import android.net.TetheringManager.TetheringRequest;
import android.os.Handler;
import android.os.IBinder;
import android.os.ServiceManager;
@@ -149,10 +152,37 @@
}
}
- private static final class TetheringService extends IVmTethering.Stub {
+ private final class TetheringService extends IVmTethering.Stub {
+ private final TetheringManager tm = getContext().getSystemService(TetheringManager.class);
+
@Override
- public void enableVmTethering() throws UnsupportedOperationException {
- throw new UnsupportedOperationException("VM tethering is not supported yet");
+ public void enableVmTethering() {
+ final TetheringRequest tr =
+ new TetheringRequest.Builder(TetheringManager.TETHERING_VIRTUAL)
+ .setConnectivityScope(TetheringManager.CONNECTIVITY_SCOPE_GLOBAL)
+ .build();
+
+ StartTetheringCallback startTetheringCallback =
+ new StartTetheringCallback() {
+ @Override
+ public void onTetheringStarted() {
+ Log.i(TAG, "VM tethering started successfully");
+ }
+
+ @Override
+ public void onTetheringFailed(int resultCode) {
+ Log.e(
+ TAG,
+ "VM tethering failed. Result Code: "
+ + Integer.toString(resultCode));
+ }
+ };
+ tm.startTethering(tr, c -> c.run() /* executor */, startTetheringCallback);
+ }
+
+ @Override
+ public void disableVmTethering() {
+ tm.stopTethering(TetheringManager.TETHERING_VIRTUAL);
}
}
}
diff --git a/virtualizationmanager/src/crosvm.rs b/virtualizationmanager/src/crosvm.rs
index ee5f5cd..47ef91a 100644
--- a/virtualizationmanager/src/crosvm.rs
+++ b/virtualizationmanager/src/crosvm.rs
@@ -1087,15 +1087,6 @@
}
}
- if cfg!(paravirtualized_devices) {
- // TODO(b/340376951): Remove this after tap in CrosvmConfig is connected to tethering.
- if rustutils::system_properties::read_bool("ro.crosvm.network.setup.done", false)
- .unwrap_or(false)
- {
- command.arg("--net").arg("tap-name=crosvm_tap");
- }
- }
-
if cfg!(network) {
if let Some(tap) = &config.tap {
let tap_fd = tap.as_raw_fd();
diff --git a/virtualizationservice/aidl/android/system/vmtethering/IVmTethering.aidl b/virtualizationservice/aidl/android/system/vmtethering/IVmTethering.aidl
index 732a515..0743ffa 100644
--- a/virtualizationservice/aidl/android/system/vmtethering/IVmTethering.aidl
+++ b/virtualizationservice/aidl/android/system/vmtethering/IVmTethering.aidl
@@ -21,4 +21,9 @@
* Start VM tethering to provide external network to VM.
*/
void enableVmTethering();
+
+ /**
+ * Terminate VM tethering that providing external network to VM.
+ */
+ void disableVmTethering();
}
diff --git a/virtualizationservice/src/aidl.rs b/virtualizationservice/src/aidl.rs
index c0e1cc7..af80998 100644
--- a/virtualizationservice/src/aidl.rs
+++ b/virtualizationservice/src/aidl.rs
@@ -518,7 +518,7 @@
Ok(())
}
- fn createTapInterface(&self, iface_name_suffix: &str) -> binder::Result<ParcelFileDescriptor> {
+ fn createTapInterface(&self, _iface_name_suffix: &str) -> binder::Result<ParcelFileDescriptor> {
check_internet_permission()?;
check_use_custom_virtual_machine()?;
if !cfg!(network) {
@@ -528,18 +528,14 @@
))
.with_log();
}
- let tap_fd = NETWORK_SERVICE.createTapInterface(iface_name_suffix)?;
+ // TODO(340377643): Use iface_name_suffix after introducing bridge interface, not fixed
+ // value.
+ let tap_fd = NETWORK_SERVICE.createTapInterface("fixed")?;
// TODO(340377643): Due to lack of implementation of creating bridge interface, tethering is
// enabled for TAP interface instead of bridge interface. After introducing creation of
// bridge interface in AVF, we should modify it.
- if let Err(e) = TETHERING_SERVICE.enableVmTethering() {
- if e.exception_code() == ExceptionCode::UNSUPPORTED_OPERATION {
- warn!("{}", e.get_description());
- } else {
- return Err(e);
- }
- }
+ TETHERING_SERVICE.enableVmTethering()?;
Ok(tap_fd)
}
@@ -554,6 +550,10 @@
))
.with_log();
}
+
+ // TODO(340377643): Disabling tethering should be for bridge interface, not TAP interface.
+ TETHERING_SERVICE.disableVmTethering()?;
+
NETWORK_SERVICE.deleteTapInterface(tap_fd)
}
}
diff --git a/vmlauncher_app/AndroidManifest.xml b/vmlauncher_app/AndroidManifest.xml
index d800ec7..ecfef86 100644
--- a/vmlauncher_app/AndroidManifest.xml
+++ b/vmlauncher_app/AndroidManifest.xml
@@ -7,19 +7,22 @@
<uses-permission android:name="android.permission.INTERNET" />
<uses-feature android:name="android.software.virtualization_framework" android:required="true" />
<application
- android:label="VmLauncherApp"
- android:networkSecurityConfig="@xml/network_security_config">
+ android:label="VmLauncherApp">
<activity android:name=".MainActivity"
- android:enabled="false"
android:screenOrientation="landscape"
android:configChanges="orientation|screenSize|keyboard|keyboardHidden|navigation|uiMode"
android:theme="@style/MyTheme"
android:exported="true">
+ </activity>
+ <activity-alias android:name=".MainActivityAlias"
+ android:targetActivity=".MainActivity"
+ android:exported="true"
+ android:enabled="false">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
- </activity>
+ </activity-alias>
</application>
</manifest>
diff --git a/vmlauncher_app/java/com/android/virtualization/vmlauncher/MainActivity.java b/vmlauncher_app/java/com/android/virtualization/vmlauncher/MainActivity.java
index 33e4755..a103dd0 100644
--- a/vmlauncher_app/java/com/android/virtualization/vmlauncher/MainActivity.java
+++ b/vmlauncher_app/java/com/android/virtualization/vmlauncher/MainActivity.java
@@ -83,6 +83,7 @@
configBuilder.setCpuTopology(CPU_TOPOLOGY_MATCH_HOST);
configBuilder.setProtectedVm(false);
+ configBuilder.setNetworkSupported(true);
if (DEBUG) {
configBuilder.setDebugLevel(VirtualMachineConfig.DEBUG_LEVEL_FULL);
configBuilder.setVmOutputCaptured(true);
diff --git a/vmlauncher_app/res/xml/network_security_config.xml b/vmlauncher_app/res/xml/network_security_config.xml
deleted file mode 100644
index f27fa56..0000000
--- a/vmlauncher_app/res/xml/network_security_config.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (C) 2024 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.
- -->
-
-<network-security-config>
- <domain-config cleartextTrafficPermitted="true">
- <domain includeSubdomains="true">localhost</domain>
- </domain-config>
-</network-security-config>