'More efficient communication channels between an Android app and a testing tool

For a specific testing purpose, I am developing an automated app testing tool. I hope my tool can read some data written by the app-under-test. Suppose we are testing on an emulator, the basic idea is:

  1. When setting to debug mode, the app writes its data to /storage/emulated/0/Android/data/<package_name>/files/data.txt every 500ms.
  2. The testing tool reads the data via adb pull /storage/emulated/0/Android/data/<package_name>/files/data.txt

The idea works but we observed when switching to debug mode, the app runs much slower than before.

Obviously, there is too much IO under debug mode, so I want to ask except dumping the data to external storage, are there any other choices I can use? For example, does Android provide a specific shared memory space for an app to communicate with external testing tools? If they can communicate directly through memory, the speed should be much faster. Unfortunately, communicating through external storage is all I can figure out.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source