Merge "Revert^2 "Use build.prop instead of buildinfo.prop"" into main
diff --git a/android/FerrochromeApp/AndroidManifest.xml b/android/FerrochromeApp/AndroidManifest.xml
index 7afffe5..d640c4a 100644
--- a/android/FerrochromeApp/AndroidManifest.xml
+++ b/android/FerrochromeApp/AndroidManifest.xml
@@ -6,6 +6,8 @@
<uses-permission android:name="android.permission.KILL_BACKGROUND_PROCESSES" />
<uses-permission android:name="android.permission.KILL_ALL_BACKGROUND_PROCESSES" />
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
+ <uses-permission android:name="com.android.virtualization.vmlauncher.permission.USE_VM_LAUNCHER" />
+
<queries>
<intent>
<action android:name="android.virtualization.VM_LAUNCHER" />
diff --git a/android/VmLauncherApp/AndroidManifest.xml b/android/VmLauncherApp/AndroidManifest.xml
index c6ab1f2..67b7a45 100644
--- a/android/VmLauncherApp/AndroidManifest.xml
+++ b/android/VmLauncherApp/AndroidManifest.xml
@@ -7,6 +7,10 @@
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-feature android:name="android.software.virtualization_framework" android:required="true" />
+
+ <permission android:name="com.android.virtualization.vmlauncher.permission.USE_VM_LAUNCHER"
+ android:protectionLevel="signature|preinstalled"/>
+
<application
android:label="VmLauncherApp">
<activity android:name=".MainActivity"
@@ -14,6 +18,7 @@
android:configChanges="orientation|screenSize|keyboard|keyboardHidden|navigation|uiMode"
android:theme="@style/MyTheme"
android:resizeableActivity="false"
+ android:permission="com.android.virtualization.vmlauncher.permission.USE_VM_LAUNCHER"
android:exported="true">
<intent-filter>
<action android:name="android.virtualization.VM_LAUNCHER" />
diff --git a/android/VmLauncherApp/java/com/android/virtualization/vmlauncher/MainActivity.java b/android/VmLauncherApp/java/com/android/virtualization/vmlauncher/MainActivity.java
index a93c173..9004c07 100644
--- a/android/VmLauncherApp/java/com/android/virtualization/vmlauncher/MainActivity.java
+++ b/android/VmLauncherApp/java/com/android/virtualization/vmlauncher/MainActivity.java
@@ -622,27 +622,30 @@
return mVirtualMachine.connectVsock(DATA_SHARING_SERVICE_PORT);
}
- private boolean writeClipboardToVm() {
- ClipboardManager clipboardManager = getClipboardManager();
- if (!clipboardManager.hasPrimaryClip()) {
- Log.d(TAG, "host device has no clipboard data");
- return true;
- }
- ClipData clip = clipboardManager.getPrimaryClip();
- String text = clip.getItemAt(0).getText().toString();
- byte[] header =
- constructClipboardHeader(
- WRITE_CLIPBOARD_TYPE_TEXT_PLAIN, text.getBytes().length + 1);
- try (ParcelFileDescriptor pfd = connectDataSharingService();
- OutputStream stream = new FileOutputStream(pfd.getFileDescriptor())) {
- stream.write(header);
- stream.write(text.getBytes());
- stream.write('\0');
- Log.d(TAG, "successfully wrote clipboard data to the VM");
- return true;
- } catch (IOException | VirtualMachineException e) {
- Log.e(TAG, "failed to write clipboard data to the VM", e);
- return false;
+ private void writeClipboardToVm() {
+ Log.d(TAG, "running writeClipboardToVm");
+ try (ParcelFileDescriptor pfd = connectDataSharingService()) {
+ ClipboardManager clipboardManager = getClipboardManager();
+ if (!clipboardManager.hasPrimaryClip()) {
+ Log.d(TAG, "host device has no clipboard data");
+ return;
+ }
+ ClipData clip = clipboardManager.getPrimaryClip();
+ String text = clip.getItemAt(0).getText().toString();
+
+ byte[] header =
+ constructClipboardHeader(
+ WRITE_CLIPBOARD_TYPE_TEXT_PLAIN, text.getBytes().length + 1);
+ try (OutputStream stream = new FileOutputStream(pfd.getFileDescriptor())) {
+ stream.write(header);
+ stream.write(text.getBytes());
+ stream.write('\0');
+ Log.d(TAG, "successfully wrote clipboard data to the VM");
+ } catch (IOException e) {
+ Log.e(TAG, "failed to write clipboard data to the VM", e);
+ }
+ } catch (Exception e) {
+ Log.e(TAG, "error on writeClipboardToVm", e);
}
}
@@ -654,23 +657,25 @@
return buf;
}
- private boolean readClipboardFromVm() {
- byte[] request = constructClipboardHeader(READ_CLIPBOARD_FROM_VM, 0);
+ private void readClipboardFromVm() {
+ Log.d(TAG, "running readClipboardFromVm");
try (ParcelFileDescriptor pfd = connectDataSharingService()) {
+ byte[] request = constructClipboardHeader(READ_CLIPBOARD_FROM_VM, 0);
try (OutputStream output = new FileOutputStream(pfd.getFileDescriptor())) {
output.write(request);
Log.d(TAG, "successfully send request to the VM for reading clipboard");
} catch (IOException e) {
- Log.e(TAG, "failed to send request to the VM for read clipboard");
+ Log.e(TAG, "failed to send request to the VM for reading clipboard");
throw e;
}
+
try (InputStream input = new FileInputStream(pfd.getFileDescriptor())) {
ByteBuffer header = ByteBuffer.wrap(readExactly(input, 8));
header.order(ByteOrder.LITTLE_ENDIAN);
switch (header.get(0)) {
case WRITE_CLIPBOARD_TYPE_EMPTY:
Log.d(TAG, "clipboard data in VM is empty");
- return true;
+ break;
case WRITE_CLIPBOARD_TYPE_TEXT_PLAIN:
int dataSize = header.getInt(4);
String text_data =
@@ -678,15 +683,17 @@
getClipboardManager()
.setPrimaryClip(ClipData.newPlainText(null, text_data));
Log.d(TAG, "successfully received clipboard data from VM");
- return true;
+ break;
default:
Log.e(TAG, "unknown clipboard response type");
- return false;
+ break;
}
+ } catch (IOException e) {
+ Log.e(TAG, "failed to receive clipboard content from VM");
+ throw e;
}
- } catch (IOException | VirtualMachineException e) {
- Log.e(TAG, "failed to receive clipboard content from the VM", e);
- return false;
+ } catch (Exception e) {
+ Log.e(TAG, "error on readClipboardFromVm", e);
}
}
@@ -699,16 +706,10 @@
surfaceView.requestPointerCapture();
}
if (mVirtualMachine != null) {
- try {
- if (hasFocus) {
- Log.d(TAG, "writing clipboard of host device into VM");
- writeClipboardToVm();
- } else {
- Log.d(TAG, "reading clipboard of VM");
- readClipboardFromVm();
- }
- } catch (Exception e) {
- Log.e(TAG, "read/write clipboard error", e);
+ if (hasFocus) {
+ mExecutorService.execute(() -> writeClipboardToVm());
+ } else {
+ mExecutorService.execute(() -> readClipboardFromVm());
}
}
}
diff --git a/compos/verify/Android.bp b/android/compos_verify/Android.bp
similarity index 100%
rename from compos/verify/Android.bp
rename to android/compos_verify/Android.bp
diff --git a/compos/verify/native/Android.bp b/android/compos_verify/native/Android.bp
similarity index 100%
rename from compos/verify/native/Android.bp
rename to android/compos_verify/native/Android.bp
diff --git a/compos/verify/native/lib.rs b/android/compos_verify/native/lib.rs
similarity index 100%
rename from compos/verify/native/lib.rs
rename to android/compos_verify/native/lib.rs
diff --git a/compos/verify/native/verify_native.cpp b/android/compos_verify/native/verify_native.cpp
similarity index 100%
rename from compos/verify/native/verify_native.cpp
rename to android/compos_verify/native/verify_native.cpp
diff --git a/compos/verify/native/verify_native.h b/android/compos_verify/native/verify_native.h
similarity index 100%
rename from compos/verify/native/verify_native.h
rename to android/compos_verify/native/verify_native.h
diff --git a/compos/verify/verify.rs b/android/compos_verify/verify.rs
similarity index 100%
rename from compos/verify/verify.rs
rename to android/compos_verify/verify.rs
diff --git a/compos/composd/Android.bp b/android/composd/Android.bp
similarity index 100%
rename from compos/composd/Android.bp
rename to android/composd/Android.bp
diff --git a/compos/composd/aidl/Android.bp b/android/composd/aidl/Android.bp
similarity index 100%
rename from compos/composd/aidl/Android.bp
rename to android/composd/aidl/Android.bp
diff --git a/compos/composd/aidl/android/system/composd/ICompilationTask.aidl b/android/composd/aidl/android/system/composd/ICompilationTask.aidl
similarity index 100%
rename from compos/composd/aidl/android/system/composd/ICompilationTask.aidl
rename to android/composd/aidl/android/system/composd/ICompilationTask.aidl
diff --git a/compos/composd/aidl/android/system/composd/ICompilationTaskCallback.aidl b/android/composd/aidl/android/system/composd/ICompilationTaskCallback.aidl
similarity index 100%
rename from compos/composd/aidl/android/system/composd/ICompilationTaskCallback.aidl
rename to android/composd/aidl/android/system/composd/ICompilationTaskCallback.aidl
diff --git a/compos/composd/aidl/android/system/composd/IIsolatedCompilationService.aidl b/android/composd/aidl/android/system/composd/IIsolatedCompilationService.aidl
similarity index 100%
rename from compos/composd/aidl/android/system/composd/IIsolatedCompilationService.aidl
rename to android/composd/aidl/android/system/composd/IIsolatedCompilationService.aidl
diff --git a/compos/composd/native/Android.bp b/android/composd/native/Android.bp
similarity index 100%
rename from compos/composd/native/Android.bp
rename to android/composd/native/Android.bp
diff --git a/compos/composd/native/lib.rs b/android/composd/native/lib.rs
similarity index 100%
rename from compos/composd/native/lib.rs
rename to android/composd/native/lib.rs
diff --git a/compos/composd/src/composd_main.rs b/android/composd/src/composd_main.rs
similarity index 100%
rename from compos/composd/src/composd_main.rs
rename to android/composd/src/composd_main.rs
diff --git a/compos/composd/src/fd_server_helper.rs b/android/composd/src/fd_server_helper.rs
similarity index 100%
rename from compos/composd/src/fd_server_helper.rs
rename to android/composd/src/fd_server_helper.rs
diff --git a/compos/composd/src/instance_manager.rs b/android/composd/src/instance_manager.rs
similarity index 100%
rename from compos/composd/src/instance_manager.rs
rename to android/composd/src/instance_manager.rs
diff --git a/compos/composd/src/instance_starter.rs b/android/composd/src/instance_starter.rs
similarity index 100%
rename from compos/composd/src/instance_starter.rs
rename to android/composd/src/instance_starter.rs
diff --git a/compos/composd/src/odrefresh_task.rs b/android/composd/src/odrefresh_task.rs
similarity index 100%
rename from compos/composd/src/odrefresh_task.rs
rename to android/composd/src/odrefresh_task.rs
diff --git a/compos/composd/src/service.rs b/android/composd/src/service.rs
similarity index 100%
rename from compos/composd/src/service.rs
rename to android/composd/src/service.rs
diff --git a/compos/composd_cmd/Android.bp b/android/composd_cmd/Android.bp
similarity index 100%
rename from compos/composd_cmd/Android.bp
rename to android/composd_cmd/Android.bp
diff --git a/compos/composd_cmd/composd_cmd.rs b/android/composd_cmd/composd_cmd.rs
similarity index 100%
rename from compos/composd_cmd/composd_cmd.rs
rename to android/composd_cmd/composd_cmd.rs
diff --git a/authfs/fd_server/Android.bp b/android/fd_server/Android.bp
similarity index 100%
rename from authfs/fd_server/Android.bp
rename to android/fd_server/Android.bp
diff --git a/authfs/TEST_MAPPING b/android/fd_server/TEST_MAPPING
similarity index 100%
copy from authfs/TEST_MAPPING
copy to android/fd_server/TEST_MAPPING
diff --git a/authfs/fd_server/src/aidl.rs b/android/fd_server/src/aidl.rs
similarity index 100%
rename from authfs/fd_server/src/aidl.rs
rename to android/fd_server/src/aidl.rs
diff --git a/authfs/fd_server/src/main.rs b/android/fd_server/src/main.rs
similarity index 100%
rename from authfs/fd_server/src/main.rs
rename to android/fd_server/src/main.rs
diff --git a/android/virtmgr/Android.bp b/android/virtmgr/Android.bp
index ae85934..a21ee6c 100644
--- a/android/virtmgr/Android.bp
+++ b/android/virtmgr/Android.bp
@@ -87,6 +87,14 @@
apex_available: ["com.android.virt"],
}
+rust_binary {
+ name: "early_virtmgr",
+ defaults: ["virtualizationmanager_defaults"],
+ srcs: ["src/main.rs"],
+ cfgs: ["early"],
+ apex_available: ["com.android.virt"],
+}
+
rust_test {
name: "virtualizationmanager_device_test",
srcs: ["src/main.rs"],
diff --git a/android/virtmgr/src/main.rs b/android/virtmgr/src/main.rs
index 4e88507..445260f 100644
--- a/android/virtmgr/src/main.rs
+++ b/android/virtmgr/src/main.rs
@@ -131,7 +131,11 @@
// Start thread pool for kernel Binder connection to VirtualizationServiceInternal.
ProcessState::start_thread_pool();
- GLOBAL_SERVICE.removeMemlockRlimit().expect("Failed to remove memlock rlimit");
+ if cfg!(early) {
+ panic!("Early VM not implemented");
+ } else {
+ GLOBAL_SERVICE.removeMemlockRlimit().expect("Failed to remove memlock rlimit");
+ }
let service = VirtualizationService::init();
let service =
diff --git a/build/apex/Android.bp b/build/apex/Android.bp
index 5e74aca..7a3ec8a 100644
--- a/build/apex/Android.bp
+++ b/build/apex/Android.bp
@@ -7,66 +7,15 @@
"microdroid_vbmeta",
]
-soong_config_module_type {
- name: "virt_apex",
- module_type: "apex",
- config_namespace: "ANDROID",
- bool_variables: [
- "avf_enabled",
- ],
- properties: [
- "defaults",
- "prebuilts",
- ],
-}
-
-virt_apex {
+apex {
name: "com.android.virt",
- soong_config_variables: {
- avf_enabled: {
- defaults: ["com.android.virt_avf_enabled"],
- conditions_default: {
- defaults: ["com.android.virt_avf_disabled"],
- },
- },
- },
+ defaults: select(soong_config_variable("ANDROID", "avf_enabled"), {
+ "true": ["com.android.virt_avf_enabled"],
+ default: ["com.android.virt_avf_disabled"],
+ }),
}
-soong_config_string_variable {
- name: "avf_microdroid_guest_gki_version",
- values: [
- "android15_66",
- ],
-}
-
-soong_config_module_type {
- name: "avf_flag_aware_apex_defaults",
- module_type: "apex_defaults",
- config_namespace: "ANDROID",
- bool_variables: [
- "release_avf_enable_device_assignment",
- "release_avf_enable_llpvm_changes",
- "release_avf_enable_network",
- "avf_remote_attestation_enabled",
- "release_avf_enable_vendor_modules",
- "release_avf_enable_virt_cpufreq",
- "release_avf_support_custom_vm_with_paravirtualized_devices",
- ],
- variables: [
- "avf_microdroid_guest_gki_version",
- ],
- properties: [
- "androidManifest",
- "arch",
- "canned_fs_config",
- "prebuilts",
- "systemserverclasspath_fragments",
- "vintf_fragments",
- "apps",
- ],
-}
-
-avf_flag_aware_apex_defaults {
+apex_defaults {
name: "com.android.virt_common",
// TODO(jiyong): make it updatable
updatable: false,
@@ -80,7 +29,10 @@
apps: [
"android.system.virtualmachine.res",
- ],
+ ] + select(release_flag("RELEASE_AVF_SUPPORT_CUSTOM_VM_WITH_PARAVIRTUALIZED_DEVICES"), {
+ true: ["VmLauncherApp"],
+ default: [],
+ }),
file_contexts: ":com.android.virt-file_contexts",
@@ -97,27 +49,19 @@
"libsso",
"libutils",
],
- soong_config_variables: {
- release_avf_enable_llpvm_changes: {
- systemserverclasspath_fragments: [
- "com.android.virt-systemserver-fragment",
- ],
- },
- release_avf_enable_virt_cpufreq: {
- canned_fs_config: "canned_fs_config_sys_nice",
- conditions_default: {
- canned_fs_config: "canned_fs_config",
- },
- },
- release_avf_support_custom_vm_with_paravirtualized_devices: {
- apps: [
- "VmLauncherApp",
- ],
- },
- },
+
+ systemserverclasspath_fragments: select(release_flag("RELEASE_AVF_ENABLE_LLPVM_CHANGES"), {
+ true: ["com.android.virt-systemserver-fragment"],
+ default: [],
+ }),
+
+ canned_fs_config: select(release_flag("RELEASE_AVF_ENABLE_VIRT_CPUFREQ"), {
+ true: "canned_fs_config_sys_nice",
+ default: "canned_fs_config",
+ }),
}
-avf_flag_aware_apex_defaults {
+apex_defaults {
name: "com.android.virt_avf_enabled",
defaults: ["com.android.virt_common"],
@@ -131,7 +75,13 @@
"crosvm",
"virtmgr",
"virtualizationservice",
- ],
+ ] + select(release_flag("RELEASE_AVF_ENABLE_DEVICE_ASSIGNMENT"), {
+ true: ["vfio_handler"],
+ default: [],
+ }) + select(release_flag("RELEASE_AVF_ENABLE_NETWORK"), {
+ true: ["vmnic"],
+ default: [],
+ }),
filesystems: microdroid_filesystem_images,
prebuilts: [
"rialto_bin",
@@ -142,14 +92,23 @@
"crosvm",
"virtmgr",
"virtualizationservice",
- ],
+ ] + select(release_flag("RELEASE_AVF_ENABLE_DEVICE_ASSIGNMENT"), {
+ true: ["vfio_handler"],
+ default: [],
+ }) + select(release_flag("RELEASE_AVF_ENABLE_NETWORK"), {
+ true: ["vmnic"],
+ default: [],
+ }),
filesystems: microdroid_filesystem_images,
},
},
binaries: [
"fd_server",
"vm",
- ],
+ ] + select(release_flag("RELEASE_AVF_ENABLE_EARLY_VM"), {
+ true: ["early_virtmgr"],
+ default: [],
+ }),
prebuilts: [
"features_com.android.virt.xml",
"microdroid_initrd_debuggable",
@@ -158,59 +117,35 @@
"microdroid_kernel",
"com.android.virt.init.rc",
"android_bootloader_crosvm_aarch64",
- ],
+ ] + select(soong_config_variable("ANDROID", "avf_microdroid_guest_gki_version"), {
+ "android15_66": [
+ "microdroid_gki-android15-6.6_initrd_debuggable",
+ "microdroid_gki-android15-6.6_initrd_normal",
+ "microdroid_gki-android15-6.6_kernel",
+ "microdroid_gki-android15-6.6.json",
+ ],
+ default: [],
+ }) + select(release_flag("RELEASE_AVF_ENABLE_DEVICE_ASSIGNMENT"), {
+ true: ["com.android.virt.vfio_handler.rc"],
+ default: [],
+ }) + select(release_flag("RELEASE_AVF_ENABLE_NETWORK"), {
+ true: ["com.android.virt.vmnic.rc"],
+ default: [],
+ }),
host_required: [
"vm_shell",
],
apps: [
"EmptyPayloadApp",
],
- soong_config_variables: {
- avf_microdroid_guest_gki_version: {
- android15_66: {
- prebuilts: [
- "microdroid_gki-android15-6.6_initrd_debuggable",
- "microdroid_gki-android15-6.6_initrd_normal",
- "microdroid_gki-android15-6.6_kernel",
- "microdroid_gki-android15-6.6.json",
- ],
- },
- },
- release_avf_enable_device_assignment: {
- prebuilts: [
- "com.android.virt.vfio_handler.rc",
- ],
- arch: {
- arm64: {
- binaries: ["vfio_handler"],
- },
- x86_64: {
- binaries: ["vfio_handler"],
- },
- },
- },
- release_avf_enable_llpvm_changes: {
- androidManifest: "AndroidManifest.xml",
- },
- release_avf_enable_network: {
- prebuilts: [
- "com.android.virt.vmnic.rc",
- ],
- arch: {
- arm64: {
- binaries: ["vmnic"],
- },
- x86_64: {
- binaries: ["vmnic"],
- },
- },
- },
- avf_remote_attestation_enabled: {
- vintf_fragments: [
- "virtualizationservice.xml",
- ],
- },
- },
+ androidManifest: select(release_flag("RELEASE_AVF_ENABLE_LLPVM_CHANGES"), {
+ true: "AndroidManifest.xml",
+ default: unset,
+ }),
+ vintf_fragments: select(soong_config_variable("ANDROID", "avf_remote_attestation_enabled"), {
+ "true": ["virtualizationservice.xml"],
+ default: unset,
+ }),
}
apex_defaults {
@@ -230,28 +165,17 @@
certificate: "com.android.virt",
}
-soong_config_module_type {
- name: "avf_flag_aware_genrule",
- module_type: "genrule",
- config_namespace: "ANDROID",
- bool_variables: [
- "release_avf_enable_llpvm_changes",
- "avf_remote_attestation_enabled",
- ],
- properties: ["srcs"],
-}
-
-avf_flag_aware_genrule {
+genrule {
name: "virtualizationservice_rc_combined",
- srcs: ["virtualizationservice.rc.base"],
- soong_config_variables: {
- release_avf_enable_llpvm_changes: {
- srcs: ["virtualizationservice.rc.llpvm"],
- },
- avf_remote_attestation_enabled: {
- srcs: ["virtualizationservice.rc.ra"],
- },
- },
+ srcs: [
+ "virtualizationservice.rc.base",
+ ] + select(release_flag("RELEASE_AVF_ENABLE_LLPVM_CHANGES"), {
+ true: ["virtualizationservice.rc.llpvm"],
+ default: [],
+ }) + select(soong_config_variable("ANDROID", "avf_remote_attestation_enabled"), {
+ "true": ["virtualizationservice.rc.ra"],
+ default: [],
+ }),
out: ["virtualizationservice.rc"],
cmd: "cat $(in) > $(out)",
}
@@ -401,28 +325,14 @@
},
}
-soong_config_module_type {
- name: "avf_flag_aware_systemserverclasspath_fragment",
- module_type: "systemserverclasspath_fragment",
- config_namespace: "ANDROID",
- bool_variables: [
- "release_avf_enable_llpvm_changes",
- ],
- properties: [
- "enabled",
- ],
-}
-
-avf_flag_aware_systemserverclasspath_fragment {
+systemserverclasspath_fragment {
name: "com.android.virt-systemserver-fragment",
contents: [
"service-virtualization",
],
apex_available: ["com.android.virt"],
- enabled: false,
- soong_config_variables: {
- release_avf_enable_llpvm_changes: {
- enabled: true,
- },
- },
+ enabled: select(release_flag("RELEASE_AVF_ENABLE_LLPVM_CHANGES"), {
+ true: true,
+ default: false,
+ }),
}
diff --git a/compos/apex/Android.bp b/build/compos/Android.bp
similarity index 100%
rename from compos/apex/Android.bp
rename to build/compos/Android.bp
diff --git a/compos/apk/Android.bp b/build/compos/CompOSPayloadApp/Android.bp
similarity index 100%
rename from compos/apk/Android.bp
rename to build/compos/CompOSPayloadApp/Android.bp
diff --git a/compos/apk/AndroidManifest.xml b/build/compos/CompOSPayloadApp/AndroidManifest.xml
similarity index 100%
rename from compos/apk/AndroidManifest.xml
rename to build/compos/CompOSPayloadApp/AndroidManifest.xml
diff --git a/compos/apk/assets/vm_config.json b/build/compos/CompOSPayloadApp/assets/vm_config.json
similarity index 100%
rename from compos/apk/assets/vm_config.json
rename to build/compos/CompOSPayloadApp/assets/vm_config.json
diff --git a/compos/apk/assets/vm_config_staged.json b/build/compos/CompOSPayloadApp/assets/vm_config_staged.json
similarity index 100%
rename from compos/apk/assets/vm_config_staged.json
rename to build/compos/CompOSPayloadApp/assets/vm_config_staged.json
diff --git a/compos/apk/assets/vm_config_system_ext.json b/build/compos/CompOSPayloadApp/assets/vm_config_system_ext.json
similarity index 100%
rename from compos/apk/assets/vm_config_system_ext.json
rename to build/compos/CompOSPayloadApp/assets/vm_config_system_ext.json
diff --git a/compos/apk/assets/vm_config_system_ext_staged.json b/build/compos/CompOSPayloadApp/assets/vm_config_system_ext_staged.json
similarity index 100%
rename from compos/apk/assets/vm_config_system_ext_staged.json
rename to build/compos/CompOSPayloadApp/assets/vm_config_system_ext_staged.json
diff --git a/compos/apex/com.android.compos.avbpubkey b/build/compos/com.android.compos.avbpubkey
similarity index 100%
rename from compos/apex/com.android.compos.avbpubkey
rename to build/compos/com.android.compos.avbpubkey
Binary files differ
diff --git a/compos/apex/com.android.compos.pem b/build/compos/com.android.compos.pem
similarity index 100%
rename from compos/apex/com.android.compos.pem
rename to build/compos/com.android.compos.pem
diff --git a/compos/apex/com.android.compos.pk8 b/build/compos/com.android.compos.pk8
similarity index 100%
rename from compos/apex/com.android.compos.pk8
rename to build/compos/com.android.compos.pk8
Binary files differ
diff --git a/compos/apex/com.android.compos.x509.pem b/build/compos/com.android.compos.x509.pem
similarity index 100%
rename from compos/apex/com.android.compos.x509.pem
rename to build/compos/com.android.compos.x509.pem
diff --git a/compos/apex/composd.rc b/build/compos/composd.rc
similarity index 100%
rename from compos/apex/composd.rc
rename to build/compos/composd.rc
diff --git a/compos/apex/manifest.json b/build/compos/manifest.json
similarity index 100%
rename from compos/apex/manifest.json
rename to build/compos/manifest.json
diff --git a/docs/custom_vm.md b/docs/custom_vm.md
index 6422678..cdeddf5 100644
--- a/docs/custom_vm.md
+++ b/docs/custom_vm.md
@@ -207,28 +207,17 @@
### Running the VM
-First, enable the `VmLauncherApp` app. This needs to be done only once. In the
-future, this step won't be necesssary.
+1. Grant permission to the `VmLauncherApp` if the virt apex is Google-signed.
+ ```shell
+ $ adb shell su root pm grant com.google.android.virtualization.vmlauncher android.permission.USE_CUSTOM_VIRTUAL_MACHINE
+ ```
-```
-$ adb root
-$ adb shell pm enable com.android.virtualization.vmlauncher/.MainActivityAlias
-$ adb unroot
-```
+2. Ensure your device is connected to the Internet.
-If virt apex is Google-signed, you need to enable the app and grant the
-permission to the app.
-```
-$ adb root
-$ adb shell pm enable com.google.android.virtualization.vmlauncher/com.android.virtualization.vmlauncher.MainActivityAlias
-$ adb shell pm grant com.google.android.virtualization.vmlauncher android.permission.USE_CUSTOM_VIRTUAL_MACHINE
-$ adb unroot
-```
-
-Second, ensure your device is connected to the Internet.
-
-Finally, tap the VmLauncherApp app from the launcher UI. You will see
-Ferrochrome booting!
+3. Launch the app with adb.
+ ```shell
+ $ adb shell su root am start-activity -a android.virtualization.VM_LAUNCHER
+ ```
If it doesn’t work well, try
diff --git a/guest/authfs/Android.bp b/guest/authfs/Android.bp
new file mode 100644
index 0000000..b11da3d
--- /dev/null
+++ b/guest/authfs/Android.bp
@@ -0,0 +1,52 @@
+package {
+ default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
+rust_defaults {
+ name: "authfs_defaults",
+ crate_name: "authfs",
+ edition: "2021",
+ srcs: [":authfs_src"],
+ rustlibs: [
+ "authfs_aidl_interface-rust",
+ "libandroid_logger",
+ "libanyhow",
+ "libauthfs_fsverity_metadata",
+ "libbinder_rs",
+ "libcfg_if",
+ "libclap",
+ "libfsverity_digests_proto_rust",
+ "libfuse_rust",
+ "libhex",
+ "liblibc",
+ "liblog_rust",
+ "libnix",
+ "libopenssl",
+ "libprotobuf",
+ "librpcbinder_rs",
+ "libthiserror",
+ ],
+ prefer_rlib: true,
+ target: {
+ darwin: {
+ enabled: false,
+ },
+ },
+ defaults: [
+ "crosvm_defaults",
+ "avf_build_flags_rust",
+ ],
+}
+
+filegroup {
+ name: "authfs_src",
+ srcs: [
+ "src/main.rs",
+ ],
+}
+
+rust_binary {
+ name: "authfs",
+ defaults: ["authfs_defaults"],
+ apex_available: ["com.android.virt"],
+}
diff --git a/authfs/TEST_MAPPING b/guest/authfs/TEST_MAPPING
similarity index 100%
rename from authfs/TEST_MAPPING
rename to guest/authfs/TEST_MAPPING
diff --git a/authfs/src/common.rs b/guest/authfs/src/common.rs
similarity index 100%
rename from authfs/src/common.rs
rename to guest/authfs/src/common.rs
diff --git a/authfs/src/file.rs b/guest/authfs/src/file.rs
similarity index 100%
rename from authfs/src/file.rs
rename to guest/authfs/src/file.rs
diff --git a/authfs/src/file/attr.rs b/guest/authfs/src/file/attr.rs
similarity index 100%
rename from authfs/src/file/attr.rs
rename to guest/authfs/src/file/attr.rs
diff --git a/authfs/src/file/dir.rs b/guest/authfs/src/file/dir.rs
similarity index 100%
rename from authfs/src/file/dir.rs
rename to guest/authfs/src/file/dir.rs
diff --git a/authfs/src/file/remote_file.rs b/guest/authfs/src/file/remote_file.rs
similarity index 100%
rename from authfs/src/file/remote_file.rs
rename to guest/authfs/src/file/remote_file.rs
diff --git a/authfs/src/fsstat.rs b/guest/authfs/src/fsstat.rs
similarity index 100%
rename from authfs/src/fsstat.rs
rename to guest/authfs/src/fsstat.rs
diff --git a/authfs/src/fsverity.rs b/guest/authfs/src/fsverity.rs
similarity index 100%
rename from authfs/src/fsverity.rs
rename to guest/authfs/src/fsverity.rs
diff --git a/authfs/src/fsverity/builder.rs b/guest/authfs/src/fsverity/builder.rs
similarity index 100%
rename from authfs/src/fsverity/builder.rs
rename to guest/authfs/src/fsverity/builder.rs
diff --git a/authfs/src/fsverity/common.rs b/guest/authfs/src/fsverity/common.rs
similarity index 100%
rename from authfs/src/fsverity/common.rs
rename to guest/authfs/src/fsverity/common.rs
diff --git a/authfs/src/fsverity/editor.rs b/guest/authfs/src/fsverity/editor.rs
similarity index 100%
rename from authfs/src/fsverity/editor.rs
rename to guest/authfs/src/fsverity/editor.rs
diff --git a/authfs/src/fsverity/metadata/Android.bp b/guest/authfs/src/fsverity/metadata/Android.bp
similarity index 100%
rename from authfs/src/fsverity/metadata/Android.bp
rename to guest/authfs/src/fsverity/metadata/Android.bp
diff --git a/authfs/src/fsverity/metadata/metadata.hpp b/guest/authfs/src/fsverity/metadata/metadata.hpp
similarity index 100%
rename from authfs/src/fsverity/metadata/metadata.hpp
rename to guest/authfs/src/fsverity/metadata/metadata.hpp
diff --git a/authfs/src/fsverity/metadata/metadata.rs b/guest/authfs/src/fsverity/metadata/metadata.rs
similarity index 100%
rename from authfs/src/fsverity/metadata/metadata.rs
rename to guest/authfs/src/fsverity/metadata/metadata.rs
diff --git a/authfs/src/fsverity/sys.rs b/guest/authfs/src/fsverity/sys.rs
similarity index 100%
rename from authfs/src/fsverity/sys.rs
rename to guest/authfs/src/fsverity/sys.rs
diff --git a/authfs/src/fsverity/verifier.rs b/guest/authfs/src/fsverity/verifier.rs
similarity index 100%
rename from authfs/src/fsverity/verifier.rs
rename to guest/authfs/src/fsverity/verifier.rs
diff --git a/authfs/src/fusefs.rs b/guest/authfs/src/fusefs.rs
similarity index 98%
rename from authfs/src/fusefs.rs
rename to guest/authfs/src/fusefs.rs
index ab75dac..618b8ac 100644
--- a/authfs/src/fusefs.rs
+++ b/guest/authfs/src/fusefs.rs
@@ -99,9 +99,9 @@
/// Number of `Handle`s (i.e. file descriptors) that are currently referring to the this inode.
///
/// Technically, this does not matter to readonly entries, since they live forever. The
- /// reference count is only needed for manageing lifetime of writable entries like `VerifiedNew`
- /// and `VerifiedNewDirectory`. That is, when an entry is deleted, the actual entry needs to
- /// stay alive until the reference count reaches zero.
+ /// reference count is only needed for manageing lifetime of writable entries like
+ /// `VerifiedNew` and `VerifiedNewDirectory`. That is, when an entry is deleted, the actual
+ /// entry needs to stay alive until the reference count reaches zero.
///
/// Note: This is not to be confused with hardlinks, which AuthFS doesn't currently implement.
handle_ref_count: AtomicU64,
@@ -192,9 +192,9 @@
/// The next available inode number.
next_inode: AtomicU64,
- /// Table for `Handle` to `Arc<DirEntriesSnapshot>` lookup. On `opendir`, a new directory handle
- /// is created and the snapshot of the current directory is created. This is not super
- /// efficient, but is the simplest way to be compliant to the FUSE contract (see
+ /// Table for `Handle` to `Arc<DirEntriesSnapshot>` lookup. On `opendir`, a new directory
+ /// handle is created and the snapshot of the current directory is created. This is not
+ /// super efficient, but is the simplest way to be compliant to the FUSE contract (see
/// `fuse::filesystem::readdir`).
///
/// Currently, no code locks `dir_handle_table` and `inode_table` at the same time to avoid
@@ -822,9 +822,9 @@
self.handle_inode(&inode, |config| {
match config {
AuthFsEntry::VerifiedNew { editor, .. } => {
- // FUSE ioctl is limited, thus we can't implement fs-verity ioctls without a kernel
- // change (see b/196635431). Until it's possible, use xattr to expose what we need
- // as an authfs specific API.
+ // FUSE ioctl is limited, thus we can't implement fs-verity ioctls without a
+ // kernel change (see b/196635431). Until it's possible, use
+ // xattr to expose what we need as an authfs specific API.
if name != CStr::from_bytes_with_nul(b"authfs.fsverity.digest\0").unwrap() {
return Err(io::Error::from_raw_os_error(libc::ENODATA));
}
diff --git a/authfs/src/fusefs/file.rs b/guest/authfs/src/fusefs/file.rs
similarity index 100%
rename from authfs/src/fusefs/file.rs
rename to guest/authfs/src/fusefs/file.rs
diff --git a/authfs/src/fusefs/mount.rs b/guest/authfs/src/fusefs/mount.rs
similarity index 100%
rename from authfs/src/fusefs/mount.rs
rename to guest/authfs/src/fusefs/mount.rs
diff --git a/authfs/src/main.rs b/guest/authfs/src/main.rs
similarity index 100%
rename from authfs/src/main.rs
rename to guest/authfs/src/main.rs
diff --git a/authfs/service/Android.bp b/guest/authfs_service/Android.bp
similarity index 100%
rename from authfs/service/Android.bp
rename to guest/authfs_service/Android.bp
diff --git a/authfs/TEST_MAPPING b/guest/authfs_service/TEST_MAPPING
similarity index 100%
copy from authfs/TEST_MAPPING
copy to guest/authfs_service/TEST_MAPPING
diff --git a/authfs/service/authfs_service.rc b/guest/authfs_service/authfs_service.rc
similarity index 100%
rename from authfs/service/authfs_service.rc
rename to guest/authfs_service/authfs_service.rc
diff --git a/authfs/service/src/authfs.rs b/guest/authfs_service/src/authfs.rs
similarity index 100%
rename from authfs/service/src/authfs.rs
rename to guest/authfs_service/src/authfs.rs
diff --git a/authfs/service/src/main.rs b/guest/authfs_service/src/main.rs
similarity index 100%
rename from authfs/service/src/main.rs
rename to guest/authfs_service/src/main.rs
diff --git a/compos/compos_key_helper/Android.bp b/guest/compos_key_helper/Android.bp
similarity index 100%
rename from compos/compos_key_helper/Android.bp
rename to guest/compos_key_helper/Android.bp
diff --git a/compos/compos_key_helper/compos_key.cpp b/guest/compos_key_helper/compos_key.cpp
similarity index 100%
rename from compos/compos_key_helper/compos_key.cpp
rename to guest/compos_key_helper/compos_key.cpp
diff --git a/compos/compos_key_helper/compos_key.h b/guest/compos_key_helper/compos_key.h
similarity index 100%
rename from compos/compos_key_helper/compos_key.h
rename to guest/compos_key_helper/compos_key.h
diff --git a/compos/compos_key_helper/compos_key_main.cpp b/guest/compos_key_helper/compos_key_main.cpp
similarity index 100%
rename from compos/compos_key_helper/compos_key_main.cpp
rename to guest/compos_key_helper/compos_key_main.cpp
diff --git a/compos/compos_key_helper/compos_key_test.cpp b/guest/compos_key_helper/compos_key_test.cpp
similarity index 100%
rename from compos/compos_key_helper/compos_key_test.cpp
rename to guest/compos_key_helper/compos_key_test.cpp
diff --git a/compos/compos_key_helper/tests/AndroidTest.xml b/guest/compos_key_helper/tests/AndroidTest.xml
similarity index 100%
rename from compos/compos_key_helper/tests/AndroidTest.xml
rename to guest/compos_key_helper/tests/AndroidTest.xml
diff --git a/compos/Android.bp b/guest/compsvc/Android.bp
similarity index 100%
rename from compos/Android.bp
rename to guest/compsvc/Android.bp
diff --git a/compos/src/artifact_signer.rs b/guest/compsvc/src/artifact_signer.rs
similarity index 100%
rename from compos/src/artifact_signer.rs
rename to guest/compsvc/src/artifact_signer.rs
diff --git a/compos/src/compilation.rs b/guest/compsvc/src/compilation.rs
similarity index 100%
rename from compos/src/compilation.rs
rename to guest/compsvc/src/compilation.rs
diff --git a/compos/src/compos_key.rs b/guest/compsvc/src/compos_key.rs
similarity index 100%
rename from compos/src/compos_key.rs
rename to guest/compsvc/src/compos_key.rs
diff --git a/compos/src/compsvc.rs b/guest/compsvc/src/compsvc.rs
similarity index 100%
rename from compos/src/compsvc.rs
rename to guest/compsvc/src/compsvc.rs
diff --git a/compos/src/compsvc_main.rs b/guest/compsvc/src/compsvc_main.rs
similarity index 100%
rename from compos/src/compsvc_main.rs
rename to guest/compsvc/src/compsvc_main.rs
diff --git a/compos/src/fsverity.rs b/guest/compsvc/src/fsverity.rs
similarity index 100%
rename from compos/src/fsverity.rs
rename to guest/compsvc/src/fsverity.rs
diff --git a/authfs/aidl/Android.bp b/libs/authfs_aidl_interface/Android.bp
similarity index 100%
rename from authfs/aidl/Android.bp
rename to libs/authfs_aidl_interface/Android.bp
diff --git a/authfs/TEST_MAPPING b/libs/authfs_aidl_interface/TEST_MAPPING
similarity index 100%
copy from authfs/TEST_MAPPING
copy to libs/authfs_aidl_interface/TEST_MAPPING
diff --git a/authfs/aidl/com/android/virt/fs/AuthFsConfig.aidl b/libs/authfs_aidl_interface/com/android/virt/fs/AuthFsConfig.aidl
similarity index 100%
rename from authfs/aidl/com/android/virt/fs/AuthFsConfig.aidl
rename to libs/authfs_aidl_interface/com/android/virt/fs/AuthFsConfig.aidl
diff --git a/authfs/aidl/com/android/virt/fs/IAuthFs.aidl b/libs/authfs_aidl_interface/com/android/virt/fs/IAuthFs.aidl
similarity index 100%
rename from authfs/aidl/com/android/virt/fs/IAuthFs.aidl
rename to libs/authfs_aidl_interface/com/android/virt/fs/IAuthFs.aidl
diff --git a/authfs/aidl/com/android/virt/fs/IAuthFsService.aidl b/libs/authfs_aidl_interface/com/android/virt/fs/IAuthFsService.aidl
similarity index 100%
rename from authfs/aidl/com/android/virt/fs/IAuthFsService.aidl
rename to libs/authfs_aidl_interface/com/android/virt/fs/IAuthFsService.aidl
diff --git a/authfs/aidl/com/android/virt/fs/IVirtFdService.aidl b/libs/authfs_aidl_interface/com/android/virt/fs/IVirtFdService.aidl
similarity index 100%
rename from authfs/aidl/com/android/virt/fs/IVirtFdService.aidl
rename to libs/authfs_aidl_interface/com/android/virt/fs/IVirtFdService.aidl
diff --git a/compos/aidl/Android.bp b/libs/compos_aidl_interface/Android.bp
similarity index 100%
rename from compos/aidl/Android.bp
rename to libs/compos_aidl_interface/Android.bp
diff --git a/compos/aidl/com/android/compos/ICompOsService.aidl b/libs/compos_aidl_interface/com/android/compos/ICompOsService.aidl
similarity index 100%
rename from compos/aidl/com/android/compos/ICompOsService.aidl
rename to libs/compos_aidl_interface/com/android/compos/ICompOsService.aidl
diff --git a/compos/common/Android.bp b/libs/libcompos_common/Android.bp
similarity index 100%
rename from compos/common/Android.bp
rename to libs/libcompos_common/Android.bp
diff --git a/compos/common/binder.rs b/libs/libcompos_common/binder.rs
similarity index 100%
rename from compos/common/binder.rs
rename to libs/libcompos_common/binder.rs
diff --git a/compos/common/compos_client.rs b/libs/libcompos_common/compos_client.rs
similarity index 100%
rename from compos/common/compos_client.rs
rename to libs/libcompos_common/compos_client.rs
diff --git a/compos/common/lib.rs b/libs/libcompos_common/lib.rs
similarity index 100%
rename from compos/common/lib.rs
rename to libs/libcompos_common/lib.rs
diff --git a/compos/common/odrefresh.rs b/libs/libcompos_common/odrefresh.rs
similarity index 100%
rename from compos/common/odrefresh.rs
rename to libs/libcompos_common/odrefresh.rs
diff --git a/compos/common/timeouts.rs b/libs/libcompos_common/timeouts.rs
similarity index 100%
rename from compos/common/timeouts.rs
rename to libs/libcompos_common/timeouts.rs
diff --git a/compos/service/Android.bp b/libs/service-compos/Android.bp
similarity index 100%
rename from compos/service/Android.bp
rename to libs/service-compos/Android.bp
diff --git a/compos/service/java/com/android/server/compos/IsolatedCompilationJobService.java b/libs/service-compos/java/com/android/server/compos/IsolatedCompilationJobService.java
similarity index 89%
rename from compos/service/java/com/android/server/compos/IsolatedCompilationJobService.java
rename to libs/service-compos/java/com/android/server/compos/IsolatedCompilationJobService.java
index 933ac7a..adc0300 100644
--- a/compos/service/java/com/android/server/compos/IsolatedCompilationJobService.java
+++ b/libs/service-compos/java/com/android/server/compos/IsolatedCompilationJobService.java
@@ -52,14 +52,16 @@
ComponentName serviceName =
new ComponentName("android", IsolatedCompilationJobService.class.getName());
- int result = scheduler.schedule(new JobInfo.Builder(STAGED_APEX_JOB_ID, serviceName)
- // Wait in case more APEXes are staged
- .setMinimumLatency(TimeUnit.MINUTES.toMillis(60))
- // We consume CPU, power, and storage
- .setRequiresDeviceIdle(true)
- .setRequiresCharging(true)
- .setRequiresStorageNotLow(true)
- .build());
+ int result =
+ scheduler.schedule(
+ new JobInfo.Builder(STAGED_APEX_JOB_ID, serviceName)
+ // Wait in case more APEXes are staged
+ .setMinimumLatency(TimeUnit.MINUTES.toMillis(60))
+ // We consume CPU, power, and storage
+ .setRequiresDeviceIdle(true)
+ .setRequiresCharging(true)
+ .setRequiresStorageNotLow(true)
+ .build());
if (result == JobScheduler.RESULT_SUCCESS) {
IsolatedCompilationMetrics.onCompilationScheduled(
IsolatedCompilationMetrics.SCHEDULING_SUCCESS);
@@ -86,13 +88,14 @@
if (oldJob != null) {
// We're already running a job, give up on this one
Log.w(TAG, "Another job is in progress, skipping");
- return false; // Already finished
+ return false; // Already finished
}
IsolatedCompilationMetrics metrics = new IsolatedCompilationMetrics();
- CompilationJob newJob = new CompilationJob(IsolatedCompilationJobService.this::onCompletion,
- params, metrics);
+ CompilationJob newJob =
+ new CompilationJob(
+ IsolatedCompilationJobService.this::onCompletion, params, metrics);
mCurrentJob.set(newJob);
// This can take some time - we need to start up a VM - so we do it on a separate
@@ -108,7 +111,7 @@
metrics.onCompilationEnded(IsolatedCompilationMetrics.RESULT_FAILED_TO_START);
mCurrentJob.set(null);
newJob.stop(); // Just in case it managed to start before failure
- jobFinished(params, /*wantReschedule=*/ false);
+ jobFinished(params, /* wantReschedule= */ false);
}
}
}.start();
@@ -137,7 +140,7 @@
// On success we don't need to reschedule.
// On failure we could reschedule, but that could just use a lot of resources and still
// fail; instead we just let odsign do compilation on reboot if necessary.
- jobFinished(params, /*wantReschedule=*/ false);
+ jobFinished(params, /* wantReschedule= */ false);
}
interface CompilationCallback {
@@ -152,7 +155,9 @@
private final JobParameters mParams;
private volatile boolean mStopRequested = false;
- CompilationJob(CompilationCallback callback, JobParameters params,
+ CompilationJob(
+ CompilationCallback callback,
+ JobParameters params,
IsolatedCompilationMetrics metrics) {
mCallback = requireNonNull(callback);
mParams = params;
diff --git a/compos/service/java/com/android/server/compos/IsolatedCompilationMetrics.java b/libs/service-compos/java/com/android/server/compos/IsolatedCompilationMetrics.java
similarity index 77%
rename from compos/service/java/com/android/server/compos/IsolatedCompilationMetrics.java
rename to libs/service-compos/java/com/android/server/compos/IsolatedCompilationMetrics.java
index f7799a4..0419a55 100644
--- a/compos/service/java/com/android/server/compos/IsolatedCompilationMetrics.java
+++ b/libs/service-compos/java/com/android/server/compos/IsolatedCompilationMetrics.java
@@ -61,10 +61,11 @@
ArtStatsLog.ISOLATED_COMPILATION_ENDED__COMPILATION_RESULT__RESULT_FAILED_TO_START;
public static final int RESULT_JOB_CANCELED =
ArtStatsLog.ISOLATED_COMPILATION_ENDED__COMPILATION_RESULT__RESULT_JOB_CANCELED;
- public static final int RESULT_COMPILATION_FAILED = ArtStatsLog
- .ISOLATED_COMPILATION_ENDED__COMPILATION_RESULT__RESULT_COMPILATION_FAILED;
- public static final int RESULT_UNEXPECTED_COMPILATION_RESULT = ArtStatsLog
- .ISOLATED_COMPILATION_ENDED__COMPILATION_RESULT__RESULT_UNEXPECTED_COMPILATION_RESULT;
+ public static final int RESULT_COMPILATION_FAILED =
+ ArtStatsLog.ISOLATED_COMPILATION_ENDED__COMPILATION_RESULT__RESULT_COMPILATION_FAILED;
+ public static final int RESULT_UNEXPECTED_COMPILATION_RESULT =
+ ArtStatsLog
+ .ISOLATED_COMPILATION_ENDED__COMPILATION_RESULT__RESULT_UNEXPECTED_COMPILATION_RESULT;
public static final int RESULT_COMPOSD_DIED =
ArtStatsLog.ISOLATED_COMPILATION_ENDED__COMPILATION_RESULT__RESULT_COMPOSD_DIED;
public static final int RESULT_FAILED_TO_ENABLE_FSVERITY =
@@ -78,8 +79,9 @@
// Keep this in sync with Result enum in IsolatedCompilationScheduled in
// frameworks/proto_logging/stats/atoms.proto
- public static final int SCHEDULING_RESULT_UNKNOWN = ArtStatsLog
- .ISOLATED_COMPILATION_SCHEDULED__SCHEDULING_RESULT__SCHEDULING_RESULT_UNKNOWN;
+ public static final int SCHEDULING_RESULT_UNKNOWN =
+ ArtStatsLog
+ .ISOLATED_COMPILATION_SCHEDULED__SCHEDULING_RESULT__SCHEDULING_RESULT_UNKNOWN;
public static final int SCHEDULING_FAILURE =
ArtStatsLog.ISOLATED_COMPILATION_SCHEDULED__SCHEDULING_RESULT__SCHEDULING_FAILURE;
public static final int SCHEDULING_SUCCESS =
@@ -104,16 +106,24 @@
statsLogPostCompilation(result, JobParameters.STOP_REASON_UNDEFINED);
}
- private void statsLogPostCompilation(@CompilationResult int result,
- @JobParameters.StopReason int jobStopReason) {
+ private void statsLogPostCompilation(
+ @CompilationResult int result, @JobParameters.StopReason int jobStopReason) {
- long compilationTime = mCompilationStartTimeMs == 0 ? -1
- : SystemClock.elapsedRealtime() - mCompilationStartTimeMs;
+ long compilationTime =
+ mCompilationStartTimeMs == 0
+ ? -1
+ : SystemClock.elapsedRealtime() - mCompilationStartTimeMs;
mCompilationStartTimeMs = 0;
- ArtStatsLog.write(ArtStatsLog.ISOLATED_COMPILATION_ENDED, compilationTime,
- result, jobStopReason);
- Log.i(TAG, "ISOLATED_COMPILATION_ENDED: " + result + ", " + compilationTime
- + ", " + jobStopReason);
+ ArtStatsLog.write(
+ ArtStatsLog.ISOLATED_COMPILATION_ENDED, compilationTime, result, jobStopReason);
+ Log.i(
+ TAG,
+ "ISOLATED_COMPILATION_ENDED: "
+ + result
+ + ", "
+ + compilationTime
+ + ", "
+ + jobStopReason);
}
}
diff --git a/compos/service/java/com/android/server/compos/IsolatedCompilationService.java b/libs/service-compos/java/com/android/server/compos/IsolatedCompilationService.java
similarity index 94%
rename from compos/service/java/com/android/server/compos/IsolatedCompilationService.java
rename to libs/service-compos/java/com/android/server/compos/IsolatedCompilationService.java
index b2fcbe0..95e365d 100644
--- a/compos/service/java/com/android/server/compos/IsolatedCompilationService.java
+++ b/libs/service-compos/java/com/android/server/compos/IsolatedCompilationService.java
@@ -60,7 +60,6 @@
return;
}
-
JobScheduler scheduler = getContext().getSystemService(JobScheduler.class);
if (scheduler == null) {
Log.e(TAG, "No scheduler");
@@ -92,8 +91,9 @@
private final IPackageManagerNative mPackageNative;
static void registerForStagedApexUpdates(JobScheduler scheduler) {
- final IPackageManagerNative packageNative = IPackageManagerNative.Stub.asInterface(
- ServiceManager.getService("package_native"));
+ final IPackageManagerNative packageNative =
+ IPackageManagerNative.Stub.asInterface(
+ ServiceManager.getService("package_native"));
if (packageNative == null) {
Log.e(TAG, "No IPackageManagerNative");
return;
@@ -110,8 +110,7 @@
}
}
- private StagedApexObserver(JobScheduler scheduler,
- IPackageManagerNative packageNative) {
+ private StagedApexObserver(JobScheduler scheduler, IPackageManagerNative packageNative) {
mScheduler = scheduler;
mPackageNative = packageNative;
}
diff --git a/compos/benchmark/Android.bp b/tests/ComposBenchmarkApp/Android.bp
similarity index 100%
rename from compos/benchmark/Android.bp
rename to tests/ComposBenchmarkApp/Android.bp
diff --git a/compos/benchmark/AndroidManifest.xml b/tests/ComposBenchmarkApp/AndroidManifest.xml
similarity index 100%
rename from compos/benchmark/AndroidManifest.xml
rename to tests/ComposBenchmarkApp/AndroidManifest.xml
diff --git a/compos/benchmark/AndroidTest.xml b/tests/ComposBenchmarkApp/AndroidTest.xml
similarity index 100%
rename from compos/benchmark/AndroidTest.xml
rename to tests/ComposBenchmarkApp/AndroidTest.xml
diff --git a/compos/benchmark/src/java/com/android/compos/benchmark/ComposBenchmark.java b/tests/ComposBenchmarkApp/src/java/com/android/compos/benchmark/ComposBenchmark.java
similarity index 100%
rename from compos/benchmark/src/java/com/android/compos/benchmark/ComposBenchmark.java
rename to tests/ComposBenchmarkApp/src/java/com/android/compos/benchmark/ComposBenchmark.java
diff --git a/compos/tests/Android.bp b/tests/ComposHostTestCases/Android.bp
similarity index 100%
rename from compos/tests/Android.bp
rename to tests/ComposHostTestCases/Android.bp
diff --git a/compos/tests/AndroidTest.xml b/tests/ComposHostTestCases/AndroidTest.xml
similarity index 100%
rename from compos/tests/AndroidTest.xml
rename to tests/ComposHostTestCases/AndroidTest.xml
diff --git a/compos/tests/java/android/compos/test/ComposTestCase.java b/tests/ComposHostTestCases/java/android/compos/test/ComposTestCase.java
similarity index 90%
rename from compos/tests/java/android/compos/test/ComposTestCase.java
rename to tests/ComposHostTestCases/java/android/compos/test/ComposTestCase.java
index b31f4f3..7a35829 100644
--- a/compos/tests/java/android/compos/test/ComposTestCase.java
+++ b/tests/ComposHostTestCases/java/android/compos/test/ComposTestCase.java
@@ -54,8 +54,7 @@
// Binaries used in test. (These paths are valid both in host and Microdroid.)
private static final String ODREFRESH_BIN = "/apex/com.android.art/bin/odrefresh";
private static final String COMPOSD_CMD_BIN = "/apex/com.android.compos/bin/composd_cmd";
- private static final String COMPOS_VERIFY_BIN =
- "/apex/com.android.compos/bin/compos_verify";
+ private static final String COMPOS_VERIFY_BIN = "/apex/com.android.compos/bin/compos_verify";
private static final String COMPOS_APEXDATA_DIR = "/data/misc/apexdata/com.android.compos";
@@ -111,10 +110,13 @@
android.tryRun("rm", "-rf", ODREFRESH_OUTPUT_DIR);
if (mBackupSystemServerCompilerFilter != null) {
- CLog.d("Restore dalvik.vm.systemservercompilerfilter to "
- + mBackupSystemServerCompilerFilter);
- getDevice().setProperty(SYSTEM_SERVER_COMPILER_FILTER_PROP_NAME,
- mBackupSystemServerCompilerFilter);
+ CLog.d(
+ "Restore dalvik.vm.systemservercompilerfilter to "
+ + mBackupSystemServerCompilerFilter);
+ getDevice()
+ .setProperty(
+ SYSTEM_SERVER_COMPILER_FILTER_PROP_NAME,
+ mBackupSystemServerCompilerFilter);
}
}
@@ -143,8 +145,8 @@
}
// Save the expected checksum for the output directory.
- String expectedChecksumSnapshot = checksumDirectoryContentPartial(android,
- ODREFRESH_OUTPUT_DIR);
+ String expectedChecksumSnapshot =
+ checksumDirectoryContentPartial(android, ODREFRESH_OUTPUT_DIR);
// --check may delete the output.
CommandResult result = runOdrefresh(android, "--check");
@@ -166,8 +168,8 @@
assertVmBccIsValid();
// Save the actual checksum for the output directory.
- String actualChecksumSnapshot = checksumDirectoryContentPartial(android,
- ODREFRESH_OUTPUT_DIR);
+ String actualChecksumSnapshot =
+ checksumDirectoryContentPartial(android, ODREFRESH_OUTPUT_DIR);
// Expect the output of Comp OS to be the same as compiled on Android.
assertThat(actualChecksumSnapshot).isEqualTo(expectedChecksumSnapshot);
@@ -185,11 +187,12 @@
assertThat(bcc_file).isNotNull();
// Add the BCC to test artifacts, in case it is ill-formed or otherwise interesting.
- mTestLogs.addTestLog(bcc_file.getPath(), LogDataType.UNKNOWN,
- new FileInputStreamSource(bcc_file));
+ mTestLogs.addTestLog(
+ bcc_file.getPath(), LogDataType.UNKNOWN, new FileInputStreamSource(bcc_file));
// Find the validator binary - note that it's specified as a dependency in our Android.bp.
- File validator = getTestInformation().getDependencyFile("hwtrust", /*targetFirst=*/ false);
+ File validator =
+ getTestInformation().getDependencyFile("hwtrust", /* targetFirst= */ false);
CommandResult result =
new RunUtil()
diff --git a/authfs/Android.bp b/tests/authfs/Android.bp
similarity index 60%
rename from authfs/Android.bp
rename to tests/authfs/Android.bp
index e04d5e1..aa814eb 100644
--- a/authfs/Android.bp
+++ b/tests/authfs/Android.bp
@@ -1,51 +1,3 @@
-package {
- default_applicable_licenses: ["Android-Apache-2.0"],
-}
-
-rust_defaults {
- name: "authfs_defaults",
- crate_name: "authfs",
- srcs: [
- "src/main.rs",
- ],
- edition: "2021",
- rustlibs: [
- "authfs_aidl_interface-rust",
- "libandroid_logger",
- "libanyhow",
- "libauthfs_fsverity_metadata",
- "libbinder_rs",
- "libcfg_if",
- "libclap",
- "libfsverity_digests_proto_rust",
- "libfuse_rust",
- "libhex",
- "liblibc",
- "liblog_rust",
- "libnix",
- "libopenssl",
- "libprotobuf",
- "librpcbinder_rs",
- "libthiserror",
- ],
- prefer_rlib: true,
- target: {
- darwin: {
- enabled: false,
- },
- },
- defaults: [
- "crosvm_defaults",
- "avf_build_flags_rust",
- ],
-}
-
-rust_binary {
- name: "authfs",
- defaults: ["authfs_defaults"],
- apex_available: ["com.android.virt"],
-}
-
rust_test {
name: "authfs_device_test_src_lib",
defaults: ["authfs_defaults"],
diff --git a/authfs/TEST_MAPPING b/tests/authfs/TEST_MAPPING
similarity index 100%
copy from authfs/TEST_MAPPING
copy to tests/authfs/TEST_MAPPING
diff --git a/authfs/tests/benchmarks/Android.bp b/tests/authfs/benchmarks/Android.bp
similarity index 100%
rename from authfs/tests/benchmarks/Android.bp
rename to tests/authfs/benchmarks/Android.bp
diff --git a/authfs/tests/benchmarks/AndroidTest.xml b/tests/authfs/benchmarks/AndroidTest.xml
similarity index 100%
rename from authfs/tests/benchmarks/AndroidTest.xml
rename to tests/authfs/benchmarks/AndroidTest.xml
diff --git a/authfs/tests/benchmarks/src/java/com/android/fs/benchmarks/AuthFsBenchmarks.java b/tests/authfs/benchmarks/src/java/com/android/fs/benchmarks/AuthFsBenchmarks.java
similarity index 99%
rename from authfs/tests/benchmarks/src/java/com/android/fs/benchmarks/AuthFsBenchmarks.java
rename to tests/authfs/benchmarks/src/java/com/android/fs/benchmarks/AuthFsBenchmarks.java
index 085d06e..abda3e3 100644
--- a/authfs/tests/benchmarks/src/java/com/android/fs/benchmarks/AuthFsBenchmarks.java
+++ b/tests/authfs/benchmarks/src/java/com/android/fs/benchmarks/AuthFsBenchmarks.java
@@ -18,7 +18,6 @@
import static com.android.tradefed.testtype.DeviceJUnit4ClassRunner.TestMetrics;
-
import static org.junit.Assume.assumeFalse;
import static org.junit.Assume.assumeTrue;
diff --git a/authfs/tests/benchmarks/src/measure_io.cpp b/tests/authfs/benchmarks/src/measure_io.cpp
similarity index 100%
rename from authfs/tests/benchmarks/src/measure_io.cpp
rename to tests/authfs/benchmarks/src/measure_io.cpp
diff --git a/authfs/tests/common/Android.bp b/tests/authfs/common/Android.bp
similarity index 100%
rename from authfs/tests/common/Android.bp
rename to tests/authfs/common/Android.bp
diff --git a/authfs/tests/common/src/java/com/android/fs/common/AuthFsTestRule.java b/tests/authfs/common/src/java/com/android/fs/common/AuthFsTestRule.java
similarity index 100%
rename from authfs/tests/common/src/java/com/android/fs/common/AuthFsTestRule.java
rename to tests/authfs/common/src/java/com/android/fs/common/AuthFsTestRule.java
diff --git a/authfs/tests/common/src/open_then_run.rs b/tests/authfs/common/src/open_then_run.rs
similarity index 100%
rename from authfs/tests/common/src/open_then_run.rs
rename to tests/authfs/common/src/open_then_run.rs
diff --git a/authfs/tests/hosttests/Android.bp b/tests/authfs/hosttests/Android.bp
similarity index 100%
rename from authfs/tests/hosttests/Android.bp
rename to tests/authfs/hosttests/Android.bp
diff --git a/authfs/tests/hosttests/AndroidTest.xml b/tests/authfs/hosttests/AndroidTest.xml
similarity index 100%
rename from authfs/tests/hosttests/AndroidTest.xml
rename to tests/authfs/hosttests/AndroidTest.xml
diff --git a/authfs/tests/hosttests/java/src/com/android/fs/AuthFsHostTest.java b/tests/authfs/hosttests/java/src/com/android/fs/AuthFsHostTest.java
similarity index 87%
rename from authfs/tests/hosttests/java/src/com/android/fs/AuthFsHostTest.java
rename to tests/authfs/hosttests/java/src/com/android/fs/AuthFsHostTest.java
index d0a7c66..0a27506 100644
--- a/authfs/tests/hosttests/java/src/com/android/fs/AuthFsHostTest.java
+++ b/tests/authfs/hosttests/java/src/com/android/fs/AuthFsHostTest.java
@@ -75,8 +75,8 @@
@BeforeClassWithInfo
public static void beforeClassWithDevice(TestInformation testInfo) throws Exception {
AuthFsTestRule.setUpAndroid(testInfo);
- assumeTrue(AuthFsTestRule.getDevice().supportsMicrodroid(/*protectedVm=*/ true));
- AuthFsTestRule.startMicrodroid(/*protectedVm=*/ true);
+ assumeTrue(AuthFsTestRule.getDevice().supportsMicrodroid(/* protectedVm= */ true));
+ AuthFsTestRule.startMicrodroid(/* protectedVm= */ true);
sAndroid = AuthFsTestRule.getAndroid();
sMicrodroid = AuthFsTestRule.getMicrodroid();
}
@@ -114,7 +114,7 @@
// Setup
runFdServerOnAndroid(
"--open-ro 3:input.4k --open-ro 4:input.4k.fsv_meta --open-ro"
- + " 6:input.4k1 --open-ro 7:input.4k1.fsv_meta",
+ + " 6:input.4k1 --open-ro 7:input.4k1.fsv_meta",
"--ro-fds 3:4 --ro-fds 6:7");
runAuthFsOnMicrodroid(
"--remote-ro-file 3:" + DIGEST_4K + " --remote-ro-file 6:" + DIGEST_4K1);
@@ -135,8 +135,7 @@
public void testReadWithFsverityVerification_TamperedMerkleTree() throws Exception {
// Setup
runFdServerOnAndroid(
- "--open-ro 3:input.4m --open-ro 4:input.4m.fsv_meta.bad_merkle",
- "--ro-fds 3:4");
+ "--open-ro 3:input.4m --open-ro 4:input.4m.fsv_meta.bad_merkle", "--ro-fds 3:4");
runAuthFsOnMicrodroid("--remote-ro-file 3:" + DIGEST_4M);
// Verify
@@ -190,8 +189,12 @@
// Action
// Tampering with the first 2 4K-blocks of the backing file.
assertThat(
- writeZerosAtFileOffset(sAndroid, backendPath,
- /* offset */ 0, /* number */ 8192, /* writeThrough */ false))
+ writeZerosAtFileOffset(
+ sAndroid,
+ backendPath,
+ /* offset */ 0, /* number */
+ 8192, /* writeThrough */
+ false))
.isSuccess();
// Verify
@@ -199,21 +202,33 @@
// when the content is inconsistent to the known hash. Use direct I/O to avoid simply
// writing to the filesystem cache.
assertThat(
- writeZerosAtFileOffset(sMicrodroid, destPath,
- /* offset */ 0, /* number */ 1024, /* writeThrough */ true))
+ writeZerosAtFileOffset(
+ sMicrodroid,
+ destPath,
+ /* offset */ 0, /* number */
+ 1024, /* writeThrough */
+ true))
.isFailed();
// A full 4K write does not require to read back, so write can succeed even if the backing
// block has already been tampered.
assertThat(
- writeZerosAtFileOffset(sMicrodroid, destPath,
- /* offset */ 4096, /* number */ 4096, /* writeThrough */ false))
+ writeZerosAtFileOffset(
+ sMicrodroid,
+ destPath,
+ /* offset */ 4096, /* number */
+ 4096, /* writeThrough */
+ false))
.isSuccess();
// Otherwise, a partial write with correct backing file should still succeed.
assertThat(
- writeZerosAtFileOffset(sMicrodroid, destPath,
- /* offset */ 8192, /* number */ 1024, /* writeThrough */ false))
+ writeZerosAtFileOffset(
+ sMicrodroid,
+ destPath,
+ /* offset */ 8192, /* number */
+ 1024, /* writeThrough */
+ false))
.isSuccess();
}
@@ -231,8 +246,12 @@
// Action
// Tampering with the first 4K-block of the backing file.
assertThat(
- writeZerosAtFileOffset(sAndroid, backendPath,
- /* offset */ 0, /* number */ 4096, /* writeThrough */ false))
+ writeZerosAtFileOffset(
+ sAndroid,
+ backendPath,
+ /* offset */ 0, /* number */
+ 4096, /* writeThrough */
+ false))
.isSuccess();
// Verify
@@ -258,8 +277,12 @@
// Action
// Tampering with the last 4K-block of the backing file.
assertThat(
- writeZerosAtFileOffset(sAndroid, backendPath,
- /* offset */ 4096, /* number */ 1, /* writeThrough */ false))
+ writeZerosAtFileOffset(
+ sAndroid,
+ backendPath,
+ /* offset */ 4096, /* number */
+ 1, /* writeThrough */
+ false))
.isSuccess();
// Verify
@@ -470,15 +493,22 @@
sAndroid.run("test -f " + androidOutputPath);
// Action
- String output = sMicrodroid.run(
- // Open the file for append and read
- "exec 4>>" + outputPath + " 5<" + outputPath + "; "
- // Delete the file from the directory
- + "rm " + outputPath + "; "
- // Append more data to the file descriptor
- + "echo -n 456 >&4; "
- // Print the whole file from the file descriptor
- + "cat <&5");
+ String output =
+ sMicrodroid.run(
+ // Open the file for append and read
+ "exec 4>>"
+ + outputPath
+ + " 5<"
+ + outputPath
+ + "; "
+ // Delete the file from the directory
+ + "rm "
+ + outputPath
+ + "; "
+ // Append more data to the file descriptor
+ + "echo -n 456 >&4; "
+ // Print the whole file from the file descriptor
+ + "cat <&5");
// Verify
// Output contains all written data, while the files are deleted.
@@ -531,27 +561,33 @@
// Verify
String[] actual = sMicrodroid.run("cd " + authfsOutputDir + "; find |sort").split("\n");
- String[] expected = new String[] {
- ".",
- "./dir",
- "./dir/dir2",
- "./dir/dir2/dir3",
- "./dir/dir2/dir3/file1",
- "./dir/dir2/dir3/file2",
- "./dir/dir2/dir3/file3",
- "./file"};
+ String[] expected =
+ new String[] {
+ ".",
+ "./dir",
+ "./dir/dir2",
+ "./dir/dir2/dir3",
+ "./dir/dir2/dir3/file1",
+ "./dir/dir2/dir3/file2",
+ "./dir/dir2/dir3/file3",
+ "./file"
+ };
assertEquals(expected, actual);
// Add more entries.
sMicrodroid.run("mkdir -p " + authfsOutputDir + "/dir2");
sMicrodroid.run("touch " + authfsOutputDir + "/file2");
// Check new entries. Also check that the types are correct.
- actual = sMicrodroid.run(
- "cd " + authfsOutputDir + "; find -maxdepth 1 -type f |sort").split("\n");
+ actual =
+ sMicrodroid
+ .run("cd " + authfsOutputDir + "; find -maxdepth 1 -type f |sort")
+ .split("\n");
expected = new String[] {"./file", "./file2"};
assertEquals(expected, actual);
- actual = sMicrodroid.run(
- "cd " + authfsOutputDir + "; find -maxdepth 1 -type d |sort").split("\n");
+ actual =
+ sMicrodroid
+ .run("cd " + authfsOutputDir + "; find -maxdepth 1 -type d |sort")
+ .split("\n");
expected = new String[] {".", "./dir", "./dir2"};
assertEquals(expected, actual);
}
@@ -687,8 +723,9 @@
"yes $'\\x01' | tr -d '\\n' | dd bs=1 count=" + numberOfOnes + " of=" + filePath);
}
- private static CommandResult checkReadAt(CommandRunner runner, String filePath, long offset,
- long size) throws DeviceNotAvailableException {
+ private static CommandResult checkReadAt(
+ CommandRunner runner, String filePath, long offset, long size)
+ throws DeviceNotAvailableException {
String cmd = "dd if=" + filePath + " of=/dev/null bs=1 count=" + size;
if (offset > 0) {
cmd += " skip=" + offset;
@@ -696,10 +733,15 @@
return runner.runForResult(cmd);
}
- private CommandResult writeZerosAtFileOffset(CommandRunner runner, String filePath, long offset,
- long numberOfZeros, boolean writeThrough) throws DeviceNotAvailableException {
- String cmd = "dd if=/dev/zero of=" + filePath + " bs=1 count=" + numberOfZeros
- + " conv=notrunc";
+ private CommandResult writeZerosAtFileOffset(
+ CommandRunner runner,
+ String filePath,
+ long offset,
+ long numberOfZeros,
+ boolean writeThrough)
+ throws DeviceNotAvailableException {
+ String cmd =
+ "dd if=/dev/zero of=" + filePath + " bs=1 count=" + numberOfZeros + " conv=notrunc";
if (offset > 0) {
cmd += " seek=" + offset;
}
diff --git a/authfs/testdata/README.md b/tests/authfs/testdata/README.md
similarity index 100%
rename from authfs/testdata/README.md
rename to tests/authfs/testdata/README.md
diff --git a/authfs/testdata/cert.der b/tests/authfs/testdata/cert.der
similarity index 100%
rename from authfs/testdata/cert.der
rename to tests/authfs/testdata/cert.der
Binary files differ
diff --git a/authfs/testdata/cert.pem b/tests/authfs/testdata/cert.pem
similarity index 100%
rename from authfs/testdata/cert.pem
rename to tests/authfs/testdata/cert.pem
diff --git a/authfs/testdata/input.4k b/tests/authfs/testdata/input.4k
similarity index 100%
rename from authfs/testdata/input.4k
rename to tests/authfs/testdata/input.4k
Binary files differ
diff --git a/authfs/testdata/input.4k.fsv_meta b/tests/authfs/testdata/input.4k.fsv_meta
similarity index 100%
rename from authfs/testdata/input.4k.fsv_meta
rename to tests/authfs/testdata/input.4k.fsv_meta
Binary files differ
diff --git a/authfs/testdata/input.4k1 b/tests/authfs/testdata/input.4k1
similarity index 100%
rename from authfs/testdata/input.4k1
rename to tests/authfs/testdata/input.4k1
Binary files differ
diff --git a/authfs/testdata/input.4k1.fsv_meta b/tests/authfs/testdata/input.4k1.fsv_meta
similarity index 100%
rename from authfs/testdata/input.4k1.fsv_meta
rename to tests/authfs/testdata/input.4k1.fsv_meta
Binary files differ
diff --git a/authfs/testdata/input.4m b/tests/authfs/testdata/input.4m
similarity index 100%
rename from authfs/testdata/input.4m
rename to tests/authfs/testdata/input.4m
Binary files differ
diff --git a/authfs/testdata/input.4m.fsv_meta b/tests/authfs/testdata/input.4m.fsv_meta
similarity index 100%
rename from authfs/testdata/input.4m.fsv_meta
rename to tests/authfs/testdata/input.4m.fsv_meta
Binary files differ
diff --git a/authfs/testdata/input.4m.fsv_meta.bad_merkle b/tests/authfs/testdata/input.4m.fsv_meta.bad_merkle
similarity index 100%
rename from authfs/testdata/input.4m.fsv_meta.bad_merkle
rename to tests/authfs/testdata/input.4m.fsv_meta.bad_merkle
Binary files differ
diff --git a/authfs/testdata/key.pem b/tests/authfs/testdata/key.pem
similarity index 100%
rename from authfs/testdata/key.pem
rename to tests/authfs/testdata/key.pem
diff --git a/demo_accessor/README.md b/tests/vm_accessor/README.md
similarity index 100%
rename from demo_accessor/README.md
rename to tests/vm_accessor/README.md
diff --git a/demo_accessor/accessor/Android.bp b/tests/vm_accessor/accessor/Android.bp
similarity index 100%
rename from demo_accessor/accessor/Android.bp
rename to tests/vm_accessor/accessor/Android.bp
diff --git a/demo_accessor/accessor/src/accessor.rs b/tests/vm_accessor/accessor/src/accessor.rs
similarity index 100%
rename from demo_accessor/accessor/src/accessor.rs
rename to tests/vm_accessor/accessor/src/accessor.rs
diff --git a/demo_accessor/accessor/src/main.rs b/tests/vm_accessor/accessor/src/main.rs
similarity index 100%
rename from demo_accessor/accessor/src/main.rs
rename to tests/vm_accessor/accessor/src/main.rs
diff --git a/demo_accessor/accessor/src/run.rs b/tests/vm_accessor/accessor/src/run.rs
similarity index 100%
rename from demo_accessor/accessor/src/run.rs
rename to tests/vm_accessor/accessor/src/run.rs
diff --git a/demo_accessor/accessor_vm/Android.bp b/tests/vm_accessor/accessor_vm/Android.bp
similarity index 100%
rename from demo_accessor/accessor_vm/Android.bp
rename to tests/vm_accessor/accessor_vm/Android.bp
diff --git a/demo_accessor/accessor_vm/AndroidManifest.xml b/tests/vm_accessor/accessor_vm/AndroidManifest.xml
similarity index 100%
rename from demo_accessor/accessor_vm/AndroidManifest.xml
rename to tests/vm_accessor/accessor_vm/AndroidManifest.xml
diff --git a/demo_accessor/accessor_vm/assets/config.json b/tests/vm_accessor/accessor_vm/assets/config.json
similarity index 100%
rename from demo_accessor/accessor_vm/assets/config.json
rename to tests/vm_accessor/accessor_vm/assets/config.json
diff --git a/demo_accessor/accessor_vm/src/main.rs b/tests/vm_accessor/accessor_vm/src/main.rs
similarity index 100%
rename from demo_accessor/accessor_vm/src/main.rs
rename to tests/vm_accessor/accessor_vm/src/main.rs
diff --git a/demo_accessor/aidl/Android.bp b/tests/vm_accessor/aidl/Android.bp
similarity index 100%
rename from demo_accessor/aidl/Android.bp
rename to tests/vm_accessor/aidl/Android.bp
diff --git a/demo_accessor/aidl/com/android/virt/accessor_demo/vm_service/IAccessorVmService.aidl b/tests/vm_accessor/aidl/com/android/virt/accessor_demo/vm_service/IAccessorVmService.aidl
similarity index 100%
rename from demo_accessor/aidl/com/android/virt/accessor_demo/vm_service/IAccessorVmService.aidl
rename to tests/vm_accessor/aidl/com/android/virt/accessor_demo/vm_service/IAccessorVmService.aidl
diff --git a/demo_accessor/apex/Android.bp b/tests/vm_accessor/apex/Android.bp
similarity index 100%
rename from demo_accessor/apex/Android.bp
rename to tests/vm_accessor/apex/Android.bp
diff --git a/demo_accessor/apex/accessor_demo-file_contexts b/tests/vm_accessor/apex/accessor_demo-file_contexts
similarity index 100%
rename from demo_accessor/apex/accessor_demo-file_contexts
rename to tests/vm_accessor/apex/accessor_demo-file_contexts
diff --git a/demo_accessor/apex/accessor_demo.init.rc b/tests/vm_accessor/apex/accessor_demo.init.rc
similarity index 100%
rename from demo_accessor/apex/accessor_demo.init.rc
rename to tests/vm_accessor/apex/accessor_demo.init.rc
diff --git a/demo_accessor/apex/accessor_demo.xml b/tests/vm_accessor/apex/accessor_demo.xml
similarity index 100%
rename from demo_accessor/apex/accessor_demo.xml
rename to tests/vm_accessor/apex/accessor_demo.xml
diff --git a/demo_accessor/apex/manifest.json b/tests/vm_accessor/apex/manifest.json
similarity index 100%
rename from demo_accessor/apex/manifest.json
rename to tests/vm_accessor/apex/manifest.json
diff --git a/demo_accessor/test/Android.bp b/tests/vm_accessor/test/Android.bp
similarity index 100%
rename from demo_accessor/test/Android.bp
rename to tests/vm_accessor/test/Android.bp
diff --git a/demo_accessor/test/AndroidTest.xml b/tests/vm_accessor/test/AndroidTest.xml
similarity index 100%
rename from demo_accessor/test/AndroidTest.xml
rename to tests/vm_accessor/test/AndroidTest.xml
diff --git a/demo_accessor/test/src/test.rs b/tests/vm_accessor/test/src/test.rs
similarity index 100%
rename from demo_accessor/test/src/test.rs
rename to tests/vm_accessor/test/src/test.rs