Merge "Create a new subreason to track when apps are killed because of excessive binder calls" into main
This commit is contained in:
committed by
Android (Google) Code Review
commit
111df8c46d
@@ -460,6 +460,14 @@ public final class ApplicationExitInfo implements Parcelable {
|
||||
*/
|
||||
public static final int SUBREASON_SDK_SANDBOX_NOT_NEEDED = 28;
|
||||
|
||||
/**
|
||||
* The process was killed because the binder proxy limit for system server was exceeded.
|
||||
*
|
||||
* For internal use only.
|
||||
* @hide
|
||||
*/
|
||||
public static final int SUBREASON_EXCESSIVE_BINDER_OBJECTS = 29;
|
||||
|
||||
// If there is any OEM code which involves additional app kill reasons, it should
|
||||
// be categorized in {@link #REASON_OTHER}, with subreason code starting from 1000.
|
||||
|
||||
@@ -635,6 +643,7 @@ public final class ApplicationExitInfo implements Parcelable {
|
||||
SUBREASON_KILL_BACKGROUND,
|
||||
SUBREASON_PACKAGE_UPDATE,
|
||||
SUBREASON_UNDELIVERED_BROADCAST,
|
||||
SUBREASON_EXCESSIVE_BINDER_OBJECTS,
|
||||
})
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface SubReason {}
|
||||
@@ -1360,6 +1369,8 @@ public final class ApplicationExitInfo implements Parcelable {
|
||||
return "PACKAGE UPDATE";
|
||||
case SUBREASON_UNDELIVERED_BROADCAST:
|
||||
return "UNDELIVERED BROADCAST";
|
||||
case SUBREASON_EXCESSIVE_BINDER_OBJECTS:
|
||||
return "EXCESSIVE BINDER OBJECTS";
|
||||
default:
|
||||
return "UNKNOWN";
|
||||
}
|
||||
|
||||
@@ -8138,8 +8138,8 @@ public class ActivityManagerService extends IActivityManager.Stub
|
||||
return killed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void killUid(int appId, int userId, String reason) {
|
||||
private void killUid(int appId, int userId, int reason, int subReason,
|
||||
String reasonAsString) {
|
||||
enforceCallingPermission(Manifest.permission.KILL_UID, "killUid");
|
||||
synchronized (this) {
|
||||
final long identity = Binder.clearCallingIdentity();
|
||||
@@ -8150,9 +8150,9 @@ public class ActivityManagerService extends IActivityManager.Stub
|
||||
true /* callerWillRestart */, true /* doit */,
|
||||
true /* evenPersistent */, false /* setRemoved */,
|
||||
false /* uninstalling */,
|
||||
ApplicationExitInfo.REASON_OTHER,
|
||||
ApplicationExitInfo.SUBREASON_KILL_UID,
|
||||
reason != null ? reason : "kill uid");
|
||||
reason,
|
||||
subReason,
|
||||
reasonAsString != null ? reasonAsString : "kill uid");
|
||||
}
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(identity);
|
||||
@@ -8160,6 +8160,12 @@ public class ActivityManagerService extends IActivityManager.Stub
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void killUid(int appId, int userId, String reason) {
|
||||
killUid(appId, userId, ApplicationExitInfo.REASON_OTHER,
|
||||
ApplicationExitInfo.SUBREASON_KILL_UID, reason);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void killUidForPermissionChange(int appId, int userId, String reason) {
|
||||
enforceCallingPermission(Manifest.permission.KILL_UID, "killUid");
|
||||
@@ -8675,6 +8681,8 @@ public class ActivityManagerService extends IActivityManager.Stub
|
||||
Slog.i(TAG, "Skipping kill (uid is SYSTEM)");
|
||||
} else {
|
||||
killUid(UserHandle.getAppId(uid), UserHandle.getUserId(uid),
|
||||
ApplicationExitInfo.REASON_EXCESSIVE_RESOURCE_USAGE,
|
||||
ApplicationExitInfo.SUBREASON_EXCESSIVE_BINDER_OBJECTS,
|
||||
"Too many Binders sent to SYSTEM");
|
||||
// We need to run a GC here, because killing the processes involved
|
||||
// actually isn't guaranteed to free up the proxies; in fact, if the
|
||||
|
||||
Reference in New Issue
Block a user