Move all AOSP code out of recovery binary

Improves license compatibility between GPL and Apache

Change-Id: I2b165aa575bb6213af6b07936f99610c113443f0
diff --git a/gui/pages.cpp b/gui/pages.cpp
index 40de44f..bf44b38 100644
--- a/gui/pages.cpp
+++ b/gui/pages.cpp
@@ -35,9 +35,8 @@
 #include <string>
 
 extern "C" {
-#include "../common.h"
+#include "../twcommon.h"
 #include "../minuitwrp/minui.h"
-#include "../recovery_ui.h"
 }
 
 #include "rapidxml.hpp"
@@ -171,11 +170,11 @@
         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 @@
 {
     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 @@
         {
             if (!templates || !child->first_attribute("name"))
             {
-                LOGE("Invalid template request.\n");
+                LOGERR("Invalid template request.\n");
             }
             else
             {
@@ -331,7 +330,7 @@
         }
         else
         {
-            LOGE("Unknown object type.\n");
+            LOGERR("Unknown object type.\n");
         }
         child = child->next_sibling("object");
     }
@@ -349,7 +348,7 @@
     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 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 @@
         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 @@
         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 @@
         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 @@
     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 @@
         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 @@
     }
     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 @@
         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 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 @@
         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 @@
     
         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 @@
     }
     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 @@
     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 @@
     {
         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 @@
 
     if (LoadPackage(name, package, "main") != 0)
     {
-        LOGE("Failed to load package.\n");
+        LOGERR("Failed to load package.\n");
         mPageSets.insert(std::pair<std::string, PageSet*>(name, set));
         return -1;
     }