|
@@ -74,11 +74,13 @@ public class FloatService extends Service {
|
|
|
Message message = handler.obtainMessage(1);
|
|
Message message = handler.obtainMessage(1);
|
|
|
message.obj = count;
|
|
message.obj = count;
|
|
|
handler.sendMessage(message);
|
|
handler.sendMessage(message);
|
|
|
|
|
+ LogUtil.println("FloatService", 1);
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
if(isShowFloat) {
|
|
if(isShowFloat) {
|
|
|
removeMessages();
|
|
removeMessages();
|
|
|
mHandler.sendEmptyMessage(OPERATION_HIDE);
|
|
mHandler.sendEmptyMessage(OPERATION_HIDE);
|
|
|
|
|
+ LogUtil.println("FloatService", 2);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -117,25 +119,31 @@ public class FloatService extends Service {
|
|
|
}
|
|
}
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
|
|
|
+ LogUtil.println("FloatService", 4);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private void onHandleMessage1() {
|
|
private void onHandleMessage1() {
|
|
|
|
|
+ LogUtil.println("FloatService", 3);
|
|
|
AppUsage appUsage = new AppUsage();
|
|
AppUsage appUsage = new AppUsage();
|
|
|
//更新悬浮窗
|
|
//更新悬浮窗
|
|
|
long totalTimeInForeground = AppUsageManager.getInstance().getTotalTimeInForeground(appUsage);
|
|
long totalTimeInForeground = AppUsageManager.getInstance().getTotalTimeInForeground(appUsage);
|
|
|
if(!AutoTaskListUtil.getInstance().hasTask(appUsage.getPackageName())){
|
|
if(!AutoTaskListUtil.getInstance().hasTask(appUsage.getPackageName())){
|
|
|
FloatService.this.removeMessages();
|
|
FloatService.this.removeMessages();
|
|
|
mHandler.sendEmptyMessage(OPERATION_HIDE);
|
|
mHandler.sendEmptyMessage(OPERATION_HIDE);
|
|
|
|
|
+ LogUtil.println("FloatService", 5);
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
+ LogUtil.println("FloatService", 6);
|
|
|
if(!isAdded){
|
|
if(!isAdded){
|
|
|
wm.addView(floatView, params);
|
|
wm.addView(floatView, params);
|
|
|
isAdded = true;
|
|
isAdded = true;
|
|
|
|
|
+ LogUtil.println("FloatService", 7);
|
|
|
}
|
|
}
|
|
|
btn_floatView.setText(String.format(Locale.CHINA,"约运行%s",TimeUtil.getHours(totalTimeInForeground)));
|
|
btn_floatView.setText(String.format(Locale.CHINA,"约运行%s",TimeUtil.getHours(totalTimeInForeground)));
|
|
|
wm.updateViewLayout(floatView, params);
|
|
wm.updateViewLayout(floatView, params);
|
|
|
|
|
+ LogUtil.println("FloatService", 8);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
};
|
|
};
|