- Added realracing3-community.apk (71.57 MB) - Removed 32-bit support (armeabi-v7a) - Only includes arm64-v8a libraries - Decompiled source code included - Added README-community.md with analysis
116 lines
4.8 KiB
Java
116 lines
4.8 KiB
Java
package com.facebook;
|
|
|
|
import android.os.Handler;
|
|
import com.facebook.GraphRequestBatch;
|
|
import java.io.FilterOutputStream;
|
|
import java.io.IOException;
|
|
import java.io.OutputStream;
|
|
import java.util.Iterator;
|
|
import java.util.Map;
|
|
import kotlin.jvm.internal.Intrinsics;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public final class ProgressOutputStream extends FilterOutputStream implements RequestOutputStream {
|
|
private long batchProgress;
|
|
private RequestProgress currentRequestProgress;
|
|
private long lastReportedProgress;
|
|
private final long maxProgress;
|
|
private final Map<GraphRequest, RequestProgress> progressMap;
|
|
private final GraphRequestBatch requests;
|
|
private final long threshold;
|
|
|
|
public final long getBatchProgress() {
|
|
return this.batchProgress;
|
|
}
|
|
|
|
public final long getMaxProgress() {
|
|
return this.maxProgress;
|
|
}
|
|
|
|
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
|
|
public ProgressOutputStream(OutputStream out, GraphRequestBatch requests, Map<GraphRequest, RequestProgress> progressMap, long j) {
|
|
super(out);
|
|
Intrinsics.checkNotNullParameter(out, "out");
|
|
Intrinsics.checkNotNullParameter(requests, "requests");
|
|
Intrinsics.checkNotNullParameter(progressMap, "progressMap");
|
|
this.requests = requests;
|
|
this.progressMap = progressMap;
|
|
this.maxProgress = j;
|
|
this.threshold = FacebookSdk.getOnProgressThreshold();
|
|
}
|
|
|
|
private final void addProgress(long j) {
|
|
RequestProgress requestProgress = this.currentRequestProgress;
|
|
if (requestProgress != null) {
|
|
requestProgress.addProgress(j);
|
|
}
|
|
long j2 = this.batchProgress + j;
|
|
this.batchProgress = j2;
|
|
if (j2 >= this.lastReportedProgress + this.threshold || j2 >= this.maxProgress) {
|
|
reportBatchProgress();
|
|
}
|
|
}
|
|
|
|
private final void reportBatchProgress() {
|
|
if (this.batchProgress > this.lastReportedProgress) {
|
|
for (final GraphRequestBatch.Callback callback : this.requests.getCallbacks()) {
|
|
if (callback instanceof GraphRequestBatch.OnProgressCallback) {
|
|
Handler callbackHandler = this.requests.getCallbackHandler();
|
|
if ((callbackHandler == null ? null : Boolean.valueOf(callbackHandler.post(new Runnable() { // from class: com.facebook.ProgressOutputStream$$ExternalSyntheticLambda0
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
ProgressOutputStream.m439reportBatchProgress$lambda0(GraphRequestBatch.Callback.this, this);
|
|
}
|
|
}))) == null) {
|
|
((GraphRequestBatch.OnProgressCallback) callback).onBatchProgress(this.requests, this.batchProgress, this.maxProgress);
|
|
}
|
|
}
|
|
}
|
|
this.lastReportedProgress = this.batchProgress;
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
/* renamed from: reportBatchProgress$lambda-0, reason: not valid java name */
|
|
public static final void m439reportBatchProgress$lambda0(GraphRequestBatch.Callback callback, ProgressOutputStream this$0) {
|
|
Intrinsics.checkNotNullParameter(callback, "$callback");
|
|
Intrinsics.checkNotNullParameter(this$0, "this$0");
|
|
((GraphRequestBatch.OnProgressCallback) callback).onBatchProgress(this$0.requests, this$0.getBatchProgress(), this$0.getMaxProgress());
|
|
}
|
|
|
|
@Override // com.facebook.RequestOutputStream
|
|
public void setCurrentRequest(GraphRequest graphRequest) {
|
|
this.currentRequestProgress = graphRequest != null ? this.progressMap.get(graphRequest) : null;
|
|
}
|
|
|
|
@Override // java.io.FilterOutputStream, java.io.OutputStream
|
|
public void write(byte[] buffer) throws IOException {
|
|
Intrinsics.checkNotNullParameter(buffer, "buffer");
|
|
((FilterOutputStream) this).out.write(buffer);
|
|
addProgress(buffer.length);
|
|
}
|
|
|
|
@Override // java.io.FilterOutputStream, java.io.OutputStream
|
|
public void write(byte[] buffer, int i, int i2) throws IOException {
|
|
Intrinsics.checkNotNullParameter(buffer, "buffer");
|
|
((FilterOutputStream) this).out.write(buffer, i, i2);
|
|
addProgress(i2);
|
|
}
|
|
|
|
@Override // java.io.FilterOutputStream, java.io.OutputStream
|
|
public void write(int i) throws IOException {
|
|
((FilterOutputStream) this).out.write(i);
|
|
addProgress(1L);
|
|
}
|
|
|
|
@Override // java.io.FilterOutputStream, java.io.OutputStream, java.io.Closeable, java.lang.AutoCloseable
|
|
public void close() throws IOException {
|
|
super.close();
|
|
Iterator<RequestProgress> it = this.progressMap.values().iterator();
|
|
while (it.hasNext()) {
|
|
it.next().reportProgress();
|
|
}
|
|
reportBatchProgress();
|
|
}
|
|
}
|