Skip to content

Commit

Permalink
express_use_data: reload after decryption successful
Browse files Browse the repository at this point in the history
  • Loading branch information
epicX67 committed Nov 26, 2021
1 parent d7fc8d3 commit 194a036
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 20 deletions.
2 changes: 1 addition & 1 deletion SHRPINIT.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ class SHRP{
public:
static void INIT();
static bool isOfficial(string target);
static void handleLock();
private:
static void printRecDetails();
static void genarateDate();
static void handleLock();
};
15 changes: 15 additions & 0 deletions gui/action.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ extern "C" {
#include "objects.hpp"
#include "tw_atomic.hpp"
#include "../SHRPMAIN.hpp"
#include "../SHRPINIT.hpp"
#include "../SHRPTOOLS.hpp"
#include "../SHRPTHEME.hpp"
#include "../SHRPFILETOOLS.hpp"
Expand Down Expand Up @@ -1648,6 +1649,20 @@ int GUIAction::decrypt(std::string arg __unused)
}
}
PartitionManager.Decrypt_Adopted();
#ifdef SHRP_EXPRESS_USE_DATA
/*
Trying to fetch theme and other datas.
This is essential because if data is decrpyted then
first init will not able to find shrp path.
*/
Express::updateSHRPBasePath();

#ifdef SHRP_EXPRESS
Express::init();
SHRP::handleLock();
reload("dummy");
#endif
#endif
}
}

Expand Down
24 changes: 5 additions & 19 deletions twrp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,21 +76,6 @@ static void Print_Prop(const char *key, const char *name, void *cookie) {
printf("%s=%s\n", key, name);
}

static void Reload_Gui() {
#ifdef SHRP_EXPRESS_USE_DATA
/*
Trying to fetch theme and other datas.
This is essential because if data is decrpyted then
first init will not able to find shrp path.
*/
Express::updateSHRPBasePath();
#ifdef SHRP_EXPRESS
Express::init();
#endif
#endif
gui_loadCustomResources();
}

static void Decrypt_Page(bool SkipDecryption, bool datamedia) {
// Offer to decrypt if the device is encrypted
if (DataManager::GetIntValue(TW_IS_ENCRYPTED) != 0) {
Expand All @@ -103,14 +88,15 @@ static void Decrypt_Page(bool SkipDecryption, bool datamedia) {
DataManager::SetValue("tw_crypto_user_id", "0");
if (gui_startPage("decrypt", 1, 1) != 0) {
LOGERR("Failed to start decrypt GUI page.\n");
// Reloading Gui
Reload_Gui();
} else {
// Check for and load custom theme if present
TWFunc::check_selinux_support();
gui_loadCustomResources();
}
}
} else if (datamedia) {
PartitionManager.Update_System_Details();
// Reloading Gui
Reload_Gui();
TWFunc::check_selinux_support();
if (tw_get_default_metadata(DataManager::GetSettingsStoragePath().c_str()) != 0) {
LOGINFO("Failed to get default contexts and file mode for storage files.\n");
} else {
Expand Down

0 comments on commit 194a036

Please sign in to comment.