ADB Command to set volume?

前端 未结 4 624
暗喜
暗喜 2020-12-19 23:06

Is there any Adb command to set the volume to a particular value? I know that we can do

adb shell input keyevent 

for volume up and down b

4条回答
  •  猫巷女王i
    2020-12-19 23:19

    I have used the service call audio test to set the volume on an android 2.3 device. In order to be more generic you need to research IBinder and the transaction number.

    To find out what you want:

    Adb shell service list packages

    • this will tell you the package file you need to look at for a service (I.e Bluetooth - com.Bluetooth.IBluetooth)

    Search for the service class and 'transaction' online ("com.Bluetooth.Ibluetooth transaction")

    Find the source files and find the Ibinder transaction details. This will be followed by the details of the input parameters.

    I.e the first transaction on Bluetooth is .is enabled(). There are no input parameters

    To use it send:

    Adb shell service call Bluetooth 1

    It should return a parcel containing the answer.

    Remember: - I think it is only for rooted devices - the transaction number you find has an offset of 1 (transaction 0 is called with service call 'service' 1) - There are two types of input: i32 for integer or s16 for string

    To set the audio there are three input integers for set volume (transaction 6)

    To use it send:

    Adb shell service call 7 i32 3 i32 15 i32 0 This will set the media volume to 15 (default number of levels for media audio is 15)

提交回复
热议问题