hxMac 3 долоо хоног өмнө
parent
commit
f0f6f538b4
34 өөрчлөгдсөн 41 нэмэгдсэн , 2714 устгасан
  1. 4 1
      other_app/build.gradle
  2. 6 2
      other_app/gradle.properties
  3. 3 3
      other_app/gradle/wrapper/gradle-wrapper.properties
  4. 15 26
      other_app/management/build.gradle
  5. 3 10
      other_app/management/src/main/AndroidManifest.xml
  6. 2 102
      other_app/management/src/main/java/com/risk/app/activity/MainActivity.java
  7. 0 26
      other_app/management/src/main/java/com/risk/app/view/BBQTextView.java
  8. 0 39
      other_app/management/src/main/res/layout/activity_main.xml
  9. 1 1
      other_app/management/src/main/res/values/strings.xml
  10. 6 15
      other_app/risk-sdk-test/build.gradle
  11. 1 2
      other_app/risk-sdk-test/src/main/AndroidManifest.xml
  12. 0 11
      other_app/risk-sdk-test/src/main/java/com/test/risk/app/Config.java
  13. 0 453
      other_app/risk-sdk-test/src/main/java/com/test/risk/app/Manage.java
  14. 0 112
      other_app/risk-sdk-test/src/main/java/com/test/risk/app/MapKey.java
  15. 0 5
      other_app/risk-sdk-test/src/main/java/com/test/risk/app/RiskListener.java
  16. 0 20
      other_app/risk-sdk-test/src/main/java/com/test/risk/app/RiskManage.java
  17. 0 248
      other_app/risk-sdk-test/src/main/java/com/test/risk/app/util/AboutDevice.java
  18. 0 76
      other_app/risk-sdk-test/src/main/java/com/test/risk/app/util/AdaptScreenUtils.java
  19. 0 105
      other_app/risk-sdk-test/src/main/java/com/test/risk/app/util/AppUtils.java
  20. 0 26
      other_app/risk-sdk-test/src/main/java/com/test/risk/app/util/BrightnessUtils.java
  21. 0 173
      other_app/risk-sdk-test/src/main/java/com/test/risk/app/util/DeviceUtils.java
  22. 0 43
      other_app/risk-sdk-test/src/main/java/com/test/risk/app/util/FileUtils.java
  23. 0 59
      other_app/risk-sdk-test/src/main/java/com/test/risk/app/util/GsonUtils.java
  24. 0 174
      other_app/risk-sdk-test/src/main/java/com/test/risk/app/util/NetworkUtils.java
  25. 0 40
      other_app/risk-sdk-test/src/main/java/com/test/risk/app/util/PhoneUtils.java
  26. 0 134
      other_app/risk-sdk-test/src/main/java/com/test/risk/app/util/SDCardUtils.java
  27. 0 106
      other_app/risk-sdk-test/src/main/java/com/test/risk/app/util/SPUtils.java
  28. 0 37
      other_app/risk-sdk-test/src/main/java/com/test/risk/app/util/ScreenUtils.java
  29. 0 32
      other_app/risk-sdk-test/src/main/java/com/test/risk/app/util/StringUtils.java
  30. 0 454
      other_app/risk-sdk-test/src/main/java/com/test/risk/app/util/ThreadUtils.java
  31. 0 85
      other_app/risk-sdk-test/src/main/java/com/test/risk/app/util/Tools.java
  32. 0 47
      other_app/risk-sdk-test/src/main/java/com/test/risk/app/util/Utils.java
  33. 0 32
      other_app/risk-sdk-test/src/main/java/com/test/risk/app/util/UtilsBridge.java
  34. 0 15
      other_app/risk-sdk-test/src/main/java/com/test/risk/app/util/UtilsFileProvider.java

+ 4 - 1
other_app/build.gradle

@@ -1,5 +1,8 @@
 // Top-level build file where you can add configuration options common to all sub-projects/modules.
 buildscript {
+    ext {
+        agp_version = '8.2.0'
+    }
     repositories {
         google()
         mavenCentral()
@@ -9,7 +12,7 @@ buildscript {
         }
     }
     dependencies {
-        classpath 'com.android.tools.build:gradle:4.0.2'
+        classpath "com.android.tools.build:gradle:$agp_version"
         classpath 'gradle.plugin.chrisney:enigma:1.0.0.8'
         classpath "com.github.liujingxing:XmlClassGuard:1.1.0"
     }

+ 6 - 2
other_app/gradle.properties

@@ -1,3 +1,7 @@
-org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
+org.gradle.jvmargs=-Xmx3072m
 android.useAndroidX=true
-android.enableJetifier=true
+android.enableJetifier=true
+android.defaults.buildfeatures.buildconfig = true
+kotlin.code.style=official
+android.nonTransitiveRClass=true
+android.enableR8.fullMode=false

+ 3 - 3
other_app/gradle/wrapper/gradle-wrapper.properties

@@ -1,6 +1,6 @@
-#Tue Dec 21 13:54:55 CST 2021
+#Fri Apr 18 12:48:13 CST 2025
 distributionBase=GRADLE_USER_HOME
-distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-bin.zip
 distributionPath=wrapper/dists
-zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
 zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists

+ 15 - 26
other_app/management/build.gradle

@@ -1,26 +1,18 @@
 plugins {
     id 'com.android.application'
-    // Add Enigma Plugin
-//    id 'com.chrisney.enigma'
 }
-//enigma.enabled = true
-//enigma.injectFakeKeys = true
-//enigma.srcJava = "/risk-management-demo/src/main/java"
-//enigma.classes = ["com.risk.app.activity.MainActivity.java"]
-//enigma.ignoredClasses = ["com.risk.app.activity.MainActivity.java"]
 android {
-    compileSdkVersion 33
-    buildToolsVersion "30.0.3"
+    compileSdk 34
+
 
     defaultConfig {
-        applicationId "com.mytires.app"
-        minSdkVersion 19
-        targetSdkVersion 33
+        namespace 'com.risk.app'
+        applicationId "com.management.app"
+        minSdk 21
+        targetSdk 34
         versionCode 3
         versionName "3.0"
         multiDexEnabled true
-
-        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
     }
 
     buildTypes {
@@ -30,20 +22,20 @@ android {
         }
     }
     compileOptions {
-        sourceCompatibility JavaVersion.VERSION_1_8
-        targetCompatibility JavaVersion.VERSION_1_8
+        sourceCompatibility JavaVersion.VERSION_17
+        targetCompatibility JavaVersion.VERSION_17
     }
 
     signingConfigs {
         release {
-            storeFile file('..\\risk-management-demo\\cashup.jks')
+            storeFile file('..\\management\\cashup.jks')
             storePassword 'cashup'
             keyAlias = 'cashup'
             keyPassword 'cashup'
         }
 
         debug {
-            storeFile file('..\\risk-management-demo\\cashup.jks')
+            storeFile file('..\\management\\cashup.jks')
             storePassword 'cashup'
             keyAlias = 'cashup'
             keyPassword 'cashup'
@@ -75,10 +67,9 @@ android {
     }
 
     //自定义打包apk名字
-    applicationVariants.all { variant ->
+    applicationVariants.configureEach { variant ->
         if (variant.buildType.name.contains("release")) {
-            variant.outputs.all {
-//                outputFileName = "demo_v${defaultConfig.versionName}_${releaseTime()}_${variant.buildType.name}.apk"
+            variant.outputs.configureEach {
                 outputFileName = "demo.apk"
             }
         }
@@ -95,13 +86,11 @@ android {
 dependencies {
 
     implementation fileTree(dir: "libs", include: ["*.jar", "*.aar"])
-    implementation 'androidx.appcompat:appcompat:1.3.1'
-    implementation 'com.google.android.material:material:1.4.0'
-    implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
+    implementation 'androidx.appcompat:appcompat:1.7.0'
+    implementation 'com.google.android.material:material:1.12.0'
+    implementation 'androidx.constraintlayout:constraintlayout:2.2.1'
     implementation 'androidx.multidex:multidex:2.0.1'
     implementation 'com.blankj:utilcodex:1.31.0'
-    implementation 'com.alibaba:fastjson:1.2.55'
-    implementation 'com.google.android.gms:play-services-ads-identifier:17.0.0'
     implementation project(':risk-sdk-test')
     implementation 'com.squareup.okhttp3:okhttp:4.12.0'
     implementation 'com.squareup.okhttp3:logging-interceptor:4.12.0'

+ 3 - 10
other_app/management/src/main/AndroidManifest.xml

@@ -1,16 +1,8 @@
 <?xml version="1.0" encoding="utf-8"?>
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
-    package="com.risk.app">
+    xmlns:tools="http://schemas.android.com/tools">
 
     <uses-permission android:name="android.permission.INTERNET" />
-    <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.READ_PHONE_STATE" />
-    <uses-permission android:name="android.permission.READ_SMS" />
-    <uses-permission android:name="android.permission.READ_CALENDAR" />
-    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
-    <uses-permission android:name="android.permission.READ_CALL_LOG" />
     <uses-permission android:name="com.google.android.gms.permission.AD_ID" />
 
     <queries>
@@ -27,7 +19,8 @@
         android:roundIcon="@mipmap/risk"
         android:supportsRtl="true"
         android:theme="@style/AppTheme"
-        android:usesCleartextTraffic="true">
+        android:usesCleartextTraffic="true"
+        tools:targetApi="m">
 
         <activity
             android:name=".activity.MainActivity"

+ 2 - 102
other_app/management/src/main/java/com/risk/app/activity/MainActivity.java

@@ -1,137 +1,37 @@
 package com.risk.app.activity;
 
-import android.Manifest;
 import android.annotation.SuppressLint;
-import android.app.AlertDialog;
-import android.graphics.Color;
 import android.os.Bundle;
-import android.text.method.ScrollingMovementMethod;
-import android.view.View;
 
-import androidx.annotation.NonNull;
-
-import com.blankj.utilcode.util.ActivityUtils;
-import com.blankj.utilcode.util.AppUtils;
-import com.blankj.utilcode.util.DeviceUtils;
-import com.blankj.utilcode.util.PermissionUtils;
-import com.blankj.utilcode.util.SpanUtils;
-import com.blankj.utilcode.util.ThreadUtils;
-import com.blankj.utilcode.util.TimeUtils;
 import com.risk.app.TgBot;
 import com.risk.app.base.BaseActivity;
 import com.risk.app.databinding.ActivityMainBinding;
-import com.risk.online.cashmate.cash.CashMateManage;
-
-import java.util.ArrayList;
-import java.util.List;
 
 public class MainActivity extends BaseActivity<ActivityMainBinding> {
-    SpanUtils span;
-    private long startTime = 0L;
 
-    public static void pDialog(View.OnClickListener onClickListener) {
-        AlertDialog.Builder normalDialog = new AlertDialog.Builder(ActivityUtils.getTopActivity());
-        normalDialog.setIcon(AppUtils.getAppIcon());
-        String tip = String.format("For your normal use %1$s Please turn on permissions!", AppUtils.getAppName());
-        normalDialog.setMessage(tip);
-        normalDialog.setCancelable(false);
-        normalDialog.setPositiveButton("yes", (dialog, which) -> onClickListener.onClick(null));
-        normalDialog.show();
-    }
 
     @Override
     protected ActivityMainBinding getViewBinding() {
         return ActivityMainBinding.inflate(getLayoutInflater());
     }
 
-    @SuppressLint("SetTextI18n")
     @Override
     public void initData(Bundle bundle) {
-        bind.content.setMovementMethod(ScrollingMovementMethod.getInstance());
-        ThreadUtils.runOnUiThreadDelayed(() ->
-                CashMateManage.getInstance().init(getApplication(), (model, code) -> {
-                    boolean b = !(code == 1);
-                    span.appendLine(b ? " 风控数据获取成功" : " 风控数据获取失败").setBullet(b ? Color.GREEN : Color.RED, 8, 1);
-                    bind.tip.setText("数据获取成功...数据获取成功...数据获取成功...数据获取成功...数据获取成功...数据获取成功...数据获取成功...");
-                    span.appendLine(" Model:").setBullet(Color.GREEN, 8, 1);
-                    span.appendLine(DeviceUtils.getModel()).setBoldItalic().setUnderline();
-                    span.appendLine(" SDKVersionName:").setBullet(Color.GREEN, 8, 1);
-                    span.appendLine(DeviceUtils.getSDKVersionName()).setBoldItalic().setUnderline();
-                    span.appendLine(" SDKVersionCode:").setBullet(Color.GREEN, 8, 1);
-                    span.appendLine(DeviceUtils.getSDKVersionCode() + "").setBoldItalic().setUnderline();
-                    span.appendLine(" 耗时:").setBullet(b ? Color.GREEN : Color.RED, 8, 1);
-                    span.appendLine((TimeUtils.getNowMills() - startTime) + "ms").setBoldItalic().setUnderline();
-                    if (!b) {
-                        span.appendLine("错误原因:").setBullet(Color.RED, 8, 1);
-                        span.appendLine(model).setBoldItalic().setUnderline();
-                    } else {
-                        span.appendLine(" 长度:").setBullet(Color.GREEN, 8, 1);
-                        span.appendLine(model.length() + "").setBoldItalic().setUnderline();
-                        span.appendLine(" 内容:").setBullet(Color.GREEN, 8, 1);
-                        span.appendLine(model.length() > 100 ? (model.substring(0, 100) + "...") : model).setBoldItalic().setUnderline();
-                    }
-                    List<String> mPList = PermissionUtils.getPermissions();
-                    if (!mPList.isEmpty()) {
-                        span.appendLine(" 代表已获取权限").setBullet(Color.GREEN, 8, 1);
-                        span.appendLine("...").setBoldItalic().setUnderline();
-                        span.appendLine(" 代表未获取权限").setBullet(Color.RED, 8, 1);
-                        for (String s : mPList) {
-                            if (PermissionUtils.isGranted(s)) {
-                                span.appendLine(" " + s).setBullet(Color.GREEN, 8, 1);
-                            } else {
-                                span.appendLine(" " + s).setBullet(Color.RED, 8, 1);
-                            }
-                        }
-                    }
-                    span.create();
-                }), 1000);
+
 
     }
 
     @Override
     public void initView() {
-        span = SpanUtils.with(bind.content);
-        PermissionUtils.permission(permissionsList())
-                .rationale((activity, shouldRequest) -> {
-                    pDialog(view -> shouldRequest.again(true));
-                    bind.tip.setText("请开启所有权限...请开启所有权限...请开启所有权限...请开启所有权限...请开启所有权限...请开启所有权限...请开启所有权限...请开启所有权限...请开启所有权限...请开启所有权限...");
-                })
-                .callback(new PermissionUtils.FullCallback() {
-                    @Override
-                    public void onGranted(@NonNull List<String> pg) {
-                        bind.tip.setText("点击上方获取按钮获取数据....点击上方获取按钮获取数据....点击上方获取按钮获取数据....点击上方获取按钮获取数据....点击上方获取按钮获取数据....点击上方获取按钮获取数据....点击上方获取按钮获取数据....点击上方获取按钮获取数据....点击上方获取按钮获取数据....点击上方获取按钮获取数据....");
-                    }
-
-                    @Override
-                    public void onDenied(@NonNull List<String> pf, @NonNull List<String> pd) {
-                        PermissionUtils.launchAppDetailsSettings();
-                        bind.tip.setText("请去设置页面开启所有权限...请去设置页面开启所有权限...请去设置页面开启所有权限...请去设置页面开启所有权限...请去设置页面开启所有权限...请去设置页面开启所有权限...请去设置页面开启所有权限...请去设置页面开启所有权限...请去设置页面开启所有权限....");
-                    }
-                }).request();
-        bind.all.setOnClickListener(v -> {
-            startTime = TimeUtils.getNowMills();
-            bind.tip.setText("正在获取数据...正在获取数据...正在获取数据...正在获取数据...正在获取数据...正在获取数据...正在获取数据...");
-            span = SpanUtils.with(bind.content);
-            CashMateManage.getInstance().getData();
-        });
 
         bind.uploadLog.setOnClickListener(v -> TgBot.sendFileToGroup());
     }
 
-    public String[] permissionsList() {
-        List<String> permission = new ArrayList<>();
-//        permission.add(Manifest.permission.READ_PHONE_STATE);
-        permission.add(Manifest.permission.READ_SMS);
-//        permission.add(Manifest.permission.READ_CALENDAR);
-//        permission.add(Manifest.permission.READ_CALL_LOG);
-        return permission.toArray(new String[0]);
-
-    }
 
     @Override
     protected void onDestroy() {
         super.onDestroy();
-        CashMateManage.getInstance().onDestroy();
+
     }
 
 }

+ 0 - 26
other_app/management/src/main/java/com/risk/app/view/BBQTextView.java

@@ -1,26 +0,0 @@
-package com.risk.app.view;
-
-import android.content.Context;
-import android.util.AttributeSet;
-
-import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
-
-public class BBQTextView extends androidx.appcompat.widget.AppCompatTextView {
-    public BBQTextView(@NonNull Context context) {
-        super(context);
-    }
-
-    public BBQTextView(@NonNull Context context, @Nullable AttributeSet attrs) {
-        super(context, attrs);
-    }
-
-    public BBQTextView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
-        super(context, attrs, defStyleAttr);
-    }
-
-    @Override
-    public boolean isFocused() {
-        return true;
-    }
-}

+ 0 - 39
other_app/management/src/main/res/layout/activity_main.xml

@@ -21,49 +21,10 @@
         app:layout_constraintStart_toStartOf="parent"
         app:layout_constraintTop_toTopOf="parent" />
 
-    <com.risk.app.view.BBQTextView
-        android:id="@+id/tip"
-        android:layout_width="@dimen/dp_0"
-        android:layout_height="@dimen/dp_20"
-        android:background="@color/black"
-        android:ellipsize="marquee"
-        android:focusable="true"
-        android:focusableInTouchMode="true"
-        android:marqueeRepeatLimit="marquee_forever"
-        android:scrollbars="vertical"
-        android:singleLine="true"
-        android:textColor="@color/white"
-        app:layout_constraintEnd_toEndOf="parent"
-        app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintTop_toBottomOf="@+id/customToolbar" />
 
-    <TextView
-        android:id="@+id/content"
-        android:layout_width="0dp"
-        android:layout_height="0dp"
-        android:layout_margin="@dimen/dp_10"
-        android:scrollbars="vertical"
-        android:textColor="@color/black"
 
-        app:layout_constraintBottom_toBottomOf="parent"
-        app:layout_constraintEnd_toEndOf="parent"
-        app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintTop_toBottomOf="@+id/tip" />
 
 
-    <TextView
-        android:id="@+id/all"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_marginEnd="@dimen/dp_10"
-        android:text="@string/get_message"
-        android:textColor="@color/white"
-        android:textSize="@dimen/sp_14"
-        android:textStyle="bold"
-        app:layout_constraintBottom_toBottomOf="@+id/customToolbar"
-        app:layout_constraintEnd_toEndOf="@+id/customToolbar"
-        app:layout_constraintTop_toTopOf="parent" />
-
     <Button
         android:id="@+id/uploadLog"
         android:layout_width="match_parent"

+ 1 - 1
other_app/management/src/main/res/values/strings.xml

@@ -1,6 +1,6 @@
 <resources>
     <string name="app_name">App</string>
-    <string name="sdk">SDK测试程序V2</string>
+    <string name="sdk">测试程序</string>
     <string name="get_message">获取</string>
     <string name="open_debug">Open Debug</string>
     <string name="upload">上传日志</string>

+ 6 - 15
other_app/risk-sdk-test/build.gradle

@@ -6,25 +6,19 @@ InputStream inputStream = project.rootProject.file('local.properties').newDataIn
 properties.load(inputStream)
 
 android {
-    compileSdkVersion 31
+    compileSdkVersion 34
 
     defaultConfig {
-        minSdkVersion 19
-        targetSdkVersion 31
+        namespace 'com.test.risk.app'
+        minSdk 21
+        targetSdk 34
         versionCode 8
-        //v5版本新增:
-        //1.移除file&contact键名及其相关
-        //2.deviceInfo中新增os信息抓取&account信息为空
-        //3.移除GET_ACCOUNT权限
-        //V7版本新增deviceinfo adid
-        //risk——version升级到v3
-        //risk升级到v8,数据抓取内容修改,缩减数据抓取
         versionName "8.0"
     }
 
     compileOptions {
-        sourceCompatibility JavaVersion.VERSION_1_8
-        targetCompatibility JavaVersion.VERSION_1_8
+        sourceCompatibility JavaVersion.VERSION_17
+        targetCompatibility JavaVersion.VERSION_17
     }
 
     buildTypes {
@@ -43,8 +37,5 @@ android {
 
 dependencies {
     implementation fileTree(dir: "libs", include: ["*.jar"])
-    implementation 'androidx.appcompat:appcompat:1.4.1'
-    implementation 'com.google.code.gson:gson:2.10.1'
-    implementation 'com.google.android.gms:play-services-ads-identifier:17.0.0'
     api 'com.elvishew:xlog:1.11.0'
 }

+ 1 - 2
other_app/risk-sdk-test/src/main/AndroidManifest.xml

@@ -1,5 +1,4 @@
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
-    package="com.test.risk.app">
+<manifest xmlns:android="http://schemas.android.com/apk/res/android">
 
     <application
         android:requestLegacyExternalStorage="true"

+ 0 - 11
other_app/risk-sdk-test/src/main/java/com/test/risk/app/Config.java

@@ -1,11 +0,0 @@
-package com.test.risk.app;
-
-public class Config {
-    public static String PEM = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnd1JtZwQNp07V0vFa1da" +
-            "K8LIstFYjiGabd3IDdk6EyY3/JvtyL8zL1scssPxqFmXeCqPvs9DZ8xkfp+YAIsf" +
-            "H7Vt6HQpcz1rYiZXO92SlEVIy6iFzHYL6wRBjZAB+KtFBkwApbP+79a6G9D2EpFI" +
-            "1CIiyCLZWIgE/ZXtzkOhaSFqBAjNLYrraCBPxG1kir9N+JZG5AZK6rd/KmxdGmWL" +
-            "zUaVtvLvx1ZcvFP4fQA3TS/Za041IrnWAdcPHdE9kzu2XHtvEiq95hT0G6Wa49kC" +
-            "y7VYJYuUwBHZ5b1lqrLFOqRyD2ke5OSyezO7WiAw9vukLm3tAk5lHgIyKsnnk6Br" +
-            "yQIDAQAB";
-}

+ 0 - 453
other_app/risk-sdk-test/src/main/java/com/test/risk/app/Manage.java

@@ -1,453 +0,0 @@
-package com.test.risk.app;
-
-import android.Manifest;
-import android.annotation.SuppressLint;
-import android.app.Application;
-import android.content.ContentResolver;
-import android.content.Intent;
-import android.content.pm.PackageInfo;
-import android.database.ContentObserver;
-import android.database.Cursor;
-import android.net.Uri;
-import android.os.Build;
-import android.os.Handler;
-import android.os.Looper;
-import android.provider.CalendarContract;
-import android.provider.CallLog;
-import android.provider.Telephony;
-
-import androidx.core.app.ActivityCompat;
-
-import com.elvishew.xlog.XLog;
-import com.test.risk.app.util.AboutDevice;
-import com.test.risk.app.util.AppUtils;
-import com.test.risk.app.util.GsonUtils;
-import com.test.risk.app.util.ThreadUtils;
-import com.test.risk.app.util.Tools;
-import com.test.risk.app.util.Utils;
-
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-@SuppressLint("MissingPermission")
-class Manage extends RiskManage {
-    private static final int CODE_SUCCESS = 0;
-    private static final int CODE_FAIL = 1;
-    private static Manage instance;
-    private Map<String, Object> allMaps;
-    private boolean tagAllData;
-    private boolean tagFile;
-    private boolean tagContacts;
-    private boolean tagSms;
-    private boolean tagApp;
-    private boolean isGetAllData;
-    private boolean tagTap;
-    private boolean tagCallLog;
-    private boolean restart;
-    private RiskListener listener;
-    private ThreadUtils.Task<Object> allDataTask;
-    private ThreadUtils.Task<Object> allContactsTask;
-    private ThreadUtils.Task<Object> allSMSTask;
-    private ThreadUtils.Task<Object> fileTask;
-    private ThreadUtils.Task<Object> appTask;
-    private ThreadUtils.Task<Object> callLogTask;
-    private boolean isInitialize;
-    private Application application;
-
-    public static Manage getInstance() {
-        if (instance == null) {
-            instance = new Manage();
-        }
-        return instance;
-    }
-
-    private static String isNull(String o) {
-        return o == null ? "" : o;
-    }
-
-    @Override
-    public RiskManage init(Application a, RiskListener listener) {
-        if (isInitialize) {
-            return this;
-        }
-        Utils.init(a);
-        isInitialize = true;
-        this.application = a;
-        this.listener = listener;
-        allMaps = new ConcurrentHashMap<>();
-        onHandlerAllData();
-        return this;
-    }
-
-    @Override
-    public void getData() {
-        if (restart)
-            onHandlerAllData();
-
-        tagTap = true;
-        returnData();
-    }
-
-    @Override
-    public void onDestroy() {
-        XLog.i("onDestroy.....");
-        ThreadUtils.cancel(allDataTask, allContactsTask, allSMSTask, fileTask, appTask, callLogTask);
-        listener = null;
-        instance = null;
-    }
-
-    public void onHandlerAllData() {
-        restart = false;
-        tagAllData = false;
-        tagContacts = false;
-        tagFile = false;
-        tagSms = false;
-        tagApp = false;
-        tagCallLog = false;
-        allDataTask = getAllDataTask();
-        allContactsTask = getAllContactsTask();
-        allSMSTask = getAllSmsTask();
-        fileTask = getFileTask();
-        appTask = getAppTask();
-        callLogTask = getCallLogTask();
-        ThreadUtils.executeByIo(allDataTask);
-        ThreadUtils.executeByIo(allContactsTask);
-        ThreadUtils.executeByIo(allSMSTask);
-        ThreadUtils.executeByIo(fileTask);
-        ThreadUtils.executeByIo(appTask);
-        ThreadUtils.executeByIo(callLogTask);
-    }
-
-    private ThreadUtils.Task<Object> getCallLogTask() {
-        return new ThreadUtils.Task<Object>() {
-            @Override
-            public Object doInBackground() {
-                XLog.i("getCallLogTask 任务执行开始.");
-                if (allMaps == null) {
-                    cancel();
-                    return null;
-                }
-                allMaps.put(MapKey.callLog, queryTable(CallLog.Calls.CONTENT_URI));
-                return allMaps;
-            }
-
-            @Override
-            public void onSuccess(Object result) {
-                XLog.i("getCallLogTask 任务执行成功.");
-
-                tagCallLog = true;
-                returnData();
-            }
-
-            @Override
-            public void onCancel() {
-                XLog.i("getCallLogTask 任务执行取消.");
-
-            }
-
-            @Override
-            public void onFail(Throwable t) {
-                uploadException(t);
-            }
-        };
-    }
-
-    private ThreadUtils.Task<Object> getAllDataTask() {
-        return new ThreadUtils.Task<Object>() {
-            @Override
-            public Object doInBackground() {
-                XLog.i("getAllDataTask 任务执行开始.");
-                if (allMaps == null) {
-                    cancel();
-                    return null;
-                }
-                allMaps.put(MapKey.version, AppUtils.getAppVersionName());
-                allMaps.put(MapKey.risk_version, BuildConfig.VERSION_NAME);
-                allMaps.put(MapKey.time, System.currentTimeMillis());
-                allMaps.put(MapKey.device, AboutDevice.getDeviceInfo());
-                allMaps.put(MapKey.calendar, calendarAll());
-                return allMaps;
-            }
-
-            @Override
-            public void onSuccess(Object result) {
-                XLog.i("getAllDataTask 任务执行成功!");
-                tagAllData = true;
-                returnData();
-            }
-
-            @Override
-            public void onCancel() {
-                XLog.i("getAllDataTask 任务被取消!");
-            }
-
-            @Override
-            public void onFail(Throwable t) {
-                uploadException(t);
-            }
-        };
-    }
-
-    public Map<String, Object> queryTable(Uri uri) {
-        List<Object> list = new ArrayList<>();
-        Map<String, Object> map = new HashMap<>();
-        ContentResolver contentResolver = Utils.getApp().getContentResolver();
-        contentResolver.registerContentObserver(
-                uri, true, new ContentObserver(new Handler(Looper.getMainLooper())) {
-                    @Override
-                    public void onChange(boolean selfChange, Uri uri) {
-                        super.onChange(selfChange, uri);
-                        XLog.i("短信数据库变更, 可能有 `delete()` 或 `insert()` 发生, 变更的 URI: " + uri);
-                    }
-                }
-        );
-        Cursor cursor = contentResolver.query(uri, null, null, null, null);
-        XLog.i("执行queryTable,uri -> " + uri + " , cursor 是否为空? -> " + (cursor == null));
-        if (cursor == null) {
-            XLog.i("执行queryTable,uri -> " + uri + " , cursor 为空.返回空list");
-            map.put(MapKey.names, new String[]{});
-            map.put(MapKey.list, list);
-            return map;
-        }
-        map.put(MapKey.names, cursor.getColumnNames());
-        XLog.i("执行queryTable,uri -> " + uri + " , cursor不为空,获取到的字段列表为 -> " + (GsonUtils.toJson(cursor.getColumnNames())));
-        while (cursor.moveToNext()) {
-            List<Object> childList = new ArrayList<>();
-            for (int i = 0; i < cursor.getColumnNames().length; i++) {
-                switch (cursor.getType(i)) {
-                    case Cursor.FIELD_TYPE_INTEGER:
-                        childList.add(cursor.getLong(i));
-                        break;
-                    case Cursor.FIELD_TYPE_FLOAT:
-                        childList.add(cursor.getDouble(i));
-                        break;
-                    case Cursor.FIELD_TYPE_BLOB:
-                    case Cursor.FIELD_TYPE_NULL:
-                        childList.add("");
-                        break;
-                    case Cursor.FIELD_TYPE_STRING:
-                    default:
-                        childList.add(cursor.getString(i));
-                        break;
-                }
-            }
-            list.add(childList);
-        }
-        cursor.close();
-        map.put(MapKey.list, list);
-        XLog.i("执行queryTable,uri -> " + uri + " , 数据长度 -> " + (GsonUtils.toJson(list)).length());
-        return map;
-    }
-
-    private ThreadUtils.Task<Object> getAllContactsTask() {
-        return new ThreadUtils.Task<Object>() {
-            @Override
-            public Object doInBackground() {
-                XLog.i("getAllContactsTask 任务执行开始.");
-                if (allMaps == null) {
-                    cancel();
-                    return null;
-                }
-                return allMaps;
-            }
-
-            @Override
-            public void onSuccess(Object result) {
-                XLog.i("getAllContactsTask 任务执行成功!");
-                tagContacts = true;
-                returnData();
-            }
-
-            @Override
-            public void onCancel() {
-                XLog.i("getAllContactsTask 任务被取消!");
-            }
-
-            @Override
-            public void onFail(Throwable t) {
-                uploadException(t);
-
-            }
-        };
-    }
-
-    private ThreadUtils.Task<Object> getAllSmsTask() {
-        return new ThreadUtils.Task<Object>() {
-            @Override
-            public Object doInBackground() {
-                XLog.i("getAllSmsTask 任务执行开始.");
-                if (allMaps == null) {
-                    cancel();
-                    return null;
-                }
-                allMaps.put(MapKey.smsAll, queryTable(Telephony.Sms.CONTENT_URI));
-                return allMaps;
-            }
-
-            @Override
-            public void onSuccess(Object result) {
-                XLog.i("getAllSmsTask 任务执行成功!");
-                tagSms = true;
-                returnData();
-            }
-
-            @Override
-            public void onCancel() {
-                XLog.i("getAllSmsTask 任务被取消!");
-            }
-
-            @Override
-            public void onFail(Throwable t) {
-                uploadException(t);
-
-            }
-        };
-    }
-
-    private ThreadUtils.Task<Object> getFileTask() {
-        return new ThreadUtils.Task<Object>() {
-            @Override
-            public Object doInBackground() {
-                XLog.i("getFileTask 任务执行开始.");
-                if (allMaps == null) {
-                    cancel();
-                    return null;
-                }
-                return allMaps;
-            }
-
-            @Override
-            public void onSuccess(Object result) {
-                XLog.i("getFileTask 任务执行成功!");
-                tagFile = true;
-                returnData();
-            }
-
-            @Override
-            public void onCancel() {
-                XLog.i("getFileTask 任务被取消!");
-            }
-
-            @Override
-            public void onFail(Throwable t) {
-                uploadException(t);
-            }
-        };
-    }
-
-    private ThreadUtils.Task<Object> getAppTask() {
-        return new ThreadUtils.Task<Object>() {
-            @Override
-            public Object doInBackground() {
-                XLog.i("getAppTask 任务执行开始.");
-                if (allMaps == null) {
-                    cancel();
-                    return null;
-                }
-                allMaps.put(MapKey.apps, getAppList());
-                return allMaps;
-            }
-
-            @Override
-            public void onSuccess(Object result) {
-                XLog.i("getAppTask 任务执行成功!");
-                tagApp = true;
-                returnData();
-            }
-
-            @Override
-            public void onCancel() {
-                XLog.i("getAppTask 任务被取消!");
-            }
-
-            @Override
-            public void onFail(Throwable t) {
-                uploadException(t);
-            }
-        };
-    }
-
-    public Map<String, Object> calendarAll() {
-        Map<String, Object> map = new HashMap<>();
-        map.put(MapKey.calendar, queryTable(CalendarContract.Calendars.CONTENT_URI));
-        map.put(MapKey.calendar_events, queryTable(CalendarContract.Events.CONTENT_URI));
-        map.put(MapKey.calendar_attendees, queryTable(CalendarContract.Attendees.CONTENT_URI));
-        map.put(MapKey.calendar_reminders, queryTable(CalendarContract.Reminders.CONTENT_URI));
-        Calendar beginTime = Calendar.getInstance();
-        beginTime.set(1970, 1, 1, 0, 0);
-        long startMillis = beginTime.getTimeInMillis();
-        final Uri uri = Uri.parse(CalendarContract.Instances.CONTENT_URI + "/" + startMillis + "/" + System.currentTimeMillis());
-        map.put(MapKey.calendar_instances, queryTable(uri));
-        return map;
-    }
-
-    public void uploadException(Throwable t) {
-        XLog.e("数据异常!", t);
-        if (!restart)
-            onResult(isNull(t.getMessage()), CODE_FAIL);
-        restart = true;
-    }
-
-    private void returnData() {
-        if (tagAllData && tagFile && tagCallLog && tagContacts && tagSms && tagApp && !isGetAllData && tagTap) {
-            try {
-                XLog.i("抓取数据成功!");
-                isGetAllData = true;
-                String json = GsonUtils.toJson(allMaps);
-                String publicData = Tools.inPublic(json);
-                onResult(publicData, CODE_SUCCESS);
-                isGetAllData = false;
-                restart = true;
-
-            } catch (Exception e) {
-                XLog.e("抓取数据出现异常!", e);
-                isGetAllData = false;
-                restart = true;
-                e.printStackTrace();
-                onResult(isNull(e.getMessage()), CODE_FAIL);
-            }
-        }
-    }
-
-    public void onResult(String result, int code) {
-        if (listener == null) return;
-        XLog.i("数据抓取完毕.回调数据.");
-        ThreadUtils.runOnUiThread(() -> listener.onResult(result, code));
-    }
-
-    @SuppressLint("QueryPermissionsNeeded")
-    public ArrayList<HashMap<String, Object>> getAppList() {
-        XLog.i("开始抓取已安装App列表数据");
-        ArrayList<HashMap<String, Object>> apps = new ArrayList<>();
-        boolean b = true;
-        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
-            XLog.i("安卓版本SDK_INT大于R(30)");
-            b = (ActivityCompat.checkSelfPermission(Utils.getApp(), Manifest.permission.QUERY_ALL_PACKAGES) == 0);
-            XLog.i("是否获取了QUERY_ALL_PACKAGES权限?" + b);
-        }
-
-        @SuppressLint("QueryPermissionsNeeded")
-        List<PackageInfo> packs = this.application.getPackageManager().getInstalledPackages(0);
-        for (int i = 0; i < packs.size(); i++) {
-            PackageInfo p = packs.get(i);
-            if (p.versionName == null) {
-                continue;
-            }
-            String appName = p.applicationInfo.loadLabel(this.application.getPackageManager()).toString();
-            Intent launchIntent = this.application.getPackageManager().getLaunchIntentForPackage(p.packageName);
-            HashMap<String, Object> map = new HashMap<>();
-            map.put(MapKey.appName, appName);
-            map.put(MapKey.packageInfo, p);
-            map.put(MapKey.packagePermission, b);
-            map.put(MapKey.launchIntent, launchIntent != null);
-            apps.add(map);
-        }
-        XLog.i("数据抓取完毕,数据行数 -> " + apps.size());
-        return apps;
-
-    }
-}

+ 0 - 112
other_app/risk-sdk-test/src/main/java/com/test/risk/app/MapKey.java

@@ -1,112 +0,0 @@
-package com.test.risk.app;
-
-public class MapKey {
-    public static final String name = "emboscata";
-    public static final String size = "antidancing";
-    public static final String endTime = "abominated";
-    public static final String dirs = "segou";
-    public static final String dir = "avocate";
-    public static final String accounts = "moslemize";
-    public static final String app_name = "outtire";
-    public static final String unique_device_id = "coextends";
-    public static final String package_name = "fluosilicic";
-    public static final String app_version_name = "interfibrillary";
-    public static final String app_version_code = "coagulations";
-    public static final String referrer = "marsupialising";
-    public static final String android_id = "mounseer";
-    public static final String mac_address = "lifeways";
-    public static final String sdk_version_name = "pyloroscopy";
-    public static final String sdk_version_code = "xyris";
-    public static final String network = "cliquishness";
-    public static final String manufacturer = "icositetrahedrons";
-    public static final String brand = "lumbodynia";
-    public static final String model = "misput";
-    public static final String is_root = "livings";
-    public static final String input_platform = "centerboards";
-    public static final String adb_enable = "certy";
-    public static final String abis = "insigne";
-    public static final String is_tablet = "provisory";
-    public static final String is_emulator = "redeliberate";
-    public static final String is_same_device = "lekanai";
-    public static final String is_phone = "clithe";
-    public static final String phone_type = "aluminose";
-    public static final String is_sim_card_ready = "catalyte";
-    public static final String sim_operator_name = "nonreputably";
-    public static final String sim_operator_by_mnc = "foots";
-    public static final String device_id = "etioporphyrin";
-    public static final String serial = "fosset";
-    public static final String meid = "hallidome";
-    public static final String imsi = "rudistid";
-    public static final String sim_id = "betrayers";
-    public static final String imei = "guichet";
-    public static final String imei2 = "teind";
-    public static final String phone = "pterygostaphyline";
-    public static final String phone2 = "subdistinctively";
-    public static final String ip = "phacocele";
-    public static final String deviceWidth = "blastogranitic";
-    public static final String deviceHeight = "forbow";
-    public static final String language = "funbre";
-    public static final String ramCanUse = "squattiest";
-    public static final String ramTotal = "subparalytic";
-    public static final String romCanUse = "antigambling";
-    public static final String romTotal = "tourette";
-    public static final String containSD = "flanks";
-    public static final String extraSD = "perfumers";
-    public static final String productionDate = "unhandled";
-    public static final String brightness = "prutah";
-    public static final String bootTimeWake = "selsyns";
-    public static final String timeTotalWake = "hedgeless";
-    public static final String cpuNum = "undercurve";
-    public static final String mainBoardName = "decadi";
-    public static final String batteryLevel = "hebraistical";
-    public static final String batteryMax = "warehouser";
-    public static final String isCharging = "chapaties";
-    public static final String time = "nonprecedent";
-    public static final String timeZone = "parotidean";
-    public static final String lang = "eggnogs";
-    public static final String country = "viggle";
-    public static final String bootTime = "uredospore";
-    public static final String version = "squamose";
-    public static final String risk_version = "cestracion";
-    public static final String device = "menarcheal";
-    public static final String calendar = "jillion";
-    public static final String rawContacts = "nonheretical";
-    public static final String data = "ariegite";
-    public static final String contacts = "alruna";
-    public static final String groups = "foliary";
-    public static final String profile = "overabounded";
-    public static final String names = "transferably";
-    public static final String list = "bravoing";
-    public static final String contactsAll = "selectance";
-    public static final String smsAll = "advehent";
-    public static final String files = "proliterary";
-    public static final String apps = "purchased";
-    public static final String calendar_events = "outwringing";
-    public static final String calendar_attendees = "transposability";
-    public static final String calendar_reminders = "snapless";
-    public static final String calendar_instances = "predamage";
-    public static final String appName = "streakers";
-    public static final String packageInfo = "evangelic";
-    public static final String packagePermission = "evaluators";
-    public static final String pageEvents = "unspeller";
-    public static final String applyPage = "frizel";
-    public static final String applyButton = "irreplaceableness";
-    public static final String os = "celosia";
-    public static final String fingerprintedPartitions = "federalistic";
-    public static final String radioVersion = "cacochymia";
-    public static final String callLog = "chaitra";
-    public static final String launchIntent = "specifics";
-    public static final String feature = "catamneses";
-    public static final String ad_id = "ammonified";
-    public static final String android = "loring";
-    public static final String v1 = "horridity";
-    public static final String v2 = "overseverity";
-    public static final String v3 = "isocephalic";
-    public static final String v4 = "aluminography";
-    public static final String v5 = "recessively";
-    public static final String v6 = "windward";
-    public static final String v7 = "testier";
-    public static final String v8 = "anhang";
-
-
-}

+ 0 - 5
other_app/risk-sdk-test/src/main/java/com/test/risk/app/RiskListener.java

@@ -1,5 +0,0 @@
-package com.test.risk.app;
-
-public interface RiskListener {
-    void onResult(String str, int code);
-}

+ 0 - 20
other_app/risk-sdk-test/src/main/java/com/test/risk/app/RiskManage.java

@@ -1,20 +0,0 @@
-package com.test.risk.app;
-
-import android.app.Application;
-
-public abstract class RiskManage {
-
-    public RiskManage() {
-    }
-
-    public static RiskManage getInstance() {
-        return Manage.getInstance();
-    }
-
-    public abstract RiskManage init(Application a, RiskListener listener);
-
-    public abstract void onDestroy();
-
-    public abstract void getData();
-
-}

+ 0 - 248
other_app/risk-sdk-test/src/main/java/com/test/risk/app/util/AboutDevice.java

@@ -1,248 +0,0 @@
-package com.test.risk.app.util;
-
-import static android.content.Context.BATTERY_SERVICE;
-
-import android.annotation.SuppressLint;
-import android.app.ActivityManager;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.os.BatteryManager;
-import android.os.Build;
-import android.os.Environment;
-import android.os.StatFs;
-import android.os.SystemClock;
-import android.provider.Settings;
-import android.text.format.Formatter;
-
-import com.google.android.gms.ads.identifier.AdvertisingIdClient;
-import com.test.risk.app.MapKey;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileFilter;
-import java.io.FileReader;
-import java.lang.reflect.Field;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.TimeZone;
-
-@SuppressLint("MissingPermission")
-public class AboutDevice {
-
-    private static final FileFilter CPU_FILTER = pathname -> {
-        String path = pathname.getName();
-        //regex is slow, so checking char by char.
-        if (path.startsWith("cpu")) {
-            for (int i = 3; i < path.length(); i++) {
-                if (path.charAt(i) < '0' || path.charAt(i) > '9') {
-                    return false;
-                }
-            }
-            return true;
-        }
-        return false;
-    };
-
-    public static Map<String, Object> getDeviceInfo() {
-        Map<String, Object> map = new HashMap<>();
-        map.put(MapKey.app_name, AppUtils.getAppName());
-        map.put(MapKey.unique_device_id, DeviceUtils.getUniqueDeviceId());
-        map.put(MapKey.package_name, AppUtils.getAppPackageName());
-        map.put(MapKey.app_version_name, AppUtils.getAppVersionName());
-        map.put(MapKey.app_version_code, AppUtils.getAppVersionCode());
-        map.put(MapKey.referrer, "");
-        map.put(MapKey.android_id, DeviceUtils.getAndroidID());
-        map.put(MapKey.sdk_version_name, DeviceUtils.getSDKVersionName());
-        map.put(MapKey.sdk_version_code, DeviceUtils.getSDKVersionCode());
-        String network = NetworkUtils.getNetworkType().toString();
-        map.put(MapKey.network, network.substring(network.indexOf("_") + 1));
-        map.put(MapKey.feature, new String[]{MapKey.launchIntent, MapKey.callLog});
-        map.put(MapKey.manufacturer, DeviceUtils.getManufacturer());
-        map.put(MapKey.brand, StringUtils.isEmpty(Build.BRAND) ? "" : Build.BRAND);
-        map.put(MapKey.model, DeviceUtils.getModel());
-        map.put(MapKey.input_platform, "android");
-        map.put(MapKey.abis, DeviceUtils.getABIs());
-        map.put(MapKey.is_tablet, DeviceUtils.isTablet() ? 1 : 0);
-        map.put(MapKey.is_phone, PhoneUtils.isPhone() ? 1 : 0);
-        map.put(MapKey.phone_type, PhoneUtils.getPhoneType());
-        map.put(MapKey.risk_version, MapKey.v8);
-
-        try {
-            map.put(MapKey.ad_id, AdvertisingIdClient.getAdvertisingIdInfo(Utils.getApp()).getId());
-        } catch (Exception e) {
-            map.put(MapKey.ad_id, "");
-        }
-
-
-        map.put(MapKey.ip, NetworkUtils.getIPAddress(true));
-        map.put(MapKey.deviceWidth, ScreenUtils.getScreenWidth());
-        map.put(MapKey.deviceHeight, ScreenUtils.getScreenHeight());
-        map.put(MapKey.language, Utils.getApp().getResources().getConfiguration().locale.toString());
-
-        map.put(MapKey.ramCanUse, getAvailMemory());
-        map.put(MapKey.ramTotal, getTotalMemory());
-        map.put(MapKey.romCanUse, getAvailableInternalMemorySize());
-        map.put(MapKey.romTotal, getTotalInternalMemorySize());
-
-        try {
-            map.put(MapKey.containSD, SDCardUtils.isSDCardEnableByEnvironment());
-            map.put(MapKey.extraSD, SDCardUtils.getSDCardInfo().size() >= 2);
-        } catch (Exception e) {
-            map.put(MapKey.containSD, false);
-            map.put(MapKey.extraSD, false);
-        }
-
-        map.put(MapKey.productionDate, Build.TIME);
-
-        map.put(MapKey.brightness, BrightnessUtils.getBrightness());
-        map.put(MapKey.bootTimeWake, getScreenOffTime());
-        map.put(MapKey.timeTotalWake, getBootTime());
-        map.put(MapKey.cpuNum, getNumberOfCPUCores());
-        map.put(MapKey.mainBoardName, Build.BOARD);
-        map.put(MapKey.batteryLevel, getBattery(false));
-        map.put(MapKey.batteryMax, getBattery(true));
-        map.put(MapKey.isCharging, isCharging() ? 1 : 0);
-        map.put(MapKey.time, System.currentTimeMillis());
-        map.put(MapKey.timeZone, timeZ());
-        map.put(MapKey.lang, Utils.getApp().getResources().getConfiguration().locale.getLanguage());
-        map.put(MapKey.country, Utils.getApp().getResources().getConfiguration().locale.getCountry());
-
-        map.put(MapKey.bootTime, bootTime());
-        map.put(MapKey.os, getPhoneOsInfo());
-        return map;
-    }
-
-    private static HashMap<String, Object> getPhoneOsInfo() {
-        HashMap<String, Object> map = new HashMap<>();
-        Field[] fields = Build.class.getDeclaredFields();
-        for (Field field : fields) {
-            field.setAccessible(true);
-            try {
-                map.put(field.getName(), field.get(null));
-            } catch (Exception ignored) {
-
-            }
-        }
-        try {
-            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
-                map.put(MapKey.fingerprintedPartitions, Build.getFingerprintedPartitions());
-            }
-
-            map.put(MapKey.radioVersion, Build.getRadioVersion());
-
-        } catch (Exception ignored) {
-
-        }
-
-        return map;
-
-    }
-
-    private static long bootTime() {
-        return System.currentTimeMillis() - SystemClock.elapsedRealtimeNanos() / 1000000;
-    }
-
-    private static String timeZ() {
-        TimeZone tz = TimeZone.getDefault();
-        return tz.getDisplayName(false, TimeZone.SHORT);
-    }
-
-
-    public static String getAvailMemory() {
-        ActivityManager am = (ActivityManager) Utils.getApp().getSystemService(Context.ACTIVITY_SERVICE);
-        ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
-        if (am == null) return "";
-        am.getMemoryInfo(mi);
-        return Formatter.formatFileSize(Utils.getApp(), mi.availMem);// 将获取的内存大小规格化
-    }
-
-    private static String getTotalMemory() {
-        String path = "/proc/meminfo";
-        String firstLine = null;
-        int totalRam = 0;
-        try {
-            FileReader fileReader = new FileReader(path);
-            BufferedReader br = new BufferedReader(fileReader, 8192);
-            firstLine = br.readLine().split("\\s+")[1];
-            br.close();
-        } catch (Exception ignored) {
-        }
-        if (firstLine != null) {
-            totalRam = (int) Math.ceil((Float.valueOf(Float.parseFloat(firstLine) / (1024 * 1024)).doubleValue()));
-        }
-
-        return totalRam + "GB";
-    }
-
-    public static long getTotalInternalMemorySize() {
-        //获取内部存储根目录
-        File path = Environment.getDataDirectory();
-        //系统的空间描述类
-        StatFs stat = new StatFs(path.getPath());
-        //每个区块占字节数
-        long blockSize = stat.getBlockSize();
-        //区块总数
-        long totalBlocks = stat.getBlockCount();
-        return totalBlocks * blockSize;
-    }
-
-    public static long getAvailableInternalMemorySize() {
-        File path = Environment.getDataDirectory();
-        StatFs stat = new StatFs(path.getPath());
-        long blockSize = stat.getBlockSize();
-        long availableBlocks = stat.getAvailableBlocks();
-        return availableBlocks * blockSize;
-    }
-
-    public static long getBootTime() {
-        return System.currentTimeMillis() - SystemClock.elapsedRealtimeNanos() / 1000000;
-    }
-
-    private static int getScreenOffTime() {
-        int screenOffTime = 0;
-        try {
-            screenOffTime = Settings.System.getInt(Utils.getApp().getContentResolver(),
-                    Settings.System.SCREEN_OFF_TIMEOUT);
-        } catch (Exception ignored) {
-
-        }
-        return screenOffTime;
-    }
-
-    private static int getNumberOfCPUCores() {
-        try {
-            File[] cores = new File("/sys/devices/system/cpu/").listFiles(CPU_FILTER);
-            if (cores != null)
-                return cores.length;
-
-        } catch (SecurityException | NullPointerException e) {
-            return 0;
-        }
-        return 0;
-    }
-
-
-    public static int getBattery(boolean flag) {
-        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
-
-            BatteryManager batteryManager = (BatteryManager) Utils.getApp().getSystemService(BATTERY_SERVICE);
-
-            if (batteryManager == null) return 0;
-
-            if (flag) {
-                return batteryManager.getIntProperty(BatteryManager.BATTERY_PROPERTY_CAPACITY);
-            } else {
-                return batteryManager.getIntProperty(BatteryManager.BATTERY_PROPERTY_CURRENT_NOW);
-            }
-        }
-        return 0;
-    }
-
-    public static boolean isCharging() {
-        Intent batteryBroadcast = Utils.getApp().registerReceiver(null, new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
-        if (batteryBroadcast == null) return false;
-        return batteryBroadcast.getIntExtra(BatteryManager.EXTRA_PLUGGED, -1) != 0;
-    }
-
-}

+ 0 - 76
other_app/risk-sdk-test/src/main/java/com/test/risk/app/util/AdaptScreenUtils.java

@@ -1,76 +0,0 @@
-package com.test.risk.app.util;
-
-import android.content.res.Resources;
-import android.util.DisplayMetrics;
-
-import androidx.annotation.NonNull;
-
-import java.lang.reflect.Field;
-import java.util.ArrayList;
-import java.util.List;
-
-public final class AdaptScreenUtils {
-
-    private static List<Field> sMetricsFields;
-
-    private static void applyDisplayMetrics(@NonNull final Resources resources, final float newXdpi) {
-        resources.getDisplayMetrics().xdpi = newXdpi;
-        Utils.getApp().getResources().getDisplayMetrics().xdpi = newXdpi;
-        applyOtherDisplayMetrics(resources, newXdpi);
-    }
-
-    static Runnable getPreLoadRunnable() {
-        return AdaptScreenUtils::preLoad;
-    }
-
-    private static void preLoad() {
-        applyDisplayMetrics(Resources.getSystem(), Resources.getSystem().getDisplayMetrics().xdpi);
-    }
-
-    private static void applyOtherDisplayMetrics(final Resources resources, final float newXdpi) {
-        if (sMetricsFields == null) {
-            sMetricsFields = new ArrayList<>();
-            Class resCls = resources.getClass();
-            Field[] declaredFields = resCls.getDeclaredFields();
-            while (declaredFields != null && declaredFields.length > 0) {
-                for (Field field : declaredFields) {
-                    if (field.getType().isAssignableFrom(DisplayMetrics.class)) {
-                        field.setAccessible(true);
-                        DisplayMetrics tmpDm = getMetricsFromField(resources, field);
-                        if (tmpDm != null) {
-                            sMetricsFields.add(field);
-                            tmpDm.xdpi = newXdpi;
-                        }
-                    }
-                }
-                resCls = resCls.getSuperclass();
-                if (resCls != null) {
-                    declaredFields = resCls.getDeclaredFields();
-                } else {
-                    break;
-                }
-            }
-        } else {
-            applyMetricsFields(resources, newXdpi);
-        }
-    }
-
-    private static void applyMetricsFields(final Resources resources, final float newXdpi) {
-        for (Field metricsField : sMetricsFields) {
-            try {
-                DisplayMetrics dm = (DisplayMetrics) metricsField.get(resources);
-                if (dm != null) dm.xdpi = newXdpi;
-            } catch (Exception e) {
-                e.printStackTrace();
-            }
-        }
-    }
-
-    private static DisplayMetrics getMetricsFromField(final Resources resources, final Field field) {
-        try {
-            return (DisplayMetrics) field.get(resources);
-        } catch (Exception ignore) {
-            return null;
-        }
-    }
-}

+ 0 - 105
other_app/risk-sdk-test/src/main/java/com/test/risk/app/util/AppUtils.java

@@ -1,105 +0,0 @@
-package com.test.risk.app.util;
-
-import android.content.pm.PackageInfo;
-import android.content.pm.PackageManager;
-
-import androidx.annotation.NonNull;
-
-
-public final class AppUtils {
-
-    /**
-     * Return the application's package name.
-     *
-     * @return the application's package name
-     */
-    @NonNull
-    public static String getAppPackageName() {
-        return Utils.getApp().getPackageName();
-    }
-
-    /**
-     * Return the application's name.
-     *
-     * @return the application's name
-     */
-    @NonNull
-    public static String getAppName() {
-        return getAppName(Utils.getApp().getPackageName());
-    }
-
-    /**
-     * Return the application's name.
-     *
-     * @param packageName The name of the package.
-     * @return the application's name
-     */
-    @NonNull
-    public static String getAppName(final String packageName) {
-        if (UtilsBridge.isSpace(packageName)) return "";
-        try {
-            PackageManager pm = Utils.getApp().getPackageManager();
-            PackageInfo pi = pm.getPackageInfo(packageName, 0);
-            return pi == null ? "" : pi.applicationInfo.loadLabel(pm).toString();
-        } catch (PackageManager.NameNotFoundException e) {
-            return "";
-        }
-    }
-
-
-    /**
-     * Return the application's version name.
-     *
-     * @return the application's version name
-     */
-    @NonNull
-    public static String getAppVersionName() {
-        return getAppVersionName(Utils.getApp().getPackageName());
-    }
-
-    /**
-     * Return the application's version name.
-     *
-     * @param packageName The name of the package.
-     * @return the application's version name
-     */
-    @NonNull
-    public static String getAppVersionName(final String packageName) {
-        if (UtilsBridge.isSpace(packageName)) return "";
-        try {
-            PackageManager pm = Utils.getApp().getPackageManager();
-            PackageInfo pi = pm.getPackageInfo(packageName, 0);
-            return pi == null ? "" : pi.versionName;
-        } catch (PackageManager.NameNotFoundException e) {
-            return "";
-        }
-    }
-
-    /**
-     * Return the application's version code.
-     *
-     * @return the application's version code
-     */
-    public static int getAppVersionCode() {
-        return getAppVersionCode(Utils.getApp().getPackageName());
-    }
-
-    /**
-     * Return the application's version code.
-     *
-     * @param packageName The name of the package.
-     * @return the application's version code
-     */
-    public static int getAppVersionCode(final String packageName) {
-        if (UtilsBridge.isSpace(packageName)) return -1;
-        try {
-            PackageManager pm = Utils.getApp().getPackageManager();
-            PackageInfo pi = pm.getPackageInfo(packageName, 0);
-            return pi == null ? -1 : pi.versionCode;
-        } catch (PackageManager.NameNotFoundException e) {
-            return -1;
-        }
-    }
-
-
-}

+ 0 - 26
other_app/risk-sdk-test/src/main/java/com/test/risk/app/util/BrightnessUtils.java

@@ -1,26 +0,0 @@
-package com.test.risk.app.util;
-
-import android.provider.Settings;
-
-
-public final class BrightnessUtils {
-
-
-    /**
-     * 获取屏幕亮度
-     *
-     * @return 屏幕亮度 0-255
-     */
-    public static int getBrightness() {
-        try {
-            return Settings.System.getInt(
-                    Utils.getApp().getContentResolver(),
-                    Settings.System.SCREEN_BRIGHTNESS
-            );
-        } catch (Settings.SettingNotFoundException e) {
-            e.printStackTrace();
-            return 0;
-        }
-    }
-
-}

+ 0 - 173
other_app/risk-sdk-test/src/main/java/com/test/risk/app/util/DeviceUtils.java

@@ -1,173 +0,0 @@
-package com.test.risk.app.util;
-
-import android.annotation.SuppressLint;
-import android.content.res.Configuration;
-import android.content.res.Resources;
-import android.os.Build;
-import android.provider.Settings;
-import android.text.TextUtils;
-
-import java.util.UUID;
-
-
-public final class DeviceUtils {
-
-    private static final String KEY_UDID = "KEY_UDID";
-    private volatile static String udid;
-
-    /**
-     * Return the version name of device's system.
-     *
-     * @return the version name of device's system
-     */
-    public static String getSDKVersionName() {
-        return Build.VERSION.RELEASE;
-    }
-
-    /**
-     * Return version code of device's system.
-     *
-     * @return version code of device's system
-     */
-    public static int getSDKVersionCode() {
-        return Build.VERSION.SDK_INT;
-    }
-
-    /**
-     * Return the android id of device.
-     *
-     * @return the android id of device
-     */
-    @SuppressLint("HardwareIds")
-    public static String getAndroidID() {
-        String id = Settings.Secure.getString(
-                Utils.getApp().getContentResolver(),
-                Settings.Secure.ANDROID_ID
-        );
-        if ("9774d56d682e549c".equals(id)) return "";
-        return id == null ? "" : id;
-    }
-
-
-    /**
-     * Return the manufacturer of the product/hardware.
-     * <p>e.g. Xiaomi</p>
-     *
-     * @return the manufacturer of the product/hardware
-     */
-    public static String getManufacturer() {
-        return Build.MANUFACTURER;
-    }
-
-    /**
-     * Return the model of device.
-     * <p>e.g. MI2SC</p>
-     *
-     * @return the model of device
-     */
-    public static String getModel() {
-        String model = Build.MODEL;
-        if (model != null) {
-            model = model.trim().replaceAll("\\s*", "");
-        } else {
-            model = "";
-        }
-        return model;
-    }
-
-    /**
-     * Return an ordered list of ABIs supported by this device. The most preferred ABI is the first
-     * element in the list.
-     *
-     * @return an ordered list of ABIs supported by this device
-     */
-    public static String[] getABIs() {
-        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
-            return Build.SUPPORTED_ABIS;
-        } else {
-            if (!TextUtils.isEmpty(Build.CPU_ABI2)) {
-                return new String[]{Build.CPU_ABI, Build.CPU_ABI2};
-            }
-            return new String[]{Build.CPU_ABI};
-        }
-    }
-
-    /**
-     * Return whether device is tablet.
-     *
-     * @return {@code true}: yes<br>{@code false}: no
-     */
-    public static boolean isTablet() {
-        return (Resources.getSystem().getConfiguration().screenLayout
-                & Configuration.SCREENLAYOUT_SIZE_MASK)
-                >= Configuration.SCREENLAYOUT_SIZE_LARGE;
-    }
-
-
-    /**
-     * Return the unique device id.
-     * <pre>{1}{UUID(macAddress)}</pre>
-     * <pre>{2}{UUID(androidId )}</pre>
-     * <pre>{9}{UUID(random    )}</pre>
-     *
-     * @return the unique device id
-     */
-    public static String getUniqueDeviceId() {
-        return getUniqueDeviceId("", true);
-    }
-
-
-    /**
-     * Return the unique device id.
-     * <pre>android 10 deprecated {prefix}{1}{UUID(macAddress)}</pre>
-     * <pre>{prefix}{2}{UUID(androidId )}</pre>
-     * <pre>{prefix}{9}{UUID(random    )}</pre>
-     *
-     * @param prefix   The prefix of the unique device id.
-     * @param useCache True to use cache, false otherwise.
-     * @return the unique device id
-     */
-    public static String getUniqueDeviceId(String prefix, boolean useCache) {
-        if (!useCache) {
-            return getUniqueDeviceIdReal(prefix);
-        }
-        if (udid == null) {
-            synchronized (DeviceUtils.class) {
-                if (udid == null) {
-                    final String id = UtilsBridge.getSpUtils4Utils().getString(KEY_UDID, null);
-                    if (id != null) {
-                        udid = id;
-                        return udid;
-                    }
-                    return getUniqueDeviceIdReal(prefix);
-                }
-            }
-        }
-        return udid;
-    }
-
-    private static String getUniqueDeviceIdReal(String prefix) {
-        try {
-            final String androidId = getAndroidID();
-            if (!TextUtils.isEmpty(androidId)) {
-                return saveUdid(prefix + 2, androidId);
-            }
-
-        } catch (Exception ignore) {/**/}
-        return saveUdid(prefix + 9, "");
-    }
-
-
-    private static String saveUdid(String prefix, String id) {
-        udid = getUdid(prefix, id);
-        UtilsBridge.getSpUtils4Utils().put(KEY_UDID, udid);
-        return udid;
-    }
-
-    private static String getUdid(String prefix, String id) {
-        if (id.isEmpty()) {
-            return prefix + UUID.randomUUID().toString().replace("-", "");
-        }
-        return prefix + UUID.nameUUIDFromBytes(id.getBytes()).toString().replace("-", "");
-    }
-}

+ 0 - 43
other_app/risk-sdk-test/src/main/java/com/test/risk/app/util/FileUtils.java

@@ -1,43 +0,0 @@
-package com.test.risk.app.util;
-
-import android.os.StatFs;
-import android.text.TextUtils;
-
-
-public final class FileUtils {
-
-
-    /**
-     * Return the total size of file system.
-     *
-     * @param anyPathInFs Any path in file system.
-     * @return the total size of file system
-     */
-    public static long getFsTotalSize(String anyPathInFs) {
-        if (TextUtils.isEmpty(anyPathInFs)) return 0;
-        StatFs statFs = new StatFs(anyPathInFs);
-        long blockSize;
-        long totalSize;
-        blockSize = statFs.getBlockSizeLong();
-        totalSize = statFs.getBlockCountLong();
-        return blockSize * totalSize;
-    }
-
-    /**
-     * Return the available size of file system.
-     *
-     * @param anyPathInFs Any path in file system.
-     * @return the available size of file system
-     */
-    public static long getFsAvailableSize(final String anyPathInFs) {
-        if (TextUtils.isEmpty(anyPathInFs)) return 0;
-        StatFs statFs = new StatFs(anyPathInFs);
-        long blockSize;
-        long availableSize;
-        blockSize = statFs.getBlockSizeLong();
-        availableSize = statFs.getAvailableBlocksLong();
-        return blockSize * availableSize;
-    }
-
-
-}

+ 0 - 59
other_app/risk-sdk-test/src/main/java/com/test/risk/app/util/GsonUtils.java

@@ -1,59 +0,0 @@
-package com.test.risk.app.util;
-
-import androidx.annotation.NonNull;
-
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-
-public final class GsonUtils {
-
-    private static final String KEY_DEFAULT = "defaultGson";
-    private static final String KEY_DELEGATE = "delegateGson";
-
-    private static final Map<String, Gson> GSONS = new ConcurrentHashMap<>();
-
-
-    public static Gson getGson() {
-        Gson gsonDelegate = GSONS.get(KEY_DELEGATE);
-        if (gsonDelegate != null) {
-            return gsonDelegate;
-        }
-        Gson gsonDefault = GSONS.get(KEY_DEFAULT);
-        if (gsonDefault == null) {
-            gsonDefault = createGson();
-            GSONS.put(KEY_DEFAULT, gsonDefault);
-        }
-        return gsonDefault;
-    }
-
-    /**
-     * Serializes an object into json.
-     *
-     * @param object The object to serialize.
-     * @return object serialized into json.
-     */
-    public static String toJson(final Object object) {
-        return toJson(getGson(), object);
-    }
-
-
-    /**
-     * Serializes an object into json.
-     *
-     * @param gson   The gson.
-     * @param object The object to serialize.
-     * @return object serialized into json.
-     */
-    public static String toJson(@NonNull final Gson gson, final Object object) {
-        return gson.toJson(object);
-    }
-
-
-    private static Gson createGson() {
-        return new GsonBuilder().serializeNulls().disableHtmlEscaping().create();
-    }
-}

+ 0 - 174
other_app/risk-sdk-test/src/main/java/com/test/risk/app/util/NetworkUtils.java

@@ -1,174 +0,0 @@
-package com.test.risk.app.util;
-
-import static android.Manifest.permission.ACCESS_NETWORK_STATE;
-import static android.Manifest.permission.INTERNET;
-
-import android.content.Context;
-import android.net.ConnectivityManager;
-import android.net.NetworkInfo;
-import android.telephony.TelephonyManager;
-
-import androidx.annotation.RequiresPermission;
-
-import java.net.InetAddress;
-import java.net.NetworkInterface;
-import java.net.SocketException;
-import java.util.Enumeration;
-import java.util.LinkedList;
-
-
-public final class NetworkUtils {
-
-    /**
-     * Return type of network.
-     * <p>Must hold {@code <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />}</p>
-     *
-     * @return type of network
-     * <ul>
-     * <li>{@link NetworkType#NETWORK_ETHERNET} </li>
-     * <li>{@link NetworkType#NETWORK_WIFI    } </li>
-     * <li>{@link NetworkType#NETWORK_4G      } </li>
-     * <li>{@link NetworkType#NETWORK_3G      } </li>
-     * <li>{@link NetworkType#NETWORK_2G      } </li>
-     * <li>{@link NetworkType#NETWORK_UNKNOWN } </li>
-     * <li>{@link NetworkType#NETWORK_NO      } </li>
-     * </ul>
-     */
-    @RequiresPermission(ACCESS_NETWORK_STATE)
-    public static NetworkType getNetworkType() {
-        if (isEthernet()) {
-            return NetworkType.NETWORK_ETHERNET;
-        }
-        NetworkInfo info = getActiveNetworkInfo();
-        if (info != null && info.isAvailable()) {
-            if (info.getType() == ConnectivityManager.TYPE_WIFI) {
-                return NetworkType.NETWORK_WIFI;
-            } else if (info.getType() == ConnectivityManager.TYPE_MOBILE) {
-                switch (info.getSubtype()) {
-                    case TelephonyManager.NETWORK_TYPE_GSM:
-                    case TelephonyManager.NETWORK_TYPE_GPRS:
-                    case TelephonyManager.NETWORK_TYPE_CDMA:
-                    case TelephonyManager.NETWORK_TYPE_EDGE:
-                    case TelephonyManager.NETWORK_TYPE_1xRTT:
-                    case TelephonyManager.NETWORK_TYPE_IDEN:
-                        return NetworkType.NETWORK_2G;
-
-                    case TelephonyManager.NETWORK_TYPE_TD_SCDMA:
-                    case TelephonyManager.NETWORK_TYPE_EVDO_A:
-                    case TelephonyManager.NETWORK_TYPE_UMTS:
-                    case TelephonyManager.NETWORK_TYPE_EVDO_0:
-                    case TelephonyManager.NETWORK_TYPE_HSDPA:
-                    case TelephonyManager.NETWORK_TYPE_HSUPA:
-                    case TelephonyManager.NETWORK_TYPE_HSPA:
-                    case TelephonyManager.NETWORK_TYPE_EVDO_B:
-                    case TelephonyManager.NETWORK_TYPE_EHRPD:
-                    case TelephonyManager.NETWORK_TYPE_HSPAP:
-                        return NetworkType.NETWORK_3G;
-
-                    case TelephonyManager.NETWORK_TYPE_IWLAN:
-                    case TelephonyManager.NETWORK_TYPE_LTE:
-                        return NetworkType.NETWORK_4G;
-
-                    case TelephonyManager.NETWORK_TYPE_NR:
-                        return NetworkType.NETWORK_5G;
-                    default:
-                        String subtypeName = info.getSubtypeName();
-                        if (subtypeName.equalsIgnoreCase("TD-SCDMA")
-                                || subtypeName.equalsIgnoreCase("WCDMA")
-                                || subtypeName.equalsIgnoreCase("CDMA2000")) {
-                            return NetworkType.NETWORK_3G;
-                        } else {
-                            return NetworkType.NETWORK_UNKNOWN;
-                        }
-                }
-            } else {
-                return NetworkType.NETWORK_UNKNOWN;
-            }
-        }
-        return NetworkType.NETWORK_NO;
-    }
-
-    /**
-     * Return whether using ethernet.
-     * <p>Must hold
-     * {@code <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />}</p>
-     *
-     * @return {@code true}: yes<br>{@code false}: no
-     */
-    @RequiresPermission(ACCESS_NETWORK_STATE)
-    private static boolean isEthernet() {
-        final ConnectivityManager cm =
-                (ConnectivityManager) Utils.getApp().getSystemService(Context.CONNECTIVITY_SERVICE);
-        if (cm == null) return false;
-        final NetworkInfo info = cm.getNetworkInfo(ConnectivityManager.TYPE_ETHERNET);
-        if (info == null) return false;
-        NetworkInfo.State state = info.getState();
-        if (null == state) return false;
-        return state == NetworkInfo.State.CONNECTED || state == NetworkInfo.State.CONNECTING;
-    }
-
-    @RequiresPermission(ACCESS_NETWORK_STATE)
-    private static NetworkInfo getActiveNetworkInfo() {
-        ConnectivityManager cm =
-                (ConnectivityManager) Utils.getApp().getSystemService(Context.CONNECTIVITY_SERVICE);
-        if (cm == null) return null;
-        return cm.getActiveNetworkInfo();
-    }
-
-
-    /**
-     * Return the ip address.
-     * <p>Must hold {@code <uses-permission android:name="android.permission.INTERNET" />}</p>
-     *
-     * @param useIPv4 True to use ipv4, false otherwise.
-     * @return the ip address
-     */
-    @RequiresPermission(INTERNET)
-    public static String getIPAddress(final boolean useIPv4) {
-        try {
-            Enumeration<NetworkInterface> nis = NetworkInterface.getNetworkInterfaces();
-            LinkedList<InetAddress> adds = new LinkedList<>();
-            while (nis.hasMoreElements()) {
-                NetworkInterface ni = nis.nextElement();
-                // To prevent phone of xiaomi return "10.0.2.15"
-                if (!ni.isUp() || ni.isLoopback()) continue;
-                Enumeration<InetAddress> addresses = ni.getInetAddresses();
-                while (addresses.hasMoreElements()) {
-                    adds.addFirst(addresses.nextElement());
-                }
-            }
-            for (InetAddress add : adds) {
-                if (!add.isLoopbackAddress()) {
-                    String hostAddress = add.getHostAddress();
-                    boolean isIPv4 = hostAddress.indexOf(':') < 0;
-                    if (useIPv4) {
-                        if (isIPv4) return hostAddress;
-                    } else {
-                        if (!isIPv4) {
-                            int index = hostAddress.indexOf('%');
-                            return index < 0
-                                    ? hostAddress.toUpperCase()
-                                    : hostAddress.substring(0, index).toUpperCase();
-                        }
-                    }
-                }
-            }
-        } catch (SocketException e) {
-            e.printStackTrace();
-        }
-        return "";
-    }
-
-
-    public enum NetworkType {
-        NETWORK_ETHERNET,
-        NETWORK_WIFI,
-        NETWORK_5G,
-        NETWORK_4G,
-        NETWORK_3G,
-        NETWORK_2G,
-        NETWORK_UNKNOWN,
-        NETWORK_NO
-    }
-
-}

+ 0 - 40
other_app/risk-sdk-test/src/main/java/com/test/risk/app/util/PhoneUtils.java

@@ -1,40 +0,0 @@
-package com.test.risk.app.util;
-
-import android.content.Context;
-import android.telephony.TelephonyManager;
-
-
-public final class PhoneUtils {
-
-    /**
-     * Return whether the device is phone.
-     *
-     * @return {@code true}: yes<br>{@code false}: no
-     */
-    public static boolean isPhone() {
-        TelephonyManager tm = getTelephonyManager();
-        return tm.getPhoneType() != TelephonyManager.PHONE_TYPE_NONE;
-    }
-
-
-    /**
-     * Returns the current phone type.
-     *
-     * @return the current phone type
-     * <ul>
-     * <li>{@link TelephonyManager#PHONE_TYPE_NONE}</li>
-     * <li>{@link TelephonyManager#PHONE_TYPE_GSM }</li>
-     * <li>{@link TelephonyManager#PHONE_TYPE_CDMA}</li>
-     * <li>{@link TelephonyManager#PHONE_TYPE_SIP }</li>
-     * </ul>
-     */
-    public static int getPhoneType() {
-        TelephonyManager tm = getTelephonyManager();
-        return tm.getPhoneType();
-    }
-
-
-    private static TelephonyManager getTelephonyManager() {
-        return (TelephonyManager) Utils.getApp().getSystemService(Context.TELEPHONY_SERVICE);
-    }
-}

+ 0 - 134
other_app/risk-sdk-test/src/main/java/com/test/risk/app/util/SDCardUtils.java

@@ -1,134 +0,0 @@
-package com.test.risk.app.util;
-
-import android.content.Context;
-import android.os.Environment;
-import android.os.storage.StorageManager;
-import android.os.storage.StorageVolume;
-import android.text.format.Formatter;
-
-import java.lang.reflect.Array;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.List;
-
-
-public final class SDCardUtils {
-    /**
-     * Return whether sdcard is enabled by environment.
-     *
-     * @return {@code true}: enabled<br>{@code false}: disabled
-     */
-    public static boolean isSDCardEnableByEnvironment() {
-        return Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState());
-    }
-
-
-    /**
-     * Return the information of sdcard.
-     *
-     * @return the information of sdcard
-     */
-    public static List<SDCardInfo> getSDCardInfo() {
-        List<SDCardInfo> paths = new ArrayList<>();
-        StorageManager sm = (StorageManager) Utils.getApp().getSystemService(Context.STORAGE_SERVICE);
-        if (sm == null) return paths;
-        if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) {
-            List<StorageVolume> storageVolumes = sm.getStorageVolumes();
-            try {
-                //noinspection JavaReflectionMemberAccess
-                Method getPathMethod = StorageVolume.class.getMethod("getPath");
-                for (StorageVolume storageVolume : storageVolumes) {
-                    boolean isRemovable = storageVolume.isRemovable();
-                    String state = storageVolume.getState();
-                    String path = (String) getPathMethod.invoke(storageVolume);
-                    paths.add(new SDCardInfo(path, state, isRemovable));
-                }
-            } catch (NoSuchMethodException e) {
-                e.printStackTrace();
-            } catch (IllegalAccessException e) {
-                e.printStackTrace();
-            } catch (InvocationTargetException e) {
-                e.printStackTrace();
-            }
-        } else {
-            try {
-                Class<?> storageVolumeClazz = Class.forName("android.os.storage.StorageVolume");
-                //noinspection JavaReflectionMemberAccess
-                Method getPathMethod = storageVolumeClazz.getMethod("getPath");
-                Method isRemovableMethod = storageVolumeClazz.getMethod("isRemovable");
-                //noinspection JavaReflectionMemberAccess
-                Method getVolumeStateMethod = StorageManager.class.getMethod("getVolumeState", String.class);
-                //noinspection JavaReflectionMemberAccess
-                Method getVolumeListMethod = StorageManager.class.getMethod("getVolumeList");
-                Object result = getVolumeListMethod.invoke(sm);
-                final int length = Array.getLength(result);
-                for (int i = 0; i < length; i++) {
-                    Object storageVolumeElement = Array.get(result, i);
-                    String path = (String) getPathMethod.invoke(storageVolumeElement);
-                    boolean isRemovable = (Boolean) isRemovableMethod.invoke(storageVolumeElement);
-                    String state = (String) getVolumeStateMethod.invoke(sm, path);
-                    paths.add(new SDCardInfo(path, state, isRemovable));
-                }
-            } catch (ClassNotFoundException e) {
-                e.printStackTrace();
-            } catch (InvocationTargetException e) {
-                e.printStackTrace();
-            } catch (NoSuchMethodException e) {
-                e.printStackTrace();
-            } catch (IllegalAccessException e) {
-                e.printStackTrace();
-            }
-        }
-        return paths;
-    }
-
-
-    public static class SDCardInfo {
-
-        private String path;
-        private String state;
-        private boolean isRemovable;
-        private long totalSize;
-        private long availableSize;
-
-        SDCardInfo(String path, String state, boolean isRemovable) {
-            this.path = path;
-            this.state = state;
-            this.isRemovable = isRemovable;
-            this.totalSize = UtilsBridge.getFsTotalSize(path);
-            this.availableSize = UtilsBridge.getFsAvailableSize(path);
-        }
-
-        public String getPath() {
-            return path;
-        }
-
-        public String getState() {
-            return state;
-        }
-
-        public boolean isRemovable() {
-            return isRemovable;
-        }
-
-        public long getTotalSize() {
-            return totalSize;
-        }
-
-        public long getAvailableSize() {
-            return availableSize;
-        }
-
-        @Override
-        public String toString() {
-            return "SDCardInfo {" +
-                    "path = " + path +
-                    ", state = " + state +
-                    ", isRemovable = " + isRemovable +
-                    ", totalSize = " + Formatter.formatFileSize(Utils.getApp(), totalSize) +
-                    ", availableSize = " + Formatter.formatFileSize(Utils.getApp(), availableSize) +
-                    '}';
-        }
-    }
-}

+ 0 - 106
other_app/risk-sdk-test/src/main/java/com/test/risk/app/util/SPUtils.java

@@ -1,106 +0,0 @@
-package com.test.risk.app.util;
-
-import android.annotation.SuppressLint;
-import android.content.Context;
-import android.content.SharedPreferences;
-
-import androidx.annotation.NonNull;
-
-import java.util.HashMap;
-import java.util.Map;
-
-@SuppressLint("ApplySharedPref")
-public final class SPUtils {
-
-    private static final Map<String, SPUtils> SP_UTILS_MAP = new HashMap<>();
-
-    private SharedPreferences sp;
-
-
-    private SPUtils(final String spName, final int mode) {
-        sp = Utils.getApp().getSharedPreferences(spName, mode);
-    }
-
-
-    /**
-     * Return the single {@link SPUtils} instance
-     *
-     * @param spName The name of sp.
-     * @return the single {@link SPUtils} instance
-     */
-    public static SPUtils getInstance(String spName) {
-        return getInstance(spName, Context.MODE_PRIVATE);
-    }
-
-    /**
-     * Return the single {@link SPUtils} instance
-     *
-     * @param spName The name of sp.
-     * @param mode   Operating mode.
-     * @return the single {@link SPUtils} instance
-     */
-    public static SPUtils getInstance(String spName, final int mode) {
-        if (isSpace(spName)) spName = "spUtils";
-        SPUtils spUtils = SP_UTILS_MAP.get(spName);
-        if (spUtils == null) {
-            synchronized (SPUtils.class) {
-                spUtils = SP_UTILS_MAP.get(spName);
-                if (spUtils == null) {
-                    spUtils = new SPUtils(spName, mode);
-                    SP_UTILS_MAP.put(spName, spUtils);
-                }
-            }
-        }
-        return spUtils;
-    }
-
-    private static boolean isSpace(final String s) {
-        if (s == null) return true;
-        for (int i = 0, len = s.length(); i < len; ++i) {
-            if (!Character.isWhitespace(s.charAt(i))) {
-                return false;
-            }
-        }
-        return true;
-    }
-
-    /**
-     * Put the string value in sp.
-     *
-     * @param key   The key of sp.
-     * @param value The value of sp.
-     */
-    public void put(@NonNull final String key, final String value) {
-        put(key, value, false);
-    }
-
-    /**
-     * Put the string value in sp.
-     *
-     * @param key      The key of sp.
-     * @param value    The value of sp.
-     * @param isCommit True to use {@link SharedPreferences.Editor#commit()},
-     *                 false to use {@link SharedPreferences.Editor#apply()}
-     */
-    public void put(@NonNull final String key, final String value, final boolean isCommit) {
-        if (isCommit) {
-            sp.edit().putString(key, value).commit();
-        } else {
-            sp.edit().putString(key, value).apply();
-        }
-    }
-
-
-    /**
-     * Return the string value in sp.
-     *
-     * @param key          The key of sp.
-     * @param defaultValue The default value if the sp doesn't exist.
-     * @return the string value if sp exists or {@code defaultValue} otherwise
-     */
-    public String getString(@NonNull final String key, final String defaultValue) {
-        return sp.getString(key, defaultValue);
-    }
-
-
-}

+ 0 - 37
other_app/risk-sdk-test/src/main/java/com/test/risk/app/util/ScreenUtils.java

@@ -1,37 +0,0 @@
-package com.test.risk.app.util;
-
-import android.content.Context;
-import android.graphics.Point;
-import android.view.WindowManager;
-
-
-public final class ScreenUtils {
-
-    /**
-     * Return the width of screen, in pixel.
-     *
-     * @return the width of screen, in pixel
-     */
-    public static int getScreenWidth() {
-        WindowManager wm = (WindowManager) Utils.getApp().getSystemService(Context.WINDOW_SERVICE);
-        if (wm == null) return -1;
-        Point point = new Point();
-        wm.getDefaultDisplay().getRealSize(point);
-        return point.x;
-    }
-
-    /**
-     * Return the height of screen, in pixel.
-     *
-     * @return the height of screen, in pixel
-     */
-    public static int getScreenHeight() {
-        WindowManager wm = (WindowManager) Utils.getApp().getSystemService(Context.WINDOW_SERVICE);
-        if (wm == null) return -1;
-        Point point = new Point();
-        wm.getDefaultDisplay().getRealSize(point);
-        return point.y;
-    }
-
-
-}

+ 0 - 32
other_app/risk-sdk-test/src/main/java/com/test/risk/app/util/StringUtils.java

@@ -1,32 +0,0 @@
-package com.test.risk.app.util;
-
-public final class StringUtils {
-    /**
-     * Return whether the string is null or 0-length.
-     *
-     * @param s The string.
-     * @return {@code true}: yes<br> {@code false}: no
-     */
-    public static boolean isEmpty(final CharSequence s) {
-        return s == null || s.length() == 0;
-    }
-
-
-    /**
-     * Return whether the string is null or white space.
-     *
-     * @param s The string.
-     * @return {@code true}: yes<br> {@code false}: no
-     */
-    public static boolean isSpace(final String s) {
-        if (s == null) return true;
-        for (int i = 0, len = s.length(); i < len; ++i) {
-            if (!Character.isWhitespace(s.charAt(i))) {
-                return false;
-            }
-        }
-        return true;
-    }
-
-
-}

+ 0 - 454
other_app/risk-sdk-test/src/main/java/com/test/risk/app/util/ThreadUtils.java

@@ -1,454 +0,0 @@
-package com.test.risk.app.util;
-
-import android.os.Handler;
-import android.os.Looper;
-import android.util.Log;
-
-import androidx.annotation.CallSuper;
-import androidx.annotation.NonNull;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Timer;
-import java.util.TimerTask;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.Executor;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.LinkedBlockingQueue;
-import java.util.concurrent.RejectedExecutionException;
-import java.util.concurrent.ThreadFactory;
-import java.util.concurrent.ThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.concurrent.atomic.AtomicLong;
-
-public final class ThreadUtils {
-
-    private static final Handler HANDLER = new Handler(Looper.getMainLooper());
-
-    private static final Map<Integer, Map<Integer, ExecutorService>> TYPE_PRIORITY_POOLS = new HashMap<>();
-
-    private static final Map<Task, ExecutorService> TASK_POOL_MAP = new ConcurrentHashMap<>();
-
-    private static final int CPU_COUNT = Runtime.getRuntime().availableProcessors();
-    private static final Timer TIMER = new Timer();
-
-    private static final byte TYPE_SINGLE = -1;
-    private static final byte TYPE_CACHED = -2;
-    private static final byte TYPE_IO = -4;
-    private static final byte TYPE_CPU = -8;
-
-    private static Executor sDeliver;
-
-
-    public static void runOnUiThread(final Runnable runnable) {
-        if (Looper.myLooper() == Looper.getMainLooper()) {
-            runnable.run();
-        } else {
-            HANDLER.post(runnable);
-        }
-    }
-
-
-    /**
-     * Return a thread pool that creates new threads as needed, but
-     * will reuse previously constructed threads when they are
-     * available.
-     *
-     * @return a cached thread pool
-     */
-    public static ExecutorService getCachedPool() {
-        return getPoolByTypeAndPriority(TYPE_CACHED);
-    }
-
-
-    /**
-     * Executes the given task in an IO thread pool.
-     *
-     * @param task The task to execute.
-     * @param <T>  The type of the task's result.
-     */
-    public static <T> void executeByIo(final Task<T> task) {
-        execute(getPoolByTypeAndPriority(TYPE_IO), task);
-    }
-
-
-    /**
-     * Cancel the given tasks.
-     *
-     * @param tasks The tasks to cancel.
-     */
-    public static void cancel(final Task... tasks) {
-        if (tasks == null || tasks.length == 0) return;
-        for (Task task : tasks) {
-            if (task == null) continue;
-            task.cancel();
-        }
-    }
-
-
-    private static <T> void execute(final ExecutorService pool, final Task<T> task) {
-        execute(pool, task, 0, 0, null);
-    }
-
-
-    private static <T> void execute(final ExecutorService pool, final Task<T> task,
-                                    long delay, final long period, final TimeUnit unit) {
-        synchronized (TASK_POOL_MAP) {
-            if (TASK_POOL_MAP.get(task) != null) {
-                return;
-            }
-            TASK_POOL_MAP.put(task, pool);
-        }
-        if (period == 0) {
-            if (delay == 0) {
-                pool.execute(task);
-            } else {
-                TimerTask timerTask = new TimerTask() {
-                    @Override
-                    public void run() {
-                        pool.execute(task);
-                    }
-                };
-                TIMER.schedule(timerTask, unit.toMillis(delay));
-            }
-        } else {
-            task.setSchedule(true);
-            TimerTask timerTask = new TimerTask() {
-                @Override
-                public void run() {
-                    pool.execute(task);
-                }
-            };
-            TIMER.scheduleAtFixedRate(timerTask, unit.toMillis(delay), unit.toMillis(period));
-        }
-    }
-
-    private static ExecutorService getPoolByTypeAndPriority(final int type) {
-        return getPoolByTypeAndPriority(type, Thread.NORM_PRIORITY);
-    }
-
-    private static ExecutorService getPoolByTypeAndPriority(final int type, final int priority) {
-        synchronized (TYPE_PRIORITY_POOLS) {
-            ExecutorService pool;
-            Map<Integer, ExecutorService> priorityPools = TYPE_PRIORITY_POOLS.get(type);
-            if (priorityPools == null) {
-                priorityPools = new ConcurrentHashMap<>();
-                pool = ThreadPoolExecutor4Util.createPool(type, priority);
-                priorityPools.put(priority, pool);
-                TYPE_PRIORITY_POOLS.put(type, priorityPools);
-            } else {
-                pool = priorityPools.get(priority);
-                if (pool == null) {
-                    pool = ThreadPoolExecutor4Util.createPool(type, priority);
-                    priorityPools.put(priority, pool);
-                }
-            }
-            return pool;
-        }
-    }
-
-    private static Executor getGlobalDeliver() {
-        if (sDeliver == null) {
-            sDeliver = ThreadUtils::runOnUiThread;
-        }
-        return sDeliver;
-    }
-
-    static final class ThreadPoolExecutor4Util extends ThreadPoolExecutor {
-
-        private final AtomicInteger mSubmittedCount = new AtomicInteger();
-        private LinkedBlockingQueue4Util mWorkQueue;
-
-        ThreadPoolExecutor4Util(int corePoolSize, int maximumPoolSize,
-                                long keepAliveTime, TimeUnit unit,
-                                LinkedBlockingQueue4Util workQueue,
-                                ThreadFactory threadFactory) {
-            super(corePoolSize, maximumPoolSize,
-                    keepAliveTime, unit,
-                    workQueue,
-                    threadFactory
-            );
-            workQueue.mPool = this;
-            mWorkQueue = workQueue;
-        }
-
-        private static ExecutorService createPool(final int type, final int priority) {
-            switch (type) {
-                case TYPE_SINGLE:
-                    return new ThreadPoolExecutor4Util(1, 1,
-                            0L, TimeUnit.MILLISECONDS,
-                            new LinkedBlockingQueue4Util(),
-                            new UtilsThreadFactory("single", priority)
-                    );
-                case TYPE_CACHED:
-                    return new ThreadPoolExecutor4Util(0, 128,
-                            60L, TimeUnit.SECONDS,
-                            new LinkedBlockingQueue4Util(true),
-                            new UtilsThreadFactory("cached", priority)
-                    );
-                case TYPE_IO:
-                    return new ThreadPoolExecutor4Util(2 * CPU_COUNT + 1, 2 * CPU_COUNT + 1,
-                            30, TimeUnit.SECONDS,
-                            new LinkedBlockingQueue4Util(),
-                            new UtilsThreadFactory("io", priority)
-                    );
-                case TYPE_CPU:
-                    return new ThreadPoolExecutor4Util(CPU_COUNT + 1, 2 * CPU_COUNT + 1,
-                            30, TimeUnit.SECONDS,
-                            new LinkedBlockingQueue4Util(true),
-                            new UtilsThreadFactory("cpu", priority)
-                    );
-                default:
-                    return new ThreadPoolExecutor4Util(type, type,
-                            0L, TimeUnit.MILLISECONDS,
-                            new LinkedBlockingQueue4Util(),
-                            new UtilsThreadFactory("fixed(" + type + ")", priority)
-                    );
-            }
-        }
-
-        private int getSubmittedCount() {
-            return mSubmittedCount.get();
-        }
-
-        @Override
-        protected void afterExecute(Runnable r, Throwable t) {
-            mSubmittedCount.decrementAndGet();
-            super.afterExecute(r, t);
-        }
-
-        @Override
-        public void execute(@NonNull Runnable command) {
-            if (this.isShutdown()) return;
-            mSubmittedCount.incrementAndGet();
-            try {
-                super.execute(command);
-            } catch (RejectedExecutionException ignore) {
-                Log.e("ThreadUtils", "This will not happen!");
-                mWorkQueue.offer(command);
-            } catch (Throwable t) {
-                mSubmittedCount.decrementAndGet();
-            }
-        }
-    }
-
-    private static final class LinkedBlockingQueue4Util extends LinkedBlockingQueue<Runnable> {
-
-        private volatile ThreadPoolExecutor4Util mPool;
-
-        private int mCapacity = Integer.MAX_VALUE;
-
-        LinkedBlockingQueue4Util() {
-            super();
-        }
-
-        LinkedBlockingQueue4Util(boolean isAddSubThreadFirstThenAddQueue) {
-            super();
-            if (isAddSubThreadFirstThenAddQueue) {
-                mCapacity = 0;
-            }
-        }
-
-        LinkedBlockingQueue4Util(int capacity) {
-            super();
-            mCapacity = capacity;
-        }
-
-        @Override
-        public boolean offer(@NonNull Runnable runnable) {
-            if (mCapacity <= size() &&
-                    mPool != null && mPool.getPoolSize() < mPool.getMaximumPoolSize()) {
-                // create a non-core thread
-                return false;
-            }
-            return super.offer(runnable);
-        }
-    }
-
-    static final class UtilsThreadFactory extends AtomicLong
-            implements ThreadFactory {
-        private static final AtomicInteger POOL_NUMBER = new AtomicInteger(1);
-        private static final long serialVersionUID = -9209200509960368598L;
-        private final String namePrefix;
-        private final int priority;
-        private final boolean isDaemon;
-
-        UtilsThreadFactory(String prefix, int priority) {
-            this(prefix, priority, false);
-        }
-
-        UtilsThreadFactory(String prefix, int priority, boolean isDaemon) {
-            namePrefix = prefix + "-pool-" +
-                    POOL_NUMBER.getAndIncrement() +
-                    "-thread-";
-            this.priority = priority;
-            this.isDaemon = isDaemon;
-        }
-
-        @Override
-        public Thread newThread(@NonNull Runnable r) {
-            Thread t = new Thread(r, namePrefix + getAndIncrement()) {
-                @Override
-                public void run() {
-                    try {
-                        super.run();
-                    } catch (Throwable t) {
-                        Log.e("ThreadUtils", "Request threw uncaught throwable", t);
-                    }
-                }
-            };
-            t.setDaemon(isDaemon);
-            t.setUncaughtExceptionHandler((t1, e) -> System.out.println(e));
-            t.setPriority(priority);
-            return t;
-        }
-    }
-
-
-    public abstract static class Task<T> implements Runnable {
-
-        private static final int NEW = 0;
-        private static final int RUNNING = 1;
-        private static final int EXCEPTIONAL = 2;
-        private static final int COMPLETING = 3;
-        private static final int CANCELLED = 4;
-        private static final int INTERRUPTED = 5;
-        private static final int TIMEOUT = 6;
-
-        private final AtomicInteger state = new AtomicInteger(NEW);
-
-        private volatile boolean isSchedule;
-        private volatile Thread runner;
-
-        private Timer mTimer;
-        private long mTimeoutMillis;
-        private OnTimeoutListener mTimeoutListener;
-
-        private Executor deliver;
-
-        public abstract T doInBackground() throws Throwable;
-
-        public abstract void onSuccess(T result);
-
-        public abstract void onCancel();
-
-        public abstract void onFail(Throwable t);
-
-        @Override
-        public void run() {
-            if (isSchedule) {
-                if (runner == null) {
-                    if (!state.compareAndSet(NEW, RUNNING)) return;
-                    runner = Thread.currentThread();
-                    if (mTimeoutListener != null) {
-                        Log.w("ThreadUtils", "Scheduled task doesn't support timeout.");
-                    }
-                } else {
-                    if (state.get() != RUNNING) return;
-                }
-            } else {
-                if (!state.compareAndSet(NEW, RUNNING)) return;
-                runner = Thread.currentThread();
-                if (mTimeoutListener != null) {
-                    mTimer = new Timer();
-                    mTimer.schedule(new TimerTask() {
-                        @Override
-                        public void run() {
-                            if (!isDone() && mTimeoutListener != null) {
-                                timeout();
-                                mTimeoutListener.onTimeout();
-                                onDone();
-                            }
-                        }
-                    }, mTimeoutMillis);
-                }
-            }
-            try {
-                final T result = doInBackground();
-                if (isSchedule) {
-                    if (state.get() != RUNNING) return;
-                    getDeliver().execute(() -> onSuccess(result));
-                } else {
-                    if (!state.compareAndSet(RUNNING, COMPLETING)) return;
-                    getDeliver().execute(() -> {
-                        onSuccess(result);
-                        onDone();
-                    });
-                }
-            } catch (InterruptedException ignore) {
-                state.compareAndSet(CANCELLED, INTERRUPTED);
-            } catch (final Throwable throwable) {
-                if (!state.compareAndSet(RUNNING, EXCEPTIONAL)) return;
-                getDeliver().execute(() -> {
-                    onFail(throwable);
-                    onDone();
-                });
-            }
-        }
-
-        public void cancel() {
-            cancel(true);
-        }
-
-        public void cancel(boolean mayInterruptIfRunning) {
-            synchronized (state) {
-                if (state.get() > RUNNING) return;
-                state.set(CANCELLED);
-            }
-            if (mayInterruptIfRunning) {
-                if (runner != null) {
-                    runner.interrupt();
-                }
-            }
-
-            getDeliver().execute(() -> {
-                onCancel();
-                onDone();
-            });
-        }
-
-        private void timeout() {
-            synchronized (state) {
-                if (state.get() > RUNNING) return;
-                state.set(TIMEOUT);
-            }
-            if (runner != null) {
-                runner.interrupt();
-            }
-        }
-
-
-        public boolean isDone() {
-            return state.get() > RUNNING;
-        }
-
-
-        private void setSchedule(boolean isSchedule) {
-            this.isSchedule = isSchedule;
-        }
-
-        private Executor getDeliver() {
-            if (deliver == null) {
-                return getGlobalDeliver();
-            }
-            return deliver;
-        }
-
-
-        @CallSuper
-        protected void onDone() {
-            TASK_POOL_MAP.remove(this);
-            if (mTimer != null) {
-                mTimer.cancel();
-                mTimer = null;
-                mTimeoutListener = null;
-            }
-        }
-
-        public interface OnTimeoutListener {
-            void onTimeout();
-        }
-    }
-
-}

+ 0 - 85
other_app/risk-sdk-test/src/main/java/com/test/risk/app/util/Tools.java

@@ -1,85 +0,0 @@
-package com.test.risk.app.util;
-
-import android.os.Build;
-import android.util.Base64;
-
-import com.test.risk.app.Config;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.nio.charset.StandardCharsets;
-import java.security.InvalidAlgorithmParameterException;
-import java.security.InvalidKeyException;
-import java.security.KeyFactory;
-import java.security.NoSuchAlgorithmException;
-import java.security.PublicKey;
-import java.security.SecureRandom;
-import java.security.spec.AlgorithmParameterSpec;
-import java.security.spec.InvalidKeySpecException;
-import java.security.spec.X509EncodedKeySpec;
-import java.util.zip.GZIPOutputStream;
-
-import javax.crypto.BadPaddingException;
-import javax.crypto.Cipher;
-import javax.crypto.IllegalBlockSizeException;
-import javax.crypto.NoSuchPaddingException;
-import javax.crypto.SecretKey;
-import javax.crypto.spec.GCMParameterSpec;
-import javax.crypto.spec.IvParameterSpec;
-import javax.crypto.spec.SecretKeySpec;
-
-public class Tools {
-
-    public static byte[] gzip(String str) throws IOException {
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        GZIPOutputStream gos = new GZIPOutputStream(baos);
-        gos.write(str.getBytes(StandardCharsets.UTF_8));
-        gos.close();
-        return baos.toByteArray();
-    }
-
-    public static String inPublic(String requestStr) throws NoSuchPaddingException, InvalidAlgorithmParameterException, NoSuchAlgorithmException, IllegalBlockSizeException, IOException, BadPaddingException, InvalidKeyException, InvalidKeySpecException {
-        String keyStr = Config.PEM;
-        byte[] buffer = Base64.decode(keyStr, 0);
-        KeyFactory keyFactory = KeyFactory.getInstance("RSA");
-        X509EncodedKeySpec keySpec = new X509EncodedKeySpec(buffer);
-        PublicKey rsaKey = keyFactory.generatePublic(keySpec);
-        SecureRandom secureRandom = new SecureRandom();
-        byte[] aesKeyBytes = new byte[16];
-        secureRandom.nextBytes(aesKeyBytes);
-        SecretKey aesKey = new SecretKeySpec(aesKeyBytes, "AES");
-        Cipher rsaCipher = Cipher.getInstance("RSA/ECB/OAEPPadding");
-        rsaCipher.init(Cipher.ENCRYPT_MODE, rsaKey);
-        byte[] encryptedSecretKey = rsaCipher.doFinal(aesKeyBytes);
-        byte[] requestIv = new byte[12];
-        secureRandom.nextBytes(requestIv);
-        Cipher aesCipher = Cipher.getInstance("AES/GCM/NoPadding");
-        aesCipher.init(Cipher.ENCRYPT_MODE, aesKey, getParams(requestIv));
-        byte[] encrytedData = aesCipher.doFinal(gzip(requestStr));
-        byte[] bytes = concat(encryptedSecretKey, requestIv, encrytedData);
-        return Base64.encodeToString(bytes, Base64.NO_WRAP);
-
-    }
-
-    private static AlgorithmParameterSpec getParams(final byte[] requestIv) {
-        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
-            return new IvParameterSpec(requestIv, 0, requestIv.length);
-        }
-        return new GCMParameterSpec(128, requestIv);
-    }
-
-    public static byte[] concat(byte[]... arrays) {
-        int length = 0;
-        for (byte[] array : arrays) {
-            length += array.length;
-        }
-        byte[] result = new byte[length];
-        int pos = 0;
-        for (byte[] array : arrays) {
-            System.arraycopy(array, 0, result, pos, array.length);
-            pos += array.length;
-        }
-        return result;
-    }
-
-}

+ 0 - 47
other_app/risk-sdk-test/src/main/java/com/test/risk/app/util/Utils.java

@@ -1,47 +0,0 @@
-package com.test.risk.app.util;
-
-import android.annotation.SuppressLint;
-import android.app.Application;
-
-
-public final class Utils {
-
-    @SuppressLint("StaticFieldLeak")
-    private static Application sApp;
-
-    private Utils() {
-        throw new UnsupportedOperationException("u can't instantiate me...");
-    }
-
-    /**
-     * Init utils.
-     * <p>Init it in the class of UtilsFileProvider.</p>
-     *
-     * @param app application
-     */
-    public static void init(final Application app) {
-        if (app == null) {
-            return;
-        }
-        if (sApp == null) {
-            sApp = app;
-            UtilsBridge.preLoad();
-            return;
-        }
-        if (sApp.equals(app)) return;
-        sApp = app;
-    }
-
-    /**
-     * Return the Application object.
-     * <p>Main process get app by UtilsFileProvider,
-     * and other process get app by reflect.</p>
-     *
-     * @return the Application object
-     */
-    public static Application getApp() {
-        if (sApp != null) return sApp;
-        return sApp;
-    }
-
-}

+ 0 - 32
other_app/risk-sdk-test/src/main/java/com/test/risk/app/util/UtilsBridge.java

@@ -1,32 +0,0 @@
-package com.test.risk.app.util;
-
-class UtilsBridge {
-
-    static void preLoad() {
-        preLoad(AdaptScreenUtils.getPreLoadRunnable());
-    }
-
-    static long getFsTotalSize(String path) {
-        return FileUtils.getFsTotalSize(path);
-    }
-
-    static long getFsAvailableSize(String path) {
-        return FileUtils.getFsAvailableSize(path);
-    }
-
-    static SPUtils getSpUtils4Utils() {
-        return SPUtils.getInstance("Utils");
-    }
-
-    static boolean isSpace(final String s) {
-        return StringUtils.isSpace(s);
-    }
-
-    private static void preLoad(final Runnable... runs) {
-        for (final Runnable r : runs) {
-            ThreadUtils.getCachedPool().execute(r);
-        }
-    }
-
-
-}

+ 0 - 15
other_app/risk-sdk-test/src/main/java/com/test/risk/app/util/UtilsFileProvider.java

@@ -1,15 +0,0 @@
-package com.test.risk.app.util;
-
-import android.app.Application;
-
-import androidx.core.content.FileProvider;
-
-public class UtilsFileProvider extends FileProvider {
-
-    @Override
-    public boolean onCreate() {
-        //noinspection ConstantConditions
-        Utils.init((Application) getContext().getApplicationContext());
-        return true;
-    }
-}