summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTianjie Xu <xunchang@google.com>2018-02-17 01:45:45 +0100
committerandroid-build-merger <android-build-merger@google.com>2018-02-17 01:45:45 +0100
commit7920648ebb22c85a2b48de343f2f217619dba3ad (patch)
treeea1ff0307b7c05641f3c4c9a55dcc1b340dc7c33
parentMerge "recovery: Porting screensave mode for new platform." am: 15e376d792 am: 470b4fef7f (diff)
parentMerge "Skip the cache size check on host" am: 31bcd7c002 (diff)
downloadandroid_bootable_recovery-7920648ebb22c85a2b48de343f2f217619dba3ad.tar
android_bootable_recovery-7920648ebb22c85a2b48de343f2f217619dba3ad.tar.gz
android_bootable_recovery-7920648ebb22c85a2b48de343f2f217619dba3ad.tar.bz2
android_bootable_recovery-7920648ebb22c85a2b48de343f2f217619dba3ad.tar.lz
android_bootable_recovery-7920648ebb22c85a2b48de343f2f217619dba3ad.tar.xz
android_bootable_recovery-7920648ebb22c85a2b48de343f2f217619dba3ad.tar.zst
android_bootable_recovery-7920648ebb22c85a2b48de343f2f217619dba3ad.zip
-rw-r--r--applypatch/Android.bp2
-rw-r--r--applypatch/applypatch.cpp5
-rw-r--r--applypatch/freecache.cpp6
-rw-r--r--otafault/Android.bp2
4 files changed, 12 insertions, 3 deletions
diff --git a/applypatch/Android.bp b/applypatch/Android.bp
index b37614072..d3efa152b 100644
--- a/applypatch/Android.bp
+++ b/applypatch/Android.bp
@@ -30,6 +30,8 @@ cc_defaults {
cc_library_static {
name: "libapplypatch",
+ host_supported: true,
+
defaults: [
"applypatch_defaults",
],
diff --git a/applypatch/applypatch.cpp b/applypatch/applypatch.cpp
index 04b964b17..73701abc9 100644
--- a/applypatch/applypatch.cpp
+++ b/applypatch/applypatch.cpp
@@ -450,9 +450,8 @@ int CacheSizeCheck(size_t bytes) {
if (MakeFreeSpaceOnCache(bytes) < 0) {
printf("unable to make %zu bytes available on /cache\n", bytes);
return 1;
- } else {
- return 0;
}
+ return 0;
}
// This function applies binary patches to EMMC target files in a way that is safe (the original
@@ -477,7 +476,7 @@ int CacheSizeCheck(size_t bytes) {
// become obsolete since we have dropped the support for patching non-EMMC targets (EMMC targets
// have the size embedded in the filename).
int applypatch(const char* source_filename, const char* target_filename,
- const char* target_sha1_str, size_t target_size __unused,
+ const char* target_sha1_str, size_t /* target_size */,
const std::vector<std::string>& patch_sha1_str,
const std::vector<std::unique_ptr<Value>>& patch_data, const Value* bonus_data) {
printf("patch %s: ", source_filename);
diff --git a/applypatch/freecache.cpp b/applypatch/freecache.cpp
index 0a40baa97..ec1d20cec 100644
--- a/applypatch/freecache.cpp
+++ b/applypatch/freecache.cpp
@@ -111,6 +111,12 @@ static std::set<std::string> FindExpendableFiles() {
}
int MakeFreeSpaceOnCache(size_t bytes_needed) {
+#ifndef __ANDROID__
+ // TODO (xunchang) implement a heuristic cache size check during host simulation.
+ printf("Skip making (%zu) bytes free space on cache; program is running on host\n", bytes_needed);
+ return 0;
+#endif
+
size_t free_now = FreeSpaceForFile("/cache");
printf("%zu bytes free on /cache (%zu needed)\n", free_now, bytes_needed);
diff --git a/otafault/Android.bp b/otafault/Android.bp
index 91a5d9a54..30d561015 100644
--- a/otafault/Android.bp
+++ b/otafault/Android.bp
@@ -15,6 +15,8 @@
cc_library_static {
name: "libotafault",
+ host_supported: true,
+
srcs: [
"config.cpp",
"ota_io.cpp",