how to get media player state using adb command - android

Can you please let me know if there are any adb commands to get the state of MediaPlayer like, Play/Pause etc.
This is what i tried like below.
c:\>adb shell dumpsys media.player
Client
pid(3764), connId(94), status(0), looping(false)
AwesomePlayer
fd(40), flags(0x00000010), bitrate(48000 bps)
Track 1
MIME(audio/mpeg), decoder(OMX.google.mp3.decoder)
AudioOutput
stream type(3), left - right volume(1.000000, 1.000000)
msec per frame(0.000000), latency (-1)
aux effect id(0), send level (0.000000)
Client
pid(3764), connId(93), status(0), looping(false)
AwesomePlayer
fd(35), flags(0x00084014), bitrate(48000 bps)
Track 1
MIME(audio/mpeg), decoder(OMX.google.mp3.decoder)
AudioOutput
stream type(3), left - right volume(1.000000, 1.000000)
msec per frame(0.022676), latency (261)
aux effect id(0), send level (0.000000)
AudioTrack::dump
stream type(3), left - right volume(1.000000, 1.000000)
format(1), channel count(2), frame count(7680)
sample rate(44100), status(0)
state(2), latency (261)
No media recorder client
Files opened and/or mapped:
/proc/749/fd/35 -> /storage/sdcard1/Music/xxx/aaaa.mp3
/proc/749/fd/40 -> /storage/sdcard1/Music/xxx/bbbb.mp3

If you are just looking if Audio is Paused or Played.
You can try using
$ adb shell dumpsys audio
Remote Control stack entries (last is top of stack):
/*....
* Some Output Here...
*/
pi: PendingIntent{42feb5a8: PendingIntentRecord{42b6b748 com.google.android.music broadcastIntent}} -- pack: com.google.android.music -- ercvr: ComponentInfo{com.google.android.music/com.google.android.music.playback.MediaButtonIntentReceiver} -- client: android.media.IRemoteControlClient$Stub$Proxy#42e544d8 -- uid: 10059 -- type: 0 state: PLAYSTATE_PAUSED, 208457ms, 1.0X
Remote Control Client stack entries (last is top of stack):
uid: -1 -- id: 1 -- type: 0 -- state: PLAYSTATE_STOPPED, PLAYBACK_POSITION_INVALID, 1.0X -- vol handling: 1 -- vol: 15 -- volMax: 15 -- volObs: null
uid: -1 -- id: 8 -- type: 0 -- state: PLAYSTATE_STOPPED, PLAYBACK_POSITION_INVALID, 1.0X -- vol handling: 1 -- vol: 15 -- volMax: 15 -- volObs: null
uid: 10059 -- id: 9 -- type: 0 -- state: PLAYSTATE_PAUSED, 208457ms, 1.0X -- vol handling: 1 -- vol: 15 -- volMax: 15 -- volObs: null
In both, it shows if state is PLAYSTATE_PAUSED, PLAYSTATE_PLAYING or PLAYSTATE_STOPPED.
I even tried it on different device,
$ adb shell dumpsys audio
Remote Control stack entries:
pi: PendingIntent{41b84660: PendingIntentRecord{42239310 com.sonyericsson.music broadcastIntent}} -- ercvr: ComponentInfo{com.sonyericsson.music/com.sonyericsson.music.proxyservice.MediaButtonReceiver} -- client: android.media.IRemoteControlClient$Stub$Proxy#428b5528 -- uid: 10049 -- type: 0 state: 2
Remote Control Client stack entries:
uid: -1 -- id: 1 -- type: 0 -- state: 1 -- vol handling: 1 -- vol: 15 -- volMax: 15 -- volObs: null
uid: -1 -- id: 2 -- type: 0 -- state: 1 -- vol handling: 1 -- vol: 15 -- volMax: 15 -- volObs: null
uid: 10049 -- id: 5 -- type: 0 -- state: 2 -- vol handling: 1 -- vol: 15 -- volMax: 15 -- volObs: null
Here it shows the state:1 or state:2,
It basically the value for that.
PLAYSTATE_PLAYING
PLAYSTATE_PAUSED
PLAYSTATE_STOPPED
You could parse the output of the above to get these values.
Hopefully this is what you looking for.

Another way to tell will be from the state present in the AudioTrack::dump.
For instance, in your case:
AudioTrack::dump
stream type(3), left - right volume(1.000000, 1.000000)
format(1), channel count(2), frame count(7680)
sample rate(44100), status(0)
state(2), latency (261)
state(2) tells us that the media is paused/stopped. state(0) would mean that the media is playing and state(1) would mean that the playing media was interrupted by some pop-up.

Related

Top command Android 8

I am trying to read (and understand) the CPU usage provided by the top command in my Samsung Galaxy S7.
From another post here I can see the explanation of the top command with the output that this person is getting.
However, when I go inside my Samsung using adb shell and I cal the top command, what I get is different from what the other used posted.
Am I doing something different/wrong?
If not, how do I read this output from top??
The output from the user on the other post has this:
User 5%, system 15%, IOW 0%, IRQ 0%
User 5 + Nice 0 + Sys 14 + Idle 73 + IOW 0 + IRQ 0 + SIRQ 0 = 92
PID CPU% S #THR VSS RSS UID Name
213 11% R 1 900K 340K app_16 top
However, the output from my top gives me something like that:
Tasks: 371 total, 7 running, 359 sleeping, 0 stopped, 0 zombie
Mem: 3618604k total, 3545056k used, 73548k free, 118980k buffers
Swap: 2097148k total, 894520k used, 1202628k free, 1441660k cached
800%cpu 9%user 0%nice 11%sys 780%idle 0%iow 0%irq 0%sirq 0%host
Basically, I cannot see the row
User 5%, system 15%, IOW 0%, IRQ 0%
which seems to be the key to understand the CPU usage.
Not really sure why, but "top" command is not longer accepting params on Android 8

Screen light up slowly due to low priority of systemserver

When I installed 30 more apps on my android devices, the screen light up time expires 3s.
Using adb shell ps -t -p to checkout the priority of threads:
USER PID PPID VSIZE RSS PRIO NICE RTPRI SCHED WCHAN
PC NAME system 553 1 6964 856 20 0 0 0
poll_sched 00000000 S /system/bin/imsdatadaemon
system 893 380 1229888 92080 18 -2 0 0 SyS_epoll_ 00000000 S system_server
u0_a94 8515 380 1199228 38548 12 -8 0 0 SyS_epoll_ 00000000 S com.baidu.netdisk
u0_a97 10901 380 848872 98740 12 -8 0 0 SyS_epoll_ 00000000 Scom.hiapk.marketpho
Nice value(priority) of many apps are higher than system_server, which prepares the showing interface when light up screen. I think this result in system_server taking more time to light up screen. In logcat:
01-04 08:02:01.733 893 1276 I DisplayPowerController: Unblocked screen on after 2740 ms
To solve the problem, I want to improve the priority of system_server(original it is THREAD_PRIORITY_FOREGROUND), will any things goes wrong in this way?
public final class SystemServer {
private void run() {
......
// Ensure binder calls into the system always run at foreground priority.
BinderInternal.disableBackgroundScheduling(true);
// Prepare the main looper thread (this thread).
android.os.Process.setThreadPriority(
android.os.Process.THREAD_PRIORITY_URGENT_DISPLAY);
android.os.Process.setCanSelfBackground(false);
Looper.prepareMainLooper();
// Initialize native services.
System.loadLibrary("android_servers");
....
}
}

android device Battery health showing overheat even though battery is in normal temperature

DUMP OF SERVICE batterystats:
Battery History (0% used, 1584 used of 256KB, 6 strings using 492):
0 (9) RESET:TIME: 2016-03-07-15-59-54
0 (2) 092 c2501424 status=not-charging health=overheat plug=none temp=373 volt=4030 +running +wake_lock +mobile_radio +audio +screen data_conn=hspa phone_signal_strength=great brightness=bright fg=1000:"com.catalina.logdump"
0 (2) 092 c2501424 top=u0a68:"com.honeywell.testtools.suspendresumetest"
0 (2) 092 c2501424 user=0:"0"
0 (2) 092 c2501424 userfg=0:"0"
+69ms (2) 092 c2501424 status=discharging
AS the battery temp=373, it is showing health=overheat, That should not happen at all. Because of this health=overheat device notification LED will blink in RED.
Can anybody give me solution please.
I got the error in the kernel as
1) <3>[18810.893554, 1] bq27000-battery bq27000-battery: error reading register 18: -1
2)<3>[19205.674407, 0] bq27000-battery bq27000-battery: error reading nominal available capacity
3) BatteryService: Battery Led Mode is null
Along with this I am attaching bugreport file.

Android lsmod output

I'm having a hard time trying to figure out the lsmod output from Android 4.0.3. What all those "Live ADDR" entries mean?
option 14926 0 - Live 0xbf12b000
usb_wwan 9419 1 option, Live 0xbf124000
cdc_acm 15150 0 - Live 0xbf11b000
g_crypto 11918 0 - Live 0xbf0cc000
g_wmt_cmoscam 1421 0 - Live 0xbf0c8000
g_wmt_v4l2_cmos 68606 1 g_wmt_cmoscam, Live 0xbf0b1000
g_wmt_v4l2 5135 1 g_wmt_v4l2_cmos, Live 0xbf0ab000
g_wmt_ve_h264 11644 0 - Live 0xbf0a5000
g_wmt_ve_com 9021 1 g_wmt_ve_h264, Live 0xbf09e000
g_wmt_vd_vpx 65936 0 - Live 0xbf088000
g_wmt_vd_rv 735 0 - Live 0xbf084000
g_wmt_vd_vc1 713 0 - Live 0xbf080000
g_wmt_vd_h264 715 0 - Live 0xbf07c000
g_wmt_vd_h263 715 0 - Live 0xbf078000
g_wmt_vd_divx 715 0 - Live 0xbf074000
g_wmt_vd_mpeg4 717 0 - Live 0xbf070000
g_wmt_vd_mpeg2 717 0 - Live 0xbf06c000
g_wmt_vd_jdec 18829 0 - Live 0xbf063000
g_wmt_lock 2881 5 - Live 0xbf05f000
g_wmt_vd_com 158558 12 g_wmt_vd_vpx,g_wmt_vd_rv,g_wmt_vd_vc1,g_wmt_vd_h264,g_wmt_vd_h263,g_wmt_vd_divx,g_wmt_vd_mpeg4,g_wmt_vd_mpeg2,g_wmt_vd_jdec, Live 0xbf032000
mali 102375 6 - Live 0xbf00d000
ump 27968 11 mali, Live 0xbf000000
I'm asking this because I use the exact same kernel to boot Ubuntu, and this is the output for lsmod on Ubuntu
option 14926 0
g_wmt_lock 2881 0
g_wmt_vd_jdec 18829 0
g_wmt_vd_mpeg2 717 0
g_wmt_vd_mpeg4 717 0
g_wmt_vd_divx 715 0
g_wmt_vd_h263 715 0
g_wmt_vd_h264 715 0
g_wmt_vd_vc1 713 0
g_wmt_vd_rv 735 0
g_wmt_vd_vpx 65936 0
g_wmt_ve_h264 11644 0
g_wmt_ve_com 9021 1 g_wmt_ve_h264
g_wmt_cmoscam 1421 0
g_wmt_v4l2_cmos 68606 1 g_wmt_cmoscam
g_wmt_v4l2 5135 1 g_wmt_v4l2_cmos
g_wmt_vd_com 158558 9 g_wmt_vd_jdec,g_wmt_vd_mpeg2,g_wmt_vd_mpeg4,g_wmt_vd_divx,g_wmt_vd_h263,g_wmt_vd_h264,g_wmt_vd_vc1,g_wmt_vd_rv,g_wmt_vd_vpx
g_crypto 11918 0
mali 102375 0
ump 27968 1 mali
cdc_acm 15150 0
usb_wwan 9419 1 option
rt3070sta_rtl8188 442205 0
HDMI, Camera, etc. are not working on Ubuntu, although the same modules are loaded on both OS's. That's why I asked about the Live and ADDR columns. I'd like to know if this has anything to do with the lack of functionality on Ubuntu.
lsmod just reads from the file /proc/modules (it actually calls cat /proc/modules)
This is the same for many UNIX like OSes:
The first column contains the name of the module.
The second column refers to the memory size of the module, in bytes.
The third column lists how many instances of the module are currently loaded. A value of zero represents an unloaded module.
The fourth column states if the module depends upon another module to be present in order to function, and lists those other modules.
The fifth column lists what load state the module is in: Live, Loading, or Unloading are the only possible values.
The sixth column lists the current kernel memory offset for the loaded module. This information can be useful for debugging purposes, or for profiling tools such as oprofile.
Source

Touchscreen not working in android on beagleboard xM

I have a custom Android (2.3) running on a Beagleboard xM. Currently we are trying to replace a small resistive touchscreen with a bigger, capacitive one. However we can't seem to get the touch working with our android. (The resistive always worked fine).
The kernel modules are loaded and the driver is running. The driver outputs the correct touch coordinates when the screen is pressed.
/proc/bus/input/devices contains these entries:
I: Bus=0003 Vendor=0eef Product=7458 Version=0210
N: Name="eGalax Inc. eGalaxTouch EXC7200-7458"
P: Phys=usb-ehci-omap.0-2.3/input0
S: Sysfs=/devices/platform/ehci-omap.0/usb1/1-2/1-2.3/1-2.3:1.0/input/input2
U: Uniq=
H: Handlers=
B: EV=1b
B: KEY=421 0 30001 0 0 0 0 0 0 0 0
B: ABS=100 3f
B: MSC=10
I: Bus=0006 Vendor=0eef Product=0020 Version=0001
N: Name="eGalaxTouch Virtual Device for Multi"
P: Phys=
S: Sysfs=/devices/virtual/input/input5
U: Uniq=
H: Handlers=event2
B: EV=b
B: KEY=400 0 0 0 0 0 0 0 0 0 0
B: ABS=6608000 1000003
I: Bus=0006 Vendor=0eef Product=0010 Version=0001
N: Name="eGalaxTouch Virtual Device for Single"
P: Phys=
S: Sysfs=/devices/virtual/input/input6
U: Uniq=
H: Handlers=event3
B: EV=b
B: KEY=30000 0 0 0 0 0 0 0 0
B: ABS=3
which are correct, according to the guide for the device.
When touching the screen android shows this in logcat:
V/EventHub(10978): /dev/input/event2 got: t0=1594, t1=229858, type=0, code=0, v=0
D/InputReader(10978): Input event: device=0x10002 type=0x0 scancode=0 keycode=0 value=0
V/EventHub(10978): /dev/input/touchscreen0 got: t0=1594, t1=235198, type=3, code=53, v=788
D/InputReader(10978): Input event: device=0x10001 type=0x3 scancode=53 keycode=53 value=788
V/EventHub(10978): /dev/input/event2 got: t0=1594, t1=235198, type=3, code=53, v=788
D/InputReader(10978): Input event: device=0x10002 type=0x3 scancode=53 keycode=53 value=788
V/EventHub(10978): /dev/input/touchscreen0 got: t0=1594, t1=235382, type=3, code=54, v=1512
D/InputReader(10978): Input event: device=0x10001 type=0x3 scancode=54 keycode=54 value=1512
V/EventHub(10978): /dev/input/event2 got: t0=1594, t1=235382, type=3, code=54, v=1512
D/InputReader(10978): Input event: device=0x10002 type=0x3 scancode=54 keycode=54 value=1512
V/EventHub(10978): /dev/input/touchscreen0 got: t0=1594, t1=235473, type=3, code=0, v=788
D/InputReader(10978): Input event: device=0x10001 type=0x3 scancode=0 keycode=0 value=788
This also seems to be correct, the code 53 and 54 are for the X and Y coordinates.
However the android UI is not reacting to the touch inputs. Neither is our own app, nor the pointer painter from the development tools. Are the events not forwarded to the input dispatcher? The problem seems to be on the android side, but I cannot figure it out.
I hope someone can help me there or at least tell me where I can find additional information.

Categories

Resources