weimingfei
2 天以前 ba92b976c7fb9f8bbe4a1bf9d06fa8468d26be58
keyCabinet-android/app/src/main/java/com/doumee/keyCabinet/ui/main/MainActivity.java
@@ -135,6 +135,7 @@
import java.util.List;
import java.util.Timer;
import java.util.TimerTask;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.regex.Matcher;
@@ -229,23 +230,6 @@
        getPermission();
        mXService = new MyService(this);
        //Timber.tag("====>").d(LMobileInfo.getDeviceUniqueId());
        Thread.setDefaultUncaughtExceptionHandler((thread, throwable) -> {
            String time2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
            getVM().addInfo("GlobalException线程报错:" + thread.getName());
            try {
                ByteArrayOutputStream out = new ByteArrayOutputStream();
                PrintStream print = new PrintStream(out);
                //导出发生异常的时间
                print.println(time2);
                print.println();
                throwable.printStackTrace(print);
                SpUtil.saveString(CrashHandler.FILE_NAME+time2,new String(out.toByteArray()));
                print.close();
            } catch (Exception e) {
                e.printStackTrace();
                getVM().addInfo("错误日志2"+e.getMessage());
            }
        });
    }
    private void initM(){
@@ -260,6 +244,7 @@
        if((availableMemory<100&&showTime!=null&&(System.currentTimeMillis()-showTime>5000))||
                ("02:00:00".equals(StringUtil.getHM()))){
            //可用内存小于400M,或者每天凌晨2点,重启app
            //ToastView.show(MApplication.mContext,"内存紧张,重新启动");
            restartApp();
        }
    }
@@ -315,7 +300,6 @@
                }
                lastDownTime1 = System.currentTimeMillis();
                downCount1++;
                System.out.println();
                //Timber.tag("==>").d(""+downCount1);
                if(downCount1>4) {
                    downCount1=0;
@@ -342,7 +326,6 @@
                }
            }
        });
        getDB().imgLeft.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v1) {
@@ -585,7 +568,6 @@
    @Subscribe
    public void GetFacesEvent(GetFacesEvent event){
        getVM().addInfo("查询人脸数据======》");
        if(!isFinishing()&&!isUpdatingFace){
            getVM().addInfo("查询人脸数据======》isDBLoad = "+isDBLoad);
            if(isDBLoad){
@@ -1370,7 +1352,7 @@
        @Override
        public void onResultBytes(byte[] bytes) {
            if(isFinishing()){
            if(isFinishing()||getVM()==null){
                return;
            }
            if(bytes.length==0){
@@ -1385,7 +1367,7 @@
    @Subscribe(threadMode = ThreadMode.MAIN)
    public void HttpEvent(HttpEvent e){
        if(!isFinishing()){
        if(!isFinishing()&&getVM()!=null){
            getVM().addInfo(e.getMsg());
        }
    }
@@ -1663,7 +1645,7 @@
        @Override
        public void onResultBytes(byte[] bytes) {
            if(isFinishing()){
            if(isFinishing()||getVM()==null){
                return;
            }
            if(bytes.length==0){