Initial commit

This commit is contained in:
2025-05-13 19:24:51 +02:00
commit a950f49678
10604 changed files with 932663 additions and 0 deletions

View File

@@ -0,0 +1,149 @@
package com.google.android.gms.common.data;
import android.graphics.Bitmap;
import android.os.Parcel;
import android.os.ParcelFileDescriptor;
import android.os.Parcelable;
import android.util.Log;
import com.google.android.gms.common.internal.ReflectedParcelable;
import com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable;
import com.google.android.gms.common.internal.safeparcel.SafeParcelWriter;
import java.io.BufferedOutputStream;
import java.io.Closeable;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.ByteBuffer;
/* loaded from: classes.dex */
public class BitmapTeleporter extends AbstractSafeParcelable implements ReflectedParcelable {
public static final Parcelable.Creator<BitmapTeleporter> CREATOR = new zaa();
private final int mType;
private final int zale;
private ParcelFileDescriptor zalf;
private Bitmap zalg;
private boolean zalh;
private File zali;
BitmapTeleporter(int i, ParcelFileDescriptor parcelFileDescriptor, int i2) {
this.zale = i;
this.zalf = parcelFileDescriptor;
this.mType = i2;
this.zalg = null;
this.zalh = false;
}
private static void zaa(Closeable closeable) {
try {
closeable.close();
} catch (IOException e) {
Log.w("BitmapTeleporter", "Could not close stream", e);
}
}
private final FileOutputStream zabz() {
File file = this.zali;
if (file == null) {
throw new IllegalStateException("setTempDir() must be called before writing this object to a parcel");
}
try {
File createTempFile = File.createTempFile("teleporter", ".tmp", file);
try {
FileOutputStream fileOutputStream = new FileOutputStream(createTempFile);
this.zalf = ParcelFileDescriptor.open(createTempFile, 268435456);
createTempFile.delete();
return fileOutputStream;
} catch (FileNotFoundException unused) {
throw new IllegalStateException("Temporary file is somehow already deleted");
}
} catch (IOException e) {
throw new IllegalStateException("Could not create temporary file", e);
}
}
public Bitmap get() {
if (!this.zalh) {
DataInputStream dataInputStream = new DataInputStream(new ParcelFileDescriptor.AutoCloseInputStream(this.zalf));
try {
try {
byte[] bArr = new byte[dataInputStream.readInt()];
int readInt = dataInputStream.readInt();
int readInt2 = dataInputStream.readInt();
Bitmap.Config valueOf = Bitmap.Config.valueOf(dataInputStream.readUTF());
dataInputStream.read(bArr);
zaa(dataInputStream);
ByteBuffer wrap = ByteBuffer.wrap(bArr);
Bitmap createBitmap = Bitmap.createBitmap(readInt, readInt2, valueOf);
createBitmap.copyPixelsFromBuffer(wrap);
this.zalg = createBitmap;
this.zalh = true;
} catch (IOException e) {
throw new IllegalStateException("Could not read from parcel file descriptor", e);
}
} catch (Throwable th) {
zaa(dataInputStream);
throw th;
}
}
return this.zalg;
}
public void release() {
if (this.zalh) {
return;
}
try {
this.zalf.close();
} catch (IOException e) {
Log.w("BitmapTeleporter", "Could not close PFD", e);
}
}
public void setTempDir(File file) {
if (file == null) {
throw new NullPointerException("Cannot set null temp directory");
}
this.zali = file;
}
@Override // android.os.Parcelable
public void writeToParcel(Parcel parcel, int i) {
if (this.zalf == null) {
Bitmap bitmap = this.zalg;
ByteBuffer allocate = ByteBuffer.allocate(bitmap.getRowBytes() * bitmap.getHeight());
bitmap.copyPixelsToBuffer(allocate);
byte[] array = allocate.array();
DataOutputStream dataOutputStream = new DataOutputStream(new BufferedOutputStream(zabz()));
try {
try {
dataOutputStream.writeInt(array.length);
dataOutputStream.writeInt(bitmap.getWidth());
dataOutputStream.writeInt(bitmap.getHeight());
dataOutputStream.writeUTF(bitmap.getConfig().toString());
dataOutputStream.write(array);
} catch (IOException e) {
throw new IllegalStateException("Could not write into unlinked file", e);
}
} finally {
zaa(dataOutputStream);
}
}
int a = SafeParcelWriter.a(parcel);
SafeParcelWriter.a(parcel, 1, this.zale);
SafeParcelWriter.a(parcel, 2, (Parcelable) this.zalf, i | 1, false);
SafeParcelWriter.a(parcel, 3, this.mType);
SafeParcelWriter.a(parcel, a);
this.zalf = null;
}
public BitmapTeleporter(Bitmap bitmap) {
this.zale = 1;
this.zalf = null;
this.mType = 0;
this.zalg = bitmap;
this.zalh = true;
}
}

View File

@@ -0,0 +1,416 @@
package com.google.android.gms.common.data;
import android.database.CharArrayBuffer;
import android.database.Cursor;
import android.database.CursorIndexOutOfBoundsException;
import android.database.CursorWindow;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
import android.util.Log;
import com.google.android.gms.common.annotation.KeepName;
import com.google.android.gms.common.internal.Preconditions;
import com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable;
import com.google.android.gms.common.internal.safeparcel.SafeParcelWriter;
import com.google.android.gms.common.sqlite.CursorWrapper;
import java.io.Closeable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@KeepName
/* loaded from: classes.dex */
public final class DataHolder extends AbstractSafeParcelable implements Closeable {
public static final Parcelable.Creator<DataHolder> CREATOR = new zac();
private static final Builder zalx = new zab(new String[0], null);
private boolean mClosed;
private final int zale;
private final String[] zalp;
private Bundle zalq;
private final CursorWindow[] zalr;
private final int zals;
private final Bundle zalt;
private int[] zalu;
private int zalv;
private boolean zalw;
public static class zaa extends RuntimeException {
public zaa(String str) {
super(str);
}
}
DataHolder(int i, String[] strArr, CursorWindow[] cursorWindowArr, int i2, Bundle bundle) {
this.mClosed = false;
this.zalw = true;
this.zale = i;
this.zalp = strArr;
this.zalr = cursorWindowArr;
this.zals = i2;
this.zalt = bundle;
}
public static Builder builder(String[] strArr) {
return new Builder(strArr, null, 0 == true ? 1 : 0);
}
public static DataHolder empty(int i) {
return new DataHolder(zalx, i, (Bundle) null);
}
private static CursorWindow[] zaa(CursorWrapper cursorWrapper) {
int i;
ArrayList arrayList = new ArrayList();
try {
int count = cursorWrapper.getCount();
CursorWindow window = cursorWrapper.getWindow();
if (window == null || window.getStartPosition() != 0) {
i = 0;
} else {
window.acquireReference();
cursorWrapper.a(null);
arrayList.add(window);
i = window.getNumRows();
}
while (i < count) {
if (!cursorWrapper.moveToPosition(i)) {
break;
}
CursorWindow window2 = cursorWrapper.getWindow();
if (window2 != null) {
window2.acquireReference();
cursorWrapper.a(null);
} else {
window2 = new CursorWindow(false);
window2.setStartPosition(i);
cursorWrapper.fillWindow(i, window2);
}
if (window2.getNumRows() == 0) {
break;
}
arrayList.add(window2);
i = window2.getStartPosition() + window2.getNumRows();
}
cursorWrapper.close();
return (CursorWindow[]) arrayList.toArray(new CursorWindow[arrayList.size()]);
} catch (Throwable th) {
cursorWrapper.close();
throw th;
}
}
@Override // java.io.Closeable, java.lang.AutoCloseable
public final void close() {
synchronized (this) {
if (!this.mClosed) {
this.mClosed = true;
for (int i = 0; i < this.zalr.length; i++) {
this.zalr[i].close();
}
}
}
}
protected final void finalize() throws Throwable {
try {
if (this.zalw && this.zalr.length > 0 && !isClosed()) {
close();
String obj = toString();
StringBuilder sb = new StringBuilder(String.valueOf(obj).length() + 178);
sb.append("Internal data leak within a DataBuffer object detected! Be sure to explicitly call release() on all DataBuffer extending objects when you are done with them. (internal object: ");
sb.append(obj);
sb.append(")");
Log.e("DataBuffer", sb.toString());
}
} finally {
super.finalize();
}
}
public final boolean getBoolean(String str, int i, int i2) {
zaa(str, i);
return Long.valueOf(this.zalr[i2].getLong(i, this.zalq.getInt(str))).longValue() == 1;
}
public final byte[] getByteArray(String str, int i, int i2) {
zaa(str, i);
return this.zalr[i2].getBlob(i, this.zalq.getInt(str));
}
public final int getCount() {
return this.zalv;
}
public final int getInteger(String str, int i, int i2) {
zaa(str, i);
return this.zalr[i2].getInt(i, this.zalq.getInt(str));
}
public final long getLong(String str, int i, int i2) {
zaa(str, i);
return this.zalr[i2].getLong(i, this.zalq.getInt(str));
}
public final Bundle getMetadata() {
return this.zalt;
}
public final int getStatusCode() {
return this.zals;
}
public final String getString(String str, int i, int i2) {
zaa(str, i);
return this.zalr[i2].getString(i, this.zalq.getInt(str));
}
public final int getWindowIndex(int i) {
int i2 = 0;
Preconditions.b(i >= 0 && i < this.zalv);
while (true) {
int[] iArr = this.zalu;
if (i2 >= iArr.length) {
break;
}
if (i < iArr[i2]) {
i2--;
break;
}
i2++;
}
return i2 == this.zalu.length ? i2 - 1 : i2;
}
public final boolean hasColumn(String str) {
return this.zalq.containsKey(str);
}
public final boolean hasNull(String str, int i, int i2) {
zaa(str, i);
return this.zalr[i2].isNull(i, this.zalq.getInt(str));
}
public final boolean isClosed() {
boolean z;
synchronized (this) {
z = this.mClosed;
}
return z;
}
@Override // android.os.Parcelable
public final void writeToParcel(Parcel parcel, int i) {
int a = SafeParcelWriter.a(parcel);
SafeParcelWriter.a(parcel, 1, this.zalp, false);
SafeParcelWriter.a(parcel, 2, (Parcelable[]) this.zalr, i, false);
SafeParcelWriter.a(parcel, 3, getStatusCode());
SafeParcelWriter.a(parcel, 4, getMetadata(), false);
SafeParcelWriter.a(parcel, 1000, this.zale);
SafeParcelWriter.a(parcel, a);
if ((i & 1) != 0) {
close();
}
}
public final double zab(String str, int i, int i2) {
zaa(str, i);
return this.zalr[i2].getDouble(i, this.zalq.getInt(str));
}
public final void zaca() {
this.zalq = new Bundle();
int i = 0;
int i2 = 0;
while (true) {
String[] strArr = this.zalp;
if (i2 >= strArr.length) {
break;
}
this.zalq.putInt(strArr[i2], i2);
i2++;
}
this.zalu = new int[this.zalr.length];
int i3 = 0;
while (true) {
CursorWindow[] cursorWindowArr = this.zalr;
if (i >= cursorWindowArr.length) {
this.zalv = i3;
return;
}
this.zalu[i] = i3;
i3 += this.zalr[i].getNumRows() - (i3 - cursorWindowArr[i].getStartPosition());
i++;
}
}
public static class Builder {
private final String[] a;
private final ArrayList<HashMap<String, Object>> b;
private Builder(String[] strArr, String str) {
Preconditions.a(strArr);
this.a = strArr;
this.b = new ArrayList<>();
new HashMap();
}
/* synthetic */ Builder(String[] strArr, String str, zab zabVar) {
this(strArr, null);
}
}
public DataHolder(String[] strArr, CursorWindow[] cursorWindowArr, int i, Bundle bundle) {
this.mClosed = false;
this.zalw = true;
this.zale = 1;
Preconditions.a(strArr);
this.zalp = strArr;
Preconditions.a(cursorWindowArr);
this.zalr = cursorWindowArr;
this.zals = i;
this.zalt = bundle;
zaca();
}
private DataHolder(CursorWrapper cursorWrapper, int i, Bundle bundle) {
this(cursorWrapper.getColumnNames(), zaa(cursorWrapper), i, bundle);
}
public DataHolder(Cursor cursor, int i, Bundle bundle) {
this(new CursorWrapper(cursor), i, bundle);
}
private DataHolder(Builder builder, int i, Bundle bundle) {
this(builder.a, zaa(builder, -1), i, (Bundle) null);
}
private DataHolder(Builder builder, int i, Bundle bundle, int i2) {
this(builder.a, zaa(builder, -1), i, bundle);
}
/* synthetic */ DataHolder(Builder builder, int i, Bundle bundle, zab zabVar) {
this(builder, i, (Bundle) null);
}
private static CursorWindow[] zaa(Builder builder, int i) {
if (builder.a.length == 0) {
return new CursorWindow[0];
}
List subList = (i < 0 || i >= builder.b.size()) ? builder.b : builder.b.subList(0, i);
int size = subList.size();
CursorWindow cursorWindow = new CursorWindow(false);
ArrayList arrayList = new ArrayList();
arrayList.add(cursorWindow);
cursorWindow.setNumColumns(builder.a.length);
CursorWindow cursorWindow2 = cursorWindow;
int i2 = 0;
boolean z = false;
while (i2 < size) {
try {
if (!cursorWindow2.allocRow()) {
StringBuilder sb = new StringBuilder(72);
sb.append("Allocating additional cursor window for large data set (row ");
sb.append(i2);
sb.append(")");
Log.d("DataHolder", sb.toString());
cursorWindow2 = new CursorWindow(false);
cursorWindow2.setStartPosition(i2);
cursorWindow2.setNumColumns(builder.a.length);
arrayList.add(cursorWindow2);
if (!cursorWindow2.allocRow()) {
Log.e("DataHolder", "Unable to allocate row to hold data.");
arrayList.remove(cursorWindow2);
return (CursorWindow[]) arrayList.toArray(new CursorWindow[arrayList.size()]);
}
}
Map map = (Map) subList.get(i2);
boolean z2 = true;
for (int i3 = 0; i3 < builder.a.length && z2; i3++) {
String str = builder.a[i3];
Object obj = map.get(str);
if (obj == null) {
z2 = cursorWindow2.putNull(i2, i3);
} else if (obj instanceof String) {
z2 = cursorWindow2.putString((String) obj, i2, i3);
} else if (obj instanceof Long) {
z2 = cursorWindow2.putLong(((Long) obj).longValue(), i2, i3);
} else if (obj instanceof Integer) {
z2 = cursorWindow2.putLong(((Integer) obj).intValue(), i2, i3);
} else if (obj instanceof Boolean) {
z2 = cursorWindow2.putLong(((Boolean) obj).booleanValue() ? 1L : 0L, i2, i3);
} else if (obj instanceof byte[]) {
z2 = cursorWindow2.putBlob((byte[]) obj, i2, i3);
} else if (obj instanceof Double) {
z2 = cursorWindow2.putDouble(((Double) obj).doubleValue(), i2, i3);
} else if (obj instanceof Float) {
z2 = cursorWindow2.putDouble(((Float) obj).floatValue(), i2, i3);
} else {
String valueOf = String.valueOf(obj);
StringBuilder sb2 = new StringBuilder(String.valueOf(str).length() + 32 + String.valueOf(valueOf).length());
sb2.append("Unsupported object for column ");
sb2.append(str);
sb2.append(": ");
sb2.append(valueOf);
throw new IllegalArgumentException(sb2.toString());
}
}
if (z2) {
z = false;
} else if (!z) {
StringBuilder sb3 = new StringBuilder(74);
sb3.append("Couldn't populate window data for row ");
sb3.append(i2);
sb3.append(" - allocating new window.");
Log.d("DataHolder", sb3.toString());
cursorWindow2.freeLastRow();
cursorWindow2 = new CursorWindow(false);
cursorWindow2.setStartPosition(i2);
cursorWindow2.setNumColumns(builder.a.length);
arrayList.add(cursorWindow2);
i2--;
z = true;
} else {
throw new zaa("Could not add the value to a new CursorWindow. The size of value may be larger than what a CursorWindow can handle.");
}
i2++;
} catch (RuntimeException e) {
int size2 = arrayList.size();
for (int i4 = 0; i4 < size2; i4++) {
((CursorWindow) arrayList.get(i4)).close();
}
throw e;
}
}
return (CursorWindow[]) arrayList.toArray(new CursorWindow[arrayList.size()]);
}
/* synthetic */ DataHolder(Builder builder, int i, Bundle bundle, int i2, zab zabVar) {
this(builder, i, bundle, -1);
}
private final void zaa(String str, int i) {
Bundle bundle = this.zalq;
if (bundle != null && bundle.containsKey(str)) {
if (!isClosed()) {
if (i < 0 || i >= this.zalv) {
throw new CursorIndexOutOfBoundsException(i, this.zalv);
}
return;
}
throw new IllegalArgumentException("Buffer is closed.");
}
String valueOf = String.valueOf(str);
throw new IllegalArgumentException(valueOf.length() != 0 ? "No such column: ".concat(valueOf) : new String("No such column: "));
}
public final float zaa(String str, int i, int i2) {
zaa(str, i);
return this.zalr[i2].getFloat(i, this.zalq.getInt(str));
}
public final void zaa(String str, int i, int i2, CharArrayBuffer charArrayBuffer) {
zaa(str, i);
this.zalr[i2].copyStringToBuffer(i, this.zalq.getInt(str), charArrayBuffer);
}
}

View File

@@ -0,0 +1,37 @@
package com.google.android.gms.common.data;
import android.os.Parcel;
import android.os.ParcelFileDescriptor;
import android.os.Parcelable;
import com.google.android.gms.common.internal.safeparcel.SafeParcelReader;
/* loaded from: classes.dex */
public final class zaa implements Parcelable.Creator<BitmapTeleporter> {
@Override // android.os.Parcelable.Creator
public final /* synthetic */ BitmapTeleporter createFromParcel(Parcel parcel) {
int b = SafeParcelReader.b(parcel);
int i = 0;
ParcelFileDescriptor parcelFileDescriptor = null;
int i2 = 0;
while (parcel.dataPosition() < b) {
int a = SafeParcelReader.a(parcel);
int a2 = SafeParcelReader.a(a);
if (a2 == 1) {
i = SafeParcelReader.x(parcel, a);
} else if (a2 == 2) {
parcelFileDescriptor = (ParcelFileDescriptor) SafeParcelReader.a(parcel, a, ParcelFileDescriptor.CREATOR);
} else if (a2 != 3) {
SafeParcelReader.C(parcel, a);
} else {
i2 = SafeParcelReader.x(parcel, a);
}
}
SafeParcelReader.q(parcel, b);
return new BitmapTeleporter(i, parcelFileDescriptor, i2);
}
@Override // android.os.Parcelable.Creator
public final /* synthetic */ BitmapTeleporter[] newArray(int i) {
return new BitmapTeleporter[i];
}
}

View File

@@ -0,0 +1,10 @@
package com.google.android.gms.common.data;
import com.google.android.gms.common.data.DataHolder;
/* loaded from: classes.dex */
final class zab extends DataHolder.Builder {
zab(String[] strArr, String str) {
super(strArr, null, null);
}
}

View File

@@ -0,0 +1,46 @@
package com.google.android.gms.common.data;
import android.database.CursorWindow;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
import com.google.android.gms.common.internal.safeparcel.SafeParcelReader;
/* loaded from: classes.dex */
public final class zac implements Parcelable.Creator<DataHolder> {
@Override // android.os.Parcelable.Creator
public final /* synthetic */ DataHolder createFromParcel(Parcel parcel) {
int b = SafeParcelReader.b(parcel);
String[] strArr = null;
CursorWindow[] cursorWindowArr = null;
Bundle bundle = null;
int i = 0;
int i2 = 0;
while (parcel.dataPosition() < b) {
int a = SafeParcelReader.a(parcel);
int a2 = SafeParcelReader.a(a);
if (a2 == 1) {
strArr = SafeParcelReader.o(parcel, a);
} else if (a2 == 2) {
cursorWindowArr = (CursorWindow[]) SafeParcelReader.b(parcel, a, CursorWindow.CREATOR);
} else if (a2 == 3) {
i2 = SafeParcelReader.x(parcel, a);
} else if (a2 == 4) {
bundle = SafeParcelReader.f(parcel, a);
} else if (a2 != 1000) {
SafeParcelReader.C(parcel, a);
} else {
i = SafeParcelReader.x(parcel, a);
}
}
SafeParcelReader.q(parcel, b);
DataHolder dataHolder = new DataHolder(i, strArr, cursorWindowArr, i2, bundle);
dataHolder.zaca();
return dataHolder;
}
@Override // android.os.Parcelable.Creator
public final /* synthetic */ DataHolder[] newArray(int i) {
return new DataHolder[i];
}
}