Pixel Fusion v1.0.2版本的 MD5 值为:7c04c460c2996569d4ad075cd671a946
以下内容为反编译后的 UrlProvider.java 源代码,内容仅作参考
package io.bidmachine;
import android.net.Uri;
import android.text.TextUtils;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
import io.bidmachine.core.Logger;
import io.bidmachine.core.Utils;
import java.util.Collection;
import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;
public class UrlProvider {
@NonNull
private static final String PATH_AUCTION = "auction";
@NonNull
private static final String PATH_INIT = "init";
@NonNull
private static final String PATH_RTB = "rtb";
@NonNull
private static final String PATH_V3 = "v3";
@Nullable
private static String auctionUrlFromInit;
@Nullable
private static String auctionUrlFromSuccessRequest;
@NonNull
private static final String DEF_BASE_URL = "https://api.bidmachine.io";
@NonNull
private static final String[] DEF_BASE_URLS = {DEF_BASE_URL, "https://x.everestop.io", "https://x.blueduckredapple.com", "https://x.thecatmachine.com"};
@NonNull
private static final Queue<String> INIT_URL_QUEUE = new ConcurrentLinkedQueue();
@NonNull
private static final Queue<String> AUCTION_URL_QUEUE = new ConcurrentLinkedQueue();
public class BbdcDCacCa extends ConcurrentLinkedQueue<String> {
public BbdcDCacCa() {
add(UrlProvider.auctionUrlFromInit);
}
}
public class DAbacDAb extends ConcurrentLinkedQueue<String> {
public DAbacDAb() {
add(UrlProvider.auctionUrlFromSuccessRequest);
}
}
static {
setupUrls();
}
@NonNull
private static String createAuctionUrl(@NonNull Uri uri) {
return uri.buildUpon().appendPath(PATH_AUCTION).appendPath(PATH_RTB).appendPath("v3").toString();
}
@NonNull
private static String createInitUrl(@NonNull Uri uri) {
return uri.buildUpon().appendPath(PATH_AUCTION).appendPath("init").toString();
}
@NonNull
public static Queue<String> getAuctionUrlQueue() {
if (!TextUtils.isEmpty(auctionUrlFromInit)) {
return new BbdcDCacCa();
}
if (!TextUtils.isEmpty(auctionUrlFromSuccessRequest)) {
return new DAbacDAb();
}
return new ConcurrentLinkedQueue(AUCTION_URL_QUEUE);
}
@NonNull
public static Queue<String> getInitUrlQueue() {
return new ConcurrentLinkedQueue(INIT_URL_QUEUE);
}
@VisibleForTesting
public static void reset() {
setupUrls();
auctionUrlFromInit = null;
auctionUrlFromSuccessRequest = null;
}
public static void setAuctionUrl(@NonNull String str) {
if (TextUtils.isEmpty(str)) {
return;
}
Queue<String> queue = AUCTION_URL_QUEUE;
queue.clear();
queue.add(str);
}
public static synchronized void setAuctionUrlFromInit(@NonNull String str) {
synchronized (UrlProvider.class) {
if (TextUtils.isEmpty(str)) {
return;
}
auctionUrlFromInit = str;
}
}
public static void setAuctionUrlFromSuccessRequest(@NonNull String str) {
if (auctionUrlFromSuccessRequest == null && !TextUtils.isEmpty(str)) {
auctionUrlFromSuccessRequest = str;
}
}
public static void setEndpoint(@NonNull String str) {
if (!Utils.isUrlValid(str)) {
Logger.logError(String.format("Endpoint has an invalid format - %s", str));
} else {
if (bDCaDADc.get().isInitializationStarted()) {
Logger.logError("Can't change endpoint url after initialization");
return;
}
Uri parse = Uri.parse(str);
setInitUrl(createInitUrl(parse));
setAuctionUrl(createAuctionUrl(parse));
}
}
public static void setInitUrl(@NonNull String str) {
if (TextUtils.isEmpty(str)) {
return;
}
Queue<String> queue = INIT_URL_QUEUE;
queue.clear();
queue.add(str);
}
private static void setupAuctionUrls(@NonNull Collection<String> collection, @NonNull String[] strArr) {
collection.clear();
for (String str : strArr) {
collection.add(createAuctionUrl(Uri.parse(str)));
}
}
private static void setupInitUrls(@NonNull Collection<String> collection, @NonNull String[] strArr) {
collection.clear();
for (String str : strArr) {
collection.add(createInitUrl(Uri.parse(str)));
}
}
@VisibleForTesting
public static void setupUrls() {
Queue<String> queue = INIT_URL_QUEUE;
String[] strArr = DEF_BASE_URLS;
setupInitUrls(queue, strArr);
setupAuctionUrls(AUCTION_URL_QUEUE, strArr);
}
}