From 2673cec07a4740f86438b50cfe1b70b258a9a8c8 Mon Sep 17 00:00:00 2001 From: Dees_Troy Date: Tue, 2 Apr 2013 20:22:16 +0000 Subject: Move all AOSP code out of recovery binary Improves license compatibility between GPL and Apache Change-Id: I2b165aa575bb6213af6b07936f99610c113443f0 --- gui/pages.cpp | 53 ++++++++++++++++++++++++++--------------------------- 1 file changed, 26 insertions(+), 27 deletions(-) (limited to 'gui/pages.cpp') diff --git a/gui/pages.cpp b/gui/pages.cpp index 40de44f79..bf44b3856 100644 --- a/gui/pages.cpp +++ b/gui/pages.cpp @@ -35,9 +35,8 @@ #include extern "C" { -#include "../common.h" +#include "../twcommon.h" #include "../minuitwrp/minui.h" -#include "../recovery_ui.h" } #include "rapidxml.hpp" @@ -171,11 +170,11 @@ Page::Page(xml_node<>* page, xml_node<>* templates /* = NULL */) mName = page->first_attribute("name")->value(); else { - LOGE("No page name attribute found!\n"); + LOGERR("No page name attribute found!\n"); return; } - LOGI("Loading page %s\n", mName.c_str()); + LOGINFO("Loading page %s\n", mName.c_str()); // This is a recursive routine for template handling ProcessNode(page, templates); @@ -187,7 +186,7 @@ bool Page::ProcessNode(xml_node<>* page, xml_node<>* templates /* = NULL */, int { if (depth == 10) { - LOGE("Page processing depth has exceeded 10. Failing out. This is likely a recursive template.\n"); + LOGERR("Page processing depth has exceeded 10. Failing out. This is likely a recursive template.\n"); return false; } @@ -303,7 +302,7 @@ bool Page::ProcessNode(xml_node<>* page, xml_node<>* templates /* = NULL */, int { if (!templates || !child->first_attribute("name")) { - LOGE("Invalid template request.\n"); + LOGERR("Invalid template request.\n"); } else { @@ -331,7 +330,7 @@ bool Page::ProcessNode(xml_node<>* page, xml_node<>* templates /* = NULL */, int } else { - LOGE("Unknown object type.\n"); + LOGERR("Unknown object type.\n"); } child = child->next_sibling("object"); } @@ -349,7 +348,7 @@ int Page::Render(void) for (iter = mRenders.begin(); iter != mRenders.end(); iter++) { if ((*iter)->Render()) - LOGE("A render request has failed.\n"); + LOGERR("A render request has failed.\n"); } return 0; } @@ -363,7 +362,7 @@ int Page::Update(void) { int ret = (*iter)->Update(); if (ret < 0) - LOGE("An update request has failed.\n"); + LOGERR("An update request has failed.\n"); else if (ret > retCode) retCode = ret; } @@ -421,7 +420,7 @@ int Page::NotifyKey(int key) if (ret == 0) return 0; else if (ret < 0) - LOGE("An action handler has returned an error"); + LOGERR("An action handler has returned an error"); } return 1; } @@ -440,7 +439,7 @@ int Page::NotifyKeyboard(int key) if (ret == 0) return 0; else if (ret < 0) - LOGE("A keyboard handler has returned an error"); + LOGERR("A keyboard handler has returned an error"); } return 1; } @@ -459,7 +458,7 @@ int Page::SetKeyBoardFocus(int inFocus) if (ret == 0) return 0; else if (ret < 0) - LOGE("An input focus handler has returned an error"); + LOGERR("An input focus handler has returned an error"); } return 1; } @@ -485,7 +484,7 @@ int Page::NotifyVarChange(std::string varName, std::string value) for (iter = mActions.begin(); iter != mActions.end(); ++iter) { if ((*iter)->NotifyVarChange(varName, value)) - LOGE("An action handler errored on NotifyVarChange.\n"); + LOGERR("An action handler errored on NotifyVarChange.\n"); } return 0; } @@ -520,17 +519,17 @@ int PageSet::Load(ZipArchive* package) parent = mDoc.first_node("install"); // Now, let's parse the XML - LOGI("Loading resources...\n"); + LOGINFO("Loading resources...\n"); child = parent->first_node("resources"); if (child) mResources = new ResourceManager(child, package); - LOGI("Loading variables...\n"); + LOGINFO("Loading variables...\n"); child = parent->first_node("variables"); if (child) LoadVariables(child); - LOGI("Loading pages...\n"); + LOGINFO("Loading pages...\n"); // This may be NULL if no templates are present templates = parent->first_node("templates"); @@ -554,7 +553,7 @@ int PageSet::SetPage(std::string page) } else { - LOGE("Unable to locate page (%s)\n", page.c_str()); + LOGERR("Unable to locate page (%s)\n", page.c_str()); } return -1; } @@ -618,7 +617,7 @@ int PageSet::LoadPages(xml_node<>* pages, xml_node<>* templates /* = NULL */) Page* page = new Page(child, templates); if (page->GetName().empty()) { - LOGE("Unable to process load page\n"); + LOGERR("Unable to process load page\n"); delete page; } else @@ -697,7 +696,7 @@ int PageManager::LoadPackage(std::string name, std::string package, std::string int ret; // Open the XML file - LOGI("Loading package: %s (%s)\n", name.c_str(), package.c_str()); + LOGINFO("Loading package: %s (%s)\n", name.c_str(), package.c_str()); if (mzOpenZipArchive(package.c_str(), &zip)) { // We can try to load the XML directly... @@ -721,7 +720,7 @@ int PageManager::LoadPackage(std::string name, std::string package, std::string const ZipEntry* ui_xml = mzFindZipEntry(&zip, "ui.xml"); if (ui_xml == NULL) { - LOGE("Unable to locate ui.xml in zip file\n"); + LOGERR("Unable to locate ui.xml in zip file\n"); goto error; } @@ -732,7 +731,7 @@ int PageManager::LoadPackage(std::string name, std::string package, std::string if (!mzExtractZipEntryToBuffer(&zip, ui_xml, (unsigned char*) xmlFile)) { - LOGE("Unable to extract ui.xml\n"); + LOGERR("Unable to extract ui.xml\n"); goto error; } } @@ -752,7 +751,7 @@ int PageManager::LoadPackage(std::string name, std::string package, std::string } else { - LOGE("Package %s failed to load.\n", name.c_str()); + LOGERR("Package %s failed to load.\n", name.c_str()); } // The first successful package we loaded is the base @@ -765,7 +764,7 @@ int PageManager::LoadPackage(std::string name, std::string package, std::string return ret; error: - LOGE("An internal error has occurred.\n"); + LOGERR("An internal error has occurred.\n"); if (pZip) mzCloseZipArchive(pZip); if (xmlFile) free(xmlFile); return -1; @@ -780,20 +779,20 @@ PageSet* PageManager::FindPackage(std::string name) { return (*iter).second; } - LOGE("Unable to locate package %s\n", name.c_str()); + LOGERR("Unable to locate package %s\n", name.c_str()); return NULL; } PageSet* PageManager::SelectPackage(std::string name) { - LOGI("Switching packages (%s)\n", name.c_str()); + LOGINFO("Switching packages (%s)\n", name.c_str()); PageSet* tmp; tmp = FindPackage(name); if (tmp) mCurrentSet = tmp; else - LOGE("Unable to find package.\n"); + LOGERR("Unable to find package.\n"); return mCurrentSet; } @@ -811,7 +810,7 @@ int PageManager::ReloadPackage(std::string name, std::string package) if (LoadPackage(name, package, "main") != 0) { - LOGE("Failed to load package.\n"); + LOGERR("Failed to load package.\n"); mPageSets.insert(std::pair(name, set)); return -1; } -- cgit v1.2.3