Merge "Make IKeyChainAliasCallback oneway"

This commit is contained in:
TreeHugger Robot
2017-02-27 16:39:52 +00:00
committed by Android (Google) Code Review
2 changed files with 10 additions and 14 deletions

View File

@@ -20,7 +20,7 @@ package android.security;
*
* @hide
*/
interface IKeyChainAliasCallback {
oneway interface IKeyChainAliasCallback {
void alias(String alias);
}

View File

@@ -4851,19 +4851,15 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
private void sendPrivateKeyAliasResponse(final String alias, final IBinder responseBinder) {
final IKeyChainAliasCallback keyChainAliasResponse =
IKeyChainAliasCallback.Stub.asInterface(responseBinder);
new AsyncTask<Void, Void, Void>() {
@Override
protected Void doInBackground(Void... unused) {
try {
keyChainAliasResponse.alias(alias);
} catch (Exception e) {
// Catch everything (not just RemoteException): caller could throw a
// RuntimeException back across processes.
Log.e(LOG_TAG, "error while responding to callback", e);
}
return null;
}
}.execute();
// Send the response. It's OK to do this from the main thread because IKeyChainAliasCallback
// is oneway, which means it won't block if the recipient lives in another process.
try {
keyChainAliasResponse.alias(alias);
} catch (Exception e) {
// Caller could throw RuntimeException or RemoteException back across processes. Catch
// everything just to be sure.
Log.e(LOG_TAG, "error while responding to callback", e);
}
}
/**