- 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
1519 lines
58 KiB
Java
1519 lines
58 KiB
Java
package com.facebook.internal;
|
|
|
|
import android.content.Context;
|
|
import android.content.Intent;
|
|
import android.content.pm.ApplicationInfo;
|
|
import android.content.pm.PackageInfo;
|
|
import android.content.pm.PackageManager;
|
|
import android.content.pm.ResolveInfo;
|
|
import android.database.Cursor;
|
|
import android.hardware.display.DisplayManager;
|
|
import android.net.Uri;
|
|
import android.os.Build;
|
|
import android.os.Bundle;
|
|
import android.os.Environment;
|
|
import android.os.Parcel;
|
|
import android.os.StatFs;
|
|
import android.telephony.TelephonyManager;
|
|
import android.text.TextUtils;
|
|
import android.util.DisplayMetrics;
|
|
import android.view.Display;
|
|
import android.view.autofill.AutofillManager;
|
|
import android.webkit.CookieManager;
|
|
import android.webkit.CookieSyncManager;
|
|
import com.applovin.exoplayer2.common.base.Ascii;
|
|
import com.facebook.AccessToken;
|
|
import com.facebook.FacebookException;
|
|
import com.facebook.FacebookSdk;
|
|
import com.facebook.GraphRequest;
|
|
import com.facebook.GraphResponse;
|
|
import com.facebook.HttpMethod;
|
|
import com.facebook.appevents.UserDataStore;
|
|
import com.facebook.appevents.codeless.internal.Constants;
|
|
import com.facebook.internal.FeatureManager;
|
|
import com.facebook.internal.Utility;
|
|
import com.facebook.internal.instrument.crashshield.CrashShieldHandler;
|
|
import com.ironsource.v8;
|
|
import com.ironsource.w8;
|
|
import java.io.BufferedInputStream;
|
|
import java.io.Closeable;
|
|
import java.io.File;
|
|
import java.io.FilenameFilter;
|
|
import java.io.IOException;
|
|
import java.io.InputStream;
|
|
import java.io.InputStreamReader;
|
|
import java.io.OutputStream;
|
|
import java.io.UnsupportedEncodingException;
|
|
import java.lang.reflect.InvocationTargetException;
|
|
import java.lang.reflect.Method;
|
|
import java.math.BigInteger;
|
|
import java.net.HttpURLConnection;
|
|
import java.net.URLConnection;
|
|
import java.net.URLDecoder;
|
|
import java.nio.charset.Charset;
|
|
import java.security.MessageDigest;
|
|
import java.security.NoSuchAlgorithmException;
|
|
import java.text.DecimalFormat;
|
|
import java.util.ArrayList;
|
|
import java.util.Arrays;
|
|
import java.util.Collection;
|
|
import java.util.Date;
|
|
import java.util.HashMap;
|
|
import java.util.HashSet;
|
|
import java.util.Iterator;
|
|
import java.util.List;
|
|
import java.util.Locale;
|
|
import java.util.Map;
|
|
import java.util.Random;
|
|
import java.util.Set;
|
|
import java.util.TimeZone;
|
|
import java.util.regex.Pattern;
|
|
import kotlin.jvm.internal.Intrinsics;
|
|
import kotlin.jvm.internal.StringCompanionObject;
|
|
import kotlin.text.Charsets;
|
|
import kotlin.text.Regex;
|
|
import kotlin.text.StringsKt__StringsJVMKt;
|
|
import kotlin.text.StringsKt__StringsKt;
|
|
import org.json.JSONArray;
|
|
import org.json.JSONException;
|
|
import org.json.JSONObject;
|
|
import org.json.JSONTokener;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public final class Utility {
|
|
private static final String ARC_DEVICE_PATTERN = ".+_cheets|cheets_.+";
|
|
public static final int DEFAULT_STREAM_BUFFER_SIZE = 8192;
|
|
private static final String EXTRA_APP_EVENTS_INFO_FORMAT_VERSION = "a2";
|
|
private static final String FACEBOOK_PROFILE_FIELDS = "id,name,first_name,middle_name,last_name";
|
|
private static final String HASH_ALGORITHM_MD5 = "MD5";
|
|
private static final String HASH_ALGORITHM_SHA1 = "SHA-1";
|
|
private static final String HASH_ALGORITHM_SHA256 = "SHA-256";
|
|
private static final String INSTAGRAM_PROFILE_FIELDS = "id,name,profile_picture";
|
|
public static final String LOG_TAG = "FacebookSDK";
|
|
private static final int REFRESH_TIME_FOR_EXTENDED_DEVICE_INFO_MILLIS = 1800000;
|
|
private static final String URL_SCHEME = "https";
|
|
private static final String UTF8 = "UTF-8";
|
|
private static Locale locale;
|
|
private static int numCPUCores;
|
|
public static final Utility INSTANCE = new Utility();
|
|
private static long timestampOfLastCheck = -1;
|
|
private static long totalExternalStorageGB = -1;
|
|
private static long availableExternalStorageGB = -1;
|
|
private static String deviceTimezoneAbbreviation = "";
|
|
private static String deviceTimeZoneName = "";
|
|
private static final String NO_CARRIER = "NoCarrier";
|
|
private static String carrierName = NO_CARRIER;
|
|
private static String versionName = "";
|
|
|
|
public interface GraphMeRequestWithCacheCallback {
|
|
void onFailure(FacebookException facebookException);
|
|
|
|
void onSuccess(JSONObject jSONObject);
|
|
}
|
|
|
|
public static /* synthetic */ void isAutoAppLinkSetup$annotations() {
|
|
}
|
|
|
|
public final long getAvailableExternalStorageGB() {
|
|
return availableExternalStorageGB;
|
|
}
|
|
|
|
public final String getCarrierName() {
|
|
return carrierName;
|
|
}
|
|
|
|
public final String getDeviceTimeZoneName() {
|
|
return deviceTimeZoneName;
|
|
}
|
|
|
|
public final Locale getLocale() {
|
|
return locale;
|
|
}
|
|
|
|
public final String getVersionName() {
|
|
return versionName;
|
|
}
|
|
|
|
public final void setAvailableExternalStorageGB(long j) {
|
|
availableExternalStorageGB = j;
|
|
}
|
|
|
|
public final void setCarrierName(String str) {
|
|
Intrinsics.checkNotNullParameter(str, "<set-?>");
|
|
carrierName = str;
|
|
}
|
|
|
|
public final void setDeviceTimeZoneName(String str) {
|
|
Intrinsics.checkNotNullParameter(str, "<set-?>");
|
|
deviceTimeZoneName = str;
|
|
}
|
|
|
|
public final void setLocale(Locale locale2) {
|
|
locale = locale2;
|
|
}
|
|
|
|
public final void setVersionName(String str) {
|
|
versionName = str;
|
|
}
|
|
|
|
private Utility() {
|
|
}
|
|
|
|
public static final boolean isNullOrEmpty(Collection<?> collection) {
|
|
return collection == null || collection.isEmpty();
|
|
}
|
|
|
|
public static final boolean isNullOrEmpty(String str) {
|
|
return str == null || str.length() == 0;
|
|
}
|
|
|
|
public static final String coerceValueIfNullOrEmpty(String str, String str2) {
|
|
return isNullOrEmpty(str) ? str2 : str;
|
|
}
|
|
|
|
public static final String md5hash(String key) {
|
|
Intrinsics.checkNotNullParameter(key, "key");
|
|
return INSTANCE.hashWithAlgorithm("MD5", key);
|
|
}
|
|
|
|
public static final String sha1hash(String key) {
|
|
Intrinsics.checkNotNullParameter(key, "key");
|
|
return INSTANCE.hashWithAlgorithm("SHA-1", key);
|
|
}
|
|
|
|
public static final String sha1hash(byte[] bytes) {
|
|
Intrinsics.checkNotNullParameter(bytes, "bytes");
|
|
return INSTANCE.hashWithAlgorithm("SHA-1", bytes);
|
|
}
|
|
|
|
public static final String sha256hash(String str) {
|
|
if (str == null) {
|
|
return null;
|
|
}
|
|
return INSTANCE.hashWithAlgorithm(HASH_ALGORITHM_SHA256, str);
|
|
}
|
|
|
|
public static final String sha256hash(byte[] bArr) {
|
|
if (bArr == null) {
|
|
return null;
|
|
}
|
|
return INSTANCE.hashWithAlgorithm(HASH_ALGORITHM_SHA256, bArr);
|
|
}
|
|
|
|
private final String hashWithAlgorithm(String str, String str2) {
|
|
Charset charset = Charsets.UTF_8;
|
|
if (str2 == null) {
|
|
throw new NullPointerException("null cannot be cast to non-null type java.lang.String");
|
|
}
|
|
byte[] bytes = str2.getBytes(charset);
|
|
Intrinsics.checkNotNullExpressionValue(bytes, "(this as java.lang.String).getBytes(charset)");
|
|
return hashWithAlgorithm(str, bytes);
|
|
}
|
|
|
|
private final String hashWithAlgorithm(String str, byte[] bArr) {
|
|
try {
|
|
MessageDigest hash = MessageDigest.getInstance(str);
|
|
Intrinsics.checkNotNullExpressionValue(hash, "hash");
|
|
return hashBytes(hash, bArr);
|
|
} catch (NoSuchAlgorithmException unused) {
|
|
return null;
|
|
}
|
|
}
|
|
|
|
private final String hashBytes(MessageDigest messageDigest, byte[] bArr) {
|
|
messageDigest.update(bArr);
|
|
byte[] digest = messageDigest.digest();
|
|
StringBuilder sb = new StringBuilder();
|
|
Intrinsics.checkNotNullExpressionValue(digest, "digest");
|
|
int length = digest.length;
|
|
int i = 0;
|
|
while (i < length) {
|
|
byte b = digest[i];
|
|
i++;
|
|
sb.append(Integer.toHexString((b >> 4) & 15));
|
|
sb.append(Integer.toHexString(b & Ascii.SI));
|
|
}
|
|
String sb2 = sb.toString();
|
|
Intrinsics.checkNotNullExpressionValue(sb2, "builder.toString()");
|
|
return sb2;
|
|
}
|
|
|
|
public static final Uri buildUri(String str, String str2, Bundle bundle) {
|
|
Uri.Builder builder = new Uri.Builder();
|
|
builder.scheme("https");
|
|
builder.authority(str);
|
|
builder.path(str2);
|
|
if (bundle != null) {
|
|
for (String str3 : bundle.keySet()) {
|
|
Object obj = bundle.get(str3);
|
|
if (obj instanceof String) {
|
|
builder.appendQueryParameter(str3, (String) obj);
|
|
}
|
|
}
|
|
}
|
|
Uri build = builder.build();
|
|
Intrinsics.checkNotNullExpressionValue(build, "builder.build()");
|
|
return build;
|
|
}
|
|
|
|
public static final Bundle parseUrlQueryString(String str) {
|
|
List split$default;
|
|
List split$default2;
|
|
Bundle bundle = new Bundle();
|
|
if (!isNullOrEmpty(str)) {
|
|
if (str == null) {
|
|
throw new IllegalStateException("Required value was null.".toString());
|
|
}
|
|
split$default = StringsKt__StringsKt.split$default((CharSequence) str, new String[]{v8.i.c}, false, 0, 6, (Object) null);
|
|
Object[] array = split$default.toArray(new String[0]);
|
|
if (array == null) {
|
|
throw new NullPointerException("null cannot be cast to non-null type kotlin.Array<T>");
|
|
}
|
|
String[] strArr = (String[]) array;
|
|
int length = strArr.length;
|
|
int i = 0;
|
|
while (i < length) {
|
|
String str2 = strArr[i];
|
|
i++;
|
|
split$default2 = StringsKt__StringsKt.split$default((CharSequence) str2, new String[]{v8.i.b}, false, 0, 6, (Object) null);
|
|
Object[] array2 = split$default2.toArray(new String[0]);
|
|
if (array2 == null) {
|
|
throw new NullPointerException("null cannot be cast to non-null type kotlin.Array<T>");
|
|
}
|
|
String[] strArr2 = (String[]) array2;
|
|
try {
|
|
if (strArr2.length == 2) {
|
|
bundle.putString(URLDecoder.decode(strArr2[0], "UTF-8"), URLDecoder.decode(strArr2[1], "UTF-8"));
|
|
} else if (strArr2.length == 1) {
|
|
bundle.putString(URLDecoder.decode(strArr2[0], "UTF-8"), "");
|
|
}
|
|
} catch (UnsupportedEncodingException e) {
|
|
logd(LOG_TAG, e);
|
|
}
|
|
}
|
|
}
|
|
return bundle;
|
|
}
|
|
|
|
public static final void putNonEmptyString(Bundle b, String str, String str2) {
|
|
Intrinsics.checkNotNullParameter(b, "b");
|
|
if (isNullOrEmpty(str2)) {
|
|
return;
|
|
}
|
|
b.putString(str, str2);
|
|
}
|
|
|
|
public static final void putCommaSeparatedStringList(Bundle b, String str, List<String> list) {
|
|
Intrinsics.checkNotNullParameter(b, "b");
|
|
if (list != null) {
|
|
b.putString(str, TextUtils.join(",", list));
|
|
}
|
|
}
|
|
|
|
public static final void putUri(Bundle b, String str, Uri uri) {
|
|
Intrinsics.checkNotNullParameter(b, "b");
|
|
if (uri != null) {
|
|
putNonEmptyString(b, str, uri.toString());
|
|
}
|
|
}
|
|
|
|
public static final boolean putJSONValueInBundle(Bundle bundle, String str, Object obj) {
|
|
Intrinsics.checkNotNullParameter(bundle, "bundle");
|
|
if (obj == null) {
|
|
bundle.remove(str);
|
|
return true;
|
|
}
|
|
if (obj instanceof Boolean) {
|
|
bundle.putBoolean(str, ((Boolean) obj).booleanValue());
|
|
return true;
|
|
}
|
|
if (obj instanceof boolean[]) {
|
|
bundle.putBooleanArray(str, (boolean[]) obj);
|
|
return true;
|
|
}
|
|
if (obj instanceof Double) {
|
|
bundle.putDouble(str, ((Number) obj).doubleValue());
|
|
return true;
|
|
}
|
|
if (obj instanceof double[]) {
|
|
bundle.putDoubleArray(str, (double[]) obj);
|
|
return true;
|
|
}
|
|
if (obj instanceof Integer) {
|
|
bundle.putInt(str, ((Number) obj).intValue());
|
|
return true;
|
|
}
|
|
if (obj instanceof int[]) {
|
|
bundle.putIntArray(str, (int[]) obj);
|
|
return true;
|
|
}
|
|
if (obj instanceof Long) {
|
|
bundle.putLong(str, ((Number) obj).longValue());
|
|
return true;
|
|
}
|
|
if (obj instanceof long[]) {
|
|
bundle.putLongArray(str, (long[]) obj);
|
|
return true;
|
|
}
|
|
if (obj instanceof String) {
|
|
bundle.putString(str, (String) obj);
|
|
return true;
|
|
}
|
|
if (obj instanceof JSONArray) {
|
|
bundle.putString(str, ((JSONArray) obj).toString());
|
|
return true;
|
|
}
|
|
if (!(obj instanceof JSONObject)) {
|
|
return false;
|
|
}
|
|
bundle.putString(str, ((JSONObject) obj).toString());
|
|
return true;
|
|
}
|
|
|
|
public static final void closeQuietly(Closeable closeable) {
|
|
if (closeable == null) {
|
|
return;
|
|
}
|
|
try {
|
|
closeable.close();
|
|
} catch (IOException unused) {
|
|
}
|
|
}
|
|
|
|
public static final void disconnectQuietly(URLConnection uRLConnection) {
|
|
if (uRLConnection == null || !(uRLConnection instanceof HttpURLConnection)) {
|
|
return;
|
|
}
|
|
((HttpURLConnection) uRLConnection).disconnect();
|
|
}
|
|
|
|
public static final String getMetadataApplicationId(Context context) {
|
|
Validate.notNull(context, "context");
|
|
return FacebookSdk.getApplicationId();
|
|
}
|
|
|
|
public static final Map<String, Object> convertJSONObjectToHashMap(JSONObject jsonObject) {
|
|
int length;
|
|
Intrinsics.checkNotNullParameter(jsonObject, "jsonObject");
|
|
HashMap hashMap = new HashMap();
|
|
JSONArray names = jsonObject.names();
|
|
if (names != null && (length = names.length()) > 0) {
|
|
int i = 0;
|
|
while (true) {
|
|
int i2 = i + 1;
|
|
try {
|
|
String string = names.getString(i);
|
|
Intrinsics.checkNotNullExpressionValue(string, "keys.getString(i)");
|
|
Object value = jsonObject.get(string);
|
|
if (value instanceof JSONObject) {
|
|
value = convertJSONObjectToHashMap((JSONObject) value);
|
|
}
|
|
Intrinsics.checkNotNullExpressionValue(value, "value");
|
|
hashMap.put(string, value);
|
|
} catch (JSONException unused) {
|
|
}
|
|
if (i2 >= length) {
|
|
break;
|
|
}
|
|
i = i2;
|
|
}
|
|
}
|
|
return hashMap;
|
|
}
|
|
|
|
public static final Map<String, String> convertJSONObjectToStringMap(JSONObject jsonObject) {
|
|
Intrinsics.checkNotNullParameter(jsonObject, "jsonObject");
|
|
HashMap hashMap = new HashMap();
|
|
Iterator<String> keys = jsonObject.keys();
|
|
while (keys.hasNext()) {
|
|
String key = keys.next();
|
|
String optString = jsonObject.optString(key);
|
|
if (optString != null) {
|
|
Intrinsics.checkNotNullExpressionValue(key, "key");
|
|
hashMap.put(key, optString);
|
|
}
|
|
}
|
|
return hashMap;
|
|
}
|
|
|
|
public static final HashSet<String> convertJSONArrayToHashSet(JSONArray jSONArray) {
|
|
if (jSONArray == null || jSONArray.length() == 0) {
|
|
return null;
|
|
}
|
|
HashSet<String> hashSet = new HashSet<>();
|
|
int length = jSONArray.length();
|
|
if (length > 0) {
|
|
int i = 0;
|
|
while (true) {
|
|
int i2 = i + 1;
|
|
String string = jSONArray.getString(i);
|
|
Intrinsics.checkNotNullExpressionValue(string, "jsonArray.getString(i)");
|
|
hashSet.add(string);
|
|
if (i2 >= length) {
|
|
break;
|
|
}
|
|
i = i2;
|
|
}
|
|
}
|
|
return hashSet;
|
|
}
|
|
|
|
public static final List<String> convertJSONArrayToList(JSONArray jsonArray) {
|
|
Intrinsics.checkNotNullParameter(jsonArray, "jsonArray");
|
|
try {
|
|
ArrayList arrayList = new ArrayList();
|
|
int length = jsonArray.length();
|
|
if (length <= 0) {
|
|
return arrayList;
|
|
}
|
|
int i = 0;
|
|
while (true) {
|
|
int i2 = i + 1;
|
|
String string = jsonArray.getString(i);
|
|
Intrinsics.checkNotNullExpressionValue(string, "jsonArray.getString(i)");
|
|
arrayList.add(string);
|
|
if (i2 >= length) {
|
|
return arrayList;
|
|
}
|
|
i = i2;
|
|
}
|
|
} catch (JSONException unused) {
|
|
return new ArrayList();
|
|
}
|
|
}
|
|
|
|
public static final Object getStringPropertyAsJSON(JSONObject jsonObject, String str, String str2) throws JSONException {
|
|
Intrinsics.checkNotNullParameter(jsonObject, "jsonObject");
|
|
Object opt = jsonObject.opt(str);
|
|
if (opt != null && (opt instanceof String)) {
|
|
opt = new JSONTokener((String) opt).nextValue();
|
|
}
|
|
if (opt == null || (opt instanceof JSONObject) || (opt instanceof JSONArray)) {
|
|
return opt;
|
|
}
|
|
if (str2 != null) {
|
|
JSONObject jSONObject = new JSONObject();
|
|
jSONObject.putOpt(str2, opt);
|
|
return jSONObject;
|
|
}
|
|
throw new FacebookException("Got an unexpected non-JSON object.");
|
|
}
|
|
|
|
public static final String readStreamToString(InputStream inputStream) throws IOException {
|
|
BufferedInputStream bufferedInputStream;
|
|
Throwable th;
|
|
InputStreamReader inputStreamReader;
|
|
try {
|
|
bufferedInputStream = new BufferedInputStream(inputStream);
|
|
try {
|
|
inputStreamReader = new InputStreamReader(bufferedInputStream);
|
|
try {
|
|
StringBuilder sb = new StringBuilder();
|
|
char[] cArr = new char[2048];
|
|
while (true) {
|
|
int read = inputStreamReader.read(cArr);
|
|
if (read != -1) {
|
|
sb.append(cArr, 0, read);
|
|
} else {
|
|
String sb2 = sb.toString();
|
|
Intrinsics.checkNotNullExpressionValue(sb2, "{\n bufferedInputStream = BufferedInputStream(inputStream)\n reader = InputStreamReader(bufferedInputStream)\n val stringBuilder = StringBuilder()\n val bufferSize = 1024 * 2\n val buffer = CharArray(bufferSize)\n var n = 0\n while (reader.read(buffer).also { n = it } != -1) {\n stringBuilder.append(buffer, 0, n)\n }\n stringBuilder.toString()\n }");
|
|
closeQuietly(bufferedInputStream);
|
|
closeQuietly(inputStreamReader);
|
|
return sb2;
|
|
}
|
|
}
|
|
} catch (Throwable th2) {
|
|
th = th2;
|
|
closeQuietly(bufferedInputStream);
|
|
closeQuietly(inputStreamReader);
|
|
throw th;
|
|
}
|
|
} catch (Throwable th3) {
|
|
th = th3;
|
|
inputStreamReader = null;
|
|
}
|
|
} catch (Throwable th4) {
|
|
bufferedInputStream = null;
|
|
th = th4;
|
|
inputStreamReader = null;
|
|
}
|
|
}
|
|
|
|
public static final int copyAndCloseInputStream(InputStream inputStream, OutputStream outputStream) throws IOException {
|
|
BufferedInputStream bufferedInputStream;
|
|
Intrinsics.checkNotNullParameter(outputStream, "outputStream");
|
|
BufferedInputStream bufferedInputStream2 = null;
|
|
try {
|
|
bufferedInputStream = new BufferedInputStream(inputStream);
|
|
} catch (Throwable th) {
|
|
th = th;
|
|
}
|
|
try {
|
|
byte[] bArr = new byte[8192];
|
|
int i = 0;
|
|
while (true) {
|
|
int read = bufferedInputStream.read(bArr);
|
|
if (read == -1) {
|
|
break;
|
|
}
|
|
outputStream.write(bArr, 0, read);
|
|
i += read;
|
|
}
|
|
bufferedInputStream.close();
|
|
if (inputStream != null) {
|
|
inputStream.close();
|
|
}
|
|
return i;
|
|
} catch (Throwable th2) {
|
|
th = th2;
|
|
bufferedInputStream2 = bufferedInputStream;
|
|
if (bufferedInputStream2 != null) {
|
|
bufferedInputStream2.close();
|
|
}
|
|
if (inputStream != null) {
|
|
inputStream.close();
|
|
}
|
|
throw th;
|
|
}
|
|
}
|
|
|
|
public static final boolean stringsEqualOrEmpty(String str, String str2) {
|
|
boolean z = str == null || str.length() == 0;
|
|
boolean z2 = str2 == null || str2.length() == 0;
|
|
if (z && z2) {
|
|
return true;
|
|
}
|
|
if (z || z2) {
|
|
return false;
|
|
}
|
|
return Intrinsics.areEqual(str, str2);
|
|
}
|
|
|
|
private final void clearCookiesForDomain(Context context, String str) {
|
|
List split$default;
|
|
List split$default2;
|
|
CookieSyncManager.createInstance(context).sync();
|
|
CookieManager cookieManager = CookieManager.getInstance();
|
|
String cookie = cookieManager.getCookie(str);
|
|
if (cookie == null) {
|
|
return;
|
|
}
|
|
split$default = StringsKt__StringsKt.split$default((CharSequence) cookie, new String[]{";"}, false, 0, 6, (Object) null);
|
|
Object[] array = split$default.toArray(new String[0]);
|
|
if (array == null) {
|
|
throw new NullPointerException("null cannot be cast to non-null type kotlin.Array<T>");
|
|
}
|
|
String[] strArr = (String[]) array;
|
|
int length = strArr.length;
|
|
int i = 0;
|
|
while (i < length) {
|
|
String str2 = strArr[i];
|
|
i++;
|
|
split$default2 = StringsKt__StringsKt.split$default((CharSequence) str2, new String[]{v8.i.b}, false, 0, 6, (Object) null);
|
|
Object[] array2 = split$default2.toArray(new String[0]);
|
|
if (array2 == null) {
|
|
throw new NullPointerException("null cannot be cast to non-null type kotlin.Array<T>");
|
|
}
|
|
String[] strArr2 = (String[]) array2;
|
|
if (strArr2.length > 0) {
|
|
String str3 = strArr2[0];
|
|
int length2 = str3.length() - 1;
|
|
int i2 = 0;
|
|
boolean z = false;
|
|
while (i2 <= length2) {
|
|
boolean z2 = Intrinsics.compare((int) str3.charAt(!z ? i2 : length2), 32) <= 0;
|
|
if (z) {
|
|
if (!z2) {
|
|
break;
|
|
} else {
|
|
length2--;
|
|
}
|
|
} else if (z2) {
|
|
i2++;
|
|
} else {
|
|
z = true;
|
|
}
|
|
}
|
|
cookieManager.setCookie(str, Intrinsics.stringPlus(str3.subSequence(i2, length2 + 1).toString(), "=;expires=Sat, 1 Jan 2000 00:00:01 UTC;"));
|
|
}
|
|
}
|
|
cookieManager.removeExpiredCookie();
|
|
}
|
|
|
|
public static final void clearFacebookCookies(Context context) {
|
|
Intrinsics.checkNotNullParameter(context, "context");
|
|
try {
|
|
Utility utility = INSTANCE;
|
|
utility.clearCookiesForDomain(context, FacebookSdk.FACEBOOK_COM);
|
|
utility.clearCookiesForDomain(context, ".facebook.com");
|
|
utility.clearCookiesForDomain(context, "https://facebook.com");
|
|
utility.clearCookiesForDomain(context, "https://.facebook.com");
|
|
} catch (Exception unused) {
|
|
}
|
|
}
|
|
|
|
public static final void logd(String str, Exception exc) {
|
|
if (!FacebookSdk.isDebugEnabled() || str == null || exc == null) {
|
|
return;
|
|
}
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.append(exc.getClass().getSimpleName());
|
|
sb.append(": ");
|
|
sb.append((Object) exc.getMessage());
|
|
}
|
|
|
|
public static final void logd(String str, String str2) {
|
|
FacebookSdk.isDebugEnabled();
|
|
}
|
|
|
|
public static final void logd(String str, String str2, Throwable th) {
|
|
if (FacebookSdk.isDebugEnabled()) {
|
|
isNullOrEmpty(str);
|
|
}
|
|
}
|
|
|
|
public static final <T> boolean areObjectsEqual(T t, T t2) {
|
|
if (t == null) {
|
|
return t2 == null;
|
|
}
|
|
return Intrinsics.areEqual(t, t2);
|
|
}
|
|
|
|
public static final String safeGetStringFromResponse(JSONObject jSONObject, String str) {
|
|
if (jSONObject == null) {
|
|
return "";
|
|
}
|
|
String optString = jSONObject.optString(str, "");
|
|
Intrinsics.checkNotNullExpressionValue(optString, "response.optString(propertyName, \"\")");
|
|
return optString;
|
|
}
|
|
|
|
public static final JSONObject tryGetJSONObjectFromResponse(JSONObject jSONObject, String str) {
|
|
if (jSONObject == null) {
|
|
return null;
|
|
}
|
|
return jSONObject.optJSONObject(str);
|
|
}
|
|
|
|
public static final JSONArray tryGetJSONArrayFromResponse(JSONObject jSONObject, String str) {
|
|
if (jSONObject == null) {
|
|
return null;
|
|
}
|
|
return jSONObject.optJSONArray(str);
|
|
}
|
|
|
|
public static final List<String> jsonArrayToStringList(JSONArray jsonArray) throws JSONException {
|
|
Intrinsics.checkNotNullParameter(jsonArray, "jsonArray");
|
|
ArrayList arrayList = new ArrayList();
|
|
int length = jsonArray.length();
|
|
if (length > 0) {
|
|
int i = 0;
|
|
while (true) {
|
|
int i2 = i + 1;
|
|
arrayList.add(jsonArray.getString(i));
|
|
if (i2 >= length) {
|
|
break;
|
|
}
|
|
i = i2;
|
|
}
|
|
}
|
|
return arrayList;
|
|
}
|
|
|
|
public static final Set<String> jsonArrayToSet(JSONArray jsonArray) throws JSONException {
|
|
Intrinsics.checkNotNullParameter(jsonArray, "jsonArray");
|
|
HashSet hashSet = new HashSet();
|
|
int length = jsonArray.length();
|
|
if (length > 0) {
|
|
int i = 0;
|
|
while (true) {
|
|
int i2 = i + 1;
|
|
String string = jsonArray.getString(i);
|
|
Intrinsics.checkNotNullExpressionValue(string, "jsonArray.getString(i)");
|
|
hashSet.add(string);
|
|
if (i2 >= length) {
|
|
break;
|
|
}
|
|
i = i2;
|
|
}
|
|
}
|
|
return hashSet;
|
|
}
|
|
|
|
public static final String mapToJsonStr(Map<String, String> map) {
|
|
Intrinsics.checkNotNullParameter(map, "map");
|
|
String str = "";
|
|
if (!map.isEmpty()) {
|
|
try {
|
|
JSONObject jSONObject = new JSONObject();
|
|
for (Map.Entry<String, String> entry : map.entrySet()) {
|
|
jSONObject.put(entry.getKey(), entry.getValue());
|
|
}
|
|
str = jSONObject.toString();
|
|
} catch (JSONException unused) {
|
|
}
|
|
Intrinsics.checkNotNullExpressionValue(str, "{\n try {\n val jsonObject = JSONObject()\n for ((key, value) in map) {\n jsonObject.put(key, value)\n }\n jsonObject.toString()\n } catch (_e: JSONException) {\n \"\"\n }\n }");
|
|
}
|
|
return str;
|
|
}
|
|
|
|
public static final Map<String, String> jsonStrToMap(String str) {
|
|
Intrinsics.checkNotNullParameter(str, "str");
|
|
if (str.length() == 0) {
|
|
return new HashMap();
|
|
}
|
|
try {
|
|
HashMap hashMap = new HashMap();
|
|
JSONObject jSONObject = new JSONObject(str);
|
|
Iterator<String> keys = jSONObject.keys();
|
|
while (keys.hasNext()) {
|
|
String key = keys.next();
|
|
Intrinsics.checkNotNullExpressionValue(key, "key");
|
|
String string = jSONObject.getString(key);
|
|
Intrinsics.checkNotNullExpressionValue(string, "jsonObject.getString(key)");
|
|
hashMap.put(key, string);
|
|
}
|
|
return hashMap;
|
|
} catch (JSONException unused) {
|
|
return new HashMap();
|
|
}
|
|
}
|
|
|
|
public static final void setAppEventAttributionParameters(JSONObject params, AttributionIdentifiers attributionIdentifiers, String str, boolean z, Context context) throws JSONException {
|
|
Intrinsics.checkNotNullParameter(params, "params");
|
|
Intrinsics.checkNotNullParameter(context, "context");
|
|
FeatureManager featureManager = FeatureManager.INSTANCE;
|
|
FeatureManager.Feature feature = FeatureManager.Feature.ServiceUpdateCompliance;
|
|
if (!FeatureManager.isEnabled(feature)) {
|
|
params.put("anon_id", str);
|
|
}
|
|
params.put("application_tracking_enabled", !z);
|
|
params.put("advertiser_id_collection_enabled", FacebookSdk.getAdvertiserIDCollectionEnabled());
|
|
if (attributionIdentifiers != null) {
|
|
if (FeatureManager.isEnabled(feature)) {
|
|
INSTANCE.appendAnonIdUnderCompliance(params, attributionIdentifiers, str, context);
|
|
}
|
|
if (attributionIdentifiers.getAttributionId() != null) {
|
|
if (FeatureManager.isEnabled(feature)) {
|
|
INSTANCE.appendAttributionIdUnderCompliance(params, attributionIdentifiers, context);
|
|
} else {
|
|
params.put(w8.c, attributionIdentifiers.getAttributionId());
|
|
}
|
|
}
|
|
if (attributionIdentifiers.getAndroidAdvertiserId() != null) {
|
|
params.put("advertiser_id", attributionIdentifiers.getAndroidAdvertiserId());
|
|
params.put("advertiser_tracking_enabled", !attributionIdentifiers.isTrackingLimited());
|
|
}
|
|
if (!attributionIdentifiers.isTrackingLimited()) {
|
|
String allHashedUserData = UserDataStore.getAllHashedUserData();
|
|
if (allHashedUserData.length() != 0) {
|
|
params.put("ud", allHashedUserData);
|
|
}
|
|
}
|
|
if (attributionIdentifiers.getAndroidInstallerPackage() != null) {
|
|
params.put("installer_package", attributionIdentifiers.getAndroidInstallerPackage());
|
|
}
|
|
}
|
|
}
|
|
|
|
public static final String getAppVersion() {
|
|
Context applicationContext = FacebookSdk.getApplicationContext();
|
|
if (applicationContext == null) {
|
|
return null;
|
|
}
|
|
try {
|
|
PackageInfo packageInfo = applicationContext.getPackageManager().getPackageInfo(applicationContext.getPackageName(), 0);
|
|
if (packageInfo == null) {
|
|
return null;
|
|
}
|
|
return packageInfo.versionName;
|
|
} catch (PackageManager.NameNotFoundException unused) {
|
|
return null;
|
|
}
|
|
}
|
|
|
|
public static final void setAppEventExtendedDeviceInfoParameters(JSONObject params, Context appContext) throws JSONException {
|
|
Locale locale2;
|
|
String language;
|
|
int i;
|
|
int i2;
|
|
Display display;
|
|
String country;
|
|
PackageInfo packageInfo;
|
|
Intrinsics.checkNotNullParameter(params, "params");
|
|
Intrinsics.checkNotNullParameter(appContext, "appContext");
|
|
JSONArray jSONArray = new JSONArray();
|
|
jSONArray.put(EXTRA_APP_EVENTS_INFO_FORMAT_VERSION);
|
|
INSTANCE.refreshPeriodicExtendedDeviceInfo(appContext);
|
|
String packageName = appContext.getPackageName();
|
|
int i3 = 0;
|
|
int i4 = -1;
|
|
try {
|
|
packageInfo = appContext.getPackageManager().getPackageInfo(packageName, 0);
|
|
} catch (PackageManager.NameNotFoundException unused) {
|
|
}
|
|
if (packageInfo == null) {
|
|
return;
|
|
}
|
|
i4 = packageInfo.versionCode;
|
|
versionName = packageInfo.versionName;
|
|
jSONArray.put(packageName);
|
|
jSONArray.put(i4);
|
|
jSONArray.put(versionName);
|
|
jSONArray.put(Build.VERSION.RELEASE);
|
|
jSONArray.put(Build.MODEL);
|
|
try {
|
|
locale2 = appContext.getResources().getConfiguration().locale;
|
|
} catch (Exception unused2) {
|
|
locale2 = Locale.getDefault();
|
|
}
|
|
locale = locale2;
|
|
StringBuilder sb = new StringBuilder();
|
|
Locale locale3 = locale;
|
|
String str = "";
|
|
if (locale3 == null || (language = locale3.getLanguage()) == null) {
|
|
language = "";
|
|
}
|
|
sb.append(language);
|
|
sb.append('_');
|
|
Locale locale4 = locale;
|
|
if (locale4 != null && (country = locale4.getCountry()) != null) {
|
|
str = country;
|
|
}
|
|
sb.append(str);
|
|
jSONArray.put(sb.toString());
|
|
jSONArray.put(deviceTimezoneAbbreviation);
|
|
jSONArray.put(carrierName);
|
|
double d = 0.0d;
|
|
try {
|
|
Object systemService = appContext.getSystemService("display");
|
|
display = null;
|
|
DisplayManager displayManager = systemService instanceof DisplayManager ? (DisplayManager) systemService : null;
|
|
if (displayManager != null) {
|
|
display = displayManager.getDisplay(0);
|
|
}
|
|
} catch (Exception unused3) {
|
|
i = 0;
|
|
}
|
|
if (display != null) {
|
|
DisplayMetrics displayMetrics = new DisplayMetrics();
|
|
display.getMetrics(displayMetrics);
|
|
i = displayMetrics.widthPixels;
|
|
try {
|
|
i3 = displayMetrics.heightPixels;
|
|
d = displayMetrics.density;
|
|
} catch (Exception unused4) {
|
|
}
|
|
i2 = i3;
|
|
i3 = i;
|
|
jSONArray.put(i3);
|
|
jSONArray.put(i2);
|
|
jSONArray.put(new DecimalFormat("#.##").format(d));
|
|
jSONArray.put(INSTANCE.refreshBestGuessNumberOfCPUCores());
|
|
jSONArray.put(totalExternalStorageGB);
|
|
jSONArray.put(availableExternalStorageGB);
|
|
jSONArray.put(deviceTimeZoneName);
|
|
params.put(Constants.EXTINFO, jSONArray.toString());
|
|
}
|
|
i2 = 0;
|
|
jSONArray.put(i3);
|
|
jSONArray.put(i2);
|
|
jSONArray.put(new DecimalFormat("#.##").format(d));
|
|
jSONArray.put(INSTANCE.refreshBestGuessNumberOfCPUCores());
|
|
jSONArray.put(totalExternalStorageGB);
|
|
jSONArray.put(availableExternalStorageGB);
|
|
jSONArray.put(deviceTimeZoneName);
|
|
params.put(Constants.EXTINFO, jSONArray.toString());
|
|
}
|
|
|
|
public static final Method getMethodQuietly(Class<?> clazz, String methodName, Class<?>... parameterTypes) {
|
|
Intrinsics.checkNotNullParameter(clazz, "clazz");
|
|
Intrinsics.checkNotNullParameter(methodName, "methodName");
|
|
Intrinsics.checkNotNullParameter(parameterTypes, "parameterTypes");
|
|
try {
|
|
return clazz.getMethod(methodName, (Class[]) Arrays.copyOf(parameterTypes, parameterTypes.length));
|
|
} catch (NoSuchMethodException unused) {
|
|
return null;
|
|
}
|
|
}
|
|
|
|
public static final Method getMethodQuietly(String className, String methodName, Class<?>... parameterTypes) {
|
|
Intrinsics.checkNotNullParameter(className, "className");
|
|
Intrinsics.checkNotNullParameter(methodName, "methodName");
|
|
Intrinsics.checkNotNullParameter(parameterTypes, "parameterTypes");
|
|
try {
|
|
Class<?> clazz = Class.forName(className);
|
|
Intrinsics.checkNotNullExpressionValue(clazz, "clazz");
|
|
return getMethodQuietly(clazz, methodName, (Class<?>[]) Arrays.copyOf(parameterTypes, parameterTypes.length));
|
|
} catch (ClassNotFoundException unused) {
|
|
return null;
|
|
}
|
|
}
|
|
|
|
public static final Object invokeMethodQuietly(Object obj, Method method, Object... args) {
|
|
Intrinsics.checkNotNullParameter(method, "method");
|
|
Intrinsics.checkNotNullParameter(args, "args");
|
|
try {
|
|
return method.invoke(obj, Arrays.copyOf(args, args.length));
|
|
} catch (IllegalAccessException | InvocationTargetException unused) {
|
|
return null;
|
|
}
|
|
}
|
|
|
|
public static final String getActivityName(Context context) {
|
|
if (context == null) {
|
|
return "null";
|
|
}
|
|
if (context == context.getApplicationContext()) {
|
|
return "unknown";
|
|
}
|
|
String simpleName = context.getClass().getSimpleName();
|
|
Intrinsics.checkNotNullExpressionValue(simpleName, "{\n context.javaClass.simpleName\n }");
|
|
return simpleName;
|
|
}
|
|
|
|
public static final String getUriString(Uri uri) {
|
|
if (uri == null) {
|
|
return null;
|
|
}
|
|
return uri.toString();
|
|
}
|
|
|
|
public static final boolean isWebUri(Uri uri) {
|
|
boolean equals;
|
|
boolean equals2;
|
|
boolean equals3;
|
|
if (uri != null) {
|
|
equals = StringsKt__StringsJVMKt.equals("http", uri.getScheme(), true);
|
|
if (equals) {
|
|
return true;
|
|
}
|
|
equals2 = StringsKt__StringsJVMKt.equals("https", uri.getScheme(), true);
|
|
if (equals2) {
|
|
return true;
|
|
}
|
|
equals3 = StringsKt__StringsJVMKt.equals("fbstaging", uri.getScheme(), true);
|
|
if (equals3) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public static final boolean isContentUri(Uri uri) {
|
|
boolean equals;
|
|
if (uri != null) {
|
|
equals = StringsKt__StringsJVMKt.equals("content", uri.getScheme(), true);
|
|
if (equals) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public static final boolean isFileUri(Uri uri) {
|
|
boolean equals;
|
|
if (uri != null) {
|
|
equals = StringsKt__StringsJVMKt.equals("file", uri.getScheme(), true);
|
|
if (equals) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public static final long getContentSize(Uri contentUri) {
|
|
Intrinsics.checkNotNullParameter(contentUri, "contentUri");
|
|
Cursor cursor = null;
|
|
try {
|
|
cursor = FacebookSdk.getApplicationContext().getContentResolver().query(contentUri, null, null, null, null);
|
|
if (cursor == null) {
|
|
return 0L;
|
|
}
|
|
int columnIndex = cursor.getColumnIndex("_size");
|
|
cursor.moveToFirst();
|
|
long j = cursor.getLong(columnIndex);
|
|
cursor.close();
|
|
return j;
|
|
} catch (Throwable th) {
|
|
if (cursor != null) {
|
|
cursor.close();
|
|
}
|
|
throw th;
|
|
}
|
|
}
|
|
|
|
public static final Date getBundleLongAsDate(Bundle bundle, String str, Date dateBase) {
|
|
long parseLong;
|
|
Intrinsics.checkNotNullParameter(dateBase, "dateBase");
|
|
if (bundle == null) {
|
|
return null;
|
|
}
|
|
Object obj = bundle.get(str);
|
|
if (obj instanceof Long) {
|
|
parseLong = ((Number) obj).longValue();
|
|
} else {
|
|
if (obj instanceof String) {
|
|
try {
|
|
parseLong = Long.parseLong((String) obj);
|
|
} catch (NumberFormatException unused) {
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
if (parseLong == 0) {
|
|
return new Date(Long.MAX_VALUE);
|
|
}
|
|
return new Date(dateBase.getTime() + (parseLong * 1000));
|
|
}
|
|
|
|
public static final void writeStringMapToParcel(Parcel parcel, Map<String, String> map) {
|
|
Intrinsics.checkNotNullParameter(parcel, "parcel");
|
|
if (map == null) {
|
|
parcel.writeInt(-1);
|
|
return;
|
|
}
|
|
parcel.writeInt(map.size());
|
|
for (Map.Entry<String, String> entry : map.entrySet()) {
|
|
String key = entry.getKey();
|
|
String value = entry.getValue();
|
|
parcel.writeString(key);
|
|
parcel.writeString(value);
|
|
}
|
|
}
|
|
|
|
public static final Map<String, String> readStringMapFromParcel(Parcel parcel) {
|
|
Intrinsics.checkNotNullParameter(parcel, "parcel");
|
|
int readInt = parcel.readInt();
|
|
if (readInt < 0) {
|
|
return null;
|
|
}
|
|
HashMap hashMap = new HashMap();
|
|
if (readInt > 0) {
|
|
int i = 0;
|
|
do {
|
|
i++;
|
|
hashMap.put(parcel.readString(), parcel.readString());
|
|
} while (i < readInt);
|
|
}
|
|
return hashMap;
|
|
}
|
|
|
|
public static final void writeNonnullStringMapToParcel(Parcel parcel, Map<String, String> map) {
|
|
Intrinsics.checkNotNullParameter(parcel, "parcel");
|
|
if (map == null) {
|
|
parcel.writeInt(-1);
|
|
return;
|
|
}
|
|
parcel.writeInt(map.size());
|
|
for (Map.Entry<String, String> entry : map.entrySet()) {
|
|
String key = entry.getKey();
|
|
String value = entry.getValue();
|
|
parcel.writeString(key);
|
|
parcel.writeString(value);
|
|
}
|
|
}
|
|
|
|
public static final Map<String, String> readNonnullStringMapFromParcel(Parcel parcel) {
|
|
Intrinsics.checkNotNullParameter(parcel, "parcel");
|
|
int readInt = parcel.readInt();
|
|
if (readInt < 0) {
|
|
return null;
|
|
}
|
|
HashMap hashMap = new HashMap();
|
|
if (readInt > 0) {
|
|
int i = 0;
|
|
do {
|
|
i++;
|
|
String readString = parcel.readString();
|
|
String readString2 = parcel.readString();
|
|
if (readString != null && readString2 != null) {
|
|
hashMap.put(readString, readString2);
|
|
}
|
|
} while (i < readInt);
|
|
}
|
|
return hashMap;
|
|
}
|
|
|
|
public static final boolean isCurrentAccessToken(AccessToken accessToken) {
|
|
return accessToken != null && Intrinsics.areEqual(accessToken, AccessToken.Companion.getCurrentAccessToken());
|
|
}
|
|
|
|
public static final String getGraphDomainFromTokenDomain(String str) {
|
|
String replace$default;
|
|
String replace$default2;
|
|
String facebookDomain = FacebookSdk.getFacebookDomain();
|
|
if (str == null) {
|
|
return facebookDomain;
|
|
}
|
|
if (Intrinsics.areEqual(str, FacebookSdk.GAMING)) {
|
|
replace$default2 = StringsKt__StringsJVMKt.replace$default(facebookDomain, FacebookSdk.FACEBOOK_COM, "fb.gg", false, 4, (Object) null);
|
|
return replace$default2;
|
|
}
|
|
if (!Intrinsics.areEqual(str, FacebookSdk.INSTAGRAM)) {
|
|
return facebookDomain;
|
|
}
|
|
replace$default = StringsKt__StringsJVMKt.replace$default(facebookDomain, FacebookSdk.FACEBOOK_COM, FacebookSdk.INSTAGRAM_COM, false, 4, (Object) null);
|
|
return replace$default;
|
|
}
|
|
|
|
public static final void getGraphMeRequestWithCacheAsync(final String accessToken, final GraphMeRequestWithCacheCallback callback) {
|
|
Intrinsics.checkNotNullParameter(accessToken, "accessToken");
|
|
Intrinsics.checkNotNullParameter(callback, "callback");
|
|
JSONObject profileInformation = ProfileInformationCache.getProfileInformation(accessToken);
|
|
if (profileInformation != null) {
|
|
callback.onSuccess(profileInformation);
|
|
return;
|
|
}
|
|
GraphRequest.Callback callback2 = new GraphRequest.Callback() { // from class: com.facebook.internal.Utility$$ExternalSyntheticLambda0
|
|
@Override // com.facebook.GraphRequest.Callback
|
|
public final void onCompleted(GraphResponse graphResponse) {
|
|
Utility.m580getGraphMeRequestWithCacheAsync$lambda3(Utility.GraphMeRequestWithCacheCallback.this, accessToken, graphResponse);
|
|
}
|
|
};
|
|
GraphRequest graphMeRequestWithCache = INSTANCE.getGraphMeRequestWithCache(accessToken);
|
|
graphMeRequestWithCache.setCallback(callback2);
|
|
graphMeRequestWithCache.executeAsync();
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
/* renamed from: getGraphMeRequestWithCacheAsync$lambda-3, reason: not valid java name */
|
|
public static final void m580getGraphMeRequestWithCacheAsync$lambda3(GraphMeRequestWithCacheCallback callback, String accessToken, GraphResponse response) {
|
|
Intrinsics.checkNotNullParameter(callback, "$callback");
|
|
Intrinsics.checkNotNullParameter(accessToken, "$accessToken");
|
|
Intrinsics.checkNotNullParameter(response, "response");
|
|
if (response.getError() != null) {
|
|
callback.onFailure(response.getError().getException());
|
|
return;
|
|
}
|
|
ProfileInformationCache profileInformationCache = ProfileInformationCache.INSTANCE;
|
|
JSONObject jsonObject = response.getJsonObject();
|
|
if (jsonObject == null) {
|
|
throw new IllegalStateException("Required value was null.".toString());
|
|
}
|
|
ProfileInformationCache.putProfileInformation(accessToken, jsonObject);
|
|
callback.onSuccess(response.getJsonObject());
|
|
}
|
|
|
|
public static final JSONObject awaitGetGraphMeRequestWithCache(String accessToken) {
|
|
Intrinsics.checkNotNullParameter(accessToken, "accessToken");
|
|
JSONObject profileInformation = ProfileInformationCache.getProfileInformation(accessToken);
|
|
if (profileInformation != null) {
|
|
return profileInformation;
|
|
}
|
|
GraphResponse executeAndWait = INSTANCE.getGraphMeRequestWithCache(accessToken).executeAndWait();
|
|
if (executeAndWait.getError() != null) {
|
|
return null;
|
|
}
|
|
return executeAndWait.getJsonObject();
|
|
}
|
|
|
|
private final GraphRequest getGraphMeRequestWithCache(String str) {
|
|
Bundle bundle = new Bundle();
|
|
bundle.putString(GraphRequest.FIELDS_PARAM, getProfileFieldsForGraphDomain(getCurrentTokenDomainWithDefault()));
|
|
bundle.putString("access_token", str);
|
|
GraphRequest newMeRequest = GraphRequest.Companion.newMeRequest(null, null);
|
|
newMeRequest.setParameters(bundle);
|
|
newMeRequest.setHttpMethod(HttpMethod.GET);
|
|
return newMeRequest;
|
|
}
|
|
|
|
private final String getProfileFieldsForGraphDomain(String str) {
|
|
return Intrinsics.areEqual(str, FacebookSdk.INSTAGRAM) ? INSTAGRAM_PROFILE_FIELDS : FACEBOOK_PROFILE_FIELDS;
|
|
}
|
|
|
|
private final String getCurrentTokenDomainWithDefault() {
|
|
AccessToken currentAccessToken = AccessToken.Companion.getCurrentAccessToken();
|
|
return (currentAccessToken == null || currentAccessToken.getGraphDomain() == null) ? "facebook" : currentAccessToken.getGraphDomain();
|
|
}
|
|
|
|
private final int refreshBestGuessNumberOfCPUCores() {
|
|
int i = numCPUCores;
|
|
if (i > 0) {
|
|
return i;
|
|
}
|
|
try {
|
|
File[] listFiles = new File("/sys/devices/system/cpu/").listFiles(new FilenameFilter() { // from class: com.facebook.internal.Utility$$ExternalSyntheticLambda1
|
|
@Override // java.io.FilenameFilter
|
|
public final boolean accept(File file, String str) {
|
|
boolean m581refreshBestGuessNumberOfCPUCores$lambda4;
|
|
m581refreshBestGuessNumberOfCPUCores$lambda4 = Utility.m581refreshBestGuessNumberOfCPUCores$lambda4(file, str);
|
|
return m581refreshBestGuessNumberOfCPUCores$lambda4;
|
|
}
|
|
});
|
|
if (listFiles != null) {
|
|
numCPUCores = listFiles.length;
|
|
}
|
|
} catch (Exception unused) {
|
|
}
|
|
if (numCPUCores <= 0) {
|
|
numCPUCores = Math.max(Runtime.getRuntime().availableProcessors(), 1);
|
|
}
|
|
return numCPUCores;
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
/* renamed from: refreshBestGuessNumberOfCPUCores$lambda-4, reason: not valid java name */
|
|
public static final boolean m581refreshBestGuessNumberOfCPUCores$lambda4(File file, String str) {
|
|
return Pattern.matches("cpu[0-9]+", str);
|
|
}
|
|
|
|
private final void refreshPeriodicExtendedDeviceInfo(Context context) {
|
|
if (timestampOfLastCheck == -1 || System.currentTimeMillis() - timestampOfLastCheck >= 1800000) {
|
|
timestampOfLastCheck = System.currentTimeMillis();
|
|
refreshTimezone();
|
|
refreshCarrierName(context);
|
|
refreshTotalExternalStorage();
|
|
refreshAvailableExternalStorage();
|
|
}
|
|
}
|
|
|
|
private final void refreshTimezone() {
|
|
try {
|
|
TimeZone timeZone = TimeZone.getDefault();
|
|
String displayName = timeZone.getDisplayName(timeZone.inDaylightTime(new Date()), 0);
|
|
Intrinsics.checkNotNullExpressionValue(displayName, "tz.getDisplayName(tz.inDaylightTime(Date()), TimeZone.SHORT)");
|
|
deviceTimezoneAbbreviation = displayName;
|
|
String id = timeZone.getID();
|
|
Intrinsics.checkNotNullExpressionValue(id, "tz.id");
|
|
deviceTimeZoneName = id;
|
|
} catch (AssertionError | Exception unused) {
|
|
}
|
|
}
|
|
|
|
private final void refreshCarrierName(Context context) {
|
|
if (Intrinsics.areEqual(carrierName, NO_CARRIER)) {
|
|
try {
|
|
Object systemService = context.getSystemService("phone");
|
|
if (systemService == null) {
|
|
throw new NullPointerException("null cannot be cast to non-null type android.telephony.TelephonyManager");
|
|
}
|
|
String networkOperatorName = ((TelephonyManager) systemService).getNetworkOperatorName();
|
|
Intrinsics.checkNotNullExpressionValue(networkOperatorName, "telephonyManager.networkOperatorName");
|
|
carrierName = networkOperatorName;
|
|
} catch (Exception unused) {
|
|
}
|
|
}
|
|
}
|
|
|
|
private final boolean externalStorageExists() {
|
|
return Intrinsics.areEqual("mounted", Environment.getExternalStorageState());
|
|
}
|
|
|
|
private final void refreshAvailableExternalStorage() {
|
|
try {
|
|
if (externalStorageExists()) {
|
|
StatFs statFs = new StatFs(Environment.getExternalStorageDirectory().getPath());
|
|
availableExternalStorageGB = statFs.getAvailableBlocks() * statFs.getBlockSize();
|
|
}
|
|
availableExternalStorageGB = convertBytesToGB(availableExternalStorageGB);
|
|
} catch (Exception unused) {
|
|
}
|
|
}
|
|
|
|
private final void refreshTotalExternalStorage() {
|
|
try {
|
|
if (externalStorageExists()) {
|
|
StatFs statFs = new StatFs(Environment.getExternalStorageDirectory().getPath());
|
|
totalExternalStorageGB = statFs.getBlockCount() * statFs.getBlockSize();
|
|
}
|
|
totalExternalStorageGB = convertBytesToGB(totalExternalStorageGB);
|
|
} catch (Exception unused) {
|
|
}
|
|
}
|
|
|
|
private final long convertBytesToGB(double d) {
|
|
return Math.round(d / 1.073741824E9d);
|
|
}
|
|
|
|
private final void appendAnonIdUnderCompliance(JSONObject jSONObject, AttributionIdentifiers attributionIdentifiers, String str, Context context) {
|
|
if (Build.VERSION.SDK_INT >= 31 && isGooglePlayServicesAvailable(context)) {
|
|
if (attributionIdentifiers.isTrackingLimited()) {
|
|
return;
|
|
}
|
|
jSONObject.put("anon_id", str);
|
|
return;
|
|
}
|
|
jSONObject.put("anon_id", str);
|
|
}
|
|
|
|
private final void appendAttributionIdUnderCompliance(JSONObject jSONObject, AttributionIdentifiers attributionIdentifiers, Context context) {
|
|
if (Build.VERSION.SDK_INT >= 31 && isGooglePlayServicesAvailable(context)) {
|
|
if (attributionIdentifiers.isTrackingLimited()) {
|
|
return;
|
|
}
|
|
jSONObject.put(w8.c, attributionIdentifiers.getAttributionId());
|
|
return;
|
|
}
|
|
jSONObject.put(w8.c, attributionIdentifiers.getAttributionId());
|
|
}
|
|
|
|
private final boolean isGooglePlayServicesAvailable(Context context) {
|
|
Method methodQuietly = getMethodQuietly("com.google.android.gms.common.GooglePlayServicesUtil", "isGooglePlayServicesAvailable", (Class<?>[]) new Class[]{Context.class});
|
|
if (methodQuietly == null) {
|
|
return false;
|
|
}
|
|
Object invokeMethodQuietly = invokeMethodQuietly(null, methodQuietly, context);
|
|
return (invokeMethodQuietly instanceof Integer) && Intrinsics.areEqual(invokeMethodQuietly, (Object) 0);
|
|
}
|
|
|
|
public static final String generateRandomString(int i) {
|
|
String bigInteger = new BigInteger(i * 5, new Random()).toString(32);
|
|
Intrinsics.checkNotNullExpressionValue(bigInteger, "BigInteger(length * 5, r).toString(32)");
|
|
return bigInteger;
|
|
}
|
|
|
|
public static final boolean mustFixWindowParamsForAutofill(Context context) {
|
|
Intrinsics.checkNotNullParameter(context, "context");
|
|
return isAutofillAvailable(context);
|
|
}
|
|
|
|
public static final boolean isAutofillAvailable(Context context) {
|
|
Intrinsics.checkNotNullParameter(context, "context");
|
|
AutofillManager autofillManager = (AutofillManager) context.getSystemService(AutofillManager.class);
|
|
return autofillManager != null && autofillManager.isAutofillSupported() && autofillManager.isEnabled();
|
|
}
|
|
|
|
public static final boolean isChromeOS(Context context) {
|
|
Intrinsics.checkNotNullParameter(context, "context");
|
|
if (Build.VERSION.SDK_INT >= 27) {
|
|
return context.getPackageManager().hasSystemFeature("android.hardware.type.pc");
|
|
}
|
|
String DEVICE = Build.DEVICE;
|
|
if (DEVICE != null) {
|
|
Intrinsics.checkNotNullExpressionValue(DEVICE, "DEVICE");
|
|
if (new Regex(ARC_DEVICE_PATTERN).matches(DEVICE)) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public static final Locale getResourceLocale() {
|
|
try {
|
|
return FacebookSdk.getApplicationContext().getResources().getConfiguration().locale;
|
|
} catch (Exception unused) {
|
|
return null;
|
|
}
|
|
}
|
|
|
|
public static final Locale getCurrentLocale() {
|
|
Locale resourceLocale = getResourceLocale();
|
|
if (resourceLocale != null) {
|
|
return resourceLocale;
|
|
}
|
|
Locale locale2 = Locale.getDefault();
|
|
Intrinsics.checkNotNullExpressionValue(locale2, "getDefault()");
|
|
return locale2;
|
|
}
|
|
|
|
public static final void runOnNonUiThread(Runnable runnable) {
|
|
try {
|
|
FacebookSdk.getExecutor().execute(runnable);
|
|
} catch (Exception unused) {
|
|
}
|
|
}
|
|
|
|
public static final String getAppName(Context context) {
|
|
String string;
|
|
Intrinsics.checkNotNullParameter(context, "context");
|
|
try {
|
|
String applicationName = FacebookSdk.getApplicationName();
|
|
if (applicationName != null) {
|
|
return applicationName;
|
|
}
|
|
ApplicationInfo applicationInfo = context.getApplicationInfo();
|
|
int i = applicationInfo.labelRes;
|
|
if (i == 0) {
|
|
string = applicationInfo.nonLocalizedLabel.toString();
|
|
} else {
|
|
string = context.getString(i);
|
|
Intrinsics.checkNotNullExpressionValue(string, "context.getString(stringId)");
|
|
}
|
|
return string;
|
|
} catch (Exception unused) {
|
|
return "";
|
|
}
|
|
}
|
|
|
|
public static final boolean isAutoAppLinkSetup() {
|
|
try {
|
|
Intent intent = new Intent("android.intent.action.VIEW");
|
|
StringCompanionObject stringCompanionObject = StringCompanionObject.INSTANCE;
|
|
String format = String.format("fb%s://applinks", Arrays.copyOf(new Object[]{FacebookSdk.getApplicationId()}, 1));
|
|
Intrinsics.checkNotNullExpressionValue(format, "java.lang.String.format(format, *args)");
|
|
intent.setData(Uri.parse(format));
|
|
Context applicationContext = FacebookSdk.getApplicationContext();
|
|
PackageManager packageManager = applicationContext.getPackageManager();
|
|
String packageName = applicationContext.getPackageName();
|
|
List<ResolveInfo> queryIntentActivities = packageManager.queryIntentActivities(intent, 65536);
|
|
Intrinsics.checkNotNullExpressionValue(queryIntentActivities, "packageManager.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY)");
|
|
Iterator<ResolveInfo> it = queryIntentActivities.iterator();
|
|
while (it.hasNext()) {
|
|
if (Intrinsics.areEqual(packageName, it.next().activityInfo.packageName)) {
|
|
return true;
|
|
}
|
|
}
|
|
} catch (Exception unused) {
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public static final JSONObject getDataProcessingOptions() {
|
|
if (CrashShieldHandler.isObjectCrashing(Utility.class)) {
|
|
return null;
|
|
}
|
|
try {
|
|
String string = FacebookSdk.getApplicationContext().getSharedPreferences(FacebookSdk.DATA_PROCESSING_OPTIONS_PREFERENCES, 0).getString(FacebookSdk.DATA_PROCESSION_OPTIONS, null);
|
|
if (string != null) {
|
|
try {
|
|
return new JSONObject(string);
|
|
} catch (JSONException unused) {
|
|
}
|
|
}
|
|
return null;
|
|
} catch (Throwable th) {
|
|
CrashShieldHandler.handleThrowable(th, Utility.class);
|
|
return null;
|
|
}
|
|
}
|
|
|
|
public static final boolean isDataProcessingRestricted() {
|
|
if (CrashShieldHandler.isObjectCrashing(Utility.class)) {
|
|
return false;
|
|
}
|
|
try {
|
|
JSONObject dataProcessingOptions = getDataProcessingOptions();
|
|
if (dataProcessingOptions == null) {
|
|
return false;
|
|
}
|
|
try {
|
|
JSONArray jSONArray = dataProcessingOptions.getJSONArray(FacebookSdk.DATA_PROCESSION_OPTIONS);
|
|
int length = jSONArray.length();
|
|
if (length > 0) {
|
|
int i = 0;
|
|
while (true) {
|
|
int i2 = i + 1;
|
|
String string = jSONArray.getString(i);
|
|
Intrinsics.checkNotNullExpressionValue(string, "options.getString(i)");
|
|
String lowerCase = string.toLowerCase();
|
|
Intrinsics.checkNotNullExpressionValue(lowerCase, "(this as java.lang.String).toLowerCase()");
|
|
if (Intrinsics.areEqual(lowerCase, "ldu")) {
|
|
return true;
|
|
}
|
|
if (i2 >= length) {
|
|
break;
|
|
}
|
|
i = i2;
|
|
}
|
|
}
|
|
} catch (Exception unused) {
|
|
}
|
|
return false;
|
|
} catch (Throwable th) {
|
|
CrashShieldHandler.handleThrowable(th, Utility.class);
|
|
return false;
|
|
}
|
|
}
|
|
}
|