Search code examples
androidadbgoogle-pixel

Temp folder in Pixel 2 devices


My Project runs C++ test cases on Android devices. An exectuable gets generated and along with that, couple of shared object files also gets copied over to the device and the executable is then run. Till now, all those data were being copied over to /data/local/tmp folder. After the test cases are run, the content from /data/local/tmp is deleted using adb shell command. With Pixel 2 devices, I am able to copy the exe and shared object files to the tmp folder, but unable to delete them once the test cases are completed. I tried using /data/local/temp folder, but I am unable to push files to that folder. Tried using /sdcard but it does not allow the exe files to be executed. I am clueless as to which specific directory I should be using to run my native test cases on Pixel 2 devices. Does anyone has any pointers? Please help.


Solution

  • if you create files from adb, uid:gid is set to 2000:2000 and permissions of /data/local/tmp is 0771, this means you always can remove your own files. There is no other location for this, you must have messed with permissions

    adb shell
    touch /data/local/tmp/my-file
    ls -an /data/local/tmp
    rm /data/local/tmp/my-file