Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
李雅为
/
wechat_click
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
26dd3e83
authored
May 16, 2018
by
zhengli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improved click workflow
parent
9dc3c589
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
35 changed files
with
818 additions
and
76 deletions
+818
-76
agent/src/main/java/android/app/IActivityManager.java
+8
-0
agent/src/main/java/android/app/IApplicationThread.java
+5
-0
agent/src/main/java/android/app/ProfilerInfo.java
+5
-0
agent/src/main/java/com/xf/agent/AgentHandler.java
+40
-2
agent/src/main/java/com/xf/agent/Input.java
+0
-0
agentcommon/src/main/java/com/xf/agent/common/Shell.java
+2
-0
agentcommon/src/main/java/com/xf/agent/common/Types.java
+9
-0
agentcommon/src/main/java/com/xf/agent/common/req/ReqFactory.java
+40
-0
agentlib/src/main/java/com/xf/agent/wrap/AgentManager.java
+19
-0
app/build.gradle
+15
-14
app/src/main/java/com/xf/weixinclick/DebugActivity.java
+84
-0
app/src/main/java/com/xf/weixinclick/LoginActivity.java
+1
-1
app/src/main/java/com/xf/weixinclick/MainActivity.java
+3
-2
app/src/main/java/com/xf/weixinclick/NewService.java
+10
-7
app/src/main/java/com/xf/weixinclick/agent/AgentExecutor.java
+37
-0
app/src/main/java/com/xf/weixinclick/agent/AutoProcesser.java
+1
-3
app/src/main/java/com/xf/weixinclick/agent/MotionRunner.java
+30
-9
app/src/main/java/com/xf/weixinclick/agent/UiHierarchyFinder.java
+77
-13
app/src/main/java/com/xf/weixinclick/agent/auto/EnableAccessibility.java
+1
-2
app/src/main/java/com/xf/weixinclick/bean/ResponseBase.java
+3
-4
app/src/main/java/com/xf/weixinclick/core/TaskSession.java
+0
-0
app/src/main/java/com/xf/weixinclick/core/UIFinderUtils.java
+198
-0
app/src/main/java/com/xf/weixinclick/core/WXLog.java
+45
-0
app/src/main/java/com/xf/weixinclick/core/Worker.java
+10
-2
app/src/main/java/com/xf/weixinclick/core/logger/LogDB.java
+87
-0
app/src/main/java/com/xf/weixinclick/core/logger/LogMsg.java
+11
-0
app/src/main/java/com/xf/weixinclick/http/ClientApi.java
+5
-0
app/src/main/java/com/xf/weixinclick/http/HttpClientApi.java
+28
-9
app/src/main/java/com/xf/weixinclick/http/stringfactory/GsonRequestBodyConverter.java
+2
-1
app/src/main/java/com/xf/weixinclick/http/stringfactory/StringConverterFactory.java
+2
-1
app/src/main/java/com/xf/weixinclick/receiver/MyMessageReceiver.java
+2
-1
app/src/main/java/com/xf/weixinclick/utils/JsonKit.java
+10
-0
app/src/main/res/layout/activity_debug.xml
+24
-0
app/tinkerpatch.gradle
+1
-1
build.gradle
+3
-4
No files found.
agent/src/main/java/android/app/IActivityManager.java
View file @
26dd3e83
...
@@ -2,13 +2,21 @@ package android.app;
...
@@ -2,13 +2,21 @@ package android.app;
import
android.content.ContentProviderNative
;
import
android.content.ContentProviderNative
;
import
android.content.IContentProvider
;
import
android.content.IContentProvider
;
import
android.content.Intent
;
import
android.content.pm.ProviderInfo
;
import
android.content.pm.ProviderInfo
;
import
android.os.Bundle
;
import
android.os.IBinder
;
import
android.os.IBinder
;
import
android.os.Parcel
;
import
android.os.Parcel
;
import
android.os.ParcelFileDescriptor
;
import
android.os.Parcelable
;
import
android.os.Parcelable
;
import
android.os.RemoteException
;
import
android.os.RemoteException
;
public
interface
IActivityManager
{
public
interface
IActivityManager
{
public
int
startActivityAsUser
(
IApplicationThread
caller
,
String
callingPackage
,
Intent
intent
,
String
resolvedType
,
IBinder
resultTo
,
String
resultWho
,
int
requestCode
,
int
flags
,
ProfilerInfo
profilerInfo
,
Bundle
options
,
int
userId
)
throws
RemoteException
;
public
ContentProviderHolder
getContentProviderExternal
(
String
name
,
int
userId
,
IBinder
token
)
throws
RemoteException
;
public
ContentProviderHolder
getContentProviderExternal
(
String
name
,
int
userId
,
IBinder
token
)
throws
RemoteException
;
public
void
removeContentProviderExternal
(
String
name
,
IBinder
token
)
throws
RemoteException
;
public
void
removeContentProviderExternal
(
String
name
,
IBinder
token
)
throws
RemoteException
;
...
...
agent/src/main/java/android/app/IApplicationThread.java
0 → 100644
View file @
26dd3e83
package
android
.
app
;
public
interface
IApplicationThread
{
}
agent/src/main/java/android/app/ProfilerInfo.java
0 → 100644
View file @
26dd3e83
package
android
.
app
;
public
class
ProfilerInfo
{
}
agent/src/main/java/com/xf/agent/AgentHandler.java
View file @
26dd3e83
package
com
.
xf
.
agent
;
package
com
.
xf
.
agent
;
import
android.app.ActivityManagerNative
;
import
android.app.ActivityThread
;
import
android.app.ActivityThread
;
import
android.content.ComponentName
;
import
android.content.ComponentName
;
import
android.content.Context
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.hardware.input.InputManager
;
import
android.os.IBinder
;
import
android.os.IBinder
;
import
android.os.Parcelable
;
import
android.os.Parcelable
;
import
android.os.ServiceManager
;
import
android.os.ServiceManager
;
import
android.os.SystemClock
;
import
android.os.SystemClock
;
import
android.os.UserHandle
;
import
android.text.TextUtils
;
import
android.text.TextUtils
;
import
android.view.accessibility.AccessibilityManager
;
import
android.view.accessibility.AccessibilityManager
;
import
com.xf.agent.common.CallRequest
;
import
com.xf.agent.common.CallRequest
;
...
@@ -22,6 +26,7 @@ import com.xf.agent.common.server.FLog;
...
@@ -22,6 +26,7 @@ import com.xf.agent.common.server.FLog;
import
com.xf.agent.common.server.OpsDataTransfer
;
import
com.xf.agent.common.server.OpsDataTransfer
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.lang.reflect.InvocationTargetException
;
import
java.lang.reflect.InvocationTargetException
;
import
java.util.Arrays
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.Set
;
...
@@ -102,9 +107,19 @@ class AgentHandler implements OpsDataTransfer.OnRecvCallback{
...
@@ -102,9 +107,19 @@ class AgentHandler implements OpsDataTransfer.OnRecvCallback{
TypeCmd
typeCmd
=
ParcelableUtil
.
unmarshall
(
callRequest
.
data
,
TypeCmd
.
CREATOR
);
TypeCmd
typeCmd
=
ParcelableUtil
.
unmarshall
(
callRequest
.
data
,
TypeCmd
.
CREATOR
);
if
(
shell
.
isClose
()){
if
(
shell
.
isClose
()){
shell
=
Shell
.
getShell
();
shell
=
Shell
.
getShell
();
}
Result
execResult
=
null
;
try
{
execResult
=
shell
.
exec
(
typeCmd
.
command
);
}
catch
(
Throwable
e
){
if
(
e
instanceof
IllegalStateException
){
shell
=
Shell
.
getShell
();
}
e
.
printStackTrace
();
}
}
Result
execResult
=
shell
.
exec
(
typeCmd
.
command
);
FLog
.
log
(
execResult
.
toString
());
FLog
.
log
(
execResult
.
toString
());
...
@@ -130,6 +145,29 @@ class AgentHandler implements OpsDataTransfer.OnRecvCallback{
...
@@ -130,6 +145,29 @@ class AgentHandler implements OpsDataTransfer.OnRecvCallback{
MethodUtils
.
invokeExactMethod
(
service
,
"setDataEnabled"
,
true
);
MethodUtils
.
invokeExactMethod
(
service
,
"setDataEnabled"
,
true
);
FLog
.
log
(
"---restart network success --- "
);
FLog
.
log
(
"---restart network success --- "
);
}
else
if
(
callRequest
.
type
==
Types
.
START_ACTIVITY
){
Intent
intent
=
ParcelableUtil
.
unmarshall
(
callRequest
.
data
,
Intent
.
CREATOR
);
getContext
().
startActivity
(
intent
);
ActivityManagerNative
.
getDefault
().
startActivityAsUser
(
null
,
null
,
intent
,
null
,
null
,
null
,
0
,
0
,
null
,
null
,
0
);
}
else
if
(
callRequest
.
type
==
Types
.
INPUT_EVENT
){
String
args
=
new
String
(
callRequest
.
data
);
String
[]
split
=
args
.
trim
().
split
(
"\\s+"
);
for
(
int
i
=
0
;
i
<
split
.
length
;
i
++)
{
split
[
i
]
=
split
[
i
].
trim
();
}
FLog
.
log
(
"input --> "
+
Arrays
.
toString
(
split
));
new
Input
().
run
(
split
);
}
else
{
}
else
{
System
.
out
.
println
(
"unknown type !"
);
System
.
out
.
println
(
"unknown type !"
);
}
}
...
...
agent/src/main/java/com/xf/agent/Input.java
0 → 100644
View file @
26dd3e83
This diff is collapsed.
Click to expand it.
agentcommon/src/main/java/com/xf/agent/common/Shell.java
View file @
26dd3e83
...
@@ -40,6 +40,7 @@ public class Shell {
...
@@ -40,6 +40,7 @@ public class Shell {
}
}
}
else
{
}
else
{
if
(
sShell
.
isClose
()){
if
(
sShell
.
isClose
()){
sShell
=
null
;
try
{
try
{
sShell
=
new
Shell
(
"sh"
);
sShell
=
new
Shell
(
"sh"
);
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
...
@@ -276,6 +277,7 @@ public class Shell {
...
@@ -276,6 +277,7 @@ public class Shell {
if
(
close
)
{
if
(
close
)
{
throw
new
IllegalStateException
(
"Unable to add commands to a closed shell"
);
throw
new
IllegalStateException
(
"Unable to add commands to a closed shell"
);
}
}
command
.
setId
(
generateCommandID
());
command
.
setId
(
generateCommandID
());
commandQueue
.
offer
(
command
);
commandQueue
.
offer
(
command
);
return
command
;
return
command
;
...
...
agentcommon/src/main/java/com/xf/agent/common/Types.java
View file @
26dd3e83
...
@@ -23,4 +23,13 @@ public final class Types {
...
@@ -23,4 +23,13 @@ public final class Types {
*/
*/
public
static
final
int
RESTART_NETWORK
=
4
;
public
static
final
int
RESTART_NETWORK
=
4
;
/**
* 启动activity
*/
public
static
final
int
START_ACTIVITY
=
5
;
/**
* 事件
*/
public
static
final
int
INPUT_EVENT
=
6
;
}
}
agentcommon/src/main/java/com/xf/agent/common/req/ReqFactory.java
0 → 100644
View file @
26dd3e83
package
com
.
xf
.
agent
.
common
.
req
;
import
android.content.Intent
;
import
com.xf.agent.common.IReq
;
import
com.xf.agent.common.ParcelableUtil
;
import
com.xf.agent.common.Types
;
public
class
ReqFactory
{
public
static
IReq
startActivity
(
final
Intent
intent
){
return
new
IReq
()
{
@Override
public
int
getType
()
{
return
Types
.
START_ACTIVITY
;
}
@Override
public
byte
[]
getData
()
{
return
ParcelableUtil
.
marshall
(
intent
);
}
};
}
public
static
IReq
inputEvent
(
final
String
event
){
return
new
IReq
()
{
@Override
public
int
getType
()
{
return
Types
.
INPUT_EVENT
;
}
@Override
public
byte
[]
getData
()
{
return
event
.
getBytes
();
}
};
}
}
agentlib/src/main/java/com/xf/agent/wrap/AgentManager.java
View file @
26dd3e83
package
com
.
xf
.
agent
.
wrap
;
package
com
.
xf
.
agent
.
wrap
;
import
android.content.Context
;
import
android.content.Context
;
import
android.content.Intent
;
import
com.xf.agent.common.CallResult
;
import
com.xf.agent.common.CallResult
;
import
com.xf.agent.common.CmdResult
;
import
com.xf.agent.common.CmdResult
;
import
com.xf.agent.common.NormalCmd
;
import
com.xf.agent.common.NormalCmd
;
import
com.xf.agent.common.ParcelableUtil
;
import
com.xf.agent.common.ParcelableUtil
;
import
com.xf.agent.common.TypeCmd
;
import
com.xf.agent.common.TypeCmd
;
import
com.xf.agent.common.Types
;
import
com.xf.agent.common.Types
;
import
com.xf.agent.common.req.ReqFactory
;
public
class
AgentManager
{
public
class
AgentManager
{
...
@@ -51,6 +53,23 @@ public class AgentManager {
...
@@ -51,6 +53,23 @@ public class AgentManager {
return
true
;
return
true
;
}
}
public
boolean
startActivity
(
Intent
intent
)
throws
Throwable
{
checkConnect
();
CallResult
result
=
mLocalServerManager
.
execNew
(
ReqFactory
.
startActivity
(
intent
));
if
(
result
!=
null
&&
result
.
throwable
!=
null
){
throw
result
.
throwable
;
}
return
true
;
}
public
boolean
input
(
String
inputEvent
)
throws
Throwable
{
checkConnect
();
CallResult
result
=
mLocalServerManager
.
execNew
(
ReqFactory
.
inputEvent
(
inputEvent
));
if
(
result
!=
null
&&
result
.
throwable
!=
null
){
throw
result
.
throwable
;
}
return
true
;
}
public
void
destory
()
{
public
void
destory
()
{
if
(
mLocalServerManager
!=
null
)
{
if
(
mLocalServerManager
!=
null
)
{
...
...
app/build.gradle
View file @
26dd3e83
...
@@ -22,8 +22,8 @@ android {
...
@@ -22,8 +22,8 @@ android {
applicationId
versions
.
applicationId
applicationId
versions
.
applicationId
minSdkVersion
versions
.
minSdkVersion
minSdkVersion
versions
.
minSdkVersion
targetSdkVersion
versions
.
targetSdkVersion
targetSdkVersion
versions
.
targetSdkVersion
versionCode
9
versionCode
10
versionName
"1.5.
7
"
versionName
"1.5.
8
"
multiDexEnabled
true
multiDexEnabled
true
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
// externalNativeBuild {
// externalNativeBuild {
...
@@ -85,26 +85,27 @@ dependencies {
...
@@ -85,26 +85,27 @@ dependencies {
implementation
'com.squareup.okhttp3:logging-interceptor:3.6.0'
implementation
'com.squareup.okhttp3:logging-interceptor:3.6.0'
implementation
'io.reactivex:rxandroid:1.2.1'
implementation
'io.reactivex:rxandroid:1.2.1'
implementation
'com.google.code.gson:gson:2.8.2'
implementation
'com.google.code.gson:gson:2.8.2'
implementation
'com.github.bumptech.glide:glide:3.5.2'
implementation
'org.greenrobot:eventbus:3.1.1'
implementation
'org.greenrobot:eventbus:3.1.1'
implementation
'com.android.support.constraint:constraint-layout:1.0.2'
implementation
"com.android.support:appcompat-v7:$versions.supportLibVersion"
implementation
"com.android.support:appcompat-v7:$versions.supportLibVersion"
implementation
"com.android.support:design:$versions.supportLibVersion"
implementation
"com.android.support:recyclerview-v7:${versions.supportLibVersion}"
implementation
"com.jakewharton:butterknife:${versions.butterknife}"
annotationProcessor
"com.jakewharton:butterknife-compiler:${versions.butterknife}"
implementation
'com.jakewharton:butterknife:8.2.1'
// implementation 'com.aliyun.ams:alicloud-android-push:3.1.2@aar'
annotationProcessor
'com.jakewharton:butterknife-compiler:8.2.1'
// implementation 'com.aliyun.ams:alicloud-android-utdid:1.1.5.3'
// implementation 'com.aliyun.ams:alicloud-android-ut:5.1.0'
// implementation 'com.aliyun.ams:alicloud-android-third-push:3.0.3@aar'
implementation
'com.aliyun.ams:alicloud-android-push:3.0.11@aar'
implementation
'com.aliyun.ams:alicloud-android-push:3.1.2'
implementation
'com.aliyun.ams:alicloud-android-utdid:1.1.5.3'
implementation
'com.aliyun.ams:alicloud-android-ut:5.0.0'
implementation
'com.aliyun.ams:alicloud-android-third-push:3.0.3@aar'
annotationProcessor
"org.androidannotations:androidannotations:$AAVersion"
//
annotationProcessor "org.androidannotations:androidannotations:$AAVersion"
annotationProcessor
(
"com.tinkerpatch.tinker:tinker-android-anno:1.9.
2
"
)
annotationProcessor
(
"com.tinkerpatch.tinker:tinker-android-anno:1.9.
6
"
)
implementation
(
"com.tinkerpatch.sdk:tinkerpatch-android-sdk:1.2.
2
"
)
implementation
(
"com.tinkerpatch.sdk:tinkerpatch-android-sdk:1.2.
6
"
)
implementation
"com.android.support:multidex:1.0.3"
implementation
"com.android.support:multidex:1.0.3"
}
}
...
...
app/src/main/java/com/xf/weixinclick/DebugActivity.java
View file @
26dd3e83
package
com
.
xf
.
weixinclick
;
package
com
.
xf
.
weixinclick
;
import
android.content.Intent
;
import
android.net.Uri
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.support.annotation.Nullable
;
import
android.support.annotation.Nullable
;
import
android.util.Log
;
import
android.util.Log
;
...
@@ -9,12 +11,15 @@ import android.widget.TextView;
...
@@ -9,12 +11,15 @@ import android.widget.TextView;
import
android.widget.Toast
;
import
android.widget.Toast
;
import
butterknife.BindView
;
import
butterknife.BindView
;
import
butterknife.OnClick
;
import
butterknife.OnClick
;
import
com.xf.agent.common.CmdResult
;
import
com.xf.weixinclick.agent.AgentExecutor
;
import
com.xf.weixinclick.agent.AgentExecutor
;
import
com.xf.weixinclick.agent.AutoProcesser
;
import
com.xf.weixinclick.agent.AutoProcesser
;
import
com.xf.weixinclick.debugtool.LogcatTools
;
import
com.xf.weixinclick.debugtool.LogcatTools
;
import
com.xf.weixinclick.http.HttpClientApi
;
import
java.util.concurrent.Callable
;
import
java.util.concurrent.Callable
;
import
rx.Single
;
import
rx.Single
;
import
rx.SingleSubscriber
;
import
rx.SingleSubscriber
;
import
rx.Subscriber
;
import
rx.android.schedulers.AndroidSchedulers
;
import
rx.android.schedulers.AndroidSchedulers
;
import
rx.schedulers.Schedulers
;
import
rx.schedulers.Schedulers
;
...
@@ -80,6 +85,85 @@ public class DebugActivity extends BaseActivity {
...
@@ -80,6 +85,85 @@ public class DebugActivity extends BaseActivity {
}
}
@OnClick
(
R
.
id
.
btn_start_act
)
void
onClickStartAct
(
View
view
){
Intent
intent
=
new
Intent
();
intent
.
setAction
(
Intent
.
ACTION_VIEW
);
intent
.
addFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
);
intent
.
setClassName
(
"com.tencent.mm"
,
"com.tencent.mm.plugin.webview.ui.tools.WebViewUI"
);
intent
.
setData
(
Uri
.
parse
(
"https://www.baidu.com"
));
// AgentExecutor.startActivity(intent).subscribe(new SingleSubscriber<Boolean>() {
// @Override
// public void onSuccess(Boolean aBoolean) {
// Toast.makeText(getApplicationContext(),"启动成功 "+aBoolean,Toast.LENGTH_SHORT).show();
// }
//
// @Override
// public void onError(Throwable error) {
// Log.e(TAG, "onError --> ",error);
// }
// });
String
url
=
"http://test.mp-watch.checheng.net/qr-addr?url=http%253A%252F%252Ftest.mp-watch.checheng.net%252Ftemp%252Fspider%252Fgh_4e07defd60d4%252Flogin_qrcode.png?1522133567961?1522722411902?1526285925734"
;
AgentExecutor
.
startWechatWeb
(
url
).
subscribe
(
new
SingleSubscriber
<
Boolean
>()
{
@Override
public
void
onSuccess
(
Boolean
aBoolean
)
{
Log
.
e
(
TAG
,
"onSuccess --> "
+
aBoolean
);
}
@Override
public
void
onError
(
Throwable
error
)
{
Log
.
e
(
TAG
,
"onError --> "
,
error
);
}
});
// AgentExecutor.exec("am start -n com.tencent.mm/com.tencent.mm.plugin.webview.ui.tools.WebViewUI -a android.intent.action.VIEW -d https://www.baidu.com")
// .subscribe(new SingleSubscriber<CmdResult>() {
// @Override
// public void onSuccess(CmdResult cmdResult) {
// Log.e(TAG, "onSuccess --> "+cmdResult);
// }
//
// @Override
// public void onError(Throwable error) {
// Log.e(TAG, "onError --> ",error);
// }
// });
}
@OnClick
(
R
.
id
.
btn_test_qr
)
void
btn_test_qr
(
View
view
){
HttpClientApi
.
getQr
(
new
Subscriber
<
String
>()
{
@Override
public
void
onCompleted
()
{
}
@Override
public
void
onError
(
Throwable
e
)
{
Log
.
e
(
TAG
,
"onError --> "
,
e
);
}
@Override
public
void
onNext
(
String
s
)
{
Log
.
e
(
TAG
,
"onNext --> "
+
s
);
Toast
.
makeText
(
getApplicationContext
(),
"获取成功,请稍等..."
,
Toast
.
LENGTH_SHORT
).
show
();
}
});
}
private
void
updateStatus
(){
private
void
updateStatus
(){
if
(
LogcatTools
.
isRunning
()){
if
(
LogcatTools
.
isRunning
()){
...
...
app/src/main/java/com/xf/weixinclick/LoginActivity.java
View file @
26dd3e83
...
@@ -95,7 +95,7 @@ public class LoginActivity extends BaseActivity {
...
@@ -95,7 +95,7 @@ public class LoginActivity extends BaseActivity {
new
HttpSubscriber
<
String
>()
{
new
HttpSubscriber
<
String
>()
{
@Override
@Override
public
void
onStart
()
{
public
void
onStart
()
{
execShellCmd
(
"input tap "
+
10
+
" "
+
10
);
//
execShellCmd("input tap " + 10 + " " + 10);
showProgress
(
"正在请求"
);
showProgress
(
"正在请求"
);
}
}
...
...
app/src/main/java/com/xf/weixinclick/MainActivity.java
View file @
26dd3e83
...
@@ -47,6 +47,7 @@ import com.xf.weixinclick.http.HttpClientApi;
...
@@ -47,6 +47,7 @@ import com.xf.weixinclick.http.HttpClientApi;
import
com.xf.weixinclick.http.HttpSubscriber
;
import
com.xf.weixinclick.http.HttpSubscriber
;
import
com.xf.weixinclick.receiver.WeChatStatus
;
import
com.xf.weixinclick.receiver.WeChatStatus
;
import
com.xf.weixinclick.utils.Accessibilitys
;
import
com.xf.weixinclick.utils.Accessibilitys
;
import
com.xf.weixinclick.utils.JsonKit
;
import
com.xf.weixinclick.utils.SP
;
import
com.xf.weixinclick.utils.SP
;
import
com.xf.weixinclick.view.WaveHelper
;
import
com.xf.weixinclick.view.WaveHelper
;
import
com.xf.weixinclick.view.WaveView
;
import
com.xf.weixinclick.view.WaveView
;
...
@@ -186,7 +187,7 @@ public class MainActivity extends BaseActivity {
...
@@ -186,7 +187,7 @@ public class MainActivity extends BaseActivity {
msg
.
setQr_addr
(
"http://test.mp-watch.checheng.net/qr-addr?url=http%253A%252F%252Ftest.mp-watch.checheng.net%252Ftemp%252Fspider%252Fgh_4e07defd60d4%252Flogin_qrcode.png?1522133567961?1522722411902"
);
msg
.
setQr_addr
(
"http://test.mp-watch.checheng.net/qr-addr?url=http%253A%252F%252Ftest.mp-watch.checheng.net%252Ftemp%252Fspider%252Fgh_4e07defd60d4%252Flogin_qrcode.png?1522133567961?1522722411902"
);
// msg.setQr_addr("https://weapp-dev.wangjia.com/qr.jpg?dd=1");
// msg.setQr_addr("https://weapp-dev.wangjia.com/qr.jpg?dd=1");
msg
.
setUnique_id
(
"1111111111111"
);
msg
.
setUnique_id
(
"1111111111111"
);
msg
.
setTime_config
(
new
Gson
()
.
fromJson
(
"{\"qrcode_timeout\":60,\"after_open_weixin_index_delay\":2000,\"after_open_weixin_file_helper_delay\":6000,\"after_paste_message_delay\":2000,\"after_send_message_delay\":2000,\"after_click_message_delay\":5000,\"long_press_qrcode_delay\":4000,\"after_click_decode_button_delay\":5000,\"after_click_confirm_button_delay\":3000}"
,
DelayBean
.
class
));
msg
.
setTime_config
(
JsonKit
.
GSON
.
fromJson
(
"{\"qrcode_timeout\":60,\"after_open_weixin_index_delay\":2000,\"after_open_weixin_file_helper_delay\":6000,\"after_paste_message_delay\":2000,\"after_send_message_delay\":2000,\"after_click_message_delay\":5000,\"long_press_qrcode_delay\":4000,\"after_click_decode_button_delay\":5000,\"after_click_confirm_button_delay\":3000}"
,
DelayBean
.
class
));
//EventBus.getDefault().post(msg);
//EventBus.getDefault().post(msg);
MsgSender
.
checkAndSend
(
getApplicationContext
(),
msg
);
MsgSender
.
checkAndSend
(
getApplicationContext
(),
msg
);
// startWorkService(MainActivity.this,msg);
// startWorkService(MainActivity.this,msg);
...
@@ -315,7 +316,7 @@ public class MainActivity extends BaseActivity {
...
@@ -315,7 +316,7 @@ public class MainActivity extends BaseActivity {
// SP.setParam("divice", d_name);
// SP.setParam("divice", d_name);
Log
.
d
(
"fei"
,
responseBase
);
Log
.
d
(
"fei"
,
responseBase
);
Type
type
=
new
TypeToken
<
ResponseBase
<
EnableResult
>>(){}.
getType
();
Type
type
=
new
TypeToken
<
ResponseBase
<
EnableResult
>>(){}.
getType
();
ResponseBase
<
EnableResult
>
result
=
new
Gson
()
.
fromJson
(
responseBase
,
type
);
ResponseBase
<
EnableResult
>
result
=
JsonKit
.
GSON
.
fromJson
(
responseBase
,
type
);
if
(
result
==
null
){
if
(
result
==
null
){
NewService
.
showToast
(
MainActivity
.
this
,
"失败:解析失败"
);
NewService
.
showToast
(
MainActivity
.
this
,
"失败:解析失败"
);
}
else
{
}
else
{
...
...
app/src/main/java/com/xf/weixinclick/NewService.java
View file @
26dd3e83
...
@@ -20,6 +20,7 @@ import android.widget.Toast;
...
@@ -20,6 +20,7 @@ import android.widget.Toast;
import
com.alibaba.sdk.android.push.noonesdk.PushServiceFactory
;
import
com.alibaba.sdk.android.push.noonesdk.PushServiceFactory
;
import
com.xf.weixinclick.bean.DelayBean
;
import
com.xf.weixinclick.bean.DelayBean
;
import
com.xf.weixinclick.bean.msg.ReceiverMsg
;
import
com.xf.weixinclick.bean.msg.ReceiverMsg
;
import
com.xf.weixinclick.core.Worker
;
import
com.xf.weixinclick.core.Worker2
;
import
com.xf.weixinclick.core.Worker2
;
import
com.xf.weixinclick.http.HttpClientApi
;
import
com.xf.weixinclick.http.HttpClientApi
;
import
com.xf.weixinclick.http.HttpSubscriber
;
import
com.xf.weixinclick.http.HttpSubscriber
;
...
@@ -69,12 +70,12 @@ public class NewService extends AccessibilityService {
...
@@ -69,12 +70,12 @@ public class NewService extends AccessibilityService {
*/
*/
private
boolean
inBacking
=
false
;
private
boolean
inBacking
=
false
;
Worker
2
mWorker
=
null
;
Worker
mWorker
=
null
;
@Override
@Override
public
void
onCreate
()
{
public
void
onCreate
()
{
super
.
onCreate
();
super
.
onCreate
();
if
(
mWorker
==
null
){
if
(
mWorker
==
null
){
mWorker
=
Worker
2
.
getInstance
();
mWorker
=
Worker
.
getInstance
();
}
}
Log
.
d
(
TAG
,
"NewService onCreate"
);
Log
.
d
(
TAG
,
"NewService onCreate"
);
}
}
...
@@ -82,19 +83,22 @@ public class NewService extends AccessibilityService {
...
@@ -82,19 +83,22 @@ public class NewService extends AccessibilityService {
@Override
@Override
public
void
onAccessibilityEvent
(
AccessibilityEvent
event
)
{
public
void
onAccessibilityEvent
(
AccessibilityEvent
event
)
{
Log
.
d
(
TAG
,
"NewService onAccessibilityEvent"
);
if
(
mWorker
==
null
){
if
(
mWorker
==
null
){
mWorker
=
Worker
2
.
getInstance
();
mWorker
=
Worker
.
getInstance
();
}
}
mWorker
.
onAccessibilityEvent
(
getRootInActiveWindow
(),
event
);
//mWorker.onAccessibilityEvent(getRootInActiveWindow(),event);
mWorker
.
handleEvent
(
this
,
event
);
}
}
@Override
@Override
public
void
onInterrupt
()
{
public
void
onInterrupt
()
{
Log
.
d
(
TAG
,
"NewService onInterrupt"
);
Log
.
d
(
TAG
,
"NewService onInterrupt"
);
if
(
mWorker
!=
null
){
if
(
mWorker
!=
null
){
mWorker
.
onIntercept
();
//mWorker.onIntercept();
mWorker
.
onInterrupt
(
this
);
}
}
}
}
...
@@ -291,7 +295,6 @@ public class NewService extends AccessibilityService {
...
@@ -291,7 +295,6 @@ public class NewService extends AccessibilityService {
if
(
TextUtils
.
isEmpty
(
name
)){
if
(
TextUtils
.
isEmpty
(
name
)){
return
;
return
;
}
}
String
device_code
=
PushServiceFactory
.
getCloudPushService
().
getDeviceId
();
String
device_code
=
PushServiceFactory
.
getCloudPushService
().
getDeviceId
();
if
(
TextUtils
.
isEmpty
(
device_code
)){
if
(
TextUtils
.
isEmpty
(
device_code
)){
return
;
return
;
...
...
app/src/main/java/com/xf/weixinclick/agent/AgentExecutor.java
View file @
26dd3e83
package
com
.
xf
.
weixinclick
.
agent
;
package
com
.
xf
.
weixinclick
.
agent
;
import
android.content.Context
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.graphics.Rect
;
import
android.graphics.Rect
;
import
android.util.DisplayMetrics
;
import
android.util.DisplayMetrics
;
import
android.util.Log
;
import
android.util.Log
;
...
@@ -84,6 +85,42 @@ public class AgentExecutor {
...
@@ -84,6 +85,42 @@ public class AgentExecutor {
}
}
public
static
Single
<
Boolean
>
inputEvent
(
final
String
event
){
return
Single
.
fromCallable
(
new
Callable
<
Boolean
>()
{
@Override
public
Boolean
call
()
throws
Exception
{
try
{
return
agentManager
.
input
(
event
);
}
catch
(
Throwable
throwable
)
{
throw
new
Exception
(
throwable
);
}
}
}).
subscribeOn
(
Schedulers
.
io
())
.
observeOn
(
AndroidSchedulers
.
mainThread
());
}
public
static
Single
<
Boolean
>
startWechatWeb
(
final
String
url
){
return
Single
.
fromCallable
(
new
Callable
<
Boolean
>()
{
@Override
public
Boolean
call
()
throws
Exception
{
try
{
String
cmd
=
"am start -n com.tencent.mm/com.tencent.mm.plugin.webview.ui.tools.WebViewUI -a android.intent.action.VIEW -d "
;
return
agentManager
.
exeCommand
(
cmd
+
url
).
code
==
0
;
}
catch
(
Throwable
throwable
)
{
throw
new
Exception
(
throwable
);
}
}
}).
subscribeOn
(
Schedulers
.
io
())
.
observeOn
(
AndroidSchedulers
.
mainThread
());
}
public
static
boolean
isConnected
(){
public
static
boolean
isConnected
(){
return
agentManager
.
isRunning
();
return
agentManager
.
isRunning
();
...
...
app/src/main/java/com/xf/weixinclick/agent/AutoProcesser.java
View file @
26dd3e83
...
@@ -45,9 +45,7 @@ public class AutoProcesser {
...
@@ -45,9 +45,7 @@ public class AutoProcesser {
@Override
@Override
public
void
onError
(
Throwable
error
)
{
public
void
onError
(
Throwable
error
)
{
DebugTools
.
dismiss
();
DebugTools
.
dismiss
();
Cmder
.
clickWxBack
();
Cmder
.
clickWxBack
();
Cmder
.
clickWxBack
();
Log
.
e
(
TAG
,
"onError --> "
,
error
);
Log
.
e
(
TAG
,
"onError --> "
,
error
);
if
(
subscriber
!=
null
){
if
(
subscriber
!=
null
){
...
...
app/src/main/java/com/xf/weixinclick/agent/MotionRunner.java
View file @
26dd3e83
...
@@ -2,9 +2,11 @@ package com.xf.weixinclick.agent;
...
@@ -2,9 +2,11 @@ package com.xf.weixinclick.agent;
import
android.graphics.Rect
;
import
android.graphics.Rect
;
import
android.support.v4.view.ViewCompat.FocusRealDirection
;
import
android.support.v4.view.ViewCompat.FocusRealDirection
;
import
android.util.Log
;
import
android.view.KeyEvent
;
import
android.view.KeyEvent
;
import
android.view.View
;
import
android.view.View
;
import
com.xf.agent.common.CmdResult
;
import
com.xf.agent.common.CmdResult
;
import
rx.SingleSubscriber
;
/**
/**
...
@@ -12,9 +14,10 @@ import com.xf.agent.common.CmdResult;
...
@@ -12,9 +14,10 @@ import com.xf.agent.common.CmdResult;
*/
*/
public
class
MotionRunner
{
public
class
MotionRunner
{
private
static
final
String
KEY_EVENT_CMD
=
"input keyevent "
;
private
static
final
String
PREFIX
=
""
;
private
static
final
String
TAP_EVENT_CMD
=
"input tap "
;
private
static
final
String
KEY_EVENT_CMD
=
PREFIX
+
" keyevent "
;
private
static
final
String
SWIPE_EVENT_CMD
=
"input swipe "
;
private
static
final
String
TAP_EVENT_CMD
=
PREFIX
+
" tap "
;
private
static
final
String
SWIPE_EVENT_CMD
=
PREFIX
+
" swipe "
;
private
static
MotionRunner
sInstance
=
null
;
private
static
MotionRunner
sInstance
=
null
;
...
@@ -64,10 +67,13 @@ public class MotionRunner {
...
@@ -64,10 +67,13 @@ public class MotionRunner {
*/
*/
public
boolean
tap
(
int
x
,
int
y
){
public
boolean
tap
(
int
x
,
int
y
){
CmdResult
cmdResult
=
AgentExecutor
.
execNonReturn
(
TAP_EVENT_CMD
+
x
+
" "
+
y
);
//
CmdResult cmdResult = AgentExecutor.execNonReturn(TAP_EVENT_CMD + x + " " + y);
//
return
cmdResult
!=
null
&&
cmdResult
.
code
==
0
;
//
return cmdResult!=null && cmdResult.code == 0;
execInputEvent
(
TAP_EVENT_CMD
+
x
+
" "
+
y
);
return
true
;
//return AgentExecutor.inputEvent(TAP_EVENT_CMD + x + " " + y).toBlocking().value();
}
}
/**
/**
...
@@ -85,7 +91,7 @@ public class MotionRunner {
...
@@ -85,7 +91,7 @@ public class MotionRunner {
.
append
(
y
).
append
(
' '
)
.
append
(
y
).
append
(
' '
)
.
append
(
duration
);
.
append
(
duration
);
AgentExecutor
.
execNonReturn
(
cmd
.
toString
());
execInputEvent
(
cmd
.
toString
());
}
}
/**
/**
...
@@ -103,7 +109,7 @@ public class MotionRunner {
...
@@ -103,7 +109,7 @@ public class MotionRunner {
.
append
(
endX
).
append
(
' '
)
.
append
(
endX
).
append
(
' '
)
.
append
(
endY
).
append
(
' '
)
.
append
(
endY
).
append
(
' '
)
.
append
(
duration
);
.
append
(
duration
);
AgentExecutor
.
execNonReturn
(
cmd
.
toString
());
execInputEvent
(
cmd
.
toString
());
}
}
/**
/**
...
@@ -142,8 +148,23 @@ public class MotionRunner {
...
@@ -142,8 +148,23 @@ public class MotionRunner {
}
}
private
void
sendKeyEvent
(
int
code
){
private
void
sendKeyEvent
(
int
code
){
AgentExecutor
.
execNonReturn
(
KEY_EVENT_CMD
+
code
);
execInputEvent
(
KEY_EVENT_CMD
+
code
);
}
}
private
void
execInputEvent
(
String
event
){
Log
.
e
(
"MotionRunner"
,
"execInputEvent --> "
+
event
);
AgentExecutor
.
inputEvent
(
event
).
subscribe
(
new
SingleSubscriber
<
Boolean
>()
{
@Override
public
void
onSuccess
(
Boolean
aBoolean
)
{
}
@Override
public
void
onError
(
Throwable
error
)
{
Log
.
e
(
"test"
,
"onError --> "
,
error
);
}
});
}
}
}
app/src/main/java/com/xf/weixinclick/agent/UiHierarchyFinder.java
View file @
26dd3e83
...
@@ -27,14 +27,27 @@ public class UiHierarchyFinder {
...
@@ -27,14 +27,27 @@ public class UiHierarchyFinder {
private
BasicTreeNode
basicTreeNode
;
private
BasicTreeNode
basicTreeNode
;
public
static
Single
<
UiHierarchyFinder
>
createFinder
(){
return
Single
.
fromCallable
(
new
Callable
<
UiHierarchyFinder
>()
{
@Override
public
UiHierarchyFinder
call
()
throws
Exception
{
UiHierarchyFinder
finder
=
new
UiHierarchyFinder
();
finder
.
dump
();
finder
.
parseDefault
();
return
finder
;
}
}).
subscribeOn
(
Schedulers
.
io
())
.
observeOn
(
AndroidSchedulers
.
mainThread
());
}
public
void
dump
()
{
public
void
dump
()
{
//
CmdResult value = AgentExecutor.exec(CMD).toBlocking().value();
CmdResult
value
=
AgentExecutor
.
exec
(
CMD
).
toBlocking
().
value
();
boolean
success
=
Cmder
.
execShellCmd
(
CMD
);
//
boolean success = Cmder.execShellCmd(CMD);
Log
.
e
(
TAG
,
"dump --> "
+
success
);
Log
.
e
(
TAG
,
"dump --> "
+
value
.
message
);
SystemClock
.
sleep
(
2000
);
SystemClock
.
sleep
(
2000
);
if
(
!
success
){
if
(
value
.
code
!=
0
){
throw
new
RuntimeException
(
"dump ERROR !!!"
);
throw
new
RuntimeException
(
"dump ERROR !!!"
);
}
}
...
@@ -91,30 +104,80 @@ public class UiHierarchyFinder {
...
@@ -91,30 +104,80 @@ public class UiHierarchyFinder {
List
<
UiNode
>
findNodeByText
(
String
text
)
{
List
<
UiNode
>
findNodeByText
(
String
text
)
{
List
<
UiNode
>
ret
=
new
ArrayList
<>();
List
<
UiNode
>
ret
=
new
ArrayList
<>();
findByAttr
(
basicTreeNode
.
getChildren
(),
"text"
,
text
,
ret
);
findByAttr
(
basicTreeNode
.
getChildren
(),
"text"
,
text
,
ret
,
true
);
return
ret
;
}
public
@NonNull
List
<
UiNode
>
findNodeByAttr
(
String
attrKey
,
String
text
)
{
List
<
UiNode
>
ret
=
new
ArrayList
<>();
findByAttr
(
basicTreeNode
.
getChildren
(),
attrKey
,
text
,
ret
,
false
);
return
ret
;
return
ret
;
}
}
public
@NonNull
public
@NonNull
List
<
UiNode
>
findNodeByAttr
(
String
attrKey
,
String
text
,
boolean
exact
)
{
List
<
UiNode
>
ret
=
new
ArrayList
<>();
findByAttr
(
basicTreeNode
.
getChildren
(),
attrKey
,
text
,
ret
,
exact
);
return
ret
;
}
public
@NonNull
List
<
UiNode
>
findNodeById
(
String
id
)
{
List
<
UiNode
>
findNodeById
(
String
id
)
{
List
<
UiNode
>
ret
=
new
ArrayList
<>();
List
<
UiNode
>
ret
=
new
ArrayList
<>();
findByAttr
(
basicTreeNode
.
getChildren
(),
"resource-id"
,
id
,
ret
);
findByAttr
(
basicTreeNode
.
getChildren
(),
"resource-id"
,
id
,
ret
,
true
);
return
ret
;
return
ret
;
}
}
private
void
findByAttr
(
BasicTreeNode
[]
nodes
,
String
key
,
String
value
,
List
<
UiNode
>
ret
)
{
public
List
<
String
>
getAttrValues
(
String
key
){
List
<
String
>
ret
=
new
ArrayList
<>();
getValue
(
basicTreeNode
.
getChildren
(),
key
,
ret
);
return
ret
;
}
private
void
getValue
(
BasicTreeNode
[]
nodes
,
String
key
,
List
<
String
>
ret
){
if
(
nodes
!=
null
)
{
if
(
nodes
!=
null
)
{
for
(
BasicTreeNode
node
:
nodes
)
{
for
(
BasicTreeNode
node
:
nodes
)
{
if
(
node
.
hasChild
())
{
if
(
node
.
hasChild
())
{
findByAttr
(
node
.
getChildren
(),
key
,
value
,
ret
);
getValue
(
node
.
getChildren
(),
key
,
ret
);
}
else
{
}
else
{
if
(
node
instanceof
UiNode
)
{
if
(
node
instanceof
UiNode
)
{
String
text
=
((
UiNode
)
node
).
getAttribute
(
key
);
String
text
=
((
UiNode
)
node
).
getAttribute
(
key
);
if
(
ret
!=
null
&&
TextUtils
.
equals
(
text
,
value
))
{
if
(!
TextUtils
.
isEmpty
(
text
)
&&
text
.
length
()
>
1
){
ret
.
add
(((
UiNode
)
node
));
ret
.
add
(
text
.
trim
());
}
}
}
}
}
}
private
void
findByAttr
(
BasicTreeNode
[]
nodes
,
String
key
,
String
value
,
List
<
UiNode
>
ret
,
boolean
exact
)
{
if
(
nodes
!=
null
)
{
for
(
BasicTreeNode
node
:
nodes
)
{
if
(
node
.
hasChild
())
{
findByAttr
(
node
.
getChildren
(),
key
,
value
,
ret
,
exact
);
}
else
{
if
(
node
instanceof
UiNode
)
{
String
text
=
((
UiNode
)
node
).
getAttribute
(
key
);
if
(
ret
!=
null
&&
!
TextUtils
.
isEmpty
(
text
)
)
{
if
(
(
exact
&&
TextUtils
.
equals
(
text
,
value
))
||
text
.
contains
(
value
)){
ret
.
add
(((
UiNode
)
node
));
}
}
}
}
}
}
}
...
@@ -130,9 +193,10 @@ public class UiHierarchyFinder {
...
@@ -130,9 +193,10 @@ public class UiHierarchyFinder {
printNodes
(
node
.
getChildren
());
printNodes
(
node
.
getChildren
());
}
else
{
}
else
{
if
(
node
instanceof
UiNode
)
{
if
(
node
instanceof
UiNode
)
{
String
text
=
((
UiNode
)
node
).
getAttribute
(
"text"
);
String
text1
=
((
UiNode
)
node
).
getAttribute
(
"text"
);
if
(!
TextUtils
.
isEmpty
(
text
))
{
String
text2
=
((
UiNode
)
node
).
getAttribute
(
"content-desc"
);
Log
.
e
(
TAG
,
"printNodes --> "
+
text
);
if
(!
TextUtils
.
isEmpty
(
text1
)
||
!
TextUtils
.
isEmpty
(
text2
)
)
{
Log
.
e
(
TAG
,
"printNodes -->text: "
+
text1
+
" content-desc:"
+
text2
);
}
}
}
}
}
}
...
...
app/src/main/java/com/xf/weixinclick/agent/auto/EnableAccessibility.java
View file @
26dd3e83
...
@@ -66,6 +66,7 @@ public class EnableAccessibility implements Callable<Boolean> {
...
@@ -66,6 +66,7 @@ public class EnableAccessibility implements Callable<Boolean> {
Log
.
e
(
TAG
,
"点击第0个节点的位置"
+
bounds
);
Log
.
e
(
TAG
,
"点击第0个节点的位置"
+
bounds
);
MotionRunner
.
get
().
clickBack
();
Cmder
.
clickPX
(
bounds
.
centerX
(),
bounds
.
centerY
());
Cmder
.
clickPX
(
bounds
.
centerX
(),
bounds
.
centerY
());
SystemClock
.
sleep
(
5000
);
SystemClock
.
sleep
(
5000
);
//打开了无障碍页面
//打开了无障碍页面
...
@@ -122,8 +123,6 @@ public class EnableAccessibility implements Callable<Boolean> {
...
@@ -122,8 +123,6 @@ public class EnableAccessibility implements Callable<Boolean> {
//然后返回
//然后返回
Cmder
.
clickWxBack
();
SystemClock
.
sleep
(
500
);
SystemClock
.
sleep
(
500
);
Cmder
.
clickWxBack
();
Cmder
.
clickWxBack
();
...
...
app/src/main/java/com/xf/weixinclick/bean/ResponseBase.java
View file @
26dd3e83
...
@@ -2,6 +2,7 @@ package com.xf.weixinclick.bean;
...
@@ -2,6 +2,7 @@ package com.xf.weixinclick.bean;
import
com.google.gson.Gson
;
import
com.google.gson.Gson
;
import
com.xf.weixinclick.utils.JsonKit
;
import
java.lang.reflect.ParameterizedType
;
import
java.lang.reflect.ParameterizedType
;
import
java.lang.reflect.Type
;
import
java.lang.reflect.Type
;
...
@@ -32,15 +33,13 @@ public class ResponseBase<T> {
...
@@ -32,15 +33,13 @@ public class ResponseBase<T> {
}
}
public
static
ResponseBase
fromJson
(
String
json
,
Class
clazz
)
{
public
static
ResponseBase
fromJson
(
String
json
,
Class
clazz
)
{
Gson
gson
=
new
Gson
();
Type
objectType
=
type
(
ResponseBase
.
class
,
clazz
);
Type
objectType
=
type
(
ResponseBase
.
class
,
clazz
);
return
gson
.
fromJson
(
json
,
objectType
);
return
JsonKit
.
GSON
.
fromJson
(
json
,
objectType
);
}
}
public
String
toJson
(
Class
<
T
>
clazz
)
{
public
String
toJson
(
Class
<
T
>
clazz
)
{
Gson
gson
=
new
Gson
();
Type
objectType
=
type
(
ResponseBase
.
class
,
clazz
);
Type
objectType
=
type
(
ResponseBase
.
class
,
clazz
);
return
gson
.
toJson
(
this
,
objectType
);
return
JsonKit
.
GSON
.
toJson
(
this
,
objectType
);
}
}
static
ParameterizedType
type
(
final
Class
raw
,
final
Type
...
args
)
{
static
ParameterizedType
type
(
final
Class
raw
,
final
Type
...
args
)
{
...
...
app/src/main/java/com/xf/weixinclick/core/TaskSession.java
View file @
26dd3e83
This diff is collapsed.
Click to expand it.
app/src/main/java/com/xf/weixinclick/core/UIFinderUtils.java
0 → 100644
View file @
26dd3e83
package
com
.
xf
.
weixinclick
.
core
;
import
android.graphics.Rect
;
import
android.text.TextUtils
;
import
android.util.Log
;
import
android.view.accessibility.AccessibilityNodeInfo
;
import
com.xf.weixinclick.agent.MotionRunner
;
import
java.util.ArrayList
;
import
java.util.List
;
class
UIFinderUtils
{
private
static
final
String
TAG
=
"UIFinderUtils"
;
private
static
Rect
nodeRect
=
new
Rect
();
static
List
<
AccessibilityNodeInfo
>
findAccessibilityNodeInfosByDesc
(
AccessibilityNodeInfo
node
,
String
text
,
boolean
exact
){
List
<
AccessibilityNodeInfo
>
ret
=
new
ArrayList
<>();
findByDesc
(
node
,
text
,
exact
,
ret
);
return
ret
;
}
private
static
void
findByDesc
(
AccessibilityNodeInfo
info
,
String
text
,
boolean
exact
,
List
<
AccessibilityNodeInfo
>
ret
){
if
(
info
==
null
){
return
;
}
int
childCount
=
info
.
getChildCount
();
if
(
childCount
>
0
)
{
for
(
int
i
=
0
;
i
<
info
.
getChildCount
();
i
++)
{
findByDesc
(
info
.
getChild
(
i
),
text
,
exact
,
ret
);
}
}
else
{
CharSequence
contentDescription
=
info
.
getContentDescription
();
if
(!
TextUtils
.
isEmpty
(
contentDescription
)){
String
s
=
contentDescription
.
toString
();
s
=
s
.
trim
();
if
(
exact
){
if
(
TextUtils
.
equals
(
text
,
s
)){
ret
.
add
(
info
);
}
}
else
{
if
(
s
.
contains
(
text
)){
ret
.
add
(
info
);
}
}
}
}
}
static
AccessibilityNodeInfo
findEditText
(
AccessibilityNodeInfo
rootInActiveWindow
){
List
<
AccessibilityNodeInfo
>
ets
=
rootInActiveWindow
.
findAccessibilityNodeInfosByViewId
(
WXIdsConfig
.
ET_INPUT_MSG
);
if
(
ets
!=
null
&&
!
ets
.
isEmpty
()){
for
(
AccessibilityNodeInfo
et
:
ets
)
{
if
(
"android.widget.EditText"
.
equals
(
et
.
getClassName
())){
return
et
;
}
}
}
return
null
;
}
static
boolean
contains
(
AccessibilityNodeInfo
nodeInfo
,
String
text
){
int
childCount
=
nodeInfo
.
getChildCount
();
if
(
childCount
>
0
)
{
for
(
int
i
=
0
;
i
<
nodeInfo
.
getChildCount
();
i
++)
{
AccessibilityNodeInfo
child
=
nodeInfo
.
getChild
(
i
);
if
(
child
!=
null
){
return
contains
(
child
,
text
);
}
}
}
else
{
CharSequence
viewText
=
nodeInfo
.
getText
();
if
(!
TextUtils
.
isEmpty
(
viewText
)){
return
viewText
.
toString
().
startsWith
(
text
);
}
}
return
false
;
}
static
boolean
clickNode
(
AccessibilityNodeInfo
nodeInfo
){
nodeRect
.
setEmpty
();
if
(
nodeInfo
!=
null
){
nodeInfo
.
getBoundsInScreen
(
nodeRect
);
}
if
(
nodeRect
.
isEmpty
()){
return
false
;
}
AccessibilityNodeInfo
clickableNode
=
null
;
while
(
clickableNode
==
null
){
if
(
nodeInfo
!=
null
){
if
(
nodeInfo
.
isClickable
()){
clickableNode
=
nodeInfo
;
}
else
{
nodeInfo
=
nodeInfo
.
getParent
();
}
}
else
{
break
;
}
}
boolean
ret
=
false
;
if
(
clickableNode
!=
null
){
ret
=
clickableNode
.
performAction
(
AccessibilityNodeInfo
.
ACTION_CLICK
);
}
return
ret
||
MotionRunner
.
get
().
tap
(
nodeRect
.
centerX
(),
nodeRect
.
centerY
());
}
static
AccessibilityNodeInfo
findByIdAndText
(
AccessibilityNodeInfo
rootInActiveWindow
,
String
id
,
String
text
){
List
<
AccessibilityNodeInfo
>
nodeInfos
=
rootInActiveWindow
.
findAccessibilityNodeInfosByViewId
(
id
);
if
(
isEmptyNodes
(
nodeInfos
)){
return
null
;
}
for
(
AccessibilityNodeInfo
nodeInfo
:
nodeInfos
)
{
if
(
TextUtils
.
equals
(
text
,
nodeInfo
.
getText
())){
return
nodeInfo
;
}
}
return
null
;
}
static
void
printNodes
(
List
<
AccessibilityNodeInfo
>
nodes
){
if
(
nodes
==
null
||
nodes
.
isEmpty
()){
Log
.
e
(
TAG
,
"printNodes --> is empty!"
);
}
else
{
Log
.
e
(
TAG
,
"printNodes --> start"
);
for
(
AccessibilityNodeInfo
node
:
nodes
)
{
Log
.
e
(
TAG
,
"printNodes --> "
+
node
.
getViewIdResourceName
()+
" "
+
node
.
getText
()+
" "
+
node
.
getContentDescription
());
}
Log
.
e
(
TAG
,
"printNodes --> end"
);
}
}
static
AccessibilityNodeInfo
findByIdAndDesc
(
AccessibilityNodeInfo
rootInActiveWindow
,
String
id
,
String
text
){
List
<
AccessibilityNodeInfo
>
nodeInfos
=
rootInActiveWindow
.
findAccessibilityNodeInfosByViewId
(
id
);
if
(
isEmptyNodes
(
nodeInfos
)){
return
null
;
}
for
(
AccessibilityNodeInfo
nodeInfo
:
nodeInfos
)
{
if
(
TextUtils
.
equals
(
text
,
nodeInfo
.
getContentDescription
())){
return
nodeInfo
;
}
}
return
null
;
}
static
void
recycle
(
AccessibilityNodeInfo
info
)
{
if
(
info
==
null
){
return
;
}
int
childCount
=
info
.
getChildCount
();
if
(
childCount
>
0
)
{
for
(
int
i
=
0
;
i
<
info
.
getChildCount
();
i
++)
{
recycle
(
info
.
getChild
(
i
));
}
}
else
{
info
.
recycle
();
}
}
private
static
boolean
isEmptyNodes
(
List
<
AccessibilityNodeInfo
>
nodeInfos
){
return
nodeInfos
==
null
||
nodeInfos
.
isEmpty
();
}
}
app/src/main/java/com/xf/weixinclick/core/WXLog.java
0 → 100644
View file @
26dd3e83
package
com
.
xf
.
weixinclick
.
core
;
import
android.text.TextUtils
;
import
android.util.Log
;
import
com.alibaba.sdk.android.push.noonesdk.PushServiceFactory
;
import
com.xf.weixinclick.http.HttpClientApi
;
import
com.xf.weixinclick.utils.SP
;
import
rx.Subscriber
;
class
WXLog
{
static
void
log
(
String
msg
){
String
name
=
(
String
)
SP
.
getParam
(
"divice"
,
""
);
if
(
TextUtils
.
isEmpty
(
name
)){
return
;
}
String
device_code
=
PushServiceFactory
.
getCloudPushService
().
getDeviceId
();
if
(
TextUtils
.
isEmpty
(
device_code
)){
return
;
}
//不管成功还是失败
HttpClientApi
.
uploadDeviceLog
(
device_code
,
name
,
msg
,
new
Subscriber
<
String
>()
{
@Override
public
void
onCompleted
()
{
}
@Override
public
void
onError
(
Throwable
e
)
{
Log
.
d
(
"uploadDeviceLog"
,
e
.
getMessage
());
}
@Override
public
void
onNext
(
String
o
)
{
Log
.
d
(
"uploadDeviceLog"
,
o
);
}
});
}
}
app/src/main/java/com/xf/weixinclick/core/Worker.java
View file @
26dd3e83
...
@@ -4,8 +4,10 @@ import android.accessibilityservice.AccessibilityService;
...
@@ -4,8 +4,10 @@ import android.accessibilityservice.AccessibilityService;
import
android.support.annotation.Keep
;
import
android.support.annotation.Keep
;
import
android.util.Log
;
import
android.util.Log
;
import
android.view.accessibility.AccessibilityEvent
;
import
android.view.accessibility.AccessibilityEvent
;
import
android.widget.Toast
;
import
com.xf.weixinclick.bean.msg.ReceiverMsg
;
import
com.xf.weixinclick.bean.msg.ReceiverMsg
;
import
com.xf.weixinclick.core.TaskSession.TaskCallback
;
import
com.xf.weixinclick.core.TaskSession.TaskCallback
;
import
com.xf.weixinclick.myApplication
;
import
java.util.concurrent.LinkedBlockingQueue
;
import
java.util.concurrent.LinkedBlockingQueue
;
import
java.util.concurrent.locks.Condition
;
import
java.util.concurrent.locks.Condition
;
import
java.util.concurrent.locks.Lock
;
import
java.util.concurrent.locks.Lock
;
...
@@ -90,7 +92,7 @@ public class Worker {
...
@@ -90,7 +92,7 @@ public class Worker {
if
(
currentTaskSession
!=
null
&&
currentTaskSession
.
canHandle
())
{
if
(
currentTaskSession
!=
null
&&
currentTaskSession
.
canHandle
())
{
currentTaskSession
.
handleEvent
(
service
,
event
);
currentTaskSession
.
handleEvent
(
service
,
event
);
}
else
{
}
else
{
Log
.
e
(
TAG
,
"handleEvent --> 当前不需要处理"
+
LINE_SEP
);
//
Log.e(TAG, "handleEvent --> 当前不需要处理"+LINE_SEP);
}
}
}
}
...
@@ -136,13 +138,19 @@ public class Worker {
...
@@ -136,13 +138,19 @@ public class Worker {
currentTaskSession
=
new
TaskSession
(
msg
,
new
TaskCallback
()
{
currentTaskSession
=
new
TaskSession
(
msg
,
new
TaskCallback
()
{
@Override
@Override
public
void
onSuccess
()
{
public
void
onSuccess
()
{
Log
.
e
(
TAG
,
"onSuccess --> "
+
LINE_SEP
);
Toast
.
makeText
(
myApplication
.
getInstence
(),
"点击成功!"
,
Toast
.
LENGTH_SHORT
).
show
();
Log
.
e
(
TAG
,
"onSuccess --> 自动点击成功!"
+
LINE_SEP
);
taskOver
();
taskOver
();
}
}
@Override
@Override
public
void
onError
(
String
msg
)
{
public
void
onError
(
String
msg
)
{
Toast
.
makeText
(
myApplication
.
getInstence
(),
"点击失败:"
+
msg
,
Toast
.
LENGTH_LONG
).
show
();
Log
.
e
(
TAG
,
"onError --> "
+
msg
+
LINE_SEP
);
Log
.
e
(
TAG
,
"onError --> "
+
msg
+
LINE_SEP
);
taskOver
();
taskOver
();
...
...
app/src/main/java/com/xf/weixinclick/core/logger/LogDB.java
0 → 100644
View file @
26dd3e83
package
com
.
xf
.
weixinclick
.
core
.
logger
;
import
android.content.ContentValues
;
import
android.content.Context
;
import
android.database.Cursor
;
import
android.database.sqlite.SQLiteDatabase
;
import
android.database.sqlite.SQLiteDatabase.CursorFactory
;
import
android.database.sqlite.SQLiteOpenHelper
;
import
java.util.ArrayList
;
import
java.util.List
;
public
class
LogDB
extends
SQLiteOpenHelper
{
private
static
final
String
DB_NAME
=
"wx_log.db"
;
private
static
final
String
DB_TABLE
=
"tb_log"
;
private
static
final
int
DB_VER
=
1
;
private
static
final
String
COLUMN_LOG_ID
=
"log_id"
;
private
static
final
String
COLUMN_LOG_TEXT
=
"log"
;
private
static
final
String
COLUMN_LOG_TIME
=
"time"
;
private
static
final
String
CREATE_SQL
=
"CREATE TABLE IF NOT EXISTS "
+
DB_TABLE
+
" ( _id integer primary key autoincrement, "
+
COLUMN_LOG_ID
+
" text,"
+
COLUMN_LOG_TEXT
+
" text,"
+
COLUMN_LOG_TIME
+
" int);"
;
public
LogDB
(
Context
context
)
{
super
(
context
,
DB_NAME
,
null
,
DB_VER
);
}
@Override
public
void
onCreate
(
SQLiteDatabase
db
)
{
db
.
execSQL
(
CREATE_SQL
);
}
@Override
public
void
onUpgrade
(
SQLiteDatabase
db
,
int
oldVersion
,
int
newVersion
)
{
}
public
void
clear
(){
getWritableDatabase
().
execSQL
(
"DROP TABLE IF EXISTS "
+
DB_TABLE
);
}
public
void
addLog
(
LogMsg
msg
){
try
{
ContentValues
values
=
new
ContentValues
(
3
);
values
.
put
(
COLUMN_LOG_ID
,
msg
.
logId
);
values
.
put
(
COLUMN_LOG_TEXT
,
msg
.
log
);
values
.
put
(
COLUMN_LOG_TIME
,
msg
.
time
);
getWritableDatabase
().
insert
(
DB_TABLE
,
null
,
values
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
public
List
<
LogMsg
>
getLogs
(){
List
<
LogMsg
>
logMsgs
=
new
ArrayList
<>();
Cursor
cursor
=
null
;
try
{
cursor
=
getReadableDatabase
()
.
query
(
DB_TABLE
,
new
String
[]{
COLUMN_LOG_ID
,
COLUMN_LOG_TEXT
,
COLUMN_LOG_TIME
},
null
,
null
,
null
,
null
,
COLUMN_LOG_TIME
+
" desc"
);
while
(
cursor
.
moveToNext
()){
LogMsg
logMsg
=
new
LogMsg
();
logMsg
.
logId
=
cursor
.
getString
(
0
);
logMsg
.
log
=
cursor
.
getString
(
1
);
logMsg
.
time
=
cursor
.
getLong
(
2
);
logMsgs
.
add
(
logMsg
);
}
}
catch
(
Exception
e
){
e
.
printStackTrace
();
}
finally
{
if
(
cursor
!=
null
){
cursor
.
close
();
}
}
return
logMsgs
;
}
}
app/src/main/java/com/xf/weixinclick/core/logger/LogMsg.java
0 → 100644
View file @
26dd3e83
package
com
.
xf
.
weixinclick
.
core
.
logger
;
public
class
LogMsg
{
public
String
logId
;
public
String
log
;
public
long
time
;
}
app/src/main/java/com/xf/weixinclick/http/ClientApi.java
View file @
26dd3e83
...
@@ -3,6 +3,7 @@ package com.xf.weixinclick.http;
...
@@ -3,6 +3,7 @@ package com.xf.weixinclick.http;
import
java.util.Map
;
import
java.util.Map
;
import
retrofit2.http.Body
;
import
retrofit2.http.Body
;
import
retrofit2.http.GET
;
import
retrofit2.http.POST
;
import
retrofit2.http.POST
;
import
rx.Observable
;
import
rx.Observable
;
...
@@ -23,4 +24,8 @@ public interface ClientApi{
...
@@ -23,4 +24,8 @@ public interface ClientApi{
Observable
<
String
>
devicesEnable
(
@Body
Map
<
String
,
String
>
params
);
Observable
<
String
>
devicesEnable
(
@Body
Map
<
String
,
String
>
params
);
@POST
(
"devices/log"
)
@POST
(
"devices/log"
)
Observable
<
String
>
devicesLog
(
@Body
Map
<
String
,
String
>
params
);
Observable
<
String
>
devicesLog
(
@Body
Map
<
String
,
String
>
params
);
@GET
(
"devices/get-qr"
)
Observable
<
String
>
getQR
();
}
}
app/src/main/java/com/xf/weixinclick/http/HttpClientApi.java
View file @
26dd3e83
...
@@ -5,6 +5,7 @@ import android.util.Log;
...
@@ -5,6 +5,7 @@ import android.util.Log;
import
com.google.gson.Gson
;
import
com.google.gson.Gson
;
import
com.xf.weixinclick.http.stringfactory.StringConverterFactory
;
import
com.xf.weixinclick.http.stringfactory.StringConverterFactory
;
import
com.xf.weixinclick.utils.JsonKit
;
import
com.xf.weixinclick.utils.SP
;
import
com.xf.weixinclick.utils.SP
;
import
com.xf.weixinclick.BuildConfig
;
import
com.xf.weixinclick.BuildConfig
;
import
com.xf.weixinclick.myApplication
;
import
com.xf.weixinclick.myApplication
;
...
@@ -33,14 +34,14 @@ import rx.schedulers.Schedulers;
...
@@ -33,14 +34,14 @@ import rx.schedulers.Schedulers;
* Email:liyawei@checheng.com
* Email:liyawei@checheng.com
*/
*/
public
class
HttpClientApi
{
public
class
HttpClientApi
{
final
static
int
DEFAULT_TIMEOUT
=
30
;
private
final
static
int
DEFAULT_TIMEOUT
=
30
;
final
static
Scheduler
io
=
Schedulers
.
io
();
private
final
static
Scheduler
io
=
Schedulers
.
io
();
final
static
Scheduler
main
=
AndroidSchedulers
.
mainThread
();
private
final
static
Scheduler
main
=
AndroidSchedulers
.
mainThread
();
static
String
TEST_URL
=
"http://test.mp-watch.checheng.net/api/"
;
//"http://118.178.135.158:8080/api/";
private
static
String
TEST_URL
=
"http://test.mp-watch.checheng.net/api/"
;
//"http://118.178.135.158:8080/api/";
static
String
REAL_URL
=
"http://mp-watch.checheng.net/api/"
;
private
static
String
REAL_URL
=
"http://mp-watch.checheng.net/api/"
;
static
String
BASE_URL
;
private
static
String
BASE_URL
;
public
static
String
getUrl
()
{
public
static
String
getUrl
()
{
initBaseUrl
();
initBaseUrl
();
...
@@ -60,8 +61,8 @@ public class HttpClientApi {
...
@@ -60,8 +61,8 @@ public class HttpClientApi {
}
}
}
}
static
HttpClientApi
httpClient
=
new
HttpClientApi
();
private
static
HttpClientApi
httpClient
=
new
HttpClientApi
();
static
Retrofit
retrofit
;
private
static
Retrofit
retrofit
;
private
HttpClientApi
()
{
private
HttpClientApi
()
{
initBaseUrl
();
initBaseUrl
();
...
@@ -76,7 +77,7 @@ public class HttpClientApi {
...
@@ -76,7 +77,7 @@ public class HttpClientApi {
String
content
=
response
.
body
().
string
();
String
content
=
response
.
body
().
string
();
//存入Session
//存入Session
if
(
response
.
code
()
!=
200
)
{
if
(
response
.
code
()
!=
200
)
{
ResponseBase
responseBase
=
new
Gson
()
.
fromJson
(
content
,
ResponseBase
.
class
);
ResponseBase
responseBase
=
JsonKit
.
GSON
.
fromJson
(
content
,
ResponseBase
.
class
);
myApplication
.
showToast
(
responseBase
.
getMessage
()
+
" "
+
response
.
code
());
myApplication
.
showToast
(
responseBase
.
getMessage
()
+
" "
+
response
.
code
());
if
(
response
.
code
()
==
401
)
{
if
(
response
.
code
()
==
401
)
{
myApplication
.
startLogin
();
myApplication
.
startLogin
();
...
@@ -196,4 +197,22 @@ public class HttpClientApi {
...
@@ -196,4 +197,22 @@ public class HttpClientApi {
.
observeOn
(
io
)
.
observeOn
(
io
)
.
subscribe
(
subscriber
);
.
subscribe
(
subscriber
);
}
}
public
static
void
uploadDeviceLog
(
String
device_code
,
String
name
,
String
message
,
Subscriber
<
String
>
subscriber
)
{
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"code"
,
device_code
);
map
.
put
(
"name"
,
name
);
map
.
put
(
"msg"
,
message
);
getInstance
().
devicesLog
(
map
)
.
subscribeOn
(
io
)
.
observeOn
(
io
)
.
subscribe
(
subscriber
);
}
public
static
void
getQr
(
Subscriber
<
String
>
subscriber
){
getInstance
().
getQR
().
subscribeOn
(
io
)
.
observeOn
(
main
)
.
subscribe
(
subscriber
);;
}
}
}
app/src/main/java/com/xf/weixinclick/http/stringfactory/GsonRequestBodyConverter.java
View file @
26dd3e83
...
@@ -19,6 +19,7 @@ import com.google.gson.Gson;
...
@@ -19,6 +19,7 @@ import com.google.gson.Gson;
import
com.google.gson.TypeAdapter
;
import
com.google.gson.TypeAdapter
;
import
com.google.gson.stream.JsonWriter
;
import
com.google.gson.stream.JsonWriter
;
import
com.xf.weixinclick.utils.JsonKit
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.OutputStreamWriter
;
import
java.io.OutputStreamWriter
;
import
java.io.Writer
;
import
java.io.Writer
;
...
@@ -42,7 +43,7 @@ final class GsonRequestBodyConverter<T> implements Converter<T, RequestBody> {
...
@@ -42,7 +43,7 @@ final class GsonRequestBodyConverter<T> implements Converter<T, RequestBody> {
@Override
public
RequestBody
convert
(
T
value
)
throws
IOException
{
@Override
public
RequestBody
convert
(
T
value
)
throws
IOException
{
Buffer
buffer
=
new
Buffer
();
Buffer
buffer
=
new
Buffer
();
Writer
writer
=
new
OutputStreamWriter
(
buffer
.
outputStream
(),
UTF_8
);
Writer
writer
=
new
OutputStreamWriter
(
buffer
.
outputStream
(),
UTF_8
);
JsonWriter
jsonWriter
=
new
Gson
()
.
newJsonWriter
(
writer
);
JsonWriter
jsonWriter
=
JsonKit
.
GSON
.
newJsonWriter
(
writer
);
adapter
.
write
(
jsonWriter
,
value
);
adapter
.
write
(
jsonWriter
,
value
);
jsonWriter
.
close
();
jsonWriter
.
close
();
return
RequestBody
.
create
(
MEDIA_TYPE
,
buffer
.
readByteString
());
return
RequestBody
.
create
(
MEDIA_TYPE
,
buffer
.
readByteString
());
...
...
app/src/main/java/com/xf/weixinclick/http/stringfactory/StringConverterFactory.java
View file @
26dd3e83
...
@@ -19,6 +19,7 @@ import com.google.gson.Gson;
...
@@ -19,6 +19,7 @@ import com.google.gson.Gson;
import
com.google.gson.TypeAdapter
;
import
com.google.gson.TypeAdapter
;
import
com.google.gson.reflect.TypeToken
;
import
com.google.gson.reflect.TypeToken
;
import
com.xf.weixinclick.utils.JsonKit
;
import
java.lang.annotation.Annotation
;
import
java.lang.annotation.Annotation
;
import
java.lang.reflect.Type
;
import
java.lang.reflect.Type
;
...
@@ -57,7 +58,7 @@ public final class StringConverterFactory extends Converter.Factory {
...
@@ -57,7 +58,7 @@ public final class StringConverterFactory extends Converter.Factory {
@Override
@Override
public
Converter
<?,
RequestBody
>
requestBodyConverter
(
Type
type
,
public
Converter
<?,
RequestBody
>
requestBodyConverter
(
Type
type
,
Annotation
[]
parameterAnnotations
,
Annotation
[]
methodAnnotations
,
Retrofit
retrofit
)
{
Annotation
[]
parameterAnnotations
,
Annotation
[]
methodAnnotations
,
Retrofit
retrofit
)
{
TypeAdapter
<?>
adapter
=
new
Gson
()
.
getAdapter
(
TypeToken
.
get
(
type
));
TypeAdapter
<?>
adapter
=
JsonKit
.
GSON
.
getAdapter
(
TypeToken
.
get
(
type
));
return
new
GsonRequestBodyConverter
<>(
adapter
);
return
new
GsonRequestBodyConverter
<>(
adapter
);
}
}
}
}
app/src/main/java/com/xf/weixinclick/receiver/MyMessageReceiver.java
View file @
26dd3e83
...
@@ -19,6 +19,7 @@ import com.xf.weixinclick.core.MsgSender;
...
@@ -19,6 +19,7 @@ import com.xf.weixinclick.core.MsgSender;
import
com.xf.weixinclick.myApplication
;
import
com.xf.weixinclick.myApplication
;
import
com.xf.weixinclick.utils.Accessibilitys
;
import
com.xf.weixinclick.utils.Accessibilitys
;
import
com.xf.weixinclick.utils.JsonKit
;
import
org.greenrobot.eventbus.EventBus
;
import
org.greenrobot.eventbus.EventBus
;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
...
@@ -66,7 +67,7 @@ public class MyMessageReceiver extends MessageReceiver {
...
@@ -66,7 +67,7 @@ public class MyMessageReceiver extends MessageReceiver {
new
Thread
(
new
Runnable
()
{
new
Thread
(
new
Runnable
()
{
@Override
@Override
public
void
run
()
{
public
void
run
()
{
ReceiverMsg
msg
=
new
Gson
()
.
fromJson
(
cPushMessage
.
getContent
(),
ReceiverMsg
.
class
);
ReceiverMsg
msg
=
JsonKit
.
GSON
.
fromJson
(
cPushMessage
.
getContent
(),
ReceiverMsg
.
class
);
long
second
=
System
.
currentTimeMillis
()/
1000
-
msg
.
getPushed_at
()
;
long
second
=
System
.
currentTimeMillis
()/
1000
-
msg
.
getPushed_at
()
;
if
(
second
<
15
*
60
){
if
(
second
<
15
*
60
){
...
...
app/src/main/java/com/xf/weixinclick/utils/JsonKit.java
0 → 100644
View file @
26dd3e83
package
com
.
xf
.
weixinclick
.
utils
;
import
com.google.gson.Gson
;
public
class
JsonKit
{
public
static
final
Gson
GSON
=
new
Gson
();
}
app/src/main/res/layout/activity_debug.xml
View file @
26dd3e83
...
@@ -52,6 +52,29 @@
...
@@ -52,6 +52,29 @@
android:text=
"重启网络"
android:text=
"重启网络"
android:layout_margin=
"4dp"
android:layout_margin=
"4dp"
/>
/>
<Button
android:id=
"@+id/btn_start_act"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"打开微信web"
android:layout_margin=
"4dp"
/>
</LinearLayout>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
>
<Button
android:id=
"@+id/btn_test_qr"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"手动获取登录消息"
/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
\ No newline at end of file
app/tinkerpatch.gradle
View file @
26dd3e83
...
@@ -4,7 +4,7 @@ import java.util.regex.Pattern
...
@@ -4,7 +4,7 @@ import java.util.regex.Pattern
def
bakPath
=
file
(
"${buildDir}/bakApk/"
)
def
bakPath
=
file
(
"${buildDir}/bakApk/"
)
def
baseInfo
=
"app-1.5.5-0409-13-15-18"
def
baseInfo
=
"app-1.5.5-0409-13-15-18"
def
appVersionName
=
"1.5.
5
"
def
appVersionName
=
"1.5.
8
"
def
variantName
=
"release"
def
variantName
=
"release"
tinkerpatchSupport
{
tinkerpatchSupport
{
...
...
build.gradle
View file @
26dd3e83
...
@@ -9,11 +9,10 @@ buildscript {
...
@@ -9,11 +9,10 @@ buildscript {
'buildToolsVersion'
:
'27.0.3'
,
'buildToolsVersion'
:
'27.0.3'
,
'minSdkVersion'
:
21
,
'minSdkVersion'
:
21
,
'targetSdkVersion'
:
27
,
'targetSdkVersion'
:
27
,
'supportLibVersion'
:
'27.1.
0
'
,
'supportLibVersion'
:
'27.1.
1
'
,
'applicationId'
:
'com.xf.weixinclick'
,
'applicationId'
:
'com.xf.weixinclick'
,
'butterknife'
:
'8.2.1'
,
'butterknife'
:
'8.2.1'
,
'retrofit'
:
'2.3.0'
,
'retrofit'
:
'2.3.0'
'kotlinVersion'
:
'1.2.31'
]
]
...
@@ -25,7 +24,7 @@ buildscript {
...
@@ -25,7 +24,7 @@ buildscript {
dependencies
{
dependencies
{
classpath
'com.android.tools.build:gradle:3.1.1'
classpath
'com.android.tools.build:gradle:3.1.1'
classpath
'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath
'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath
(
"com.tinkerpatch.sdk:tinkerpatch-gradle-plugin:1.2.
2
"
){
changing
=
true
}
classpath
(
"com.tinkerpatch.sdk:tinkerpatch-gradle-plugin:1.2.
6
"
){
changing
=
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