Add decompiled APK source code (JADX)

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

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

View File

@@ -0,0 +1,496 @@
package com.vungle.ads.internal.util;
import android.app.Activity;
import android.app.Application;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import androidx.annotation.VisibleForTesting;
import com.vungle.ads.AnalyticsClient;
import com.vungle.ads.internal.ui.PresenterAdOpenCallback;
import com.vungle.ads.internal.util.ActivityManager;
import com.vungle.ads.internal.util.Logger;
import java.lang.ref.WeakReference;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArraySet;
import java.util.concurrent.atomic.AtomicBoolean;
import kotlin.collections.CollectionsKt__CollectionsJVMKt;
import kotlin.collections.CollectionsKt__CollectionsKt;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes4.dex */
public final class ActivityManager implements Application.ActivityLifecycleCallbacks {
private Handler handler;
private String lastStoppedActivityName;
public static final Companion Companion = new Companion(null);
private static final String TAG = ActivityManager.class.getSimpleName();
private static final ActivityManager instance = new ActivityManager();
private static final long TIMEOUT = 3000;
private static final long CONFIG_CHANGE_DELAY = 700;
private State state = State.UNKNOWN;
private AtomicBoolean isInitialized = new AtomicBoolean(false);
private final CopyOnWriteArraySet<String> startedActivities = new CopyOnWriteArraySet<>();
private final CopyOnWriteArraySet<String> resumedActivities = new CopyOnWriteArraySet<>();
private final CopyOnWriteArraySet<LifeCycleCallback> callbacks = new CopyOnWriteArraySet<>();
private final ConcurrentHashMap<LeftApplicationCallback, LifeCycleCallback> adLeftCallbacks = new ConcurrentHashMap<>();
private final Runnable configChangeRunnable = new Runnable() { // from class: com.vungle.ads.internal.util.ActivityManager$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
ActivityManager.m3987configChangeRunnable$lambda0(ActivityManager.this);
}
};
public interface LeftApplicationCallback {
void onLeftApplication();
}
public static class LifeCycleCallback {
public void onPause() {
}
public void onResume() {
}
public void onStart() {
}
public void onStop() {
}
}
public enum State {
STARTED,
RESUMED,
PAUSED,
STOPPED,
UNKNOWN
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivityCreated(Activity activity, Bundle bundle) {
Intrinsics.checkNotNullParameter(activity, "activity");
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivityDestroyed(Activity activity) {
Intrinsics.checkNotNullParameter(activity, "activity");
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivitySaveInstanceState(Activity activity, Bundle outState) {
Intrinsics.checkNotNullParameter(activity, "activity");
Intrinsics.checkNotNullParameter(outState, "outState");
}
private ActivityManager() {
}
private final int getStartedActivitiesCount() {
return this.startedActivities.size();
}
private final int getResumedActivitiesCount() {
return this.resumedActivities.size();
}
private final boolean isAppForeground() {
return !this.resumedActivities.isEmpty();
}
private final boolean getNoResumedActivities() {
return this.resumedActivities.isEmpty();
}
private final boolean getNoStartedActivities() {
return this.startedActivities.isEmpty();
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: configChangeRunnable$lambda-0, reason: not valid java name */
public static final void m3987configChangeRunnable$lambda0(ActivityManager this$0) {
Intrinsics.checkNotNullParameter(this$0, "this$0");
if (this$0.getNoResumedActivities()) {
State state = this$0.state;
State state2 = State.PAUSED;
if (state != state2) {
this$0.state = state2;
Iterator<LifeCycleCallback> it = this$0.callbacks.iterator();
while (it.hasNext()) {
it.next().onPause();
}
}
}
if (this$0.getNoStartedActivities() && this$0.state == State.PAUSED) {
this$0.state = State.STOPPED;
Iterator<LifeCycleCallback> it2 = this$0.callbacks.iterator();
while (it2.hasNext()) {
it2.next().onStop();
}
}
}
public final void init(final Context context) {
Intrinsics.checkNotNullParameter(context, "context");
if (this.isInitialized.getAndSet(true)) {
return;
}
try {
Handler handler = new Handler(Looper.getMainLooper());
this.handler = handler;
handler.post(new Runnable() { // from class: com.vungle.ads.internal.util.ActivityManager$$ExternalSyntheticLambda1
@Override // java.lang.Runnable
public final void run() {
ActivityManager.m3988init$lambda1(context, this);
}
});
} catch (Exception e) {
Logger.Companion companion = Logger.Companion;
String TAG2 = TAG;
Intrinsics.checkNotNullExpressionValue(TAG2, "TAG");
companion.e(TAG2, "Error initializing ActivityManager", e);
this.isInitialized.set(false);
}
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: init$lambda-1, reason: not valid java name */
public static final void m3988init$lambda1(Context context, ActivityManager this$0) {
Intrinsics.checkNotNullParameter(context, "$context");
Intrinsics.checkNotNullParameter(this$0, "this$0");
Context applicationContext = context.getApplicationContext();
Intrinsics.checkNotNull(applicationContext, "null cannot be cast to non-null type android.app.Application");
((Application) applicationContext).registerActivityLifecycleCallbacks(this$0);
}
@VisibleForTesting
public final void deInit(Context context) {
Intrinsics.checkNotNullParameter(context, "context");
Context applicationContext = context.getApplicationContext();
Intrinsics.checkNotNull(applicationContext, "null cannot be cast to non-null type android.app.Application");
((Application) applicationContext).unregisterActivityLifecycleCallbacks(this);
this.startedActivities.clear();
this.resumedActivities.clear();
this.isInitialized.set(false);
this.callbacks.clear();
this.adLeftCallbacks.clear();
}
/* JADX INFO: Access modifiers changed from: private */
public final boolean inForeground() {
return !this.isInitialized.get() || this.lastStoppedActivityName == null || isAppForeground();
}
public final void addListener(LifeCycleCallback callback) {
Intrinsics.checkNotNullParameter(callback, "callback");
this.callbacks.add(callback);
}
/* JADX INFO: Access modifiers changed from: private */
public final void removeListener(LifeCycleCallback lifeCycleCallback) {
this.callbacks.remove(lifeCycleCallback);
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivityStarted(Activity activity) {
List listOf;
Intrinsics.checkNotNullParameter(activity, "activity");
this.startedActivities.add(activity.toString());
if (getStartedActivitiesCount() == 1) {
State state = State.STARTED;
listOf = CollectionsKt__CollectionsKt.listOf((Object[]) new State[]{state, State.RESUMED});
if (listOf.contains(this.state)) {
return;
}
this.state = state;
Iterator<LifeCycleCallback> it = this.callbacks.iterator();
while (it.hasNext()) {
it.next().onStart();
}
}
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivityStopped(Activity activity) {
Handler handler;
Intrinsics.checkNotNullParameter(activity, "activity");
this.lastStoppedActivityName = activity.toString();
this.startedActivities.remove(activity.toString());
if (!getNoStartedActivities() || (handler = this.handler) == null) {
return;
}
handler.removeCallbacks(this.configChangeRunnable);
handler.postDelayed(this.configChangeRunnable, CONFIG_CHANGE_DELAY);
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivityResumed(Activity activity) {
Intrinsics.checkNotNullParameter(activity, "activity");
boolean noResumedActivities = getNoResumedActivities();
this.resumedActivities.add(activity.toString());
if (getResumedActivitiesCount() == 1) {
if (noResumedActivities) {
State state = State.RESUMED;
if (!CollectionsKt__CollectionsJVMKt.listOf(state).contains(this.state)) {
this.state = state;
Iterator<LifeCycleCallback> it = this.callbacks.iterator();
while (it.hasNext()) {
it.next().onResume();
}
return;
}
}
Handler handler = this.handler;
if (handler != null) {
handler.removeCallbacks(this.configChangeRunnable);
}
}
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivityPaused(Activity activity) {
Intrinsics.checkNotNullParameter(activity, "activity");
this.resumedActivities.remove(activity.toString());
if (getNoResumedActivities()) {
Handler handler = this.handler;
if (handler != null) {
handler.removeCallbacks(this.configChangeRunnable);
}
Handler handler2 = this.handler;
if (handler2 != null) {
handler2.postDelayed(this.configChangeRunnable, CONFIG_CHANGE_DELAY);
}
}
}
public final void addOnNextAppLeftCallback(LeftApplicationCallback leftApplicationCallback) {
if (leftApplicationCallback == null) {
return;
}
if (!this.isInitialized.get()) {
leftApplicationCallback.onLeftApplication();
return;
}
final WeakReference weakReference = new WeakReference(leftApplicationCallback);
final Runnable runnable = new Runnable() { // from class: com.vungle.ads.internal.util.ActivityManager$addOnNextAppLeftCallback$cancelRunnable$1
@Override // java.lang.Runnable
public void run() {
Handler handler;
handler = ActivityManager.this.handler;
if (handler != null) {
handler.removeCallbacks(this);
}
ActivityManager.this.removeOnNextAppLeftCallback(weakReference.get());
}
};
LifeCycleCallback lifeCycleCallback = new LifeCycleCallback() { // from class: com.vungle.ads.internal.util.ActivityManager$addOnNextAppLeftCallback$callback$1
private boolean wasPaused;
public final boolean getWasPaused() {
return this.wasPaused;
}
public final void setWasPaused(boolean z) {
this.wasPaused = z;
}
@Override // com.vungle.ads.internal.util.ActivityManager.LifeCycleCallback
public void onStop() {
Handler handler;
ConcurrentHashMap concurrentHashMap;
super.onStop();
ActivityManager.LeftApplicationCallback leftApplicationCallback2 = weakReference.get();
if (this.wasPaused && leftApplicationCallback2 != null) {
concurrentHashMap = this.adLeftCallbacks;
if (concurrentHashMap.containsKey(leftApplicationCallback2)) {
leftApplicationCallback2.onLeftApplication();
}
}
this.removeOnNextAppLeftCallback(leftApplicationCallback2);
handler = this.handler;
if (handler != null) {
handler.removeCallbacks(runnable);
}
}
@Override // com.vungle.ads.internal.util.ActivityManager.LifeCycleCallback
public void onResume() {
Handler handler;
super.onResume();
handler = this.handler;
if (handler != null) {
handler.postDelayed(runnable, ActivityManager.Companion.getCONFIG_CHANGE_DELAY() * 2);
}
}
@Override // com.vungle.ads.internal.util.ActivityManager.LifeCycleCallback
public void onPause() {
Handler handler;
super.onPause();
this.wasPaused = true;
handler = this.handler;
if (handler != null) {
handler.removeCallbacks(runnable);
}
}
};
this.adLeftCallbacks.put(leftApplicationCallback, lifeCycleCallback);
if (inForeground()) {
Handler handler = this.handler;
if (handler != null) {
handler.postDelayed(runnable, TIMEOUT);
}
addListener(lifeCycleCallback);
return;
}
instance.addListener(new LifeCycleCallback() { // from class: com.vungle.ads.internal.util.ActivityManager$addOnNextAppLeftCallback$1
@Override // com.vungle.ads.internal.util.ActivityManager.LifeCycleCallback
public void onStart() {
ConcurrentHashMap concurrentHashMap;
Handler handler2;
ActivityManager.Companion companion = ActivityManager.Companion;
companion.getInstance$vungle_ads_release().removeListener(this);
concurrentHashMap = ActivityManager.this.adLeftCallbacks;
ActivityManager.LifeCycleCallback lifeCycleCallback2 = (ActivityManager.LifeCycleCallback) concurrentHashMap.get(weakReference.get());
if (lifeCycleCallback2 != null) {
handler2 = ActivityManager.this.handler;
if (handler2 != null) {
handler2.postDelayed(runnable, companion.getTIMEOUT());
}
ActivityManager.this.addListener(lifeCycleCallback2);
}
}
});
}
/* JADX INFO: Access modifiers changed from: private */
public final void removeOnNextAppLeftCallback(LeftApplicationCallback leftApplicationCallback) {
LifeCycleCallback remove;
if (leftApplicationCallback == null || (remove = this.adLeftCallbacks.remove(leftApplicationCallback)) == null) {
return;
}
removeListener(remove);
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
@VisibleForTesting
public static /* synthetic */ void getCONFIG_CHANGE_DELAY$annotations() {
}
@VisibleForTesting(otherwise = 2)
public static /* synthetic */ void getInstance$vungle_ads_release$annotations() {
}
@VisibleForTesting
public static /* synthetic */ void getTIMEOUT$annotations() {
}
private Companion() {
}
public final String getTAG() {
return ActivityManager.TAG;
}
public final ActivityManager getInstance$vungle_ads_release() {
return ActivityManager.instance;
}
public final long getTIMEOUT() {
return ActivityManager.TIMEOUT;
}
public final long getCONFIG_CHANGE_DELAY() {
return ActivityManager.CONFIG_CHANGE_DELAY;
}
public final void startWhenForeground(Context context, final Intent intent, final Intent intent2, final LeftApplicationCallback leftApplicationCallback, final PresenterAdOpenCallback presenterAdOpenCallback) {
Intrinsics.checkNotNullParameter(context, "context");
final WeakReference weakReference = new WeakReference(context);
if (getInstance$vungle_ads_release().inForeground()) {
if (startActivityHandleException(context, intent, intent2, presenterAdOpenCallback)) {
getInstance$vungle_ads_release().addOnNextAppLeftCallback(leftApplicationCallback);
return;
}
return;
}
getInstance$vungle_ads_release().addListener(new LifeCycleCallback() { // from class: com.vungle.ads.internal.util.ActivityManager$Companion$startWhenForeground$1
@Override // com.vungle.ads.internal.util.ActivityManager.LifeCycleCallback
public void onStart() {
boolean startActivityHandleException;
super.onStart();
ActivityManager.Companion companion = ActivityManager.Companion;
companion.getInstance$vungle_ads_release().removeListener(this);
Context context2 = weakReference.get();
if (context2 != null) {
startActivityHandleException = companion.startActivityHandleException(context2, intent, intent2, presenterAdOpenCallback);
if (startActivityHandleException) {
companion.getInstance$vungle_ads_release().addOnNextAppLeftCallback(leftApplicationCallback);
}
}
}
});
}
public final void startWhenForeground(Context context, Intent intent, Intent intent2, LeftApplicationCallback leftApplicationCallback) {
Intrinsics.checkNotNullParameter(context, "context");
startWhenForeground(context, intent, intent2, leftApplicationCallback, null);
}
/* JADX INFO: Access modifiers changed from: private */
public final boolean startActivityHandleException(Context context, Intent intent, Intent intent2, PresenterAdOpenCallback presenterAdOpenCallback) {
if (intent == null && intent2 == null) {
return false;
}
try {
if (intent != null) {
context.startActivity(intent);
if (presenterAdOpenCallback != null) {
presenterAdOpenCallback.onDeeplinkClick(true);
}
} else {
context.startActivity(intent2);
}
return true;
} catch (Exception e) {
Logger.Companion companion = Logger.Companion;
String TAG = getTAG();
Intrinsics.checkNotNullExpressionValue(TAG, "TAG");
companion.e(TAG, "Cannot launch/find activity to handle the Implicit intent: " + e);
if (intent != null) {
try {
AnalyticsClient.INSTANCE.logError$vungle_ads_release(312, "Fail to open " + intent.getDataString(), (r13 & 4) != 0 ? null : "", (r13 & 8) != 0 ? null : null, (r13 & 16) != 0 ? null : null);
if (presenterAdOpenCallback != null) {
presenterAdOpenCallback.onDeeplinkClick(false);
}
} catch (Exception unused) {
return false;
}
}
if (intent != null && intent2 != null) {
context.startActivity(intent2);
return true;
}
return false;
}
}
public final void init(Context context) {
Intrinsics.checkNotNullParameter(context, "context");
getInstance$vungle_ads_release().init(context);
}
public final void addLifecycleListener(LifeCycleCallback listener) {
Intrinsics.checkNotNullParameter(listener, "listener");
getInstance$vungle_ads_release().addListener(listener);
}
}
}

View File

@@ -0,0 +1,28 @@
package com.vungle.ads.internal.util;
import java.util.HashSet;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes4.dex */
public final class CollectionsConcurrencyUtil {
public static final CollectionsConcurrencyUtil INSTANCE = new CollectionsConcurrencyUtil();
private CollectionsConcurrencyUtil() {
}
public static final synchronized HashSet<String> getNewHashSet(HashSet<String> hashSet) {
HashSet<String> hashSet2;
synchronized (CollectionsConcurrencyUtil.class) {
hashSet2 = new HashSet<>(hashSet);
}
return hashSet2;
}
public static final synchronized void addToSet(HashSet<String> hashset, String set) {
synchronized (CollectionsConcurrencyUtil.class) {
Intrinsics.checkNotNullParameter(hashset, "hashset");
Intrinsics.checkNotNullParameter(set, "set");
hashset.add(set);
}
}
}

View File

@@ -0,0 +1,26 @@
package com.vungle.ads.internal.util;
import java.util.concurrent.TimeUnit;
import kotlin.jvm.internal.DefaultConstructorMarker;
/* loaded from: classes4.dex */
public final class ConcurrencyTimeoutProvider {
public static final Companion Companion = new Companion(null);
private static final long OPERATION_TIMEOUT = TimeUnit.SECONDS.toMillis(4);
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
}
public final long getTimeout() {
if (ThreadUtil.INSTANCE.isMainThread()) {
return OPERATION_TIMEOUT;
}
return Long.MAX_VALUE;
}
}

View File

@@ -0,0 +1,66 @@
package com.vungle.ads.internal.util;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import com.google.android.gms.drive.DriveFile;
import com.vungle.ads.AnalyticsClient;
import com.vungle.ads.internal.ui.PresenterAdOpenCallback;
import com.vungle.ads.internal.util.ActivityManager;
import com.vungle.ads.internal.util.Logger;
import java.net.URISyntaxException;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes4.dex */
public final class ExternalRouter {
public static final ExternalRouter INSTANCE = new ExternalRouter();
private static final String TAG = ExternalRouter.class.getSimpleName();
private ExternalRouter() {
}
public static final boolean launch(String str, String str2, Context context, ActivityManager.LeftApplicationCallback leftApplicationCallback, PresenterAdOpenCallback presenterAdOpenCallback) {
Intrinsics.checkNotNullParameter(context, "context");
if ((str != null && str.length() != 0) || (str2 != null && str2.length() != 0)) {
boolean z = !(context instanceof Activity);
try {
ExternalRouter externalRouter = INSTANCE;
ActivityManager.Companion.startWhenForeground(context, externalRouter.getIntentFromUrl(str, z), externalRouter.getIntentFromUrl(str2, z), leftApplicationCallback, presenterAdOpenCallback);
return true;
} catch (Exception e) {
if (str != null && str.length() != 0) {
AnalyticsClient.INSTANCE.logError$vungle_ads_release(312, "Fail to open " + str, (r13 & 4) != 0 ? null : "", (r13 & 8) != 0 ? null : null, (r13 & 16) != 0 ? null : null);
} else {
AnalyticsClient.INSTANCE.logError$vungle_ads_release(314, "Fail to open " + str2, (r13 & 4) != 0 ? null : "", (r13 & 8) != 0 ? null : null, (r13 & 16) != 0 ? null : null);
}
Logger.Companion companion = Logger.Companion;
String TAG2 = TAG;
Intrinsics.checkNotNullExpressionValue(TAG2, "TAG");
companion.e(TAG2, "Error while opening url" + e.getLocalizedMessage());
Intrinsics.checkNotNullExpressionValue(TAG2, "TAG");
companion.d(TAG2, "Cannot open url " + str2);
}
}
return false;
}
private final Intent getIntentFromUrl(String str, boolean z) {
Intent intent = null;
if (str != null) {
try {
if (str.length() != 0) {
intent = Intent.parseUri(str, 0);
}
} catch (URISyntaxException e) {
Logger.Companion companion = Logger.Companion;
String TAG2 = TAG;
Intrinsics.checkNotNullExpressionValue(TAG2, "TAG");
companion.e(TAG2, "url format is not correct " + e.getLocalizedMessage());
}
}
if (intent != null && z) {
intent.setFlags(DriveFile.MODE_READ_ONLY);
}
return intent;
}
}

View File

@@ -0,0 +1,448 @@
package com.vungle.ads.internal.util;
import android.webkit.URLUtil;
import androidx.annotation.VisibleForTesting;
import com.vungle.ads.internal.util.Logger;
import java.io.Closeable;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.nio.file.Files;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
import kotlin.collections.CollectionsKt__CollectionsKt;
import kotlin.io.FilesKt__FileReadWriteKt;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.Charsets;
import okhttp3.HttpUrl;
/* loaded from: classes4.dex */
public final class FileUtility {
private static final List<Class<?>> allowedClasses;
public static final FileUtility INSTANCE = new FileUtility();
private static ObjectInputStreamProvider objectInputStreamProvider = new ObjectInputStreamProvider() { // from class: com.vungle.ads.internal.util.FileUtility$$ExternalSyntheticLambda0
@Override // com.vungle.ads.internal.util.FileUtility.ObjectInputStreamProvider
public final ObjectInputStream provideObjectInputStream(InputStream inputStream) {
ObjectInputStream m3990objectInputStreamProvider$lambda0;
m3990objectInputStreamProvider$lambda0 = FileUtility.m3990objectInputStreamProvider$lambda0(inputStream);
return m3990objectInputStreamProvider$lambda0;
}
};
private static final String TAG = FileUtility.class.getSimpleName();
public interface ObjectInputStreamProvider {
ObjectInputStream provideObjectInputStream(InputStream inputStream) throws IOException, ClassNotFoundException;
}
@VisibleForTesting
public static /* synthetic */ void getAllowedClasses$vungle_ads_release$annotations() {
}
public static final void printDirectoryTree(File file) {
}
public final List<Class<?>> getAllowedClasses$vungle_ads_release() {
return allowedClasses;
}
@VisibleForTesting
public final ObjectInputStreamProvider getObjectInputStreamProvider() {
return objectInputStreamProvider;
}
@VisibleForTesting
public final void setObjectInputStreamProvider(ObjectInputStreamProvider objectInputStreamProvider2) {
Intrinsics.checkNotNullParameter(objectInputStreamProvider2, "<set-?>");
objectInputStreamProvider = objectInputStreamProvider2;
}
private FileUtility() {
}
static {
List<Class<?>> listOf;
listOf = CollectionsKt__CollectionsKt.listOf((Object[]) new Class[]{LinkedHashSet.class, HashSet.class, HashMap.class, ArrayList.class, File.class});
allowedClasses = listOf;
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: objectInputStreamProvider$lambda-0, reason: not valid java name */
public static final ObjectInputStream m3990objectInputStreamProvider$lambda0(InputStream inputStream) {
return new SafeObjectInputStream(inputStream, allowedClasses);
}
private final void printDirectoryTree(File file, int i, StringBuilder sb) {
if (file == null) {
return;
}
if (!file.isDirectory()) {
throw new IllegalArgumentException("folder is not a Directory".toString());
}
sb.append(getIndentString(i));
sb.append("+--");
sb.append(file.getName());
sb.append("/\n");
File[] listFiles = file.listFiles();
if (listFiles == null) {
return;
}
for (File file2 : listFiles) {
if (file2.isDirectory()) {
printDirectoryTree(file2, i + 1, sb);
} else {
Intrinsics.checkNotNullExpressionValue(file2, "file");
printFile(file2, i + 1, sb);
}
}
}
private final void printFile(File file, int i, StringBuilder sb) {
sb.append(getIndentString(i));
sb.append("+--");
sb.append(file.getName());
sb.append('\n');
}
private final String getIndentString(int i) {
StringBuilder sb = new StringBuilder();
for (int i2 = 0; i2 < i; i2++) {
sb.append("| ");
}
String sb2 = sb.toString();
Intrinsics.checkNotNullExpressionValue(sb2, "sb.toString()");
return sb2;
}
public static final void delete(File file) {
if (file != null) {
try {
if (file.exists()) {
if (file.isDirectory()) {
deleteContents(file);
}
if (file.delete()) {
return;
}
Logger.Companion companion = Logger.Companion;
String TAG2 = TAG;
Intrinsics.checkNotNullExpressionValue(TAG2, "TAG");
companion.d(TAG2, "Failed to delete file: " + file);
}
} catch (Exception e) {
Logger.Companion companion2 = Logger.Companion;
String TAG3 = TAG;
Intrinsics.checkNotNullExpressionValue(TAG3, "TAG");
companion2.e(TAG3, "Failed to delete file: " + e.getLocalizedMessage());
}
}
}
public static final void deleteContents(File folder) {
Intrinsics.checkNotNullParameter(folder, "folder");
File[] listFiles = folder.listFiles();
if (listFiles == null) {
return;
}
for (File file : listFiles) {
delete(file);
}
}
public static final void deleteAndLogIfFailed(File file) {
Intrinsics.checkNotNullParameter(file, "file");
try {
Files.delete(file.toPath());
} catch (Exception e) {
Logger.Companion companion = Logger.Companion;
String TAG2 = TAG;
Intrinsics.checkNotNullExpressionValue(TAG2, "TAG");
companion.e(TAG2, "Cannot delete " + file.getName(), e);
}
}
public final void closeQuietly(Closeable closeable) {
if (closeable != null) {
try {
closeable.close();
} catch (IOException unused) {
}
}
}
/* JADX WARN: Multi-variable type inference failed */
/* JADX WARN: Type inference failed for: r4v1 */
/* JADX WARN: Type inference failed for: r4v3 */
/* JADX WARN: Type inference failed for: r4v4, types: [java.io.Closeable] */
/* JADX WARN: Type inference failed for: r4v5 */
/* JADX WARN: Type inference failed for: r4v6 */
/* JADX WARN: Type inference failed for: r4v7, types: [java.io.Closeable, java.io.ObjectOutputStream] */
/* JADX WARN: Type inference failed for: r4v8 */
/* JADX WARN: Type inference failed for: r5v15, types: [com.vungle.ads.internal.util.FileUtility] */
/* JADX WARN: Type inference failed for: r5v9, types: [com.vungle.ads.internal.util.FileUtility] */
public static final void writeSerializable(File file, Serializable serializable) {
FileOutputStream fileOutputStream;
?? r4;
Intrinsics.checkNotNullParameter(file, "file");
if (file.exists()) {
deleteAndLogIfFailed(file);
}
if (serializable == null) {
return;
}
FileOutputStream fileOutputStream2 = null;
try {
fileOutputStream = new FileOutputStream(file);
} catch (IOException e) {
e = e;
r4 = 0;
} catch (Throwable th) {
th = th;
fileOutputStream = null;
}
try {
r4 = new ObjectOutputStream(fileOutputStream);
} catch (IOException e2) {
e = e2;
r4 = 0;
} catch (Throwable th2) {
th = th2;
FileUtility fileUtility = INSTANCE;
fileUtility.closeQuietly(fileOutputStream2);
fileUtility.closeQuietly(fileOutputStream);
throw th;
}
try {
r4.writeObject(serializable);
r4.reset();
?? r5 = INSTANCE;
r5.closeQuietly(r4);
r5.closeQuietly(fileOutputStream);
} catch (IOException e3) {
e = e3;
fileOutputStream2 = fileOutputStream;
r4 = r4;
try {
Logger.Companion companion = Logger.Companion;
String TAG2 = TAG;
Intrinsics.checkNotNullExpressionValue(TAG2, "TAG");
companion.e(TAG2, String.valueOf(e.getMessage()));
?? r52 = INSTANCE;
r52.closeQuietly(r4);
r52.closeQuietly(fileOutputStream2);
} catch (Throwable th3) {
th = th3;
fileOutputStream = fileOutputStream2;
fileOutputStream2 = r4;
FileUtility fileUtility2 = INSTANCE;
fileUtility2.closeQuietly(fileOutputStream2);
fileUtility2.closeQuietly(fileOutputStream);
throw th;
}
} catch (Throwable th4) {
th = th4;
fileOutputStream2 = r4;
FileUtility fileUtility22 = INSTANCE;
fileUtility22.closeQuietly(fileOutputStream2);
fileUtility22.closeQuietly(fileOutputStream);
throw th;
}
}
public final void writeString(File file, String str) {
Intrinsics.checkNotNullParameter(file, "file");
if (str == null) {
return;
}
try {
FilesKt__FileReadWriteKt.writeText(file, str, Charsets.UTF_8);
} catch (IOException e) {
Logger.Companion companion = Logger.Companion;
String TAG2 = TAG;
Intrinsics.checkNotNullExpressionValue(TAG2, "TAG");
companion.e(TAG2, String.valueOf(e.getMessage()));
}
}
/* JADX WARN: Multi-variable type inference failed */
/* JADX WARN: Not initialized variable reg: 3, insn: 0x0028: MOVE (r2 I:??[OBJECT, ARRAY]) = (r3 I:??[OBJECT, ARRAY]), block:B:47:0x0028 */
/* JADX WARN: Type inference failed for: r0v1, types: [com.vungle.ads.internal.util.FileUtility] */
/* JADX WARN: Type inference failed for: r0v9, types: [com.vungle.ads.internal.util.FileUtility] */
/* JADX WARN: Type inference failed for: r1v1, types: [boolean] */
/* JADX WARN: Type inference failed for: r1v10 */
/* JADX WARN: Type inference failed for: r1v11, types: [java.io.Closeable, java.io.FileInputStream, java.io.InputStream] */
/* JADX WARN: Type inference failed for: r1v2, types: [java.io.Closeable] */
/* JADX WARN: Type inference failed for: r1v3 */
/* JADX WARN: Type inference failed for: r1v4 */
/* JADX WARN: Type inference failed for: r1v5 */
/* JADX WARN: Type inference failed for: r1v6 */
/* JADX WARN: Type inference failed for: r1v7 */
/* JADX WARN: Type inference failed for: r1v8 */
/* JADX WARN: Type inference failed for: r3v11, types: [com.vungle.ads.internal.util.FileUtility$ObjectInputStreamProvider] */
public static final <T> T readSerializable(File file) {
Closeable closeable;
ObjectInputStream objectInputStream;
Closeable closeable2;
Intrinsics.checkNotNullParameter(file, "file");
?? exists = file.exists();
Closeable closeable3 = null;
try {
if (exists == 0) {
return null;
}
try {
exists = new FileInputStream(file);
} catch (IOException e) {
e = e;
exists = 0;
objectInputStream = null;
} catch (ClassNotFoundException e2) {
e = e2;
exists = 0;
objectInputStream = null;
} catch (Exception e3) {
e = e3;
exists = 0;
objectInputStream = null;
} catch (Throwable th) {
th = th;
exists = 0;
}
try {
objectInputStream = objectInputStreamProvider.provideObjectInputStream(exists);
try {
T t = (T) objectInputStream.readObject();
?? r0 = INSTANCE;
r0.closeQuietly(objectInputStream);
r0.closeQuietly(exists);
return t;
} catch (IOException e4) {
e = e4;
Logger.Companion companion = Logger.Companion;
String TAG2 = TAG;
Intrinsics.checkNotNullExpressionValue(TAG2, "TAG");
companion.e(TAG2, "IOException: " + e.getMessage());
closeable2 = exists;
FileUtility fileUtility = INSTANCE;
fileUtility.closeQuietly(objectInputStream);
fileUtility.closeQuietly(closeable2);
try {
delete(file);
} catch (IOException unused) {
}
return null;
} catch (ClassNotFoundException e5) {
e = e5;
Logger.Companion companion2 = Logger.Companion;
String TAG3 = TAG;
Intrinsics.checkNotNullExpressionValue(TAG3, "TAG");
companion2.e(TAG3, "ClassNotFoundException: " + e.getMessage());
closeable2 = exists;
FileUtility fileUtility2 = INSTANCE;
fileUtility2.closeQuietly(objectInputStream);
fileUtility2.closeQuietly(closeable2);
delete(file);
return null;
} catch (Exception e6) {
e = e6;
Logger.Companion companion3 = Logger.Companion;
String TAG4 = TAG;
Intrinsics.checkNotNullExpressionValue(TAG4, "TAG");
companion3.e(TAG4, "cannot read serializable " + e.getMessage());
closeable2 = exists;
FileUtility fileUtility22 = INSTANCE;
fileUtility22.closeQuietly(objectInputStream);
fileUtility22.closeQuietly(closeable2);
delete(file);
return null;
}
} catch (IOException e7) {
e = e7;
objectInputStream = null;
} catch (ClassNotFoundException e8) {
e = e8;
objectInputStream = null;
} catch (Exception e9) {
e = e9;
objectInputStream = null;
} catch (Throwable th2) {
th = th2;
?? r02 = INSTANCE;
r02.closeQuietly(closeable3);
r02.closeQuietly(exists);
throw th;
}
} catch (Throwable th3) {
th = th3;
closeable3 = closeable;
}
}
public final String readString(File file) {
String readText$default;
Intrinsics.checkNotNullParameter(file, "file");
if (!file.exists()) {
return null;
}
try {
readText$default = FilesKt__FileReadWriteKt.readText$default(file, null, 1, null);
return readText$default;
} catch (IOException e) {
Logger.Companion companion = Logger.Companion;
String TAG2 = TAG;
Intrinsics.checkNotNullExpressionValue(TAG2, "TAG");
companion.e(TAG2, "IOException: " + e.getMessage());
return null;
} catch (Exception e2) {
Logger.Companion companion2 = Logger.Companion;
String TAG3 = TAG;
Intrinsics.checkNotNullExpressionValue(TAG3, "TAG");
companion2.e(TAG3, "cannot read string " + e2.getMessage());
return null;
}
}
public final boolean isValidUrl(String str) {
return (str == null || str.length() == 0 || HttpUrl.Companion.parse(str) == null) ? false : true;
}
public final long size(File file) {
long j = 0;
if (file == null || !file.exists()) {
return 0L;
}
if (file.isDirectory()) {
File[] listFiles = file.listFiles();
if (listFiles != null) {
if (!(listFiles.length == 0)) {
for (File file2 : listFiles) {
j += size(file2);
}
}
}
return j;
}
return file.length();
}
public static /* synthetic */ String guessFileName$default(FileUtility fileUtility, String str, String str2, int i, Object obj) {
if ((i & 2) != 0) {
str2 = null;
}
return fileUtility.guessFileName(str, str2);
}
public final String guessFileName(String url, String str) {
Intrinsics.checkNotNullParameter(url, "url");
String guessFileName = URLUtil.guessFileName(url, null, str);
Intrinsics.checkNotNullExpressionValue(guessFileName, "guessFileName(url, null, ext)");
return guessFileName;
}
}

View File

@@ -0,0 +1,35 @@
package com.vungle.ads.internal.util;
import android.os.Handler;
import android.os.Looper;
import android.os.SystemClock;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes4.dex */
public final class HandlerScheduler {
private final Handler handler = new Handler(Looper.getMainLooper());
public final void schedule(Runnable runnable, String tag, long j) {
Intrinsics.checkNotNullParameter(runnable, "runnable");
Intrinsics.checkNotNullParameter(tag, "tag");
this.handler.postAtTime(runnable, tag, calculateTime(j));
}
private final long calculateTime(long j) {
return SystemClock.uptimeMillis() + j;
}
public final void schedule(Runnable runnable, long j) {
Intrinsics.checkNotNullParameter(runnable, "runnable");
this.handler.postAtTime(runnable, calculateTime(j));
}
public final void cancel(String tag) {
Intrinsics.checkNotNullParameter(tag, "tag");
this.handler.removeCallbacksAndMessages(tag);
}
public final void cancelAll() {
this.handler.removeCallbacksAndMessages(null);
}
}

View File

@@ -0,0 +1,101 @@
package com.vungle.ads.internal.util;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.util.LruCache;
import com.vungle.ads.internal.util.Logger;
import java.util.concurrent.Executor;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.StringsKt__StringsJVMKt;
/* loaded from: classes4.dex */
public final class ImageLoader {
private static final String FILE_SCHEME = "file://";
private Executor ioExecutor;
private final LruCache<String, Bitmap> lruCache = new LruCache<String, Bitmap>(((int) (Runtime.getRuntime().maxMemory() / 1024)) / 8) { // from class: com.vungle.ads.internal.util.ImageLoader.1
@Override // android.util.LruCache
public int sizeOf(String str, Bitmap value) {
Intrinsics.checkNotNullParameter(value, "value");
return value.getByteCount() / 1024;
}
};
public static final Companion Companion = new Companion(null);
private static final String TAG = ImageLoader.class.getSimpleName();
private static final ImageLoader instance = new ImageLoader();
public final void init(Executor ioExecutor) {
Intrinsics.checkNotNullParameter(ioExecutor, "ioExecutor");
this.ioExecutor = ioExecutor;
}
private ImageLoader() {
}
public final void displayImage(final String str, final Function1 onImageLoaded) {
Intrinsics.checkNotNullParameter(onImageLoaded, "onImageLoaded");
if (this.ioExecutor == null) {
Logger.Companion companion = Logger.Companion;
String TAG2 = TAG;
Intrinsics.checkNotNullExpressionValue(TAG2, "TAG");
companion.w(TAG2, "ImageLoader not initialized.");
return;
}
if (str == null || str.length() == 0) {
Logger.Companion companion2 = Logger.Companion;
String TAG3 = TAG;
Intrinsics.checkNotNullExpressionValue(TAG3, "TAG");
companion2.w(TAG3, "the uri is required.");
return;
}
Executor executor = this.ioExecutor;
if (executor != null) {
executor.execute(new Runnable() { // from class: com.vungle.ads.internal.util.ImageLoader$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
ImageLoader.m3991displayImage$lambda0(str, this, onImageLoaded);
}
});
}
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: displayImage$lambda-0, reason: not valid java name */
public static final void m3991displayImage$lambda0(String str, ImageLoader this$0, Function1 onImageLoaded) {
Intrinsics.checkNotNullParameter(this$0, "this$0");
Intrinsics.checkNotNullParameter(onImageLoaded, "$onImageLoaded");
if (StringsKt__StringsJVMKt.startsWith$default(str, "file://", false, 2, null)) {
Bitmap bitmap = this$0.lruCache.get(str);
if (bitmap != null && !bitmap.isRecycled()) {
onImageLoaded.invoke(bitmap);
return;
}
String substring = str.substring(7);
Intrinsics.checkNotNullExpressionValue(substring, "this as java.lang.String).substring(startIndex)");
Bitmap decodeFile = BitmapFactory.decodeFile(substring);
if (decodeFile != null) {
this$0.lruCache.put(str, decodeFile);
onImageLoaded.invoke(decodeFile);
} else {
Logger.Companion companion = Logger.Companion;
String TAG2 = TAG;
Intrinsics.checkNotNullExpressionValue(TAG2, "TAG");
companion.w(TAG2, "decode bitmap failed.");
}
}
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
public final ImageLoader getInstance() {
return ImageLoader.instance;
}
}
}

View File

@@ -0,0 +1,38 @@
package com.vungle.ads.internal.util;
import android.util.Base64;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.zip.GZIPOutputStream;
import kotlin.io.CloseableKt;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.Charsets;
/* loaded from: classes4.dex */
public final class InputOutputUtils {
public static final InputOutputUtils INSTANCE = new InputOutputUtils();
private InputOutputUtils() {
}
public final String convertForSending(String stringToConvert) throws IOException {
Intrinsics.checkNotNullParameter(stringToConvert, "stringToConvert");
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(stringToConvert.length());
try {
GZIPOutputStream gZIPOutputStream = new GZIPOutputStream(byteArrayOutputStream);
try {
byte[] bytes = stringToConvert.getBytes(Charsets.UTF_8);
Intrinsics.checkNotNullExpressionValue(bytes, "this as java.lang.String).getBytes(charset)");
gZIPOutputStream.write(bytes);
gZIPOutputStream.close();
String encodeToString = Base64.encodeToString(byteArrayOutputStream.toByteArray(), 2);
Intrinsics.checkNotNullExpressionValue(encodeToString, "encodeToString(compressed, Base64.NO_WRAP)");
CloseableKt.closeFinally(gZIPOutputStream, null);
CloseableKt.closeFinally(byteArrayOutputStream, null);
return encodeToString;
} finally {
}
} finally {
}
}
}

View File

@@ -0,0 +1,28 @@
package com.vungle.ads.internal.util;
import java.util.Map;
import kotlin.collections.MapsKt__MapsKt;
import kotlin.jvm.internal.Intrinsics;
import kotlinx.serialization.json.JsonElement;
import kotlinx.serialization.json.JsonElementKt;
import kotlinx.serialization.json.JsonObject;
/* loaded from: classes4.dex */
public final class JsonUtil {
public static final JsonUtil INSTANCE = new JsonUtil();
private JsonUtil() {
}
public final String getContentStringValue(JsonObject json, String key) {
Object value;
Intrinsics.checkNotNullParameter(json, "json");
Intrinsics.checkNotNullParameter(key, "key");
try {
value = MapsKt__MapsKt.getValue((Map) json, key);
return JsonElementKt.getJsonPrimitive((JsonElement) value).getContent();
} catch (Exception unused) {
return null;
}
}
}

View File

@@ -0,0 +1,127 @@
package com.vungle.ads.internal.util;
import android.util.Log;
import java.util.regex.Pattern;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.Regex;
/* loaded from: classes4.dex */
public final class Logger {
public static final Companion Companion = new Companion(null);
private static boolean enabled;
public static final int d(String str, String str2) {
return Companion.d(str, str2);
}
public static final int e(String str, String str2) {
return Companion.e(str, str2);
}
public static final int e(String str, String str2, Throwable th) {
return Companion.e(str, str2, th);
}
public static final int i(String str, String str2) {
return Companion.i(str, str2);
}
public static final int i(String str, String str2, Throwable th) {
return Companion.i(str, str2, th);
}
public static final int w(String str, String str2) {
return Companion.w(str, str2);
}
public static final int w(String str, String str2, Throwable th) {
return Companion.w(str, str2, th);
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
public final void enable(boolean z) {
Logger.enabled = z;
}
public final int d(String tag, String message) {
Intrinsics.checkNotNullParameter(tag, "tag");
Intrinsics.checkNotNullParameter(message, "message");
if (Logger.enabled) {
return Log.d(tag, eraseSensitiveData(message));
}
return -1;
}
public final int e(String tag, String message) {
Intrinsics.checkNotNullParameter(tag, "tag");
Intrinsics.checkNotNullParameter(message, "message");
if (Logger.enabled) {
return Log.e(tag, eraseSensitiveData(message));
}
return -1;
}
public final int e(String tag, String message, Throwable throwable) {
Intrinsics.checkNotNullParameter(tag, "tag");
Intrinsics.checkNotNullParameter(message, "message");
Intrinsics.checkNotNullParameter(throwable, "throwable");
if (!Logger.enabled) {
return -1;
}
return Log.e(tag, eraseSensitiveData(message) + "; error: " + throwable.getLocalizedMessage());
}
public final int w(String tag, String message) {
Intrinsics.checkNotNullParameter(tag, "tag");
Intrinsics.checkNotNullParameter(message, "message");
if (Logger.enabled) {
return Log.w(tag, eraseSensitiveData(message));
}
return -1;
}
public final int w(String tag, String message, Throwable throwable) {
Intrinsics.checkNotNullParameter(tag, "tag");
Intrinsics.checkNotNullParameter(message, "message");
Intrinsics.checkNotNullParameter(throwable, "throwable");
if (!Logger.enabled) {
return -1;
}
return Log.w(tag, eraseSensitiveData(message) + "; error: " + throwable.getLocalizedMessage());
}
public final int i(String tag, String message) {
Intrinsics.checkNotNullParameter(tag, "tag");
Intrinsics.checkNotNullParameter(message, "message");
if (Logger.enabled) {
return Log.i(tag, eraseSensitiveData(message));
}
return -1;
}
public final int i(String tag, String message, Throwable throwable) {
Intrinsics.checkNotNullParameter(tag, "tag");
Intrinsics.checkNotNullParameter(message, "message");
Intrinsics.checkNotNullParameter(throwable, "throwable");
if (!Logger.enabled) {
return -1;
}
return Log.i(tag, eraseSensitiveData(message) + "; error: " + throwable.getLocalizedMessage());
}
public final String eraseSensitiveData(String str) {
Intrinsics.checkNotNullParameter(str, "<this>");
Pattern compile = Pattern.compile("[\\d]{1,3}\\.[\\d]{1,3}\\.[\\d]{1,3}\\.[\\d]{1,3}");
Intrinsics.checkNotNullExpressionValue(compile, "compile(\"[\\\\d]{1,3}\\\\.[\\…[\\\\d]{1,3}\\\\.[\\\\d]{1,3}\")");
return new Regex(compile).replace(str, "xxx.xxx.xxx.xxx");
}
}
}

View File

@@ -0,0 +1,126 @@
package com.vungle.ads.internal.util;
import android.content.Context;
import android.os.StatFs;
import java.io.File;
import java.util.List;
import kotlin.collections.CollectionsKt__CollectionsKt;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes4.dex */
public final class PathProvider {
private static final String CLEVER_CACHE_FOLDER = "clever_cache";
public static final Companion Companion = new Companion(null);
private static final String DOWNLOADS_FOLDER = "downloads";
private static final String JS_FOLDER = "js";
private static final long UNKNOWN_SIZE = -1;
private static final String VUNGLE_FOLDER = "vungle_cache";
private final File cleverCacheDir;
private final Context context;
private final File downloadsDir;
private final File jsDir;
private final File vungleDir;
public final Context getContext() {
return this.context;
}
public PathProvider(Context context) {
List<File> listOf;
Intrinsics.checkNotNullParameter(context, "context");
this.context = context;
File file = new File(context.getNoBackupFilesDir(), VUNGLE_FOLDER);
this.vungleDir = file;
File file2 = new File(file, DOWNLOADS_FOLDER);
this.downloadsDir = file2;
File file3 = new File(file, JS_FOLDER);
this.jsDir = file3;
File file4 = new File(file, CLEVER_CACHE_FOLDER);
this.cleverCacheDir = file4;
listOf = CollectionsKt__CollectionsKt.listOf((Object[]) new File[]{file, file2, file3, file4});
for (File file5 : listOf) {
if (!file5.exists()) {
file5.mkdirs();
}
}
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
}
public final File getVungleDir() {
if (!this.vungleDir.exists()) {
this.vungleDir.mkdirs();
}
return this.vungleDir;
}
public final File getCleverCacheDir() {
if (!this.cleverCacheDir.exists()) {
this.cleverCacheDir.mkdirs();
}
return this.cleverCacheDir;
}
public final File getJsDir() {
if (!this.jsDir.exists()) {
this.jsDir.mkdirs();
}
return this.jsDir;
}
public final File getDownloadDir() {
if (!this.downloadsDir.exists()) {
this.downloadsDir.mkdirs();
}
return this.downloadsDir;
}
public final File getJsAssetDir(String jsVersion) {
Intrinsics.checkNotNullParameter(jsVersion, "jsVersion");
File file = new File(getJsDir(), jsVersion);
if (!file.exists()) {
file.mkdirs();
}
return file;
}
public final File getDownloadsDirForAd(String str) {
if (str == null || str.length() == 0) {
return null;
}
File file = new File(getDownloadDir().getPath() + File.separator + str);
if (!file.exists()) {
file.mkdirs();
}
return file;
}
public final File getSharedPrefsDir() {
File noBackupFilesDir = this.context.getNoBackupFilesDir();
Intrinsics.checkNotNullExpressionValue(noBackupFilesDir, "{\n context.noBackupFilesDir\n }");
return noBackupFilesDir;
}
public final File getUnclosedAdFile(String name) {
Intrinsics.checkNotNullParameter(name, "name");
return new File(getSharedPrefsDir(), name);
}
public final long getAvailableBytes(String path) {
Intrinsics.checkNotNullParameter(path, "path");
try {
return new StatFs(path).getAvailableBytes();
} catch (IllegalArgumentException e) {
Logger.Companion.w("PathProvider", "Failed to get available bytes " + e.getMessage());
return -1L;
}
}
}

View File

@@ -0,0 +1,31 @@
package com.vungle.ads.internal.util;
/* loaded from: classes4.dex */
public final class RangeUtil {
public static final RangeUtil INSTANCE = new RangeUtil();
public final boolean isInRange(float f, float f2, float f3) {
return f2 <= f && f <= f3;
}
public final boolean isInRange(int i, int i2, int i3) {
return i2 <= i && i <= i3;
}
private RangeUtil() {
}
public static /* synthetic */ boolean isInRange$default(RangeUtil rangeUtil, int i, int i2, int i3, int i4, Object obj) {
if ((i4 & 4) != 0) {
i3 = Integer.MAX_VALUE;
}
return rangeUtil.isInRange(i, i2, i3);
}
public static /* synthetic */ boolean isInRange$default(RangeUtil rangeUtil, float f, float f2, float f3, int i, Object obj) {
if ((i & 4) != 0) {
f3 = Float.MAX_VALUE;
}
return rangeUtil.isInRange(f, f2, f3);
}
}

View File

@@ -0,0 +1,63 @@
package com.vungle.ads.internal.util;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import com.vungle.ads.internal.ui.VungleWebClient;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes4.dex */
public final class RingerModeReceiver extends BroadcastReceiver {
private VungleWebClient webClient;
public final VungleWebClient getWebClient() {
return this.webClient;
}
public final void setWebClient(VungleWebClient vungleWebClient) {
this.webClient = vungleWebClient;
}
@Override // android.content.BroadcastReceiver
public void onReceive(Context context, Intent intent) {
String action;
VungleWebClient vungleWebClient;
if (intent != null) {
try {
action = intent.getAction();
} catch (Exception e) {
String localizedMessage = e.getLocalizedMessage();
if (localizedMessage != null) {
Logger.Companion.e("RingerModeReceiver", localizedMessage);
return;
}
return;
}
} else {
action = null;
}
if (Intrinsics.areEqual(action, "android.media.RINGER_MODE_CHANGED")) {
int intExtra = intent.getIntExtra("android.media.EXTRA_RINGER_MODE", -1);
Logger.Companion.d("RingerModeReceiver", "receive ringermode: " + intExtra);
if (intExtra == 0) {
VungleWebClient vungleWebClient2 = this.webClient;
if (vungleWebClient2 != null) {
vungleWebClient2.notifySilentModeChange(true);
return;
}
return;
}
if (intExtra != 1) {
if (intExtra == 2 && (vungleWebClient = this.webClient) != null) {
vungleWebClient.notifySilentModeChange(false);
return;
}
return;
}
VungleWebClient vungleWebClient3 = this.webClient;
if (vungleWebClient3 != null) {
vungleWebClient3.notifySilentModeChange(true);
}
}
}
}

View File

@@ -0,0 +1,30 @@
package com.vungle.ads.internal.util;
import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;
import java.io.ObjectStreamClass;
import java.util.List;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes4.dex */
public final class SafeObjectInputStream extends ObjectInputStream {
private final List<Class<?>> allowed;
/* JADX WARN: Multi-variable type inference failed */
public SafeObjectInputStream(InputStream inputStream, List<? extends Class<?>> list) {
super(inputStream);
this.allowed = list;
}
@Override // java.io.ObjectInputStream
public Class<?> resolveClass(ObjectStreamClass desc) throws ClassNotFoundException, IOException {
Intrinsics.checkNotNullParameter(desc, "desc");
Class<?> c = super.resolveClass(desc);
if (this.allowed == null || Number.class.isAssignableFrom(c) || Intrinsics.areEqual(String.class, c) || Intrinsics.areEqual(Boolean.class, c) || c.isArray() || this.allowed.contains(c)) {
Intrinsics.checkNotNullExpressionValue(c, "c");
return c;
}
throw new IOException("Deserialization is not allowed for " + desc.getName());
}
}

View File

@@ -0,0 +1,195 @@
package com.vungle.ads.internal.util;
import android.os.CountDownTimer;
import androidx.annotation.VisibleForTesting;
import kotlin.Unit;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes4.dex */
public final class SuspendableTimer {
private final double durationSecs;
private boolean isCanceled;
private boolean isPaused;
private double nextDurationSecs;
private final Function0 onFinish;
private final Function0 onTick;
private final boolean repeats;
private long startTimeMillis;
private CountDownTimer timer;
private final long getDurationMillis() {
return (long) (this.durationSecs * 1000);
}
@VisibleForTesting
public static /* synthetic */ void getElapsedMillis$vungle_ads_release$annotations() {
}
private final long getNextDurationMillis() {
return (long) (this.nextDurationSecs * 1000);
}
@VisibleForTesting
public static /* synthetic */ void getNextDurationSecs$vungle_ads_release$annotations() {
}
@VisibleForTesting
public static /* synthetic */ void getStartTimeMillis$vungle_ads_release$annotations() {
}
@VisibleForTesting
public static /* synthetic */ void getTimer$vungle_ads_release$annotations() {
}
public final double getNextDurationSecs$vungle_ads_release() {
return this.nextDurationSecs;
}
public final long getStartTimeMillis$vungle_ads_release() {
return this.startTimeMillis;
}
public final CountDownTimer getTimer$vungle_ads_release() {
return this.timer;
}
public final void setNextDurationSecs$vungle_ads_release(double d) {
this.nextDurationSecs = d;
}
public final void setStartTimeMillis$vungle_ads_release(long j) {
this.startTimeMillis = j;
}
public final void setTimer$vungle_ads_release(CountDownTimer countDownTimer) {
this.timer = countDownTimer;
}
public SuspendableTimer(double d, boolean z, Function0 onTick, Function0 onFinish) {
Intrinsics.checkNotNullParameter(onTick, "onTick");
Intrinsics.checkNotNullParameter(onFinish, "onFinish");
this.durationSecs = d;
this.repeats = z;
this.onTick = onTick;
this.onFinish = onFinish;
this.nextDurationSecs = d;
}
public /* synthetic */ SuspendableTimer(double d, boolean z, Function0 function0, Function0 function02, int i, DefaultConstructorMarker defaultConstructorMarker) {
this(d, z, (i & 4) != 0 ? new Function0() { // from class: com.vungle.ads.internal.util.SuspendableTimer.1
/* renamed from: invoke, reason: collision with other method in class */
public final void m3992invoke() {
}
@Override // kotlin.jvm.functions.Function0
public /* bridge */ /* synthetic */ Object invoke() {
m3992invoke();
return Unit.INSTANCE;
}
} : function0, function02);
}
public final long getElapsedMillis$vungle_ads_release() {
long currentTimeMillis;
long j;
if (this.isPaused) {
currentTimeMillis = getDurationMillis();
j = getNextDurationMillis();
} else {
currentTimeMillis = System.currentTimeMillis();
j = this.startTimeMillis;
}
return currentTimeMillis - j;
}
private final double getElapsedSecs() {
return getElapsedMillis$vungle_ads_release() / 1000;
}
public final void start() {
this.startTimeMillis = System.currentTimeMillis();
CountDownTimer createCountdown = createCountdown(getNextDurationMillis());
this.timer = createCountdown;
if (createCountdown != null) {
createCountdown.start();
}
}
public final void reset() {
cancel();
start();
}
public final void pause() {
if (this.timer == null) {
return;
}
this.nextDurationSecs -= getElapsedSecs();
this.isPaused = true;
CountDownTimer countDownTimer = this.timer;
if (countDownTimer != null) {
countDownTimer.cancel();
}
this.timer = null;
}
public final void resume() {
if (this.isPaused) {
this.isPaused = false;
start();
}
}
public final void cancel() {
this.isPaused = false;
this.isCanceled = true;
CountDownTimer countDownTimer = this.timer;
if (countDownTimer != null) {
countDownTimer.cancel();
}
this.timer = null;
}
private final CountDownTimer createCountdown(final long j) {
return new CountDownTimer(j, this) { // from class: com.vungle.ads.internal.util.SuspendableTimer$createCountdown$1
final /* synthetic */ SuspendableTimer this$0;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
{
super(j, j);
this.this$0 = this;
}
@Override // android.os.CountDownTimer
public void onTick(long j2) {
Function0 function0;
function0 = this.this$0.onTick;
function0.invoke();
}
@Override // android.os.CountDownTimer
public void onFinish() {
Function0 function0;
boolean z;
boolean z2;
double d;
SuspendableTimer suspendableTimer = this.this$0;
function0 = suspendableTimer.onFinish;
function0.invoke();
z = suspendableTimer.repeats;
if (z) {
z2 = suspendableTimer.isCanceled;
if (!z2) {
d = suspendableTimer.durationSecs;
suspendableTimer.setNextDurationSecs$vungle_ads_release(d);
suspendableTimer.start();
return;
}
}
suspendableTimer.cancel();
}
};
}
}

View File

@@ -0,0 +1,51 @@
package com.vungle.ads.internal.util;
import android.os.Handler;
import android.os.Looper;
import androidx.annotation.VisibleForTesting;
import java.util.concurrent.Executor;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes4.dex */
public final class ThreadUtil {
public static final ThreadUtil INSTANCE = new ThreadUtil();
private static final Handler UI_HANDLER = new Handler(Looper.getMainLooper());
private static Executor uiExecutor;
@VisibleForTesting
public static /* synthetic */ void getUiExecutor$vungle_ads_release$annotations() {
}
public final Executor getUiExecutor$vungle_ads_release() {
return uiExecutor;
}
public final void setUiExecutor$vungle_ads_release(Executor executor) {
uiExecutor = executor;
}
private ThreadUtil() {
}
public final boolean isMainThread() {
Looper mainLooper = Looper.getMainLooper();
if (mainLooper == null) {
return false;
}
return mainLooper.isCurrentThread();
}
public final void runOnUiThread(Runnable runnable) {
Intrinsics.checkNotNullParameter(runnable, "runnable");
if (isMainThread()) {
runnable.run();
return;
}
Executor executor = uiExecutor;
if (executor == null) {
UI_HANDLER.post(runnable);
} else if (executor != null) {
executor.execute(runnable);
}
}
}

View File

@@ -0,0 +1,170 @@
package com.vungle.ads.internal.util;
import androidx.annotation.VisibleForTesting;
import com.vungle.ads.internal.util.Logger;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.StringsKt__StringsJVMKt;
/* loaded from: classes4.dex */
public final class UnzipUtility {
private static final int BUFFER_SIZE = 4096;
public static final UnzipUtility INSTANCE = new UnzipUtility();
private static final String TAG = UnzipUtility.class.getCanonicalName();
public interface Filter {
boolean matches(String str);
}
public final List<File> unzip(String str, String destDirectory) throws IOException {
Intrinsics.checkNotNullParameter(destDirectory, "destDirectory");
return unzip$default(this, str, destDirectory, null, 4, null);
}
private UnzipUtility() {
}
public static /* synthetic */ List unzip$default(UnzipUtility unzipUtility, String str, String str2, Filter filter, int i, Object obj) throws IOException {
if ((i & 4) != 0) {
filter = null;
}
return unzipUtility.unzip(str, str2, filter);
}
public final List<File> unzip(String str, String destDirectory, Filter filter) throws IOException {
Intrinsics.checkNotNullParameter(destDirectory, "destDirectory");
if (str == null || str.length() == 0) {
throw new IOException("Path is empty");
}
File file = new File(str);
if (!file.exists()) {
throw new IOException("File does not exist");
}
File file2 = new File(destDirectory);
if (!file2.exists()) {
file2.mkdirs();
}
ArrayList arrayList = new ArrayList();
ZipFile zipFile = null;
try {
ZipFile zipFile2 = new ZipFile(file);
try {
Enumeration<? extends ZipEntry> entries = zipFile2.entries();
while (entries.hasMoreElements()) {
ZipEntry nextElement = entries.nextElement();
String str2 = destDirectory + File.separator + nextElement.getName();
if (filter != null && !filter.matches(str2)) {
}
validateFilename(str2, destDirectory);
if (nextElement.isDirectory()) {
File file3 = new File(str2);
if (!file3.exists()) {
file3.mkdirs();
}
} else {
InputStream inputStream = zipFile2.getInputStream(nextElement);
Intrinsics.checkNotNullExpressionValue(inputStream, "zipFile.getInputStream(entry)");
extractFile(inputStream, str2);
arrayList.add(new File(str2));
}
}
try {
zipFile2.close();
} catch (IOException unused) {
}
return arrayList;
} catch (Throwable th) {
th = th;
zipFile = zipFile2;
if (zipFile != null) {
try {
zipFile.close();
} catch (IOException unused2) {
}
}
throw th;
}
} catch (Throwable th2) {
th = th2;
}
}
@VisibleForTesting
public final void extractFile(InputStream zipIn, String str) throws IOException {
FileOutputStream fileOutputStream;
Throwable th;
BufferedOutputStream bufferedOutputStream;
Intrinsics.checkNotNullParameter(zipIn, "zipIn");
File file = new File(str);
FileUtility.delete(file);
File parentFile = file.getParentFile();
if (parentFile != null && !parentFile.exists()) {
parentFile.mkdirs();
}
try {
fileOutputStream = new FileOutputStream(str);
try {
bufferedOutputStream = new BufferedOutputStream(fileOutputStream);
} catch (Throwable th2) {
th = th2;
bufferedOutputStream = null;
}
try {
byte[] bArr = new byte[4096];
while (true) {
int read = zipIn.read(bArr);
if (read != -1) {
bufferedOutputStream.write(bArr, 0, read);
} else {
FileUtility fileUtility = FileUtility.INSTANCE;
fileUtility.closeQuietly(zipIn);
fileUtility.closeQuietly(bufferedOutputStream);
fileUtility.closeQuietly(fileOutputStream);
return;
}
}
} catch (Throwable th3) {
th = th3;
FileUtility fileUtility2 = FileUtility.INSTANCE;
fileUtility2.closeQuietly(zipIn);
fileUtility2.closeQuietly(bufferedOutputStream);
fileUtility2.closeQuietly(fileOutputStream);
throw th;
}
} catch (Throwable th4) {
fileOutputStream = null;
th = th4;
bufferedOutputStream = null;
}
}
private final String validateFilename(String str, String str2) throws IOException {
String canonicalPath = new File(str).getCanonicalPath();
String canonicalID = new File(str2).getCanonicalPath();
Intrinsics.checkNotNullExpressionValue(canonicalPath, "canonicalPath");
Intrinsics.checkNotNullExpressionValue(canonicalID, "canonicalID");
if (StringsKt__StringsJVMKt.startsWith$default(canonicalPath, canonicalID, false, 2, null)) {
return canonicalPath;
}
Logger.Companion companion = Logger.Companion;
String TAG2 = TAG;
Intrinsics.checkNotNullExpressionValue(TAG2, "TAG");
companion.e(TAG2, "File is outside extraction target directory.");
throw new ZipSecurityException("File is outside extraction target directory.");
}
public static final class ZipSecurityException extends IOException {
public ZipSecurityException(String str) {
super(str);
}
}
}

View File

@@ -0,0 +1,46 @@
package com.vungle.ads.internal.util;
import android.content.Context;
import android.content.res.Resources;
import android.util.DisplayMetrics;
import android.webkit.WebView;
import kotlin.Pair;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes4.dex */
public final class ViewUtility {
public static final ViewUtility INSTANCE = new ViewUtility();
private ViewUtility() {
}
public final int dpToPixels(Context context, int i) {
Intrinsics.checkNotNullParameter(context, "context");
return (int) ((i * context.getResources().getDisplayMetrics().density) + 0.5f);
}
public final WebView getWebView(Context context) throws InstantiationException {
Intrinsics.checkNotNullParameter(context, "context");
try {
return new WebView(context);
} catch (Resources.NotFoundException e) {
throw new InstantiationException("Cannot instantiate WebView due to Resources.NotFoundException: " + e + ".message");
} catch (Exception e2) {
throw new InstantiationException(e2.getMessage());
}
}
public final Pair getDeviceWidthAndHeightWithOrientation(Context context, int i) {
Intrinsics.checkNotNullParameter(context, "context");
Resources resources = context.getApplicationContext().getResources();
DisplayMetrics displayMetrics = resources.getDisplayMetrics();
int i2 = resources.getConfiguration().orientation;
if (i == 0) {
i = i2;
}
if (i == i2) {
return new Pair(Integer.valueOf(Math.round(displayMetrics.widthPixels / displayMetrics.density)), Integer.valueOf(Math.round(displayMetrics.heightPixels / displayMetrics.density)));
}
return new Pair(Integer.valueOf(Math.round(displayMetrics.heightPixels / displayMetrics.density)), Integer.valueOf(Math.round(displayMetrics.widthPixels / displayMetrics.density)));
}
}