正在查看: Oolka v2.4.42 应用的 b.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Oolka v2.4.42 应用的 b.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.amplitude.android.utilities;
import android.annotation.SuppressLint;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.Network;
import android.net.NetworkCapabilities;
import android.net.NetworkInfo;
import kotlin.Metadata;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import org.jetbrains.annotations.NotNull;
@Metadata
public final class b {
@NotNull
public static final a e = new a(null);
@NotNull
public final Context a;
@NotNull
public final com.amplitude.common.a b;
public final boolean c;
public boolean d;
@Metadata
public static final class a {
public a(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
public a() {
}
}
public b(@NotNull Context context, @NotNull com.amplitude.common.a aVar) {
Intrinsics.checkNotNullParameter(context, "context");
Intrinsics.checkNotNullParameter(aVar, "logger");
this.a = context;
this.b = aVar;
this.d = true;
boolean a2 = a(context, "android.permission.ACCESS_NETWORK_STATE");
this.c = a2;
if (a2) {
return;
}
aVar.d("No ACCESS_NETWORK_STATE permission, offline mode is not supported. To enable, add <uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\" /> to your AndroidManifest.xml. Learn more at https://www.docs.developers.amplitude.com/data/sdks/android-kotlin/#offline-mode");
}
public final boolean a(Context context, String str) {
return context.checkCallingOrSelfPermission(str) == 0;
}
@SuppressLint({"MissingPermission", "NewApi"})
public final boolean b() {
NetworkCapabilities networkCapabilities;
if (!this.c) {
return true;
}
try {
Object systemService = this.a.getSystemService("connectivity");
if (!(systemService instanceof ConnectivityManager)) {
this.b.a("Service is not an instance of ConnectivityManager. Offline mode is not supported");
return true;
}
if (!this.d) {
NetworkInfo activeNetworkInfo = ((ConnectivityManager) systemService).getActiveNetworkInfo();
return activeNetworkInfo != null && activeNetworkInfo.isConnectedOrConnecting();
}
Network activeNetwork = ((ConnectivityManager) systemService).getActiveNetwork();
if (activeNetwork == null || (networkCapabilities = ((ConnectivityManager) systemService).getNetworkCapabilities(activeNetwork)) == null) {
return false;
}
if (!networkCapabilities.hasTransport(1) && !networkCapabilities.hasTransport(0)) {
return false;
}
return true;
} catch (Throwable th) {
this.b.d("Error checking network connectivity: " + th.getMessage());
this.b.d(kotlin.a.b(th));
return true;
}
}
}