[Android Software Development] DeckerSU:
Hi again to all, need an advice. Seems i have discovered another bug (?) in latest TWRP (i was builded it from latest omnirom sources, branch - android 7.0). For example i have a recovery.img image at /sdcard (recovery.img is a dd dump of partition). In older versions (builded from older sources) i was able to flash it using the following steps:

Install (menu) -> Install image (button) -> select recovery.img, choose Recovery partition from list and swipe to confirm flash. But now i have a lot of errors after swipe, here is it:

I:operation_start: 'Flash Image'
[IMAGE FLASH STARTED]
Image to flash: '/sdcard/recovery-3.0.2-0-decker.img'
Calculating restore details...
I:Image filename is: recovery.emmc.win
Error opening: '/sdcard/recovery-3.0.2-0-decker.img/recovery.emmc.win' (Not a directory)
Error opening: '/sdcard/recovery-3.0.2-0-decker.img/recovery.emmc.win' (Not a directory)
I:Set page: 'action_complete'
I:operation_end - status=1

It seems TWRP tries to open recovery-3.0.2-0-decker.img (dd image) as directory, but actually this is dd image (!). Any advices, thoughts, assumptions?

p.s. Of course recovery partition have a backup method = dd:

/recovery | /dev/block/mmcblk0p24 | Size: 32MB
Flags: Can_Be_Backed_Up IsPresent Can_Flash_Img
Primary_Block_Device: /dev/block/mmcblk0p24
Display_Name: Recovery
Storage_Name: Recovery
Backup_Path: /recovery
Backup_Name: recovery
Backup_Display_Name: Recovery
Storage_Path: /recovery
Current_File_System: emmc
Fstab_File_System: emmc
Backup_Method: dd

I think problem is somewhere between partitionmanager.cpp --> partition.cpp. In partitionmanager.cpp when we call TWPartitionManager::Flash_Image we have full_filename = /sdcard/recovery-3.0.2-0-decker.img , but in the partition.cpp in TWPartition::Flash_Image which called from TWPartitionManager::Flash_Image we have another value in full_filename = recovery.emmc.win.

Could anyone try to reproduce with bug on the TWRP builded from latest sources?

p.p.s. Also i see next changes between 6.0 and 7.0 branch, in 6.0:

partitionmanager.cpp

bool TWPartitionManager::Flash_Image(PartitionSettings *part_settings) {
int check, partition_count = 0;
TWPartition* flash_part = NULL;
string Flash_List, flash_path, full_filename;
size_t start_pos = 0, end_pos = 0;
full_filename = part_settings->Restore_Name + "/" + part_settings->Backup_FileName;

partition.cpp

bool TWPartition::Flash_Image(PartitionSettings *part_settings) {
string Restore_File_System, full_filename;
full_filename = part_settings->Restore_Name + "/" + part_settings->Backup_FileName;
LOGINFO("Image filename is: %s\n", part_settings->Backup_FileName.c_str());

I think in this full_filename is identical in both Flash_Image methods ... But in 7.0 branch i see different code:

partitionmanager.cpp

bool TWPartitionManager::Flash_Image(PartitionSettings *part_settings) {
int check, partition_count = 0;
TWPartition* flash_part = NULL;
string Flash_List, flash_path, full_filename;
size_t start_pos = 0, end_pos = 0;
full_filename = part_settings->Backup_Folder;
gui_msg("image_flash_start=[IMAGE FLASH STARTED]");
gui_msg(Msg("img_to_flash=Image to flash: '{1}'")(full_filename));

partition.cpp

if (part_settings->Part != NULL)
full_filename = part_settings->Backup_Folder + "/" + Backup_FileName;
else
full_filename = part_settings->Backup_Folder; // Flash image action from GUI
LOGINFO("Image filename is: %s\n", Backup_FileName.c_str());

I think all was broken with the latest commit on 7.0 branch :(