正在查看: Rilo v2.0.21 应用的 CustomTabMainActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Rilo v2.0.21 应用的 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.NativeProtocol;
import com.facebook.internal.Utility;
public class CustomTabMainActivity extends Activity {
private BroadcastReceiver redirectReceiver;
private boolean shouldCloseCustomTab = true;
public static final String EXTRA_ACTION = "CustomTabMainActivity.extra_action";
public static final String EXTRA_PARAMS = "CustomTabMainActivity.extra_params";
public static final String EXTRA_CHROME_PACKAGE = "CustomTabMainActivity.extra_chromePackage";
public static final String EXTRA_URL = "CustomTabMainActivity.extra_url";
public static final String REFRESH_ACTION = "CustomTabMainActivity.action_refresh";
public static final String NO_ACTIVITY_EXCEPTION = "CustomTabMainActivity.no_activity_exception";
@Override
protected void onCreate(Bundle bundle) {
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);
boolean openCustomTab = new CustomTab(stringExtra, bundleExtra).openCustomTab(this, getIntent().getStringExtra(EXTRA_CHROME_PACKAGE));
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));
}
}
}
@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(), (FacebookException) null);
if (createProtocolResultIntent != null) {
intent = createProtocolResultIntent;
}
setResult(i, intent);
} else {
setResult(i, NativeProtocol.createProtocolResultIntent(getIntent(), (Bundle) null, (FacebookException) 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;
}
}