summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTao Bao <tbao@google.com>2019-10-02 23:00:08 +0200
committerGerrit Code Review <noreply-gerritcodereview@google.com>2019-10-02 23:00:08 +0200
commitc6fb9f9df5807f7eba23fc8a4cdd6aa03273b835 (patch)
tree76c6fa3594480dafbd5b0ef7c032bf7258a017bb
parentMerge "otautil: Drop a few unneeded includes." (diff)
parentotautil: Factor out the utils that're private to recovery. (diff)
downloadandroid_bootable_recovery-c6fb9f9df5807f7eba23fc8a4cdd6aa03273b835.tar
android_bootable_recovery-c6fb9f9df5807f7eba23fc8a4cdd6aa03273b835.tar.gz
android_bootable_recovery-c6fb9f9df5807f7eba23fc8a4cdd6aa03273b835.tar.bz2
android_bootable_recovery-c6fb9f9df5807f7eba23fc8a4cdd6aa03273b835.tar.lz
android_bootable_recovery-c6fb9f9df5807f7eba23fc8a4cdd6aa03273b835.tar.xz
android_bootable_recovery-c6fb9f9df5807f7eba23fc8a4cdd6aa03273b835.tar.zst
android_bootable_recovery-c6fb9f9df5807f7eba23fc8a4cdd6aa03273b835.zip
-rw-r--r--Android.bp5
-rw-r--r--fsck_unshare_blocks.cpp2
-rw-r--r--install/Android.bp1
-rw-r--r--install/fuse_install.cpp2
-rw-r--r--install/install.cpp4
-rw-r--r--install/wipe_data.cpp6
-rw-r--r--otautil/Android.bp28
-rw-r--r--recovery-persist.cpp4
-rw-r--r--recovery-refresh.cpp3
-rw-r--r--recovery.cpp4
-rw-r--r--recovery_main.cpp4
-rw-r--r--recovery_utils/Android.bp66
-rw-r--r--recovery_utils/include/recovery_utils/logging.h (renamed from otautil/include/otautil/logging.h)0
-rw-r--r--recovery_utils/include/recovery_utils/parse_install_logs.h (renamed from otautil/include/otautil/parse_install_logs.h)0
-rw-r--r--recovery_utils/include/recovery_utils/roots.h (renamed from otautil/include/otautil/roots.h)0
-rw-r--r--recovery_utils/include/recovery_utils/thermalutil.h (renamed from otautil/include/otautil/thermalutil.h)0
-rw-r--r--recovery_utils/logging.cpp (renamed from otautil/logging.cpp)4
-rw-r--r--recovery_utils/parse_install_logs.cpp (renamed from otautil/parse_install_logs.cpp)2
-rw-r--r--recovery_utils/roots.cpp (renamed from otautil/roots.cpp)2
-rw-r--r--recovery_utils/thermalutil.cpp (renamed from otautil/thermalutil.cpp)2
-rw-r--r--tests/Android.bp1
-rw-r--r--tests/unit/parse_install_logs_test.cpp2
22 files changed, 92 insertions, 50 deletions
diff --git a/Android.bp b/Android.bp
index 0eb5fd9e5..0759e08d1 100644
--- a/Android.bp
+++ b/Android.bp
@@ -72,6 +72,7 @@ cc_defaults {
"libinstall",
"librecovery_fastboot",
"libminui",
+ "librecovery_utils",
"libotautil",
// external dependencies
@@ -148,7 +149,7 @@ cc_binary {
],
static_libs: [
- "libotautil",
+ "librecovery_utils",
],
init_rc: [
@@ -174,7 +175,7 @@ cc_binary {
],
static_libs: [
- "libotautil",
+ "librecovery_utils",
],
init_rc: [
diff --git a/fsck_unshare_blocks.cpp b/fsck_unshare_blocks.cpp
index 9dc0fd8ec..e0b2d966b 100644
--- a/fsck_unshare_blocks.cpp
+++ b/fsck_unshare_blocks.cpp
@@ -36,7 +36,7 @@
#include <android-base/unique_fd.h>
#include <fs_mgr/roots.h>
-#include "otautil/roots.h"
+#include "recovery_utils/roots.h"
static constexpr const char* SYSTEM_E2FSCK_BIN = "/system/bin/e2fsck_static";
static constexpr const char* TMP_E2FSCK_BIN = "/tmp/e2fsck.bin";
diff --git a/install/Android.bp b/install/Android.bp
index e24027049..d4606e92c 100644
--- a/install/Android.bp
+++ b/install/Android.bp
@@ -37,6 +37,7 @@ cc_defaults {
],
static_libs: [
+ "librecovery_utils",
"libotautil",
// external dependencies
diff --git a/install/fuse_install.cpp b/install/fuse_install.cpp
index 8a7a278e0..143b5d3fb 100644
--- a/install/fuse_install.cpp
+++ b/install/fuse_install.cpp
@@ -37,7 +37,7 @@
#include "fuse_provider.h"
#include "fuse_sideload.h"
#include "install/install.h"
-#include "otautil/roots.h"
+#include "recovery_utils/roots.h"
static constexpr const char* SDCARD_ROOT = "/sdcard";
// How long (in seconds) we wait for the fuse-provided package file to
diff --git a/install/install.cpp b/install/install.cpp
index 9d67b0105..9166f9cfb 100644
--- a/install/install.cpp
+++ b/install/install.cpp
@@ -51,11 +51,11 @@
#include "install/wipe_data.h"
#include "otautil/error_code.h"
#include "otautil/paths.h"
-#include "otautil/roots.h"
#include "otautil/sysutil.h"
-#include "otautil/thermalutil.h"
#include "private/setup_commands.h"
#include "recovery_ui/ui.h"
+#include "recovery_utils/roots.h"
+#include "recovery_utils/thermalutil.h"
using namespace std::chrono_literals;
diff --git a/install/wipe_data.cpp b/install/wipe_data.cpp
index 765a8152b..82660bef0 100644
--- a/install/wipe_data.cpp
+++ b/install/wipe_data.cpp
@@ -28,9 +28,9 @@
#include <android-base/stringprintf.h>
#include "otautil/dirutil.h"
-#include "otautil/logging.h"
-#include "otautil/roots.h"
#include "recovery_ui/ui.h"
+#include "recovery_utils/logging.h"
+#include "recovery_utils/roots.h"
constexpr const char* CACHE_ROOT = "/cache";
constexpr const char* DATA_ROOT = "/data";
@@ -120,4 +120,4 @@ bool WipeData(Device* device, bool convert_fbe) {
}
ui->Print("Data wipe %s.\n", success ? "complete" : "failed");
return success;
-} \ No newline at end of file
+}
diff --git a/otautil/Android.bp b/otautil/Android.bp
index 6f816a17d..c8f974688 100644
--- a/otautil/Android.bp
+++ b/otautil/Android.bp
@@ -39,32 +39,4 @@ cc_library_static {
export_include_dirs: [
"include",
],
-
- target: {
- android: {
- srcs: [
- "logging.cpp",
- "parse_install_logs.cpp",
- "roots.cpp",
- "thermalutil.cpp",
- ],
-
- include_dirs: [
- "system/vold",
- ],
-
- static_libs: [
- "libfstab",
- ],
-
- shared_libs: [
- "libext4_utils",
- "libfs_mgr",
- ],
-
- export_static_lib_headers: [
- "libfstab",
- ],
- },
- },
}
diff --git a/recovery-persist.cpp b/recovery-persist.cpp
index 294017a12..6dbf86253 100644
--- a/recovery-persist.cpp
+++ b/recovery-persist.cpp
@@ -43,8 +43,8 @@
#include <metricslogger/metrics_logger.h>
#include <private/android_logger.h> /* private pmsg functions */
-#include "otautil/logging.h"
-#include "otautil/parse_install_logs.h"
+#include "recovery_utils/logging.h"
+#include "recovery_utils/parse_install_logs.h"
constexpr const char* LAST_LOG_FILE = "/data/misc/recovery/last_log";
constexpr const char* LAST_PMSG_FILE = "/sys/fs/pstore/pmsg-ramoops-0";
diff --git a/recovery-refresh.cpp b/recovery-refresh.cpp
index d41755d0a..42acd05be 100644
--- a/recovery-refresh.cpp
+++ b/recovery-refresh.cpp
@@ -38,11 +38,12 @@
//
#include <string.h>
+
#include <string>
#include <private/android_logger.h> /* private pmsg functions */
-#include "otautil/logging.h"
+#include "recovery_utils/logging.h"
int main(int argc, char **argv) {
static const char filter[] = "recovery/";
diff --git a/recovery.cpp b/recovery.cpp
index 4862dfccb..682ddbc4c 100644
--- a/recovery.cpp
+++ b/recovery.cpp
@@ -55,12 +55,12 @@
#include "install/wipe_device.h"
#include "otautil/boot_state.h"
#include "otautil/error_code.h"
-#include "otautil/logging.h"
#include "otautil/paths.h"
-#include "otautil/roots.h"
#include "otautil/sysutil.h"
#include "recovery_ui/screen_ui.h"
#include "recovery_ui/ui.h"
+#include "recovery_utils/logging.h"
+#include "recovery_utils/roots.h"
static constexpr const char* COMMAND_FILE = "/cache/recovery/command";
static constexpr const char* LAST_KMSG_FILE = "/cache/recovery/last_kmsg";
diff --git a/recovery_main.cpp b/recovery_main.cpp
index a04c1bbae..89253dcd2 100644
--- a/recovery_main.cpp
+++ b/recovery_main.cpp
@@ -51,14 +51,14 @@
#include "fastboot/fastboot.h"
#include "install/wipe_data.h"
#include "otautil/boot_state.h"
-#include "otautil/logging.h"
#include "otautil/paths.h"
-#include "otautil/roots.h"
#include "otautil/sysutil.h"
#include "recovery.h"
#include "recovery_ui/device.h"
#include "recovery_ui/stub_ui.h"
#include "recovery_ui/ui.h"
+#include "recovery_utils/logging.h"
+#include "recovery_utils/roots.h"
static constexpr const char* COMMAND_FILE = "/cache/recovery/command";
static constexpr const char* LOCALE_FILE = "/cache/recovery/last_locale";
diff --git a/recovery_utils/Android.bp b/recovery_utils/Android.bp
new file mode 100644
index 000000000..271d0799d
--- /dev/null
+++ b/recovery_utils/Android.bp
@@ -0,0 +1,66 @@
+// Copyright (C) 2019 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.
+
+// A utility lib that's local to recovery (in contrast, libotautil is exposed to device-specific
+// recovery_ui lib as well as device-specific updater).
+cc_library_static {
+ name: "librecovery_utils",
+
+ recovery_available: true,
+
+ defaults: [
+ "recovery_defaults",
+ ],
+
+ srcs: [
+ "logging.cpp",
+ "parse_install_logs.cpp",
+ "roots.cpp",
+ "thermalutil.cpp",
+ ],
+
+ shared_libs: [
+ "libbase",
+ "libext4_utils",
+ "libfs_mgr",
+ "libselinux",
+ ],
+
+ export_include_dirs: [
+ "include",
+ ],
+
+ include_dirs: [
+ "system/vold",
+ ],
+
+ static_libs: [
+ "libotautil",
+
+ // external dependency
+ "libfstab",
+ ],
+
+ export_static_lib_headers: [
+ "libfstab",
+ ],
+
+ // Should avoid exposing to the libs that might be used in device-specific codes (e.g.
+ // libedify, libotautil, librecovery_ui).
+ visibility: [
+ "//bootable/recovery",
+ "//bootable/recovery/install",
+ "//bootable/recovery/tests",
+ ],
+}
diff --git a/otautil/include/otautil/logging.h b/recovery_utils/include/recovery_utils/logging.h
index 4462eca6e..4462eca6e 100644
--- a/otautil/include/otautil/logging.h
+++ b/recovery_utils/include/recovery_utils/logging.h
diff --git a/otautil/include/otautil/parse_install_logs.h b/recovery_utils/include/recovery_utils/parse_install_logs.h
index 135d29ccf..135d29ccf 100644
--- a/otautil/include/otautil/parse_install_logs.h
+++ b/recovery_utils/include/recovery_utils/parse_install_logs.h
diff --git a/otautil/include/otautil/roots.h b/recovery_utils/include/recovery_utils/roots.h
index 92ee756f0..92ee756f0 100644
--- a/otautil/include/otautil/roots.h
+++ b/recovery_utils/include/recovery_utils/roots.h
diff --git a/otautil/include/otautil/thermalutil.h b/recovery_utils/include/recovery_utils/thermalutil.h
index 43ab55940..43ab55940 100644
--- a/otautil/include/otautil/thermalutil.h
+++ b/recovery_utils/include/recovery_utils/thermalutil.h
diff --git a/otautil/logging.cpp b/recovery_utils/logging.cpp
index 3db0e8ac2..52f12a8d8 100644
--- a/otautil/logging.cpp
+++ b/recovery_utils/logging.cpp
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-#include "otautil/logging.h"
+#include "recovery_utils/logging.h"
#include <dirent.h>
#include <errno.h>
@@ -38,7 +38,7 @@
#include "otautil/dirutil.h"
#include "otautil/paths.h"
-#include "otautil/roots.h"
+#include "recovery_utils/roots.h"
constexpr const char* LOG_FILE = "/cache/recovery/log";
constexpr const char* LAST_INSTALL_FILE = "/cache/recovery/last_install";
diff --git a/otautil/parse_install_logs.cpp b/recovery_utils/parse_install_logs.cpp
index 13a729921..c86317623 100644
--- a/otautil/parse_install_logs.cpp
+++ b/recovery_utils/parse_install_logs.cpp
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-#include "otautil/parse_install_logs.h"
+#include "recovery_utils/parse_install_logs.h"
#include <unistd.h>
diff --git a/otautil/roots.cpp b/recovery_utils/roots.cpp
index e098b4b77..f717ec208 100644
--- a/otautil/roots.cpp
+++ b/recovery_utils/roots.cpp
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-#include "otautil/roots.h"
+#include "recovery_utils/roots.h"
#include <fcntl.h>
#include <stdint.h>
diff --git a/otautil/thermalutil.cpp b/recovery_utils/thermalutil.cpp
index 4660e057e..5436355d6 100644
--- a/otautil/thermalutil.cpp
+++ b/recovery_utils/thermalutil.cpp
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-#include "otautil/thermalutil.h"
+#include "recovery_utils/thermalutil.h"
#include <dirent.h>
#include <stdio.h>
diff --git a/tests/Android.bp b/tests/Android.bp
index 3335c0b83..5b881e367 100644
--- a/tests/Android.bp
+++ b/tests/Android.bp
@@ -117,6 +117,7 @@ cc_test {
"librecovery_ui",
"libfusesideload",
"libminui",
+ "librecovery_utils",
"libotautil",
"libupdater_device",
"libupdater_core",
diff --git a/tests/unit/parse_install_logs_test.cpp b/tests/unit/parse_install_logs_test.cpp
index 72169a0c6..052f71c98 100644
--- a/tests/unit/parse_install_logs_test.cpp
+++ b/tests/unit/parse_install_logs_test.cpp
@@ -22,7 +22,7 @@
#include <android-base/strings.h>
#include <gtest/gtest.h>
-#include "otautil/parse_install_logs.h"
+#include "recovery_utils/parse_install_logs.h"
TEST(ParseInstallLogsTest, EmptyFile) {
TemporaryFile last_install;