* AudioAPI: simplify code * AudioAPI: remove volume info Redundunt with the introduction of VolumeAPI * AudioAPI: remove PROPERTY_SUPPORT_AUDIO_SOURCE_UNPROCESSED It does not seem to have a point for us to get this property as it is not very clear what it actually reflects. We have not been getting PROPERTY_SUPPORT_MIC_NEAR_ULTRASOUND and PROPERTY_SUPPORT_SPEAKER_NEAR_ULTRASOUND either. In fact, properties from getProperty() tend to be rather useless. PROPERTY_OUTPUT_FRAMES_PER_BUFFER and PROPERTY_OUTPUT_SAMPLE_RATE are kept only to show that, they should NOT be used to optimize any player in audio output, as they do not change as per the current sink, not like the values from the AudioTrack methods do. * AudioAPI: order output * AudioAPI: check info in PERFORMANCE_MODE_POWER_SAVING When setPerformanceMode was introduced in Android O, it was introduced with three possible modes, namely: PERFORMANCE_MODE_NONE (default) PERFORMANCE_MODE_LOW_LATENCY PERFORMANCE_MODE_POWER_SAVING While PERFORMANCE_MODE_NONE essentially causes tracks to be routed to the deep buffer mixer path on my phone (as PERFORMANCE_MODE_POWER_SAVING does), it may not be the case on every single device. Therefore, check info with track in PERFORMANCE_MODE_POWER_SAVING, compare it against that of the default PERFORMANCE_MODE_NONE, and print it out if they are not the same. Note: shouldEnablePowerSaving for PERFORMANCE_MODE_NONE always returns false for SAMPLE_RATE_UNSPECIFIED as of the current AudioTrack.java.
Termux API
This is an app exposing Android API to command line usage and scripts or programs.
When developing or packaging, note that this app needs to be signed with the same key as the main Termux app for permissions to work (only the main Termux app are allowed to call the API methods in this app).
License
Released under the GPLv3 license.
How API calls are made through the termux-api helper binary
The termux-api client binary in the termux-api
package generates two linux anonymous namespace sockets, and passes their address to the TermuxApiReceiver broadcast receiver as in:
/system/bin/am broadcast ${BROADCAST_RECEIVER} --es socket_input ${INPUT_SOCKET} --es socket_output ${OUTPUT_SOCKET}
The two sockets are used to forward stdin from termux-api
to the relevant API class and output from the API class to the stdout of termux-api
.
Client scripts
Client scripts which processes command line arguments before calling the termux-api
helper binary are available in the termux-api package.
Ideas
- Wifi network search and connect.
- Add extra permissions to the app to (un)install apps, stop processes etc.