云执法小微版 v1.0.0版本的 MD5 值为:dfa1ab09653b3256f84dafdbda8bb96c
以下内容为反编译后的 LegoPrivacyActivity.java 源代码,内容仅作参考
package com.kedacom.lego.fast.privacy;
import android.app.Application;
import android.content.Context;
import android.content.pm.PackageManager;
import android.content.res.ColorStateList;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.text.SpannableStringBuilder;
import android.text.method.LinkMovementMethod;
import android.text.style.TextAppearanceSpan;
import android.view.View;
import com.kedacom.lego.fast.LegoFastApplication;
import com.kedacom.lego.fast.LegoIntent;
import com.kedacom.lego.fast.R;
import com.kedacom.lego.fast.databinding.LibLegoActivityPrivacyPolicyBinding;
import com.kedacom.lego.fast.view.LegoFastActivity;
import com.kedacom.lego.fast.view.LegoFastViewModel;
import com.kedacom.util.SystemUtil;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.List;
public class LegoPrivacyActivity extends LegoFastActivity<LibLegoActivityPrivacyPolicyBinding, LegoFastViewModel> {
private static final String PACKAGE_LOCATION_GAO_DE = "com.kedacom.kmap.location.plugin.amap.AMapLocationAdapter";
private static final String PACKAGE_MAP_GAO_DE = "com.kedacom.kmap.plugin.amap.AMapAdapter";
private static final String PACKAGE_PUSH_JI_GUANG = "cn.jpush.android.api.JPushInterface";
private PermissionParser nPermissionParser;
private LegoPrivacyConfig nPrivacyPolicyConfig;
private final List<LegoPrivacyExternalLibrary> nSelfCheckingExternalLibraries = new ArrayList();
private final Handler nHandler = new Handler(Looper.getMainLooper()) {
@Override
public void handleMessage(Message msg) {
if (msg.what == 255) {
((LibLegoActivityPrivacyPolicyBinding) LegoPrivacyActivity.this.nViewDataBinding).tvPrivacyPolicy.setText((SpannableStringBuilder) msg.obj);
}
}
};
public static void show(Context context) {
context.startActivity(new LegoIntent(context, LegoPrivacyActivity.class));
}
@Override
public int getContentViewId() {
return R.layout.lib_lego_activity_privacy_policy;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
((LibLegoActivityPrivacyPolicyBinding) this.nViewDataBinding).tvPrivacyPolicy.setMovementMethod(LinkMovementMethod.getInstance());
((LibLegoActivityPrivacyPolicyBinding) this.nViewDataBinding).ivClose.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
LegoPrivacyActivity.this.finish();
}
});
Application application = getApplication();
if (application instanceof LegoFastApplication) {
this.nPrivacyPolicyConfig = ((LegoFastApplication) application).privacyPolicyConfig();
parseRequestedPermissions();
parseExternalLibraries();
loadPrivacyPolicyMouldFromAssets(this.nPrivacyPolicyConfig.toArguments());
return;
}
throw new RuntimeException("make sure your app Application extends LegoFastApplication");
}
@Override
public void onStop() {
super.onStop();
this.nHandler.removeMessages(255);
}
private void loadPrivacyPolicyMouldFromAssets(final String[] arguments) {
new Thread(new Runnable() {
@Override
public void run() {
int i;
PrivacyModuleParseData formatPrivacyPolicyMouldFromAssets = LegoPrivacyActivity.this.formatPrivacyPolicyMouldFromAssets(arguments);
SpannableStringBuilder documentContent = formatPrivacyPolicyMouldFromAssets.getDocumentContent();
if (LegoPrivacyActivity.this.nPermissionParser != null) {
int insertPermissionsIndex = formatPrivacyPolicyMouldFromAssets.getInsertPermissionsIndex();
SpannableStringBuilder permissionTextContent = LegoPrivacyActivity.this.nPermissionParser.getPermissionTextContent();
documentContent.insert(insertPermissionsIndex, (CharSequence) permissionTextContent);
i = insertPermissionsIndex + permissionTextContent.length();
} else {
i = -1;
}
if (LegoPrivacyActivity.this.nSelfCheckingExternalLibraries.size() > 0) {
if (i == -1) {
i = formatPrivacyPolicyMouldFromAssets.getInsertPermissionsIndex();
}
documentContent.insert(i, (CharSequence) " 产品和服务中包含我们合作伙伴提供的SDK插件。当您在使用合作伙伴提供的相关服务时,插件将收集和处理您的相关个人信息。我们强烈建议您在使用任何第三方SDK服务前先行查看并了解其隐私条款。\n\n");
int i2 = i + 102;
int i3 = 1;
for (LegoPrivacyExternalLibrary legoPrivacyExternalLibrary : LegoPrivacyActivity.this.nSelfCheckingExternalLibraries) {
SpannableStringBuilder externalLibraryTextContent = legoPrivacyExternalLibrary.getExternalLibraryTextContent(i3);
documentContent.insert(i2, (CharSequence) externalLibraryTextContent);
i3++;
i2 += externalLibraryTextContent.length();
}
}
Message obtain = Message.obtain();
obtain.what = 255;
obtain.obj = documentContent;
LegoPrivacyActivity.this.nHandler.sendMessage(obtain);
}
}).start();
}
private void parseExternalLibraries() {
List<LegoPrivacyExternalLibrary> appendPrivacyExternalLibrary;
try {
Class.forName(PACKAGE_PUSH_JI_GUANG);
this.nSelfCheckingExternalLibraries.add(LegoPrivacyExternalLibrary.create("极光推送SDK", "设备参数及系统信息、设备标识符、网络信息与位置信息和APP应用列表及活跃状态信息", "用于确保消息准确下发,保证推送的精准送达,实现区域推送功能", "《极光隐私政策》", "https://www.jiguang.cn/license/privacy"));
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
try {
Class.forName(PACKAGE_LOCATION_GAO_DE);
this.nSelfCheckingExternalLibraries.add(LegoPrivacyExternalLibrary.create("高德定位SDK", "设备的位置信息、设备标识符、当前应用信息、设备参数及系统信息、网络信息、蓝牙与传感器信息", "为了给应用返回用户位置信息,便于提供实时路况、路况预测和与位置相关的其他服务等", "《高德地图开放平台隐私权政策》", "https://lbs.amap.com/pages/privacy"));
} catch (ClassNotFoundException e2) {
e2.printStackTrace();
}
try {
Class.forName(PACKAGE_MAP_GAO_DE);
this.nSelfCheckingExternalLibraries.add(LegoPrivacyExternalLibrary.create("高德地图SDK", "设备的位置信息、设备标识符、当前应用信息、设备参数及系统信息、网络信息、蓝牙与传感器信息", "为了给应用返回用户位置信息,并在地图图面上展示用户位置,提供基于用户位置信息的地图、搜索等服务", "《高德地图开放平台隐私权政策》", "https://lbs.amap.com/pages/privacy"));
} catch (ClassNotFoundException e3) {
e3.printStackTrace();
}
PrivacyExtensionListener privacyExtensionListener = this.nPrivacyPolicyConfig.getPrivacyExtensionListener();
if (privacyExtensionListener == null || (appendPrivacyExternalLibrary = privacyExtensionListener.appendPrivacyExternalLibrary()) == null || appendPrivacyExternalLibrary.size() <= 0) {
return;
}
this.nSelfCheckingExternalLibraries.addAll(appendPrivacyExternalLibrary);
}
private void parseRequestedPermissions() {
try {
String[] strArr = getApplication().getPackageManager().getPackageInfo(getApplication().getPackageName(), 4096).requestedPermissions;
if (strArr != null) {
this.nPermissionParser = PrivacyPermissionHandler.handleRequestedPermissions(strArr);
PrivacyExtensionListener privacyExtensionListener = this.nPrivacyPolicyConfig.getPrivacyExtensionListener();
if (privacyExtensionListener != null) {
this.nPermissionParser.caughtPermissionGroups(privacyExtensionListener.appendPrivacyPermissionGroup(this.nPermissionParser.getUncaughtPermissions()));
}
}
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
}
public PrivacyModuleParseData formatPrivacyPolicyMouldFromAssets(final String[] arguments) {
Throwable th;
BufferedReader bufferedReader;
SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder();
InputStreamReader inputStreamReader = null;
int i = -1;
try {
try {
InputStreamReader inputStreamReader2 = new InputStreamReader(getResources().getAssets().open(LegoPrivacyConfig.MOULD_FILE_NAME));
try {
bufferedReader = new BufferedReader(inputStreamReader2);
while (true) {
try {
String readLine = bufferedReader.readLine();
if (readLine == null) {
break;
}
String format = MessageFormat.format(readLine, arguments);
int lastIndexOf = format.lastIndexOf("</title1>");
int lastIndexOf2 = format.lastIndexOf("</title2>");
int lastIndexOf3 = format.lastIndexOf("</blod>");
if (lastIndexOf > 0) {
spannableStringBuilder.append((CharSequence) format.substring(0, lastIndexOf)).append((CharSequence) "\n");
spannableStringBuilder.setSpan(new TextAppearanceSpan(null, 1, SystemUtil.sp2px(16.0f), ColorStateList.valueOf(getResources().getColor(17170444)), null), (spannableStringBuilder.length() - 1) - lastIndexOf, spannableStringBuilder.length(), 17);
} else if (lastIndexOf2 > 0) {
spannableStringBuilder.append((CharSequence) format.substring(0, lastIndexOf2)).append((CharSequence) "\n");
spannableStringBuilder.setSpan(new TextAppearanceSpan(null, 1, SystemUtil.sp2px(14.0f), ColorStateList.valueOf(getResources().getColor(17170444)), null), (spannableStringBuilder.length() - 1) - lastIndexOf2, spannableStringBuilder.length(), 17);
} else if (lastIndexOf3 > 0) {
spannableStringBuilder.append((CharSequence) format.substring(0, lastIndexOf3)).append((CharSequence) "\n");
spannableStringBuilder.setSpan(new TextAppearanceSpan(null, 1, SystemUtil.sp2px(12.0f), ColorStateList.valueOf(getResources().getColor(17170444)), null), (spannableStringBuilder.length() - 1) - lastIndexOf3, spannableStringBuilder.length(), 17);
} else if (format.trim().equals("</tag_permissions>")) {
i = spannableStringBuilder.length();
} else {
spannableStringBuilder.append((CharSequence) format).append((CharSequence) "\n");
spannableStringBuilder.setSpan(new TextAppearanceSpan(null, 0, SystemUtil.sp2px(12.0f), ColorStateList.valueOf(getResources().getColor(17170444)), null), (spannableStringBuilder.length() - 1) - format.length(), spannableStringBuilder.length(), 17);
}
} catch (Exception e) {
e = e;
inputStreamReader = inputStreamReader2;
try {
e.printStackTrace();
if (inputStreamReader != null) {
inputStreamReader.close();
}
if (bufferedReader != null) {
bufferedReader.close();
}
return new PrivacyModuleParseData(spannableStringBuilder, i);
} catch (Throwable th2) {
th = th2;
if (inputStreamReader != null) {
try {
inputStreamReader.close();
} catch (Exception e2) {
e2.printStackTrace();
throw th;
}
}
if (bufferedReader != null) {
bufferedReader.close();
}
throw th;
}
} catch (Throwable th3) {
th = th3;
inputStreamReader = inputStreamReader2;
if (inputStreamReader != null) {
}
if (bufferedReader != null) {
}
throw th;
}
}
inputStreamReader2.close();
bufferedReader.close();
} catch (Exception e3) {
e = e3;
bufferedReader = null;
} catch (Throwable th4) {
th = th4;
bufferedReader = null;
}
} catch (Exception e4) {
e4.printStackTrace();
}
} catch (Exception e5) {
e = e5;
bufferedReader = null;
} catch (Throwable th5) {
th = th5;
bufferedReader = null;
}
return new PrivacyModuleParseData(spannableStringBuilder, i);
}
}