Merge changes I1cc5d702,I32ab9854
* changes: Move reboot() from common.h into otautil/sysutil.h. otautil: Rename dir/sys/thermal utils.
This commit is contained in:
commit
420f7f8df4
19 changed files with 41 additions and 40 deletions
|
@ -65,6 +65,7 @@ LOCAL_MODULE := librecovery_ui
|
||||||
|
|
||||||
LOCAL_STATIC_LIBRARIES := \
|
LOCAL_STATIC_LIBRARIES := \
|
||||||
libminui \
|
libminui \
|
||||||
|
libotautil \
|
||||||
libbase
|
libbase
|
||||||
|
|
||||||
ifneq ($(TARGET_RECOVERY_UI_MARGIN_HEIGHT),)
|
ifneq ($(TARGET_RECOVERY_UI_MARGIN_HEIGHT),)
|
||||||
|
|
2
common.h
2
common.h
|
@ -48,6 +48,4 @@ void ui_print(const char* format, ...) __printflike(1, 2);
|
||||||
|
|
||||||
bool is_ro_debuggable();
|
bool is_ro_debuggable();
|
||||||
|
|
||||||
bool reboot(const std::string& command);
|
|
||||||
|
|
||||||
#endif // RECOVERY_COMMON_H
|
#endif // RECOVERY_COMMON_H
|
||||||
|
|
|
@ -49,10 +49,10 @@
|
||||||
#include <ziparchive/zip_archive.h>
|
#include <ziparchive/zip_archive.h>
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "otautil/SysUtil.h"
|
|
||||||
#include "otautil/ThermalUtil.h"
|
|
||||||
#include "otautil/error_code.h"
|
#include "otautil/error_code.h"
|
||||||
#include "otautil/paths.h"
|
#include "otautil/paths.h"
|
||||||
|
#include "otautil/sysutil.h"
|
||||||
|
#include "otautil/thermalutil.h"
|
||||||
#include "private/install.h"
|
#include "private/install.h"
|
||||||
#include "roots.h"
|
#include "roots.h"
|
||||||
#include "ui.h"
|
#include "ui.h"
|
||||||
|
|
|
@ -40,14 +40,15 @@ cc_library_static {
|
||||||
target: {
|
target: {
|
||||||
android: {
|
android: {
|
||||||
srcs: [
|
srcs: [
|
||||||
"DirUtil.cpp",
|
"dirutil.cpp",
|
||||||
"SysUtil.cpp",
|
|
||||||
"ThermalUtil.cpp",
|
|
||||||
"mounts.cpp",
|
"mounts.cpp",
|
||||||
|
"sysutil.cpp",
|
||||||
|
"thermalutil.cpp",
|
||||||
],
|
],
|
||||||
|
|
||||||
static_libs: [
|
static_libs: [
|
||||||
"libselinux",
|
"libselinux",
|
||||||
|
"libcutils",
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "otautil/DirUtil.h"
|
#include "otautil/dirutil.h"
|
||||||
|
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
|
@ -50,4 +50,8 @@ class MemMapping {
|
||||||
std::vector<MappedRange> ranges_;
|
std::vector<MappedRange> ranges_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Wrapper function to trigger a reboot, by additionally handling quiescent reboot mode. The
|
||||||
|
// command should start with "reboot," (e.g. "reboot,bootloader" or "reboot,").
|
||||||
|
bool reboot(const std::string& command);
|
||||||
|
|
||||||
#endif // _OTAUTIL_SYSUTIL
|
#endif // _OTAUTIL_SYSUTIL
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "otautil/SysUtil.h"
|
#include "otautil/sysutil.h"
|
||||||
|
|
||||||
#include <errno.h> // TEMP_FAILURE_RETRY
|
#include <errno.h> // TEMP_FAILURE_RETRY
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
@ -28,8 +28,10 @@
|
||||||
|
|
||||||
#include <android-base/file.h>
|
#include <android-base/file.h>
|
||||||
#include <android-base/logging.h>
|
#include <android-base/logging.h>
|
||||||
|
#include <android-base/properties.h>
|
||||||
#include <android-base/strings.h>
|
#include <android-base/strings.h>
|
||||||
#include <android-base/unique_fd.h>
|
#include <android-base/unique_fd.h>
|
||||||
|
#include <cutils/android_reboot.h>
|
||||||
|
|
||||||
bool MemMapping::MapFD(int fd) {
|
bool MemMapping::MapFD(int fd) {
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
|
@ -201,3 +203,11 @@ MemMapping::~MemMapping() {
|
||||||
};
|
};
|
||||||
ranges_.clear();
|
ranges_.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool reboot(const std::string& command) {
|
||||||
|
std::string cmd = command;
|
||||||
|
if (android::base::GetBoolProperty("ro.boot.quiescent", false)) {
|
||||||
|
cmd += ",quiescent";
|
||||||
|
}
|
||||||
|
return android::base::SetProperty(ANDROID_RB_PROPERTY, cmd);
|
||||||
|
}
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "otautil/ThermalUtil.h"
|
#include "otautil/thermalutil.h"
|
||||||
|
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
11
recovery.cpp
11
recovery.cpp
|
@ -67,9 +67,10 @@
|
||||||
#include "fuse_sideload.h"
|
#include "fuse_sideload.h"
|
||||||
#include "install.h"
|
#include "install.h"
|
||||||
#include "minui/minui.h"
|
#include "minui/minui.h"
|
||||||
#include "otautil/DirUtil.h"
|
#include "otautil/dirutil.h"
|
||||||
#include "otautil/error_code.h"
|
#include "otautil/error_code.h"
|
||||||
#include "otautil/paths.h"
|
#include "otautil/paths.h"
|
||||||
|
#include "otautil/sysutil.h"
|
||||||
#include "roots.h"
|
#include "roots.h"
|
||||||
#include "rotate_logs.h"
|
#include "rotate_logs.h"
|
||||||
#include "screen_ui.h"
|
#include "screen_ui.h"
|
||||||
|
@ -177,14 +178,6 @@ bool is_ro_debuggable() {
|
||||||
return android::base::GetBoolProperty("ro.debuggable", false);
|
return android::base::GetBoolProperty("ro.debuggable", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool reboot(const std::string& command) {
|
|
||||||
std::string cmd = command;
|
|
||||||
if (android::base::GetBoolProperty("ro.boot.quiescent", false)) {
|
|
||||||
cmd += ",quiescent";
|
|
||||||
}
|
|
||||||
return android::base::SetProperty(ANDROID_RB_PROPERTY, cmd);
|
|
||||||
}
|
|
||||||
|
|
||||||
// command line args come from, in decreasing precedence:
|
// command line args come from, in decreasing precedence:
|
||||||
// - the actual command line
|
// - the actual command line
|
||||||
// - the bootloader control block (one per line, after "recovery")
|
// - the bootloader control block (one per line, after "recovery")
|
||||||
|
|
|
@ -40,10 +40,10 @@
|
||||||
|
|
||||||
#include "common/test_constants.h"
|
#include "common/test_constants.h"
|
||||||
#include "edify/expr.h"
|
#include "edify/expr.h"
|
||||||
#include "otautil/SysUtil.h"
|
|
||||||
#include "otautil/error_code.h"
|
#include "otautil/error_code.h"
|
||||||
#include "otautil/paths.h"
|
#include "otautil/paths.h"
|
||||||
#include "otautil/print_sha1.h"
|
#include "otautil/print_sha1.h"
|
||||||
|
#include "otautil/sysutil.h"
|
||||||
#include "updater/blockimg.h"
|
#include "updater/blockimg.h"
|
||||||
#include "updater/install.h"
|
#include "updater/install.h"
|
||||||
#include "updater/updater.h"
|
#include "updater/updater.h"
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <gtest/gtest.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
@ -28,9 +27,10 @@
|
||||||
#include <android-base/file.h>
|
#include <android-base/file.h>
|
||||||
#include <android-base/stringprintf.h>
|
#include <android-base/stringprintf.h>
|
||||||
#include <android-base/test_utils.h>
|
#include <android-base/test_utils.h>
|
||||||
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
#include "common/test_constants.h"
|
#include "common/test_constants.h"
|
||||||
#include "otautil/SysUtil.h"
|
#include "otautil/sysutil.h"
|
||||||
#include "verifier.h"
|
#include "verifier.h"
|
||||||
|
|
||||||
using namespace std::string_literals;
|
using namespace std::string_literals;
|
||||||
|
|
|
@ -22,7 +22,8 @@
|
||||||
|
|
||||||
#include <android-base/test_utils.h>
|
#include <android-base/test_utils.h>
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
#include <otautil/DirUtil.h>
|
|
||||||
|
#include "otautil/dirutil.h"
|
||||||
|
|
||||||
TEST(DirUtilTest, create_invalid) {
|
TEST(DirUtilTest, create_invalid) {
|
||||||
// Requesting to create an empty dir is invalid.
|
// Requesting to create an empty dir is invalid.
|
||||||
|
|
|
@ -14,14 +14,13 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <gtest/gtest.h>
|
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include <android-base/file.h>
|
#include <android-base/file.h>
|
||||||
#include <android-base/test_utils.h>
|
#include <android-base/test_utils.h>
|
||||||
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
#include "otautil/SysUtil.h"
|
#include "otautil/sysutil.h"
|
||||||
|
|
||||||
TEST(SysUtilTest, InvalidArgs) {
|
TEST(SysUtilTest, InvalidArgs) {
|
||||||
MemMapping mapping;
|
MemMapping mapping;
|
||||||
|
|
|
@ -23,10 +23,10 @@
|
||||||
#include <android-base/file.h>
|
#include <android-base/file.h>
|
||||||
#include <android-base/test_utils.h>
|
#include <android-base/test_utils.h>
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
#include <otautil/SysUtil.h>
|
|
||||||
#include <ziparchive/zip_archive.h>
|
#include <ziparchive/zip_archive.h>
|
||||||
|
|
||||||
#include "common/test_constants.h"
|
#include "common/test_constants.h"
|
||||||
|
#include "otautil/sysutil.h"
|
||||||
|
|
||||||
TEST(ZipTest, OpenFromMemory) {
|
TEST(ZipTest, OpenFromMemory) {
|
||||||
std::string zip_path = from_testdata_base("ziptest_dummy-update.zip");
|
std::string zip_path = from_testdata_base("ziptest_dummy-update.zip");
|
||||||
|
|
6
ui.cpp
6
ui.cpp
|
@ -36,14 +36,12 @@
|
||||||
#include <android-base/file.h>
|
#include <android-base/file.h>
|
||||||
#include <android-base/logging.h>
|
#include <android-base/logging.h>
|
||||||
#include <android-base/parseint.h>
|
#include <android-base/parseint.h>
|
||||||
#include <android-base/properties.h>
|
|
||||||
#include <android-base/strings.h>
|
#include <android-base/strings.h>
|
||||||
#include <cutils/android_reboot.h>
|
|
||||||
#include <minui/minui.h>
|
#include <minui/minui.h>
|
||||||
|
|
||||||
#include "common.h"
|
|
||||||
#include "roots.h"
|
|
||||||
#include "device.h"
|
#include "device.h"
|
||||||
|
#include "otautil/sysutil.h"
|
||||||
|
#include "roots.h"
|
||||||
|
|
||||||
static constexpr int UI_WAIT_KEY_TIMEOUT_SEC = 120;
|
static constexpr int UI_WAIT_KEY_TIMEOUT_SEC = 120;
|
||||||
static constexpr const char* BRIGHTNESS_FILE = "/sys/class/leds/lcd-backlight/brightness";
|
static constexpr const char* BRIGHTNESS_FILE = "/sys/class/leds/lcd-backlight/brightness";
|
||||||
|
|
|
@ -48,7 +48,6 @@
|
||||||
#include <android-base/strings.h>
|
#include <android-base/strings.h>
|
||||||
#include <applypatch/applypatch.h>
|
#include <applypatch/applypatch.h>
|
||||||
#include <bootloader_message/bootloader_message.h>
|
#include <bootloader_message/bootloader_message.h>
|
||||||
#include <cutils/android_reboot.h>
|
|
||||||
#include <ext4_utils/wipe.h>
|
#include <ext4_utils/wipe.h>
|
||||||
#include <openssl/sha.h>
|
#include <openssl/sha.h>
|
||||||
#include <selinux/label.h>
|
#include <selinux/label.h>
|
||||||
|
@ -58,10 +57,11 @@
|
||||||
|
|
||||||
#include "edify/expr.h"
|
#include "edify/expr.h"
|
||||||
#include "otafault/ota_io.h"
|
#include "otafault/ota_io.h"
|
||||||
#include "otautil/DirUtil.h"
|
#include "otautil/dirutil.h"
|
||||||
#include "otautil/error_code.h"
|
#include "otautil/error_code.h"
|
||||||
#include "otautil/mounts.h"
|
#include "otautil/mounts.h"
|
||||||
#include "otautil/print_sha1.h"
|
#include "otautil/print_sha1.h"
|
||||||
|
#include "otautil/sysutil.h"
|
||||||
#include "updater/updater.h"
|
#include "updater/updater.h"
|
||||||
|
|
||||||
// Send over the buffer to recovery though the command pipe.
|
// Send over the buffer to recovery though the command pipe.
|
||||||
|
@ -874,11 +874,7 @@ Value* RebootNowFn(const char* name, State* state, const std::vector<std::unique
|
||||||
return StringValue("");
|
return StringValue("");
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string reboot_cmd = "reboot," + property;
|
reboot("reboot," + property);
|
||||||
if (android::base::GetBoolProperty("ro.boot.quiescent", false)) {
|
|
||||||
reboot_cmd += ",quiescent";
|
|
||||||
}
|
|
||||||
android::base::SetProperty(ANDROID_RB_PROPERTY, reboot_cmd);
|
|
||||||
|
|
||||||
sleep(5);
|
sleep(5);
|
||||||
return ErrorAbort(state, kRebootFailure, "%s() failed to reboot", name);
|
return ErrorAbort(state, kRebootFailure, "%s() failed to reboot", name);
|
||||||
|
|
|
@ -32,9 +32,9 @@
|
||||||
|
|
||||||
#include "edify/expr.h"
|
#include "edify/expr.h"
|
||||||
#include "otafault/config.h"
|
#include "otafault/config.h"
|
||||||
#include "otautil/DirUtil.h"
|
#include "otautil/dirutil.h"
|
||||||
#include "otautil/SysUtil.h"
|
|
||||||
#include "otautil/error_code.h"
|
#include "otautil/error_code.h"
|
||||||
|
#include "otautil/sysutil.h"
|
||||||
#include "updater/blockimg.h"
|
#include "updater/blockimg.h"
|
||||||
#include "updater/install.h"
|
#include "updater/install.h"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue