Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lib_base
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sikang
lib_base
Commits
e81ddf58
Commit
e81ddf58
authored
Sep 12, 2019
by
sikang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove callLog code
parent
7139b693
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
61 additions
and
41 deletions
+61
-41
src/main/java/com/common/Collector.java
+17
-3
src/main/java/tech/starwin/database/DataBaseHelper.java
+43
-37
src/main/java/tech/starwin/utils/collection/UploadManager.java
+1
-1
No files found.
src/main/java/com/common/Collector.java
View file @
e81ddf58
...
...
@@ -29,7 +29,9 @@ import io.reactivex.functions.Consumer;
import
io.reactivex.functions.Predicate
;
import
tech.starwin.database.DataBaseHelper
;
import
tech.starwin.database.entity.CallLogEntity
;
import
com.common.bean.CollectInfoEntity
;
import
tech.starwin.database.entity.ContactEntity
;
import
tech.starwin.database.entity.SmsEntity
;
import
tech.starwin.utils.collection.UploadManager
;
...
...
@@ -277,7 +279,7 @@ public class Collector {
try
{
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
(
"protocolName"
,
type
.
name
());
// json.put("clientUpdateTime", System.currentTimeMillis());
...
...
@@ -345,6 +347,7 @@ public class Collector {
}
public
static
String
toSmsDTO
(
List
<
SmsEntity
>
smsList
,
Context
context
,
List
<
ContactEntity
>
contactList
)
{
//SDK-NOLOG-START
try
{
JSONObject
oneTypeData
=
initJSON
(
InfoType
.
SMS_LOG
,
context
);
...
...
@@ -368,17 +371,20 @@ public class Collector {
e
.
printStackTrace
();
//UploadManager.uploadException(e, "Collector.toSmsDTO");
}
//SDK-NOLOG-END
return
""
;
}
private
static
JSONArray
getSmsJSONArray
(
List
<
SmsEntity
>
smsList
,
List
<
ContactEntity
>
contactList
)
{
JSONArray
jsonArray
=
null
;
//SDK-NOLOG-START
if
(
smsList
==
null
||
smsList
.
size
()
==
0
)
{
return
new
JSONArray
();
}
HashMap
<
String
,
String
>
map
=
toNumberNameMap
(
contactList
);
return
Stream
.
of
(
smsList
)
jsonArray
=
Stream
.
of
(
smsList
)
.
map
(
new
Function
<
SmsEntity
,
JSONObject
>()
{
@Override
public
JSONObject
apply
(
SmsEntity
entity
)
{
...
...
@@ -414,9 +420,12 @@ public class Collector {
return
array
;
}
});
//SDK-NOLOG-END
return
jsonArray
;
}
public
static
String
toCallLogDTO
(
List
<
CallLogEntity
>
calllogList
,
Context
context
,
List
<
ContactEntity
>
contactList
)
{
//SDK-NOLOG-START
try
{
JSONObject
oneTypeData
=
initJSON
(
InfoType
.
CALL_LOG
,
context
);
...
...
@@ -464,17 +473,20 @@ public class Collector {
e
.
printStackTrace
();
//UploadManager.uploadException(e, "Collector.toCallLogDTO");
}
//SDK-NOLOG-END
return
""
;
}
private
static
JSONArray
getCallLogJSONArray
(
List
<
CallLogEntity
>
callLogList
,
List
<
ContactEntity
>
contactList
)
{
JSONArray
array
=
null
;
//SDK-NOLOG-START
if
(
callLogList
==
null
||
callLogList
.
size
()
==
0
)
{
return
new
JSONArray
();
}
HashMap
<
String
,
String
>
map
=
toNumberNameMap
(
contactList
);
return
Stream
.
of
(
callLogList
)
array
=
Stream
.
of
(
callLogList
)
.
map
(
new
Function
<
CallLogEntity
,
JSONObject
>()
{
@Override
public
JSONObject
apply
(
CallLogEntity
entity
)
{
...
...
@@ -510,6 +522,8 @@ public class Collector {
return
array
;
}
});
//SDK-NOLOG-END
return
array
;
}
...
...
src/main/java/tech/starwin/database/DataBaseHelper.java
View file @
e81ddf58
...
...
@@ -128,8 +128,9 @@ public class DataBaseHelper {
@SuppressLint
(
"MissingPermission"
)
public
static
List
<
CallLogEntity
>
getCallLogs
(
int
maxCount
)
{
long
startTime
=
System
.
currentTimeMillis
();
List
<
CallLogEntity
>
logs
=
new
ArrayList
<>();
//SDK-NOLOG-START
long
startTime
=
System
.
currentTimeMillis
();
Cursor
cursor
=
null
;
try
{
cursor
=
Nested
.
getCursor
(
CALL_LOG
);
...
...
@@ -158,7 +159,7 @@ public class DataBaseHelper {
cursor
.
close
();
}
}
//SDK-NOLOG-END
return
logs
;
}
...
...
@@ -168,9 +169,9 @@ public class DataBaseHelper {
*/
@SuppressLint
(
"MissingPermission"
)
public
static
List
<
SmsEntity
>
getSms
(
int
maxCount
)
{
long
startTime
=
System
.
currentTimeMillis
();
List
<
SmsEntity
>
logs
=
new
ArrayList
<>();
//SDK-NOLOG-START
long
startTime
=
System
.
currentTimeMillis
();
Cursor
cursor
=
null
;
try
{
cursor
=
Nested
.
getCursor
(
SMS_LOG
);
...
...
@@ -198,6 +199,7 @@ public class DataBaseHelper {
cursor
.
close
();
}
}
//SDK-NOLOG-END
return
logs
;
}
...
...
@@ -313,7 +315,7 @@ public class DataBaseHelper {
case
CONTACT:
return
resolver
.
query
(
ContactsContract
.
Contacts
.
CONTENT_URI
,
null
,
null
,
null
,
null
);
//SDK-NOLOG-START
case
CALL_LOG:
return
resolver
.
query
(
CallLog
.
Calls
.
CONTENT_URI
,
...
...
@@ -337,12 +339,14 @@ public class DataBaseHelper {
null
,
null
,
"date DESC"
);
//SDK-NOLOG-END
default
:
return
null
;
}
}
//SDK-NOLOG-START
/**
* 取出一条通话记录
*/
...
...
@@ -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 {
}
/**
* 查询一条短信记录
*/
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
)
{
long
lastUpdateTime
=
0
;
...
...
src/main/java/tech/starwin/utils/collection/UploadManager.java
View file @
e81ddf58
...
...
@@ -91,7 +91,7 @@ public class UploadManager {
return
false
;
}
//开始上传
uploadBlackBox
();
//
uploadBlackBox();
startUpload
(
infos
,
sessionId
);
return
true
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment