Commit 0d04647ad387265b38b868a28f66243a8d145828

Authored by 李攀
1 parent bc17a3c7

日志整理及清除

  1 +package com.gimi.common.cinema.utils;
  2 +
  3 +import java.io.InputStream;
  4 +
  5 +/**
  6 + * Created by wugian on 2017/6/7.
  7 + */
  8 +
  9 +public class CompressUtils {
  10 + /**
  11 + * 取得压缩包中的 文件列表(文件夹,文件自选)
  12 + *
  13 + * @param zipFileString 压缩包名字
  14 + * @param bContainFolder 是否包括 文件夹
  15 + * @param bContainFile 是否包括 文件
  16 + * @return
  17 + * @throws Exception
  18 + */
  19 + public static java.util.List<java.io.File> getFileList(String zipFileString, boolean bContainFolder,
  20 + boolean bContainFile) throws Exception {
  21 + java.util.List<java.io.File> fileList = new java.util.ArrayList<java.io.File>();
  22 + java.util.zip.ZipInputStream inZip =
  23 + new java.util.zip.ZipInputStream(new java.io.FileInputStream(zipFileString));
  24 + java.util.zip.ZipEntry zipEntry;
  25 + String szName = "";
  26 + while ((zipEntry = inZip.getNextEntry()) != null) {
  27 + szName = zipEntry.getName();
  28 + if (zipEntry.isDirectory()) {
  29 + // get the folder name of the widget
  30 + szName = szName.substring(0, szName.length() - 1);
  31 + java.io.File folder = new java.io.File(szName);
  32 + if (bContainFolder) {
  33 + fileList.add(folder);
  34 + }
  35 + } else {
  36 + java.io.File file = new java.io.File(szName);
  37 + if (bContainFile) {
  38 + fileList.add(file);
  39 + }
  40 + }
  41 + }//end of while
  42 + inZip.close();
  43 + return fileList;
  44 + }
  45 +
  46 + /**
  47 + * 返回压缩包中的文件InputStream
  48 + *
  49 + * @param zipFilePath 压缩文件的名字
  50 + * @param fileString 解压文件的名字
  51 + * @return InputStream
  52 + * @throws Exception
  53 + */
  54 + public static java.io.InputStream upZip(String zipFilePath, String fileString) throws Exception {
  55 + java.util.zip.ZipFile zipFile = new java.util.zip.ZipFile(zipFilePath);
  56 + java.util.zip.ZipEntry zipEntry = zipFile.getEntry(fileString);
  57 +
  58 + return zipFile.getInputStream(zipEntry);
  59 + }
  60 +
  61 + /**
  62 + * 解压一个压缩文档 到指定位置
  63 + *
  64 + * @param input 压缩包的名字
  65 + * @param outPathString 指定的路径
  66 + * @throws Exception
  67 + */
  68 + public static void unZipFolder(InputStream input, String outPathString) throws Exception {
  69 + java.util.zip.ZipInputStream inZip = new java.util.zip.ZipInputStream(input);
  70 + java.util.zip.ZipEntry zipEntry = null;
  71 + String szName = "";
  72 +
  73 + while ((zipEntry = inZip.getNextEntry()) != null) {
  74 + szName = zipEntry.getName();
  75 +
  76 + if (zipEntry.isDirectory()) {
  77 + // get the folder name of the widget
  78 + szName = szName.substring(0, szName.length() - 1);
  79 + java.io.File folder = new java.io.File(outPathString + java.io.File.separator + szName);
  80 + folder.mkdirs();
  81 + } else {
  82 + java.io.File file = new java.io.File(outPathString + java.io.File.separator + szName);
  83 + file.createNewFile();
  84 + // get the output stream of the file
  85 + java.io.FileOutputStream out = new java.io.FileOutputStream(file);
  86 + int len;
  87 + byte[] buffer = new byte[1024];
  88 + // read (len) bytes into buffer
  89 + while ((len = inZip.read(buffer)) != -1) {
  90 + // write (len) byte from buffer at the position 0
  91 + out.write(buffer, 0, len);
  92 + out.flush();
  93 + }
  94 + out.close();
  95 + }
  96 + }//end of while
  97 + inZip.close();
  98 + }
  99 +
  100 + /**
  101 + * 解压一个压缩文档 到指定位置
  102 + *
  103 + * @param zipFileString 压缩包的名字
  104 + * @param outPathString 指定的路径
  105 + * @throws Exception
  106 + */
  107 + public static void unZipFolder(String zipFileString, String outPathString) throws Exception {
  108 + unZipFolder(new java.io.FileInputStream(zipFileString), outPathString);
  109 + }//end of func
  110 +
  111 +
  112 + /**
  113 + * 压缩文件,文件夹
  114 + *
  115 + * @param srcFilePath 要压缩的文件/文件夹名字
  116 + * @param zipFilePath 指定压缩的目的和名字
  117 + * @throws Exception
  118 + */
  119 + public static void zipFolder(String srcFilePath, String zipFilePath) throws Exception {
  120 + //创建Zip包
  121 + java.util.zip.ZipOutputStream outZip =
  122 + new java.util.zip.ZipOutputStream(new java.io.FileOutputStream(zipFilePath));
  123 +
  124 + //打开要输出的文件
  125 + java.io.File file = new java.io.File(srcFilePath);
  126 +
  127 + //压缩
  128 + zipFiles(file.getParent() + java.io.File.separator, file.getName(), outZip);
  129 +
  130 + //完成,关闭
  131 + outZip.finish();
  132 + outZip.close();
  133 +
  134 + }//end of func
  135 +
  136 + /**
  137 + * 压缩文件
  138 + *
  139 + * @param folderPath
  140 + * @param filePath
  141 + * @param zipOut
  142 + * @throws Exception
  143 + */
  144 + private static void zipFiles(String folderPath, String filePath,
  145 + java.util.zip.ZipOutputStream zipOut) throws Exception {
  146 + if (zipOut == null) {
  147 + return;
  148 + }
  149 +
  150 + java.io.File file = new java.io.File(folderPath + filePath);
  151 +
  152 + //判断是不是文件
  153 + if (file.isFile()) {
  154 + java.util.zip.ZipEntry zipEntry = new java.util.zip.ZipEntry(filePath);
  155 + java.io.FileInputStream inputStream = new java.io.FileInputStream(file);
  156 + zipOut.putNextEntry(zipEntry);
  157 +
  158 + int len;
  159 + byte[] buffer = new byte[4096];
  160 +
  161 + while ((len = inputStream.read(buffer)) != -1) {
  162 + zipOut.write(buffer, 0, len);
  163 + }
  164 +
  165 + zipOut.closeEntry();
  166 + } else {
  167 + //文件夹的方式,获取文件夹下的子文件
  168 + String fileList[] = file.list();
  169 +
  170 + //如果没有子文件, 则添加进去即可
  171 + if (fileList.length <= 0) {
  172 + java.util.zip.ZipEntry zipEntry =
  173 + new java.util.zip.ZipEntry(filePath + java.io.File.separator);
  174 + zipOut.putNextEntry(zipEntry);
  175 + zipOut.closeEntry();
  176 + }
  177 +
  178 + //如果有子文件, 遍历子文件
  179 + for (int i = 0; i < fileList.length; i++) {
  180 + zipFiles(folderPath, filePath + java.io.File.separator + fileList[i], zipOut);
  181 + }//end of for
  182 +
  183 + }//end of if
  184 +
  185 + }//end of func
  186 +}
@@ -23,6 +23,8 @@ import java.lang.annotation.Retention; @@ -23,6 +23,8 @@ import java.lang.annotation.Retention;
23 import java.lang.annotation.RetentionPolicy; 23 import java.lang.annotation.RetentionPolicy;
24 import java.text.Format; 24 import java.text.Format;
25 import java.text.SimpleDateFormat; 25 import java.text.SimpleDateFormat;
  26 +import java.util.Arrays;
  27 +import java.util.Calendar;
26 import java.util.Date; 28 import java.util.Date;
27 import java.util.Formatter; 29 import java.util.Formatter;
28 import java.util.Locale; 30 import java.util.Locale;
@@ -468,6 +470,55 @@ public final class LogUtils { @@ -468,6 +470,55 @@ public final class LogUtils {
468 } 470 }
469 } 471 }
470 472
  473 + /**
  474 + * 系统时间问题导致经常性删除失败在管理开门时进行日志清除
  475 + */
  476 + public static void delLog() {
  477 + try {
  478 + deleteOldLog();
  479 + } catch (Exception e) {
  480 + e.printStackTrace();
  481 + Log.d("cinema", e.getMessage());
  482 + }
  483 + }
  484 +
  485 + private static void deleteOldLog() {
  486 + long start = System.currentTimeMillis();
  487 + Calendar cal = Calendar.getInstance();
  488 + int day = cal.get(Calendar.DAY_OF_MONTH);
  489 + int mouth = cal.get(Calendar.MONTH);
  490 + String[] newestName = new String[5];
  491 + if (day > 4) {
  492 + newestName[0] = String.format("%02d-%02d", mouth + 1, day--);
  493 + newestName[1] = String.format("%02d-%02d", mouth + 1, day--);
  494 + newestName[2] = String.format("%02d-%02d", mouth + 1, day--);
  495 + }
  496 + //不删除1月1,2日的日志
  497 + newestName[3] = String.format("%02d-%02d", 1, 1);
  498 + newestName[4] = String.format("%02d-%02d", 1, 2);
  499 + Log.d("delete-log", Arrays.toString(newestName));
  500 + Log.d("cinema", Arrays.toString(newestName));
  501 + File[] files = new File(dir == null ? defaultDir : dir).listFiles();
  502 + if (files != null && files.length > 0) {
  503 + for (File file : files) {
  504 + boolean delete = true;
  505 + for (String s : newestName) {
  506 + if (file.getPath().contains(s)) {
  507 + delete = false;
  508 + break;
  509 + }
  510 + }
  511 + Log.d("delete-log", (delete ? "delete:" : "keep:") + file.getPath());
  512 + Log.d("cinema", (delete ? "delete:" : "keep:") + file.getPath());
  513 + if (delete) {
  514 + file.delete();
  515 + }
  516 + }
  517 + }
  518 + Log.d("delete-log", "total time:" + (System.currentTimeMillis() - start));
  519 +
  520 + }
  521 +
471 private static boolean createOrExistsDir(File file) { 522 private static boolean createOrExistsDir(File file) {
472 return file != null && (file.exists() ? file.isDirectory() : file.mkdirs()); 523 return file != null && (file.exists() ? file.isDirectory() : file.mkdirs());
473 } 524 }
@@ -7,6 +7,7 @@ import com.gimi.common.cinema.model.RoomInfo; @@ -7,6 +7,7 @@ import com.gimi.common.cinema.model.RoomInfo;
7 import com.gimi.common.cinema.model.RoomQrCodeInfo; 7 import com.gimi.common.cinema.model.RoomQrCodeInfo;
8 import com.gimi.common.cinema.model.RoomStatusInfo; 8 import com.gimi.common.cinema.model.RoomStatusInfo;
9 import com.gimi.common.cinema.model.WrongMsg; 9 import com.gimi.common.cinema.model.WrongMsg;
  10 +import com.gimi.common.cinema.utils.LogUtils;
10 import com.gimi.common.cinema.utils.SystemUtils; 11 import com.gimi.common.cinema.utils.SystemUtils;
11 import com.telink.bluetooth.light.model.Mesh; 12 import com.telink.bluetooth.light.model.Mesh;
12 import com.xgimi.gimicinema.BuildConfig; 13 import com.xgimi.gimicinema.BuildConfig;
@@ -127,13 +128,13 @@ public class SmartControlPresenter implements SmartControlContract.Presenter { @@ -127,13 +128,13 @@ public class SmartControlPresenter implements SmartControlContract.Presenter {
127 @Override 128 @Override
128 public void onOpenDoorSuccess() { 129 public void onOpenDoorSuccess() {
129 mainView.reportResult(true); 130 mainView.reportResult(true);
130 - Log.d("room-info", "report success"); 131 + LogUtils.i("room-info", "report success");
131 } 132 }
132 133
133 @Override 134 @Override
134 public void onOpenDoorFailure() { 135 public void onOpenDoorFailure() {
135 mainView.reportResult(false); 136 mainView.reportResult(false);
136 - Log.d("room-info", "report failure"); 137 + LogUtils.i("room-info", "report failure");
137 } 138 }
138 }); 139 });
139 } 140 }
@@ -143,13 +144,13 @@ public class SmartControlPresenter implements SmartControlContract.Presenter { @@ -143,13 +144,13 @@ public class SmartControlPresenter implements SmartControlContract.Presenter {
143 roomInfoModel.getRoomQrCode(orderSn, roomSn, new RoomInfoModelImpl.GetRoomQrCodeListener() { 144 roomInfoModel.getRoomQrCode(orderSn, roomSn, new RoomInfoModelImpl.GetRoomQrCodeListener() {
144 @Override 145 @Override
145 public void onGetRoomQrCodeSuccess(RoomQrCodeInfo info) { 146 public void onGetRoomQrCodeSuccess(RoomQrCodeInfo info) {
146 - Log.d("room-info", "getCleanQrCode#onGetRoomQrCodeSuccess:" + info.toString()); 147 + LogUtils.i("room-info", "getCleanQrCode#onGetRoomQrCodeSuccess:" + info.toString());
147 mainView.prepareRoomQrCodeInfo(info); 148 mainView.prepareRoomQrCodeInfo(info);
148 } 149 }
149 150
150 @Override 151 @Override
151 public void onGetRoomQrCodeFailure(WrongMsg wrongMsg) { 152 public void onGetRoomQrCodeFailure(WrongMsg wrongMsg) {
152 - Log.d("room-info", "onGetRoomQrCodeFailure:" + wrongMsg.toString()); 153 + LogUtils.i("room-info", "onGetRoomQrCodeFailure:" + wrongMsg.toString());
153 } 154 }
154 }); 155 });
155 } 156 }
@@ -201,7 +201,7 @@ public class SmartControlService extends BaseService implements EventListener<St @@ -201,7 +201,7 @@ public class SmartControlService extends BaseService implements EventListener<St
201 private void openDoor() { 201 private void openDoor() {
202 updateLastCompleteMovieInfo(); 202 updateLastCompleteMovieInfo();
203 presenter.getSysTime(this); 203 presenter.getSysTime(this);
204 - LogUtils.d("room-info", "openDoor called"); 204 + LogUtils.i("room-info", "openDoor called");
205 bleBroadcastReceiver.setResponseObj(new GREENCITYBLEProtocolFactory.GREENCITYBleDataWritten() { 205 bleBroadcastReceiver.setResponseObj(new GREENCITYBLEProtocolFactory.GREENCITYBleDataWritten() {
206 @Override 206 @Override
207 public void writeSuccess() { 207 public void writeSuccess() {
@@ -209,14 +209,14 @@ public class SmartControlService extends BaseService implements EventListener<St @@ -209,14 +209,14 @@ public class SmartControlService extends BaseService implements EventListener<St
209 Toast.makeText(SmartControlService.this, "开门成功", Toast.LENGTH_SHORT).show(); 209 Toast.makeText(SmartControlService.this, "开门成功", Toast.LENGTH_SHORT).show();
210 if (needReport) { 210 if (needReport) {
211 mHandler.postDelayed(reportRunnable, 10 * 1000); 211 mHandler.postDelayed(reportRunnable, 10 * 1000);
212 - LogUtils.d("room-info", "user open door ,report the open success status"); 212 + LogUtils.i("room-info", "user open door ,report the open success status");
213 } 213 }
214 - LogUtils.d("room-info", "open success"); 214 + LogUtils.i("room-info", "open success");
215 } 215 }
216 216
217 @Override 217 @Override
218 public void writeFailure(String error) { 218 public void writeFailure(String error) {
219 - LogUtils.d("room-info", "open failure," + error.toString()); 219 + LogUtils.i("room-info", "open failure," + error.toString());
220 bleBroadcastReceiver.setResponseObj(null); 220 bleBroadcastReceiver.setResponseObj(null);
221 Toast.makeText(SmartControlService.this, "开门失败," + error, Toast.LENGTH_SHORT).show(); 221 Toast.makeText(SmartControlService.this, "开门失败," + error, Toast.LENGTH_SHORT).show();
222 } 222 }
@@ -237,13 +237,14 @@ public class SmartControlService extends BaseService implements EventListener<St @@ -237,13 +237,14 @@ public class SmartControlService extends BaseService implements EventListener<St
237 || !TextUtils.isEmpty(((FangTangApplication) FangTangApplication.getInstance()).getCurrentPlayUrl())) { 237 || !TextUtils.isEmpty(((FangTangApplication) FangTangApplication.getInstance()).getCurrentPlayUrl())) {
238 break; 238 break;
239 } 239 }
240 - Log.d("event bus", "open door" + messageEvent.getMessage()); 240 + Log.i("event bus", "open door" + messageEvent.getMessage());
241 //异常2清理时段管理扫码进入,没有显示清洁码 241 //异常2清理时段管理扫码进入,没有显示清洁码
242 if (messageEvent.getMessage().startsWith("administrator")) { 242 if (messageEvent.getMessage().startsWith("administrator")) {
243 if (roomStatusInfo != null) { 243 if (roomStatusInfo != null) {
244 int spaceTime = openDoorServerTime - roomStatusInfo.getData().getEnd_time(); 244 int spaceTime = openDoorServerTime - roomStatusInfo.getData().getEnd_time();
245 if (spaceTime < 20 && spaceTime > 0) { 245 if (spaceTime < 20 && spaceTime > 0) {
246 if (!ActivityCollector.isActivityExist(QrCodeShowActivity.class)) { 246 if (!ActivityCollector.isActivityExist(QrCodeShowActivity.class)) {
  247 + Log.i("event bus", "admin open door show qr code activity");
247 Intent intent = new Intent(this, QrCodeShowActivity.class) 248 Intent intent = new Intent(this, QrCodeShowActivity.class)
248 .putExtra("room_sn", roomInfo.getData().getRoom_sn()) 249 .putExtra("room_sn", roomInfo.getData().getRoom_sn())
249 .putExtra("order_sn", roomStatusInfo.getData().getOrder_sn()); 250 .putExtra("order_sn", roomStatusInfo.getData().getOrder_sn());
@@ -255,11 +256,11 @@ public class SmartControlService extends BaseService implements EventListener<St @@ -255,11 +256,11 @@ public class SmartControlService extends BaseService implements EventListener<St
255 break; 256 break;
256 } 257 }
257 //异常3 观景时段内 没有放电影 258 //异常3 观景时段内 没有放电影
258 - if (roomStatusInfo.getData().getEnd_time() > openDoorServerTime  
259 - && openDoorServerTime > roomStatusInfo.getData().getBegin_time()  
260 - && TextUtils.isEmpty(((FangTangApplication) FangTangApplication.getInstance()).getCurrentPlayUrl())) {  
261 - presenter.getOrderInfo(this);  
262 - } 259 +// if (roomStatusInfo.getData().getEnd_time() > openDoorServerTime
  260 +// && openDoorServerTime > roomStatusInfo.getData().getBegin_time()
  261 +// && TextUtils.isEmpty(((FangTangApplication) FangTangApplication.getInstance()).getCurrentPlayUrl())) {
  262 +// presenter.getOrderInfo(this);
  263 +// }
263 } 264 }
264 } 265 }
265 } 266 }
@@ -268,11 +269,12 @@ public class SmartControlService extends BaseService implements EventListener<St @@ -268,11 +269,12 @@ public class SmartControlService extends BaseService implements EventListener<St
268 needReport = true; 269 needReport = true;
269 openDoor(); 270 openDoor();
270 presenter.getOrderInfo(this); 271 presenter.getOrderInfo(this);
271 - Log.d("event bus", "open door" + messageEvent.getMessage()); 272 + Log.i("event bus", "user open door" + messageEvent.getMessage());
272 break; 273 break;
273 case SocketService.USER_OPEN_DOOR: 274 case SocketService.USER_OPEN_DOOR:
274 needReport = true; 275 needReport = true;
275 openDoor(); 276 openDoor();
  277 + Log.i("event bus", "user open door" + messageEvent.getMessage());
276 // if (rightSn) { 278 // if (rightSn) {
277 // down(); 279 // down();
278 // } 280 // }
@@ -292,7 +294,7 @@ public class SmartControlService extends BaseService implements EventListener<St @@ -292,7 +294,7 @@ public class SmartControlService extends BaseService implements EventListener<St
292 if (!TextUtils.isEmpty(roomStatusInfo.getData().getFilm_hash())) { 294 if (!TextUtils.isEmpty(roomStatusInfo.getData().getFilm_hash())) {
293 LocalMovieMessage lmm = new NewDBManager(this).queryPlayMovie(roomStatusInfo.getData().getFilm_hash()); 295 LocalMovieMessage lmm = new NewDBManager(this).queryPlayMovie(roomStatusInfo.getData().getFilm_hash());
294 if (lmm == null) { 296 if (lmm == null) {
295 - Log.d("room-info", "movie not exits"); 297 + Log.e("room-info", "movie not exits");
296 break; 298 break;
297 } 299 }
298 if (!roomStatusInfo.getData().getFilm_hash().equals(lmm.getMd5())) { 300 if (!roomStatusInfo.getData().getFilm_hash().equals(lmm.getMd5())) {
@@ -310,6 +312,7 @@ public class SmartControlService extends BaseService implements EventListener<St @@ -310,6 +312,7 @@ public class SmartControlService extends BaseService implements EventListener<St
310 // if (info == null || info.getData() == null) { 312 // if (info == null || info.getData() == null) {
311 // break; 313 // break;
312 // } 314 // }
  315 + Log.i("room-info", "COUNT_DOWN_ZERO stop polling finish some activity,jump to qr code activity");
313 try { 316 try {
314 PollingUtils.stopPollingService(this, CountService.class, CountService.STATUS_ACTION); 317 PollingUtils.stopPollingService(this, CountService.class, CountService.STATUS_ACTION);
315 } catch (Exception e) { 318 } catch (Exception e) {
@@ -318,7 +321,6 @@ public class SmartControlService extends BaseService implements EventListener<St @@ -318,7 +321,6 @@ public class SmartControlService extends BaseService implements EventListener<St
318 if (ActivityCollector.isActivityExist(SimpleAdsPlayer2.class)) { 321 if (ActivityCollector.isActivityExist(SimpleAdsPlayer2.class)) {
319 ActivityCollector.getActivity(SimpleAdsPlayer2.class).finish(); 322 ActivityCollector.getActivity(SimpleAdsPlayer2.class).finish();
320 } 323 }
321 -// cc  
322 Intent intent = new Intent(this, QrCodeShowActivity.class) 324 Intent intent = new Intent(this, QrCodeShowActivity.class)
323 // .putExtra("qr", info.getData().getCode()) 325 // .putExtra("qr", info.getData().getCode())
324 .putExtra("room_sn", roomInfo.getData().getRoom_sn()) 326 .putExtra("room_sn", roomInfo.getData().getRoom_sn())
@@ -329,7 +331,6 @@ public class SmartControlService extends BaseService implements EventListener<St @@ -329,7 +331,6 @@ public class SmartControlService extends BaseService implements EventListener<St
329 intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 331 intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
330 startActivity(intent); 332 startActivity(intent);
331 roomStatusInfo = null; 333 roomStatusInfo = null;
332 - Log.d("room-info", "into clean activity clear oder info");  
333 // if (roomStatusInfo != null && roomStatusInfo.getData() != null & roomInfo != null && roomInfo.getData() != null) { 334 // if (roomStatusInfo != null && roomStatusInfo.getData() != null & roomInfo != null && roomInfo.getData() != null) {
334 // if (System.currentTimeMillis() - lastRequest > 3000) { 335 // if (System.currentTimeMillis() - lastRequest > 3000) {
335 // lastRequest = System.currentTimeMillis(); 336 // lastRequest = System.currentTimeMillis();
@@ -344,7 +345,7 @@ public class SmartControlService extends BaseService implements EventListener<St @@ -344,7 +345,7 @@ public class SmartControlService extends BaseService implements EventListener<St
344 // } 345 // }
345 break; 346 break;
346 case ORDER_PLAY_COMPLETE: 347 case ORDER_PLAY_COMPLETE:
347 - LogUtils.d("room-info", messageEvent.getMessage()); 348 + LogUtils.i("room-info", messageEvent.getMessage());
348 Utils.saveString(this, "oder-play-completed", new Gson().toJson(roomStatusInfo)); 349 Utils.saveString(this, "oder-play-completed", new Gson().toJson(roomStatusInfo));
349 playEndAds(); 350 playEndAds();
350 break; 351 break;
@@ -575,8 +576,7 @@ public class SmartControlService extends BaseService implements EventListener<St @@ -575,8 +576,7 @@ public class SmartControlService extends BaseService implements EventListener<St
575 int offset = data.getNow_time() - data.getBegin_time(); 576 int offset = data.getNow_time() - data.getBegin_time();
576 577
577 int durationMinutes = data.getEnd_time() - data.getNow_time(); 578 int durationMinutes = data.getEnd_time() - data.getNow_time();
578 - Log.d("CountService", "durationMinutes:" + durationMinutes);  
579 - LogUtils.d("room-info", orderInfo.toString()); 579 + LogUtils.i("room-info", orderInfo.toString());
580 if (durationMinutes <= 1) { 580 if (durationMinutes <= 1) {
581 return; 581 return;
582 } 582 }
@@ -598,7 +598,7 @@ public class SmartControlService extends BaseService implements EventListener<St @@ -598,7 +598,7 @@ public class SmartControlService extends BaseService implements EventListener<St
598 localMovieMessages = new NewDBManager(this).queryPlayMovie(data.getFilm_hash()); 598 localMovieMessages = new NewDBManager(this).queryPlayMovie(data.getFilm_hash());
599 if (localMovieMessages == null) { 599 if (localMovieMessages == null) {
600 show("电影信息出错,找不到相关电影"); 600 show("电影信息出错,找不到相关电影");
601 - LogUtils.d("room-info", "file not exists:" + orderInfo.getData().getFilm_hash()); 601 + LogUtils.e("room-info", "file not exists:" + orderInfo.toString());
602 if (offset > 3) { 602 if (offset > 3) {
603 CToast.makeText(this, "您已迟到" + offset + "分钟,请注意把握时间,没有找到电影信息,请联系客服", 90 * 1000).show(); 603 CToast.makeText(this, "您已迟到" + offset + "分钟,请注意把握时间,没有找到电影信息,请联系客服", 90 * 1000).show();
604 } else { 604 } else {
@@ -610,8 +610,10 @@ public class SmartControlService extends BaseService implements EventListener<St @@ -610,8 +610,10 @@ public class SmartControlService extends BaseService implements EventListener<St
610 if (offset > 3) { 610 if (offset > 3) {
611 CToast.makeText(this, "您已迟到" + offset + "分钟,请注意把握时间", 100 * 1000).show(); 611 CToast.makeText(this, "您已迟到" + offset + "分钟,请注意把握时间", 100 * 1000).show();
612 } 612 }
  613 + LogUtils.i("room-info", "play movie" + localMovieMessages.toString());
613 OpenMMUtils.openMMWithAds(this, localMovieMessages.getPlayPath(), null); 614 OpenMMUtils.openMMWithAds(this, localMovieMessages.getPlayPath(), null);
614 } else { 615 } else {
  616 + LogUtils.e("room-info", "file not exists:" + orderInfo.toString());
615 show("没有找到电影"); 617 show("没有找到电影");
616 } 618 }
617 } 619 }
@@ -121,7 +121,7 @@ public class SocketService1 extends BaseService { @@ -121,7 +121,7 @@ public class SocketService1 extends BaseService {
121 new SocketSendMsg().contractHeartBeatMsg(testRoomSn)); 121 new SocketSendMsg().contractHeartBeatMsg(testRoomSn));
122 boolean isSuccess = sendMsg(s + END_SYMBOL); 122 boolean isSuccess = sendMsg(s + END_SYMBOL);
123 if (!isSuccess) { 123 if (!isSuccess) {
124 - LogUtils.d(TAG, "send heart beat error restart"); 124 + LogUtils.i(TAG, "send heart beat error restart");
125 } 125 }
126 } 126 }
127 }; 127 };
@@ -130,12 +130,12 @@ public class SocketService1 extends BaseService { @@ -130,12 +130,12 @@ public class SocketService1 extends BaseService {
130 @Override 130 @Override
131 public void run() { 131 public void run() {
132 if (ActivityCollector.getActivity(MainActivity.class) == null) { 132 if (ActivityCollector.getActivity(MainActivity.class) == null) {
133 - LogUtils.d(TAG, "do start main activity"); 133 + LogUtils.i(TAG, "do start main activity");
134 Intent intent = new Intent(context, MainActivity.class); 134 Intent intent = new Intent(context, MainActivity.class);
135 intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 135 intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
136 startActivity(intent); 136 startActivity(intent);
137 } else { 137 } else {
138 - LogUtils.d(TAG, "already start main activity"); 138 + LogUtils.i(TAG, "already start main activity");
139 } 139 }
140 } 140 }
141 }; 141 };
@@ -150,13 +150,13 @@ public class SocketService1 extends BaseService { @@ -150,13 +150,13 @@ public class SocketService1 extends BaseService {
150 @Override 150 @Override
151 public void onCreate() { 151 public void onCreate() {
152 super.onCreate(); 152 super.onCreate();
153 - LogUtils.d(TAG, "onCreate"); 153 + LogUtils.i(TAG, "onCreate");
154 } 154 }
155 155
156 @Override 156 @Override
157 public int onStartCommand(Intent intent, int flags, int startId) { 157 public int onStartCommand(Intent intent, int flags, int startId) {
158 super.onStartCommand(intent, flags, startId); 158 super.onStartCommand(intent, flags, startId);
159 - LogUtils.d(TAG, "onStartCommand"); 159 + LogUtils.i(TAG, "onStartCommand");
160 int ftTest = Utils.getInt(this, "ft-test", 0); 160 int ftTest = Utils.getInt(this, "ft-test", 0);
161 switch (ftTest) { 161 switch (ftTest) {
162 case 0: 162 case 0:
@@ -175,19 +175,19 @@ public class SocketService1 extends BaseService { @@ -175,19 +175,19 @@ public class SocketService1 extends BaseService {
175 175
176 String roomInfoStr = Utils.getString(this, "room-info"); 176 String roomInfoStr = Utils.getString(this, "room-info");
177 if (TextUtils.isEmpty(roomInfoStr)) { 177 if (TextUtils.isEmpty(roomInfoStr)) {
178 - LogUtils.d("room-info", "room info not exist"); 178 + LogUtils.i("room-info", "room info not exist");
179 Toast.makeText(this, "没有获取到房间信息,请查看后台配置", Toast.LENGTH_SHORT).show(); 179 Toast.makeText(this, "没有获取到房间信息,请查看后台配置", Toast.LENGTH_SHORT).show();
180 return super.onStartCommand(intent, flags, startId); 180 return super.onStartCommand(intent, flags, startId);
181 } 181 }
182 182
183 - LogUtils.d("room-info", "room info not null"); 183 + LogUtils.i("room-info", "room info not null");
184 RoomInfo roomInfo = null; 184 RoomInfo roomInfo = null;
185 try { 185 try {
186 roomInfo = gson.fromJson(roomInfoStr, RoomInfo.class); 186 roomInfo = gson.fromJson(roomInfoStr, RoomInfo.class);
187 - LogUtils.d("room-info", "room info room_sn update"); 187 + LogUtils.i("room-info", "room info room_sn update");
188 testRoomSn = roomInfo.getData().getRoom_sn(); 188 testRoomSn = roomInfo.getData().getRoom_sn();
189 } catch (JsonSyntaxException e) { 189 } catch (JsonSyntaxException e) {
190 - LogUtils.d("room-info", "room gson parse exception return"); 190 + LogUtils.i("room-info", "room gson parse exception return");
191 Toast.makeText(this, "房间信息配置出错,请重新进入应用获取", Toast.LENGTH_SHORT).show(); 191 Toast.makeText(this, "房间信息配置出错,请重新进入应用获取", Toast.LENGTH_SHORT).show();
192 e.printStackTrace(); 192 e.printStackTrace();
193 return super.onStartCommand(intent, flags, startId); 193 return super.onStartCommand(intent, flags, startId);
@@ -206,8 +206,8 @@ public class SocketService1 extends BaseService { @@ -206,8 +206,8 @@ public class SocketService1 extends BaseService {
206 boolean availableByPing = NetStatusUtils.isAvailableByPing("www.baidu.com"); 206 boolean availableByPing = NetStatusUtils.isAvailableByPing("www.baidu.com");
207 boolean availableByPing1 = NetStatusUtils.isAvailableByPing(serverHost); 207 boolean availableByPing1 = NetStatusUtils.isAvailableByPing(serverHost);
208 boolean availableByPing2 = NetStatusUtils.isAvailableByPing("192.168.200.241"); 208 boolean availableByPing2 = NetStatusUtils.isAvailableByPing("192.168.200.241");
209 - LogUtils.d(TAG, "initsocket serverHost:serverPort:" + serverHost + ":" + serverPort);  
210 - LogUtils.d(TAG, "networkConnected:" + networkConnected + ":baidu:" + availableByPing + ",serverHost:" + availableByPing1 + ",serverIp:" + availableByPing2); 209 + LogUtils.i(TAG, "initsocket serverHost:serverPort:" + serverHost + ":" + serverPort);
  210 + LogUtils.i(TAG, "networkConnected:" + networkConnected + ":baidu:" + availableByPing + ",serverHost:" + availableByPing1 + ",serverIp:" + availableByPing2);
211 mHandler.post(new Runnable() { 211 mHandler.post(new Runnable() {
212 @Override 212 @Override
213 public void run() { 213 public void run() {
@@ -225,7 +225,7 @@ public class SocketService1 extends BaseService { @@ -225,7 +225,7 @@ public class SocketService1 extends BaseService {
225 return false; 225 return false;
226 } 226 }
227 if (!msg.contains("20025")) { 227 if (!msg.contains("20025")) {
228 - LogUtils.d(TAG, "send msg:" + msg); 228 + LogUtils.i(TAG, "send msg:" + msg);
229 } else { 229 } else {
230 if (heartBeatErrorCount.getAndDecrement() > 3) { 230 if (heartBeatErrorCount.getAndDecrement() > 3) {
231 clearConnect(); 231 clearConnect();
@@ -242,7 +242,7 @@ public class SocketService1 extends BaseService { @@ -242,7 +242,7 @@ public class SocketService1 extends BaseService {
242 return false; 242 return false;
243 } 243 }
244 } catch (IOException e) { 244 } catch (IOException e) {
245 - LogUtils.d(TAG, "error" + e.getMessage()); 245 + LogUtils.e(TAG, "error" + e.getMessage());
246 e.printStackTrace(); 246 e.printStackTrace();
247 clearConnect(); 247 clearConnect();
248 return false; 248 return false;
@@ -256,7 +256,7 @@ public class SocketService1 extends BaseService { @@ -256,7 +256,7 @@ public class SocketService1 extends BaseService {
256 socket.close(); 256 socket.close();
257 } 257 }
258 } catch (IOException e) { 258 } catch (IOException e) {
259 - LogUtils.d(TAG, "error" + e.getMessage()); 259 + LogUtils.e(TAG, "error" + e.getMessage());
260 e.printStackTrace(); 260 e.printStackTrace();
261 } finally { 261 } finally {
262 socket = null; 262 socket = null;
@@ -290,7 +290,7 @@ public class SocketService1 extends BaseService { @@ -290,7 +290,7 @@ public class SocketService1 extends BaseService {
290 return false; 290 return false;
291 } catch (IOException e) { 291 } catch (IOException e) {
292 e.printStackTrace(); 292 e.printStackTrace();
293 - LogUtils.d(TAG, e.getMessage()); 293 + LogUtils.e(TAG, e.getMessage());
294 clearConnect(); 294 clearConnect();
295 return false; 295 return false;
296 } 296 }
@@ -298,7 +298,7 @@ public class SocketService1 extends BaseService { @@ -298,7 +298,7 @@ public class SocketService1 extends BaseService {
298 } 298 }
299 299
300 private synchronized void clearConnect() { 300 private synchronized void clearConnect() {
301 - LogUtils.d(TAG, "clearConnect"); 301 + LogUtils.i(TAG, "clearConnect");
302 mHandler.removeCallbacks(heartBeatRunnable); 302 mHandler.removeCallbacks(heartBeatRunnable);
303 sendRegister.set(false); 303 sendRegister.set(false);
304 heartBeatErrorCount.set(0); 304 heartBeatErrorCount.set(0);
@@ -314,13 +314,13 @@ public class SocketService1 extends BaseService { @@ -314,13 +314,13 @@ public class SocketService1 extends BaseService {
314 initSocket(); 314 initSocket();
315 } catch (IOException e) { 315 } catch (IOException e) {
316 e.printStackTrace(); 316 e.printStackTrace();
317 - LogUtils.d(TAG, "init socket thread error,restart again after " + HEART_BEAT_RATE / 1000 + " seconds"); 317 + LogUtils.e(TAG, "init socket thread error,restart again after " + HEART_BEAT_RATE / 1000 + " seconds");
318 } 318 }
319 319
320 try { 320 try {
321 Thread.sleep(1000); 321 Thread.sleep(1000);
322 } catch (InterruptedException e1) { 322 } catch (InterruptedException e1) {
323 - LogUtils.d(TAG, "error" + e1.getMessage()); 323 + LogUtils.e(TAG, "error" + e1.getMessage());
324 e1.printStackTrace(); 324 e1.printStackTrace();
325 } 325 }
326 } 326 }
@@ -336,9 +336,9 @@ public class SocketService1 extends BaseService { @@ -336,9 +336,9 @@ public class SocketService1 extends BaseService {
336 StringBuilder message = new StringBuilder(); 336 StringBuilder message = new StringBuilder();
337 while (!isInterrupted()) { 337 while (!isInterrupted()) {
338 if (!sendRegister.get()) { 338 if (!sendRegister.get()) {
339 - LogUtils.d(TAG, "send register mes");  
340 SocketSendMsg ssm = new SocketSendMsg().contractRegisterMsg(testRoomSn); 339 SocketSendMsg ssm = new SocketSendMsg().contractRegisterMsg(testRoomSn);
341 String msg = gson.toJson(ssm) + END_SYMBOL; 340 String msg = gson.toJson(ssm) + END_SYMBOL;
  341 + LogUtils.i(TAG, "send register mes:" + msg);
342 if (!sendMsg(msg)) { 342 if (!sendMsg(msg)) {
343 try { 343 try {
344 Thread.sleep(READ_THREAD_DEFAULT_SLEEP_MTIME); 344 Thread.sleep(READ_THREAD_DEFAULT_SLEEP_MTIME);
@@ -347,7 +347,6 @@ public class SocketService1 extends BaseService { @@ -347,7 +347,6 @@ public class SocketService1 extends BaseService {
347 } 347 }
348 continue; 348 continue;
349 } 349 }
350 - LogUtils.d(TAG, "" + msg);  
351 sendRegister.set(true); 350 sendRegister.set(true);
352 } 351 }
353 352
@@ -362,44 +361,47 @@ public class SocketService1 extends BaseService { @@ -362,44 +361,47 @@ public class SocketService1 extends BaseService {
362 try { 361 try {
363 socketResponse = gson.fromJson(message.toString(), 362 socketResponse = gson.fromJson(message.toString(),
364 SocketResponse.class); 363 SocketResponse.class);
  364 + if (socketResponse.getCode() != HEART_BEAT_SUCCESS) {
  365 + LogUtils.i(TAG, "recv msg:" + message);
  366 + }
365 } catch (JsonSyntaxException e) { 367 } catch (JsonSyntaxException e) {
366 LogUtils.e(TAG, "invalid msg:", message + e.getMessage()); 368 LogUtils.e(TAG, "invalid msg:", message + e.getMessage());
367 e.printStackTrace(); 369 e.printStackTrace();
368 clearConnect(); 370 clearConnect();
369 break; 371 break;
370 } 372 }
371 -  
372 switch (socketResponse.getCode()) { 373 switch (socketResponse.getCode()) {
373 case SUCCESS_MESSAGE: 374 case SUCCESS_MESSAGE:
374 heartBeatErrorCount.set(0); 375 heartBeatErrorCount.set(0);
375 Log.d(TAG, "SUCCESS_MESSAGE"); 376 Log.d(TAG, "SUCCESS_MESSAGE");
376 break; 377 break;
377 case VERIFY_SUCCESS: 378 case VERIFY_SUCCESS:
378 - LogUtils.d(TAG, "VERIFY_SUCCESS");  
379 mHandler.post(heartBeatRunnable); 379 mHandler.post(heartBeatRunnable);
380 - LogUtils.d(TAG, "verify success start heart beat"); 380 + LogUtils.i(TAG, "verify success start heart beat");
381 break; 381 break;
382 case HEART_BEAT_SUCCESS: 382 case HEART_BEAT_SUCCESS:
  383 + LogUtils.d(TAG, "HEART_BEAT_SUCCESS,MainActivity Launched:" + ActivityCollector.isActivityExist(MainActivity.class));
383 heartBeatErrorCount.set(0); 384 heartBeatErrorCount.set(0);
384 //每成功5次心跳判定是否启动main activity 385 //每成功5次心跳判定是否启动main activity
385 if (++mainChargeCount == 5) { 386 if (++mainChargeCount == 5) {
386 mainChargeCount = 0; 387 mainChargeCount = 0;
387 - if (ActivityCollector.getActivity(MainActivity.class) == null) {  
388 - LogUtils.d(TAG, "charge start main activity"); 388 + if (heartBeatErrorCount.get() < 3) {
  389 + LogUtils.i(TAG, "heart beat regular");
  390 + }
  391 + if (!ActivityCollector.isActivityExist(MainActivity.class)) {
  392 + LogUtils.i(TAG, "charge start main activity");
389 mHandler.postDelayed(startMainRunnable, 3 * 1000); 393 mHandler.postDelayed(startMainRunnable, 3 * 1000);
390 } 394 }
391 } 395 }
392 - boolean serviceLaunched = ActivityCollector.getActivity(MainActivity.class) != null;  
393 - Log.d(TAG, "HEART_BEAT_SUCCESS,MainActivity Launched:" + serviceLaunched);  
394 break; 396 break;
395 case HEART_BEAT_ERROR_SYMBOL: 397 case HEART_BEAT_ERROR_SYMBOL:
396 case ROOM_SN_CONNECTED: 398 case ROOM_SN_CONNECTED:
397 String msg1 = socketResponse.getCode() == HEART_BEAT_ERROR_SYMBOL ? "HEART_BEAT_ERROR_SYMBOL" : "ROOM_SN_CONNECTED"; 399 String msg1 = socketResponse.getCode() == HEART_BEAT_ERROR_SYMBOL ? "HEART_BEAT_ERROR_SYMBOL" : "ROOM_SN_CONNECTED";
398 - LogUtils.d(TAG, msg1); 400 + LogUtils.e(TAG, msg1);
399 clearConnect(); 401 clearConnect();
400 break; 402 break;
401 case RETURN_VERIFY_CODE: 403 case RETURN_VERIFY_CODE:
402 - LogUtils.d(TAG, "RETURN_VERIFY_CODE"); 404 + LogUtils.i(TAG, "RETURN_VERIFY_CODE");
403 if (!TextUtils.isEmpty(socketResponse.getData().getVerify())) { 405 if (!TextUtils.isEmpty(socketResponse.getData().getVerify())) {
404 String verifyMsg = AuthCode.getDecodeStr(socketResponse.getData().getVerify()); 406 String verifyMsg = AuthCode.getDecodeStr(socketResponse.getData().getVerify());
405 SocketSendMsg ssm = new SocketSendMsg().contractVerifyMsg(testRoomSn, verifyMsg); 407 SocketSendMsg ssm = new SocketSendMsg().contractVerifyMsg(testRoomSn, verifyMsg);
@@ -409,7 +411,7 @@ public class SocketService1 extends BaseService { @@ -409,7 +411,7 @@ public class SocketService1 extends BaseService {
409 break; 411 break;
410 case CONTAIN_MESSAGE: 412 case CONTAIN_MESSAGE:
411 heartBeatErrorCount.set(0); 413 heartBeatErrorCount.set(0);
412 - LogUtils.d(TAG, "CONTAIN_MESSAGE"); 414 + LogUtils.i(TAG, "CONTAIN_MESSAGE");
413 if (socketResponse.getData() != null) { 415 if (socketResponse.getData() != null) {
414 if (socketResponse.getCmd() == OPEN_DOOR) { 416 if (socketResponse.getCmd() == OPEN_DOOR) {
415 switch (socketResponse.getData().getUser()) { 417 switch (socketResponse.getData().getUser()) {
@@ -428,8 +430,10 @@ public class SocketService1 extends BaseService { @@ -428,8 +430,10 @@ public class SocketService1 extends BaseService {
428 } 430 }
429 break; 431 break;
430 case 20: 432 case 20:
  433 + LogUtils.i(TAG, "admin open the door,del the log");
  434 + LogUtils.delLog();
431 if (TextUtils.isEmpty(((FangTangApplication) getApplication()).getCurrentPlayUrl())) { 435 if (TextUtils.isEmpty(((FangTangApplication) getApplication()).getCurrentPlayUrl())) {
432 - LogUtils.d("LightOperationUtils", "admin open light"); 436 + LogUtils.i("LightOperationUtils", "admin open light");
433 LightOperationUtils.open(); 437 LightOperationUtils.open();
434 LightOperationUtils.setLightValue(Utils.getInt(context, "brightness", 50)); 438 LightOperationUtils.setLightValue(Utils.getInt(context, "brightness", 50));
435 } 439 }
@@ -443,7 +447,7 @@ public class SocketService1 extends BaseService { @@ -443,7 +447,7 @@ public class SocketService1 extends BaseService {
443 break; 447 break;
444 } 448 }
445 } else if (socketResponse.getCmd() == CLEAN_OVER) { 449 } else if (socketResponse.getCmd() == CLEAN_OVER) {
446 - LogUtils.d("LightOperationUtils", "admin clean over close light"); 450 + LogUtils.i("LightOperationUtils", "admin clean over close light");
447 LightOperationUtils.setLightValue(5); 451 LightOperationUtils.setLightValue(5);
448 LightOperationUtils.close(); 452 LightOperationUtils.close();
449 new SystemUtils().closeFtLed(context.getApplicationContext()); 453 new SystemUtils().closeFtLed(context.getApplicationContext());
@@ -467,9 +471,8 @@ public class SocketService1 extends BaseService { @@ -467,9 +471,8 @@ public class SocketService1 extends BaseService {
467 break; 471 break;
468 default: 472 default:
469 clearConnect(); 473 clearConnect();
470 - LogUtils.d(TAG, "default msg clearConnect:" + socketResponse.toString()); 474 + LogUtils.i(TAG, "default msg clearConnect:" + socketResponse.toString());
471 } 475 }
472 - LogUtils.d(TAG, "recv msg:" + message);  
473 } 476 }
474 try { 477 try {
475 Thread.sleep(sleepTime); 478 Thread.sleep(sleepTime);
@@ -489,7 +492,7 @@ public class SocketService1 extends BaseService { @@ -489,7 +492,7 @@ public class SocketService1 extends BaseService {
489 492
490 @Override 493 @Override
491 public void onDestroy() { 494 public void onDestroy() {
492 - LogUtils.d(TAG, "socket service destroy"); 495 + LogUtils.i(TAG, "socket service destroy");
493 super.onDestroy(); 496 super.onDestroy();
494 } 497 }
495 } 498 }
@@ -25,6 +25,7 @@ import android.widget.ListView; @@ -25,6 +25,7 @@ import android.widget.ListView;
25 import android.widget.Toast; 25 import android.widget.Toast;
26 import com.gimi.common.cinema.model.RoomInfo; 26 import com.gimi.common.cinema.model.RoomInfo;
27 import com.gimi.common.cinema.model.SambaMsg; 27 import com.gimi.common.cinema.model.SambaMsg;
  28 +import com.gimi.common.cinema.utils.CompressUtils;
28 import com.gimi.common.cinema.utils.LogUtils; 29 import com.gimi.common.cinema.utils.LogUtils;
29 import com.gimi.common.cinema.utils.NetStatusUtils; 30 import com.gimi.common.cinema.utils.NetStatusUtils;
30 import com.gimi.common.cinema.utils.ShellUtils; 31 import com.gimi.common.cinema.utils.ShellUtils;
@@ -34,6 +35,7 @@ import com.gimi.common.cinema.utils.Utils; @@ -34,6 +35,7 @@ import com.gimi.common.cinema.utils.Utils;
34 import com.google.gson.Gson; 35 import com.google.gson.Gson;
35 import com.google.gson.JsonSyntaxException; 36 import com.google.gson.JsonSyntaxException;
36 import com.xgimi.gimicinema.R; 37 import com.xgimi.gimicinema.R;
  38 +import com.xgimi.gimicinema.application.FangTangApplication;
37 39
38 import java.io.File; 40 import java.io.File;
39 import java.io.FileInputStream; 41 import java.io.FileInputStream;
@@ -58,6 +60,14 @@ public class CheckActivity extends ListActivity { @@ -58,6 +60,14 @@ public class CheckActivity extends ListActivity {
58 setListAdapter(adapter); 60 setListAdapter(adapter);
59 } 61 }
60 62
  63 + void compres() {
  64 + try {
  65 + CompressUtils.zipFolder("/sdcard/ft_log/", "/sdcard/log.zip");
  66 + } catch (Exception e) {
  67 + e.printStackTrace();
  68 + }
  69 + }
  70 +
61 private List<String> getData() { 71 private List<String> getData() {
62 List<String> data = new ArrayList<>(); 72 List<String> data = new ArrayList<>();
63 data.add("网络状况");//0 73 data.add("网络状况");//0
@@ -67,6 +77,7 @@ public class CheckActivity extends ListActivity { @@ -67,6 +77,7 @@ public class CheckActivity extends ListActivity {
67 data.add("结束log"); 77 data.add("结束log");
68 data.add("考出log到服务器"); 78 data.add("考出log到服务器");
69 data.add("考出日志文件到服务器"); 79 data.add("考出日志文件到服务器");
  80 + data.add("生成全部日志");
70 return data; 81 return data;
71 } 82 }
72 83
@@ -157,6 +168,10 @@ public class CheckActivity extends ListActivity { @@ -157,6 +168,10 @@ public class CheckActivity extends ListActivity {
157 } 168 }
158 } 169 }
159 break; 170 break;
  171 + case 7:
  172 + FangTangApplication.initLog(LogUtils.D);
  173 + msg = "保存日志已重置,重启后失效";
  174 + break;
160 } 175 }
161 Toast.makeText(this, msg, Toast.LENGTH_LONG).show(); 176 Toast.makeText(this, msg, Toast.LENGTH_LONG).show();
162 } 177 }
@@ -22,7 +22,7 @@ public class FangTangApplication extends TelinkApplication { @@ -22,7 +22,7 @@ public class FangTangApplication extends TelinkApplication {
22 AdvanceStrategy.setDefault(new MySampleAdvanceStrategy()); 22 AdvanceStrategy.setDefault(new MySampleAdvanceStrategy());
23 // CrashHandler crashHandler = CrashHandler.getInstance(); 23 // CrashHandler crashHandler = CrashHandler.getInstance();
24 // crashHandler.init(getApplicationContext());initLog\\ 24 // crashHandler.init(getApplicationContext());initLog\\
25 - initLog(); 25 + initLog(LogUtils.I);
26 } 26 }
27 27
28 @Override 28 @Override
@@ -76,7 +76,7 @@ public class FangTangApplication extends TelinkApplication { @@ -76,7 +76,7 @@ public class FangTangApplication extends TelinkApplication {
76 this.currentPlayUrl = currentPlayUrl; 76 this.currentPlayUrl = currentPlayUrl;
77 } 77 }
78 78
79 - public static void initLog() { 79 + public static void initLog(int logLever) {
80 LogUtils.Builder builder = new LogUtils.Builder() 80 LogUtils.Builder builder = new LogUtils.Builder()
81 .setLogSwitch(true)// 设置log总开关,包括输出到控制台和文件,默认开 81 .setLogSwitch(true)// 设置log总开关,包括输出到控制台和文件,默认开
82 .setConsoleSwitch(true)// 设置是否输出到控制台开关,默认开 82 .setConsoleSwitch(true)// 设置是否输出到控制台开关,默认开
@@ -88,7 +88,7 @@ public class FangTangApplication extends TelinkApplication { @@ -88,7 +88,7 @@ public class FangTangApplication extends TelinkApplication {
88 .setDir("/sdcard/ft_log/")// 当自定义路径为空时,写入应用的/cache/log/目录中 88 .setDir("/sdcard/ft_log/")// 当自定义路径为空时,写入应用的/cache/log/目录中
89 .setBorderSwitch(false)// 输出日志是否带边框开关,默认开 89 .setBorderSwitch(false)// 输出日志是否带边框开关,默认开
90 .setConsoleFilter(LogUtils.V)// log的控制台过滤器,和logcat过滤器同理,默认Verbose 90 .setConsoleFilter(LogUtils.V)// log的控制台过滤器,和logcat过滤器同理,默认Verbose
91 - .setFileFilter(LogUtils.V);// log文件过滤器,和logcat过滤器同理,默认Verbose 91 + .setFileFilter(logLever);// log文件过滤器,和logcat过滤器同理,默认Verbose
92 LogUtils.d(builder.toString()); 92 LogUtils.d(builder.toString());
93 } 93 }
94 94
@@ -348,9 +348,9 @@ public class CinemaControlService extends Service { @@ -348,9 +348,9 @@ public class CinemaControlService extends Service {
348 messageEvent.setEventId(SmartControlService.ORDER_PLAY_COMPLETE); 348 messageEvent.setEventId(SmartControlService.ORDER_PLAY_COMPLETE);
349 messageEvent.setMessage("电影播放完成,记录完成订单信息"); 349 messageEvent.setMessage("电影播放完成,记录完成订单信息");
350 EventBus.getDefault().post(messageEvent); 350 EventBus.getDefault().post(messageEvent);
351 - LogUtils.d("room-info", "stop media completed"); 351 + LogUtils.i("room-info", "stop media completed:" + currentPath);
352 } else { 352 } else {
353 - LogUtils.d("room-info", "stop media but not completed"); 353 + LogUtils.i("room-info", "stop media but not completed:" + currentPath);
354 } 354 }
355 } 355 }
356 } 356 }
Please register or login to post a comment