[[["เข้าใจง่าย","easyToUnderstand","thumb-up"],["แก้ปัญหาของฉันได้","solvedMyProblem","thumb-up"],["อื่นๆ","otherUp","thumb-up"]],[["ไม่มีข้อมูลที่ฉันต้องการ","missingTheInformationINeed","thumb-down"],["ซับซ้อนเกินไป/มีหลายขั้นตอนมากเกินไป","tooComplicatedTooManySteps","thumb-down"],["ล้าสมัย","outOfDate","thumb-down"],["ปัญหาเกี่ยวกับการแปล","translationIssue","thumb-down"],["ตัวอย่าง/ปัญหาเกี่ยวกับโค้ด","samplesCodeIssue","thumb-down"],["อื่นๆ","otherDown","thumb-down"]],["อัปเดตล่าสุด 2025-07-27 UTC"],[],[],null,["# Soft restarts (<= AOSP 14)\n\n| **Note:** Soft restart is deprecated in Android 15.\n\nAndroid 11 supports soft restarts, which are\nruntime restarts of processes in the user space used to apply updates that\nrequire a reboot (for example, updates to APEX packages). Currently, soft\nrestart is limited to processes that started after `userdata` has been mounted.\n\nA soft restart is requested in the following ways:\n\n- From `PowerManager`, by calling\n `PowerManager.reboot(PowerManager.REBOOT_USERSPACE)`\n\n- From shell, using `adb shell svc power reboot userspace` or `adb reboot\n userspace`\n\nAfter a soft restart, credential encrypted storage remains unlocked.\n\nIf a device supports soft restarts, then the\n`PowerManager.isRebootingUserspace()` API method returns `true`, and the value\nof the system property `init.userspace_reboot.is_supported` is equal to `1`.\n\nIf device doesn't support soft restarts, then calls to\n`PowerManager.reboot(PowerManager.REBOOT_USERSPACE)`, `adb reboot\nuserspace`, and `adb shell svc power reboot userspace` fail.\n\nSoft restart execution\n----------------------\n\n| **Note:** If the `PowerManager` API requests the soft restart, the framework runs the regular reboot sequence.\n\nAfter a soft restart is requested (through `PowerManager` or from a shell),\n`init` performs the following steps:\n\n1. Receives `sys.powerctl=reboot,userspace`.\n\n2. Forks a separate\n [`UserspaceRebootWatchdogThread()`](https://cs.android.com/android/_/android/platform/system/core/+/01c8eccca3f7c7ed9f08fdc7bb641ab40ac833d1:init/reboot.cpp;l=823;drc=802864c7826ea79f8cc29c52801e08bcfc15db76)\n process to monitor the soft restart.\n\n3. Triggers a `userspace-reboot-requested` action, which resets all system\n properties that might impact the soft restart. Affected properties:\n\n - `sys.usb.config`\n - `sys.usb.state`\n - `sys.boot_completed`\n - `dev.bootcomplete`\n - `sys.init.updatable_crashing`\n - `sys.init.updatable_crashing_process_name`\n - `apexd.status`\n - `sys.user.0.ce_available`\n - `sys.shutdown.requested`\n - `service.bootanim.exit`\n\n The above properties should be set again during boot sequence. If needed, you\n can reset additional properties. For examples, refer to the\n `on userspace-reboot-requested` action in\n [`rootdir/init.rc`](https://cs.android.com/android/_/android/platform/system/core/+/01c8eccca3f7c7ed9f08fdc7bb641ab40ac833d1:rootdir/init.rc;l=1047;drc=843f46e674e3f9d424144aa91c51777d66c9692c).\n4. Runs the\n [`DoUserspaceReboot`](https://cs.android.com/android/_/android/platform/system/core/+/01c8eccca3f7c7ed9f08fdc7bb641ab40ac833d1:init/reboot.cpp;l=735;drc=802864c7826ea79f8cc29c52801e08bcfc15db76)\n function, which performs the following actions:\n\n 1. Sends `SIGTERM` to processes started after `userdata` has been mounted and waits for them to stop.\n 2. After the timeout is reached, sends `SIGKILL` to kill any running processes.\n 3. Calls `/system/bin/vdc volume reset`.\n 4. Unmounts the zRAM backing device.\n 5. Unmounts active APEX packages.\n 6. Switches back to the bootstrap mount namespace.\n 7. Triggers the [`userspace-reboot-resume`](https://cs.android.com/android/_/android/platform/system/core/+/01c8eccca3f7c7ed9f08fdc7bb641ab40ac833d1:rootdir/init.rc;l=1068;drc=843f46e674e3f9d424144aa91c51777d66c9692c) action.\n\nIf file system checkpointing was requested before the soft restart,\n`userdata` is remounted into checkpointing mode during the\n`userspace-reboot-fs-remount` action (see the following section for details). A\nsoft restart is considered after the `sys.boot_completed property` is set\nto `1`. At the end of the soft restart, the display is kept off and\nexplicit user interaction is required to wake it.\n\nFile system checkpointing\n-------------------------\n\nIf a file system checkpoint was requested before the soft restart,\n`userdata` is remounted in checkpointing mode during the soft restart.\nRemounting logic is implemented in the\n[`fs_mgr_remount_userdata_into_checkpointing`](https://cs.android.com/android/_/android/platform/system/core/+/01c8eccca3f7c7ed9f08fdc7bb641ab40ac833d1:fs_mgr/fs_mgr.cpp;l=1647;drc=17824f0590785adc77181ad5f937aa5c50ebf2fe)\nfunction, and differs between checkpointing methods. Specifically, when\n`userdata` supports:\n\n- **Filesystem level checkpointing** (for example, `f2fs`), `userdata` is\n remounted with the `checkpoint=disable` option.\n\n- **Block level checkpointing** (for example, `ext4`), then `/data` is unmounted\n and all the parent device mapper devices it was mounted on top of are\n destroyed. Next, `userdata` is mounted using the same code path as used in\n normal checkpointing boot.\n\nIf a file system level keyring is used to manage credential-encrypted (CE) and\ndevice-encrypted (DE) keys, then keys are lost after `userdata` is unmounted. To\nallow key restoration, when installing a key to a file system keyring, `vold`\nalso installs the same key of type `fscrypt-provisioning` to session-level\nkeyring. When `init_user0` is called, `vold` reinstalls the keys in the file\nsystem keyring.\n\nFallback to hard reboot\n-----------------------\n\nTo ensure that a soft restart doesn't leave a device in an unusable state,\nAndroid 11 includes a fallback to hard reboot that's\ntriggered when one of the following conditions is met:\n| **Note:** This list isn't exhaustive.\n\n- A device fails to start soft restart (that is, `sys.init.userspace_reboot.in_progress=1`) within a given timeout.\n- A process fails to stop within a given timeout.\n- The `/system/bin/vdc volume reset` operation fails.\n- The unmounting of the zRAM device fails.\n- An active APEX package unmounts incorrectly.\n- An attempt to remount `userdata` into checkpointing mode fails.\n- A device fails to successfully boot (that is, `sys.boot_completed=1`) within a given timeout.\n\nPer-device configuration\n------------------------\n\nSome soft restart aspects can be tuned by changing values of the following\nproperties:\n\n- `init.userspace_reboot.is_supported` controls when a device can perform a soft restart. If value of this property is `false`, `0`, or not specified, then attempts to restart are rejected.\n- `init.userspace_reboot.sigkill.timeoutmillis` controls the timeout in milliseconds for processes that received a `SIGKILL` signal to stop. If one of the processes fails to stop in the given timeout, then a fallback to hard reboot is triggered.\n- `init.userspace_reboot.sigterm.timeoutmillis` controls the timeout in milliseconds for processes that received a `SIGTERM` signal to terminate. All the processes that failed to terminate in the given timeout receive a `SIGKILL` signal.\n- `init.userspace_reboot.started.timeoutmillis` controls the timeout in milliseconds for soft restart to start (that is, `sys.init.userspace_reboot.in_progress=1`). If a device fails to start soft restart within the given timeout, a fallback to hard reboot is triggered.\n- `init.userspace_reboot.userdata_remount.timeoutmillis` controls the timeout in milliseconds to unmount `userdata`. If a device fails to unmount `userdata` within the given timeout, a fallback to hard reboot is triggered.\n- `init.userspace_reboot.watchdog.timeoutmillis` controls the timeout for a device to successfully boot (that is, `sys.boot_completed=1`). If a device fails to boot within the given timeout, a fallback to hard reboot is triggered.\n\n| **Note:** Changing value of the above properties requires `root` access.\n\nCustomize animation during soft restart\n---------------------------------------\n\nThe reference implementation of a soft restart includes an ability to customize\nanimation shown during the soft restart.\n\nAt the end of the `userspace-reboot-fs-remount` action, `init` starts the\n`bootanim` service. This service looks for the existence of the following\nanimation files, in the order listed, and plays the first one it finds:\n\n- `/product/media/userspace-reboot.zip`\n- `/oem/media/userspace-reboot.zip`\n- `/system/media/userspace-reboot.zip`\n\n| **Note:** Animation files must adhere to the following [format](https://cs.android.com/android/platform/superproject/+/android-latest-release:frameworks/base/cmds/bootanimation/FORMAT.md)\n\nIf no soft restart specific animation files are specified, `bootanim` shows a\ndefault `android` animation.\n\nTesting\n-------\n\nAndroid 11 includes a reference implementation of a\nsoft restart. In addition, you can verify a soft restart using CTS\ntests in\n[`UserspaceRebootHostTest`](https://cs.android.com/android/_/android/platform/cts/+/7d2209956506ccca386863526b00160739d11062:hostsidetests/userspacereboot/src/com/android/cts/userspacereboot/host/UserspaceRebootHostTest.java;l=38;drc=5023f0c980728da99188e216269e498730c4476c)."]]