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,13 @@
package com.unity3d.services.ads.token;
import com.unity3d.services.ads.gmascar.managers.IBiddingManager;
import com.unity3d.services.core.configuration.Configuration;
/* loaded from: classes4.dex */
public interface AsyncTokenStorage {
void getToken(IBiddingManager iBiddingManager);
void onTokenAvailable();
void setConfiguration(Configuration configuration);
}

View File

@@ -0,0 +1,6 @@
package com.unity3d.services.ads.token;
/* loaded from: classes4.dex */
public interface INativeTokenGenerator {
void generateToken(INativeTokenGeneratorListener iNativeTokenGeneratorListener);
}

View File

@@ -0,0 +1,6 @@
package com.unity3d.services.ads.token;
/* loaded from: classes4.dex */
public interface INativeTokenGeneratorListener {
void onReady(String str);
}

View File

@@ -0,0 +1,241 @@
package com.unity3d.services.ads.token;
import android.os.Handler;
import com.unity3d.services.ads.gmascar.GMA;
import com.unity3d.services.ads.gmascar.managers.IBiddingManager;
import com.unity3d.services.ads.gmascar.utils.ScarConstants;
import com.unity3d.services.core.configuration.Configuration;
import com.unity3d.services.core.configuration.ConfigurationReader;
import com.unity3d.services.core.configuration.PrivacyConfigStorage;
import com.unity3d.services.core.device.TokenType;
import com.unity3d.services.core.device.reader.GameSessionIdReader;
import com.unity3d.services.core.device.reader.builder.DeviceInfoReaderBuilderWithExtras;
import com.unity3d.services.core.log.DeviceLog;
import com.unity3d.services.core.properties.InitializationStatusReader;
import com.unity3d.services.core.properties.SdkProperties;
import com.unity3d.services.core.request.metrics.SDKMetricsSender;
import com.unity3d.services.core.request.metrics.TSIMetric;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/* loaded from: classes4.dex */
public class InMemoryAsyncTokenStorage implements AsyncTokenStorage {
private DeviceInfoReaderBuilderWithExtras _deviceInfoReaderBuilderWithExtras;
private final Handler _handler;
private INativeTokenGenerator _nativeTokenGenerator;
private final SDKMetricsSender _sdkMetrics;
private TokenStorage _tokenStorage;
private final List<TokenListenerState> _tokenListeners = new LinkedList();
private boolean _tokenAvailable = false;
private boolean _configurationWasSet = false;
private Configuration _configuration = new Configuration();
private final InitializationStatusReader _initStatusReader = new InitializationStatusReader();
private boolean isValidConfig(Configuration configuration) {
return configuration != null;
}
public class TokenListenerState {
public IBiddingManager biddingManager;
public boolean invoked;
public Runnable runnable;
public TokenType tokenType;
public TokenListenerState() {
}
}
public InMemoryAsyncTokenStorage(INativeTokenGenerator iNativeTokenGenerator, Handler handler, SDKMetricsSender sDKMetricsSender, TokenStorage tokenStorage) {
this._handler = handler;
this._nativeTokenGenerator = iNativeTokenGenerator;
this._sdkMetrics = sDKMetricsSender;
this._tokenStorage = tokenStorage;
}
@Override // com.unity3d.services.ads.token.AsyncTokenStorage
public synchronized void setConfiguration(Configuration configuration) {
try {
this._configuration = configuration;
boolean isValidConfig = isValidConfig(configuration);
this._configurationWasSet = isValidConfig;
if (isValidConfig) {
if (this._nativeTokenGenerator == null) {
this._deviceInfoReaderBuilderWithExtras = new DeviceInfoReaderBuilderWithExtras(new ConfigurationReader(), PrivacyConfigStorage.getInstance(), GameSessionIdReader.getInstance());
ExecutorService newSingleThreadExecutor = Executors.newSingleThreadExecutor();
this._nativeTokenGenerator = new NativeTokenGenerator(newSingleThreadExecutor, this._deviceInfoReaderBuilderWithExtras);
if (configuration.getExperiments().shouldNativeTokenAwaitPrivacy()) {
this._nativeTokenGenerator = new NativeTokenGeneratorWithPrivacyAwait(newSingleThreadExecutor, this._nativeTokenGenerator, configuration.getPrivacyRequestWaitTimeout());
}
}
Iterator it = new ArrayList(this._tokenListeners).iterator();
while (it.hasNext()) {
handleTokenInvocation((TokenListenerState) it.next());
}
}
} catch (Throwable th) {
throw th;
}
}
@Override // com.unity3d.services.ads.token.AsyncTokenStorage
public synchronized void onTokenAvailable() {
this._tokenAvailable = true;
if (this._configurationWasSet) {
notifyListenersTokenReady();
}
}
@Override // com.unity3d.services.ads.token.AsyncTokenStorage
public synchronized void getToken(IBiddingManager iBiddingManager) {
if (SdkProperties.getCurrentInitializationState() == SdkProperties.InitializationState.INITIALIZED_FAILED) {
iBiddingManager.onUnityAdsTokenReady(null);
sendTokenMetrics(null, TokenType.TOKEN_REMOTE);
} else if (SdkProperties.getCurrentInitializationState() == SdkProperties.InitializationState.NOT_INITIALIZED) {
iBiddingManager.onUnityAdsTokenReady(null);
sendTokenMetrics(null, TokenType.TOKEN_REMOTE);
} else {
TokenListenerState addTimeoutHandler = addTimeoutHandler(iBiddingManager);
if (this._configurationWasSet) {
handleTokenInvocation(addTimeoutHandler);
}
}
}
private synchronized TokenListenerState addTimeoutHandler(IBiddingManager iBiddingManager) {
final TokenListenerState tokenListenerState;
tokenListenerState = new TokenListenerState();
tokenListenerState.biddingManager = iBiddingManager;
tokenListenerState.tokenType = TokenType.TOKEN_REMOTE;
tokenListenerState.runnable = new Runnable() { // from class: com.unity3d.services.ads.token.InMemoryAsyncTokenStorage.1
@Override // java.lang.Runnable
public void run() {
InMemoryAsyncTokenStorage.this.notifyTokenReady(tokenListenerState, null);
}
};
this._tokenListeners.add(tokenListenerState);
this._handler.postDelayed(tokenListenerState.runnable, this._configuration.getTokenTimeout());
return tokenListenerState;
}
private synchronized void notifyListenersTokenReady() {
String token;
while (!this._tokenListeners.isEmpty() && (token = this._tokenStorage.getToken()) != null) {
notifyTokenReady(this._tokenListeners.get(0), token);
}
}
private void handleTokenInvocation(final TokenListenerState tokenListenerState) {
if (tokenListenerState.invoked) {
return;
}
tokenListenerState.invoked = true;
if (!this._tokenAvailable) {
tokenListenerState.tokenType = TokenType.TOKEN_NATIVE;
if (GMA.getInstance().hasSCARBiddingSupport() && this._deviceInfoReaderBuilderWithExtras != null) {
HashMap hashMap = new HashMap();
hashMap.put(ScarConstants.TOKEN_ID_KEY, tokenListenerState.biddingManager.getTokenIdentifier());
this._deviceInfoReaderBuilderWithExtras.setExtras(hashMap);
}
this._nativeTokenGenerator.generateToken(new INativeTokenGeneratorListener() { // from class: com.unity3d.services.ads.token.InMemoryAsyncTokenStorage.2
@Override // com.unity3d.services.ads.token.INativeTokenGeneratorListener
public void onReady(final String str) {
InMemoryAsyncTokenStorage.this._handler.post(new Runnable() { // from class: com.unity3d.services.ads.token.InMemoryAsyncTokenStorage.2.1
@Override // java.lang.Runnable
public void run() {
AnonymousClass2 anonymousClass2 = AnonymousClass2.this;
InMemoryAsyncTokenStorage.this.notifyTokenReady(tokenListenerState, str);
}
});
}
});
return;
}
tokenListenerState.tokenType = TokenType.TOKEN_REMOTE;
String token = this._tokenStorage.getToken();
if (token == null || token.isEmpty()) {
return;
}
notifyTokenReady(tokenListenerState, token);
}
/* JADX INFO: Access modifiers changed from: private */
public synchronized void notifyTokenReady(TokenListenerState tokenListenerState, String str) {
try {
if (this._tokenListeners.remove(tokenListenerState)) {
tokenListenerState.biddingManager.onUnityAdsTokenReady(tokenListenerState.tokenType == TokenType.TOKEN_REMOTE ? tokenListenerState.biddingManager.getFormattedToken(str) : str);
try {
this._handler.removeCallbacks(tokenListenerState.runnable);
} catch (Exception e) {
DeviceLog.exception("Failed to remove callback from a handler", e);
}
}
sendTokenMetrics(str, tokenListenerState.tokenType);
} catch (Throwable th) {
throw th;
}
}
/* renamed from: com.unity3d.services.ads.token.InMemoryAsyncTokenStorage$3, reason: invalid class name */
public static /* synthetic */ class AnonymousClass3 {
static final /* synthetic */ int[] $SwitchMap$com$unity3d$services$core$device$TokenType;
static {
int[] iArr = new int[TokenType.values().length];
$SwitchMap$com$unity3d$services$core$device$TokenType = iArr;
try {
iArr[TokenType.TOKEN_NATIVE.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
$SwitchMap$com$unity3d$services$core$device$TokenType[TokenType.TOKEN_REMOTE.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
}
}
private void sendTokenMetrics(String str, TokenType tokenType) {
int i = AnonymousClass3.$SwitchMap$com$unity3d$services$core$device$TokenType[tokenType.ordinal()];
if (i == 1) {
sendNativeTokenMetrics(str);
} else if (i == 2) {
sendRemoteTokenMetrics(str);
} else {
DeviceLog.error("Unknown token type passed to sendTokenMetrics");
}
}
private void sendNativeTokenMetrics(String str) {
SDKMetricsSender sDKMetricsSender = this._sdkMetrics;
if (sDKMetricsSender == null) {
return;
}
if (str == null) {
sDKMetricsSender.sendMetric(TSIMetric.newNativeGeneratedTokenNull(getMetricTags()));
} else {
sDKMetricsSender.sendMetric(TSIMetric.newNativeGeneratedTokenAvailable(getMetricTags()));
}
}
private void sendRemoteTokenMetrics(String str) {
if (this._sdkMetrics == null) {
return;
}
if (str == null || str.isEmpty()) {
this._sdkMetrics.sendMetric(TSIMetric.newAsyncTokenNull(getMetricTags()));
} else {
this._sdkMetrics.sendMetric(TSIMetric.newAsyncTokenAvailable(getMetricTags()));
}
}
private Map<String, String> getMetricTags() {
HashMap hashMap = new HashMap();
hashMap.put("state", this._initStatusReader.getInitializationStateString(SdkProperties.getCurrentInitializationState()));
return hashMap;
}
}

View File

@@ -0,0 +1,150 @@
package com.unity3d.services.ads.token;
import com.unity3d.services.core.configuration.ConfigurationReader;
import com.unity3d.services.core.configuration.InitializeEventsMetricSender;
import com.unity3d.services.core.configuration.PrivacyConfigStorage;
import com.unity3d.services.core.device.reader.GameSessionIdReader;
import com.unity3d.services.core.device.reader.builder.DeviceInfoReaderBuilder;
import com.unity3d.services.core.di.IServiceComponent;
import com.unity3d.services.core.di.IServiceProvider;
import com.unity3d.services.core.webview.WebViewApp;
import com.unity3d.services.core.webview.WebViewEventCategory;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import kotlin.Lazy;
import kotlin.LazyKt__LazyJVMKt;
import kotlin.LazyThreadSafetyMode;
import kotlin.Unit;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.Reflection;
import kotlin.jvm.internal.SourceDebugExtension;
import kotlinx.coroutines.flow.MutableStateFlow;
import kotlinx.coroutines.flow.StateFlowKt;
import org.json.JSONArray;
import org.json.JSONException;
@SourceDebugExtension({"SMAP\nInMemoryTokenStorage.kt\nKotlin\n*S Kotlin\n*F\n+ 1 InMemoryTokenStorage.kt\ncom/unity3d/services/ads/token/InMemoryTokenStorage\n+ 2 IServiceComponent.kt\ncom/unity3d/services/core/di/IServiceComponentKt\n+ 3 StateFlow.kt\nkotlinx/coroutines/flow/StateFlowKt\n*L\n1#1,101:1\n29#2,5:102\n230#3,5:107\n214#3,5:112\n230#3,5:117\n*S KotlinDebug\n*F\n+ 1 InMemoryTokenStorage.kt\ncom/unity3d/services/ads/token/InMemoryTokenStorage\n*L\n27#1:102,5\n53#1:107,5\n67#1:112,5\n91#1:117,5\n*E\n"})
/* loaded from: classes4.dex */
public final class InMemoryTokenStorage implements TokenStorage, IServiceComponent {
private final Lazy asyncTokenStorage$delegate;
private final ConcurrentLinkedQueue<String> queue = new ConcurrentLinkedQueue<>();
private final MutableStateFlow accessCounter = StateFlowKt.MutableStateFlow(-1);
private final MutableStateFlow initToken = StateFlowKt.MutableStateFlow(null);
private final ExecutorService executorService = Executors.newSingleThreadExecutor();
public InMemoryTokenStorage() {
Lazy lazy;
final String str = "";
lazy = LazyKt__LazyJVMKt.lazy(LazyThreadSafetyMode.NONE, new Function0() { // from class: com.unity3d.services.ads.token.InMemoryTokenStorage$special$$inlined$inject$default$1
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
{
super(0);
}
/* JADX WARN: Type inference failed for: r0v3, types: [com.unity3d.services.ads.token.AsyncTokenStorage, java.lang.Object] */
@Override // kotlin.jvm.functions.Function0
public final AsyncTokenStorage invoke() {
IServiceComponent iServiceComponent = IServiceComponent.this;
return iServiceComponent.getServiceProvider().getRegistry().getService(str, Reflection.getOrCreateKotlinClass(AsyncTokenStorage.class));
}
});
this.asyncTokenStorage$delegate = lazy;
}
@Override // com.unity3d.services.core.di.IServiceComponent
public IServiceProvider getServiceProvider() {
return IServiceComponent.DefaultImpls.getServiceProvider(this);
}
private final AsyncTokenStorage getAsyncTokenStorage() {
return (AsyncTokenStorage) this.asyncTokenStorage$delegate.getValue();
}
@Override // com.unity3d.services.ads.token.TokenStorage
public void createTokens(JSONArray tokens) throws JSONException {
Intrinsics.checkNotNullParameter(tokens, "tokens");
deleteTokens();
appendTokens(tokens);
}
@Override // com.unity3d.services.ads.token.TokenStorage
public void appendTokens(JSONArray tokens) throws JSONException {
Intrinsics.checkNotNullParameter(tokens, "tokens");
this.accessCounter.compareAndSet(-1, 0);
int length = tokens.length();
for (int i = 0; i < length; i++) {
this.queue.add(tokens.getString(i));
}
if (length > 0) {
triggerTokenAvailable(false);
getAsyncTokenStorage().onTokenAvailable();
}
}
@Override // com.unity3d.services.ads.token.TokenStorage
public void deleteTokens() {
Object value;
this.queue.clear();
MutableStateFlow mutableStateFlow = this.accessCounter;
do {
value = mutableStateFlow.getValue();
((Number) value).intValue();
} while (!mutableStateFlow.compareAndSet(value, -1));
}
@Override // com.unity3d.services.ads.token.TokenStorage
public String getToken() {
Object value;
Number number;
if (((Number) this.accessCounter.getValue()).intValue() == -1) {
return (String) this.initToken.getValue();
}
if (this.queue.isEmpty()) {
WebViewApp.getCurrentApp().sendEvent(WebViewEventCategory.TOKEN, TokenEvent.QUEUE_EMPTY, new Object[0]);
return null;
}
MutableStateFlow mutableStateFlow = this.accessCounter;
do {
value = mutableStateFlow.getValue();
number = (Number) value;
} while (!mutableStateFlow.compareAndSet(value, Integer.valueOf(number.intValue() + 1)));
WebViewApp.getCurrentApp().sendEvent(WebViewEventCategory.TOKEN, TokenEvent.TOKEN_ACCESS, Integer.valueOf(number.intValue()));
return this.queue.poll();
}
@Override // com.unity3d.services.ads.token.TokenStorage
public Unit getNativeGeneratedToken() {
new NativeTokenGenerator(this.executorService, new DeviceInfoReaderBuilder(new ConfigurationReader(), PrivacyConfigStorage.getInstance(), GameSessionIdReader.getInstance()), null).generateToken(new INativeTokenGeneratorListener() { // from class: com.unity3d.services.ads.token.InMemoryTokenStorage$$ExternalSyntheticLambda0
@Override // com.unity3d.services.ads.token.INativeTokenGeneratorListener
public final void onReady(String str) {
InMemoryTokenStorage._get_nativeGeneratedToken_$lambda$2(str);
}
});
return Unit.INSTANCE;
}
/* JADX INFO: Access modifiers changed from: private */
public static final void _get_nativeGeneratedToken_$lambda$2(String str) {
WebViewApp.getCurrentApp().sendEvent(WebViewEventCategory.TOKEN, TokenEvent.TOKEN_NATIVE_DATA, str);
}
private final void triggerTokenAvailable(boolean z) {
InitializeEventsMetricSender.getInstance().sdkTokenDidBecomeAvailableWithConfig(z);
}
@Override // com.unity3d.services.ads.token.TokenStorage
public void setInitToken(String str) {
Object value;
if (str == null) {
return;
}
MutableStateFlow mutableStateFlow = this.initToken;
do {
value = mutableStateFlow.getValue();
} while (!mutableStateFlow.compareAndSet(value, str));
triggerTokenAvailable(true);
getAsyncTokenStorage().onTokenAvailable();
}
}

View File

@@ -0,0 +1,48 @@
package com.unity3d.services.ads.token;
import android.util.Base64;
import com.unity3d.services.core.device.reader.DeviceInfoReaderCompressor;
import com.unity3d.services.core.device.reader.builder.DeviceInfoReaderBuilder;
import com.unity3d.services.core.log.DeviceLog;
import java.util.concurrent.ExecutorService;
/* loaded from: classes4.dex */
public class NativeTokenGenerator implements INativeTokenGenerator {
private static final String DEFAULT_NATIVE_TOKEN_PREFIX = "1:";
private DeviceInfoReaderBuilder _deviceInfoReaderBuilder;
private ExecutorService _executorService;
private String _prependStr;
public NativeTokenGenerator(ExecutorService executorService, DeviceInfoReaderBuilder deviceInfoReaderBuilder) {
this(executorService, deviceInfoReaderBuilder, DEFAULT_NATIVE_TOKEN_PREFIX);
}
public NativeTokenGenerator(ExecutorService executorService, DeviceInfoReaderBuilder deviceInfoReaderBuilder, String str) {
this._executorService = executorService;
this._deviceInfoReaderBuilder = deviceInfoReaderBuilder;
this._prependStr = str;
}
@Override // com.unity3d.services.ads.token.INativeTokenGenerator
public void generateToken(final INativeTokenGeneratorListener iNativeTokenGeneratorListener) {
this._executorService.execute(new Runnable() { // from class: com.unity3d.services.ads.token.NativeTokenGenerator.1
@Override // java.lang.Runnable
public void run() {
try {
String encodeToString = Base64.encodeToString(new DeviceInfoReaderCompressor(NativeTokenGenerator.this._deviceInfoReaderBuilder.build()).getDeviceData(), 2);
if (NativeTokenGenerator.this._prependStr != null && !NativeTokenGenerator.this._prependStr.isEmpty()) {
StringBuilder sb = new StringBuilder(NativeTokenGenerator.this._prependStr.length() + encodeToString.length());
sb.append(NativeTokenGenerator.this._prependStr);
sb.append(encodeToString);
iNativeTokenGeneratorListener.onReady(sb.toString());
} else {
iNativeTokenGeneratorListener.onReady(encodeToString);
}
} catch (Exception e) {
DeviceLog.exception("Unity Ads failed to generate token.", e);
iNativeTokenGeneratorListener.onReady(null);
}
}
});
}
}

View File

@@ -0,0 +1,40 @@
package com.unity3d.services.ads.token;
import android.os.ConditionVariable;
import com.unity3d.services.core.configuration.PrivacyConfig;
import com.unity3d.services.core.configuration.PrivacyConfigStorage;
import com.unity3d.services.core.misc.IObserver;
import java.util.concurrent.ExecutorService;
/* loaded from: classes4.dex */
public class NativeTokenGeneratorWithPrivacyAwait implements INativeTokenGenerator {
private final ExecutorService _executorService;
private final INativeTokenGenerator _nativeTokenGenerator;
private final ConditionVariable _privacyAwait = new ConditionVariable();
private final int _privacyAwaitTimeout;
public NativeTokenGeneratorWithPrivacyAwait(ExecutorService executorService, INativeTokenGenerator iNativeTokenGenerator, int i) {
this._executorService = executorService;
this._nativeTokenGenerator = iNativeTokenGenerator;
this._privacyAwaitTimeout = i;
}
@Override // com.unity3d.services.ads.token.INativeTokenGenerator
public void generateToken(final INativeTokenGeneratorListener iNativeTokenGeneratorListener) {
final IObserver<PrivacyConfig> iObserver = new IObserver<PrivacyConfig>() { // from class: com.unity3d.services.ads.token.NativeTokenGeneratorWithPrivacyAwait.1
@Override // com.unity3d.services.core.misc.IObserver
public void updated(PrivacyConfig privacyConfig) {
NativeTokenGeneratorWithPrivacyAwait.this._privacyAwait.open();
}
};
PrivacyConfigStorage.getInstance().registerObserver(iObserver);
this._executorService.execute(new Runnable() { // from class: com.unity3d.services.ads.token.NativeTokenGeneratorWithPrivacyAwait.2
@Override // java.lang.Runnable
public void run() {
NativeTokenGeneratorWithPrivacyAwait.this._privacyAwait.block(NativeTokenGeneratorWithPrivacyAwait.this._privacyAwaitTimeout);
PrivacyConfigStorage.getInstance().unregisterObserver(iObserver);
NativeTokenGeneratorWithPrivacyAwait.this._nativeTokenGenerator.generateToken(iNativeTokenGeneratorListener);
}
});
}
}

View File

@@ -0,0 +1,6 @@
package com.unity3d.services.ads.token;
/* loaded from: classes4.dex */
public enum TokenError {
JSON_EXCEPTION
}

View File

@@ -0,0 +1,8 @@
package com.unity3d.services.ads.token;
/* loaded from: classes4.dex */
public enum TokenEvent {
TOKEN_ACCESS,
QUEUE_EMPTY,
TOKEN_NATIVE_DATA
}

View File

@@ -0,0 +1,20 @@
package com.unity3d.services.ads.token;
import kotlin.Unit;
import org.json.JSONArray;
import org.json.JSONException;
/* loaded from: classes4.dex */
public interface TokenStorage {
void appendTokens(JSONArray jSONArray) throws JSONException;
void createTokens(JSONArray jSONArray) throws JSONException;
void deleteTokens();
Unit getNativeGeneratedToken();
String getToken();
void setInitToken(String str);
}