Use different exceptions for different crash reasons
Always throwing RemoteServiceException would make it impossible to tell the cause of a crash without the string message. Let's use a different exception type so developers can cluster crashes without the exception message. Bug: 124137635 Test: Treehugger Change-Id: Ibae57bdb1b8965241c41249a89c728d224e4e995
This commit is contained in:
@@ -79,18 +79,20 @@ public final class PasswordUtils extends com.android.settingslib.Utils {
|
||||
}
|
||||
|
||||
/** Crashes the calling application and provides it with {@code message}. */
|
||||
public static void crashCallingApplication(IBinder activityToken, String message) {
|
||||
public static void crashCallingApplication(IBinder activityToken, String message,
|
||||
int exceptionTypeId) {
|
||||
IActivityManager am = ActivityManager.getService();
|
||||
try {
|
||||
int uid = am.getLaunchedFromUid(activityToken);
|
||||
int userId = UserHandle.getUserId(uid);
|
||||
am.crashApplication(
|
||||
am.crashApplicationWithType(
|
||||
uid,
|
||||
/* initialPid= */ -1,
|
||||
getCallingAppPackageName(activityToken),
|
||||
userId,
|
||||
message,
|
||||
false);
|
||||
false,
|
||||
exceptionTypeId);
|
||||
} catch (RemoteException e) {
|
||||
Log.v(TAG, "Could not talk to activity manager.", e);
|
||||
}
|
||||
|
Reference in New Issue
Block a user