mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-21 00:59:49 +01:00
Use the BlobProvider in the contact and group sync jobs.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user