Commit 631b161e by jeffrey

先保存下吧

parent a6a9b16e
......@@ -22,8 +22,8 @@ android {
applicationId "com.xf.weixinclick"
minSdkVersion 21
targetSdkVersion 25
versionCode 5
versionName "1.4"
versionCode 6
versionName "1.5.2"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
externalNativeBuild {
cmake {
......
......@@ -4,6 +4,7 @@ import android.annotation.TargetApi;
import android.os.BatteryManager;
import android.os.Build;
import android.text.TextUtils;
import android.util.Log;
import com.alibaba.sdk.android.push.noonesdk.PushServiceFactory;
import com.xf.weixinclick.http.HttpClientApi;
......@@ -23,6 +24,7 @@ import static android.content.Context.BATTERY_SERVICE;
*/
public class HeartBeatAction {
private String TAG = HeartBeatAction.class.getSimpleName();
private static HeartBeatAction heartBeatAction;
private boolean isRunning = false;
public static HeartBeatAction get(){
......@@ -45,16 +47,18 @@ public class HeartBeatAction {
.subscribe(new Subscriber<Long>() {
@Override
public void onCompleted() {
Log.d(TAG,"onCompleted");
}
@Override
public void onError(Throwable e) {
Log.d(TAG,e.getMessage());
}
@Override
public void onNext(Long aLong) {
Log.d(TAG,"onNext");
String name = (String) SP.getParam("divice", "");
if (TextUtils.isEmpty(name)){
return;
......
......@@ -95,7 +95,7 @@ public class LoginActivity extends BaseActivity {
new HttpSubscriber<String>() {
@Override
public void onStart() {
execShellCmd("input tap " + 100 + " " + 100);
execShellCmd("input tap " + 10 + " " + 10);
showProgress("正在请求");
}
......
......@@ -6,8 +6,10 @@ import android.app.NotificationManager;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.graphics.Color;
import android.os.BatteryManager;
import android.os.Build;
......@@ -37,6 +39,8 @@ import com.xf.weixinclick.view.WaveView;
import org.greenrobot.eventbus.EventBus;
import java.io.DataOutputStream;
import java.io.OutputStream;
import java.lang.reflect.Type;
import java.text.SimpleDateFormat;
import java.util.Calendar;
......@@ -159,7 +163,7 @@ public class MainActivity extends BaseActivity {
e.printStackTrace();
}
ReceiverMsg msg = new ReceiverMsg();
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");
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.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));
......@@ -228,11 +232,21 @@ public class MainActivity extends BaseActivity {
});
ensureListenerStatus();
// checkRoot();
}
@Override
public void onBackPressed() {
// super.onBackPressed();
PackageManager pm = getPackageManager();
ResolveInfo homeInfo =
pm.resolveActivity(new Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_HOME), 0);
ActivityInfo ai = homeInfo.activityInfo;
Intent startIntent = new Intent(Intent.ACTION_MAIN);
startIntent.addCategory(Intent.CATEGORY_LAUNCHER);
startIntent.setComponent(new ComponentName(ai.packageName, ai.name));
startActivity(startIntent);
}
private void ensureListenerStatus(){
......@@ -272,6 +286,7 @@ public class MainActivity extends BaseActivity {
if (mWaveHelper != null){
mWaveHelper.start();
}
}
@Override
......@@ -281,4 +296,29 @@ public class MainActivity extends BaseActivity {
mWaveHelper.cancel();
}
}
// private void checkRoot() {
//// Log.d("checkRoot", "execShellCmd " + cmd);
//
// try {
// // 申请获取root权限,这一步很重要,不然会没有作用
// Process process = Runtime.getRuntime().exec("su");
// // 获取输出流
// OutputStream outputStream = process.getOutputStream();
// DataOutputStream dataOutputStream = new DataOutputStream(
// outputStream);
// dataOutputStream.writeBytes("exit\n");
// int exitValue = process.waitFor();
// Log.d("checkRoot", "exitValue " + exitValue);
//
// dataOutputStream.flush();
// dataOutputStream.close();
// outputStream.close();
// } catch (Throwable t) {
// t.printStackTrace();
// Log.d("checkRoot", t.getMessage());
// }
// }
}
......@@ -72,11 +72,11 @@ public class NewService extends AccessibilityService {
/**
* 当前任务的步骤,完成一步+1
*/
private int step = -1;
private int step = 0;
long times = 0;
boolean clickDone = false;
long lastShowToastTime ;
......@@ -107,24 +107,30 @@ public class NewService extends AccessibilityService {
public void receiverMsg(final ReceiverMsg msg) {
Log.d(TAG, "receiverMsg");
//收到消息后 打开文件传输助手
// Log.d(TAG, "点击文件传输助手");
delayBean = msg.getTime_config();
if (delayBean == null){
Log.d(TAG, "delayBean 是空");
}
// execShellCmd("input tap 220 200");
if (step != 0 && taskMsg != null){
long haveRunTime = System.currentTimeMillis()/1000 - taskMsg.getPushed_at();
if (haveRunTime < 20 ){
Log.d(TAG, "前还有任务在执行,什么都不做");
showToast(getApplicationContext(),"当前还有任务在执行,什么都不做");
return;
}
if (haveRunTime > 40){
Log.d(TAG, "之前任务超过40秒,清除并开始新任务");
showToast(getApplicationContext(),"之前任务超过40秒,清除并开始新任务");
resetAll();
}
}
//发送触发的消息给service,难道微信没有触发?
delayDeal(delayBean.getAfter_open_weixin_file_helper_delay(), new IDelayMethord() {
@Override
public void delayMethord() {
clickDone = true;
// showToast(getApplicationContext(),"消息的 unique_id 是 " + msg.getUnique_id());
Log.d(TAG, "receiverMsg里面触发下页面消息 unique_id " + msg.getUnique_id());
WeChatStatus.receiverMsg();
String Url = msg.getQr_addr();
......@@ -153,7 +159,13 @@ public class NewService extends AccessibilityService {
String className = event.getClassName().toString();
Log.d(TAG, "get event = " + eventType + " class " + className + " step " + step);
long currentTime = System.currentTimeMillis();
if (currentTime - lastShowToastTime > 10 *1000){
boolean taskMsgExist = taskMsg == null ;
String taskMsgPrompt = taskMsgExist ? "消息是空":"消息存在";
showToast(getApplicationContext(),"辅助service还活着 step = " + step + " " + taskMsgPrompt);
lastShowToastTime = currentTime;
}
if (!className.contains(MM_PNAME)) {
return;
}
......@@ -591,7 +603,7 @@ public class NewService extends AccessibilityService {
/**
* 返回
*/
private void turnBack(int code, int size) {
private void turnBack(final int code, int size) {
Log.d(TAG, "执行返回" + code + " size " + size);
//需要返回
......@@ -623,6 +635,8 @@ public class NewService extends AccessibilityService {
public void delayMethord() {
Log.d("fei ", "执行返回 step 4");
execShellCmd("input keyevent 4");
upResult(code,message_id);
}
});
// if (size > 1) {
......@@ -636,9 +650,7 @@ public class NewService extends AccessibilityService {
// }
// WeChatStatus.finishAll();
clickDone = false;
// String uniqueID = taskMsg.getUnique_id();
upResult(code,message_id);
resetAll();
}
......@@ -707,7 +719,7 @@ public class NewService extends AccessibilityService {
execShellCmd("input tap " + x + " " + y);
} else {
Log.d(TAG, "找不到消息 消息url" + taskMsg.getQr_addr());
execShellCmd("input tap " + dip2px(80) + " " + dip2px(540));
execShellCmd("input tap " + dip2px(100) + " " + dip2px(540));
}
}
......
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 sign in to comment