Use the BlobProvider in the contact and group sync jobs.

This commit is contained in:
Greyson Parrelli
2020-06-30 08:17:29 -07:00
committed by GitHub
parent 5c0cb425a6
commit 904cb01067
3 changed files with 95 additions and 35 deletions

View File

@@ -215,6 +215,20 @@ public class BlobProvider {
return null;
}
@WorkerThread
public long calculateFileSize(@NonNull Context context, @NonNull Uri uri) {
if (!isAuthority(uri)) {
return 0;
}
try (InputStream stream = getStream(context, uri)) {
return Util.getStreamLength(stream);
} catch (IOException e) {
Log.w(TAG, e);
return 0;
}
}
public static boolean isAuthority(@NonNull Uri uri) {
return URI_MATCHER.match(uri) == MATCH;
}