Play the ToneGenerator cause ANR - android

When click the dialerpad, play the ToneGenerator, but cause ANR。
The log:
01-02 04:02:48.209 392 2548 E audio_hw_primary: out_write: error -5, cannot write stream data: I/O error
01-02 04:02:48.209 392 2548 D audio_hw_primary: out_standby: enter: stream (0xae38a800) usecase(0: deep-buffer-playback)
01-02 04:02:48.249 392 3038 E audio_hw_primary: out_write: error -5, cannot write stream data: I/O error
01-02 04:02:48.249 392 3038 D audio_hw_primary: out_standby: enter: stream (0xae3ed000) usecase(1: low-latency-playback)
01-02 04:02:48.772 423 1116 W AudioFlinger: write blocked for 10554 msecs, 50 delayed writes, thread 0xae883ec0
01-02 04:02:48.772 423 1116 D AudioFlinger: mixer(0xae883ec0) throttle end: throttle time(19)
01-02 04:02:49.579 1767 1767 E ToneGenerator: — Stop timed out
01-02 04:02:52.639 1767 1767 E ToneGenerator: — Delayed start timed out, status -110
01-02 04:02:52.639 1767 1767 W ToneGenerator: Tone start failed!!!, time 8178550
You can check the code: DialpadFragment.java--ToneGenerator:
private void playTone(int tone, int durationMs)
private void stopTone()
The ToneGenerator stop timed out cause the ANR. But what did ToneGenerator cause to stop timed out? How to analyze and fix this issue?

you can simply use and its work for me
ToneGenerator toneG = new ToneGenerator(AudioManager.STREAM_ALARM, 100);
toneG.startTone(ToneGenerator.TONE_CDMA_ALERT_CALL_GUARD, 200);

Related

VideoView and ViewPager 1 'Can't play this video' Error (Decoder Issue?)

I'm experiencing a 'Can't Play this Video' pop-up error when using the ViewPager 1 with VideoView. The popup message only happens when the user waits about an hour and a half and then navigates away to another video page that's adjacent to it. Looking at the logs, there seems to be a native crash with 'OMX.google.h264.decoder'. I'd like to figure out the root cause of this since I've recently migrated to ViewPager 2 and the issue seems to be fixed (not sure why). I'm using SDK version 25 with a custom ROM (if it matters). Also, I haven't been able to reproduce this issue on an emulator.
Steps to Reproduce:
Navigate to a video page that has an adjacent video page
Wait an hour and a half
Navigate to the adjacent video page
Expected Result:
Can't play this video error doesn't appear
Actual Result:
Can't play this video error appears
01-02 17:55:40.320 511 574 E SoundPool: Error creating AudioTrack
01-02 17:55:40.638 251 685 D NuPlayerDriver: pause(0xb060c060)
01-02 17:55:40.638 251 685 D NuPlayerDriver: notifyListener_l(0xb060c060), (7, 0, 0), loop setting(0, 0)
01-02 17:55:40.639 251 251 D NuPlayerDriver: seekTo(0xb060c060) 0 ms at state 6
01-02 17:55:40.639 251 251 D NuPlayerDriver: notifyListener_l(0xb060c060), (7, 0, 0), loop setting(0, 0)
01-02 17:55:40.642 251 296 D NuPlayerDriver: start(0xb1e2ac00), state is 6, eos is 0
01-02 17:55:40.649 251 2163 D NuPlayerDriver: notifyListener_l(0xb1e2ac00), (6, 0, 0), loop setting(0, 0)
01-02 17:55:40.652 248 2169 F libc : Fatal signal 6 (SIGABRT), code -6 in tid 2169 (le.h264.decoder)
01-02 17:55:40.653 222 222 W : debuggerd: handling request: pid=248 uid=1046 gid=1006 tid=2169
01-02 17:55:40.707 1964 1975 I art : Background sticky concurrent mark sweep GC freed 53604(4MB) AllocSpace objects, 37(740KB) LOS objects, 26% free, 11MB/16MB, paused 1.070ms total 160.419ms
01-02 17:55:40.748 17200 17200 F DEBUG : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
01-02 17:55:40.750 17200 17200 F DEBUG : Build fingerprint: 'Android/pico_7d/pico_7d:7.1.2/dev-keys'
01-02 17:55:40.750 17200 17200 F DEBUG : Revision: '0'
01-02 17:55:40.750 17200 17200 F DEBUG : ABI: 'arm'
01-02 17:55:40.750 17200 17200 F DEBUG : pid: 248, tid: 2169, name: le.h264.decoder >>> media.codec <<<
01-02 17:55:40.750 17200 17200 F DEBUG : signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
01-02 17:55:40.751 17200 17200 F DEBUG : r0 00000000 r1 00000879 r2 00000006 r3 00000008
01-02 17:55:40.751 17200 17200 F DEBUG : r4 aa2ef978 r5 00000006 r6 aa2ef920 r7 0000010c
01-02 17:55:40.751 17200 17200 F DEBUG : r8 aacadbe0 r9 000f4240 sl aaa140a0 fp aaa6e0d0
01-02 17:55:40.751 17200 17200 F DEBUG : ip 00000016 sp aa2ef4b8 lr ab2de257 pc ab2e0ab4 cpsr 200f0010
01-02 17:55:40.796 17200 17200 F DEBUG :
01-02 17:55:40.796 17200 17200 F DEBUG : backtrace:
01-02 17:55:40.797 17200 17200 F DEBUG : #00 pc 00049ab4 /system/lib/libc.so (tgkill+12)
01-02 17:55:40.797 17200 17200 F DEBUG : #01 pc 00047253 /system/lib/libc.so (pthread_kill+34)
01-02 17:55:40.797 17200 17200 F DEBUG : #02 pc 0001d525 /system/lib/libc.so (raise+10)
01-02 17:55:40.797 17200 17200 F DEBUG : #03 pc 00019071 /system/lib/libc.so (__libc_android_abort+34)
01-02 17:55:40.797 17200 17200 F DEBUG : #04 pc 00017034 /system/lib/libc.so (abort+4)
01-02 17:55:40.797 17200 17200 F DEBUG : #05 pc 0000b50b /system/lib/libstagefright_soft_avcdec.so (_ZN7android7SoftAVC13onQueueFilledEj+1334)
01-02 17:55:40.797 17200 17200 F DEBUG : #06 pc 00023175 /system/lib/libstagefright_omx.so (_ZN7android22SimpleSoftOMXComponent17onMessageReceivedERKNS_2spINS_8AMessageEEE+272)
01-02 17:55:40.797 17200 17200 F DEBUG : #07 pc 000241ad /system/lib/libstagefright_omx.so
01-02 17:55:40.797 17200 17200 F DEBUG : #08 pc 0000f505 /system/lib/libstagefright_foundation.so (_ZN7android8AHandler14deliverMessageERKNS_2spINS_8AMessageEEE+24)
01-02 17:55:40.797 17200 17200 F DEBUG : #09 pc 00011795 /system/lib/libstagefright_foundation.so (_ZN7android8AMessage7deliverEv+60)
01-02 17:55:40.798 17200 17200 F DEBUG : #10 pc 0001006d /system/lib/libstagefright_foundation.so (_ZN7android7ALooper4loopEv+380)
01-02 17:55:40.798 17200 17200 F DEBUG : #11 pc 0000e3c1 /system/lib/libutils.so (_ZN7android6Thread11_threadLoopEPv+264)
01-02 17:55:40.798 17200 17200 F DEBUG : #12 pc 00046d23 /system/lib/libc.so (_ZL15__pthread_startPv+22)
01-02 17:55:40.798 17200 17200 F DEBUG : #13 pc 00019abd /system/lib/libc.so (__start_thread+6)
01-02 17:55:41.120 511 604 W NativeCrashListener: Couldn't find ProcessRecord for pid 248
01-02 17:55:41.121 17200 17200 E : debuggerd: failed to kill process 248: No such process
01-02 17:55:41.124 511 529 I BootReceiver: Copying /data/tombstones/tombstone_07 to DropBox (SYSTEM_TOMBSTONE)
01-02 17:55:41.137 222 222 W : debuggerd: resuming target 248
01-02 17:55:41.194 251 2168 E ACodec : OMX/mediaserver died, signalling error!
01-02 17:55:41.194 251 2168 E ACodec : signalError(omxError 0x8000100d, internalError -32)
01-02 17:55:41.194 251 2214 E ACodec : OMX/mediaserver died, signalling error!
01-02 17:55:41.194 251 2214 E ACodec : signalError(omxError 0x8000100d, internalError -32)
01-02 17:55:41.196 1964 1977 E MediaPlayer: error (100, 2)
01-02 17:55:41.196 1964 1964 E MediaPlayer: Error (100,2)
01-02 17:55:41.196 1964 1964 D VideoView: Error: 100,2
01-02 17:55:41.197 251 2167 E MediaCodec: Codec reported err 0xffffffe0, actionCode 0, while in state 6
01-02 17:55:41.197 251 2166 E NuPlayerDecoder: Decoder (video) reported error : 0xffffffe0
01-02 17:55:41.197 251 2213 E MediaCodec: Codec reported err 0xffffffe0, actionCode 0, while in state 7
01-02 17:55:41.197 251 2163 E NuPlayer: received error(0xffffffe0) from video decoder, flushing(0), now shutting down
01-02 17:55:41.197 251 2163 D NuPlayerDriver: notifyListener_l(0xb1e2ac00), (100, 1, -32), loop setting(0, 0)
01-02 17:55:41.207 1964 1976 E MediaPlayer: error (100, 2)
01-02 17:55:41.217 1964 1977 E MediaPlayer: error (1, -32)
01-02 17:55:41.218 251 2166 E NuPlayerDecoder: failed to flush OMX.google.h264.decoder (err=-38)
01-02 17:55:41.218 251 2163 E NuPlayer: received error(0xffffffda) from video decoder, flushing(2), now shutting down
01-02 17:55:41.218 251 2163 D NuPlayerDriver: notifyListener_l(0xb1e2ac00), (100, 1, -38), loop setting(0, 0)
01-02 17:55:41.225 251 2166 W AMessage: failed to post message as target looper for handler 0 is gone.
01-02 17:55:41.237 238 238 I ServiceManager: service 'media.codec' died
01-02 17:55:41.239 1964 1976 E MediaPlayer: error (1, -38)
01-02 17:55:41.258 1964 1964 E MediaPlayer: Error (100,2)
01-02 17:55:41.258 1964 1964 D VideoView: Error: 100,2
01-02 17:55:41.304 1964 1964 E MediaPlayer: Error (1,-32)
01-02 17:55:41.304 1964 1964 D VideoView: Error: 1,-32
01-02 17:55:41.351 1964 1964 E MediaPlayer: Error (1,-38)
01-02 17:55:41.351 1964 1964 D VideoView: Error: 1,-38
01-02 17:55:41.361 251 2212 E NuPlayerDecoder: failed to flush OMX.google.h264.decoder (err=-32)
01-02 17:55:41.361 251 2204 E NuPlayer: received error(0xffffffe0) from video decoder, flushing(1), now shutting down
01-02 17:55:41.361 251 2204 D NuPlayerDriver: notifyListener_l(0xb060c060), (100, 1, -32), loop setting(0, 0)
01-02 17:55:41.361 1964 1977 E MediaPlayer: error (1, -32)
01-02 17:55:41.367 251 2204 W AMessage: failed to post message as target looper for handler 0 is gone.
01-02 17:55:41.368 250 677 D FslExtractor: HandleSeekOperation do seek index=0
01-02 17:55:41.369 250 677 D FslExtractor: HandleSeekOperation index=0,ts=0,flag=2
01-02 17:55:41.371 251 2204 D NuPlayerDriver: notifyListener_l(0xb060c060), (4, 0, 0), loop setting(0, 0)
01-02 17:55:41.547 1964 1964 E MediaPlayer: Error (1,-32)
01-02 17:55:41.547 1964 1964 D VideoView: Error: 1,-32
01-02 17:55:41.587 17205 17205 I mediacodec: ### mediacodecservice starting
01-02 17:55:41.587 17205 17205 W /system/bin/mediacodec: libminijail: allowing syscall: clock_gettime
01-02 17:55:41.587 17205 17205 W /system/bin/mediacodec: libminijail: allowing syscall: connect
01-02 17:55:41.587 17205 17205 W /system/bin/mediacodec: libminijail: allowing syscall: fcntl64
01-02 17:55:41.587 17205 17205 W /system/bin/mediacodec: libminijail: allowing syscall: socket
01-02 17:55:41.588 17205 17205 W /system/bin/mediacodec: libminijail: allowing syscall: writev
01-02 17:55:41.588 17205 17205 W /system/bin/mediacodec: libminijail: logging seccomp filter failures
01-02 17:55:46.147 1964 2000 I nativePoll: Call timed out and no file descriptors were ready for GPIO
01-02 17:55:49.343 582 589 I art : Debugger is no longer active
01-02 17:55:49.344 582 589 I art : Starting a blocking GC Instrumentation
01-02 17:55:49.344 1964 1971 I art : Debugger is no longer active
01-02 17:55:49.344 1964 1971 I art : Starting a blocking GC Instrumentation
01-02 17:55:49.344 781 789 I art : Debugger is no longer active
01-02 17:55:49.344 897 904 I art : Debugger is no longer active
01-02 17:55:49.344 897 904 I art : Starting a blocking GC Instrumentation
01-02 17:55:49.344 781 789 I art : Starting a blocking GC Instrumentation
01-02 17:55:49.345 838 847 I art : Debugger is no longer active
01-02 17:55:49.345 511 517 I art : Debugger is no longer active
01-02 17:55:49.345 838 847 I art : Starting a blocking GC Instrumentation
01-02 17:55:49.345 511 517 I art : Starting a blocking GC Instrumentation
01-02 17:55:49.345 626 643 I art : Debugger is no longer active
01-02 17:55:49.345 626 643 I art : Starting a blocking GC Instrumentation
01-02 17:55:49.348 975 982 I art : Debugger is no longer active
01-02 17:55:49.348 975 982 I art : Starting a blocking GC Instrumentation
01-02 17:55:49.348 880 888 I art : Debugger is no longer active
01-02 17:55:49.348 880 888 I art : Starting a blocking GC Instrumentation
01-02 17:55:49.348 1136 1143 I art : Debugger is no longer active
01-02 17:55:49.348 1136 1143 I art : Starting a blocking GC Instrumentation
01-02 17:55:49.349 596 606 I art : Debugger is no longer active
01-02 17:55:49.349 596 606 I art : Starting a blocking GC Instrumentation
01-02 17:55:49.349 925 931 I art : Debugger is no longer active
01-02 17:55:49.349 925 931 I art : Starting a blocking GC Instrumentation
01-02 17:55:49.349 990 997 I art : Debugger is no longer active
01-02 17:55:49.349 990 997 I art : Starting a blocking GC Instrumentation
01-02 17:55:49.354 17126 17126 D StudioTransport: Profiler:Signal received 1
01-02 17:55:49.354 17126 17126 D StudioTransport: Profiler:TerminationService shutting down with signal 1
01-02 17:55:49.830 17210 17210 I getprop : type=1400 audit(0.0:690): avc: denied { open } for path="/dev/__properties__/u:object_r:safemode_prop:s0" dev="tmpfs" ino=6854 scontext=u:r:shell:s0 tcontext=u:object_r:safemode_prop:s0 tclass=file permissive=1
01-02 17:55:49.850 17210 17210 I getprop : type=1400 audit(0.0:691): avc: denied { getattr } for path="/dev/__properties__/u:object_r:safemode_prop:s0" dev="tmpfs" ino=6854 scontext=u:r:shell:s0 tcontext=u:object_r:safemode_prop:s0 tclass=file permissive=1
01-02 17:55:49.850 17210 17210 I getprop : type=1400 audit(0.0:692): avc: denied { open } for path="/dev/__properties__/u:object_r:mmc_prop:s0" dev="tmpfs" ino=6855 scontext=u:r:shell:s0 tcontext=u:object_r:mmc_prop:s0 tclass=file permissive=1
01-02 17:55:49.850 17210 17210 I getprop : type=1400 audit(0.0:693): avc: denied { getattr } for path="/dev/__properties__/u:object_r:mmc_prop:s0" dev="tmpfs" ino=6855 scontext=u:r:shell:s0 tcontext=u:object_r:mmc_prop:s0 tclass=file permissive=1
01-02 17:55:49.850 17210 17210 I getprop : type=1400 audit(0.0:694): avc: denied { open } for path="/dev/__properties__/u:object_r:device_logging_prop:s0" dev="tmpfs" ino=6857 scontext=u:r:shell:s0 tcontext=u:object_r:device_logging_prop:s0 tclass=file permissive=1
01-02 17:55:49.850 17210 17210 I getprop : type=1400 audit(0.0:695): avc: denied { getattr } for path="/dev/__properties__/u:object_r:device_logging_prop:s0" dev="tmpfs" ino=6857 scontext=u:r:shell:s0 tcontext=u:object_r:device_logging_prop:s0 tclass=file permissive=1
01-02 17:55:51.290 17267 17267 V StudioTransport: Server listening on 127.0.0.1:12389 port:12389
01-02 17:55:56.157 1964 2000 I nativePoll: Call timed out and no file descriptors were ready for GPIO
01-02 17:56:06.167 1964 2000 I nativePoll: Call timed out and no file descriptors were ready for GPIO
01-02 17:56:15.070 1964 1996 I BatteryMonitor: Battery voltage (V) current (mA), 4.5757, 522
01-02 17:56:15.073 1964 1981 I TemperatureLogger: Unit temperature (deg C), 71.00
01-02 17:56:16.177 1964 2000 I nativePoll: Call timed out and no file descriptors were ready for GPIO
01-02 17:56:26.187 1964 2000 I nativePoll: Call timed out and no file descriptors were ready for GPIO
01-02 17:56:36.197 1964 2000 I nativePoll: Call timed out and no file descriptors were ready for GPIO
01-02 17:56:46.206 1964 2000 I nativePoll: Call timed out and no file descriptors were ready for GPIO

ACTION_VOICE_COMMAND doesn't do anything

I'm using this code snippet to activate voice command on android.
Intent newIntent = new Intent(Intent.ACTION_VOICE_COMMAND);
newIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
getApplicationContext().sendBroadcast(newIntent);
it doesn't do anything, not even an error in my log cat:
06-03 13:26:24.325 203-822/? D/audio_hw_primary: out_set_parameters: enter: usecase(1: low-latency-playback) kvpairs: routing=2
06-03 13:26:24.335 203-822/? D/audio_hw_primary: select_devices: out_snd_device(2: speaker) in_snd_device(0: none)
06-03 13:26:24.335 203-822/? D/msm8974_platform: platform_send_audio_calibration: sending audio calibration for snd_device(2) acdb_id(15)
06-03 13:26:24.335 203-822/? D/audio_hw_primary: enable_snd_device: snd_device(2: speaker)
06-03 13:26:24.338 203-822/? D/audio_hw_primary: enable_audio_route: apply and update mixer path: low-latency-playback
--------- beginning of system
06-03 13:26:26.277 786-892/? D/ConnectivityService: notifyType CAP_CHANGED for NetworkAgentInfo [WIFI () - 100]
06-03 13:26:27.551 203-822/? D/audio_hw_primary: disable_audio_route: reset and update mixer path: low-latency-playback
disable_snd_device: snd_device(2: speaker)
when I run this in ADB, it brings the google assistant up:
adb shell am start -a android.intent.action.VOICE_COMMAND
which is weird, it's technically the very same thing.
is there permission i'm missing or something?
From Docs
Activity Action: Start Voice Command.
So to bring up the voice command assistant activity, Use startActivityas
getApplicationContext().startActivity(newIntent);
instead of
getApplicationContext().sendBroadcast(newIntent);
like
Intent newIntent = new Intent(Intent.ACTION_VOICE_COMMAND);
newIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
getApplicationContext().startActivity(newIntent);
// ^^^^^^^^^^^^
is there a way for the UI not to come up and cover my UI? or at least
for google assistant to go away after it listened and acted on my
voice command?
You can use Google Assistant Service sdk and here is the android quick start guide

Using bluetooth create_bond_out_of_band()

I need to force an Android phone to use oob data for pairing. That means I want the Android phone to have the "OOB Data Flag" being set, when the phone sends a Pairing Request to a device.
What I've tried so far: I've identified platform/system/bt to be the current (6.0.1) Android Bluetooth implementation and platform/packages/apps/Bluetooth being a Java wrapper around BT.
platform/system/bt exposes it's interface through a bt_interface_t structure. That structure contains a function named create_bond_out_of_bandthat should do what I need. Unfortunately, that function is not exposed by the Java Wrapper.
First I've tried to use the JNI function const bt_interface_t* android::getBluetoothInterface() from libbluetooth_jni.so. I managed to lookup that function during runtime, but when I call it, it returns 0. At that point, the app used already a lot of the bluetooth API.
This led me to the conclusion, that either, the shared object was loaded a second time, or that the bluetooth library is not part of my application, but somehow implemented in a different process.
Second, I've tried to use the Android libhardware API. I've managed to get the BT module, a BT device and finally call the create_bond_out_of_band() from the bt_interface_t. The function returns 0, which indicates success, but no Pairing Request is send out. I see following messages in the logs:
02-02 15:24:38.083 5791-5824/? E/bt_btif: btif_hh_virtual_unplug: Error, device C4:BE:84:BA:DA:0B not opened.
02-02 15:24:38.083 5791-5791/? E/Gatt: createBondOutOfBand: create_bond_out_of_band(0)
02-02 15:24:38.086 490-2881/? D/audio_hw_primary: out_set_parameters: enter: usecase(1: low-latency-playback) kvpairs: routing=2
02-02 15:24:38.101 490-2881/? D/audio_hw_primary: select_devices: out_snd_device(2: speaker) in_snd_device(0: none)
02-02 15:24:38.101 490-2881/? D/msm8974_platform: platform_send_audio_calibration: sending audio calibration for snd_device(2) acdb_id(101)
02-02 15:24:38.101 490-2881/? I/soundtrigger: audio_extn_sound_trigger_update_device_status: device 0x2 of type 0 for Event 1
02-02 15:24:38.108 490-2881/? D/msm8974_platform: platform_send_audio_calibration: sending audio calibration for snd_device(69) acdb_id(102)
02-02 15:24:38.108 490-2881/? D/audio_hw_primary: enable_snd_device: snd_device(69: vi-feedback)
02-02 15:24:38.108 490-2881/? D/audio_hw_primary: enable_audio_route: apply and update mixer path: spkr-vi-record
02-02 15:24:38.132 490-2881/? D/msm8974_platform: platform_send_audio_calibration: sending audio calibration for snd_device(27) acdb_id(4)
02-02 15:24:38.132 490-2881/? I/ACDB-LOADER: ACDB AFE returned = -19
02-02 15:24:38.133 490-2881/? D/audio_hw_primary: enable_audio_route: apply and update mixer path: low-latency-playback
02-02 15:24:38.672 490-2881/? D/audio_hw_primary: disable_audio_route: reset and update mixer path: low-latency-playback
02-02 15:24:38.674 490-2881/? D/audio_hw_primary: disable_snd_device: snd_device(2: speaker)
02-02 15:24:38.690 600-600/? E/QCALOG: [MessageQ] ProcessNewMessage: [LOWI-SERVER] unknown deliver target [OS-Agent]
02-02 15:24:38.693 490-2881/? D/audio_hw_primary: disable_snd_device: snd_device(69: vi-feedback)
02-02 15:24:38.693 490-2881/? D/audio_hw_primary: disable_audio_route: reset and update mixer path: spkr-vi-record
02-02 15:24:38.696 490-2881/? I/soundtrigger: audio_extn_sound_trigger_update_device_status: device 0x2 of type 0 for Event 0
C4:BE:84:BA:DA:0B is the device, I try to pair with.
Any ideas? How I can archive my goal or at least some pointers to where an active Android community can be found?
Thanks in advance,
Torsten

Audiotrack stops sound randomly, but state is STATE_INITIALIZED and PLAYSTATE_PLAYING

I'm looping and audiotrack with...
audioTrack.setLoopPoints(0, length, -1);
audioTrack.play();
But after random time (several minutes), it stop sounding, but state is STATE_INITIALIZED and PLAYSTATE_PLAYING.
In that moment, I get this message ...
09-20 19:32:27.989: D/audio_hw_primary(176): out_standby: enter: usecase(1: low-latency_playback)
09-20 19:32:28.039: D/audio_hw_primary(176): stop_output_stream: enter: usecase(1: low- latency-playback)
09-20 19:32:28.049: D/audio_hw_primary(176): disable_audio_route: reset mixer path: low-latency-playback
09-20 19:32:28.049: D/audio_hw_primary(176): disable_snd_device: snd_device(2: speaker)
09-20 19:32:28.049: D/audio_hw_primary(176): stop_output_stream: exit: status(0)
09-20 19:32:28.049: D/audio_hw_primary(176): out_standby: exit
I need to loop audiotrack limitless, please, anyone knows how to solve it ?
PD: The stop seems to happen only in versions 4.1 and later.
Seems like the phone is entering stand by, when you configured your MediaPlayer, did you get a wakelock?
yourMediaPlayer.setWakeMode(getApplicationContext(), PowerManager.PARTIAL_WAKE_LOCK);
Don't forget to release your mplayer later.

how to show activity while in call

When i'm calling i would like to have an activity to be started from a background service.
I can get the activity to start while i'm calling and the phone is of my head (something to do with the proximity sensor I asume)
But when the proximity sensor detects something and i try to start the activty, the onStart of that activity is called, and directly after that the onStop is called.
Does anyone know how to start an activity while in call and the proximity sensor detects something?
01-02 15:42:14.829: I/KeepAliveService(5985): show pager call from Service
01-02 15:42:14.849: I/ActivityManager(167): Starting: Intent { flg=0x14050004 cmp=com.clb.clbmobile/.NewMessage (has extras) } from pid 5985
01-02 15:42:14.849: W/ActivityManager(167): Trying to launch com.clb.clbmobile/.NewMessage
01-02 15:42:14.859: D/KeyguardViewMediator(167): adjustUserActivityLocked mShowing: false mHidden: false
01-02 15:42:14.859: D/PowerManagerService(167): enableUserActivity true
01-02 15:42:14.859: D/StatusBarManagerService(167): manageDisableList what=0x0 pkg=android
01-02 15:42:14.859: D/InCallScreen(242): onWindowFocusChanged(false)...
01-02 15:42:14.859: D/InCallScreen(242): - onWindowFocusChanged: faking onDialerKeyUp()...
01-02 15:42:14.859: D/DTMFTwelveKeyDialer(242): Notifying dtmf key up.
01-02 15:42:14.889: I/KeepAliveService(5985): activity started
01-02 15:42:14.939: I/ClbActivity(5985): getting shared prefs
01-02 15:42:14.939: I/ClbActivity(5985): end shared prefs
01-02 15:42:14.939: I/AlertDialog(5985): Starting Alert Dialog
01-02 15:42:15.019: I/AlertDialog(5985): Done with init
01-02 15:42:15.079: D/BatteryService(167): update start
01-02 15:42:15.079: D/BatteryService(167): update start
01-02 15:42:15.079: D/BatteryService(167): update start
01-02 15:42:15.099: E/PlayerDriver(95): Creating Non-Tunnel mode playback - uncompressed MIO
01-02 15:42:15.099: W/MediaPlayer(5985): info/warning (1, 44)
01-02 15:42:15.109: I/AlertDialog(5985): Current volume = 15
01-02 15:42:15.109: E/MediaPlayer(5985): prepareAsync called in state 8
01-02 15:42:15.109: I/AlertDialog(5985): cant prepare Media Player
01-02 15:42:15.109: V/AudioPolicyManager(95): startOutput() output 1, stream 3, session 241
01-02 15:42:15.109: V/AudioPolicyManager(95): getDeviceForStrategy() from cache strategy 1, device 1
01-02 15:42:15.109: V/AudioPolicyManager(95): getNewDevice() selected device 1
01-02 15:42:15.109: V/AudioPolicyManager(95): setOutputDevice() output 1 device 1 delayMs 0
01-02 15:42:15.109: V/AudioPolicyManager(95): setOutputDevice() setting same device 1 or null device for output 1
01-02 15:42:15.109: V/AudioHardwareMSM72XX(95): open driver
01-02 15:42:15.109: V/AudioHardwareMSM72XX(95): get config
01-02 15:42:15.109: V/AudioHardwareMSM72XX(95): set config
01-02 15:42:15.109: V/AudioHardwareMSM72XX(95): buffer_size: 4800
01-02 15:42:15.109: V/AudioHardwareMSM72XX(95): buffer_count: 2
01-02 15:42:15.109: V/AudioHardwareMSM72XX(95): channel_count: 2
01-02 15:42:15.109: V/AudioHardwareMSM72XX(95): sample_rate: 44100
01-02 15:42:15.109: V/AudioHardwareMSM72XX(95): count : 4800
01-02 15:42:15.139: I/AlertDialog(5985): start pausing
01-02 15:42:15.149: I/MediaPlayer(5985): Info (1,44)
01-02 15:42:15.369: I/ActivityManager(167): Displayed com.clb.clbmobile/.NewMessage: +517ms
01-02 15:42:15.489: W/IInputConnectionWrapper(5985): showStatusIcon on inactive InputConnection
01-02 15:42:15.489: W/IInputConnectionWrapper(5985): getExtractedText on inactive InputConnection
01-02 15:42:15.499: D/InCallScreen(242): onStop()...
01-02 15:42:15.499: D/InCallScreen(242): onStop: state = OFFHOOK
01-02 15:42:15.509: D/InCallScreen(242): onResume()...
01-02 15:42:15.519: D/PhoneApp(242): setIgnoreTouchUserActivity(true)...
01-02 15:42:15.519: D/DTMFTwelveKeyDialer(242): startDialerSession()... this = com.android.phone.DTMFTwelveKeyDialer#4055e2a0
01-02 15:42:15.519: D/DTMFTwelveKeyDialer(242): - startDialerSession: mDTMFToneEnabled = true
01-02 15:42:15.519: D/InCallScreen(242): - onResume: initial status = SUCCESS
01-02 15:42:15.519: D/InCallScreen(242): isBluetoothAudioConnected: ==> isAudioOn = false
01-02 15:42:15.519: D/InCallScreen(242): setInCallScreenMode: NORMAL
01-02 15:42:15.519: D/InCallScreen(242): [okToDialDTMFTones] foreground state: ACTIVE, ringing state: false, call screen mode: NORMAL, result: true
01-02 15:42:15.519: D/InCallScreen(242): isBluetoothAudioConnected: ==> isAudioOn = false
01-02 15:42:15.519: D/StatusBarManagerService(167): manageDisableList what=0x1 pkg=com.android.phone
01-02 15:42:15.519: D/PowerManagerService(167): setPokeLock pokey=16 tag=PhoneApp
01-02 15:42:15.519: D/PowerManagerService(167): setScreenOffTimeouts mKeylightDelay=3000 mDimDelay=7000 mScreenOffDelay=20000 mDimScreen=true
01-02 15:42:15.519: D/StatusBarManagerService(167): manageDisableList what=0x1 pkg=com.android.phone
01-02 15:42:15.519: I/CallOnGoingView(229): onDetachedFromWindow
01-02 15:42:15.669: D/InCallScreen(242): Handler: handling message { what=101 when=-48ms obj=android.os.AsyncResult#406d01b8 } while not in foreground
01-02 15:42:15.669: D/InCallScreen(242): onPhoneStateChanged()...
01-02 15:42:15.669: D/PhoneApp(242): updateWakeState: callscreen false, dialer false, speaker false, state OFFHOOK...
01-02 15:42:15.669: D/PhoneApp(242): setScreenTimeout(DEFAULT)...
01-02 15:42:15.669: D/PhoneApp(242): requestWakeState(SLEEP)...
01-02 15:42:15.669: D/InCallScreen(242): onPhoneStateChanged: Activity not in foreground! Bailing out...
01-02 15:42:15.669: I/StatusBarManagerService(167): UPDATE-null , 0x7f020143
01-02 15:42:15.669: I/StatusBarService(229): REMOVE:MiniCon-1
01-02 15:42:15.689: I/AlertDialog(5985): start stopping
01-02 15:42:15.699: I/StatusBarService(229): ADD:MiniCon-1
I fixed this problem in a different way.
- First I check if the person is in a call
- Then I check if the proximity sensor is activated
If these two are the case, then a sound is being played from a service.
I then keep checking if the proximity sensor has deactived (eg. the phone is of the head). If this is the case, my acitivity is shown.

Categories

Resources