commit | e0848f27e46c4c395f0e25304b9fd9870509f6e8 | [log] [tgz] |
---|---|---|
author | Jeongik Cha <jeongik@google.com> | Fri Nov 08 05:10:14 2024 +0000 |
committer | Jeongik Cha <jeongik@google.com> | Fri Nov 08 05:10:14 2024 +0000 |
tree | 2217ad2ab48dd6f299b0a96a594d15866f1ed7fe | |
parent | 54c7b38c2acf3d9d04c9390b6bd196823edf9000 [diff] |
Stop VmLauncherService when vm is finished Bug: n/a Change-Id: I91cc9a48e43fbcf5eddb0ea93d50322079c3de6f Test: stop vm
diff --git a/android/TerminalApp/AndroidManifest.xml b/android/TerminalApp/AndroidManifest.xml index 61737fe..c5cee52 100644 --- a/android/TerminalApp/AndroidManifest.xml +++ b/android/TerminalApp/AndroidManifest.xml
@@ -65,7 +65,8 @@ <service android:name="com.android.virtualization.vmlauncher.VmLauncherService" android:exported="false" - android:foregroundServiceType="specialUse"> + android:foregroundServiceType="specialUse" + android:stopWithTask="true" > <property android:name="android.app.PROPERTY_SPECIAL_USE_FGS_SUBTYPE" android:value="Run VM instances" />
diff --git a/libs/vm_launcher_lib/java/com/android/virtualization/vmlauncher/VmLauncherService.java b/libs/vm_launcher_lib/java/com/android/virtualization/vmlauncher/VmLauncherService.java index 2bd85e1..277ec92 100644 --- a/libs/vm_launcher_lib/java/com/android/virtualization/vmlauncher/VmLauncherService.java +++ b/libs/vm_launcher_lib/java/com/android/virtualization/vmlauncher/VmLauncherService.java
@@ -107,9 +107,7 @@ if (mResultReceiver != null) { mResultReceiver.send(success ? RESULT_STOP : RESULT_ERROR, null); } - if (!success) { - stopSelf(); - } + stopSelf(); }); Path logPath = getFileStreamPath(mVirtualMachine.getName() + ".log").toPath(); Logger.setup(mVirtualMachine, logPath, mExecutorService);