Merge changes I498c1740,Iff984b74 into main
* changes:
FerrochromeApp: Remove FerrochromeApp
LinuxInstaller: Remove dependency with FerrochromeApp
diff --git a/android/FerrochromeApp/Android.bp b/android/FerrochromeApp/Android.bp
deleted file mode 100644
index 3e4ad14..0000000
--- a/android/FerrochromeApp/Android.bp
+++ /dev/null
@@ -1,42 +0,0 @@
-package {
- default_applicable_licenses: ["Android-Apache-2.0"],
-}
-
-java_defaults {
- name: "VmPayloadInstaller",
- init_rc: [":custom_vm_setup.rc"],
- required: ["custom_vm_setup"],
- // TODO(b/348113995): move this app to product partition
- system_ext_specific: true,
- platform_apis: true,
- privileged: true,
-}
-
-android_app {
- name: "FerrochromeApp",
- srcs: ["java/**/*.java"],
- resource_dirs: ["res"],
- defaults: ["VmPayloadInstaller"],
- required: [
- "privapp-permissions-ferrochrome.xml",
- ],
-}
-
-prebuilt_etc {
- name: "privapp-permissions-ferrochrome.xml",
- src: "privapp-permissions-ferrochrome.xml",
- sub_dir: "permissions",
- system_ext_specific: true,
-}
-
-filegroup {
- name: "custom_vm_setup.rc",
- srcs: ["custom_vm_setup.rc"],
-}
-
-sh_binary {
- name: "custom_vm_setup",
- src: "custom_vm_setup.sh",
- system_ext_specific: true,
- host_supported: false,
-}
diff --git a/android/FerrochromeApp/AndroidManifest.xml b/android/FerrochromeApp/AndroidManifest.xml
deleted file mode 100644
index f6d3f6a..0000000
--- a/android/FerrochromeApp/AndroidManifest.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.android.virtualization.ferrochrome" >
-
- <uses-permission android:name="android.permission.INTERNET" />
- <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" />
- </intent>
- <intent>
- <action android:name="android.virtualization.FERROCHROME_DOWNLOADER" />
- </intent>
- </queries>
- <application
- android:label="Ferrochrome">
- <activity android:name=".FerrochromeActivity"
- android:configChanges="orientation|screenSize|keyboard|keyboardHidden|navigation|uiMode"
- android:screenOrientation="landscape"
- android:resizeableActivity="false"
- android:exported="true">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- <activity android:name=".OpenUrlActivity"
- android:theme="@android:style/Theme.NoDisplay"
- android:launchMode="singleTask"
- android:exported="true">
- <intent-filter>
- <action android:name="android.intent.action.SEND" />
- <category android:name="android.intent.category.DEFAULT" />
- <data android:mimeType="text/*" />
- </intent-filter>
- </activity>
- </application>
-
-</manifest>
diff --git a/android/FerrochromeApp/java/com/android/virtualization/ferrochrome/FerrochromeActivity.java b/android/FerrochromeApp/java/com/android/virtualization/ferrochrome/FerrochromeActivity.java
deleted file mode 100644
index dba0078..0000000
--- a/android/FerrochromeApp/java/com/android/virtualization/ferrochrome/FerrochromeActivity.java
+++ /dev/null
@@ -1,307 +0,0 @@
-/*
- * 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.annotation.WorkerThread;
-import android.app.Activity;
-import android.app.ActivityManager;
-import android.content.Intent;
-import android.content.pm.ActivityInfo;
-import android.content.pm.PackageManager;
-import android.content.pm.ResolveInfo;
-import android.os.Bundle;
-import android.os.Environment;
-import android.os.SystemProperties;
-import android.text.TextUtils;
-import android.util.Log;
-import android.view.WindowManager;
-import android.widget.TextView;
-
-import java.io.BufferedReader;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.StandardCopyOption;
-import java.util.List;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
-public class FerrochromeActivity extends Activity {
- private static final String TAG = FerrochromeActivity.class.getName();
- private static final String ACTION_VM_LAUNCHER = "android.virtualization.VM_LAUNCHER";
- private static final String ACTION_FERROCHROME_DOWNLOAD =
- "android.virtualization.FERROCHROME_DOWNLOADER";
- private static final String EXTRA_FERROCHROME_DEST_DIR = "dest_dir";
- private static final String EXTRA_FERROCHROME_UPDATE_NEEDED = "update_needed";
-
- private static final Path DEST_DIR =
- Path.of(Environment.getExternalStorageDirectory().getPath(), "ferrochrome");
- private static final String ASSET_DIR = "ferrochrome";
- private static final Path VERSION_FILE = Path.of(DEST_DIR.toString(), "version");
-
- private static final int REQUEST_CODE_VMLAUNCHER = 1;
- private static final int REQUEST_CODE_FERROCHROME_DOWNLOADER = 2;
-
- private ResolvedActivity mVmLauncher;
-
- ExecutorService executorService = Executors.newSingleThreadExecutor();
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- if (!isTaskRoot()) {
- // In case we launched this activity multiple times, only start one instance of this
- // activity by only starting this as the root activity in task.
- finish();
- Log.w(TAG, "Not starting because not task root");
- return;
- }
- setContentView(R.layout.activity_ferrochrome);
- getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
-
- // Find VM Launcher
- mVmLauncher = ResolvedActivity.resolve(getPackageManager(), ACTION_VM_LAUNCHER);
- if (mVmLauncher == null) {
- updateStatus("Failed to resolve VM Launcher");
- return;
- }
-
- // Clean up the existing vm launcher process if there is
- ActivityManager am = getSystemService(ActivityManager.class);
- am.killBackgroundProcesses(mVmLauncher.activityInfo.packageName);
-
- executorService.execute(
- () -> {
- if (hasLocalAssets()) {
- if (updateImageIfNeeded()) {
- updateStatus("Starting Ferrochrome...");
- runOnUiThread(
- () ->
- startActivityForResult(
- mVmLauncher.intent, REQUEST_CODE_VMLAUNCHER));
- }
- } else {
- tryLaunchDownloader();
- }
- });
- }
-
- @Override
- protected void onActivityResult(int requestCode, int resultCode, Intent data) {
- if (requestCode == REQUEST_CODE_VMLAUNCHER) {
- finishAndRemoveTask();
- } else if (requestCode == REQUEST_CODE_FERROCHROME_DOWNLOADER) {
- String destDir = data.getStringExtra(EXTRA_FERROCHROME_DEST_DIR);
- boolean updateNeeded =
- data.getBooleanExtra(EXTRA_FERROCHROME_UPDATE_NEEDED, /* default= */ true);
-
- if (resultCode != RESULT_OK || TextUtils.isEmpty(destDir)) {
- Log.w(
- TAG,
- "Ferrochrome downloader returned error, code="
- + resultCode
- + ", dest="
- + destDir);
- updateStatus("User didn't accepted ferrochrome download..");
- return;
- }
-
- Log.w(TAG, "Ferrochrome downloader returned OK");
-
- if (!updateNeeded) {
- updateStatus("Starting Ferrochrome...");
- startActivityForResult(mVmLauncher.intent, REQUEST_CODE_VMLAUNCHER);
- }
-
- executorService.execute(
- () -> {
- if (!extractImages(destDir)) {
- updateStatus("Images from downloader looks bad..");
- return;
- }
- updateStatus("Starting Ferrochrome...");
- runOnUiThread(
- () ->
- startActivityForResult(
- mVmLauncher.intent, REQUEST_CODE_VMLAUNCHER));
- });
- }
- }
-
- @WorkerThread
- private boolean hasLocalAssets() {
- try {
- String[] files = getAssets().list(ASSET_DIR);
- return files != null && files.length > 0;
- } catch (IOException e) {
- return false;
- }
- }
-
- @WorkerThread
- private boolean updateImageIfNeeded() {
- if (!isUpdateNeeded()) {
- Log.d(TAG, "No update needed.");
- return true;
- }
-
- try {
- if (Files.notExists(DEST_DIR)) {
- Files.createDirectory(DEST_DIR);
- }
-
- updateStatus("Copying images...");
- String[] files = getAssets().list("ferrochrome");
- for (String file : files) {
- updateStatus(file);
- Path dst = Path.of(DEST_DIR.toString(), file);
- updateFile(getAssets().open("ferrochrome/" + file), dst);
- }
- } catch (IOException e) {
- Log.e(TAG, "Error while updating image: " + e);
- updateStatus("Failed.");
- return false;
- }
- updateStatus("Done.");
-
- return extractImages(DEST_DIR.toAbsolutePath().toString());
- }
-
- @WorkerThread
- private void tryLaunchDownloader() {
- // TODO(jaewan): Add safeguard to check whether ferrochrome downloader is valid.
- Log.w(TAG, "No built-in assets found. Try again with ferrochrome downloader");
-
- ResolvedActivity downloader =
- ResolvedActivity.resolve(getPackageManager(), ACTION_FERROCHROME_DOWNLOAD);
- if (downloader == null) {
- Log.d(TAG, "Ferrochrome downloader doesn't exist");
- updateStatus("ChromeOS image not found. Please go/try-ferrochrome");
- return;
- }
- String pkgName = downloader.activityInfo.packageName;
- Log.d(TAG, "Resolved Ferrochrome Downloader, pkgName=" + pkgName);
- updateStatus("Launching Ferrochrome downloader for update");
-
- // onActivityResult() will handle downloader result.
- startActivityForResult(downloader.intent, REQUEST_CODE_FERROCHROME_DOWNLOADER);
- }
-
- @WorkerThread
- private boolean extractImages(String destDir) {
- updateStatus("Extracting images...");
-
- if (TextUtils.isEmpty(destDir)) {
- throw new RuntimeException("Internal error: destDir shouldn't be null");
- }
-
- SystemProperties.set("debug.custom_vm_setup.path", destDir);
- SystemProperties.set("debug.custom_vm_setup.done", "false");
- SystemProperties.set("debug.custom_vm_setup.start", "true");
- while (!SystemProperties.getBoolean("debug.custom_vm_setup.done", false)) {
- try {
- Thread.sleep(1000);
- } catch (Exception e) {
- Log.e(TAG, "Error while extracting image: " + e);
- updateStatus("Failed.");
- return false;
- }
- }
-
- updateStatus("Done.");
- return true;
- }
-
- @WorkerThread
- private boolean isUpdateNeeded() {
- Path[] pathsToCheck = {DEST_DIR, VERSION_FILE};
- for (Path p : pathsToCheck) {
- if (Files.notExists(p)) {
- Log.d(TAG, p.toString() + " does not exist.");
- return true;
- }
- }
-
- try {
- String installedVer = readLine(new FileInputStream(VERSION_FILE.toFile()));
- String updatedVer = readLine(getAssets().open("ferrochrome/version"));
- if (installedVer.equals(updatedVer)) {
- return false;
- }
- Log.d(TAG, "Version mismatch. Installed: " + installedVer + " Updated: " + updatedVer);
- } catch (IOException e) {
- Log.e(TAG, "Error while checking version: " + e);
- }
- return true;
- }
-
- private static String readLine(InputStream input) throws IOException {
- try (BufferedReader reader = new BufferedReader(new InputStreamReader(input))) {
- return reader.readLine();
- } catch (IOException e) {
- throw e;
- }
- }
-
- private static void updateFile(InputStream input, Path path) throws IOException {
- try {
- Files.copy(input, path, StandardCopyOption.REPLACE_EXISTING);
- } finally {
- input.close();
- }
- }
-
- private void updateStatus(String line) {
- runOnUiThread(
- () -> {
- TextView statusView = findViewById(R.id.status_txt_view);
- statusView.append(line + "\n");
- });
- }
-
- private static final class ResolvedActivity {
- public final ActivityInfo activityInfo;
- public final Intent intent;
-
- private ResolvedActivity(ActivityInfo activityInfo, Intent intent) {
- this.activityInfo = activityInfo;
- this.intent = intent;
- }
-
- /* synthetic access */
- static ResolvedActivity resolve(PackageManager pm, String action) {
- Intent intent = new Intent(action).setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
- List<ResolveInfo> resolveInfos =
- pm.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY);
- if (resolveInfos == null || resolveInfos.size() != 1) {
- Log.w(
- TAG,
- "Failed to resolve activity, action="
- + action
- + ", resolved="
- + resolveInfos);
- return null;
- }
- ActivityInfo activityInfo = resolveInfos.get(0).activityInfo;
- intent.setClassName(activityInfo.packageName, activityInfo.name);
- return new ResolvedActivity(activityInfo, intent);
- }
- }
-}
diff --git a/android/FerrochromeApp/java/com/android/virtualization/ferrochrome/OpenUrlActivity.java b/android/FerrochromeApp/java/com/android/virtualization/ferrochrome/OpenUrlActivity.java
deleted file mode 100644
index 433e89c..0000000
--- a/android/FerrochromeApp/java/com/android/virtualization/ferrochrome/OpenUrlActivity.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * 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.content.Intent;
-import android.net.Uri;
-import android.os.Bundle;
-import android.util.Log;
-
-public class OpenUrlActivity extends Activity {
- private static final String TAG = OpenUrlActivity.class.getSimpleName();
-
- private static final String ACTION_VM_OPEN_URL = "android.virtualization.VM_OPEN_URL";
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- finish();
-
- if (!Intent.ACTION_SEND.equals(getIntent().getAction())) {
- return;
- }
- String text = getIntent().getStringExtra(Intent.EXTRA_TEXT);
- if (text == null) {
- return;
- }
- Uri uri = Uri.parse(text);
- if (uri == null) {
- return;
- }
- String scheme = uri.getScheme();
- if (!("http".equals(scheme) || "https".equals(scheme) || "mailto".equals(scheme))) {
- Log.e(TAG, "Unsupported URL scheme: " + scheme);
- return;
- }
- Log.i(TAG, "Sending " + scheme + " URL to VM");
- startActivity(
- new Intent(ACTION_VM_OPEN_URL)
- .setFlags(
- Intent.FLAG_ACTIVITY_SINGLE_TOP
- | Intent.FLAG_ACTIVITY_PREVIOUS_IS_TOP)
- .putExtra(Intent.EXTRA_TEXT, text));
- }
-}
diff --git a/android/FerrochromeApp/privapp-permissions-ferrochrome.xml b/android/FerrochromeApp/privapp-permissions-ferrochrome.xml
deleted file mode 100644
index 987db9c..0000000
--- a/android/FerrochromeApp/privapp-permissions-ferrochrome.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<permissions>
- <privapp-permissions package="com.android.virtualization.ferrochrome">
- <permission name="android.permission.KILL_ALL_BACKGROUND_PROCESSES"/>
- </privapp-permissions>
-</permissions>
\ No newline at end of file
diff --git a/android/FerrochromeApp/repack.sh b/android/FerrochromeApp/repack.sh
deleted file mode 100755
index b2a96dd..0000000
--- a/android/FerrochromeApp/repack.sh
+++ /dev/null
@@ -1,53 +0,0 @@
-#!/bin/bash
-# Repacks chromiumos_*.bin into the assets of FerrochromeApp
-
-usage() {
- echo "Usage: $0 CHROME_OS_DISK_IMAGE"
- exit 1
-}
-
-if [ "$#" -ne 1 ]; then
- usage
-fi
-
-disk=$1
-
-loop=$(sudo losetup --show -f -P ${disk})
-kern=$(sudo fdisk -x ${loop} | grep KERN-A | awk "{print\$1}")
-root=$(sudo fdisk -x ${loop} | grep ROOT-A | awk "{print\$1}")
-efi=$(sudo fdisk -x ${loop} | grep EFI-SYSTEM | awk "{print\$1}")
-state=$(sudo fdisk -x ${loop} | grep STATE | awk "{print\$1}")
-root_guid=$(sudo fdisk -x ${loop} | grep ROOT-A | awk "{print\$6}")
-
-tempdir=$(mktemp -d)
-pushd ${tempdir} > /dev/null
-echo Extracting partition images...
-sudo cp --sparse=always ${kern} kernel.img
-sudo cp --sparse=always ${root} root.img
-sudo cp --sparse=always ${efi} efi.img
-sudo cp --sparse=always ${state} state.img
-sudo chmod 777 *.img
-
-echo Archiving. This can take long...
-tar czvS -f images.tar.gz *.img
-
-echo Splitting...
-split -b 100M -d images.tar.gz images.tar.gz.part
-
-popd > /dev/null
-asset_dir=$(dirname $0)/assets/ferrochrome
-echo Updating ${asset_dir}...
-vm_config_template=$(dirname $0)/vm_config.json.template
-mkdir -p ${asset_dir}
-rm ${asset_dir}/images.tar.gz.part*
-mv ${tempdir}/images.tar.gz.part* ${asset_dir}
-sed -E s/GUID/${root_guid}/ ${vm_config_template} > ${asset_dir}/vm_config.json
-
-echo Calculating hash...
-hash=$(cat ${tempdir}/images.tar.gz ${asset_dir}/vm_config.json | sha1sum | cut -d' ' -f 1)
-echo ${hash} > ${asset_dir}/version
-
-echo Cleanup...
-sudo losetup -d ${loop}
-rm -rf ${tempdir}
-echo Done.
diff --git a/android/FerrochromeApp/res/layout/activity_ferrochrome.xml b/android/FerrochromeApp/res/layout/activity_ferrochrome.xml
deleted file mode 100644
index 3967167..0000000
--- a/android/FerrochromeApp/res/layout/activity_ferrochrome.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<RelativeLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:fitsSystemWindows="true"
- android:paddingLeft="16dp"
- android:paddingRight="16dp">
- <TextView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:textSize="28sp"
- android:id="@+id/status_txt_view"/>
-
-</RelativeLayout>
diff --git a/android/FerrochromeApp/vm_config.json.template b/android/FerrochromeApp/vm_config.json.template
deleted file mode 100644
index 380f016..0000000
--- a/android/FerrochromeApp/vm_config.json.template
+++ /dev/null
@@ -1,56 +0,0 @@
-{
- "name": "cros",
- "disks": [
- {
- "writable": true,
- "partitions": [
- {
- "label": "STATE",
- "path": "/data/local/tmp/state.img",
- "writable": true
- },
- {
- "label": "KERN-A",
- "path": "/data/local/tmp/kernel.img"
- },
- {
- "label": "ROOT-A",
- "path": "/data/local/tmp/root.img",
- "guid": "GUID"
- },
- {
- "label": "EFI-SYSTEM",
- "path": "/data/local/tmp/efi.img"
- }
- ]
- }
- ],
- "protected": false,
- "cpu_topology": "match_host",
- "platform_version": "~1.0",
- "memory_mib": 8096,
- "debuggable": true,
- "console_out": true,
- "connect_console": true,
- "console_input_device": "hvc0",
- "network": true,
- "input": {
- "touchscreen": true,
- "keyboard": true,
- "mouse": true,
- "trackpad": true,
- "switches": true
- },
- "audio": {
- "speaker": true,
- "microphone": true
- },
- "gpu": {
- "backend": "virglrenderer",
- "context_types": ["virgl2"]
- },
- "display": {
- "scale": "0.77",
- "refresh_rate": "30"
- }
-}
diff --git a/android/LinuxInstaller/Android.bp b/android/LinuxInstaller/Android.bp
index f70452d..f7994ef 100644
--- a/android/LinuxInstaller/Android.bp
+++ b/android/LinuxInstaller/Android.bp
@@ -2,13 +2,22 @@
default_applicable_licenses: ["Android-Apache-2.0"],
}
+java_defaults {
+ name: "LinuxVmPayloadInstaller",
+ init_rc: [":linux_vm_setup.rc"],
+ required: ["linux_vm_setup"],
+ system_ext_specific: true,
+ platform_apis: true,
+ privileged: true,
+}
+
android_app {
name: "LinuxInstallerApp",
srcs: ["java/**/*.java"],
resource_dirs: ["res"],
asset_dirs: ["assets"],
manifest: "AndroidManifest.xml",
- defaults: ["VmPayloadInstaller"],
+ defaults: ["LinuxVmPayloadInstaller"],
overrides: ["LinuxInstallerAppStub"],
required: [
"privapp-permissions-linuxinstaller.xml",
@@ -21,7 +30,7 @@
srcs: ["java/**/*.java"],
resource_dirs: ["res"],
manifest: "AndroidManifest_stub.xml",
- defaults: ["VmPayloadInstaller"],
+ defaults: ["LinuxVmPayloadInstaller"],
required: [
"privapp-permissions-linuxinstaller.xml",
],
@@ -39,3 +48,15 @@
name: "com.android.virtualization.linuxinstaller_certificate",
certificate: "com_android_virtualization_linuxinstaller",
}
+
+filegroup {
+ name: "linux_vm_setup.rc",
+ srcs: ["linux_vm_setup.rc"],
+}
+
+sh_binary {
+ name: "linux_vm_setup",
+ src: "linux_vm_setup.sh",
+ system_ext_specific: true,
+ host_supported: false,
+}
diff --git a/android/LinuxInstaller/java/com/android/virtualization/linuxinstaller/MainActivity.java b/android/LinuxInstaller/java/com/android/virtualization/linuxinstaller/MainActivity.java
index 1d875cb..0351f97 100644
--- a/android/LinuxInstaller/java/com/android/virtualization/linuxinstaller/MainActivity.java
+++ b/android/LinuxInstaller/java/com/android/virtualization/linuxinstaller/MainActivity.java
@@ -136,10 +136,10 @@
throw new RuntimeException("Internal error: destDir shouldn't be null");
}
- SystemProperties.set("debug.custom_vm_setup.path", destDir);
- SystemProperties.set("debug.custom_vm_setup.done", "false");
- SystemProperties.set("debug.custom_vm_setup.start", "true");
- while (!SystemProperties.getBoolean("debug.custom_vm_setup.done", false)) {
+ SystemProperties.set("debug.linux_vm_setup.path", destDir);
+ SystemProperties.set("debug.linux_vm_setup.done", "false");
+ SystemProperties.set("debug.linux_vm_setup.start", "true");
+ while (!SystemProperties.getBoolean("debug.linux_vm_setup.done", false)) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
diff --git a/android/FerrochromeApp/custom_vm_setup.rc b/android/LinuxInstaller/linux_vm_setup.rc
similarity index 77%
rename from android/FerrochromeApp/custom_vm_setup.rc
rename to android/LinuxInstaller/linux_vm_setup.rc
index 68f370e..9264d96 100644
--- a/android/FerrochromeApp/custom_vm_setup.rc
+++ b/android/LinuxInstaller/linux_vm_setup.rc
@@ -1,4 +1,4 @@
-# Copyright (C) 2024 The Android Open Source Project
+# Copyright 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.
@@ -12,12 +12,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-service custom_vm_setup /system_ext/bin/custom_vm_setup
+service linux_vm_setup /system_ext/bin/linux_vm_setup
user shell
group shell media_rw
disabled
oneshot
seclabel u:r:shell:s0
-on property:debug.custom_vm_setup.start=true
- start custom_vm_setup
+on property:debug.linux_vm_setup.start=true
+ start linux_vm_setup
diff --git a/android/FerrochromeApp/custom_vm_setup.sh b/android/LinuxInstaller/linux_vm_setup.sh
similarity index 82%
rename from android/FerrochromeApp/custom_vm_setup.sh
rename to android/LinuxInstaller/linux_vm_setup.sh
index df1a3a6..6a93f6f 100644
--- a/android/FerrochromeApp/custom_vm_setup.sh
+++ b/android/LinuxInstaller/linux_vm_setup.sh
@@ -7,7 +7,7 @@
}
function install() {
- src_dir=$(getprop debug.custom_vm_setup.path)
+ src_dir=$(getprop debug.linux_vm_setup.path)
src_dir=${src_dir/#\/storage\/emulated\//\/data\/media\/}
dst_dir=/data/local/tmp/
@@ -26,7 +26,7 @@
rm ${src_dir}/vm_config.json
}
-setprop debug.custom_vm_setup.done false
+setprop debug.linux_vm_setup.done false
install
-setprop debug.custom_vm_setup.start false
-setprop debug.custom_vm_setup.done true
+setprop debug.linux_vm_setup.start false
+setprop debug.linux_vm_setup.done true