Add decompiled APK source code (JADX)

- 28,932 files
- Full Java source code
- Smali files
- Resources

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-02-18 14:52:23 -08:00
parent cc210a65ea
commit f9d20bb3fc
26991 changed files with 2541449 additions and 0 deletions

View File

@@ -0,0 +1,97 @@
package com.facebook.internal;
/* loaded from: classes2.dex */
public final class AnalyticsEvents {
public static final String EVENT_DEVICE_SHARE_BUTTON_CREATE = "fb_device_share_button_create";
public static final String EVENT_DEVICE_SHARE_BUTTON_DID_TAP = "fb_device_share_button_did_tap";
public static final String EVENT_FOA_DISAMBIGUATION_DIALOG_CANCELLED = "foa_disambiguation_dialog_cancelled";
public static final String EVENT_FOA_DISAMBIGUATION_DIALOG_FB_DID_TAP = "foa_disambiguation_dialog_fb_did_tap";
public static final String EVENT_FOA_DISAMBIGUATION_DIALOG_IG_DID_TAP = "foa_disambiguation_dialog_ig_did_tap";
public static final String EVENT_FOA_FB_LOGIN_BUTTON_CREATE = "foa_fb_login_button_create";
public static final String EVENT_FOA_FB_LOGIN_BUTTON_DID_TAP = "foa_fb_login_button_did_tap";
public static final String EVENT_FOA_IG_LOGIN_BUTTON_CREATE = "foa_ig_login_button_create";
public static final String EVENT_FOA_IG_LOGIN_BUTTON_DID_TAP = "foa_ig_login_button_did_tap";
public static final String EVENT_FOA_LOGIN_BUTTON_CREATE = "foa_login_button_create";
public static final String EVENT_FOA_LOGIN_BUTTON_DID_TAP = "foa_login_button_did_tap";
public static final String EVENT_FRIEND_PICKER_USAGE = "fb_friend_picker_usage";
public static final String EVENT_LIKE_BUTTON_CREATE = "fb_like_button_create";
public static final String EVENT_LIKE_BUTTON_DID_TAP = "fb_like_button_did_tap";
public static final String EVENT_LIKE_VIEW_CANNOT_PRESENT_DIALOG = "fb_like_control_cannot_present_dialog";
public static final String EVENT_LIKE_VIEW_DIALOG_DID_SUCCEED = "fb_like_control_dialog_did_succeed";
public static final String EVENT_LIKE_VIEW_DID_LIKE = "fb_like_control_did_like";
public static final String EVENT_LIKE_VIEW_DID_PRESENT_DIALOG = "fb_like_control_did_present_dialog";
public static final String EVENT_LIKE_VIEW_DID_PRESENT_FALLBACK = "fb_like_control_did_present_fallback_dialog";
public static final String EVENT_LIKE_VIEW_DID_UNDO_QUICKLY = "fb_like_control_did_undo_quickly";
public static final String EVENT_LIKE_VIEW_DID_UNLIKE = "fb_like_control_did_unlike";
public static final String EVENT_LIKE_VIEW_ERROR = "fb_like_control_error";
public static final String EVENT_LOGIN_BUTTON_CREATE = "fb_login_button_create";
public static final String EVENT_LOGIN_BUTTON_DID_TAP = "fb_login_button_did_tap";
public static final String EVENT_LOGIN_VIEW_USAGE = "fb_login_view_usage";
public static final String EVENT_NATIVE_DIALOG_COMPLETE = "fb_native_dialog_complete";
public static final String EVENT_NATIVE_DIALOG_START = "fb_native_dialog_start";
public static final String EVENT_NATIVE_DIALOG_TYPE_LIKE = "fb_dialogs_present_like";
public static final String EVENT_NATIVE_DIALOG_TYPE_MESSAGE = "fb_dialogs_present_message";
public static final String EVENT_NATIVE_DIALOG_TYPE_OG_MESSAGE = "fb_dialogs_present_message_og";
public static final String EVENT_NATIVE_DIALOG_TYPE_OG_SHARE = "fb_dialogs_present_share_og";
public static final String EVENT_NATIVE_DIALOG_TYPE_PHOTO_MESSAGE = "fb_dialogs_present_message_photo";
public static final String EVENT_NATIVE_DIALOG_TYPE_PHOTO_SHARE = "fb_dialogs_present_share_photo";
public static final String EVENT_NATIVE_DIALOG_TYPE_SHARE = "fb_dialogs_present_share";
public static final String EVENT_NATIVE_DIALOG_TYPE_VIDEO_SHARE = "fb_dialogs_present_share_video";
public static final String EVENT_NATIVE_LOGIN_DIALOG_COMPLETE = "fb_dialogs_native_login_dialog_complete";
public static final String EVENT_NATIVE_LOGIN_DIALOG_START = "fb_dialogs_native_login_dialog_start";
public static final String EVENT_PLACE_PICKER_USAGE = "fb_place_picker_usage";
public static final String EVENT_SDK_INITIALIZE = "fb_sdk_initialize";
public static final String EVENT_SEND_BUTTON_CREATE = "fb_send_button_create";
public static final String EVENT_SEND_BUTTON_DID_TAP = "fb_send_button_did_tap";
public static final String EVENT_SHARE_BUTTON_CREATE = "fb_share_button_create";
public static final String EVENT_SHARE_BUTTON_DID_TAP = "fb_share_button_did_tap";
public static final String EVENT_SHARE_DIALOG_SHOW = "fb_share_dialog_show";
public static final String EVENT_SHARE_MESSENGER_DIALOG_SHOW = "fb_messenger_share_dialog_show";
public static final String EVENT_SHARE_RESULT = "fb_share_dialog_result";
public static final String EVENT_SMART_LOGIN_SERVICE = "fb_smart_login_service";
public static final String EVENT_USER_SETTINGS_USAGE = "fb_user_settings_vc_usage";
public static final String EVENT_WEB_LOGIN_COMPLETE = "fb_dialogs_web_login_dialog_complete";
public static final AnalyticsEvents INSTANCE = new AnalyticsEvents();
public static final String PARAMETER_ACTION_ID = "action_id";
public static final String PARAMETER_APP_ID = "app_id";
public static final String PARAMETER_CALL_ID = "call_id";
public static final String PARAMETER_DIALOG_OUTCOME = "fb_dialog_outcome";
public static final String PARAMETER_DIALOG_OUTCOME_VALUE_CANCELLED = "Cancelled";
public static final String PARAMETER_DIALOG_OUTCOME_VALUE_COMPLETED = "Completed";
public static final String PARAMETER_DIALOG_OUTCOME_VALUE_FAILED = "Failed";
public static final String PARAMETER_DIALOG_OUTCOME_VALUE_UNKNOWN = "Unknown";
public static final String PARAMETER_LIKE_VIEW_AUXILIARY_POSITION = "auxiliary_position";
public static final String PARAMETER_LIKE_VIEW_CURRENT_ACTION = "current_action";
public static final String PARAMETER_LIKE_VIEW_ERROR_JSON = "error";
public static final String PARAMETER_LIKE_VIEW_HORIZONTAL_ALIGNMENT = "horizontal_alignment";
public static final String PARAMETER_LIKE_VIEW_OBJECT_ID = "object_id";
public static final String PARAMETER_LIKE_VIEW_OBJECT_TYPE = "object_type";
public static final String PARAMETER_LIKE_VIEW_STYLE = "style";
public static final String PARAMETER_NATIVE_LOGIN_DIALOG_COMPLETE_TIME = "fb_native_login_dialog_complete_time";
public static final String PARAMETER_NATIVE_LOGIN_DIALOG_START_TIME = "fb_native_login_dialog_start_time";
public static final String PARAMETER_SHARE_DIALOG_CONTENT_PAGE_ID = "fb_share_dialog_content_page_id";
public static final String PARAMETER_SHARE_DIALOG_CONTENT_PHOTO = "photo";
public static final String PARAMETER_SHARE_DIALOG_CONTENT_STATUS = "status";
public static final String PARAMETER_SHARE_DIALOG_CONTENT_TYPE = "fb_share_dialog_content_type";
public static final String PARAMETER_SHARE_DIALOG_CONTENT_UNKNOWN = "unknown";
public static final String PARAMETER_SHARE_DIALOG_CONTENT_UUID = "fb_share_dialog_content_uuid";
public static final String PARAMETER_SHARE_DIALOG_CONTENT_VIDEO = "video";
public static final String PARAMETER_SHARE_DIALOG_SHOW = "fb_share_dialog_show";
public static final String PARAMETER_SHARE_DIALOG_SHOW_AUTOMATIC = "automatic";
public static final String PARAMETER_SHARE_DIALOG_SHOW_NATIVE = "native";
public static final String PARAMETER_SHARE_DIALOG_SHOW_UNKNOWN = "unknown";
public static final String PARAMETER_SHARE_DIALOG_SHOW_WEB = "web";
public static final String PARAMETER_SHARE_ERROR_MESSAGE = "error_message";
public static final String PARAMETER_SHARE_MESSENGER_GENERIC_TEMPLATE = "GenericTemplate";
public static final String PARAMETER_SHARE_MESSENGER_MEDIA_TEMPLATE = "MediaTemplate";
public static final String PARAMETER_SHARE_OUTCOME = "fb_share_dialog_outcome";
public static final String PARAMETER_SHARE_OUTCOME_CANCELLED = "cancelled";
public static final String PARAMETER_SHARE_OUTCOME_ERROR = "error";
public static final String PARAMETER_SHARE_OUTCOME_SUCCEEDED = "succeeded";
public static final String PARAMETER_SHARE_OUTCOME_UNKNOWN = "unknown";
public static final String PARAMETER_WEB_LOGIN_E2E = "fb_web_login_e2e";
public static final String PARAMETER_WEB_LOGIN_SWITCHBACK_TIME = "fb_web_login_switchback_time";
private AnalyticsEvents() {
}
}

View File

@@ -0,0 +1,185 @@
package com.facebook.internal;
import android.content.Intent;
import com.facebook.internal.instrument.crashshield.CrashShieldHandler;
import java.util.UUID;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes2.dex */
public final class AppCall {
public static final Companion Companion = new Companion(null);
private static AppCall currentPendingCall;
private final UUID callId;
private int requestCode;
private Intent requestIntent;
/* JADX WARN: Multi-variable type inference failed */
public AppCall(int i) {
this(i, null, 2, 0 == true ? 1 : 0);
}
public static final synchronized AppCall finishPendingCall(UUID uuid, int i) {
synchronized (AppCall.class) {
if (CrashShieldHandler.isObjectCrashing(AppCall.class)) {
return null;
}
try {
return Companion.finishPendingCall(uuid, i);
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, AppCall.class);
return null;
}
}
}
public AppCall(int i, UUID callId) {
Intrinsics.checkNotNullParameter(callId, "callId");
this.requestCode = i;
this.callId = callId;
}
public static final /* synthetic */ AppCall access$getCurrentPendingCall$cp() {
if (CrashShieldHandler.isObjectCrashing(AppCall.class)) {
return null;
}
try {
return currentPendingCall;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, AppCall.class);
return null;
}
}
public static final /* synthetic */ void access$setCurrentPendingCall$cp(AppCall appCall) {
if (CrashShieldHandler.isObjectCrashing(AppCall.class)) {
return;
}
try {
currentPendingCall = appCall;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, AppCall.class);
}
}
public final int getRequestCode() {
if (CrashShieldHandler.isObjectCrashing(this)) {
return 0;
}
try {
return this.requestCode;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return 0;
}
}
public final void setRequestCode(int i) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
this.requestCode = i;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
/* JADX WARN: Illegal instructions before constructor call */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public /* synthetic */ AppCall(int r1, java.util.UUID r2, int r3, kotlin.jvm.internal.DefaultConstructorMarker r4) {
/*
r0 = this;
r3 = r3 & 2
if (r3 == 0) goto Ld
java.util.UUID r2 = java.util.UUID.randomUUID()
java.lang.String r3 = "randomUUID()"
kotlin.jvm.internal.Intrinsics.checkNotNullExpressionValue(r2, r3)
Ld:
r0.<init>(r1, r2)
return
*/
throw new UnsupportedOperationException("Method not decompiled: com.facebook.internal.AppCall.<init>(int, java.util.UUID, int, kotlin.jvm.internal.DefaultConstructorMarker):void");
}
public final UUID getCallId() {
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
return this.callId;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return null;
}
}
public final Intent getRequestIntent() {
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
return this.requestIntent;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return null;
}
}
public final void setRequestIntent(Intent intent) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
this.requestIntent = intent;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
public final boolean setPending() {
if (CrashShieldHandler.isObjectCrashing(this)) {
return false;
}
try {
return Companion.setCurrentPendingCall(this);
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return false;
}
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
public final AppCall getCurrentPendingCall() {
return AppCall.access$getCurrentPendingCall$cp();
}
public final synchronized AppCall finishPendingCall(UUID callId, int i) {
Intrinsics.checkNotNullParameter(callId, "callId");
AppCall currentPendingCall = getCurrentPendingCall();
if (currentPendingCall != null && Intrinsics.areEqual(currentPendingCall.getCallId(), callId) && currentPendingCall.getRequestCode() == i) {
setCurrentPendingCall(null);
return currentPendingCall;
}
return null;
}
/* JADX INFO: Access modifiers changed from: private */
public final synchronized boolean setCurrentPendingCall(AppCall appCall) {
AppCall currentPendingCall;
currentPendingCall = getCurrentPendingCall();
AppCall.access$setCurrentPendingCall$cp(appCall);
return currentPendingCall != null;
}
}
}

View File

@@ -0,0 +1,283 @@
package com.facebook.internal;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.content.pm.PackageManager;
import android.os.IBinder;
import android.os.IInterface;
import android.os.Parcel;
import android.os.RemoteException;
import androidx.annotation.RestrictTo;
import androidx.annotation.VisibleForTesting;
import com.facebook.FacebookSdk;
import com.ironsource.v8;
import java.lang.reflect.Method;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.atomic.AtomicBoolean;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes2.dex */
public final class AttributionIdentifiers {
private static final String ANDROID_ID_COLUMN_NAME = "androidid";
private static final String ATTRIBUTION_ID_COLUMN_NAME = "aid";
public static final String ATTRIBUTION_ID_CONTENT_PROVIDER = "com.facebook.katana.provider.AttributionIdProvider";
private static final String ATTRIBUTION_ID_CONTENT_PROVIDER_WAKIZASHI = "com.facebook.wakizashi.provider.AttributionIdProvider";
private static final int CONNECTION_RESULT_SUCCESS = 0;
private static final long IDENTIFIER_REFRESH_INTERVAL_MILLIS = 3600000;
private static final String LIMIT_TRACKING_COLUMN_NAME = "limit_tracking";
public static AttributionIdentifiers cachedIdentifiers;
private String androidAdvertiserIdValue;
private String androidInstallerPackage;
private String attributionId;
private long fetchTime;
private boolean isTrackingLimited;
public static final Companion Companion = new Companion(null);
private static final String TAG = AttributionIdentifiers.class.getCanonicalName();
public static final AttributionIdentifiers getAttributionIdentifiers(Context context) {
return Companion.getAttributionIdentifiers(context);
}
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
public static final boolean isTrackingLimited(Context context) {
return Companion.isTrackingLimited(context);
}
public final String getAndroidInstallerPackage() {
return this.androidInstallerPackage;
}
public final String getAttributionId() {
return this.attributionId;
}
public final boolean isTrackingLimited() {
return this.isTrackingLimited;
}
public final String getAndroidAdvertiserId() {
if (FacebookSdk.isInitialized() && FacebookSdk.getAdvertiserIDCollectionEnabled()) {
return this.androidAdvertiserIdValue;
}
return null;
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
@VisibleForTesting(otherwise = 2)
public static /* synthetic */ void getATTRIBUTION_ID_CONTENT_PROVIDER$facebook_core_release$annotations() {
}
@VisibleForTesting(otherwise = 2)
public static /* synthetic */ void getCachedIdentifiers$facebook_core_release$annotations() {
}
private Companion() {
}
private final AttributionIdentifiers getAndroidId(Context context) {
AttributionIdentifiers androidIdViaReflection = getAndroidIdViaReflection(context);
if (androidIdViaReflection != null) {
return androidIdViaReflection;
}
AttributionIdentifiers androidIdViaService = getAndroidIdViaService(context);
return androidIdViaService == null ? new AttributionIdentifiers() : androidIdViaService;
}
private final AttributionIdentifiers getAndroidIdViaReflection(Context context) {
Object invokeMethodQuietly;
try {
if (!isGooglePlayServicesAvailable(context)) {
return null;
}
boolean z = false;
Method methodQuietly = Utility.getMethodQuietly("com.google.android.gms.ads.identifier.AdvertisingIdClient", "getAdvertisingIdInfo", (Class<?>[]) new Class[]{Context.class});
if (methodQuietly == null || (invokeMethodQuietly = Utility.invokeMethodQuietly(null, methodQuietly, context)) == null) {
return null;
}
Method methodQuietly2 = Utility.getMethodQuietly(invokeMethodQuietly.getClass(), "getId", (Class<?>[]) new Class[0]);
Method methodQuietly3 = Utility.getMethodQuietly(invokeMethodQuietly.getClass(), v8.i.M, (Class<?>[]) new Class[0]);
if (methodQuietly2 != null && methodQuietly3 != null) {
AttributionIdentifiers attributionIdentifiers = new AttributionIdentifiers();
attributionIdentifiers.androidAdvertiserIdValue = (String) Utility.invokeMethodQuietly(invokeMethodQuietly, methodQuietly2, new Object[0]);
Boolean bool = (Boolean) Utility.invokeMethodQuietly(invokeMethodQuietly, methodQuietly3, new Object[0]);
if (bool != null) {
z = bool.booleanValue();
}
attributionIdentifiers.isTrackingLimited = z;
return attributionIdentifiers;
}
return null;
} catch (Exception e) {
Utility.logd("android_id", e);
return null;
}
}
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
public final boolean isTrackingLimited(Context context) {
Intrinsics.checkNotNullParameter(context, "context");
AttributionIdentifiers attributionIdentifiers = getAttributionIdentifiers(context);
return attributionIdentifiers != null && attributionIdentifiers.isTrackingLimited();
}
private final boolean isGooglePlayServicesAvailable(Context context) {
Method methodQuietly = Utility.getMethodQuietly("com.google.android.gms.common.GooglePlayServicesUtil", "isGooglePlayServicesAvailable", (Class<?>[]) new Class[]{Context.class});
if (methodQuietly == null) {
return false;
}
Object invokeMethodQuietly = Utility.invokeMethodQuietly(null, methodQuietly, context);
return (invokeMethodQuietly instanceof Integer) && Intrinsics.areEqual(invokeMethodQuietly, (Object) 0);
}
private final AttributionIdentifiers getAndroidIdViaService(Context context) {
if (!isGooglePlayServicesAvailable(context)) {
return null;
}
GoogleAdServiceConnection googleAdServiceConnection = new GoogleAdServiceConnection();
Intent intent = new Intent("com.google.android.gms.ads.identifier.service.START");
intent.setPackage("com.google.android.gms");
try {
try {
if (context.bindService(intent, googleAdServiceConnection, 1)) {
GoogleAdInfo googleAdInfo = new GoogleAdInfo(googleAdServiceConnection.getBinder());
AttributionIdentifiers attributionIdentifiers = new AttributionIdentifiers();
attributionIdentifiers.androidAdvertiserIdValue = googleAdInfo.getAdvertiserId();
attributionIdentifiers.isTrackingLimited = googleAdInfo.isTrackingLimited();
return attributionIdentifiers;
}
} catch (Exception e) {
Utility.logd("android_id", e);
} finally {
context.unbindService(googleAdServiceConnection);
}
} catch (SecurityException unused) {
}
return null;
}
/* JADX WARN: Removed duplicated region for block: B:19:0x0092 A[Catch: all -> 0x0033, Exception -> 0x0036, TryCatch #4 {Exception -> 0x0036, all -> 0x0033, blocks: (B:3:0x0010, B:5:0x001e, B:7:0x0022, B:11:0x003a, B:13:0x005c, B:15:0x006b, B:17:0x008c, B:19:0x0092, B:21:0x0097, B:23:0x009c, B:57:0x0075, B:59:0x0084, B:61:0x00fc, B:62:0x0103), top: B:2:0x0010 }] */
/* JADX WARN: Removed duplicated region for block: B:21:0x0097 A[Catch: all -> 0x0033, Exception -> 0x0036, TryCatch #4 {Exception -> 0x0036, all -> 0x0033, blocks: (B:3:0x0010, B:5:0x001e, B:7:0x0022, B:11:0x003a, B:13:0x005c, B:15:0x006b, B:17:0x008c, B:19:0x0092, B:21:0x0097, B:23:0x009c, B:57:0x0075, B:59:0x0084, B:61:0x00fc, B:62:0x0103), top: B:2:0x0010 }] */
/* JADX WARN: Removed duplicated region for block: B:23:0x009c A[Catch: all -> 0x0033, Exception -> 0x0036, TRY_LEAVE, TryCatch #4 {Exception -> 0x0036, all -> 0x0033, blocks: (B:3:0x0010, B:5:0x001e, B:7:0x0022, B:11:0x003a, B:13:0x005c, B:15:0x006b, B:17:0x008c, B:19:0x0092, B:21:0x0097, B:23:0x009c, B:57:0x0075, B:59:0x0084, B:61:0x00fc, B:62:0x0103), top: B:2:0x0010 }] */
/* JADX WARN: Removed duplicated region for block: B:52:0x011f */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public final com.facebook.internal.AttributionIdentifiers getAttributionIdentifiers(android.content.Context r14) {
/*
Method dump skipped, instructions count: 291
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: com.facebook.internal.AttributionIdentifiers.Companion.getAttributionIdentifiers(android.content.Context):com.facebook.internal.AttributionIdentifiers");
}
private final AttributionIdentifiers cacheAndReturnIdentifiers(AttributionIdentifiers attributionIdentifiers) {
attributionIdentifiers.fetchTime = System.currentTimeMillis();
AttributionIdentifiers.cachedIdentifiers = attributionIdentifiers;
return attributionIdentifiers;
}
private final String getInstallerPackageName(Context context) {
PackageManager packageManager = context.getPackageManager();
if (packageManager == null) {
return null;
}
return packageManager.getInstallerPackageName(context.getPackageName());
}
}
public static final class GoogleAdServiceConnection implements ServiceConnection {
private final AtomicBoolean consumed = new AtomicBoolean(false);
private final BlockingQueue<IBinder> queue = new LinkedBlockingDeque();
@Override // android.content.ServiceConnection
public void onServiceDisconnected(ComponentName componentName) {
}
@Override // android.content.ServiceConnection
public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
if (iBinder != null) {
try {
this.queue.put(iBinder);
} catch (InterruptedException unused) {
}
}
}
public final IBinder getBinder() throws InterruptedException {
if (!(!this.consumed.compareAndSet(true, true))) {
throw new IllegalStateException("Binder already consumed".toString());
}
IBinder take = this.queue.take();
Intrinsics.checkNotNullExpressionValue(take, "queue.take()");
return take;
}
}
public static final class GoogleAdInfo implements IInterface {
public static final Companion Companion = new Companion(null);
private static final int FIRST_TRANSACTION_CODE = 1;
private static final int SECOND_TRANSACTION_CODE = 2;
private final IBinder binder;
@Override // android.os.IInterface
public IBinder asBinder() {
return this.binder;
}
public GoogleAdInfo(IBinder binder) {
Intrinsics.checkNotNullParameter(binder, "binder");
this.binder = binder;
}
public final String getAdvertiserId() throws RemoteException {
Parcel obtain = Parcel.obtain();
Intrinsics.checkNotNullExpressionValue(obtain, "obtain()");
Parcel obtain2 = Parcel.obtain();
Intrinsics.checkNotNullExpressionValue(obtain2, "obtain()");
try {
obtain.writeInterfaceToken("com.google.android.gms.ads.identifier.internal.IAdvertisingIdService");
this.binder.transact(1, obtain, obtain2, 0);
obtain2.readException();
return obtain2.readString();
} finally {
obtain2.recycle();
obtain.recycle();
}
}
public final boolean isTrackingLimited() throws RemoteException {
Parcel obtain = Parcel.obtain();
Intrinsics.checkNotNullExpressionValue(obtain, "obtain()");
Parcel obtain2 = Parcel.obtain();
Intrinsics.checkNotNullExpressionValue(obtain2, "obtain()");
try {
obtain.writeInterfaceToken("com.google.android.gms.ads.identifier.internal.IAdvertisingIdService");
obtain.writeInt(1);
this.binder.transact(2, obtain, obtain2, 0);
obtain2.readException();
return obtain2.readInt() != 0;
} finally {
obtain2.recycle();
obtain.recycle();
}
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
}
}
}

View File

@@ -0,0 +1,185 @@
package com.facebook.internal;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import androidx.annotation.VisibleForTesting;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import com.facebook.appevents.InternalAppEventsLogger;
import com.facebook.internal.instrument.crashshield.CrashShieldHandler;
import java.util.Set;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.Regex;
/* loaded from: classes2.dex */
public final class BoltsMeasurementEventListener extends BroadcastReceiver {
private static final String BOLTS_MEASUREMENT_EVENT_PREFIX = "bf_";
private static final String MEASUREMENT_EVENT_ARGS_KEY = "event_args";
private static final String MEASUREMENT_EVENT_NAME_KEY = "event_name";
private static BoltsMeasurementEventListener singleton;
private final Context applicationContext;
public static final Companion Companion = new Companion(null);
private static final String MEASUREMENT_EVENT_NOTIFICATION_NAME = "com.parse.bolts.measurement_event";
public /* synthetic */ BoltsMeasurementEventListener(Context context, DefaultConstructorMarker defaultConstructorMarker) {
this(context);
}
public static final BoltsMeasurementEventListener getInstance(Context context) {
if (CrashShieldHandler.isObjectCrashing(BoltsMeasurementEventListener.class)) {
return null;
}
try {
return Companion.getInstance(context);
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, BoltsMeasurementEventListener.class);
return null;
}
}
public static final /* synthetic */ String access$getMEASUREMENT_EVENT_NOTIFICATION_NAME$cp() {
if (CrashShieldHandler.isObjectCrashing(BoltsMeasurementEventListener.class)) {
return null;
}
try {
return MEASUREMENT_EVENT_NOTIFICATION_NAME;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, BoltsMeasurementEventListener.class);
return null;
}
}
public static final /* synthetic */ BoltsMeasurementEventListener access$getSingleton$cp() {
if (CrashShieldHandler.isObjectCrashing(BoltsMeasurementEventListener.class)) {
return null;
}
try {
return singleton;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, BoltsMeasurementEventListener.class);
return null;
}
}
public static final /* synthetic */ void access$open(BoltsMeasurementEventListener boltsMeasurementEventListener) {
if (CrashShieldHandler.isObjectCrashing(BoltsMeasurementEventListener.class)) {
return;
}
try {
boltsMeasurementEventListener.open();
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, BoltsMeasurementEventListener.class);
}
}
public static final /* synthetic */ void access$setSingleton$cp(BoltsMeasurementEventListener boltsMeasurementEventListener) {
if (CrashShieldHandler.isObjectCrashing(BoltsMeasurementEventListener.class)) {
return;
}
try {
singleton = boltsMeasurementEventListener;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, BoltsMeasurementEventListener.class);
}
}
private BoltsMeasurementEventListener(Context context) {
Context applicationContext = context.getApplicationContext();
Intrinsics.checkNotNullExpressionValue(applicationContext, "context.applicationContext");
this.applicationContext = applicationContext;
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
@VisibleForTesting
public static /* synthetic */ void getMEASUREMENT_EVENT_NOTIFICATION_NAME$facebook_core_release$annotations() {
}
private Companion() {
}
public final String getMEASUREMENT_EVENT_NOTIFICATION_NAME$facebook_core_release() {
return BoltsMeasurementEventListener.access$getMEASUREMENT_EVENT_NOTIFICATION_NAME$cp();
}
public final BoltsMeasurementEventListener getInstance(Context context) {
Intrinsics.checkNotNullParameter(context, "context");
if (BoltsMeasurementEventListener.access$getSingleton$cp() != null) {
return BoltsMeasurementEventListener.access$getSingleton$cp();
}
BoltsMeasurementEventListener boltsMeasurementEventListener = new BoltsMeasurementEventListener(context, null);
BoltsMeasurementEventListener.access$open(boltsMeasurementEventListener);
BoltsMeasurementEventListener.access$setSingleton$cp(boltsMeasurementEventListener);
return BoltsMeasurementEventListener.access$getSingleton$cp();
}
}
private final void open() {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
LocalBroadcastManager localBroadcastManager = LocalBroadcastManager.getInstance(this.applicationContext);
Intrinsics.checkNotNullExpressionValue(localBroadcastManager, "getInstance(applicationContext)");
localBroadcastManager.registerReceiver(this, new IntentFilter(MEASUREMENT_EVENT_NOTIFICATION_NAME));
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
private final void close() {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
LocalBroadcastManager localBroadcastManager = LocalBroadcastManager.getInstance(this.applicationContext);
Intrinsics.checkNotNullExpressionValue(localBroadcastManager, "getInstance(applicationContext)");
localBroadcastManager.unregisterReceiver(this);
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
public final void finalize() throws Throwable {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
close();
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
@Override // android.content.BroadcastReceiver
public void onReceive(Context context, Intent intent) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
InternalAppEventsLogger internalAppEventsLogger = new InternalAppEventsLogger(context);
Set<String> set = null;
String stringPlus = Intrinsics.stringPlus(BOLTS_MEASUREMENT_EVENT_PREFIX, intent == null ? null : intent.getStringExtra("event_name"));
Bundle bundleExtra = intent == null ? null : intent.getBundleExtra(MEASUREMENT_EVENT_ARGS_KEY);
Bundle bundle = new Bundle();
if (bundleExtra != null) {
set = bundleExtra.keySet();
}
if (set != null) {
for (String key : set) {
Intrinsics.checkNotNullExpressionValue(key, "key");
bundle.putString(new Regex("[ -]*$").replace(new Regex("^[ -]*").replace(new Regex("[^0-9a-zA-Z _-]").replace(key, "-"), ""), ""), (String) bundleExtra.get(key));
}
}
internalAppEventsLogger.logEvent(stringPlus, bundle);
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
}

View File

@@ -0,0 +1,237 @@
package com.facebook.internal;
import android.os.Bundle;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import kotlin.jvm.internal.Intrinsics;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public final class BundleJSONConverter {
public static final BundleJSONConverter INSTANCE = new BundleJSONConverter();
private static final Map<Class<?>, Setter> SETTERS;
public interface Setter {
void setOnBundle(Bundle bundle, String str, Object obj) throws JSONException;
void setOnJSON(JSONObject jSONObject, String str, Object obj) throws JSONException;
}
private BundleJSONConverter() {
}
static {
HashMap hashMap = new HashMap();
SETTERS = hashMap;
hashMap.put(Boolean.class, new Setter() { // from class: com.facebook.internal.BundleJSONConverter.1
@Override // com.facebook.internal.BundleJSONConverter.Setter
public void setOnBundle(Bundle bundle, String key, Object value) throws JSONException {
Intrinsics.checkNotNullParameter(bundle, "bundle");
Intrinsics.checkNotNullParameter(key, "key");
Intrinsics.checkNotNullParameter(value, "value");
bundle.putBoolean(key, ((Boolean) value).booleanValue());
}
@Override // com.facebook.internal.BundleJSONConverter.Setter
public void setOnJSON(JSONObject json, String key, Object value) throws JSONException {
Intrinsics.checkNotNullParameter(json, "json");
Intrinsics.checkNotNullParameter(key, "key");
Intrinsics.checkNotNullParameter(value, "value");
json.put(key, value);
}
});
hashMap.put(Integer.class, new Setter() { // from class: com.facebook.internal.BundleJSONConverter.2
@Override // com.facebook.internal.BundleJSONConverter.Setter
public void setOnBundle(Bundle bundle, String key, Object value) throws JSONException {
Intrinsics.checkNotNullParameter(bundle, "bundle");
Intrinsics.checkNotNullParameter(key, "key");
Intrinsics.checkNotNullParameter(value, "value");
bundle.putInt(key, ((Integer) value).intValue());
}
@Override // com.facebook.internal.BundleJSONConverter.Setter
public void setOnJSON(JSONObject json, String key, Object value) throws JSONException {
Intrinsics.checkNotNullParameter(json, "json");
Intrinsics.checkNotNullParameter(key, "key");
Intrinsics.checkNotNullParameter(value, "value");
json.put(key, value);
}
});
hashMap.put(Long.class, new Setter() { // from class: com.facebook.internal.BundleJSONConverter.3
@Override // com.facebook.internal.BundleJSONConverter.Setter
public void setOnBundle(Bundle bundle, String key, Object value) throws JSONException {
Intrinsics.checkNotNullParameter(bundle, "bundle");
Intrinsics.checkNotNullParameter(key, "key");
Intrinsics.checkNotNullParameter(value, "value");
bundle.putLong(key, ((Long) value).longValue());
}
@Override // com.facebook.internal.BundleJSONConverter.Setter
public void setOnJSON(JSONObject json, String key, Object value) throws JSONException {
Intrinsics.checkNotNullParameter(json, "json");
Intrinsics.checkNotNullParameter(key, "key");
Intrinsics.checkNotNullParameter(value, "value");
json.put(key, value);
}
});
hashMap.put(Double.class, new Setter() { // from class: com.facebook.internal.BundleJSONConverter.4
@Override // com.facebook.internal.BundleJSONConverter.Setter
public void setOnBundle(Bundle bundle, String key, Object value) throws JSONException {
Intrinsics.checkNotNullParameter(bundle, "bundle");
Intrinsics.checkNotNullParameter(key, "key");
Intrinsics.checkNotNullParameter(value, "value");
bundle.putDouble(key, ((Double) value).doubleValue());
}
@Override // com.facebook.internal.BundleJSONConverter.Setter
public void setOnJSON(JSONObject json, String key, Object value) throws JSONException {
Intrinsics.checkNotNullParameter(json, "json");
Intrinsics.checkNotNullParameter(key, "key");
Intrinsics.checkNotNullParameter(value, "value");
json.put(key, value);
}
});
hashMap.put(String.class, new Setter() { // from class: com.facebook.internal.BundleJSONConverter.5
@Override // com.facebook.internal.BundleJSONConverter.Setter
public void setOnBundle(Bundle bundle, String key, Object value) throws JSONException {
Intrinsics.checkNotNullParameter(bundle, "bundle");
Intrinsics.checkNotNullParameter(key, "key");
Intrinsics.checkNotNullParameter(value, "value");
bundle.putString(key, (String) value);
}
@Override // com.facebook.internal.BundleJSONConverter.Setter
public void setOnJSON(JSONObject json, String key, Object value) throws JSONException {
Intrinsics.checkNotNullParameter(json, "json");
Intrinsics.checkNotNullParameter(key, "key");
Intrinsics.checkNotNullParameter(value, "value");
json.put(key, value);
}
});
hashMap.put(String[].class, new Setter() { // from class: com.facebook.internal.BundleJSONConverter.6
@Override // com.facebook.internal.BundleJSONConverter.Setter
public void setOnBundle(Bundle bundle, String key, Object value) throws JSONException {
Intrinsics.checkNotNullParameter(bundle, "bundle");
Intrinsics.checkNotNullParameter(key, "key");
Intrinsics.checkNotNullParameter(value, "value");
throw new IllegalArgumentException("Unexpected type from JSON");
}
@Override // com.facebook.internal.BundleJSONConverter.Setter
public void setOnJSON(JSONObject json, String key, Object value) throws JSONException {
Intrinsics.checkNotNullParameter(json, "json");
Intrinsics.checkNotNullParameter(key, "key");
Intrinsics.checkNotNullParameter(value, "value");
JSONArray jSONArray = new JSONArray();
String[] strArr = (String[]) value;
int length = strArr.length;
int i = 0;
while (i < length) {
String str = strArr[i];
i++;
jSONArray.put(str);
}
json.put(key, jSONArray);
}
});
hashMap.put(JSONArray.class, new Setter() { // from class: com.facebook.internal.BundleJSONConverter.7
/* JADX WARN: Multi-variable type inference failed */
@Override // com.facebook.internal.BundleJSONConverter.Setter
public void setOnBundle(Bundle bundle, String key, Object value) throws JSONException {
Intrinsics.checkNotNullParameter(bundle, "bundle");
Intrinsics.checkNotNullParameter(key, "key");
Intrinsics.checkNotNullParameter(value, "value");
JSONArray jSONArray = (JSONArray) value;
ArrayList arrayList = new ArrayList();
if (jSONArray.length() == 0) {
bundle.putStringArrayList(key, arrayList);
return;
}
int length = jSONArray.length();
if (length > 0) {
int i = 0;
while (true) {
int i2 = i + 1;
Object obj = jSONArray.get(i);
if (obj instanceof String) {
arrayList.add(obj);
if (i2 >= length) {
break;
} else {
i = i2;
}
} else {
throw new IllegalArgumentException(Intrinsics.stringPlus("Unexpected type in an array: ", obj.getClass()));
}
}
}
bundle.putStringArrayList(key, arrayList);
}
@Override // com.facebook.internal.BundleJSONConverter.Setter
public void setOnJSON(JSONObject json, String key, Object value) throws JSONException {
Intrinsics.checkNotNullParameter(json, "json");
Intrinsics.checkNotNullParameter(key, "key");
Intrinsics.checkNotNullParameter(value, "value");
throw new IllegalArgumentException("JSONArray's are not supported in bundles.");
}
});
}
public static final JSONObject convertToJSON(Bundle bundle) throws JSONException {
Intrinsics.checkNotNullParameter(bundle, "bundle");
JSONObject jSONObject = new JSONObject();
for (String key : bundle.keySet()) {
Object obj = bundle.get(key);
if (obj != null) {
if (obj instanceof List) {
JSONArray jSONArray = new JSONArray();
Iterator it = ((List) obj).iterator();
while (it.hasNext()) {
jSONArray.put((String) it.next());
}
jSONObject.put(key, jSONArray);
} else if (obj instanceof Bundle) {
jSONObject.put(key, convertToJSON((Bundle) obj));
} else {
Setter setter = SETTERS.get(obj.getClass());
if (setter == null) {
throw new IllegalArgumentException(Intrinsics.stringPlus("Unsupported type: ", obj.getClass()));
}
Intrinsics.checkNotNullExpressionValue(key, "key");
setter.setOnJSON(jSONObject, key, obj);
}
}
}
return jSONObject;
}
public static final Bundle convertToBundle(JSONObject jsonObject) throws JSONException {
Intrinsics.checkNotNullParameter(jsonObject, "jsonObject");
Bundle bundle = new Bundle();
Iterator<String> keys = jsonObject.keys();
while (keys.hasNext()) {
String key = keys.next();
Object value = jsonObject.get(key);
if (value != JSONObject.NULL) {
if (value instanceof JSONObject) {
bundle.putBundle(key, convertToBundle((JSONObject) value));
} else {
Setter setter = SETTERS.get(value.getClass());
if (setter == null) {
throw new IllegalArgumentException(Intrinsics.stringPlus("Unsupported type: ", value.getClass()));
}
Intrinsics.checkNotNullExpressionValue(key, "key");
Intrinsics.checkNotNullExpressionValue(value, "value");
setter.setOnBundle(bundle, key, value);
}
}
}
return bundle;
}
}

View File

@@ -0,0 +1,111 @@
package com.facebook.internal;
import android.content.Intent;
import com.facebook.CallbackManager;
import com.facebook.FacebookSdk;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes2.dex */
public final class CallbackManagerImpl implements CallbackManager {
public static final Companion Companion = new Companion(null);
private static final Map<Integer, Callback> staticCallbacks = new HashMap();
private final Map<Integer, Callback> callbacks = new HashMap();
public interface Callback {
boolean onActivityResult(int i, Intent intent);
}
public static final synchronized void registerStaticCallback(int i, Callback callback) {
synchronized (CallbackManagerImpl.class) {
Companion.registerStaticCallback(i, callback);
}
}
public final void registerCallback(int i, Callback callback) {
Intrinsics.checkNotNullParameter(callback, "callback");
this.callbacks.put(Integer.valueOf(i), callback);
}
public final void unregisterCallback(int i) {
this.callbacks.remove(Integer.valueOf(i));
}
@Override // com.facebook.CallbackManager
public boolean onActivityResult(int i, int i2, Intent intent) {
Callback callback = this.callbacks.get(Integer.valueOf(i));
if (callback != null) {
return callback.onActivityResult(i2, intent);
}
return Companion.runStaticCallback(i, i2, intent);
}
public enum RequestCodeOffset {
Login(0),
Share(1),
Message(2),
Like(3),
GameRequest(4),
AppGroupCreate(5),
AppGroupJoin(6),
AppInvite(7),
DeviceShare(8),
GamingFriendFinder(9),
GamingGroupIntegration(10),
Referral(11),
GamingContextCreate(12),
GamingContextSwitch(13),
GamingContextChoose(14),
TournamentShareDialog(15),
TournamentJoinDialog(16);
private final int offset;
RequestCodeOffset(int i) {
this.offset = i;
}
public final int toRequestCode() {
return FacebookSdk.getCallbackRequestCodeOffset() + this.offset;
}
/* renamed from: values, reason: to resolve conflict with enum method */
public static RequestCodeOffset[] valuesCustom() {
RequestCodeOffset[] valuesCustom = values();
return (RequestCodeOffset[]) Arrays.copyOf(valuesCustom, valuesCustom.length);
}
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
public final synchronized void registerStaticCallback(int i, Callback callback) {
Intrinsics.checkNotNullParameter(callback, "callback");
if (CallbackManagerImpl.staticCallbacks.containsKey(Integer.valueOf(i))) {
return;
}
CallbackManagerImpl.staticCallbacks.put(Integer.valueOf(i), callback);
}
private final synchronized Callback getStaticCallback(int i) {
return (Callback) CallbackManagerImpl.staticCallbacks.get(Integer.valueOf(i));
}
/* JADX INFO: Access modifiers changed from: private */
public final boolean runStaticCallback(int i, int i2, Intent intent) {
Callback staticCallback = getStaticCallback(i);
if (staticCallback == null) {
return false;
}
return staticCallback.onActivityResult(i2, intent);
}
}
}

View File

@@ -0,0 +1,93 @@
package com.facebook.internal;
import com.facebook.FacebookException;
import java.util.Iterator;
import java.util.LinkedList;
/* loaded from: classes2.dex */
public class CollectionMapper {
public interface Collection<T> {
Object get(T t);
Iterator<T> keyIterator();
void set(T t, Object obj, OnErrorListener onErrorListener);
}
public interface OnErrorListener {
void onError(FacebookException facebookException);
}
public interface OnMapValueCompleteListener extends OnErrorListener {
void onComplete(Object obj);
}
public interface OnMapperCompleteListener extends OnErrorListener {
void onComplete();
}
public interface ValueMapper {
void mapValue(Object obj, OnMapValueCompleteListener onMapValueCompleteListener);
}
/* JADX WARN: Multi-variable type inference failed */
public static <T> void iterate(final Collection<T> collection, ValueMapper valueMapper, final OnMapperCompleteListener onMapperCompleteListener) {
final Mutable mutable = new Mutable(Boolean.FALSE);
final Mutable mutable2 = new Mutable(1);
final OnMapperCompleteListener onMapperCompleteListener2 = new OnMapperCompleteListener() { // from class: com.facebook.internal.CollectionMapper.1
/* JADX WARN: Multi-variable type inference failed */
/* JADX WARN: Type inference failed for: r1v4, types: [T, java.lang.Integer] */
@Override // com.facebook.internal.CollectionMapper.OnMapperCompleteListener
public void onComplete() {
if (((Boolean) Mutable.this.value).booleanValue()) {
return;
}
Mutable mutable3 = mutable2;
?? valueOf = Integer.valueOf(((Integer) mutable3.value).intValue() - 1);
mutable3.value = valueOf;
if (valueOf.intValue() == 0) {
onMapperCompleteListener.onComplete();
}
}
/* JADX WARN: Multi-variable type inference failed */
/* JADX WARN: Type inference failed for: r1v0, types: [T, java.lang.Boolean] */
@Override // com.facebook.internal.CollectionMapper.OnErrorListener
public void onError(FacebookException facebookException) {
if (((Boolean) Mutable.this.value).booleanValue()) {
return;
}
Mutable.this.value = Boolean.TRUE;
onMapperCompleteListener.onError(facebookException);
}
};
Iterator keyIterator = collection.keyIterator();
LinkedList linkedList = new LinkedList();
while (keyIterator.hasNext()) {
linkedList.add(keyIterator.next());
}
for (final Object obj : linkedList) {
Object obj2 = collection.get(obj);
OnMapValueCompleteListener onMapValueCompleteListener = new OnMapValueCompleteListener() { // from class: com.facebook.internal.CollectionMapper.2
@Override // com.facebook.internal.CollectionMapper.OnMapValueCompleteListener
public void onComplete(Object obj3) {
Collection.this.set(obj, obj3, onMapperCompleteListener2);
onMapperCompleteListener2.onComplete();
}
@Override // com.facebook.internal.CollectionMapper.OnErrorListener
public void onError(FacebookException facebookException) {
onMapperCompleteListener2.onError(facebookException);
}
};
T t = mutable2.value;
mutable2.value = (T) Integer.valueOf(((Integer) t).intValue() + 1);
valueMapper.mapValue(obj2, onMapValueCompleteListener);
}
onMapperCompleteListener2.onComplete();
}
private CollectionMapper() {
}
}

View File

@@ -0,0 +1,108 @@
package com.facebook.internal;
import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.net.Uri;
import android.os.Bundle;
import androidx.browser.customtabs.CustomTabsIntent;
import com.facebook.FacebookSdk;
import com.facebook.internal.instrument.crashshield.CrashShieldHandler;
import com.facebook.login.CustomTabPrefetchHelper;
import java.util.ArrayList;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes2.dex */
public class CustomTab {
public static final Companion Companion = new Companion(null);
private Uri uri;
public static Uri getURIForAction(String str, Bundle bundle) {
if (CrashShieldHandler.isObjectCrashing(CustomTab.class)) {
return null;
}
try {
return Companion.getURIForAction(str, bundle);
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, CustomTab.class);
return null;
}
}
public CustomTab(String action, Bundle bundle) {
Uri uRIForAction;
Intrinsics.checkNotNullParameter(action, "action");
bundle = bundle == null ? new Bundle() : bundle;
GamingAction[] valuesCustom = GamingAction.valuesCustom();
ArrayList arrayList = new ArrayList(valuesCustom.length);
for (GamingAction gamingAction : valuesCustom) {
arrayList.add(gamingAction.getRawValue());
}
if (arrayList.contains(action)) {
Utility utility = Utility.INSTANCE;
uRIForAction = Utility.buildUri(ServerProtocol.getGamingDialogAuthority(), Intrinsics.stringPlus("/dialog/", action), bundle);
} else {
uRIForAction = Companion.getURIForAction(action, bundle);
}
this.uri = uRIForAction;
}
public final Uri getUri() {
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
return this.uri;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return null;
}
}
public final void setUri(Uri uri) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
Intrinsics.checkNotNullParameter(uri, "<set-?>");
this.uri = uri;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
public final boolean openCustomTab(Activity activity, String str) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return false;
}
try {
Intrinsics.checkNotNullParameter(activity, "activity");
CustomTabsIntent build = new CustomTabsIntent.Builder(CustomTabPrefetchHelper.Companion.getPreparedSessionOnce()).build();
build.intent.setPackage(str);
try {
build.launchUrl(activity, this.uri);
return true;
} catch (ActivityNotFoundException unused) {
return false;
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return false;
}
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
public Uri getURIForAction(String action, Bundle bundle) {
Intrinsics.checkNotNullParameter(action, "action");
Utility utility = Utility.INSTANCE;
return Utility.buildUri(ServerProtocol.getDialogAuthority(), FacebookSdk.getGraphApiVersion() + "/dialog/" + action, bundle);
}
}
}

View File

@@ -0,0 +1,73 @@
package com.facebook.internal;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ResolveInfo;
import android.content.pm.ServiceInfo;
import androidx.browser.customtabs.CustomTabsService;
import com.facebook.FacebookSdk;
import com.facebook.internal.instrument.crashshield.CrashShieldHandler;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import kotlin.collections.ArraysKt___ArraysKt;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes2.dex */
public final class CustomTabUtils {
public static final CustomTabUtils INSTANCE = new CustomTabUtils();
private static final String[] CHROME_PACKAGES = {"com.android.chrome", "com.chrome.beta", "com.chrome.dev"};
private CustomTabUtils() {
}
public static final String getDefaultRedirectURI() {
if (CrashShieldHandler.isObjectCrashing(CustomTabUtils.class)) {
return null;
}
try {
return Intrinsics.stringPlus(Validate.CUSTOM_TAB_REDIRECT_URI_PREFIX, FacebookSdk.getApplicationContext().getPackageName());
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, CustomTabUtils.class);
return null;
}
}
public static final String getValidRedirectURI(String developerDefinedRedirectURI) {
if (CrashShieldHandler.isObjectCrashing(CustomTabUtils.class)) {
return null;
}
try {
Intrinsics.checkNotNullParameter(developerDefinedRedirectURI, "developerDefinedRedirectURI");
Validate validate = Validate.INSTANCE;
return Validate.hasCustomTabRedirectActivity(FacebookSdk.getApplicationContext(), developerDefinedRedirectURI) ? developerDefinedRedirectURI : Validate.hasCustomTabRedirectActivity(FacebookSdk.getApplicationContext(), getDefaultRedirectURI()) ? getDefaultRedirectURI() : "";
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, CustomTabUtils.class);
return null;
}
}
public static final String getChromePackage() {
HashSet hashSet;
if (CrashShieldHandler.isObjectCrashing(CustomTabUtils.class)) {
return null;
}
try {
Context applicationContext = FacebookSdk.getApplicationContext();
List<ResolveInfo> queryIntentServices = applicationContext.getPackageManager().queryIntentServices(new Intent(CustomTabsService.ACTION_CUSTOM_TABS_CONNECTION), 0);
Intrinsics.checkNotNullExpressionValue(queryIntentServices, "context.packageManager.queryIntentServices(serviceIntent, 0)");
hashSet = ArraysKt___ArraysKt.toHashSet(CHROME_PACKAGES);
Iterator<ResolveInfo> it = queryIntentServices.iterator();
while (it.hasNext()) {
ServiceInfo serviceInfo = it.next().serviceInfo;
if (serviceInfo != null && hashSet.contains(serviceInfo.packageName)) {
return serviceInfo.packageName;
}
}
return null;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, CustomTabUtils.class);
return null;
}
}
}

View File

@@ -0,0 +1,16 @@
package com.facebook.internal;
/* loaded from: classes2.dex */
public interface DialogFeature {
public static final class DefaultImpls {
public static /* synthetic */ void name$annotations() {
}
}
String getAction();
int getMinVersion();
String name();
}

View File

@@ -0,0 +1,279 @@
package com.facebook.internal;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.util.Pair;
import androidx.activity.result.ActivityResultCallback;
import androidx.activity.result.ActivityResultLauncher;
import androidx.activity.result.ActivityResultRegistry;
import androidx.activity.result.contract.ActivityResultContract;
import com.facebook.CallbackManager;
import com.facebook.CustomTabMainActivity;
import com.facebook.FacebookActivity;
import com.facebook.FacebookException;
import com.facebook.FacebookSdk;
import com.facebook.appevents.InternalAppEventsLogger;
import com.facebook.internal.FetchedAppSettings;
import com.facebook.internal.NativeProtocol;
import kotlin.Unit;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.Ref;
/* loaded from: classes2.dex */
public final class DialogPresenter {
public static final DialogPresenter INSTANCE = new DialogPresenter();
public interface ParameterProvider {
Bundle getLegacyParameters();
Bundle getParameters();
}
private DialogPresenter() {
}
public static final void setupAppCallForCannotShowError(AppCall appCall) {
Intrinsics.checkNotNullParameter(appCall, "appCall");
setupAppCallForValidationError(appCall, new FacebookException("Unable to show the provided content via the web or the installed version of the Facebook app. Some dialogs are only supported starting API 14."));
}
public static final void setupAppCallForValidationError(AppCall appCall, FacebookException facebookException) {
Intrinsics.checkNotNullParameter(appCall, "appCall");
setupAppCallForErrorResult(appCall, facebookException);
}
public static final void present(AppCall appCall, Activity activity) {
Intrinsics.checkNotNullParameter(appCall, "appCall");
Intrinsics.checkNotNullParameter(activity, "activity");
activity.startActivityForResult(appCall.getRequestIntent(), appCall.getRequestCode());
appCall.setPending();
}
public static final void present(AppCall appCall, FragmentWrapper fragmentWrapper) {
Intrinsics.checkNotNullParameter(appCall, "appCall");
Intrinsics.checkNotNullParameter(fragmentWrapper, "fragmentWrapper");
fragmentWrapper.startActivityForResult(appCall.getRequestIntent(), appCall.getRequestCode());
appCall.setPending();
}
public static final void present(AppCall appCall, ActivityResultRegistry registry, CallbackManager callbackManager) {
Intrinsics.checkNotNullParameter(appCall, "appCall");
Intrinsics.checkNotNullParameter(registry, "registry");
Intent requestIntent = appCall.getRequestIntent();
if (requestIntent == null) {
return;
}
startActivityForResultWithAndroidX(registry, callbackManager, requestIntent, appCall.getRequestCode());
appCall.setPending();
}
/* JADX WARN: Type inference failed for: r4v1, types: [T, androidx.activity.result.ActivityResultLauncher] */
public static final void startActivityForResultWithAndroidX(ActivityResultRegistry registry, final CallbackManager callbackManager, Intent intent, final int i) {
Intrinsics.checkNotNullParameter(registry, "registry");
Intrinsics.checkNotNullParameter(intent, "intent");
final Ref.ObjectRef objectRef = new Ref.ObjectRef();
?? register = registry.register(Intrinsics.stringPlus("facebook-dialog-request-", Integer.valueOf(i)), new ActivityResultContract<Intent, Pair<Integer, Intent>>() { // from class: com.facebook.internal.DialogPresenter$startActivityForResultWithAndroidX$1
@Override // androidx.activity.result.contract.ActivityResultContract
public Intent createIntent(Context context, Intent input) {
Intrinsics.checkNotNullParameter(context, "context");
Intrinsics.checkNotNullParameter(input, "input");
return input;
}
/* JADX WARN: Can't rename method to resolve collision */
@Override // androidx.activity.result.contract.ActivityResultContract
public Pair<Integer, Intent> parseResult(int i2, Intent intent2) {
Pair<Integer, Intent> create = Pair.create(Integer.valueOf(i2), intent2);
Intrinsics.checkNotNullExpressionValue(create, "create(resultCode, intent)");
return create;
}
}, new ActivityResultCallback() { // from class: com.facebook.internal.DialogPresenter$$ExternalSyntheticLambda0
@Override // androidx.activity.result.ActivityResultCallback
public final void onActivityResult(Object obj) {
DialogPresenter.m556startActivityForResultWithAndroidX$lambda2(CallbackManager.this, i, objectRef, (Pair) obj);
}
});
objectRef.element = register;
if (register == 0) {
return;
}
register.launch(intent);
}
/* JADX INFO: Access modifiers changed from: private */
/* JADX WARN: Multi-variable type inference failed */
/* renamed from: startActivityForResultWithAndroidX$lambda-2, reason: not valid java name */
public static final void m556startActivityForResultWithAndroidX$lambda2(CallbackManager callbackManager, int i, Ref.ObjectRef launcher, Pair pair) {
Intrinsics.checkNotNullParameter(launcher, "$launcher");
if (callbackManager == null) {
callbackManager = new CallbackManagerImpl();
}
Object obj = pair.first;
Intrinsics.checkNotNullExpressionValue(obj, "result.first");
callbackManager.onActivityResult(i, ((Number) obj).intValue(), (Intent) pair.second);
ActivityResultLauncher activityResultLauncher = (ActivityResultLauncher) launcher.element;
if (activityResultLauncher == null) {
return;
}
synchronized (activityResultLauncher) {
activityResultLauncher.unregister();
launcher.element = null;
Unit unit = Unit.INSTANCE;
}
}
public static final boolean canPresentNativeDialogWithFeature(DialogFeature feature) {
Intrinsics.checkNotNullParameter(feature, "feature");
return getProtocolVersionForNativeDialog(feature).getProtocolVersion() != -1;
}
public static final boolean canPresentWebFallbackDialogWithFeature(DialogFeature feature) {
Intrinsics.checkNotNullParameter(feature, "feature");
return INSTANCE.getDialogWebFallbackUri(feature) != null;
}
public static final void setupAppCallForErrorResult(AppCall appCall, FacebookException facebookException) {
Intrinsics.checkNotNullParameter(appCall, "appCall");
if (facebookException == null) {
return;
}
Validate validate = Validate.INSTANCE;
Validate.hasFacebookActivity(FacebookSdk.getApplicationContext());
Intent intent = new Intent();
intent.setClass(FacebookSdk.getApplicationContext(), FacebookActivity.class);
intent.setAction(FacebookActivity.PASS_THROUGH_CANCEL_ACTION);
NativeProtocol nativeProtocol = NativeProtocol.INSTANCE;
NativeProtocol.setupProtocolRequestIntent(intent, appCall.getCallId().toString(), null, NativeProtocol.getLatestKnownVersion(), NativeProtocol.createBundleForException(facebookException));
appCall.setRequestIntent(intent);
}
public static final void setupAppCallForWebDialog(AppCall appCall, String str, Bundle bundle) {
Intrinsics.checkNotNullParameter(appCall, "appCall");
Validate validate = Validate.INSTANCE;
Validate.hasFacebookActivity(FacebookSdk.getApplicationContext());
Validate.hasInternetPermissions(FacebookSdk.getApplicationContext());
Bundle bundle2 = new Bundle();
bundle2.putString("action", str);
bundle2.putBundle("params", bundle);
Intent intent = new Intent();
NativeProtocol nativeProtocol = NativeProtocol.INSTANCE;
NativeProtocol.setupProtocolRequestIntent(intent, appCall.getCallId().toString(), str, NativeProtocol.getLatestKnownVersion(), bundle2);
intent.setClass(FacebookSdk.getApplicationContext(), FacebookActivity.class);
intent.setAction(FacebookDialogFragment.TAG);
appCall.setRequestIntent(intent);
}
public static final void setupAppCallForWebFallbackDialog(AppCall appCall, Bundle bundle, DialogFeature feature) {
Uri buildUri;
Intrinsics.checkNotNullParameter(appCall, "appCall");
Intrinsics.checkNotNullParameter(feature, "feature");
Validate validate = Validate.INSTANCE;
Validate.hasFacebookActivity(FacebookSdk.getApplicationContext());
Validate.hasInternetPermissions(FacebookSdk.getApplicationContext());
String name = feature.name();
Uri dialogWebFallbackUri = INSTANCE.getDialogWebFallbackUri(feature);
if (dialogWebFallbackUri == null) {
throw new FacebookException("Unable to fetch the Url for the DialogFeature : '" + name + '\'');
}
int latestKnownVersion = NativeProtocol.getLatestKnownVersion();
ServerProtocol serverProtocol = ServerProtocol.INSTANCE;
String uuid = appCall.getCallId().toString();
Intrinsics.checkNotNullExpressionValue(uuid, "appCall.callId.toString()");
Bundle queryParamsForPlatformActivityIntentWebFallback = ServerProtocol.getQueryParamsForPlatformActivityIntentWebFallback(uuid, latestKnownVersion, bundle);
if (queryParamsForPlatformActivityIntentWebFallback == null) {
throw new FacebookException("Unable to fetch the app's key-hash");
}
if (dialogWebFallbackUri.isRelative()) {
Utility utility = Utility.INSTANCE;
buildUri = Utility.buildUri(ServerProtocol.getDialogAuthority(), dialogWebFallbackUri.toString(), queryParamsForPlatformActivityIntentWebFallback);
} else {
Utility utility2 = Utility.INSTANCE;
buildUri = Utility.buildUri(dialogWebFallbackUri.getAuthority(), dialogWebFallbackUri.getPath(), queryParamsForPlatformActivityIntentWebFallback);
}
Bundle bundle2 = new Bundle();
bundle2.putString("url", buildUri.toString());
bundle2.putBoolean(NativeProtocol.WEB_DIALOG_IS_FALLBACK, true);
Intent intent = new Intent();
NativeProtocol.setupProtocolRequestIntent(intent, appCall.getCallId().toString(), feature.getAction(), NativeProtocol.getLatestKnownVersion(), bundle2);
intent.setClass(FacebookSdk.getApplicationContext(), FacebookActivity.class);
intent.setAction(FacebookDialogFragment.TAG);
appCall.setRequestIntent(intent);
}
public static final void setupAppCallForNativeDialog(AppCall appCall, ParameterProvider parameterProvider, DialogFeature feature) {
Bundle legacyParameters;
Intrinsics.checkNotNullParameter(appCall, "appCall");
Intrinsics.checkNotNullParameter(parameterProvider, "parameterProvider");
Intrinsics.checkNotNullParameter(feature, "feature");
Context applicationContext = FacebookSdk.getApplicationContext();
String action = feature.getAction();
NativeProtocol.ProtocolVersionQueryResult protocolVersionForNativeDialog = getProtocolVersionForNativeDialog(feature);
int protocolVersion = protocolVersionForNativeDialog.getProtocolVersion();
if (protocolVersion == -1) {
throw new FacebookException("Cannot present this dialog. This likely means that the Facebook app is not installed.");
}
if (NativeProtocol.isVersionCompatibleWithBucketedIntent(protocolVersion)) {
legacyParameters = parameterProvider.getParameters();
} else {
legacyParameters = parameterProvider.getLegacyParameters();
}
if (legacyParameters == null) {
legacyParameters = new Bundle();
}
Intent createPlatformActivityIntent = NativeProtocol.createPlatformActivityIntent(applicationContext, appCall.getCallId().toString(), action, protocolVersionForNativeDialog, legacyParameters);
if (createPlatformActivityIntent == null) {
throw new FacebookException("Unable to create Intent; this likely means theFacebook app is not installed.");
}
appCall.setRequestIntent(createPlatformActivityIntent);
}
public static final void setupAppCallForCustomTabDialog(AppCall appCall, String str, Bundle bundle) {
Intrinsics.checkNotNullParameter(appCall, "appCall");
Validate validate = Validate.INSTANCE;
Validate.hasCustomTabRedirectActivity(FacebookSdk.getApplicationContext(), CustomTabUtils.getDefaultRedirectURI());
Validate.hasInternetPermissions(FacebookSdk.getApplicationContext());
Intent intent = new Intent(FacebookSdk.getApplicationContext(), (Class<?>) CustomTabMainActivity.class);
intent.putExtra(CustomTabMainActivity.EXTRA_ACTION, str);
intent.putExtra(CustomTabMainActivity.EXTRA_PARAMS, bundle);
intent.putExtra(CustomTabMainActivity.EXTRA_CHROME_PACKAGE, CustomTabUtils.getChromePackage());
NativeProtocol nativeProtocol = NativeProtocol.INSTANCE;
NativeProtocol.setupProtocolRequestIntent(intent, appCall.getCallId().toString(), str, NativeProtocol.getLatestKnownVersion(), null);
appCall.setRequestIntent(intent);
}
private final Uri getDialogWebFallbackUri(DialogFeature dialogFeature) {
String name = dialogFeature.name();
String action = dialogFeature.getAction();
FetchedAppSettings.DialogFeatureConfig dialogFeatureConfig = FetchedAppSettings.Companion.getDialogFeatureConfig(FacebookSdk.getApplicationId(), action, name);
if (dialogFeatureConfig != null) {
return dialogFeatureConfig.getFallbackUrl();
}
return null;
}
public static final NativeProtocol.ProtocolVersionQueryResult getProtocolVersionForNativeDialog(DialogFeature feature) {
Intrinsics.checkNotNullParameter(feature, "feature");
String applicationId = FacebookSdk.getApplicationId();
String action = feature.getAction();
return NativeProtocol.getLatestAvailableProtocolVersionForAction(action, INSTANCE.getVersionSpecForFeature(applicationId, action, feature));
}
private final int[] getVersionSpecForFeature(String str, String str2, DialogFeature dialogFeature) {
FetchedAppSettings.DialogFeatureConfig dialogFeatureConfig = FetchedAppSettings.Companion.getDialogFeatureConfig(str, str2, dialogFeature.name());
int[] versionSpec = dialogFeatureConfig == null ? null : dialogFeatureConfig.getVersionSpec();
return versionSpec == null ? new int[]{dialogFeature.getMinVersion()} : versionSpec;
}
public static final void logDialogActivity(Context context, String eventName, String outcome) {
Intrinsics.checkNotNullParameter(context, "context");
Intrinsics.checkNotNullParameter(eventName, "eventName");
Intrinsics.checkNotNullParameter(outcome, "outcome");
InternalAppEventsLogger internalAppEventsLogger = new InternalAppEventsLogger(context);
Bundle bundle = new Bundle();
bundle.putString(AnalyticsEvents.PARAMETER_DIALOG_OUTCOME, outcome);
internalAppEventsLogger.logEventImplicitly(eventName, bundle);
}
}

View File

@@ -0,0 +1,361 @@
package com.facebook.internal;
import android.app.Activity;
import android.content.ComponentCallbacks2;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import androidx.activity.result.ActivityResultRegistry;
import androidx.activity.result.ActivityResultRegistryOwner;
import androidx.activity.result.contract.ActivityResultContract;
import androidx.annotation.VisibleForTesting;
import com.facebook.CallbackManager;
import com.facebook.FacebookCallback;
import com.facebook.FacebookDialog;
import com.facebook.FacebookException;
import com.facebook.FacebookSdk;
import java.util.Iterator;
import java.util.List;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes2.dex */
public abstract class FacebookDialogBase<CONTENT, RESULT> implements FacebookDialog<CONTENT, RESULT> {
private static final String TAG = "FacebookDialog";
private final Activity activity;
private CallbackManager callbackManager;
private final FragmentWrapper fragmentWrapper;
private List<? extends FacebookDialogBase<CONTENT, RESULT>.ModeHandler> modeHandlers;
private int requestCodeField;
public static final Companion Companion = new Companion(null);
public static final Object BASE_AUTOMATIC_MODE = new Object();
public abstract AppCall createBaseAppCall();
@VisibleForTesting(otherwise = 2)
public final CallbackManager getCallbackManager$facebook_common_release() {
return this.callbackManager;
}
public abstract List<FacebookDialogBase<CONTENT, RESULT>.ModeHandler> getOrderedModeHandlers();
public final int getRequestCode() {
return this.requestCodeField;
}
public abstract void registerCallbackImpl(CallbackManagerImpl callbackManagerImpl, FacebookCallback<RESULT> facebookCallback);
public final void setCallbackManager(CallbackManager callbackManager) {
this.callbackManager = callbackManager;
}
public final void setCallbackManager$facebook_common_release(CallbackManager callbackManager) {
this.callbackManager = callbackManager;
}
public FacebookDialogBase(Activity activity, int i) {
Intrinsics.checkNotNullParameter(activity, "activity");
this.activity = activity;
this.fragmentWrapper = null;
this.requestCodeField = i;
this.callbackManager = null;
}
public FacebookDialogBase(FragmentWrapper fragmentWrapper, int i) {
Intrinsics.checkNotNullParameter(fragmentWrapper, "fragmentWrapper");
this.fragmentWrapper = fragmentWrapper;
this.activity = null;
this.requestCodeField = i;
if (fragmentWrapper.getActivity() == null) {
throw new IllegalArgumentException("Cannot use a fragment that is not attached to an activity".toString());
}
}
public FacebookDialogBase(int i) {
this.requestCodeField = i;
this.activity = null;
this.fragmentWrapper = null;
}
@Override // com.facebook.FacebookDialog
public void registerCallback(CallbackManager callbackManager, FacebookCallback<RESULT> callback) {
Intrinsics.checkNotNullParameter(callbackManager, "callbackManager");
Intrinsics.checkNotNullParameter(callback, "callback");
if (!(callbackManager instanceof CallbackManagerImpl)) {
throw new FacebookException("Unexpected CallbackManager, please use the provided Factory.");
}
memorizeCallbackManager(callbackManager);
registerCallbackImpl((CallbackManagerImpl) callbackManager, callback);
}
@Override // com.facebook.FacebookDialog
public void registerCallback(CallbackManager callbackManager, FacebookCallback<RESULT> callback, int i) {
Intrinsics.checkNotNullParameter(callbackManager, "callbackManager");
Intrinsics.checkNotNullParameter(callback, "callback");
memorizeCallbackManager(callbackManager);
setRequestCode(i);
registerCallback(callbackManager, callback);
}
public final void setRequestCode(int i) {
if (!FacebookSdk.isFacebookRequestCode(i)) {
this.requestCodeField = i;
return;
}
throw new IllegalArgumentException(("Request code " + i + " cannot be within the range reserved by the Facebook SDK.").toString());
}
@Override // com.facebook.FacebookDialog
public boolean canShow(CONTENT content) {
return canShowImpl(content, BASE_AUTOMATIC_MODE);
}
public boolean canShowImpl(CONTENT content, Object mode) {
Intrinsics.checkNotNullParameter(mode, "mode");
boolean z = mode == BASE_AUTOMATIC_MODE;
for (FacebookDialogBase<CONTENT, RESULT>.ModeHandler modeHandler : cachedModeHandlers()) {
if (!z) {
Utility utility = Utility.INSTANCE;
if (!Utility.areObjectsEqual(modeHandler.getMode(), mode)) {
continue;
}
}
if (modeHandler.canShow(content, false)) {
return true;
}
}
return false;
}
@Override // com.facebook.FacebookDialog
public void show(CONTENT content) {
showImpl(content, BASE_AUTOMATIC_MODE);
}
public final ActivityResultContract<CONTENT, CallbackManager.ActivityResultParameters> createActivityResultContractForShowingDialog(final CallbackManager callbackManager, final Object mode) {
Intrinsics.checkNotNullParameter(mode, "mode");
return new ActivityResultContract<CONTENT, CallbackManager.ActivityResultParameters>(this) { // from class: com.facebook.internal.FacebookDialogBase$createActivityResultContractForShowingDialog$1
final /* synthetic */ FacebookDialogBase<CONTENT, RESULT> this$0;
{
this.this$0 = this;
}
@Override // androidx.activity.result.contract.ActivityResultContract
public Intent createIntent(Context context, CONTENT content) {
AppCall createAppCallForMode;
Intrinsics.checkNotNullParameter(context, "context");
createAppCallForMode = this.this$0.createAppCallForMode(content, mode);
Intent requestIntent = createAppCallForMode == null ? null : createAppCallForMode.getRequestIntent();
if (requestIntent != null) {
createAppCallForMode.setPending();
return requestIntent;
}
throw new FacebookException("Content " + content + " is not supported");
}
/* JADX WARN: Can't rename method to resolve collision */
@Override // androidx.activity.result.contract.ActivityResultContract
public CallbackManager.ActivityResultParameters parseResult(int i, Intent intent) {
CallbackManager callbackManager2 = callbackManager;
if (callbackManager2 != null) {
callbackManager2.onActivityResult(this.this$0.getRequestCode(), i, intent);
}
return new CallbackManager.ActivityResultParameters(this.this$0.getRequestCode(), i, intent);
}
};
}
@Override // com.facebook.FacebookDialog
public ActivityResultContract<CONTENT, CallbackManager.ActivityResultParameters> createActivityResultContractForShowingDialog(CallbackManager callbackManager) {
return createActivityResultContractForShowingDialog(callbackManager, BASE_AUTOMATIC_MODE);
}
public void showImpl(CONTENT content, Object mode) {
Intrinsics.checkNotNullParameter(mode, "mode");
AppCall createAppCallForMode = createAppCallForMode(content, mode);
if (createAppCallForMode != null) {
if (getActivityContext() instanceof ActivityResultRegistryOwner) {
ComponentCallbacks2 activityContext = getActivityContext();
if (activityContext == null) {
throw new NullPointerException("null cannot be cast to non-null type androidx.activity.result.ActivityResultRegistryOwner");
}
DialogPresenter dialogPresenter = DialogPresenter.INSTANCE;
ActivityResultRegistry activityResultRegistry = ((ActivityResultRegistryOwner) activityContext).getActivityResultRegistry();
Intrinsics.checkNotNullExpressionValue(activityResultRegistry, "registryOwner.activityResultRegistry");
DialogPresenter.present(createAppCallForMode, activityResultRegistry, this.callbackManager);
createAppCallForMode.setPending();
return;
}
FragmentWrapper fragmentWrapper = this.fragmentWrapper;
if (fragmentWrapper != null) {
DialogPresenter.present(createAppCallForMode, fragmentWrapper);
return;
}
Activity activity = this.activity;
if (activity != null) {
DialogPresenter.present(createAppCallForMode, activity);
return;
}
return;
}
Log.e(TAG, "No code path should ever result in a null appCall");
if (!(!FacebookSdk.isDebugEnabled())) {
throw new IllegalStateException("No code path should ever result in a null appCall".toString());
}
}
public final Activity getActivityContext() {
Activity activity = this.activity;
if (activity != null) {
return activity;
}
FragmentWrapper fragmentWrapper = this.fragmentWrapper;
if (fragmentWrapper == null) {
return null;
}
return fragmentWrapper.getActivity();
}
/* JADX WARN: Multi-variable type inference failed */
/* JADX WARN: Removed duplicated region for block: B:6:0x0033 */
/* JADX WARN: Removed duplicated region for block: B:9:? A[RETURN, SYNTHETIC] */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public final void startActivityForResult(android.content.Intent r4, int r5) {
/*
r3 = this;
java.lang.String r0 = "intent"
kotlin.jvm.internal.Intrinsics.checkNotNullParameter(r4, r0)
android.app.Activity r0 = r3.getActivityContext()
boolean r1 = r0 instanceof androidx.activity.result.ActivityResultRegistryOwner
if (r1 == 0) goto L20
com.facebook.internal.DialogPresenter r1 = com.facebook.internal.DialogPresenter.INSTANCE
androidx.activity.result.ActivityResultRegistryOwner r0 = (androidx.activity.result.ActivityResultRegistryOwner) r0
androidx.activity.result.ActivityResultRegistry r0 = r0.getActivityResultRegistry()
java.lang.String r1 = "activity as ActivityResultRegistryOwner).activityResultRegistry"
kotlin.jvm.internal.Intrinsics.checkNotNullExpressionValue(r0, r1)
com.facebook.CallbackManager r1 = r3.callbackManager
com.facebook.internal.DialogPresenter.startActivityForResultWithAndroidX(r0, r1, r4, r5)
goto L2d
L20:
if (r0 == 0) goto L26
r0.startActivityForResult(r4, r5)
goto L2d
L26:
com.facebook.internal.FragmentWrapper r0 = r3.fragmentWrapper
if (r0 == 0) goto L2f
r0.startActivityForResult(r4, r5)
L2d:
r4 = 0
goto L31
L2f:
java.lang.String r4 = "Failed to find Activity or Fragment to startActivityForResult "
L31:
if (r4 == 0) goto L48
com.facebook.internal.Logger$Companion r5 = com.facebook.internal.Logger.Companion
com.facebook.LoggingBehavior r0 = com.facebook.LoggingBehavior.DEVELOPER_ERRORS
java.lang.Class r1 = r3.getClass()
java.lang.String r1 = r1.getName()
java.lang.String r2 = "this.javaClass.name"
kotlin.jvm.internal.Intrinsics.checkNotNullExpressionValue(r1, r2)
r2 = 6
r5.log(r0, r2, r1, r4)
L48:
return
*/
throw new UnsupportedOperationException("Method not decompiled: com.facebook.internal.FacebookDialogBase.startActivityForResult(android.content.Intent, int):void");
}
/* JADX INFO: Access modifiers changed from: private */
public final AppCall createAppCallForMode(CONTENT content, Object obj) {
AppCall appCall;
boolean z = obj == BASE_AUTOMATIC_MODE;
Iterator<FacebookDialogBase<CONTENT, RESULT>.ModeHandler> it = cachedModeHandlers().iterator();
while (true) {
if (!it.hasNext()) {
appCall = null;
break;
}
FacebookDialogBase<CONTENT, RESULT>.ModeHandler next = it.next();
if (!z) {
Utility utility = Utility.INSTANCE;
if (!Utility.areObjectsEqual(next.getMode(), obj)) {
continue;
}
}
if (next.canShow(content, true)) {
try {
appCall = next.createAppCall(content);
break;
} catch (FacebookException e) {
AppCall createBaseAppCall = createBaseAppCall();
DialogPresenter dialogPresenter = DialogPresenter.INSTANCE;
DialogPresenter.setupAppCallForValidationError(createBaseAppCall, e);
appCall = createBaseAppCall;
}
}
}
if (appCall != null) {
return appCall;
}
AppCall createBaseAppCall2 = createBaseAppCall();
DialogPresenter.setupAppCallForCannotShowError(createBaseAppCall2);
return createBaseAppCall2;
}
private final void memorizeCallbackManager(CallbackManager callbackManager) {
CallbackManager callbackManager2 = this.callbackManager;
if (callbackManager2 == null) {
this.callbackManager = callbackManager;
} else if (callbackManager2 != callbackManager) {
Log.w(TAG, "You're registering a callback on a Facebook dialog with two different callback managers. It's almost wrong and may cause unexpected results. Only the first callback manager will be used for handling activity result with androidx.");
}
}
private final List<FacebookDialogBase<CONTENT, RESULT>.ModeHandler> cachedModeHandlers() {
if (this.modeHandlers == null) {
this.modeHandlers = getOrderedModeHandlers();
}
List<? extends FacebookDialogBase<CONTENT, RESULT>.ModeHandler> list = this.modeHandlers;
if (list != null) {
return list;
}
throw new NullPointerException("null cannot be cast to non-null type kotlin.collections.List<com.facebook.internal.FacebookDialogBase.ModeHandler<CONTENT of com.facebook.internal.FacebookDialogBase, RESULT of com.facebook.internal.FacebookDialogBase>>");
}
public abstract class ModeHandler {
private Object mode;
final /* synthetic */ FacebookDialogBase<CONTENT, RESULT> this$0;
public abstract boolean canShow(CONTENT content, boolean z);
public abstract AppCall createAppCall(CONTENT content);
public Object getMode() {
return this.mode;
}
public void setMode(Object obj) {
Intrinsics.checkNotNullParameter(obj, "<set-?>");
this.mode = obj;
}
public ModeHandler(FacebookDialogBase this$0) {
Intrinsics.checkNotNullParameter(this$0, "this$0");
this.this$0 = this$0;
this.mode = FacebookDialogBase.BASE_AUTOMATIC_MODE;
}
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
}
}

View File

@@ -0,0 +1,190 @@
package com.facebook.internal;
import android.app.Dialog;
import android.content.Intent;
import android.content.res.Configuration;
import android.os.Bundle;
import androidx.annotation.VisibleForTesting;
import androidx.fragment.app.DialogFragment;
import androidx.fragment.app.FragmentActivity;
import com.facebook.FacebookException;
import com.facebook.FacebookSdk;
import com.facebook.internal.FacebookWebFallbackDialog;
import com.facebook.internal.WebDialog;
import java.util.Arrays;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.StringCompanionObject;
/* loaded from: classes2.dex */
public final class FacebookDialogFragment extends DialogFragment {
public static final Companion Companion = new Companion(null);
public static final String TAG = "FacebookDialogFragment";
private Dialog innerDialog;
public final Dialog getInnerDialog() {
return this.innerDialog;
}
public final void setInnerDialog(Dialog dialog) {
this.innerDialog = dialog;
}
@Override // androidx.fragment.app.DialogFragment, androidx.fragment.app.Fragment
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
initDialog$facebook_common_release();
}
@VisibleForTesting
public final void initDialog$facebook_common_release() {
FragmentActivity activity;
WebDialog newInstance;
if (this.innerDialog == null && (activity = getActivity()) != null) {
Intent intent = activity.getIntent();
NativeProtocol nativeProtocol = NativeProtocol.INSTANCE;
Intrinsics.checkNotNullExpressionValue(intent, "intent");
Bundle methodArgumentsFromIntent = NativeProtocol.getMethodArgumentsFromIntent(intent);
if (!(methodArgumentsFromIntent != null ? methodArgumentsFromIntent.getBoolean(NativeProtocol.WEB_DIALOG_IS_FALLBACK, false) : false)) {
String string = methodArgumentsFromIntent == null ? null : methodArgumentsFromIntent.getString("action");
Bundle bundle = methodArgumentsFromIntent != null ? methodArgumentsFromIntent.getBundle("params") : null;
if (Utility.isNullOrEmpty(string)) {
Utility.logd(TAG, "Cannot start a WebDialog with an empty/missing 'actionName'");
activity.finish();
return;
} else {
if (string == null) {
throw new NullPointerException("null cannot be cast to non-null type kotlin.String");
}
newInstance = new WebDialog.Builder(activity, string, bundle).setOnCompleteListener(new WebDialog.OnCompleteListener() { // from class: com.facebook.internal.FacebookDialogFragment$$ExternalSyntheticLambda0
@Override // com.facebook.internal.WebDialog.OnCompleteListener
public final void onComplete(Bundle bundle2, FacebookException facebookException) {
FacebookDialogFragment.m558initDialog$lambda0(FacebookDialogFragment.this, bundle2, facebookException);
}
}).build();
}
} else {
String string2 = methodArgumentsFromIntent != null ? methodArgumentsFromIntent.getString("url") : null;
if (Utility.isNullOrEmpty(string2)) {
Utility.logd(TAG, "Cannot start a fallback WebDialog with an empty/missing 'url'");
activity.finish();
return;
}
StringCompanionObject stringCompanionObject = StringCompanionObject.INSTANCE;
String format = String.format("fb%s://bridge/", Arrays.copyOf(new Object[]{FacebookSdk.getApplicationId()}, 1));
Intrinsics.checkNotNullExpressionValue(format, "java.lang.String.format(format, *args)");
FacebookWebFallbackDialog.Companion companion = FacebookWebFallbackDialog.Companion;
if (string2 == null) {
throw new NullPointerException("null cannot be cast to non-null type kotlin.String");
}
newInstance = companion.newInstance(activity, string2, format);
newInstance.setOnCompleteListener(new WebDialog.OnCompleteListener() { // from class: com.facebook.internal.FacebookDialogFragment$$ExternalSyntheticLambda1
@Override // com.facebook.internal.WebDialog.OnCompleteListener
public final void onComplete(Bundle bundle2, FacebookException facebookException) {
FacebookDialogFragment.m559initDialog$lambda1(FacebookDialogFragment.this, bundle2, facebookException);
}
});
}
this.innerDialog = newInstance;
}
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: initDialog$lambda-0, reason: not valid java name */
public static final void m558initDialog$lambda0(FacebookDialogFragment this$0, Bundle bundle, FacebookException facebookException) {
Intrinsics.checkNotNullParameter(this$0, "this$0");
this$0.onCompleteWebDialog(bundle, facebookException);
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: initDialog$lambda-1, reason: not valid java name */
public static final void m559initDialog$lambda1(FacebookDialogFragment this$0, Bundle bundle, FacebookException facebookException) {
Intrinsics.checkNotNullParameter(this$0, "this$0");
this$0.onCompleteWebFallbackDialog(bundle);
}
@Override // androidx.fragment.app.DialogFragment
public Dialog onCreateDialog(Bundle bundle) {
Dialog dialog = this.innerDialog;
if (dialog != null) {
if (dialog != null) {
return dialog;
}
throw new NullPointerException("null cannot be cast to non-null type android.app.Dialog");
}
onCompleteWebDialog(null, null);
setShowsDialog(false);
Dialog onCreateDialog = super.onCreateDialog(bundle);
Intrinsics.checkNotNullExpressionValue(onCreateDialog, "super.onCreateDialog(savedInstanceState)");
return onCreateDialog;
}
@Override // androidx.fragment.app.Fragment
public void onResume() {
super.onResume();
Dialog dialog = this.innerDialog;
if (dialog instanceof WebDialog) {
if (dialog == null) {
throw new NullPointerException("null cannot be cast to non-null type com.facebook.internal.WebDialog");
}
((WebDialog) dialog).resize();
}
}
@Override // androidx.fragment.app.Fragment, android.content.ComponentCallbacks
public void onConfigurationChanged(Configuration newConfig) {
Intrinsics.checkNotNullParameter(newConfig, "newConfig");
super.onConfigurationChanged(newConfig);
if ((this.innerDialog instanceof WebDialog) && isResumed()) {
Dialog dialog = this.innerDialog;
if (dialog == null) {
throw new NullPointerException("null cannot be cast to non-null type com.facebook.internal.WebDialog");
}
((WebDialog) dialog).resize();
}
}
@Override // androidx.fragment.app.DialogFragment, androidx.fragment.app.Fragment
public void onDestroyView() {
Dialog dialog = getDialog();
if (dialog != null && getRetainInstance()) {
dialog.setDismissMessage(null);
}
super.onDestroyView();
}
private final void onCompleteWebDialog(Bundle bundle, FacebookException facebookException) {
FragmentActivity activity = getActivity();
if (activity == null) {
return;
}
NativeProtocol nativeProtocol = NativeProtocol.INSTANCE;
Intent intent = activity.getIntent();
Intrinsics.checkNotNullExpressionValue(intent, "fragmentActivity.intent");
activity.setResult(facebookException == null ? -1 : 0, NativeProtocol.createProtocolResultIntent(intent, bundle, facebookException));
activity.finish();
}
private final void onCompleteWebFallbackDialog(Bundle bundle) {
FragmentActivity activity = getActivity();
if (activity == null) {
return;
}
Intent intent = new Intent();
if (bundle == null) {
bundle = new Bundle();
}
intent.putExtras(bundle);
activity.setResult(-1, intent);
activity.finish();
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
}
}

View File

@@ -0,0 +1,69 @@
package com.facebook.internal;
import android.content.ContentProvider;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
import com.facebook.FacebookSdk;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes2.dex */
public final class FacebookInitProvider extends ContentProvider {
public static final Companion Companion = new Companion(null);
private static final String TAG = FacebookInitProvider.class.getSimpleName();
@Override // android.content.ContentProvider
public int delete(Uri uri, String str, String[] strArr) {
Intrinsics.checkNotNullParameter(uri, "uri");
return 0;
}
@Override // android.content.ContentProvider
public String getType(Uri uri) {
Intrinsics.checkNotNullParameter(uri, "uri");
return null;
}
@Override // android.content.ContentProvider
public Uri insert(Uri uri, ContentValues contentValues) {
Intrinsics.checkNotNullParameter(uri, "uri");
return null;
}
@Override // android.content.ContentProvider
public Cursor query(Uri uri, String[] strArr, String str, String[] strArr2, String str2) {
Intrinsics.checkNotNullParameter(uri, "uri");
return null;
}
@Override // android.content.ContentProvider
public int update(Uri uri, ContentValues contentValues, String str, String[] strArr) {
Intrinsics.checkNotNullParameter(uri, "uri");
return 0;
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
}
@Override // android.content.ContentProvider
public boolean onCreate() {
try {
Context context = getContext();
if (context == null) {
throw new IllegalArgumentException("Required value was null.".toString());
}
FacebookSdk.sdkInitialize(context);
return false;
} catch (Exception unused) {
return false;
}
}
}

View File

@@ -0,0 +1,272 @@
package com.facebook.internal;
import com.facebook.FacebookRequestError;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import kotlin.TuplesKt;
import kotlin.collections.MapsKt__MapsKt;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.text.StringsKt__StringsJVMKt;
import org.json.JSONArray;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public final class FacebookRequestErrorClassification {
public static final Companion Companion = new Companion(null);
public static final int EC_APP_NOT_INSTALLED = 412;
public static final int EC_APP_TOO_MANY_CALLS = 4;
public static final int EC_INVALID_SESSION = 102;
public static final int EC_INVALID_TOKEN = 190;
public static final int EC_RATE = 9;
public static final int EC_SERVICE_UNAVAILABLE = 2;
public static final int EC_TOO_MANY_USER_ACTION_CALLS = 341;
public static final int EC_USER_TOO_MANY_CALLS = 17;
public static final int ESC_APP_INACTIVE = 493;
public static final int ESC_APP_NOT_INSTALLED = 458;
public static final String KEY_LOGIN_RECOVERABLE = "login_recoverable";
public static final String KEY_NAME = "name";
public static final String KEY_OTHER = "other";
public static final String KEY_RECOVERY_MESSAGE = "recovery_message";
public static final String KEY_TRANSIENT = "transient";
private static FacebookRequestErrorClassification defaultInstance;
private final Map<Integer, Set<Integer>> loginRecoverableErrors;
private final String loginRecoverableRecoveryMessage;
private final Map<Integer, Set<Integer>> otherErrors;
private final String otherRecoveryMessage;
private final Map<Integer, Set<Integer>> transientErrors;
private final String transientRecoveryMessage;
public /* synthetic */ class WhenMappings {
public static final /* synthetic */ int[] $EnumSwitchMapping$0;
static {
int[] iArr = new int[FacebookRequestError.Category.valuesCustom().length];
iArr[FacebookRequestError.Category.OTHER.ordinal()] = 1;
iArr[FacebookRequestError.Category.LOGIN_RECOVERABLE.ordinal()] = 2;
iArr[FacebookRequestError.Category.TRANSIENT.ordinal()] = 3;
$EnumSwitchMapping$0 = iArr;
}
}
public static final FacebookRequestErrorClassification createFromJSON(JSONArray jSONArray) {
return Companion.createFromJSON(jSONArray);
}
public static final synchronized FacebookRequestErrorClassification getDefaultErrorClassification() {
FacebookRequestErrorClassification defaultErrorClassification;
synchronized (FacebookRequestErrorClassification.class) {
defaultErrorClassification = Companion.getDefaultErrorClassification();
}
return defaultErrorClassification;
}
public final Map<Integer, Set<Integer>> getLoginRecoverableErrors() {
return this.loginRecoverableErrors;
}
public final Map<Integer, Set<Integer>> getOtherErrors() {
return this.otherErrors;
}
public final Map<Integer, Set<Integer>> getTransientErrors() {
return this.transientErrors;
}
/* JADX WARN: Multi-variable type inference failed */
public FacebookRequestErrorClassification(Map<Integer, ? extends Set<Integer>> map, Map<Integer, ? extends Set<Integer>> map2, Map<Integer, ? extends Set<Integer>> map3, String str, String str2, String str3) {
this.otherErrors = map;
this.transientErrors = map2;
this.loginRecoverableErrors = map3;
this.otherRecoveryMessage = str;
this.transientRecoveryMessage = str2;
this.loginRecoverableRecoveryMessage = str3;
}
public final String getRecoveryMessage(FacebookRequestError.Category category) {
int i = category == null ? -1 : WhenMappings.$EnumSwitchMapping$0[category.ordinal()];
if (i == 1) {
return this.otherRecoveryMessage;
}
if (i == 2) {
return this.loginRecoverableRecoveryMessage;
}
if (i != 3) {
return null;
}
return this.transientRecoveryMessage;
}
public final FacebookRequestError.Category classify(int i, int i2, boolean z) {
Set<Integer> set;
Set<Integer> set2;
Set<Integer> set3;
if (z) {
return FacebookRequestError.Category.TRANSIENT;
}
Map<Integer, Set<Integer>> map = this.otherErrors;
if (map != null && map.containsKey(Integer.valueOf(i)) && ((set3 = this.otherErrors.get(Integer.valueOf(i))) == null || set3.contains(Integer.valueOf(i2)))) {
return FacebookRequestError.Category.OTHER;
}
Map<Integer, Set<Integer>> map2 = this.loginRecoverableErrors;
if (map2 != null && map2.containsKey(Integer.valueOf(i)) && ((set2 = this.loginRecoverableErrors.get(Integer.valueOf(i))) == null || set2.contains(Integer.valueOf(i2)))) {
return FacebookRequestError.Category.LOGIN_RECOVERABLE;
}
Map<Integer, Set<Integer>> map3 = this.transientErrors;
if (map3 != null && map3.containsKey(Integer.valueOf(i)) && ((set = this.transientErrors.get(Integer.valueOf(i))) == null || set.contains(Integer.valueOf(i2)))) {
return FacebookRequestError.Category.TRANSIENT;
}
return FacebookRequestError.Category.OTHER;
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
public static /* synthetic */ void getDefaultErrorClassification$annotations() {
}
private Companion() {
}
public final synchronized FacebookRequestErrorClassification getDefaultErrorClassification() {
FacebookRequestErrorClassification facebookRequestErrorClassification;
try {
if (FacebookRequestErrorClassification.defaultInstance == null) {
FacebookRequestErrorClassification.defaultInstance = getDefaultErrorClassificationImpl();
}
facebookRequestErrorClassification = FacebookRequestErrorClassification.defaultInstance;
if (facebookRequestErrorClassification == null) {
throw new NullPointerException("null cannot be cast to non-null type com.facebook.internal.FacebookRequestErrorClassification");
}
} catch (Throwable th) {
throw th;
}
return facebookRequestErrorClassification;
}
private final FacebookRequestErrorClassification getDefaultErrorClassificationImpl() {
HashMap hashMapOf;
HashMap hashMapOf2;
hashMapOf = MapsKt__MapsKt.hashMapOf(TuplesKt.to(2, null), TuplesKt.to(4, null), TuplesKt.to(9, null), TuplesKt.to(17, null), TuplesKt.to(Integer.valueOf(FacebookRequestErrorClassification.EC_TOO_MANY_USER_ACTION_CALLS), null));
hashMapOf2 = MapsKt__MapsKt.hashMapOf(TuplesKt.to(102, null), TuplesKt.to(Integer.valueOf(FacebookRequestErrorClassification.EC_INVALID_TOKEN), null), TuplesKt.to(412, null));
return new FacebookRequestErrorClassification(null, hashMapOf, hashMapOf2, null, null, null);
}
private final Map<Integer, Set<Integer>> parseJSONDefinition(JSONObject jSONObject) {
int optInt;
HashSet hashSet;
JSONArray optJSONArray = jSONObject.optJSONArray("items");
if (optJSONArray == null || optJSONArray.length() == 0) {
return null;
}
HashMap hashMap = new HashMap();
int length = optJSONArray.length();
if (length > 0) {
int i = 0;
while (true) {
int i2 = i + 1;
JSONObject optJSONObject = optJSONArray.optJSONObject(i);
if (optJSONObject != null && (optInt = optJSONObject.optInt("code")) != 0) {
JSONArray optJSONArray2 = optJSONObject.optJSONArray("subcodes");
if (optJSONArray2 == null || optJSONArray2.length() <= 0) {
hashSet = null;
} else {
hashSet = new HashSet();
int length2 = optJSONArray2.length();
if (length2 > 0) {
int i3 = 0;
while (true) {
int i4 = i3 + 1;
int optInt2 = optJSONArray2.optInt(i3);
if (optInt2 != 0) {
hashSet.add(Integer.valueOf(optInt2));
}
if (i4 >= length2) {
break;
}
i3 = i4;
}
}
}
hashMap.put(Integer.valueOf(optInt), hashSet);
}
if (i2 >= length) {
break;
}
i = i2;
}
}
return hashMap;
}
public final FacebookRequestErrorClassification createFromJSON(JSONArray jSONArray) {
Map<Integer, Set<Integer>> map;
Map<Integer, Set<Integer>> map2;
Map<Integer, Set<Integer>> map3;
String str;
String str2;
String str3;
String optString;
boolean equals;
boolean equals2;
boolean equals3;
if (jSONArray == null) {
return null;
}
int length = jSONArray.length();
if (length > 0) {
int i = 0;
Map<Integer, Set<Integer>> map4 = null;
Map<Integer, Set<Integer>> map5 = null;
Map<Integer, Set<Integer>> map6 = null;
String str4 = null;
String str5 = null;
String str6 = null;
while (true) {
int i2 = i + 1;
JSONObject optJSONObject = jSONArray.optJSONObject(i);
if (optJSONObject != null && (optString = optJSONObject.optString("name")) != null) {
equals = StringsKt__StringsJVMKt.equals(optString, "other", true);
if (equals) {
str4 = optJSONObject.optString(FacebookRequestErrorClassification.KEY_RECOVERY_MESSAGE, null);
map4 = parseJSONDefinition(optJSONObject);
} else {
equals2 = StringsKt__StringsJVMKt.equals(optString, FacebookRequestErrorClassification.KEY_TRANSIENT, true);
if (equals2) {
str5 = optJSONObject.optString(FacebookRequestErrorClassification.KEY_RECOVERY_MESSAGE, null);
map5 = parseJSONDefinition(optJSONObject);
} else {
equals3 = StringsKt__StringsJVMKt.equals(optString, FacebookRequestErrorClassification.KEY_LOGIN_RECOVERABLE, true);
if (equals3) {
str6 = optJSONObject.optString(FacebookRequestErrorClassification.KEY_RECOVERY_MESSAGE, null);
map6 = parseJSONDefinition(optJSONObject);
}
}
}
}
if (i2 >= length) {
break;
}
i = i2;
}
map = map4;
map2 = map5;
map3 = map6;
str = str4;
str2 = str5;
str3 = str6;
} else {
map = null;
map2 = null;
map3 = null;
str = null;
str2 = null;
str3 = null;
}
return new FacebookRequestErrorClassification(map, map2, map3, str, str2, str3);
}
}
}

View File

@@ -0,0 +1,72 @@
package com.facebook.internal;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.Signature;
import android.os.Build;
import java.util.HashSet;
import kotlin.collections.CollectionsKt___CollectionsKt;
import kotlin.collections.SetsKt__SetsKt;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.StringsKt__StringsJVMKt;
/* loaded from: classes2.dex */
public final class FacebookSignatureValidator {
private static final String FBF_HASH = "2438bce1ddb7bd026d5ff89f598b3b5e5bb824b3";
private static final String FBI_HASH = "a4b7452e2ed8f5f191058ca7bbfd26b0d3214bfc";
private static final String FBL_HASH = "df6b721c8b4d3b6eb44c861d4415007e5a35fc95";
private static final String FBR2_HASH = "cc2751449a350f668590264ed76692694a80308a";
private static final String FBR_HASH = "8a3c4b262d721acd49a4bf97d5213199c86fa2b9";
private static final String IGR_HASH = "c56fb7d591ba6704df047fd98f535372fea00211";
public static final FacebookSignatureValidator INSTANCE = new FacebookSignatureValidator();
private static final String MSR_HASH = "9b8f518b086098de3d77736f9458a3d2f6f95a37";
private static final HashSet<String> validAppSignatureHashes;
private FacebookSignatureValidator() {
}
static {
HashSet<String> hashSetOf;
hashSetOf = SetsKt__SetsKt.hashSetOf(FBR_HASH, FBR2_HASH, FBI_HASH, FBL_HASH, MSR_HASH, FBF_HASH, IGR_HASH);
validAppSignatureHashes = hashSetOf;
}
public static final boolean validateSignature(Context context, String packageName) {
boolean contains;
Intrinsics.checkNotNullParameter(context, "context");
Intrinsics.checkNotNullParameter(packageName, "packageName");
String brand = Build.BRAND;
int i = context.getApplicationInfo().flags;
Intrinsics.checkNotNullExpressionValue(brand, "brand");
if (StringsKt__StringsJVMKt.startsWith$default(brand, "generic", false, 2, null) && (i & 2) != 0) {
return true;
}
try {
PackageInfo packageInfo = context.getPackageManager().getPackageInfo(packageName, 64);
Signature[] signatureArr = packageInfo.signatures;
if (signatureArr == null) {
return false;
}
Intrinsics.checkNotNullExpressionValue(signatureArr, "packageInfo.signatures");
if (signatureArr.length == 0) {
return false;
}
Signature[] signatureArr2 = packageInfo.signatures;
Intrinsics.checkNotNullExpressionValue(signatureArr2, "packageInfo.signatures");
for (Signature signature : signatureArr2) {
HashSet<String> hashSet = validAppSignatureHashes;
Utility utility = Utility.INSTANCE;
byte[] byteArray = signature.toByteArray();
Intrinsics.checkNotNullExpressionValue(byteArray, "it.toByteArray()");
contains = CollectionsKt___CollectionsKt.contains(hashSet, Utility.sha1hash(byteArray));
if (!contains) {
return false;
}
}
return true;
} catch (PackageManager.NameNotFoundException unused) {
return false;
}
}
}

View File

@@ -0,0 +1,107 @@
package com.facebook.internal;
import android.content.Context;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.webkit.WebView;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import org.json.JSONException;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public final class FacebookWebFallbackDialog extends WebDialog {
private static final int OS_BACK_BUTTON_RESPONSE_TIMEOUT_MILLISECONDS = 1500;
private boolean waitingForDialogToClose;
public static final Companion Companion = new Companion(null);
private static final String TAG = FacebookWebFallbackDialog.class.getName();
public /* synthetic */ FacebookWebFallbackDialog(Context context, String str, String str2, DefaultConstructorMarker defaultConstructorMarker) {
this(context, str, str2);
}
public static final FacebookWebFallbackDialog newInstance(Context context, String str, String str2) {
return Companion.newInstance(context, str, str2);
}
private FacebookWebFallbackDialog(Context context, String str, String str2) {
super(context, str);
setExpectedRedirectUrl(str2);
}
@Override // com.facebook.internal.WebDialog
public Bundle parseResponseUri(String str) {
Uri parse = Uri.parse(str);
Utility utility = Utility.INSTANCE;
Bundle parseUrlQueryString = Utility.parseUrlQueryString(parse.getQuery());
String string = parseUrlQueryString.getString(ServerProtocol.FALLBACK_DIALOG_PARAM_BRIDGE_ARGS);
parseUrlQueryString.remove(ServerProtocol.FALLBACK_DIALOG_PARAM_BRIDGE_ARGS);
if (!Utility.isNullOrEmpty(string)) {
try {
parseUrlQueryString.putBundle(NativeProtocol.EXTRA_PROTOCOL_BRIDGE_ARGS, BundleJSONConverter.convertToBundle(new JSONObject(string)));
} catch (JSONException e) {
Utility utility2 = Utility.INSTANCE;
Utility.logd(TAG, "Unable to parse bridge_args JSON", e);
}
}
String string2 = parseUrlQueryString.getString(ServerProtocol.FALLBACK_DIALOG_PARAM_METHOD_RESULTS);
parseUrlQueryString.remove(ServerProtocol.FALLBACK_DIALOG_PARAM_METHOD_RESULTS);
if (!Utility.isNullOrEmpty(string2)) {
try {
parseUrlQueryString.putBundle(NativeProtocol.EXTRA_PROTOCOL_METHOD_RESULTS, BundleJSONConverter.convertToBundle(new JSONObject(string2)));
} catch (JSONException e2) {
Utility utility3 = Utility.INSTANCE;
Utility.logd(TAG, "Unable to parse bridge_args JSON", e2);
}
}
parseUrlQueryString.remove("version");
parseUrlQueryString.putInt(NativeProtocol.EXTRA_PROTOCOL_VERSION, NativeProtocol.getLatestKnownVersion());
return parseUrlQueryString;
}
@Override // com.facebook.internal.WebDialog, android.app.Dialog, android.content.DialogInterface
public void cancel() {
WebView webView = getWebView();
if (!isPageFinished() || isListenerCalled() || webView == null || !webView.isShown()) {
super.cancel();
} else {
if (this.waitingForDialogToClose) {
return;
}
this.waitingForDialogToClose = true;
webView.loadUrl(Intrinsics.stringPlus("javascript:", "(function() { var event = document.createEvent('Event'); event.initEvent('fbPlatformDialogMustClose',true,true); document.dispatchEvent(event);})();"));
new Handler(Looper.getMainLooper()).postDelayed(new Runnable() { // from class: com.facebook.internal.FacebookWebFallbackDialog$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
FacebookWebFallbackDialog.m560cancel$lambda0(FacebookWebFallbackDialog.this);
}
}, 1500L);
}
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: cancel$lambda-0, reason: not valid java name */
public static final void m560cancel$lambda0(FacebookWebFallbackDialog this$0) {
Intrinsics.checkNotNullParameter(this$0, "this$0");
super.cancel();
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
public final FacebookWebFallbackDialog newInstance(Context context, String url, String expectedRedirectUrl) {
Intrinsics.checkNotNullParameter(context, "context");
Intrinsics.checkNotNullParameter(url, "url");
Intrinsics.checkNotNullParameter(expectedRedirectUrl, "expectedRedirectUrl");
WebDialog.initDefaultTheme(context);
return new FacebookWebFallbackDialog(context, url, expectedRedirectUrl, null);
}
}
}

View File

@@ -0,0 +1,403 @@
package com.facebook.internal;
import android.R;
import androidx.annotation.RestrictTo;
import androidx.core.internal.view.SupportMenu;
import androidx.core.view.ViewCompat;
import com.facebook.FacebookSdk;
import com.facebook.internal.FeatureManager;
import com.facebook.internal.FetchedAppGateKeepersManager;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.StringsKt__StringsJVMKt;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
/* loaded from: classes2.dex */
public final class FeatureManager {
private static final String FEATURE_MANAGER_STORE = "com.facebook.internal.FEATURE_MANAGER";
public static final FeatureManager INSTANCE = new FeatureManager();
private static final Map<Feature, String[]> featureMapping = new HashMap();
public interface Callback {
void onCompleted(boolean z);
}
public /* synthetic */ class WhenMappings {
public static final /* synthetic */ int[] $EnumSwitchMapping$0;
static {
int[] iArr = new int[Feature.valuesCustom().length];
iArr[Feature.RestrictiveDataFiltering.ordinal()] = 1;
iArr[Feature.Instrument.ordinal()] = 2;
iArr[Feature.CrashReport.ordinal()] = 3;
iArr[Feature.CrashShield.ordinal()] = 4;
iArr[Feature.ThreadCheck.ordinal()] = 5;
iArr[Feature.ErrorReport.ordinal()] = 6;
iArr[Feature.AnrReport.ordinal()] = 7;
iArr[Feature.AAM.ordinal()] = 8;
iArr[Feature.CloudBridge.ordinal()] = 9;
iArr[Feature.PrivacyProtection.ordinal()] = 10;
iArr[Feature.SuggestedEvents.ordinal()] = 11;
iArr[Feature.IntelligentIntegrity.ordinal()] = 12;
iArr[Feature.ModelRequest.ordinal()] = 13;
iArr[Feature.EventDeactivation.ordinal()] = 14;
iArr[Feature.OnDeviceEventProcessing.ordinal()] = 15;
iArr[Feature.OnDevicePostInstallEventProcessing.ordinal()] = 16;
iArr[Feature.IapLogging.ordinal()] = 17;
iArr[Feature.IapLoggingLib2.ordinal()] = 18;
iArr[Feature.ProtectedMode.ordinal()] = 19;
iArr[Feature.MACARuleMatching.ordinal()] = 20;
iArr[Feature.BlocklistEvents.ordinal()] = 21;
iArr[Feature.FilterRedactedEvents.ordinal()] = 22;
iArr[Feature.FilterSensitiveParams.ordinal()] = 23;
iArr[Feature.ChromeCustomTabsPrefetching.ordinal()] = 24;
iArr[Feature.Monitoring.ordinal()] = 25;
iArr[Feature.IgnoreAppSwitchToLoggedOut.ordinal()] = 26;
iArr[Feature.BypassAppSwitch.ordinal()] = 27;
$EnumSwitchMapping$0 = iArr;
}
}
private FeatureManager() {
}
public static final void checkFeature(final Feature feature, final Callback callback) {
Intrinsics.checkNotNullParameter(feature, "feature");
Intrinsics.checkNotNullParameter(callback, "callback");
FetchedAppGateKeepersManager fetchedAppGateKeepersManager = FetchedAppGateKeepersManager.INSTANCE;
FetchedAppGateKeepersManager.loadAppGateKeepersAsync(new FetchedAppGateKeepersManager.Callback() { // from class: com.facebook.internal.FeatureManager$checkFeature$1
@Override // com.facebook.internal.FetchedAppGateKeepersManager.Callback
public void onCompleted() {
FeatureManager.Callback callback2 = FeatureManager.Callback.this;
FeatureManager featureManager = FeatureManager.INSTANCE;
callback2.onCompleted(FeatureManager.isEnabled(feature));
}
});
}
public static final boolean isEnabled(Feature feature) {
Intrinsics.checkNotNullParameter(feature, "feature");
if (Feature.Unknown == feature) {
return false;
}
if (Feature.Core == feature) {
return true;
}
String string = FacebookSdk.getApplicationContext().getSharedPreferences(FEATURE_MANAGER_STORE, 0).getString(feature.toKey(), null);
if (string != null && Intrinsics.areEqual(string, FacebookSdk.getSdkVersion())) {
return false;
}
Feature parent = feature.getParent();
if (parent == feature) {
return INSTANCE.getGKStatus(feature);
}
return isEnabled(parent) && INSTANCE.getGKStatus(feature);
}
public static final void disableFeature(Feature feature) {
Intrinsics.checkNotNullParameter(feature, "feature");
FacebookSdk.getApplicationContext().getSharedPreferences(FEATURE_MANAGER_STORE, 0).edit().putString(feature.toKey(), FacebookSdk.getSdkVersion()).apply();
}
public static final Feature getFeature(String className) {
Intrinsics.checkNotNullParameter(className, "className");
INSTANCE.initializeFeatureMapping();
for (Map.Entry<Feature, String[]> entry : featureMapping.entrySet()) {
Feature key = entry.getKey();
String[] value = entry.getValue();
int length = value.length;
int i = 0;
while (i < length) {
String str = value[i];
i++;
if (StringsKt__StringsJVMKt.startsWith$default(className, str, false, 2, null)) {
return key;
}
}
}
return Feature.Unknown;
}
private final synchronized void initializeFeatureMapping() {
Map<Feature, String[]> map = featureMapping;
if (map.isEmpty()) {
map.put(Feature.AAM, new String[]{"com.facebook.appevents.aam."});
map.put(Feature.CodelessEvents, new String[]{"com.facebook.appevents.codeless."});
map.put(Feature.CloudBridge, new String[]{"com.facebook.appevents.cloudbridge."});
map.put(Feature.ErrorReport, new String[]{"com.facebook.internal.instrument.errorreport."});
map.put(Feature.AnrReport, new String[]{"com.facebook.internal.instrument.anrreport."});
map.put(Feature.PrivacyProtection, new String[]{"com.facebook.appevents.ml."});
map.put(Feature.SuggestedEvents, new String[]{"com.facebook.appevents.suggestedevents."});
map.put(Feature.RestrictiveDataFiltering, new String[]{"com.facebook.appevents.restrictivedatafilter.RestrictiveDataManager"});
map.put(Feature.IntelligentIntegrity, new String[]{"com.facebook.appevents.integrity.IntegrityManager"});
map.put(Feature.ProtectedMode, new String[]{"com.facebook.appevents.integrity.ProtectedModeManager"});
map.put(Feature.MACARuleMatching, new String[]{"com.facebook.appevents.integrity.MACARuleMatchingManager"});
map.put(Feature.BlocklistEvents, new String[]{"com.facebook.appevents.integrity.BlocklistEventsManager"});
map.put(Feature.FilterRedactedEvents, new String[]{"com.facebook.appevents.integrity.RedactedEventsManager"});
map.put(Feature.FilterSensitiveParams, new String[]{"com.facebook.appevents.integrity.SensitiveParamsManager"});
map.put(Feature.EventDeactivation, new String[]{"com.facebook.appevents.eventdeactivation."});
map.put(Feature.OnDeviceEventProcessing, new String[]{"com.facebook.appevents.ondeviceprocessing."});
map.put(Feature.IapLogging, new String[]{"com.facebook.appevents.iap."});
map.put(Feature.Monitoring, new String[]{"com.facebook.internal.logging.monitor"});
}
}
private final boolean getGKStatus(Feature feature) {
boolean defaultStatus = defaultStatus(feature);
FetchedAppGateKeepersManager fetchedAppGateKeepersManager = FetchedAppGateKeepersManager.INSTANCE;
return FetchedAppGateKeepersManager.getGateKeeperForKey(feature.toKey(), FacebookSdk.getApplicationId(), defaultStatus);
}
private final boolean defaultStatus(Feature feature) {
switch (WhenMappings.$EnumSwitchMapping$0[feature.ordinal()]) {
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
case 8:
case 9:
case 10:
case 11:
case 12:
case 13:
case 14:
case 15:
case 16:
case 17:
case 18:
case 19:
case 20:
case 21:
case 22:
case 23:
case 24:
case 25:
case 26:
case 27:
return false;
default:
return true;
}
}
public enum Feature {
Unknown(-1),
Core(0),
AppEvents(65536),
CodelessEvents(65792),
CloudBridge(67584),
RestrictiveDataFiltering(66048),
AAM(66304),
PrivacyProtection(66560),
SuggestedEvents(66561),
IntelligentIntegrity(66562),
ModelRequest(66563),
ProtectedMode(66564),
MACARuleMatching(66565),
BlocklistEvents(66566),
FilterRedactedEvents(66567),
FilterSensitiveParams(66568),
EventDeactivation(66816),
OnDeviceEventProcessing(67072),
OnDevicePostInstallEventProcessing(67073),
IapLogging(67328),
IapLoggingLib2(67329),
Instrument(131072),
CrashReport(131328),
CrashShield(131329),
ThreadCheck(131330),
ErrorReport(131584),
AnrReport(131840),
Monitoring(196608),
ServiceUpdateCompliance(196864),
Megatron(262144),
Elora(327680),
Login(16777216),
ChromeCustomTabsPrefetching(R.attr.theme),
IgnoreAppSwitchToLoggedOut(R.id.background),
BypassAppSwitch(R.style.Animation),
Share(33554432);
public static final Companion Companion = new Companion(null);
private final int code;
public /* synthetic */ class WhenMappings {
public static final /* synthetic */ int[] $EnumSwitchMapping$0;
static {
int[] iArr = new int[Feature.valuesCustom().length];
iArr[Feature.Core.ordinal()] = 1;
iArr[Feature.AppEvents.ordinal()] = 2;
iArr[Feature.CodelessEvents.ordinal()] = 3;
iArr[Feature.RestrictiveDataFiltering.ordinal()] = 4;
iArr[Feature.Instrument.ordinal()] = 5;
iArr[Feature.CrashReport.ordinal()] = 6;
iArr[Feature.CrashShield.ordinal()] = 7;
iArr[Feature.ThreadCheck.ordinal()] = 8;
iArr[Feature.ErrorReport.ordinal()] = 9;
iArr[Feature.AnrReport.ordinal()] = 10;
iArr[Feature.AAM.ordinal()] = 11;
iArr[Feature.CloudBridge.ordinal()] = 12;
iArr[Feature.PrivacyProtection.ordinal()] = 13;
iArr[Feature.SuggestedEvents.ordinal()] = 14;
iArr[Feature.IntelligentIntegrity.ordinal()] = 15;
iArr[Feature.ProtectedMode.ordinal()] = 16;
iArr[Feature.MACARuleMatching.ordinal()] = 17;
iArr[Feature.BlocklistEvents.ordinal()] = 18;
iArr[Feature.FilterRedactedEvents.ordinal()] = 19;
iArr[Feature.FilterSensitiveParams.ordinal()] = 20;
iArr[Feature.ModelRequest.ordinal()] = 21;
iArr[Feature.EventDeactivation.ordinal()] = 22;
iArr[Feature.OnDeviceEventProcessing.ordinal()] = 23;
iArr[Feature.OnDevicePostInstallEventProcessing.ordinal()] = 24;
iArr[Feature.IapLogging.ordinal()] = 25;
iArr[Feature.IapLoggingLib2.ordinal()] = 26;
iArr[Feature.Monitoring.ordinal()] = 27;
iArr[Feature.Megatron.ordinal()] = 28;
iArr[Feature.Elora.ordinal()] = 29;
iArr[Feature.ServiceUpdateCompliance.ordinal()] = 30;
iArr[Feature.Login.ordinal()] = 31;
iArr[Feature.ChromeCustomTabsPrefetching.ordinal()] = 32;
iArr[Feature.IgnoreAppSwitchToLoggedOut.ordinal()] = 33;
iArr[Feature.BypassAppSwitch.ordinal()] = 34;
iArr[Feature.Share.ordinal()] = 35;
$EnumSwitchMapping$0 = iArr;
}
}
Feature(int i) {
this.code = i;
}
@Override // java.lang.Enum
public String toString() {
switch (WhenMappings.$EnumSwitchMapping$0[ordinal()]) {
case 1:
return "CoreKit";
case 2:
return "AppEvents";
case 3:
return "CodelessEvents";
case 4:
return "RestrictiveDataFiltering";
case 5:
return "Instrument";
case 6:
return "CrashReport";
case 7:
return "CrashShield";
case 8:
return "ThreadCheck";
case 9:
return "ErrorReport";
case 10:
return "AnrReport";
case 11:
return "AAM";
case 12:
return "AppEventsCloudbridge";
case 13:
return "PrivacyProtection";
case 14:
return "SuggestedEvents";
case 15:
return "IntelligentIntegrity";
case 16:
return "ProtectedMode";
case 17:
return "MACARuleMatching";
case 18:
return "BlocklistEvents";
case 19:
return "FilterRedactedEvents";
case 20:
return "FilterSensitiveParams";
case 21:
return "ModelRequest";
case 22:
return "EventDeactivation";
case 23:
return "OnDeviceEventProcessing";
case 24:
return "OnDevicePostInstallEventProcessing";
case 25:
return "IAPLogging";
case 26:
return "IAPLoggingLib2";
case 27:
return "Monitoring";
case 28:
return "Megatron";
case 29:
return "Elora";
case 30:
return "ServiceUpdateCompliance";
case 31:
return "LoginKit";
case 32:
return "ChromeCustomTabsPrefetching";
case 33:
return "IgnoreAppSwitchToLoggedOut";
case 34:
return "BypassAppSwitch";
case 35:
return "ShareKit";
default:
return "unknown";
}
}
public final String toKey() {
return Intrinsics.stringPlus("FBSDKFeature", this);
}
public final Feature getParent() {
int i = this.code;
if ((i & 255) > 0) {
return Companion.fromInt(i & (-256));
}
if ((65280 & i) > 0) {
return Companion.fromInt(i & SupportMenu.CATEGORY_MASK);
}
if ((16711680 & i) > 0) {
return Companion.fromInt(i & ViewCompat.MEASURED_STATE_MASK);
}
return Companion.fromInt(0);
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
public final Feature fromInt(int i) {
Feature[] valuesCustom = Feature.valuesCustom();
int length = valuesCustom.length;
int i2 = 0;
while (i2 < length) {
Feature feature = valuesCustom[i2];
i2++;
if (feature.code == i) {
return feature;
}
}
return Feature.Unknown;
}
}
/* renamed from: values, reason: to resolve conflict with enum method */
public static Feature[] valuesCustom() {
Feature[] valuesCustom = values();
return (Feature[]) Arrays.copyOf(valuesCustom, valuesCustom.length);
}
}
}

View File

@@ -0,0 +1,310 @@
package com.facebook.internal;
import android.content.Context;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.util.Log;
import androidx.annotation.RestrictTo;
import androidx.annotation.VisibleForTesting;
import com.facebook.FacebookSdk;
import com.facebook.GraphRequest;
import com.facebook.internal.FetchedAppGateKeepersManager;
import com.facebook.internal.gatekeeper.GateKeeper;
import com.facebook.internal.gatekeeper.GateKeeperRuntimeCache;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.Executor;
import java.util.concurrent.atomic.AtomicBoolean;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.Reflection;
import kotlin.jvm.internal.StringCompanionObject;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
/* loaded from: classes2.dex */
public final class FetchedAppGateKeepersManager {
private static final String APPLICATION_FIELDS = "fields";
private static final long APPLICATION_GATEKEEPER_CACHE_TIMEOUT = 3600000;
private static final String APPLICATION_GATEKEEPER_EDGE = "mobile_sdk_gk";
private static final String APPLICATION_GATEKEEPER_FIELD = "gatekeepers";
private static final String APPLICATION_GRAPH_DATA = "data";
private static final String APPLICATION_PLATFORM = "platform";
private static final String APPLICATION_SDK_VERSION = "sdk_version";
private static final String APP_GATEKEEPERS_PREFS_KEY_FORMAT = "com.facebook.internal.APP_GATEKEEPERS.%s";
private static final String APP_GATEKEEPERS_PREFS_STORE = "com.facebook.internal.preferences.APP_GATEKEEPERS";
private static final String APP_PLATFORM = "android";
private static GateKeeperRuntimeCache gateKeeperRuntimeCache;
private static Long timestamp;
public static final FetchedAppGateKeepersManager INSTANCE = new FetchedAppGateKeepersManager();
private static final String TAG = Reflection.getOrCreateKotlinClass(FetchedAppGateKeepersManager.class).getSimpleName();
private static final AtomicBoolean isLoading = new AtomicBoolean(false);
private static final ConcurrentLinkedQueue<Callback> callbacks = new ConcurrentLinkedQueue<>();
private static final Map<String, JSONObject> fetchedAppGateKeepers = new ConcurrentHashMap();
public interface Callback {
void onCompleted();
}
private FetchedAppGateKeepersManager() {
}
public final void loadAppGateKeepersAsync() {
loadAppGateKeepersAsync(null);
}
public static final synchronized void loadAppGateKeepersAsync(Callback callback) {
synchronized (FetchedAppGateKeepersManager.class) {
if (callback != null) {
try {
callbacks.add(callback);
} catch (Throwable th) {
throw th;
}
}
final String applicationId = FacebookSdk.getApplicationId();
FetchedAppGateKeepersManager fetchedAppGateKeepersManager = INSTANCE;
if (fetchedAppGateKeepersManager.isTimestampValid(timestamp) && fetchedAppGateKeepers.containsKey(applicationId)) {
fetchedAppGateKeepersManager.pollCallbacks();
return;
}
final Context applicationContext = FacebookSdk.getApplicationContext();
StringCompanionObject stringCompanionObject = StringCompanionObject.INSTANCE;
final String format = String.format(APP_GATEKEEPERS_PREFS_KEY_FORMAT, Arrays.copyOf(new Object[]{applicationId}, 1));
Intrinsics.checkNotNullExpressionValue(format, "java.lang.String.format(format, *args)");
if (applicationContext == null) {
return;
}
JSONObject jSONObject = null;
String string = applicationContext.getSharedPreferences(APP_GATEKEEPERS_PREFS_STORE, 0).getString(format, null);
if (!Utility.isNullOrEmpty(string)) {
try {
jSONObject = new JSONObject(string);
} catch (JSONException e) {
Utility.logd(Utility.LOG_TAG, e);
}
if (jSONObject != null) {
parseAppGateKeepersFromJSON$facebook_core_release(applicationId, jSONObject);
}
}
Executor executor = FacebookSdk.getExecutor();
if (executor == null) {
return;
}
if (isLoading.compareAndSet(false, true)) {
executor.execute(new Runnable() { // from class: com.facebook.internal.FetchedAppGateKeepersManager$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
FetchedAppGateKeepersManager.m562loadAppGateKeepersAsync$lambda0(applicationId, applicationContext, format);
}
});
}
}
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: loadAppGateKeepersAsync$lambda-0, reason: not valid java name */
public static final void m562loadAppGateKeepersAsync$lambda0(String applicationId, Context context, String gateKeepersKey) {
Intrinsics.checkNotNullParameter(applicationId, "$applicationId");
Intrinsics.checkNotNullParameter(context, "$context");
Intrinsics.checkNotNullParameter(gateKeepersKey, "$gateKeepersKey");
FetchedAppGateKeepersManager fetchedAppGateKeepersManager = INSTANCE;
JSONObject appGateKeepersQueryResponse = fetchedAppGateKeepersManager.getAppGateKeepersQueryResponse(applicationId);
if (appGateKeepersQueryResponse.length() != 0) {
parseAppGateKeepersFromJSON$facebook_core_release(applicationId, appGateKeepersQueryResponse);
context.getSharedPreferences(APP_GATEKEEPERS_PREFS_STORE, 0).edit().putString(gateKeepersKey, appGateKeepersQueryResponse.toString()).apply();
timestamp = Long.valueOf(System.currentTimeMillis());
}
fetchedAppGateKeepersManager.pollCallbacks();
isLoading.set(false);
}
private final void pollCallbacks() {
Handler handler = new Handler(Looper.getMainLooper());
while (true) {
ConcurrentLinkedQueue<Callback> concurrentLinkedQueue = callbacks;
if (concurrentLinkedQueue.isEmpty()) {
return;
}
final Callback poll = concurrentLinkedQueue.poll();
if (poll != null) {
handler.post(new Runnable() { // from class: com.facebook.internal.FetchedAppGateKeepersManager$$ExternalSyntheticLambda1
@Override // java.lang.Runnable
public final void run() {
FetchedAppGateKeepersManager.Callback.this.onCompleted();
}
});
}
}
}
public static final JSONObject queryAppGateKeepers(String applicationId, boolean z) {
Intrinsics.checkNotNullParameter(applicationId, "applicationId");
if (!z) {
Map<String, JSONObject> map = fetchedAppGateKeepers;
if (map.containsKey(applicationId)) {
JSONObject jSONObject = map.get(applicationId);
return jSONObject == null ? new JSONObject() : jSONObject;
}
}
JSONObject appGateKeepersQueryResponse = INSTANCE.getAppGateKeepersQueryResponse(applicationId);
Context applicationContext = FacebookSdk.getApplicationContext();
StringCompanionObject stringCompanionObject = StringCompanionObject.INSTANCE;
String format = String.format(APP_GATEKEEPERS_PREFS_KEY_FORMAT, Arrays.copyOf(new Object[]{applicationId}, 1));
Intrinsics.checkNotNullExpressionValue(format, "java.lang.String.format(format, *args)");
applicationContext.getSharedPreferences(APP_GATEKEEPERS_PREFS_STORE, 0).edit().putString(format, appGateKeepersQueryResponse.toString()).apply();
return parseAppGateKeepersFromJSON$facebook_core_release(applicationId, appGateKeepersQueryResponse);
}
public final Map<String, Boolean> getGateKeepersForApplication(String str) {
loadAppGateKeepersAsync();
if (str != null) {
Map<String, JSONObject> map = fetchedAppGateKeepers;
if (map.containsKey(str)) {
GateKeeperRuntimeCache gateKeeperRuntimeCache2 = gateKeeperRuntimeCache;
List<GateKeeper> dumpGateKeepers = gateKeeperRuntimeCache2 == null ? null : gateKeeperRuntimeCache2.dumpGateKeepers(str);
if (dumpGateKeepers != null) {
HashMap hashMap = new HashMap();
for (GateKeeper gateKeeper : dumpGateKeepers) {
hashMap.put(gateKeeper.getName(), Boolean.valueOf(gateKeeper.getValue()));
}
return hashMap;
}
HashMap hashMap2 = new HashMap();
JSONObject jSONObject = map.get(str);
if (jSONObject == null) {
jSONObject = new JSONObject();
}
Iterator<String> keys = jSONObject.keys();
while (keys.hasNext()) {
String key = keys.next();
Intrinsics.checkNotNullExpressionValue(key, "key");
hashMap2.put(key, Boolean.valueOf(jSONObject.optBoolean(key)));
}
GateKeeperRuntimeCache gateKeeperRuntimeCache3 = gateKeeperRuntimeCache;
if (gateKeeperRuntimeCache3 == null) {
gateKeeperRuntimeCache3 = new GateKeeperRuntimeCache();
}
ArrayList arrayList = new ArrayList(hashMap2.size());
for (Map.Entry entry : hashMap2.entrySet()) {
arrayList.add(new GateKeeper((String) entry.getKey(), ((Boolean) entry.getValue()).booleanValue()));
}
gateKeeperRuntimeCache3.setGateKeepers(str, arrayList);
gateKeeperRuntimeCache = gateKeeperRuntimeCache3;
return hashMap2;
}
}
return new HashMap();
}
public static final boolean getGateKeeperForKey(String name, String str, boolean z) {
Boolean bool;
Intrinsics.checkNotNullParameter(name, "name");
Map<String, Boolean> gateKeepersForApplication = INSTANCE.getGateKeepersForApplication(str);
return (gateKeepersForApplication.containsKey(name) && (bool = gateKeepersForApplication.get(name)) != null) ? bool.booleanValue() : z;
}
public static /* synthetic */ void setRuntimeGateKeeper$default(String str, GateKeeper gateKeeper, int i, Object obj) {
if ((i & 1) != 0) {
str = FacebookSdk.getApplicationId();
}
setRuntimeGateKeeper(str, gateKeeper);
}
public static final void setRuntimeGateKeeper(String applicationId, GateKeeper gateKeeper) {
Intrinsics.checkNotNullParameter(applicationId, "applicationId");
Intrinsics.checkNotNullParameter(gateKeeper, "gateKeeper");
GateKeeperRuntimeCache gateKeeperRuntimeCache2 = gateKeeperRuntimeCache;
if ((gateKeeperRuntimeCache2 == null ? null : gateKeeperRuntimeCache2.getGateKeeper(applicationId, gateKeeper.getName())) == null) {
Log.w(TAG, "Missing gatekeeper runtime cache");
return;
}
GateKeeperRuntimeCache gateKeeperRuntimeCache3 = gateKeeperRuntimeCache;
if (gateKeeperRuntimeCache3 == null) {
return;
}
gateKeeperRuntimeCache3.setGateKeeper(applicationId, gateKeeper);
}
public static final void resetRuntimeGateKeeperCache() {
GateKeeperRuntimeCache gateKeeperRuntimeCache2 = gateKeeperRuntimeCache;
if (gateKeeperRuntimeCache2 == null) {
return;
}
GateKeeperRuntimeCache.resetCache$default(gateKeeperRuntimeCache2, null, 1, null);
}
private final JSONObject getAppGateKeepersQueryResponse(String str) {
Bundle bundle = new Bundle();
bundle.putString("platform", "android");
bundle.putString(APPLICATION_SDK_VERSION, FacebookSdk.getSdkVersion());
bundle.putString("fields", APPLICATION_GATEKEEPER_FIELD);
GraphRequest.Companion companion = GraphRequest.Companion;
StringCompanionObject stringCompanionObject = StringCompanionObject.INSTANCE;
String format = String.format("app/%s", Arrays.copyOf(new Object[]{APPLICATION_GATEKEEPER_EDGE}, 1));
Intrinsics.checkNotNullExpressionValue(format, "java.lang.String.format(format, *args)");
GraphRequest newGraphPathRequest = companion.newGraphPathRequest(null, format, null);
newGraphPathRequest.setParameters(bundle);
JSONObject jsonObject = newGraphPathRequest.executeAndWait().getJsonObject();
return jsonObject == null ? new JSONObject() : jsonObject;
}
@VisibleForTesting(otherwise = 2)
public static final synchronized JSONObject parseAppGateKeepersFromJSON$facebook_core_release(String applicationId, JSONObject jSONObject) {
JSONObject jSONObject2;
JSONArray optJSONArray;
synchronized (FetchedAppGateKeepersManager.class) {
try {
Intrinsics.checkNotNullParameter(applicationId, "applicationId");
jSONObject2 = fetchedAppGateKeepers.get(applicationId);
if (jSONObject2 == null) {
jSONObject2 = new JSONObject();
}
int i = 0;
JSONObject jSONObject3 = null;
if (jSONObject != null && (optJSONArray = jSONObject.optJSONArray("data")) != null) {
jSONObject3 = optJSONArray.optJSONObject(0);
}
if (jSONObject3 == null) {
jSONObject3 = new JSONObject();
}
JSONArray optJSONArray2 = jSONObject3.optJSONArray(APPLICATION_GATEKEEPER_FIELD);
if (optJSONArray2 == null) {
optJSONArray2 = new JSONArray();
}
int length = optJSONArray2.length();
if (length > 0) {
while (true) {
int i2 = i + 1;
try {
JSONObject jSONObject4 = optJSONArray2.getJSONObject(i);
jSONObject2.put(jSONObject4.getString("key"), jSONObject4.getBoolean("value"));
} catch (JSONException e) {
Utility.logd(Utility.LOG_TAG, e);
}
if (i2 >= length) {
break;
}
i = i2;
}
}
fetchedAppGateKeepers.put(applicationId, jSONObject2);
} catch (Throwable th) {
throw th;
}
}
return jSONObject2;
}
private final boolean isTimestampValid(Long l) {
return l != null && System.currentTimeMillis() - l.longValue() < APPLICATION_GATEKEEPER_CACHE_TIMEOUT;
}
}

View File

@@ -0,0 +1,309 @@
package com.facebook.internal;
import android.net.Uri;
import java.util.EnumSet;
import java.util.List;
import java.util.Map;
import kotlin.collections.CollectionsKt___CollectionsKt;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.StringsKt__StringsKt;
import org.json.JSONArray;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public final class FetchedAppSettings {
public static final Companion Companion = new Companion(null);
private final JSONArray MACARuleMatchingSetting;
private final boolean automaticLoggingEnabled;
private final JSONArray blocklistEvents;
private final boolean codelessEventsEnabled;
private final Map<String, Map<String, DialogFeatureConfig>> dialogConfigurations;
private final FacebookRequestErrorClassification errorClassification;
private final JSONArray eventBindings;
private final boolean iAPAutomaticLoggingEnabled;
private final Map<String, Boolean> migratedAutoLogValues;
private final boolean monitorViaDialogEnabled;
private final String nuxContent;
private final boolean nuxEnabled;
private final JSONArray protectedModeStandardParamsSetting;
private final String rawAamRules;
private final JSONArray redactedEvents;
private final String restrictiveDataSetting;
private final String sdkUpdateMessage;
private final JSONArray sensitiveParams;
private final int sessionTimeoutInSeconds;
private final String smartLoginBookmarkIconURL;
private final String smartLoginMenuIconURL;
private final EnumSet<SmartLoginOption> smartLoginOptions;
private final String suggestedEventsSetting;
private final boolean supportsImplicitLogging;
private final boolean trackUninstallEnabled;
public static final DialogFeatureConfig getDialogFeatureConfig(String str, String str2, String str3) {
return Companion.getDialogFeatureConfig(str, str2, str3);
}
public final boolean getAutomaticLoggingEnabled() {
return this.automaticLoggingEnabled;
}
public final JSONArray getBlocklistEvents() {
return this.blocklistEvents;
}
public final boolean getCodelessEventsEnabled() {
return this.codelessEventsEnabled;
}
public final Map<String, Map<String, DialogFeatureConfig>> getDialogConfigurations() {
return this.dialogConfigurations;
}
public final FacebookRequestErrorClassification getErrorClassification() {
return this.errorClassification;
}
public final JSONArray getEventBindings() {
return this.eventBindings;
}
public final boolean getIAPAutomaticLoggingEnabled() {
return this.iAPAutomaticLoggingEnabled;
}
public final JSONArray getMACARuleMatchingSetting() {
return this.MACARuleMatchingSetting;
}
public final Map<String, Boolean> getMigratedAutoLogValues() {
return this.migratedAutoLogValues;
}
public final boolean getMonitorViaDialogEnabled() {
return this.monitorViaDialogEnabled;
}
public final String getNuxContent() {
return this.nuxContent;
}
public final boolean getNuxEnabled() {
return this.nuxEnabled;
}
public final JSONArray getProtectedModeStandardParamsSetting() {
return this.protectedModeStandardParamsSetting;
}
public final String getRawAamRules() {
return this.rawAamRules;
}
public final JSONArray getRedactedEvents() {
return this.redactedEvents;
}
public final String getRestrictiveDataSetting() {
return this.restrictiveDataSetting;
}
public final String getSdkUpdateMessage() {
return this.sdkUpdateMessage;
}
public final JSONArray getSensitiveParams() {
return this.sensitiveParams;
}
public final int getSessionTimeoutInSeconds() {
return this.sessionTimeoutInSeconds;
}
public final String getSmartLoginBookmarkIconURL() {
return this.smartLoginBookmarkIconURL;
}
public final String getSmartLoginMenuIconURL() {
return this.smartLoginMenuIconURL;
}
public final EnumSet<SmartLoginOption> getSmartLoginOptions() {
return this.smartLoginOptions;
}
public final String getSuggestedEventsSetting() {
return this.suggestedEventsSetting;
}
public final boolean getTrackUninstallEnabled() {
return this.trackUninstallEnabled;
}
public final boolean supportsImplicitLogging() {
return this.supportsImplicitLogging;
}
/* JADX WARN: Multi-variable type inference failed */
public FetchedAppSettings(boolean z, String nuxContent, boolean z2, int i, EnumSet<SmartLoginOption> smartLoginOptions, Map<String, ? extends Map<String, DialogFeatureConfig>> dialogConfigurations, boolean z3, FacebookRequestErrorClassification errorClassification, String smartLoginBookmarkIconURL, String smartLoginMenuIconURL, boolean z4, boolean z5, JSONArray jSONArray, String sdkUpdateMessage, boolean z6, boolean z7, String str, String str2, String str3, JSONArray jSONArray2, JSONArray jSONArray3, Map<String, Boolean> map, JSONArray jSONArray4, JSONArray jSONArray5, JSONArray jSONArray6) {
Intrinsics.checkNotNullParameter(nuxContent, "nuxContent");
Intrinsics.checkNotNullParameter(smartLoginOptions, "smartLoginOptions");
Intrinsics.checkNotNullParameter(dialogConfigurations, "dialogConfigurations");
Intrinsics.checkNotNullParameter(errorClassification, "errorClassification");
Intrinsics.checkNotNullParameter(smartLoginBookmarkIconURL, "smartLoginBookmarkIconURL");
Intrinsics.checkNotNullParameter(smartLoginMenuIconURL, "smartLoginMenuIconURL");
Intrinsics.checkNotNullParameter(sdkUpdateMessage, "sdkUpdateMessage");
this.supportsImplicitLogging = z;
this.nuxContent = nuxContent;
this.nuxEnabled = z2;
this.sessionTimeoutInSeconds = i;
this.smartLoginOptions = smartLoginOptions;
this.dialogConfigurations = dialogConfigurations;
this.automaticLoggingEnabled = z3;
this.errorClassification = errorClassification;
this.smartLoginBookmarkIconURL = smartLoginBookmarkIconURL;
this.smartLoginMenuIconURL = smartLoginMenuIconURL;
this.iAPAutomaticLoggingEnabled = z4;
this.codelessEventsEnabled = z5;
this.eventBindings = jSONArray;
this.sdkUpdateMessage = sdkUpdateMessage;
this.trackUninstallEnabled = z6;
this.monitorViaDialogEnabled = z7;
this.rawAamRules = str;
this.suggestedEventsSetting = str2;
this.restrictiveDataSetting = str3;
this.protectedModeStandardParamsSetting = jSONArray2;
this.MACARuleMatchingSetting = jSONArray3;
this.migratedAutoLogValues = map;
this.blocklistEvents = jSONArray4;
this.redactedEvents = jSONArray5;
this.sensitiveParams = jSONArray6;
}
public static final class DialogFeatureConfig {
public static final Companion Companion = new Companion(null);
private static final String DIALOG_CONFIG_DIALOG_NAME_FEATURE_NAME_SEPARATOR = "|";
private static final String DIALOG_CONFIG_NAME_KEY = "name";
private static final String DIALOG_CONFIG_URL_KEY = "url";
private static final String DIALOG_CONFIG_VERSIONS_KEY = "versions";
private final String dialogName;
private final Uri fallbackUrl;
private final String featureName;
private final int[] versionSpec;
public /* synthetic */ DialogFeatureConfig(String str, String str2, Uri uri, int[] iArr, DefaultConstructorMarker defaultConstructorMarker) {
this(str, str2, uri, iArr);
}
public final String getDialogName() {
return this.dialogName;
}
public final Uri getFallbackUrl() {
return this.fallbackUrl;
}
public final String getFeatureName() {
return this.featureName;
}
public final int[] getVersionSpec() {
return this.versionSpec;
}
private DialogFeatureConfig(String str, String str2, Uri uri, int[] iArr) {
this.dialogName = str;
this.featureName = str2;
this.fallbackUrl = uri;
this.versionSpec = iArr;
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
public final DialogFeatureConfig parseDialogConfig(JSONObject dialogConfigJSON) {
List split$default;
Intrinsics.checkNotNullParameter(dialogConfigJSON, "dialogConfigJSON");
String dialogNameWithFeature = dialogConfigJSON.optString("name");
if (Utility.isNullOrEmpty(dialogNameWithFeature)) {
return null;
}
Intrinsics.checkNotNullExpressionValue(dialogNameWithFeature, "dialogNameWithFeature");
split$default = StringsKt__StringsKt.split$default((CharSequence) dialogNameWithFeature, new String[]{DialogFeatureConfig.DIALOG_CONFIG_DIALOG_NAME_FEATURE_NAME_SEPARATOR}, false, 0, 6, (Object) null);
if (split$default.size() != 2) {
return null;
}
String str = (String) CollectionsKt___CollectionsKt.first(split$default);
String str2 = (String) CollectionsKt___CollectionsKt.last(split$default);
if (Utility.isNullOrEmpty(str) || Utility.isNullOrEmpty(str2)) {
return null;
}
String optString = dialogConfigJSON.optString("url");
return new DialogFeatureConfig(str, str2, Utility.isNullOrEmpty(optString) ? null : Uri.parse(optString), parseVersionSpec(dialogConfigJSON.optJSONArray(DialogFeatureConfig.DIALOG_CONFIG_VERSIONS_KEY)), null);
}
private final int[] parseVersionSpec(JSONArray jSONArray) {
if (jSONArray == null) {
return null;
}
int length = jSONArray.length();
int[] iArr = new int[length];
if (length <= 0) {
return iArr;
}
int i = 0;
while (true) {
int i2 = i + 1;
int i3 = -1;
int optInt = jSONArray.optInt(i, -1);
if (optInt == -1) {
String versionString = jSONArray.optString(i);
if (!Utility.isNullOrEmpty(versionString)) {
try {
Intrinsics.checkNotNullExpressionValue(versionString, "versionString");
i3 = Integer.parseInt(versionString);
} catch (NumberFormatException e) {
Utility.logd(Utility.LOG_TAG, e);
}
optInt = i3;
}
}
iArr[i] = optInt;
if (i2 >= length) {
return iArr;
}
i = i2;
}
}
}
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
public final DialogFeatureConfig getDialogFeatureConfig(String applicationId, String actionName, String featureName) {
Intrinsics.checkNotNullParameter(applicationId, "applicationId");
Intrinsics.checkNotNullParameter(actionName, "actionName");
Intrinsics.checkNotNullParameter(featureName, "featureName");
if (actionName.length() == 0 || featureName.length() == 0) {
return null;
}
FetchedAppSettings appSettingsWithoutQuery = FetchedAppSettingsManager.getAppSettingsWithoutQuery(applicationId);
Map<String, DialogFeatureConfig> map = appSettingsWithoutQuery == null ? null : appSettingsWithoutQuery.getDialogConfigurations().get(actionName);
if (map != null) {
return map.get(featureName);
}
return null;
}
}
}

View File

@@ -0,0 +1,402 @@
package com.facebook.internal;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.text.TextUtils;
import android.util.Log;
import androidx.lifecycle.LifecycleKt$$ExternalSyntheticBackportWithForwarding0;
import com.facebook.FacebookSdk;
import com.facebook.GraphRequest;
import com.facebook.appevents.codeless.internal.UnityReflection;
import com.facebook.appevents.internal.AutomaticAnalyticsLogger;
import com.facebook.appevents.internal.Constants;
import com.facebook.internal.FacebookRequestErrorClassification;
import com.facebook.internal.FetchedAppSettings;
import com.facebook.internal.FetchedAppSettingsManager;
import com.mbridge.msdk.MBridgeConstans;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.atomic.AtomicReference;
import kotlin.collections.CollectionsKt__CollectionsKt;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.StringCompanionObject;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public final class FetchedAppSettingsManager {
private static final String APPLICATION_FIELDS = "fields";
private static final String APP_SETTINGS_PREFS_KEY_FORMAT = "com.facebook.internal.APP_SETTINGS.%s";
private static final String APP_SETTINGS_PREFS_STORE = "com.facebook.internal.preferences.APP_SETTINGS";
private static final String APP_SETTING_ANDROID_SDK_ERROR_CATEGORIES = "android_sdk_error_categories";
private static final String APP_SETTING_APP_EVENTS_AAM_RULE = "aam_rules";
private static final String APP_SETTING_APP_EVENTS_EVENT_BINDINGS = "auto_event_mapping_android";
private static final String APP_SETTING_APP_EVENTS_FEATURE_BITMASK = "app_events_feature_bitmask";
private static final String APP_SETTING_APP_EVENTS_SESSION_TIMEOUT = "app_events_session_timeout";
private static final String APP_SETTING_DIALOG_CONFIGS = "android_dialog_configs";
private static final List<String> APP_SETTING_FIELDS;
private static final String APP_SETTING_NUX_CONTENT = "gdpv4_nux_content";
private static final String APP_SETTING_NUX_ENABLED = "gdpv4_nux_enabled";
private static final String APP_SETTING_RESTRICTIVE_EVENT_FILTER_FIELD = "restrictive_data_filter_params";
private static final String APP_SETTING_SMART_LOGIN_OPTIONS = "seamless_login";
private static final String APP_SETTING_SUPPORTS_IMPLICIT_SDK_LOGGING = "supports_implicit_sdk_logging";
private static final int AUTOMATIC_LOGGING_ENABLED_BITMASK_FIELD = 8;
public static final String AUTO_LOG_APP_EVENTS_DEFAULT_FIELD = "auto_log_app_events_default";
public static final String AUTO_LOG_APP_EVENT_ENABLED_FIELD = "auto_log_app_events_enabled";
private static final String BLOCKLIST_EVENTS_KEY = "blocklist_events";
private static final int CODELESS_EVENTS_ENABLED_BITMASK_FIELD = 32;
private static final int IAP_AUTOMATIC_LOGGING_ENABLED_BITMASK_FIELD = 16;
private static final String MACA_RULES_KEY = "maca_rules";
private static final int MONITOR_ENABLED_BITMASK_FIELD = 16384;
private static final String PROTECTED_MODE_RULES = "protected_mode_rules";
private static final String REDACTED_EVENTS_KEY = "redacted_events";
private static final String SDK_UPDATE_MESSAGE = "sdk_update_message";
private static final String SENSITIVE_PARAMS_KEY = "sensitive_params";
private static final String SMART_LOGIN_BOOKMARK_ICON_URL = "smart_login_bookmark_icon_url";
private static final String SMART_LOGIN_MENU_ICON_URL = "smart_login_menu_icon_url";
private static final String STANDARD_PARAMS_KEY = "standard_params";
private static final String SUGGESTED_EVENTS_SETTING = "suggested_events_setting";
private static final int TRACK_UNINSTALL_ENABLED_BITMASK_FIELD = 256;
private static final Map<String, FetchedAppSettings> fetchedAppSettings;
private static final ConcurrentLinkedQueue<FetchedAppSettingsCallback> fetchedAppSettingsCallbacks;
private static boolean isUnityInit;
private static final AtomicReference<FetchAppSettingState> loadingState;
private static boolean printedSDKUpdatedMessage;
private static JSONArray unityEventBindings;
public static final FetchedAppSettingsManager INSTANCE = new FetchedAppSettingsManager();
private static final String TAG = FetchedAppSettingsManager.class.getSimpleName();
public interface FetchedAppSettingsCallback {
void onError();
void onSuccess(FetchedAppSettings fetchedAppSettings);
}
private FetchedAppSettingsManager() {
}
static {
List<String> listOf;
listOf = CollectionsKt__CollectionsKt.listOf((Object[]) new String[]{APP_SETTING_SUPPORTS_IMPLICIT_SDK_LOGGING, APP_SETTING_NUX_CONTENT, APP_SETTING_NUX_ENABLED, APP_SETTING_DIALOG_CONFIGS, APP_SETTING_ANDROID_SDK_ERROR_CATEGORIES, APP_SETTING_APP_EVENTS_SESSION_TIMEOUT, APP_SETTING_APP_EVENTS_FEATURE_BITMASK, APP_SETTING_APP_EVENTS_EVENT_BINDINGS, APP_SETTING_SMART_LOGIN_OPTIONS, SMART_LOGIN_BOOKMARK_ICON_URL, SMART_LOGIN_MENU_ICON_URL, APP_SETTING_RESTRICTIVE_EVENT_FILTER_FIELD, APP_SETTING_APP_EVENTS_AAM_RULE, SUGGESTED_EVENTS_SETTING, PROTECTED_MODE_RULES, AUTO_LOG_APP_EVENTS_DEFAULT_FIELD, AUTO_LOG_APP_EVENT_ENABLED_FIELD});
APP_SETTING_FIELDS = listOf;
fetchedAppSettings = new ConcurrentHashMap();
loadingState = new AtomicReference<>(FetchAppSettingState.NOT_LOADED);
fetchedAppSettingsCallbacks = new ConcurrentLinkedQueue<>();
}
public static final void loadAppSettingsAsync() {
final Context applicationContext = FacebookSdk.getApplicationContext();
final String applicationId = FacebookSdk.getApplicationId();
if (Utility.isNullOrEmpty(applicationId)) {
loadingState.set(FetchAppSettingState.ERROR);
INSTANCE.pollCallbacks();
return;
}
if (fetchedAppSettings.containsKey(applicationId)) {
loadingState.set(FetchAppSettingState.SUCCESS);
INSTANCE.pollCallbacks();
return;
}
AtomicReference<FetchAppSettingState> atomicReference = loadingState;
FetchAppSettingState fetchAppSettingState = FetchAppSettingState.NOT_LOADED;
FetchAppSettingState fetchAppSettingState2 = FetchAppSettingState.LOADING;
if (!LifecycleKt$$ExternalSyntheticBackportWithForwarding0.m(atomicReference, fetchAppSettingState, fetchAppSettingState2) && !LifecycleKt$$ExternalSyntheticBackportWithForwarding0.m(atomicReference, FetchAppSettingState.ERROR, fetchAppSettingState2)) {
INSTANCE.pollCallbacks();
return;
}
StringCompanionObject stringCompanionObject = StringCompanionObject.INSTANCE;
final String format = String.format(APP_SETTINGS_PREFS_KEY_FORMAT, Arrays.copyOf(new Object[]{applicationId}, 1));
Intrinsics.checkNotNullExpressionValue(format, "java.lang.String.format(format, *args)");
FacebookSdk.getExecutor().execute(new Runnable() { // from class: com.facebook.internal.FetchedAppSettingsManager$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
FetchedAppSettingsManager.m565loadAppSettingsAsync$lambda0(applicationContext, format, applicationId);
}
});
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: loadAppSettingsAsync$lambda-0, reason: not valid java name */
public static final void m565loadAppSettingsAsync$lambda0(Context context, String settingsKey, String applicationId) {
JSONObject jSONObject;
Intrinsics.checkNotNullParameter(context, "$context");
Intrinsics.checkNotNullParameter(settingsKey, "$settingsKey");
Intrinsics.checkNotNullParameter(applicationId, "$applicationId");
SharedPreferences sharedPreferences = context.getSharedPreferences(APP_SETTINGS_PREFS_STORE, 0);
FetchedAppSettings fetchedAppSettings2 = null;
String string = sharedPreferences.getString(settingsKey, null);
if (!Utility.isNullOrEmpty(string)) {
if (string == null) {
throw new IllegalStateException("Required value was null.".toString());
}
try {
jSONObject = new JSONObject(string);
} catch (JSONException e) {
Utility.logd(Utility.LOG_TAG, e);
jSONObject = null;
}
if (jSONObject != null) {
fetchedAppSettings2 = INSTANCE.parseAppSettingsFromJSON$facebook_core_release(applicationId, jSONObject);
}
}
FetchedAppSettingsManager fetchedAppSettingsManager = INSTANCE;
JSONObject appSettingsQueryResponse = fetchedAppSettingsManager.getAppSettingsQueryResponse(applicationId);
if (appSettingsQueryResponse != null) {
fetchedAppSettingsManager.parseAppSettingsFromJSON$facebook_core_release(applicationId, appSettingsQueryResponse);
sharedPreferences.edit().putString(settingsKey, appSettingsQueryResponse.toString()).apply();
}
if (fetchedAppSettings2 != null) {
String sdkUpdateMessage = fetchedAppSettings2.getSdkUpdateMessage();
if (!printedSDKUpdatedMessage && sdkUpdateMessage != null && sdkUpdateMessage.length() > 0) {
printedSDKUpdatedMessage = true;
Log.w(TAG, sdkUpdateMessage);
}
}
FetchedAppGateKeepersManager.queryAppGateKeepers(applicationId, true);
AutomaticAnalyticsLogger.logActivateAppEvent();
loadingState.set(fetchedAppSettings.containsKey(applicationId) ? FetchAppSettingState.SUCCESS : FetchAppSettingState.ERROR);
fetchedAppSettingsManager.pollCallbacks();
}
public static final FetchedAppSettings getAppSettingsWithoutQuery(String str) {
if (str != null) {
return fetchedAppSettings.get(str);
}
return null;
}
public static final void getAppSettingsAsync(FetchedAppSettingsCallback callback) {
Intrinsics.checkNotNullParameter(callback, "callback");
fetchedAppSettingsCallbacks.add(callback);
loadAppSettingsAsync();
}
private final synchronized void pollCallbacks() {
FetchAppSettingState fetchAppSettingState = loadingState.get();
if (FetchAppSettingState.NOT_LOADED != fetchAppSettingState && FetchAppSettingState.LOADING != fetchAppSettingState) {
final FetchedAppSettings fetchedAppSettings2 = fetchedAppSettings.get(FacebookSdk.getApplicationId());
Handler handler = new Handler(Looper.getMainLooper());
if (FetchAppSettingState.ERROR == fetchAppSettingState) {
while (true) {
ConcurrentLinkedQueue<FetchedAppSettingsCallback> concurrentLinkedQueue = fetchedAppSettingsCallbacks;
if (concurrentLinkedQueue.isEmpty()) {
return;
}
final FetchedAppSettingsCallback poll = concurrentLinkedQueue.poll();
handler.post(new Runnable() { // from class: com.facebook.internal.FetchedAppSettingsManager$$ExternalSyntheticLambda1
@Override // java.lang.Runnable
public final void run() {
FetchedAppSettingsManager.FetchedAppSettingsCallback.this.onError();
}
});
}
} else {
while (true) {
ConcurrentLinkedQueue<FetchedAppSettingsCallback> concurrentLinkedQueue2 = fetchedAppSettingsCallbacks;
if (concurrentLinkedQueue2.isEmpty()) {
return;
}
final FetchedAppSettingsCallback poll2 = concurrentLinkedQueue2.poll();
handler.post(new Runnable() { // from class: com.facebook.internal.FetchedAppSettingsManager$$ExternalSyntheticLambda2
@Override // java.lang.Runnable
public final void run() {
FetchedAppSettingsManager.FetchedAppSettingsCallback.this.onSuccess(fetchedAppSettings2);
}
});
}
}
}
}
public static final Map<String, Boolean> getCachedMigratedAutoLogValuesInAppSettings() {
JSONObject jSONObject;
Context applicationContext = FacebookSdk.getApplicationContext();
String applicationId = FacebookSdk.getApplicationId();
StringCompanionObject stringCompanionObject = StringCompanionObject.INSTANCE;
String format = String.format(APP_SETTINGS_PREFS_KEY_FORMAT, Arrays.copyOf(new Object[]{applicationId}, 1));
Intrinsics.checkNotNullExpressionValue(format, "java.lang.String.format(format, *args)");
String string = applicationContext.getSharedPreferences(APP_SETTINGS_PREFS_STORE, 0).getString(format, null);
if (!Utility.isNullOrEmpty(string)) {
if (string == null) {
throw new IllegalStateException("Required value was null.".toString());
}
try {
jSONObject = new JSONObject(string);
} catch (JSONException e) {
Utility.logd(Utility.LOG_TAG, e);
jSONObject = null;
}
if (jSONObject != null) {
return INSTANCE.parseMigratedAutoLogValues(jSONObject);
}
}
return null;
}
public static final FetchedAppSettings queryAppSettings(String applicationId, boolean z) {
Intrinsics.checkNotNullParameter(applicationId, "applicationId");
if (!z) {
Map<String, FetchedAppSettings> map = fetchedAppSettings;
if (map.containsKey(applicationId)) {
return map.get(applicationId);
}
}
FetchedAppSettingsManager fetchedAppSettingsManager = INSTANCE;
JSONObject appSettingsQueryResponse = fetchedAppSettingsManager.getAppSettingsQueryResponse(applicationId);
if (appSettingsQueryResponse == null) {
return null;
}
FetchedAppSettings parseAppSettingsFromJSON$facebook_core_release = fetchedAppSettingsManager.parseAppSettingsFromJSON$facebook_core_release(applicationId, appSettingsQueryResponse);
if (Intrinsics.areEqual(applicationId, FacebookSdk.getApplicationId())) {
loadingState.set(FetchAppSettingState.SUCCESS);
fetchedAppSettingsManager.pollCallbacks();
}
return parseAppSettingsFromJSON$facebook_core_release;
}
public final FetchedAppSettings parseAppSettingsFromJSON$facebook_core_release(String applicationId, JSONObject settingsJSON) {
Intrinsics.checkNotNullParameter(applicationId, "applicationId");
Intrinsics.checkNotNullParameter(settingsJSON, "settingsJSON");
JSONArray optJSONArray = settingsJSON.optJSONArray(APP_SETTING_ANDROID_SDK_ERROR_CATEGORIES);
FacebookRequestErrorClassification.Companion companion = FacebookRequestErrorClassification.Companion;
FacebookRequestErrorClassification createFromJSON = companion.createFromJSON(optJSONArray);
if (createFromJSON == null) {
createFromJSON = companion.getDefaultErrorClassification();
}
FacebookRequestErrorClassification facebookRequestErrorClassification = createFromJSON;
int optInt = settingsJSON.optInt(APP_SETTING_APP_EVENTS_FEATURE_BITMASK, 0);
boolean z = (optInt & 8) != 0;
boolean z2 = (optInt & 16) != 0;
boolean z3 = (optInt & 32) != 0;
boolean z4 = (optInt & 256) != 0;
boolean z5 = (optInt & 16384) != 0;
JSONArray optJSONArray2 = settingsJSON.optJSONArray(APP_SETTING_APP_EVENTS_EVENT_BINDINGS);
unityEventBindings = optJSONArray2;
if (optJSONArray2 != null && InternalSettings.isUnityApp()) {
UnityReflection unityReflection = UnityReflection.INSTANCE;
UnityReflection.sendEventMapping(optJSONArray2 == null ? null : optJSONArray2.toString());
}
boolean optBoolean = settingsJSON.optBoolean(APP_SETTING_SUPPORTS_IMPLICIT_SDK_LOGGING, false);
String optString = settingsJSON.optString(APP_SETTING_NUX_CONTENT, "");
Intrinsics.checkNotNullExpressionValue(optString, "settingsJSON.optString(APP_SETTING_NUX_CONTENT, \"\")");
boolean optBoolean2 = settingsJSON.optBoolean(APP_SETTING_NUX_ENABLED, false);
int optInt2 = settingsJSON.optInt(APP_SETTING_APP_EVENTS_SESSION_TIMEOUT, Constants.getDefaultAppEventsSessionTimeoutInSeconds());
EnumSet<SmartLoginOption> parseOptions = SmartLoginOption.Companion.parseOptions(settingsJSON.optLong(APP_SETTING_SMART_LOGIN_OPTIONS));
Map<String, Map<String, FetchedAppSettings.DialogFeatureConfig>> parseDialogConfigurations = parseDialogConfigurations(settingsJSON.optJSONObject(APP_SETTING_DIALOG_CONFIGS));
String optString2 = settingsJSON.optString(SMART_LOGIN_BOOKMARK_ICON_URL);
Intrinsics.checkNotNullExpressionValue(optString2, "settingsJSON.optString(SMART_LOGIN_BOOKMARK_ICON_URL)");
String optString3 = settingsJSON.optString(SMART_LOGIN_MENU_ICON_URL);
Intrinsics.checkNotNullExpressionValue(optString3, "settingsJSON.optString(SMART_LOGIN_MENU_ICON_URL)");
String optString4 = settingsJSON.optString(SDK_UPDATE_MESSAGE);
Intrinsics.checkNotNullExpressionValue(optString4, "settingsJSON.optString(SDK_UPDATE_MESSAGE)");
FetchedAppSettings fetchedAppSettings2 = new FetchedAppSettings(optBoolean, optString, optBoolean2, optInt2, parseOptions, parseDialogConfigurations, z, facebookRequestErrorClassification, optString2, optString3, z2, z3, optJSONArray2, optString4, z4, z5, settingsJSON.optString(APP_SETTING_APP_EVENTS_AAM_RULE), settingsJSON.optString(SUGGESTED_EVENTS_SETTING), settingsJSON.optString(APP_SETTING_RESTRICTIVE_EVENT_FILTER_FIELD), parseProtectedModeRules(settingsJSON.optJSONObject(PROTECTED_MODE_RULES), STANDARD_PARAMS_KEY), parseProtectedModeRules(settingsJSON.optJSONObject(PROTECTED_MODE_RULES), MACA_RULES_KEY), parseMigratedAutoLogValues(settingsJSON), parseProtectedModeRules(settingsJSON.optJSONObject(PROTECTED_MODE_RULES), BLOCKLIST_EVENTS_KEY), parseProtectedModeRules(settingsJSON.optJSONObject(PROTECTED_MODE_RULES), REDACTED_EVENTS_KEY), parseProtectedModeRules(settingsJSON.optJSONObject(PROTECTED_MODE_RULES), SENSITIVE_PARAMS_KEY));
fetchedAppSettings.put(applicationId, fetchedAppSettings2);
return fetchedAppSettings2;
}
public static final void setIsUnityInit(boolean z) {
isUnityInit = z;
if (unityEventBindings == null || !z) {
return;
}
UnityReflection unityReflection = UnityReflection.INSTANCE;
UnityReflection.sendEventMapping(String.valueOf(unityEventBindings));
}
private final JSONObject getAppSettingsQueryResponse(String str) {
Bundle bundle = new Bundle();
ArrayList arrayList = new ArrayList();
arrayList.addAll(APP_SETTING_FIELDS);
bundle.putString("fields", TextUtils.join(",", arrayList));
GraphRequest newGraphPathRequest = GraphRequest.Companion.newGraphPathRequest(null, MBridgeConstans.DYNAMIC_VIEW_WX_APP, null);
newGraphPathRequest.setForceApplicationRequest(true);
newGraphPathRequest.setParameters(bundle);
JSONObject jsonObject = newGraphPathRequest.executeAndWait().getJsonObject();
return jsonObject == null ? new JSONObject() : jsonObject;
}
private final Map<String, Map<String, FetchedAppSettings.DialogFeatureConfig>> parseDialogConfigurations(JSONObject jSONObject) {
JSONArray optJSONArray;
int length;
HashMap hashMap = new HashMap();
if (jSONObject != null && (optJSONArray = jSONObject.optJSONArray("data")) != null && (length = optJSONArray.length()) > 0) {
int i = 0;
while (true) {
int i2 = i + 1;
FetchedAppSettings.DialogFeatureConfig.Companion companion = FetchedAppSettings.DialogFeatureConfig.Companion;
JSONObject optJSONObject = optJSONArray.optJSONObject(i);
Intrinsics.checkNotNullExpressionValue(optJSONObject, "dialogConfigData.optJSONObject(i)");
FetchedAppSettings.DialogFeatureConfig parseDialogConfig = companion.parseDialogConfig(optJSONObject);
if (parseDialogConfig != null) {
String dialogName = parseDialogConfig.getDialogName();
Map map = (Map) hashMap.get(dialogName);
if (map == null) {
map = new HashMap();
hashMap.put(dialogName, map);
}
map.put(parseDialogConfig.getFeatureName(), parseDialogConfig);
}
if (i2 >= length) {
break;
}
i = i2;
}
}
return hashMap;
}
private final JSONArray parseProtectedModeRules(JSONObject jSONObject, String str) {
if (jSONObject != null) {
return jSONObject.optJSONArray(str);
}
return null;
}
private final Map<String, Boolean> parseMigratedAutoLogValues(JSONObject jSONObject) {
if (jSONObject == null) {
return null;
}
HashMap hashMap = new HashMap();
if (!jSONObject.isNull(AUTO_LOG_APP_EVENTS_DEFAULT_FIELD)) {
try {
hashMap.put(AUTO_LOG_APP_EVENTS_DEFAULT_FIELD, Boolean.valueOf(jSONObject.getBoolean(AUTO_LOG_APP_EVENTS_DEFAULT_FIELD)));
} catch (JSONException e) {
Utility.logd(Utility.LOG_TAG, e);
}
}
if (!jSONObject.isNull(AUTO_LOG_APP_EVENT_ENABLED_FIELD)) {
try {
hashMap.put(AUTO_LOG_APP_EVENT_ENABLED_FIELD, Boolean.valueOf(jSONObject.getBoolean(AUTO_LOG_APP_EVENT_ENABLED_FIELD)));
} catch (JSONException e2) {
Utility.logd(Utility.LOG_TAG, e2);
}
}
if (hashMap.isEmpty()) {
return null;
}
return hashMap;
}
public enum FetchAppSettingState {
NOT_LOADED,
LOADING,
SUCCESS,
ERROR;
/* renamed from: values, reason: to resolve conflict with enum method */
public static FetchAppSettingState[] valuesCustom() {
FetchAppSettingState[] valuesCustom = values();
return (FetchAppSettingState[]) Arrays.copyOf(valuesCustom, valuesCustom.length);
}
}
}

View File

@@ -0,0 +1,731 @@
package com.facebook.internal;
import com.facebook.FacebookSdk;
import com.facebook.LoggingBehavior;
import com.facebook.internal.FileLruCache;
import com.facebook.internal.Logger;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FilenameFilter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.security.InvalidParameterException;
import java.util.Date;
import java.util.PriorityQueue;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.ReentrantLock;
import kotlin.Unit;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.Charsets;
import kotlin.text.StringsKt__StringsJVMKt;
import org.json.JSONException;
import org.json.JSONObject;
import org.json.JSONTokener;
/* loaded from: classes2.dex */
public final class FileLruCache {
private static final String HEADER_CACHEKEY_KEY = "key";
private static final String HEADER_CACHE_CONTENT_TAG_KEY = "tag";
private final Condition condition;
private final File directory;
private boolean isTrimInProgress;
private boolean isTrimPending;
private final AtomicLong lastClearCacheTime;
private final Limits limits;
private final ReentrantLock lock;
private final String tag;
public static final Companion Companion = new Companion(null);
private static final String TAG = FileLruCache.class.getSimpleName();
private static final AtomicLong bufferIndex = new AtomicLong();
public interface StreamCloseCallback {
void onClose();
}
public final InputStream get(String key) throws IOException {
Intrinsics.checkNotNullParameter(key, "key");
return get$default(this, key, null, 2, null);
}
public final OutputStream openPutStream(String key) throws IOException {
Intrinsics.checkNotNullParameter(key, "key");
return openPutStream$default(this, key, null, 2, null);
}
public FileLruCache(String tag, Limits limits) {
Intrinsics.checkNotNullParameter(tag, "tag");
Intrinsics.checkNotNullParameter(limits, "limits");
this.tag = tag;
this.limits = limits;
File file = new File(FacebookSdk.getCacheDir(), tag);
this.directory = file;
ReentrantLock reentrantLock = new ReentrantLock();
this.lock = reentrantLock;
this.condition = reentrantLock.newCondition();
this.lastClearCacheTime = new AtomicLong(0L);
if (file.mkdirs() || file.isDirectory()) {
BufferFile.INSTANCE.deleteAll(file);
}
}
public final long sizeInBytesForTest() {
ReentrantLock reentrantLock = this.lock;
reentrantLock.lock();
while (true) {
try {
if (!this.isTrimPending && !this.isTrimInProgress) {
break;
}
try {
this.condition.await();
} catch (InterruptedException unused) {
}
} catch (Throwable th) {
reentrantLock.unlock();
throw th;
}
}
Unit unit = Unit.INSTANCE;
reentrantLock.unlock();
File[] listFiles = this.directory.listFiles();
long j = 0;
if (listFiles != null) {
int length = listFiles.length;
int i = 0;
while (i < length) {
File file = listFiles[i];
i++;
j += file.length();
}
}
return j;
}
public static /* synthetic */ InputStream get$default(FileLruCache fileLruCache, String str, String str2, int i, Object obj) throws IOException {
if ((i & 2) != 0) {
str2 = null;
}
return fileLruCache.get(str, str2);
}
public final InputStream get(String key, String str) throws IOException {
Intrinsics.checkNotNullParameter(key, "key");
File file = new File(this.directory, Utility.md5hash(key));
try {
BufferedInputStream bufferedInputStream = new BufferedInputStream(new FileInputStream(file), 8192);
try {
JSONObject readHeader = StreamHeader.INSTANCE.readHeader(bufferedInputStream);
if (readHeader == null) {
return null;
}
if (!Intrinsics.areEqual(readHeader.optString("key"), key)) {
return null;
}
String optString = readHeader.optString("tag", null);
if (str == null && !Intrinsics.areEqual(str, optString)) {
return null;
}
long time = new Date().getTime();
Logger.Companion companion = Logger.Companion;
LoggingBehavior loggingBehavior = LoggingBehavior.CACHE;
String TAG2 = TAG;
Intrinsics.checkNotNullExpressionValue(TAG2, "TAG");
companion.log(loggingBehavior, TAG2, "Setting lastModified to " + Long.valueOf(time) + " for " + ((Object) file.getName()));
file.setLastModified(time);
return bufferedInputStream;
} finally {
bufferedInputStream.close();
}
} catch (IOException unused) {
return null;
}
}
public static /* synthetic */ OutputStream openPutStream$default(FileLruCache fileLruCache, String str, String str2, int i, Object obj) throws IOException {
if ((i & 2) != 0) {
str2 = null;
}
return fileLruCache.openPutStream(str, str2);
}
public final OutputStream openPutStream(final String key, String str) throws IOException {
Intrinsics.checkNotNullParameter(key, "key");
final File newFile = BufferFile.INSTANCE.newFile(this.directory);
newFile.delete();
if (!newFile.createNewFile()) {
throw new IOException(Intrinsics.stringPlus("Could not create file at ", newFile.getAbsolutePath()));
}
try {
FileOutputStream fileOutputStream = new FileOutputStream(newFile);
final long currentTimeMillis = System.currentTimeMillis();
BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(new CloseCallbackOutputStream(fileOutputStream, new StreamCloseCallback() { // from class: com.facebook.internal.FileLruCache$openPutStream$renameToTargetCallback$1
@Override // com.facebook.internal.FileLruCache.StreamCloseCallback
public void onClose() {
AtomicLong atomicLong;
long j = currentTimeMillis;
atomicLong = this.lastClearCacheTime;
if (j >= atomicLong.get()) {
this.renameToTargetAndTrim(key, newFile);
} else {
newFile.delete();
}
}
}), 8192);
try {
try {
JSONObject jSONObject = new JSONObject();
jSONObject.put("key", key);
if (!Utility.isNullOrEmpty(str)) {
jSONObject.put("tag", str);
}
StreamHeader.INSTANCE.writeHeader(bufferedOutputStream, jSONObject);
return bufferedOutputStream;
} catch (JSONException e) {
Logger.Companion companion = Logger.Companion;
LoggingBehavior loggingBehavior = LoggingBehavior.CACHE;
String TAG2 = TAG;
Intrinsics.checkNotNullExpressionValue(TAG2, "TAG");
companion.log(loggingBehavior, 5, TAG2, Intrinsics.stringPlus("Error creating JSON header for cache file: ", e));
throw new IOException(e.getMessage());
}
} catch (Throwable th) {
bufferedOutputStream.close();
throw th;
}
} catch (FileNotFoundException e2) {
Logger.Companion companion2 = Logger.Companion;
LoggingBehavior loggingBehavior2 = LoggingBehavior.CACHE;
String TAG3 = TAG;
Intrinsics.checkNotNullExpressionValue(TAG3, "TAG");
companion2.log(loggingBehavior2, 5, TAG3, Intrinsics.stringPlus("Error creating buffer output stream: ", e2));
throw new IOException(e2.getMessage());
}
}
public final void clearCache() {
final File[] listFiles = this.directory.listFiles(BufferFile.INSTANCE.excludeBufferFiles());
this.lastClearCacheTime.set(System.currentTimeMillis());
if (listFiles != null) {
FacebookSdk.getExecutor().execute(new Runnable() { // from class: com.facebook.internal.FileLruCache$$ExternalSyntheticLambda1
@Override // java.lang.Runnable
public final void run() {
FileLruCache.m569clearCache$lambda1(listFiles);
}
});
}
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: clearCache$lambda-1, reason: not valid java name */
public static final void m569clearCache$lambda1(File[] filesToDelete) {
Intrinsics.checkNotNullExpressionValue(filesToDelete, "filesToDelete");
int length = filesToDelete.length;
int i = 0;
while (i < length) {
File file = filesToDelete[i];
i++;
file.delete();
}
}
public final String getLocation() {
String path = this.directory.getPath();
Intrinsics.checkNotNullExpressionValue(path, "directory.path");
return path;
}
/* JADX INFO: Access modifiers changed from: private */
public final void renameToTargetAndTrim(String str, File file) {
if (!file.renameTo(new File(this.directory, Utility.md5hash(str)))) {
file.delete();
}
postTrim();
}
public final InputStream interceptAndPut(String key, InputStream input) throws IOException {
Intrinsics.checkNotNullParameter(key, "key");
Intrinsics.checkNotNullParameter(input, "input");
return new CopyingInputStream(input, openPutStream$default(this, key, null, 2, null));
}
public String toString() {
return "{FileLruCache: tag:" + this.tag + " file:" + ((Object) this.directory.getName()) + '}';
}
private final void postTrim() {
ReentrantLock reentrantLock = this.lock;
reentrantLock.lock();
try {
if (!this.isTrimPending) {
this.isTrimPending = true;
FacebookSdk.getExecutor().execute(new Runnable() { // from class: com.facebook.internal.FileLruCache$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
FileLruCache.m570postTrim$lambda3$lambda2(FileLruCache.this);
}
});
}
Unit unit = Unit.INSTANCE;
reentrantLock.unlock();
} catch (Throwable th) {
reentrantLock.unlock();
throw th;
}
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: postTrim$lambda-3$lambda-2, reason: not valid java name */
public static final void m570postTrim$lambda3$lambda2(FileLruCache this$0) {
Intrinsics.checkNotNullParameter(this$0, "this$0");
this$0.trim();
}
private final void trim() {
long j;
ReentrantLock reentrantLock = this.lock;
reentrantLock.lock();
try {
this.isTrimPending = false;
this.isTrimInProgress = true;
Unit unit = Unit.INSTANCE;
reentrantLock.unlock();
try {
Logger.Companion companion = Logger.Companion;
LoggingBehavior loggingBehavior = LoggingBehavior.CACHE;
String TAG2 = TAG;
Intrinsics.checkNotNullExpressionValue(TAG2, "TAG");
companion.log(loggingBehavior, TAG2, "trim started");
PriorityQueue priorityQueue = new PriorityQueue();
File[] listFiles = this.directory.listFiles(BufferFile.INSTANCE.excludeBufferFiles());
long j2 = 0;
if (listFiles != null) {
int length = listFiles.length;
int i = 0;
j = 0;
while (i < length) {
File file = listFiles[i];
i++;
Intrinsics.checkNotNullExpressionValue(file, "file");
ModifiedFile modifiedFile = new ModifiedFile(file);
priorityQueue.add(modifiedFile);
Logger.Companion companion2 = Logger.Companion;
LoggingBehavior loggingBehavior2 = LoggingBehavior.CACHE;
String TAG3 = TAG;
Intrinsics.checkNotNullExpressionValue(TAG3, "TAG");
companion2.log(loggingBehavior2, TAG3, " trim considering time=" + Long.valueOf(modifiedFile.getModified()) + " name=" + ((Object) modifiedFile.getFile().getName()));
j2 += file.length();
j++;
listFiles = listFiles;
}
} else {
j = 0;
}
while (true) {
if (j2 <= this.limits.getByteCount() && j <= this.limits.getFileCount()) {
this.lock.lock();
try {
this.isTrimInProgress = false;
this.condition.signalAll();
Unit unit2 = Unit.INSTANCE;
return;
} finally {
}
}
File file2 = ((ModifiedFile) priorityQueue.remove()).getFile();
Logger.Companion companion3 = Logger.Companion;
LoggingBehavior loggingBehavior3 = LoggingBehavior.CACHE;
String TAG4 = TAG;
Intrinsics.checkNotNullExpressionValue(TAG4, "TAG");
companion3.log(loggingBehavior3, TAG4, Intrinsics.stringPlus(" trim removing ", file2.getName()));
j2 -= file2.length();
j--;
file2.delete();
}
} catch (Throwable th) {
this.lock.lock();
try {
this.isTrimInProgress = false;
this.condition.signalAll();
Unit unit3 = Unit.INSTANCE;
throw th;
} finally {
}
}
} finally {
}
}
public static final class BufferFile {
private static final String FILE_NAME_PREFIX = "buffer";
public static final BufferFile INSTANCE = new BufferFile();
private static final FilenameFilter filterExcludeBufferFiles = new FilenameFilter() { // from class: com.facebook.internal.FileLruCache$BufferFile$$ExternalSyntheticLambda0
@Override // java.io.FilenameFilter
public final boolean accept(File file, String str) {
boolean m571filterExcludeBufferFiles$lambda0;
m571filterExcludeBufferFiles$lambda0 = FileLruCache.BufferFile.m571filterExcludeBufferFiles$lambda0(file, str);
return m571filterExcludeBufferFiles$lambda0;
}
};
private static final FilenameFilter filterExcludeNonBufferFiles = new FilenameFilter() { // from class: com.facebook.internal.FileLruCache$BufferFile$$ExternalSyntheticLambda1
@Override // java.io.FilenameFilter
public final boolean accept(File file, String str) {
boolean m572filterExcludeNonBufferFiles$lambda1;
m572filterExcludeNonBufferFiles$lambda1 = FileLruCache.BufferFile.m572filterExcludeNonBufferFiles$lambda1(file, str);
return m572filterExcludeNonBufferFiles$lambda1;
}
};
public final FilenameFilter excludeBufferFiles() {
return filterExcludeBufferFiles;
}
public final FilenameFilter excludeNonBufferFiles() {
return filterExcludeNonBufferFiles;
}
private BufferFile() {
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: filterExcludeBufferFiles$lambda-0, reason: not valid java name */
public static final boolean m571filterExcludeBufferFiles$lambda0(File file, String filename) {
Intrinsics.checkNotNullExpressionValue(filename, "filename");
return !StringsKt__StringsJVMKt.startsWith$default(filename, FILE_NAME_PREFIX, false, 2, null);
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: filterExcludeNonBufferFiles$lambda-1, reason: not valid java name */
public static final boolean m572filterExcludeNonBufferFiles$lambda1(File file, String filename) {
Intrinsics.checkNotNullExpressionValue(filename, "filename");
return StringsKt__StringsJVMKt.startsWith$default(filename, FILE_NAME_PREFIX, false, 2, null);
}
public final void deleteAll(File root) {
Intrinsics.checkNotNullParameter(root, "root");
File[] listFiles = root.listFiles(excludeNonBufferFiles());
if (listFiles != null) {
int length = listFiles.length;
int i = 0;
while (i < length) {
File file = listFiles[i];
i++;
file.delete();
}
}
}
public final File newFile(File file) {
return new File(file, Intrinsics.stringPlus(FILE_NAME_PREFIX, Long.valueOf(FileLruCache.bufferIndex.incrementAndGet())));
}
}
public static final class StreamHeader {
private static final int HEADER_VERSION = 0;
public static final StreamHeader INSTANCE = new StreamHeader();
private StreamHeader() {
}
public final void writeHeader(OutputStream stream, JSONObject header) throws IOException {
Intrinsics.checkNotNullParameter(stream, "stream");
Intrinsics.checkNotNullParameter(header, "header");
String jSONObject = header.toString();
Intrinsics.checkNotNullExpressionValue(jSONObject, "header.toString()");
byte[] bytes = jSONObject.getBytes(Charsets.UTF_8);
Intrinsics.checkNotNullExpressionValue(bytes, "(this as java.lang.String).getBytes(charset)");
stream.write(0);
stream.write((bytes.length >> 16) & 255);
stream.write((bytes.length >> 8) & 255);
stream.write(bytes.length & 255);
stream.write(bytes);
}
public final JSONObject readHeader(InputStream stream) throws IOException {
Intrinsics.checkNotNullParameter(stream, "stream");
if (stream.read() != 0) {
return null;
}
int i = 0;
int i2 = 0;
for (int i3 = 0; i3 < 3; i3++) {
int read = stream.read();
if (read == -1) {
Logger.Companion companion = Logger.Companion;
LoggingBehavior loggingBehavior = LoggingBehavior.CACHE;
String TAG = FileLruCache.Companion.getTAG();
Intrinsics.checkNotNullExpressionValue(TAG, "TAG");
companion.log(loggingBehavior, TAG, "readHeader: stream.read returned -1 while reading header size");
return null;
}
i2 = (i2 << 8) + (read & 255);
}
byte[] bArr = new byte[i2];
while (i < i2) {
int read2 = stream.read(bArr, i, i2 - i);
if (read2 < 1) {
Logger.Companion companion2 = Logger.Companion;
LoggingBehavior loggingBehavior2 = LoggingBehavior.CACHE;
String TAG2 = FileLruCache.Companion.getTAG();
Intrinsics.checkNotNullExpressionValue(TAG2, "TAG");
companion2.log(loggingBehavior2, TAG2, "readHeader: stream.read stopped at " + Integer.valueOf(i) + " when expected " + i2);
return null;
}
i += read2;
}
try {
Object nextValue = new JSONTokener(new String(bArr, Charsets.UTF_8)).nextValue();
if (!(nextValue instanceof JSONObject)) {
Logger.Companion companion3 = Logger.Companion;
LoggingBehavior loggingBehavior3 = LoggingBehavior.CACHE;
String TAG3 = FileLruCache.Companion.getTAG();
Intrinsics.checkNotNullExpressionValue(TAG3, "TAG");
companion3.log(loggingBehavior3, TAG3, Intrinsics.stringPlus("readHeader: expected JSONObject, got ", nextValue.getClass().getCanonicalName()));
return null;
}
return (JSONObject) nextValue;
} catch (JSONException e) {
throw new IOException(e.getMessage());
}
}
}
public static final class CloseCallbackOutputStream extends OutputStream {
private final StreamCloseCallback callback;
private final OutputStream innerStream;
public final StreamCloseCallback getCallback() {
return this.callback;
}
public final OutputStream getInnerStream() {
return this.innerStream;
}
public CloseCallbackOutputStream(OutputStream innerStream, StreamCloseCallback callback) {
Intrinsics.checkNotNullParameter(innerStream, "innerStream");
Intrinsics.checkNotNullParameter(callback, "callback");
this.innerStream = innerStream;
this.callback = callback;
}
@Override // java.io.OutputStream, java.io.Closeable, java.lang.AutoCloseable
public void close() throws IOException {
try {
this.innerStream.close();
} finally {
this.callback.onClose();
}
}
@Override // java.io.OutputStream, java.io.Flushable
public void flush() throws IOException {
this.innerStream.flush();
}
@Override // java.io.OutputStream
public void write(byte[] buffer, int i, int i2) throws IOException {
Intrinsics.checkNotNullParameter(buffer, "buffer");
this.innerStream.write(buffer, i, i2);
}
@Override // java.io.OutputStream
public void write(byte[] buffer) throws IOException {
Intrinsics.checkNotNullParameter(buffer, "buffer");
this.innerStream.write(buffer);
}
@Override // java.io.OutputStream
public void write(int i) throws IOException {
this.innerStream.write(i);
}
}
public static final class CopyingInputStream extends InputStream {
private final InputStream input;
private final OutputStream output;
public final InputStream getInput() {
return this.input;
}
public final OutputStream getOutput() {
return this.output;
}
@Override // java.io.InputStream
public boolean markSupported() {
return false;
}
public CopyingInputStream(InputStream input, OutputStream output) {
Intrinsics.checkNotNullParameter(input, "input");
Intrinsics.checkNotNullParameter(output, "output");
this.input = input;
this.output = output;
}
@Override // java.io.InputStream
public int available() throws IOException {
return this.input.available();
}
@Override // java.io.InputStream, java.io.Closeable, java.lang.AutoCloseable
public void close() throws IOException {
try {
this.input.close();
} finally {
this.output.close();
}
}
@Override // java.io.InputStream
public void mark(int i) {
throw new UnsupportedOperationException();
}
@Override // java.io.InputStream
public int read(byte[] buffer) throws IOException {
Intrinsics.checkNotNullParameter(buffer, "buffer");
int read = this.input.read(buffer);
if (read > 0) {
this.output.write(buffer, 0, read);
}
return read;
}
@Override // java.io.InputStream
public int read() throws IOException {
int read = this.input.read();
if (read >= 0) {
this.output.write(read);
}
return read;
}
@Override // java.io.InputStream
public int read(byte[] buffer, int i, int i2) throws IOException {
Intrinsics.checkNotNullParameter(buffer, "buffer");
int read = this.input.read(buffer, i, i2);
if (read > 0) {
this.output.write(buffer, i, read);
}
return read;
}
@Override // java.io.InputStream
public synchronized void reset() {
throw new UnsupportedOperationException();
}
@Override // java.io.InputStream
public long skip(long j) throws IOException {
int read;
byte[] bArr = new byte[1024];
long j2 = 0;
while (j2 < j && (read = read(bArr, 0, (int) Math.min(j - j2, 1024))) >= 0) {
j2 += read;
}
return j2;
}
}
public static final class Limits {
private int byteCount = 1048576;
private int fileCount = 1024;
public final int getByteCount() {
return this.byteCount;
}
public final int getFileCount() {
return this.fileCount;
}
public final void setByteCount(int i) {
if (i < 0) {
throw new InvalidParameterException("Cache byte-count limit must be >= 0");
}
this.byteCount = i;
}
public final void setFileCount(int i) {
if (i < 0) {
throw new InvalidParameterException("Cache file count limit must be >= 0");
}
this.fileCount = i;
}
}
public static final class ModifiedFile implements Comparable<ModifiedFile> {
public static final Companion Companion = new Companion(null);
private static final int HASH_MULTIPLIER = 37;
private static final int HASH_SEED = 29;
private final File file;
private final long modified;
public final File getFile() {
return this.file;
}
public final long getModified() {
return this.modified;
}
public ModifiedFile(File file) {
Intrinsics.checkNotNullParameter(file, "file");
this.file = file;
this.modified = file.lastModified();
}
@Override // java.lang.Comparable
public int compareTo(ModifiedFile another) {
Intrinsics.checkNotNullParameter(another, "another");
long j = this.modified;
long j2 = another.modified;
if (j < j2) {
return -1;
}
if (j > j2) {
return 1;
}
return this.file.compareTo(another.file);
}
public boolean equals(Object obj) {
return (obj instanceof ModifiedFile) && compareTo((ModifiedFile) obj) == 0;
}
public int hashCode() {
return ((1073 + this.file.hashCode()) * 37) + ((int) (this.modified % Integer.MAX_VALUE));
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
}
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
public final String getTAG() {
return FileLruCache.TAG;
}
}
}

View File

@@ -0,0 +1,61 @@
package com.facebook.internal;
import android.app.Activity;
import android.app.Fragment;
import android.content.Intent;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes2.dex */
public final class FragmentWrapper {
private Fragment nativeFragment;
private androidx.fragment.app.Fragment supportFragment;
public final Fragment getNativeFragment() {
return this.nativeFragment;
}
public final androidx.fragment.app.Fragment getSupportFragment() {
return this.supportFragment;
}
public FragmentWrapper(androidx.fragment.app.Fragment fragment) {
Intrinsics.checkNotNullParameter(fragment, "fragment");
this.supportFragment = fragment;
}
public FragmentWrapper(Fragment fragment) {
Intrinsics.checkNotNullParameter(fragment, "fragment");
this.nativeFragment = fragment;
}
public final void startActivityForResult(Intent intent, int i) {
androidx.fragment.app.Fragment fragment = this.supportFragment;
if (fragment != null) {
if (fragment == null) {
return;
}
fragment.startActivityForResult(intent, i);
} else {
Fragment fragment2 = this.nativeFragment;
if (fragment2 == null) {
return;
}
fragment2.startActivityForResult(intent, i);
}
}
public final Activity getActivity() {
androidx.fragment.app.Fragment fragment = this.supportFragment;
if (fragment != null) {
if (fragment == null) {
return null;
}
return fragment.getActivity();
}
Fragment fragment2 = this.nativeFragment;
if (fragment2 == null) {
return null;
}
return fragment2.getActivity();
}
}

View File

@@ -0,0 +1,25 @@
package com.facebook.internal;
import java.util.Arrays;
/* loaded from: classes2.dex */
public enum GamingAction {
ContextChoose("context_choose"),
JoinTournament("join_tournament");
private final String rawValue;
public final String getRawValue() {
return this.rawValue;
}
GamingAction(String str) {
this.rawValue = str;
}
/* renamed from: values, reason: to resolve conflict with enum method */
public static GamingAction[] valuesCustom() {
GamingAction[] valuesCustom = values();
return (GamingAction[]) Arrays.copyOf(valuesCustom, valuesCustom.length);
}
}

View File

@@ -0,0 +1,407 @@
package com.facebook.internal;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Handler;
import android.os.Looper;
import androidx.annotation.VisibleForTesting;
import com.facebook.internal.ImageRequest;
import com.facebook.internal.WorkQueue;
import com.facebook.internal.instrument.crashshield.CrashShieldHandler;
import java.util.HashMap;
import java.util.Map;
import kotlin.Unit;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes2.dex */
public final class ImageDownloader {
private static final int CACHE_READ_QUEUE_MAX_CONCURRENT = 2;
private static final int DOWNLOAD_QUEUE_MAX_CONCURRENT = 8;
private static Handler handler;
public static final ImageDownloader INSTANCE = new ImageDownloader();
private static final WorkQueue downloadQueue = new WorkQueue(8, null, 2, null);
private static final WorkQueue cacheReadQueue = new WorkQueue(2, null, 2, null);
private static final Map<RequestKey, DownloaderContext> pendingRequests = new HashMap();
@VisibleForTesting(otherwise = 2)
public final Map<RequestKey, DownloaderContext> getPendingRequests() {
return pendingRequests;
}
private ImageDownloader() {
}
private final synchronized Handler getHandler() {
try {
if (handler == null) {
handler = new Handler(Looper.getMainLooper());
}
} catch (Throwable th) {
throw th;
}
return handler;
}
public static final void downloadAsync(ImageRequest imageRequest) {
if (imageRequest == null) {
return;
}
RequestKey requestKey = new RequestKey(imageRequest.getImageUri(), imageRequest.getCallerTag());
Map<RequestKey, DownloaderContext> map = pendingRequests;
synchronized (map) {
try {
DownloaderContext downloaderContext = map.get(requestKey);
if (downloaderContext != null) {
downloaderContext.setRequest(imageRequest);
downloaderContext.setCancelled(false);
WorkQueue.WorkItem workItem = downloaderContext.getWorkItem();
if (workItem != null) {
workItem.moveToFront();
Unit unit = Unit.INSTANCE;
}
} else {
INSTANCE.enqueueCacheRead(imageRequest, requestKey, imageRequest.isCachedRedirectAllowed());
Unit unit2 = Unit.INSTANCE;
}
} finally {
}
}
}
public static final boolean cancelRequest(ImageRequest request) {
boolean z;
Intrinsics.checkNotNullParameter(request, "request");
RequestKey requestKey = new RequestKey(request.getImageUri(), request.getCallerTag());
Map<RequestKey, DownloaderContext> map = pendingRequests;
synchronized (map) {
try {
DownloaderContext downloaderContext = map.get(requestKey);
if (downloaderContext != null) {
WorkQueue.WorkItem workItem = downloaderContext.getWorkItem();
z = true;
if (workItem != null && workItem.cancel()) {
map.remove(requestKey);
} else {
downloaderContext.setCancelled(true);
}
} else {
z = false;
}
Unit unit = Unit.INSTANCE;
} catch (Throwable th) {
throw th;
}
}
return z;
}
public static final void prioritizeRequest(ImageRequest request) {
WorkQueue.WorkItem workItem;
Intrinsics.checkNotNullParameter(request, "request");
RequestKey requestKey = new RequestKey(request.getImageUri(), request.getCallerTag());
Map<RequestKey, DownloaderContext> map = pendingRequests;
synchronized (map) {
try {
DownloaderContext downloaderContext = map.get(requestKey);
if (downloaderContext != null && (workItem = downloaderContext.getWorkItem()) != null) {
workItem.moveToFront();
}
Unit unit = Unit.INSTANCE;
} catch (Throwable th) {
throw th;
}
}
}
public static final void clearCache() {
ImageResponseCache.clearCache();
UrlRedirectCache.clearCache();
}
private final void enqueueCacheRead(ImageRequest imageRequest, RequestKey requestKey, boolean z) {
enqueueRequest(imageRequest, requestKey, cacheReadQueue, new CacheReadWorkItem(requestKey, z));
}
private final void enqueueDownload(ImageRequest imageRequest, RequestKey requestKey) {
enqueueRequest(imageRequest, requestKey, downloadQueue, new DownloadImageWorkItem(requestKey));
}
private final void enqueueRequest(ImageRequest imageRequest, RequestKey requestKey, WorkQueue workQueue, Runnable runnable) {
Map<RequestKey, DownloaderContext> map = pendingRequests;
synchronized (map) {
DownloaderContext downloaderContext = new DownloaderContext(imageRequest);
map.put(requestKey, downloaderContext);
downloaderContext.setWorkItem(WorkQueue.addActiveWorkItem$default(workQueue, runnable, false, 2, null));
Unit unit = Unit.INSTANCE;
}
}
private final void issueResponse(RequestKey requestKey, final Exception exc, final Bitmap bitmap, final boolean z) {
Handler handler2;
DownloaderContext removePendingRequest = removePendingRequest(requestKey);
if (removePendingRequest == null || removePendingRequest.isCancelled()) {
return;
}
final ImageRequest request = removePendingRequest.getRequest();
final ImageRequest.Callback callback = request == null ? null : request.getCallback();
if (callback == null || (handler2 = getHandler()) == null) {
return;
}
handler2.post(new Runnable() { // from class: com.facebook.internal.ImageDownloader$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
ImageDownloader.m573issueResponse$lambda4(ImageRequest.this, exc, z, bitmap, callback);
}
});
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: issueResponse$lambda-4, reason: not valid java name */
public static final void m573issueResponse$lambda4(ImageRequest request, Exception exc, boolean z, Bitmap bitmap, ImageRequest.Callback callback) {
Intrinsics.checkNotNullParameter(request, "$request");
callback.onCompleted(new ImageResponse(request, exc, z, bitmap));
}
/* JADX INFO: Access modifiers changed from: private */
/* JADX WARN: Removed duplicated region for block: B:11:0x0027 */
/* JADX WARN: Removed duplicated region for block: B:14:0x0032 */
/* JADX WARN: Removed duplicated region for block: B:9:0x001b */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public final void readFromCache(com.facebook.internal.ImageDownloader.RequestKey r4, boolean r5) {
/*
r3 = this;
r0 = 0
r1 = 0
if (r5 == 0) goto L18
com.facebook.internal.UrlRedirectCache r5 = com.facebook.internal.UrlRedirectCache.INSTANCE
android.net.Uri r5 = r4.getUri()
android.net.Uri r5 = com.facebook.internal.UrlRedirectCache.getRedirectedUri(r5)
if (r5 == 0) goto L18
java.io.InputStream r5 = com.facebook.internal.ImageResponseCache.getCachedImageStream(r5)
if (r5 == 0) goto L19
r1 = 1
goto L19
L18:
r5 = r0
L19:
if (r1 != 0) goto L25
com.facebook.internal.ImageResponseCache r5 = com.facebook.internal.ImageResponseCache.INSTANCE
android.net.Uri r5 = r4.getUri()
java.io.InputStream r5 = com.facebook.internal.ImageResponseCache.getCachedImageStream(r5)
L25:
if (r5 == 0) goto L32
android.graphics.Bitmap r2 = android.graphics.BitmapFactory.decodeStream(r5)
com.facebook.internal.Utility.closeQuietly(r5)
r3.issueResponse(r4, r0, r2, r1)
goto L4a
L32:
com.facebook.internal.ImageDownloader$DownloaderContext r5 = r3.removePendingRequest(r4)
if (r5 != 0) goto L39
goto L3d
L39:
com.facebook.internal.ImageRequest r0 = r5.getRequest()
L3d:
if (r5 == 0) goto L4a
boolean r5 = r5.isCancelled()
if (r5 != 0) goto L4a
if (r0 == 0) goto L4a
r3.enqueueDownload(r0, r4)
L4a:
return
*/
throw new UnsupportedOperationException("Method not decompiled: com.facebook.internal.ImageDownloader.readFromCache(com.facebook.internal.ImageDownloader$RequestKey, boolean):void");
}
/* JADX INFO: Access modifiers changed from: private */
/* JADX WARN: Removed duplicated region for block: B:28:0x00e5 */
/* JADX WARN: Removed duplicated region for block: B:31:? A[RETURN, SYNTHETIC] */
/* JADX WARN: Type inference failed for: r4v6, types: [int] */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public final void download(com.facebook.internal.ImageDownloader.RequestKey r11) {
/*
Method dump skipped, instructions count: 233
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: com.facebook.internal.ImageDownloader.download(com.facebook.internal.ImageDownloader$RequestKey):void");
}
private final DownloaderContext removePendingRequest(RequestKey requestKey) {
DownloaderContext remove;
Map<RequestKey, DownloaderContext> map = pendingRequests;
synchronized (map) {
remove = map.remove(requestKey);
}
return remove;
}
@VisibleForTesting(otherwise = 2)
public static final class RequestKey {
public static final Companion Companion = new Companion(null);
private static final int HASH_MULTIPLIER = 37;
private static final int HASH_SEED = 29;
private Object tag;
private Uri uri;
public final Object getTag() {
return this.tag;
}
public final Uri getUri() {
return this.uri;
}
public final void setTag(Object obj) {
Intrinsics.checkNotNullParameter(obj, "<set-?>");
this.tag = obj;
}
public final void setUri(Uri uri) {
Intrinsics.checkNotNullParameter(uri, "<set-?>");
this.uri = uri;
}
public RequestKey(Uri uri, Object tag) {
Intrinsics.checkNotNullParameter(uri, "uri");
Intrinsics.checkNotNullParameter(tag, "tag");
this.uri = uri;
this.tag = tag;
}
public int hashCode() {
return ((1073 + this.uri.hashCode()) * 37) + this.tag.hashCode();
}
public boolean equals(Object obj) {
if (obj == null || !(obj instanceof RequestKey)) {
return false;
}
RequestKey requestKey = (RequestKey) obj;
return requestKey.uri == this.uri && requestKey.tag == this.tag;
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
}
}
@VisibleForTesting(otherwise = 2)
public static final class DownloaderContext {
private boolean isCancelled;
private ImageRequest request;
private WorkQueue.WorkItem workItem;
public final ImageRequest getRequest() {
return this.request;
}
public final WorkQueue.WorkItem getWorkItem() {
return this.workItem;
}
public final boolean isCancelled() {
return this.isCancelled;
}
public final void setCancelled(boolean z) {
this.isCancelled = z;
}
public final void setRequest(ImageRequest imageRequest) {
Intrinsics.checkNotNullParameter(imageRequest, "<set-?>");
this.request = imageRequest;
}
public final void setWorkItem(WorkQueue.WorkItem workItem) {
this.workItem = workItem;
}
public DownloaderContext(ImageRequest request) {
Intrinsics.checkNotNullParameter(request, "request");
this.request = request;
}
}
public static final class CacheReadWorkItem implements Runnable {
private final boolean allowCachedRedirects;
private final RequestKey key;
public CacheReadWorkItem(RequestKey key, boolean z) {
Intrinsics.checkNotNullParameter(key, "key");
this.key = key;
this.allowCachedRedirects = z;
}
@Override // java.lang.Runnable
public void run() {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
ImageDownloader.INSTANCE.readFromCache(this.key, this.allowCachedRedirects);
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
} catch (Throwable th2) {
CrashShieldHandler.handleThrowable(th2, this);
}
} catch (Throwable th3) {
CrashShieldHandler.handleThrowable(th3, this);
}
}
}
public static final class DownloadImageWorkItem implements Runnable {
private final RequestKey key;
public DownloadImageWorkItem(RequestKey key) {
Intrinsics.checkNotNullParameter(key, "key");
this.key = key;
}
@Override // java.lang.Runnable
public void run() {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
ImageDownloader.INSTANCE.download(this.key);
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
} catch (Throwable th2) {
CrashShieldHandler.handleThrowable(th2, this);
}
} catch (Throwable th3) {
CrashShieldHandler.handleThrowable(th3, this);
}
}
}
}

View File

@@ -0,0 +1,204 @@
package com.facebook.internal;
import android.content.Context;
import android.net.Uri;
import com.facebook.FacebookSdk;
import java.util.Arrays;
import java.util.Locale;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.StringCompanionObject;
/* loaded from: classes2.dex */
public final class ImageRequest {
private static final String ACCESS_TOKEN_PARAM = "access_token";
public static final Companion Companion = new Companion(null);
private static final String HEIGHT_PARAM = "height";
private static final String MIGRATION_PARAM = "migration_overrides";
private static final String MIGRATION_VALUE = "{october_2012:true}";
private static final String PATH = "%s/%s/picture";
public static final int UNSPECIFIED_DIMENSION = 0;
private static final String WIDTH_PARAM = "width";
private final boolean allowCachedRedirects;
private final Callback callback;
private final Object callerTag;
private final Context context;
private final Uri imageUri;
public interface Callback {
void onCompleted(ImageResponse imageResponse);
}
public /* synthetic */ ImageRequest(Context context, Uri uri, Callback callback, boolean z, Object obj, DefaultConstructorMarker defaultConstructorMarker) {
this(context, uri, callback, z, obj);
}
public static final Uri getProfilePictureUri(String str, int i, int i2) {
return Companion.getProfilePictureUri(str, i, i2);
}
public static final Uri getProfilePictureUri(String str, int i, int i2, String str2) {
return Companion.getProfilePictureUri(str, i, i2, str2);
}
public final boolean getAllowCachedRedirects() {
return this.allowCachedRedirects;
}
public final Callback getCallback() {
return this.callback;
}
public final Object getCallerTag() {
return this.callerTag;
}
public final Context getContext() {
return this.context;
}
public final Uri getImageUri() {
return this.imageUri;
}
public final boolean isCachedRedirectAllowed() {
return this.allowCachedRedirects;
}
private ImageRequest(Context context, Uri uri, Callback callback, boolean z, Object obj) {
this.context = context;
this.imageUri = uri;
this.callback = callback;
this.allowCachedRedirects = z;
this.callerTag = obj;
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
public final Uri getProfilePictureUri(String str, int i, int i2) {
return getProfilePictureUri(str, i, i2, "");
}
public final Uri getProfilePictureUri(String str, int i, int i2, String str2) {
Validate.notNullOrEmpty(str, "userId");
int max = Math.max(i, 0);
int max2 = Math.max(i2, 0);
if (!((max == 0 && max2 == 0) ? false : true)) {
throw new IllegalArgumentException("Either width or height must be greater than 0".toString());
}
Uri.Builder buildUpon = Uri.parse(ServerProtocol.getGraphUrlBase()).buildUpon();
StringCompanionObject stringCompanionObject = StringCompanionObject.INSTANCE;
String format = String.format(Locale.US, ImageRequest.PATH, Arrays.copyOf(new Object[]{FacebookSdk.getGraphApiVersion(), str}, 2));
Intrinsics.checkNotNullExpressionValue(format, "java.lang.String.format(locale, format, *args)");
Uri.Builder path = buildUpon.path(format);
if (max2 != 0) {
path.appendQueryParameter("height", String.valueOf(max2));
}
if (max != 0) {
path.appendQueryParameter("width", String.valueOf(max));
}
path.appendQueryParameter(ImageRequest.MIGRATION_PARAM, ImageRequest.MIGRATION_VALUE);
if (!Utility.isNullOrEmpty(str2)) {
path.appendQueryParameter("access_token", str2);
} else if (!Utility.isNullOrEmpty(FacebookSdk.getClientToken()) && !Utility.isNullOrEmpty(FacebookSdk.getApplicationId())) {
path.appendQueryParameter("access_token", FacebookSdk.getApplicationId() + '|' + FacebookSdk.getClientToken());
}
Uri build = path.build();
Intrinsics.checkNotNullExpressionValue(build, "builder.build()");
return build;
}
}
public static final class Builder {
private boolean allowCachedRedirects;
private Callback callback;
private Object callerTag;
private final Context context;
private final Uri imageUri;
private final Context component1() {
return this.context;
}
private final Uri component2() {
return this.imageUri;
}
public static /* synthetic */ Builder copy$default(Builder builder, Context context, Uri uri, int i, Object obj) {
if ((i & 1) != 0) {
context = builder.context;
}
if ((i & 2) != 0) {
uri = builder.imageUri;
}
return builder.copy(context, uri);
}
public final Builder copy(Context context, Uri imageUri) {
Intrinsics.checkNotNullParameter(context, "context");
Intrinsics.checkNotNullParameter(imageUri, "imageUri");
return new Builder(context, imageUri);
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof Builder)) {
return false;
}
Builder builder = (Builder) obj;
return Intrinsics.areEqual(this.context, builder.context) && Intrinsics.areEqual(this.imageUri, builder.imageUri);
}
public int hashCode() {
return (this.context.hashCode() * 31) + this.imageUri.hashCode();
}
public final Builder setAllowCachedRedirects(boolean z) {
this.allowCachedRedirects = z;
return this;
}
public final Builder setCallback(Callback callback) {
this.callback = callback;
return this;
}
public final Builder setCallerTag(Object obj) {
this.callerTag = obj;
return this;
}
public String toString() {
return "Builder(context=" + this.context + ", imageUri=" + this.imageUri + ')';
}
public Builder(Context context, Uri imageUri) {
Intrinsics.checkNotNullParameter(context, "context");
Intrinsics.checkNotNullParameter(imageUri, "imageUri");
this.context = context;
this.imageUri = imageUri;
}
public final ImageRequest build() {
Context context = this.context;
Uri uri = this.imageUri;
Callback callback = this.callback;
boolean z = this.allowCachedRedirects;
Object obj = this.callerTag;
if (obj == null) {
obj = new Object();
} else if (obj == null) {
throw new IllegalStateException("Required value was null.".toString());
}
return new ImageRequest(context, uri, callback, z, obj, null);
}
}
}

View File

@@ -0,0 +1,36 @@
package com.facebook.internal;
import android.graphics.Bitmap;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes2.dex */
public final class ImageResponse {
private final Bitmap bitmap;
private final Exception error;
private final boolean isCachedRedirect;
private final ImageRequest request;
public final Bitmap getBitmap() {
return this.bitmap;
}
public final Exception getError() {
return this.error;
}
public final ImageRequest getRequest() {
return this.request;
}
public final boolean isCachedRedirect() {
return this.isCachedRedirect;
}
public ImageResponse(ImageRequest request, Exception exc, boolean z, Bitmap bitmap) {
Intrinsics.checkNotNullParameter(request, "request");
this.request = request;
this.error = exc;
this.isCachedRedirect = z;
this.bitmap = bitmap;
}
}

View File

@@ -0,0 +1,130 @@
package com.facebook.internal;
import android.net.Uri;
import com.facebook.LoggingBehavior;
import com.facebook.internal.FileLruCache;
import com.facebook.internal.Logger;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.StringsKt__StringsJVMKt;
/* loaded from: classes2.dex */
public final class ImageResponseCache {
public static final ImageResponseCache INSTANCE = new ImageResponseCache();
private static final String TAG = ImageResponseCache.class.getSimpleName();
private static FileLruCache imageCache;
public final String getTAG() {
return TAG;
}
private ImageResponseCache() {
}
public static final synchronized FileLruCache getCache() throws IOException {
FileLruCache fileLruCache;
synchronized (ImageResponseCache.class) {
try {
if (imageCache == null) {
String TAG2 = TAG;
Intrinsics.checkNotNullExpressionValue(TAG2, "TAG");
imageCache = new FileLruCache(TAG2, new FileLruCache.Limits());
}
fileLruCache = imageCache;
if (fileLruCache == null) {
Intrinsics.throwUninitializedPropertyAccessException("imageCache");
throw null;
}
} catch (Throwable th) {
throw th;
}
}
return fileLruCache;
}
public static final InputStream getCachedImageStream(Uri uri) {
if (uri == null || !INSTANCE.isCDNURL(uri)) {
return null;
}
try {
FileLruCache cache = getCache();
String uri2 = uri.toString();
Intrinsics.checkNotNullExpressionValue(uri2, "uri.toString()");
return FileLruCache.get$default(cache, uri2, null, 2, null);
} catch (IOException e) {
Logger.Companion companion = Logger.Companion;
LoggingBehavior loggingBehavior = LoggingBehavior.CACHE;
String TAG2 = TAG;
Intrinsics.checkNotNullExpressionValue(TAG2, "TAG");
companion.log(loggingBehavior, 5, TAG2, e.toString());
return null;
}
}
public static final InputStream interceptAndCacheImageStream(HttpURLConnection connection) throws IOException {
Intrinsics.checkNotNullParameter(connection, "connection");
if (connection.getResponseCode() != 200) {
return null;
}
Uri parse = Uri.parse(connection.getURL().toString());
InputStream inputStream = connection.getInputStream();
try {
if (!INSTANCE.isCDNURL(parse)) {
return inputStream;
}
FileLruCache cache = getCache();
String uri = parse.toString();
Intrinsics.checkNotNullExpressionValue(uri, "uri.toString()");
return cache.interceptAndPut(uri, new BufferedHttpInputStream(inputStream, connection));
} catch (IOException unused) {
return inputStream;
}
}
private final boolean isCDNURL(Uri uri) {
String host;
return (uri == null || (host = uri.getHost()) == null || (!Intrinsics.areEqual(host, "fbcdn.net") && !StringsKt__StringsJVMKt.endsWith$default(host, ".fbcdn.net", false, 2, null) && (!StringsKt__StringsJVMKt.startsWith$default(host, "fbcdn", false, 2, null) || !StringsKt__StringsJVMKt.endsWith$default(host, ".akamaihd.net", false, 2, null)))) ? false : true;
}
public static final void clearCache() {
try {
getCache().clearCache();
} catch (IOException e) {
Logger.Companion companion = Logger.Companion;
LoggingBehavior loggingBehavior = LoggingBehavior.CACHE;
String TAG2 = TAG;
Intrinsics.checkNotNullExpressionValue(TAG2, "TAG");
companion.log(loggingBehavior, 5, TAG2, Intrinsics.stringPlus("clearCache failed ", e.getMessage()));
}
}
public static final class BufferedHttpInputStream extends BufferedInputStream {
private HttpURLConnection connection;
public final HttpURLConnection getConnection() {
return this.connection;
}
public final void setConnection(HttpURLConnection httpURLConnection) {
Intrinsics.checkNotNullParameter(httpURLConnection, "<set-?>");
this.connection = httpURLConnection;
}
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
public BufferedHttpInputStream(InputStream inputStream, HttpURLConnection connection) {
super(inputStream, 8192);
Intrinsics.checkNotNullParameter(connection, "connection");
this.connection = connection;
}
@Override // java.io.BufferedInputStream, java.io.FilterInputStream, java.io.InputStream, java.io.Closeable, java.lang.AutoCloseable
public void close() throws IOException {
super.close();
Utility utility = Utility.INSTANCE;
Utility.disconnectQuietly(this.connection);
}
}
}

View File

@@ -0,0 +1,39 @@
package com.facebook.internal;
import android.net.Uri;
import android.os.Bundle;
import com.facebook.FacebookSdk;
import com.facebook.login.CustomTabLoginMethodHandler;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes2.dex */
public final class InstagramCustomTab extends CustomTab {
public static final Companion Companion = new Companion(null);
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
public final Uri getURIForAction(String action, Bundle bundle) {
Intrinsics.checkNotNullParameter(action, "action");
if (Intrinsics.areEqual(action, CustomTabLoginMethodHandler.OAUTH_DIALOG)) {
Utility utility = Utility.INSTANCE;
return Utility.buildUri(ServerProtocol.getInstagramDialogAuthority(), ServerProtocol.INSTAGRAM_OAUTH_PATH, bundle);
}
Utility utility2 = Utility.INSTANCE;
return Utility.buildUri(ServerProtocol.getInstagramDialogAuthority(), FacebookSdk.getGraphApiVersion() + "/dialog/" + action, bundle);
}
}
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
public InstagramCustomTab(String action, Bundle bundle) {
super(action, bundle);
Intrinsics.checkNotNullParameter(action, "action");
setUri(Companion.getURIForAction(action, bundle == null ? new Bundle() : bundle));
}
}

View File

@@ -0,0 +1,110 @@
package com.facebook.internal;
import com.android.installreferrer.api.InstallReferrerClient;
import com.android.installreferrer.api.InstallReferrerStateListener;
import com.facebook.FacebookSdk;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes2.dex */
public final class InstallReferrerUtil {
public static final InstallReferrerUtil INSTANCE = new InstallReferrerUtil();
private static final String IS_REFERRER_UPDATED = "is_referrer_updated";
public interface Callback {
void onReceiveReferrerUrl(String str);
}
private InstallReferrerUtil() {
}
public static final void tryUpdateReferrerInfo(Callback callback) {
Intrinsics.checkNotNullParameter(callback, "callback");
InstallReferrerUtil installReferrerUtil = INSTANCE;
if (installReferrerUtil.isUpdated()) {
return;
}
installReferrerUtil.tryConnectReferrerInfo(callback);
}
private final void tryConnectReferrerInfo(final Callback callback) {
final InstallReferrerClient build = InstallReferrerClient.newBuilder(FacebookSdk.getApplicationContext()).build();
try {
build.startConnection(new InstallReferrerStateListener() { // from class: com.facebook.internal.InstallReferrerUtil$tryConnectReferrerInfo$installReferrerStateListener$1
@Override // com.android.installreferrer.api.InstallReferrerStateListener
public void onInstallReferrerServiceDisconnected() {
}
/* JADX WARN: Code restructure failed: missing block: B:23:0x0036, code lost:
if (r0 != false) goto L20;
*/
@Override // com.android.installreferrer.api.InstallReferrerStateListener
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public void onInstallReferrerSetupFinished(int r5) {
/*
r4 = this;
boolean r0 = com.facebook.internal.instrument.crashshield.CrashShieldHandler.isObjectCrashing(r4)
if (r0 == 0) goto L7
return
L7:
r0 = 2
if (r5 == 0) goto L15
if (r5 == r0) goto Ld
goto L42
Ld:
com.facebook.internal.InstallReferrerUtil r5 = com.facebook.internal.InstallReferrerUtil.INSTANCE // Catch: java.lang.Throwable -> L13
com.facebook.internal.InstallReferrerUtil.access$updateReferrer(r5) // Catch: java.lang.Throwable -> L13
goto L42
L13:
r5 = move-exception
goto L48
L15:
com.android.installreferrer.api.InstallReferrerClient r5 = com.android.installreferrer.api.InstallReferrerClient.this // Catch: java.lang.Throwable -> L13 android.os.RemoteException -> L4b
com.android.installreferrer.api.ReferrerDetails r5 = r5.getInstallReferrer() // Catch: java.lang.Throwable -> L13 android.os.RemoteException -> L4b
java.lang.String r1 = "{\n referrerClient.installReferrer\n }"
kotlin.jvm.internal.Intrinsics.checkNotNullExpressionValue(r5, r1) // Catch: java.lang.Throwable -> L13 android.os.RemoteException -> L4b
java.lang.String r5 = r5.getInstallReferrer() // Catch: java.lang.Throwable -> L13
if (r5 == 0) goto L3d
java.lang.String r1 = "fb"
r2 = 0
r3 = 0
boolean r1 = kotlin.text.StringsKt.contains$default(r5, r1, r3, r0, r2) // Catch: java.lang.Throwable -> L13
if (r1 != 0) goto L38
java.lang.String r1 = "facebook"
boolean r0 = kotlin.text.StringsKt.contains$default(r5, r1, r3, r0, r2) // Catch: java.lang.Throwable -> L13
if (r0 == 0) goto L3d
L38:
com.facebook.internal.InstallReferrerUtil$Callback r0 = r2 // Catch: java.lang.Throwable -> L13
r0.onReceiveReferrerUrl(r5) // Catch: java.lang.Throwable -> L13
L3d:
com.facebook.internal.InstallReferrerUtil r5 = com.facebook.internal.InstallReferrerUtil.INSTANCE // Catch: java.lang.Throwable -> L13
com.facebook.internal.InstallReferrerUtil.access$updateReferrer(r5) // Catch: java.lang.Throwable -> L13
L42:
com.android.installreferrer.api.InstallReferrerClient r5 = com.android.installreferrer.api.InstallReferrerClient.this // Catch: java.lang.Throwable -> L13 java.lang.Exception -> L47
r5.endConnection() // Catch: java.lang.Throwable -> L13 java.lang.Exception -> L47
L47:
return
L48:
com.facebook.internal.instrument.crashshield.CrashShieldHandler.handleThrowable(r5, r4)
L4b:
return
*/
throw new UnsupportedOperationException("Method not decompiled: com.facebook.internal.InstallReferrerUtil$tryConnectReferrerInfo$installReferrerStateListener$1.onInstallReferrerSetupFinished(int):void");
}
});
} catch (Exception unused) {
}
}
/* JADX INFO: Access modifiers changed from: private */
public final void updateReferrer() {
FacebookSdk.getApplicationContext().getSharedPreferences(FacebookSdk.APP_EVENT_PREFERENCES, 0).edit().putBoolean(IS_REFERRER_UPDATED, true).apply();
}
private final boolean isUpdated() {
return FacebookSdk.getApplicationContext().getSharedPreferences(FacebookSdk.APP_EVENT_PREFERENCES, 0).getBoolean(IS_REFERRER_UPDATED, false);
}
}

View File

@@ -0,0 +1,31 @@
package com.facebook.internal;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.StringsKt__StringsJVMKt;
/* loaded from: classes2.dex */
public final class InternalSettings {
public static final InternalSettings INSTANCE = new InternalSettings();
private static final String UNITY_PREFIX = "Unity.";
private static volatile String customUserAgent;
public static final String getCustomUserAgent() {
return customUserAgent;
}
public static /* synthetic */ void isUnityApp$annotations() {
}
public static final void setCustomUserAgent(String value) {
Intrinsics.checkNotNullParameter(value, "value");
customUserAgent = value;
}
private InternalSettings() {
}
public static final boolean isUnityApp() {
String str = customUserAgent;
return Intrinsics.areEqual(str != null ? Boolean.valueOf(StringsKt__StringsJVMKt.startsWith$default(str, UNITY_PREFIX, false, 2, null)) : null, Boolean.TRUE);
}
}

View File

@@ -0,0 +1,61 @@
package com.facebook.internal;
import com.facebook.FacebookSdk;
import java.util.concurrent.Callable;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.FutureTask;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes2.dex */
public final class LockOnGetVariable<T> {
private CountDownLatch initLatch;
private T storedValue;
public final T getValue() {
waitOnInit();
return this.storedValue;
}
public LockOnGetVariable(T t) {
this.storedValue = t;
}
public LockOnGetVariable(final Callable<T> callable) {
Intrinsics.checkNotNullParameter(callable, "callable");
this.initLatch = new CountDownLatch(1);
FacebookSdk.getExecutor().execute(new FutureTask(new Callable() { // from class: com.facebook.internal.LockOnGetVariable$$ExternalSyntheticLambda0
@Override // java.util.concurrent.Callable
public final Object call() {
Void m575_init_$lambda0;
m575_init_$lambda0 = LockOnGetVariable.m575_init_$lambda0(LockOnGetVariable.this, callable);
return m575_init_$lambda0;
}
}));
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: _init_$lambda-0, reason: not valid java name */
public static final Void m575_init_$lambda0(LockOnGetVariable this$0, Callable callable) {
Intrinsics.checkNotNullParameter(this$0, "this$0");
Intrinsics.checkNotNullParameter(callable, "$callable");
try {
this$0.storedValue = (T) callable.call();
} finally {
CountDownLatch countDownLatch = this$0.initLatch;
if (countDownLatch != null) {
countDownLatch.countDown();
}
}
}
private final void waitOnInit() {
CountDownLatch countDownLatch = this.initLatch;
if (countDownLatch == null) {
return;
}
try {
countDownLatch.await();
} catch (InterruptedException unused) {
}
}
}

View File

@@ -0,0 +1,211 @@
package com.facebook.internal;
import android.util.Log;
import com.facebook.FacebookSdk;
import com.facebook.LoggingBehavior;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.StringCompanionObject;
import kotlin.text.StringsKt__StringsJVMKt;
/* loaded from: classes2.dex */
public final class Logger {
public static final String LOG_TAG_BASE = "FacebookSDK.";
private final LoggingBehavior behavior;
private StringBuilder contents;
private int priority;
private final String tag;
public static final Companion Companion = new Companion(null);
private static final HashMap<String, String> stringsToReplace = new HashMap<>();
public static final void log(LoggingBehavior loggingBehavior, int i, String str, String str2) {
Companion.log(loggingBehavior, i, str, str2);
}
public static final void log(LoggingBehavior loggingBehavior, int i, String str, String str2, Object... objArr) {
Companion.log(loggingBehavior, i, str, str2, objArr);
}
public static final void log(LoggingBehavior loggingBehavior, String str, String str2) {
Companion.log(loggingBehavior, str, str2);
}
public static final void log(LoggingBehavior loggingBehavior, String str, String str2, Object... objArr) {
Companion.log(loggingBehavior, str, str2, objArr);
}
public static final synchronized void registerAccessToken(String str) {
synchronized (Logger.class) {
Companion.registerAccessToken(str);
}
}
public static final synchronized void registerStringToReplace(String str, String str2) {
synchronized (Logger.class) {
Companion.registerStringToReplace(str, str2);
}
}
public final int getPriority() {
return this.priority;
}
public Logger(LoggingBehavior behavior, String tag) {
Intrinsics.checkNotNullParameter(behavior, "behavior");
Intrinsics.checkNotNullParameter(tag, "tag");
this.priority = 3;
this.behavior = behavior;
this.tag = Intrinsics.stringPlus(LOG_TAG_BASE, Validate.notNullOrEmpty(tag, "tag"));
this.contents = new StringBuilder();
}
public final void setPriority(int i) {
Validate validate = Validate.INSTANCE;
Validate.oneOf(Integer.valueOf(i), "value", 7, 3, 6, 4, 2, 5);
setPriority(i);
}
public final String getContents() {
Companion companion = Companion;
String sb = this.contents.toString();
Intrinsics.checkNotNullExpressionValue(sb, "contents.toString()");
return companion.replaceStrings(sb);
}
public final void log() {
String sb = this.contents.toString();
Intrinsics.checkNotNullExpressionValue(sb, "contents.toString()");
logString(sb);
this.contents = new StringBuilder();
}
public final void logString(String string) {
Intrinsics.checkNotNullParameter(string, "string");
Companion.log(this.behavior, this.priority, this.tag, string);
}
public final void append(StringBuilder stringBuilder) {
Intrinsics.checkNotNullParameter(stringBuilder, "stringBuilder");
if (shouldLog()) {
this.contents.append((CharSequence) stringBuilder);
}
}
public final void append(String string) {
Intrinsics.checkNotNullParameter(string, "string");
if (shouldLog()) {
this.contents.append(string);
}
}
public final void append(String format, Object... args) {
Intrinsics.checkNotNullParameter(format, "format");
Intrinsics.checkNotNullParameter(args, "args");
if (shouldLog()) {
StringBuilder sb = this.contents;
StringCompanionObject stringCompanionObject = StringCompanionObject.INSTANCE;
Object[] copyOf = Arrays.copyOf(args, args.length);
String format2 = String.format(format, Arrays.copyOf(copyOf, copyOf.length));
Intrinsics.checkNotNullExpressionValue(format2, "java.lang.String.format(format, *args)");
sb.append(format2);
}
}
public final void appendKeyValue(String key, Object value) {
Intrinsics.checkNotNullParameter(key, "key");
Intrinsics.checkNotNullParameter(value, "value");
append(" %s:\t%s\n", key, value);
}
private final boolean shouldLog() {
FacebookSdk facebookSdk = FacebookSdk.INSTANCE;
return FacebookSdk.isLoggingBehaviorEnabled(this.behavior);
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
public final synchronized void registerStringToReplace(String original, String replace) {
Intrinsics.checkNotNullParameter(original, "original");
Intrinsics.checkNotNullParameter(replace, "replace");
Logger.stringsToReplace.put(original, replace);
}
public final synchronized void registerAccessToken(String accessToken) {
Intrinsics.checkNotNullParameter(accessToken, "accessToken");
FacebookSdk facebookSdk = FacebookSdk.INSTANCE;
if (!FacebookSdk.isLoggingBehaviorEnabled(LoggingBehavior.INCLUDE_ACCESS_TOKENS)) {
registerStringToReplace(accessToken, "ACCESS_TOKEN_REMOVED");
}
}
public final void log(LoggingBehavior behavior, String tag, String string) {
Intrinsics.checkNotNullParameter(behavior, "behavior");
Intrinsics.checkNotNullParameter(tag, "tag");
Intrinsics.checkNotNullParameter(string, "string");
log(behavior, 3, tag, string);
}
public final void log(LoggingBehavior behavior, String tag, String format, Object... args) {
Intrinsics.checkNotNullParameter(behavior, "behavior");
Intrinsics.checkNotNullParameter(tag, "tag");
Intrinsics.checkNotNullParameter(format, "format");
Intrinsics.checkNotNullParameter(args, "args");
if (FacebookSdk.isLoggingBehaviorEnabled(behavior)) {
StringCompanionObject stringCompanionObject = StringCompanionObject.INSTANCE;
Object[] copyOf = Arrays.copyOf(args, args.length);
String format2 = String.format(format, Arrays.copyOf(copyOf, copyOf.length));
Intrinsics.checkNotNullExpressionValue(format2, "java.lang.String.format(format, *args)");
log(behavior, 3, tag, format2);
}
}
public final void log(LoggingBehavior behavior, int i, String tag, String format, Object... args) {
Intrinsics.checkNotNullParameter(behavior, "behavior");
Intrinsics.checkNotNullParameter(tag, "tag");
Intrinsics.checkNotNullParameter(format, "format");
Intrinsics.checkNotNullParameter(args, "args");
if (FacebookSdk.isLoggingBehaviorEnabled(behavior)) {
StringCompanionObject stringCompanionObject = StringCompanionObject.INSTANCE;
Object[] copyOf = Arrays.copyOf(args, args.length);
String format2 = String.format(format, Arrays.copyOf(copyOf, copyOf.length));
Intrinsics.checkNotNullExpressionValue(format2, "java.lang.String.format(format, *args)");
log(behavior, i, tag, format2);
}
}
public final void log(LoggingBehavior behavior, int i, String tag, String string) {
Intrinsics.checkNotNullParameter(behavior, "behavior");
Intrinsics.checkNotNullParameter(tag, "tag");
Intrinsics.checkNotNullParameter(string, "string");
if (FacebookSdk.isLoggingBehaviorEnabled(behavior)) {
String replaceStrings = replaceStrings(string);
if (!StringsKt__StringsJVMKt.startsWith$default(tag, Logger.LOG_TAG_BASE, false, 2, null)) {
tag = Intrinsics.stringPlus(Logger.LOG_TAG_BASE, tag);
}
Log.println(i, tag, replaceStrings);
if (behavior == LoggingBehavior.DEVELOPER_ERRORS) {
new Exception().printStackTrace();
}
}
}
/* JADX INFO: Access modifiers changed from: private */
public final synchronized String replaceStrings(String str) {
String str2;
str2 = str;
for (Map.Entry entry : Logger.stringsToReplace.entrySet()) {
str2 = StringsKt__StringsJVMKt.replace$default(str2, (String) entry.getKey(), (String) entry.getValue(), false, 4, (Object) null);
}
return str2;
}
}
}

View File

@@ -0,0 +1,10 @@
package com.facebook.internal;
/* loaded from: classes2.dex */
public class Mutable<T> {
public T value;
public Mutable(T t) {
this.value = t;
}
}

View File

@@ -0,0 +1,267 @@
package com.facebook.internal;
import android.graphics.Bitmap;
import android.net.Uri;
import android.util.Log;
import com.facebook.FacebookContentProvider;
import com.facebook.FacebookException;
import com.facebook.FacebookSdk;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Collection;
import java.util.UUID;
import kotlin.io.FilesKt__UtilsKt;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.StringsKt__StringsJVMKt;
/* loaded from: classes2.dex */
public final class NativeAppCallAttachmentStore {
public static final String ATTACHMENTS_DIR_NAME = "com.facebook.NativeAppCallAttachmentStore.files";
public static final NativeAppCallAttachmentStore INSTANCE = new NativeAppCallAttachmentStore();
private static final String TAG = NativeAppCallAttachmentStore.class.getName();
private static File attachmentsDirectory;
private NativeAppCallAttachmentStore() {
}
public static final Attachment createAttachment(UUID callId, Bitmap attachmentBitmap) {
Intrinsics.checkNotNullParameter(callId, "callId");
Intrinsics.checkNotNullParameter(attachmentBitmap, "attachmentBitmap");
return new Attachment(callId, attachmentBitmap, null);
}
public static final Attachment createAttachment(UUID callId, Uri attachmentUri) {
Intrinsics.checkNotNullParameter(callId, "callId");
Intrinsics.checkNotNullParameter(attachmentUri, "attachmentUri");
return new Attachment(callId, null, attachmentUri);
}
private final void processAttachmentBitmap(Bitmap bitmap, File file) throws IOException {
FileOutputStream fileOutputStream = new FileOutputStream(file);
try {
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, fileOutputStream);
} finally {
Utility.closeQuietly(fileOutputStream);
}
}
private final void processAttachmentFile(Uri uri, boolean z, File file) throws IOException {
InputStream openInputStream;
FileOutputStream fileOutputStream = new FileOutputStream(file);
try {
if (!z) {
openInputStream = new FileInputStream(uri.getPath());
} else {
openInputStream = FacebookSdk.getApplicationContext().getContentResolver().openInputStream(uri);
}
Utility.copyAndCloseInputStream(openInputStream, fileOutputStream);
Utility.closeQuietly(fileOutputStream);
} catch (Throwable th) {
Utility.closeQuietly(fileOutputStream);
throw th;
}
}
public static final void addAttachments(Collection<Attachment> collection) throws FacebookException {
File attachmentFile;
if (collection == null || collection.isEmpty()) {
return;
}
if (attachmentsDirectory == null) {
cleanupAllAttachments();
}
ensureAttachmentsDirectoryExists();
ArrayList<File> arrayList = new ArrayList();
try {
for (Attachment attachment : collection) {
if (attachment.getShouldCreateFile() && (attachmentFile = getAttachmentFile(attachment.getCallId(), attachment.getAttachmentName(), true)) != null) {
arrayList.add(attachmentFile);
if (attachment.getBitmap() != null) {
INSTANCE.processAttachmentBitmap(attachment.getBitmap(), attachmentFile);
} else if (attachment.getOriginalUri() != null) {
INSTANCE.processAttachmentFile(attachment.getOriginalUri(), attachment.isContentUri(), attachmentFile);
}
}
}
} catch (IOException e) {
Log.e(TAG, Intrinsics.stringPlus("Got unexpected exception:", e));
for (File file : arrayList) {
if (file != null) {
try {
file.delete();
} catch (Exception unused) {
}
}
}
throw new FacebookException(e);
}
}
public static final void cleanupAttachmentsForCall(UUID callId) {
Intrinsics.checkNotNullParameter(callId, "callId");
File attachmentsDirectoryForCall = getAttachmentsDirectoryForCall(callId, false);
if (attachmentsDirectoryForCall == null) {
return;
}
FilesKt__UtilsKt.deleteRecursively(attachmentsDirectoryForCall);
}
public static final File openAttachment(UUID uuid, String str) throws FileNotFoundException {
if (Utility.isNullOrEmpty(str) || uuid == null) {
throw new FileNotFoundException();
}
try {
return getAttachmentFile(uuid, str, false);
} catch (IOException unused) {
throw new FileNotFoundException();
}
}
public static final synchronized File getAttachmentsDirectory() {
File file;
synchronized (NativeAppCallAttachmentStore.class) {
try {
if (attachmentsDirectory == null) {
attachmentsDirectory = new File(FacebookSdk.getApplicationContext().getCacheDir(), ATTACHMENTS_DIR_NAME);
}
file = attachmentsDirectory;
} catch (Throwable th) {
throw th;
}
}
return file;
}
public static final File ensureAttachmentsDirectoryExists() {
File attachmentsDirectory2 = getAttachmentsDirectory();
if (attachmentsDirectory2 != null) {
attachmentsDirectory2.mkdirs();
}
return attachmentsDirectory2;
}
public static final File getAttachmentsDirectoryForCall(UUID callId, boolean z) {
Intrinsics.checkNotNullParameter(callId, "callId");
if (attachmentsDirectory == null) {
return null;
}
File file = new File(attachmentsDirectory, callId.toString());
if (z && !file.exists()) {
file.mkdirs();
}
return file;
}
public static final File getAttachmentFile(UUID callId, String str, boolean z) throws IOException {
Intrinsics.checkNotNullParameter(callId, "callId");
File attachmentsDirectoryForCall = getAttachmentsDirectoryForCall(callId, z);
if (attachmentsDirectoryForCall == null) {
return null;
}
try {
return new File(attachmentsDirectoryForCall, URLEncoder.encode(str, "UTF-8"));
} catch (UnsupportedEncodingException unused) {
return null;
}
}
public static final void cleanupAllAttachments() {
File attachmentsDirectory2 = getAttachmentsDirectory();
if (attachmentsDirectory2 == null) {
return;
}
FilesKt__UtilsKt.deleteRecursively(attachmentsDirectory2);
}
public static final class Attachment {
private final String attachmentName;
private final String attachmentUrl;
private final Bitmap bitmap;
private final UUID callId;
private boolean isContentUri;
private final Uri originalUri;
private boolean shouldCreateFile;
public final String getAttachmentName() {
return this.attachmentName;
}
public final String getAttachmentUrl() {
return this.attachmentUrl;
}
public final Bitmap getBitmap() {
return this.bitmap;
}
public final UUID getCallId() {
return this.callId;
}
public final Uri getOriginalUri() {
return this.originalUri;
}
public final boolean getShouldCreateFile() {
return this.shouldCreateFile;
}
public final boolean isContentUri() {
return this.isContentUri;
}
public final void setContentUri(boolean z) {
this.isContentUri = z;
}
public final void setShouldCreateFile(boolean z) {
this.shouldCreateFile = z;
}
public Attachment(UUID callId, Bitmap bitmap, Uri uri) {
String attachmentUrl;
boolean equals;
boolean equals2;
Intrinsics.checkNotNullParameter(callId, "callId");
this.callId = callId;
this.bitmap = bitmap;
this.originalUri = uri;
if (uri != null) {
String scheme = uri.getScheme();
equals = StringsKt__StringsJVMKt.equals("content", scheme, true);
if (equals) {
this.isContentUri = true;
String authority = uri.getAuthority();
this.shouldCreateFile = (authority == null || StringsKt__StringsJVMKt.startsWith$default(authority, "media", false, 2, null)) ? false : true;
} else {
equals2 = StringsKt__StringsJVMKt.equals("file", uri.getScheme(), true);
if (equals2) {
this.shouldCreateFile = true;
} else if (!Utility.isWebUri(uri)) {
throw new FacebookException(Intrinsics.stringPlus("Unsupported scheme for media Uri : ", scheme));
}
}
} else {
if (bitmap == null) {
throw new FacebookException("Cannot share media without a bitmap or Uri set");
}
this.shouldCreateFile = true;
}
String uuid = this.shouldCreateFile ? UUID.randomUUID().toString() : null;
this.attachmentName = uuid;
if (!this.shouldCreateFile) {
attachmentUrl = String.valueOf(uri);
} else {
attachmentUrl = FacebookContentProvider.Companion.getAttachmentUrl(FacebookSdk.getApplicationId(), callId, uuid);
}
this.attachmentUrl = attachmentUrl;
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,172 @@
package com.facebook.internal;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.os.Message;
import android.os.Messenger;
import android.os.RemoteException;
import com.facebook.internal.instrument.crashshield.CrashShieldHandler;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes2.dex */
public abstract class PlatformServiceClient implements ServiceConnection {
private final String applicationId;
private final Context context;
private final Handler handler;
private CompletedListener listener;
private final String nonce;
private final int protocolVersion;
private final int replyMessage;
private final int requestMessage;
private boolean running;
private Messenger sender;
public interface CompletedListener {
void completed(Bundle bundle);
}
public final void cancel() {
this.running = false;
}
public final Context getContext() {
return this.context;
}
public final String getNonce() {
return this.nonce;
}
public abstract void populateRequestBundle(Bundle bundle);
public final void setCompletedListener(CompletedListener completedListener) {
this.listener = completedListener;
}
public PlatformServiceClient(Context context, int i, int i2, int i3, String applicationId, String str) {
Intrinsics.checkNotNullParameter(context, "context");
Intrinsics.checkNotNullParameter(applicationId, "applicationId");
Context applicationContext = context.getApplicationContext();
this.context = applicationContext != null ? applicationContext : context;
this.requestMessage = i;
this.replyMessage = i2;
this.applicationId = applicationId;
this.protocolVersion = i3;
this.nonce = str;
this.handler = new Handler() { // from class: com.facebook.internal.PlatformServiceClient.1
@Override // android.os.Handler
public void handleMessage(Message message) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
Intrinsics.checkNotNullParameter(message, "message");
PlatformServiceClient.this.handleMessage(message);
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
} catch (Throwable th2) {
CrashShieldHandler.handleThrowable(th2, this);
}
}
};
}
public final boolean start() {
synchronized (this) {
boolean z = false;
if (this.running) {
return false;
}
NativeProtocol nativeProtocol = NativeProtocol.INSTANCE;
if (NativeProtocol.getLatestAvailableProtocolVersionForService(this.protocolVersion) == -1) {
return false;
}
Intent createPlatformServiceIntent = NativeProtocol.createPlatformServiceIntent(getContext());
if (createPlatformServiceIntent != null) {
z = true;
this.running = true;
getContext().bindService(createPlatformServiceIntent, this, 1);
}
return z;
}
}
@Override // android.content.ServiceConnection
public void onServiceConnected(ComponentName name, IBinder service) {
Intrinsics.checkNotNullParameter(name, "name");
Intrinsics.checkNotNullParameter(service, "service");
this.sender = new Messenger(service);
sendMessage();
}
@Override // android.content.ServiceConnection
public void onServiceDisconnected(ComponentName name) {
Intrinsics.checkNotNullParameter(name, "name");
this.sender = null;
try {
this.context.unbindService(this);
} catch (IllegalArgumentException unused) {
}
callback(null);
}
private final void sendMessage() {
Bundle bundle = new Bundle();
bundle.putString(NativeProtocol.EXTRA_APPLICATION_ID, this.applicationId);
String str = this.nonce;
if (str != null) {
bundle.putString(NativeProtocol.EXTRA_NONCE, str);
}
populateRequestBundle(bundle);
Message obtain = Message.obtain((Handler) null, this.requestMessage);
obtain.arg1 = this.protocolVersion;
obtain.setData(bundle);
obtain.replyTo = new Messenger(this.handler);
try {
Messenger messenger = this.sender;
if (messenger == null) {
return;
}
messenger.send(obtain);
} catch (RemoteException unused) {
callback(null);
}
}
public final void handleMessage(Message message) {
Intrinsics.checkNotNullParameter(message, "message");
if (message.what == this.replyMessage) {
Bundle data = message.getData();
if (data.getString(NativeProtocol.STATUS_ERROR_TYPE) != null) {
callback(null);
} else {
callback(data);
}
try {
this.context.unbindService(this);
} catch (IllegalArgumentException unused) {
}
}
}
private final void callback(Bundle bundle) {
if (this.running) {
this.running = false;
CompletedListener completedListener = this.listener;
if (completedListener == null) {
return;
}
completedListener.completed(bundle);
}
}
}

View File

@@ -0,0 +1,25 @@
package com.facebook.internal;
import java.util.concurrent.ConcurrentHashMap;
import kotlin.jvm.internal.Intrinsics;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public final class ProfileInformationCache {
public static final ProfileInformationCache INSTANCE = new ProfileInformationCache();
private static final ConcurrentHashMap<String, JSONObject> infoCache = new ConcurrentHashMap<>();
private ProfileInformationCache() {
}
public static final JSONObject getProfileInformation(String accessToken) {
Intrinsics.checkNotNullParameter(accessToken, "accessToken");
return infoCache.get(accessToken);
}
public static final void putProfileInformation(String key, JSONObject value) {
Intrinsics.checkNotNullParameter(key, "key");
Intrinsics.checkNotNullParameter(value, "value");
infoCache.put(key, value);
}
}

View File

@@ -0,0 +1,188 @@
package com.facebook.internal;
import android.os.Bundle;
import com.facebook.FacebookSdk;
import com.facebook.LoggingBehavior;
import com.facebook.internal.Logger;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import kotlin.collections.CollectionsKt__CollectionsKt;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.StringCompanionObject;
import org.json.JSONException;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public final class ServerProtocol {
private static final String DIALOG_AUTHORITY_FORMAT = "m.%s";
public static final String DIALOG_CANCEL_URI = "fbconnect://cancel";
public static final String DIALOG_PARAM_ACCESS_TOKEN = "access_token";
public static final String DIALOG_PARAM_APP_ID = "app_id";
public static final String DIALOG_PARAM_AUTHENTICATION_TOKEN = "id_token";
public static final String DIALOG_PARAM_AUTH_TYPE = "auth_type";
public static final String DIALOG_PARAM_CBT = "cbt";
public static final String DIALOG_PARAM_CCT_OVER_LOGGED_OUT_APP_SWITCH = "cct_over_app_switch";
public static final String DIALOG_PARAM_CLIENT_ID = "client_id";
public static final String DIALOG_PARAM_CODE_CHALLENGE = "code_challenge";
public static final String DIALOG_PARAM_CODE_CHALLENGE_METHOD = "code_challenge_method";
public static final String DIALOG_PARAM_CODE_REDIRECT_URI = "code_redirect_uri";
public static final String DIALOG_PARAM_CUSTOM_TABS_PREFETCHING = "cct_prefetching";
public static final String DIALOG_PARAM_DEFAULT_AUDIENCE = "default_audience";
public static final String DIALOG_PARAM_DISPLAY = "display";
public static final String DIALOG_PARAM_DISPLAY_TOUCH = "touch";
public static final String DIALOG_PARAM_E2E = "e2e";
public static final String DIALOG_PARAM_FAIL_ON_LOGGED_OUT = "fail_on_logged_out";
public static final String DIALOG_PARAM_FX_APP = "fx_app";
public static final String DIALOG_PARAM_IES = "ies";
public static final String DIALOG_PARAM_LEGACY_OVERRIDE = "legacy_override";
public static final String DIALOG_PARAM_LOGIN_BEHAVIOR = "login_behavior";
public static final String DIALOG_PARAM_MESSENGER_PAGE_ID = "messenger_page_id";
public static final String DIALOG_PARAM_NONCE = "nonce";
public static final String DIALOG_PARAM_REDIRECT_URI = "redirect_uri";
public static final String DIALOG_PARAM_RESET_MESSENGER_STATE = "reset_messenger_state";
public static final String DIALOG_PARAM_RESPONSE_TYPE = "response_type";
public static final String DIALOG_PARAM_RETURN_SCOPES = "return_scopes";
public static final String DIALOG_PARAM_SCOPE = "scope";
public static final String DIALOG_PARAM_SDK_VERSION = "sdk";
public static final String DIALOG_PARAM_SKIP_DEDUPE = "skip_dedupe";
public static final String DIALOG_PARAM_SSO_DEVICE = "sso";
public static final String DIALOG_PARAM_STATE = "state";
public static final String DIALOG_PATH = "dialog/";
public static final String DIALOG_REDIRECT_CHROME_OS_URI = "fbconnect://chrome_os_success";
public static final String DIALOG_REDIRECT_URI = "fbconnect://success";
public static final String DIALOG_REREQUEST_AUTH_TYPE = "rerequest";
public static final String DIALOG_RESPONSE_TYPE_CODE = "code,signed_request,graph_domain";
public static final String DIALOG_RESPONSE_TYPE_ID_TOKEN_AND_SIGNED_REQUEST = "id_token,token,signed_request,graph_domain";
public static final String DIALOG_RESPONSE_TYPE_TOKEN_AND_SCOPES = "token,signed_request,graph_domain,granted_scopes";
public static final String DIALOG_RESPONSE_TYPE_TOKEN_AND_SIGNED_REQUEST = "token,signed_request,graph_domain";
public static final String DIALOG_RETURN_SCOPES_TRUE = "true";
public static final String FALLBACK_DIALOG_DISPLAY_VALUE_TOUCH = "touch";
public static final String FALLBACK_DIALOG_PARAM_APP_ID = "app_id";
public static final String FALLBACK_DIALOG_PARAM_BRIDGE_ARGS = "bridge_args";
public static final String FALLBACK_DIALOG_PARAM_KEY_HASH = "android_key_hash";
public static final String FALLBACK_DIALOG_PARAM_METHOD_ARGS = "method_args";
public static final String FALLBACK_DIALOG_PARAM_METHOD_RESULTS = "method_results";
public static final String FALLBACK_DIALOG_PARAM_VERSION = "version";
private static final String GAMING_DIALOG_AUTHORITY_FORMAT = "%s";
private static final String GRAPH_URL_FORMAT = "https://graph.%s";
private static final String GRAPH_VIDEO_URL_FORMAT = "https://graph-video.%s";
public static final String INSTAGRAM_OAUTH_PATH = "oauth/authorize";
public static final ServerProtocol INSTANCE = new ServerProtocol();
private static final String TAG = ServerProtocol.class.getName();
public static final String getDefaultAPIVersion() {
return "v16.0";
}
public static final String getErrorConnectionFailure() {
return "CONNECTION_FAILURE";
}
private ServerProtocol() {
}
public static final Collection<String> getErrorsProxyAuthDisabled() {
List listOf;
listOf = CollectionsKt__CollectionsKt.listOf((Object[]) new String[]{"service_disabled", "AndroidAuthKillSwitchException"});
return listOf;
}
public static final Collection<String> getErrorsUserCanceled() {
List listOf;
listOf = CollectionsKt__CollectionsKt.listOf((Object[]) new String[]{"access_denied", "OAuthAccessDeniedException"});
return listOf;
}
public static final String getDialogAuthority() {
StringCompanionObject stringCompanionObject = StringCompanionObject.INSTANCE;
String format = String.format(DIALOG_AUTHORITY_FORMAT, Arrays.copyOf(new Object[]{FacebookSdk.getFacebookDomain()}, 1));
Intrinsics.checkNotNullExpressionValue(format, "java.lang.String.format(format, *args)");
return format;
}
public static final String getGamingDialogAuthority() {
StringCompanionObject stringCompanionObject = StringCompanionObject.INSTANCE;
String format = String.format(GAMING_DIALOG_AUTHORITY_FORMAT, Arrays.copyOf(new Object[]{FacebookSdk.getFacebookGamingDomain()}, 1));
Intrinsics.checkNotNullExpressionValue(format, "java.lang.String.format(format, *args)");
return format;
}
public static final String getInstagramDialogAuthority() {
StringCompanionObject stringCompanionObject = StringCompanionObject.INSTANCE;
String format = String.format(DIALOG_AUTHORITY_FORMAT, Arrays.copyOf(new Object[]{FacebookSdk.getInstagramDomain()}, 1));
Intrinsics.checkNotNullExpressionValue(format, "java.lang.String.format(format, *args)");
return format;
}
public static final String getGraphUrlBase() {
StringCompanionObject stringCompanionObject = StringCompanionObject.INSTANCE;
String format = String.format(GRAPH_URL_FORMAT, Arrays.copyOf(new Object[]{FacebookSdk.getGraphDomain()}, 1));
Intrinsics.checkNotNullExpressionValue(format, "java.lang.String.format(format, *args)");
return format;
}
public static final String getGraphVideoUrlBase() {
StringCompanionObject stringCompanionObject = StringCompanionObject.INSTANCE;
String format = String.format(GRAPH_VIDEO_URL_FORMAT, Arrays.copyOf(new Object[]{FacebookSdk.getGraphDomain()}, 1));
Intrinsics.checkNotNullExpressionValue(format, "java.lang.String.format(format, *args)");
return format;
}
public static final String getFacebookGraphUrlBase() {
StringCompanionObject stringCompanionObject = StringCompanionObject.INSTANCE;
String format = String.format(GRAPH_URL_FORMAT, Arrays.copyOf(new Object[]{FacebookSdk.getFacebookDomain()}, 1));
Intrinsics.checkNotNullExpressionValue(format, "java.lang.String.format(format, *args)");
return format;
}
public static final String getGraphUrlBaseForSubdomain(String subdomain) {
Intrinsics.checkNotNullParameter(subdomain, "subdomain");
StringCompanionObject stringCompanionObject = StringCompanionObject.INSTANCE;
String format = String.format(GRAPH_URL_FORMAT, Arrays.copyOf(new Object[]{subdomain}, 1));
Intrinsics.checkNotNullExpressionValue(format, "java.lang.String.format(format, *args)");
return format;
}
public static final Bundle getQueryParamsForPlatformActivityIntentWebFallback(String callId, int i, Bundle bundle) {
Intrinsics.checkNotNullParameter(callId, "callId");
String applicationSignature = FacebookSdk.getApplicationSignature(FacebookSdk.getApplicationContext());
if (Utility.isNullOrEmpty(applicationSignature)) {
return null;
}
Bundle bundle2 = new Bundle();
bundle2.putString(FALLBACK_DIALOG_PARAM_KEY_HASH, applicationSignature);
bundle2.putString("app_id", FacebookSdk.getApplicationId());
bundle2.putInt("version", i);
bundle2.putString("display", "touch");
Bundle bundle3 = new Bundle();
bundle3.putString("action_id", callId);
try {
JSONObject convertToJSON = BundleJSONConverter.convertToJSON(bundle3);
if (bundle == null) {
bundle = new Bundle();
}
JSONObject convertToJSON2 = BundleJSONConverter.convertToJSON(bundle);
if (convertToJSON != null && convertToJSON2 != null) {
bundle2.putString(FALLBACK_DIALOG_PARAM_BRIDGE_ARGS, convertToJSON.toString());
bundle2.putString(FALLBACK_DIALOG_PARAM_METHOD_ARGS, convertToJSON2.toString());
return bundle2;
}
return null;
} catch (IllegalArgumentException e) {
Logger.Companion companion = Logger.Companion;
LoggingBehavior loggingBehavior = LoggingBehavior.DEVELOPER_ERRORS;
String TAG2 = TAG;
Intrinsics.checkNotNullExpressionValue(TAG2, "TAG");
companion.log(loggingBehavior, 6, TAG2, Intrinsics.stringPlus("Error creating Url -- ", e));
return null;
} catch (JSONException e2) {
Logger.Companion companion2 = Logger.Companion;
LoggingBehavior loggingBehavior2 = LoggingBehavior.DEVELOPER_ERRORS;
String TAG3 = TAG;
Intrinsics.checkNotNullExpressionValue(TAG3, "TAG");
companion2.log(loggingBehavior2, 6, TAG3, Intrinsics.stringPlus("Error creating Url -- ", e2));
return null;
}
}
}

View File

@@ -0,0 +1,64 @@
package com.facebook.internal;
import java.util.Arrays;
import java.util.EnumSet;
import java.util.Iterator;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes2.dex */
public enum SmartLoginOption {
None(0),
Enabled(1),
RequireConfirm(2);
private static final EnumSet<SmartLoginOption> ALL;
public static final Companion Companion = new Companion(null);
private final long value;
public static final EnumSet<SmartLoginOption> parseOptions(long j) {
return Companion.parseOptions(j);
}
public final long getValue() {
return this.value;
}
SmartLoginOption(long j) {
this.value = j;
}
static {
EnumSet<SmartLoginOption> allOf = EnumSet.allOf(SmartLoginOption.class);
Intrinsics.checkNotNullExpressionValue(allOf, "allOf(SmartLoginOption::class.java)");
ALL = allOf;
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
public final EnumSet<SmartLoginOption> parseOptions(long j) {
EnumSet<SmartLoginOption> result = EnumSet.noneOf(SmartLoginOption.class);
Iterator it = SmartLoginOption.ALL.iterator();
while (it.hasNext()) {
SmartLoginOption smartLoginOption = (SmartLoginOption) it.next();
if ((smartLoginOption.getValue() & j) != 0) {
result.add(smartLoginOption);
}
}
Intrinsics.checkNotNullExpressionValue(result, "result");
return result;
}
}
/* renamed from: values, reason: to resolve conflict with enum method */
public static SmartLoginOption[] valuesCustom() {
SmartLoginOption[] valuesCustom = values();
return (SmartLoginOption[]) Arrays.copyOf(valuesCustom, valuesCustom.length);
}
}

View File

@@ -0,0 +1,216 @@
package com.facebook.internal;
import android.net.Uri;
import com.facebook.LoggingBehavior;
import com.facebook.internal.FileLruCache;
import java.io.IOException;
import java.io.OutputStream;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.Reflection;
import kotlin.text.Charsets;
/* loaded from: classes2.dex */
public final class UrlRedirectCache {
public static final UrlRedirectCache INSTANCE = new UrlRedirectCache();
private static final String redirectContentTag;
private static final String tag;
private static FileLruCache urlRedirectFileLruCache;
private UrlRedirectCache() {
}
static {
String simpleName = Reflection.getOrCreateKotlinClass(UrlRedirectCache.class).getSimpleName();
if (simpleName == null) {
simpleName = "UrlRedirectCache";
}
tag = simpleName;
redirectContentTag = Intrinsics.stringPlus(simpleName, "_Redirect");
}
public static final synchronized FileLruCache getCache() throws IOException {
FileLruCache fileLruCache;
synchronized (UrlRedirectCache.class) {
try {
fileLruCache = urlRedirectFileLruCache;
if (fileLruCache == null) {
fileLruCache = new FileLruCache(tag, new FileLruCache.Limits());
}
urlRedirectFileLruCache = fileLruCache;
} catch (Throwable th) {
throw th;
}
}
return fileLruCache;
}
/* JADX WARN: Code restructure failed: missing block: B:24:0x005e, code lost:
if (kotlin.jvm.internal.Intrinsics.areEqual(r3, r10) == false) goto L23;
*/
/* JADX WARN: Code restructure failed: missing block: B:25:0x0060, code lost:
r5 = r6;
r6 = true;
*/
/* JADX WARN: Code restructure failed: missing block: B:33:0x0063, code lost:
com.facebook.internal.Logger.Companion.log(com.facebook.LoggingBehavior.CACHE, 6, com.facebook.internal.UrlRedirectCache.tag, "A loop detected in UrlRedirectCache");
*/
/* JADX WARN: Code restructure failed: missing block: B:34:0x006f, code lost:
com.facebook.internal.Utility.closeQuietly(r6);
*/
/* JADX WARN: Code restructure failed: missing block: B:35:0x0072, code lost:
return null;
*/
/* JADX WARN: Not initialized variable reg: 5, insn: 0x0083: MOVE (r0 I:??[OBJECT, ARRAY]) = (r5 I:??[OBJECT, ARRAY]), block:B:48:0x0083 */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public static final android.net.Uri getRedirectedUri(android.net.Uri r10) {
/*
r0 = 0
if (r10 != 0) goto L4
return r0
L4:
java.lang.String r10 = r10.toString()
java.lang.String r1 = "uri.toString()"
kotlin.jvm.internal.Intrinsics.checkNotNullExpressionValue(r10, r1)
java.util.HashSet r1 = new java.util.HashSet
r1.<init>()
r1.add(r10)
com.facebook.internal.FileLruCache r2 = getCache() // Catch: java.lang.Throwable -> L95 java.io.IOException -> L97
java.lang.String r3 = com.facebook.internal.UrlRedirectCache.redirectContentTag // Catch: java.lang.Throwable -> L95 java.io.IOException -> L97
java.io.InputStream r3 = r2.get(r10, r3) // Catch: java.lang.Throwable -> L95 java.io.IOException -> L97
r4 = 0
r5 = r0
r6 = r4
L22:
if (r3 == 0) goto L87
java.io.InputStreamReader r6 = new java.io.InputStreamReader // Catch: java.lang.Throwable -> L82 java.io.IOException -> L85
r6.<init>(r3) // Catch: java.lang.Throwable -> L82 java.io.IOException -> L85
r3 = 128(0x80, float:1.8E-43)
char[] r5 = new char[r3] // Catch: java.lang.Throwable -> L40 java.io.IOException -> L44
java.lang.StringBuilder r7 = new java.lang.StringBuilder // Catch: java.lang.Throwable -> L40 java.io.IOException -> L44
r7.<init>() // Catch: java.lang.Throwable -> L40 java.io.IOException -> L44
int r8 = r6.read(r5, r4, r3) // Catch: java.lang.Throwable -> L40 java.io.IOException -> L44
L36:
if (r8 <= 0) goto L47
r7.append(r5, r4, r8) // Catch: java.lang.Throwable -> L40 java.io.IOException -> L44
int r8 = r6.read(r5, r4, r3) // Catch: java.lang.Throwable -> L40 java.io.IOException -> L44
goto L36
L40:
r10 = move-exception
r0 = r6
goto Laf
L44:
r10 = move-exception
r5 = r6
goto L99
L47:
com.facebook.internal.Utility.closeQuietly(r6) // Catch: java.lang.Throwable -> L40 java.io.IOException -> L44
java.lang.String r3 = r7.toString() // Catch: java.lang.Throwable -> L40 java.io.IOException -> L44
java.lang.String r5 = "urlBuilder.toString()"
kotlin.jvm.internal.Intrinsics.checkNotNullExpressionValue(r3, r5) // Catch: java.lang.Throwable -> L40 java.io.IOException -> L44
boolean r5 = r1.contains(r3) // Catch: java.lang.Throwable -> L40 java.io.IOException -> L44
r7 = 1
if (r5 == 0) goto L73
boolean r1 = kotlin.jvm.internal.Intrinsics.areEqual(r3, r10) // Catch: java.lang.Throwable -> L40 java.io.IOException -> L44
if (r1 == 0) goto L63
r5 = r6
r6 = r7
goto L87
L63:
com.facebook.internal.Logger$Companion r10 = com.facebook.internal.Logger.Companion // Catch: java.lang.Throwable -> L40 java.io.IOException -> L44
com.facebook.LoggingBehavior r1 = com.facebook.LoggingBehavior.CACHE // Catch: java.lang.Throwable -> L40 java.io.IOException -> L44
java.lang.String r2 = com.facebook.internal.UrlRedirectCache.tag // Catch: java.lang.Throwable -> L40 java.io.IOException -> L44
java.lang.String r3 = "A loop detected in UrlRedirectCache"
r4 = 6
r10.log(r1, r4, r2, r3) // Catch: java.lang.Throwable -> L40 java.io.IOException -> L44
com.facebook.internal.Utility.closeQuietly(r6)
return r0
L73:
r1.add(r3) // Catch: java.lang.Throwable -> L40 java.io.IOException -> L44
java.lang.String r10 = com.facebook.internal.UrlRedirectCache.redirectContentTag // Catch: java.lang.Throwable -> L40 java.io.IOException -> L44
java.io.InputStream r10 = r2.get(r3, r10) // Catch: java.lang.Throwable -> L40 java.io.IOException -> L44
r5 = r6
r6 = r7
r9 = r3
r3 = r10
r10 = r9
goto L22
L82:
r10 = move-exception
r0 = r5
goto Laf
L85:
r10 = move-exception
goto L99
L87:
if (r6 == 0) goto L91
android.net.Uri r10 = android.net.Uri.parse(r10) // Catch: java.lang.Throwable -> L82 java.io.IOException -> L85
com.facebook.internal.Utility.closeQuietly(r5)
return r10
L91:
com.facebook.internal.Utility.closeQuietly(r5)
goto Lae
L95:
r10 = move-exception
goto Laf
L97:
r10 = move-exception
r5 = r0
L99:
com.facebook.internal.Logger$Companion r1 = com.facebook.internal.Logger.Companion // Catch: java.lang.Throwable -> L82
com.facebook.LoggingBehavior r2 = com.facebook.LoggingBehavior.CACHE // Catch: java.lang.Throwable -> L82
java.lang.String r3 = com.facebook.internal.UrlRedirectCache.tag // Catch: java.lang.Throwable -> L82
java.lang.String r4 = "IOException when accessing cache: "
java.lang.String r10 = r10.getMessage() // Catch: java.lang.Throwable -> L82
java.lang.String r10 = kotlin.jvm.internal.Intrinsics.stringPlus(r4, r10) // Catch: java.lang.Throwable -> L82
r4 = 4
r1.log(r2, r4, r3, r10) // Catch: java.lang.Throwable -> L82
goto L91
Lae:
return r0
Laf:
com.facebook.internal.Utility.closeQuietly(r0)
throw r10
*/
throw new UnsupportedOperationException("Method not decompiled: com.facebook.internal.UrlRedirectCache.getRedirectedUri(android.net.Uri):android.net.Uri");
}
public static final void cacheUriRedirect(Uri uri, Uri uri2) {
if (uri == null || uri2 == null) {
return;
}
OutputStream outputStream = null;
try {
try {
FileLruCache cache = getCache();
String uri3 = uri.toString();
Intrinsics.checkNotNullExpressionValue(uri3, "fromUri.toString()");
outputStream = cache.openPutStream(uri3, redirectContentTag);
String uri4 = uri2.toString();
Intrinsics.checkNotNullExpressionValue(uri4, "toUri.toString()");
byte[] bytes = uri4.getBytes(Charsets.UTF_8);
Intrinsics.checkNotNullExpressionValue(bytes, "(this as java.lang.String).getBytes(charset)");
outputStream.write(bytes);
} catch (IOException e) {
Logger.Companion.log(LoggingBehavior.CACHE, 4, tag, Intrinsics.stringPlus("IOException when accessing cache: ", e.getMessage()));
}
} finally {
Utility.closeQuietly(outputStream);
}
}
public static final void clearCache() {
try {
getCache().clearCache();
} catch (IOException e) {
Logger.Companion.log(LoggingBehavior.CACHE, 5, tag, Intrinsics.stringPlus("clearCache failed ", e.getMessage()));
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,273 @@
package com.facebook.internal;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.net.Uri;
import android.os.Looper;
import android.util.Log;
import com.facebook.FacebookException;
import com.facebook.FacebookSdk;
import com.facebook.FacebookSdkNotInitializedException;
import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.StringCompanionObject;
/* loaded from: classes2.dex */
public final class Validate {
private static final String CONTENT_PROVIDER_BASE = "com.facebook.app.FacebookContentProvider";
private static final String CONTENT_PROVIDER_NOT_FOUND_REASON = "A ContentProvider for this app was not set up in the AndroidManifest.xml, please add %s as a provider to your AndroidManifest.xml file. See https://developers.facebook.com/docs/sharing/android for more info.";
public static final String CUSTOM_TAB_REDIRECT_URI_PREFIX = "fbconnect://cct.";
private static final String FACEBOOK_ACTIVITY_NOT_FOUND_REASON = "FacebookActivity is not declared in the AndroidManifest.xml. If you are using the facebook-common module or dependent modules please add com.facebook.FacebookActivity to your AndroidManifest.xml file. See https://developers.facebook.com/docs/android/getting-started for more info.";
private static final String NO_INTERNET_PERMISSION_REASON = "No internet permissions granted for the app, please add <uses-permission android:name=\"android.permission.INTERNET\" /> to your AndroidManifest.xml.";
public static final Validate INSTANCE = new Validate();
private static final String TAG = Validate.class.getName();
private Validate() {
}
public static final void notNull(Object obj, String name) {
Intrinsics.checkNotNullParameter(name, "name");
if (obj != null) {
return;
}
throw new NullPointerException("Argument '" + name + "' cannot be null");
}
public static final <T> void notEmpty(Collection<? extends T> container, String name) {
Intrinsics.checkNotNullParameter(container, "container");
Intrinsics.checkNotNullParameter(name, "name");
if (!container.isEmpty()) {
return;
}
throw new IllegalArgumentException(("Container '" + name + "' cannot be empty").toString());
}
public static final <T> void containsNoNulls(Collection<? extends T> container, String name) {
Intrinsics.checkNotNullParameter(container, "container");
Intrinsics.checkNotNullParameter(name, "name");
Iterator<? extends T> it = container.iterator();
while (it.hasNext()) {
if (it.next() == null) {
throw new NullPointerException("Container '" + name + "' cannot contain null values");
}
}
}
public static final void containsNoNullOrEmpty(Collection<String> container, String name) {
Intrinsics.checkNotNullParameter(container, "container");
Intrinsics.checkNotNullParameter(name, "name");
for (String str : container) {
if (str == null) {
throw new NullPointerException("Container '" + name + "' cannot contain null values");
}
if (!(str.length() > 0)) {
throw new IllegalArgumentException(("Container '" + name + "' cannot contain empty values").toString());
}
}
}
public static final <T> void notEmptyAndContainsNoNulls(Collection<? extends T> container, String name) {
Intrinsics.checkNotNullParameter(container, "container");
Intrinsics.checkNotNullParameter(name, "name");
containsNoNulls(container, name);
notEmpty(container, name);
}
public static final void runningOnUiThread() {
if (!Intrinsics.areEqual(Looper.getMainLooper(), Looper.myLooper())) {
throw new FacebookException("This method should be called from the UI thread");
}
}
public static final String notNullOrEmpty(String str, String name) {
Intrinsics.checkNotNullParameter(name, "name");
if (str != null && str.length() > 0) {
return str;
}
throw new IllegalArgumentException(("Argument '" + name + "' cannot be null or empty").toString());
}
public static final void notEmpty(String arg, String name) {
Intrinsics.checkNotNullParameter(arg, "arg");
Intrinsics.checkNotNullParameter(name, "name");
if (arg.length() > 0) {
return;
}
throw new IllegalArgumentException(("Argument '" + name + "' cannot be empty").toString());
}
public static final void oneOf(Object obj, String name, Object... values) {
Intrinsics.checkNotNullParameter(name, "name");
Intrinsics.checkNotNullParameter(values, "values");
int length = values.length;
int i = 0;
while (i < length) {
Object obj2 = values[i];
i++;
if (Intrinsics.areEqual(obj2, obj)) {
return;
}
}
throw new IllegalArgumentException("Argument '" + name + "' was not one of the allowed values");
}
public static final void sdkInitialized() {
if (!FacebookSdk.isInitialized()) {
throw new FacebookSdkNotInitializedException("The SDK has not been initialized, make sure to call FacebookSdk.sdkInitialize() first.");
}
}
public static final String hasAppID() {
String applicationId = FacebookSdk.getApplicationId();
if (applicationId != null) {
return applicationId;
}
throw new IllegalStateException("No App ID found, please set the App ID.".toString());
}
public static final String hasClientToken() {
String clientToken = FacebookSdk.getClientToken();
if (clientToken != null) {
return clientToken;
}
throw new IllegalStateException("No Client Token found, please set the Client Token. Please follow https://developers.facebook.com/docs/android/getting-started/#client-access-token to get the token and fill it in AndroidManifest.xml".toString());
}
public static final void hasInternetPermissions(Context context) {
Intrinsics.checkNotNullParameter(context, "context");
hasInternetPermissions(context, true);
}
public static final void hasInternetPermissions(Context context, boolean z) {
Intrinsics.checkNotNullParameter(context, "context");
if (context.checkCallingOrSelfPermission("android.permission.INTERNET") == -1) {
if (!(!z)) {
throw new IllegalStateException(NO_INTERNET_PERMISSION_REASON.toString());
}
Log.w(TAG, NO_INTERNET_PERMISSION_REASON);
}
}
public static final boolean hasWiFiPermission(Context context) {
Intrinsics.checkNotNullParameter(context, "context");
return hasPermission(context, "android.permission.ACCESS_WIFI_STATE");
}
public static final boolean hasChangeWifiStatePermission(Context context) {
Intrinsics.checkNotNullParameter(context, "context");
return hasPermission(context, "android.permission.CHANGE_WIFI_STATE");
}
public static final boolean hasLocationPermission(Context context) {
Intrinsics.checkNotNullParameter(context, "context");
return hasPermission(context, "android.permission.ACCESS_COARSE_LOCATION") || hasPermission(context, "android.permission.ACCESS_FINE_LOCATION");
}
public static final boolean hasBluetoothPermission(Context context) {
Intrinsics.checkNotNullParameter(context, "context");
return hasPermission(context, "android.permission.BLUETOOTH") && hasPermission(context, "android.permission.BLUETOOTH_ADMIN");
}
public static final boolean hasPermission(Context context, String permission) {
Intrinsics.checkNotNullParameter(context, "context");
Intrinsics.checkNotNullParameter(permission, "permission");
return context.checkCallingOrSelfPermission(permission) == 0;
}
public static final void hasFacebookActivity(Context context) {
Intrinsics.checkNotNullParameter(context, "context");
hasFacebookActivity(context, true);
}
/* JADX WARN: Removed duplicated region for block: B:14:0x0031 A[ORIG_RETURN, RETURN] */
/* JADX WARN: Removed duplicated region for block: B:7:0x001b */
@android.annotation.SuppressLint({"WrongConstant"})
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public static final void hasFacebookActivity(android.content.Context r4, boolean r5) {
/*
java.lang.String r0 = "context"
kotlin.jvm.internal.Intrinsics.checkNotNullParameter(r4, r0)
android.content.pm.PackageManager r0 = r4.getPackageManager()
r1 = 1
if (r0 == 0) goto L18
android.content.ComponentName r2 = new android.content.ComponentName
java.lang.String r3 = "com.facebook.FacebookActivity"
r2.<init>(r4, r3)
android.content.pm.ActivityInfo r4 = r0.getActivityInfo(r2, r1) // Catch: android.content.pm.PackageManager.NameNotFoundException -> L18
goto L19
L18:
r4 = 0
L19:
if (r4 != 0) goto L31
r4 = r5 ^ 1
java.lang.String r5 = "FacebookActivity is not declared in the AndroidManifest.xml. If you are using the facebook-common module or dependent modules please add com.facebook.FacebookActivity to your AndroidManifest.xml file. See https://developers.facebook.com/docs/android/getting-started for more info."
if (r4 == 0) goto L27
java.lang.String r4 = com.facebook.internal.Validate.TAG
android.util.Log.w(r4, r5)
goto L31
L27:
java.lang.IllegalStateException r4 = new java.lang.IllegalStateException
java.lang.String r5 = r5.toString()
r4.<init>(r5)
throw r4
L31:
return
*/
throw new UnsupportedOperationException("Method not decompiled: com.facebook.internal.Validate.hasFacebookActivity(android.content.Context, boolean):void");
}
public static final boolean hasCustomTabRedirectActivity(Context context, String redirectURI) {
List<ResolveInfo> list;
Intrinsics.checkNotNullParameter(context, "context");
Intrinsics.checkNotNullParameter(redirectURI, "redirectURI");
PackageManager packageManager = context.getPackageManager();
if (packageManager != null) {
Intent intent = new Intent();
intent.setAction("android.intent.action.VIEW");
intent.addCategory("android.intent.category.DEFAULT");
intent.addCategory("android.intent.category.BROWSABLE");
intent.setData(Uri.parse(redirectURI));
list = packageManager.queryIntentActivities(intent, 64);
} else {
list = null;
}
if (list == null) {
return false;
}
Iterator<ResolveInfo> it = list.iterator();
boolean z = false;
while (it.hasNext()) {
ActivityInfo activityInfo = it.next().activityInfo;
if (!Intrinsics.areEqual(activityInfo.name, "com.facebook.CustomTabActivity") || !Intrinsics.areEqual(activityInfo.packageName, context.getPackageName())) {
return false;
}
z = true;
}
return z;
}
public static final void hasContentProvider(Context context) {
Intrinsics.checkNotNullParameter(context, "context");
String hasAppID = hasAppID();
PackageManager packageManager = context.getPackageManager();
if (packageManager != null) {
String stringPlus = Intrinsics.stringPlus(CONTENT_PROVIDER_BASE, hasAppID);
if (packageManager.resolveContentProvider(stringPlus, 0) != null) {
return;
}
StringCompanionObject stringCompanionObject = StringCompanionObject.INSTANCE;
String format = String.format(CONTENT_PROVIDER_NOT_FOUND_REASON, Arrays.copyOf(new Object[]{stringPlus}, 1));
Intrinsics.checkNotNullExpressionValue(format, "java.lang.String.format(format, *args)");
throw new IllegalStateException(format.toString());
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,301 @@
package com.facebook.internal;
import com.facebook.FacebookException;
import com.facebook.FacebookSdk;
import com.facebook.internal.WorkQueue;
import java.util.concurrent.Executor;
import java.util.concurrent.locks.ReentrantLock;
import kotlin.Unit;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes2.dex */
public final class WorkQueue {
public static final Companion Companion = new Companion(null);
public static final int DEFAULT_MAX_CONCURRENT = 8;
private final Executor executor;
private final int maxConcurrent;
private WorkNode pendingJobs;
private int runningCount;
private WorkNode runningJobs;
private final ReentrantLock workLock;
public interface WorkItem {
boolean cancel();
boolean isRunning();
void moveToFront();
}
/* JADX WARN: Multi-variable type inference failed */
public WorkQueue() {
this(0, null, 3, 0 == true ? 1 : 0);
}
/* JADX WARN: Multi-variable type inference failed */
public WorkQueue(int i) {
this(i, null, 2, 0 == true ? 1 : 0);
}
public final WorkItem addActiveWorkItem(Runnable callback) {
Intrinsics.checkNotNullParameter(callback, "callback");
return addActiveWorkItem$default(this, callback, false, 2, null);
}
public WorkQueue(int i, Executor executor) {
Intrinsics.checkNotNullParameter(executor, "executor");
this.maxConcurrent = i;
this.executor = executor;
this.workLock = new ReentrantLock();
}
public /* synthetic */ WorkQueue(int i, Executor executor, int i2, DefaultConstructorMarker defaultConstructorMarker) {
this((i2 & 1) != 0 ? 8 : i, (i2 & 2) != 0 ? FacebookSdk.getExecutor() : executor);
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: assert, reason: not valid java name */
public final void m588assert(boolean z) {
if (!z) {
throw new FacebookException("Validation failed");
}
}
}
public static /* synthetic */ WorkItem addActiveWorkItem$default(WorkQueue workQueue, Runnable runnable, boolean z, int i, Object obj) {
if ((i & 2) != 0) {
z = true;
}
return workQueue.addActiveWorkItem(runnable, z);
}
public final WorkItem addActiveWorkItem(Runnable callback, boolean z) {
Intrinsics.checkNotNullParameter(callback, "callback");
WorkNode workNode = new WorkNode(this, callback);
ReentrantLock reentrantLock = this.workLock;
reentrantLock.lock();
try {
this.pendingJobs = workNode.addToList(this.pendingJobs, z);
Unit unit = Unit.INSTANCE;
reentrantLock.unlock();
startItem();
return workNode;
} catch (Throwable th) {
reentrantLock.unlock();
throw th;
}
}
public final void validate() {
ReentrantLock reentrantLock = this.workLock;
reentrantLock.lock();
try {
WorkNode workNode = this.runningJobs;
int i = 0;
if (workNode != null) {
while (workNode != null) {
workNode.verify(true);
i++;
workNode = workNode.getNext();
if (workNode == this.runningJobs) {
}
}
throw new IllegalStateException("Required value was null.".toString());
}
Companion.m588assert(this.runningCount == i);
Unit unit = Unit.INSTANCE;
reentrantLock.unlock();
} catch (Throwable th) {
reentrantLock.unlock();
throw th;
}
}
private final void startItem() {
finishItemAndStartNew(null);
}
private final void finishItemAndStartNew(WorkNode workNode) {
WorkNode workNode2;
this.workLock.lock();
if (workNode != null) {
this.runningJobs = workNode.removeFromList(this.runningJobs);
this.runningCount--;
}
if (this.runningCount < this.maxConcurrent) {
workNode2 = this.pendingJobs;
if (workNode2 != null) {
this.pendingJobs = workNode2.removeFromList(workNode2);
this.runningJobs = workNode2.addToList(this.runningJobs, false);
this.runningCount++;
workNode2.setRunning(true);
}
} else {
workNode2 = null;
}
this.workLock.unlock();
if (workNode2 != null) {
execute(workNode2);
}
}
private final void execute(final WorkNode workNode) {
this.executor.execute(new Runnable() { // from class: com.facebook.internal.WorkQueue$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
WorkQueue.m587execute$lambda2(WorkQueue.WorkNode.this, this);
}
});
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: execute$lambda-2, reason: not valid java name */
public static final void m587execute$lambda2(WorkNode node, WorkQueue this$0) {
Intrinsics.checkNotNullParameter(node, "$node");
Intrinsics.checkNotNullParameter(this$0, "this$0");
try {
node.getCallback().run();
} finally {
this$0.finishItemAndStartNew(node);
}
}
public final class WorkNode implements WorkItem {
private final Runnable callback;
private boolean isRunning;
private WorkNode next;
private WorkNode prev;
final /* synthetic */ WorkQueue this$0;
public final Runnable getCallback() {
return this.callback;
}
public final WorkNode getNext() {
return this.next;
}
@Override // com.facebook.internal.WorkQueue.WorkItem
public boolean isRunning() {
return this.isRunning;
}
public void setRunning(boolean z) {
this.isRunning = z;
}
public WorkNode(WorkQueue this$0, Runnable callback) {
Intrinsics.checkNotNullParameter(this$0, "this$0");
Intrinsics.checkNotNullParameter(callback, "callback");
this.this$0 = this$0;
this.callback = callback;
}
@Override // com.facebook.internal.WorkQueue.WorkItem
public boolean cancel() {
ReentrantLock reentrantLock = this.this$0.workLock;
WorkQueue workQueue = this.this$0;
reentrantLock.lock();
try {
if (!isRunning()) {
workQueue.pendingJobs = removeFromList(workQueue.pendingJobs);
reentrantLock.unlock();
return true;
}
Unit unit = Unit.INSTANCE;
reentrantLock.unlock();
return false;
} catch (Throwable th) {
reentrantLock.unlock();
throw th;
}
}
@Override // com.facebook.internal.WorkQueue.WorkItem
public void moveToFront() {
ReentrantLock reentrantLock = this.this$0.workLock;
WorkQueue workQueue = this.this$0;
reentrantLock.lock();
try {
if (!isRunning()) {
workQueue.pendingJobs = removeFromList(workQueue.pendingJobs);
workQueue.pendingJobs = addToList(workQueue.pendingJobs, true);
}
Unit unit = Unit.INSTANCE;
reentrantLock.unlock();
} catch (Throwable th) {
reentrantLock.unlock();
throw th;
}
}
public final WorkNode addToList(WorkNode workNode, boolean z) {
Companion companion = WorkQueue.Companion;
companion.m588assert(this.next == null);
companion.m588assert(this.prev == null);
if (workNode == null) {
this.prev = this;
this.next = this;
workNode = this;
} else {
this.next = workNode;
WorkNode workNode2 = workNode.prev;
this.prev = workNode2;
if (workNode2 != null) {
workNode2.next = this;
}
WorkNode workNode3 = this.next;
if (workNode3 != null) {
workNode3.prev = workNode2 == null ? null : workNode2.next;
}
}
return z ? this : workNode;
}
public final WorkNode removeFromList(WorkNode workNode) {
Companion companion = WorkQueue.Companion;
companion.m588assert(this.next != null);
companion.m588assert(this.prev != null);
if (workNode == this && (workNode = this.next) == this) {
workNode = null;
}
WorkNode workNode2 = this.next;
if (workNode2 != null) {
workNode2.prev = this.prev;
}
WorkNode workNode3 = this.prev;
if (workNode3 != null) {
workNode3.next = workNode2;
}
this.prev = null;
this.next = null;
return workNode;
}
public final void verify(boolean z) {
WorkNode workNode;
WorkNode workNode2;
Companion companion = WorkQueue.Companion;
WorkNode workNode3 = this.prev;
if (workNode3 == null || (workNode = workNode3.next) == null) {
workNode = this;
}
companion.m588assert(workNode == this);
WorkNode workNode4 = this.next;
if (workNode4 == null || (workNode2 = workNode4.prev) == null) {
workNode2 = this;
}
companion.m588assert(workNode2 == this);
companion.m588assert(isRunning() == z);
}
}
}

View File

@@ -0,0 +1,72 @@
package com.facebook.internal.gatekeeper;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes2.dex */
public final class GateKeeper {
private final String name;
private final boolean value;
public static /* synthetic */ GateKeeper copy$default(GateKeeper gateKeeper, String str, boolean z, int i, Object obj) {
if ((i & 1) != 0) {
str = gateKeeper.name;
}
if ((i & 2) != 0) {
z = gateKeeper.value;
}
return gateKeeper.copy(str, z);
}
public final String component1() {
return this.name;
}
public final boolean component2() {
return this.value;
}
public final GateKeeper copy(String name, boolean z) {
Intrinsics.checkNotNullParameter(name, "name");
return new GateKeeper(name, z);
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof GateKeeper)) {
return false;
}
GateKeeper gateKeeper = (GateKeeper) obj;
return Intrinsics.areEqual(this.name, gateKeeper.name) && this.value == gateKeeper.value;
}
public final String getName() {
return this.name;
}
public final boolean getValue() {
return this.value;
}
/* JADX WARN: Multi-variable type inference failed */
public int hashCode() {
int hashCode = this.name.hashCode() * 31;
boolean z = this.value;
int i = z;
if (z != 0) {
i = 1;
}
return hashCode + i;
}
public String toString() {
return "GateKeeper(name=" + this.name + ", value=" + this.value + ')';
}
public GateKeeper(String name, boolean z) {
Intrinsics.checkNotNullParameter(name, "name");
this.name = name;
this.value = z;
}
}

View File

@@ -0,0 +1,128 @@
package com.facebook.internal.gatekeeper;
import com.facebook.FacebookSdk;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes2.dex */
public final class GateKeeperRuntimeCache {
private final ConcurrentHashMap<String, ConcurrentHashMap<String, GateKeeper>> gateKeepers = new ConcurrentHashMap<>();
public static /* synthetic */ void setGateKeepers$default(GateKeeperRuntimeCache gateKeeperRuntimeCache, String str, List list, int i, Object obj) {
if ((i & 1) != 0) {
str = FacebookSdk.getApplicationId();
}
gateKeeperRuntimeCache.setGateKeepers(str, list);
}
public final void setGateKeepers(String appId, List<GateKeeper> gateKeeperList) {
Intrinsics.checkNotNullParameter(appId, "appId");
Intrinsics.checkNotNullParameter(gateKeeperList, "gateKeeperList");
ConcurrentHashMap<String, GateKeeper> concurrentHashMap = new ConcurrentHashMap<>();
for (GateKeeper gateKeeper : gateKeeperList) {
concurrentHashMap.put(gateKeeper.getName(), gateKeeper);
}
this.gateKeepers.put(appId, concurrentHashMap);
}
public static /* synthetic */ List dumpGateKeepers$default(GateKeeperRuntimeCache gateKeeperRuntimeCache, String str, int i, Object obj) {
if ((i & 1) != 0) {
str = FacebookSdk.getApplicationId();
}
return gateKeeperRuntimeCache.dumpGateKeepers(str);
}
public final List<GateKeeper> dumpGateKeepers(String appId) {
Intrinsics.checkNotNullParameter(appId, "appId");
ConcurrentHashMap<String, GateKeeper> concurrentHashMap = this.gateKeepers.get(appId);
if (concurrentHashMap == null) {
return null;
}
ArrayList arrayList = new ArrayList(concurrentHashMap.size());
Iterator<Map.Entry<String, GateKeeper>> it = concurrentHashMap.entrySet().iterator();
while (it.hasNext()) {
arrayList.add(it.next().getValue());
}
return arrayList;
}
public static /* synthetic */ boolean getGateKeeperValue$default(GateKeeperRuntimeCache gateKeeperRuntimeCache, String str, String str2, boolean z, int i, Object obj) {
if ((i & 1) != 0) {
str = FacebookSdk.getApplicationId();
}
return gateKeeperRuntimeCache.getGateKeeperValue(str, str2, z);
}
public final boolean getGateKeeperValue(String appId, String name, boolean z) {
Intrinsics.checkNotNullParameter(appId, "appId");
Intrinsics.checkNotNullParameter(name, "name");
GateKeeper gateKeeper = getGateKeeper(appId, name);
return gateKeeper == null ? z : gateKeeper.getValue();
}
public static /* synthetic */ void setGateKeeperValue$default(GateKeeperRuntimeCache gateKeeperRuntimeCache, String str, String str2, boolean z, int i, Object obj) {
if ((i & 1) != 0) {
str = FacebookSdk.getApplicationId();
}
gateKeeperRuntimeCache.setGateKeeperValue(str, str2, z);
}
public final void setGateKeeperValue(String appId, String name, boolean z) {
Intrinsics.checkNotNullParameter(appId, "appId");
Intrinsics.checkNotNullParameter(name, "name");
setGateKeeper(appId, new GateKeeper(name, z));
}
public static /* synthetic */ GateKeeper getGateKeeper$default(GateKeeperRuntimeCache gateKeeperRuntimeCache, String str, String str2, int i, Object obj) {
if ((i & 1) != 0) {
str = FacebookSdk.getApplicationId();
}
return gateKeeperRuntimeCache.getGateKeeper(str, str2);
}
public final GateKeeper getGateKeeper(String appId, String name) {
Intrinsics.checkNotNullParameter(appId, "appId");
Intrinsics.checkNotNullParameter(name, "name");
ConcurrentHashMap<String, GateKeeper> concurrentHashMap = this.gateKeepers.get(appId);
if (concurrentHashMap == null) {
return null;
}
return concurrentHashMap.get(name);
}
public static /* synthetic */ void setGateKeeper$default(GateKeeperRuntimeCache gateKeeperRuntimeCache, String str, GateKeeper gateKeeper, int i, Object obj) {
if ((i & 1) != 0) {
str = FacebookSdk.getApplicationId();
}
gateKeeperRuntimeCache.setGateKeeper(str, gateKeeper);
}
public final void setGateKeeper(String appId, GateKeeper gateKeeper) {
Intrinsics.checkNotNullParameter(appId, "appId");
Intrinsics.checkNotNullParameter(gateKeeper, "gateKeeper");
if (!this.gateKeepers.containsKey(appId)) {
this.gateKeepers.put(appId, new ConcurrentHashMap<>());
}
ConcurrentHashMap<String, GateKeeper> concurrentHashMap = this.gateKeepers.get(appId);
if (concurrentHashMap == null) {
return;
}
concurrentHashMap.put(gateKeeper.getName(), gateKeeper);
}
public static /* synthetic */ void resetCache$default(GateKeeperRuntimeCache gateKeeperRuntimeCache, String str, int i, Object obj) {
if ((i & 1) != 0) {
str = FacebookSdk.getApplicationId();
}
gateKeeperRuntimeCache.resetCache(str);
}
public final void resetCache(String appId) {
Intrinsics.checkNotNullParameter(appId, "appId");
this.gateKeepers.remove(appId);
}
}

View File

@@ -0,0 +1,5 @@
package com.facebook.internal.gatekeeper;
/* loaded from: classes2.dex */
public final class GateKeeperRuntimeCacheKt {
}

View File

@@ -0,0 +1,119 @@
package com.facebook.internal.instrument;
import androidx.annotation.RestrictTo;
import androidx.annotation.VisibleForTesting;
import com.facebook.FacebookSdk;
import com.facebook.GraphRequest;
import com.facebook.GraphRequestBatch;
import com.facebook.GraphResponse;
import com.facebook.internal.FeatureManager;
import com.facebook.internal.Utility;
import com.facebook.internal.instrument.InstrumentData;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.StringCompanionObject;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
/* loaded from: classes2.dex */
public final class ExceptionAnalyzer {
public static final ExceptionAnalyzer INSTANCE = new ExceptionAnalyzer();
private static boolean enabled;
@VisibleForTesting(otherwise = 2)
public static final boolean isDebug$facebook_core_release() {
return false;
}
private ExceptionAnalyzer() {
}
public static final void enable() {
enabled = true;
if (FacebookSdk.getAutoLogAppEventsEnabled()) {
INSTANCE.sendExceptionAnalysisReports$facebook_core_release();
}
}
public static final void execute(Throwable th) {
if (!enabled || isDebug$facebook_core_release() || th == null) {
return;
}
HashSet hashSet = new HashSet();
StackTraceElement[] stackTrace = th.getStackTrace();
Intrinsics.checkNotNullExpressionValue(stackTrace, "e.stackTrace");
for (StackTraceElement stackTraceElement : stackTrace) {
FeatureManager featureManager = FeatureManager.INSTANCE;
String className = stackTraceElement.getClassName();
Intrinsics.checkNotNullExpressionValue(className, "it.className");
FeatureManager.Feature feature = FeatureManager.getFeature(className);
if (feature != FeatureManager.Feature.Unknown) {
FeatureManager.disableFeature(feature);
hashSet.add(feature.toString());
}
}
if (FacebookSdk.getAutoLogAppEventsEnabled() && (!hashSet.isEmpty())) {
InstrumentData.Builder builder = InstrumentData.Builder.INSTANCE;
InstrumentData.Builder.build(new JSONArray((Collection) hashSet)).save();
}
}
@VisibleForTesting(otherwise = 2)
public final void sendExceptionAnalysisReports$facebook_core_release() {
if (Utility.isDataProcessingRestricted()) {
return;
}
File[] listExceptionAnalysisReportFiles = InstrumentUtility.listExceptionAnalysisReportFiles();
ArrayList arrayList = new ArrayList();
int length = listExceptionAnalysisReportFiles.length;
int i = 0;
while (i < length) {
File file = listExceptionAnalysisReportFiles[i];
i++;
final InstrumentData load = InstrumentData.Builder.load(file);
if (load.isValid()) {
JSONObject jSONObject = new JSONObject();
try {
jSONObject.put("crash_shield", load.toString());
GraphRequest.Companion companion = GraphRequest.Companion;
StringCompanionObject stringCompanionObject = StringCompanionObject.INSTANCE;
String format = String.format("%s/instruments", Arrays.copyOf(new Object[]{FacebookSdk.getApplicationId()}, 1));
Intrinsics.checkNotNullExpressionValue(format, "java.lang.String.format(format, *args)");
arrayList.add(companion.newPostRequest(null, format, jSONObject, new GraphRequest.Callback() { // from class: com.facebook.internal.instrument.ExceptionAnalyzer$$ExternalSyntheticLambda0
@Override // com.facebook.GraphRequest.Callback
public final void onCompleted(GraphResponse graphResponse) {
ExceptionAnalyzer.m590sendExceptionAnalysisReports$lambda1(InstrumentData.this, graphResponse);
}
}));
} catch (JSONException unused) {
}
}
}
if (arrayList.isEmpty()) {
return;
}
new GraphRequestBatch(arrayList).executeAsync();
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: sendExceptionAnalysisReports$lambda-1, reason: not valid java name */
public static final void m590sendExceptionAnalysisReports$lambda1(InstrumentData instrumentData, GraphResponse response) {
Intrinsics.checkNotNullParameter(instrumentData, "$instrumentData");
Intrinsics.checkNotNullParameter(response, "response");
try {
if (response.getError() == null) {
JSONObject jsonObject = response.getJsonObject();
if (Intrinsics.areEqual(jsonObject == null ? null : Boolean.valueOf(jsonObject.getBoolean("success")), Boolean.TRUE)) {
instrumentData.clear();
}
}
} catch (JSONException unused) {
}
}
}

View File

@@ -0,0 +1,334 @@
package com.facebook.internal.instrument;
import android.os.Build;
import androidx.annotation.RestrictTo;
import com.facebook.internal.Utility;
import java.io.File;
import java.util.Arrays;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.StringsKt__StringsJVMKt;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
/* loaded from: classes2.dex */
public final class InstrumentData {
public static final Companion Companion = new Companion(null);
private static final String PARAM_APP_VERSION = "app_version";
private static final String PARAM_CALLSTACK = "callstack";
private static final String PARAM_DEVICE_MODEL = "device_model";
private static final String PARAM_DEVICE_OS = "device_os_version";
private static final String PARAM_FEATURE_NAMES = "feature_names";
private static final String PARAM_REASON = "reason";
private static final String PARAM_TIMESTAMP = "timestamp";
private static final String PARAM_TYPE = "type";
private static final String UNKNOWN = "Unknown";
private String appVersion;
private String cause;
private JSONArray featureNames;
private String filename;
private String stackTrace;
private Long timestamp;
private Type type;
public /* synthetic */ class WhenMappings {
public static final /* synthetic */ int[] $EnumSwitchMapping$0;
static {
int[] iArr = new int[Type.valuesCustom().length];
iArr[Type.Analysis.ordinal()] = 1;
iArr[Type.AnrReport.ordinal()] = 2;
iArr[Type.CrashReport.ordinal()] = 3;
iArr[Type.CrashShield.ordinal()] = 4;
iArr[Type.ThreadCheck.ordinal()] = 5;
$EnumSwitchMapping$0 = iArr;
}
}
public /* synthetic */ InstrumentData(File file, DefaultConstructorMarker defaultConstructorMarker) {
this(file);
}
public /* synthetic */ InstrumentData(String str, String str2, DefaultConstructorMarker defaultConstructorMarker) {
this(str, str2);
}
public /* synthetic */ InstrumentData(Throwable th, Type type, DefaultConstructorMarker defaultConstructorMarker) {
this(th, type);
}
public /* synthetic */ InstrumentData(JSONArray jSONArray, DefaultConstructorMarker defaultConstructorMarker) {
this(jSONArray);
}
public enum Type {
Unknown,
Analysis,
AnrReport,
CrashReport,
CrashShield,
ThreadCheck;
public /* synthetic */ class WhenMappings {
public static final /* synthetic */ int[] $EnumSwitchMapping$0;
static {
int[] iArr = new int[Type.valuesCustom().length];
iArr[Type.Analysis.ordinal()] = 1;
iArr[Type.AnrReport.ordinal()] = 2;
iArr[Type.CrashReport.ordinal()] = 3;
iArr[Type.CrashShield.ordinal()] = 4;
iArr[Type.ThreadCheck.ordinal()] = 5;
$EnumSwitchMapping$0 = iArr;
}
}
@Override // java.lang.Enum
public String toString() {
int i = WhenMappings.$EnumSwitchMapping$0[ordinal()];
return i != 1 ? i != 2 ? i != 3 ? i != 4 ? i != 5 ? "Unknown" : "ThreadCheck" : "CrashShield" : "CrashReport" : "AnrReport" : "Analysis";
}
public final String getLogPrefix() {
int i = WhenMappings.$EnumSwitchMapping$0[ordinal()];
return i != 1 ? i != 2 ? i != 3 ? i != 4 ? i != 5 ? "Unknown" : InstrumentUtility.THREAD_CHECK_PREFIX : InstrumentUtility.CRASH_SHIELD_PREFIX : InstrumentUtility.CRASH_REPORT_PREFIX : InstrumentUtility.ANR_REPORT_PREFIX : InstrumentUtility.ANALYSIS_REPORT_PREFIX;
}
/* renamed from: values, reason: to resolve conflict with enum method */
public static Type[] valuesCustom() {
Type[] valuesCustom = values();
return (Type[]) Arrays.copyOf(valuesCustom, valuesCustom.length);
}
}
private InstrumentData(JSONArray jSONArray) {
this.type = Type.Analysis;
this.timestamp = Long.valueOf(System.currentTimeMillis() / 1000);
this.featureNames = jSONArray;
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append(InstrumentUtility.ANALYSIS_REPORT_PREFIX);
stringBuffer.append(String.valueOf(this.timestamp));
stringBuffer.append(".json");
String stringBuffer2 = stringBuffer.toString();
Intrinsics.checkNotNullExpressionValue(stringBuffer2, "StringBuffer()\n .append(InstrumentUtility.ANALYSIS_REPORT_PREFIX)\n .append(timestamp.toString())\n .append(\".json\")\n .toString()");
this.filename = stringBuffer2;
}
private InstrumentData(Throwable th, Type type) {
this.type = type;
this.appVersion = Utility.getAppVersion();
this.cause = InstrumentUtility.getCause(th);
this.stackTrace = InstrumentUtility.getStackTrace(th);
this.timestamp = Long.valueOf(System.currentTimeMillis() / 1000);
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append(type.getLogPrefix());
stringBuffer.append(String.valueOf(this.timestamp));
stringBuffer.append(".json");
String stringBuffer2 = stringBuffer.toString();
Intrinsics.checkNotNullExpressionValue(stringBuffer2, "StringBuffer().append(t.logPrefix).append(timestamp.toString()).append(\".json\").toString()");
this.filename = stringBuffer2;
}
private InstrumentData(String str, String str2) {
this.type = Type.AnrReport;
this.appVersion = Utility.getAppVersion();
this.cause = str;
this.stackTrace = str2;
this.timestamp = Long.valueOf(System.currentTimeMillis() / 1000);
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append(InstrumentUtility.ANR_REPORT_PREFIX);
stringBuffer.append(String.valueOf(this.timestamp));
stringBuffer.append(".json");
String stringBuffer2 = stringBuffer.toString();
Intrinsics.checkNotNullExpressionValue(stringBuffer2, "StringBuffer()\n .append(InstrumentUtility.ANR_REPORT_PREFIX)\n .append(timestamp.toString())\n .append(\".json\")\n .toString()");
this.filename = stringBuffer2;
}
private InstrumentData(File file) {
String name = file.getName();
Intrinsics.checkNotNullExpressionValue(name, "file.name");
this.filename = name;
this.type = Companion.getType(name);
InstrumentUtility instrumentUtility = InstrumentUtility.INSTANCE;
JSONObject readFile = InstrumentUtility.readFile(this.filename, true);
if (readFile != null) {
this.timestamp = Long.valueOf(readFile.optLong("timestamp", 0L));
this.appVersion = readFile.optString(PARAM_APP_VERSION, null);
this.cause = readFile.optString("reason", null);
this.stackTrace = readFile.optString(PARAM_CALLSTACK, null);
this.featureNames = readFile.optJSONArray(PARAM_FEATURE_NAMES);
}
}
public final int compareTo(InstrumentData data) {
Intrinsics.checkNotNullParameter(data, "data");
Long l = this.timestamp;
if (l == null) {
return -1;
}
long longValue = l.longValue();
Long l2 = data.timestamp;
if (l2 == null) {
return 1;
}
return Intrinsics.compare(l2.longValue(), longValue);
}
public final boolean isValid() {
Type type = this.type;
int i = type == null ? -1 : WhenMappings.$EnumSwitchMapping$0[type.ordinal()];
if (i != 1) {
if (i != 2) {
if ((i != 3 && i != 4 && i != 5) || this.stackTrace == null || this.timestamp == null) {
return false;
}
} else if (this.stackTrace == null || this.cause == null || this.timestamp == null) {
return false;
}
} else if (this.featureNames == null || this.timestamp == null) {
return false;
}
return true;
}
public final void save() {
if (isValid()) {
InstrumentUtility instrumentUtility = InstrumentUtility.INSTANCE;
InstrumentUtility.writeFile(this.filename, toString());
}
}
public final void clear() {
InstrumentUtility instrumentUtility = InstrumentUtility.INSTANCE;
InstrumentUtility.deleteFile(this.filename);
}
public String toString() {
JSONObject parameters = getParameters();
if (parameters == null) {
String jSONObject = new JSONObject().toString();
Intrinsics.checkNotNullExpressionValue(jSONObject, "JSONObject().toString()");
return jSONObject;
}
String jSONObject2 = parameters.toString();
Intrinsics.checkNotNullExpressionValue(jSONObject2, "params.toString()");
return jSONObject2;
}
private final JSONObject getParameters() {
Type type = this.type;
int i = type == null ? -1 : WhenMappings.$EnumSwitchMapping$0[type.ordinal()];
if (i == 1) {
return getAnalysisReportParameters();
}
if (i == 2 || i == 3 || i == 4 || i == 5) {
return getExceptionReportParameters();
}
return null;
}
private final JSONObject getAnalysisReportParameters() {
JSONObject jSONObject = new JSONObject();
try {
JSONArray jSONArray = this.featureNames;
if (jSONArray != null) {
jSONObject.put(PARAM_FEATURE_NAMES, jSONArray);
}
Long l = this.timestamp;
if (l != null) {
jSONObject.put("timestamp", l);
}
return jSONObject;
} catch (JSONException unused) {
return null;
}
}
private final JSONObject getExceptionReportParameters() {
JSONObject jSONObject = new JSONObject();
try {
jSONObject.put(PARAM_DEVICE_OS, Build.VERSION.RELEASE);
jSONObject.put(PARAM_DEVICE_MODEL, Build.MODEL);
String str = this.appVersion;
if (str != null) {
jSONObject.put(PARAM_APP_VERSION, str);
}
Long l = this.timestamp;
if (l != null) {
jSONObject.put("timestamp", l);
}
String str2 = this.cause;
if (str2 != null) {
jSONObject.put("reason", str2);
}
String str3 = this.stackTrace;
if (str3 != null) {
jSONObject.put(PARAM_CALLSTACK, str3);
}
Type type = this.type;
if (type != null) {
jSONObject.put("type", type);
}
return jSONObject;
} catch (JSONException unused) {
return null;
}
}
public static final class Builder {
public static final Builder INSTANCE = new Builder();
private Builder() {
}
public static final InstrumentData load(File file) {
Intrinsics.checkNotNullParameter(file, "file");
return new InstrumentData(file, (DefaultConstructorMarker) null);
}
public static final InstrumentData build(Throwable th, Type t) {
Intrinsics.checkNotNullParameter(t, "t");
return new InstrumentData(th, t, (DefaultConstructorMarker) null);
}
public static final InstrumentData build(JSONArray features) {
Intrinsics.checkNotNullParameter(features, "features");
return new InstrumentData(features, (DefaultConstructorMarker) null);
}
public static final InstrumentData build(String str, String str2) {
return new InstrumentData(str, str2, (DefaultConstructorMarker) null);
}
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
/* JADX INFO: Access modifiers changed from: private */
public final Type getType(String str) {
if (StringsKt__StringsJVMKt.startsWith$default(str, InstrumentUtility.CRASH_REPORT_PREFIX, false, 2, null)) {
return Type.CrashReport;
}
if (StringsKt__StringsJVMKt.startsWith$default(str, InstrumentUtility.CRASH_SHIELD_PREFIX, false, 2, null)) {
return Type.CrashShield;
}
if (StringsKt__StringsJVMKt.startsWith$default(str, InstrumentUtility.THREAD_CHECK_PREFIX, false, 2, null)) {
return Type.ThreadCheck;
}
if (StringsKt__StringsJVMKt.startsWith$default(str, InstrumentUtility.ANALYSIS_REPORT_PREFIX, false, 2, null)) {
return Type.Analysis;
}
if (StringsKt__StringsJVMKt.startsWith$default(str, InstrumentUtility.ANR_REPORT_PREFIX, false, 2, null)) {
return Type.AnrReport;
}
return Type.Unknown;
}
}
}

View File

@@ -0,0 +1,75 @@
package com.facebook.internal.instrument;
import androidx.annotation.RestrictTo;
import com.facebook.FacebookSdk;
import com.facebook.internal.FeatureManager;
import com.facebook.internal.instrument.anrreport.ANRHandler;
import com.facebook.internal.instrument.crashreport.CrashHandler;
import com.facebook.internal.instrument.crashshield.CrashShieldHandler;
import com.facebook.internal.instrument.errorreport.ErrorReportHandler;
import com.facebook.internal.instrument.threadcheck.ThreadCheckHandler;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
/* loaded from: classes2.dex */
public final class InstrumentManager {
public static final InstrumentManager INSTANCE = new InstrumentManager();
private InstrumentManager() {
}
public static final void start() {
if (FacebookSdk.getAutoLogAppEventsEnabled()) {
FeatureManager featureManager = FeatureManager.INSTANCE;
FeatureManager.checkFeature(FeatureManager.Feature.CrashReport, new FeatureManager.Callback() { // from class: com.facebook.internal.instrument.InstrumentManager$$ExternalSyntheticLambda0
@Override // com.facebook.internal.FeatureManager.Callback
public final void onCompleted(boolean z) {
InstrumentManager.m592start$lambda0(z);
}
});
FeatureManager.checkFeature(FeatureManager.Feature.ErrorReport, new FeatureManager.Callback() { // from class: com.facebook.internal.instrument.InstrumentManager$$ExternalSyntheticLambda1
@Override // com.facebook.internal.FeatureManager.Callback
public final void onCompleted(boolean z) {
InstrumentManager.m593start$lambda1(z);
}
});
FeatureManager.checkFeature(FeatureManager.Feature.AnrReport, new FeatureManager.Callback() { // from class: com.facebook.internal.instrument.InstrumentManager$$ExternalSyntheticLambda2
@Override // com.facebook.internal.FeatureManager.Callback
public final void onCompleted(boolean z) {
InstrumentManager.m594start$lambda2(z);
}
});
}
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: start$lambda-0, reason: not valid java name */
public static final void m592start$lambda0(boolean z) {
if (z) {
CrashHandler.Companion.enable();
FeatureManager featureManager = FeatureManager.INSTANCE;
if (FeatureManager.isEnabled(FeatureManager.Feature.CrashShield)) {
ExceptionAnalyzer.enable();
CrashShieldHandler.enable();
}
if (FeatureManager.isEnabled(FeatureManager.Feature.ThreadCheck)) {
ThreadCheckHandler.enable();
}
}
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: start$lambda-1, reason: not valid java name */
public static final void m593start$lambda1(boolean z) {
if (z) {
ErrorReportHandler.enable();
}
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: start$lambda-2, reason: not valid java name */
public static final void m594start$lambda2(boolean z) {
if (z) {
ANRHandler.enable();
}
}
}

View File

@@ -0,0 +1,311 @@
package com.facebook.internal.instrument;
import androidx.annotation.RestrictTo;
import com.facebook.FacebookSdk;
import com.facebook.GraphRequest;
import com.facebook.internal.Utility;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FilenameFilter;
import java.util.Arrays;
import java.util.Iterator;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.StringCompanionObject;
import kotlin.text.Charsets;
import kotlin.text.Regex;
import kotlin.text.StringsKt__StringsJVMKt;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
/* loaded from: classes2.dex */
public final class InstrumentUtility {
public static final String ANALYSIS_REPORT_PREFIX = "analysis_log_";
public static final String ANR_REPORT_PREFIX = "anr_log_";
private static final String CODELESS_PREFIX = "com.facebook.appevents.codeless";
public static final String CRASH_REPORT_PREFIX = "crash_log_";
public static final String CRASH_SHIELD_PREFIX = "shield_log_";
public static final String ERROR_REPORT_PREFIX = "error_log_";
private static final String FBSDK_PREFIX = "com.facebook";
public static final InstrumentUtility INSTANCE = new InstrumentUtility();
private static final String INSTRUMENT_DIR = "instrument";
private static final String METASDK_PREFIX = "com.meta";
private static final String SUGGESTED_EVENTS_PREFIX = "com.facebook.appevents.suggestedevents";
public static final String THREAD_CHECK_PREFIX = "thread_check_log_";
private InstrumentUtility() {
}
public static final String getCause(Throwable th) {
if (th == null) {
return null;
}
if (th.getCause() == null) {
return th.toString();
}
return String.valueOf(th.getCause());
}
public static final String getStackTrace(Throwable th) {
Throwable th2 = null;
if (th == null) {
return null;
}
JSONArray jSONArray = new JSONArray();
while (th != null && th != th2) {
StackTraceElement[] stackTrace = th.getStackTrace();
Intrinsics.checkNotNullExpressionValue(stackTrace, "t.stackTrace");
int length = stackTrace.length;
int i = 0;
while (i < length) {
StackTraceElement stackTraceElement = stackTrace[i];
i++;
jSONArray.put(stackTraceElement.toString());
}
th2 = th;
th = th.getCause();
}
return jSONArray.toString();
}
public static final String getStackTrace(Thread thread) {
Intrinsics.checkNotNullParameter(thread, "thread");
StackTraceElement[] stackTrace = thread.getStackTrace();
JSONArray jSONArray = new JSONArray();
Intrinsics.checkNotNullExpressionValue(stackTrace, "stackTrace");
int length = stackTrace.length;
int i = 0;
while (i < length) {
StackTraceElement stackTraceElement = stackTrace[i];
i++;
jSONArray.put(stackTraceElement.toString());
}
return jSONArray.toString();
}
public static final boolean isSDKRelatedException(Throwable th) {
if (th == null) {
return false;
}
Throwable th2 = null;
while (th != null && th != th2) {
StackTraceElement[] stackTrace = th.getStackTrace();
Intrinsics.checkNotNullExpressionValue(stackTrace, "t.stackTrace");
int length = stackTrace.length;
int i = 0;
while (i < length) {
StackTraceElement element = stackTrace[i];
i++;
Intrinsics.checkNotNullExpressionValue(element, "element");
if (isFromFbOrMeta(element)) {
return true;
}
}
th2 = th;
th = th.getCause();
}
return false;
}
public static final boolean isSDKRelatedThread(Thread thread) {
StackTraceElement[] stackTrace;
if (thread != null && (stackTrace = thread.getStackTrace()) != null) {
for (StackTraceElement element : stackTrace) {
Intrinsics.checkNotNullExpressionValue(element, "element");
if (isFromFbOrMeta(element)) {
String className = element.getClassName();
Intrinsics.checkNotNullExpressionValue(className, "element.className");
if (!StringsKt__StringsJVMKt.startsWith$default(className, CODELESS_PREFIX, false, 2, null)) {
String className2 = element.getClassName();
Intrinsics.checkNotNullExpressionValue(className2, "element.className");
if (!StringsKt__StringsJVMKt.startsWith$default(className2, SUGGESTED_EVENTS_PREFIX, false, 2, null)) {
return true;
}
}
String methodName = element.getMethodName();
Intrinsics.checkNotNullExpressionValue(methodName, "element.methodName");
if (StringsKt__StringsJVMKt.startsWith$default(methodName, "onClick", false, 2, null)) {
continue;
} else {
String methodName2 = element.getMethodName();
Intrinsics.checkNotNullExpressionValue(methodName2, "element.methodName");
if (StringsKt__StringsJVMKt.startsWith$default(methodName2, "onItemClick", false, 2, null)) {
continue;
} else {
String methodName3 = element.getMethodName();
Intrinsics.checkNotNullExpressionValue(methodName3, "element.methodName");
if (!StringsKt__StringsJVMKt.startsWith$default(methodName3, "onTouch", false, 2, null)) {
return true;
}
}
}
}
}
}
return false;
}
public static final File[] listAnrReportFiles() {
File instrumentReportDir = getInstrumentReportDir();
if (instrumentReportDir == null) {
return new File[0];
}
File[] listFiles = instrumentReportDir.listFiles(new FilenameFilter() { // from class: com.facebook.internal.instrument.InstrumentUtility$$ExternalSyntheticLambda2
@Override // java.io.FilenameFilter
public final boolean accept(File file, String str) {
boolean m596listAnrReportFiles$lambda1;
m596listAnrReportFiles$lambda1 = InstrumentUtility.m596listAnrReportFiles$lambda1(file, str);
return m596listAnrReportFiles$lambda1;
}
});
return listFiles == null ? new File[0] : listFiles;
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: listAnrReportFiles$lambda-1, reason: not valid java name */
public static final boolean m596listAnrReportFiles$lambda1(File file, String name) {
Intrinsics.checkNotNullExpressionValue(name, "name");
StringCompanionObject stringCompanionObject = StringCompanionObject.INSTANCE;
String format = String.format("^%s[0-9]+.json$", Arrays.copyOf(new Object[]{ANR_REPORT_PREFIX}, 1));
Intrinsics.checkNotNullExpressionValue(format, "java.lang.String.format(format, *args)");
return new Regex(format).matches(name);
}
public static final File[] listExceptionAnalysisReportFiles() {
File instrumentReportDir = getInstrumentReportDir();
if (instrumentReportDir == null) {
return new File[0];
}
File[] listFiles = instrumentReportDir.listFiles(new FilenameFilter() { // from class: com.facebook.internal.instrument.InstrumentUtility$$ExternalSyntheticLambda1
@Override // java.io.FilenameFilter
public final boolean accept(File file, String str) {
boolean m597listExceptionAnalysisReportFiles$lambda2;
m597listExceptionAnalysisReportFiles$lambda2 = InstrumentUtility.m597listExceptionAnalysisReportFiles$lambda2(file, str);
return m597listExceptionAnalysisReportFiles$lambda2;
}
});
return listFiles == null ? new File[0] : listFiles;
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: listExceptionAnalysisReportFiles$lambda-2, reason: not valid java name */
public static final boolean m597listExceptionAnalysisReportFiles$lambda2(File file, String name) {
Intrinsics.checkNotNullExpressionValue(name, "name");
StringCompanionObject stringCompanionObject = StringCompanionObject.INSTANCE;
String format = String.format("^%s[0-9]+.json$", Arrays.copyOf(new Object[]{ANALYSIS_REPORT_PREFIX}, 1));
Intrinsics.checkNotNullExpressionValue(format, "java.lang.String.format(format, *args)");
return new Regex(format).matches(name);
}
public static final File[] listExceptionReportFiles() {
File instrumentReportDir = getInstrumentReportDir();
if (instrumentReportDir == null) {
return new File[0];
}
File[] listFiles = instrumentReportDir.listFiles(new FilenameFilter() { // from class: com.facebook.internal.instrument.InstrumentUtility$$ExternalSyntheticLambda0
@Override // java.io.FilenameFilter
public final boolean accept(File file, String str) {
boolean m598listExceptionReportFiles$lambda3;
m598listExceptionReportFiles$lambda3 = InstrumentUtility.m598listExceptionReportFiles$lambda3(file, str);
return m598listExceptionReportFiles$lambda3;
}
});
return listFiles == null ? new File[0] : listFiles;
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: listExceptionReportFiles$lambda-3, reason: not valid java name */
public static final boolean m598listExceptionReportFiles$lambda3(File file, String name) {
Intrinsics.checkNotNullExpressionValue(name, "name");
StringCompanionObject stringCompanionObject = StringCompanionObject.INSTANCE;
String format = String.format("^(%s|%s|%s)[0-9]+.json$", Arrays.copyOf(new Object[]{CRASH_REPORT_PREFIX, CRASH_SHIELD_PREFIX, THREAD_CHECK_PREFIX}, 3));
Intrinsics.checkNotNullExpressionValue(format, "java.lang.String.format(format, *args)");
return new Regex(format).matches(name);
}
public static final JSONObject readFile(String str, boolean z) {
File instrumentReportDir = getInstrumentReportDir();
if (instrumentReportDir != null && str != null) {
try {
return new JSONObject(Utility.readStreamToString(new FileInputStream(new File(instrumentReportDir, str))));
} catch (Exception unused) {
if (z) {
deleteFile(str);
}
}
}
return null;
}
public static final void writeFile(String str, String str2) {
File instrumentReportDir = getInstrumentReportDir();
if (instrumentReportDir == null || str == null || str2 == null) {
return;
}
try {
FileOutputStream fileOutputStream = new FileOutputStream(new File(instrumentReportDir, str));
byte[] bytes = str2.getBytes(Charsets.UTF_8);
Intrinsics.checkNotNullExpressionValue(bytes, "(this as java.lang.String).getBytes(charset)");
fileOutputStream.write(bytes);
fileOutputStream.close();
} catch (Exception unused) {
}
}
public static final boolean deleteFile(String str) {
File instrumentReportDir = getInstrumentReportDir();
if (instrumentReportDir == null || str == null) {
return false;
}
return new File(instrumentReportDir, str).delete();
}
public static final void sendReports(String str, JSONArray reports, GraphRequest.Callback callback) {
Intrinsics.checkNotNullParameter(reports, "reports");
if (reports.length() == 0) {
return;
}
JSONObject jSONObject = new JSONObject();
try {
jSONObject.put(str, reports.toString());
JSONObject dataProcessingOptions = Utility.getDataProcessingOptions();
if (dataProcessingOptions != null) {
Iterator<String> keys = dataProcessingOptions.keys();
while (keys.hasNext()) {
String next = keys.next();
jSONObject.put(next, dataProcessingOptions.get(next));
}
}
GraphRequest.Companion companion = GraphRequest.Companion;
StringCompanionObject stringCompanionObject = StringCompanionObject.INSTANCE;
String format = String.format("%s/instruments", Arrays.copyOf(new Object[]{FacebookSdk.getApplicationId()}, 1));
Intrinsics.checkNotNullExpressionValue(format, "java.lang.String.format(format, *args)");
companion.newPostRequest(null, format, jSONObject, callback).executeAsync();
} catch (JSONException unused) {
}
}
public static final File getInstrumentReportDir() {
File file = new File(FacebookSdk.getApplicationContext().getCacheDir(), INSTRUMENT_DIR);
if (file.exists() || file.mkdirs()) {
return file;
}
return null;
}
public static final boolean isFromFbOrMeta(StackTraceElement element) {
Intrinsics.checkNotNullParameter(element, "element");
String className = element.getClassName();
Intrinsics.checkNotNullExpressionValue(className, "element.className");
if (!StringsKt__StringsJVMKt.startsWith$default(className, "com.facebook", false, 2, null)) {
String className2 = element.getClassName();
Intrinsics.checkNotNullExpressionValue(className2, "element.className");
if (!StringsKt__StringsJVMKt.startsWith$default(className2, METASDK_PREFIX, false, 2, null)) {
return false;
}
}
return true;
}
}

View File

@@ -0,0 +1,92 @@
package com.facebook.internal.instrument.anrreport;
import android.app.ActivityManager;
import android.os.Looper;
import android.os.Process;
import androidx.annotation.RestrictTo;
import androidx.annotation.VisibleForTesting;
import com.facebook.FacebookSdk;
import com.facebook.internal.instrument.InstrumentData;
import com.facebook.internal.instrument.InstrumentUtility;
import com.facebook.internal.instrument.crashshield.CrashShieldHandler;
import java.util.List;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import kotlin.jvm.internal.Intrinsics;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
/* loaded from: classes2.dex */
public final class ANRDetector {
private static final int DETECTION_INTERVAL_IN_MS = 500;
public static final ANRDetector INSTANCE = new ANRDetector();
private static final int myUid = Process.myUid();
private static final ScheduledExecutorService scheduledExecutorService = Executors.newSingleThreadScheduledExecutor();
private static String previousStackTrace = "";
private static final Runnable anrDetectorRunnable = new Runnable() { // from class: com.facebook.internal.instrument.anrreport.ANRDetector$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
ANRDetector.m600anrDetectorRunnable$lambda0();
}
};
private ANRDetector() {
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: anrDetectorRunnable$lambda-0, reason: not valid java name */
public static final void m600anrDetectorRunnable$lambda0() {
if (CrashShieldHandler.isObjectCrashing(ANRDetector.class)) {
return;
}
try {
Object systemService = FacebookSdk.getApplicationContext().getSystemService("activity");
if (systemService == null) {
throw new NullPointerException("null cannot be cast to non-null type android.app.ActivityManager");
}
checkProcessError((ActivityManager) systemService);
} catch (Exception unused) {
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, ANRDetector.class);
}
}
@VisibleForTesting
public static final void checkProcessError(ActivityManager activityManager) {
if (CrashShieldHandler.isObjectCrashing(ANRDetector.class) || activityManager == null) {
return;
}
try {
List<ActivityManager.ProcessErrorStateInfo> processesInErrorState = activityManager.getProcessesInErrorState();
if (processesInErrorState == null) {
return;
}
for (ActivityManager.ProcessErrorStateInfo processErrorStateInfo : processesInErrorState) {
if (processErrorStateInfo.condition == 2 && processErrorStateInfo.uid == myUid) {
Thread thread = Looper.getMainLooper().getThread();
Intrinsics.checkNotNullExpressionValue(thread, "getMainLooper().thread");
String stackTrace = InstrumentUtility.getStackTrace(thread);
if (!Intrinsics.areEqual(stackTrace, previousStackTrace) && InstrumentUtility.isSDKRelatedThread(thread)) {
previousStackTrace = stackTrace;
InstrumentData.Builder builder = InstrumentData.Builder.INSTANCE;
InstrumentData.Builder.build(processErrorStateInfo.shortMsg, stackTrace).save();
}
}
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, ANRDetector.class);
}
}
@VisibleForTesting
public static final void start() {
if (CrashShieldHandler.isObjectCrashing(ANRDetector.class)) {
return;
}
try {
scheduledExecutorService.scheduleWithFixedDelay(anrDetectorRunnable, 0L, 500, TimeUnit.MILLISECONDS);
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, ANRDetector.class);
}
}
}

View File

@@ -0,0 +1,144 @@
package com.facebook.internal.instrument.anrreport;
import androidx.annotation.RestrictTo;
import androidx.annotation.VisibleForTesting;
import com.facebook.FacebookSdk;
import com.facebook.GraphRequest;
import com.facebook.GraphResponse;
import com.facebook.internal.Utility;
import com.facebook.internal.instrument.InstrumentData;
import com.facebook.internal.instrument.InstrumentUtility;
import com.facebook.internal.instrument.crashshield.CrashShieldHandler;
import java.io.File;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
import kotlin.collections.CollectionsKt___CollectionsKt;
import kotlin.collections.IntIterator;
import kotlin.jvm.internal.Intrinsics;
import kotlin.ranges.IntRange;
import kotlin.ranges.RangesKt___RangesKt;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
/* loaded from: classes2.dex */
public final class ANRHandler {
private static final int MAX_ANR_REPORT_NUM = 5;
public static final ANRHandler INSTANCE = new ANRHandler();
private static final AtomicBoolean enabled = new AtomicBoolean(false);
private ANRHandler() {
}
public static final synchronized void enable() {
synchronized (ANRHandler.class) {
if (CrashShieldHandler.isObjectCrashing(ANRHandler.class)) {
return;
}
try {
if (enabled.getAndSet(true)) {
return;
}
if (FacebookSdk.getAutoLogAppEventsEnabled()) {
sendANRReports();
}
ANRDetector.start();
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, ANRHandler.class);
}
}
}
@VisibleForTesting
public static final void sendANRReports() {
final List sortedWith;
IntRange until;
if (CrashShieldHandler.isObjectCrashing(ANRHandler.class)) {
return;
}
try {
if (Utility.isDataProcessingRestricted()) {
return;
}
File[] listAnrReportFiles = InstrumentUtility.listAnrReportFiles();
ArrayList arrayList = new ArrayList(listAnrReportFiles.length);
for (File file : listAnrReportFiles) {
arrayList.add(InstrumentData.Builder.load(file));
}
ArrayList arrayList2 = new ArrayList();
for (Object obj : arrayList) {
if (((InstrumentData) obj).isValid()) {
arrayList2.add(obj);
}
}
sortedWith = CollectionsKt___CollectionsKt.sortedWith(arrayList2, new Comparator() { // from class: com.facebook.internal.instrument.anrreport.ANRHandler$$ExternalSyntheticLambda0
@Override // java.util.Comparator
public final int compare(Object obj2, Object obj3) {
int m601sendANRReports$lambda2;
m601sendANRReports$lambda2 = ANRHandler.m601sendANRReports$lambda2((InstrumentData) obj2, (InstrumentData) obj3);
return m601sendANRReports$lambda2;
}
});
JSONArray jSONArray = new JSONArray();
until = RangesKt___RangesKt.until(0, Math.min(sortedWith.size(), 5));
Iterator it = until.iterator();
while (it.hasNext()) {
jSONArray.put(sortedWith.get(((IntIterator) it).nextInt()));
}
InstrumentUtility instrumentUtility = InstrumentUtility.INSTANCE;
InstrumentUtility.sendReports("anr_reports", jSONArray, new GraphRequest.Callback() { // from class: com.facebook.internal.instrument.anrreport.ANRHandler$$ExternalSyntheticLambda1
@Override // com.facebook.GraphRequest.Callback
public final void onCompleted(GraphResponse graphResponse) {
ANRHandler.m602sendANRReports$lambda5(sortedWith, graphResponse);
}
});
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, ANRHandler.class);
}
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: sendANRReports$lambda-2, reason: not valid java name */
public static final int m601sendANRReports$lambda2(InstrumentData instrumentData, InstrumentData o2) {
if (CrashShieldHandler.isObjectCrashing(ANRHandler.class)) {
return 0;
}
try {
Intrinsics.checkNotNullExpressionValue(o2, "o2");
return instrumentData.compareTo(o2);
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, ANRHandler.class);
return 0;
}
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: sendANRReports$lambda-5, reason: not valid java name */
public static final void m602sendANRReports$lambda5(List validReports, GraphResponse response) {
if (CrashShieldHandler.isObjectCrashing(ANRHandler.class)) {
return;
}
try {
Intrinsics.checkNotNullParameter(validReports, "$validReports");
Intrinsics.checkNotNullParameter(response, "response");
try {
if (response.getError() == null) {
JSONObject jsonObject = response.getJsonObject();
if (Intrinsics.areEqual(jsonObject == null ? null : Boolean.valueOf(jsonObject.getBoolean("success")), Boolean.TRUE)) {
Iterator it = validReports.iterator();
while (it.hasNext()) {
((InstrumentData) it.next()).clear();
}
}
}
} catch (JSONException unused) {
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, ANRHandler.class);
}
}
}

View File

@@ -0,0 +1,158 @@
package com.facebook.internal.instrument.crashreport;
import android.util.Log;
import androidx.annotation.RestrictTo;
import com.facebook.FacebookSdk;
import com.facebook.GraphRequest;
import com.facebook.GraphResponse;
import com.facebook.internal.Utility;
import com.facebook.internal.instrument.ExceptionAnalyzer;
import com.facebook.internal.instrument.InstrumentData;
import com.facebook.internal.instrument.InstrumentUtility;
import com.facebook.internal.instrument.crashreport.CrashHandler;
import java.io.File;
import java.lang.Thread;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import kotlin.collections.CollectionsKt___CollectionsKt;
import kotlin.collections.IntIterator;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.ranges.IntRange;
import kotlin.ranges.RangesKt___RangesKt;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
/* loaded from: classes2.dex */
public final class CrashHandler implements Thread.UncaughtExceptionHandler {
private static final int MAX_CRASH_REPORT_NUM = 5;
private static CrashHandler instance;
private final Thread.UncaughtExceptionHandler previousHandler;
public static final Companion Companion = new Companion(null);
private static final String TAG = CrashHandler.class.getCanonicalName();
public /* synthetic */ CrashHandler(Thread.UncaughtExceptionHandler uncaughtExceptionHandler, DefaultConstructorMarker defaultConstructorMarker) {
this(uncaughtExceptionHandler);
}
public static final synchronized void enable() {
synchronized (CrashHandler.class) {
Companion.enable();
}
}
private CrashHandler(Thread.UncaughtExceptionHandler uncaughtExceptionHandler) {
this.previousHandler = uncaughtExceptionHandler;
}
@Override // java.lang.Thread.UncaughtExceptionHandler
public void uncaughtException(Thread t, Throwable e) {
Intrinsics.checkNotNullParameter(t, "t");
Intrinsics.checkNotNullParameter(e, "e");
if (InstrumentUtility.isSDKRelatedException(e)) {
ExceptionAnalyzer.execute(e);
InstrumentData.Builder builder = InstrumentData.Builder.INSTANCE;
InstrumentData.Builder.build(e, InstrumentData.Type.CrashReport).save();
}
Thread.UncaughtExceptionHandler uncaughtExceptionHandler = this.previousHandler;
if (uncaughtExceptionHandler == null) {
return;
}
uncaughtExceptionHandler.uncaughtException(t, e);
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
public final synchronized void enable() {
try {
if (FacebookSdk.getAutoLogAppEventsEnabled()) {
sendExceptionReports();
}
if (CrashHandler.instance != null) {
Log.w(CrashHandler.TAG, "Already enabled!");
} else {
CrashHandler.instance = new CrashHandler(Thread.getDefaultUncaughtExceptionHandler(), null);
Thread.setDefaultUncaughtExceptionHandler(CrashHandler.instance);
}
} catch (Throwable th) {
throw th;
}
}
private final void sendExceptionReports() {
final List sortedWith;
IntRange until;
if (Utility.isDataProcessingRestricted()) {
return;
}
File[] listExceptionReportFiles = InstrumentUtility.listExceptionReportFiles();
ArrayList arrayList = new ArrayList(listExceptionReportFiles.length);
for (File file : listExceptionReportFiles) {
arrayList.add(InstrumentData.Builder.load(file));
}
ArrayList arrayList2 = new ArrayList();
for (Object obj : arrayList) {
if (((InstrumentData) obj).isValid()) {
arrayList2.add(obj);
}
}
sortedWith = CollectionsKt___CollectionsKt.sortedWith(arrayList2, new Comparator() { // from class: com.facebook.internal.instrument.crashreport.CrashHandler$Companion$$ExternalSyntheticLambda0
@Override // java.util.Comparator
public final int compare(Object obj2, Object obj3) {
int m603sendExceptionReports$lambda2;
m603sendExceptionReports$lambda2 = CrashHandler.Companion.m603sendExceptionReports$lambda2((InstrumentData) obj2, (InstrumentData) obj3);
return m603sendExceptionReports$lambda2;
}
});
JSONArray jSONArray = new JSONArray();
until = RangesKt___RangesKt.until(0, Math.min(sortedWith.size(), 5));
Iterator it = until.iterator();
while (it.hasNext()) {
jSONArray.put(sortedWith.get(((IntIterator) it).nextInt()));
}
InstrumentUtility instrumentUtility = InstrumentUtility.INSTANCE;
InstrumentUtility.sendReports("crash_reports", jSONArray, new GraphRequest.Callback() { // from class: com.facebook.internal.instrument.crashreport.CrashHandler$Companion$$ExternalSyntheticLambda1
@Override // com.facebook.GraphRequest.Callback
public final void onCompleted(GraphResponse graphResponse) {
CrashHandler.Companion.m604sendExceptionReports$lambda5(sortedWith, graphResponse);
}
});
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: sendExceptionReports$lambda-2, reason: not valid java name */
public static final int m603sendExceptionReports$lambda2(InstrumentData instrumentData, InstrumentData o2) {
Intrinsics.checkNotNullExpressionValue(o2, "o2");
return instrumentData.compareTo(o2);
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: sendExceptionReports$lambda-5, reason: not valid java name */
public static final void m604sendExceptionReports$lambda5(List validReports, GraphResponse response) {
Intrinsics.checkNotNullParameter(validReports, "$validReports");
Intrinsics.checkNotNullParameter(response, "response");
try {
if (response.getError() == null) {
JSONObject jsonObject = response.getJsonObject();
if (Intrinsics.areEqual(jsonObject == null ? null : Boolean.valueOf(jsonObject.getBoolean("success")), Boolean.TRUE)) {
Iterator it = validReports.iterator();
while (it.hasNext()) {
((InstrumentData) it.next()).clear();
}
}
}
} catch (JSONException unused) {
}
}
}
}

View File

@@ -0,0 +1,9 @@
package com.facebook.internal.instrument.crashshield;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@Retention(RetentionPolicy.CLASS)
/* loaded from: classes2.dex */
public @interface AutoHandleExceptions {
}

View File

@@ -0,0 +1,91 @@
package com.facebook.internal.instrument.crashshield;
import android.os.Handler;
import android.os.Looper;
import androidx.annotation.VisibleForTesting;
import com.facebook.FacebookSdk;
import com.facebook.internal.instrument.ExceptionAnalyzer;
import com.facebook.internal.instrument.InstrumentData;
import java.util.Collections;
import java.util.Set;
import java.util.WeakHashMap;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes2.dex */
public final class CrashShieldHandler {
public static final CrashShieldHandler INSTANCE = new CrashShieldHandler();
private static final Set<Object> crashingObjects = Collections.newSetFromMap(new WeakHashMap());
private static boolean enabled;
@VisibleForTesting
public static final void disable() {
enabled = false;
}
public static final void enable() {
enabled = true;
}
@VisibleForTesting
public static final boolean isDebug() {
return false;
}
public static final void methodFinished(Object obj) {
}
private CrashShieldHandler() {
}
public static final void handleThrowable(Throwable th, Object o) {
Intrinsics.checkNotNullParameter(o, "o");
if (enabled) {
crashingObjects.add(o);
if (FacebookSdk.getAutoLogAppEventsEnabled()) {
ExceptionAnalyzer.execute(th);
InstrumentData.Builder builder = InstrumentData.Builder.INSTANCE;
InstrumentData.Builder.build(th, InstrumentData.Type.CrashShield).save();
}
scheduleCrashInDebug(th);
}
}
public static final boolean isObjectCrashing(Object o) {
Intrinsics.checkNotNullParameter(o, "o");
return crashingObjects.contains(o);
}
public static final void reset() {
resetCrashingObjects();
}
public static final void resetCrashingObjects() {
crashingObjects.clear();
}
@VisibleForTesting
public static final void scheduleCrashInDebug(final Throwable th) {
if (isDebug()) {
new Handler(Looper.getMainLooper()).post(new Runnable() { // from class: com.facebook.internal.instrument.crashshield.CrashShieldHandler$scheduleCrashInDebug$1
@Override // java.lang.Runnable
public void run() {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
throw new RuntimeException(th);
} catch (Throwable th2) {
CrashShieldHandler.handleThrowable(th2, this);
}
} catch (Throwable th3) {
CrashShieldHandler.handleThrowable(th3, this);
}
}
});
}
}
}

View File

@@ -0,0 +1,9 @@
package com.facebook.internal.instrument.crashshield;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@Retention(RetentionPolicy.CLASS)
/* loaded from: classes2.dex */
public @interface NoAutoExceptionHandling {
}

View File

@@ -0,0 +1,111 @@
package com.facebook.internal.instrument.errorreport;
import androidx.annotation.RestrictTo;
import com.facebook.internal.instrument.InstrumentUtility;
import java.io.File;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import org.json.JSONException;
import org.json.JSONObject;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
/* loaded from: classes2.dex */
public final class ErrorReportData {
public static final Companion Companion = new Companion(null);
private static final String PARAM_TIMESTAMP = "timestamp";
private static final String PRARAM_ERROR_MESSAGE = "error_message";
private String errorMessage;
private String filename;
private Long timestamp;
public final boolean isValid() {
return (this.errorMessage == null || this.timestamp == null) ? false : true;
}
public ErrorReportData(String str) {
this.timestamp = Long.valueOf(System.currentTimeMillis() / 1000);
this.errorMessage = str;
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append(InstrumentUtility.ERROR_REPORT_PREFIX);
Long l = this.timestamp;
if (l == null) {
throw new NullPointerException("null cannot be cast to non-null type kotlin.Long");
}
stringBuffer.append(l.longValue());
stringBuffer.append(".json");
String stringBuffer2 = stringBuffer.toString();
Intrinsics.checkNotNullExpressionValue(stringBuffer2, "StringBuffer()\n .append(InstrumentUtility.ERROR_REPORT_PREFIX)\n .append(timestamp as Long)\n .append(\".json\")\n .toString()");
this.filename = stringBuffer2;
}
public ErrorReportData(File file) {
Intrinsics.checkNotNullParameter(file, "file");
String name = file.getName();
Intrinsics.checkNotNullExpressionValue(name, "file.name");
this.filename = name;
JSONObject readFile = InstrumentUtility.readFile(name, true);
if (readFile != null) {
this.timestamp = Long.valueOf(readFile.optLong("timestamp", 0L));
this.errorMessage = readFile.optString("error_message", null);
}
}
public final int compareTo(ErrorReportData data) {
Intrinsics.checkNotNullParameter(data, "data");
Long l = this.timestamp;
if (l == null) {
return -1;
}
long longValue = l.longValue();
Long l2 = data.timestamp;
if (l2 == null) {
return 1;
}
return Intrinsics.compare(l2.longValue(), longValue);
}
public final void save() {
if (isValid()) {
InstrumentUtility instrumentUtility = InstrumentUtility.INSTANCE;
InstrumentUtility.writeFile(this.filename, toString());
}
}
public final void clear() {
InstrumentUtility instrumentUtility = InstrumentUtility.INSTANCE;
InstrumentUtility.deleteFile(this.filename);
}
public String toString() {
JSONObject parameters = getParameters();
if (parameters == null) {
return super.toString();
}
String jSONObject = parameters.toString();
Intrinsics.checkNotNullExpressionValue(jSONObject, "params.toString()");
return jSONObject;
}
public final JSONObject getParameters() {
JSONObject jSONObject = new JSONObject();
try {
Long l = this.timestamp;
if (l != null) {
jSONObject.put("timestamp", l);
}
jSONObject.put("error_message", this.errorMessage);
return jSONObject;
} catch (JSONException unused) {
return null;
}
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
}
}

View File

@@ -0,0 +1,134 @@
package com.facebook.internal.instrument.errorreport;
import androidx.annotation.RestrictTo;
import com.facebook.FacebookSdk;
import com.facebook.GraphRequest;
import com.facebook.GraphResponse;
import com.facebook.internal.Utility;
import com.facebook.internal.instrument.InstrumentUtility;
import java.io.File;
import java.io.FilenameFilter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Iterator;
import kotlin.collections.CollectionsKt__MutableCollectionsJVMKt;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.StringCompanionObject;
import kotlin.text.Regex;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
/* loaded from: classes2.dex */
public final class ErrorReportHandler {
public static final ErrorReportHandler INSTANCE = new ErrorReportHandler();
private static final int MAX_ERROR_REPORT_NUM = 1000;
private ErrorReportHandler() {
}
public static final void save(String str) {
try {
new ErrorReportData(str).save();
} catch (Exception unused) {
}
}
public static final void enable() {
if (FacebookSdk.getAutoLogAppEventsEnabled()) {
sendErrorReports();
}
}
public static final void sendErrorReports() {
if (Utility.isDataProcessingRestricted()) {
return;
}
File[] listErrorReportFiles = listErrorReportFiles();
final ArrayList arrayList = new ArrayList();
int length = listErrorReportFiles.length;
int i = 0;
while (i < length) {
File file = listErrorReportFiles[i];
i++;
ErrorReportData errorReportData = new ErrorReportData(file);
if (errorReportData.isValid()) {
arrayList.add(errorReportData);
}
}
CollectionsKt__MutableCollectionsJVMKt.sortWith(arrayList, new Comparator() { // from class: com.facebook.internal.instrument.errorreport.ErrorReportHandler$$ExternalSyntheticLambda0
@Override // java.util.Comparator
public final int compare(Object obj, Object obj2) {
int m607sendErrorReports$lambda0;
m607sendErrorReports$lambda0 = ErrorReportHandler.m607sendErrorReports$lambda0((ErrorReportData) obj, (ErrorReportData) obj2);
return m607sendErrorReports$lambda0;
}
});
JSONArray jSONArray = new JSONArray();
for (int i2 = 0; i2 < arrayList.size() && i2 < 1000; i2++) {
jSONArray.put(arrayList.get(i2));
}
InstrumentUtility instrumentUtility = InstrumentUtility.INSTANCE;
InstrumentUtility.sendReports("error_reports", jSONArray, new GraphRequest.Callback() { // from class: com.facebook.internal.instrument.errorreport.ErrorReportHandler$$ExternalSyntheticLambda1
@Override // com.facebook.GraphRequest.Callback
public final void onCompleted(GraphResponse graphResponse) {
ErrorReportHandler.m608sendErrorReports$lambda2(arrayList, graphResponse);
}
});
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: sendErrorReports$lambda-0, reason: not valid java name */
public static final int m607sendErrorReports$lambda0(ErrorReportData errorReportData, ErrorReportData o2) {
Intrinsics.checkNotNullExpressionValue(o2, "o2");
return errorReportData.compareTo(o2);
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: sendErrorReports$lambda-2, reason: not valid java name */
public static final void m608sendErrorReports$lambda2(ArrayList validReports, GraphResponse response) {
Intrinsics.checkNotNullParameter(validReports, "$validReports");
Intrinsics.checkNotNullParameter(response, "response");
try {
if (response.getError() == null) {
JSONObject jsonObject = response.getJsonObject();
if (Intrinsics.areEqual(jsonObject == null ? null : Boolean.valueOf(jsonObject.getBoolean("success")), Boolean.TRUE)) {
Iterator it = validReports.iterator();
while (it.hasNext()) {
((ErrorReportData) it.next()).clear();
}
}
}
} catch (JSONException unused) {
}
}
public static final File[] listErrorReportFiles() {
File instrumentReportDir = InstrumentUtility.getInstrumentReportDir();
if (instrumentReportDir == null) {
return new File[0];
}
File[] listFiles = instrumentReportDir.listFiles(new FilenameFilter() { // from class: com.facebook.internal.instrument.errorreport.ErrorReportHandler$$ExternalSyntheticLambda2
@Override // java.io.FilenameFilter
public final boolean accept(File file, String str) {
boolean m606listErrorReportFiles$lambda3;
m606listErrorReportFiles$lambda3 = ErrorReportHandler.m606listErrorReportFiles$lambda3(file, str);
return m606listErrorReportFiles$lambda3;
}
});
Intrinsics.checkNotNullExpressionValue(listFiles, "reportDir.listFiles { dir, name ->\n name.matches(Regex(String.format(\"^%s[0-9]+.json$\", InstrumentUtility.ERROR_REPORT_PREFIX)))\n }");
return listFiles;
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: listErrorReportFiles$lambda-3, reason: not valid java name */
public static final boolean m606listErrorReportFiles$lambda3(File file, String name) {
Intrinsics.checkNotNullExpressionValue(name, "name");
StringCompanionObject stringCompanionObject = StringCompanionObject.INSTANCE;
String format = String.format("^%s[0-9]+.json$", Arrays.copyOf(new Object[]{InstrumentUtility.ERROR_REPORT_PREFIX}, 1));
Intrinsics.checkNotNullExpressionValue(format, "java.lang.String.format(format, *args)");
return new Regex(format).matches(name);
}
}

View File

@@ -0,0 +1,51 @@
package com.facebook.internal.instrument.threadcheck;
import android.os.Looper;
import android.util.Log;
import androidx.annotation.RestrictTo;
import com.facebook.internal.instrument.InstrumentData;
import java.util.Arrays;
import java.util.Locale;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.StringCompanionObject;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
/* loaded from: classes2.dex */
public final class ThreadCheckHandler {
public static final ThreadCheckHandler INSTANCE = new ThreadCheckHandler();
private static final String TAG = ThreadCheckHandler.class.getCanonicalName();
private static boolean enabled;
public static final void enable() {
enabled = true;
}
private ThreadCheckHandler() {
}
public static final void uiThreadViolationDetected(Class<?> clazz, String methodName, String methodDesc) {
Intrinsics.checkNotNullParameter(clazz, "clazz");
Intrinsics.checkNotNullParameter(methodName, "methodName");
Intrinsics.checkNotNullParameter(methodDesc, "methodDesc");
INSTANCE.log("@UiThread", clazz, methodName, methodDesc);
}
public static final void workerThreadViolationDetected(Class<?> clazz, String methodName, String methodDesc) {
Intrinsics.checkNotNullParameter(clazz, "clazz");
Intrinsics.checkNotNullParameter(methodName, "methodName");
Intrinsics.checkNotNullParameter(methodDesc, "methodDesc");
INSTANCE.log("@WorkerThread", clazz, methodName, methodDesc);
}
private final void log(String str, Class<?> cls, String str2, String str3) {
if (enabled) {
StringCompanionObject stringCompanionObject = StringCompanionObject.INSTANCE;
String format = String.format(Locale.US, "%s annotation violation detected in %s.%s%s. Current looper is %s and main looper is %s.", Arrays.copyOf(new Object[]{str, cls.getName(), str2, str3, Looper.myLooper(), Looper.getMainLooper()}, 6));
Intrinsics.checkNotNullExpressionValue(format, "java.lang.String.format(locale, format, *args)");
Exception exc = new Exception();
Log.e(TAG, format, exc);
InstrumentData.Builder builder = InstrumentData.Builder.INSTANCE;
InstrumentData.Builder.build(exc, InstrumentData.Type.ThreadCheck).save();
}
}
}

View File

@@ -0,0 +1,26 @@
package com.facebook.internal.logging.dumpsys;
import java.io.PrintWriter;
/* loaded from: classes2.dex */
public interface EndToEndDumper {
public static final Companion Companion = Companion.$$INSTANCE;
boolean maybeDump(String str, PrintWriter printWriter, String[] strArr);
public static final class Companion {
static final /* synthetic */ Companion $$INSTANCE = new Companion();
private static EndToEndDumper instance;
public final EndToEndDumper getInstance() {
return instance;
}
public final void setInstance(EndToEndDumper endToEndDumper) {
instance = endToEndDumper;
}
private Companion() {
}
}
}

View File

@@ -0,0 +1,14 @@
package com.facebook.internal.qualityvalidation;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target({})
@Retention(RetentionPolicy.SOURCE)
/* loaded from: classes2.dex */
public @interface Excuse {
String reason();
String type();
}

View File

@@ -0,0 +1,13 @@
package com.facebook.internal.qualityvalidation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target({ElementType.TYPE, ElementType.ANNOTATION_TYPE})
@Retention(RetentionPolicy.SOURCE)
/* loaded from: classes2.dex */
public @interface ExcusesForDesignViolations {
Excuse[] value();
}

View File

@@ -0,0 +1,50 @@
package com.facebook.internal.security;
import android.content.Context;
import android.content.pm.PackageManager;
import android.content.pm.Signature;
import android.util.Base64;
import androidx.annotation.VisibleForTesting;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes2.dex */
public final class CertificateUtil {
public static final String DELIMITER = ":";
public static final CertificateUtil INSTANCE = new CertificateUtil();
@VisibleForTesting(otherwise = 2)
public static /* synthetic */ void getDELIMITER$facebook_core_release$annotations() {
}
private CertificateUtil() {
}
public static final String getCertificateHash(Context ctx) {
Intrinsics.checkNotNullParameter(ctx, "ctx");
try {
Signature[] signatures = ctx.getPackageManager().getPackageInfo(ctx.getPackageName(), 64).signatures;
StringBuilder sb = new StringBuilder();
MessageDigest messageDigest = MessageDigest.getInstance("SHA1");
Intrinsics.checkNotNullExpressionValue(signatures, "signatures");
int length = signatures.length;
int i = 0;
while (i < length) {
Signature signature = signatures[i];
i++;
messageDigest.update(signature.toByteArray());
sb.append(Base64.encodeToString(messageDigest.digest(), 0));
sb.append(DELIMITER);
}
if (sb.length() > 0) {
sb.setLength(sb.length() - 1);
}
String sb2 = sb.toString();
Intrinsics.checkNotNullExpressionValue(sb2, "sb.toString()");
return sb2;
} catch (PackageManager.NameNotFoundException | NoSuchAlgorithmException unused) {
return "";
}
}
}

View File

@@ -0,0 +1,149 @@
package com.facebook.internal.security;
import android.util.Base64;
import com.facebook.FacebookSdk;
import com.google.firebase.perf.network.FirebasePerfUrlConnection;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
import java.security.KeyFactory;
import java.security.PublicKey;
import java.security.Signature;
import java.security.spec.X509EncodedKeySpec;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.ReentrantLock;
import kotlin.Unit;
import kotlin.io.TextStreamsKt;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.Ref;
import kotlin.text.Charsets;
import kotlin.text.StringsKt__StringsJVMKt;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public final class OidcSecurityUtil {
public static final OidcSecurityUtil INSTANCE = new OidcSecurityUtil();
private static final String OPENID_KEYS_PATH = "/.well-known/oauth/openid/keys/";
public static final String SIGNATURE_ALGORITHM_SHA256 = "SHA256withRSA";
public static final long TIMEOUT_IN_MILLISECONDS = 5000;
public final String getOPENID_KEYS_PATH() {
return OPENID_KEYS_PATH;
}
private OidcSecurityUtil() {
}
/* JADX WARN: Multi-variable type inference failed */
public static final String getRawKeyFromEndPoint(final String kid) {
Intrinsics.checkNotNullParameter(kid, "kid");
final URL url = new URL("https", Intrinsics.stringPlus("www.", FacebookSdk.getFacebookDomain()), OPENID_KEYS_PATH);
final ReentrantLock reentrantLock = new ReentrantLock();
final Condition newCondition = reentrantLock.newCondition();
final Ref.ObjectRef objectRef = new Ref.ObjectRef();
FacebookSdk.getExecutor().execute(new Runnable() { // from class: com.facebook.internal.security.OidcSecurityUtil$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
OidcSecurityUtil.m609getRawKeyFromEndPoint$lambda1(url, objectRef, kid, reentrantLock, newCondition);
}
});
reentrantLock.lock();
try {
newCondition.await(5000L, TimeUnit.MILLISECONDS);
reentrantLock.unlock();
return (String) objectRef.element;
} catch (Throwable th) {
reentrantLock.unlock();
throw th;
}
}
/* JADX INFO: Access modifiers changed from: private */
/* JADX WARN: Type inference failed for: r5v2, types: [T, java.lang.String] */
/* renamed from: getRawKeyFromEndPoint$lambda-1, reason: not valid java name */
public static final void m609getRawKeyFromEndPoint$lambda1(URL openIdKeyUrl, Ref.ObjectRef result, String kid, ReentrantLock lock, Condition condition) {
Intrinsics.checkNotNullParameter(openIdKeyUrl, "$openIdKeyUrl");
Intrinsics.checkNotNullParameter(result, "$result");
Intrinsics.checkNotNullParameter(kid, "$kid");
Intrinsics.checkNotNullParameter(lock, "$lock");
URLConnection uRLConnection = (URLConnection) FirebasePerfUrlConnection.instrument(openIdKeyUrl.openConnection());
if (uRLConnection == null) {
throw new NullPointerException("null cannot be cast to non-null type java.net.HttpURLConnection");
}
HttpURLConnection httpURLConnection = (HttpURLConnection) uRLConnection;
try {
try {
InputStream inputStream = httpURLConnection.getInputStream();
Intrinsics.checkNotNullExpressionValue(inputStream, "connection.inputStream");
Reader inputStreamReader = new InputStreamReader(inputStream, Charsets.UTF_8);
String readText = TextStreamsKt.readText(inputStreamReader instanceof BufferedReader ? (BufferedReader) inputStreamReader : new BufferedReader(inputStreamReader, 8192));
httpURLConnection.getInputStream().close();
result.element = new JSONObject(readText).optString(kid);
httpURLConnection.disconnect();
lock.lock();
} catch (Exception e) {
INSTANCE.getClass();
e.getMessage();
httpURLConnection.disconnect();
lock.lock();
try {
condition.signal();
Unit unit = Unit.INSTANCE;
} finally {
}
}
try {
condition.signal();
Unit unit2 = Unit.INSTANCE;
} finally {
}
} catch (Throwable th) {
httpURLConnection.disconnect();
lock.lock();
try {
condition.signal();
Unit unit3 = Unit.INSTANCE;
throw th;
} finally {
}
}
}
public static final PublicKey getPublicKeyFromString(String key) {
String replace$default;
String replace$default2;
String replace$default3;
Intrinsics.checkNotNullParameter(key, "key");
replace$default = StringsKt__StringsJVMKt.replace$default(key, "\n", "", false, 4, (Object) null);
replace$default2 = StringsKt__StringsJVMKt.replace$default(replace$default, "-----BEGIN PUBLIC KEY-----", "", false, 4, (Object) null);
replace$default3 = StringsKt__StringsJVMKt.replace$default(replace$default2, "-----END PUBLIC KEY-----", "", false, 4, (Object) null);
byte[] decode = Base64.decode(replace$default3, 0);
Intrinsics.checkNotNullExpressionValue(decode, "decode(pubKeyString, Base64.DEFAULT)");
PublicKey generatePublic = KeyFactory.getInstance("RSA").generatePublic(new X509EncodedKeySpec(decode));
Intrinsics.checkNotNullExpressionValue(generatePublic, "kf.generatePublic(x509publicKey)");
return generatePublic;
}
public static final boolean verify(PublicKey publicKey, String data, String signature) {
Intrinsics.checkNotNullParameter(publicKey, "publicKey");
Intrinsics.checkNotNullParameter(data, "data");
Intrinsics.checkNotNullParameter(signature, "signature");
try {
Signature signature2 = Signature.getInstance(SIGNATURE_ALGORITHM_SHA256);
signature2.initVerify(publicKey);
byte[] bytes = data.getBytes(Charsets.UTF_8);
Intrinsics.checkNotNullExpressionValue(bytes, "(this as java.lang.String).getBytes(charset)");
signature2.update(bytes);
byte[] decode = Base64.decode(signature, 8);
Intrinsics.checkNotNullExpressionValue(decode, "decode(signature, Base64.URL_SAFE)");
return signature2.verify(decode);
} catch (Exception unused) {
return false;
}
}
}