Move proxy debug info dumping back to Java.
This had to be called from native because serialization was done from native, but now that serialization is in Java we can move this back to a more logical place. Also, this allows us to dump the per-UID proxy counts in this situation again. Bug: 109888955 Test: sailfish builds, proxy debug info shown on hitting limits Merged-In: I4e06b3f93e30ed1c7868ec9e018709a7e796e441 Change-Id: I4e06b3f93e30ed1c7868ec9e018709a7e796e441
This commit is contained in:
committed by
Andreas Gampe
parent
345d4c16bb
commit
c1493b283b
@@ -353,13 +353,12 @@ public final class BinderProxy implements IBinder {
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
private static void dumpProxyDebugInfo() {
|
||||
public static void dumpProxyDebugInfo() {
|
||||
if (Build.IS_DEBUGGABLE) {
|
||||
sProxyMap.dumpProxyInterfaceCounts();
|
||||
// Note that we don't call dumpPerUidProxyCounts(); this is because this
|
||||
// method may be called as part of the uid limit being hit, and calling
|
||||
// back into the UID tracking code would cause us to try to acquire a mutex
|
||||
// that is held during that callback.
|
||||
synchronized (sProxyMap) {
|
||||
sProxyMap.dumpProxyInterfaceCounts();
|
||||
sProxyMap.dumpPerUidProxyCounts();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -110,7 +110,6 @@ static struct binderproxy_offsets_t
|
||||
jclass mClass;
|
||||
jmethodID mGetInstance;
|
||||
jmethodID mSendDeathNotice;
|
||||
jmethodID mDumpProxyDebugInfo;
|
||||
|
||||
// Object state.
|
||||
jfieldID mNativeData; // Field holds native pointer to BinderProxyNativeData.
|
||||
@@ -1038,18 +1037,6 @@ static void android_os_BinderInternal_handleGc(JNIEnv* env, jobject clazz)
|
||||
static void android_os_BinderInternal_proxyLimitcallback(int uid)
|
||||
{
|
||||
JNIEnv *env = AndroidRuntime::getJNIEnv();
|
||||
{
|
||||
// Calls into BinderProxy must be serialized
|
||||
AutoMutex _l(gProxyLock);
|
||||
env->CallStaticObjectMethod(gBinderProxyOffsets.mClass,
|
||||
gBinderProxyOffsets.mDumpProxyDebugInfo);
|
||||
}
|
||||
if (env->ExceptionCheck()) {
|
||||
ScopedLocalRef<jthrowable> excep(env, env->ExceptionOccurred());
|
||||
report_exception(env, excep.get(),
|
||||
"*** Uncaught exception in dumpProxyDebugInfo");
|
||||
}
|
||||
|
||||
env->CallStaticVoidMethod(gBinderInternalOffsets.mClass,
|
||||
gBinderInternalOffsets.mProxyLimitCallback,
|
||||
uid);
|
||||
@@ -1439,8 +1426,6 @@ static int int_register_android_os_BinderProxy(JNIEnv* env)
|
||||
"(JJ)Landroid/os/BinderProxy;");
|
||||
gBinderProxyOffsets.mSendDeathNotice = GetStaticMethodIDOrDie(env, clazz, "sendDeathNotice",
|
||||
"(Landroid/os/IBinder$DeathRecipient;)V");
|
||||
gBinderProxyOffsets.mDumpProxyDebugInfo = GetStaticMethodIDOrDie(env, clazz, "dumpProxyDebugInfo",
|
||||
"()V");
|
||||
gBinderProxyOffsets.mNativeData = GetFieldIDOrDie(env, clazz, "mNativeData", "J");
|
||||
|
||||
clazz = FindClassOrDie(env, "java/lang/Class");
|
||||
|
||||
@@ -15211,6 +15211,7 @@ public class ActivityManagerService extends IActivityManager.Stub
|
||||
public void onLimitReached(int uid) {
|
||||
Slog.wtf(TAG, "Uid " + uid + " sent too many Binders to uid "
|
||||
+ Process.myUid());
|
||||
BinderProxy.dumpProxyDebugInfo();
|
||||
if (uid == Process.SYSTEM_UID) {
|
||||
Slog.i(TAG, "Skipping kill (uid is SYSTEM)");
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user