summaryrefslogtreecommitdiffstats
path: root/gui/gui.cpp
diff options
context:
space:
mode:
authorEthan Yonker <dees_troy@teamw.in>2015-01-13 04:59:07 +0100
committerEthan Yonker <dees_troy@teamw.in>2015-01-13 05:08:35 +0100
commitcf50da57422f70059a928f34ca731f18f569eab9 (patch)
tree221f14d4c427e050fbc62e0a87416142a92d33d6 /gui/gui.cpp
parentFix some crashes during theme (re)loading (diff)
downloadandroid_bootable_recovery-cf50da57422f70059a928f34ca731f18f569eab9.tar
android_bootable_recovery-cf50da57422f70059a928f34ca731f18f569eab9.tar.gz
android_bootable_recovery-cf50da57422f70059a928f34ca731f18f569eab9.tar.bz2
android_bootable_recovery-cf50da57422f70059a928f34ca731f18f569eab9.tar.lz
android_bootable_recovery-cf50da57422f70059a928f34ca731f18f569eab9.tar.xz
android_bootable_recovery-cf50da57422f70059a928f34ca731f18f569eab9.tar.zst
android_bootable_recovery-cf50da57422f70059a928f34ca731f18f569eab9.zip
Diffstat (limited to 'gui/gui.cpp')
-rw-r--r--gui/gui.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/gui/gui.cpp b/gui/gui.cpp
index edf2d7671..61e5de1fb 100644
--- a/gui/gui.cpp
+++ b/gui/gui.cpp
@@ -805,6 +805,38 @@ error:
return -1;
}
+extern "C" int gui_loadCustomResources(void)
+{
+#ifndef TW_OEM_BUILD
+ if (!PartitionManager.Mount_Settings_Storage(false)) {
+ LOGERR("Unable to mount settings storage during GUI startup.\n");
+ return -1;
+ }
+
+ std::string theme_path = DataManager::GetSettingsStoragePath();
+ theme_path += "/TWRP/theme/ui.zip";
+ // Check for a custom theme
+ if (TWFunc::Path_Exists(theme_path)) {
+ // There is a custom theme, try to load it
+ if (PageManager::ReloadPackage("TWRP", theme_path)) {
+ // Custom theme failed to load, try to load stock theme
+ if (PageManager::ReloadPackage("TWRP", "/res/ui.xml")) {
+ LOGERR("Failed to load base packages.\n");
+ goto error;
+ }
+ }
+ }
+ // Set the default package
+ PageManager::SelectPackage("TWRP");
+#endif
+ return 0;
+
+error:
+ LOGERR("An internal error has occurred: unable to load theme.\n");
+ gGuiInitialized = 0;
+ return -1;
+}
+
extern "C" int gui_start(void)
{
if (!gGuiInitialized)