Commit 2673cec0 authored by Dees_Troy's avatar Dees_Troy

Move all AOSP code out of recovery binary

Improves license compatibility between GPL and Apache

Change-Id: I2b165aa575bb6213af6b07936f99610c113443f0
parent a13d74fc
......@@ -16,25 +16,16 @@ LOCAL_PATH := $(call my-dir)
TARGET_RECOVERY_GUI := true
include $(CLEAR_VARS)
LOCAL_SRC_FILES := \
recovery.cpp \
twbootloader.cpp \
install.cpp \
roots.cpp \
ui.cpp \
screen_ui.cpp \
verifier.cpp \
twrp.cpp \
fixPermissions.cpp \
twrpTar.cpp \
twrpDigest.cpp \
adb_install.cpp
LOCAL_SRC_FILES += \
data.cpp \
partition.cpp \
partitionmanager.cpp \
mtdutils/mtdutils.c \
twinstall.cpp \
twrp-functions.cpp \
openrecoveryscript.cpp \
......@@ -64,10 +55,8 @@ LOCAL_C_INCLUDES += bionic external/stlport/stlport
LOCAL_STATIC_LIBRARIES :=
LOCAL_SHARED_LIBRARIES :=
LOCAL_STATIC_LIBRARIES += libmtdutils libcrecovery
LOCAL_STATIC_LIBRARIES += libminadbd libminzip libunz
LOCAL_STATIC_LIBRARIES += libminuitwrp libpixelflinger_static libpng libjpegtwrp libgui
LOCAL_SHARED_LIBRARIES += libz libc libstlport libcutils libstdc++ libmincrypt libext4_utils libtar libblkid
LOCAL_STATIC_LIBRARIES += libcrecovery libguitwrp
LOCAL_SHARED_LIBRARIES += libz libc libstlport libcutils libstdc++ libext4_utils libtar libblkid libminuitwrp libminadbd libmtdutils libminzip libaosprecovery
ifneq ($(wildcard system/core/libsparse/Android.mk),)
LOCAL_SHARED_LIBRARIES += libsparse
......@@ -80,9 +69,9 @@ ifeq ($(TARGET_USERIMAGES_USE_EXT4), true)
endif
ifeq ($(HAVE_SELINUX), true)
LOCAL_C_INCLUDES += external/libselinux/include
LOCAL_STATIC_LIBRARIES += libselinux
LOCAL_CFLAGS += -DHAVE_SELINUX -g
#LOCAL_C_INCLUDES += external/libselinux/include
#LOCAL_STATIC_LIBRARIES += libselinux
#LOCAL_CFLAGS += -DHAVE_SELINUX -g
endif # HAVE_SELINUX
# This binary is in the recovery ramdisk, which is otherwise a copy of root.
......@@ -217,17 +206,16 @@ ifeq ($(TW_INCLUDE_CRYPTO_SAMSUNG), true)
LOCAL_LDFLAGS += -ldl
LOCAL_STATIC_LIBRARIES += libcrypt_samsung
endif
LOCAL_SHARED_LIBRARIES += libcrypto
LOCAL_SRC_FILES += crypto/ics/cryptfs.c
LOCAL_C_INCLUDES += system/extras/ext4_utils external/openssl/include
LOCAL_SHARED_LIBRARIES += libcryptfsics
#LOCAL_SRC_FILES += crypto/ics/cryptfs.c
#LOCAL_C_INCLUDES += system/extras/ext4_utils external/openssl/include
endif
ifeq ($(TW_INCLUDE_JB_CRYPTO), true)
LOCAL_CFLAGS += -DTW_INCLUDE_CRYPTO
LOCAL_CFLAGS += -DTW_INCLUDE_JB_CRYPTO
LOCAL_SHARED_LIBRARIES += libcrypto
LOCAL_STATIC_LIBRARIES += libfs_mgrtwrp
LOCAL_SRC_FILES += crypto/jb/cryptfs.c
LOCAL_C_INCLUDES += system/extras/ext4_utils external/openssl/include
LOCAL_SHARED_LIBRARIES += libcryptfsjb
#LOCAL_SRC_FILES += crypto/jb/cryptfs.c
#LOCAL_C_INCLUDES += system/extras/ext4_utils external/openssl/include
endif
ifeq ($(TW_USE_MODEL_HARDWARE_ID_FOR_DEVICE_ID), true)
LOCAL_CFLAGS += -DTW_USE_MODEL_HARDWARE_ID_FOR_DEVICE_ID
......@@ -277,6 +265,18 @@ LOCAL_STATIC_LIBRARIES := \
libc
include $(BUILD_EXECUTABLE)
include $(CLEAR_VARS)
LOCAL_MODULE := libaosprecovery
LOCAL_MODULE_TAGS := eng
LOCAL_MODULES_TAGS = optional
LOCAL_CFLAGS =
LOCAL_SRC_FILES = adb_install.cpp bootloader.cpp verifier.cpp
LOCAL_SHARED_LIBRARIES += libc liblog libcutils libmtdutils
LOCAL_STATIC_LIBRARIES += libmincrypt
include $(BUILD_SHARED_LIBRARY)
commands_recovery_local_path := $(LOCAL_PATH)
include $(LOCAL_PATH)/minui/Android.mk \
$(LOCAL_PATH)/minelf/Android.mk \
......@@ -291,7 +291,6 @@ include $(LOCAL_PATH)/minui/Android.mk \
include $(commands_recovery_local_path)/libjpegtwrp/Android.mk \
$(commands_recovery_local_path)/injecttwrp/Android.mk \
$(commands_recovery_local_path)/htcdumlock/Android.mk \
$(commands_recovery_local_path)/minuitwrp/Android.mk \
$(commands_recovery_local_path)/gui/Android.mk \
$(commands_recovery_local_path)/mmcutils/Android.mk \
$(commands_recovery_local_path)/bmlutils/Android.mk \
......@@ -305,13 +304,15 @@ include $(commands_recovery_local_path)/libjpegtwrp/Android.mk \
$(commands_recovery_local_path)/crypto/cryptfs/Android.mk \
$(commands_recovery_local_path)/libcrecovery/Android.mk \
$(commands_recovery_local_path)/twmincrypt/Android.mk \
$(commands_recovery_local_path)/libblkid/Android.mk
$(commands_recovery_local_path)/libblkid/Android.mk \
$(commands_recovery_local_path)/minuitwrp/Android.mk
ifeq ($(TW_INCLUDE_CRYPTO_SAMSUNG), true)
include $(commands_recovery_local_path)/crypto/libcrypt_samsung/Android.mk
endif
ifeq ($(TW_INCLUDE_JB_CRYPTO), true)
include $(commands_recovery_local_path)/crypto/jb/Android.mk
include $(commands_recovery_local_path)/crypto/fs_mgr/Android.mk
endif
ifeq ($(BUILD_ID), GINGERBREAD)
......@@ -323,5 +324,8 @@ ifneq ($(TW_NO_EXFAT), true)
$(commands_recovery_local_path)/fuse/Android.mk \
$(commands_recovery_local_path)/exfat/libexfat/Android.mk
endif
ifeq ($(TW_INCLUDE_CRYPTO), true)
include $(commands_recovery_local_path)/crypto/ics/Android.mk
endif
commands_recovery_local_path :=
......@@ -24,17 +24,13 @@
#include <sys/stat.h>
#include <signal.h>
#include <fcntl.h>
#include <stdio.h>
#include "ui.h"
#include "cutils/properties.h"
#include "install.h"
#include "common.h"
#include "adb_install.h"
extern "C" {
#include "minadbd/adb.h"
#include "twinstall.h"
#include "data.h"
int TWinstall_zip(const char* path, int* wipe_cache);
}
static RecoveryUI* ui = NULL;
......@@ -47,20 +43,20 @@ set_usb_driver(bool enabled) {
It's not a critical error so we're disabling the error messages.
ui->Print("failed to open driver control: %s\n", strerror(errno));
*/
LOGI("failed to open driver control: %s\n", strerror(errno));
printf("failed to open driver control: %s\n", strerror(errno));
return;
}
if (write(fd, enabled ? "1" : "0", 1) < 0) {
/*
ui->Print("failed to set driver control: %s\n", strerror(errno));
*/
LOGI("failed to set driver control: %s\n", strerror(errno));
printf("failed to set driver control: %s\n", strerror(errno));
}
if (close(fd) < 0) {
/*
ui->Print("failed to close driver control: %s\n", strerror(errno));
*/
LOGI("failed to close driver control: %s\n", strerror(errno));
printf("failed to close driver control: %s\n", strerror(errno));
}
}
......@@ -76,28 +72,29 @@ maybe_restart_adbd() {
char value[PROPERTY_VALUE_MAX+1];
int len = property_get("ro.debuggable", value, NULL);
if (len == 1 && value[0] == '1') {
ui->Print("Restarting adbd...\n");
printf("Restarting adbd...\n");
set_usb_driver(true);
property_set("ctl.start", "adbd");
}
}
int
apply_from_adb(RecoveryUI* ui_, int* wipe_cache, const char* install_file) {
ui = ui_;
apply_from_adb(const char* install_file) {
stop_adbd();
set_usb_driver(true);
/*
ui->Print("\n\nNow send the package you want to apply\n"
"to the device with \"adb sideload <filename>\"...\n");
*/
pid_t child;
if ((child = fork()) == 0) {
execl("/sbin/recovery", "recovery", "--adbd", install_file, NULL);
_exit(-1);
}
DataManager_SetIntValue("tw_child_pid", child);
char child_prop[PROPERTY_VALUE_MAX];
sprintf(child_prop, "%i", child);
property_set("tw_child_pid", child_prop);
int status;
// TODO(dougz): there should be a way to cancel waiting for a
// package (by pushing some button combo on the device). For now
......@@ -105,20 +102,19 @@ apply_from_adb(RecoveryUI* ui_, int* wipe_cache, const char* install_file) {
// package, like "/dev/null".
waitpid(child, &status, 0);
if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) {
ui->Print("status %d\n", WEXITSTATUS(status));
printf("status %d\n", WEXITSTATUS(status));
}
DataManager_SetIntValue("tw_has_cancel", 0); // Remove cancel button from gui now that the zip install is going to start
set_usb_driver(false);
maybe_restart_adbd();
struct stat st;
if (stat(install_file, &st) != 0) {
if (errno == ENOENT) {
ui->Print("No package received.\n");
printf("No package received.\n");
} else {
ui->Print("Error reading package:\n %s\n", strerror(errno));
printf("Error reading package:\n %s\n", strerror(errno));
}
return INSTALL_ERROR;
return -1;
}
return TWinstall_zip(install_file, wipe_cache);
return 0;
}
......@@ -17,8 +17,8 @@
#ifndef _ADB_INSTALL_H
#define _ADB_INSTALL_H
class RecoveryUI;
//class RecoveryUI;
int apply_from_adb(RecoveryUI* h, int* wipe_cache, const char* install_file);
int apply_from_adb(const char* install_file);
#endif
......@@ -33,7 +33,7 @@ static int get_bootloader_message_block(struct bootloader_message *out, const Vo
static int set_bootloader_message_block(const struct bootloader_message *in, const Volume* v);
int get_bootloader_message(struct bootloader_message *out) {
Volume* v = volume_for_path("/misc");
Volume* v = NULL;//volume_for_path("/misc");
if (v == NULL) {
LOGE("Cannot load volume /misc!\n");
return -1;
......@@ -48,7 +48,7 @@ int get_bootloader_message(struct bootloader_message *out) {
}
int set_bootloader_message(const struct bootloader_message *in) {
Volume* v = volume_for_path("/misc");
Volume* v = NULL;//volume_for_path("/misc");
if (v == NULL) {
LOGE("Cannot load volume /misc!\n");
return -1;
......@@ -139,6 +139,49 @@ static int set_bootloader_message_mtd(const struct bootloader_message *in,
return 0;
}
int set_bootloader_message_mtd_name(const struct bootloader_message *in,
const char* mtd_name) {
size_t write_size;
mtd_scan_partitions();
const MtdPartition *part = mtd_find_partition_by_name(mtd_name);
if (part == NULL || mtd_partition_info(part, NULL, NULL, &write_size)) {
printf("Can't find %s\n", mtd_name);
return -1;
}
MtdReadContext *read = mtd_read_partition(part);
if (read == NULL) {
printf("Can't open %s\n(%s)\n", mtd_name, strerror(errno));
return -1;
}
ssize_t size = write_size * MISC_PAGES;
char data[size];
ssize_t r = mtd_read_data(read, data, size);
if (r != size) printf("Can't read %s\n(%s)\n", mtd_name, strerror(errno));
mtd_read_close(read);
if (r != size) return -1;
memcpy(&data[write_size * MISC_COMMAND_PAGE], in, sizeof(*in));
MtdWriteContext *write = mtd_write_partition(part);
if (write == NULL) {
printf("Can't open %s\n(%s)\n", mtd_name, strerror(errno));
return -1;
}
if (mtd_write_data(write, data, size) != size) {
printf("Can't write %s\n(%s)\n", mtd_name, strerror(errno));
mtd_write_close(write);
return -1;
}
if (mtd_write_close(write)) {
printf("Can't finish %s\n(%s)\n", mtd_name, strerror(errno));
return -1;
}
printf("Set boot command \"%s\"\n", in->command[0] != 255 ? in->command : "");
return 0;
}
// ------------------------------------
// for misc partitions on block devices
......@@ -202,3 +245,23 @@ static int set_bootloader_message_block(const struct bootloader_message *in,
}
return 0;
}
int set_bootloader_message_block_name(const struct bootloader_message *in,
const char* block_name) {
wait_for_device(block_name);
FILE* f = fopen(block_name, "wb");
if (f == NULL) {
printf("Can't open %s\n(%s)\n", block_name, strerror(errno));
return -1;
}
int count = fwrite(in, sizeof(*in), 1, f);
if (count != 1) {
printf("Failed writing %s\n(%s)\n", block_name, strerror(errno));
return -1;
}
if (fclose(f) != 0) {
printf("Failed closing %s\n(%s)\n", block_name, strerror(errno));
return -1;
}
return 0;
}
......@@ -51,6 +51,9 @@ struct bootloader_message {
int get_bootloader_message(struct bootloader_message *out);
int set_bootloader_message(const struct bootloader_message *in);
int set_bootloader_message_mtd_name(const struct bootloader_message *in, const char* mtd_name);
int set_bootloader_message_block_name(const struct bootloader_message *in, const char* block_name);
#ifdef __cplusplus
}
#endif
......
......@@ -25,12 +25,11 @@ extern "C" {
static long tmplog_offset = 0;
#define ui_print(...) gui_print(__VA_ARGS__)
#define ui_print_overwrite(...) gui_print_overwrite(__VA_ARGS__)
#define ui_print(...) printf(__VA_ARGS__)
#define ui_print_overwrite(...) printf(__VA_ARGS__)
#include "gui/gui.h"
// TODO: restore ui_print for LOGE
#define LOGE(...) gui_print("E:" __VA_ARGS__)
#define LOGE(...) printf("E:" __VA_ARGS__)
#define LOGW(...) fprintf(stdout, "W:" __VA_ARGS__)
#define LOGI(...) fprintf(stdout, "I:" __VA_ARGS__)
......
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := libcryptfsics
LOCAL_MODULE_TAGS := eng
LOCAL_MODULES_TAGS = optional
LOCAL_CFLAGS =
LOCAL_SRC_FILES = cryptfs.c
LOCAL_C_INCLUDES += system/extras/ext4_utils external/openssl/include
LOCAL_SHARED_LIBRARIES += libc liblog libcutils libcrypto
include $(BUILD_SHARED_LIBRARY)
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := libcryptfsjb
LOCAL_MODULE_TAGS := eng
LOCAL_MODULES_TAGS = optional
LOCAL_CFLAGS =
LOCAL_SRC_FILES = cryptfs.c
LOCAL_C_INCLUDES += system/extras/ext4_utils external/openssl/include
LOCAL_SHARED_LIBRARIES += libc liblog libcutils libcrypto
LOCAL_STATIC_LIBRARIES += libfs_mgrtwrp
include $(BUILD_SHARED_LIBRARY)
\ No newline at end of file
This diff is collapsed.
......@@ -33,6 +33,7 @@ public:
// Core get routines
static int GetValue(const string varName, string& value);
static int GetValue(const string varName, int& value);
static int GetValue(const string varName, float& value);
static unsigned long long GetValue(const string varName, unsigned long long& value);
// This is a dangerous function. It will create the value if it doesn't exist so it has a valid c_str
......@@ -47,6 +48,8 @@ public:
static int SetValue(const string varName, int value, int persist = 0);
static int SetValue(const string varName, float value, int persist = 0);
static int SetValue(const string varName, unsigned long long value, int persist = 0);
static int SetProgress(float Fraction);
static int ShowProgress(float Portion, float Seconds);
static void DumpValues();
static void update_tz_environment_variables();
......
This diff is collapsed.
......@@ -30,7 +30,7 @@ else
LOCAL_SRC_FILES += hardwarekeyboard.cpp
endif
LOCAL_MODULE := libgui
LOCAL_MODULE := libguitwrp
# Use this flag to create a build that simulates threaded actions like installing zips, backups, restores, and wipes for theme testing
#TWRP_SIMULATE_ACTIONS := true
......
This diff is collapsed.
......@@ -18,9 +18,8 @@
#include <string>
extern "C" {
#include "../common.h"
#include "../twcommon.h"
#include "../minuitwrp/minui.h"
#include "../recovery_ui.h"
}
#include "rapidxml.hpp"
......
......@@ -39,8 +39,7 @@ extern "C" {
#include "blanktimer.hpp"
#include "../data.hpp"
extern "C" {
#include "../common.h"
#include "../recovery_ui.h"
#include "../twcommon.h"
}
#include "../twrp-functions.hpp"
#include "../variables.h"
......@@ -140,7 +139,7 @@ void blanktimer::resetTimerAndUnblank(void) {
case 3:
#ifndef TW_NO_SCREEN_BLANK
if (gr_fb_blank(0) < 0) {
LOGI("blanktimer::resetTimerAndUnblank failed to gr_fb_blank(0)\n");
LOGINFO("blanktimer::resetTimerAndUnblank failed to gr_fb_blank(0)\n");
break;
}
#endif
......
......@@ -34,9 +34,8 @@
#include <string>
extern "C" {
#include "../common.h"
#include "../twcommon.h"
#include "../minuitwrp/minui.h"
#include "../recovery_ui.h"
}
#include "rapidxml.hpp"
......@@ -87,7 +86,7 @@ GUIButton::GUIButton(xml_node<>* node)
}
}
if (!hasFill && mButtonImg == NULL) {
LOGE("No image resource or fill specified for button.\n");
LOGERR("No image resource or fill specified for button.\n");
}
// The icon is a special case
......
......@@ -18,9 +18,8 @@
#include <string>
extern "C" {
#include "../common.h"
#include "../twcommon.h"
#include "../minuitwrp/minui.h"
#include "../recovery_ui.h"
}
#include "rapidxml.hpp"
......
......@@ -18,9 +18,8 @@
#include <string>
extern "C" {
#include "../common.h"
#include "../twcommon.h"
#include "../minuitwrp/minui.h"
#include "../recovery_ui.h"
#include "../variables.h"
}
......
......@@ -18,9 +18,8 @@
#include <string>
extern "C" {
#include "../common.h"
#include "../twcommon.h"
#include "../minuitwrp/minui.h"
#include "../recovery_ui.h"
}
#include "rapidxml.hpp"
......
......@@ -38,10 +38,8 @@
#include <algorithm>
extern "C" {
#include "../common.h"
#include "../roots.h"
#include "../twcommon.h"
#include "../minuitwrp/minui.h"
#include "../recovery_ui.h"
}
#include "rapidxml.hpp"
......@@ -945,7 +943,7 @@ int GUIFileSelector::GetFileList(const std::string folder)
d = opendir(folder.c_str());
if (d == NULL)
{
LOGI("Unable to open '%s'\n", folder.c_str());
LOGINFO("Unable to open '%s'\n", folder.c_str());
if (folder != "/" && (mShowNavFolders != 0 || mShowFiles != 0)) {
size_t found;
found = folder.find_last_of('/');
......
......@@ -18,9 +18,8 @@
#include <string>
extern "C" {
#include "../common.h"
#include "../twcommon.h"
#include "../minuitwrp/minui.h"
#include "../recovery_ui.h"
}
#include "rapidxml.hpp"
......@@ -36,7 +35,7 @@ GUIFill::GUIFill(xml_node<>* node)
attr = node->first_attribute("color");
if (!attr) {
LOGE("No color specified for fill\n");
LOGERR("No color specified for fill\n");
return;
}
......
......@@ -35,10 +35,8 @@
extern "C"
{
#include "../common.h"
#include "../roots.h"
#include "../twcommon.h"
#include "../minuitwrp/minui.h"
#include "../recovery_ui.h"
#include "../minzip/Zip.h"
#include <pixelflinger/pixelflinger.h>
}
......@@ -217,7 +215,7 @@ input_thread (void *cookie)
touch_repeat = 1;
gettimeofday (&touchStart, NULL);
#ifdef _EVENT_LOGGING
LOGE ("TOUCH_HOLD: %d,%d\n", x, y);
LOGERR("TOUCH_HOLD: %d,%d\n", x, y);
#endif
PageManager::NotifyTouch (TOUCH_HOLD, x, y);
blankTimer.resetTimerAndUnblank();
......@@ -225,7 +223,7 @@ input_thread (void *cookie)
else if (touch_repeat && mtime > 100)
{
#ifdef _EVENT_LOGGING
LOGE ("TOUCH_REPEAT: %d,%d\n", x, y);
LOGERR("TOUCH_REPEAT: %d,%d\n", x, y);
#endif
gettimeofday (&touchStart, NULL);
PageManager::NotifyTouch (TOUCH_REPEAT, x, y);
......@@ -234,7 +232,7 @@ input_thread (void *cookie)
else if (key_repeat == 1 && mtime > 500)
{
#ifdef _EVENT_LOGGING
LOGE ("KEY_HOLD: %d,%d\n", x, y);
LOGERR("KEY_HOLD: %d,%d\n", x, y);
#endif
gettimeofday (&touchStart, NULL);
key_repeat = 2;
......@@ -244,7 +242,7 @@ input_thread (void *cookie)
else if (key_repeat == 2 && mtime > 100)
{
#ifdef _EVENT_LOGGING
LOGE ("KEY_REPEAT: %d,%d\n", x, y);
LOGERR("KEY_REPEAT: %d,%d\n", x, y);
#endif
gettimeofday (&touchStart, NULL);
kb.KeyRepeat ();
......@@ -262,7 +260,7 @@ input_thread (void *cookie)
if (state == 0)
{
#ifdef _EVENT_LOGGING
LOGE ("TOUCH_RELEASE: %d,%d\n", x, y);
LOGERR("TOUCH_RELEASE: %d,%d\n", x, y);
#endif
PageManager::NotifyTouch (TOUCH_RELEASE, x, y);
blankTimer.resetTimerAndUnblank();
......@@ -279,7 +277,7 @@ input_thread (void *cookie)
if (!drag)
{
#ifdef _EVENT_LOGGING
LOGE ("TOUCH_START: %d,%d\n", x, y);
LOGERR("TOUCH_START: %d,%d\n", x, y);
#endif
if (PageManager::NotifyTouch (TOUCH_START, x, y) > 0)
state = 1;
......@@ -295,7 +293,7 @@ input_thread (void *cookie)
if (state == 0)
{
#ifdef _EVENT_LOGGING
LOGE ("TOUCH_DRAG: %d,%d\n", x, y);
LOGERR("TOUCH_DRAG: %d,%d\n", x, y);
#endif
if (PageManager::NotifyTouch (TOUCH_DRAG, x, y) > 0)
state = 1;
......@@ -309,7 +307,7 @@ input_thread (void *cookie)
{
// Handle key-press here
#ifdef _EVENT_LOGGING
LOGE ("TOUCH_KEY: %d\n", ev.code);
LOGERR("TOUCH_KEY: %d\n", ev.code);
#endif
if (ev.value != 0)
{
......@@ -502,7 +500,7 @@ gui_forceRender (void)
int
gui_changePage (std::string newPage)
{
LOGI ("Set page: '%s'\n", newPage.c_str ());
LOGINFO("Set page: '%s'\n", newPage.c_str ());
PageManager::ChangePage (newPage);
pthread_mutex_lock(&gForceRendermutex);
gForceRender = 1;
......@@ -600,41 +598,41 @@ gui_loadResources ()
{
if (PageManager::LoadPackage ("TWRP", "/res/ui.xml", "decrypt"))
{
LOGE ("Failed to load base packages.\n");
LOGERR("Failed to load base packages.\n");
goto error;
}
else
check = 1;
}
if (check == 0
&& PageManager::LoadPackage ("TWRP", "/script/ui.xml", "main"))
&& PageManager::LoadPackage("TWRP", "/script/ui.xml", "main"))
{
std::string theme_path;
theme_path = DataManager::GetSettingsStoragePath ();
if (!PartitionManager.Mount_Settings_Storage (false))
if (!PartitionManager.Mount_Settings_Storage(false))
{
int retry_count = 5;
while (retry_count > 0
&& !PartitionManager.Mount_Settings_Storage (false))
&& !PartitionManager.Mount_Settings_Storage(false))
{
usleep (500000);
retry_count--;
}
if (!PartitionManager.Mount_Settings_Storage (false))
if (!PartitionManager.Mount_Settings_Storage(false))
{
LOGE ("Unable to mount %s during GUI startup.\n",
LOGERR("Unable to mount %s during GUI startup.\n",
theme_path.c_str ());
check = 1;
}
}
theme_path += "/TWRP/theme/ui.zip";
if (check || PageManager::LoadPackage ("TWRP", theme_path, "main"))
if (check || PageManager::LoadPackage("TWRP", theme_path, "main"))
{
if (PageManager::LoadPackage ("TWRP", "/res/ui.xml", "main"))
if (PageManager::LoadPackage("TWRP", "/res/ui.xml", "main"))
{
LOGE ("Failed to load base packages.\n");
LOGERR("Failed to load base packages.\n");
goto error;
}
}
......@@ -647,7 +645,7 @@ gui_loadResources ()
return 0;
error:
LOGE ("An internal error has occurred.\n");
LOGERR("An internal error has occurred.\n");
gGuiInitialized = 0;
return -1;
}
......@@ -687,7 +685,7 @@ gui_startPage (const char *page_name)
loopTimer ();
// Set the default package
PageManager::SelectPackage ("TWRP");
PageManager::SelectPackage("TWRP");
if (!gGuiInputRunning)
{
......@@ -697,7 +695,7 @@ gui_startPage (const char *page_name)
gGuiInputRunning = 1;
}
DataManager::SetValue ("tw_page_done", 0);
DataManager::SetValue("tw_page_done", 0);
return runPage (page_name);
}
......@@ -722,7 +720,7 @@ console_thread (void *cookie)
flip ();
if (ret < 0)
LOGE ("An update request has failed.\n");
LOGERR("An update request has failed.\n");
}
else
{
......
......@@ -19,9 +19,8 @@
#include <string>
extern "C" {
#include "../common.h"
#include "../twcommon.h"
#include "../minuitwrp/minui.h"