正在查看: Cashalo v2.25.0.0 应用的 CustomTabMainActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Cashalo v2.25.0.0 应用的 CustomTabMainActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.facebook;
import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.Uri;
import android.os.Bundle;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import com.facebook.internal.CustomTab;
import com.facebook.internal.InstagramCustomTab;
import com.facebook.internal.NativeProtocol;
import com.facebook.internal.Utility;
import com.facebook.login.LoginTargetApp;
public class CustomTabMainActivity extends Activity {
public static final String EXTRA_ACTION = "CustomTabMainActivity.extra_action";
public static final String EXTRA_CHROME_PACKAGE = "CustomTabMainActivity.extra_chromePackage";
public static final String EXTRA_PARAMS = "CustomTabMainActivity.extra_params";
public static final String EXTRA_TARGET_APP = "CustomTabMainActivity.extra_targetApp";
public static final String EXTRA_URL = "CustomTabMainActivity.extra_url";
public static final String NO_ACTIVITY_EXCEPTION = "CustomTabMainActivity.no_activity_exception";
public static final String REFRESH_ACTION = "CustomTabMainActivity.action_refresh";
private BroadcastReceiver redirectReceiver;
private boolean shouldCloseCustomTab = true;
@Override
protected void onCreate(Bundle bundle) {
CustomTab instagramCustomTab;
super.onCreate(bundle);
if (CustomTabActivity.CUSTOM_TAB_REDIRECT_ACTION.equals(getIntent().getAction())) {
setResult(0);
finish();
return;
}
if (bundle == null) {
String stringExtra = getIntent().getStringExtra(EXTRA_ACTION);
Bundle bundleExtra = getIntent().getBundleExtra(EXTRA_PARAMS);
String stringExtra2 = getIntent().getStringExtra(EXTRA_CHROME_PACKAGE);
if (AnonymousClass2.$SwitchMap$com$facebook$login$LoginTargetApp[LoginTargetApp.fromString(getIntent().getStringExtra(EXTRA_TARGET_APP)).ordinal()] == 1) {
instagramCustomTab = new InstagramCustomTab(stringExtra, bundleExtra);
} else {
instagramCustomTab = new CustomTab(stringExtra, bundleExtra);
}
boolean openCustomTab = instagramCustomTab.openCustomTab(this, stringExtra2);
this.shouldCloseCustomTab = false;
if (!openCustomTab) {
setResult(0, getIntent().putExtra(NO_ACTIVITY_EXCEPTION, true));
finish();
} else {
this.redirectReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
Intent intent2 = new Intent(CustomTabMainActivity.this, (Class<?>) CustomTabMainActivity.class);
intent2.setAction(CustomTabMainActivity.REFRESH_ACTION);
intent2.putExtra(CustomTabMainActivity.EXTRA_URL, intent.getStringExtra(CustomTabMainActivity.EXTRA_URL));
intent2.addFlags(603979776);
CustomTabMainActivity.this.startActivity(intent2);
}
};
LocalBroadcastManager.getInstance(this).registerReceiver(this.redirectReceiver, new IntentFilter(CustomTabActivity.CUSTOM_TAB_REDIRECT_ACTION));
}
}
}
static class AnonymousClass2 {
static final int[] $SwitchMap$com$facebook$login$LoginTargetApp;
static {
int[] iArr = new int[LoginTargetApp.values().length];
$SwitchMap$com$facebook$login$LoginTargetApp = iArr;
try {
iArr[LoginTargetApp.INSTAGRAM.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
}
}
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
if (REFRESH_ACTION.equals(intent.getAction())) {
LocalBroadcastManager.getInstance(this).sendBroadcast(new Intent(CustomTabActivity.DESTROY_ACTION));
sendResult(-1, intent);
} else if (CustomTabActivity.CUSTOM_TAB_REDIRECT_ACTION.equals(intent.getAction())) {
sendResult(-1, intent);
}
}
@Override
protected void onResume() {
super.onResume();
if (this.shouldCloseCustomTab) {
sendResult(0, null);
}
this.shouldCloseCustomTab = true;
}
private void sendResult(int i, Intent intent) {
LocalBroadcastManager.getInstance(this).unregisterReceiver(this.redirectReceiver);
if (intent != null) {
String stringExtra = intent.getStringExtra(EXTRA_URL);
Intent createProtocolResultIntent = NativeProtocol.createProtocolResultIntent(getIntent(), stringExtra != null ? parseResponseUri(stringExtra) : new Bundle(), null);
if (createProtocolResultIntent != null) {
intent = createProtocolResultIntent;
}
setResult(i, intent);
} else {
setResult(i, NativeProtocol.createProtocolResultIntent(getIntent(), null, null));
}
finish();
}
private static Bundle parseResponseUri(String str) {
Uri parse = Uri.parse(str);
Bundle parseUrlQueryString = Utility.parseUrlQueryString(parse.getQuery());
parseUrlQueryString.putAll(Utility.parseUrlQueryString(parse.getFragment()));
return parseUrlQueryString;
}
}