summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Android.bp1
-rw-r--r--Android.mk2
-rw-r--r--applypatch/imgdiff.cpp6
-rw-r--r--edify/include/edify/expr.h2
-rw-r--r--recovery_ui/include/recovery_ui/ui.h4
-rw-r--r--recovery_ui/screen_ui.cpp25
-rw-r--r--recovery_utils/roots.cpp6
-rw-r--r--tests/Android.bp19
-rw-r--r--tests/testdata/recovery.imgbin529707 -> 0 bytes
-rw-r--r--tests/testdata/recovery_bodybin0 -> 1293568 bytes
-rw-r--r--tests/testdata/recovery_headbin0 -> 45056 bytes
-rw-r--r--tests/testdata/recovery_tailbin0 -> 5191 bytes
-rw-r--r--tools/recovery_l10n/res/values-ar/strings.xml4
-rw-r--r--tools/recovery_l10n/res/values-hy/strings.xml2
-rw-r--r--uncrypt/uncrypt.cpp6
-rw-r--r--updater/include/private/commands.h2
16 files changed, 62 insertions, 17 deletions
diff --git a/Android.bp b/Android.bp
index 8e29dc8fd..bd2d0b0b2 100644
--- a/Android.bp
+++ b/Android.bp
@@ -79,6 +79,7 @@ cc_defaults {
"librecovery_utils",
"libotautil",
"libsnapshot_nobinder",
+ "update_metadata-protos",
],
}
diff --git a/Android.mk b/Android.mk
index 9f691531c..58167491a 100644
--- a/Android.mk
+++ b/Android.mk
@@ -56,12 +56,10 @@ include $(CLEAR_VARS)
LOCAL_MODULE := recovery_deps
ifeq ($(TARGET_USERIMAGES_USE_F2FS),true)
-ifeq ($(HOST_OS),linux)
LOCAL_REQUIRED_MODULES += \
make_f2fs.recovery \
sload_f2fs.recovery
endif
-endif
# On A/B devices recovery-persist reads the recovery related file from the persist storage and
# copies them into /data/misc/recovery. Then, for both A/B and non-A/B devices, recovery-persist
diff --git a/applypatch/imgdiff.cpp b/applypatch/imgdiff.cpp
index 6ad4a6105..91007ac3b 100644
--- a/applypatch/imgdiff.cpp
+++ b/applypatch/imgdiff.cpp
@@ -965,7 +965,7 @@ bool ZipModeImage::SplitZipModeImageWithLimit(const ZipModeImage& tgt_image,
used_src_ranges.Insert(src_ranges);
split_src_ranges->push_back(std::move(src_ranges));
}
- src_ranges.Clear();
+ src_ranges = {};
// We don't have enough space for the current chunk; start a new split image and handle
// this chunk there.
@@ -1035,7 +1035,7 @@ bool ZipModeImage::AddSplitImageFromChunkList(const ZipModeImage& tgt_image,
}
ZipModeImage split_tgt_image(false);
- split_tgt_image.Initialize(std::move(aligned_tgt_chunks), {});
+ split_tgt_image.Initialize(aligned_tgt_chunks, {});
split_tgt_image.MergeAdjacentNormalChunks();
// Construct the dummy source file based on the src_ranges.
@@ -1051,7 +1051,7 @@ bool ZipModeImage::AddSplitImageFromChunkList(const ZipModeImage& tgt_image,
CHECK(!src_content.empty());
ZipModeImage split_src_image(true);
- split_src_image.Initialize(split_src_chunks, std::move(src_content));
+ split_src_image.Initialize(split_src_chunks, src_content);
split_tgt_images->push_back(std::move(split_tgt_image));
split_src_images->push_back(std::move(split_src_image));
diff --git a/edify/include/edify/expr.h b/edify/include/edify/expr.h
index cd9c70120..3ddf7f5fe 100644
--- a/edify/include/edify/expr.h
+++ b/edify/include/edify/expr.h
@@ -60,7 +60,7 @@ struct Value {
BLOB = 2,
};
- Value(Type type, const std::string& str) : type(type), data(str) {}
+ Value(Type type, std::string str) : type(type), data(std::move(str)) {}
Type type;
std::string data;
diff --git a/recovery_ui/include/recovery_ui/ui.h b/recovery_ui/include/recovery_ui/ui.h
index 08ec1d76a..512732f90 100644
--- a/recovery_ui/include/recovery_ui/ui.h
+++ b/recovery_ui/include/recovery_ui/ui.h
@@ -192,6 +192,8 @@ class RecoveryUI {
return key_interrupted_;
}
+ virtual bool IsUsbConnected();
+
protected:
void EnqueueKey(int key_code);
@@ -226,8 +228,6 @@ class RecoveryUI {
void ProcessKey(int key_code, int updown);
void TimeKey(int key_code, int count);
- bool IsUsbConnected();
-
bool InitScreensaver();
void SetScreensaverState(ScreensaverState state);
diff --git a/recovery_ui/screen_ui.cpp b/recovery_ui/screen_ui.cpp
index 087fc0e84..b2c828f34 100644
--- a/recovery_ui/screen_ui.cpp
+++ b/recovery_ui/screen_ui.cpp
@@ -37,6 +37,7 @@
#include <unordered_map>
#include <vector>
+#include <android-base/chrono_utils.h>
#include <android-base/logging.h>
#include <android-base/properties.h>
#include <android-base/stringprintf.h>
@@ -448,7 +449,9 @@ void ScreenRecoveryUI::draw_foreground_locked() {
int frame_height = gr_get_height(frame);
int frame_x = (ScreenWidth() - frame_width) / 2;
int frame_y = GetAnimationBaseline();
- DrawSurface(frame, 0, 0, frame_width, frame_height, frame_x, frame_y);
+ if (frame_x >= 0 && frame_y >= 0 && (frame_x + frame_width) < ScreenWidth() &&
+ (frame_y + frame_height) < ScreenHeight())
+ DrawSurface(frame, 0, 0, frame_width, frame_height, frame_x, frame_y);
}
if (progressBarType != EMPTY) {
@@ -879,10 +882,28 @@ bool ScreenRecoveryUI::LoadWipeDataMenuText() {
return true;
}
+static bool InitGraphics() {
+ // Timeout is same as init wait for file default of 5 seconds and is arbitrary
+ const unsigned timeout = 500; // 10ms increments
+ for (auto retry = timeout; retry > 0; --retry) {
+ if (gr_init() == 0) {
+ if (retry < timeout) {
+ // Log message like init wait for file completion log for consistency.
+ LOG(WARNING) << "wait for 'graphics' took " << ((timeout - retry) * 10) << "ms";
+ }
+ return true;
+ }
+ std::this_thread::sleep_for(10ms);
+ }
+ // Log message like init wait for file timeout log for consistency.
+ LOG(ERROR) << "timeout wait for 'graphics' took " << (timeout * 10) << "ms";
+ return false;
+}
+
bool ScreenRecoveryUI::Init(const std::string& locale) {
RecoveryUI::Init(locale);
- if (gr_init() == -1) {
+ if (!InitGraphics()) {
return false;
}
diff --git a/recovery_utils/roots.cpp b/recovery_utils/roots.cpp
index 99f3c5dc9..19484478c 100644
--- a/recovery_utils/roots.cpp
+++ b/recovery_utils/roots.cpp
@@ -259,6 +259,12 @@ int format_volume(const std::string& volume, const std::string& directory) {
make_f2fs_cmd.push_back("-C");
make_f2fs_cmd.push_back("utf8");
}
+ if (v->fs_mgr_flags.fs_compress) {
+ make_f2fs_cmd.push_back("-O");
+ make_f2fs_cmd.push_back("compression");
+ make_f2fs_cmd.push_back("-O");
+ make_f2fs_cmd.push_back("extra_attr");
+ }
make_f2fs_cmd.push_back(v->blk_device);
if (length >= kSectorSize) {
make_f2fs_cmd.push_back(std::to_string(length / kSectorSize));
diff --git a/tests/Android.bp b/tests/Android.bp
index 4c23255ad..a9a088a32 100644
--- a/tests/Android.bp
+++ b/tests/Android.bp
@@ -95,6 +95,24 @@ librecovery_static_libs = [
"libc++fs",
]
+// recovery image for unittests.
+// ========================================================
+genrule {
+ name: "recovery_image",
+ cmd: "cat $(location testdata/recovery_head) <(cat $(location testdata/recovery_body) | $(location minigzip)) $(location testdata/recovery_tail) > $(out)",
+ srcs: [
+ "testdata/recovery_head",
+ "testdata/recovery_body",
+ "testdata/recovery_tail",
+ ],
+ tools: [
+ "minigzip",
+ ],
+ out: [
+ "testdata/recovery.img",
+ ],
+}
+
cc_test {
name: "recovery_unit_test",
isolated: true,
@@ -128,6 +146,7 @@ cc_test {
data: [
"testdata/*",
+ ":recovery_image",
":res-testdata",
],
}
diff --git a/tests/testdata/recovery.img b/tests/testdata/recovery.img
deleted file mode 100644
index b862e6f0c..000000000
--- a/tests/testdata/recovery.img
+++ /dev/null
Binary files differ
diff --git a/tests/testdata/recovery_body b/tests/testdata/recovery_body
new file mode 100644
index 000000000..48d7c10a5
--- /dev/null
+++ b/tests/testdata/recovery_body
Binary files differ
diff --git a/tests/testdata/recovery_head b/tests/testdata/recovery_head
new file mode 100644
index 000000000..7f494d098
--- /dev/null
+++ b/tests/testdata/recovery_head
Binary files differ
diff --git a/tests/testdata/recovery_tail b/tests/testdata/recovery_tail
new file mode 100644
index 000000000..7fe2c6ce8
--- /dev/null
+++ b/tests/testdata/recovery_tail
Binary files differ
diff --git a/tools/recovery_l10n/res/values-ar/strings.xml b/tools/recovery_l10n/res/values-ar/strings.xml
index a9cd2d133..69191287d 100644
--- a/tools/recovery_l10n/res/values-ar/strings.xml
+++ b/tools/recovery_l10n/res/values-ar/strings.xml
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="recovery_installing" msgid="2013591905463558223">"جارٍ تثبيت تحديث النظام"</string>
+ <string name="recovery_installing" msgid="2013591905463558223">"جارٍ تثبيت إعادة تحميل النظام"</string>
<string name="recovery_erasing" msgid="7334826894904037088">"جارٍ محو البيانات"</string>
<string name="recovery_no_command" msgid="4465476568623024327">"ليس هناك أي أمر"</string>
<string name="recovery_error" msgid="5748178989622716736">"خطأ!"</string>
- <string name="recovery_installing_security" msgid="9184031299717114342">"جارٍ تثبيت تحديث الأمان"</string>
+ <string name="recovery_installing_security" msgid="9184031299717114342">"جارٍ تثبيت إعادة تحميل الأمان"</string>
<string name="recovery_wipe_data_menu_header" msgid="550255032058254478">"‏يتعذَّر تحميل نظام Android، حيث قد تكون بياناتك تالفة. وإذا استمر ظهور هذه الرسالة، قد يتعيَّن عليك إجراء إعادة الضبط على الإعدادات الأصلية ومحو جميع بيانات المستخدم المُخزَّنة على هذا الجهاز."</string>
<string name="recovery_try_again" msgid="7168248750158873496">"إعادة المحاولة"</string>
<string name="recovery_factory_data_reset" msgid="7321351565602894783">"إعادة الضبط على الإعدادات الأصلية"</string>
diff --git a/tools/recovery_l10n/res/values-hy/strings.xml b/tools/recovery_l10n/res/values-hy/strings.xml
index 76c28a707..35a0ab113 100644
--- a/tools/recovery_l10n/res/values-hy/strings.xml
+++ b/tools/recovery_l10n/res/values-hy/strings.xml
@@ -9,6 +9,6 @@
<string name="recovery_wipe_data_menu_header" msgid="550255032058254478">"Չհաջողվեց բեռնել Android համակարգը։ Հնարավոր է՝ ձեր տվյալները վնասված են։ Եթե նորից տեսնեք այս հաղորդագրությունը, փորձեք վերակայել սարքի կարգավորումները և ջնջել օգտատիրոջ բոլոր տվյալները։"</string>
<string name="recovery_try_again" msgid="7168248750158873496">"Նորից փորձել"</string>
<string name="recovery_factory_data_reset" msgid="7321351565602894783">"Վերակայել բոլոր տվյալները"</string>
- <string name="recovery_wipe_data_confirmation" msgid="5439823343348043954">"Ջնջե՞լ օգտատիրոջ բոլոր տվյալները։\n\n ԱՅՍ ԳՈՐԾՈՂՈՒԹՅՈՒՆԸ ՀՆԱՐԱՎՈՐ ՉԻ ԼԻՆԻ ՀԵՏԱՐԿԵԼ"</string>
+ <string name="recovery_wipe_data_confirmation" msgid="5439823343348043954">"Մաքրե՞լ օգտատիրոջ բոլոր տվյալները։\n\n ԱՅՍ ԳՈՐԾՈՂՈՒԹՅՈՒՆԸ ՀՆԱՐԱՎՈՐ ՉԻ ԼԻՆԻ ՀԵՏԱՐԿԵԼ"</string>
<string name="recovery_cancel_wipe_data" msgid="66987687653647384">"Չեղարկել"</string>
</resources>
diff --git a/uncrypt/uncrypt.cpp b/uncrypt/uncrypt.cpp
index f1f4f69f0..c798e31d6 100644
--- a/uncrypt/uncrypt.cpp
+++ b/uncrypt/uncrypt.cpp
@@ -477,9 +477,9 @@ static int Uncrypt(const std::string& input_path, const std::string& map_file, i
return kUncryptRealpathFindError;
}
- bool encryptable;
- bool encrypted;
- bool f2fs_fs;
+ bool encryptable = false;
+ bool encrypted = false;
+ bool f2fs_fs = false;
const std::string blk_dev = FindBlockDevice(path, &encryptable, &encrypted, &f2fs_fs);
if (blk_dev.empty()) {
LOG(ERROR) << "Failed to find block device for " << path;
diff --git a/updater/include/private/commands.h b/updater/include/private/commands.h
index 79f915434..7a23bb78b 100644
--- a/updater/include/private/commands.h
+++ b/updater/include/private/commands.h
@@ -307,7 +307,7 @@ class Command {
: type_(type),
index_(index),
cmdline_(std::move(cmdline)),
- patch_(std::move(patch)),
+ patch_(patch),
target_(std::move(target)),
source_(std::move(source)),
stash_(std::move(stash)) {}