reset last updated and keyserver status on change of keyserver preference

This commit is contained in:
Vincent Breitmoser
2017-07-24 12:11:56 +02:00
parent ef6921210c
commit bff6b98e0b
4 changed files with 74 additions and 15 deletions

View File

@@ -1363,4 +1363,11 @@ public class KeyWritableRepository extends KeyRepository {
return mContentResolver.insert(UpdatedKeys.CONTENT_URI, values);
}
public void resetAllLastUpdatedTimes() {
ContentValues values = new ContentValues();
values.putNull(UpdatedKeys.LAST_UPDATED);
values.putNull(UpdatedKeys.SEEN_ON_KEYSERVERS);
mContentResolver.update(UpdatedKeys.CONTENT_URI, values, null, null);
}
}

View File

@@ -916,6 +916,19 @@ public class KeychainProvider extends ContentProvider {
buildDefaultApiAppsSelection(uri, selection), selectionArgs);
break;
}
case UPDATED_KEYS: {
if (values.size() != 2 ||
!values.containsKey(UpdatedKeys.SEEN_ON_KEYSERVERS) ||
!values.containsKey(UpdatedKeys.LAST_UPDATED) ||
values.get(UpdatedKeys.LAST_UPDATED) != null ||
values.get(UpdatedKeys.SEEN_ON_KEYSERVERS) != null ||
selection != null || selectionArgs != null) {
throw new UnsupportedOperationException("can only reset all keys");
}
db.update(Tables.UPDATED_KEYS, values, null, null);
break;
}
default: {
throw new UnsupportedOperationException("Unknown uri: " + uri);
}