Keun-young Park | 8d01f63 | 2017-03-13 11:54:47 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2017 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
Tom Cherry | 3f5eaae5 | 2017-04-06 16:30:22 -0700 | [diff] [blame] | 16 | |
| 17 | #include "reboot.h" |
| 18 | |
Keun-young Park | 8d01f63 | 2017-03-13 11:54:47 -0700 | [diff] [blame] | 19 | #include <dirent.h> |
| 20 | #include <fcntl.h> |
Keun-young Park | 2ba5c81 | 2017-03-29 12:54:40 -0700 | [diff] [blame] | 21 | #include <linux/fs.h> |
Keun-young Park | 8d01f63 | 2017-03-13 11:54:47 -0700 | [diff] [blame] | 22 | #include <mntent.h> |
| 23 | #include <sys/cdefs.h> |
Keun-young Park | 2ba5c81 | 2017-03-29 12:54:40 -0700 | [diff] [blame] | 24 | #include <sys/ioctl.h> |
Keun-young Park | 8d01f63 | 2017-03-13 11:54:47 -0700 | [diff] [blame] | 25 | #include <sys/mount.h> |
Keun-young Park | 8d01f63 | 2017-03-13 11:54:47 -0700 | [diff] [blame] | 26 | #include <sys/stat.h> |
| 27 | #include <sys/syscall.h> |
| 28 | #include <sys/types.h> |
| 29 | #include <sys/wait.h> |
| 30 | |
| 31 | #include <memory> |
Keun-young Park | 7830d59 | 2017-03-27 16:07:02 -0700 | [diff] [blame] | 32 | #include <set> |
Keun-young Park | 8d01f63 | 2017-03-13 11:54:47 -0700 | [diff] [blame] | 33 | #include <thread> |
| 34 | #include <vector> |
| 35 | |
Tom Cherry | ede0d53 | 2017-07-06 14:20:11 -0700 | [diff] [blame] | 36 | #include <android-base/chrono_utils.h> |
Keun-young Park | 8d01f63 | 2017-03-13 11:54:47 -0700 | [diff] [blame] | 37 | #include <android-base/file.h> |
Tom Cherry | 3f5eaae5 | 2017-04-06 16:30:22 -0700 | [diff] [blame] | 38 | #include <android-base/logging.h> |
Keun-young Park | 8d01f63 | 2017-03-13 11:54:47 -0700 | [diff] [blame] | 39 | #include <android-base/macros.h> |
Tom Cherry | ccf2353 | 2017-03-28 16:40:41 -0700 | [diff] [blame] | 40 | #include <android-base/properties.h> |
Keun-young Park | 8d01f63 | 2017-03-13 11:54:47 -0700 | [diff] [blame] | 41 | #include <android-base/stringprintf.h> |
| 42 | #include <android-base/strings.h> |
Keun-young Park | 2ba5c81 | 2017-03-29 12:54:40 -0700 | [diff] [blame] | 43 | #include <android-base/unique_fd.h> |
Keun-young Park | 8d01f63 | 2017-03-13 11:54:47 -0700 | [diff] [blame] | 44 | #include <bootloader_message/bootloader_message.h> |
| 45 | #include <cutils/android_reboot.h> |
Keun-young Park | 8d01f63 | 2017-03-13 11:54:47 -0700 | [diff] [blame] | 46 | #include <fs_mgr.h> |
| 47 | #include <logwrap/logwrap.h> |
Todd Poynor | fc827be | 2017-04-13 15:17:24 -0700 | [diff] [blame] | 48 | #include <private/android_filesystem_config.h> |
Tom Cherry | 0c8d6d2 | 2017-08-10 12:22:44 -0700 | [diff] [blame] | 49 | #include <selinux/selinux.h> |
Keun-young Park | 8d01f63 | 2017-03-13 11:54:47 -0700 | [diff] [blame] | 50 | |
Tom Cherry | 7fd3bc2 | 2018-02-13 15:36:14 -0800 | [diff] [blame] | 51 | #include "action_manager.h" |
Wei Wang | eeab491 | 2017-06-27 22:08:45 -0700 | [diff] [blame] | 52 | #include "init.h" |
Keun-young Park | 7830d59 | 2017-03-27 16:07:02 -0700 | [diff] [blame] | 53 | #include "property_service.h" |
Tom Cherry | 44aceed | 2018-08-03 13:36:18 -0700 | [diff] [blame] | 54 | #include "reboot_utils.h" |
Keun-young Park | 8d01f63 | 2017-03-13 11:54:47 -0700 | [diff] [blame] | 55 | #include "service.h" |
Luis Hector Chavez | 9f97f47 | 2017-09-06 13:43:57 -0700 | [diff] [blame] | 56 | #include "sigchld_handler.h" |
Keun-young Park | 8d01f63 | 2017-03-13 11:54:47 -0700 | [diff] [blame] | 57 | |
Tom Cherry | 4f4cacc | 2019-01-08 10:39:00 -0800 | [diff] [blame^] | 58 | using android::base::GetBoolProperty; |
Mark Salyzyn | 6290982 | 2017-10-09 09:27:16 -0700 | [diff] [blame] | 59 | using android::base::Split; |
Keun-young Park | 8d01f63 | 2017-03-13 11:54:47 -0700 | [diff] [blame] | 60 | using android::base::StringPrintf; |
Tom Cherry | ede0d53 | 2017-07-06 14:20:11 -0700 | [diff] [blame] | 61 | using android::base::Timer; |
Keun-young Park | 8d01f63 | 2017-03-13 11:54:47 -0700 | [diff] [blame] | 62 | |
Tom Cherry | 81f5d3e | 2017-06-22 12:53:17 -0700 | [diff] [blame] | 63 | namespace android { |
| 64 | namespace init { |
| 65 | |
Keun-young Park | 8d01f63 | 2017-03-13 11:54:47 -0700 | [diff] [blame] | 66 | // represents umount status during reboot / shutdown. |
| 67 | enum UmountStat { |
| 68 | /* umount succeeded. */ |
| 69 | UMOUNT_STAT_SUCCESS = 0, |
| 70 | /* umount was not run. */ |
| 71 | UMOUNT_STAT_SKIPPED = 1, |
| 72 | /* umount failed with timeout. */ |
| 73 | UMOUNT_STAT_TIMEOUT = 2, |
| 74 | /* could not run due to error */ |
| 75 | UMOUNT_STAT_ERROR = 3, |
| 76 | /* not used by init but reserved for other part to use this to represent the |
| 77 | the state where umount status before reboot is not found / available. */ |
| 78 | UMOUNT_STAT_NOT_AVAILABLE = 4, |
| 79 | }; |
| 80 | |
| 81 | // Utility for struct mntent |
| 82 | class MountEntry { |
| 83 | public: |
Keun-young Park | 2ba5c81 | 2017-03-29 12:54:40 -0700 | [diff] [blame] | 84 | explicit MountEntry(const mntent& entry) |
Keun-young Park | 8d01f63 | 2017-03-13 11:54:47 -0700 | [diff] [blame] | 85 | : mnt_fsname_(entry.mnt_fsname), |
| 86 | mnt_dir_(entry.mnt_dir), |
| 87 | mnt_type_(entry.mnt_type), |
Keun-young Park | 2ba5c81 | 2017-03-29 12:54:40 -0700 | [diff] [blame] | 88 | mnt_opts_(entry.mnt_opts) {} |
Keun-young Park | 8d01f63 | 2017-03-13 11:54:47 -0700 | [diff] [blame] | 89 | |
Jaegeuk Kim | 0f04f72 | 2017-09-25 10:55:39 -0700 | [diff] [blame] | 90 | bool Umount(bool force) { |
Tom Cherry | c9fec9d | 2018-02-15 14:26:58 -0800 | [diff] [blame] | 91 | LOG(INFO) << "Unmounting " << mnt_fsname_ << ":" << mnt_dir_ << " opts " << mnt_opts_; |
Jaegeuk Kim | 0f04f72 | 2017-09-25 10:55:39 -0700 | [diff] [blame] | 92 | int r = umount2(mnt_dir_.c_str(), force ? MNT_FORCE : 0); |
Keun-young Park | 2ba5c81 | 2017-03-29 12:54:40 -0700 | [diff] [blame] | 93 | if (r == 0) { |
Tom Cherry | c9fec9d | 2018-02-15 14:26:58 -0800 | [diff] [blame] | 94 | LOG(INFO) << "Umounted " << mnt_fsname_ << ":" << mnt_dir_ << " opts " << mnt_opts_; |
Keun-young Park | 2ba5c81 | 2017-03-29 12:54:40 -0700 | [diff] [blame] | 95 | return true; |
| 96 | } else { |
Tom Cherry | c9fec9d | 2018-02-15 14:26:58 -0800 | [diff] [blame] | 97 | PLOG(WARNING) << "Cannot umount " << mnt_fsname_ << ":" << mnt_dir_ << " opts " |
Keun-young Park | 2ba5c81 | 2017-03-29 12:54:40 -0700 | [diff] [blame] | 98 | << mnt_opts_; |
| 99 | return false; |
| 100 | } |
| 101 | } |
Keun-young Park | 8d01f63 | 2017-03-13 11:54:47 -0700 | [diff] [blame] | 102 | |
Keun-young Park | 2ba5c81 | 2017-03-29 12:54:40 -0700 | [diff] [blame] | 103 | void DoFsck() { |
| 104 | int st; |
| 105 | if (IsF2Fs()) { |
| 106 | const char* f2fs_argv[] = { |
| 107 | "/system/bin/fsck.f2fs", "-f", mnt_fsname_.c_str(), |
| 108 | }; |
| 109 | android_fork_execvp_ext(arraysize(f2fs_argv), (char**)f2fs_argv, &st, true, LOG_KLOG, |
| 110 | true, nullptr, nullptr, 0); |
| 111 | } else if (IsExt4()) { |
| 112 | const char* ext4_argv[] = { |
| 113 | "/system/bin/e2fsck", "-f", "-y", mnt_fsname_.c_str(), |
| 114 | }; |
| 115 | android_fork_execvp_ext(arraysize(ext4_argv), (char**)ext4_argv, &st, true, LOG_KLOG, |
| 116 | true, nullptr, nullptr, 0); |
| 117 | } |
| 118 | } |
Keun-young Park | 8d01f63 | 2017-03-13 11:54:47 -0700 | [diff] [blame] | 119 | |
| 120 | static bool IsBlockDevice(const struct mntent& mntent) { |
| 121 | return android::base::StartsWith(mntent.mnt_fsname, "/dev/block"); |
| 122 | } |
| 123 | |
| 124 | static bool IsEmulatedDevice(const struct mntent& mntent) { |
Keun-young Park | 2ba5c81 | 2017-03-29 12:54:40 -0700 | [diff] [blame] | 125 | return android::base::StartsWith(mntent.mnt_fsname, "/data/"); |
Keun-young Park | 8d01f63 | 2017-03-13 11:54:47 -0700 | [diff] [blame] | 126 | } |
| 127 | |
| 128 | private: |
Keun-young Park | 2ba5c81 | 2017-03-29 12:54:40 -0700 | [diff] [blame] | 129 | bool IsF2Fs() const { return mnt_type_ == "f2fs"; } |
| 130 | |
| 131 | bool IsExt4() const { return mnt_type_ == "ext4"; } |
| 132 | |
Keun-young Park | 8d01f63 | 2017-03-13 11:54:47 -0700 | [diff] [blame] | 133 | std::string mnt_fsname_; |
| 134 | std::string mnt_dir_; |
| 135 | std::string mnt_type_; |
Keun-young Park | 2ba5c81 | 2017-03-29 12:54:40 -0700 | [diff] [blame] | 136 | std::string mnt_opts_; |
Keun-young Park | 8d01f63 | 2017-03-13 11:54:47 -0700 | [diff] [blame] | 137 | }; |
| 138 | |
| 139 | // Turn off backlight while we are performing power down cleanup activities. |
| 140 | static void TurnOffBacklight() { |
Steven Moreland | d5eccfd | 2018-01-19 13:01:53 -0800 | [diff] [blame] | 141 | Service* service = ServiceList::GetInstance().FindService("blank_screen"); |
| 142 | if (service == nullptr) { |
| 143 | LOG(WARNING) << "cannot find blank_screen in TurnOffBacklight"; |
Keun-young Park | 8d01f63 | 2017-03-13 11:54:47 -0700 | [diff] [blame] | 144 | return; |
| 145 | } |
Tom Cherry | d987264 | 2018-10-11 10:38:05 -0700 | [diff] [blame] | 146 | if (auto result = service->Start(); !result) { |
| 147 | LOG(WARNING) << "Could not start blank_screen service: " << result.error(); |
| 148 | } |
Keun-young Park | 8d01f63 | 2017-03-13 11:54:47 -0700 | [diff] [blame] | 149 | } |
| 150 | |
Keun-young Park | 8d01f63 | 2017-03-13 11:54:47 -0700 | [diff] [blame] | 151 | static void ShutdownVold() { |
| 152 | const char* vdc_argv[] = {"/system/bin/vdc", "volume", "shutdown"}; |
| 153 | int status; |
| 154 | android_fork_execvp_ext(arraysize(vdc_argv), (char**)vdc_argv, &status, true, LOG_KLOG, true, |
| 155 | nullptr, nullptr, 0); |
| 156 | } |
| 157 | |
| 158 | static void LogShutdownTime(UmountStat stat, Timer* t) { |
Tom Cherry | ede0d53 | 2017-07-06 14:20:11 -0700 | [diff] [blame] | 159 | LOG(WARNING) << "powerctl_shutdown_time_ms:" << std::to_string(t->duration().count()) << ":" |
| 160 | << stat; |
Keun-young Park | 8d01f63 | 2017-03-13 11:54:47 -0700 | [diff] [blame] | 161 | } |
| 162 | |
Keun-young Park | 8d01f63 | 2017-03-13 11:54:47 -0700 | [diff] [blame] | 163 | /* Find all read+write block devices and emulated devices in /proc/mounts |
| 164 | * and add them to correpsponding list. |
| 165 | */ |
| 166 | static bool FindPartitionsToUmount(std::vector<MountEntry>* blockDevPartitions, |
Keun-young Park | 2ba5c81 | 2017-03-29 12:54:40 -0700 | [diff] [blame] | 167 | std::vector<MountEntry>* emulatedPartitions, bool dump) { |
Tom Cherry | f274e78 | 2018-10-03 13:13:41 -0700 | [diff] [blame] | 168 | std::unique_ptr<std::FILE, int (*)(std::FILE*)> fp(setmntent("/proc/mounts", "re"), endmntent); |
Keun-young Park | 8d01f63 | 2017-03-13 11:54:47 -0700 | [diff] [blame] | 169 | if (fp == nullptr) { |
| 170 | PLOG(ERROR) << "Failed to open /proc/mounts"; |
| 171 | return false; |
| 172 | } |
| 173 | mntent* mentry; |
| 174 | while ((mentry = getmntent(fp.get())) != nullptr) { |
Keun-young Park | 2ba5c81 | 2017-03-29 12:54:40 -0700 | [diff] [blame] | 175 | if (dump) { |
| 176 | LOG(INFO) << "mount entry " << mentry->mnt_fsname << ":" << mentry->mnt_dir << " opts " |
| 177 | << mentry->mnt_opts << " type " << mentry->mnt_type; |
| 178 | } else if (MountEntry::IsBlockDevice(*mentry) && hasmntopt(mentry, "rw")) { |
Keun-young Park | 6e12b38 | 2017-07-17 12:20:33 -0700 | [diff] [blame] | 179 | std::string mount_dir(mentry->mnt_dir); |
| 180 | // These are R/O partitions changed to R/W after adb remount. |
| 181 | // Do not umount them as shutdown critical services may rely on them. |
Wei Wang | a01c27e | 2017-07-25 10:52:08 -0700 | [diff] [blame] | 182 | if (mount_dir != "/" && mount_dir != "/system" && mount_dir != "/vendor" && |
| 183 | mount_dir != "/oem") { |
Keun-young Park | 6e12b38 | 2017-07-17 12:20:33 -0700 | [diff] [blame] | 184 | blockDevPartitions->emplace(blockDevPartitions->begin(), *mentry); |
| 185 | } |
Keun-young Park | 8d01f63 | 2017-03-13 11:54:47 -0700 | [diff] [blame] | 186 | } else if (MountEntry::IsEmulatedDevice(*mentry)) { |
Keun-young Park | 2ba5c81 | 2017-03-29 12:54:40 -0700 | [diff] [blame] | 187 | emulatedPartitions->emplace(emulatedPartitions->begin(), *mentry); |
Keun-young Park | 8d01f63 | 2017-03-13 11:54:47 -0700 | [diff] [blame] | 188 | } |
| 189 | } |
| 190 | return true; |
| 191 | } |
| 192 | |
Keun-young Park | 1663e97 | 2017-04-21 17:29:26 -0700 | [diff] [blame] | 193 | static void DumpUmountDebuggingInfo(bool dump_all) { |
Keun-young Park | 2ba5c81 | 2017-03-29 12:54:40 -0700 | [diff] [blame] | 194 | int status; |
| 195 | if (!security_getenforce()) { |
| 196 | LOG(INFO) << "Run lsof"; |
| 197 | const char* lsof_argv[] = {"/system/bin/lsof"}; |
| 198 | android_fork_execvp_ext(arraysize(lsof_argv), (char**)lsof_argv, &status, true, LOG_KLOG, |
| 199 | true, nullptr, nullptr, 0); |
Keun-young Park | 8d01f63 | 2017-03-13 11:54:47 -0700 | [diff] [blame] | 200 | } |
Keun-young Park | 2ba5c81 | 2017-03-29 12:54:40 -0700 | [diff] [blame] | 201 | FindPartitionsToUmount(nullptr, nullptr, true); |
Keun-young Park | 1663e97 | 2017-04-21 17:29:26 -0700 | [diff] [blame] | 202 | if (dump_all) { |
| 203 | // dump current tasks, this log can be lengthy, so only dump with dump_all |
| 204 | android::base::WriteStringToFile("t", "/proc/sysrq-trigger"); |
| 205 | } |
Keun-young Park | 2ba5c81 | 2017-03-29 12:54:40 -0700 | [diff] [blame] | 206 | } |
| 207 | |
Tom Cherry | ede0d53 | 2017-07-06 14:20:11 -0700 | [diff] [blame] | 208 | static UmountStat UmountPartitions(std::chrono::milliseconds timeout) { |
Keun-young Park | 2ba5c81 | 2017-03-29 12:54:40 -0700 | [diff] [blame] | 209 | Timer t; |
Keun-young Park | 2ba5c81 | 2017-03-29 12:54:40 -0700 | [diff] [blame] | 210 | /* data partition needs all pending writes to be completed and all emulated partitions |
| 211 | * umounted.If the current waiting is not good enough, give |
| 212 | * up and leave it to e2fsck after reboot to fix it. |
| 213 | */ |
| 214 | while (true) { |
| 215 | std::vector<MountEntry> block_devices; |
| 216 | std::vector<MountEntry> emulated_devices; |
| 217 | if (!FindPartitionsToUmount(&block_devices, &emulated_devices, false)) { |
| 218 | return UMOUNT_STAT_ERROR; |
| 219 | } |
| 220 | if (block_devices.size() == 0) { |
Wei Wang | 8c00e42 | 2017-08-16 14:01:46 -0700 | [diff] [blame] | 221 | return UMOUNT_STAT_SUCCESS; |
Keun-young Park | 2ba5c81 | 2017-03-29 12:54:40 -0700 | [diff] [blame] | 222 | } |
Wei Wang | 8c00e42 | 2017-08-16 14:01:46 -0700 | [diff] [blame] | 223 | bool unmount_done = true; |
| 224 | if (emulated_devices.size() > 0) { |
Wei Wang | 25dc30f | 2017-10-23 15:32:03 -0700 | [diff] [blame] | 225 | for (auto& entry : emulated_devices) { |
| 226 | if (!entry.Umount(false)) unmount_done = false; |
| 227 | } |
Wei Wang | 8c00e42 | 2017-08-16 14:01:46 -0700 | [diff] [blame] | 228 | if (unmount_done) { |
| 229 | sync(); |
| 230 | } |
Keun-young Park | 2ba5c81 | 2017-03-29 12:54:40 -0700 | [diff] [blame] | 231 | } |
Wei Wang | 25dc30f | 2017-10-23 15:32:03 -0700 | [diff] [blame] | 232 | for (auto& entry : block_devices) { |
| 233 | if (!entry.Umount(timeout == 0ms)) unmount_done = false; |
| 234 | } |
Wei Wang | 8c00e42 | 2017-08-16 14:01:46 -0700 | [diff] [blame] | 235 | if (unmount_done) { |
| 236 | return UMOUNT_STAT_SUCCESS; |
Keun-young Park | 2ba5c81 | 2017-03-29 12:54:40 -0700 | [diff] [blame] | 237 | } |
Wei Wang | 8c00e42 | 2017-08-16 14:01:46 -0700 | [diff] [blame] | 238 | if ((timeout < t.duration())) { // try umount at least once |
| 239 | return UMOUNT_STAT_TIMEOUT; |
Keun-young Park | 2ba5c81 | 2017-03-29 12:54:40 -0700 | [diff] [blame] | 240 | } |
Keun-young Park | 2ba5c81 | 2017-03-29 12:54:40 -0700 | [diff] [blame] | 241 | std::this_thread::sleep_for(100ms); |
| 242 | } |
Keun-young Park | 8d01f63 | 2017-03-13 11:54:47 -0700 | [diff] [blame] | 243 | } |
| 244 | |
Keun-young Park | 3ee0df9 | 2017-03-27 11:21:09 -0700 | [diff] [blame] | 245 | static void KillAllProcesses() { android::base::WriteStringToFile("i", "/proc/sysrq-trigger"); } |
| 246 | |
Keun-young Park | 8d01f63 | 2017-03-13 11:54:47 -0700 | [diff] [blame] | 247 | /* Try umounting all emulated file systems R/W block device cfile systems. |
| 248 | * This will just try umount and give it up if it fails. |
| 249 | * For fs like ext4, this is ok as file system will be marked as unclean shutdown |
| 250 | * and necessary check can be done at the next reboot. |
| 251 | * For safer shutdown, caller needs to make sure that |
| 252 | * all processes / emulated partition for the target fs are all cleaned-up. |
| 253 | * |
| 254 | * return true when umount was successful. false when timed out. |
| 255 | */ |
Tom Cherry | ede0d53 | 2017-07-06 14:20:11 -0700 | [diff] [blame] | 256 | static UmountStat TryUmountAndFsck(bool runFsck, std::chrono::milliseconds timeout) { |
Keun-young Park | 3ee0df9 | 2017-03-27 11:21:09 -0700 | [diff] [blame] | 257 | Timer t; |
Keun-young Park | 2ba5c81 | 2017-03-29 12:54:40 -0700 | [diff] [blame] | 258 | std::vector<MountEntry> block_devices; |
| 259 | std::vector<MountEntry> emulated_devices; |
Keun-young Park | 8d01f63 | 2017-03-13 11:54:47 -0700 | [diff] [blame] | 260 | |
Keun-young Park | 2ba5c81 | 2017-03-29 12:54:40 -0700 | [diff] [blame] | 261 | if (runFsck && !FindPartitionsToUmount(&block_devices, &emulated_devices, false)) { |
Keun-young Park | 8d01f63 | 2017-03-13 11:54:47 -0700 | [diff] [blame] | 262 | return UMOUNT_STAT_ERROR; |
| 263 | } |
Keun-young Park | 2ba5c81 | 2017-03-29 12:54:40 -0700 | [diff] [blame] | 264 | |
Tom Cherry | ede0d53 | 2017-07-06 14:20:11 -0700 | [diff] [blame] | 265 | UmountStat stat = UmountPartitions(timeout - t.duration()); |
Keun-young Park | 2ba5c81 | 2017-03-29 12:54:40 -0700 | [diff] [blame] | 266 | if (stat != UMOUNT_STAT_SUCCESS) { |
| 267 | LOG(INFO) << "umount timeout, last resort, kill all and try"; |
Keun-young Park | c59b822 | 2017-07-18 18:52:25 -0700 | [diff] [blame] | 268 | if (DUMP_ON_UMOUNT_FAILURE) DumpUmountDebuggingInfo(true); |
Keun-young Park | 3ee0df9 | 2017-03-27 11:21:09 -0700 | [diff] [blame] | 269 | KillAllProcesses(); |
Keun-young Park | 2ba5c81 | 2017-03-29 12:54:40 -0700 | [diff] [blame] | 270 | // even if it succeeds, still it is timeout and do not run fsck with all processes killed |
Keun-young Park | c59b822 | 2017-07-18 18:52:25 -0700 | [diff] [blame] | 271 | UmountStat st = UmountPartitions(0ms); |
| 272 | if ((st != UMOUNT_STAT_SUCCESS) && DUMP_ON_UMOUNT_FAILURE) DumpUmountDebuggingInfo(false); |
Keun-young Park | 8d01f63 | 2017-03-13 11:54:47 -0700 | [diff] [blame] | 273 | } |
| 274 | |
Keun-young Park | 2ba5c81 | 2017-03-29 12:54:40 -0700 | [diff] [blame] | 275 | if (stat == UMOUNT_STAT_SUCCESS && runFsck) { |
| 276 | // fsck part is excluded from timeout check. It only runs for user initiated shutdown |
| 277 | // and should not affect reboot time. |
| 278 | for (auto& entry : block_devices) { |
| 279 | entry.DoFsck(); |
| 280 | } |
| 281 | } |
Keun-young Park | 8d01f63 | 2017-03-13 11:54:47 -0700 | [diff] [blame] | 282 | return stat; |
| 283 | } |
| 284 | |
Tom Cherry | 44aceed | 2018-08-03 13:36:18 -0700 | [diff] [blame] | 285 | //* Reboot / shutdown the system. |
| 286 | // cmd ANDROID_RB_* as defined in android_reboot.h |
| 287 | // reason Reason string like "reboot", "shutdown,userrequested" |
| 288 | // rebootTarget Reboot target string like "bootloader". Otherwise, it should be an |
| 289 | // empty string. |
| 290 | // runFsck Whether to run fsck after umount is done. |
| 291 | // |
| 292 | static void DoReboot(unsigned int cmd, const std::string& reason, const std::string& rebootTarget, |
| 293 | bool runFsck) { |
Keun-young Park | 8d01f63 | 2017-03-13 11:54:47 -0700 | [diff] [blame] | 294 | Timer t; |
Tom Cherry | 0a72e6c | 2018-03-19 16:19:01 -0700 | [diff] [blame] | 295 | LOG(INFO) << "Reboot start, reason: " << reason << ", rebootTarget: " << rebootTarget; |
| 296 | |
| 297 | // Ensure last reboot reason is reduced to canonical |
| 298 | // alias reported in bootloader or system boot reason. |
| 299 | size_t skip = 0; |
| 300 | std::vector<std::string> reasons = Split(reason, ","); |
| 301 | if (reasons.size() >= 2 && reasons[0] == "reboot" && |
| 302 | (reasons[1] == "recovery" || reasons[1] == "bootloader" || reasons[1] == "cold" || |
| 303 | reasons[1] == "hard" || reasons[1] == "warm")) { |
| 304 | skip = strlen("reboot,"); |
| 305 | } |
| 306 | property_set(LAST_REBOOT_REASON_PROPERTY, reason.c_str() + skip); |
| 307 | sync(); |
| 308 | |
| 309 | bool is_thermal_shutdown = cmd == ANDROID_RB_THERMOFF; |
| 310 | |
| 311 | auto shutdown_timeout = 0ms; |
| 312 | if (!SHUTDOWN_ZERO_TIMEOUT) { |
Wei Wang | b5de088 | 2018-10-09 12:42:06 -0700 | [diff] [blame] | 313 | constexpr unsigned int shutdown_timeout_default = 6; |
| 314 | constexpr unsigned int max_thermal_shutdown_timeout = 3; |
| 315 | auto shutdown_timeout_final = android::base::GetUintProperty("ro.build.shutdown_timeout", |
| 316 | shutdown_timeout_default); |
| 317 | if (is_thermal_shutdown && shutdown_timeout_final > max_thermal_shutdown_timeout) { |
| 318 | shutdown_timeout_final = max_thermal_shutdown_timeout; |
Tom Cherry | 0a72e6c | 2018-03-19 16:19:01 -0700 | [diff] [blame] | 319 | } |
Wei Wang | b5de088 | 2018-10-09 12:42:06 -0700 | [diff] [blame] | 320 | shutdown_timeout = std::chrono::seconds(shutdown_timeout_final); |
Tom Cherry | 0a72e6c | 2018-03-19 16:19:01 -0700 | [diff] [blame] | 321 | } |
| 322 | LOG(INFO) << "Shutdown timeout: " << shutdown_timeout.count() << " ms"; |
| 323 | |
Keun-young Park | 7830d59 | 2017-03-27 16:07:02 -0700 | [diff] [blame] | 324 | // keep debugging tools until non critical ones are all gone. |
| 325 | const std::set<std::string> kill_after_apps{"tombstoned", "logd", "adbd"}; |
| 326 | // watchdogd is a vendor specific component but should be alive to complete shutdown safely. |
Keun-young Park | cccb34f | 2017-07-05 11:38:44 -0700 | [diff] [blame] | 327 | const std::set<std::string> to_starts{"watchdogd"}; |
Tom Cherry | 911b9b1 | 2017-07-27 16:20:58 -0700 | [diff] [blame] | 328 | for (const auto& s : ServiceList::GetInstance()) { |
Keun-young Park | 7830d59 | 2017-03-27 16:07:02 -0700 | [diff] [blame] | 329 | if (kill_after_apps.count(s->name())) { |
| 330 | s->SetShutdownCritical(); |
| 331 | } else if (to_starts.count(s->name())) { |
Tom Cherry | 702ca9a | 2017-08-25 10:36:52 -0700 | [diff] [blame] | 332 | if (auto result = s->Start(); !result) { |
| 333 | LOG(ERROR) << "Could not start shutdown 'to_start' service '" << s->name() |
| 334 | << "': " << result.error(); |
| 335 | } |
Keun-young Park | 7830d59 | 2017-03-27 16:07:02 -0700 | [diff] [blame] | 336 | s->SetShutdownCritical(); |
Keun-young Park | cccb34f | 2017-07-05 11:38:44 -0700 | [diff] [blame] | 337 | } else if (s->IsShutdownCritical()) { |
Tom Cherry | 702ca9a | 2017-08-25 10:36:52 -0700 | [diff] [blame] | 338 | // Start shutdown critical service if not started. |
| 339 | if (auto result = s->Start(); !result) { |
| 340 | LOG(ERROR) << "Could not start shutdown critical service '" << s->name() |
| 341 | << "': " << result.error(); |
| 342 | } |
Keun-young Park | 8d01f63 | 2017-03-13 11:54:47 -0700 | [diff] [blame] | 343 | } |
Tom Cherry | 911b9b1 | 2017-07-27 16:20:58 -0700 | [diff] [blame] | 344 | } |
Keun-young Park | 7830d59 | 2017-03-27 16:07:02 -0700 | [diff] [blame] | 345 | |
Steven Moreland | d5eccfd | 2018-01-19 13:01:53 -0800 | [diff] [blame] | 346 | // remaining operations (specifically fsck) may take a substantial duration |
Tom Cherry | 0a72e6c | 2018-03-19 16:19:01 -0700 | [diff] [blame] | 347 | if (cmd == ANDROID_RB_POWEROFF || is_thermal_shutdown) { |
Steven Moreland | d5eccfd | 2018-01-19 13:01:53 -0800 | [diff] [blame] | 348 | TurnOffBacklight(); |
| 349 | } |
| 350 | |
Tom Cherry | 911b9b1 | 2017-07-27 16:20:58 -0700 | [diff] [blame] | 351 | Service* bootAnim = ServiceList::GetInstance().FindService("bootanim"); |
| 352 | Service* surfaceFlinger = ServiceList::GetInstance().FindService("surfaceflinger"); |
Keun-young Park | 7830d59 | 2017-03-27 16:07:02 -0700 | [diff] [blame] | 353 | if (bootAnim != nullptr && surfaceFlinger != nullptr && surfaceFlinger->IsRunning()) { |
Tom Cherry | 4f4cacc | 2019-01-08 10:39:00 -0800 | [diff] [blame^] | 354 | bool do_shutdown_animation = GetBoolProperty("ro.init.shutdown_animation", false); |
| 355 | |
| 356 | if (do_shutdown_animation) { |
| 357 | property_set("service.bootanim.exit", "0"); |
| 358 | // Could be in the middle of animation. Stop and start so that it can pick |
| 359 | // up the right mode. |
| 360 | bootAnim->Stop(); |
| 361 | } |
| 362 | |
Tom Cherry | 911b9b1 | 2017-07-27 16:20:58 -0700 | [diff] [blame] | 363 | for (const auto& service : ServiceList::GetInstance()) { |
Tom Cherry | 4f4cacc | 2019-01-08 10:39:00 -0800 | [diff] [blame^] | 364 | if (service->classnames().count("animation") == 0) { |
| 365 | continue; |
| 366 | } |
| 367 | |
| 368 | // start all animation classes if stopped. |
| 369 | if (do_shutdown_animation) { |
| 370 | service->Start().IgnoreError(); |
| 371 | } |
| 372 | service->SetShutdownCritical(); // will not check animation class separately |
| 373 | } |
| 374 | |
| 375 | if (do_shutdown_animation) { |
| 376 | bootAnim->Start().IgnoreError(); |
| 377 | surfaceFlinger->SetShutdownCritical(); |
| 378 | bootAnim->SetShutdownCritical(); |
Tom Cherry | 911b9b1 | 2017-07-27 16:20:58 -0700 | [diff] [blame] | 379 | } |
Keun-young Park | 8d01f63 | 2017-03-13 11:54:47 -0700 | [diff] [blame] | 380 | } |
Keun-young Park | 7830d59 | 2017-03-27 16:07:02 -0700 | [diff] [blame] | 381 | |
Keun-young Park | 8d01f63 | 2017-03-13 11:54:47 -0700 | [diff] [blame] | 382 | // optional shutdown step |
| 383 | // 1. terminate all services except shutdown critical ones. wait for delay to finish |
Keun-young Park | 3017387 | 2017-07-18 10:58:28 -0700 | [diff] [blame] | 384 | if (shutdown_timeout > 0ms) { |
Keun-young Park | 8d01f63 | 2017-03-13 11:54:47 -0700 | [diff] [blame] | 385 | LOG(INFO) << "terminating init services"; |
Keun-young Park | 8d01f63 | 2017-03-13 11:54:47 -0700 | [diff] [blame] | 386 | |
| 387 | // Ask all services to terminate except shutdown critical ones. |
Tom Cherry | 911b9b1 | 2017-07-27 16:20:58 -0700 | [diff] [blame] | 388 | for (const auto& s : ServiceList::GetInstance().services_in_shutdown_order()) { |
Keun-young Park | 8d01f63 | 2017-03-13 11:54:47 -0700 | [diff] [blame] | 389 | if (!s->IsShutdownCritical()) s->Terminate(); |
Tom Cherry | 911b9b1 | 2017-07-27 16:20:58 -0700 | [diff] [blame] | 390 | } |
Keun-young Park | 8d01f63 | 2017-03-13 11:54:47 -0700 | [diff] [blame] | 391 | |
| 392 | int service_count = 0; |
Keun-young Park | 3017387 | 2017-07-18 10:58:28 -0700 | [diff] [blame] | 393 | // Only wait up to half of timeout here |
| 394 | auto termination_wait_timeout = shutdown_timeout / 2; |
Tom Cherry | ede0d53 | 2017-07-06 14:20:11 -0700 | [diff] [blame] | 395 | while (t.duration() < termination_wait_timeout) { |
Tom Cherry | eeee831 | 2017-07-28 15:22:23 -0700 | [diff] [blame] | 396 | ReapAnyOutstandingChildren(); |
Keun-young Park | 8d01f63 | 2017-03-13 11:54:47 -0700 | [diff] [blame] | 397 | |
| 398 | service_count = 0; |
Tom Cherry | 911b9b1 | 2017-07-27 16:20:58 -0700 | [diff] [blame] | 399 | for (const auto& s : ServiceList::GetInstance()) { |
Keun-young Park | 8d01f63 | 2017-03-13 11:54:47 -0700 | [diff] [blame] | 400 | // Count the number of services running except shutdown critical. |
| 401 | // Exclude the console as it will ignore the SIGTERM signal |
| 402 | // and not exit. |
| 403 | // Note: SVC_CONSOLE actually means "requires console" but |
| 404 | // it is only used by the shell. |
| 405 | if (!s->IsShutdownCritical() && s->pid() != 0 && (s->flags() & SVC_CONSOLE) == 0) { |
| 406 | service_count++; |
| 407 | } |
Tom Cherry | 911b9b1 | 2017-07-27 16:20:58 -0700 | [diff] [blame] | 408 | } |
Keun-young Park | 8d01f63 | 2017-03-13 11:54:47 -0700 | [diff] [blame] | 409 | |
| 410 | if (service_count == 0) { |
| 411 | // All terminable services terminated. We can exit early. |
| 412 | break; |
| 413 | } |
| 414 | |
| 415 | // Wait a bit before recounting the number or running services. |
| 416 | std::this_thread::sleep_for(50ms); |
| 417 | } |
| 418 | LOG(INFO) << "Terminating running services took " << t |
| 419 | << " with remaining services:" << service_count; |
| 420 | } |
| 421 | |
| 422 | // minimum safety steps before restarting |
| 423 | // 2. kill all services except ones that are necessary for the shutdown sequence. |
Tom Cherry | 911b9b1 | 2017-07-27 16:20:58 -0700 | [diff] [blame] | 424 | for (const auto& s : ServiceList::GetInstance().services_in_shutdown_order()) { |
Keun-young Park | 2ba5c81 | 2017-03-29 12:54:40 -0700 | [diff] [blame] | 425 | if (!s->IsShutdownCritical()) s->Stop(); |
Tom Cherry | 911b9b1 | 2017-07-27 16:20:58 -0700 | [diff] [blame] | 426 | } |
Luis Hector Chavez | 92c49bc | 2018-07-27 11:19:25 -0700 | [diff] [blame] | 427 | SubcontextTerminate(); |
Tom Cherry | eeee831 | 2017-07-28 15:22:23 -0700 | [diff] [blame] | 428 | ReapAnyOutstandingChildren(); |
Keun-young Park | 8d01f63 | 2017-03-13 11:54:47 -0700 | [diff] [blame] | 429 | |
| 430 | // 3. send volume shutdown to vold |
Tom Cherry | 911b9b1 | 2017-07-27 16:20:58 -0700 | [diff] [blame] | 431 | Service* voldService = ServiceList::GetInstance().FindService("vold"); |
Keun-young Park | 8d01f63 | 2017-03-13 11:54:47 -0700 | [diff] [blame] | 432 | if (voldService != nullptr && voldService->IsRunning()) { |
| 433 | ShutdownVold(); |
Keun-young Park | 2ba5c81 | 2017-03-29 12:54:40 -0700 | [diff] [blame] | 434 | voldService->Stop(); |
Keun-young Park | 8d01f63 | 2017-03-13 11:54:47 -0700 | [diff] [blame] | 435 | } else { |
| 436 | LOG(INFO) << "vold not running, skipping vold shutdown"; |
| 437 | } |
Keun-young Park | 2ba5c81 | 2017-03-29 12:54:40 -0700 | [diff] [blame] | 438 | // logcat stopped here |
Tom Cherry | 911b9b1 | 2017-07-27 16:20:58 -0700 | [diff] [blame] | 439 | for (const auto& s : ServiceList::GetInstance().services_in_shutdown_order()) { |
Keun-young Park | 2ba5c81 | 2017-03-29 12:54:40 -0700 | [diff] [blame] | 440 | if (kill_after_apps.count(s->name())) s->Stop(); |
Tom Cherry | 911b9b1 | 2017-07-27 16:20:58 -0700 | [diff] [blame] | 441 | } |
Keun-young Park | 8d01f63 | 2017-03-13 11:54:47 -0700 | [diff] [blame] | 442 | // 4. sync, try umount, and optionally run fsck for user shutdown |
Tom Cherry | 1f9d540 | 2018-03-15 10:22:40 -0700 | [diff] [blame] | 443 | { |
| 444 | Timer sync_timer; |
| 445 | LOG(INFO) << "sync() before umount..."; |
| 446 | sync(); |
| 447 | LOG(INFO) << "sync() before umount took" << sync_timer; |
| 448 | } |
Tom Cherry | ede0d53 | 2017-07-06 14:20:11 -0700 | [diff] [blame] | 449 | UmountStat stat = TryUmountAndFsck(runFsck, shutdown_timeout - t.duration()); |
Keun-young Park | 2ba5c81 | 2017-03-29 12:54:40 -0700 | [diff] [blame] | 450 | // Follow what linux shutdown is doing: one more sync with little bit delay |
Tom Cherry | 1f9d540 | 2018-03-15 10:22:40 -0700 | [diff] [blame] | 451 | { |
| 452 | Timer sync_timer; |
| 453 | LOG(INFO) << "sync() after umount..."; |
| 454 | sync(); |
| 455 | LOG(INFO) << "sync() after umount took" << sync_timer; |
| 456 | } |
Tom Cherry | 0a72e6c | 2018-03-19 16:19:01 -0700 | [diff] [blame] | 457 | if (!is_thermal_shutdown) std::this_thread::sleep_for(100ms); |
Keun-young Park | 8d01f63 | 2017-03-13 11:54:47 -0700 | [diff] [blame] | 458 | LogShutdownTime(stat, &t); |
| 459 | // Reboot regardless of umount status. If umount fails, fsck after reboot will fix it. |
| 460 | RebootSystem(cmd, rebootTarget); |
| 461 | abort(); |
| 462 | } |
Tom Cherry | 98ad32a | 2017-04-17 16:34:20 -0700 | [diff] [blame] | 463 | |
| 464 | bool HandlePowerctlMessage(const std::string& command) { |
| 465 | unsigned int cmd = 0; |
Mark Salyzyn | 6290982 | 2017-10-09 09:27:16 -0700 | [diff] [blame] | 466 | std::vector<std::string> cmd_params = Split(command, ","); |
Tom Cherry | 98ad32a | 2017-04-17 16:34:20 -0700 | [diff] [blame] | 467 | std::string reboot_target = ""; |
| 468 | bool run_fsck = false; |
| 469 | bool command_invalid = false; |
| 470 | |
| 471 | if (cmd_params.size() > 3) { |
| 472 | command_invalid = true; |
| 473 | } else if (cmd_params[0] == "shutdown") { |
| 474 | cmd = ANDROID_RB_POWEROFF; |
Mark Salyzyn | 73e6b49 | 2017-08-14 15:56:53 -0700 | [diff] [blame] | 475 | if (cmd_params.size() == 2) { |
| 476 | if (cmd_params[1] == "userrequested") { |
| 477 | // The shutdown reason is PowerManager.SHUTDOWN_USER_REQUESTED. |
| 478 | // Run fsck once the file system is remounted in read-only mode. |
| 479 | run_fsck = true; |
| 480 | } else if (cmd_params[1] == "thermal") { |
Mark Salyzyn | bfd05b6 | 2017-09-26 11:10:12 -0700 | [diff] [blame] | 481 | // Turn off sources of heat immediately. |
| 482 | TurnOffBacklight(); |
Mark Salyzyn | 73e6b49 | 2017-08-14 15:56:53 -0700 | [diff] [blame] | 483 | // run_fsck is false to avoid delay |
| 484 | cmd = ANDROID_RB_THERMOFF; |
| 485 | } |
Tom Cherry | 98ad32a | 2017-04-17 16:34:20 -0700 | [diff] [blame] | 486 | } |
| 487 | } else if (cmd_params[0] == "reboot") { |
| 488 | cmd = ANDROID_RB_RESTART2; |
| 489 | if (cmd_params.size() >= 2) { |
| 490 | reboot_target = cmd_params[1]; |
Hridya Valsaraju | 5425826 | 2018-09-19 21:14:18 -0700 | [diff] [blame] | 491 | // adb reboot fastboot should boot into bootloader for devices not |
| 492 | // supporting logical partitions. |
| 493 | if (reboot_target == "fastboot" && |
Yifan Hong | 0e0f818 | 2018-11-16 12:49:06 -0800 | [diff] [blame] | 494 | !android::base::GetBoolProperty("ro.boot.dynamic_partitions", false)) { |
Hridya Valsaraju | 5425826 | 2018-09-19 21:14:18 -0700 | [diff] [blame] | 495 | reboot_target = "bootloader"; |
| 496 | } |
Tom Cherry | 98ad32a | 2017-04-17 16:34:20 -0700 | [diff] [blame] | 497 | // When rebooting to the bootloader notify the bootloader writing |
| 498 | // also the BCB. |
| 499 | if (reboot_target == "bootloader") { |
| 500 | std::string err; |
| 501 | if (!write_reboot_bootloader(&err)) { |
| 502 | LOG(ERROR) << "reboot-bootloader: Error writing " |
| 503 | "bootloader_message: " |
| 504 | << err; |
| 505 | } |
Hridya Valsaraju | 71fb82a | 2018-08-02 15:02:06 -0700 | [diff] [blame] | 506 | } else if (reboot_target == "sideload" || reboot_target == "sideload-auto-reboot" || |
| 507 | reboot_target == "fastboot") { |
| 508 | std::string arg = reboot_target == "sideload-auto-reboot" ? "sideload_auto_reboot" |
| 509 | : reboot_target; |
| 510 | const std::vector<std::string> options = { |
| 511 | "--" + arg, |
| 512 | }; |
| 513 | std::string err; |
| 514 | if (!write_bootloader_message(options, &err)) { |
| 515 | LOG(ERROR) << "Failed to set bootloader message: " << err; |
| 516 | return false; |
| 517 | } |
| 518 | reboot_target = "recovery"; |
Tom Cherry | 98ad32a | 2017-04-17 16:34:20 -0700 | [diff] [blame] | 519 | } |
Hridya Valsaraju | 71fb82a | 2018-08-02 15:02:06 -0700 | [diff] [blame] | 520 | |
Mark Salyzyn | 73e6b49 | 2017-08-14 15:56:53 -0700 | [diff] [blame] | 521 | // If there is an additional parameter, pass it along |
| 522 | if ((cmd_params.size() == 3) && cmd_params[2].size()) { |
Tom Cherry | 98ad32a | 2017-04-17 16:34:20 -0700 | [diff] [blame] | 523 | reboot_target += "," + cmd_params[2]; |
| 524 | } |
| 525 | } |
Tom Cherry | 98ad32a | 2017-04-17 16:34:20 -0700 | [diff] [blame] | 526 | } else { |
| 527 | command_invalid = true; |
| 528 | } |
| 529 | if (command_invalid) { |
| 530 | LOG(ERROR) << "powerctl: unrecognized command '" << command << "'"; |
| 531 | return false; |
| 532 | } |
| 533 | |
Wei Wang | eeab491 | 2017-06-27 22:08:45 -0700 | [diff] [blame] | 534 | LOG(INFO) << "Clear action queue and start shutdown trigger"; |
| 535 | ActionManager::GetInstance().ClearQueue(); |
| 536 | // Queue shutdown trigger first |
| 537 | ActionManager::GetInstance().QueueEventTrigger("shutdown"); |
| 538 | // Queue built-in shutdown_done |
Tom Cherry | cb0f9bb | 2017-09-12 15:58:47 -0700 | [diff] [blame] | 539 | auto shutdown_handler = [cmd, command, reboot_target, run_fsck](const BuiltinArguments&) { |
Wei Wang | eeab491 | 2017-06-27 22:08:45 -0700 | [diff] [blame] | 540 | DoReboot(cmd, command, reboot_target, run_fsck); |
Tom Cherry | 557946e | 2017-08-01 13:50:23 -0700 | [diff] [blame] | 541 | return Success(); |
Wei Wang | eeab491 | 2017-06-27 22:08:45 -0700 | [diff] [blame] | 542 | }; |
| 543 | ActionManager::GetInstance().QueueBuiltinAction(shutdown_handler, "shutdown_done"); |
| 544 | |
| 545 | // Skip wait for prop if it is in progress |
| 546 | ResetWaitForProp(); |
| 547 | |
Tom Cherry | 3b81f2d | 2017-07-28 14:48:41 -0700 | [diff] [blame] | 548 | // Clear EXEC flag if there is one pending |
Tom Cherry | 911b9b1 | 2017-07-27 16:20:58 -0700 | [diff] [blame] | 549 | for (const auto& s : ServiceList::GetInstance()) { |
| 550 | s->UnSetExec(); |
| 551 | } |
Wei Wang | eeab491 | 2017-06-27 22:08:45 -0700 | [diff] [blame] | 552 | |
Tom Cherry | 98ad32a | 2017-04-17 16:34:20 -0700 | [diff] [blame] | 553 | return true; |
| 554 | } |
Tom Cherry | 81f5d3e | 2017-06-22 12:53:17 -0700 | [diff] [blame] | 555 | |
| 556 | } // namespace init |
| 557 | } // namespace android |