summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDees_Troy <dees_troy@teamw.in>2012-09-19 22:18:00 +0200
committerDees_Troy <dees_troy@teamw.in>2012-09-19 22:18:21 +0200
commite2920fa237cb0b69b82838e4c453ac7af48f7e48 (patch)
tree7993640d3d6fb4eca75c197963651813d3a0b9e3
parentImprove adb sideload - use storage vs tmp (diff)
downloadandroid_bootable_recovery-e2920fa237cb0b69b82838e4c453ac7af48f7e48.tar
android_bootable_recovery-e2920fa237cb0b69b82838e4c453ac7af48f7e48.tar.gz
android_bootable_recovery-e2920fa237cb0b69b82838e4c453ac7af48f7e48.tar.bz2
android_bootable_recovery-e2920fa237cb0b69b82838e4c453ac7af48f7e48.tar.lz
android_bootable_recovery-e2920fa237cb0b69b82838e4c453ac7af48f7e48.tar.xz
android_bootable_recovery-e2920fa237cb0b69b82838e4c453ac7af48f7e48.tar.zst
android_bootable_recovery-e2920fa237cb0b69b82838e4c453ac7af48f7e48.zip
-rw-r--r--data.cpp6
-rw-r--r--gui/Android.mk3
-rw-r--r--gui/action.cpp26
3 files changed, 34 insertions, 1 deletions
diff --git a/data.cpp b/data.cpp
index 505a3a1d8..21293641c 100644
--- a/data.cpp
+++ b/data.cpp
@@ -840,11 +840,15 @@ void DataManager::ReadSettingsFile(void)
GetValue(TW_HAS_EXTERNAL, has_ext);
if (has_dual != 0 && use_ext == 1) {
// Attempt to sdcard using external storage
- if (PartitionManager.Mount_Current_Storage(false)) {
+ if (!PartitionManager.Mount_Current_Storage(false)) {
LOGE("Failed to mount external storage, using internal storage.\n");
// Remount failed, default back to internal storage
SetValue(TW_USE_EXTERNAL_STORAGE, 0);
PartitionManager.Mount_Current_Storage(true);
+ string int_zip_path;
+ GetValue(TW_ZIP_INTERNAL_VAR, int_zip_path);
+ SetValue(TW_USE_EXTERNAL_STORAGE, 0);
+ SetValue(TW_ZIP_LOCATION_VAR, int_zip_path);
}
} else {
PartitionManager.Mount_Current_Storage(true);
diff --git a/gui/Android.mk b/gui/Android.mk
index a19a63ec2..86d7453b8 100644
--- a/gui/Android.mk
+++ b/gui/Android.mk
@@ -43,6 +43,9 @@ endif
ifneq ($(RECOVERY_SDCARD_ON_DATA),)
LOCAL_CFLAGS += -DRECOVERY_SDCARD_ON_DATA
endif
+ifneq ($(TW_EXTERNAL_STORAGE_PATH),)
+ LOCAL_CFLAGS += -DTW_EXTERNAL_STORAGE_PATH=$(TW_EXTERNAL_STORAGE_PATH)
+endif
LOCAL_C_INCLUDES += bionic external/stlport/stlport $(commands_recovery_local_path)/gui/devices/$(DEVICE_RESOLUTION)
diff --git a/gui/action.cpp b/gui/action.cpp
index 15180ca06..bbcca23f5 100644
--- a/gui/action.cpp
+++ b/gui/action.cpp
@@ -540,11 +540,37 @@ int GUIAction::doAction(Action action, int isThreaded /* = 0 */)
}
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