summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--Android.mk29
-rw-r--r--etc/init.rc4
-rw-r--r--minui/graphics.cpp4
-rw-r--r--recovery.cpp9
-rw-r--r--screen_ui.cpp4
-rw-r--r--screen_ui.h6
-rw-r--r--tests/component/verifier_test.cpp17
-rw-r--r--tools/recovery_l10n/res/values-az/strings.xml (renamed from tools/recovery_l10n/res/values-az-rAZ/strings.xml)0
-rw-r--r--tools/recovery_l10n/res/values-b+sr+Latn/strings.xml9
-rw-r--r--tools/recovery_l10n/res/values-be/strings.xml9
-rw-r--r--tools/recovery_l10n/res/values-bn/strings.xml (renamed from tools/recovery_l10n/res/values-bn-rBD/strings.xml)0
-rw-r--r--tools/recovery_l10n/res/values-bs/strings.xml9
-rw-r--r--tools/recovery_l10n/res/values-et/strings.xml (renamed from tools/recovery_l10n/res/values-et-rEE/strings.xml)0
-rw-r--r--tools/recovery_l10n/res/values-eu/strings.xml (renamed from tools/recovery_l10n/res/values-eu-rES/strings.xml)0
-rw-r--r--tools/recovery_l10n/res/values-gl/strings.xml (renamed from tools/recovery_l10n/res/values-gl-rES/strings.xml)0
-rw-r--r--tools/recovery_l10n/res/values-gu/strings.xml (renamed from tools/recovery_l10n/res/values-gu-rIN/strings.xml)0
-rw-r--r--tools/recovery_l10n/res/values-hy/strings.xml (renamed from tools/recovery_l10n/res/values-hy-rAM/strings.xml)0
-rw-r--r--tools/recovery_l10n/res/values-is/strings.xml (renamed from tools/recovery_l10n/res/values-is-rIS/strings.xml)0
-rw-r--r--tools/recovery_l10n/res/values-ka/strings.xml (renamed from tools/recovery_l10n/res/values-ka-rGE/strings.xml)0
-rw-r--r--tools/recovery_l10n/res/values-kk/strings.xml (renamed from tools/recovery_l10n/res/values-kk-rKZ/strings.xml)0
-rw-r--r--tools/recovery_l10n/res/values-km/strings.xml (renamed from tools/recovery_l10n/res/values-km-rKH/strings.xml)0
-rw-r--r--tools/recovery_l10n/res/values-kn/strings.xml (renamed from tools/recovery_l10n/res/values-kn-rIN/strings.xml)0
-rw-r--r--tools/recovery_l10n/res/values-ky/strings.xml (renamed from tools/recovery_l10n/res/values-ky-rKG/strings.xml)0
-rw-r--r--tools/recovery_l10n/res/values-lo/strings.xml (renamed from tools/recovery_l10n/res/values-lo-rLA/strings.xml)0
-rw-r--r--tools/recovery_l10n/res/values-mk/strings.xml (renamed from tools/recovery_l10n/res/values-mk-rMK/strings.xml)0
-rw-r--r--tools/recovery_l10n/res/values-ml/strings.xml (renamed from tools/recovery_l10n/res/values-ml-rIN/strings.xml)0
-rw-r--r--tools/recovery_l10n/res/values-mn/strings.xml (renamed from tools/recovery_l10n/res/values-mn-rMN/strings.xml)0
-rw-r--r--tools/recovery_l10n/res/values-mr/strings.xml (renamed from tools/recovery_l10n/res/values-mr-rIN/strings.xml)0
-rw-r--r--tools/recovery_l10n/res/values-ms/strings.xml (renamed from tools/recovery_l10n/res/values-ms-rMY/strings.xml)0
-rw-r--r--tools/recovery_l10n/res/values-my/strings.xml (renamed from tools/recovery_l10n/res/values-my-rMM/strings.xml)0
-rw-r--r--tools/recovery_l10n/res/values-ne/strings.xml (renamed from tools/recovery_l10n/res/values-ne-rNP/strings.xml)0
-rw-r--r--tools/recovery_l10n/res/values-pa/strings.xml (renamed from tools/recovery_l10n/res/values-pa-rIN/strings.xml)0
-rw-r--r--tools/recovery_l10n/res/values-si/strings.xml (renamed from tools/recovery_l10n/res/values-si-rLK/strings.xml)0
-rw-r--r--tools/recovery_l10n/res/values-sq/strings.xml (renamed from tools/recovery_l10n/res/values-sq-rAL/strings.xml)0
-rw-r--r--tools/recovery_l10n/res/values-ta/strings.xml (renamed from tools/recovery_l10n/res/values-ta-rIN/strings.xml)0
-rw-r--r--tools/recovery_l10n/res/values-te/strings.xml (renamed from tools/recovery_l10n/res/values-te-rIN/strings.xml)0
-rw-r--r--tools/recovery_l10n/res/values-ur/strings.xml (renamed from tools/recovery_l10n/res/values-ur-rPK/strings.xml)0
-rw-r--r--tools/recovery_l10n/res/values-uz/strings.xml (renamed from tools/recovery_l10n/res/values-uz-rUZ/strings.xml)0
-rw-r--r--uncrypt/uncrypt.cpp6
-rw-r--r--updater/updater.cpp6
-rw-r--r--wear_device.cpp23
-rw-r--r--wear_touch.cpp177
-rw-r--r--wear_touch.h58
-rw-r--r--wear_ui.cpp24
-rw-r--r--wear_ui.h7
45 files changed, 130 insertions, 271 deletions
diff --git a/Android.mk b/Android.mk
index 967b9dfbe..776e6ea19 100644
--- a/Android.mk
+++ b/Android.mk
@@ -79,7 +79,6 @@ LOCAL_SRC_FILES := \
ui.cpp \
vr_ui.cpp \
wear_ui.cpp \
- wear_touch.cpp \
LOCAL_MODULE := recovery
@@ -120,6 +119,24 @@ else
LOCAL_CFLAGS += -DRECOVERY_UI_TOUCH_HIGH_THRESHOLD=90
endif
+ifneq ($(TARGET_RECOVERY_UI_PROGRESS_BAR_BASELINE),)
+LOCAL_CFLAGS += -DRECOVERY_UI_PROGRESS_BAR_BASELINE=$(TARGET_RECOVERY_UI_PROGRESS_BAR_BASELINE)
+else
+LOCAL_CFLAGS += -DRECOVERY_UI_PROGRESS_BAR_BASELINE=259
+endif
+
+ifneq ($(TARGET_RECOVERY_UI_ANIMATION_FPS),)
+LOCAL_CFLAGS += -DRECOVERY_UI_ANIMATION_FPS=$(TARGET_RECOVERY_UI_ANIMATION_FPS)
+else
+LOCAL_CFLAGS += -DRECOVERY_UI_ANIMATION_FPS=30
+endif
+
+ifneq ($(TARGET_RECOVERY_UI_MENU_UNUSABLE_ROWS),)
+LOCAL_CFLAGS += -DRECOVERY_UI_MENU_UNUSABLE_ROWS=$(TARGET_RECOVERY_UI_MENU_UNUSABLE_ROWS)
+else
+LOCAL_CFLAGS += -DRECOVERY_UI_MENU_UNUSABLE_ROWS=9
+endif
+
ifneq ($(TARGET_RECOVERY_UI_VR_STEREO_OFFSET),)
LOCAL_CFLAGS += -DRECOVERY_UI_VR_STEREO_OFFSET=$(TARGET_RECOVERY_UI_VR_STEREO_OFFSET)
else
@@ -216,6 +233,16 @@ LOCAL_STATIC_LIBRARIES := \
LOCAL_CFLAGS := -Werror
include $(BUILD_STATIC_LIBRARY)
+# Wear default device
+# ===============================
+include $(CLEAR_VARS)
+LOCAL_SRC_FILES := wear_device.cpp
+
+# Should match TARGET_RECOVERY_UI_LIB in BoardConfig.mk.
+LOCAL_MODULE := librecovery_ui_wear
+
+include $(BUILD_STATIC_LIBRARY)
+
# vr headset default device
# ===============================
include $(CLEAR_VARS)
diff --git a/etc/init.rc b/etc/init.rc
index 2e3c7a739..d8121cc4e 100644
--- a/etc/init.rc
+++ b/etc/init.rc
@@ -79,9 +79,9 @@ service ueventd /sbin/ueventd
critical
seclabel u:r:ueventd:s0
-service healthd /sbin/healthd -r
+service charger /charger -r
critical
- seclabel u:r:healthd:s0
+ seclabel u:r:charger:s0
service recovery /sbin/recovery
seclabel u:r:recovery:s0
diff --git a/minui/graphics.cpp b/minui/graphics.cpp
index 3bdc33fd1..3bfce11d8 100644
--- a/minui/graphics.cpp
+++ b/minui/graphics.cpp
@@ -258,7 +258,7 @@ unsigned int gr_get_height(GRSurface* surface) {
}
int gr_init_font(const char* name, GRFont** dest) {
- GRFont* font = reinterpret_cast<GRFont*>(calloc(1, sizeof(*gr_font)));
+ GRFont* font = static_cast<GRFont*>(calloc(1, sizeof(*gr_font)));
if (font == nullptr) {
return -1;
}
@@ -291,7 +291,7 @@ static void gr_init_font(void)
// fall back to the compiled-in font.
- gr_font = static_cast<GRFont*>(calloc(sizeof(*gr_font), 1));
+ gr_font = static_cast<GRFont*>(calloc(1, sizeof(*gr_font)));
gr_font->texture = static_cast<GRSurface*>(malloc(sizeof(*gr_font->texture)));
gr_font->texture->width = font.width;
gr_font->texture->height = font.height;
diff --git a/recovery.cpp b/recovery.cpp
index c5ead451a..6f62ff17c 100644
--- a/recovery.cpp
+++ b/recovery.cpp
@@ -53,6 +53,7 @@
#include <healthd/BatteryMonitor.h>
#include <private/android_logger.h> /* private pmsg functions */
#include <private/android_filesystem_config.h> /* for AID_SYSTEM */
+#include <selinux/android.h>
#include <selinux/label.h>
#include <selinux/selinux.h>
#include <ziparchive/zip_archive.h>
@@ -1480,12 +1481,8 @@ int main(int argc, char **argv) {
ui->SetBackground(RecoveryUI::NONE);
if (show_text) ui->ShowText(true);
- struct selinux_opt seopts[] = {
- { SELABEL_OPT_PATH, "/file_contexts" }
- };
-
- sehandle = selabel_open(SELABEL_CTX_FILE, seopts, 1);
-
+ sehandle = selinux_android_file_context_handle();
+ selinux_android_set_sehandle(sehandle);
if (!sehandle) {
ui->Print("Warning: No file_contexts\n");
}
diff --git a/screen_ui.cpp b/screen_ui.cpp
index a02550199..5c93b6672 100644
--- a/screen_ui.cpp
+++ b/screen_ui.cpp
@@ -53,6 +53,7 @@ static double now() {
ScreenRecoveryUI::ScreenRecoveryUI()
: kMarginWidth(RECOVERY_UI_MARGIN_WIDTH),
kMarginHeight(RECOVERY_UI_MARGIN_HEIGHT),
+ kAnimationFps(RECOVERY_UI_ANIMATION_FPS),
density_(static_cast<float>(android::base::GetIntProperty("ro.sf.lcd_density", 160)) / 160.f),
currentIcon(NONE),
progressBarType(EMPTY),
@@ -77,7 +78,6 @@ ScreenRecoveryUI::ScreenRecoveryUI()
loop_frames(0),
current_frame(0),
intro_done(false),
- animation_fps(30), // TODO: there's currently no way to infer this.
stage(-1),
max_stage(-1),
updateMutex(PTHREAD_MUTEX_INITIALIZER) {}
@@ -404,7 +404,7 @@ void* ScreenRecoveryUI::ProgressThreadStartRoutine(void* data) {
}
void ScreenRecoveryUI::ProgressThreadLoop() {
- double interval = 1.0 / animation_fps;
+ double interval = 1.0 / kAnimationFps;
while (true) {
double start = now();
pthread_mutex_lock(&updateMutex);
diff --git a/screen_ui.h b/screen_ui.h
index df7cc25b3..62dda7558 100644
--- a/screen_ui.h
+++ b/screen_ui.h
@@ -84,6 +84,9 @@ class ScreenRecoveryUI : public RecoveryUI {
const int kMarginWidth;
const int kMarginHeight;
+ // Number of frames per sec (default: 30) for both parts of the animation.
+ const int kAnimationFps;
+
// The scale factor from dp to pixels. 1.0 for mdpi, 4.0 for xxxhdpi.
const float density_;
@@ -141,9 +144,6 @@ class ScreenRecoveryUI : public RecoveryUI {
size_t current_frame;
bool intro_done;
- // Number of frames per sec (default: 30) for both parts of the animation.
- int animation_fps;
-
int stage, max_stage;
int char_width_;
diff --git a/tests/component/verifier_test.cpp b/tests/component/verifier_test.cpp
index 5338f05c6..e520f5028 100644
--- a/tests/component/verifier_test.cpp
+++ b/tests/component/verifier_test.cpp
@@ -33,6 +33,8 @@
#include "otautil/SysUtil.h"
#include "verifier.h"
+using namespace std::string_literals;
+
class VerifierTest : public testing::TestWithParam<std::vector<std::string>> {
protected:
void SetUp() override {
@@ -115,6 +117,21 @@ TEST(VerifierTest, load_keys_invalid_keys) {
ASSERT_FALSE(load_keys(key_file5.path, certs));
}
+TEST(VerifierTest, BadPackage_SignatureStartOutOfBounds) {
+ std::string testkey_v3;
+ ASSERT_TRUE(android::base::ReadFileToString(from_testdata_base("testkey_v3.txt"), &testkey_v3));
+
+ TemporaryFile key_file;
+ ASSERT_TRUE(android::base::WriteStringToFile(testkey_v3, key_file.path));
+ std::vector<Certificate> certs;
+ ASSERT_TRUE(load_keys(key_file.path, certs));
+
+ // Signature start is 65535 (0xffff) while comment size is 0 (Bug: 31914369).
+ std::string package = "\x50\x4b\x05\x06"s + std::string(12, '\0') + "\xff\xff\xff\xff\x00\x00"s;
+ ASSERT_EQ(VERIFY_FAILURE, verify_file(reinterpret_cast<const unsigned char*>(package.data()),
+ package.size(), certs));
+}
+
TEST(VerifierTest, BadPackage_AlteredFooter) {
std::string testkey_v3;
ASSERT_TRUE(android::base::ReadFileToString(from_testdata_base("testkey_v3.txt"), &testkey_v3));
diff --git a/tools/recovery_l10n/res/values-az-rAZ/strings.xml b/tools/recovery_l10n/res/values-az/strings.xml
index c6765a9ea..c6765a9ea 100644
--- a/tools/recovery_l10n/res/values-az-rAZ/strings.xml
+++ b/tools/recovery_l10n/res/values-az/strings.xml
diff --git a/tools/recovery_l10n/res/values-b+sr+Latn/strings.xml b/tools/recovery_l10n/res/values-b+sr+Latn/strings.xml
new file mode 100644
index 000000000..c2d8f2239
--- /dev/null
+++ b/tools/recovery_l10n/res/values-b+sr+Latn/strings.xml
@@ -0,0 +1,9 @@
+<?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">"Ažuriranje sistema se instalira"</string>
+ <string name="recovery_erasing" msgid="7334826894904037088">"Briše se"</string>
+ <string name="recovery_no_command" msgid="4465476568623024327">"Nema komande"</string>
+ <string name="recovery_error" msgid="5748178989622716736">"Greška!"</string>
+ <string name="recovery_installing_security" msgid="9184031299717114342">"Instalira se bezbednosno ažuriranje"</string>
+</resources>
diff --git a/tools/recovery_l10n/res/values-be/strings.xml b/tools/recovery_l10n/res/values-be/strings.xml
new file mode 100644
index 000000000..7c0954d31
--- /dev/null
+++ b/tools/recovery_l10n/res/values-be/strings.xml
@@ -0,0 +1,9 @@
+<?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_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>
+</resources>
diff --git a/tools/recovery_l10n/res/values-bn-rBD/strings.xml b/tools/recovery_l10n/res/values-bn/strings.xml
index 0a481faf1..0a481faf1 100644
--- a/tools/recovery_l10n/res/values-bn-rBD/strings.xml
+++ b/tools/recovery_l10n/res/values-bn/strings.xml
diff --git a/tools/recovery_l10n/res/values-bs/strings.xml b/tools/recovery_l10n/res/values-bs/strings.xml
new file mode 100644
index 000000000..412cf0276
--- /dev/null
+++ b/tools/recovery_l10n/res/values-bs/strings.xml
@@ -0,0 +1,9 @@
+<?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">"Ažuriranje sistema…"</string>
+ <string name="recovery_erasing" msgid="7334826894904037088">"Brisanje u toku"</string>
+ <string name="recovery_no_command" msgid="4465476568623024327">"Nema komande"</string>
+ <string name="recovery_error" msgid="5748178989622716736">"Greška!"</string>
+ <string name="recovery_installing_security" msgid="9184031299717114342">"Instaliranje sigurnosnog ažuriranja…"</string>
+</resources>
diff --git a/tools/recovery_l10n/res/values-et-rEE/strings.xml b/tools/recovery_l10n/res/values-et/strings.xml
index 072a9ef80..072a9ef80 100644
--- a/tools/recovery_l10n/res/values-et-rEE/strings.xml
+++ b/tools/recovery_l10n/res/values-et/strings.xml
diff --git a/tools/recovery_l10n/res/values-eu-rES/strings.xml b/tools/recovery_l10n/res/values-eu/strings.xml
index 5540469d0..5540469d0 100644
--- a/tools/recovery_l10n/res/values-eu-rES/strings.xml
+++ b/tools/recovery_l10n/res/values-eu/strings.xml
diff --git a/tools/recovery_l10n/res/values-gl-rES/strings.xml b/tools/recovery_l10n/res/values-gl/strings.xml
index 42b2016c2..42b2016c2 100644
--- a/tools/recovery_l10n/res/values-gl-rES/strings.xml
+++ b/tools/recovery_l10n/res/values-gl/strings.xml
diff --git a/tools/recovery_l10n/res/values-gu-rIN/strings.xml b/tools/recovery_l10n/res/values-gu/strings.xml
index 2355a0f4f..2355a0f4f 100644
--- a/tools/recovery_l10n/res/values-gu-rIN/strings.xml
+++ b/tools/recovery_l10n/res/values-gu/strings.xml
diff --git a/tools/recovery_l10n/res/values-hy-rAM/strings.xml b/tools/recovery_l10n/res/values-hy/strings.xml
index 9d62bb763..9d62bb763 100644
--- a/tools/recovery_l10n/res/values-hy-rAM/strings.xml
+++ b/tools/recovery_l10n/res/values-hy/strings.xml
diff --git a/tools/recovery_l10n/res/values-is-rIS/strings.xml b/tools/recovery_l10n/res/values-is/strings.xml
index 5065b6522..5065b6522 100644
--- a/tools/recovery_l10n/res/values-is-rIS/strings.xml
+++ b/tools/recovery_l10n/res/values-is/strings.xml
diff --git a/tools/recovery_l10n/res/values-ka-rGE/strings.xml b/tools/recovery_l10n/res/values-ka/strings.xml
index 6a46b3677..6a46b3677 100644
--- a/tools/recovery_l10n/res/values-ka-rGE/strings.xml
+++ b/tools/recovery_l10n/res/values-ka/strings.xml
diff --git a/tools/recovery_l10n/res/values-kk-rKZ/strings.xml b/tools/recovery_l10n/res/values-kk/strings.xml
index a4bd86e66..a4bd86e66 100644
--- a/tools/recovery_l10n/res/values-kk-rKZ/strings.xml
+++ b/tools/recovery_l10n/res/values-kk/strings.xml
diff --git a/tools/recovery_l10n/res/values-km-rKH/strings.xml b/tools/recovery_l10n/res/values-km/strings.xml
index 313c0f457..313c0f457 100644
--- a/tools/recovery_l10n/res/values-km-rKH/strings.xml
+++ b/tools/recovery_l10n/res/values-km/strings.xml
diff --git a/tools/recovery_l10n/res/values-kn-rIN/strings.xml b/tools/recovery_l10n/res/values-kn/strings.xml
index 5bf6260ee..5bf6260ee 100644
--- a/tools/recovery_l10n/res/values-kn-rIN/strings.xml
+++ b/tools/recovery_l10n/res/values-kn/strings.xml
diff --git a/tools/recovery_l10n/res/values-ky-rKG/strings.xml b/tools/recovery_l10n/res/values-ky/strings.xml
index 0a6bd783a..0a6bd783a 100644
--- a/tools/recovery_l10n/res/values-ky-rKG/strings.xml
+++ b/tools/recovery_l10n/res/values-ky/strings.xml
diff --git a/tools/recovery_l10n/res/values-lo-rLA/strings.xml b/tools/recovery_l10n/res/values-lo/strings.xml
index d3dbb3970..d3dbb3970 100644
--- a/tools/recovery_l10n/res/values-lo-rLA/strings.xml
+++ b/tools/recovery_l10n/res/values-lo/strings.xml
diff --git a/tools/recovery_l10n/res/values-mk-rMK/strings.xml b/tools/recovery_l10n/res/values-mk/strings.xml
index 351459730..351459730 100644
--- a/tools/recovery_l10n/res/values-mk-rMK/strings.xml
+++ b/tools/recovery_l10n/res/values-mk/strings.xml
diff --git a/tools/recovery_l10n/res/values-ml-rIN/strings.xml b/tools/recovery_l10n/res/values-ml/strings.xml
index b506e2530..b506e2530 100644
--- a/tools/recovery_l10n/res/values-ml-rIN/strings.xml
+++ b/tools/recovery_l10n/res/values-ml/strings.xml
diff --git a/tools/recovery_l10n/res/values-mn-rMN/strings.xml b/tools/recovery_l10n/res/values-mn/strings.xml
index e3dd2e90e..e3dd2e90e 100644
--- a/tools/recovery_l10n/res/values-mn-rMN/strings.xml
+++ b/tools/recovery_l10n/res/values-mn/strings.xml
diff --git a/tools/recovery_l10n/res/values-mr-rIN/strings.xml b/tools/recovery_l10n/res/values-mr/strings.xml
index 8cf86f773..8cf86f773 100644
--- a/tools/recovery_l10n/res/values-mr-rIN/strings.xml
+++ b/tools/recovery_l10n/res/values-mr/strings.xml
diff --git a/tools/recovery_l10n/res/values-ms-rMY/strings.xml b/tools/recovery_l10n/res/values-ms/strings.xml
index 0e24ac4e1..0e24ac4e1 100644
--- a/tools/recovery_l10n/res/values-ms-rMY/strings.xml
+++ b/tools/recovery_l10n/res/values-ms/strings.xml
diff --git a/tools/recovery_l10n/res/values-my-rMM/strings.xml b/tools/recovery_l10n/res/values-my/strings.xml
index f13752461..f13752461 100644
--- a/tools/recovery_l10n/res/values-my-rMM/strings.xml
+++ b/tools/recovery_l10n/res/values-my/strings.xml
diff --git a/tools/recovery_l10n/res/values-ne-rNP/strings.xml b/tools/recovery_l10n/res/values-ne/strings.xml
index 1880e807b..1880e807b 100644
--- a/tools/recovery_l10n/res/values-ne-rNP/strings.xml
+++ b/tools/recovery_l10n/res/values-ne/strings.xml
diff --git a/tools/recovery_l10n/res/values-pa-rIN/strings.xml b/tools/recovery_l10n/res/values-pa/strings.xml
index 8564c9c36..8564c9c36 100644
--- a/tools/recovery_l10n/res/values-pa-rIN/strings.xml
+++ b/tools/recovery_l10n/res/values-pa/strings.xml
diff --git a/tools/recovery_l10n/res/values-si-rLK/strings.xml b/tools/recovery_l10n/res/values-si/strings.xml
index 456cdc567..456cdc567 100644
--- a/tools/recovery_l10n/res/values-si-rLK/strings.xml
+++ b/tools/recovery_l10n/res/values-si/strings.xml
diff --git a/tools/recovery_l10n/res/values-sq-rAL/strings.xml b/tools/recovery_l10n/res/values-sq/strings.xml
index 1156931fb..1156931fb 100644
--- a/tools/recovery_l10n/res/values-sq-rAL/strings.xml
+++ b/tools/recovery_l10n/res/values-sq/strings.xml
diff --git a/tools/recovery_l10n/res/values-ta-rIN/strings.xml b/tools/recovery_l10n/res/values-ta/strings.xml
index d49186d8d..d49186d8d 100644
--- a/tools/recovery_l10n/res/values-ta-rIN/strings.xml
+++ b/tools/recovery_l10n/res/values-ta/strings.xml
diff --git a/tools/recovery_l10n/res/values-te-rIN/strings.xml b/tools/recovery_l10n/res/values-te/strings.xml
index cfb02c915..cfb02c915 100644
--- a/tools/recovery_l10n/res/values-te-rIN/strings.xml
+++ b/tools/recovery_l10n/res/values-te/strings.xml
diff --git a/tools/recovery_l10n/res/values-ur-rPK/strings.xml b/tools/recovery_l10n/res/values-ur/strings.xml
index 12e32fbc1..12e32fbc1 100644
--- a/tools/recovery_l10n/res/values-ur-rPK/strings.xml
+++ b/tools/recovery_l10n/res/values-ur/strings.xml
diff --git a/tools/recovery_l10n/res/values-uz-rUZ/strings.xml b/tools/recovery_l10n/res/values-uz/strings.xml
index 2c309d646..2c309d646 100644
--- a/tools/recovery_l10n/res/values-uz-rUZ/strings.xml
+++ b/tools/recovery_l10n/res/values-uz/strings.xml
diff --git a/uncrypt/uncrypt.cpp b/uncrypt/uncrypt.cpp
index 35998bcba..7a2ccbc7c 100644
--- a/uncrypt/uncrypt.cpp
+++ b/uncrypt/uncrypt.cpp
@@ -625,12 +625,12 @@ int main(int argc, char** argv) {
}
if (action == UNCRYPT_DEBUG) {
- LOG(INFO) << "uncrypt called in debug mode, skip socket communication\n";
+ LOG(INFO) << "uncrypt called in debug mode, skip socket communication";
bool success = uncrypt_wrapper(input_path, map_file, -1);
if (success) {
- LOG(INFO) << "uncrypt succeeded\n";
+ LOG(INFO) << "uncrypt succeeded";
} else{
- LOG(INFO) << "uncrypt failed\n";
+ LOG(INFO) << "uncrypt failed";
}
return success ? 0 : 1;
}
diff --git a/updater/updater.cpp b/updater/updater.cpp
index f5ff6df91..1d8fa8e92 100644
--- a/updater/updater.cpp
+++ b/updater/updater.cpp
@@ -25,6 +25,7 @@
#include <android-base/logging.h>
#include <android-base/strings.h>
+#include <selinux/android.h>
#include <selinux/label.h>
#include <selinux/selinux.h>
#include <ziparchive/zip_archive.h>
@@ -139,9 +140,8 @@ int main(int argc, char** argv) {
return 6;
}
- struct selinux_opt seopts[] = { { SELABEL_OPT_PATH, "/file_contexts" } };
-
- sehandle = selabel_open(SELABEL_CTX_FILE, seopts, 1);
+ sehandle = selinux_android_file_context_handle();
+ selinux_android_set_sehandle(sehandle);
if (!sehandle) {
fprintf(cmd_pipe, "ui_print Warning: No file_contexts\n");
diff --git a/wear_device.cpp b/wear_device.cpp
new file mode 100644
index 000000000..3268130b0
--- /dev/null
+++ b/wear_device.cpp
@@ -0,0 +1,23 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#include "device.h"
+#include "wear_ui.h"
+
+Device* make_device() {
+ return new Device(new WearRecoveryUI);
+}
+
diff --git a/wear_touch.cpp b/wear_touch.cpp
deleted file mode 100644
index e2ab44d2d..000000000
--- a/wear_touch.cpp
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * Copyright (C) 2016 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.
- */
-
-#include <dirent.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <errno.h>
-#include <string.h>
-
-#include <android-base/logging.h>
-#include <linux/input.h>
-
-#include "wear_touch.h"
-
-#define DEVICE_PATH "/dev/input"
-
-WearSwipeDetector::WearSwipeDetector(int low, int high, OnSwipeCallback callback, void* cookie):
- mLowThreshold(low),
- mHighThreshold(high),
- mCallback(callback),
- mCookie(cookie),
- mCurrentSlot(-1) {
- pthread_create(&mThread, NULL, touch_thread, this);
-}
-
-WearSwipeDetector::~WearSwipeDetector() {
-}
-
-void WearSwipeDetector::detect(int dx, int dy) {
- enum SwipeDirection direction;
-
- if (abs(dy) < mLowThreshold && abs(dx) > mHighThreshold) {
- direction = dx < 0 ? LEFT : RIGHT;
- } else if (abs(dx) < mLowThreshold && abs(dy) > mHighThreshold) {
- direction = dy < 0 ? UP : DOWN;
- } else {
- LOG(DEBUG) << "Ignore " << dx << " " << dy;
- return;
- }
-
- LOG(DEBUG) << "Swipe direction=" << direction;
- mCallback(mCookie, direction);
-}
-
-void WearSwipeDetector::process(struct input_event *event) {
- if (mCurrentSlot < 0) {
- mCallback(mCookie, UP);
- mCurrentSlot = 0;
- }
-
- if (event->type == EV_ABS) {
- if (event->code == ABS_MT_SLOT)
- mCurrentSlot = event->value;
-
- // Ignore other fingers
- if (mCurrentSlot > 0) {
- return;
- }
-
- switch (event->code) {
- case ABS_MT_POSITION_X:
- mX = event->value;
- mFingerDown = true;
- break;
-
- case ABS_MT_POSITION_Y:
- mY = event->value;
- mFingerDown = true;
- break;
-
- case ABS_MT_TRACKING_ID:
- if (event->value < 0)
- mFingerDown = false;
- break;
- }
- } else if (event->type == EV_SYN) {
- if (event->code == SYN_REPORT) {
- if (mFingerDown && !mSwiping) {
- mStartX = mX;
- mStartY = mY;
- mSwiping = true;
- } else if (!mFingerDown && mSwiping) {
- mSwiping = false;
- detect(mX - mStartX, mY - mStartY);
- }
- }
- }
-}
-
-void WearSwipeDetector::run() {
- int fd = findDevice(DEVICE_PATH);
- if (fd < 0) {
- LOG(ERROR) << "no input devices found";
- return;
- }
-
- struct input_event event;
- while (read(fd, &event, sizeof(event)) == sizeof(event)) {
- process(&event);
- }
-
- close(fd);
-}
-
-void* WearSwipeDetector::touch_thread(void* cookie) {
- (static_cast<WearSwipeDetector*>(cookie))->run();
- return NULL;
-}
-
-#define test_bit(bit, array) ((array)[(bit)/8] & (1<<((bit)%8)))
-
-int WearSwipeDetector::openDevice(const char *device) {
- int fd = open(device, O_RDONLY);
- if (fd < 0) {
- PLOG(ERROR) << "could not open " << device;
- return false;
- }
-
- char name[80];
- name[sizeof(name) - 1] = '\0';
- if (ioctl(fd, EVIOCGNAME(sizeof(name) - 1), &name) < 1) {
- PLOG(ERROR) << "could not get device name for " << device;
- name[0] = '\0';
- }
-
- uint8_t bits[512];
- memset(bits, 0, sizeof(bits));
- int ret = ioctl(fd, EVIOCGBIT(EV_ABS, sizeof(bits)), bits);
- if (ret > 0) {
- if (test_bit(ABS_MT_POSITION_X, bits) && test_bit(ABS_MT_POSITION_Y, bits)) {
- LOG(DEBUG) << "Found " << device << " " << name;
- return fd;
- }
- }
-
- close(fd);
- return -1;
-}
-
-int WearSwipeDetector::findDevice(const char* path) {
- DIR* dir = opendir(path);
- if (dir == NULL) {
- PLOG(ERROR) << "Could not open directory " << path;
- return false;
- }
-
- struct dirent* entry;
- int ret = -1;
- while (ret < 0 && (entry = readdir(dir)) != NULL) {
- if (entry->d_name[0] == '.') continue;
-
- char device[PATH_MAX];
- device[PATH_MAX-1] = '\0';
- snprintf(device, PATH_MAX-1, "%s/%s", path, entry->d_name);
-
- ret = openDevice(device);
- }
-
- closedir(dir);
- return ret;
-}
-
diff --git a/wear_touch.h b/wear_touch.h
deleted file mode 100644
index 9a1d3150c..000000000
--- a/wear_touch.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (C) 2016 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.
- */
-
-#ifndef __WEAR_TOUCH_H
-#define __WEAR_TOUCH_H
-
-#include <pthread.h>
-
-class WearSwipeDetector {
-
-public:
- enum SwipeDirection { UP, DOWN, RIGHT, LEFT };
- typedef void (*OnSwipeCallback)(void* cookie, enum SwipeDirection direction);
-
- WearSwipeDetector(int low, int high, OnSwipeCallback cb, void* cookie);
- ~WearSwipeDetector();
-
-private:
- void run();
- void process(struct input_event *event);
- void detect(int dx, int dy);
-
- pthread_t mThread;
- static void* touch_thread(void* cookie);
-
- int findDevice(const char* path);
- int openDevice(const char* device);
-
- int mLowThreshold;
- int mHighThreshold;
-
- OnSwipeCallback mCallback;
- void *mCookie;
-
- int mX;
- int mY;
- int mStartX;
- int mStartY;
-
- int mCurrentSlot;
- bool mFingerDown;
- bool mSwiping;
-};
-
-#endif // __WEAR_TOUCH_H
diff --git a/wear_ui.cpp b/wear_ui.cpp
index 18c30d34a..169ef20e1 100644
--- a/wear_ui.cpp
+++ b/wear_ui.cpp
@@ -51,10 +51,16 @@ static double now() {
}
WearRecoveryUI::WearRecoveryUI()
- : progress_bar_y(259), outer_height(0), outer_width(0), menu_unusable_rows(0) {
+ : kProgressBarBaseline(RECOVERY_UI_PROGRESS_BAR_BASELINE),
+ kMenuUnusableRows(RECOVERY_UI_MENU_UNUSABLE_ROWS) {
+ // TODO: kMenuUnusableRows should be computed based on the lines in draw_screen_locked().
+
+ // TODO: The following three variables are likely not needed. The first two are detected
+ // automatically in ScreenRecoveryUI::LoadAnimation(), based on the actual files seen on device.
intro_frames = 22;
loop_frames = 60;
- animation_fps = 30;
+
+ touch_screen_allowed_ = true;
for (size_t i = 0; i < 5; i++) backgroundIcon[i] = NULL;
@@ -62,7 +68,7 @@ WearRecoveryUI::WearRecoveryUI()
}
int WearRecoveryUI::GetProgressBaseline() const {
- return progress_bar_y;
+ return kProgressBarBaseline;
}
// Draw background frame on the screen. Does not flip pages.
@@ -113,8 +119,8 @@ void WearRecoveryUI::draw_screen_locked() {
SetColor(TEXT_FILL);
gr_fill(0, 0, gr_fb_width(), gr_fb_height());
- int y = outer_height;
- int x = outer_width;
+ int y = kMarginHeight;
+ int x = kMarginWidth;
if (show_menu) {
std::string recovery_fingerprint =
android::base::GetProperty("ro.bootimage.build.fingerprint", "");
@@ -170,7 +176,7 @@ void WearRecoveryUI::draw_screen_locked() {
int ty;
int row = (text_top_ + text_rows_ - 1) % text_rows_;
size_t count = 0;
- for (int ty = gr_fb_height() - char_height_ - outer_height; ty > y + 2 && count < text_rows_;
+ for (int ty = gr_fb_height() - char_height_ - kMarginHeight; ty > y + 2 && count < text_rows_;
ty -= char_height_, ++count) {
gr_text(gr_sys_font(), x + 4, ty, text_[row], 0);
--row;
@@ -190,12 +196,12 @@ bool WearRecoveryUI::InitTextParams() {
return false;
}
- text_cols_ = (gr_fb_width() - (outer_width * 2)) / char_width_;
+ 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() - (outer_height * 2)) / char_height_;
+ visible_text_rows = (gr_fb_height() - (kMarginHeight * 2)) / char_height_;
return true;
}
@@ -263,7 +269,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 - menu_unusable_rows;
+ menu_end = visible_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 a814118c7..3bd90b699 100644
--- a/wear_ui.h
+++ b/wear_ui.h
@@ -42,14 +42,11 @@ class WearRecoveryUI : public ScreenRecoveryUI {
protected:
// progress bar vertical position, it's centered horizontally
- int progress_bar_y;
-
- // outer of window
- int outer_height, outer_width;
+ const int kProgressBarBaseline;
// Unusable rows when displaying the recovery menu, including the lines for headers (Android
// Recovery, build id and etc) and the bottom lines that may otherwise go out of the screen.
- int menu_unusable_rows;
+ const int kMenuUnusableRows;
int GetProgressBaseline() const override;