- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
253 lines
7.8 KiB
Java
253 lines
7.8 KiB
Java
package com.google.android.gms.common.internal;
|
|
|
|
import android.os.Handler;
|
|
import android.os.Looper;
|
|
import android.text.TextUtils;
|
|
import androidx.annotation.NonNull;
|
|
import androidx.annotation.Nullable;
|
|
import com.google.android.gms.common.annotation.KeepForSdk;
|
|
import com.ironsource.v8;
|
|
import csdk.gluads.Consts;
|
|
|
|
@KeepForSdk
|
|
/* loaded from: classes2.dex */
|
|
public final class Preconditions {
|
|
private Preconditions() {
|
|
throw new AssertionError("Uninstantiable");
|
|
}
|
|
|
|
@KeepForSdk
|
|
public static void checkArgument(boolean z) {
|
|
if (!z) {
|
|
throw new IllegalArgumentException();
|
|
}
|
|
}
|
|
|
|
@KeepForSdk
|
|
public static double checkArgumentInRange(double d, double d2, double d3, @NonNull String str) {
|
|
if (d < d2) {
|
|
throw new IllegalArgumentException(zza("%s is out of range of [%f, %f] (too low)", str, Double.valueOf(d2), Double.valueOf(d3)));
|
|
}
|
|
if (d <= d3) {
|
|
return d;
|
|
}
|
|
throw new IllegalArgumentException(zza("%s is out of range of [%f, %f] (too high)", str, Double.valueOf(d2), Double.valueOf(d3)));
|
|
}
|
|
|
|
@KeepForSdk
|
|
public static void checkHandlerThread(@NonNull Handler handler) {
|
|
Looper myLooper = Looper.myLooper();
|
|
if (myLooper != handler.getLooper()) {
|
|
String name = myLooper != null ? myLooper.getThread().getName() : "null current looper";
|
|
throw new IllegalStateException("Must be called on " + handler.getLooper().getThread().getName() + " thread, but got " + name + Consts.STRING_PERIOD);
|
|
}
|
|
}
|
|
|
|
@KeepForSdk
|
|
public static void checkMainThread() {
|
|
checkMainThread("Must be called on the main application thread");
|
|
}
|
|
|
|
@NonNull
|
|
@KeepForSdk
|
|
public static String checkNotEmpty(@Nullable String str) {
|
|
if (TextUtils.isEmpty(str)) {
|
|
throw new IllegalArgumentException("Given String is empty or null");
|
|
}
|
|
return str;
|
|
}
|
|
|
|
@KeepForSdk
|
|
public static void checkNotGoogleApiHandlerThread() {
|
|
checkNotGoogleApiHandlerThread("Must not be called on GoogleApiHandler thread.");
|
|
}
|
|
|
|
@KeepForSdk
|
|
public static void checkNotMainThread() {
|
|
checkNotMainThread("Must not be called on the main application thread");
|
|
}
|
|
|
|
@NonNull
|
|
@KeepForSdk
|
|
public static <T> T checkNotNull(@Nullable T t) {
|
|
if (t != null) {
|
|
return t;
|
|
}
|
|
throw new NullPointerException("null reference");
|
|
}
|
|
|
|
@KeepForSdk
|
|
public static int checkNotZero(int i) {
|
|
if (i != 0) {
|
|
return i;
|
|
}
|
|
throw new IllegalArgumentException("Given Integer is zero");
|
|
}
|
|
|
|
@KeepForSdk
|
|
public static void checkState(boolean z) {
|
|
if (!z) {
|
|
throw new IllegalStateException();
|
|
}
|
|
}
|
|
|
|
public static String zza(String str, Object... objArr) {
|
|
int indexOf;
|
|
StringBuilder sb = new StringBuilder(str.length() + 48);
|
|
int i = 0;
|
|
int i2 = 0;
|
|
while (i < 3 && (indexOf = str.indexOf("%s", i2)) != -1) {
|
|
sb.append(str.substring(i2, indexOf));
|
|
sb.append(objArr[i]);
|
|
i2 = indexOf + 2;
|
|
i++;
|
|
}
|
|
sb.append(str.substring(i2));
|
|
if (i < 3) {
|
|
sb.append(" [");
|
|
sb.append(objArr[i]);
|
|
for (int i3 = i + 1; i3 < 3; i3++) {
|
|
sb.append(", ");
|
|
sb.append(objArr[i3]);
|
|
}
|
|
sb.append(v8.i.e);
|
|
}
|
|
return sb.toString();
|
|
}
|
|
|
|
@KeepForSdk
|
|
public static void checkArgument(boolean z, @NonNull Object obj) {
|
|
if (!z) {
|
|
throw new IllegalArgumentException(String.valueOf(obj));
|
|
}
|
|
}
|
|
|
|
@KeepForSdk
|
|
public static void checkMainThread(@NonNull String str) {
|
|
if (!com.google.android.gms.common.util.zzb.zza()) {
|
|
throw new IllegalStateException(str);
|
|
}
|
|
}
|
|
|
|
@KeepForSdk
|
|
public static void checkNotGoogleApiHandlerThread(@NonNull String str) {
|
|
Looper myLooper = Looper.myLooper();
|
|
if (myLooper != null) {
|
|
String name = myLooper.getThread().getName();
|
|
if (name == "GoogleApiHandler" || (name != null && name.equals("GoogleApiHandler"))) {
|
|
throw new IllegalStateException(str);
|
|
}
|
|
}
|
|
}
|
|
|
|
@KeepForSdk
|
|
public static void checkNotMainThread(@NonNull String str) {
|
|
if (com.google.android.gms.common.util.zzb.zza()) {
|
|
throw new IllegalStateException(str);
|
|
}
|
|
}
|
|
|
|
@NonNull
|
|
@KeepForSdk
|
|
public static <T> T checkNotNull(@NonNull T t, @NonNull Object obj) {
|
|
if (t != null) {
|
|
return t;
|
|
}
|
|
throw new NullPointerException(String.valueOf(obj));
|
|
}
|
|
|
|
@KeepForSdk
|
|
public static int checkNotZero(int i, @NonNull Object obj) {
|
|
if (i != 0) {
|
|
return i;
|
|
}
|
|
throw new IllegalArgumentException(String.valueOf(obj));
|
|
}
|
|
|
|
@KeepForSdk
|
|
public static void checkState(boolean z, @NonNull Object obj) {
|
|
if (!z) {
|
|
throw new IllegalStateException(String.valueOf(obj));
|
|
}
|
|
}
|
|
|
|
@KeepForSdk
|
|
public static void checkArgument(boolean z, @NonNull String str, @NonNull Object... objArr) {
|
|
if (!z) {
|
|
throw new IllegalArgumentException(String.format(str, objArr));
|
|
}
|
|
}
|
|
|
|
@KeepForSdk
|
|
public static float checkArgumentInRange(float f, float f2, float f3, @NonNull String str) {
|
|
if (f < f2) {
|
|
throw new IllegalArgumentException(zza("%s is out of range of [%f, %f] (too low)", str, Float.valueOf(f2), Float.valueOf(f3)));
|
|
}
|
|
if (f <= f3) {
|
|
return f;
|
|
}
|
|
throw new IllegalArgumentException(zza("%s is out of range of [%f, %f] (too high)", str, Float.valueOf(f2), Float.valueOf(f3)));
|
|
}
|
|
|
|
@NonNull
|
|
@KeepForSdk
|
|
public static String checkNotEmpty(@Nullable String str, @NonNull Object obj) {
|
|
if (TextUtils.isEmpty(str)) {
|
|
throw new IllegalArgumentException(String.valueOf(obj));
|
|
}
|
|
return str;
|
|
}
|
|
|
|
@KeepForSdk
|
|
public static long checkNotZero(long j) {
|
|
if (j != 0) {
|
|
return j;
|
|
}
|
|
throw new IllegalArgumentException("Given Long is zero");
|
|
}
|
|
|
|
@KeepForSdk
|
|
public static void checkState(boolean z, @NonNull String str, @NonNull Object... objArr) {
|
|
if (!z) {
|
|
throw new IllegalStateException(String.format(str, objArr));
|
|
}
|
|
}
|
|
|
|
@KeepForSdk
|
|
public static long checkNotZero(long j, @NonNull Object obj) {
|
|
if (j != 0) {
|
|
return j;
|
|
}
|
|
throw new IllegalArgumentException(String.valueOf(obj));
|
|
}
|
|
|
|
@KeepForSdk
|
|
public static int checkArgumentInRange(int i, int i2, int i3, @NonNull String str) {
|
|
if (i < i2) {
|
|
throw new IllegalArgumentException(zza("%s is out of range of [%d, %d] (too low)", str, Integer.valueOf(i2), Integer.valueOf(i3)));
|
|
}
|
|
if (i <= i3) {
|
|
return i;
|
|
}
|
|
throw new IllegalArgumentException(zza("%s is out of range of [%d, %d] (too high)", str, Integer.valueOf(i2), Integer.valueOf(i3)));
|
|
}
|
|
|
|
@KeepForSdk
|
|
public static void checkHandlerThread(@NonNull Handler handler, @NonNull String str) {
|
|
if (Looper.myLooper() != handler.getLooper()) {
|
|
throw new IllegalStateException(str);
|
|
}
|
|
}
|
|
|
|
@KeepForSdk
|
|
public static long checkArgumentInRange(long j, long j2, long j3, @NonNull String str) {
|
|
if (j < j2) {
|
|
throw new IllegalArgumentException(zza("%s is out of range of [%d, %d] (too low)", str, Long.valueOf(j2), Long.valueOf(j3)));
|
|
}
|
|
if (j <= j3) {
|
|
return j;
|
|
}
|
|
throw new IllegalArgumentException(zza("%s is out of range of [%d, %d] (too high)", str, Long.valueOf(j2), Long.valueOf(j3)));
|
|
}
|
|
}
|