This is major problem I am getting while monkey testing my application on emulator.
"activity home(in process
android.process.acore) is not
responding"
I don't know what is happening behind.
Has anybody any solution?
You are probably doing something time-consuming (like a network connection) on the event thread. You need to move all time-consuming processing into worker threads. See the article on Painless Threading.
That process don't belong to you application does it ? I think that is a system process.
Have you limited monkey to only run on your package ? Are you running emulator or target ?
Souns like monkey make your emulator or target phone "crash".
Related
As far as I know, debuggers work based on system calls like ptrace in linux, which will block the tracee and then tracer get informations from tracee's memory.
It means, if I want to use a debugger to debug the main thread in an android app process, it will block the main thread and wait for my operations, which may easily cause main thread ANR in few seconds.
So I am confused about is it really possible to debug the main thread in android app process and how?
Correct, ADP uses ptrace and blocks the main thread and this causes the application to slow down slightly while in debug mode. If you do step by step debugging the thread you put your breakpoint in will be halted completely.
For general debugging purposes this should not be an issue. Testing how smooth an application runs should be done in run mode and not in debug mode.
I am new to android dev. Our requirement is to run a background service in android. Which is unkillable or it is capable to handle KILL signal from taskmanager..
Is there is any way to do it?
I have heard about addShutdownHandler, But it wont fired when user kills it.
Thanks in advance
Is there is any way to do it?
Only by building your own custom version of Android, with your code in a standard C/C++ daemon, and then distributing a ROM mod that contains that customized version of Android.
If you are trying to create an ordinary SDK app, the user or Android itself can get rid of your process at any time, for any reason.
In general: not possible.
I should add that trying to impose such a requirement makes you sound nefarious -- there's a reason the user is allowed to kill processes.
From man 7 signal:
The signals SIGKILL and SIGSTOP cannot be caught, blocked, or ignored.
This is fundamentally by kernel design. Think about it: if a process could ignore all signals whatsoever, then how would you stop it if it ran away uncontrolled? No, what you'll have to do is see to it that the KILL signal is not sent. Running your program under its own userid should achieve this, as long as no one with administrative privileges generates the signal -- but even this requirement may be practically impossible to meet. By design, the system provides the basic ability to kill a process, on the theory that the user or sysadmin might (for whatever reason) want the process killed.
I am studying Android driver/kernel. I find that there are 2 set of watchdogs:
kernel/watchdog.c
/drivers/watchdog/tegra_wdt.c
Both them are used to recovery the system as system hang on an event (e.g. infinite loop).
The first one is enabled in system boot time by default, but many people still implementing their watchdog in /drivers/watchdog/ folder for specific driver. I confuse about this. Why should we need multiple watchdog? Is any one know about the "philosophy" about this?
Because Watchdog is used for the secure thread, with the help of this we can stop the thread so it will not be able to perforrm any longer.
Is there any possibility to create a listener for closing another process?
Let's say I want to know when the process com.android.test.app isn't running anymore.
By the way, I don't want to use threads for listening for current running apps.
Btw I don't want to use threads for listening for current running apps.
From what I know, there is no other way supported by Android as yet.
I'd like to point out that getRunningAppProcesses() checking processes with IMPORTANCE_EMPTY or IMPORTANCE_BACKGROUND is one of doing this but as per the documentation :
Note: this method is only intended for debugging or building a user-facing process management UI.
Is there a way to know all the threads that are currently running in background inside of an Android application??
Thanks!!
The user interface by default runs in a single thread!
Map<Thread, StackTraceElement[]> myMap = Thread.getAllStackTraces();
This map also contains system threads running in this application like garbage collection.
An Android application, by default, runs in a single thread. This is why it is important to spawn off threads to do significant work in your application so that the main thread can continue to respond to the OS and GUI input, avoiding the "Application Not Responding" dialog.
This information can be found in the Android development guide here.