summaryrefslogtreecommitdiffstats
path: root/core/jni/android_util_Process.cpp
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2010-05-10 15:57:38 -0700
committerDianne Hackborn <hackbod@google.com>2010-05-10 17:19:58 -0700
commit906497c574d45d8dfd295b16dece0d0bc32c0895 (patch)
tree636cafd0184ebc44cc8dfa7cec9dda125bb8d8ec /core/jni/android_util_Process.cpp
parent639a7fc2c2d0bda12fef0c822bb2e3c002d5c5b4 (diff)
downloadframeworks_base-906497c574d45d8dfd295b16dece0d0bc32c0895.zip
frameworks_base-906497c574d45d8dfd295b16dece0d0bc32c0895.tar.gz
frameworks_base-906497c574d45d8dfd295b16dece0d0bc32c0895.tar.bz2
Hopefully fix issue #2662536: Why is launcher being killed?
It looks like there was a subtle bug where Process.setOomAdj() could return false just because the given process doesn't exist, even though it is documented to only return false if OOM killing is not supported at all. This would cause the activity manager to fall into its code path of trying to clean up processes itself, which it does a much poorer problem at. I am thinking we may be seeing this problem more now that the activity manager is killing background processes itself when there are too many of them. In addition, this change cleans up and reduces some of the logging around killing processes. Finally, try to improve process LRU management a bit by taking into account process dependencies. Any dependent processes are pulled up in the LRU list with the processes that is actually moving. Also, we bring a process up if someone accesses its content provider. Change-Id: I34ea161f839679345578ffe681e8d9c5d26ab948
Diffstat (limited to 'core/jni/android_util_Process.cpp')
-rw-r--r--core/jni/android_util_Process.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/core/jni/android_util_Process.cpp b/core/jni/android_util_Process.cpp
index e84f2e5..68be741 100644
--- a/core/jni/android_util_Process.cpp
+++ b/core/jni/android_util_Process.cpp
@@ -311,8 +311,8 @@ jboolean android_os_Process_setOomAdj(JNIEnv* env, jobject clazz,
sprintf(text, "%d", adj);
write(fd, text, strlen(text));
close(fd);
- return true;
}
+ return true;
}
#endif
return false;
@@ -797,6 +797,13 @@ void android_os_Process_sendSignal(JNIEnv* env, jobject clazz, jint pid, jint si
}
}
+void android_os_Process_sendSignalQuiet(JNIEnv* env, jobject clazz, jint pid, jint sig)
+{
+ if (pid > 0) {
+ kill(pid, sig);
+ }
+}
+
static jlong android_os_Process_getElapsedCpuTime(JNIEnv* env, jobject clazz)
{
struct timespec ts;
@@ -854,6 +861,7 @@ static const JNINativeMethod methods[] = {
{"setUid", "(I)I", (void*)android_os_Process_setUid},
{"setGid", "(I)I", (void*)android_os_Process_setGid},
{"sendSignal", "(II)V", (void*)android_os_Process_sendSignal},
+ {"sendSignalQuiet", "(II)V", (void*)android_os_Process_sendSignalQuiet},
{"supportsProcesses", "()Z", (void*)android_os_Process_supportsProcesses},
{"getFreeMemory", "()J", (void*)android_os_Process_getFreeMemory},
{"readProcLines", "(Ljava/lang/String;[Ljava/lang/String;[J)V", (void*)android_os_Process_readProcLines},