正在查看: 管控平台 v5.2.3.0. 应用的 DataFlushService.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: 管控平台 v5.2.3.0. 应用的 DataFlushService.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.iflytek.mdmservice.service;
import android.app.Service;
import android.content.Intent;
import android.database.Cursor;
import android.media.MediaScannerConnection;
import android.net.Uri;
import android.os.IBinder;
import android.provider.MediaStore;
import androidx.annotation.Nullable;
import com.iflytek.mdmcommon.LogUtil;
import com.iflytek.mdmcommon.SpHelper;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
public class DataFlushService extends Service {
private MediaScannerConnection f455a;
private com.iflytek.mdmservice.l.a f456b;
private ArrayList<String> f457c;
private ArrayList<String> d = new ArrayList<>();
class a implements MediaScannerConnection.MediaScannerConnectionClient {
a() {
}
@Override
public void onMediaScannerConnected() {
Iterator it = DataFlushService.this.f457c.iterator();
while (it.hasNext()) {
DataFlushService.this.f455a.scanFile((String) it.next(), null);
}
}
@Override
public void onScanCompleted(String str, Uri uri) {
LogUtil.i("MDMFileScan", "path: " + str + ", uri: " + uri);
DataFlushService.this.d.add(str);
if (DataFlushService.this.d.size() == DataFlushService.this.f457c.size()) {
DataFlushService.this.f455a.disconnect();
DataFlushService.this.e();
}
}
}
class b {
int f459a;
long f460b;
long f461c;
public b(DataFlushService dataFlushService, int i, long j, long j2) {
this.f459a = i;
this.f460b = j;
this.f461c = j2;
}
}
public void e() {
Cursor cursor;
HashMap hashMap;
ArrayList arrayList;
String str;
String str2;
String str3;
String str4;
String str5;
String str6;
String str7;
long j;
String str8;
String str9;
String str10;
String str11;
String str12;
Cursor cursor2;
String str13;
String str14;
String str15;
ArrayList arrayList2;
String str16;
String str17;
String str18 = "_id";
String str19 = "_data";
String str20 = "_size";
String str21 = "date_added";
String str22 = "date_modified";
Cursor query = getContentResolver().query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, new String[]{"_id", "_data", "_size", "date_added", "date_modified"}, null, null, "date_modified desc");
HashMap hashMap2 = new HashMap();
ArrayList arrayList3 = new ArrayList();
HashMap hashMap3 = new HashMap();
String str23 = " ,modifyTime:";
String str24 = " ,addTime:";
String str25 = ", dirPath:";
String str26 = "MDMFileScan";
if (query == null) {
LogUtil.i("MDMFileScan", "no image.");
hashMap = hashMap2;
arrayList = arrayList3;
str = "_id";
str2 = "_data";
str3 = "_size";
str4 = "date_added";
str5 = "date_modified";
str6 = "MDMFileScan";
} else {
if (query.moveToFirst()) {
while (true) {
String string = query.getString(query.getColumnIndex(str19));
str = str18;
str2 = str19;
long j2 = query.getLong(query.getColumnIndex(str20));
str3 = str20;
str4 = str21;
long j3 = query.getLong(query.getColumnIndex(str21));
hashMap = hashMap2;
arrayList = arrayList3;
long j4 = query.getLong(query.getColumnIndex(str22));
cursor = query;
str5 = str22;
String substring = string.substring(0, string.lastIndexOf(47));
b bVar = (b) hashMap3.get(substring);
long j5 = j4 > j3 ? j4 : j3;
if (bVar == null) {
hashMap3.put(substring, new b(this, 1, j2, j5));
j = j4;
str7 = str26;
} else {
str7 = str26;
bVar.f459a++;
j = j4;
bVar.f460b += j2;
long j6 = bVar.f461c;
if (j5 > j6) {
j6 = j5;
}
bVar.f461c = j6;
hashMap3.put(substring, bVar);
}
str6 = str7;
LogUtil.i(str6, "path:" + string + ", size:" + j2 + ", dirPath:" + substring + " ,addTime:" + j3 + " ,modifyTime:" + j);
if (!cursor.moveToNext()) {
break;
}
str26 = str6;
str18 = str;
str19 = str2;
str20 = str3;
str21 = str4;
hashMap2 = hashMap;
arrayList3 = arrayList;
str22 = str5;
query = cursor;
}
} else {
cursor = query;
hashMap = hashMap2;
arrayList = arrayList3;
str = "_id";
str2 = "_data";
str3 = "_size";
str4 = "date_added";
str5 = "date_modified";
str6 = "MDMFileScan";
}
cursor.close();
}
Iterator it = hashMap3.entrySet().iterator();
long j7 = 0;
int i = 0;
while (true) {
str8 = "path";
str9 = "time";
str10 = "size";
str11 = str23;
str12 = "count";
if (!it.hasNext()) {
break;
}
Map.Entry entry = (Map.Entry) it.next();
Iterator it2 = it;
String str27 = (String) entry.getKey();
b bVar2 = (b) entry.getValue();
int i2 = i + bVar2.f459a;
long j8 = j7 + bVar2.f460b;
HashMap hashMap4 = new HashMap();
hashMap4.put("count", Integer.valueOf(bVar2.f459a));
hashMap4.put("size", Long.valueOf(bVar2.f460b));
hashMap4.put("time", Long.valueOf(bVar2.f461c * 1000));
hashMap4.put("type", "image");
hashMap4.put("path", str27);
arrayList.add(hashMap4);
LogUtil.i(str6, "image: key:" + str27 + ", count:" + bVar2.f459a + ", size:" + bVar2.f460b);
str23 = str11;
it = it2;
i = i2;
j7 = j8;
str25 = str25;
str24 = str24;
}
String str28 = str24;
String str29 = str25;
ArrayList arrayList4 = arrayList;
Integer valueOf = Integer.valueOf(i);
int i3 = i;
HashMap hashMap5 = hashMap;
hashMap5.put("imageTotalCount", valueOf);
hashMap5.put("imageTotalSize", Long.valueOf(j7));
String str30 = str2;
String str31 = str3;
String str32 = str4;
String str33 = str5;
Cursor query2 = getContentResolver().query(MediaStore.Video.Media.EXTERNAL_CONTENT_URI, new String[]{str, str30, str31, str32, str33}, null, null, "date_modified desc");
HashMap hashMap6 = new HashMap();
if (query2 == null) {
LogUtil.i(str6, "no video.");
str13 = "time";
str14 = "size";
str15 = "count";
arrayList2 = arrayList4;
str16 = "path";
str17 = str6;
} else {
if (query2.moveToFirst()) {
arrayList2 = arrayList4;
while (true) {
String string2 = query2.getString(query2.getColumnIndex(str30));
String str34 = str30;
str13 = str9;
str14 = str10;
long j9 = query2.getLong(query2.getColumnIndex(str31));
String str35 = str32;
String str36 = str31;
long j10 = query2.getLong(query2.getColumnIndex(str32));
str15 = str12;
String str37 = str29;
long j11 = query2.getLong(query2.getColumnIndex(str33));
String str38 = str33;
String substring2 = string2.substring(0, string2.lastIndexOf(47));
b bVar3 = (b) hashMap6.get(substring2);
long j12 = j11 > j10 ? j11 : j10;
if (bVar3 == null) {
hashMap6.put(substring2, new b(this, 1, j9, j12));
cursor2 = query2;
str16 = str8;
str17 = str6;
} else {
str16 = str8;
bVar3.f459a++;
cursor2 = query2;
str17 = str6;
bVar3.f460b += j9;
long j13 = bVar3.f461c;
if (j12 > j13) {
j13 = j12;
}
bVar3.f461c = j13;
hashMap6.put(substring2, bVar3);
}
StringBuilder sb = new StringBuilder();
sb.append("path:");
sb.append(string2);
sb.append(", size:");
sb.append(j9);
sb.append(str37);
sb.append(substring2);
String str39 = str28;
sb.append(str39);
sb.append(j10);
String str40 = str11;
sb.append(str40);
sb.append(j11);
LogUtil.i(str17, sb.toString());
if (!cursor2.moveToNext()) {
break;
}
str29 = str37;
str28 = str39;
str11 = str40;
str6 = str17;
str8 = str16;
str33 = str38;
str30 = str34;
str10 = str14;
str9 = str13;
query2 = cursor2;
str32 = str35;
str31 = str36;
str12 = str15;
}
} else {
cursor2 = query2;
str13 = "time";
str14 = "size";
str15 = "count";
arrayList2 = arrayList4;
str16 = "path";
str17 = str6;
}
cursor2.close();
}
long j14 = 0;
int i4 = 0;
for (Map.Entry entry2 : hashMap6.entrySet()) {
String str41 = (String) entry2.getKey();
b bVar4 = (b) entry2.getValue();
i4 += bVar4.f459a;
j14 += bVar4.f460b;
HashMap hashMap7 = new HashMap();
hashMap7.put(str15, Integer.valueOf(bVar4.f459a));
hashMap7.put(str14, Long.valueOf(bVar4.f460b));
hashMap7.put(str13, Long.valueOf(bVar4.f461c * 1000));
hashMap7.put("type", "video");
hashMap7.put(str16, str41);
arrayList2.add(hashMap7);
LogUtil.i(str17, "video: key:" + str41 + ", count:" + bVar4.f459a + ", size:" + bVar4.f460b);
}
HashMap hashMap8 = hashMap;
hashMap8.put("videoTotalCount", Integer.valueOf(i4));
hashMap8.put("videoTotalSize", Long.valueOf(j14));
hashMap8.put("detail", arrayList2);
if (i3 == 0 && i4 == 0) {
return;
}
this.f456b.u(hashMap8);
LogUtil.c(str17, "media data:" + hashMap8);
SpHelper.putLong("mdm_record_media_data", System.currentTimeMillis());
}
@Override
@Nullable
public IBinder onBind(Intent intent) {
return null;
}
@Override
public void onCreate() {
super.onCreate();
this.f456b = new com.iflytek.mdmservice.l.a();
this.f455a = new MediaScannerConnection(this, new a());
}
@Override
public int onStartCommand(Intent intent, int i, int i2) {
this.f457c = intent.getStringArrayListExtra("paths");
StringBuilder sb = new StringBuilder();
sb.append("paths.size: ");
ArrayList<String> arrayList = this.f457c;
sb.append(arrayList == null ? "null" : String.valueOf(arrayList.size()));
LogUtil.i("MDMFileScan", sb.toString());
ArrayList<String> arrayList2 = this.f457c;
if (arrayList2 == null || arrayList2.size() <= 0) {
e();
} else {
this.d.clear();
this.f455a.connect();
}
return super.onStartCommand(intent, i, i2);
}
}