Initial commit

This commit is contained in:
2025-05-13 19:24:51 +02:00
commit a950f49678
10604 changed files with 932663 additions and 0 deletions

View File

@@ -0,0 +1,66 @@
package com.facebook.internal;
import android.content.Intent;
import java.util.UUID;
/* loaded from: classes.dex */
public class AppCall {
private static AppCall d;
private UUID a;
private Intent b;
private int c;
public AppCall(int i) {
this(i, UUID.randomUUID());
}
public static synchronized AppCall a(UUID uuid, int i) {
synchronized (AppCall.class) {
AppCall e = e();
if (e != null && e.a().equals(uuid) && e.b() == i) {
a((AppCall) null);
return e;
}
return null;
}
}
public static AppCall e() {
return d;
}
public int b() {
return this.c;
}
public Intent c() {
return this.b;
}
public boolean d() {
return a(this);
}
public AppCall(int i, UUID uuid) {
this.a = uuid;
this.c = i;
}
private static synchronized boolean a(AppCall appCall) {
boolean z;
synchronized (AppCall.class) {
AppCall e = e();
d = appCall;
z = e != null;
}
return z;
}
public UUID a() {
return this.a;
}
public void a(Intent intent) {
this.b = intent;
}
}

View File

@@ -0,0 +1,36 @@
package com.facebook.internal;
import android.content.Context;
import com.facebook.LoggingBehavior;
import java.util.HashMap;
import java.util.Map;
import org.json.JSONException;
import org.json.JSONObject;
/* loaded from: classes.dex */
public class AppEventsLoggerUtility {
private static final Map<GraphAPIActivityType, String> a = new HashMap<GraphAPIActivityType, String>() { // from class: com.facebook.internal.AppEventsLoggerUtility.1
{
put(GraphAPIActivityType.MOBILE_INSTALL_EVENT, "MOBILE_APP_INSTALL");
put(GraphAPIActivityType.CUSTOM_APP_EVENTS, "CUSTOM_APP_EVENTS");
}
};
public enum GraphAPIActivityType {
MOBILE_INSTALL_EVENT,
CUSTOM_APP_EVENTS
}
public static JSONObject a(GraphAPIActivityType graphAPIActivityType, AttributionIdentifiers attributionIdentifiers, String str, boolean z, Context context) throws JSONException {
JSONObject jSONObject = new JSONObject();
jSONObject.put("event", a.get(graphAPIActivityType));
Utility.a(jSONObject, attributionIdentifiers, str, z);
try {
Utility.a(jSONObject, context);
} catch (Exception e) {
Logger.a(LoggingBehavior.APP_EVENTS, "AppEvents", "Fetching extended device info parameters failed: '%s'", e.toString());
}
jSONObject.put("application_package_name", context.getPackageName());
return jSONObject;
}
}

View File

@@ -0,0 +1,206 @@
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.Looper;
import android.os.Parcel;
import android.os.RemoteException;
import com.facebook.FacebookException;
import java.lang.reflect.Method;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.atomic.AtomicBoolean;
/* loaded from: classes.dex */
public class AttributionIdentifiers {
private static final String f = "com.facebook.internal.AttributionIdentifiers";
private static AttributionIdentifiers g;
private String a;
private String b;
private String c;
private boolean d;
private long e;
private static final class GoogleAdInfo implements IInterface {
private IBinder a;
GoogleAdInfo(IBinder iBinder) {
this.a = iBinder;
}
@Override // android.os.IInterface
public IBinder asBinder() {
return this.a;
}
public String i() throws RemoteException {
Parcel obtain = Parcel.obtain();
Parcel obtain2 = Parcel.obtain();
try {
obtain.writeInterfaceToken("com.google.android.gms.ads.identifier.internal.IAdvertisingIdService");
this.a.transact(1, obtain, obtain2, 0);
obtain2.readException();
return obtain2.readString();
} finally {
obtain2.recycle();
obtain.recycle();
}
}
public boolean j() throws RemoteException {
Parcel obtain = Parcel.obtain();
Parcel obtain2 = Parcel.obtain();
try {
obtain.writeInterfaceToken("com.google.android.gms.ads.identifier.internal.IAdvertisingIdService");
obtain.writeInt(1);
this.a.transact(2, obtain, obtain2, 0);
obtain2.readException();
return obtain2.readInt() != 0;
} finally {
obtain2.recycle();
obtain.recycle();
}
}
}
private static final class GoogleAdServiceConnection implements ServiceConnection {
private AtomicBoolean a;
private final BlockingQueue<IBinder> b;
private GoogleAdServiceConnection() {
this.a = new AtomicBoolean(false);
this.b = new LinkedBlockingDeque();
}
public IBinder a() throws InterruptedException {
if (this.a.compareAndSet(true, true)) {
throw new IllegalStateException("Binder already consumed");
}
return this.b.take();
}
@Override // android.content.ServiceConnection
public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
if (iBinder != null) {
try {
this.b.put(iBinder);
} catch (InterruptedException unused) {
}
}
}
@Override // android.content.ServiceConnection
public void onServiceDisconnected(ComponentName componentName) {
}
}
private static AttributionIdentifiers a(Context context) {
AttributionIdentifiers b = b(context);
if (b != null) {
return b;
}
AttributionIdentifiers c = c(context);
return c == null ? new AttributionIdentifiers() : c;
}
private static AttributionIdentifiers b(Context context) {
Method a;
Object a2;
try {
if (Looper.myLooper() == Looper.getMainLooper()) {
throw new FacebookException("getAndroidId cannot be called on the main thread.");
}
Method a3 = Utility.a("com.google.android.gms.common.GooglePlayServicesUtil", "isGooglePlayServicesAvailable", (Class<?>[]) new Class[]{Context.class});
if (a3 == null) {
return null;
}
Object a4 = Utility.a((Object) null, a3, context);
if (!(a4 instanceof Integer) || ((Integer) a4).intValue() != 0 || (a = Utility.a("com.google.android.gms.ads.identifier.AdvertisingIdClient", "getAdvertisingIdInfo", (Class<?>[]) new Class[]{Context.class})) == null || (a2 = Utility.a((Object) null, a, context)) == null) {
return null;
}
Method a5 = Utility.a(a2.getClass(), "getId", (Class<?>[]) new Class[0]);
Method a6 = Utility.a(a2.getClass(), "isLimitAdTrackingEnabled", (Class<?>[]) new Class[0]);
if (a5 != null && a6 != null) {
AttributionIdentifiers attributionIdentifiers = new AttributionIdentifiers();
attributionIdentifiers.b = (String) Utility.a(a2, a5, new Object[0]);
attributionIdentifiers.d = ((Boolean) Utility.a(a2, a6, new Object[0])).booleanValue();
return attributionIdentifiers;
}
return null;
} catch (Exception e) {
Utility.a("android_id", e);
return null;
}
}
private static AttributionIdentifiers c(Context context) {
GoogleAdServiceConnection googleAdServiceConnection = new GoogleAdServiceConnection();
Intent intent = new Intent("com.google.android.gms.ads.identifier.service.START");
intent.setPackage("com.google.android.gms");
if (context.bindService(intent, googleAdServiceConnection, 1)) {
try {
GoogleAdInfo googleAdInfo = new GoogleAdInfo(googleAdServiceConnection.a());
AttributionIdentifiers attributionIdentifiers = new AttributionIdentifiers();
attributionIdentifiers.b = googleAdInfo.i();
attributionIdentifiers.d = googleAdInfo.j();
return attributionIdentifiers;
} catch (Exception e) {
Utility.a("android_id", e);
} finally {
context.unbindService(googleAdServiceConnection);
}
}
return null;
}
/* JADX WARN: Removed duplicated region for block: B:18:0x0064 A[Catch: all -> 0x00c7, Exception -> 0x00c9, TryCatch #5 {Exception -> 0x00c9, all -> 0x00c7, blocks: (B:12:0x0031, B:14:0x0042, B:16:0x005e, B:18:0x0064, B:20:0x0068, B:22:0x006c, B:57:0x004a, B:59:0x0056), top: B:11:0x0031 }] */
/* JADX WARN: Removed duplicated region for block: B:20:0x0068 A[Catch: all -> 0x00c7, Exception -> 0x00c9, TryCatch #5 {Exception -> 0x00c9, all -> 0x00c7, blocks: (B:12:0x0031, B:14:0x0042, B:16:0x005e, B:18:0x0064, B:20:0x0068, B:22:0x006c, B:57:0x004a, B:59:0x0056), top: B:11:0x0031 }] */
/* JADX WARN: Removed duplicated region for block: B:22:0x006c A[Catch: all -> 0x00c7, Exception -> 0x00c9, TRY_LEAVE, TryCatch #5 {Exception -> 0x00c9, all -> 0x00c7, blocks: (B:12:0x0031, B:14:0x0042, B:16:0x005e, B:18:0x0064, B:20:0x0068, B:22:0x006c, B:57:0x004a, B:59:0x0056), top: B:11:0x0031 }] */
/* JADX WARN: Removed duplicated region for block: B:53:0x00ef */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct code enable 'Show inconsistent code' option in preferences
*/
public static com.facebook.internal.AttributionIdentifiers d(android.content.Context r12) {
/*
Method dump skipped, instructions count: 243
To view this dump change 'Code comments level' option to 'DEBUG'
*/
throw new UnsupportedOperationException("Method not decompiled: com.facebook.internal.AttributionIdentifiers.d(android.content.Context):com.facebook.internal.AttributionIdentifiers");
}
private static String e(Context context) {
PackageManager packageManager = context.getPackageManager();
if (packageManager != null) {
return packageManager.getInstallerPackageName(context.getPackageName());
}
return null;
}
private static AttributionIdentifiers a(AttributionIdentifiers attributionIdentifiers) {
attributionIdentifiers.e = System.currentTimeMillis();
g = attributionIdentifiers;
return attributionIdentifiers;
}
public String a() {
return this.b;
}
public String c() {
return this.a;
}
public String b() {
return this.c;
}
public boolean d() {
return this.d;
}
}

View File

@@ -0,0 +1,57 @@
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.localbroadcastmanager.content.LocalBroadcastManager;
import com.facebook.appevents.AppEventsLogger;
/* loaded from: classes.dex */
public class BoltsMeasurementEventListener extends BroadcastReceiver {
private static BoltsMeasurementEventListener b;
private Context a;
private BoltsMeasurementEventListener(Context context) {
this.a = context.getApplicationContext();
}
private void a() {
LocalBroadcastManager.a(this.a).a(this);
}
private void b() {
LocalBroadcastManager.a(this.a).a(this, new IntentFilter("com.parse.bolts.measurement_event"));
}
protected void finalize() throws Throwable {
try {
a();
} finally {
super.finalize();
}
}
@Override // android.content.BroadcastReceiver
public void onReceive(Context context, Intent intent) {
AppEventsLogger b2 = AppEventsLogger.b(context);
String str = "bf_" + intent.getStringExtra("event_name");
Bundle bundleExtra = intent.getBundleExtra("event_args");
Bundle bundle = new Bundle();
for (String str2 : bundleExtra.keySet()) {
bundle.putString(str2.replaceAll("[^0-9a-zA-Z _-]", "-").replaceAll("^[ -]*", "").replaceAll("[ -]*$", ""), (String) bundleExtra.get(str2));
}
b2.a(str, bundle);
}
public static BoltsMeasurementEventListener a(Context context) {
BoltsMeasurementEventListener boltsMeasurementEventListener = b;
if (boltsMeasurementEventListener != null) {
return boltsMeasurementEventListener;
}
b = new BoltsMeasurementEventListener(context);
b.b();
return b;
}
}

View File

@@ -0,0 +1,98 @@
package com.facebook.internal;
import android.os.Bundle;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
/* loaded from: classes.dex */
public class BundleJSONConverter {
private static final Map<Class<?>, Setter> a = new HashMap();
public interface Setter {
void a(Bundle bundle, String str, Object obj) throws JSONException;
}
static {
a.put(Boolean.class, new Setter() { // from class: com.facebook.internal.BundleJSONConverter.1
@Override // com.facebook.internal.BundleJSONConverter.Setter
public void a(Bundle bundle, String str, Object obj) throws JSONException {
bundle.putBoolean(str, ((Boolean) obj).booleanValue());
}
});
a.put(Integer.class, new Setter() { // from class: com.facebook.internal.BundleJSONConverter.2
@Override // com.facebook.internal.BundleJSONConverter.Setter
public void a(Bundle bundle, String str, Object obj) throws JSONException {
bundle.putInt(str, ((Integer) obj).intValue());
}
});
a.put(Long.class, new Setter() { // from class: com.facebook.internal.BundleJSONConverter.3
@Override // com.facebook.internal.BundleJSONConverter.Setter
public void a(Bundle bundle, String str, Object obj) throws JSONException {
bundle.putLong(str, ((Long) obj).longValue());
}
});
a.put(Double.class, new Setter() { // from class: com.facebook.internal.BundleJSONConverter.4
@Override // com.facebook.internal.BundleJSONConverter.Setter
public void a(Bundle bundle, String str, Object obj) throws JSONException {
bundle.putDouble(str, ((Double) obj).doubleValue());
}
});
a.put(String.class, new Setter() { // from class: com.facebook.internal.BundleJSONConverter.5
@Override // com.facebook.internal.BundleJSONConverter.Setter
public void a(Bundle bundle, String str, Object obj) throws JSONException {
bundle.putString(str, (String) obj);
}
});
a.put(String[].class, new Setter() { // from class: com.facebook.internal.BundleJSONConverter.6
@Override // com.facebook.internal.BundleJSONConverter.Setter
public void a(Bundle bundle, String str, Object obj) throws JSONException {
throw new IllegalArgumentException("Unexpected type from JSON");
}
});
a.put(JSONArray.class, new Setter() { // from class: com.facebook.internal.BundleJSONConverter.7
@Override // com.facebook.internal.BundleJSONConverter.Setter
public void a(Bundle bundle, String str, Object obj) throws JSONException {
JSONArray jSONArray = (JSONArray) obj;
ArrayList<String> arrayList = new ArrayList<>();
if (jSONArray.length() == 0) {
bundle.putStringArrayList(str, arrayList);
return;
}
for (int i = 0; i < jSONArray.length(); i++) {
Object obj2 = jSONArray.get(i);
if (!(obj2 instanceof String)) {
throw new IllegalArgumentException("Unexpected type in an array: " + obj2.getClass());
}
arrayList.add((String) obj2);
}
bundle.putStringArrayList(str, arrayList);
}
});
}
public static Bundle a(JSONObject jSONObject) throws JSONException {
Bundle bundle = new Bundle();
Iterator<String> keys = jSONObject.keys();
while (keys.hasNext()) {
String next = keys.next();
Object obj = jSONObject.get(next);
if (obj != null && obj != JSONObject.NULL) {
if (obj instanceof JSONObject) {
bundle.putBundle(next, a((JSONObject) obj));
} else {
Setter setter = a.get(obj.getClass());
if (setter == null) {
throw new IllegalArgumentException("Unsupported type: " + obj.getClass());
}
setter.a(bundle, next, obj);
}
}
}
return bundle;
}
}

View File

@@ -0,0 +1,80 @@
package com.facebook.internal;
import android.content.Intent;
import com.facebook.CallbackManager;
import com.facebook.FacebookSdk;
import com.ubt.jimu.unity.bluetooth.MyUnityListener;
import java.util.HashMap;
import java.util.Map;
/* loaded from: classes.dex */
public final class CallbackManagerImpl implements CallbackManager {
private static Map<Integer, Callback> b = new HashMap();
private Map<Integer, Callback> a = new HashMap();
public interface Callback {
boolean a(int i, Intent intent);
}
public enum RequestCodeOffset {
Login(0),
Share(1),
Message(2),
Like(3),
GameRequest(4),
AppGroupCreate(5),
AppGroupJoin(6),
AppInvite(7),
DeviceShare(8);
private final int offset;
RequestCodeOffset(int i) {
this.offset = i;
}
public int toRequestCode() {
return FacebookSdk.f() + this.offset;
}
}
private static synchronized Callback a(Integer num) {
Callback callback;
synchronized (CallbackManagerImpl.class) {
callback = b.get(num);
}
return callback;
}
public static synchronized void b(int i, Callback callback) {
synchronized (CallbackManagerImpl.class) {
Validate.a(callback, MyUnityListener.CALLBACK);
if (b.containsKey(Integer.valueOf(i))) {
return;
}
b.put(Integer.valueOf(i), callback);
}
}
public void a(int i, Callback callback) {
Validate.a(callback, MyUnityListener.CALLBACK);
this.a.put(Integer.valueOf(i), callback);
}
@Override // com.facebook.CallbackManager
public boolean a(int i, int i2, Intent intent) {
Callback callback = this.a.get(Integer.valueOf(i));
if (callback != null) {
return callback.a(i2, intent);
}
return b(i, i2, intent);
}
private static boolean b(int i, int i2, Intent intent) {
Callback a = a(Integer.valueOf(i));
if (a != null) {
return a.a(i2, intent);
}
return false;
}
}

View File

@@ -0,0 +1,24 @@
package com.facebook.internal;
import android.app.Activity;
import android.net.Uri;
import android.os.Bundle;
import androidx.browser.customtabs.CustomTabsIntent;
import com.facebook.FacebookSdk;
/* loaded from: classes.dex */
public class CustomTab {
private Uri a;
public CustomTab(String str, Bundle bundle) {
bundle = bundle == null ? new Bundle() : bundle;
this.a = Utility.a(ServerProtocol.b(), FacebookSdk.j() + "/dialog/" + str, bundle);
}
public void a(Activity activity, String str) {
CustomTabsIntent a = new CustomTabsIntent.Builder().a();
a.a.setPackage(str);
a.a.addFlags(1073741824);
a.a(activity, this.a);
}
}

View File

@@ -0,0 +1,10 @@
package com.facebook.internal;
/* loaded from: classes.dex */
public interface DialogFeature {
String getAction();
int getMinVersion();
String name();
}

View File

@@ -0,0 +1,104 @@
package com.facebook.internal;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import com.facebook.FacebookActivity;
import com.facebook.FacebookException;
import com.facebook.FacebookSdk;
import com.facebook.internal.FetchedAppSettings;
import com.facebook.internal.NativeProtocol;
/* loaded from: classes.dex */
public class DialogPresenter {
public interface ParameterProvider {
Bundle a();
Bundle b();
}
public static void a(AppCall appCall) {
b(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 void b(AppCall appCall, FacebookException facebookException) {
a(appCall, facebookException);
}
public static NativeProtocol.ProtocolVersionQueryResult b(DialogFeature dialogFeature) {
String c = FacebookSdk.c();
String action = dialogFeature.getAction();
return NativeProtocol.a(action, a(c, action, dialogFeature));
}
public static void a(AppCall appCall, Activity activity) {
activity.startActivityForResult(appCall.c(), appCall.b());
appCall.d();
}
public static void a(AppCall appCall, FragmentWrapper fragmentWrapper) {
fragmentWrapper.a(appCall.c(), appCall.b());
throw null;
}
public static boolean a(DialogFeature dialogFeature) {
return b(dialogFeature).a() != -1;
}
public static void a(AppCall appCall, FacebookException facebookException) {
if (facebookException == null) {
return;
}
Validate.c(FacebookSdk.b());
Intent intent = new Intent();
intent.setClass(FacebookSdk.b(), FacebookActivity.class);
intent.setAction(FacebookActivity.b);
NativeProtocol.a(intent, appCall.a().toString(), (String) null, NativeProtocol.e(), NativeProtocol.a(facebookException));
appCall.a(intent);
}
public static void a(AppCall appCall, String str, Bundle bundle) {
Validate.c(FacebookSdk.b());
Validate.d(FacebookSdk.b());
Bundle bundle2 = new Bundle();
bundle2.putString("action", str);
bundle2.putBundle("params", bundle);
Intent intent = new Intent();
NativeProtocol.a(intent, appCall.a().toString(), str, NativeProtocol.e(), bundle2);
intent.setClass(FacebookSdk.b(), FacebookActivity.class);
intent.setAction("FacebookDialogFragment");
appCall.a(intent);
}
public static void a(AppCall appCall, ParameterProvider parameterProvider, DialogFeature dialogFeature) {
Bundle b;
Context b2 = FacebookSdk.b();
String action = dialogFeature.getAction();
NativeProtocol.ProtocolVersionQueryResult b3 = b(dialogFeature);
int a = b3.a();
if (a != -1) {
if (NativeProtocol.b(a)) {
b = parameterProvider.a();
} else {
b = parameterProvider.b();
}
if (b == null) {
b = new Bundle();
}
Intent a2 = NativeProtocol.a(b2, appCall.a().toString(), action, b3, b);
if (a2 != null) {
appCall.a(a2);
return;
}
throw new FacebookException("Unable to create Intent; this likely means theFacebook app is not installed.");
}
throw new FacebookException("Cannot present this dialog. This likely means that the Facebook app is not installed.");
}
private static int[] a(String str, String str2, DialogFeature dialogFeature) {
FetchedAppSettings.DialogFeatureConfig a = FetchedAppSettings.a(str, str2, dialogFeature.name());
return a != null ? a.c() : new int[]{dialogFeature.getMinVersion()};
}
}

View File

@@ -0,0 +1,118 @@
package com.facebook.internal;
import android.app.Activity;
import android.util.Log;
import com.facebook.FacebookDialog;
import com.facebook.FacebookException;
import com.facebook.FacebookSdk;
import java.util.Iterator;
import java.util.List;
/* loaded from: classes.dex */
public abstract class FacebookDialogBase<CONTENT, RESULT> implements FacebookDialog<CONTENT, RESULT> {
protected static final Object e = new Object();
private final Activity a;
private final FragmentWrapper b;
private List<FacebookDialogBase<CONTENT, RESULT>.ModeHandler> c;
private int d;
/* JADX INFO: Access modifiers changed from: protected */
public abstract class ModeHandler {
protected ModeHandler(FacebookDialogBase facebookDialogBase) {
}
public abstract AppCall a(CONTENT content);
public Object a() {
return FacebookDialogBase.e;
}
public abstract boolean a(CONTENT content, boolean z);
}
protected FacebookDialogBase(Activity activity, int i) {
Validate.a(activity, "activity");
this.a = activity;
this.b = null;
this.d = i;
}
private List<FacebookDialogBase<CONTENT, RESULT>.ModeHandler> e() {
if (this.c == null) {
this.c = c();
}
return this.c;
}
protected abstract AppCall a();
public void a(CONTENT content) {
a(content, e);
}
protected Activity b() {
Activity activity = this.a;
if (activity != null) {
return activity;
}
FragmentWrapper fragmentWrapper = this.b;
if (fragmentWrapper == null) {
return null;
}
fragmentWrapper.a();
throw null;
}
protected abstract List<FacebookDialogBase<CONTENT, RESULT>.ModeHandler> c();
public int d() {
return this.d;
}
protected void a(CONTENT content, Object obj) {
AppCall b = b(content, obj);
if (b == null) {
Log.e("FacebookDialog", "No code path should ever result in a null appCall");
if (FacebookSdk.n()) {
throw new IllegalStateException("No code path should ever result in a null appCall");
}
} else {
FragmentWrapper fragmentWrapper = this.b;
if (fragmentWrapper == null) {
DialogPresenter.a(b, this.a);
} else {
DialogPresenter.a(b, fragmentWrapper);
throw null;
}
}
}
private AppCall b(CONTENT content, Object obj) {
boolean z = obj == e;
AppCall appCall = null;
Iterator<FacebookDialogBase<CONTENT, RESULT>.ModeHandler> it = e().iterator();
while (true) {
if (!it.hasNext()) {
break;
}
FacebookDialogBase<CONTENT, RESULT>.ModeHandler next = it.next();
if (z || Utility.a(next.a(), obj)) {
if (next.a(content, true)) {
try {
appCall = next.a(content);
break;
} catch (FacebookException e2) {
appCall = a();
DialogPresenter.b(appCall, e2);
}
}
}
}
if (appCall != null) {
return appCall;
}
AppCall a = a();
DialogPresenter.a(a);
return a;
}
}

View File

@@ -0,0 +1,118 @@
package com.facebook.internal;
import android.app.Dialog;
import android.content.Intent;
import android.content.res.Configuration;
import android.os.Bundle;
import androidx.fragment.app.DialogFragment;
import androidx.fragment.app.FragmentActivity;
import com.facebook.FacebookException;
import com.facebook.FacebookSdk;
import com.facebook.internal.WebDialog;
/* loaded from: classes.dex */
public class FacebookDialogFragment extends DialogFragment {
private Dialog j;
/* JADX INFO: Access modifiers changed from: private */
public void b(Bundle bundle) {
FragmentActivity activity = getActivity();
Intent intent = new Intent();
if (bundle == null) {
bundle = new Bundle();
}
intent.putExtras(bundle);
activity.setResult(-1, intent);
activity.finish();
}
@Override // androidx.fragment.app.Fragment, android.content.ComponentCallbacks
public void onConfigurationChanged(Configuration configuration) {
super.onConfigurationChanged(configuration);
if ((this.j instanceof WebDialog) && isResumed()) {
((WebDialog) this.j).d();
}
}
@Override // androidx.fragment.app.DialogFragment, androidx.fragment.app.Fragment
public void onCreate(Bundle bundle) {
WebDialog webDialog;
super.onCreate(bundle);
if (this.j == null) {
FragmentActivity activity = getActivity();
Bundle d = NativeProtocol.d(activity.getIntent());
if (d.getBoolean("is_fallback", false)) {
String string = d.getString("url");
if (Utility.c(string)) {
Utility.a("FacebookDialogFragment", "Cannot start a fallback WebDialog with an empty/missing 'url'");
activity.finish();
return;
} else {
FacebookWebFallbackDialog facebookWebFallbackDialog = new FacebookWebFallbackDialog(activity, string, String.format("fb%s://bridge/", FacebookSdk.c()));
facebookWebFallbackDialog.a(new WebDialog.OnCompleteListener() { // from class: com.facebook.internal.FacebookDialogFragment.2
@Override // com.facebook.internal.WebDialog.OnCompleteListener
public void a(Bundle bundle2, FacebookException facebookException) {
FacebookDialogFragment.this.b(bundle2);
}
});
webDialog = facebookWebFallbackDialog;
}
} else {
String string2 = d.getString("action");
Bundle bundle2 = d.getBundle("params");
if (Utility.c(string2)) {
Utility.a("FacebookDialogFragment", "Cannot start a WebDialog with an empty/missing 'actionName'");
activity.finish();
return;
} else {
WebDialog.Builder builder = new WebDialog.Builder(activity, string2, bundle2);
builder.a(new WebDialog.OnCompleteListener() { // from class: com.facebook.internal.FacebookDialogFragment.1
@Override // com.facebook.internal.WebDialog.OnCompleteListener
public void a(Bundle bundle3, FacebookException facebookException) {
FacebookDialogFragment.this.a(bundle3, facebookException);
}
});
webDialog = builder.a();
}
}
this.j = webDialog;
}
}
@Override // androidx.fragment.app.DialogFragment, androidx.fragment.app.Fragment
public void onDestroyView() {
if (b() != null && getRetainInstance()) {
b().setDismissMessage(null);
}
super.onDestroyView();
}
@Override // androidx.fragment.app.Fragment
public void onResume() {
super.onResume();
Dialog dialog = this.j;
if (dialog instanceof WebDialog) {
((WebDialog) dialog).d();
}
}
public void a(Dialog dialog) {
this.j = dialog;
}
@Override // androidx.fragment.app.DialogFragment
public Dialog a(Bundle bundle) {
if (this.j == null) {
a((Bundle) null, (FacebookException) null);
b(false);
}
return this.j;
}
/* JADX INFO: Access modifiers changed from: private */
public void a(Bundle bundle, FacebookException facebookException) {
FragmentActivity activity = getActivity();
activity.setResult(facebookException == null ? -1 : 0, NativeProtocol.a(activity.getIntent(), bundle, facebookException));
activity.finish();
}
}

View File

@@ -0,0 +1,49 @@
package com.facebook.internal;
import android.content.ContentProvider;
import android.content.ContentValues;
import android.database.Cursor;
import android.net.Uri;
import android.util.Log;
import com.facebook.FacebookSdk;
/* loaded from: classes.dex */
public final class FacebookInitProvider extends ContentProvider {
private static final String a = FacebookInitProvider.class.getSimpleName();
@Override // android.content.ContentProvider
public int delete(Uri uri, String str, String[] strArr) {
return 0;
}
@Override // android.content.ContentProvider
public String getType(Uri uri) {
return null;
}
@Override // android.content.ContentProvider
public Uri insert(Uri uri, ContentValues contentValues) {
return null;
}
@Override // android.content.ContentProvider
public boolean onCreate() {
try {
FacebookSdk.c(getContext());
return false;
} catch (Exception e) {
Log.i(a, "Failed to auto initialize the Facebook SDK", e);
return false;
}
}
@Override // android.content.ContentProvider
public Cursor query(Uri uri, String[] strArr, String str, String[] strArr2, String str2) {
return null;
}
@Override // android.content.ContentProvider
public int update(Uri uri, ContentValues contentValues, String str, String[] strArr) {
return 0;
}
}

View File

@@ -0,0 +1,173 @@
package com.facebook.internal;
import com.facebook.FacebookRequestError;
import com.ubt.jimu.base.entities.Course;
import com.unity3d.ads.metadata.MediationMetaData;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import org.json.JSONArray;
import org.json.JSONObject;
/* loaded from: classes.dex */
public final class FacebookRequestErrorClassification {
private static FacebookRequestErrorClassification g;
private final Map<Integer, Set<Integer>> a;
private final Map<Integer, Set<Integer>> b;
private final Map<Integer, Set<Integer>> c;
private final String d;
private final String e;
private final String f;
/* renamed from: com.facebook.internal.FacebookRequestErrorClassification$3, reason: invalid class name */
static /* synthetic */ class AnonymousClass3 {
static final /* synthetic */ int[] a = new int[FacebookRequestError.Category.values().length];
static {
try {
a[FacebookRequestError.Category.OTHER.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
a[FacebookRequestError.Category.LOGIN_RECOVERABLE.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
a[FacebookRequestError.Category.TRANSIENT.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
}
}
FacebookRequestErrorClassification(Map<Integer, Set<Integer>> map, Map<Integer, Set<Integer>> map2, Map<Integer, Set<Integer>> map3, String str, String str2, String str3) {
this.a = map;
this.b = map2;
this.c = map3;
this.d = str;
this.e = str2;
this.f = str3;
}
private static FacebookRequestErrorClassification b() {
return new FacebookRequestErrorClassification(null, new HashMap<Integer, Set<Integer>>() { // from class: com.facebook.internal.FacebookRequestErrorClassification.1
{
put(2, null);
put(4, null);
put(9, null);
put(17, null);
put(341, null);
}
}, new HashMap<Integer, Set<Integer>>() { // from class: com.facebook.internal.FacebookRequestErrorClassification.2
{
put(102, null);
put(190, null);
}
}, null, null, null);
}
public String a(FacebookRequestError.Category category) {
int i = AnonymousClass3.a[category.ordinal()];
if (i == 1) {
return this.d;
}
if (i == 2) {
return this.f;
}
if (i != 3) {
return null;
}
return this.e;
}
public FacebookRequestError.Category a(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.a;
if (map != null && map.containsKey(Integer.valueOf(i)) && ((set3 = this.a.get(Integer.valueOf(i))) == null || set3.contains(Integer.valueOf(i2)))) {
return FacebookRequestError.Category.OTHER;
}
Map<Integer, Set<Integer>> map2 = this.c;
if (map2 != null && map2.containsKey(Integer.valueOf(i)) && ((set2 = this.c.get(Integer.valueOf(i))) == null || set2.contains(Integer.valueOf(i2)))) {
return FacebookRequestError.Category.LOGIN_RECOVERABLE;
}
Map<Integer, Set<Integer>> map3 = this.b;
if (map3 != null && map3.containsKey(Integer.valueOf(i)) && ((set = this.b.get(Integer.valueOf(i))) == null || set.contains(Integer.valueOf(i2)))) {
return FacebookRequestError.Category.TRANSIENT;
}
return FacebookRequestError.Category.OTHER;
}
public static synchronized FacebookRequestErrorClassification a() {
FacebookRequestErrorClassification facebookRequestErrorClassification;
synchronized (FacebookRequestErrorClassification.class) {
if (g == null) {
g = b();
}
facebookRequestErrorClassification = g;
}
return facebookRequestErrorClassification;
}
private static Map<Integer, Set<Integer>> a(JSONObject jSONObject) {
int optInt;
HashSet hashSet;
JSONArray optJSONArray = jSONObject.optJSONArray("items");
if (optJSONArray.length() == 0) {
return null;
}
HashMap hashMap = new HashMap();
for (int i = 0; i < optJSONArray.length(); i++) {
JSONObject optJSONObject = optJSONArray.optJSONObject(i);
if (optJSONObject != null && (optInt = optJSONObject.optInt(Course.TYPE_BLOCKLY)) != 0) {
JSONArray optJSONArray2 = optJSONObject.optJSONArray("subcodes");
if (optJSONArray2 == null || optJSONArray2.length() <= 0) {
hashSet = null;
} else {
hashSet = new HashSet();
for (int i2 = 0; i2 < optJSONArray2.length(); i2++) {
int optInt2 = optJSONArray2.optInt(i2);
if (optInt2 != 0) {
hashSet.add(Integer.valueOf(optInt2));
}
}
}
hashMap.put(Integer.valueOf(optInt), hashSet);
}
}
return hashMap;
}
public static FacebookRequestErrorClassification a(JSONArray jSONArray) {
String optString;
if (jSONArray == null) {
return null;
}
Map<Integer, Set<Integer>> map = null;
Map<Integer, Set<Integer>> map2 = null;
Map<Integer, Set<Integer>> map3 = null;
String str = null;
String str2 = null;
String str3 = null;
for (int i = 0; i < jSONArray.length(); i++) {
JSONObject optJSONObject = jSONArray.optJSONObject(i);
if (optJSONObject != null && (optString = optJSONObject.optString(MediationMetaData.KEY_NAME)) != null) {
if (optString.equalsIgnoreCase("other")) {
str = optJSONObject.optString("recovery_message", null);
map = a(optJSONObject);
} else if (optString.equalsIgnoreCase("transient")) {
str2 = optJSONObject.optString("recovery_message", null);
map2 = a(optJSONObject);
} else if (optString.equalsIgnoreCase("login_recoverable")) {
str3 = optJSONObject.optString("recovery_message", null);
map3 = a(optJSONObject);
}
}
}
return new FacebookRequestErrorClassification(map, map2, map3, str, str2, str3);
}
}

View File

@@ -0,0 +1,41 @@
package com.facebook.internal;
import android.content.Context;
import android.content.pm.PackageManager;
import android.content.pm.Signature;
import android.os.Build;
import java.util.HashSet;
/* loaded from: classes.dex */
public class FacebookSignatureValidator {
private static final HashSet<String> a = a();
private static HashSet<String> a() {
HashSet<String> hashSet = new HashSet<>();
hashSet.add("8a3c4b262d721acd49a4bf97d5213199c86fa2b9");
hashSet.add("a4b7452e2ed8f5f191058ca7bbfd26b0d3214bfc");
hashSet.add("5e8f16062ea3cd2c4a0d547876baa6f38cabf625");
return hashSet;
}
public static boolean a(Context context, String str) {
String str2 = Build.BRAND;
int i = context.getApplicationInfo().flags;
if (str2.startsWith("generic") && (i & 2) != 0) {
return true;
}
try {
Signature[] signatureArr = context.getPackageManager().getPackageInfo(str, 64).signatures;
if (signatureArr != null && signatureArr.length > 0) {
for (Signature signature : signatureArr) {
if (!a.contains(Utility.a(signature.toByteArray()))) {
return false;
}
}
return true;
}
} catch (PackageManager.NameNotFoundException unused) {
}
return false;
}
}

View File

@@ -0,0 +1,71 @@
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 com.unity3d.ads.metadata.MediationMetaData;
import org.json.JSONException;
import org.json.JSONObject;
/* loaded from: classes.dex */
public class FacebookWebFallbackDialog extends WebDialog {
private static final String m = FacebookWebFallbackDialog.class.getName();
private boolean l;
public FacebookWebFallbackDialog(Context context, String str, String str2) {
super(context, str);
b(str2);
}
@Override // com.facebook.internal.WebDialog, android.app.Dialog, android.content.DialogInterface
public void cancel() {
WebView a = a();
if (!c() || b() || a == null || !a.isShown()) {
super.cancel();
return;
}
if (this.l) {
return;
}
this.l = true;
a.loadUrl("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.1
@Override // java.lang.Runnable
public void run() {
FacebookWebFallbackDialog.super.cancel();
}
}, 1500L);
}
@Override // com.facebook.internal.WebDialog
protected Bundle a(String str) {
Bundle d = Utility.d(Uri.parse(str).getQuery());
String string = d.getString("bridge_args");
d.remove("bridge_args");
if (!Utility.c(string)) {
try {
d.putBundle("com.facebook.platform.protocol.BRIDGE_ARGS", BundleJSONConverter.a(new JSONObject(string)));
} catch (JSONException e) {
Utility.a(m, "Unable to parse bridge_args JSON", e);
}
}
String string2 = d.getString("method_results");
d.remove("method_results");
if (!Utility.c(string2)) {
if (Utility.c(string2)) {
string2 = "{}";
}
try {
d.putBundle("com.facebook.platform.protocol.RESULT_ARGS", BundleJSONConverter.a(new JSONObject(string2)));
} catch (JSONException e2) {
Utility.a(m, "Unable to parse bridge_args JSON", e2);
}
}
d.remove(MediationMetaData.KEY_VERSION);
d.putInt("com.facebook.platform.protocol.PROTOCOL_VERSION", NativeProtocol.e());
return d;
}
}

View File

@@ -0,0 +1,134 @@
package com.facebook.internal;
import android.net.Uri;
import com.unity3d.ads.metadata.MediationMetaData;
import java.util.EnumSet;
import java.util.Map;
import org.json.JSONArray;
import org.json.JSONObject;
/* loaded from: classes.dex */
public final class FetchedAppSettings {
private boolean a;
private boolean b;
private int c;
private EnumSet<SmartLoginOption> d;
private Map<String, Map<String, DialogFeatureConfig>> e;
private boolean f;
private FacebookRequestErrorClassification g;
public FetchedAppSettings(boolean z, String str, boolean z2, boolean z3, int i, EnumSet<SmartLoginOption> enumSet, Map<String, Map<String, DialogFeatureConfig>> map, boolean z4, FacebookRequestErrorClassification facebookRequestErrorClassification, String str2, String str3) {
this.a = z;
this.b = z3;
this.e = map;
this.g = facebookRequestErrorClassification;
this.c = i;
this.f = z4;
this.d = enumSet;
}
public boolean a() {
return this.f;
}
public boolean b() {
return this.b;
}
public Map<String, Map<String, DialogFeatureConfig>> c() {
return this.e;
}
public FacebookRequestErrorClassification d() {
return this.g;
}
public int e() {
return this.c;
}
public EnumSet<SmartLoginOption> f() {
return this.d;
}
public boolean g() {
return this.a;
}
public static DialogFeatureConfig a(String str, String str2, String str3) {
FetchedAppSettings c;
Map<String, DialogFeatureConfig> map;
if (Utility.c(str2) || Utility.c(str3) || (c = FetchedAppSettingsManager.c(str)) == null || (map = c.c().get(str2)) == null) {
return null;
}
return map.get(str3);
}
public static class DialogFeatureConfig {
private String a;
private String b;
private int[] c;
private DialogFeatureConfig(String str, String str2, Uri uri, int[] iArr) {
this.a = str;
this.b = str2;
this.c = iArr;
}
public static DialogFeatureConfig a(JSONObject jSONObject) {
String optString = jSONObject.optString(MediationMetaData.KEY_NAME);
if (Utility.c(optString)) {
return null;
}
String[] split = optString.split("\\|");
if (split.length != 2) {
return null;
}
String str = split[0];
String str2 = split[1];
if (Utility.c(str) || Utility.c(str2)) {
return null;
}
String optString2 = jSONObject.optString("url");
return new DialogFeatureConfig(str, str2, Utility.c(optString2) ? null : Uri.parse(optString2), a(jSONObject.optJSONArray("versions")));
}
public String b() {
return this.b;
}
public int[] c() {
return this.c;
}
private static int[] a(JSONArray jSONArray) {
if (jSONArray == null) {
return null;
}
int length = jSONArray.length();
int[] iArr = new int[length];
for (int i = 0; i < length; i++) {
int i2 = -1;
int optInt = jSONArray.optInt(i, -1);
if (optInt == -1) {
String optString = jSONArray.optString(i);
if (!Utility.c(optString)) {
try {
i2 = Integer.parseInt(optString);
} catch (NumberFormatException e) {
Utility.a("FacebookSDK", (Exception) e);
}
iArr[i] = i2;
}
}
i2 = optInt;
iArr[i] = i2;
}
return iArr;
}
public String a() {
return this.a;
}
}
}

View File

@@ -0,0 +1,123 @@
package com.facebook.internal;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.text.TextUtils;
import com.facebook.AccessToken;
import com.facebook.FacebookSdk;
import com.facebook.GraphRequest;
import com.facebook.appevents.internal.AutomaticAnalyticsLogger;
import com.facebook.appevents.internal.Constants;
import com.facebook.internal.FetchedAppSettings;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicBoolean;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
/* loaded from: classes.dex */
public final class FetchedAppSettingsManager {
private static final String[] a = {"supports_implicit_sdk_logging", "gdpv4_nux_content", "gdpv4_nux_enabled", "gdpv4_chrome_custom_tabs_enabled", "android_dialog_configs", "android_sdk_error_categories", "app_events_session_timeout", "app_events_feature_bitmask", "seamless_login", "smart_login_bookmark_icon_url", "smart_login_menu_icon_url"};
private static Map<String, FetchedAppSettings> b = new ConcurrentHashMap();
private static AtomicBoolean c = new AtomicBoolean(false);
public static void b() {
final Context b2 = FacebookSdk.b();
final String c2 = FacebookSdk.c();
boolean compareAndSet = c.compareAndSet(false, true);
if (Utility.c(c2) || b.containsKey(c2) || !compareAndSet) {
return;
}
final String format = String.format("com.facebook.internal.APP_SETTINGS.%s", c2);
FacebookSdk.h().execute(new Runnable() { // from class: com.facebook.internal.FetchedAppSettingsManager.1
@Override // java.lang.Runnable
public void run() {
SharedPreferences sharedPreferences = b2.getSharedPreferences("com.facebook.internal.preferences.APP_SETTINGS", 0);
JSONObject jSONObject = null;
String string = sharedPreferences.getString(format, null);
if (!Utility.c(string)) {
try {
jSONObject = new JSONObject(string);
} catch (JSONException e) {
Utility.a("FacebookSDK", (Exception) e);
}
if (jSONObject != null) {
FetchedAppSettingsManager.b(c2, jSONObject);
}
}
JSONObject b3 = FetchedAppSettingsManager.b(c2);
if (b3 != null) {
FetchedAppSettingsManager.b(c2, b3);
sharedPreferences.edit().putString(format, b3.toString()).apply();
}
AutomaticAnalyticsLogger.a();
FetchedAppSettingsManager.c.set(false);
}
});
}
public static FetchedAppSettings c(String str) {
if (str != null) {
return b.get(str);
}
return null;
}
public static FetchedAppSettings a(String str, boolean z) {
if (!z && b.containsKey(str)) {
return b.get(str);
}
JSONObject b2 = b(str);
if (b2 == null) {
return null;
}
return b(str, b2);
}
private static Map<String, Map<String, FetchedAppSettings.DialogFeatureConfig>> a(JSONObject jSONObject) {
JSONArray optJSONArray;
HashMap hashMap = new HashMap();
if (jSONObject != null && (optJSONArray = jSONObject.optJSONArray("data")) != null) {
for (int i = 0; i < optJSONArray.length(); i++) {
FetchedAppSettings.DialogFeatureConfig a2 = FetchedAppSettings.DialogFeatureConfig.a(optJSONArray.optJSONObject(i));
if (a2 != null) {
String a3 = a2.a();
Map map = (Map) hashMap.get(a3);
if (map == null) {
map = new HashMap();
hashMap.put(a3, map);
}
map.put(a2.b(), a2);
}
}
}
return hashMap;
}
/* JADX INFO: Access modifiers changed from: private */
public static FetchedAppSettings b(String str, JSONObject jSONObject) {
FacebookRequestErrorClassification a2;
JSONArray optJSONArray = jSONObject.optJSONArray("android_sdk_error_categories");
if (optJSONArray == null) {
a2 = FacebookRequestErrorClassification.a();
} else {
a2 = FacebookRequestErrorClassification.a(optJSONArray);
}
FetchedAppSettings fetchedAppSettings = new FetchedAppSettings(jSONObject.optBoolean("supports_implicit_sdk_logging", false), jSONObject.optString("gdpv4_nux_content", ""), jSONObject.optBoolean("gdpv4_nux_enabled", false), jSONObject.optBoolean("gdpv4_chrome_custom_tabs_enabled", false), jSONObject.optInt("app_events_session_timeout", Constants.a()), SmartLoginOption.parseOptions(jSONObject.optLong("seamless_login")), a(jSONObject.optJSONObject("android_dialog_configs")), (jSONObject.optInt("app_events_feature_bitmask", 0) & 8) != 0, a2, jSONObject.optString("smart_login_bookmark_icon_url"), jSONObject.optString("smart_login_menu_icon_url"));
b.put(str, fetchedAppSettings);
return fetchedAppSettings;
}
/* JADX INFO: Access modifiers changed from: private */
public static JSONObject b(String str) {
Bundle bundle = new Bundle();
bundle.putString("fields", TextUtils.join(",", a));
GraphRequest a2 = GraphRequest.a((AccessToken) null, str, (GraphRequest.Callback) null);
a2.a(true);
a2.a(bundle);
return a2.a().b();
}
}

View File

@@ -0,0 +1,15 @@
package com.facebook.internal;
import android.app.Activity;
import android.content.Intent;
/* loaded from: classes.dex */
public class FragmentWrapper {
public final Activity a() {
throw null;
}
public void a(Intent intent, int i) {
throw null;
}
}

View File

@@ -0,0 +1,26 @@
package com.facebook.internal;
import android.net.Uri;
import com.baidu.cloud.media.player.misc.IMediaFormat;
import java.util.Locale;
/* loaded from: classes.dex */
public class ImageRequest {
public static Uri a(String str, int i, int i2) {
Validate.a(str, "userId");
int max = Math.max(i, 0);
int max2 = Math.max(i2, 0);
if (max == 0 && max2 == 0) {
throw new IllegalArgumentException("Either width or height must be greater than 0");
}
Uri.Builder path = new Uri.Builder().scheme("https").authority("graph.facebook.com").path(String.format(Locale.US, "%s/picture", str));
if (max2 != 0) {
path.appendQueryParameter(IMediaFormat.KEY_HEIGHT, String.valueOf(max2));
}
if (max != 0) {
path.appendQueryParameter(IMediaFormat.KEY_WIDTH, String.valueOf(max));
}
path.appendQueryParameter("migration_overrides", "{october_2012:true}");
return path.build();
}
}

View File

@@ -0,0 +1,10 @@
package com.facebook.internal;
/* loaded from: classes.dex */
public class InternalSettings {
private static volatile String a;
public static String a() {
return a;
}
}

View File

@@ -0,0 +1,28 @@
package com.facebook.internal;
import com.facebook.FacebookSdk;
import java.util.concurrent.Callable;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.FutureTask;
/* loaded from: classes.dex */
public class LockOnGetVariable<T> {
private T a;
private CountDownLatch b = new CountDownLatch(1);
public LockOnGetVariable(final Callable<T> callable) {
FacebookSdk.h().execute(new FutureTask(new Callable<Void>() { // from class: com.facebook.internal.LockOnGetVariable.1
@Override // java.util.concurrent.Callable
public Void call() throws Exception {
try {
LockOnGetVariable.this.a = callable.call();
LockOnGetVariable.this.b.countDown();
return null;
} catch (Throwable th) {
LockOnGetVariable.this.b.countDown();
throw th;
}
}
}));
}
}

View File

@@ -0,0 +1,104 @@
package com.facebook.internal;
import android.util.Log;
import com.facebook.FacebookSdk;
import com.facebook.LoggingBehavior;
import java.util.HashMap;
import java.util.Map;
/* loaded from: classes.dex */
public class Logger {
private static final HashMap<String, String> e = new HashMap<>();
private final LoggingBehavior a;
private final String b;
private StringBuilder c;
private int d = 3;
public Logger(LoggingBehavior loggingBehavior, String str) {
Validate.a(str, "tag");
this.a = loggingBehavior;
this.b = "FacebookSDK." + str;
this.c = new StringBuilder();
}
public static synchronized void a(String str, String str2) {
synchronized (Logger.class) {
e.put(str, str2);
}
}
public static synchronized void c(String str) {
synchronized (Logger.class) {
if (!FacebookSdk.a(LoggingBehavior.INCLUDE_ACCESS_TOKENS)) {
a(str, "ACCESS_TOKEN_REMOVED");
}
}
}
private static synchronized String d(String str) {
synchronized (Logger.class) {
for (Map.Entry<String, String> entry : e.entrySet()) {
str = str.replace(entry.getKey(), entry.getValue());
}
}
return str;
}
public void b(String str) {
a(this.a, this.d, this.b, str);
}
private boolean b() {
return FacebookSdk.a(this.a);
}
public static void a(LoggingBehavior loggingBehavior, String str, String str2) {
a(loggingBehavior, 3, str, str2);
}
public static void a(LoggingBehavior loggingBehavior, String str, String str2, Object... objArr) {
if (FacebookSdk.a(loggingBehavior)) {
a(loggingBehavior, 3, str, String.format(str2, objArr));
}
}
public static void a(LoggingBehavior loggingBehavior, int i, String str, String str2, Object... objArr) {
if (FacebookSdk.a(loggingBehavior)) {
a(loggingBehavior, i, str, String.format(str2, objArr));
}
}
public static void a(LoggingBehavior loggingBehavior, int i, String str, String str2) {
if (FacebookSdk.a(loggingBehavior)) {
String d = d(str2);
if (!str.startsWith("FacebookSDK.")) {
str = "FacebookSDK." + str;
}
Log.println(i, str, d);
if (loggingBehavior == LoggingBehavior.DEVELOPER_ERRORS) {
new Exception().printStackTrace();
}
}
}
public void a() {
b(this.c.toString());
this.c = new StringBuilder();
}
public void a(String str) {
if (b()) {
this.c.append(str);
}
}
public void a(String str, Object... objArr) {
if (b()) {
this.c.append(String.format(str, objArr));
}
}
public void a(String str, Object obj) {
a(" %s:\t%s\n", str, obj);
}
}

View File

@@ -0,0 +1,7 @@
package com.facebook.internal;
/* loaded from: classes.dex */
public enum LoginAuthorizationType {
READ,
PUBLISH
}

View File

@@ -0,0 +1,201 @@
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.OutputStream;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.UUID;
/* loaded from: classes.dex */
public final class NativeAppCallAttachmentStore {
private static final String a = "com.facebook.internal.NativeAppCallAttachmentStore";
private static File b;
public static final class Attachment {
private final UUID a;
private final String b;
private final String c;
private Bitmap d;
private Uri e;
private boolean f;
private boolean g;
private Attachment(UUID uuid, Bitmap bitmap, Uri uri) {
this.a = uuid;
this.d = bitmap;
this.e = uri;
if (uri != null) {
String scheme = uri.getScheme();
if ("content".equalsIgnoreCase(scheme)) {
this.f = true;
this.g = (uri.getAuthority() == null || uri.getAuthority().startsWith("media")) ? false : true;
} else if ("file".equalsIgnoreCase(uri.getScheme())) {
this.g = true;
} else if (!Utility.e(uri)) {
throw new FacebookException("Unsupported scheme for media Uri : " + scheme);
}
} else {
if (bitmap == null) {
throw new FacebookException("Cannot share media without a bitmap or Uri set");
}
this.g = true;
}
this.c = !this.g ? null : UUID.randomUUID().toString();
this.b = !this.g ? this.e.toString() : FacebookContentProvider.a(FacebookSdk.c(), uuid, this.c);
}
public String a() {
return this.b;
}
}
private NativeAppCallAttachmentStore() {
}
public static Attachment a(UUID uuid, Bitmap bitmap) {
Validate.a(uuid, "callId");
Validate.a(bitmap, "attachmentBitmap");
return new Attachment(uuid, bitmap, null);
}
static File b() {
File c = c();
c.mkdirs();
return c;
}
static synchronized File c() {
File file;
synchronized (NativeAppCallAttachmentStore.class) {
if (b == null) {
b = new File(FacebookSdk.b().getCacheDir(), "com.facebook.NativeAppCallAttachmentStore.files");
}
file = b;
}
return file;
}
public static Attachment a(UUID uuid, Uri uri) {
Validate.a(uuid, "callId");
Validate.a(uri, "attachmentUri");
return new Attachment(uuid, null, uri);
}
private static void a(Bitmap bitmap, File file) throws IOException {
FileOutputStream fileOutputStream = new FileOutputStream(file);
try {
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, fileOutputStream);
} finally {
Utility.a(fileOutputStream);
}
}
private static void a(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.b().getContentResolver().openInputStream(uri);
}
Utility.a(openInputStream, (OutputStream) fileOutputStream);
} finally {
Utility.a(fileOutputStream);
}
}
public static void a(Collection<Attachment> collection) {
if (collection == null || collection.size() == 0) {
return;
}
if (b == null) {
a();
}
b();
ArrayList arrayList = new ArrayList();
try {
for (Attachment attachment : collection) {
if (attachment.g) {
File a2 = a(attachment.a, attachment.c, true);
arrayList.add(a2);
if (attachment.d != null) {
a(attachment.d, a2);
} else if (attachment.e != null) {
a(attachment.e, attachment.f, a2);
}
}
}
} catch (IOException e) {
Log.e(a, "Got unexpected exception:" + e);
Iterator it = arrayList.iterator();
while (it.hasNext()) {
try {
((File) it.next()).delete();
} catch (Exception unused) {
}
}
throw new FacebookException(e);
}
}
public static void a(UUID uuid) {
File a2 = a(uuid, false);
if (a2 != null) {
Utility.a(a2);
}
}
public static File a(UUID uuid, String str) throws FileNotFoundException {
if (!Utility.c(str) && uuid != null) {
try {
return a(uuid, str, false);
} catch (IOException unused) {
throw new FileNotFoundException();
}
}
throw new FileNotFoundException();
}
static File a(UUID uuid, boolean z) {
File file = b;
if (file == null) {
return null;
}
File file2 = new File(file, uuid.toString());
if (z && !file2.exists()) {
file2.mkdirs();
}
return file2;
}
static File a(UUID uuid, String str, boolean z) throws IOException {
File a2 = a(uuid, z);
if (a2 == null) {
return null;
}
try {
return new File(a2, URLEncoder.encode(str, "UTF-8"));
} catch (UnsupportedEncodingException unused) {
return null;
}
}
public static void a() {
Utility.a(c());
}
}

View File

@@ -0,0 +1,512 @@
package com.facebook.internal;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ProviderInfo;
import android.content.pm.ResolveInfo;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import com.baidu.cloud.media.player.BDCloudMediaPlayer;
import com.facebook.FacebookException;
import com.facebook.FacebookOperationCanceledException;
import com.facebook.FacebookSdk;
import com.facebook.login.DefaultAudience;
import com.unity3d.ads.metadata.MediationMetaData;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.TreeSet;
import java.util.UUID;
import java.util.concurrent.atomic.AtomicBoolean;
/* loaded from: classes.dex */
public final class NativeProtocol {
private static final String a = "com.facebook.internal.NativeProtocol";
private static List<NativeAppInfo> b = d();
private static Map<String, List<NativeAppInfo>> c = c();
private static AtomicBoolean d = new AtomicBoolean(false);
private static final List<Integer> e = Arrays.asList(20160327, 20141218, 20141107, 20141028, 20141001, 20140701, 20140324, 20140204, 20131107, 20130618, 20130502, 20121101);
private static class FBLiteAppInfo extends NativeAppInfo {
private FBLiteAppInfo() {
super();
}
@Override // com.facebook.internal.NativeProtocol.NativeAppInfo
protected String b() {
return "com.facebook.lite.platform.LoginGDPDialogActivity";
}
@Override // com.facebook.internal.NativeProtocol.NativeAppInfo
protected String c() {
return "com.facebook.lite";
}
}
private static class KatanaAppInfo extends NativeAppInfo {
private KatanaAppInfo() {
super();
}
@Override // com.facebook.internal.NativeProtocol.NativeAppInfo
protected String b() {
return "com.facebook.katana.ProxyAuth";
}
@Override // com.facebook.internal.NativeProtocol.NativeAppInfo
protected String c() {
return "com.facebook.katana";
}
}
private static class MessengerAppInfo extends NativeAppInfo {
private MessengerAppInfo() {
super();
}
@Override // com.facebook.internal.NativeProtocol.NativeAppInfo
protected String b() {
return null;
}
@Override // com.facebook.internal.NativeProtocol.NativeAppInfo
protected String c() {
return "com.facebook.orca";
}
}
private static abstract class NativeAppInfo {
private TreeSet<Integer> a;
private NativeAppInfo() {
}
protected abstract String b();
protected abstract String c();
public TreeSet<Integer> a() {
if (this.a == null) {
a(false);
}
return this.a;
}
/* JADX INFO: Access modifiers changed from: private */
/* JADX WARN: Code restructure failed: missing block: B:12:0x0005, code lost:
if (r0.a == null) goto L6;
*/
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct code enable 'Show inconsistent code' option in preferences
*/
public synchronized void a(boolean r1) {
/*
r0 = this;
monitor-enter(r0)
if (r1 != 0) goto L7
java.util.TreeSet<java.lang.Integer> r1 = r0.a // Catch: java.lang.Throwable -> Lf
if (r1 != 0) goto Ld
L7:
java.util.TreeSet r1 = com.facebook.internal.NativeProtocol.a(r0) // Catch: java.lang.Throwable -> Lf
r0.a = r1 // Catch: java.lang.Throwable -> Lf
Ld:
monitor-exit(r0)
return
Lf:
r1 = move-exception
monitor-exit(r0)
throw r1
*/
throw new UnsupportedOperationException("Method not decompiled: com.facebook.internal.NativeProtocol.NativeAppInfo.a(boolean):void");
}
}
public static class ProtocolVersionQueryResult {
private NativeAppInfo a;
private int b;
private ProtocolVersionQueryResult() {
}
public static ProtocolVersionQueryResult a(NativeAppInfo nativeAppInfo, int i) {
ProtocolVersionQueryResult protocolVersionQueryResult = new ProtocolVersionQueryResult();
protocolVersionQueryResult.a = nativeAppInfo;
protocolVersionQueryResult.b = i;
return protocolVersionQueryResult;
}
public static ProtocolVersionQueryResult b() {
ProtocolVersionQueryResult protocolVersionQueryResult = new ProtocolVersionQueryResult();
protocolVersionQueryResult.b = -1;
return protocolVersionQueryResult;
}
public int a() {
return this.b;
}
}
private static class WakizashiAppInfo extends NativeAppInfo {
private WakizashiAppInfo() {
super();
}
@Override // com.facebook.internal.NativeProtocol.NativeAppInfo
protected String b() {
return "com.facebook.katana.ProxyAuth";
}
@Override // com.facebook.internal.NativeProtocol.NativeAppInfo
protected String c() {
return "com.facebook.wakizashi";
}
}
private static Map<String, List<NativeAppInfo>> c() {
HashMap hashMap = new HashMap();
ArrayList arrayList = new ArrayList();
arrayList.add(new MessengerAppInfo());
hashMap.put("com.facebook.platform.action.request.OGACTIONPUBLISH_DIALOG", b);
hashMap.put("com.facebook.platform.action.request.FEED_DIALOG", b);
hashMap.put("com.facebook.platform.action.request.LIKE_DIALOG", b);
hashMap.put("com.facebook.platform.action.request.APPINVITES_DIALOG", b);
hashMap.put("com.facebook.platform.action.request.MESSAGE_DIALOG", arrayList);
hashMap.put("com.facebook.platform.action.request.OGMESSAGEPUBLISH_DIALOG", arrayList);
return hashMap;
}
private static List<NativeAppInfo> d() {
ArrayList arrayList = new ArrayList();
arrayList.add(new KatanaAppInfo());
arrayList.add(new WakizashiAppInfo());
return arrayList;
}
public static final int e() {
return e.get(0).intValue();
}
public static Bundle f(Intent intent) {
int e2 = e(intent);
Bundle extras = intent.getExtras();
return (!b(e2) || extras == null) ? extras : extras.getBundle("com.facebook.platform.protocol.RESULT_ARGS");
}
public static boolean g(Intent intent) {
Bundle a2 = a(intent);
return a2 != null ? a2.containsKey(BDCloudMediaPlayer.OnNativeInvokeListener.ARG_ERROR) : intent.hasExtra("com.facebook.platform.status.ERROR_TYPE");
}
static Intent b(Context context, Intent intent, NativeAppInfo nativeAppInfo) {
ResolveInfo resolveService;
if (intent == null || (resolveService = context.getPackageManager().resolveService(intent, 0)) == null || !FacebookSignatureValidator.a(context, resolveService.serviceInfo.packageName)) {
return null;
}
return intent;
}
public static int e(Intent intent) {
return intent.getIntExtra("com.facebook.platform.protocol.PROTOCOL_VERSION", 0);
}
static Intent a(Context context, Intent intent, NativeAppInfo nativeAppInfo) {
ResolveInfo resolveActivity;
if (intent == null || (resolveActivity = context.getPackageManager().resolveActivity(intent, 0)) == null || !FacebookSignatureValidator.a(context, resolveActivity.activityInfo.packageName)) {
return null;
}
return intent;
}
public static Intent b(Context context, String str, Collection<String> collection, String str2, boolean z, boolean z2, DefaultAudience defaultAudience, String str3) {
for (NativeAppInfo nativeAppInfo : b) {
Intent a2 = a(context, a(nativeAppInfo, str, collection, str2, z, z2, defaultAudience, str3), nativeAppInfo);
if (a2 != null) {
return a2;
}
}
return null;
}
public static Bundle d(Intent intent) {
if (!b(e(intent))) {
return intent.getExtras();
}
return intent.getBundleExtra("com.facebook.platform.protocol.METHOD_ARGS");
}
public static Intent a(Context context, String str, Collection<String> collection, String str2, boolean z, boolean z2, DefaultAudience defaultAudience, String str3) {
FBLiteAppInfo fBLiteAppInfo = new FBLiteAppInfo();
return a(context, a(fBLiteAppInfo, str, collection, str2, z, z2, defaultAudience, str3), fBLiteAppInfo);
}
public static void f() {
if (d.compareAndSet(false, true)) {
FacebookSdk.h().execute(new Runnable() { // from class: com.facebook.internal.NativeProtocol.1
@Override // java.lang.Runnable
public void run() {
try {
Iterator it = NativeProtocol.b.iterator();
while (it.hasNext()) {
((NativeAppInfo) it.next()).a(true);
}
} finally {
NativeProtocol.d.set(false);
}
}
});
}
}
public static boolean b(int i) {
return e.contains(Integer.valueOf(i)) && i >= 20140701;
}
private static Intent a(NativeAppInfo nativeAppInfo, String str, Collection<String> collection, String str2, boolean z, boolean z2, DefaultAudience defaultAudience, String str3) {
String b2 = nativeAppInfo.b();
if (b2 == null) {
return null;
}
Intent putExtra = new Intent().setClassName(nativeAppInfo.c(), b2).putExtra("client_id", str);
putExtra.putExtra("facebook_sdk_version", FacebookSdk.l());
if (!Utility.a(collection)) {
putExtra.putExtra("scope", TextUtils.join(",", collection));
}
if (!Utility.c(str2)) {
putExtra.putExtra("e2e", str2);
}
putExtra.putExtra("state", str3);
putExtra.putExtra("response_type", "token,signed_request");
putExtra.putExtra("return_scopes", "true");
if (z2) {
putExtra.putExtra("default_audience", defaultAudience.getNativeProtocolAudience());
}
putExtra.putExtra("legacy_override", FacebookSdk.j());
putExtra.putExtra("auth_type", "rerequest");
return putExtra;
}
public static UUID b(Intent intent) {
String stringExtra;
if (intent == null) {
return null;
}
if (b(e(intent))) {
Bundle bundleExtra = intent.getBundleExtra("com.facebook.platform.protocol.BRIDGE_ARGS");
stringExtra = bundleExtra != null ? bundleExtra.getString("action_id") : null;
} else {
stringExtra = intent.getStringExtra("com.facebook.platform.protocol.CALL_ID");
}
if (stringExtra == null) {
return null;
}
try {
return UUID.fromString(stringExtra);
} catch (IllegalArgumentException unused) {
return null;
}
}
public static Bundle c(Intent intent) {
if (!g(intent)) {
return null;
}
Bundle a2 = a(intent);
if (a2 != null) {
return a2.getBundle(BDCloudMediaPlayer.OnNativeInvokeListener.ARG_ERROR);
}
return intent.getExtras();
}
private static Uri b(NativeAppInfo nativeAppInfo) {
return Uri.parse("content://" + nativeAppInfo.c() + ".provider.PlatformProvider/versions");
}
/* JADX INFO: Access modifiers changed from: private */
public static TreeSet<Integer> c(NativeAppInfo nativeAppInfo) {
ProviderInfo providerInfo;
TreeSet<Integer> treeSet = new TreeSet<>();
ContentResolver contentResolver = FacebookSdk.b().getContentResolver();
String[] strArr = {MediationMetaData.KEY_VERSION};
Uri b2 = b(nativeAppInfo);
Cursor cursor = null;
try {
try {
providerInfo = FacebookSdk.b().getPackageManager().resolveContentProvider(nativeAppInfo.c() + ".provider.PlatformProvider", 0);
} catch (RuntimeException e2) {
Log.e(a, "Failed to query content resolver.", e2);
providerInfo = null;
}
if (providerInfo != null) {
try {
cursor = contentResolver.query(b2, strArr, null, null, null);
} catch (NullPointerException | SecurityException unused) {
Log.e(a, "Failed to query content resolver.");
}
if (cursor != null) {
while (cursor.moveToNext()) {
treeSet.add(Integer.valueOf(cursor.getInt(cursor.getColumnIndex(MediationMetaData.KEY_VERSION))));
}
}
}
return treeSet;
} finally {
if (cursor != null) {
cursor.close();
}
}
}
public static Intent a(Context context, String str, String str2, ProtocolVersionQueryResult protocolVersionQueryResult, Bundle bundle) {
NativeAppInfo nativeAppInfo;
Intent a2;
if (protocolVersionQueryResult == null || (nativeAppInfo = protocolVersionQueryResult.a) == null || (a2 = a(context, new Intent().setAction("com.facebook.platform.PLATFORM_ACTIVITY").setPackage(nativeAppInfo.c()).addCategory("android.intent.category.DEFAULT"), nativeAppInfo)) == null) {
return null;
}
a(a2, str, str2, protocolVersionQueryResult.b, bundle);
return a2;
}
public static void a(Intent intent, String str, String str2, int i, Bundle bundle) {
String c2 = FacebookSdk.c();
String d2 = FacebookSdk.d();
intent.putExtra("com.facebook.platform.protocol.PROTOCOL_VERSION", i).putExtra("com.facebook.platform.protocol.PROTOCOL_ACTION", str2).putExtra("com.facebook.platform.extra.APPLICATION_ID", c2);
if (b(i)) {
Bundle bundle2 = new Bundle();
bundle2.putString("action_id", str);
Utility.a(bundle2, "app_name", d2);
intent.putExtra("com.facebook.platform.protocol.BRIDGE_ARGS", bundle2);
if (bundle == null) {
bundle = new Bundle();
}
intent.putExtra("com.facebook.platform.protocol.METHOD_ARGS", bundle);
return;
}
intent.putExtra("com.facebook.platform.protocol.CALL_ID", str);
if (!Utility.c(d2)) {
intent.putExtra("com.facebook.platform.extra.APPLICATION_NAME", d2);
}
intent.putExtras(bundle);
}
public static Intent a(Intent intent, Bundle bundle, FacebookException facebookException) {
UUID b2 = b(intent);
if (b2 == null) {
return null;
}
Intent intent2 = new Intent();
intent2.putExtra("com.facebook.platform.protocol.PROTOCOL_VERSION", e(intent));
Bundle bundle2 = new Bundle();
bundle2.putString("action_id", b2.toString());
if (facebookException != null) {
bundle2.putBundle(BDCloudMediaPlayer.OnNativeInvokeListener.ARG_ERROR, a(facebookException));
}
intent2.putExtra("com.facebook.platform.protocol.BRIDGE_ARGS", bundle2);
if (bundle != null) {
intent2.putExtra("com.facebook.platform.protocol.RESULT_ARGS", bundle);
}
return intent2;
}
public static Intent a(Context context) {
for (NativeAppInfo nativeAppInfo : b) {
Intent b2 = b(context, new Intent("com.facebook.platform.PLATFORM_SERVICE").setPackage(nativeAppInfo.c()).addCategory("android.intent.category.DEFAULT"), nativeAppInfo);
if (b2 != null) {
return b2;
}
}
return null;
}
public static Bundle a(Intent intent) {
if (b(e(intent))) {
return intent.getBundleExtra("com.facebook.platform.protocol.BRIDGE_ARGS");
}
return null;
}
public static FacebookException a(Bundle bundle) {
if (bundle == null) {
return null;
}
String string = bundle.getString("error_type");
if (string == null) {
string = bundle.getString("com.facebook.platform.status.ERROR_TYPE");
}
String string2 = bundle.getString("error_description");
if (string2 == null) {
string2 = bundle.getString("com.facebook.platform.status.ERROR_DESCRIPTION");
}
if (string != null && string.equalsIgnoreCase("UserCanceled")) {
return new FacebookOperationCanceledException(string2);
}
return new FacebookException(string2);
}
public static Bundle a(FacebookException facebookException) {
if (facebookException == null) {
return null;
}
Bundle bundle = new Bundle();
bundle.putString("error_description", facebookException.toString());
if (facebookException instanceof FacebookOperationCanceledException) {
bundle.putString("error_type", "UserCanceled");
}
return bundle;
}
public static int a(int i) {
return a(b, new int[]{i}).a();
}
public static ProtocolVersionQueryResult a(String str, int[] iArr) {
return a(c.get(str), iArr);
}
private static ProtocolVersionQueryResult a(List<NativeAppInfo> list, int[] iArr) {
f();
if (list == null) {
return ProtocolVersionQueryResult.b();
}
for (NativeAppInfo nativeAppInfo : list) {
int a2 = a(nativeAppInfo.a(), e(), iArr);
if (a2 != -1) {
return ProtocolVersionQueryResult.a(nativeAppInfo, a2);
}
}
return ProtocolVersionQueryResult.b();
}
public static int a(TreeSet<Integer> treeSet, int i, int[] iArr) {
int length = iArr.length - 1;
Iterator<Integer> descendingIterator = treeSet.descendingIterator();
int i2 = length;
int i3 = -1;
while (descendingIterator.hasNext()) {
int intValue = descendingIterator.next().intValue();
i3 = Math.max(i3, intValue);
while (i2 >= 0 && iArr[i2] > intValue) {
i2--;
}
if (i2 < 0) {
return -1;
}
if (iArr[i2] == intValue) {
if (i2 % 2 == 0) {
return Math.min(i3, i);
}
return -1;
}
}
return -1;
}
}

View File

@@ -0,0 +1,7 @@
package com.facebook.internal;
/* loaded from: classes.dex */
public enum PermissionType {
READ,
PUBLISH
}

View File

@@ -0,0 +1,120 @@
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;
/* loaded from: classes.dex */
public abstract class PlatformServiceClient implements ServiceConnection {
private final Context a;
private final Handler b;
private CompletedListener c;
private boolean d;
private Messenger e;
private int f;
private int g;
private final String h;
private final int i;
public interface CompletedListener {
void a(Bundle bundle);
}
public PlatformServiceClient(Context context, int i, int i2, int i3, String str) {
Context applicationContext = context.getApplicationContext();
this.a = applicationContext != null ? applicationContext : context;
this.f = i;
this.g = i2;
this.h = str;
this.i = i3;
this.b = new Handler() { // from class: com.facebook.internal.PlatformServiceClient.1
@Override // android.os.Handler
public void handleMessage(Message message) {
PlatformServiceClient.this.a(message);
}
};
}
private void c() {
Bundle bundle = new Bundle();
bundle.putString("com.facebook.platform.extra.APPLICATION_ID", this.h);
a(bundle);
Message obtain = Message.obtain((Handler) null, this.f);
obtain.arg1 = this.i;
obtain.setData(bundle);
obtain.replyTo = new Messenger(this.b);
try {
this.e.send(obtain);
} catch (RemoteException unused) {
b(null);
}
}
protected abstract void a(Bundle bundle);
public void a(CompletedListener completedListener) {
this.c = completedListener;
}
public boolean b() {
Intent a;
if (this.d || NativeProtocol.a(this.i) == -1 || (a = NativeProtocol.a(this.a)) == null) {
return false;
}
this.d = true;
this.a.bindService(a, this, 1);
return true;
}
@Override // android.content.ServiceConnection
public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
this.e = new Messenger(iBinder);
c();
}
@Override // android.content.ServiceConnection
public void onServiceDisconnected(ComponentName componentName) {
this.e = null;
try {
this.a.unbindService(this);
} catch (IllegalArgumentException unused) {
}
b(null);
}
public void a() {
this.d = false;
}
protected void a(Message message) {
if (message.what == this.g) {
Bundle data = message.getData();
if (data.getString("com.facebook.platform.status.ERROR_TYPE") != null) {
b(null);
} else {
b(data);
}
try {
this.a.unbindService(this);
} catch (IllegalArgumentException unused) {
}
}
}
private void b(Bundle bundle) {
if (this.d) {
this.d = false;
CompletedListener completedListener = this.c;
if (completedListener != null) {
completedListener.a(bundle);
}
}
}
}

View File

@@ -0,0 +1,17 @@
package com.facebook.internal;
import java.util.concurrent.ConcurrentHashMap;
import org.json.JSONObject;
/* loaded from: classes.dex */
class ProfileInformationCache {
private static final ConcurrentHashMap<String, JSONObject> a = new ConcurrentHashMap<>();
public static JSONObject a(String str) {
return a.get(str);
}
public static void a(String str, JSONObject jSONObject) {
a.put(str, jSONObject);
}
}

View File

@@ -0,0 +1,26 @@
package com.facebook.internal;
import com.facebook.FacebookSdk;
import java.util.Collection;
/* loaded from: classes.dex */
public final class ServerProtocol {
public static final Collection<String> a = Utility.b("service_disabled", "AndroidAuthKillSwitchException");
public static final Collection<String> b = Utility.b("access_denied", "OAuthAccessDeniedException");
public static final String a() {
return "v2.9";
}
public static final String b() {
return String.format("m.%s", FacebookSdk.i());
}
public static final String c() {
return String.format("https://graph.%s", FacebookSdk.i());
}
public static final String d() {
return String.format("https://graph-video.%s", FacebookSdk.i());
}
}

View File

@@ -0,0 +1,34 @@
package com.facebook.internal;
import java.util.EnumSet;
import java.util.Iterator;
/* loaded from: classes.dex */
public enum SmartLoginOption {
None(0),
Enabled(1),
RequireConfirm(2);
public static final EnumSet<SmartLoginOption> ALL = EnumSet.allOf(SmartLoginOption.class);
private final long mValue;
SmartLoginOption(long j) {
this.mValue = j;
}
public static EnumSet<SmartLoginOption> parseOptions(long j) {
EnumSet<SmartLoginOption> noneOf = EnumSet.noneOf(SmartLoginOption.class);
Iterator it = ALL.iterator();
while (it.hasNext()) {
SmartLoginOption smartLoginOption = (SmartLoginOption) it.next();
if ((smartLoginOption.getValue() & j) != 0) {
noneOf.add(smartLoginOption);
}
}
return noneOf;
}
public long getValue() {
return this.mValue;
}
}

View File

@@ -0,0 +1,804 @@
package com.facebook.internal;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.os.Parcel;
import android.os.StatFs;
import android.telephony.TelephonyManager;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.Display;
import android.view.WindowManager;
import android.webkit.CookieManager;
import android.webkit.CookieSyncManager;
import com.facebook.AccessToken;
import com.facebook.FacebookException;
import com.facebook.FacebookSdk;
import com.facebook.GraphRequest;
import com.facebook.GraphResponse;
import com.facebook.HttpMethod;
import com.liulishuo.filedownloader.model.FileDownloadModel;
import com.ubt.jimu.diy.model.CategoryModel;
import com.ubt.jimu.unity.bluetooth.UnityActivity;
import java.io.BufferedInputStream;
import java.io.Closeable;
import java.io.File;
import java.io.FilenameFilter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.math.BigInteger;
import java.net.HttpURLConnection;
import java.net.URLConnection;
import java.net.URLDecoder;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Random;
import java.util.Set;
import java.util.TimeZone;
import java.util.regex.Pattern;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.json.JSONTokener;
/* loaded from: classes.dex */
public final class Utility {
private static int a = 0;
private static long b = -1;
private static long c = -1;
private static long d = -1;
private static String e = "";
private static String f = "";
private static String g = "NoCarrier";
public interface GraphMeRequestWithCacheCallback {
void a(FacebookException facebookException);
void a(JSONObject jSONObject);
}
public interface Mapper<T, K> {
K apply(T t);
}
public static class PermissionsPair {
List<String> a;
List<String> b;
public PermissionsPair(List<String> list, List<String> list2) {
this.a = list;
this.b = list2;
}
public List<String> a() {
return this.b;
}
public List<String> b() {
return this.a;
}
}
public static <T> boolean a(Collection<T> collection) {
return collection == null || collection.size() == 0;
}
public static <T> Collection<T> b(T... tArr) {
return Collections.unmodifiableCollection(Arrays.asList(tArr));
}
public static boolean c(String str) {
return str == null || str.length() == 0;
}
public static Bundle d(String str) {
Bundle bundle = new Bundle();
if (!c(str)) {
for (String str2 : str.split("&")) {
String[] split = str2.split("=");
try {
if (split.length == 2) {
bundle.putString(URLDecoder.decode(split[0], "UTF-8"), URLDecoder.decode(split[1], "UTF-8"));
} else if (split.length == 1) {
bundle.putString(URLDecoder.decode(split[0], "UTF-8"), "");
}
} catch (UnsupportedEncodingException e2) {
a("FacebookSDK", (Exception) e2);
}
}
}
return bundle;
}
public static boolean e(Uri uri) {
return uri != null && ("http".equalsIgnoreCase(uri.getScheme()) || "https".equalsIgnoreCase(uri.getScheme()) || "fbstaging".equalsIgnoreCase(uri.getScheme()));
}
public static String a(byte[] bArr) {
return a("SHA-1", bArr);
}
public static List<String> b(JSONArray jSONArray) throws JSONException {
ArrayList arrayList = new ArrayList();
for (int i = 0; i < jSONArray.length(); i++) {
arrayList.add(jSONArray.getString(i));
}
return arrayList;
}
public static String c(Context context) {
Validate.a(context, "context");
FacebookSdk.c(context);
return FacebookSdk.c();
}
private static String a(String str, byte[] bArr) {
try {
return a(MessageDigest.getInstance(str), bArr);
} catch (NoSuchAlgorithmException unused) {
return null;
}
}
private static void e(Context context) {
if (b == -1 || System.currentTimeMillis() - b >= 1800000) {
b = System.currentTimeMillis();
d();
d(context);
e();
b();
}
}
private static String a(MessageDigest messageDigest, byte[] bArr) {
messageDigest.update(bArr);
byte[] digest = messageDigest.digest();
StringBuilder sb = new StringBuilder();
for (byte b2 : digest) {
sb.append(Integer.toHexString((b2 >> 4) & 15));
sb.append(Integer.toHexString((b2 >> 0) & 15));
}
return sb.toString();
}
public static String b(Context context) {
return context == null ? "null" : context == context.getApplicationContext() ? CategoryModel.unknown : context.getClass().getSimpleName();
}
public static boolean c(Uri uri) {
return uri != null && "content".equalsIgnoreCase(uri.getScheme());
}
private static int c() {
int i = a;
if (i > 0) {
return i;
}
try {
File[] listFiles = new File("/sys/devices/system/cpu/").listFiles(new FilenameFilter() { // from class: com.facebook.internal.Utility.2
@Override // java.io.FilenameFilter
public boolean accept(File file, String str) {
return Pattern.matches("cpu[0-9]+", str);
}
});
if (listFiles != null) {
a = listFiles.length;
}
} catch (Exception unused) {
}
if (a <= 0) {
a = Math.max(Runtime.getRuntime().availableProcessors(), 1);
}
return a;
}
public static String b(Uri uri) {
if (uri == null) {
return null;
}
return uri.toString();
}
private static GraphRequest b(String str) {
Bundle bundle = new Bundle();
bundle.putString("fields", "id,name,first_name,middle_name,last_name,link");
bundle.putString(AccessToken.ACCESS_TOKEN_KEY, str);
return new GraphRequest(null, "me", bundle, HttpMethod.GET, null);
}
private static void e() {
try {
if (a()) {
StatFs statFs = new StatFs(Environment.getExternalStorageDirectory().getPath());
c = statFs.getBlockCount() * statFs.getBlockSize();
}
c = a(c);
} catch (Exception unused) {
}
}
public static Uri a(String str, String str2, Bundle bundle) {
Uri.Builder builder = new Uri.Builder();
builder.scheme("https");
builder.authority(str);
builder.path(str2);
if (bundle != null) {
for (String str3 : bundle.keySet()) {
Object obj = bundle.get(str3);
if (obj instanceof String) {
builder.appendQueryParameter(str3, (String) obj);
}
}
}
return builder.build();
}
private static void b() {
try {
if (a()) {
StatFs statFs = new StatFs(Environment.getExternalStorageDirectory().getPath());
d = statFs.getAvailableBlocks() * statFs.getBlockSize();
}
d = a(d);
} catch (Exception unused) {
}
}
public static boolean d(Uri uri) {
return uri != null && "file".equalsIgnoreCase(uri.getScheme());
}
private static void d() {
try {
TimeZone timeZone = TimeZone.getDefault();
e = timeZone.getDisplayName(timeZone.inDaylightTime(new Date()), 0);
f = timeZone.getID();
} catch (Exception unused) {
}
}
public static void a(Bundle bundle, String str, String str2) {
if (c(str2)) {
return;
}
bundle.putString(str, str2);
}
private static void d(Context context) {
if (g.equals("NoCarrier")) {
try {
g = ((TelephonyManager) context.getSystemService("phone")).getNetworkOperatorName();
} catch (Exception unused) {
}
}
}
public static void a(Bundle bundle, String str, Uri uri) {
if (uri != null) {
a(bundle, str, uri.toString());
}
}
public static boolean a(Bundle bundle, String str, Object obj) {
if (obj == null) {
bundle.remove(str);
return true;
}
if (obj instanceof Boolean) {
bundle.putBoolean(str, ((Boolean) obj).booleanValue());
return true;
}
if (obj instanceof boolean[]) {
bundle.putBooleanArray(str, (boolean[]) obj);
return true;
}
if (obj instanceof Double) {
bundle.putDouble(str, ((Double) obj).doubleValue());
return true;
}
if (obj instanceof double[]) {
bundle.putDoubleArray(str, (double[]) obj);
return true;
}
if (obj instanceof Integer) {
bundle.putInt(str, ((Integer) obj).intValue());
return true;
}
if (obj instanceof int[]) {
bundle.putIntArray(str, (int[]) obj);
return true;
}
if (obj instanceof Long) {
bundle.putLong(str, ((Long) obj).longValue());
return true;
}
if (obj instanceof long[]) {
bundle.putLongArray(str, (long[]) obj);
return true;
}
if (obj instanceof String) {
bundle.putString(str, (String) obj);
return true;
}
if (obj instanceof JSONArray) {
bundle.putString(str, obj.toString());
return true;
}
if (!(obj instanceof JSONObject)) {
return false;
}
bundle.putString(str, obj.toString());
return true;
}
public static void a(Closeable closeable) {
if (closeable != null) {
try {
closeable.close();
} catch (IOException unused) {
}
}
}
public static void a(URLConnection uRLConnection) {
if (uRLConnection == null || !(uRLConnection instanceof HttpURLConnection)) {
return;
}
((HttpURLConnection) uRLConnection).disconnect();
}
public static Object a(JSONObject jSONObject, String str, String str2) throws JSONException {
Object opt = jSONObject.opt(str);
if (opt != null && (opt instanceof String)) {
opt = new JSONTokener((String) opt).nextValue();
}
if (opt == null || (opt instanceof JSONObject) || (opt instanceof JSONArray)) {
return opt;
}
if (str2 != null) {
JSONObject jSONObject2 = new JSONObject();
jSONObject2.putOpt(str2, opt);
return jSONObject2;
}
throw new FacebookException("Got an unexpected non-JSON object.");
}
public static String a(InputStream inputStream) throws IOException {
BufferedInputStream bufferedInputStream;
Throwable th;
InputStreamReader inputStreamReader;
try {
bufferedInputStream = new BufferedInputStream(inputStream);
try {
inputStreamReader = new InputStreamReader(bufferedInputStream);
} catch (Throwable th2) {
th = th2;
inputStreamReader = null;
}
try {
StringBuilder sb = new StringBuilder();
char[] cArr = new char[2048];
while (true) {
int read = inputStreamReader.read(cArr);
if (read != -1) {
sb.append(cArr, 0, read);
} else {
String sb2 = sb.toString();
a((Closeable) bufferedInputStream);
a(inputStreamReader);
return sb2;
}
}
} catch (Throwable th3) {
th = th3;
a((Closeable) bufferedInputStream);
a(inputStreamReader);
throw th;
}
} catch (Throwable th4) {
bufferedInputStream = null;
th = th4;
inputStreamReader = null;
}
}
public static int a(InputStream inputStream, OutputStream outputStream) throws IOException {
BufferedInputStream bufferedInputStream;
try {
bufferedInputStream = new BufferedInputStream(inputStream);
} catch (Throwable th) {
th = th;
bufferedInputStream = null;
}
try {
byte[] bArr = new byte[UnityActivity.BLOCKLY_TYPE_NONE];
int i = 0;
while (true) {
int read = bufferedInputStream.read(bArr);
if (read == -1) {
break;
}
outputStream.write(bArr, 0, read);
i += read;
}
bufferedInputStream.close();
if (inputStream != null) {
inputStream.close();
}
return i;
} catch (Throwable th2) {
th = th2;
if (bufferedInputStream != null) {
bufferedInputStream.close();
}
if (inputStream != null) {
inputStream.close();
}
throw th;
}
}
private static void a(Context context, String str) {
CookieSyncManager.createInstance(context).sync();
CookieManager cookieManager = CookieManager.getInstance();
String cookie = cookieManager.getCookie(str);
if (cookie == null) {
return;
}
for (String str2 : cookie.split(";")) {
String[] split = str2.split("=");
if (split.length > 0) {
cookieManager.setCookie(str, split[0].trim() + "=;expires=Sat, 1 Jan 2000 00:00:01 UTC;");
}
}
cookieManager.removeExpiredCookie();
}
public static void a(Context context) {
a(context, "facebook.com");
a(context, ".facebook.com");
a(context, "https://facebook.com");
a(context, "https://.facebook.com");
}
public static void a(String str, Exception exc) {
if (!FacebookSdk.n() || str == null || exc == null) {
return;
}
Log.d(str, exc.getClass().getSimpleName() + ": " + exc.getMessage());
}
public static void a(String str, String str2) {
if (!FacebookSdk.n() || str == null || str2 == null) {
return;
}
Log.d(str, str2);
}
public static void a(String str, String str2, Throwable th) {
if (!FacebookSdk.n() || c(str)) {
return;
}
Log.d(str, str2, th);
}
public static <T> boolean a(T t, T t2) {
if (t == null) {
return t2 == null;
}
return t.equals(t2);
}
public static void a(File file) {
File[] listFiles;
if (file.exists()) {
if (file.isDirectory() && (listFiles = file.listFiles()) != null) {
for (File file2 : listFiles) {
a(file2);
}
}
file.delete();
}
}
public static <T> List<T> a(T... tArr) {
ArrayList arrayList = new ArrayList();
for (T t : tArr) {
if (t != null) {
arrayList.add(t);
}
}
return arrayList;
}
public static Set<String> a(JSONArray jSONArray) throws JSONException {
HashSet hashSet = new HashSet();
for (int i = 0; i < jSONArray.length(); i++) {
hashSet.add(jSONArray.getString(i));
}
return hashSet;
}
public static void a(JSONObject jSONObject, AttributionIdentifiers attributionIdentifiers, String str, boolean z) throws JSONException {
if (attributionIdentifiers != null && attributionIdentifiers.c() != null) {
jSONObject.put("attribution", attributionIdentifiers.c());
}
if (attributionIdentifiers != null && attributionIdentifiers.a() != null) {
jSONObject.put("advertiser_id", attributionIdentifiers.a());
jSONObject.put("advertiser_tracking_enabled", !attributionIdentifiers.d());
}
if (attributionIdentifiers != null && attributionIdentifiers.b() != null) {
jSONObject.put("installer_package", attributionIdentifiers.b());
}
jSONObject.put("anon_id", str);
jSONObject.put("application_tracking_enabled", !z);
}
public static void a(JSONObject jSONObject, Context context) throws JSONException {
String str;
Locale locale;
int i;
int i2;
WindowManager windowManager;
JSONArray jSONArray = new JSONArray();
jSONArray.put("a2");
e(context);
String packageName = context.getPackageName();
int i3 = -1;
try {
PackageInfo packageInfo = context.getPackageManager().getPackageInfo(packageName, 0);
i3 = packageInfo.versionCode;
str = packageInfo.versionName;
} catch (PackageManager.NameNotFoundException unused) {
str = "";
}
jSONArray.put(packageName);
jSONArray.put(i3);
jSONArray.put(str);
jSONArray.put(Build.VERSION.RELEASE);
jSONArray.put(Build.MODEL);
try {
locale = context.getResources().getConfiguration().locale;
} catch (Exception unused2) {
locale = Locale.getDefault();
}
jSONArray.put(locale.getLanguage() + "_" + locale.getCountry());
jSONArray.put(e);
jSONArray.put(g);
double d2 = 0.0d;
try {
windowManager = (WindowManager) context.getSystemService("window");
} catch (Exception unused3) {
}
if (windowManager != null) {
Display defaultDisplay = windowManager.getDefaultDisplay();
DisplayMetrics displayMetrics = new DisplayMetrics();
defaultDisplay.getMetrics(displayMetrics);
i = displayMetrics.widthPixels;
try {
i2 = displayMetrics.heightPixels;
try {
d2 = displayMetrics.density;
} catch (Exception unused4) {
}
} catch (Exception unused5) {
}
jSONArray.put(i);
jSONArray.put(i2);
jSONArray.put(String.format("%.2f", Double.valueOf(d2)));
jSONArray.put(c());
jSONArray.put(c);
jSONArray.put(d);
jSONArray.put(f);
jSONObject.put("extinfo", jSONArray.toString());
}
i = 0;
i2 = 0;
jSONArray.put(i);
jSONArray.put(i2);
jSONArray.put(String.format("%.2f", Double.valueOf(d2)));
jSONArray.put(c());
jSONArray.put(c);
jSONArray.put(d);
jSONArray.put(f);
jSONObject.put("extinfo", jSONArray.toString());
}
public static Method a(Class<?> cls, String str, Class<?>... clsArr) {
try {
return cls.getMethod(str, clsArr);
} catch (NoSuchMethodException unused) {
return null;
}
}
public static Method a(String str, String str2, Class<?>... clsArr) {
try {
return a(Class.forName(str), str2, clsArr);
} catch (ClassNotFoundException unused) {
return null;
}
}
public static Object a(Object obj, Method method, Object... objArr) {
try {
return method.invoke(obj, objArr);
} catch (IllegalAccessException | InvocationTargetException unused) {
return null;
}
}
public static <T, K> List<K> a(List<T> list, Mapper<T, K> mapper) {
if (list == null) {
return null;
}
ArrayList arrayList = new ArrayList();
Iterator<T> it = list.iterator();
while (it.hasNext()) {
K apply = mapper.apply(it.next());
if (apply != null) {
arrayList.add(apply);
}
}
if (arrayList.size() == 0) {
return null;
}
return arrayList;
}
public static long a(Uri uri) {
Cursor cursor = null;
try {
cursor = FacebookSdk.b().getContentResolver().query(uri, null, null, null, null);
int columnIndex = cursor.getColumnIndex("_size");
cursor.moveToFirst();
return cursor.getLong(columnIndex);
} finally {
if (cursor != null) {
cursor.close();
}
}
}
public static Date a(Bundle bundle, String str, Date date) {
long parseLong;
if (bundle == null) {
return null;
}
Object obj = bundle.get(str);
if (obj instanceof Long) {
parseLong = ((Long) obj).longValue();
} else {
if (!(obj instanceof String)) {
return null;
}
try {
parseLong = Long.parseLong((String) obj);
} catch (NumberFormatException unused) {
return null;
}
}
if (parseLong == 0) {
return new Date(Long.MAX_VALUE);
}
return new Date(date.getTime() + (parseLong * 1000));
}
public static void a(Parcel parcel, Map<String, String> map) {
if (map == null) {
parcel.writeInt(-1);
return;
}
parcel.writeInt(map.size());
for (Map.Entry<String, String> entry : map.entrySet()) {
parcel.writeString(entry.getKey());
parcel.writeString(entry.getValue());
}
}
public static Map<String, String> a(Parcel parcel) {
int readInt = parcel.readInt();
if (readInt < 0) {
return null;
}
HashMap hashMap = new HashMap();
for (int i = 0; i < readInt; i++) {
hashMap.put(parcel.readString(), parcel.readString());
}
return hashMap;
}
public static boolean a(AccessToken accessToken) {
if (accessToken != null) {
return accessToken.equals(AccessToken.getCurrentAccessToken());
}
return false;
}
public static void a(final String str, final GraphMeRequestWithCacheCallback graphMeRequestWithCacheCallback) {
JSONObject a2 = ProfileInformationCache.a(str);
if (a2 != null) {
graphMeRequestWithCacheCallback.a(a2);
return;
}
GraphRequest.Callback callback = new GraphRequest.Callback() { // from class: com.facebook.internal.Utility.1
@Override // com.facebook.GraphRequest.Callback
public void a(GraphResponse graphResponse) {
if (graphResponse.a() != null) {
GraphMeRequestWithCacheCallback.this.a(graphResponse.a().getException());
} else {
ProfileInformationCache.a(str, graphResponse.b());
GraphMeRequestWithCacheCallback.this.a(graphResponse.b());
}
}
};
GraphRequest b2 = b(str);
b2.a(callback);
b2.b();
}
public static JSONObject a(String str) {
JSONObject a2 = ProfileInformationCache.a(str);
if (a2 != null) {
return a2;
}
GraphResponse a3 = b(str).a();
if (a3.a() != null) {
return null;
}
return a3.b();
}
private static boolean a() {
return "mounted".equals(Environment.getExternalStorageState());
}
private static long a(double d2) {
return Math.round(d2 / 1.073741824E9d);
}
public static PermissionsPair a(JSONObject jSONObject) throws JSONException {
String optString;
JSONArray jSONArray = jSONObject.getJSONObject("permissions").getJSONArray("data");
ArrayList arrayList = new ArrayList(jSONArray.length());
ArrayList arrayList2 = new ArrayList(jSONArray.length());
for (int i = 0; i < jSONArray.length(); i++) {
JSONObject optJSONObject = jSONArray.optJSONObject(i);
String optString2 = optJSONObject.optString("permission");
if (optString2 != null && !optString2.equals("installed") && (optString = optJSONObject.optString(FileDownloadModel.STATUS)) != null) {
if (optString.equals("granted")) {
arrayList.add(optString2);
} else if (optString.equals("declined")) {
arrayList2.add(optString2);
}
}
}
return new PermissionsPair(arrayList, arrayList2);
}
public static String a(int i) {
return new BigInteger(i * 5, new Random()).toString(32);
}
}

View File

@@ -0,0 +1,171 @@
package com.facebook.internal;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.net.Uri;
import android.util.Log;
import com.facebook.CustomTabActivity;
import com.facebook.FacebookSdk;
import com.facebook.FacebookSdkNotInitializedException;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
/* loaded from: classes.dex */
public final class Validate {
private static final String a = "com.facebook.internal.Validate";
public static void a(Object obj, String str) {
if (obj != null) {
return;
}
throw new NullPointerException("Argument '" + str + "' cannot be null");
}
public static <T> void b(Collection<T> collection, String str) {
if (collection.isEmpty()) {
throw new IllegalArgumentException("Container '" + str + "' cannot be empty");
}
}
public static <T> void c(Collection<T> collection, String str) {
a((Collection) collection, str);
b(collection, str);
}
public static void d(Context context) {
b(context, true);
}
public static <T> void a(Collection<T> collection, String str) {
a((Object) collection, str);
Iterator<T> it = collection.iterator();
while (it.hasNext()) {
if (it.next() == null) {
throw new NullPointerException("Container '" + str + "' cannot contain null values");
}
}
}
public static String b() {
String g = FacebookSdk.g();
if (g != null) {
return g;
}
throw new IllegalStateException("No Client Token found, please set the Client Token.");
}
public static void c() {
if (!FacebookSdk.o()) {
throw new FacebookSdkNotInitializedException("The SDK has not been initialized, make sure to call FacebookSdk.sdkInitialize() first.");
}
}
public static void a(String str, String str2) {
if (Utility.c(str)) {
throw new IllegalArgumentException("Argument '" + str2 + "' cannot be null or empty");
}
}
public static void b(Context context, boolean z) {
a(context, "context");
if (context.checkCallingOrSelfPermission("android.permission.INTERNET") == -1) {
if (!z) {
Log.w(a, "No internet permissions granted for the app, please add <uses-permission android:name=\"android.permission.INTERNET\" /> to your AndroidManifest.xml.");
return;
}
throw new IllegalStateException("No internet permissions granted for the app, please add <uses-permission android:name=\"android.permission.INTERNET\" /> to your AndroidManifest.xml.");
}
}
public static void c(Context context) {
a(context, true);
}
public static String a() {
String c = FacebookSdk.c();
if (c != null) {
return c;
}
throw new IllegalStateException("No App ID found, please set the App ID.");
}
/* JADX WARN: Removed duplicated region for block: B:14:0x002b A[ORIG_RETURN, RETURN] */
/* JADX WARN: Removed duplicated region for block: B:7:0x001b */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct code enable 'Show inconsistent code' option in preferences
*/
public static void a(android.content.Context r3, boolean r4) {
/*
java.lang.String r0 = "context"
a(r3, r0)
android.content.pm.PackageManager r0 = r3.getPackageManager()
if (r0 == 0) goto L18
android.content.ComponentName r1 = new android.content.ComponentName
java.lang.Class<com.facebook.FacebookActivity> r2 = com.facebook.FacebookActivity.class
r1.<init>(r3, r2)
r3 = 1
android.content.pm.ActivityInfo r3 = r0.getActivityInfo(r1, r3) // Catch: android.content.pm.PackageManager.NameNotFoundException -> L18
goto L19
L18:
r3 = 0
L19:
if (r3 != 0) goto L2b
java.lang.String r3 = "FacebookActivity is not declared in the AndroidManifest.xml, 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 L25
java.lang.String r4 = com.facebook.internal.Validate.a
android.util.Log.w(r4, r3)
goto L2b
L25:
java.lang.IllegalStateException r4 = new java.lang.IllegalStateException
r4.<init>(r3)
throw r4
L2b:
return
*/
throw new UnsupportedOperationException("Method not decompiled: com.facebook.internal.Validate.a(android.content.Context, boolean):void");
}
public static boolean b(Context context) {
List<ResolveInfo> list;
a(context, "context");
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("fb" + FacebookSdk.c() + "://authorize"));
list = packageManager.queryIntentActivities(intent, 64);
} else {
list = null;
}
if (list == null) {
return false;
}
Iterator<ResolveInfo> it = list.iterator();
boolean z = false;
while (it.hasNext()) {
if (!it.next().activityInfo.name.equals(CustomTabActivity.class.getName())) {
return false;
}
z = true;
}
return z;
}
public static void a(Context context) {
a(context, "context");
String a2 = a();
PackageManager packageManager = context.getPackageManager();
if (packageManager != null) {
String str = "com.facebook.app.FacebookContentProvider" + a2;
if (packageManager.resolveContentProvider(str, 0) == null) {
throw new IllegalStateException(String.format("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.", str));
}
}
}
}

View File

@@ -0,0 +1,647 @@
package com.facebook.internal;
import android.annotation.SuppressLint;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.graphics.Bitmap;
import android.net.Uri;
import android.net.http.SslError;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.view.Display;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.webkit.SslErrorHandler;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import com.facebook.AccessToken;
import com.facebook.FacebookDialogException;
import com.facebook.FacebookException;
import com.facebook.FacebookGraphResponseException;
import com.facebook.FacebookOperationCanceledException;
import com.facebook.FacebookRequestError;
import com.facebook.FacebookSdk;
import com.facebook.GraphRequest;
import com.facebook.GraphResponse;
import com.facebook.R$drawable;
import com.facebook.R$string;
import com.facebook.share.internal.ShareInternalUtility;
import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.CountDownLatch;
import org.json.JSONArray;
import org.json.JSONObject;
/* loaded from: classes.dex */
public class WebDialog extends Dialog {
private String a;
private String b;
private OnCompleteListener c;
private WebView d;
private ProgressDialog e;
private ImageView f;
private FrameLayout g;
private UploadStagingResourcesTask h;
private boolean i;
private boolean j;
private boolean k;
public static class Builder {
private Context a;
private String b;
private String c;
private int d;
private OnCompleteListener e;
private Bundle f;
private AccessToken g;
public Builder(Context context, String str, Bundle bundle) {
this.g = AccessToken.getCurrentAccessToken();
if (this.g == null) {
String c = Utility.c(context);
if (c == null) {
throw new FacebookException("Attempted to create a builder without a valid access token or a valid default Application ID.");
}
this.b = c;
}
a(context, str, bundle);
}
public Builder a(OnCompleteListener onCompleteListener) {
this.e = onCompleteListener;
return this;
}
public String b() {
return this.b;
}
public Context c() {
return this.a;
}
public OnCompleteListener d() {
return this.e;
}
public Bundle e() {
return this.f;
}
public int f() {
return this.d;
}
public WebDialog a() {
AccessToken accessToken = this.g;
if (accessToken != null) {
this.f.putString("app_id", accessToken.getApplicationId());
this.f.putString(AccessToken.ACCESS_TOKEN_KEY, this.g.getToken());
} else {
this.f.putString("app_id", this.b);
}
return new WebDialog(this.a, this.c, this.f, this.d, this.e);
}
public Builder(Context context, String str, String str2, Bundle bundle) {
str = str == null ? Utility.c(context) : str;
Validate.a(str, "applicationId");
this.b = str;
a(context, str2, bundle);
}
private void a(Context context, String str, Bundle bundle) {
this.a = context;
this.c = str;
if (bundle != null) {
this.f = bundle;
} else {
this.f = new Bundle();
}
}
}
private class DialogWebViewClient extends WebViewClient {
private DialogWebViewClient() {
}
@Override // android.webkit.WebViewClient
public void onPageFinished(WebView webView, String str) {
super.onPageFinished(webView, str);
if (!WebDialog.this.j) {
WebDialog.this.e.dismiss();
}
WebDialog.this.g.setBackgroundColor(0);
WebDialog.this.d.setVisibility(0);
WebDialog.this.f.setVisibility(0);
WebDialog.this.k = true;
}
@Override // android.webkit.WebViewClient
public void onPageStarted(WebView webView, String str, Bitmap bitmap) {
Utility.a("FacebookSDK.WebDialog", "Webview loading URL: " + str);
super.onPageStarted(webView, str, bitmap);
if (WebDialog.this.j) {
return;
}
WebDialog.this.e.show();
}
@Override // android.webkit.WebViewClient
public void onReceivedError(WebView webView, int i, String str, String str2) {
super.onReceivedError(webView, i, str, str2);
WebDialog.this.a(new FacebookDialogException(str, i, str2));
}
@Override // android.webkit.WebViewClient
public void onReceivedSslError(WebView webView, SslErrorHandler sslErrorHandler, SslError sslError) {
super.onReceivedSslError(webView, sslErrorHandler, sslError);
sslErrorHandler.cancel();
WebDialog.this.a(new FacebookDialogException(null, -11, null));
}
/* JADX WARN: Removed duplicated region for block: B:30:0x0090 */
/* JADX WARN: Removed duplicated region for block: B:31:0x0096 */
@Override // android.webkit.WebViewClient
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct code enable 'Show inconsistent code' option in preferences
*/
public boolean shouldOverrideUrlLoading(android.webkit.WebView r6, java.lang.String r7) {
/*
r5 = this;
java.lang.StringBuilder r6 = new java.lang.StringBuilder
r6.<init>()
java.lang.String r0 = "Redirect URL: "
r6.append(r0)
r6.append(r7)
java.lang.String r6 = r6.toString()
java.lang.String r0 = "FacebookSDK.WebDialog"
com.facebook.internal.Utility.a(r0, r6)
com.facebook.internal.WebDialog r6 = com.facebook.internal.WebDialog.this
java.lang.String r6 = com.facebook.internal.WebDialog.a(r6)
boolean r6 = r7.startsWith(r6)
r0 = 1
if (r6 == 0) goto La6
com.facebook.internal.WebDialog r6 = com.facebook.internal.WebDialog.this
android.os.Bundle r6 = r6.a(r7)
java.lang.String r7 = "error"
java.lang.String r7 = r6.getString(r7)
if (r7 != 0) goto L37
java.lang.String r7 = "error_type"
java.lang.String r7 = r6.getString(r7)
L37:
java.lang.String r1 = "error_msg"
java.lang.String r1 = r6.getString(r1)
if (r1 != 0) goto L45
java.lang.String r1 = "error_message"
java.lang.String r1 = r6.getString(r1)
L45:
if (r1 != 0) goto L4d
java.lang.String r1 = "error_description"
java.lang.String r1 = r6.getString(r1)
L4d:
java.lang.String r2 = "error_code"
java.lang.String r2 = r6.getString(r2)
boolean r3 = com.facebook.internal.Utility.c(r2)
r4 = -1
if (r3 != 0) goto L5f
int r2 = java.lang.Integer.parseInt(r2) // Catch: java.lang.NumberFormatException -> L5f
goto L60
L5f:
r2 = -1
L60:
boolean r3 = com.facebook.internal.Utility.c(r7)
if (r3 == 0) goto L74
boolean r3 = com.facebook.internal.Utility.c(r1)
if (r3 == 0) goto L74
if (r2 != r4) goto L74
com.facebook.internal.WebDialog r7 = com.facebook.internal.WebDialog.this
r7.a(r6)
goto La5
L74:
if (r7 == 0) goto L8c
java.lang.String r6 = "access_denied"
boolean r6 = r7.equals(r6)
if (r6 != 0) goto L86
java.lang.String r6 = "OAuthAccessDeniedException"
boolean r6 = r7.equals(r6)
if (r6 == 0) goto L8c
L86:
com.facebook.internal.WebDialog r6 = com.facebook.internal.WebDialog.this
r6.cancel()
goto La5
L8c:
r6 = 4201(0x1069, float:5.887E-42)
if (r2 != r6) goto L96
com.facebook.internal.WebDialog r6 = com.facebook.internal.WebDialog.this
r6.cancel()
goto La5
L96:
com.facebook.FacebookRequestError r6 = new com.facebook.FacebookRequestError
r6.<init>(r2, r7, r1)
com.facebook.internal.WebDialog r7 = com.facebook.internal.WebDialog.this
com.facebook.FacebookServiceException r2 = new com.facebook.FacebookServiceException
r2.<init>(r6, r1)
r7.a(r2)
La5:
return r0
La6:
java.lang.String r6 = "fbconnect://cancel"
boolean r6 = r7.startsWith(r6)
if (r6 == 0) goto Lb4
com.facebook.internal.WebDialog r6 = com.facebook.internal.WebDialog.this
r6.cancel()
return r0
Lb4:
java.lang.String r6 = "touch"
boolean r6 = r7.contains(r6)
r1 = 0
if (r6 == 0) goto Lbe
return r1
Lbe:
com.facebook.internal.WebDialog r6 = com.facebook.internal.WebDialog.this // Catch: android.content.ActivityNotFoundException -> Ld3
android.content.Context r6 = r6.getContext() // Catch: android.content.ActivityNotFoundException -> Ld3
android.content.Intent r2 = new android.content.Intent // Catch: android.content.ActivityNotFoundException -> Ld3
java.lang.String r3 = "android.intent.action.VIEW"
android.net.Uri r7 = android.net.Uri.parse(r7) // Catch: android.content.ActivityNotFoundException -> Ld3
r2.<init>(r3, r7) // Catch: android.content.ActivityNotFoundException -> Ld3
r6.startActivity(r2) // Catch: android.content.ActivityNotFoundException -> Ld3
return r0
Ld3:
return r1
*/
throw new UnsupportedOperationException("Method not decompiled: com.facebook.internal.WebDialog.DialogWebViewClient.shouldOverrideUrlLoading(android.webkit.WebView, java.lang.String):boolean");
}
}
public interface OnCompleteListener {
void a(Bundle bundle, FacebookException facebookException);
}
private class UploadStagingResourcesTask extends AsyncTask<Void, Void, String[]> {
private String a;
private Bundle b;
private Exception[] c;
UploadStagingResourcesTask(String str, Bundle bundle) {
this.a = str;
this.b = bundle;
}
/* JADX INFO: Access modifiers changed from: protected */
@Override // android.os.AsyncTask
/* renamed from: a, reason: merged with bridge method [inline-methods] */
public String[] doInBackground(Void... voidArr) {
String[] stringArray = this.b.getStringArray("media");
final String[] strArr = new String[stringArray.length];
this.c = new Exception[stringArray.length];
final CountDownLatch countDownLatch = new CountDownLatch(stringArray.length);
ConcurrentLinkedQueue concurrentLinkedQueue = new ConcurrentLinkedQueue();
AccessToken currentAccessToken = AccessToken.getCurrentAccessToken();
for (final int i = 0; i < stringArray.length; i++) {
try {
if (isCancelled()) {
Iterator it = concurrentLinkedQueue.iterator();
while (it.hasNext()) {
((AsyncTask) it.next()).cancel(true);
}
return null;
}
Uri parse = Uri.parse(stringArray[i]);
if (Utility.e(parse)) {
strArr[i] = parse.toString();
countDownLatch.countDown();
} else {
concurrentLinkedQueue.add(ShareInternalUtility.a(currentAccessToken, parse, new GraphRequest.Callback() { // from class: com.facebook.internal.WebDialog.UploadStagingResourcesTask.1
@Override // com.facebook.GraphRequest.Callback
public void a(GraphResponse graphResponse) {
FacebookRequestError a;
try {
a = graphResponse.a();
} catch (Exception e) {
UploadStagingResourcesTask.this.c[i] = e;
}
if (a != null) {
String errorMessage = a.getErrorMessage();
if (errorMessage == null) {
errorMessage = "Error staging photo.";
}
throw new FacebookGraphResponseException(graphResponse, errorMessage);
}
JSONObject b = graphResponse.b();
if (b == null) {
throw new FacebookException("Error staging photo.");
}
String optString = b.optString("uri");
if (optString == null) {
throw new FacebookException("Error staging photo.");
}
strArr[i] = optString;
countDownLatch.countDown();
}
}).b());
}
} catch (Exception unused) {
Iterator it2 = concurrentLinkedQueue.iterator();
while (it2.hasNext()) {
((AsyncTask) it2.next()).cancel(true);
}
return null;
}
}
countDownLatch.await();
return strArr;
}
/* JADX INFO: Access modifiers changed from: protected */
@Override // android.os.AsyncTask
/* renamed from: a, reason: merged with bridge method [inline-methods] */
public void onPostExecute(String[] strArr) {
WebDialog.this.e.dismiss();
for (Exception exc : this.c) {
if (exc != null) {
WebDialog.this.a(exc);
return;
}
}
if (strArr == null) {
WebDialog.this.a(new FacebookException("Failed to stage photos for web dialog"));
return;
}
List asList = Arrays.asList(strArr);
if (asList.contains(null)) {
WebDialog.this.a(new FacebookException("Failed to stage photos for web dialog"));
return;
}
Utility.a(this.b, "media", new JSONArray((Collection) asList));
WebDialog.this.a = Utility.a(ServerProtocol.b(), FacebookSdk.j() + "/dialog/" + this.a, this.b).toString();
WebDialog.this.a((WebDialog.this.f.getDrawable().getIntrinsicWidth() / 2) + 1);
}
}
public WebDialog(Context context, String str) {
this(context, str, FacebookSdk.m());
}
private int a(int i, float f, int i2, int i3) {
int i4 = (int) (i / f);
double d = 0.5d;
if (i4 <= i2) {
d = 1.0d;
} else if (i4 < i3) {
d = 0.5d + (((i3 - i4) / (i3 - i2)) * 0.5d);
}
return (int) (i * d);
}
@Override // android.app.Dialog, android.content.DialogInterface
public void cancel() {
if (this.c == null || this.i) {
return;
}
a(new FacebookOperationCanceledException());
}
@Override // android.app.Dialog, android.content.DialogInterface
public void dismiss() {
ProgressDialog progressDialog;
WebView webView = this.d;
if (webView != null) {
webView.stopLoading();
}
if (!this.j && (progressDialog = this.e) != null && progressDialog.isShowing()) {
this.e.dismiss();
}
super.dismiss();
}
@Override // android.app.Dialog, android.view.Window.Callback
public void onAttachedToWindow() {
this.j = false;
super.onAttachedToWindow();
}
@Override // android.app.Dialog
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);
this.e = new ProgressDialog(getContext());
this.e.requestWindowFeature(1);
this.e.setMessage(getContext().getString(R$string.com_facebook_loading));
this.e.setCanceledOnTouchOutside(false);
this.e.setOnCancelListener(new DialogInterface.OnCancelListener() { // from class: com.facebook.internal.WebDialog.1
@Override // android.content.DialogInterface.OnCancelListener
public void onCancel(DialogInterface dialogInterface) {
WebDialog.this.cancel();
}
});
requestWindowFeature(1);
this.g = new FrameLayout(getContext());
d();
getWindow().setGravity(17);
getWindow().setSoftInputMode(16);
e();
if (this.a != null) {
a((this.f.getDrawable().getIntrinsicWidth() / 2) + 1);
}
this.g.addView(this.f, new ViewGroup.LayoutParams(-2, -2));
setContentView(this.g);
}
@Override // android.app.Dialog, android.view.Window.Callback
public void onDetachedFromWindow() {
this.j = true;
super.onDetachedFromWindow();
}
@Override // android.app.Dialog, android.view.KeyEvent.Callback
public boolean onKeyDown(int i, KeyEvent keyEvent) {
if (i == 4) {
cancel();
}
return super.onKeyDown(i, keyEvent);
}
@Override // android.app.Dialog
protected void onStart() {
super.onStart();
UploadStagingResourcesTask uploadStagingResourcesTask = this.h;
if (uploadStagingResourcesTask == null || uploadStagingResourcesTask.getStatus() != AsyncTask.Status.PENDING) {
d();
} else {
this.h.execute(new Void[0]);
this.e.show();
}
}
@Override // android.app.Dialog
protected void onStop() {
UploadStagingResourcesTask uploadStagingResourcesTask = this.h;
if (uploadStagingResourcesTask != null) {
uploadStagingResourcesTask.cancel(true);
this.e.dismiss();
}
super.onStop();
}
public WebDialog(Context context, String str, int i) {
super(context, i == 0 ? FacebookSdk.m() : i);
this.b = "fbconnect://success";
this.i = false;
this.j = false;
this.k = false;
this.a = str;
}
private void e() {
this.f = new ImageView(getContext());
this.f.setOnClickListener(new View.OnClickListener() { // from class: com.facebook.internal.WebDialog.2
@Override // android.view.View.OnClickListener
public void onClick(View view) {
WebDialog.this.cancel();
}
});
this.f.setImageDrawable(getContext().getResources().getDrawable(R$drawable.com_facebook_close));
this.f.setVisibility(4);
}
protected void b(String str) {
this.b = str;
}
protected boolean c() {
return this.k;
}
public void d() {
Display defaultDisplay = ((WindowManager) getContext().getSystemService("window")).getDefaultDisplay();
DisplayMetrics displayMetrics = new DisplayMetrics();
defaultDisplay.getMetrics(displayMetrics);
int i = displayMetrics.widthPixels;
int i2 = displayMetrics.heightPixels;
if (i >= i2) {
i = i2;
}
int i3 = displayMetrics.widthPixels;
int i4 = displayMetrics.heightPixels;
if (i3 < i4) {
i3 = i4;
}
getWindow().setLayout(Math.min(a(i, displayMetrics.density, 480, 800), displayMetrics.widthPixels), Math.min(a(i3, displayMetrics.density, 800, 1280), displayMetrics.heightPixels));
}
protected boolean b() {
return this.i;
}
public void a(OnCompleteListener onCompleteListener) {
this.c = onCompleteListener;
}
protected Bundle a(String str) {
Uri parse = Uri.parse(str);
Bundle d = Utility.d(parse.getQuery());
d.putAll(Utility.d(parse.getFragment()));
return d;
}
public WebDialog(Context context, String str, Bundle bundle, int i, OnCompleteListener onCompleteListener) {
super(context, i == 0 ? FacebookSdk.m() : i);
this.b = "fbconnect://success";
this.i = false;
this.j = false;
this.k = false;
bundle = bundle == null ? new Bundle() : bundle;
bundle.putString("redirect_uri", "fbconnect://success");
bundle.putString("display", "touch");
bundle.putString("sdk", String.format(Locale.ROOT, "android-%s", FacebookSdk.l()));
this.c = onCompleteListener;
if (str.equals("share") && bundle.containsKey("media")) {
this.h = new UploadStagingResourcesTask(str, bundle);
return;
}
this.a = Utility.a(ServerProtocol.b(), FacebookSdk.j() + "/dialog/" + str, bundle).toString();
}
protected WebView a() {
return this.d;
}
protected void a(Bundle bundle) {
OnCompleteListener onCompleteListener = this.c;
if (onCompleteListener == null || this.i) {
return;
}
this.i = true;
onCompleteListener.a(bundle, null);
dismiss();
}
protected void a(Throwable th) {
FacebookException facebookException;
if (this.c == null || this.i) {
return;
}
this.i = true;
if (th instanceof FacebookException) {
facebookException = (FacebookException) th;
} else {
facebookException = new FacebookException(th);
}
this.c.a(null, facebookException);
dismiss();
}
/* JADX INFO: Access modifiers changed from: private */
@SuppressLint({"SetJavaScriptEnabled"})
public void a(int i) {
LinearLayout linearLayout = new LinearLayout(getContext());
this.d = new WebView(this, getContext().getApplicationContext()) { // from class: com.facebook.internal.WebDialog.3
@Override // android.webkit.WebView, android.view.View
public void onWindowFocusChanged(boolean z) {
try {
super.onWindowFocusChanged(z);
} catch (NullPointerException unused) {
}
}
};
this.d.setVerticalScrollBarEnabled(false);
this.d.setHorizontalScrollBarEnabled(false);
this.d.setWebViewClient(new DialogWebViewClient());
this.d.getSettings().setJavaScriptEnabled(true);
this.d.loadUrl(this.a);
this.d.setLayoutParams(new FrameLayout.LayoutParams(-1, -1));
this.d.setVisibility(4);
this.d.getSettings().setSavePassword(false);
this.d.getSettings().setSaveFormData(false);
this.d.setFocusable(true);
this.d.setFocusableInTouchMode(true);
this.d.setOnTouchListener(new View.OnTouchListener(this) { // from class: com.facebook.internal.WebDialog.4
@Override // android.view.View.OnTouchListener
public boolean onTouch(View view, MotionEvent motionEvent) {
if (view.hasFocus()) {
return false;
}
view.requestFocus();
return false;
}
});
linearLayout.setPadding(i, i, i, i);
linearLayout.addView(this.d);
linearLayout.setBackgroundColor(-872415232);
this.g.addView(linearLayout);
}
}