Del File command on Script to Android 14 is not able to erase file

When an Android device upgrades itself to a version it may erase special access rights to MobiControl Agent, such as ACCESS ANY File.
 
Prior to massive deployment, we have tested wich devices have upgrade and lost permissions.
 
In order to test if permissions are grant or not in Android devices we have a package that includes an apk, 2 txt file and a post install script.
 
 
The apk requests EXTERNAL_ACESS_MANAGEMENT and we do nothing with it. The only reason of its presence is to identify if MC Agent is able to install and grant such permission. After the confirmation it is installed, the post install script uninstall it. If installation has failed, the script stops on this point and the log on scripts helps to identify it.
 
The 2 txt files is to verify if we are able to copy/replace one by another, working as a flag if the MC Agent has rights to delete or overwrite files content. One file has 9 bytes and other 4 bytes. We know it has worked  if both stay with 9 bytes.
 
By the list of installation failed we are able to start a remote session to grant the proper rights.
 
This was so, up to Android 14.
 
Android 14 denies the delete, copy/replace action and we could not identify which permission is missing for it.
The Log from script writes the file has been deleted and the other one copied, but the scripts hangs as failed, even after writes the log of installation success at the end.
 
By the way, the file sync rules are able to replace the content of the files, but legacy script copy command may not.
 
 
Below you see the package and its post install script.
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; Post-Install Script File
; Date Created: quarta-feira, 17 de abril de 2024
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
log -i "ANDROID ANDROID ScanMobAUth2 installed"
;Remove File testeScan2.txt
;It fails here, because the original file is still there 
del /sdcard/Download/testeScan2.txt
log -i "Succes on erase testeScan2.txt "
;It is weird that the log above is registered, even after del command been failed
copy /sdcard/Download/versao123.txt /sdcard/Download/testeScan2.txt
;It does not copy and is expected to happen so, when the target already exists with same name and different content
log -i "Succes on copy file  testeScan2.txt by versao123"
;As before, the log above should not be executed, but is
;uninstall the package
uninstall br.com.nobredelatorre.scanmobauth2
log -i "Finishing ANDROID ScanMobAUth "
;it even writes the Finishing log above
finishpkg
 
Here comes the package content
 
[Fileoptions]
Encrypt=1
Compress=1
Format=1
[Info]
Name=ScanMob
VersionStr=23.0
CommentStr=
Wrap=85
Build=0
BuildDir=C:\Users\Aline\Documents\MobiControl Packages\ScanMob\checked\
WrapDir=C:\Users\Aline\Documents\MobiControl Packages\ScanMob\built\
File=ScanMob.pcg
TotalFileSize=1610632
ExtraSize=0
TotalPackageSize=1314126
Processor=ALL
Platform=Android
ProcessorType=1
PlatformType=7
Osver=2.0-22.0
VendorName=
Type=0
Prompt=0
PromptMsg=Install package 'ScanMob' now?
PromptTimeout=10
[Files]
File1Src=C:\Users\Aline\Downloads\app-release-21.apk
File1Path=Internal Storage\app-release-21.apk
File1Flags=128
File1Type=17
File1Params=
File1Uninst=
File2Src=scripts\posti.cmd
File2Path=|\posti.cmd
File2Flags=256
File2Type=12
File2Params=
File2Uninst=
File3Src=C:\Users\Aline\Desktop\testeScan2.txt
File3Path=%sdcard%\Donwload\testeScan2.txt
File3Flags=1
File3Type=0
File3Params=
File3Uninst=
File4Src=C:\Users\Aline\Desktop\versao123.txt
File4Path=%sdcard%\Donwload\versao123.txt
File4Flags=1
File4Type=0
File4Params=
File4Uninst=
a year ago
Android Scripting
ANSWERS
RC
Raymond Chan Diamond Contributor
a year ago

What are the version and build numbers of your MobiControl server and device agent?

Have you done any test(s) to confirm the absolute path of the Download directory on your Android 14 device?  Is there a possibility that directory has been mounted to a different location on your test device?

If you're not sure, maybe you can verify by using MobiControl standard directory macro in your test script, i.e.

  copy %sdcard%/Download/versao123.txt %sdcard%/Download/testeScan2.txt

J
JJMOD@SOTI
a year ago

Hi Joao Nelson,

Thanks for posting on SOTI Pulse, Thanks Raymond for responding to the post, your expertise and willingness to help are greatly appreciated!

Have you had an opportunity to test the suggested solution by Raymond, and has it successfully addressed your query?

If not, or If you have any additional questions or concerns, please don't hesitate to reach out. We're dedicated to providing assistance and support.

Kind regards,

Technical Support | SOTI Inc. |1.905.624.9828 | support@soti.net | www.soti.net |

B
BPMOD@SOTI
a year ago

Hello Joao Nelson,

Thanks for posting in SOTI Pulse.

Could you please confirm if you had an opportunity to test the suggested solutions by Raymond, Matt, and Radim and if it has successfully addressed your query?

If the above solution helps you to resolve your issue, then please mark this post as the solution. Also, feel free to reach out if you need clarification or have any follow-up questions.

Kind Regards