More sensible return code for Credentials.deleteAll

Was: result = True iff nDeleted != 0
Now: result = True iff nDeleted == nExisted

The most common reason you'd want to delete all credentials under an
alias is to be sure they no longer exist. The new contract gives a
way to do this without multiple IPCs to the same service.

Bug: 27335182
Change-Id: I8762b9b4fcc48037387dd805dbd0dbbe141d5b24
This commit is contained in:
Robin Lee
2016-02-29 17:43:54 +00:00
parent 42d8b7d7ab
commit e4487ea288
3 changed files with 20 additions and 24 deletions

View File

@@ -183,7 +183,8 @@ public class KeyStore {
public boolean delete(String key, int uid) {
try {
return mBinder.del(key, uid) == NO_ERROR;
int ret = mBinder.del(key, uid);
return (ret == NO_ERROR || ret == KEY_NOT_FOUND);
} catch (RemoteException e) {
Log.w(TAG, "Cannot connect to keystore", e);
return false;