How to determine the app that emits sound(s) - Galaxy Tab General

I have a Galaxy Tab GT-P1000 running Overcome 3.3.1. On occasion, when all else seems quiet, the device will suddenly decide to play the /system/media/audio/notifications/12_Tweeters.ogg sound file (sounds something like a bird chirp), and I would like to find the application that causes this sound file to be played. I ran the Log Collector app (v1.1.0) and poured through its output, and that is how I determined which file is being played,
In the latest instance, the log shows:
09-06 08:40:24.230 I/MediaPlayer( 306): The actual path is:/system/media/audio/notifications/12_Tweeters.ogg.
Before that, I can see references to (306) like "KeyguardViewMediator in the same second. In fact, there are hundreds of references to 306 within parentheses, mostly around Sensors and PowerManagerService BatteryService But I don't see a way to trace back to the originator. (Frankly, I also don't have any indication that the '306' is important.)
How would I go about finding the reason that MediaPlayer was kicked off in the first place? (My goal is to find the application that suddenly decides to play this sound file, and to understand why it does so. After all, I'm being notified of something, right? Wouldn't it be swell to understand the reason for the notification, instead of just "Hey!" ?)
I've searched for general information on how to figure out what the Log is trying to tell me, but to no avail for something like this. Is there enough information in the typical Log Collector output to determine this information? If so, where can I read up on how to trace this? If not, then what might I do to trap/identify this?
I appreciate any pointers you may have on this.

Related

Identifying symlink to avoid "infinite" loop when browsing files.

Hi,
I have tested this behaviour on both a N1 and the emulator. Could anyone tell me if that is a problem? How can I avoid the recursive code going forever? What is happening?
If you use any file browser/manager and starting going into /sys/devices/w1 bus master/subsystem/devices/w1 bus master/subsystem it will go inner forever, repeating that pattern devices/w1 bus master/subsystem/ all the way.
So when I run a recursive search it keeps going deeper and deeper and seems never to finish.
What is happening, how to avoid this behaviour?
I tried different file managers and they all seem to be going forever into these folders, although when I do a search through Astro it doesn't seem to get stuck with this loop (It seems to ignore the /sys folder, but I am not sure if this happens also in any other folder).
Some people point me this problem can be related to symlinks, but I didn't find a way of checking for those symbolic links with Android's Java.
I know it can be done (as proved by Astro file manager), I just don't know how.
Hopefully it won't involve any call to functions which I'll have to create using NDK, which would be a pain.
Regards.
astro goes infinite for me on an N1
I think any app needs to do some extra checks instead of following stuff down.
eg the "find" command has the "-follow" option
open a terminal or use "adb shell" and "cd /sys/bus"
now type in "find" and it will display all the files directories and symlinks without following them
now type in "find -follow" - you will need to press Control-C to get out, you will see that each line has an error "too many symlinks" - kernel has protection/limit for symlink levels.
writers of file managers could easily fix this, but you have to ask what you were doing in their anyway?
Lol, I was trying to find some info to address this problem under Android & found a relevant thread I thought might help, only to discover it was you (jfbaro) having this conversation on another forum
Specifically, this thread on anddev.org.
I don't know Android yet, but a getCanonicalPath() like call is always going to be at the heart of spotting in advance & avoiding this type of problem, whatever your environment & language. If it doesn't work either the function is broken or you're making a mistake somewhere, I'm fairly sure.
In the above thread you say this doesn't help you. Can you post what getCanonicalPath returns for both /sys/device/subsystem/ & /sys/device/subsystem/sys/ ?
Let's assume you start your traverse at / & have reached /sys/device/subsystem/. When you check to see if it's safe to follow /sys/device/subsystem/sys you should discover that the latter is actually /sys, and that further, it is in your list of already scanned directories, hence you do not search further down that branch.
Where is this breaking down?
[Edit:] You might also find something of use buried in this bug thread which involves similar issues. Funnily enough it concerns Eclipse, but all that matters is that it's a Java based example of the problem. From a quick scan, getCanonicalPath again seems to be the solution though I think they avoid any performance hit by only using it on files known to be sym-links.

[Q] Debugging help needed

I have a user of my app who is having a problem running it. My code launches another activity in the same app, and he is saying it is stopping before it should & returning to the previous activity, and he doesn't see any Force Close warnings.
I have run my code in the emulator & on my phone, I can't reproduce the error. We both run Android 2.2 on our phones, his is an HTC EVO & mine is a HTC Wildfire, as far as I can tell his specs are better than mine so shouldn't cause an issue - I deliberately chose a low spec for for my dev work so the code ought to run on anything.
As a bit of an Andoid dev noob (but been coding for years), is there any easy way I can make a special build of the app to send to him that would log any errors that happen ? I'd like to get a stack dump as well if possible, as I'm not sure exactly what routine in the activity its crashing out in. The activity that crashes is Gallery with 9 images in it, he can't flick through them or select one. I'm stumped as to whats causing it, any assistance would be gratefully received.
Thanks.
Why not point to your app and let others here try it on their phones? It could simply be other apps installed on his phone interfering with your app.
Long time programmer here too and when I get to where you're at (and I"m sure you've put some hours into this LOL), I go back to STEP 1.
I comment-out any and all code but the bare minimum; break it down to the Intent, startActivity and maybe a Toast message in the second activity. Even parse down your XML files to bare minimum.
See if that works. Then, ADD BACK ONE LINE OF CODE AT A TIME Run program and make sure it works. Yeah, it's painful, but in my 20 years of coding, I've learned to put my pride aside and to not "pretend" all the code I've written is correct.
Sometimes on bigger projects, I"ll change or add a couple of lines of code, run a back up and test. Rinse and repeat LOL. That way, I know I"m only a couple of lines of code from what "used" to work.
Good Luck!
Thanks both of you.
old_dude - Its a paid app. Only £0.99 but I don't think people would pay to help me. There is a free version of the same app (with less functionality) that this guy can get to work. If your really interested the 2 versions are -
Plink Log - Free Version
Plink Log Pro - Paid version
Rootstonian - agreed thats the approach I'd normally take if I was having problems on my dev phone or the emulator. The problem is that its OK on my HTC Wildfire/Android2.2 but on this guys HTC EVO/Android2.2 its having problems. I dont really want to keep sending him .apks with 1 or 2 lines extra enabled just to see if that fixes his specific issue. I was hoping there was something I could code to catch whatever crashes the activity & log it somewhere for me to analyse. When I do PC dev work, I have a global exception handler that catches anything I dont explicitly handle, and dumps the full call stack into a Log File I can read later.
I think I'll just have to take the existing app & put loads of debug code into it to save messages into a log file & see what bits of code are being called & what isn't & then get him to email me the results.
Thanks for the ideas guys, its always useful to get input from another perspective.
Dave
Hmmmm, just discovered setDefaultUncaughtExceptionHandler - might be able to use that with printStackTrace. Sounds interesting.

[Q] Tasker Help - Google Music Interaction

Greetings!
I'm trying to determine if I can find a workaround for the Music related issue (with the Equalizer bug) that i've experienced, and documented at length in another thread in this forum, also documented in a different thread with more people impacted. I had a bit of a Eureka moment the other day, in that the resolution (that has very reliably worked), has been to hit Pause and then Play again, to turn the Equalizer back on.
My thought was: Can I set up a Tasker (or similar app) profile to accomplish this automatically? I'm not at all experienced with Tasker so this is very much a 'please hold my hand' kind of post. I want to learn, as I want to resolve this, and maybe this will help others with the same issue. After fumbling around a bit in the app, i'm not sure how to proceed or accomplish this.
Here's what I want Tasker to do:
1. If Google Music is Open
2. If Track change has happened
2a. Then Pause
2b. Then Play
3. Return to 1
If this can be accomplished in an extremely small amount of time, as I imagine Tasker could, then i'd be fine with it doing it at the beginning of every new track. I'm also entirely fine with being a guinea pig to make sure it works, I just need to know if this is even possible, and then thoughts on how best to accomplish it. Any assistance would be greatly appreciated.

[Q] How to run multiple processes at exactly the same time

I can not publish any code or any logs, because there is no real problem yet. I am a beginner in Android / Java and the OOP concept.
I need to run two processes at exactly the same time in my program. The processes are sound samples and requires played at exactly the same time to be synchronized with each other.
I call the methods on the lines one after the other, which gives me a delay when the first clip starts a few microseconds before. Depending on the hardware this delay will also vary enormously .. how do i run the commands, or call the methods exactly the same time?
I've been looking at adding a delay of the first method by a handler, but I do not want to do this but it does not guarantee accurate synchronization.
I am on track to use AsyncTask, and somehow run these processes simultaneously but in different threads ... I have no idea if I'm on the right track? Can anyone confirm that this is the right way, or provide information about what else I can do? Grateful for all the help I can get. I hope I have not used the wrong terms and that I have given you enough information so that you can understand my question. Thanks in advance.
Having two functions tied to the same event has worked for me in the past.
For example, if you have a play button and you set up two separate functions to run when that button is clicked, they should go at the exact same time. If your play button is pressed, it will fire both functions simultaneously.
Another more advanced approach would be to return the current time code of "sound a" and pause it until the time code of "sound b" reaches the current time of "sound a".
Im Saint said:
Having two functions tied to the same event has worked for me in the past.
For example, if you have a play button and you set up two separate functions to run when that button is clicked, they should go at the exact same time. If your play button is pressed, it will fire both functions simultaneously.
Another more advanced approach would be to return the current time code of "sound a" and pause it until the time code of "sound b" reaches the current time of "sound a".
Click to expand...
Click to collapse
Well "simultaneously" is a big word but you are right, even if one player lags behind the other one, we are talking about microseconds at most. And i doubt that anybody would even notice that.
And to OP:
In java there is a keyword called "synchronized" where one thread awaits the other. I have never used that and so i dont know how to use this. Maybe if you look it up on google it could prove useful to your project. But i actually dont think that you can technically accomplish this "true" synchronization you are thinking of... It is worth a try at least
--------------------
Phone: Nexus 4
OS: rooted Lollipop LRX21T
Bootloader: unlocked
Recovery: TWRP 2.8.2.0
Have you considered buffering? you can buffer samples in some queue and start playing them after a decided delay / samples count, making sure you have samples from all the sources you need to synchronize
Thanks for the replies, any help is much appreciated!
Im Saint said:
Having two functions tied to the same event has worked for me in the past.
For example, if you have a play button and you set up two separate functions to run when that button is clicked, they should go at the exact same time. If your play button is pressed, it will fire both functions simultaneously.
Another more advanced approach would be to return the current time code of "sound a" and pause it until the time code of "sound b" reaches the current time of "sound a".
Click to expand...
Click to collapse
Good to hear, but can it be guaranteed that the function calls are performed exactly the same time? This is very necessary for various reasons.
Masrepus said:
Well "simultaneously" is a big word but you are right, even if one player lags behind the other one, we are talking about microseconds at most. And i doubt that anybody would even notice that.
And to OP:
In java there is a keyword called "synchronized" where one thread awaits the other. I have never used that and so i dont know how to use this. Maybe if you look it up on google it could prove useful to your project. But i actually dont think that you can technically accomplish this "true" synchronization you are thinking of... It is worth a try at least
Click to expand...
Click to collapse
This is what I also want to emphasize. With the greatness of the inner meaning of "simultaneousness", even if that someone would not notice anything, it's a necessity.
I will seriously undermine further the keyword synchronized. This sounds exactly like what I need. I will succeed and reconnect with the results!
pixeltech.dev said:
Have you considered buffering? you can buffer samples in some queue and start playing them after a decided delay / samples count, making sure you have samples from all the sources you need to synchronize
Click to expand...
Click to collapse
I have heard the word buffer before but never truly understood how it works syntactically, nor in Android / Java.
With what kind of content can this be done? All types of media, audio / picture / video? Do you have any keyword to search on or link to an example?
Invisible Algorithm said:
Thanks for the replies, any help is much appreciated!
I have heard the word buffer before but never truly understood how it works syntactically, nor in Android / Java.
With what kind of content can this be done? All types of media, audio / picture / video? Do you have any keyword to search on or link to an example?
Click to expand...
Click to collapse
Buffering is a technique where you first collect enough data (can be represented in any form but is usually done through collections) and once you have enough data you do something with it.
An example can be reading data in bytes form from one source (e.g. network channel), buffering it (storing it in some collection) and writing it to files when buffered data reaches some threshold size

Coaxing GrooVe IP to work?

Yeah, I know it's kind of "out there", but consider the problem a proof-of-concept exercise
I've found an old version of the app that will install and "run" on Eclair--but not so old that it still tries to log into GoogleVoice. I can get past the intro screen but for the "sign in" screen I get a white-out condition except for the little bar that says "Sign in". The menu options (help and exit) can still be brought up.
I use GrooVe IP Lite on my Nook Tablet and a cheap little unactivated Kit-Kat smartphone I bought as a dedicated mp3 player (after my beloved Insignia Pilot died :crying. It works great for an emergency call if you can scare up wi-fi----and it's free (to any land-line in the US or Canada--cell phones too, I guess). In this respect it seems better than Skype to me unless you have a lot of overseas contacts (I don't).
So....I uninstalled the current app from my little Kit-Kat device and side-loaded the old app. It ran just fine, allowed me to sign in, etc. Once signed in and exited, the next time the app starts you are already signed in. Hmm. I started digging in the /data/data folder for the app and came across two xml files of preferences, one of which clearly contained log-in information (my assigned telephone number, my email, etc.). So I tried copying that file to the same folder on the NST, hoping to get past the indomitable white-out. No joy. Same behavior AND when I checked the xml file I had overwritten it had been returned to a generic state, minus my personal data
I tried two other things. I reactivated the old phone.apk system app. That made no difference. I didn't try the telephony or whatever that other one is. I also started up USB audio before going to the app, thinking it might check for audio capabilities (and it still might) but that made no difference.
I'd probably never use the app on the NST but I am curious about what is keeping it from working. Perhaps the voip server just rejects log-in attempts from really old Android systems.
Any ideas?
Sorry for necroposting but this topic is in line of mine reasoning to use device as much as possible as it is. So if it does not have camera why would you need a Skype or Whatsapp? As a VoIP phone that is OK. Did you made any progress on that one? I am asking because I have a feeling that it might be possible to write an application that would work like VoIP/SIP/web phone to completely remove Phone.apk that reside in NST.
SJT75 said:
Sorry for necroposting but this topic is in line of mine reasoning to use device as much as possible as it is. So if it does not have camera why would you need a Skype or Whatsapp? As a VoIP phone that is OK. Did you made any progress on that one? I am asking because I have a feeling that it might be possible to write an application that would work like VoIP/SIP/web phone to completely remove Phone.apk that reside in NST.
Click to expand...
Click to collapse
No, I eventually gave up on the idea. It was only a lark from the start, just to see if it would be possible, but the demands of the task exceeded my knowledge. GrooveIP has changed the way connections are made as well as encryption schemes several times over since I first looked at the issue. All that aside, I doubt that the device could now login to the new servers even if all the code were properly in place.
Re: Phone.apk, on the NST this is where the control of the Android volume resides, so if you remove that you lose the ability to control the media volume (or any volume, for that matter). I eventually discovered this after a lot of flailing around with kludges to prevent the media volume from blasting out when using USB Audio. Many people had deactivated or deleted Phone.apk (me too). When I re-enabled the app I suddenly had access to the volume controls.
nmyshkin said:
No, I eventually gave up on the idea.
Re: Phone.apk, on the NST this is where the control of the Android volume resides, so if you remove that you lose the ability to control the media volume (or any volume, for that matter). I eventually discovered this after a lot of flailing around with kludges to prevent the media volume from blasting out when using USB Audio. Many people had deactivated or deleted Phone.apk (me too). When I re-enabled the app I suddenly had access to the volume controls.
Click to expand...
Click to collapse
First thanks for reply. Second does that mean you won't have anything against me trying to do something like that... it might not be GrooVeIP since I haven't decided what service would be optimal to begin with. Third I have read your experiments with Phone.apk and that part of volume control resides there that is why I suggest not to remove it but rewrite it in a more usable form. Even if I fail doing that at least I might have satisfaction in knowing that I tried.
SJT75 said:
First thanks for reply. Second does that mean you won't have anything against me trying to do something like that... it might not be GrooVeIP since I haven't decided what service would be optimal to begin with. Third I have read your experiments with Phone.apk and that part of volume control resides there that is why I suggest not to remove it but rewrite it in a more usable form. Even if I fail doing that at least I might have satisfaction in knowing that I tried.
Click to expand...
Click to collapse
By all means, give it a try! Supposedly some versions of WhatsApp would run on the NST. Again, whether you could log in to a server is another matter.
nmyshkin said:
By all means, give it a try! Supposedly some versions of WhatsApp would run on the NST. Again, whether you could log in to a server is another matter.
Click to expand...
Click to collapse
I also think that WhatsApp would fail since company promised support for devices with Android older then 2.3 would be maintained until February of this year. Still some other existing software might go through installation process and be registered using code sent to mobile phone that have same software or maybe I find something new who knows.

Categories

Resources