package p138.p176.p177.p242.p265.p266;

import android.os.Binder;
import android.text.TextUtils;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import p000.p001.p002.p003.p004.C0567;
import p138.p176.p177.p242.p246.C4198;
import p138.p176.p177.p242.p246.C4199;
import p138.p176.p177.p242.p246.p251.C4303;
import p138.p176.p177.p242.p246.p253.C4312;

/* JADX INFO: renamed from: ދ.ހ.֏.ހ.ބ.֏.Ι, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
public final class BinderC4836 extends AbstractBinderC4949 {

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final C4889 f14547;

    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public Boolean f14548;

    /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
    public String f14549;

    public BinderC4836(C4889 c4889) {
        C0567.m1910(c4889);
        this.f14547 = c4889;
        this.f14549 = null;
    }

    @Override // p138.p176.p177.p242.p265.p266.InterfaceC4823
    /* JADX INFO: renamed from: ֏ */
    public final List<C4891> mo8092(String str, String str2, String str3) {
        m8146(str, true);
        try {
            return (List) ((FutureTask) this.f14547.mo8163().m8003(new CallableC4820(this, str, str2, str3))).get();
        } catch (InterruptedException | ExecutionException e) {
            this.f14547.mo8165().f14444.m8035("Failed to get conditional user properties as", e);
            return Collections.emptyList();
        }
    }

    @Override // p138.p176.p177.p242.p265.p266.InterfaceC4823
    /* JADX INFO: renamed from: ֏ */
    public final List<C4999> mo8093(String str, String str2, String str3, boolean z) {
        m8146(str, true);
        try {
            List<C5036> list = (List) ((FutureTask) this.f14547.mo8163().m8003(new CallableC4752(this, str, str2, str3))).get();
            ArrayList arrayList = new ArrayList(list.size());
            for (C5036 c5036 : list) {
                if (z || !C4887.m8234(c5036.f15173)) {
                    arrayList.add(new C4999(c5036));
                }
            }
            return arrayList;
        } catch (InterruptedException | ExecutionException e) {
            this.f14547.mo8165().f14444.m8036("Failed to get user properties as. appId", C4794.m8038(str), e);
            return Collections.emptyList();
        }
    }

    @Override // p138.p176.p177.p242.p265.p266.InterfaceC4823
    /* JADX INFO: renamed from: ֏ */
    public final List<C4891> mo8094(String str, String str2, C4977 c4977) {
        m8147(c4977);
        try {
            return (List) ((FutureTask) this.f14547.mo8163().m8003(new CallableC4857(this, c4977, str, str2))).get();
        } catch (InterruptedException | ExecutionException e) {
            this.f14547.mo8165().f14444.m8035("Failed to get conditional user properties", e);
            return Collections.emptyList();
        }
    }

    @Override // p138.p176.p177.p242.p265.p266.InterfaceC4823
    /* JADX INFO: renamed from: ֏ */
    public final List<C4999> mo8095(String str, String str2, boolean z, C4977 c4977) {
        m8147(c4977);
        try {
            List<C5036> list = (List) ((FutureTask) this.f14547.mo8163().m8003(new CallableC4760(this, c4977, str, str2))).get();
            ArrayList arrayList = new ArrayList(list.size());
            for (C5036 c5036 : list) {
                if (z || !C4887.m8234(c5036.f15173)) {
                    arrayList.add(new C4999(c5036));
                }
            }
            return arrayList;
        } catch (InterruptedException | ExecutionException e) {
            this.f14547.mo8165().f14444.m8036("Failed to query user properties. appId", C4794.m8038(c4977.f15049), e);
            return Collections.emptyList();
        }
    }

    @Override // p138.p176.p177.p242.p265.p266.InterfaceC4823
    /* JADX INFO: renamed from: ֏ */
    public final List<C4999> mo8096(C4977 c4977, boolean z) {
        m8147(c4977);
        try {
            List<C5036> list = (List) ((FutureTask) this.f14547.mo8163().m8003(new CallableC4851(this, c4977))).get();
            ArrayList arrayList = new ArrayList(list.size());
            for (C5036 c5036 : list) {
                if (z || !C4887.m8234(c5036.f15173)) {
                    arrayList.add(new C4999(c5036));
                }
            }
            return arrayList;
        } catch (InterruptedException | ExecutionException e) {
            this.f14547.mo8165().f14444.m8036("Failed to get user properties. appId", C4794.m8038(c4977.f15049), e);
            return null;
        }
    }

    @Override // p138.p176.p177.p242.p265.p266.InterfaceC4823
    /* JADX INFO: renamed from: ֏ */
    public final void mo8097(long j, String str, String str2, String str3) {
        m8145(new RunnableC4864(this, str2, str3, str, j));
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final void m8145(Runnable runnable) {
        C0567.m1910(runnable);
        if (this.f14547.mo8163().m8010()) {
            runnable.run();
            return;
        }
        C4771 c4771Mo8163 = this.f14547.mo8163();
        c4771Mo8163.m8482();
        C0567.m1910(runnable);
        c4771Mo8163.m8005(new C4894<>(c4771Mo8163, runnable, "Task exception on worker thread"));
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final void m8146(String str, boolean z) {
        if (TextUtils.isEmpty(str)) {
            this.f14547.mo8165().f14444.m8034("Measurement Service called without app package");
            throw new SecurityException("Measurement Service called without app package");
        }
        if (z) {
            try {
                if (this.f14548 == null) {
                    this.f14548 = Boolean.valueOf("com.google.android.gms".equals(this.f14549) || C4303.m7124(this.f14547.f14718.f15009, Binder.getCallingUid()) || C4199.m6857(this.f14547.f14718.f15009).m6860(Binder.getCallingUid()));
                }
                if (this.f14548.booleanValue()) {
                    return;
                }
            } catch (SecurityException e) {
                this.f14547.mo8165().f14444.m8035("Measurement Service called with invalid calling package. appId", C4794.m8038(str));
                throw e;
            }
        }
        if (this.f14549 == null && C4198.m6853(this.f14547.f14718.f15009, Binder.getCallingUid(), str)) {
            this.f14549 = str;
        }
        if (str.equals(this.f14549)) {
        } else {
            throw new SecurityException(String.format("Unknown calling package name '%s'.", str));
        }
    }

    @Override // p138.p176.p177.p242.p265.p266.InterfaceC4823
    /* JADX INFO: renamed from: ֏ */
    public final void mo8098(C4891 c4891) {
        C0567.m1910(c4891);
        C0567.m1910(c4891.f14739);
        m8146(c4891.f14737, true);
        m8145(new RunnableC4863(this, new C4891(c4891)));
    }

    @Override // p138.p176.p177.p242.p265.p266.InterfaceC4823
    /* JADX INFO: renamed from: ֏ */
    public final void mo8099(C4891 c4891, C4977 c4977) {
        C0567.m1910(c4891);
        C0567.m1910(c4891.f14739);
        m8147(c4977);
        C4891 c48912 = new C4891(c4891);
        c48912.f14737 = c4977.f15049;
        m8145(new RunnableC4939(this, c48912, c4977));
    }

    @Override // p138.p176.p177.p242.p265.p266.InterfaceC4823
    /* JADX INFO: renamed from: ֏ */
    public final void mo8100(C4913 c4913, String str, String str2) {
        C0567.m1910(c4913);
        C0567.m1926(str);
        m8146(str, true);
        m8145(new RunnableC4860(this, c4913, str));
    }

    @Override // p138.p176.p177.p242.p265.p266.InterfaceC4823
    /* JADX INFO: renamed from: ֏ */
    public final void mo8101(C4913 c4913, C4977 c4977) {
        C0567.m1910(c4913);
        m8147(c4977);
        m8145(new RunnableC4840(this, c4913, c4977));
    }

    @Override // p138.p176.p177.p242.p265.p266.InterfaceC4823
    /* JADX INFO: renamed from: ֏ */
    public final void mo8102(C4977 c4977) {
        m8147(c4977);
        m8145(new RunnableC4773(this, c4977));
    }

    @Override // p138.p176.p177.p242.p265.p266.InterfaceC4823
    /* JADX INFO: renamed from: ֏ */
    public final void mo8103(C4999 c4999, C4977 c4977) {
        C0567.m1910(c4999);
        m8147(c4977);
        m8145(new RunnableC4848(this, c4999, c4977));
    }

    @Override // p138.p176.p177.p242.p265.p266.InterfaceC4823
    /* JADX INFO: renamed from: ֏ */
    public final byte[] mo8104(C4913 c4913, String str) {
        C0567.m1926(str);
        C0567.m1910(c4913);
        m8146(str, true);
        this.f14547.mo8165().f14451.m8035("Log and bundle. event", this.f14547.m8304().m8110(c4913.f14822));
        if (((C4312) this.f14547.f14718.f15022) == null) {
            throw null;
        }
        long jNanoTime = System.nanoTime() / 1000000;
        C4771 c4771Mo8163 = this.f14547.mo8163();
        CallableC4762 callableC4762 = new CallableC4762(this, c4913, str);
        c4771Mo8163.m8482();
        C0567.m1910(callableC4762);
        C4894<?> c4894 = new C4894<>(c4771Mo8163, callableC4762, true, "Task exception on worker thread");
        if (Thread.currentThread() == c4771Mo8163.f14381) {
            c4894.run();
        } else {
            c4771Mo8163.m8005(c4894);
        }
        try {
            byte[] bArr = (byte[]) c4894.get();
            if (bArr == null) {
                this.f14547.mo8165().f14444.m8035("Log and bundle returned null. appId", C4794.m8038(str));
                bArr = new byte[0];
            }
            if (((C4312) this.f14547.f14718.f15022) == null) {
                throw null;
            }
            this.f14547.mo8165().f14451.m8037("Log and bundle processed. event, size, time_ms", this.f14547.m8304().m8110(c4913.f14822), Integer.valueOf(bArr.length), Long.valueOf((System.nanoTime() / 1000000) - jNanoTime));
            return bArr;
        } catch (InterruptedException | ExecutionException e) {
            this.f14547.mo8165().f14444.m8037("Failed to log and bundle. appId, event, error", C4794.m8038(str), this.f14547.m8304().m8110(c4913.f14822), e);
            return null;
        }
    }

    @Override // p138.p176.p177.p242.p265.p266.InterfaceC4823
    /* JADX INFO: renamed from: ؠ */
    public final String mo8105(C4977 c4977) {
        m8147(c4977);
        C4889 c4889 = this.f14547;
        try {
            return (String) ((FutureTask) c4889.f14718.mo8163().m8003(new CallableC4761(c4889, c4977))).get(30000L, TimeUnit.MILLISECONDS);
        } catch (InterruptedException | ExecutionException | TimeoutException e) {
            c4889.f14718.mo8165().f14444.m8036("Failed to get app instance id. appId", C4794.m8038(c4977.f15049), e);
            return null;
        }
    }

    @Override // p138.p176.p177.p242.p265.p266.InterfaceC4823
    /* JADX INFO: renamed from: ހ */
    public final void mo8106(C4977 c4977) {
        m8146(c4977.f15049, false);
        m8145(new RunnableC4982(this, c4977));
    }

    @Override // p138.p176.p177.p242.p265.p266.InterfaceC4823
    /* JADX INFO: renamed from: ށ */
    public final void mo8107(C4977 c4977) {
        m8147(c4977);
        m8145(new RunnableC4763(this, c4977));
    }

    /* JADX INFO: renamed from: ނ, reason: contains not printable characters */
    public final void m8147(C4977 c4977) {
        C0567.m1910(c4977);
        m8146(c4977.f15049, false);
        this.f14547.f14718.m8504().m8260(c4977.f15050, c4977.f15066, c4977.f15070);
    }
}
