Initial commit
This commit is contained in:
62
sources/com/facebook/appevents/AccessTokenAppIdPair.java
Normal file
62
sources/com/facebook/appevents/AccessTokenAppIdPair.java
Normal file
@@ -0,0 +1,62 @@
|
||||
package com.facebook.appevents;
|
||||
|
||||
import com.facebook.AccessToken;
|
||||
import com.facebook.FacebookSdk;
|
||||
import com.facebook.internal.Utility;
|
||||
import java.io.Serializable;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class AccessTokenAppIdPair implements Serializable {
|
||||
private final String a;
|
||||
private final String b;
|
||||
|
||||
static class SerializationProxyV1 implements Serializable {
|
||||
private final String a;
|
||||
private final String b;
|
||||
|
||||
private Object readResolve() {
|
||||
return new AccessTokenAppIdPair(this.a, this.b);
|
||||
}
|
||||
|
||||
private SerializationProxyV1(String str, String str2) {
|
||||
this.a = str;
|
||||
this.b = str2;
|
||||
}
|
||||
}
|
||||
|
||||
public AccessTokenAppIdPair(AccessToken accessToken) {
|
||||
this(accessToken.getToken(), FacebookSdk.c());
|
||||
}
|
||||
|
||||
private Object writeReplace() {
|
||||
return new SerializationProxyV1(this.a, this.b);
|
||||
}
|
||||
|
||||
public String a() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
public String b() {
|
||||
return this.b;
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (!(obj instanceof AccessTokenAppIdPair)) {
|
||||
return false;
|
||||
}
|
||||
AccessTokenAppIdPair accessTokenAppIdPair = (AccessTokenAppIdPair) obj;
|
||||
return Utility.a(accessTokenAppIdPair.a, this.a) && Utility.a(accessTokenAppIdPair.b, this.b);
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
String str = this.a;
|
||||
int hashCode = str == null ? 0 : str.hashCode();
|
||||
String str2 = this.b;
|
||||
return hashCode ^ (str2 != null ? str2.hashCode() : 0);
|
||||
}
|
||||
|
||||
public AccessTokenAppIdPair(String str, String str2) {
|
||||
this.a = Utility.c(str) ? null : str;
|
||||
this.b = str2;
|
||||
}
|
||||
}
|
56
sources/com/facebook/appevents/AnalyticsUserIDStore.java
Normal file
56
sources/com/facebook/appevents/AnalyticsUserIDStore.java
Normal file
@@ -0,0 +1,56 @@
|
||||
package com.facebook.appevents;
|
||||
|
||||
import android.preference.PreferenceManager;
|
||||
import android.util.Log;
|
||||
import com.facebook.FacebookSdk;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class AnalyticsUserIDStore {
|
||||
private static final String a = "AnalyticsUserIDStore";
|
||||
private static String c;
|
||||
private static ReentrantReadWriteLock b = new ReentrantReadWriteLock();
|
||||
private static volatile boolean d = false;
|
||||
|
||||
public static String b() {
|
||||
if (!d) {
|
||||
Log.w(a, "initStore should have been called before calling setUserID");
|
||||
c();
|
||||
}
|
||||
b.readLock().lock();
|
||||
try {
|
||||
return c;
|
||||
} finally {
|
||||
b.readLock().unlock();
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public static void c() {
|
||||
if (d) {
|
||||
return;
|
||||
}
|
||||
b.writeLock().lock();
|
||||
try {
|
||||
if (d) {
|
||||
return;
|
||||
}
|
||||
c = PreferenceManager.getDefaultSharedPreferences(FacebookSdk.b()).getString("com.facebook.appevents.AnalyticsUserIDStore.userID", null);
|
||||
d = true;
|
||||
} finally {
|
||||
b.writeLock().unlock();
|
||||
}
|
||||
}
|
||||
|
||||
public static void d() {
|
||||
if (d) {
|
||||
return;
|
||||
}
|
||||
AppEventsLogger.b().execute(new Runnable() { // from class: com.facebook.appevents.AnalyticsUserIDStore.1
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
AnalyticsUserIDStore.c();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
176
sources/com/facebook/appevents/AppEvent.java
Normal file
176
sources/com/facebook/appevents/AppEvent.java
Normal file
@@ -0,0 +1,176 @@
|
||||
package com.facebook.appevents;
|
||||
|
||||
import android.os.Bundle;
|
||||
import com.facebook.FacebookException;
|
||||
import com.facebook.LoggingBehavior;
|
||||
import com.facebook.internal.Logger;
|
||||
import com.facebook.internal.Utility;
|
||||
import java.io.Serializable;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.HashSet;
|
||||
import java.util.Locale;
|
||||
import java.util.UUID;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class AppEvent implements Serializable {
|
||||
private static final HashSet<String> e = new HashSet<>();
|
||||
private final JSONObject a;
|
||||
private final boolean b;
|
||||
private final String c;
|
||||
private final String d;
|
||||
|
||||
static class SerializationProxyV1 implements Serializable {
|
||||
private final String a;
|
||||
private final boolean b;
|
||||
|
||||
private Object readResolve() throws JSONException {
|
||||
return new AppEvent(this.a, this.b, null);
|
||||
}
|
||||
}
|
||||
|
||||
static class SerializationProxyV2 implements Serializable {
|
||||
private final String a;
|
||||
private final boolean b;
|
||||
private final String c;
|
||||
|
||||
private Object readResolve() throws JSONException {
|
||||
return new AppEvent(this.a, this.b, this.c);
|
||||
}
|
||||
|
||||
private SerializationProxyV2(String str, boolean z, String str2) {
|
||||
this.a = str;
|
||||
this.b = z;
|
||||
this.c = str2;
|
||||
}
|
||||
}
|
||||
|
||||
private String e() {
|
||||
return a(this.a.toString());
|
||||
}
|
||||
|
||||
private Object writeReplace() {
|
||||
return new SerializationProxyV2(this.a.toString(), this.b, this.d);
|
||||
}
|
||||
|
||||
public boolean a() {
|
||||
return this.b;
|
||||
}
|
||||
|
||||
public JSONObject b() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
public String c() {
|
||||
return this.c;
|
||||
}
|
||||
|
||||
public boolean d() {
|
||||
if (this.d == null) {
|
||||
return true;
|
||||
}
|
||||
return e().equals(this.d);
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return String.format("\"%s\", implicit: %b, json: %s", this.a.optString("_eventName"), Boolean.valueOf(this.b), this.a.toString());
|
||||
}
|
||||
|
||||
public AppEvent(String str, String str2, Double d, Bundle bundle, boolean z, UUID uuid) throws JSONException, FacebookException {
|
||||
this.a = a(str, str2, d, bundle, z, uuid);
|
||||
this.b = z;
|
||||
this.c = str2;
|
||||
this.d = e();
|
||||
}
|
||||
|
||||
private static JSONObject a(String str, String str2, Double d, Bundle bundle, boolean z, UUID uuid) throws FacebookException, JSONException {
|
||||
b(str2);
|
||||
JSONObject jSONObject = new JSONObject();
|
||||
jSONObject.put("_eventName", str2);
|
||||
jSONObject.put("_eventName_md5", a(str2));
|
||||
jSONObject.put("_logTime", System.currentTimeMillis() / 1000);
|
||||
jSONObject.put("_ui", str);
|
||||
if (uuid != null) {
|
||||
jSONObject.put("_session_id", uuid);
|
||||
}
|
||||
if (d != null) {
|
||||
jSONObject.put("_valueToSum", d.doubleValue());
|
||||
}
|
||||
if (z) {
|
||||
jSONObject.put("_implicitlyLogged", "1");
|
||||
}
|
||||
String e2 = AppEventsLogger.e();
|
||||
if (e2 != null) {
|
||||
jSONObject.put("_app_user_id", e2);
|
||||
}
|
||||
if (bundle != null) {
|
||||
for (String str3 : bundle.keySet()) {
|
||||
b(str3);
|
||||
Object obj = bundle.get(str3);
|
||||
if (!(obj instanceof String) && !(obj instanceof Number)) {
|
||||
throw new FacebookException(String.format("Parameter value '%s' for key '%s' should be a string or a numeric type.", obj, str3));
|
||||
}
|
||||
jSONObject.put(str3, obj.toString());
|
||||
}
|
||||
}
|
||||
if (!z) {
|
||||
Logger.a(LoggingBehavior.APP_EVENTS, "AppEvents", "Created app event '%s'", jSONObject.toString());
|
||||
}
|
||||
return jSONObject;
|
||||
}
|
||||
|
||||
private static void b(String str) throws FacebookException {
|
||||
boolean contains;
|
||||
if (str == null || str.length() == 0 || str.length() > 40) {
|
||||
if (str == null) {
|
||||
str = "<None Provided>";
|
||||
}
|
||||
throw new FacebookException(String.format(Locale.ROOT, "Identifier '%s' must be less than %d characters", str, 40));
|
||||
}
|
||||
synchronized (e) {
|
||||
contains = e.contains(str);
|
||||
}
|
||||
if (contains) {
|
||||
return;
|
||||
}
|
||||
if (!str.matches("^[0-9a-zA-Z_]+[0-9a-zA-Z _-]*$")) {
|
||||
throw new FacebookException(String.format("Skipping event named '%s' due to illegal name - must be under 40 chars and alphanumeric, _, - or space, and not start with a space or hyphen.", str));
|
||||
}
|
||||
synchronized (e) {
|
||||
e.add(str);
|
||||
}
|
||||
}
|
||||
|
||||
private AppEvent(String str, boolean z, String str2) throws JSONException {
|
||||
this.a = new JSONObject(str);
|
||||
this.b = z;
|
||||
this.c = this.a.optString("_eventName");
|
||||
this.d = str2;
|
||||
}
|
||||
|
||||
private static String a(String str) {
|
||||
try {
|
||||
MessageDigest messageDigest = MessageDigest.getInstance("MD5");
|
||||
byte[] bytes = str.getBytes("UTF-8");
|
||||
messageDigest.update(bytes, 0, bytes.length);
|
||||
return a(messageDigest.digest());
|
||||
} catch (UnsupportedEncodingException e2) {
|
||||
Utility.a("Failed to generate checksum: ", (Exception) e2);
|
||||
return "1";
|
||||
} catch (NoSuchAlgorithmException e3) {
|
||||
Utility.a("Failed to generate checksum: ", (Exception) e3);
|
||||
return "0";
|
||||
}
|
||||
}
|
||||
|
||||
private static String a(byte[] bArr) {
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
for (byte b : bArr) {
|
||||
stringBuffer.append(String.format("%02x", Byte.valueOf(b)));
|
||||
}
|
||||
return stringBuffer.toString();
|
||||
}
|
||||
}
|
59
sources/com/facebook/appevents/AppEventCollection.java
Normal file
59
sources/com/facebook/appevents/AppEventCollection.java
Normal file
@@ -0,0 +1,59 @@
|
||||
package com.facebook.appevents;
|
||||
|
||||
import android.content.Context;
|
||||
import com.facebook.FacebookSdk;
|
||||
import com.facebook.internal.AttributionIdentifiers;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class AppEventCollection {
|
||||
private final HashMap<AccessTokenAppIdPair, SessionEventsState> a = new HashMap<>();
|
||||
|
||||
public synchronized void a(PersistedEvents persistedEvents) {
|
||||
if (persistedEvents == null) {
|
||||
return;
|
||||
}
|
||||
for (AccessTokenAppIdPair accessTokenAppIdPair : persistedEvents.a()) {
|
||||
SessionEventsState b = b(accessTokenAppIdPair);
|
||||
Iterator<AppEvent> it = persistedEvents.b(accessTokenAppIdPair).iterator();
|
||||
while (it.hasNext()) {
|
||||
b.a(it.next());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized Set<AccessTokenAppIdPair> b() {
|
||||
return this.a.keySet();
|
||||
}
|
||||
|
||||
private synchronized SessionEventsState b(AccessTokenAppIdPair accessTokenAppIdPair) {
|
||||
SessionEventsState sessionEventsState;
|
||||
sessionEventsState = this.a.get(accessTokenAppIdPair);
|
||||
if (sessionEventsState == null) {
|
||||
Context b = FacebookSdk.b();
|
||||
sessionEventsState = new SessionEventsState(AttributionIdentifiers.d(b), AppEventsLogger.a(b));
|
||||
}
|
||||
this.a.put(accessTokenAppIdPair, sessionEventsState);
|
||||
return sessionEventsState;
|
||||
}
|
||||
|
||||
public synchronized void a(AccessTokenAppIdPair accessTokenAppIdPair, AppEvent appEvent) {
|
||||
b(accessTokenAppIdPair).a(appEvent);
|
||||
}
|
||||
|
||||
public synchronized SessionEventsState a(AccessTokenAppIdPair accessTokenAppIdPair) {
|
||||
return this.a.get(accessTokenAppIdPair);
|
||||
}
|
||||
|
||||
public synchronized int a() {
|
||||
int i;
|
||||
i = 0;
|
||||
Iterator<SessionEventsState> it = this.a.values().iterator();
|
||||
while (it.hasNext()) {
|
||||
i += it.next().a();
|
||||
}
|
||||
return i;
|
||||
}
|
||||
}
|
182
sources/com/facebook/appevents/AppEventQueue.java
Normal file
182
sources/com/facebook/appevents/AppEventQueue.java
Normal file
@@ -0,0 +1,182 @@
|
||||
package com.facebook.appevents;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||
import com.facebook.AccessToken;
|
||||
import com.facebook.FacebookRequestError;
|
||||
import com.facebook.FacebookSdk;
|
||||
import com.facebook.GraphRequest;
|
||||
import com.facebook.GraphResponse;
|
||||
import com.facebook.LoggingBehavior;
|
||||
import com.facebook.appevents.AppEventsLogger;
|
||||
import com.facebook.internal.FetchedAppSettings;
|
||||
import com.facebook.internal.FetchedAppSettingsManager;
|
||||
import com.facebook.internal.Logger;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class AppEventQueue {
|
||||
private static final String a = "com.facebook.appevents.AppEventQueue";
|
||||
private static ScheduledFuture d;
|
||||
private static volatile AppEventCollection b = new AppEventCollection();
|
||||
private static final ScheduledExecutorService c = Executors.newSingleThreadScheduledExecutor();
|
||||
private static final Runnable e = new Runnable() { // from class: com.facebook.appevents.AppEventQueue.1
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
ScheduledFuture unused = AppEventQueue.d = null;
|
||||
if (AppEventsLogger.c() != AppEventsLogger.FlushBehavior.EXPLICIT_ONLY) {
|
||||
AppEventQueue.b(FlushReason.TIMER);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
public static Set<AccessTokenAppIdPair> e() {
|
||||
return b.b();
|
||||
}
|
||||
|
||||
public static void f() {
|
||||
c.execute(new Runnable() { // from class: com.facebook.appevents.AppEventQueue.2
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
AppEventStore.a(AppEventQueue.b);
|
||||
AppEventCollection unused = AppEventQueue.b = new AppEventCollection();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
static void b(FlushReason flushReason) {
|
||||
b.a(AppEventStore.a());
|
||||
try {
|
||||
FlushStatistics a2 = a(flushReason, b);
|
||||
if (a2 != null) {
|
||||
Intent intent = new Intent("com.facebook.sdk.APP_EVENTS_FLUSHED");
|
||||
intent.putExtra("com.facebook.sdk.APP_EVENTS_NUM_EVENTS_FLUSHED", a2.a);
|
||||
intent.putExtra("com.facebook.sdk.APP_EVENTS_FLUSH_RESULT", a2.b);
|
||||
LocalBroadcastManager.a(FacebookSdk.b()).a(intent);
|
||||
}
|
||||
} catch (Exception e2) {
|
||||
Log.w(a, "Caught unexpected exception while flushing app events: ", e2);
|
||||
}
|
||||
}
|
||||
|
||||
public static void a(final FlushReason flushReason) {
|
||||
c.execute(new Runnable() { // from class: com.facebook.appevents.AppEventQueue.3
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
AppEventQueue.b(FlushReason.this);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void a(final AccessTokenAppIdPair accessTokenAppIdPair, final AppEvent appEvent) {
|
||||
c.execute(new Runnable() { // from class: com.facebook.appevents.AppEventQueue.4
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
AppEventQueue.b.a(AccessTokenAppIdPair.this, appEvent);
|
||||
if (AppEventsLogger.c() != AppEventsLogger.FlushBehavior.EXPLICIT_ONLY && AppEventQueue.b.a() > 100) {
|
||||
AppEventQueue.b(FlushReason.EVENT_THRESHOLD);
|
||||
} else if (AppEventQueue.d == null) {
|
||||
ScheduledFuture unused = AppEventQueue.d = AppEventQueue.c.schedule(AppEventQueue.e, 15L, TimeUnit.SECONDS);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static FlushStatistics a(FlushReason flushReason, AppEventCollection appEventCollection) {
|
||||
FlushStatistics flushStatistics = new FlushStatistics();
|
||||
boolean a2 = FacebookSdk.a(FacebookSdk.b());
|
||||
ArrayList arrayList = new ArrayList();
|
||||
for (AccessTokenAppIdPair accessTokenAppIdPair : appEventCollection.b()) {
|
||||
GraphRequest a3 = a(accessTokenAppIdPair, appEventCollection.a(accessTokenAppIdPair), a2, flushStatistics);
|
||||
if (a3 != null) {
|
||||
arrayList.add(a3);
|
||||
}
|
||||
}
|
||||
if (arrayList.size() <= 0) {
|
||||
return null;
|
||||
}
|
||||
Logger.a(LoggingBehavior.APP_EVENTS, a, "Flushing %d events due to %s.", Integer.valueOf(flushStatistics.a), flushReason.toString());
|
||||
Iterator it = arrayList.iterator();
|
||||
while (it.hasNext()) {
|
||||
((GraphRequest) it.next()).a();
|
||||
}
|
||||
return flushStatistics;
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public static void b(final AccessTokenAppIdPair accessTokenAppIdPair, GraphRequest graphRequest, GraphResponse graphResponse, final SessionEventsState sessionEventsState, FlushStatistics flushStatistics) {
|
||||
String str;
|
||||
String str2;
|
||||
FacebookRequestError a2 = graphResponse.a();
|
||||
FlushResult flushResult = FlushResult.SUCCESS;
|
||||
if (a2 == null) {
|
||||
str = "Success";
|
||||
} else if (a2.getErrorCode() == -1) {
|
||||
flushResult = FlushResult.NO_CONNECTIVITY;
|
||||
str = "Failed: No Connectivity";
|
||||
} else {
|
||||
str = String.format("Failed:\n Response: %s\n Error %s", graphResponse.toString(), a2.toString());
|
||||
flushResult = FlushResult.SERVER_ERROR;
|
||||
}
|
||||
if (FacebookSdk.a(LoggingBehavior.APP_EVENTS)) {
|
||||
try {
|
||||
str2 = new JSONArray((String) graphRequest.j()).toString(2);
|
||||
} catch (JSONException unused) {
|
||||
str2 = "<Can't encode events for debug logging>";
|
||||
}
|
||||
Logger.a(LoggingBehavior.APP_EVENTS, a, "Flush completed\nParams: %s\n Result: %s\n Events JSON: %s", graphRequest.e().toString(), str, str2);
|
||||
}
|
||||
sessionEventsState.a(a2 != null);
|
||||
if (flushResult == FlushResult.NO_CONNECTIVITY) {
|
||||
FacebookSdk.h().execute(new Runnable() { // from class: com.facebook.appevents.AppEventQueue.6
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
AppEventStore.a(AccessTokenAppIdPair.this, sessionEventsState);
|
||||
}
|
||||
});
|
||||
}
|
||||
if (flushResult == FlushResult.SUCCESS || flushStatistics.b == FlushResult.NO_CONNECTIVITY) {
|
||||
return;
|
||||
}
|
||||
flushStatistics.b = flushResult;
|
||||
}
|
||||
|
||||
private static GraphRequest a(final AccessTokenAppIdPair accessTokenAppIdPair, final SessionEventsState sessionEventsState, boolean z, final FlushStatistics flushStatistics) {
|
||||
String b2 = accessTokenAppIdPair.b();
|
||||
FetchedAppSettings a2 = FetchedAppSettingsManager.a(b2, false);
|
||||
final GraphRequest a3 = GraphRequest.a((AccessToken) null, String.format("%s/activities", b2), (JSONObject) null, (GraphRequest.Callback) null);
|
||||
Bundle h = a3.h();
|
||||
if (h == null) {
|
||||
h = new Bundle();
|
||||
}
|
||||
h.putString(AccessToken.ACCESS_TOKEN_KEY, accessTokenAppIdPair.a());
|
||||
String d2 = AppEventsLogger.d();
|
||||
if (d2 != null) {
|
||||
h.putString("device_token", d2);
|
||||
}
|
||||
a3.a(h);
|
||||
int a4 = sessionEventsState.a(a3, FacebookSdk.b(), a2 != null ? a2.g() : false, z);
|
||||
if (a4 == 0) {
|
||||
return null;
|
||||
}
|
||||
flushStatistics.a += a4;
|
||||
a3.a(new GraphRequest.Callback() { // from class: com.facebook.appevents.AppEventQueue.5
|
||||
@Override // com.facebook.GraphRequest.Callback
|
||||
public void a(GraphResponse graphResponse) {
|
||||
AppEventQueue.b(AccessTokenAppIdPair.this, a3, graphResponse, sessionEventsState, flushStatistics);
|
||||
}
|
||||
});
|
||||
return a3;
|
||||
}
|
||||
}
|
197
sources/com/facebook/appevents/AppEventStore.java
Normal file
197
sources/com/facebook/appevents/AppEventStore.java
Normal file
@@ -0,0 +1,197 @@
|
||||
package com.facebook.appevents;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import com.facebook.FacebookSdk;
|
||||
import com.facebook.appevents.AccessTokenAppIdPair;
|
||||
import com.facebook.appevents.AppEvent;
|
||||
import com.facebook.appevents.internal.AppEventUtility;
|
||||
import com.facebook.internal.Utility;
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.io.ObjectStreamClass;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class AppEventStore {
|
||||
private static final String a = "com.facebook.appevents.AppEventStore";
|
||||
|
||||
private static class MovedClassObjectInputStream extends ObjectInputStream {
|
||||
public MovedClassObjectInputStream(InputStream inputStream) throws IOException {
|
||||
super(inputStream);
|
||||
}
|
||||
|
||||
@Override // java.io.ObjectInputStream
|
||||
protected ObjectStreamClass readClassDescriptor() throws IOException, ClassNotFoundException {
|
||||
ObjectStreamClass readClassDescriptor = super.readClassDescriptor();
|
||||
return readClassDescriptor.getName().equals("com.facebook.appevents.AppEventsLogger$AccessTokenAppIdPair$SerializationProxyV1") ? ObjectStreamClass.lookup(AccessTokenAppIdPair.SerializationProxyV1.class) : readClassDescriptor.getName().equals("com.facebook.appevents.AppEventsLogger$AppEvent$SerializationProxyV1") ? ObjectStreamClass.lookup(AppEvent.SerializationProxyV1.class) : readClassDescriptor;
|
||||
}
|
||||
}
|
||||
|
||||
AppEventStore() {
|
||||
}
|
||||
|
||||
public static synchronized void a(AccessTokenAppIdPair accessTokenAppIdPair, SessionEventsState sessionEventsState) {
|
||||
synchronized (AppEventStore.class) {
|
||||
AppEventUtility.b();
|
||||
PersistedEvents a2 = a();
|
||||
if (a2.a(accessTokenAppIdPair)) {
|
||||
a2.b(accessTokenAppIdPair).addAll(sessionEventsState.b());
|
||||
} else {
|
||||
a2.a(accessTokenAppIdPair, sessionEventsState.b());
|
||||
}
|
||||
a(a2);
|
||||
}
|
||||
}
|
||||
|
||||
public static synchronized void a(AppEventCollection appEventCollection) {
|
||||
synchronized (AppEventStore.class) {
|
||||
AppEventUtility.b();
|
||||
PersistedEvents a2 = a();
|
||||
for (AccessTokenAppIdPair accessTokenAppIdPair : appEventCollection.b()) {
|
||||
a2.a(accessTokenAppIdPair, appEventCollection.a(accessTokenAppIdPair).b());
|
||||
}
|
||||
a(a2);
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX WARN: Multi-variable type inference failed */
|
||||
/* JADX WARN: Removed duplicated region for block: B:16:0x008a A[Catch: all -> 0x0091, TRY_LEAVE, TryCatch #0 {, blocks: (B:4:0x0003, B:10:0x0021, B:12:0x0024, B:16:0x008a, B:23:0x002f, B:35:0x0045, B:37:0x0048, B:40:0x0053, B:32:0x0057, B:44:0x005e, B:46:0x0061, B:47:0x0073, B:50:0x006c, B:26:0x0075, B:28:0x0078, B:31:0x0083), top: B:3:0x0003, inners: #1, #4, #9, #10 }] */
|
||||
/* JADX WARN: Type inference failed for: r1v12, types: [java.lang.Exception, java.lang.Throwable] */
|
||||
/* JADX WARN: Type inference failed for: r4v11, types: [java.lang.String] */
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct code enable 'Show inconsistent code' option in preferences
|
||||
*/
|
||||
public static synchronized com.facebook.appevents.PersistedEvents a() {
|
||||
/*
|
||||
java.lang.Class<com.facebook.appevents.AppEventStore> r0 = com.facebook.appevents.AppEventStore.class
|
||||
monitor-enter(r0)
|
||||
com.facebook.appevents.internal.AppEventUtility.b() // Catch: java.lang.Throwable -> L91
|
||||
android.content.Context r1 = com.facebook.FacebookSdk.b() // Catch: java.lang.Throwable -> L91
|
||||
r2 = 0
|
||||
java.lang.String r3 = "AppEventsLogger.persistedevents"
|
||||
java.io.FileInputStream r3 = r1.openFileInput(r3) // Catch: java.lang.Throwable -> L3a java.lang.Exception -> L3c java.io.FileNotFoundException -> L74
|
||||
com.facebook.appevents.AppEventStore$MovedClassObjectInputStream r4 = new com.facebook.appevents.AppEventStore$MovedClassObjectInputStream // Catch: java.lang.Throwable -> L3a java.lang.Exception -> L3c java.io.FileNotFoundException -> L74
|
||||
java.io.BufferedInputStream r5 = new java.io.BufferedInputStream // Catch: java.lang.Throwable -> L3a java.lang.Exception -> L3c java.io.FileNotFoundException -> L74
|
||||
r5.<init>(r3) // Catch: java.lang.Throwable -> L3a java.lang.Exception -> L3c java.io.FileNotFoundException -> L74
|
||||
r4.<init>(r5) // Catch: java.lang.Throwable -> L3a java.lang.Exception -> L3c java.io.FileNotFoundException -> L74
|
||||
java.lang.Object r3 = r4.readObject() // Catch: java.lang.Exception -> L38 java.lang.Throwable -> L5b java.io.FileNotFoundException -> L75
|
||||
com.facebook.appevents.PersistedEvents r3 = (com.facebook.appevents.PersistedEvents) r3 // Catch: java.lang.Exception -> L38 java.lang.Throwable -> L5b java.io.FileNotFoundException -> L75
|
||||
com.facebook.internal.Utility.a(r4) // Catch: java.lang.Throwable -> L91
|
||||
java.lang.String r2 = "AppEventsLogger.persistedevents"
|
||||
java.io.File r1 = r1.getFileStreamPath(r2) // Catch: java.lang.Exception -> L2e java.lang.Throwable -> L91
|
||||
r1.delete() // Catch: java.lang.Exception -> L2e java.lang.Throwable -> L91
|
||||
goto L36
|
||||
L2e:
|
||||
r1 = move-exception
|
||||
java.lang.String r2 = com.facebook.appevents.AppEventStore.a // Catch: java.lang.Throwable -> L91
|
||||
java.lang.String r4 = "Got unexpected exception when removing events file: "
|
||||
android.util.Log.w(r2, r4, r1) // Catch: java.lang.Throwable -> L91
|
||||
L36:
|
||||
r2 = r3
|
||||
goto L88
|
||||
L38:
|
||||
r3 = move-exception
|
||||
goto L3e
|
||||
L3a:
|
||||
r3 = move-exception
|
||||
goto L5e
|
||||
L3c:
|
||||
r3 = move-exception
|
||||
r4 = r2
|
||||
L3e:
|
||||
java.lang.String r5 = com.facebook.appevents.AppEventStore.a // Catch: java.lang.Throwable -> L5b
|
||||
java.lang.String r6 = "Got unexpected exception while reading events: "
|
||||
android.util.Log.w(r5, r6, r3) // Catch: java.lang.Throwable -> L5b
|
||||
com.facebook.internal.Utility.a(r4) // Catch: java.lang.Throwable -> L91
|
||||
java.lang.String r3 = "AppEventsLogger.persistedevents"
|
||||
java.io.File r1 = r1.getFileStreamPath(r3) // Catch: java.lang.Exception -> L52 java.lang.Throwable -> L91
|
||||
r1.delete() // Catch: java.lang.Exception -> L52 java.lang.Throwable -> L91
|
||||
goto L88
|
||||
L52:
|
||||
r1 = move-exception
|
||||
java.lang.String r3 = com.facebook.appevents.AppEventStore.a // Catch: java.lang.Throwable -> L91
|
||||
java.lang.String r4 = "Got unexpected exception when removing events file: "
|
||||
L57:
|
||||
android.util.Log.w(r3, r4, r1) // Catch: java.lang.Throwable -> L91
|
||||
goto L88
|
||||
L5b:
|
||||
r2 = move-exception
|
||||
r3 = r2
|
||||
r2 = r4
|
||||
L5e:
|
||||
com.facebook.internal.Utility.a(r2) // Catch: java.lang.Throwable -> L91
|
||||
java.lang.String r2 = "AppEventsLogger.persistedevents"
|
||||
java.io.File r1 = r1.getFileStreamPath(r2) // Catch: java.lang.Exception -> L6b java.lang.Throwable -> L91
|
||||
r1.delete() // Catch: java.lang.Exception -> L6b java.lang.Throwable -> L91
|
||||
goto L73
|
||||
L6b:
|
||||
r1 = move-exception
|
||||
java.lang.String r2 = com.facebook.appevents.AppEventStore.a // Catch: java.lang.Throwable -> L91
|
||||
java.lang.String r4 = "Got unexpected exception when removing events file: "
|
||||
android.util.Log.w(r2, r4, r1) // Catch: java.lang.Throwable -> L91
|
||||
L73:
|
||||
throw r3 // Catch: java.lang.Throwable -> L91
|
||||
L74:
|
||||
r4 = r2
|
||||
L75:
|
||||
com.facebook.internal.Utility.a(r4) // Catch: java.lang.Throwable -> L91
|
||||
java.lang.String r3 = "AppEventsLogger.persistedevents"
|
||||
java.io.File r1 = r1.getFileStreamPath(r3) // Catch: java.lang.Exception -> L82 java.lang.Throwable -> L91
|
||||
r1.delete() // Catch: java.lang.Exception -> L82 java.lang.Throwable -> L91
|
||||
goto L88
|
||||
L82:
|
||||
r1 = move-exception
|
||||
java.lang.String r3 = com.facebook.appevents.AppEventStore.a // Catch: java.lang.Throwable -> L91
|
||||
java.lang.String r4 = "Got unexpected exception when removing events file: "
|
||||
goto L57
|
||||
L88:
|
||||
if (r2 != 0) goto L8f
|
||||
com.facebook.appevents.PersistedEvents r2 = new com.facebook.appevents.PersistedEvents // Catch: java.lang.Throwable -> L91
|
||||
r2.<init>() // Catch: java.lang.Throwable -> L91
|
||||
L8f:
|
||||
monitor-exit(r0)
|
||||
return r2
|
||||
L91:
|
||||
r1 = move-exception
|
||||
monitor-exit(r0)
|
||||
throw r1
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: com.facebook.appevents.AppEventStore.a():com.facebook.appevents.PersistedEvents");
|
||||
}
|
||||
|
||||
private static void a(PersistedEvents persistedEvents) {
|
||||
Context b = FacebookSdk.b();
|
||||
ObjectOutputStream objectOutputStream = null;
|
||||
try {
|
||||
try {
|
||||
ObjectOutputStream objectOutputStream2 = new ObjectOutputStream(new BufferedOutputStream(b.openFileOutput("AppEventsLogger.persistedevents", 0)));
|
||||
try {
|
||||
objectOutputStream2.writeObject(persistedEvents);
|
||||
Utility.a(objectOutputStream2);
|
||||
} catch (Exception e) {
|
||||
e = e;
|
||||
objectOutputStream = objectOutputStream2;
|
||||
Log.w(a, "Got unexpected exception while persisting events: ", e);
|
||||
try {
|
||||
b.getFileStreamPath("AppEventsLogger.persistedevents").delete();
|
||||
} catch (Exception unused) {
|
||||
}
|
||||
Utility.a(objectOutputStream);
|
||||
} catch (Throwable th) {
|
||||
th = th;
|
||||
objectOutputStream = objectOutputStream2;
|
||||
Utility.a(objectOutputStream);
|
||||
throw th;
|
||||
}
|
||||
} catch (Exception e2) {
|
||||
e = e2;
|
||||
}
|
||||
} catch (Throwable th2) {
|
||||
th = th2;
|
||||
}
|
||||
}
|
||||
}
|
181
sources/com/facebook/appevents/AppEventsLogger.java
Normal file
181
sources/com/facebook/appevents/AppEventsLogger.java
Normal file
@@ -0,0 +1,181 @@
|
||||
package com.facebook.appevents;
|
||||
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import com.facebook.AccessToken;
|
||||
import com.facebook.FacebookException;
|
||||
import com.facebook.FacebookSdk;
|
||||
import com.facebook.LoggingBehavior;
|
||||
import com.facebook.appevents.internal.ActivityLifecycleTracker;
|
||||
import com.facebook.internal.FetchedAppSettingsManager;
|
||||
import com.facebook.internal.Logger;
|
||||
import com.facebook.internal.Utility;
|
||||
import com.facebook.internal.Validate;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.ScheduledThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import org.json.JSONException;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class AppEventsLogger {
|
||||
private static ScheduledThreadPoolExecutor c;
|
||||
private static FlushBehavior d = FlushBehavior.AUTO;
|
||||
private static Object e = new Object();
|
||||
private static String f;
|
||||
private static boolean g;
|
||||
private static String h;
|
||||
private final String a;
|
||||
private final AccessTokenAppIdPair b;
|
||||
|
||||
public enum FlushBehavior {
|
||||
AUTO,
|
||||
EXPLICIT_ONLY
|
||||
}
|
||||
|
||||
private AppEventsLogger(Context context, String str, AccessToken accessToken) {
|
||||
this(Utility.b(context), str, accessToken);
|
||||
}
|
||||
|
||||
public static void a(Application application, String str) {
|
||||
if (!FacebookSdk.o()) {
|
||||
throw new FacebookException("The Facebook sdk must be initialized before calling activateApp");
|
||||
}
|
||||
AnalyticsUserIDStore.d();
|
||||
if (str == null) {
|
||||
str = FacebookSdk.c();
|
||||
}
|
||||
FacebookSdk.b(application, str);
|
||||
ActivityLifecycleTracker.a(application, str);
|
||||
}
|
||||
|
||||
public static AppEventsLogger b(Context context) {
|
||||
return new AppEventsLogger(context, (String) null, (AccessToken) null);
|
||||
}
|
||||
|
||||
public static FlushBehavior c() {
|
||||
FlushBehavior flushBehavior;
|
||||
synchronized (e) {
|
||||
flushBehavior = d;
|
||||
}
|
||||
return flushBehavior;
|
||||
}
|
||||
|
||||
static String d() {
|
||||
String str;
|
||||
synchronized (e) {
|
||||
str = h;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
public static String e() {
|
||||
return AnalyticsUserIDStore.b();
|
||||
}
|
||||
|
||||
private static void f() {
|
||||
synchronized (e) {
|
||||
if (c != null) {
|
||||
return;
|
||||
}
|
||||
c = new ScheduledThreadPoolExecutor(1);
|
||||
c.scheduleAtFixedRate(new Runnable() { // from class: com.facebook.appevents.AppEventsLogger.4
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
HashSet hashSet = new HashSet();
|
||||
Iterator<AccessTokenAppIdPair> it = AppEventQueue.e().iterator();
|
||||
while (it.hasNext()) {
|
||||
hashSet.add(it.next().b());
|
||||
}
|
||||
Iterator it2 = hashSet.iterator();
|
||||
while (it2.hasNext()) {
|
||||
FetchedAppSettingsManager.a((String) it2.next(), true);
|
||||
}
|
||||
}
|
||||
}, 0L, 86400L, TimeUnit.SECONDS);
|
||||
}
|
||||
}
|
||||
|
||||
public static void g() {
|
||||
AppEventQueue.f();
|
||||
}
|
||||
|
||||
static Executor b() {
|
||||
if (c == null) {
|
||||
f();
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
protected AppEventsLogger(String str, String str2, AccessToken accessToken) {
|
||||
Validate.c();
|
||||
this.a = str;
|
||||
accessToken = accessToken == null ? AccessToken.getCurrentAccessToken() : accessToken;
|
||||
if (accessToken != null && (str2 == null || str2.equals(accessToken.getApplicationId()))) {
|
||||
this.b = new AccessTokenAppIdPair(accessToken);
|
||||
} else {
|
||||
this.b = new AccessTokenAppIdPair(null, str2 == null ? Utility.c(FacebookSdk.b()) : str2);
|
||||
}
|
||||
f();
|
||||
}
|
||||
|
||||
public static AppEventsLogger a(Context context, String str) {
|
||||
return new AppEventsLogger(context, str, (AccessToken) null);
|
||||
}
|
||||
|
||||
public void a(String str, Bundle bundle) {
|
||||
a(str, null, bundle, false, ActivityLifecycleTracker.h());
|
||||
}
|
||||
|
||||
public void a(String str, double d2, Bundle bundle) {
|
||||
a(str, Double.valueOf(d2), bundle, false, ActivityLifecycleTracker.h());
|
||||
}
|
||||
|
||||
public void a() {
|
||||
AppEventQueue.a(FlushReason.EXPLICIT);
|
||||
}
|
||||
|
||||
public void a(String str, Double d2, Bundle bundle) {
|
||||
a(str, d2, bundle, true, ActivityLifecycleTracker.h());
|
||||
}
|
||||
|
||||
private void a(String str, Double d2, Bundle bundle, boolean z, UUID uuid) {
|
||||
try {
|
||||
a(FacebookSdk.b(), new AppEvent(this.a, str, d2, bundle, z, uuid), this.b);
|
||||
} catch (FacebookException e2) {
|
||||
Logger.a(LoggingBehavior.APP_EVENTS, "AppEvents", "Invalid app event: %s", e2.toString());
|
||||
} catch (JSONException e3) {
|
||||
Logger.a(LoggingBehavior.APP_EVENTS, "AppEvents", "JSON encoding for app event failed: '%s'", e3.toString());
|
||||
}
|
||||
}
|
||||
|
||||
private static void a(Context context, AppEvent appEvent, AccessTokenAppIdPair accessTokenAppIdPair) {
|
||||
AppEventQueue.a(accessTokenAppIdPair, appEvent);
|
||||
if (appEvent.a() || g) {
|
||||
return;
|
||||
}
|
||||
if (appEvent.c() == "fb_mobile_activate_app") {
|
||||
g = true;
|
||||
} else {
|
||||
Logger.a(LoggingBehavior.APP_EVENTS, "AppEvents", "Warning: Please call AppEventsLogger.activateApp(...)from the long-lived activity's onResume() methodbefore logging other app events.");
|
||||
}
|
||||
}
|
||||
|
||||
public static String a(Context context) {
|
||||
if (f == null) {
|
||||
synchronized (e) {
|
||||
if (f == null) {
|
||||
f = context.getSharedPreferences("com.facebook.sdk.appEventPreferences", 0).getString("anonymousAppDeviceGUID", null);
|
||||
if (f == null) {
|
||||
f = "XZ" + UUID.randomUUID().toString();
|
||||
context.getSharedPreferences("com.facebook.sdk.appEventPreferences", 0).edit().putString("anonymousAppDeviceGUID", f).apply();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return f;
|
||||
}
|
||||
}
|
11
sources/com/facebook/appevents/FlushReason.java
Normal file
11
sources/com/facebook/appevents/FlushReason.java
Normal file
@@ -0,0 +1,11 @@
|
||||
package com.facebook.appevents;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
enum FlushReason {
|
||||
EXPLICIT,
|
||||
TIMER,
|
||||
SESSION_CHANGE,
|
||||
PERSISTED_EVENTS,
|
||||
EVENT_THRESHOLD,
|
||||
EAGER_FLUSHING_EVENT
|
||||
}
|
9
sources/com/facebook/appevents/FlushResult.java
Normal file
9
sources/com/facebook/appevents/FlushResult.java
Normal file
@@ -0,0 +1,9 @@
|
||||
package com.facebook.appevents;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public enum FlushResult {
|
||||
SUCCESS,
|
||||
SERVER_ERROR,
|
||||
NO_CONNECTIVITY,
|
||||
UNKNOWN_ERROR
|
||||
}
|
10
sources/com/facebook/appevents/FlushStatistics.java
Normal file
10
sources/com/facebook/appevents/FlushStatistics.java
Normal file
@@ -0,0 +1,10 @@
|
||||
package com.facebook.appevents;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class FlushStatistics {
|
||||
public int a = 0;
|
||||
public FlushResult b = FlushResult.SUCCESS;
|
||||
|
||||
FlushStatistics() {
|
||||
}
|
||||
}
|
54
sources/com/facebook/appevents/PersistedEvents.java
Normal file
54
sources/com/facebook/appevents/PersistedEvents.java
Normal file
@@ -0,0 +1,54 @@
|
||||
package com.facebook.appevents;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class PersistedEvents implements Serializable {
|
||||
private HashMap<AccessTokenAppIdPair, List<AppEvent>> a = new HashMap<>();
|
||||
|
||||
static class SerializationProxyV1 implements Serializable {
|
||||
private final HashMap<AccessTokenAppIdPair, List<AppEvent>> a;
|
||||
|
||||
private Object readResolve() {
|
||||
return new PersistedEvents(this.a);
|
||||
}
|
||||
|
||||
private SerializationProxyV1(HashMap<AccessTokenAppIdPair, List<AppEvent>> hashMap) {
|
||||
this.a = hashMap;
|
||||
}
|
||||
}
|
||||
|
||||
public PersistedEvents() {
|
||||
}
|
||||
|
||||
private Object writeReplace() {
|
||||
return new SerializationProxyV1(this.a);
|
||||
}
|
||||
|
||||
public Set<AccessTokenAppIdPair> a() {
|
||||
return this.a.keySet();
|
||||
}
|
||||
|
||||
public List<AppEvent> b(AccessTokenAppIdPair accessTokenAppIdPair) {
|
||||
return this.a.get(accessTokenAppIdPair);
|
||||
}
|
||||
|
||||
public boolean a(AccessTokenAppIdPair accessTokenAppIdPair) {
|
||||
return this.a.containsKey(accessTokenAppIdPair);
|
||||
}
|
||||
|
||||
public PersistedEvents(HashMap<AccessTokenAppIdPair, List<AppEvent>> hashMap) {
|
||||
this.a.putAll(hashMap);
|
||||
}
|
||||
|
||||
public void a(AccessTokenAppIdPair accessTokenAppIdPair, List<AppEvent> list) {
|
||||
if (!this.a.containsKey(accessTokenAppIdPair)) {
|
||||
this.a.put(accessTokenAppIdPair, list);
|
||||
} else {
|
||||
this.a.get(accessTokenAppIdPair).addAll(list);
|
||||
}
|
||||
}
|
||||
}
|
110
sources/com/facebook/appevents/SessionEventsState.java
Normal file
110
sources/com/facebook/appevents/SessionEventsState.java
Normal file
@@ -0,0 +1,110 @@
|
||||
package com.facebook.appevents;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import com.facebook.GraphRequest;
|
||||
import com.facebook.internal.AppEventsLoggerUtility;
|
||||
import com.facebook.internal.AttributionIdentifiers;
|
||||
import com.facebook.internal.Utility;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class SessionEventsState {
|
||||
private List<AppEvent> a = new ArrayList();
|
||||
private List<AppEvent> b = new ArrayList();
|
||||
private int c;
|
||||
private AttributionIdentifiers d;
|
||||
private String e;
|
||||
|
||||
public SessionEventsState(AttributionIdentifiers attributionIdentifiers, String str) {
|
||||
this.d = attributionIdentifiers;
|
||||
this.e = str;
|
||||
}
|
||||
|
||||
public synchronized void a(AppEvent appEvent) {
|
||||
if (this.a.size() + this.b.size() >= 1000) {
|
||||
this.c++;
|
||||
} else {
|
||||
this.a.add(appEvent);
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized List<AppEvent> b() {
|
||||
List<AppEvent> list;
|
||||
list = this.a;
|
||||
this.a = new ArrayList();
|
||||
return list;
|
||||
}
|
||||
|
||||
public synchronized int a() {
|
||||
return this.a.size();
|
||||
}
|
||||
|
||||
public synchronized void a(boolean z) {
|
||||
if (z) {
|
||||
this.a.addAll(this.b);
|
||||
}
|
||||
this.b.clear();
|
||||
this.c = 0;
|
||||
}
|
||||
|
||||
public int a(GraphRequest graphRequest, Context context, boolean z, boolean z2) {
|
||||
synchronized (this) {
|
||||
int i = this.c;
|
||||
this.b.addAll(this.a);
|
||||
this.a.clear();
|
||||
JSONArray jSONArray = new JSONArray();
|
||||
for (AppEvent appEvent : this.b) {
|
||||
if (appEvent.d()) {
|
||||
if (z || !appEvent.a()) {
|
||||
jSONArray.put(appEvent.b());
|
||||
}
|
||||
} else {
|
||||
Utility.a("Event with invalid checksum: %s", appEvent.toString());
|
||||
}
|
||||
}
|
||||
if (jSONArray.length() == 0) {
|
||||
return 0;
|
||||
}
|
||||
a(graphRequest, context, i, jSONArray, z2);
|
||||
return jSONArray.length();
|
||||
}
|
||||
}
|
||||
|
||||
private void a(GraphRequest graphRequest, Context context, int i, JSONArray jSONArray, boolean z) {
|
||||
JSONObject jSONObject;
|
||||
try {
|
||||
jSONObject = AppEventsLoggerUtility.a(AppEventsLoggerUtility.GraphAPIActivityType.CUSTOM_APP_EVENTS, this.d, this.e, z, context);
|
||||
if (this.c > 0) {
|
||||
jSONObject.put("num_skipped_events", i);
|
||||
}
|
||||
} catch (JSONException unused) {
|
||||
jSONObject = new JSONObject();
|
||||
}
|
||||
graphRequest.a(jSONObject);
|
||||
Bundle h = graphRequest.h();
|
||||
if (h == null) {
|
||||
h = new Bundle();
|
||||
}
|
||||
String jSONArray2 = jSONArray.toString();
|
||||
if (jSONArray2 != null) {
|
||||
h.putByteArray("custom_events_file", a(jSONArray2));
|
||||
graphRequest.a((Object) jSONArray2);
|
||||
}
|
||||
graphRequest.a(h);
|
||||
}
|
||||
|
||||
private byte[] a(String str) {
|
||||
try {
|
||||
return str.getBytes("UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
Utility.a("Encoding exception: ", (Exception) e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,182 @@
|
||||
package com.facebook.appevents.internal;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import com.facebook.FacebookSdk;
|
||||
import com.facebook.appevents.AppEventsLogger;
|
||||
import com.facebook.appevents.internal.SourceApplicationInfo;
|
||||
import com.facebook.internal.FetchedAppSettings;
|
||||
import com.facebook.internal.FetchedAppSettingsManager;
|
||||
import com.facebook.internal.Utility;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ActivityLifecycleTracker {
|
||||
private static final String a = "com.facebook.appevents.internal.ActivityLifecycleTracker";
|
||||
private static volatile ScheduledFuture c;
|
||||
private static volatile SessionInfo e;
|
||||
private static String g;
|
||||
private static long h;
|
||||
private static final ScheduledExecutorService b = Executors.newSingleThreadScheduledExecutor();
|
||||
private static AtomicInteger d = new AtomicInteger(0);
|
||||
private static AtomicBoolean f = new AtomicBoolean(false);
|
||||
|
||||
private static void g() {
|
||||
if (c != null) {
|
||||
c.cancel(false);
|
||||
}
|
||||
c = null;
|
||||
}
|
||||
|
||||
public static UUID h() {
|
||||
if (e != null) {
|
||||
return e.c();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public static int i() {
|
||||
FetchedAppSettings c2 = FetchedAppSettingsManager.c(FacebookSdk.c());
|
||||
return c2 == null ? Constants.a() : c2.e();
|
||||
}
|
||||
|
||||
public static void b(Activity activity) {
|
||||
final long currentTimeMillis = System.currentTimeMillis();
|
||||
final Context applicationContext = activity.getApplicationContext();
|
||||
final String b2 = Utility.b(activity);
|
||||
final SourceApplicationInfo a2 = SourceApplicationInfo.Factory.a(activity);
|
||||
b.execute(new Runnable() { // from class: com.facebook.appevents.internal.ActivityLifecycleTracker.2
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
if (ActivityLifecycleTracker.e == null) {
|
||||
SessionInfo j = SessionInfo.j();
|
||||
if (j != null) {
|
||||
SessionLogger.a(applicationContext, b2, j, ActivityLifecycleTracker.g);
|
||||
}
|
||||
SessionInfo unused = ActivityLifecycleTracker.e = new SessionInfo(Long.valueOf(currentTimeMillis), null);
|
||||
ActivityLifecycleTracker.e.a(a2);
|
||||
SessionLogger.a(applicationContext, b2, a2, ActivityLifecycleTracker.g);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public static void c(Activity activity) {
|
||||
if (d.decrementAndGet() < 0) {
|
||||
d.set(0);
|
||||
Log.w(a, "Unexpected activity pause without a matching activity resume. Logging data may be incorrect. Make sure you call activateApp from your Application's onCreate method");
|
||||
}
|
||||
g();
|
||||
final long currentTimeMillis = System.currentTimeMillis();
|
||||
final Context applicationContext = activity.getApplicationContext();
|
||||
final String b2 = Utility.b(activity);
|
||||
b.execute(new Runnable() { // from class: com.facebook.appevents.internal.ActivityLifecycleTracker.4
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
if (ActivityLifecycleTracker.e == null) {
|
||||
SessionInfo unused = ActivityLifecycleTracker.e = new SessionInfo(Long.valueOf(currentTimeMillis), null);
|
||||
}
|
||||
ActivityLifecycleTracker.e.a(Long.valueOf(currentTimeMillis));
|
||||
if (ActivityLifecycleTracker.d.get() <= 0) {
|
||||
ScheduledFuture unused2 = ActivityLifecycleTracker.c = ActivityLifecycleTracker.b.schedule(new Runnable() { // from class: com.facebook.appevents.internal.ActivityLifecycleTracker.4.1
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
if (ActivityLifecycleTracker.d.get() <= 0) {
|
||||
AnonymousClass4 anonymousClass4 = AnonymousClass4.this;
|
||||
SessionLogger.a(applicationContext, b2, ActivityLifecycleTracker.e, ActivityLifecycleTracker.g);
|
||||
SessionInfo.i();
|
||||
SessionInfo unused3 = ActivityLifecycleTracker.e = null;
|
||||
}
|
||||
ScheduledFuture unused4 = ActivityLifecycleTracker.c = null;
|
||||
}
|
||||
}, ActivityLifecycleTracker.i(), TimeUnit.SECONDS);
|
||||
}
|
||||
long j = ActivityLifecycleTracker.h;
|
||||
AutomaticAnalyticsLogger.a(b2, j > 0 ? (currentTimeMillis - j) / 1000 : 0L);
|
||||
ActivityLifecycleTracker.e.h();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void d(Activity activity) {
|
||||
d.incrementAndGet();
|
||||
g();
|
||||
final long currentTimeMillis = System.currentTimeMillis();
|
||||
h = currentTimeMillis;
|
||||
final Context applicationContext = activity.getApplicationContext();
|
||||
final String b2 = Utility.b(activity);
|
||||
b.execute(new Runnable() { // from class: com.facebook.appevents.internal.ActivityLifecycleTracker.3
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
if (ActivityLifecycleTracker.e == null) {
|
||||
SessionInfo unused = ActivityLifecycleTracker.e = new SessionInfo(Long.valueOf(currentTimeMillis), null);
|
||||
SessionLogger.a(applicationContext, b2, (SourceApplicationInfo) null, ActivityLifecycleTracker.g);
|
||||
} else if (ActivityLifecycleTracker.e.d() != null) {
|
||||
long longValue = currentTimeMillis - ActivityLifecycleTracker.e.d().longValue();
|
||||
if (longValue > ActivityLifecycleTracker.i() * 1000) {
|
||||
SessionLogger.a(applicationContext, b2, ActivityLifecycleTracker.e, ActivityLifecycleTracker.g);
|
||||
SessionLogger.a(applicationContext, b2, (SourceApplicationInfo) null, ActivityLifecycleTracker.g);
|
||||
SessionInfo unused2 = ActivityLifecycleTracker.e = new SessionInfo(Long.valueOf(currentTimeMillis), null);
|
||||
} else if (longValue > 1000) {
|
||||
ActivityLifecycleTracker.e.g();
|
||||
}
|
||||
}
|
||||
ActivityLifecycleTracker.e.a(Long.valueOf(currentTimeMillis));
|
||||
ActivityLifecycleTracker.e.h();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void a(Application application, String str) {
|
||||
if (f.compareAndSet(false, true)) {
|
||||
g = str;
|
||||
application.registerActivityLifecycleCallbacks(new Application.ActivityLifecycleCallbacks() { // from class: com.facebook.appevents.internal.ActivityLifecycleTracker.1
|
||||
@Override // android.app.Application.ActivityLifecycleCallbacks
|
||||
public void onActivityCreated(Activity activity, Bundle bundle) {
|
||||
AppEventUtility.a();
|
||||
ActivityLifecycleTracker.b(activity);
|
||||
}
|
||||
|
||||
@Override // android.app.Application.ActivityLifecycleCallbacks
|
||||
public void onActivityDestroyed(Activity activity) {
|
||||
}
|
||||
|
||||
@Override // android.app.Application.ActivityLifecycleCallbacks
|
||||
public void onActivityPaused(Activity activity) {
|
||||
AppEventUtility.a();
|
||||
ActivityLifecycleTracker.c(activity);
|
||||
}
|
||||
|
||||
@Override // android.app.Application.ActivityLifecycleCallbacks
|
||||
public void onActivityResumed(Activity activity) {
|
||||
AppEventUtility.a();
|
||||
ActivityLifecycleTracker.d(activity);
|
||||
}
|
||||
|
||||
@Override // android.app.Application.ActivityLifecycleCallbacks
|
||||
public void onActivitySaveInstanceState(Activity activity, Bundle bundle) {
|
||||
}
|
||||
|
||||
@Override // android.app.Application.ActivityLifecycleCallbacks
|
||||
public void onActivityStarted(Activity activity) {
|
||||
}
|
||||
|
||||
@Override // android.app.Application.ActivityLifecycleCallbacks
|
||||
public void onActivityStopped(Activity activity) {
|
||||
AppEventsLogger.g();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
10
sources/com/facebook/appevents/internal/AppEventUtility.java
Normal file
10
sources/com/facebook/appevents/internal/AppEventUtility.java
Normal file
@@ -0,0 +1,10 @@
|
||||
package com.facebook.appevents.internal;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class AppEventUtility {
|
||||
public static void a() {
|
||||
}
|
||||
|
||||
public static void b() {
|
||||
}
|
||||
}
|
@@ -0,0 +1,44 @@
|
||||
package com.facebook.appevents.internal;
|
||||
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import com.facebook.FacebookSdk;
|
||||
import com.facebook.appevents.AppEventsLogger;
|
||||
import com.facebook.internal.FetchedAppSettings;
|
||||
import com.facebook.internal.FetchedAppSettingsManager;
|
||||
import com.facebook.internal.Validate;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class AutomaticAnalyticsLogger {
|
||||
private static final String a = "com.facebook.appevents.internal.AutomaticAnalyticsLogger";
|
||||
|
||||
public static void a() {
|
||||
Context b = FacebookSdk.b();
|
||||
String c = FacebookSdk.c();
|
||||
boolean e = FacebookSdk.e();
|
||||
Validate.a(b, "context");
|
||||
if (e) {
|
||||
if (b instanceof Application) {
|
||||
AppEventsLogger.a((Application) b, c);
|
||||
} else {
|
||||
Log.w(a, "Automatic logging of basic events will not happen, because FacebookSdk.getApplicationContext() returns object that is not instance of android.app.Application. Make sure you call FacebookSdk.sdkInitialize() from Application class and pass application context.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void a(String str, long j) {
|
||||
Context b = FacebookSdk.b();
|
||||
String c = FacebookSdk.c();
|
||||
Validate.a(b, "context");
|
||||
FetchedAppSettings a2 = FetchedAppSettingsManager.a(c, false);
|
||||
if (a2 == null || !a2.a() || j <= 0) {
|
||||
return;
|
||||
}
|
||||
AppEventsLogger b2 = AppEventsLogger.b(b);
|
||||
Bundle bundle = new Bundle(1);
|
||||
bundle.putCharSequence("fb_aa_time_spent_view_name", str);
|
||||
b2.a("fb_aa_time_spent_on_view", j, bundle);
|
||||
}
|
||||
}
|
8
sources/com/facebook/appevents/internal/Constants.java
Normal file
8
sources/com/facebook/appevents/internal/Constants.java
Normal file
@@ -0,0 +1,8 @@
|
||||
package com.facebook.appevents.internal;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class Constants {
|
||||
public static int a() {
|
||||
return 60;
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
package com.facebook.appevents.internal;
|
||||
|
||||
import com.facebook.AccessToken;
|
||||
import com.facebook.appevents.AppEventsLogger;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class InternalAppEventsLogger extends AppEventsLogger {
|
||||
InternalAppEventsLogger(String str, String str2, AccessToken accessToken) {
|
||||
super(str, str2, accessToken);
|
||||
}
|
||||
}
|
109
sources/com/facebook/appevents/internal/SessionInfo.java
Normal file
109
sources/com/facebook/appevents/internal/SessionInfo.java
Normal file
@@ -0,0 +1,109 @@
|
||||
package com.facebook.appevents.internal;
|
||||
|
||||
import android.content.SharedPreferences;
|
||||
import android.preference.PreferenceManager;
|
||||
import com.facebook.FacebookSdk;
|
||||
import java.util.UUID;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class SessionInfo {
|
||||
private Long a;
|
||||
private Long b;
|
||||
private int c;
|
||||
private Long d;
|
||||
private SourceApplicationInfo e;
|
||||
private UUID f;
|
||||
|
||||
public SessionInfo(Long l, Long l2) {
|
||||
this(l, l2, UUID.randomUUID());
|
||||
}
|
||||
|
||||
public static void i() {
|
||||
SharedPreferences.Editor edit = PreferenceManager.getDefaultSharedPreferences(FacebookSdk.b()).edit();
|
||||
edit.remove("com.facebook.appevents.SessionInfo.sessionStartTime");
|
||||
edit.remove("com.facebook.appevents.SessionInfo.sessionEndTime");
|
||||
edit.remove("com.facebook.appevents.SessionInfo.interruptionCount");
|
||||
edit.remove("com.facebook.appevents.SessionInfo.sessionId");
|
||||
edit.apply();
|
||||
SourceApplicationInfo.b();
|
||||
}
|
||||
|
||||
public static SessionInfo j() {
|
||||
SharedPreferences defaultSharedPreferences = PreferenceManager.getDefaultSharedPreferences(FacebookSdk.b());
|
||||
long j = defaultSharedPreferences.getLong("com.facebook.appevents.SessionInfo.sessionStartTime", 0L);
|
||||
long j2 = defaultSharedPreferences.getLong("com.facebook.appevents.SessionInfo.sessionEndTime", 0L);
|
||||
String string = defaultSharedPreferences.getString("com.facebook.appevents.SessionInfo.sessionId", null);
|
||||
if (j == 0 || j2 == 0 || string == null) {
|
||||
return null;
|
||||
}
|
||||
SessionInfo sessionInfo = new SessionInfo(Long.valueOf(j), Long.valueOf(j2));
|
||||
sessionInfo.c = defaultSharedPreferences.getInt("com.facebook.appevents.SessionInfo.interruptionCount", 0);
|
||||
sessionInfo.e = SourceApplicationInfo.c();
|
||||
sessionInfo.d = Long.valueOf(System.currentTimeMillis());
|
||||
sessionInfo.f = UUID.fromString(string);
|
||||
return sessionInfo;
|
||||
}
|
||||
|
||||
public void a(Long l) {
|
||||
this.b = l;
|
||||
}
|
||||
|
||||
public int b() {
|
||||
return this.c;
|
||||
}
|
||||
|
||||
public UUID c() {
|
||||
return this.f;
|
||||
}
|
||||
|
||||
public Long d() {
|
||||
return this.b;
|
||||
}
|
||||
|
||||
public long e() {
|
||||
Long l;
|
||||
if (this.a == null || (l = this.b) == null) {
|
||||
return 0L;
|
||||
}
|
||||
return l.longValue() - this.a.longValue();
|
||||
}
|
||||
|
||||
public SourceApplicationInfo f() {
|
||||
return this.e;
|
||||
}
|
||||
|
||||
public void g() {
|
||||
this.c++;
|
||||
}
|
||||
|
||||
public void h() {
|
||||
SharedPreferences.Editor edit = PreferenceManager.getDefaultSharedPreferences(FacebookSdk.b()).edit();
|
||||
edit.putLong("com.facebook.appevents.SessionInfo.sessionStartTime", this.a.longValue());
|
||||
edit.putLong("com.facebook.appevents.SessionInfo.sessionEndTime", this.b.longValue());
|
||||
edit.putInt("com.facebook.appevents.SessionInfo.interruptionCount", this.c);
|
||||
edit.putString("com.facebook.appevents.SessionInfo.sessionId", this.f.toString());
|
||||
edit.apply();
|
||||
SourceApplicationInfo sourceApplicationInfo = this.e;
|
||||
if (sourceApplicationInfo != null) {
|
||||
sourceApplicationInfo.a();
|
||||
}
|
||||
}
|
||||
|
||||
public SessionInfo(Long l, Long l2, UUID uuid) {
|
||||
this.a = l;
|
||||
this.b = l2;
|
||||
this.f = uuid;
|
||||
}
|
||||
|
||||
public long a() {
|
||||
Long l = this.d;
|
||||
if (l == null) {
|
||||
return 0L;
|
||||
}
|
||||
return l.longValue();
|
||||
}
|
||||
|
||||
public void a(SourceApplicationInfo sourceApplicationInfo) {
|
||||
this.e = sourceApplicationInfo;
|
||||
}
|
||||
}
|
61
sources/com/facebook/appevents/internal/SessionLogger.java
Normal file
61
sources/com/facebook/appevents/internal/SessionLogger.java
Normal file
@@ -0,0 +1,61 @@
|
||||
package com.facebook.appevents.internal;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import com.facebook.LoggingBehavior;
|
||||
import com.facebook.appevents.AppEventsLogger;
|
||||
import com.facebook.internal.Logger;
|
||||
import java.util.Locale;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class SessionLogger {
|
||||
private static final String a = "com.facebook.appevents.internal.SessionLogger";
|
||||
private static final long[] b = {300000, 900000, 1800000, 3600000, 21600000, 43200000, 86400000, 172800000, 259200000, 604800000, 1209600000, 1814400000, 2419200000L, 5184000000L, 7776000000L, 10368000000L, 12960000000L, 15552000000L, 31536000000L};
|
||||
|
||||
public static void a(Context context, String str, SourceApplicationInfo sourceApplicationInfo, String str2) {
|
||||
String sourceApplicationInfo2 = sourceApplicationInfo != null ? sourceApplicationInfo.toString() : "Unclassified";
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("fb_mobile_launch_source", sourceApplicationInfo2);
|
||||
InternalAppEventsLogger internalAppEventsLogger = new InternalAppEventsLogger(str, str2, null);
|
||||
internalAppEventsLogger.a("fb_mobile_activate_app", bundle);
|
||||
if (AppEventsLogger.c() != AppEventsLogger.FlushBehavior.EXPLICIT_ONLY) {
|
||||
internalAppEventsLogger.a();
|
||||
}
|
||||
}
|
||||
|
||||
public static void a(Context context, String str, SessionInfo sessionInfo, String str2) {
|
||||
Long valueOf = Long.valueOf(sessionInfo.a() - sessionInfo.d().longValue());
|
||||
if (valueOf.longValue() < 0) {
|
||||
a();
|
||||
valueOf = 0L;
|
||||
}
|
||||
Long valueOf2 = Long.valueOf(sessionInfo.e());
|
||||
if (valueOf2.longValue() < 0) {
|
||||
a();
|
||||
valueOf2 = 0L;
|
||||
}
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putInt("fb_mobile_app_interruptions", sessionInfo.b());
|
||||
bundle.putString("fb_mobile_time_between_sessions", String.format(Locale.ROOT, "session_quanta_%d", Integer.valueOf(a(valueOf.longValue()))));
|
||||
SourceApplicationInfo f = sessionInfo.f();
|
||||
bundle.putString("fb_mobile_launch_source", f != null ? f.toString() : "Unclassified");
|
||||
bundle.putLong("_logTime", sessionInfo.d().longValue() / 1000);
|
||||
new InternalAppEventsLogger(str, str2, null).a("fb_mobile_deactivate_app", valueOf2.longValue() / 1000, bundle);
|
||||
}
|
||||
|
||||
private static void a() {
|
||||
Logger.a(LoggingBehavior.APP_EVENTS, a, "Clock skew detected");
|
||||
}
|
||||
|
||||
private static int a(long j) {
|
||||
int i = 0;
|
||||
while (true) {
|
||||
long[] jArr = b;
|
||||
if (i >= jArr.length || jArr[i] >= j) {
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
}
|
@@ -0,0 +1,79 @@
|
||||
package com.facebook.appevents.internal;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import bolts.AppLinks;
|
||||
import com.facebook.FacebookSdk;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class SourceApplicationInfo {
|
||||
private String a;
|
||||
private boolean b;
|
||||
|
||||
public static class Factory {
|
||||
public static SourceApplicationInfo a(Activity activity) {
|
||||
ComponentName callingActivity = activity.getCallingActivity();
|
||||
if (callingActivity == null) {
|
||||
return null;
|
||||
}
|
||||
String packageName = callingActivity.getPackageName();
|
||||
if (packageName.equals(activity.getPackageName())) {
|
||||
return null;
|
||||
}
|
||||
Intent intent = activity.getIntent();
|
||||
boolean z = false;
|
||||
if (intent != null && !intent.getBooleanExtra("_fbSourceApplicationHasBeenSet", false)) {
|
||||
intent.putExtra("_fbSourceApplicationHasBeenSet", true);
|
||||
Bundle a = AppLinks.a(intent);
|
||||
if (a != null) {
|
||||
Bundle bundle = a.getBundle("referer_app_link");
|
||||
if (bundle != null) {
|
||||
packageName = bundle.getString("package");
|
||||
}
|
||||
z = true;
|
||||
}
|
||||
}
|
||||
intent.putExtra("_fbSourceApplicationHasBeenSet", true);
|
||||
return new SourceApplicationInfo(packageName, z);
|
||||
}
|
||||
}
|
||||
|
||||
public static void b() {
|
||||
SharedPreferences.Editor edit = PreferenceManager.getDefaultSharedPreferences(FacebookSdk.b()).edit();
|
||||
edit.remove("com.facebook.appevents.SourceApplicationInfo.callingApplicationPackage");
|
||||
edit.remove("com.facebook.appevents.SourceApplicationInfo.openedByApplink");
|
||||
edit.apply();
|
||||
}
|
||||
|
||||
public static SourceApplicationInfo c() {
|
||||
SharedPreferences defaultSharedPreferences = PreferenceManager.getDefaultSharedPreferences(FacebookSdk.b());
|
||||
if (defaultSharedPreferences.contains("com.facebook.appevents.SourceApplicationInfo.callingApplicationPackage")) {
|
||||
return new SourceApplicationInfo(defaultSharedPreferences.getString("com.facebook.appevents.SourceApplicationInfo.callingApplicationPackage", null), defaultSharedPreferences.getBoolean("com.facebook.appevents.SourceApplicationInfo.openedByApplink", false));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void a() {
|
||||
SharedPreferences.Editor edit = PreferenceManager.getDefaultSharedPreferences(FacebookSdk.b()).edit();
|
||||
edit.putString("com.facebook.appevents.SourceApplicationInfo.callingApplicationPackage", this.a);
|
||||
edit.putBoolean("com.facebook.appevents.SourceApplicationInfo.openedByApplink", this.b);
|
||||
edit.apply();
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
String str = this.b ? "Applink" : "Unclassified";
|
||||
if (this.a == null) {
|
||||
return str;
|
||||
}
|
||||
return str + "(" + this.a + ")";
|
||||
}
|
||||
|
||||
private SourceApplicationInfo(String str, boolean z) {
|
||||
this.a = str;
|
||||
this.b = z;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user