导航菜单

页面标题

页面副标题

管控平台 v5.2.3.0. - FileScanService.java 源代码

正在查看: 管控平台 v5.2.3.0. 应用的 FileScanService.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.iflytek.mdmservice.service;

import android.app.IntentService;
import android.content.Intent;
import android.os.Environment;
import androidx.annotation.Nullable;
import com.iflytek.mdmcommon.LogUtil;
import com.iflytek.mdmcommon.SpHelper;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class FileScanService extends IntentService {

    private com.iflytek.mdmservice.l.a f473a;

    private ArrayList<String> f474b;

    private Map<String, Object> f475c;
    private List<Map<String, Object>> d;
    private Map<String, a> e;
    private Map<String, a> f;

    class a {

        int f476a;

        long f477b;

        long f478c;

        public a(FileScanService fileScanService, int i, long j, long j2) {
            this.f476a = i;
            this.f477b = j;
            this.f478c = j2;
        }
    }

    public FileScanService() {
        this("FileScanService");
    }

    private boolean a(File file) {
        String absolutePath = file.getAbsolutePath();
        return absolutePath.endsWith(".jpg") || absolutePath.endsWith(".jpeg") || absolutePath.endsWith(".gif") || absolutePath.endsWith(".bmp") || absolutePath.endsWith(".png") || absolutePath.endsWith(".webp");
    }

    private boolean b(File file) {
        String absolutePath = file.getAbsolutePath();
        return absolutePath.endsWith(".3gp") || absolutePath.endsWith(".mp4") || absolutePath.endsWith(".rmvb") || absolutePath.endsWith(".wmv") || absolutePath.endsWith(".avi") || absolutePath.endsWith(".mkv") || absolutePath.endsWith(".mov") || absolutePath.endsWith(".flv") || absolutePath.endsWith(".f4v") || absolutePath.endsWith(".m4v") || absolutePath.endsWith(".webm") || absolutePath.endsWith(".vob") || absolutePath.endsWith(".mpg") || absolutePath.endsWith(".mpeg");
    }

    private void c() {
        this.f475c.clear();
        this.d.clear();
        this.e.clear();
        this.f.clear();
    }

    private void d(File file) {
        long j;
        long j2;
        if (file.exists()) {
            if (file.isDirectory()) {
                File[] listFiles = file.listFiles();
                if (listFiles == null || listFiles.length <= 0) {
                    return;
                }
                for (File file2 : listFiles) {
                    d(file2);
                }
                return;
            }
            if (a(file)) {
                String absolutePath = file.getAbsolutePath();
                LogUtil.i("MDMFileScan", "media image path: " + absolutePath);
                String parent = file.getParent();
                a aVar = this.e.get(parent);
                long length = file.length();
                long lastModified = file.lastModified();
                if (aVar == null) {
                    this.e.put(parent, new a(this, 1, length, lastModified));
                    j2 = lastModified;
                } else {
                    aVar.f476a++;
                    aVar.f477b += length;
                    long j3 = aVar.f478c;
                    j2 = lastModified;
                    if (j2 > j3) {
                        j3 = j2;
                    }
                    aVar.f478c = j3;
                    this.e.put(parent, aVar);
                }
                LogUtil.i("MDMFileScan", "image path:" + absolutePath + ", size:" + length + ", dirPath:" + parent + " ,time:" + j2);
                return;
            }
            if (b(file)) {
                String absolutePath2 = file.getAbsolutePath();
                LogUtil.i("MDMFileScan", "media video path: " + absolutePath2);
                String parent2 = file.getParent();
                a aVar2 = this.f.get(parent2);
                long length2 = file.length();
                long lastModified2 = file.lastModified();
                if (aVar2 == null) {
                    this.f.put(parent2, new a(this, 1, length2, lastModified2));
                    j = lastModified2;
                } else {
                    aVar2.f476a++;
                    aVar2.f477b += length2;
                    long j4 = aVar2.f478c;
                    j = lastModified2;
                    if (j > j4) {
                        j4 = j;
                    }
                    aVar2.f478c = j4;
                    this.f.put(parent2, aVar2);
                }
                LogUtil.i("MDMFileScan", "video path:" + absolutePath2 + ", size:" + length2 + ", dirPath:" + parent2 + " ,time:" + j);
            }
        }
    }

    @Override
    public void onCreate() {
        super.onCreate();
        this.f473a = new com.iflytek.mdmservice.l.a();
    }

    @Override
    protected void onHandleIntent(@Nullable Intent intent) {
        String absolutePath = Environment.getExternalStorageDirectory().getAbsolutePath();
        this.f474b.clear();
        c();
        d(new File(absolutePath));
        int i = 0;
        long j = 0;
        for (Map.Entry<String, a> entry : this.e.entrySet()) {
            String key = entry.getKey();
            a value = entry.getValue();
            int i2 = i + value.f476a;
            long j2 = j + value.f477b;
            HashMap hashMap = new HashMap();
            hashMap.put("count", Integer.valueOf(value.f476a));
            hashMap.put("size", Long.valueOf(value.f477b));
            hashMap.put("time", Long.valueOf(value.f478c));
            hashMap.put("type", "image");
            hashMap.put("path", key);
            this.d.add(hashMap);
            LogUtil.i("MDMFileScan", "image:  key:" + key + ", count:" + value.f476a + ", size:" + value.f477b);
            i = i2;
            j = j2;
        }
        this.f475c.put("imageTotalCount", Integer.valueOf(i));
        this.f475c.put("imageTotalSize", Long.valueOf(j));
        int i3 = 0;
        long j3 = 0;
        for (Map.Entry<String, a> entry2 : this.f.entrySet()) {
            String key2 = entry2.getKey();
            a value2 = entry2.getValue();
            int i4 = i3 + value2.f476a;
            j3 += value2.f477b;
            HashMap hashMap2 = new HashMap();
            hashMap2.put("count", Integer.valueOf(value2.f476a));
            hashMap2.put("size", Long.valueOf(value2.f477b));
            hashMap2.put("time", Long.valueOf(value2.f478c));
            hashMap2.put("type", "video");
            hashMap2.put("path", key2);
            this.d.add(hashMap2);
            LogUtil.i("MDMFileScan", "video:  key:" + key2 + ", count:" + value2.f476a + ", size:" + value2.f477b);
            i = i;
            i3 = i4;
        }
        int i5 = i;
        this.f475c.put("videoTotalCount", Integer.valueOf(i3));
        this.f475c.put("videoTotalSize", Long.valueOf(j3));
        this.f475c.put("detail", this.d);
        if (i5 == 0 && i3 == 0) {
            return;
        }
        LogUtil.c("MDMFileScan", "media data:" + this.f475c);
        this.f473a.u(this.f475c);
        SpHelper.putLong("mdm_record_media_data", System.currentTimeMillis());
    }

    public FileScanService(String str) {
        super(str);
        this.f474b = new ArrayList<>();
        this.f475c = new HashMap();
        this.d = new ArrayList();
        this.e = new HashMap();
        this.f = new HashMap();
    }
}