正在查看: Handling Master v2 应用的 SEJsAppInterface.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Handling Master v2 应用的 SEJsAppInterface.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.reyun.solar.engine;
import android.content.Context;
import android.webkit.JavascriptInterface;
import com.reyun.solar.engine.region.lib.SolarEngineRegionPluginManager;
import com.reyun.solar.engine.utils.Command;
import com.reyun.solar.engine.utils.Objects;
import com.reyun.solar.engine.utils.store.NativeInteractiveH5Util;
import com.reyun.solar.engine.utils.store.NetworkUtils;
import com.reyun.solar.engine.utils.store.OsUtil;
import com.reyun.solar.engine.utils.store.RecordEventUtil;
import com.reyun.solar.engine.utils.store.SPUtils;
import com.reyun.solar.engine.utils.store.UrlUtil;
import java.util.HashMap;
import org.json.JSONException;
import org.json.JSONObject;
public final class SEJsAppInterface {
public static final String SCHEME_TITLE = "sesdk://interface/getSEAppData";
public static final String TAG = "SolarEngineSDK.SEJsAppInterface";
public String jsFunction;
public Object webView;
private String composeJsEventData() {
JSONObject jSONObject;
try {
Context context = Global.getInstance().getContext();
JSONObject jSONObject2 = new JSONObject();
String appKey = Global.getInstance().getAppKey();
if (Objects.isNotEmpty(appKey)) {
jSONObject2.put(Command.PresetAttrKey.APPKEY, appKey);
}
String accountID = Global.getInstance().getUserInfo().getAccountID();
if (Objects.isNotEmpty(accountID)) {
jSONObject2.put(Command.PresetAttrKey.ACCOUNT_ID, accountID);
}
String visitorID = Global.getInstance().getUserInfo().getVisitorID();
if (Objects.isNotEmpty(visitorID)) {
jSONObject2.put(Command.PresetAttrKey.VISITOR_ID, visitorID);
}
String sessionId = Global.getInstance().getSessionId();
if (Objects.isNotEmpty(sessionId)) {
jSONObject2.put(Command.PresetAttrKey.SESSION_ID, sessionId);
}
String uuid = Global.getInstance().getDeviceInfo().getUUID();
if (Objects.isNotEmpty(uuid)) {
jSONObject2.put(Command.PresetAttrKey.UUID, uuid);
}
String string = SPUtils.getString(Command.SPKEY.ADID, "");
if (Objects.isNotEmpty(string)) {
jSONObject2.put(Command.PresetAttrKey.GAID, string);
}
String string2 = SPUtils.getString("android_id", "");
if (Objects.isNotEmpty(string2)) {
jSONObject2.put(Command.PresetAttrKey.ANDROID_ID, string2);
}
jSONObject2.put(Command.PresetAttrKey.PACKAGE_TYPE, SolarEngineRegionPluginManager.getPackageType());
try {
HashMap hashMap = (HashMap) OsUtil.getDistinctIdAndType();
String str = (String) hashMap.get("distinctId");
int intValue = ((Integer) hashMap.get("distinctIdType")).intValue();
if (Objects.isNotEmpty(str) && Objects.isNotNull(str)) {
jSONObject2.put(Command.PresetAttrKey.DISTINCT_ID, str.trim());
jSONObject2.put(Command.PresetAttrKey.DISTINCT_ID_TYPE, intValue);
}
} catch (Exception unused) {
}
jSONObject2.put(Command.PresetAttrKey.OUT, System.currentTimeMillis());
jSONObject2.put(Command.PresetAttrKey.UPT, OsUtil.getSystemStartupTime());
JSONObject jSONObject3 = new JSONObject();
jSONObject3.put(Command.PresetAttrKey.LANGUAGE, OsUtil.getLocalLanguage());
jSONObject3.put(Command.PresetAttrKey.LOCALE, OsUtil.getLocale());
jSONObject3.put(Command.PresetAttrKey.TIME_ZONE, OsUtil.getTimeZone());
String manufacturer = OsUtil.getManufacturer();
if (Objects.isNotEmpty(manufacturer)) {
jSONObject3.put(Command.PresetAttrKey.MANUFACTURER, manufacturer);
}
jSONObject3.put(Command.PresetAttrKey.PLATFORM, 1);
jSONObject3.put(Command.PresetAttrKey.OS_VERSION, OsUtil.getOSVersion());
jSONObject3.put(Command.PresetAttrKey.SCREEN_HEIGHT, OsUtil.getHeight(context));
jSONObject3.put(Command.PresetAttrKey.SCREEN_WIDTH, OsUtil.getWidth(context));
jSONObject3.put(Command.PresetAttrKey.DEVICE_MODEL, OsUtil.getDeviceModel());
jSONObject3.put(Command.PresetAttrKey.DEVICE_TYPE, OsUtil.isTablet(context) ? 2 : 1);
jSONObject3.put(Command.PresetAttrKey.NETWORK_TYPE, NetworkUtils.getNetworkConnectionState(context));
jSONObject3.put(Command.PresetAttrKey.APP_VERSION, OsUtil.getAppVersionString(context));
jSONObject3.put(Command.PresetAttrKey.APP_VERSION_CODE, String.valueOf(OsUtil.getAppVersionCode(context)));
jSONObject3.put(Command.PresetAttrKey.PACKAGE_NAME, OsUtil.getPackageName(context));
jSONObject3.put(Command.PresetAttrKey.APP_NAME, OsUtil.getAppName(context));
String channel = Global.getInstance().getUserInfo().getChannel();
if (Objects.isEmpty(channel)) {
channel = OsUtil.getAppChannel(context, Command.Common.UMENG_CHANNEL);
}
jSONObject3.put(Command.PresetAttrKey.CHANNEL, channel);
jSONObject3.put(Command.PresetAttrKey.LIB, 1);
jSONObject3.put(Command.PresetAttrKey.LIB_VERSION, "1.2.9.1");
jSONObject2.put(Command.PresetAttrKey.PROPERTIES, jSONObject3);
jSONObject = jSONObject2;
} catch (JSONException unused2) {
jSONObject = null;
}
return Objects.isNull(jSONObject) ? "" : jSONObject.toString();
}
public String getJsFunction() {
return this.jsFunction;
}
@JavascriptInterface
public void getSEAppData(String str) {
int i;
String str2;
Global.getInstance().getLogger().logDebug("SolarEngineSDK.SEJsAppInterface", "get Js scheme:" + str);
if (Objects.isEmpty(str)) {
Global.getInstance().getLogger().logError("SolarEngineSDK.SEJsAppInterface", Command.ErrorMessage.SCHEME_IS_NULL);
i = Command.RecordType.APP_TO_H5_FAILED;
str2 = Command.ErrorMessage.SCHEME_IS_NULL;
} else if (str.startsWith(SCHEME_TITLE)) {
String analysisUrl = UrlUtil.analysisUrl(str);
if (!Objects.isEmpty(analysisUrl)) {
this.jsFunction = analysisUrl;
RecordEventUtil.composeRecordLogEvent(Command.RecordType.GET_JS_REQUEST_SUCCESS, "get js request success! jsFunction :" + analysisUrl, null, "SolarEngineSDK.SEJsAppInterface", "getSEAppData()", 0);
String composeJsEventData = composeJsEventData();
if (!Objects.isNotEmpty(composeJsEventData)) {
RecordEventUtil.composeRecordLogEvent(Command.RecordType.SEND_APPDATA_TO_JS_FAILED, "send appData to js failed! app data compose failed!", null, "SolarEngineSDK.SEJsAppInterface", "getSEAppData()", 0);
return;
}
String str3 = analysisUrl + "('" + composeJsEventData + "')";
if (Objects.isNotNull(this.webView)) {
RecordEventUtil.composeRecordLogEvent(Command.RecordType.SEND_APPDATA_TO_JS_SUCCESS, "send appData to js success! jsCode :" + str3, null, "SolarEngineSDK.SEJsAppInterface", "webviewEvaluateJs()", 0);
NativeInteractiveH5Util.webviewEvaluateJs(this.webView, str3);
return;
}
return;
}
Global.getInstance().getLogger().logError("SolarEngineSDK.SEJsAppInterface", Command.ErrorMessage.JS_FUNCTION_IS_NULL);
i = Command.RecordType.APP_TO_H5_FAILED;
str2 = Command.ErrorMessage.JS_FUNCTION_IS_NULL;
} else {
Global.getInstance().getLogger().logError("SolarEngineSDK.SEJsAppInterface", Command.ErrorMessage.SCHEME_IS_ILLEGAL);
i = Command.RecordType.APP_TO_H5_FAILED;
str2 = Command.ErrorMessage.SCHEME_IS_ILLEGAL;
}
RecordEventUtil.composeRecordLogEvent(i, str2, null, "SolarEngineSDK.SEJsAppInterface", "getSEAppData()", 0);
}
public Object getWebView() {
return this.webView;
}
public void setWebView(Object obj) {
this.webView = obj;
}
}