summaryrefslogtreecommitdiffstats
path: root/gui/action.cpp
diff options
context:
space:
mode:
authorEthan Yonker <dees_troy@teamw.in>2014-02-16 22:15:34 +0100
committerEthan Yonker <dees_troy@teamw.in>2014-02-16 22:15:34 +0100
commit8214f0ae648d5b3571764f026905f6b396e59384 (patch)
treed83dab4ef6e6860c908d05f6b2a86f196a8f34e0 /gui/action.cpp
parentMerge "Improve ORS scanning of storage locations" into android-4.4 (diff)
downloadandroid_bootable_recovery-8214f0ae648d5b3571764f026905f6b396e59384.tar
android_bootable_recovery-8214f0ae648d5b3571764f026905f6b396e59384.tar.gz
android_bootable_recovery-8214f0ae648d5b3571764f026905f6b396e59384.tar.bz2
android_bootable_recovery-8214f0ae648d5b3571764f026905f6b396e59384.tar.lz
android_bootable_recovery-8214f0ae648d5b3571764f026905f6b396e59384.tar.xz
android_bootable_recovery-8214f0ae648d5b3571764f026905f6b396e59384.tar.zst
android_bootable_recovery-8214f0ae648d5b3571764f026905f6b396e59384.zip
Diffstat (limited to 'gui/action.cpp')
-rw-r--r--gui/action.cpp87
1 files changed, 8 insertions, 79 deletions
diff --git a/gui/action.cpp b/gui/action.cpp
index 66ee5d6f0..344ced3b6 100644
--- a/gui/action.cpp
+++ b/gui/action.cpp
@@ -443,49 +443,29 @@ int GUIAction::doAction(Action action, int isThreaded /* = 0 */)
return 0;
}
- if (function == "mount")
- {
- if (arg == "usb")
- {
+ if (function == "mount") {
+ if (arg == "usb") {
DataManager::SetValue(TW_ACTION_BUSY, 1);
if (!simulate)
PartitionManager.usb_storage_enable();
else
gui_print("Simulating actions...\n");
- }
- else if (!simulate)
- {
- string cmd;
- if (arg == "EXTERNAL")
- PartitionManager.Mount_By_Path(DataManager::GetStrValue(TW_EXTERNAL_MOUNT), true);
- else if (arg == "INTERNAL")
- PartitionManager.Mount_By_Path(DataManager::GetStrValue(TW_INTERNAL_MOUNT), true);
- else
- PartitionManager.Mount_By_Path(arg, true);
+ } else if (!simulate) {
+ PartitionManager.Mount_By_Path(arg, true);
} else
gui_print("Simulating actions...\n");
return 0;
}
- if (function == "umount" || function == "unmount")
- {
- if (arg == "usb")
- {
+ if (function == "umount" || function == "unmount") {
+ if (arg == "usb") {
if (!simulate)
PartitionManager.usb_storage_disable();
else
gui_print("Simulating actions...\n");
DataManager::SetValue(TW_ACTION_BUSY, 0);
- }
- else if (!simulate)
- {
- string cmd;
- if (arg == "EXTERNAL")
- PartitionManager.UnMount_By_Path(DataManager::GetStrValue(TW_EXTERNAL_MOUNT), true);
- else if (arg == "INTERNAL")
- PartitionManager.UnMount_By_Path(DataManager::GetStrValue(TW_INTERNAL_MOUNT), true);
- else
- PartitionManager.UnMount_By_Path(arg, true);
+ } else if (!simulate) {
+ PartitionManager.UnMount_By_Path(arg, true);
} else
gui_print("Simulating actions...\n");
return 0;
@@ -605,57 +585,6 @@ int GUIAction::doAction(Action action, int isThreaded /* = 0 */)
if (function == "togglestorage") {
LOGERR("togglestorage action was deprecated from TWRP\n");
- if (arg == "internal") {
- DataManager::SetValue(TW_USE_EXTERNAL_STORAGE, 0);
- } else if (arg == "external") {
- DataManager::SetValue(TW_USE_EXTERNAL_STORAGE, 1);
- }
- if (PartitionManager.Mount_Current_Storage(true)) {
- if (arg == "internal") {
- string zip_path, zip_root;
- DataManager::GetValue(TW_ZIP_INTERNAL_VAR, zip_path);
- zip_root = TWFunc::Get_Root_Path(zip_path);
-#ifdef RECOVERY_SDCARD_ON_DATA
- #ifndef TW_EXTERNAL_STORAGE_PATH
- if (zip_root != "/sdcard")
- DataManager::SetValue(TW_ZIP_INTERNAL_VAR, "/sdcard");
- #else
- if (strcmp(EXPAND(TW_EXTERNAL_STORAGE_PATH), "/sdcard") == 0) {
- if (zip_root != "/emmc")
- DataManager::SetValue(TW_ZIP_INTERNAL_VAR, "/emmc");
- } else {
- if (zip_root != "/sdcard")
- DataManager::SetValue(TW_ZIP_INTERNAL_VAR, "/sdcard");
- }
- #endif
-#else
- if (zip_root != DataManager::GetCurrentStoragePath())
- DataManager::SetValue(TW_ZIP_LOCATION_VAR, DataManager::GetCurrentStoragePath());
-#endif
- // Save the current zip location to the external variable
- DataManager::SetValue(TW_ZIP_EXTERNAL_VAR, DataManager::GetStrValue(TW_ZIP_LOCATION_VAR));
- // Change the current zip location to the internal variable
- DataManager::SetValue(TW_ZIP_LOCATION_VAR, DataManager::GetStrValue(TW_ZIP_INTERNAL_VAR));
- } else if (arg == "external") {
- string zip_path, zip_root;
- DataManager::GetValue(TW_ZIP_EXTERNAL_VAR, zip_path);
- zip_root = TWFunc::Get_Root_Path(zip_path);
- if (zip_root != DataManager::GetCurrentStoragePath()) {
- DataManager::SetValue(TW_ZIP_EXTERNAL_VAR, DataManager::GetCurrentStoragePath());
- }
- // Save the current zip location to the internal variable
- DataManager::SetValue(TW_ZIP_INTERNAL_VAR, DataManager::GetStrValue(TW_ZIP_LOCATION_VAR));
- // Change the current zip location to the external variable
- DataManager::SetValue(TW_ZIP_LOCATION_VAR, DataManager::GetStrValue(TW_ZIP_EXTERNAL_VAR));
- }
- } else {
- // We weren't able to toggle for some reason, restore original setting
- if (arg == "internal") {
- DataManager::SetValue(TW_USE_EXTERNAL_STORAGE, 1);
- } else if (arg == "external") {
- DataManager::SetValue(TW_USE_EXTERNAL_STORAGE, 0);
- }
- }
return 0;
}