Skip to content

Commit

Permalink
- Change to show exception correctly when logging errors in several c…
Browse files Browse the repository at this point in the history
…ases
  • Loading branch information
KVVat committed Apr 16, 2024
1 parent 19ed20c commit 2b7e8fb
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ public boolean runPermissionTest(String permission, PermissionTest test,
} catch (UnexpectedPermissionTestFailureException e) {

testPassed = false;
mLogger.logInfo(permission + "/"+ e.getMessage());
mLogger.logInfo(permission + "/"+ e.getMessage(),e);
} catch (Throwable t) {
// Any other Throwable indicates the test did not fail due to a SecurityException;
// treat the API as successful if the caller specified exceptions are allowed.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1190,7 +1190,7 @@ public void onServiceConnected(ComponentName name, IBinder binder) {
} catch (RemoteException e) {
binderSuccess.set(false);
//e.printStackTrace();
mLogger.logError(name+" failure."+e.getMessage());
mLogger.logError(name+" failure."+e.getMessage(),e);
}
lock.notify();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5492,7 +5492,7 @@ public void onServiceConnected(ComponentName name, IBinder binder) {
} catch (RemoteException e) {
binderSuccess.set(false);
//e.printStackTrace();
mLogger.logError(name+" failure."+e.getMessage());
mLogger.logError(name+" failure."+e.getMessage(),e);
}
lock.notify();
}
Expand Down Expand Up @@ -5785,25 +5785,24 @@ public boolean runPermissionTest(String permission, PermissionTest test) {
// should have been thrown so the result of the test should be the opposite of
// whether the permission was granted.
mLogger.logDebug(
"Caught a SecurityException for permission " + permission + ": ", e);
"Caught a SecurityException for permission " + permission, e);
if (e.getCause() != null) {
mLogger.logDebug("Cause of SecurityException: ", e.getCause());
}
testPassed = getAndLogTestStatus(permission, permissionGranted, false);
} catch (BypassTestException bte) {
mLogger.logTestSkipped(permission, permissionGranted, bte.getMessage());
} catch (UnexpectedPermissionTestFailureException e) {
//mLogger.logTestSkipped(permission, permissionGranted, bte.getMessage())
mLogger.logDebug(
"Caught a UnexpectedPermissionTestFailureException for permission " + permission + ": ", e);
"Caught a UnexpectedPermissionTestFailureException for permission " + permission , e);
testPassed = getAndLogTestStatus(permission, permissionGranted, false);;
} catch (Throwable t) {
// Some of the signature / privileged tests can fail for other reasons (primarily
// due to the test app not having access to all necessary classes to invoke the
// APIs guarded by signature permissions), but if they make it past the
// SecurityException then the API should be considered successfully invoked.
if (Constants.DEBUG) {
mLogger.logDebug("Caught a Throwable for permission " + permission + ": ", t);
mLogger.logDebug("Caught a Throwable for permission " + permission , t);
}
testPassed = getAndLogTestStatus(permission, permissionGranted, true);
}
Expand Down

0 comments on commit 2b7e8fb

Please sign in to comment.