Files
rr3-apk/decompiled/sources/com/ea/nimble/CustomTabActivity.java
Daniel Elliott f9d20bb3fc 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>
2026-02-18 14:52:23 -08:00

109 lines
4.0 KiB
Java

package com.ea.nimble;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.content.pm.ServiceInfo;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import androidx.browser.customtabs.CustomTabsIntent;
import androidx.browser.customtabs.CustomTabsService;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
/* loaded from: classes2.dex */
public class CustomTabActivity extends Activity {
private static final String[] CHROME_PACKAGES = {"com.android.chrome", "com.chrome.beta", "com.chrome.dev"};
private static final String LOG_TAG = "NimbleCustomTabActivity";
private static String sCustomTabPackageNameToUse;
private boolean mShouldCloseCustomTab = true;
public static String getCustomTabsPackageToUse(Context context) {
List<ResolveInfo> queryIntentServices;
PackageManager.ResolveInfoFlags of;
String str = sCustomTabPackageNameToUse;
if (str != null) {
return str;
}
PackageManager packageManager = context.getPackageManager();
Intent intent = new Intent(CustomTabsService.ACTION_CUSTOM_TABS_CONNECTION);
if (Build.VERSION.SDK_INT >= 33) {
of = PackageManager.ResolveInfoFlags.of(0L);
queryIntentServices = packageManager.queryIntentServices(intent, of);
} else {
queryIntentServices = packageManager.queryIntentServices(intent, 0);
}
if (queryIntentServices != null) {
List asList = Arrays.asList(CHROME_PACKAGES);
Iterator<ResolveInfo> it = queryIntentServices.iterator();
while (true) {
if (!it.hasNext()) {
break;
}
ResolveInfo next = it.next();
ServiceInfo serviceInfo = next.serviceInfo;
if (serviceInfo != null && asList.contains(serviceInfo.packageName)) {
sCustomTabPackageNameToUse = next.serviceInfo.packageName;
break;
}
}
}
StringBuilder sb = new StringBuilder();
sb.append("CustomTabsPackageToUse : ");
sb.append(sCustomTabPackageNameToUse);
return sCustomTabPackageNameToUse;
}
public static boolean isCustomTabSupported(Context context) {
return getCustomTabsPackageToUse(context) != null;
}
@Override // android.app.Activity
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
String string = getIntent().getExtras().getString(Constants.EXTRA_URL, "");
CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder(WebView.getCustomTabServiceSession());
builder.setUrlBarHidingEnabled(true);
builder.setShareState(2);
CustomTabsIntent build = builder.build();
build.intent.setPackage(sCustomTabPackageNameToUse);
try {
StringBuilder sb = new StringBuilder();
sb.append("[onCreate] URL: ");
sb.append(string);
build.launchUrl(this, Uri.parse(string));
this.mShouldCloseCustomTab = false;
} catch (Exception e) {
System.out.println(e);
setResult(10, getIntent().putExtra(Constants.EXTRA_ERROR, e.getMessage()));
finish();
}
}
@Override // android.app.Activity
public void onResume() {
super.onResume();
if (this.mShouldCloseCustomTab) {
setResult(0);
finish();
}
this.mShouldCloseCustomTab = true;
}
@Override // android.app.Activity
public void onNewIntent(Intent intent) {
super.onNewIntent(intent);
StringBuilder sb = new StringBuilder();
sb.append("[onNewIntent] Action: ");
sb.append(intent.getAction());
if (Constants.CUSTOM_TAB_REDIRECT_ACTION.equals(intent.getAction())) {
setResult(-1, intent);
finish();
}
}
}