summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Android.mk11
-rw-r--r--applypatch/Android.mk10
-rw-r--r--bootloader_message/Android.bp5
-rw-r--r--minui/Android.mk4
-rw-r--r--otafault/Android.mk3
-rw-r--r--otafault/config.cpp4
-rw-r--r--print_sha1.h6
-rw-r--r--tests/Android.mk7
-rw-r--r--tests/component/applypatch_test.cpp8
-rw-r--r--uncrypt/Android.mk2
-rw-r--r--updater/Android.mk2
-rw-r--r--wear_ui.cpp32
-rw-r--r--wear_ui.h11
13 files changed, 37 insertions, 68 deletions
diff --git a/Android.mk b/Android.mk
index 776e6ea19..801141249 100644
--- a/Android.mk
+++ b/Android.mk
@@ -93,7 +93,7 @@ endif
endif
LOCAL_CFLAGS += -DRECOVERY_API_VERSION=$(RECOVERY_API_VERSION)
-LOCAL_CFLAGS += -Wno-unused-parameter -Werror
+LOCAL_CFLAGS += -Wall -Wno-unused-parameter -Werror
ifneq ($(TARGET_RECOVERY_UI_MARGIN_HEIGHT),)
LOCAL_CFLAGS += -DRECOVERY_UI_MARGIN_HEIGHT=$(TARGET_RECOVERY_UI_MARGIN_HEIGHT)
@@ -159,6 +159,7 @@ LOCAL_STATIC_LIBRARIES := \
libmounts \
libz \
libminadbd \
+ libasyncio \
libfusesideload \
libminui \
libpng \
@@ -203,7 +204,7 @@ LOCAL_SRC_FILES := \
rotate_logs.cpp
LOCAL_MODULE := recovery-persist
LOCAL_SHARED_LIBRARIES := liblog libbase
-LOCAL_CFLAGS := -Werror
+LOCAL_CFLAGS := -Wall -Werror
LOCAL_INIT_RC := recovery-persist.rc
include $(BUILD_EXECUTABLE)
@@ -215,7 +216,7 @@ LOCAL_SRC_FILES := \
rotate_logs.cpp
LOCAL_MODULE := recovery-refresh
LOCAL_SHARED_LIBRARIES := liblog libbase
-LOCAL_CFLAGS := -Werror
+LOCAL_CFLAGS := -Wall -Werror
LOCAL_INIT_RC := recovery-refresh.rc
include $(BUILD_EXECUTABLE)
@@ -230,13 +231,14 @@ LOCAL_STATIC_LIBRARIES := \
libcrypto_utils \
libcrypto \
libbase
-LOCAL_CFLAGS := -Werror
+LOCAL_CFLAGS := -Wall -Werror
include $(BUILD_STATIC_LIBRARY)
# Wear default device
# ===============================
include $(CLEAR_VARS)
LOCAL_SRC_FILES := wear_device.cpp
+LOCAL_CFLAGS := -Wall -Werror
# Should match TARGET_RECOVERY_UI_LIB in BoardConfig.mk.
LOCAL_MODULE := librecovery_ui_wear
@@ -248,6 +250,7 @@ include $(BUILD_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := vr_device.cpp
+LOCAL_CFLAGS := -Wall -Werror
# should match TARGET_RECOVERY_UI_LIB set in BoardConfig.mk
LOCAL_MODULE := librecovery_ui_vr
diff --git a/applypatch/Android.mk b/applypatch/Android.mk
index e38207c22..59aa0ce6c 100644
--- a/applypatch/Android.mk
+++ b/applypatch/Android.mk
@@ -37,6 +37,7 @@ LOCAL_STATIC_LIBRARIES := \
libz
LOCAL_CFLAGS := \
-DZLIB_CONST \
+ -Wall \
-Werror
include $(BUILD_STATIC_LIBRARY)
@@ -59,6 +60,7 @@ LOCAL_STATIC_LIBRARIES := \
libz
LOCAL_CFLAGS := \
-DZLIB_CONST \
+ -Wall \
-Werror
include $(BUILD_STATIC_LIBRARY)
@@ -82,6 +84,7 @@ LOCAL_STATIC_LIBRARIES := \
libz
LOCAL_CFLAGS := \
-DZLIB_CONST \
+ -Wall \
-Werror
include $(BUILD_HOST_STATIC_LIBRARY)
@@ -97,7 +100,7 @@ LOCAL_STATIC_LIBRARIES := \
libbase \
libedify \
libcrypto
-LOCAL_CFLAGS := -Werror
+LOCAL_CFLAGS := -Wall -Werror
include $(BUILD_STATIC_LIBRARY)
# applypatch (target executable)
@@ -119,13 +122,14 @@ LOCAL_SHARED_LIBRARIES := \
libbase \
libz \
libcutils
-LOCAL_CFLAGS := -Werror
+LOCAL_CFLAGS := -Wall -Werror
include $(BUILD_EXECUTABLE)
libimgdiff_src_files := imgdiff.cpp
# libbsdiff is compiled with -D_FILE_OFFSET_BITS=64.
libimgdiff_cflags := \
+ -Wall \
-Werror \
-D_FILE_OFFSET_BITS=64 \
-DZLIB_CONST
@@ -177,7 +181,7 @@ include $(BUILD_HOST_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := imgdiff_main.cpp
LOCAL_MODULE := imgdiff
-LOCAL_CFLAGS := -Werror
+LOCAL_CFLAGS := -Wall -Werror
LOCAL_STATIC_LIBRARIES := \
libimgdiff \
$(libimgdiff_static_libraries) \
diff --git a/bootloader_message/Android.bp b/bootloader_message/Android.bp
index f0d76e718..456b04c33 100644
--- a/bootloader_message/Android.bp
+++ b/bootloader_message/Android.bp
@@ -17,7 +17,10 @@
cc_library_static {
name: "libbootloader_message",
srcs: ["bootloader_message.cpp"],
- cppflags: ["-Werror"],
+ cppflags: [
+ "-Wall",
+ "-Werror",
+ ],
static_libs: [
"libbase",
"libfs_mgr",
diff --git a/minui/Android.mk b/minui/Android.mk
index 6522fcfd2..1abcf0a7c 100644
--- a/minui/Android.mk
+++ b/minui/Android.mk
@@ -32,7 +32,7 @@ LOCAL_STATIC_LIBRARIES := \
libpng \
libbase
-LOCAL_CFLAGS := -Werror
+LOCAL_CFLAGS := -Wall -Werror
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
@@ -68,7 +68,7 @@ LOCAL_SHARED_LIBRARIES := \
libpng \
libbase
-LOCAL_CFLAGS := -Werror
+LOCAL_CFLAGS := -Wall -Werror
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
include $(BUILD_SHARED_LIBRARY)
diff --git a/otafault/Android.mk b/otafault/Android.mk
index 7b5aab0b8..4784d56ef 100644
--- a/otafault/Android.mk
+++ b/otafault/Android.mk
@@ -24,6 +24,7 @@ otafault_static_libs := \
liblog
LOCAL_CFLAGS := \
+ -Wall \
-Werror \
-Wthread-safety \
-Wthread-safety-negative \
@@ -46,7 +47,7 @@ LOCAL_SRC_FILES := config.cpp ota_io.cpp test.cpp
LOCAL_MODULE_TAGS := tests
LOCAL_MODULE := otafault_test
LOCAL_STATIC_LIBRARIES := $(otafault_static_libs)
-LOCAL_CFLAGS := -Werror
+LOCAL_CFLAGS := -Wall -Werror
LOCAL_C_INCLUDES := bootable/recovery
LOCAL_FORCE_STATIC_EXECUTABLE := true
diff --git a/otafault/config.cpp b/otafault/config.cpp
index 8590833ee..b94e429c6 100644
--- a/otafault/config.cpp
+++ b/otafault/config.cpp
@@ -69,7 +69,9 @@ std::string fault_fname(const char* io_type) {
fname.resize(OTAIO_MAX_FNAME_SIZE);
ZipString zip_type_path(type_path.c_str());
ZipEntry entry;
- int status = FindEntry(archive, zip_type_path, &entry);
+ if (FindEntry(archive, zip_type_path, &entry) != 0) {
+ return {};
+ }
ExtractToMemory(archive, &entry, reinterpret_cast<uint8_t*>(&fname[0]), OTAIO_MAX_FNAME_SIZE);
return fname;
}
diff --git a/print_sha1.h b/print_sha1.h
index 1f8589519..d0c18b355 100644
--- a/print_sha1.h
+++ b/print_sha1.h
@@ -32,15 +32,15 @@ static std::string print_sha1(const uint8_t* sha1, size_t len) {
return result;
}
-static std::string print_sha1(const uint8_t sha1[SHA_DIGEST_LENGTH]) {
+[[maybe_unused]] static std::string print_sha1(const uint8_t sha1[SHA_DIGEST_LENGTH]) {
return print_sha1(sha1, SHA_DIGEST_LENGTH);
}
-static std::string short_sha1(const uint8_t sha1[SHA_DIGEST_LENGTH]) {
+[[maybe_unused]] static std::string short_sha1(const uint8_t sha1[SHA_DIGEST_LENGTH]) {
return print_sha1(sha1, 4);
}
-static std::string print_hex(const uint8_t* bytes, size_t len) {
+[[maybe_unused]] static std::string print_hex(const uint8_t* bytes, size_t len) {
return print_sha1(bytes, len);
}
diff --git a/tests/Android.mk b/tests/Android.mk
index f2497b8b3..748d9c87b 100644
--- a/tests/Android.mk
+++ b/tests/Android.mk
@@ -18,7 +18,7 @@ LOCAL_PATH := $(call my-dir)
# Unit tests
include $(CLEAR_VARS)
-LOCAL_CFLAGS := -Werror
+LOCAL_CFLAGS := -Wall -Werror
LOCAL_MODULE := recovery_unit_test
LOCAL_COMPATIBILITY_SUITE := device-tests
LOCAL_STATIC_LIBRARIES := \
@@ -46,7 +46,7 @@ include $(BUILD_NATIVE_TEST)
# Manual tests
include $(CLEAR_VARS)
-LOCAL_CFLAGS := -Werror
+LOCAL_CFLAGS := -Wall -Werror
LOCAL_MODULE := recovery_manual_test
LOCAL_STATIC_LIBRARIES := \
libminui \
@@ -81,6 +81,7 @@ include $(BUILD_NATIVE_TEST)
# Component tests
include $(CLEAR_VARS)
LOCAL_CFLAGS := \
+ -Wall \
-Werror \
-D_FILE_OFFSET_BITS=64
@@ -191,7 +192,7 @@ include $(BUILD_NATIVE_TEST)
# Host tests
include $(CLEAR_VARS)
-LOCAL_CFLAGS := -Werror
+LOCAL_CFLAGS := -Wall -Werror
LOCAL_MODULE := recovery_host_test
LOCAL_MODULE_HOST_OS := linux
LOCAL_C_INCLUDES := bootable/recovery
diff --git a/tests/component/applypatch_test.cpp b/tests/component/applypatch_test.cpp
index 016fed9b1..42542898b 100644
--- a/tests/component/applypatch_test.cpp
+++ b/tests/component/applypatch_test.cpp
@@ -61,14 +61,6 @@ static void mangle_file(const std::string& fname) {
ASSERT_TRUE(android::base::WriteStringToFile(content, fname));
}
-static bool file_cmp(const std::string& f1, const std::string& f2) {
- std::string c1;
- android::base::ReadFileToString(f1, &c1);
- std::string c2;
- android::base::ReadFileToString(f2, &c2);
- return c1 == c2;
-}
-
class ApplyPatchTest : public ::testing::Test {
public:
static void SetUpTestCase() {
diff --git a/uncrypt/Android.mk b/uncrypt/Android.mk
index cb60c721e..a3b0ca98d 100644
--- a/uncrypt/Android.mk
+++ b/uncrypt/Android.mk
@@ -25,7 +25,7 @@ LOCAL_STATIC_LIBRARIES := \
liblog \
libfs_mgr \
libcutils
-LOCAL_CFLAGS := -Werror
+LOCAL_CFLAGS := -Wall -Werror
LOCAL_INIT_RC := uncrypt.rc
include $(BUILD_EXECUTABLE)
diff --git a/updater/Android.mk b/updater/Android.mk
index 86dc48e30..12181602f 100644
--- a/updater/Android.mk
+++ b/updater/Android.mk
@@ -66,6 +66,7 @@ LOCAL_C_INCLUDES := \
external/e2fsprogs/misc
LOCAL_CFLAGS := \
+ -Wall \
-Wno-unused-parameter \
-Werror
@@ -91,6 +92,7 @@ LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/include
LOCAL_CFLAGS := \
+ -Wall \
-Wno-unused-parameter \
-Werror
diff --git a/wear_ui.cpp b/wear_ui.cpp
index 169ef20e1..85c8f835d 100644
--- a/wear_ui.cpp
+++ b/wear_ui.cpp
@@ -18,6 +18,7 @@
#include <errno.h>
#include <fcntl.h>
+#include <pthread.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
@@ -38,18 +39,6 @@
#include "common.h"
#include "device.h"
-// There's only (at most) one of these objects, and global callbacks
-// (for pthread_create, and the input event system) need to find it,
-// so use a global variable.
-static WearRecoveryUI* self = NULL;
-
-// Return the current time as a double (including fractions of a second).
-static double now() {
- struct timeval tv;
- gettimeofday(&tv, NULL);
- return tv.tv_sec + tv.tv_usec / 1000000.0;
-}
-
WearRecoveryUI::WearRecoveryUI()
: kProgressBarBaseline(RECOVERY_UI_PROGRESS_BAR_BASELINE),
kMenuUnusableRows(RECOVERY_UI_MENU_UNUSABLE_ROWS) {
@@ -63,8 +52,6 @@ WearRecoveryUI::WearRecoveryUI()
touch_screen_allowed_ = true;
for (size_t i = 0; i < 5; i++) backgroundIcon[i] = NULL;
-
- self = this;
}
int WearRecoveryUI::GetProgressBaseline() const {
@@ -173,7 +160,6 @@ void WearRecoveryUI::draw_screen_locked() {
// display from the bottom up, until we hit the top of the
// screen, the bottom of the menu, or we've displayed the
// entire text buffer.
- int ty;
int row = (text_top_ + text_rows_ - 1) % text_rows_;
size_t count = 0;
for (int ty = gr_fb_height() - char_height_ - kMarginHeight; ty > y + 2 && count < text_rows_;
@@ -191,20 +177,6 @@ void WearRecoveryUI::update_progress_locked() {
gr_flip();
}
-bool WearRecoveryUI::InitTextParams() {
- if (!ScreenRecoveryUI::InitTextParams()) {
- return false;
- }
-
- text_cols_ = (gr_fb_width() - (kMarginWidth * 2)) / char_width_;
-
- if (text_rows_ > kMaxRows) text_rows_ = kMaxRows;
- if (text_cols_ > kMaxCols) text_cols_ = kMaxCols;
-
- visible_text_rows = (gr_fb_height() - (kMarginHeight * 2)) / char_height_;
- return true;
-}
-
bool WearRecoveryUI::Init(const std::string& locale) {
if (!ScreenRecoveryUI::Init(locale)) {
return false;
@@ -269,7 +241,7 @@ void WearRecoveryUI::StartMenu(const char* const* headers, const char* const* it
show_menu = true;
menu_sel = initial_selection;
menu_start = 0;
- menu_end = visible_text_rows - 1 - kMenuUnusableRows;
+ menu_end = text_rows_ - 1 - kMenuUnusableRows;
if (menu_items <= menu_end) menu_end = menu_items;
update_screen_locked();
}
diff --git a/wear_ui.h b/wear_ui.h
index 3bd90b699..9731f4161 100644
--- a/wear_ui.h
+++ b/wear_ui.h
@@ -50,8 +50,6 @@ class WearRecoveryUI : public ScreenRecoveryUI {
int GetProgressBaseline() const override;
- bool InitTextParams() override;
-
void update_progress_locked() override;
void PrintV(const char*, bool, va_list) override;
@@ -59,17 +57,8 @@ class WearRecoveryUI : public ScreenRecoveryUI {
private:
GRSurface* backgroundIcon[5];
- static const int kMaxCols = 96;
- static const int kMaxRows = 96;
-
- // Number of text rows seen on screen
- int visible_text_rows;
-
- const char* const* menu_headers_;
int menu_start, menu_end;
- pthread_t progress_t;
-
void draw_background_locked() override;
void draw_screen_locked() override;