summaryrefslogtreecommitdiffstats
path: root/gui
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--gui/Android.mk5
-rw-r--r--gui/pages.cpp18
2 files changed, 23 insertions, 0 deletions
diff --git a/gui/Android.mk b/gui/Android.mk
index 479bc76f9..15a27a204 100644
--- a/gui/Android.mk
+++ b/gui/Android.mk
@@ -81,6 +81,11 @@ ifeq ($(TW_CUSTOM_THEME),)
endif
endif
+# Auto filled build flag
+ifeq ($(PLATFORM_VERSION), 5.0)
+ LOCAL_CFLAGS += -DANDROID_VERSION=5
+endif
+
LOCAL_C_INCLUDES += bionic external/stlport/stlport $(commands_recovery_local_path)/gui/devices/$(DEVICE_RESOLUTION)
include $(BUILD_STATIC_LIBRARY)
diff --git a/gui/pages.cpp b/gui/pages.cpp
index bea39e902..b110e3820 100644
--- a/gui/pages.cpp
+++ b/gui/pages.cpp
@@ -39,8 +39,13 @@
extern "C" {
#include "../twcommon.h"
#include "../minuitwrp/minui.h"
+#if (ANDROID_VERSION >= 5)
#include "../minzip/SysUtil.h"
#include "../minzip/Zip.h"
+#else
+#include "../minzipold/SysUtil.h"
+#include "../minzipold/Zip.h"
+#endif
}
#include "rapidxml.hpp"
@@ -921,7 +926,9 @@ int PageManager::LoadPackage(std::string name, std::string package, std::string
char* xmlFile = NULL;
PageSet* pageSet = NULL;
int ret;
+#if (ANDROID_VERSION >= 5)
MemMapping map;
+#endif
// Open the XML file
LOGINFO("Loading package: %s (%s)\n", name.c_str(), package.c_str());
@@ -948,6 +955,7 @@ int PageManager::LoadPackage(std::string name, std::string package, std::string
else
{
LOGINFO("Loading zip theme\n");
+#if (ANDROID_VERSION >= 5)
if (!TWFunc::Path_Exists(package))
return -1;
if (sysMapFile(package.c_str(), &map) != 0) {
@@ -959,6 +967,12 @@ int PageManager::LoadPackage(std::string name, std::string package, std::string
sysReleaseMap(&map);
return -1;
}
+#else
+ if (mzOpenZipArchive(package.c_str(), &zip)) {
+ LOGERR("Failed to open theme zip.\n");
+ return -1;
+ }
+#endif
pZip = &zip;
const ZipEntry* ui_xml = mzFindZipEntry(&zip, "ui.xml");
if (ui_xml == NULL)
@@ -1006,7 +1020,9 @@ int PageManager::LoadPackage(std::string name, std::string package, std::string
if (pZip) {
mzCloseZipArchive(pZip);
+#if (ANDROID_VERSION >= 5)
sysReleaseMap(&map);
+#endif
}
return ret;
@@ -1014,7 +1030,9 @@ error:
LOGERR("An internal error has occurred.\n");
if (pZip) {
mzCloseZipArchive(pZip);
+#if (ANDROID_VERSION >= 5)
sysReleaseMap(&map);
+#endif
}
if (xmlFile)
free(xmlFile);