summaryrefslogtreecommitdiffstats
path: root/twrp.cpp
diff options
context:
space:
mode:
authorEthan Yonker <dees_troy@teamw.in>2015-05-18 17:23:03 +0200
committerEthan Yonker <dees_troy@teamw.in>2015-05-27 16:22:49 +0200
commiteb32b1ff00878e7b01453450fcd04ecb9fcbba52 (patch)
treea25888903dd6c07d14afa46ccce41d1779b8e975 /twrp.cpp
parentOnly include uncrypt if not in system/core (diff)
downloadandroid_bootable_recovery-eb32b1ff00878e7b01453450fcd04ecb9fcbba52.tar
android_bootable_recovery-eb32b1ff00878e7b01453450fcd04ecb9fcbba52.tar.gz
android_bootable_recovery-eb32b1ff00878e7b01453450fcd04ecb9fcbba52.tar.bz2
android_bootable_recovery-eb32b1ff00878e7b01453450fcd04ecb9fcbba52.tar.lz
android_bootable_recovery-eb32b1ff00878e7b01453450fcd04ecb9fcbba52.tar.xz
android_bootable_recovery-eb32b1ff00878e7b01453450fcd04ecb9fcbba52.tar.zst
android_bootable_recovery-eb32b1ff00878e7b01453450fcd04ecb9fcbba52.zip
Diffstat (limited to 'twrp.cpp')
-rw-r--r--twrp.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/twrp.cpp b/twrp.cpp
index 0c012d7ec..b7fc9815d 100644
--- a/twrp.cpp
+++ b/twrp.cpp
@@ -332,13 +332,27 @@ int main(int argc, char **argv) {
PartitionManager.Disable_MTP();
#endif
+ // Check if system has never been changed
+ if (DataManager::GetIntValue("tw_mount_system_ro") != 0 && DataManager::GetIntValue("tw_never_show_system_ro_page") == 0) {
+ TWPartition* sys = PartitionManager.Find_Partition_By_Path("/system");
+ if (sys && sys->Check_Lifetime_Writes() == 0) {
+ LOGINFO("System writes is 0, show system_readonly page\n");
+ DataManager::SetValue("tw_back", "main");
+ if (gui_startPage("system_readonly", 1, 1) != 0) {
+ LOGERR("Failed to start system_readonly GUI page.\n");
+ }
+ } else {
+ DataManager::SetValue("tw_mount_system_ro", 0);
+ }
+ }
+
// Launch the main GUI
gui_start();
// Disable flashing of stock recovery
TWFunc::Disable_Stock_Recovery_Replace();
// Check for su to see if the device is rooted or not
- if (PartitionManager.Mount_By_Path("/system", false)) {
+ if (PartitionManager.Mount_By_Path("/system", false) && DataManager::GetIntValue("tw_mount_system_ro") == 0) {
if (TWFunc::Path_Exists("/supersu/su") && !TWFunc::Path_Exists("/system/bin/su") && !TWFunc::Path_Exists("/system/xbin/su") && !TWFunc::Path_Exists("/system/bin/.ext/.su")) {
// Device doesn't have su installed
DataManager::SetValue("tw_busy", 1);