summaryrefslogtreecommitdiffstats
path: root/twrp-functions.cpp
diff options
context:
space:
mode:
authorEthan Yonker <dees_troy@teamw.in>2019-05-10 17:50:04 +0200
committerDees Troy <dees_troy@teamw.in>2019-05-16 19:07:06 +0200
commit76bbd3a11a40686e9d01d0875c7e56ebf4ac8b53 (patch)
tree260722281833aa234e386b2e65e75238af5e36a7 /twrp-functions.cpp
parentFlash both A/B partitions when flashing recovery ramdisk (diff)
downloadandroid_bootable_recovery-76bbd3a11a40686e9d01d0875c7e56ebf4ac8b53.tar
android_bootable_recovery-76bbd3a11a40686e9d01d0875c7e56ebf4ac8b53.tar.gz
android_bootable_recovery-76bbd3a11a40686e9d01d0875c7e56ebf4ac8b53.tar.bz2
android_bootable_recovery-76bbd3a11a40686e9d01d0875c7e56ebf4ac8b53.tar.lz
android_bootable_recovery-76bbd3a11a40686e9d01d0875c7e56ebf4ac8b53.tar.xz
android_bootable_recovery-76bbd3a11a40686e9d01d0875c7e56ebf4ac8b53.tar.zst
android_bootable_recovery-76bbd3a11a40686e9d01d0875c7e56ebf4ac8b53.zip
Diffstat (limited to 'twrp-functions.cpp')
-rwxr-xr-xtwrp-functions.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/twrp-functions.cpp b/twrp-functions.cpp
index 5b618e2ac..9034a5013 100755
--- a/twrp-functions.cpp
+++ b/twrp-functions.cpp
@@ -1228,4 +1228,23 @@ void TWFunc::check_selinux_support() {
}
}
}
+
+bool TWFunc::Is_TWRP_App_In_System() {
+ if (PartitionManager.Mount_By_Path(PartitionManager.Get_Android_Root_Path(), false)) {
+ string base_path = PartitionManager.Get_Android_Root_Path();
+ if (TWFunc::Path_Exists(PartitionManager.Get_Android_Root_Path() + "/system"))
+ base_path += "/system"; // For devices with system as a root file system (e.g. Pixel)
+ string install_path = base_path + "/priv-app";
+ if (!TWFunc::Path_Exists(install_path))
+ install_path = base_path + "/app";
+ install_path += "/twrpapp";
+ if (TWFunc::Path_Exists(install_path)) {
+ LOGINFO("App found at '%s'\n", install_path.c_str());
+ DataManager::SetValue("tw_app_installed_in_system", 1);
+ return true;
+ }
+ }
+ DataManager::SetValue("tw_app_installed_in_system", 0);
+ return false;
+}
#endif // ndef BUILD_TWRPTAR_MAIN