├── .gitignore
├── .idea
├── .name
├── compiler.xml
├── copyright
│ └── profiles_settings.xml
├── encodings.xml
├── gradle.xml
├── misc.xml
├── modules.xml
└── runConfigurations.xml
├── README.md
├── app
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── linhao
│ │ └── inspectwechatfriend
│ │ └── ApplicationTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── linhao
│ │ │ └── inspectwechatfriend
│ │ │ ├── Preferences.java
│ │ │ ├── accessibility
│ │ │ └── InspectWechatFriendService.java
│ │ │ ├── activity
│ │ │ ├── DeleteFriendListActivity.java
│ │ │ └── MainActivity.java
│ │ │ └── utils
│ │ │ ├── PerformClickUtils.java
│ │ │ └── Utils.java
│ └── res
│ │ ├── layout
│ │ ├── activity_delete_friend_list.xml
│ │ └── activity_main.xml
│ │ ├── mipmap-hdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-mdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xhdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xxhdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xxxhdpi
│ │ └── ic_launcher.png
│ │ ├── values-w820dp
│ │ ├── dimens.xml
│ │ └── strings.xml
│ │ ├── values
│ │ ├── colors.xml
│ │ ├── dimens.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ │ └── xml
│ │ └── inspect_wechat_friend.xml
│ └── test
│ └── java
│ └── linhao
│ └── inspectwechatfriend
│ └── ExampleUnitTest.java
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── settings.gradle
└── wxid_ui.png
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 |
--------------------------------------------------------------------------------
/.idea/.name:
--------------------------------------------------------------------------------
1 | InspectWechatFriend
--------------------------------------------------------------------------------
/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/.idea/copyright/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
22 |
23 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 | 1.8
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # InspectWechatFriend
2 | 检测微信是否有删除好友,目前只适配了6.3.32版本的,在android studio上导入,运行程序后点击开始检测,如果手机没有开启无障碍服务,则会调到设置页面进行打开无障碍服务,该app主要是用到了AccessibilityService 界面的ui控件的检测使用的是Google自带的uiautomatorviewer
3 | 
4 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 23
5 | buildToolsVersion "23.0.1"
6 |
7 | defaultConfig {
8 | applicationId "linhao.inspectwechatfriend"
9 | minSdkVersion 21
10 | targetSdkVersion 23
11 | versionCode 1
12 | versionName "1.0"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | dependencies {
23 | compile fileTree(dir: 'libs', include: ['*.jar'])
24 | testCompile 'junit:junit:4.12'
25 | compile 'com.android.support:appcompat-v7:23.0.1'
26 | }
27 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in E:\sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/linhao/inspectwechatfriend/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package linhao.inspectwechatfriend;
2 |
3 | import android.app.Application;
4 | import android.test.ApplicationTestCase;
5 |
6 | /**
7 | * Testing Fundamentals
8 | */
9 | public class ApplicationTest extends ApplicationTestCase {
10 | public ApplicationTest() {
11 | super(Application.class);
12 | }
13 | }
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
27 |
28 |
29 |
30 |
31 |
34 |
35 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/app/src/main/java/linhao/inspectwechatfriend/Preferences.java:
--------------------------------------------------------------------------------
1 | package linhao.inspectwechatfriend;
2 |
3 | import android.content.Context;
4 | import android.content.SharedPreferences;
5 | import java.util.ArrayList;
6 | import java.util.HashSet;
7 | import java.util.List;
8 | import java.util.Set;
9 |
10 | import linhao.inspectwechatfriend.accessibility.InspectWechatFriendService;
11 |
12 | /**
13 | * Created by linhao on 16/12/30.
14 | */
15 |
16 | public class Preferences {
17 |
18 | public static void saveDeleteFriends(Context context) {
19 | SharedPreferences sharedPreferences = context.getSharedPreferences("delete", Context.MODE_PRIVATE);
20 | sharedPreferences.edit().putStringSet("delete_friends", InspectWechatFriendService.deleteList).apply();
21 | }
22 |
23 |
24 | public static List getDeleteFriends(Context context){
25 | SharedPreferences sharedPreferences = context.getSharedPreferences("delete", Context.MODE_PRIVATE);
26 | Set hashSet = sharedPreferences.getStringSet("delete_friends",new HashSet());
27 | List stringList = new ArrayList<>();
28 | for(String s:hashSet){
29 | stringList.add(s);
30 | }
31 | return stringList;
32 |
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/app/src/main/java/linhao/inspectwechatfriend/accessibility/InspectWechatFriendService.java:
--------------------------------------------------------------------------------
1 | package linhao.inspectwechatfriend.accessibility;
2 |
3 | import android.accessibilityservice.AccessibilityService;
4 | import android.content.Intent;
5 | import android.util.Log;
6 | import android.view.accessibility.AccessibilityEvent;
7 | import android.view.accessibility.AccessibilityNodeInfo;
8 | import android.widget.Toast;
9 | import java.util.ArrayList;
10 | import java.util.Arrays;
11 | import java.util.HashSet;
12 | import java.util.List;
13 |
14 | import linhao.inspectwechatfriend.Preferences;
15 | import linhao.inspectwechatfriend.activity.DeleteFriendListActivity;
16 | import linhao.inspectwechatfriend.utils.PerformClickUtils;
17 | import linhao.inspectwechatfriend.utils.Utils;
18 |
19 | import static android.content.ContentValues.TAG;
20 | /**
21 | * Created by linhao on 16/12/30.
22 | */
23 |
24 | public class InspectWechatFriendService extends AccessibilityService {
25 |
26 | public static final int GROUP_COUNT = 39;//群组成员个数
27 |
28 | public static final String WECHAT_VERSION_32 = "6.3.32";
29 |
30 | public static List nickNameList = new ArrayList<>();
31 | public static HashSet deleteList = new HashSet<>();
32 | public static HashSet sortItems = new HashSet<>();
33 |
34 | public static boolean hasComplete = false;
35 | public static boolean complete = false;
36 | public static boolean canChecked;
37 |
38 | public static String selectUI_listview_id = "com.tencent.mm:id/en";
39 | public static String selectUI_checkbox_id = "com.tencent.mm:id/n3";
40 | public static String selectUI_sortitem_id = "com.tencent.mm:id/a90";
41 | public static String selectUI_nickname_id = "com.tencent.mm:id/lm";
42 | public static String selectUI_create_button_id = "com.tencent.mm:id/g9";
43 | public static String chattingUI_message_id = "com.tencent.mm:id/bfx";
44 | public static String groupinfoUI_listview_id = "android:id/list";
45 | private Intent intent = null;
46 |
47 | @Override
48 | protected void onServiceConnected() {//辅助服务被打开后 执行此方法
49 | super.onServiceConnected();
50 | Toast.makeText(this, "_已开启检测好友服务_", Toast.LENGTH_LONG).show();
51 | intent = new Intent(this, DeleteFriendListActivity.class);
52 | String wechatVersion = Utils.getVersion(this);
53 | if (WECHAT_VERSION_32.equals(wechatVersion)) {
54 | selectUI_listview_id = "com.tencent.mm:id/en";
55 | selectUI_checkbox_id = "com.tencent.mm:id/n3";
56 | selectUI_sortitem_id = "com.tencent.mm:id/a90";
57 | selectUI_nickname_id = "com.tencent.mm:id/lm";
58 | selectUI_create_button_id = "com.tencent.mm:id/g9";
59 | chattingUI_message_id = "com.tencent.mm:id/bfx";
60 | groupinfoUI_listview_id = "android:id/list";
61 | }
62 | }
63 |
64 | @Override
65 | public void onAccessibilityEvent(AccessibilityEvent accessibilityEvent) {//监听手机当前窗口状态改变 比如 Activity 跳转,内容变化,按钮点击等事件
66 |
67 | //如果手机当前界面的窗口发送变化
68 | if (accessibilityEvent.getEventType() == AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED) {
69 |
70 | //获取当前activity的类名:
71 | String currentWindowActivity = accessibilityEvent.getClassName().toString();
72 | if (!hasComplete) {
73 | if ("com.tencent.mm.ui.contact.SelectContactUI".equals(currentWindowActivity)) {
74 | canChecked = true;
75 | createGroup();
76 | } else if ("com.tencent.mm.ui.chatting.ChattingUI".equals(currentWindowActivity)) {
77 | getDeleteFriend();
78 | } else if ("com.tencent.mm.plugin.chatroom.ui.ChatroomInfoUI".equals(currentWindowActivity)) {
79 | deleteGroup();
80 | } else if ("com.tencent.mm.ui.LauncherUI".equals(currentWindowActivity)) {
81 | PerformClickUtils.findTextAndClick(this, "更多功能按钮");
82 | try {
83 | Thread.sleep(1000);
84 | } catch (InterruptedException e) {
85 | e.printStackTrace();
86 | }
87 | PerformClickUtils.findTextAndClick(this, "发起群聊");
88 | }
89 | } else {
90 | nickNameList.clear();
91 | deleteList.clear();
92 | sortItems.clear();
93 | if (intent != null) {
94 | intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
95 | startActivity(intent);
96 | stopSelf();
97 | }
98 | intent = null;
99 | }
100 | }
101 |
102 | }
103 |
104 | /**
105 | * 模拟创建群组步骤
106 | */
107 | private void createGroup() {
108 | AccessibilityNodeInfo accessibilityNodeInfo = getRootInActiveWindow();
109 | if (accessibilityNodeInfo == null) {
110 | return;
111 | }
112 | List listview = accessibilityNodeInfo.findAccessibilityNodeInfosByViewId(selectUI_listview_id);
113 | int count = 0;
114 | int allCount = listview.get(0).getCollectionInfo().getRowCount() - 4;
115 | int sorltCount = sortItems.size();
116 | Log.e("allCount---", String.valueOf(allCount));
117 | Log.e("sorltCount---", String.valueOf(sorltCount));
118 | if (!listview.isEmpty()) {
119 | while (canChecked) {
120 | List checkboxList = accessibilityNodeInfo.findAccessibilityNodeInfosByViewId(selectUI_checkbox_id);
121 | List sortList = accessibilityNodeInfo.findAccessibilityNodeInfosByViewId(selectUI_sortitem_id);
122 |
123 | for (AccessibilityNodeInfo nodeInfo : sortList) {
124 | if (nodeInfo != null && nodeInfo.getText() != null) {
125 | sortItems.add(nodeInfo.getText().toString());
126 | }
127 | }
128 | for (AccessibilityNodeInfo nodeInfo : checkboxList) {
129 |
130 | String nickname = nodeInfo.getParent().findAccessibilityNodeInfosByViewId(selectUI_nickname_id).get(0).getText().toString();
131 | if (!nickNameList.contains(nickname)) {
132 | nickNameList.add(nickname);
133 | PerformClickUtils.performClick(nodeInfo);
134 | count++;
135 | Log.e(TAG, "nickname = " + nickname);
136 | Log.e("count---", String.valueOf(count));
137 | int lastCount = nickNameList.size() - listview.get(0).getCollectionInfo().getRowCount() + sortItems.size() + 4;
138 | Log.e("lastCount---", String.valueOf(lastCount));
139 | if (count >= GROUP_COUNT || nickNameList.size() >= listview.get(0).getCollectionInfo().getRowCount() - sortItems.size() - 4) {
140 | List createButtons = accessibilityNodeInfo.findAccessibilityNodeInfosByViewId(selectUI_create_button_id);
141 | if (!createButtons.isEmpty()) {
142 | canChecked = false;
143 | PerformClickUtils.performClick(createButtons.get(0));
144 | }
145 | if (nickNameList.size() >= listview.get(0).getCollectionInfo().getRowCount() - sortItems.size() - 4) {
146 | complete = true;
147 | System.out.println("end--------" + String.valueOf(complete));
148 | }
149 | return;
150 | }
151 | }
152 | }
153 | listview.get(0).performAction(AccessibilityNodeInfo.ACTION_SCROLL_FORWARD);
154 | try {
155 | Thread.sleep(1000);
156 | } catch (InterruptedException e) {
157 | e.printStackTrace();
158 | }
159 | }
160 | }
161 | }
162 |
163 | /**
164 | * 模拟获取被删好友列表步骤
165 | */
166 | private void getDeleteFriend() {
167 | AccessibilityNodeInfo accessibilityNodeInfo = getRootInActiveWindow();
168 | if (accessibilityNodeInfo == null) {
169 | return;
170 | }
171 | List nodeInfoList = accessibilityNodeInfo.findAccessibilityNodeInfosByViewId(chattingUI_message_id);
172 |
173 | for (AccessibilityNodeInfo nodeInfo : nodeInfoList) {
174 | if (nodeInfo != null && nodeInfo.getText() != null && nodeInfo.getText().toString().contains("你无法邀请未添加你为好友的用户进去群聊,请先向")) {
175 | String str = nodeInfo.getText().toString();
176 | str = str.replace("你无法邀请未添加你为好友的用户进去群聊,请先向", "");
177 | str = str.replace("发送朋友验证申请。对方通过验证后,才能加入群聊。", "");
178 | String[] arr = str.split("、");
179 | System.out.println("arr------" + arr);
180 | deleteList.addAll(Arrays.asList(arr));
181 | Preferences.saveDeleteFriends(this);
182 | Log.e(TAG, "deleteList.size():" + deleteList.size());
183 | Toast.makeText(this, "僵尸粉数量:" + deleteList.size(), Toast.LENGTH_SHORT).show();
184 | break;
185 | }
186 | }
187 | PerformClickUtils.findTextAndClick(this, "聊天信息");
188 | }
189 |
190 | /**
191 | * 退出群组步骤
192 | */
193 | private void deleteGroup() {
194 | AccessibilityNodeInfo accessibilityNodeInfo = getRootInActiveWindow();
195 | if (accessibilityNodeInfo == null) {
196 | return;
197 | }
198 | List nodeInfoList = accessibilityNodeInfo.findAccessibilityNodeInfosByViewId(groupinfoUI_listview_id);
199 | if (!nodeInfoList.isEmpty()) {
200 | boolean isDelete = false;
201 | while (true) {
202 | List deletes = nodeInfoList.get(0).findAccessibilityNodeInfosByText("删除并退出");
203 | if (deletes != null && deletes.size() != 0) {
204 | String deleteButton = deletes.get(0).getText().toString();
205 | if (deleteButton != null && deleteButton.equals("删除并退出")) {
206 | isDelete = true;
207 | break;
208 | }
209 | }
210 | if (!isDelete) {
211 | nodeInfoList.get(0).performAction(AccessibilityNodeInfo.ACTION_SCROLL_FORWARD);
212 | try {
213 | Thread.sleep(1000);
214 | } catch (InterruptedException e) {
215 | e.printStackTrace();
216 | }
217 | }
218 | }
219 | PerformClickUtils.findTextAndClick(this, "删除并退出");
220 | try {
221 | Thread.sleep(1000);
222 | } catch (InterruptedException e) {
223 | e.printStackTrace();
224 | }
225 | PerformClickUtils.findTextAndClick(this, "离开群聊");
226 | try {
227 | Thread.sleep(1000);
228 | PerformClickUtils.findTextAndClick(this, "离开群聊");
229 | } catch (InterruptedException e) {
230 | e.printStackTrace();
231 | }
232 | if (complete) {
233 | hasComplete = true;
234 | }
235 | }
236 | }
237 |
238 | @Override
239 | public void onInterrupt() {//辅助服务被关闭 执行此方法
240 | canChecked = false;
241 | Toast.makeText(this, "_检测好友服务被中断啦_", Toast.LENGTH_LONG).show();
242 | }
243 | }
244 |
--------------------------------------------------------------------------------
/app/src/main/java/linhao/inspectwechatfriend/activity/DeleteFriendListActivity.java:
--------------------------------------------------------------------------------
1 | package linhao.inspectwechatfriend.activity;
2 |
3 | import android.os.Bundle;
4 | import android.support.v7.app.AppCompatActivity;
5 | import android.widget.ArrayAdapter;
6 | import android.widget.ListView;
7 | import android.widget.TextView;
8 |
9 |
10 | import java.util.List;
11 |
12 | import linhao.inspectwechatfriend.Preferences;
13 | import linhao.inspectwechatfriend.R;
14 |
15 | public class DeleteFriendListActivity extends AppCompatActivity {
16 |
17 | @Override
18 | protected void onCreate(Bundle savedInstanceState) {
19 | super.onCreate(savedInstanceState);
20 | setContentView(R.layout.activity_delete_friend_list);
21 | ListView listView = (ListView) findViewById(R.id.listview);
22 | TextView textView = (TextView) findViewById(R.id.desc);
23 |
24 | List list = Preferences.getDeleteFriends(this);
25 | textView.setText("被删好友数量:"+list.size());
26 | listView.setAdapter(new ArrayAdapter<>(this,android.R.layout.simple_list_item_1,list));
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/app/src/main/java/linhao/inspectwechatfriend/activity/MainActivity.java:
--------------------------------------------------------------------------------
1 | package linhao.inspectwechatfriend.activity;
2 |
3 | import android.content.Intent;
4 | import android.os.Bundle;
5 | import android.support.v7.app.AppCompatActivity;
6 | import android.util.Log;
7 | import android.view.View;
8 | import android.view.accessibility.AccessibilityManager;
9 | import android.widget.Button;
10 | import android.widget.Toast;
11 |
12 | import linhao.inspectwechatfriend.R;
13 | import linhao.inspectwechatfriend.utils.Utils;
14 |
15 | import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
16 |
17 | public class MainActivity extends AppCompatActivity {
18 | public static final String LauncherUI = "com.tencent.mm.ui.LauncherUI";
19 | public static final String MM = "com.tencent.mm";
20 |
21 | @Override
22 | protected void onCreate(Bundle savedInstanceState) {
23 | super.onCreate(savedInstanceState);
24 | setContentView(R.layout.activity_main);
25 | Log.d("MainActivity", Utils.getVersion(this));
26 | findViewById(R.id.start).setOnClickListener(new View.OnClickListener() {
27 | @Override
28 | public void onClick(View view) {
29 | AccessibilityManager accessibilityManager = (AccessibilityManager) getSystemService(ACCESSIBILITY_SERVICE);
30 | accessibilityManager.addAccessibilityStateChangeListener(new AccessibilityManager.AccessibilityStateChangeListener() {
31 | @Override
32 | public void onAccessibilityStateChanged(boolean b) {
33 | if(b){
34 | Intent intent = new Intent();
35 | intent.setFlags(FLAG_ACTIVITY_NEW_TASK);
36 | intent.setClassName(MM, LauncherUI);
37 | startActivity(intent);
38 | }else{
39 | try {
40 | //打开系统设置中辅助功能
41 | Intent intent = new Intent(android.provider.Settings.ACTION_ACCESSIBILITY_SETTINGS);
42 | startActivity(intent);
43 | Toast.makeText(MainActivity.this, "找到检测被删好友辅助,然后开启服务即可", Toast.LENGTH_LONG).show();
44 | } catch (Exception e) {
45 | e.printStackTrace();
46 | }
47 | }
48 | }
49 | });
50 |
51 | if(!accessibilityManager.isEnabled()){
52 | try {
53 | //打开系统设置中辅助功能
54 | Intent intent = new Intent(android.provider.Settings.ACTION_ACCESSIBILITY_SETTINGS);
55 | startActivity(intent);
56 | Toast.makeText(MainActivity.this, "找到检测被删好友辅助,然后开启服务即可", Toast.LENGTH_LONG).show();
57 | } catch (Exception e) {
58 | e.printStackTrace();
59 | }
60 | }else{
61 | Intent intent = new Intent();
62 | intent.setFlags(FLAG_ACTIVITY_NEW_TASK);
63 | intent.setClassName(MM, LauncherUI);
64 | startActivity(intent);
65 | }
66 | }
67 | });
68 | final Button button = (Button) findViewById(R.id.getCount);
69 | button.setOnClickListener(new View.OnClickListener() {
70 | @Override
71 | public void onClick(View view) {
72 | startActivity(new Intent(MainActivity.this, DeleteFriendListActivity.class));
73 | }
74 | });
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/app/src/main/java/linhao/inspectwechatfriend/utils/PerformClickUtils.java:
--------------------------------------------------------------------------------
1 | package linhao.inspectwechatfriend.utils;
2 |
3 | import android.accessibilityservice.AccessibilityService;
4 | import android.os.Build;
5 | import android.view.accessibility.AccessibilityNodeInfo;
6 |
7 | import java.util.List;
8 |
9 | /**
10 | * Created by linhao on 16/12/30.
11 | */
12 |
13 | public class PerformClickUtils {
14 |
15 |
16 | /**
17 | * 在当前页面查找文字内容并点击
18 | *
19 | * @param text
20 | */
21 | public static void findTextAndClick(AccessibilityService accessibilityService,String text) {
22 |
23 | AccessibilityNodeInfo accessibilityNodeInfo = accessibilityService.getRootInActiveWindow();
24 | if (accessibilityNodeInfo == null) {
25 | return;
26 | }
27 |
28 | List nodeInfoList = accessibilityNodeInfo.findAccessibilityNodeInfosByText(text);
29 | if (nodeInfoList != null && !nodeInfoList.isEmpty()) {
30 | for (AccessibilityNodeInfo nodeInfo : nodeInfoList) {
31 | if (nodeInfo != null && (text.equals(nodeInfo.getText()) || text.equals(nodeInfo.getContentDescription()))) {
32 | performClick(nodeInfo);
33 | break;
34 | }
35 | }
36 | }
37 | }
38 |
39 |
40 | /**
41 | * 检查viewId进行点击
42 | *
43 | * @param accessibilityService
44 | * @param id
45 | */
46 | public static void findViewIdAndClick(AccessibilityService accessibilityService,String id) {
47 |
48 | AccessibilityNodeInfo accessibilityNodeInfo = accessibilityService.getRootInActiveWindow();
49 | if (accessibilityNodeInfo == null) {
50 | return;
51 | }
52 |
53 | List nodeInfoList = accessibilityNodeInfo.findAccessibilityNodeInfosByViewId(id);
54 | if (nodeInfoList != null && !nodeInfoList.isEmpty()) {
55 | for (AccessibilityNodeInfo nodeInfo : nodeInfoList) {
56 | if (nodeInfo != null) {
57 | performClick(nodeInfo);
58 | break;
59 | }
60 | }
61 | }
62 | }
63 | /**
64 | * 在当前页面查找对话框文字内容并点击
65 | *
66 | * @param text1 默认点击text1
67 | * @param text2
68 | */
69 | public static void findDialogAndClick(AccessibilityService accessibilityService,String text1, String text2) {
70 |
71 | AccessibilityNodeInfo accessibilityNodeInfo = accessibilityService.getRootInActiveWindow();
72 | if (accessibilityNodeInfo == null) {
73 | return;
74 | }
75 |
76 | List dialogWait = accessibilityNodeInfo.findAccessibilityNodeInfosByText(text1);
77 | List dialogConfirm = accessibilityNodeInfo.findAccessibilityNodeInfosByText(text2);
78 | if (!dialogWait.isEmpty() && !dialogConfirm.isEmpty()) {
79 | for (AccessibilityNodeInfo nodeInfo : dialogWait) {
80 | if (nodeInfo != null && text1.equals(nodeInfo.getText())) {
81 | performClick(nodeInfo);
82 | break;
83 | }
84 | }
85 | }
86 |
87 | }
88 |
89 | //模拟点击事件
90 | public static void performClick(AccessibilityNodeInfo nodeInfo) {
91 | if (nodeInfo == null) {
92 | return;
93 | }
94 | if (nodeInfo.isClickable()) {
95 | nodeInfo.performAction(AccessibilityNodeInfo.ACTION_CLICK);
96 | } else {
97 | performClick(nodeInfo.getParent());
98 | }
99 | }
100 |
101 | //模拟返回事件
102 | public static void performBack(AccessibilityService service) {
103 | if (service == null) {
104 | return;
105 | }
106 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
107 | try {
108 | Thread.sleep(200);
109 | } catch (InterruptedException e) {
110 | e.printStackTrace();
111 | }
112 | service.performGlobalAction(AccessibilityService.GLOBAL_ACTION_BACK);
113 | }
114 | }
115 | }
116 |
--------------------------------------------------------------------------------
/app/src/main/java/linhao/inspectwechatfriend/utils/Utils.java:
--------------------------------------------------------------------------------
1 | package linhao.inspectwechatfriend.utils;
2 |
3 | import android.content.Context;
4 | import android.content.pm.PackageInfo;
5 | import android.content.pm.PackageManager;
6 |
7 | import java.util.List;
8 |
9 | /**
10 | * Created by linhao on 16/12/30.
11 | */
12 |
13 | public class Utils {
14 |
15 | /**
16 | * 获取微信的版本号
17 | * @param context
18 | * @return
19 | */
20 | public static String getVersion(Context context){
21 | PackageManager packageManager = context.getPackageManager();
22 | List packageInfoList = packageManager.getInstalledPackages(0);
23 |
24 | for(PackageInfo packageInfo:packageInfoList){
25 | if("com.tencent.mm".equals(packageInfo.packageName)){
26 | return packageInfo.versionName;
27 | }
28 | }
29 | return "6.3.32";
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_delete_friend_list.xml:
--------------------------------------------------------------------------------
1 |
2 |
14 |
15 |
19 |
20 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
13 |
18 |
19 |
24 |
25 |
30 |
31 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linhaosheng/InspectWechatFriend/169e74991376e5687d577da9c7c665de6f3f583e/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linhaosheng/InspectWechatFriend/169e74991376e5687d577da9c7c665de6f3f583e/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linhaosheng/InspectWechatFriend/169e74991376e5687d577da9c7c665de6f3f583e/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linhaosheng/InspectWechatFriend/169e74991376e5687d577da9c7c665de6f3f583e/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linhaosheng/InspectWechatFriend/169e74991376e5687d577da9c7c665de6f3f583e/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values-w820dp/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | 检查被删好友
3 | 检查被删好友辅助软件
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 检查被删好友
4 | 检查被删好友辅助软件
5 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/inspect_wechat_friend.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/test/java/linhao/inspectwechatfriend/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package linhao.inspectwechatfriend;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * To work on unit tests, switch the Test Artifact in the Build Variants view.
9 | */
10 | public class ExampleUnitTest {
11 | @Test
12 | public void addition_isCorrect() throws Exception {
13 | assertEquals(4, 2 + 2);
14 | }
15 | }
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:2.1.0'
9 |
10 | // NOTE: Do not place your application dependencies here; they belong
11 | // in the individual module build.gradle files
12 | }
13 | }
14 |
15 | allprojects {
16 | repositories {
17 | jcenter()
18 | }
19 | }
20 |
21 | task clean(type: Delete) {
22 | delete rootProject.buildDir
23 | }
24 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linhaosheng/InspectWechatFriend/169e74991376e5687d577da9c7c665de6f3f583e/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Dec 28 10:00:20 PST 2015
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
52 | if expr "$link" : '/.*' > /dev/null; then
53 | PRG="$link"
54 | else
55 | PRG=`dirname "$PRG"`"/$link"
56 | fi
57 | done
58 | SAVED="`pwd`"
59 | cd "`dirname \"$PRG\"`/" >/dev/null
60 | APP_HOME="`pwd -P`"
61 | cd "$SAVED" >/dev/null
62 |
63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64 |
65 | # Determine the Java command to use to start the JVM.
66 | if [ -n "$JAVA_HOME" ] ; then
67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 | # IBM's JDK on AIX uses strange locations for the executables
69 | JAVACMD="$JAVA_HOME/jre/sh/java"
70 | else
71 | JAVACMD="$JAVA_HOME/bin/java"
72 | fi
73 | if [ ! -x "$JAVACMD" ] ; then
74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75 |
76 | Please set the JAVA_HOME variable in your environment to match the
77 | location of your Java installation."
78 | fi
79 | else
80 | JAVACMD="java"
81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82 |
83 | Please set the JAVA_HOME variable in your environment to match the
84 | location of your Java installation."
85 | fi
86 |
87 | # Increase the maximum file descriptors if we can.
88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 | MAX_FD_LIMIT=`ulimit -H -n`
90 | if [ $? -eq 0 ] ; then
91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 | MAX_FD="$MAX_FD_LIMIT"
93 | fi
94 | ulimit -n $MAX_FD
95 | if [ $? -ne 0 ] ; then
96 | warn "Could not set maximum file descriptor limit: $MAX_FD"
97 | fi
98 | else
99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 | fi
101 | fi
102 |
103 | # For Darwin, add options to specify how the application appears in the dock
104 | if $darwin; then
105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 | fi
107 |
108 | # For Cygwin, switch paths to Windows format before running java
109 | if $cygwin ; then
110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 | JAVACMD=`cygpath --unix "$JAVACMD"`
113 |
114 | # We build the pattern for arguments to be converted via cygpath
115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 | SEP=""
117 | for dir in $ROOTDIRSRAW ; do
118 | ROOTDIRS="$ROOTDIRS$SEP$dir"
119 | SEP="|"
120 | done
121 | OURCYGPATTERN="(^($ROOTDIRS))"
122 | # Add a user-defined pattern to the cygpath arguments
123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 | fi
126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 | i=0
128 | for arg in "$@" ; do
129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131 |
132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 | else
135 | eval `echo args$i`="\"$arg\""
136 | fi
137 | i=$((i+1))
138 | done
139 | case $i in
140 | (0) set -- ;;
141 | (1) set -- "$args0" ;;
142 | (2) set -- "$args0" "$args1" ;;
143 | (3) set -- "$args0" "$args1" "$args2" ;;
144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 | esac
151 | fi
152 |
153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 | function splitJvmOpts() {
155 | JVM_OPTS=("$@")
156 | }
157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159 |
160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
161 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/wxid_ui.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linhaosheng/InspectWechatFriend/169e74991376e5687d577da9c7c665de6f3f583e/wxid_ui.png
--------------------------------------------------------------------------------