2021-08-09 22:50:52 +00:00
|
|
|
package c.f.j.p;
|
|
|
|
|
|
|
|
import android.content.ContentResolver;
|
|
|
|
import android.database.Cursor;
|
|
|
|
import android.graphics.Rect;
|
|
|
|
import android.media.ExifInterface;
|
|
|
|
import android.net.Uri;
|
|
|
|
import android.provider.MediaStore;
|
|
|
|
import c.f.d.e.a;
|
|
|
|
import c.f.d.g.g;
|
|
|
|
import c.f.d.l.b;
|
|
|
|
import c.f.j.j.e;
|
|
|
|
import com.airbnb.lottie.parser.AnimatableValueParser;
|
|
|
|
import com.facebook.imagepipeline.request.ImageRequest;
|
|
|
|
import java.io.File;
|
|
|
|
import java.io.FileInputStream;
|
|
|
|
import java.io.IOException;
|
|
|
|
import java.util.concurrent.Executor;
|
|
|
|
/* compiled from: LocalContentUriThumbnailFetchProducer */
|
|
|
|
public class f0 extends g0 implements j1<e> {
|
|
|
|
|
|
|
|
/* renamed from: c reason: collision with root package name */
|
2021-09-21 07:33:49 +00:00
|
|
|
public static final String[] f481c = {"_id", "_data"};
|
2021-08-09 22:50:52 +00:00
|
|
|
public static final String[] d = {"_data"};
|
|
|
|
public static final Rect e = new Rect(0, 0, 512, 384);
|
|
|
|
public static final Rect f = new Rect(0, 0, 96, 96);
|
|
|
|
public final ContentResolver g;
|
|
|
|
|
|
|
|
public f0(Executor executor, g gVar, ContentResolver contentResolver) {
|
|
|
|
super(executor, gVar);
|
|
|
|
this.g = contentResolver;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // c.f.j.p.j1
|
|
|
|
public boolean a(c.f.j.d.e eVar) {
|
|
|
|
Rect rect = e;
|
|
|
|
return AnimatableValueParser.n1(rect.width(), rect.height(), eVar);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // c.f.j.p.g0
|
|
|
|
public e d(ImageRequest imageRequest) throws IOException {
|
|
|
|
c.f.j.d.e eVar;
|
|
|
|
Cursor query;
|
|
|
|
e f2;
|
2021-09-21 07:33:49 +00:00
|
|
|
Uri uri = imageRequest.f2261c;
|
|
|
|
if (!b.b(uri) || (eVar = imageRequest.i) == null || (query = this.g.query(uri, f481c, null, null, null)) == null) {
|
2021-08-09 22:50:52 +00:00
|
|
|
return null;
|
|
|
|
}
|
|
|
|
try {
|
|
|
|
if (!query.moveToFirst() || (f2 = f(eVar, query.getLong(query.getColumnIndex("_id")))) == null) {
|
|
|
|
query.close();
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
String string = query.getString(query.getColumnIndex("_data"));
|
|
|
|
int i = 0;
|
|
|
|
if (string != null) {
|
|
|
|
try {
|
|
|
|
i = AnimatableValueParser.u0(new ExifInterface(string).getAttributeInt(androidx.exifinterface.media.ExifInterface.TAG_ORIENTATION, 1));
|
|
|
|
} catch (IOException e2) {
|
|
|
|
a.d(f0.class, e2, "Unable to retrieve thumbnail rotation for %s", string);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
f2.l = i;
|
|
|
|
return f2;
|
|
|
|
} finally {
|
|
|
|
query.close();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // c.f.j.p.g0
|
|
|
|
public String e() {
|
|
|
|
return "LocalContentUriThumbnailFetchProducer";
|
|
|
|
}
|
|
|
|
|
|
|
|
public final e f(c.f.j.d.e eVar, long j) throws IOException {
|
|
|
|
int i;
|
|
|
|
Cursor queryMiniThumbnail;
|
|
|
|
Rect rect = f;
|
|
|
|
if (AnimatableValueParser.n1(rect.width(), rect.height(), eVar)) {
|
|
|
|
i = 3;
|
|
|
|
} else {
|
|
|
|
Rect rect2 = e;
|
|
|
|
i = AnimatableValueParser.n1(rect2.width(), rect2.height(), eVar) ? 1 : 0;
|
|
|
|
}
|
|
|
|
if (i == 0 || (queryMiniThumbnail = MediaStore.Images.Thumbnails.queryMiniThumbnail(this.g, j, i, d)) == null) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
try {
|
|
|
|
if (queryMiniThumbnail.moveToFirst()) {
|
|
|
|
String string = queryMiniThumbnail.getString(queryMiniThumbnail.getColumnIndex("_data"));
|
|
|
|
if (new File(string).exists()) {
|
|
|
|
return c(new FileInputStream(string), string == null ? -1 : (int) new File(string).length());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
queryMiniThumbnail.close();
|
|
|
|
return null;
|
|
|
|
} finally {
|
|
|
|
queryMiniThumbnail.close();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|