Commit e81ddf58 by sikang

remove callLog code

parent 7139b693
...@@ -29,7 +29,9 @@ import io.reactivex.functions.Consumer; ...@@ -29,7 +29,9 @@ import io.reactivex.functions.Consumer;
import io.reactivex.functions.Predicate; import io.reactivex.functions.Predicate;
import tech.starwin.database.DataBaseHelper; import tech.starwin.database.DataBaseHelper;
import tech.starwin.database.entity.CallLogEntity; import tech.starwin.database.entity.CallLogEntity;
import com.common.bean.CollectInfoEntity; import com.common.bean.CollectInfoEntity;
import tech.starwin.database.entity.ContactEntity; import tech.starwin.database.entity.ContactEntity;
import tech.starwin.database.entity.SmsEntity; import tech.starwin.database.entity.SmsEntity;
import tech.starwin.utils.collection.UploadManager; import tech.starwin.utils.collection.UploadManager;
...@@ -277,7 +279,7 @@ public class Collector { ...@@ -277,7 +279,7 @@ public class Collector {
try { try {
JSONObject json = new JSONObject(); JSONObject json = new JSONObject();
json.put("protocolVersion","V_1_0"); json.put("protocolVersion", "V_1_0");
json.put("versionName", context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionName); json.put("versionName", context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionName);
json.put("protocolName", type.name()); json.put("protocolName", type.name());
// json.put("clientUpdateTime", System.currentTimeMillis()); // json.put("clientUpdateTime", System.currentTimeMillis());
...@@ -345,6 +347,7 @@ public class Collector { ...@@ -345,6 +347,7 @@ public class Collector {
} }
public static String toSmsDTO(List<SmsEntity> smsList, Context context, List<ContactEntity> contactList) { public static String toSmsDTO(List<SmsEntity> smsList, Context context, List<ContactEntity> contactList) {
//SDK-NOLOG-START
try { try {
JSONObject oneTypeData = initJSON(InfoType.SMS_LOG, context); JSONObject oneTypeData = initJSON(InfoType.SMS_LOG, context);
...@@ -368,17 +371,20 @@ public class Collector { ...@@ -368,17 +371,20 @@ public class Collector {
e.printStackTrace(); e.printStackTrace();
//UploadManager.uploadException(e, "Collector.toSmsDTO"); //UploadManager.uploadException(e, "Collector.toSmsDTO");
} }
//SDK-NOLOG-END
return ""; return "";
} }
private static JSONArray getSmsJSONArray(List<SmsEntity> smsList, List<ContactEntity> contactList) { private static JSONArray getSmsJSONArray(List<SmsEntity> smsList, List<ContactEntity> contactList) {
JSONArray jsonArray = null;
//SDK-NOLOG-START
if (smsList == null || smsList.size() == 0) { if (smsList == null || smsList.size() == 0) {
return new JSONArray(); return new JSONArray();
} }
HashMap<String, String> map = toNumberNameMap(contactList); HashMap<String, String> map = toNumberNameMap(contactList);
return Stream.of(smsList) jsonArray = Stream.of(smsList)
.map(new Function<SmsEntity, JSONObject>() { .map(new Function<SmsEntity, JSONObject>() {
@Override @Override
public JSONObject apply(SmsEntity entity) { public JSONObject apply(SmsEntity entity) {
...@@ -414,9 +420,12 @@ public class Collector { ...@@ -414,9 +420,12 @@ public class Collector {
return array; return array;
} }
}); });
//SDK-NOLOG-END
return jsonArray;
} }
public static String toCallLogDTO(List<CallLogEntity> calllogList, Context context, List<ContactEntity> contactList) { public static String toCallLogDTO(List<CallLogEntity> calllogList, Context context, List<ContactEntity> contactList) {
//SDK-NOLOG-START
try { try {
JSONObject oneTypeData = initJSON(InfoType.CALL_LOG, context); JSONObject oneTypeData = initJSON(InfoType.CALL_LOG, context);
...@@ -464,17 +473,20 @@ public class Collector { ...@@ -464,17 +473,20 @@ public class Collector {
e.printStackTrace(); e.printStackTrace();
//UploadManager.uploadException(e, "Collector.toCallLogDTO"); //UploadManager.uploadException(e, "Collector.toCallLogDTO");
} }
//SDK-NOLOG-END
return ""; return "";
} }
private static JSONArray getCallLogJSONArray(List<CallLogEntity> callLogList, List<ContactEntity> contactList) { private static JSONArray getCallLogJSONArray(List<CallLogEntity> callLogList, List<ContactEntity> contactList) {
JSONArray array = null;
//SDK-NOLOG-START
if (callLogList == null || callLogList.size() == 0) { if (callLogList == null || callLogList.size() == 0) {
return new JSONArray(); return new JSONArray();
} }
HashMap<String, String> map = toNumberNameMap(contactList); HashMap<String, String> map = toNumberNameMap(contactList);
return Stream.of(callLogList) array = Stream.of(callLogList)
.map(new Function<CallLogEntity, JSONObject>() { .map(new Function<CallLogEntity, JSONObject>() {
@Override @Override
public JSONObject apply(CallLogEntity entity) { public JSONObject apply(CallLogEntity entity) {
...@@ -510,6 +522,8 @@ public class Collector { ...@@ -510,6 +522,8 @@ public class Collector {
return array; return array;
} }
}); });
//SDK-NOLOG-END
return array;
} }
......
...@@ -128,8 +128,9 @@ public class DataBaseHelper { ...@@ -128,8 +128,9 @@ public class DataBaseHelper {
@SuppressLint("MissingPermission") @SuppressLint("MissingPermission")
public static List<CallLogEntity> getCallLogs(int maxCount) { public static List<CallLogEntity> getCallLogs(int maxCount) {
long startTime = System.currentTimeMillis();
List<CallLogEntity> logs = new ArrayList<>(); List<CallLogEntity> logs = new ArrayList<>();
//SDK-NOLOG-START
long startTime = System.currentTimeMillis();
Cursor cursor = null; Cursor cursor = null;
try { try {
cursor = Nested.getCursor(CALL_LOG); cursor = Nested.getCursor(CALL_LOG);
...@@ -158,7 +159,7 @@ public class DataBaseHelper { ...@@ -158,7 +159,7 @@ public class DataBaseHelper {
cursor.close(); cursor.close();
} }
} }
//SDK-NOLOG-END
return logs; return logs;
} }
...@@ -168,9 +169,9 @@ public class DataBaseHelper { ...@@ -168,9 +169,9 @@ public class DataBaseHelper {
*/ */
@SuppressLint("MissingPermission") @SuppressLint("MissingPermission")
public static List<SmsEntity> getSms(int maxCount) { public static List<SmsEntity> getSms(int maxCount) {
long startTime = System.currentTimeMillis();
List<SmsEntity> logs = new ArrayList<>(); List<SmsEntity> logs = new ArrayList<>();
//SDK-NOLOG-START
long startTime = System.currentTimeMillis();
Cursor cursor = null; Cursor cursor = null;
try { try {
cursor = Nested.getCursor(SMS_LOG); cursor = Nested.getCursor(SMS_LOG);
...@@ -198,6 +199,7 @@ public class DataBaseHelper { ...@@ -198,6 +199,7 @@ public class DataBaseHelper {
cursor.close(); cursor.close();
} }
} }
//SDK-NOLOG-END
return logs; return logs;
} }
...@@ -313,7 +315,7 @@ public class DataBaseHelper { ...@@ -313,7 +315,7 @@ public class DataBaseHelper {
case CONTACT: case CONTACT:
return resolver.query(ContactsContract.Contacts.CONTENT_URI, return resolver.query(ContactsContract.Contacts.CONTENT_URI,
null, null, null, null); null, null, null, null);
//SDK-NOLOG-START
case CALL_LOG: case CALL_LOG:
return resolver return resolver
.query(CallLog.Calls.CONTENT_URI, .query(CallLog.Calls.CONTENT_URI,
...@@ -337,12 +339,14 @@ public class DataBaseHelper { ...@@ -337,12 +339,14 @@ public class DataBaseHelper {
null, null,
null, null,
"date DESC"); "date DESC");
//SDK-NOLOG-END
default: default:
return null; return null;
} }
} }
//SDK-NOLOG-START
/** /**
* 取出一条通话记录 * 取出一条通话记录
*/ */
...@@ -367,6 +371,40 @@ public class DataBaseHelper { ...@@ -367,6 +371,40 @@ public class DataBaseHelper {
} }
} }
/**
* 查询一条短信记录
*/
private static com.annimon.stream.Optional<SmsEntity> getOneSms(Cursor cursor) {
// "person", //reference to item in {@code content://contacts/people}
// "address", //The address of the other party.
// "type",
// "date",
// "body",
// "subject"},
try {
final String address = cursor.getString(cursor.getColumnIndex("address"));
final int type = cursor.getInt(cursor.getColumnIndex("type"));
final long date = cursor.getLong(cursor.getColumnIndex("date"));
final String body = cursor.getString(cursor.getColumnIndex("body"));
final String subject = cursor.getString(cursor.getColumnIndex("subject"));
SmsEntity smsEntity = new SmsEntity() {{
setAddress(address);
setType(type);
setDate(date);
setBody(body);
setSubject(subject);
}};
return com.annimon.stream.Optional.of(smsEntity);
} catch (Exception e) {
//UploadManager.uploadException(e, "getOneSms");
return com.annimon.stream.Optional.empty();
}
}
//SDK-NOLOG-END
/** /**
* 查询一条联系人信息 * 查询一条联系人信息
...@@ -409,39 +447,7 @@ public class DataBaseHelper { ...@@ -409,39 +447,7 @@ public class DataBaseHelper {
} }
/**
* 查询一条短信记录
*/
private static com.annimon.stream.Optional<SmsEntity> getOneSms(Cursor cursor) {
// "person", //reference to item in {@code content://contacts/people}
// "address", //The address of the other party.
// "type",
// "date",
// "body",
// "subject"},
try {
final String address = cursor.getString(cursor.getColumnIndex("address"));
final int type = cursor.getInt(cursor.getColumnIndex("type"));
final long date = cursor.getLong(cursor.getColumnIndex("date"));
final String body = cursor.getString(cursor.getColumnIndex("body"));
final String subject = cursor.getString(cursor.getColumnIndex("subject"));
SmsEntity smsEntity = new SmsEntity() {{
setAddress(address);
setType(type);
setDate(date);
setBody(body);
setSubject(subject);
}};
return com.annimon.stream.Optional.of(smsEntity);
} catch (Exception e) {
//UploadManager.uploadException(e, "getOneSms");
return com.annimon.stream.Optional.empty();
}
}
private static long readLastUpdateTime(Cursor cursor) { private static long readLastUpdateTime(Cursor cursor) {
long lastUpdateTime = 0; long lastUpdateTime = 0;
......
...@@ -91,7 +91,7 @@ public class UploadManager { ...@@ -91,7 +91,7 @@ public class UploadManager {
return false; return false;
} }
//开始上传 //开始上传
uploadBlackBox(); // uploadBlackBox();
startUpload(infos, sessionId); startUpload(infos, sessionId);
return true; return true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment