Browse Source

添加获取imei,oaid,android_id 的排序逻辑,新增弹窗提示操作。

kaiweicai 3 years ago
parent
commit
b76a2fbe82
53 changed files with 1003 additions and 2249 deletions
  1. 22 2
      demo/build.gradle
  2. 44 14
      demo/src/main/AndroidManifest.xml
  3. 3 0
      demo/src/main/assets/yyxx_game/yyxx_cfg.properties
  4. 39 1
      demo/src/main/java/com/yyxx/commsdk/demo/DemoActivity.kt
  5. 6 1
      demo/src/main/java/com/yyxx/commsdk/demo/SplashActivity.java
  6. 0 1
      demo/src/main/res/layout/activity_login.xml
  7. 1 0
      demo/src/main/res/values-land/dimens.xml
  8. 1 0
      demo/src/main/res/values-w1240dp/dimens.xml
  9. 1 0
      demo/src/main/res/values-w600dp/dimens.xml
  10. 1 0
      demo/src/main/res/values/dimens.xml
  11. 18 0
      demo/src/main/res/values/strings.xml
  12. 9 0
      demo/src/main/res/values/themes.xml
  13. 0 1
      library_base/build.gradle
  14. 0 1
      library_base/src/main/java/cn/yyxx/commsdk/Version.java
  15. 1 0
      library_base/src/main/java/cn/yyxx/commsdk/base/SdkBridgeManager.java
  16. 1 1
      library_base/src/main/java/cn/yyxx/commsdk/base/YYXXApplication.java
  17. 18 6
      library_base/src/main/java/cn/yyxx/commsdk/base/YYXXCommSdk.java
  18. 113 1
      library_base/src/main/java/cn/yyxx/commsdk/base/YYXXWelcomeActivity.java
  19. 1 0
      library_base/src/main/java/cn/yyxx/commsdk/base/entity/Function.java
  20. 26 0
      library_base/src/main/java/cn/yyxx/commsdk/base/entity/ResultInfo.java
  21. 1 0
      library_base/src/main/java/cn/yyxx/commsdk/base/entity/SdkRoleInfo.java
  22. 0 220
      library_base/src/main/java/cn/yyxx/commsdk/base/utils/sign/AESUtils.java
  23. 0 351
      library_base/src/main/java/cn/yyxx/commsdk/base/utils/sign/SignUtils.java
  24. 0 41
      library_base/src/main/java/cn/yyxx/commsdk/base/utils/sign/a2u/tn/utils/json/IGetCollection.java
  25. 0 550
      library_base/src/main/java/cn/yyxx/commsdk/base/utils/sign/a2u/tn/utils/json/JsonParser.java
  26. 0 465
      library_base/src/main/java/cn/yyxx/commsdk/base/utils/sign/a2u/tn/utils/json/JsonSerializer.java
  27. 0 55
      library_base/src/main/java/cn/yyxx/commsdk/base/utils/sign/a2u/tn/utils/json/MapNavigator.java
  28. 0 31
      library_base/src/main/java/cn/yyxx/commsdk/base/utils/sign/a2u/tn/utils/json/ParseException.java
  29. 0 16
      library_base/src/main/java/cn/yyxx/commsdk/base/utils/sign/a2u/tn/utils/json/SerializeException.java
  30. 0 157
      library_base/src/main/java/cn/yyxx/commsdk/base/utils/sign/a2u/tn/utils/json/TnJson.java
  31. 0 146
      library_base/src/main/java/cn/yyxx/commsdk/base/utils/sign/a2u/tn/utils/json/TnJsonBuilder.java
  32. 1 0
      library_channel/build.gradle
  33. BIN
      library_channel/libs/oaid_sdk_1.0.25.aar
  34. 12 0
      library_channel/src/main/java/cn/yyxx/commsdk/impl/channel/msa/IMsaDeviceIdsCallback.java
  35. 66 0
      library_channel/src/main/java/cn/yyxx/commsdk/impl/channel/msa/MsaDeviceIdsHandler.java
  36. 2 2
      library_core/src/main/cpp/yyxxgame.cpp
  37. 1 1
      library_core/src/main/java/cn/yyxx/commsdk/core/SdkBridge.java
  38. 4 4
      library_core/src/main/java/cn/yyxx/commsdk/core/SdkDrive.java
  39. 320 0
      library_core/src/main/java/cn/yyxx/commsdk/core/common/CommonOperationManager.java
  40. 21 13
      library_core/src/main/java/cn/yyxx/commsdk/core/impl/SdkBridgeImpl.java
  41. 1 1
      library_core/src/main/java/cn/yyxx/commsdk/core/network/Hosts.java
  42. 22 2
      library_core/src/main/java/cn/yyxx/commsdk/core/network/SdkRequest.java
  43. 2 13
      library_core/src/main/java/cn/yyxx/commsdk/core/network/VolleyRequest.java
  44. 0 150
      library_core/src/main/java/cn/yyxx/commsdk/core/permission/PermissionManager.java
  45. 72 0
      library_core/src/main/java/cn/yyxx/commsdk/core/ui/dialog/SingleButtonDialog.java
  46. 68 0
      library_core/src/main/java/cn/yyxx/commsdk/core/utils/MMKVUtils.java
  47. 14 0
      library_core/src/main/java/cn/yyxx/commsdk/core/utils/ParamsUtils.java
  48. 8 0
      library_core/src/main/res/drawable/yyxx_dialog_ios_bg.xml
  49. 46 0
      library_core/src/main/res/layout/yyxx_comm_ios_style_dialog.xml
  50. 3 1
      library_core/src/main/res/values/yyxx_comm_colors.xml
  51. 4 1
      library_core/src/main/res/values/yyxx_comm_strings.xml
  52. 30 0
      library_core/src/main/res/values/yyxx_comm_styles.xml
  53. BIN
      libs/oaid_sdk_1.0.25.jar

+ 22 - 2
demo/build.gradle

@@ -14,7 +14,7 @@ android {
     defaultConfig {
         applicationId 'com.yyxx.commsdk.demo'
         minSdk rootProject.ext.android.minSdk
-        targetSdk rootProject.ext.android.targetSdk
+        targetSdk 26
         versionCode 1
         versionName "0.0.1"
 
@@ -59,8 +59,28 @@ android {
     kotlinOptions {
         jvmTarget = "1.8"
     }
+    sourceSets {
+        main {
+            assets {
+                srcDirs 'src/main/assets'
+            }
+        }
+    }
+    buildFeatures {
+        viewBinding true
+    }
 }
 
 dependencies {
-    debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.7'
+    implementation project(path: ':library_core')
+    implementation 'androidx.appcompat:appcompat:1.3.0'
+    implementation 'com.google.android.material:material:1.4.0'
+    implementation 'androidx.annotation:annotation:1.2.0'
+    implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
+    implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.3.1'
+    implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1'
+    implementation 'androidx.navigation:navigation-fragment:2.3.5'
+    implementation 'androidx.navigation:navigation-ui:2.3.5'
+    debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.8.1'
+    apply plugin: 'kotlin-android-extensions'
 }

+ 44 - 14
demo/src/main/AndroidManifest.xml

@@ -1,28 +1,58 @@
 <?xml version="1.0" encoding="utf-8"?>
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:tools="http://schemas.android.com/tools"
-    package="com.yyxx.commsdk.demo">
+    package="com.yyxx.commsdk.demo" >
+    <!-- 网络权限 -->
+    <uses-permission android:name="android.permission.INTERNET" />
+    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
+    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
+    <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
+    <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
+    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
+    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
+    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
+    <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
 
     <application
+        android:name="cn.yyxx.commsdk.base.YYXXApplication"
         android:allowBackup="true"
         android:icon="@mipmap/ic_launcher"
         android:label="@string/app_name"
-        android:supportsRtl="true"
-       >
+        android:supportsRtl="true" >
+        <activity
+            android:name=".SplashActivity"
+            android:exported="true"
+            android:screenOrientation="landscape"
+            android:label="@string/app_name"
+            android:theme="@style/Theme.Design.NoActionBar" >
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
 
+                <category android:name="android.intent.category.LAUNCHER" />
+            </intent-filter>
+        </activity>
 
-    <activity
-        android:name="com.yyxx.commsdk.demo.DemoActivity"
-        android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
-        android:exported="true"
-        android:launchMode="singleTask"
-        android:screenOrientation="sensorLandscape">
-        <intent-filter>
-            <action android:name="android.intent.action.MAIN" />
-            <category android:name="android.intent.category.LAUNCHER" />
-        </intent-filter>
-    </activity>
+        <activity
+            android:name=".DemoActivity"
+            android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
+            android:exported="true"
+            android:launchMode="singleTask"
+            android:screenOrientation="sensorLandscape" >
+            <intent-filter>
+                <action android:name="${applicationId}" />
+                <action android:name="android.intent.action.VIEW" />
+                <category android:name="android.intent.category.DEFAULT" />
+            </intent-filter>
+        </activity>
 
+        <activity android:name="cn.yyxx.support.permission.PermissionKitActivity"
+            android:configChanges="orientation|keyboardHidden|screenSize"
+            android:screenOrientation="behind"
+            android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"
+            />
+        <meta-data
+            android:name="yyrh_game_code"
+            android:value="100001" />
     </application>
 
 </manifest>

+ 3 - 0
demo/src/main/assets/yyxx_game/yyxx_cfg.properties

@@ -0,0 +1,3 @@
+YYXX_GAME_CODE=100001
+YYXX_GCP_CODE=
+YYXX_ONLINE_ENV=http://testsdkapi.yyxxgame.com

+ 39 - 1
demo/src/main/java/com/yyxx/commsdk/demo/DemoActivity.kt

@@ -2,12 +2,26 @@ package com.yyxx.commsdk.demo
 
 import android.app.Activity
 import android.content.Intent
+import android.os.Bundle
+
+import android.view.View
+import cn.yyxx.commsdk.base.YYXXCommSdk
+import cn.yyxx.commsdk.base.internal.ICallback
+
+
+import cn.yyxx.commsdk.base.internal.IRequestCallback
+
+
+import cn.yyxx.commsdk.core.network.SdkRequest
+import cn.yyxx.support.hawkeye.ToastUtils
+import kotlinx.android.synthetic.main.activity_login.*
+
 
 /**
  * @author #Suyghur.
  * Created on 2021/12/26
  */
-class DemoActivity : Activity() {
+class DemoActivity : Activity(), View.OnClickListener {
 
     override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
         super.onActivityResult(requestCode, resultCode, data)
@@ -16,4 +30,28 @@ class DemoActivity : Activity() {
     override fun onNewIntent(intent: Intent?) {
         super.onNewIntent(intent)
     }
+
+    override fun onCreate(savedInstanceState: Bundle?) {
+        super.onCreate(savedInstanceState)
+        setContentView(R.layout.activity_login)
+
+        login.setOnClickListener(this@DemoActivity)
+
+        YYXXCommSdk.getInstance().initialize(this,true,object: ICallback{
+            override fun onResult(code: Int, result: String?) {
+
+                ToastUtils.toastInfo(this@DemoActivity,"code:\$code   msg:$result")
+            }
+        })
+
+    }
+
+
+
+    override fun onClick(v: View?) {
+        v?.apply{
+            SdkRequest.getInstance().initAgreement(this@DemoActivity, IRequestCallback {
+            })
+        }
+    }
 }

+ 6 - 1
demo/src/main/java/com/yyxx/commsdk/demo/SplashActivity.java

@@ -1,2 +1,7 @@
-package com.yyxx.commsdk.demo;public class SplashActivity {
+package com.yyxx.commsdk.demo;
+
+import cn.yyxx.commsdk.base.YYXXWelcomeActivity;
+
+public class SplashActivity extends YYXXWelcomeActivity {
+
 }

+ 0 - 1
demo/src/main/res/layout/activity_login.xml

@@ -44,7 +44,6 @@
         android:layout_gravity="start"
         android:layout_marginTop="16dp"
         android:layout_marginBottom="64dp"
-        android:enabled="false"
         android:text="@string/action_sign_in"
         app:layout_constraintBottom_toBottomOf="parent"
         app:layout_constraintEnd_toEndOf="parent"

+ 1 - 0
demo/src/main/res/values-land/dimens.xml

@@ -1,3 +1,4 @@
 <resources>
     <dimen name="activity_horizontal_margin">48dp</dimen>
+    <dimen name="fab_margin">48dp</dimen>
 </resources>

+ 1 - 0
demo/src/main/res/values-w1240dp/dimens.xml

@@ -1,3 +1,4 @@
 <resources>
     <dimen name="activity_horizontal_margin">200dp</dimen>
+    <dimen name="fab_margin">200dp</dimen>
 </resources>

+ 1 - 0
demo/src/main/res/values-w600dp/dimens.xml

@@ -1,3 +1,4 @@
 <resources>
     <dimen name="activity_horizontal_margin">48dp</dimen>
+    <dimen name="fab_margin">48dp</dimen>
 </resources>

+ 1 - 0
demo/src/main/res/values/dimens.xml

@@ -2,4 +2,5 @@
     <!-- Default screen margins, per the Android Design guidelines. -->
     <dimen name="activity_horizontal_margin">16dp</dimen>
     <dimen name="activity_vertical_margin">16dp</dimen>
+    <dimen name="fab_margin">16dp</dimen>
 </resources>

+ 18 - 0
demo/src/main/res/values/strings.xml

@@ -1,3 +1,21 @@
 <resources>
     <string name="app_name">融合通用SDK</string>
+    <string name="title_activity_login">LoginActivity</string>
+    <string name="prompt_email">Email</string>
+    <string name="prompt_password">Password</string>
+    <string name="action_sign_in">Sign in or register</string>
+    <string name="action_sign_in_short">Sign in</string>
+    <string name="welcome">"Welcome !"</string>
+    <string name="invalid_username">Not a valid username</string>
+    <string name="invalid_password">Password must be >5 characters</string>
+    <string name="login_failed">"Login failed"</string>
+    <string name="title_activity_splash">Splash</string>
+    <!-- Strings used for fragments for navigation -->
+    <string name="first_fragment_label">First Fragment</string>
+    <string name="second_fragment_label">Second Fragment</string>
+    <string name="next">Next</string>
+    <string name="previous">Previous</string>
+
+    <string name="hello_first_fragment">Hello first fragment</string>
+    <string name="hello_second_fragment">Hello second fragment. Arg: %1$s</string>
 </resources>

+ 9 - 0
demo/src/main/res/values/themes.xml

@@ -1,4 +1,13 @@
 <resources>
 
     <style name="Theme.YYXXCommSdk" parent="Theme.MaterialComponents.Light" />
+
+    <style name="Theme.YYXXCommSdk.NoActionBar">
+        <item name="windowActionBar">false</item>
+        <item name="windowNoTitle">true</item>
+    </style>
+
+    <style name="Theme.YYXXCommSdk.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
+
+    <style name="Theme.YYXXCommSdk.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
 </resources>

+ 0 - 1
library_base/build.gradle

@@ -32,7 +32,6 @@ android {
 }
 
 dependencies {
-    api files('../libs/oaid_sdk_1.0.25.jar')
     api files('../libs/mmkv-static-1.2.8.jar')
     api files('../libs/dolin_zap_1.0.0.jar')
     api files('../libs/yyxx_support_1.0.2.jar')

+ 0 - 1
library_base/src/main/java/cn/yyxx/commsdk/Version.java

@@ -6,5 +6,4 @@ package cn.yyxx.commsdk;
  */
 public class Version {
     public static final String VERSION_NAME = "3.0.0";
-    public static final int VERSION_CODE = 300;
 }

+ 1 - 0
library_base/src/main/java/cn/yyxx/commsdk/base/SdkBridgeManager.java

@@ -35,6 +35,7 @@ final class SdkBridgeManager {
             return;
         }
         try {
+
             Method method = clzBridge.getMethod(methodName, types);
             method.invoke(sdkBridge, values);
         } catch (Exception e) {

+ 1 - 1
library_base/src/main/java/cn/yyxx/commsdk/base/YYXXApplication.java

@@ -1,4 +1,4 @@
-package cn.yyxx.commsdk;
+package cn.yyxx.commsdk.base;
 
 import android.app.Application;
 import android.content.Context;

+ 18 - 6
library_base/src/main/java/cn/yyxx/commsdk/base/YYXXCommSdk.java

@@ -111,6 +111,21 @@ public final class YYXXCommSdk {
         SdkBridgeManager.call(Function.INIT_APPLICATION, new Class[]{Application.class}, new Object[]{application});
     }
 
+    /**
+     * 启动打开隐私协议页面
+     * @param activity
+     * @param callback
+     */
+    public void  initAgreement(Activity activity, final ICallback callback){
+        if (checkSdkBridgeNull(Function.INIT_AGREEMENT, callback)) {
+            return;
+        }
+
+        SdkBridgeManager.call(Function.INIT_AGREEMENT, new Class[]{Activity.class, ICallback.class}, new Object[]{activity, callback});
+
+
+    }
+
     /**
      * SDK初始化
      *
@@ -128,11 +143,8 @@ public final class YYXXCommSdk {
             Logger.e("QSGameSdk initialize 已经执行,拦截此次调用");
             return;
         }
-        IInitialize initCallback = (code, result) -> {
-            doSdkInit = code == 0;
-            callback.onResult(code, result);
-        };
-        SdkBridgeManager.call(Function.INITIALIZE, new Class[]{Activity.class, Boolean.class, IInitialize.class}, new Object[]{activity, isLandscape, initCallback});
+
+        SdkBridgeManager.call(Function.INITIALIZE, new Class[]{Activity.class, Boolean.class,  ICallback.class}, new Object[]{activity, isLandscape, callback});
     }
 
     /**
@@ -444,7 +456,7 @@ public final class YYXXCommSdk {
         if (mSdkBridge == null) {
             Logger.e("invoke " + function + " error ... SdkBridge is null");
             if (callback != null) {
-                callback.onResult(-1, "QSGameSdk初始化失败");
+                callback.onResult(-1, "YYXXCommSdk初始化失败");
             }
             return true;
         } else {

+ 113 - 1
library_base/src/main/java/cn/yyxx/commsdk/base/YYXXWelcomeActivity.java

@@ -1,11 +1,123 @@
-package cn.yyxx.commsdk;
+package cn.yyxx.commsdk.base;
 
 import android.app.Activity;
+import android.content.Intent;
+import android.content.res.Configuration;
 import android.os.Bundle;
+import android.os.Handler;
+import android.os.Looper;
+import android.os.Message;
+import android.view.Window;
+import android.view.WindowManager;
+import android.view.animation.AlphaAnimation;
+import android.view.animation.Animation;
+import android.widget.LinearLayout;
+
+import java.util.List;
+
+import cn.yyxx.commsdk.base.internal.ICallback;
+import cn.yyxx.commsdk.base.utils.Logger;
+import cn.yyxx.support.AppUtils;
+import cn.yyxx.support.ResUtils;
+import cn.yyxx.support.permission.IPermissionCallback;
+import cn.yyxx.support.permission.Permission;
+import cn.yyxx.support.permission.PermissionKit;
 
 public class YYXXWelcomeActivity extends Activity {
+
+
+    private static final int CODE_GO_INIT = 1000;
+    private static final int CODE_GO_GAME_ACTIVITY = 1001;
+
+    private LinearLayout layout;
+    private final Handler handler = new Handler(Looper.getMainLooper()) {
+        @Override
+        public void handleMessage(Message msg) {
+            switch (msg.what) {
+                case CODE_GO_INIT:
+                    goInit();
+                    break;
+                case CODE_GO_GAME_ACTIVITY:
+                    goGameActivity();
+                    break;
+                default:
+                    break;
+            }
+        }
+    };
+
+
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
+        requestWindowFeature(Window.FEATURE_NO_TITLE);
+
+        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
+                WindowManager.LayoutParams.FLAG_FULLSCREEN);
+
+        setView();
+        YYXXCommSdk.getInstance().initAgreement(this, new ICallback() {
+            @Override
+            public void onResult(int code, String result) {
+                Logger.logHandler("result : " + result + "\n");
+
+                if (code == 0) {
+                    if (layout == null){
+                        handler.sendEmptyMessage(CODE_GO_GAME_ACTIVITY);
+                    }else{
+                        handler.sendEmptyMessageDelayed(CODE_GO_INIT, 400);
+                    }
+                } else {
+                    System.exit(0);
+                }
+            }
+        });
     }
+
+    private void goInit() {
+        Animation animation = new AlphaAnimation(0.3f, 1.0f);
+        animation.setDuration(2000);
+        animation.setAnimationListener(new Animation.AnimationListener() {
+            @Override
+            public void onAnimationStart(Animation animation) {
+            }
+            @Override
+            public void onAnimationEnd(Animation animation) {
+
+                handler.sendEmptyMessage(CODE_GO_GAME_ACTIVITY);
+            }
+
+            @Override
+            public void onAnimationRepeat(Animation animation) {
+
+            }
+        });
+
+        layout.startAnimation(animation);
+
+    }
+
+
+    private void setView() {
+        int id = 0;
+
+        id = ResUtils.getResId(this, "yyxx_comm_welcome", "drawable");
+
+        if (id == 0) {
+
+            return;
+        }
+
+        layout = new LinearLayout(this);
+        layout.setBackgroundResource(id);
+        setContentView(layout);
+    }
+
+    private void goGameActivity() {
+        String action = getPackageName();
+        Logger.i("goGameActivity -> action = " + action);
+        startActivity(new Intent(action));
+        finish();
+    }
+
 }

+ 1 - 0
library_base/src/main/java/cn/yyxx/commsdk/base/entity/Function.java

@@ -11,6 +11,7 @@ import java.lang.annotation.RetentionPolicy;
 public @interface Function {
     String ATTACH_BASE_CONTEXT = "attachBaseContext";
     String INIT_APPLICATION = "initApplication";
+    String INIT_AGREEMENT = "initAgreement";
     String INITIALIZE = "initialize";
     String LOGIN = "login";
     String LOGOUT = "logout";

+ 26 - 0
library_base/src/main/java/cn/yyxx/commsdk/base/entity/ResultInfo.java

@@ -6,5 +6,31 @@ package cn.yyxx.commsdk.base.entity;
  */
 public class ResultInfo {
 
+    /**
+     * 0是成功,其他是错误
+     */
+    public int code;
+    /**
+     * 返回信息
+     */
+    public String msg;
+    /**
+     * 返回数据
+     */
+    public String data;
 
+    public ResultInfo() {
+        code = -1;
+        msg = "";
+        data = "";
+    }
+
+    @Override
+    public String toString() {
+        return "ResultInfo{" +
+                "code=" + code +
+                ", msg='" + msg + '\'' +
+                ", data='" + data + '\'' +
+                '}';
+    }
 }

+ 1 - 0
library_base/src/main/java/cn/yyxx/commsdk/base/entity/SdkRoleInfo.java

@@ -5,4 +5,5 @@ package cn.yyxx.commsdk.base.entity;
  * Created on 2021/12/25
  */
 public class SdkRoleInfo {
+
 }

+ 0 - 220
library_base/src/main/java/cn/yyxx/commsdk/base/utils/sign/AESUtils.java

@@ -1,220 +0,0 @@
-package com.yyrh.utils;
-
-import android.util.Log;
-
-import com.yyrh.utils.a2u.tn.utils.json.TnJson;
-
-import java.io.UnsupportedEncodingException;
-
-import java.security.InvalidAlgorithmParameterException;
-import java.security.InvalidKeyException;
-import java.security.NoSuchAlgorithmException;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Random;
-
-import javax.crypto.BadPaddingException;
-import javax.crypto.Cipher;
-import javax.crypto.IllegalBlockSizeException;
-import javax.crypto.NoSuchPaddingException;
-import javax.crypto.SecretKey;
-
-import javax.crypto.spec.IvParameterSpec;
-
-import javax.crypto.spec.SecretKeySpec;
-
-public class AESUtils {
-
-
-    private final int HASH_ITERATIONS = 10000;
-    private final int KEY_LENGTH = 256;
-    private char[] humanPassphrase = { 'P', 'e', 'r', ' ', 'v', 'a', 'l', 'l',
-            'u', 'm', ' ', 'd', 'u', 'c', 'e', 's', ' ', 'L', 'a', 'b', 'a',
-            'n', 't' };// per vallum duces labant
-    private byte[] salt = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0xA, 0xB, 0xC, 0xD,
-            0xE, 0xF }; // must save this for next time we want the key
-
-
-    private static final String CIPHERMODEPADDING = "AES/CBC/PKCS7Padding";// AES/CBC/PKCS7Padding
-
-
-    private static String ivParameter = "8eb99e1f9813f24b";// 密钥默认偏移,可更改
-
-
-    private static String sKey = "8eb99e1f9813f24b5edb7a501ceae5ac";// key必须为16位,可更改为自己的key
-
-
-
-    public static String encrypt(String param) {
-
-
-         SecretKeySpec skforAES = null;
-         byte[] iv = ivParameter.getBytes();
-         IvParameterSpec IV;
-
-
-        // This is our secret key. We could just save this to a file instead of
-        // regenerating it
-        // each time it is needed. But that file cannot be on the device (too
-        // insecure). It could
-        // be secure if we kept it on a server accessible through https.
-
-        // byte[] skAsByteArray = sk.getEncoded();
-        byte[] skAsByteArray;
-        try {
-            skAsByteArray = sKey.getBytes("ASCII");
-            skforAES = new SecretKeySpec(skAsByteArray, "AES");
-        } catch (UnsupportedEncodingException e) {
-            e.printStackTrace();
-        }
-        IV = new IvParameterSpec(iv);
-
-
-        byte[] plaintext  =  param.getBytes();
-        byte[] ciphertext = encrypt(CIPHERMODEPADDING, skforAES, IV, plaintext);
-        return bytesToHex(ciphertext);
-    }
-
-
-    /**
-     * 字节数组转16进制
-     * @param bytes 需要转换的byte数组
-     * @return  转换后的Hex字符串
-     */
-    public static String bytesToHex(byte[] bytes) {
-        StringBuffer sb = new StringBuffer();
-        for(int i = 0; i < bytes.length; i++) {
-            String hex = Integer.toHexString(bytes[i] & 0xFF);
-            if(hex.length() < 2){
-                sb.append(0);
-            }
-            sb.append(hex);
-        }
-        return sb.toString();
-    }
-
-    /**
-     * AES 加密
-     * @param cmp
-     * @param sk
-     * @param IV
-     * @param msg
-     * @return
-     */
-
-    private static byte[] encrypt(String cmp, SecretKey sk, IvParameterSpec IV,
-                           byte[] msg) {
-        try {
-            Cipher c = Cipher.getInstance(cmp);
-            c.init(Cipher.ENCRYPT_MODE, sk, IV);
-            return c.doFinal(msg);
-        } catch (NoSuchAlgorithmException nsae) {
-            Log.e("AESdemo", "no cipher getinstance support for " + cmp);
-        } catch (NoSuchPaddingException nspe) {
-            Log.e("AESdemo", "no cipher getinstance support for padding " + cmp);
-        } catch (InvalidKeyException e) {
-            Log.e("AESdemo", "invalid key exception");
-        } catch (InvalidAlgorithmParameterException e) {
-            Log.e("AESdemo", "invalid algorithm parameter exception");
-        } catch (IllegalBlockSizeException e) {
-            Log.e("AESdemo", "illegal block size exception");
-        } catch (BadPaddingException e) {
-            Log.e("AESdemo", "bad padding exception");
-        }
-        return null;
-    }
-
-
-
-
-    public static String rand(int digit) {
-        Random rand = new Random();
-        char[] letters = new char[]{'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q',
-                'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i',
-                'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'r',
-                '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'};
-        String str = "";
-        int index;
-        boolean[] flags = new boolean[letters.length];//默认为false
-        for (int i = 0; i < digit; i++) {
-            do {
-                index = rand.nextInt(letters.length);
-            } while (flags[index] == true);
-            char c = letters[index];
-            str += c;
-            flags[index] = true;
-        }
-        return str;
-    }
-
-    /**
-     * hashMap转Json格式
-     * @param map
-     * @return
-     */
-    public static String hashMapToJson(HashMap<String, String> map) {
-        String string = "{";
-        for (Iterator it = map.entrySet().iterator(); it.hasNext();) {
-            Map.Entry e = (Map.Entry) it.next();
-            string += "\"" + e.getKey() + "\":";
-            String value = e.getValue() == null ? "" : e.getValue().toString();
-
-
-
-                string += "\"" + value + "\",";
-
-
-        }
-        string = string.substring(0, string.lastIndexOf(","));
-        string += "}";
-        return string;
-    }
-
-    public static String toJson(HashMap<String, String> map) {
-
-        String jsonString ="" ;//"[";
-
-        jsonString +=rand(5) + TnJson.toJson(map,TnJson.Mode.LIGHT);
-        YYLog.i(jsonString);
-        return jsonString ;//+= "]";
-
-    }
-
-
-
-    // 解密
-    public static String decrypt(String sSrc) {
-        try {
-            byte[] raw = sKey.getBytes("ASCII");
-            SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES");
-            Cipher cipher = Cipher.getInstance(CIPHERMODEPADDING);
-            IvParameterSpec iv = new IvParameterSpec(ivParameter.getBytes());
-            cipher.init(Cipher.DECRYPT_MODE, skeySpec, iv);
-            byte[] encrypted1 = hexStringToByteArray(sSrc);// 先用base64解密
-            byte[] original = cipher.doFinal(encrypted1);
-            String originalString = new String(original, "utf-8");
-            return originalString;
-        } catch (Exception ex) {
-            return null;
-        }
-    }
-
-
-    /**
-     * 十六进制转换为字节数组
-     * @param s
-     * @return
-     */
-    public static byte[] hexStringToByteArray(String s) {
-        //十六进制转byte数组
-        int len = s.length();
-        byte[] bs = new byte[len/2];
-        for(int i = 0;i < len;i+=2) {
-            bs[i/2] = (byte) ((Character.digit(s.charAt(i), 16) << 4) + Character.digit(s.charAt(i+1), 16));
-        }
-        return bs;
-    }
-
-}

+ 0 - 351
library_base/src/main/java/cn/yyxx/commsdk/base/utils/sign/SignUtils.java

@@ -1,351 +0,0 @@
-package com.yyrh.utils;
-
-import android.util.Base64;
-
-import java.io.ByteArrayOutputStream;
-import java.net.URLEncoder;
-import java.security.Key;
-import java.security.KeyFactory;
-import java.security.MessageDigest;
-import java.security.spec.X509EncodedKeySpec;
-import java.util.ArrayList;
-import java.util.Collections;
-
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.crypto.Cipher;
-import javax.crypto.Mac;
-import javax.crypto.spec.SecretKeySpec;
-
-import static com.yyrh.constant.URLConstants.APP_KEY;
-
-public class SignUtils {
-
-    private static final int MAX_ENCRYPT_BLOCK = 117;
-    public static final String KEY_ALGORITHM = "RSA";
-
-    public static String encryptParam(HashMap<String,String> map) {
-        String paramContent = "";
-        String URLenCodeparamContent = "";
-        List<Map.Entry<String, String>> infoIds = new ArrayList<Map.Entry<String, String>>(map.entrySet());
-        Collections.sort(infoIds, new Comparator<Map.Entry<String, String>>() {
-            @Override
-            public int compare(Map.Entry<String, String> o1, Map.Entry<String, String> o2) {
-                return o1.getKey().compareTo(o2.getKey());
-            }
-        });
-
-        for (int i = 0; i < infoIds.size(); i++) {
-
-            String id =  infoIds.get(i).toString();
-            paramContent = paramContent + id + "&";
-        }
-
-        String time = System.currentTimeMillis() / 1000 + "";
-        String allParam = paramContent + "time=" + time + "qDikI9v?>!x)1rS&yo";
-        String sign = Utils.getMD5(allParam);
-
-        for (String key : map.keySet()) {
-            YYLog.i(key + "=" + map.get(key));
-            URLenCodeparamContent = URLenCodeparamContent + key + "=" + toURLEncoded(map.get(key)) + "&";
-           }
-
-        URLenCodeparamContent =URLenCodeparamContent + "time=" + time  + "&sign="+ sign ;
-        return URLenCodeparamContent;
-    }
-
-    public static String paramSign(HashMap<String,String> map) {
-        String paramContent = "";
-        List<Map.Entry<String, String>> infoIds = new ArrayList<Map.Entry<String, String>>(map.entrySet());
-        Collections.sort(infoIds, new Comparator<Map.Entry<String, String>>() {
-            @Override
-            public int compare(Map.Entry<String, String> o1, Map.Entry<String, String> o2) {
-                return o1.getKey().compareTo(o2.getKey());
-            }
-        });
-
-        for (int i = 0; i < infoIds.size(); i++) {
-
-            String id =  infoIds.get(i).toString();
-            paramContent = paramContent + id + "&";
-        }
-
-        String time = toURLEncoded(System.currentTimeMillis() / 1000 + "");
-        paramContent = Utils.getMD5(paramContent + "time=" + time + "qDikI9v?>!x)1rS&yo");
-        return paramContent;
-    }
-
-    public static String encryptRsaByPublicKey(String key, String text)
-            throws Exception {
-
-        // 对公钥解密
-        byte[] data = Base64.decode(key, Base64.NO_WRAP);
-
-
-
-        byte[] byteText = text.getBytes();
-        // 取得公钥
-        X509EncodedKeySpec x509KeySpec = new X509EncodedKeySpec(data);
-        KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM);
-        Key publicKey = keyFactory.generatePublic(x509KeySpec);
-
-        // 对数据加密
-        Cipher cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding");
-        cipher.init(Cipher.ENCRYPT_MODE, publicKey);
-
-        int inputLen = byteText.length;
-        ByteArrayOutputStream out = new ByteArrayOutputStream();
-        int offSet = 0;
-        byte[] cache;
-        int i = 0;
-        while (inputLen -offSet > 0 ){
-            if(inputLen -offSet >MAX_ENCRYPT_BLOCK){
-                cache = cipher.doFinal(byteText,offSet,MAX_ENCRYPT_BLOCK);
-            }else{
-                cache = cipher.doFinal(byteText,offSet,inputLen - offSet);
-            }
-            out.write(cache,0,cache.length);
-            i++;
-            offSet = i * MAX_ENCRYPT_BLOCK;
-        }
-        byte[] encryptedData = out.toByteArray();
-        out.close();
-
-
-        String strBase64 = new String(Base64.encode(encryptedData, Base64.NO_WRAP));
-
-        return strBase64;
-    }
-
-    public static String toURLEncoded(String paramString) {
-        if (paramString == null || paramString.equals("")) {
-            return "";
-        }
-
-        try {
-            String str = new String(paramString.getBytes(), "UTF-8");
-            str = URLEncoder.encode(str, "UTF-8");
-            return str;
-        } catch (Exception localException) {
-            System.out.println("toURLEncoded error:" + paramString + ","
-                    + localException);
-        }
-
-        return "";
-    }
-
-
-
-    public static String paramSign(HashMap<String,String> map ,String time) {
-        String paramContent = "";
-        List<Map.Entry<String, String>> infoIds = new ArrayList<Map.Entry<String, String>>(map.entrySet());
-        Collections.sort(infoIds, new Comparator<Map.Entry<String, String>>() {
-            @Override
-            public int compare(Map.Entry<String, String> o1, Map.Entry<String, String> o2) {
-                return o1.getKey().compareTo(o2.getKey());
-            }
-        });
-
-        for (int i = 0; i < infoIds.size(); i++) {
-
-            String id =  infoIds.get(i).toString();
-            paramContent = paramContent + id + "&";
-
-
-
-        }
-        String content = paramContent +"time=" + time + "qDikI9v?>!x)1rS&yo";
-
-        paramContent = getMD5(content);
-        return paramContent;
-    }
-
-
-    public static String getMD5(String content) {
-        String s = null;
-        char hexDigits[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
-                'a', 'b', 'c', 'd', 'e', 'f'};
-        try {
-            java.security.MessageDigest md = java.security.MessageDigest
-                    .getInstance("MD5");
-            md.update(content.getBytes());
-            byte tmp[] = md.digest();
-            char str[] = new char[16 * 2];
-            int k = 0;
-            for (int i = 0; i < 16; i++) {
-                byte byte0 = tmp[i];
-                str[k++] = hexDigits[byte0 >>> 4 & 0xf];
-                str[k++] = hexDigits[byte0 & 0xf];
-            }
-            s = new String(str);
-
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-        return s;
-    }
-
-    /**
-     * 新融合增加打点上报签名规则
-     */
-
-    public static String sdkLogParamSign(HashMap<String,String> map) {
-        String paramContent = "";
-        List<Map.Entry<String, String>> infoIds = new ArrayList<Map.Entry<String, String>>(map.entrySet());
-        Collections.sort(infoIds, new Comparator<Map.Entry<String, String>>() {
-            @Override
-            public int compare(Map.Entry<String, String> o1, Map.Entry<String, String> o2) {
-                return o1.getKey().compareTo(o2.getKey());
-            }
-        });
-
-        for (int i = 0; i < infoIds.size(); i++) {
-
-            String id =  infoIds.get(i).toString();
-            paramContent = paramContent + id + "&";
-
-
-        }
-        String sign = "";
-        paramContent = paramContent.substring(0,paramContent.length() - 1);
-        try {
-            sign = hmacSHA256(paramContent,APP_KEY);
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-        return sign;
-    }
-
-    public static String hmacSHA256(String data, String key) throws Exception {
-
-        Mac sha256_HMAC = Mac.getInstance("HmacSHA256");
-
-        SecretKeySpec secret_key = new SecretKeySpec(key.getBytes("UTF-8"), "HmacSHA256");
-
-        sha256_HMAC.init(secret_key);
-
-        byte[] array = sha256_HMAC.doFinal(data.getBytes("UTF-8"));
-
-        StringBuilder sb = new StringBuilder();
-
-        for (byte item : array) {
-
-            sb.append(Integer.toHexString((item & 0xFF) | 0x100).substring(1, 3));
-
-        }
-
-        return sb.toString();
-
-    }
-
-
-
-    public static String sdkLogEncryptParam(HashMap<String,String> map) {
-        String paramContent = "";
-        String URLenCodeparamContent = "";
-        List<Map.Entry<String, String>> infoIds = new ArrayList<Map.Entry<String, String>>(map.entrySet());
-        Collections.sort(infoIds, new Comparator<Map.Entry<String, String>>() {
-            @Override
-            public int compare(Map.Entry<String, String> o1, Map.Entry<String, String> o2) {
-                return o1.getKey().compareTo(o2.getKey());
-            }
-        });
-
-        for (int i = 0; i < infoIds.size(); i++) {
-
-            String id =  infoIds.get(i).toString();
-            paramContent = paramContent + id + "&";
-        }
-
-
-
-        String sign = sdkLogParamSign(map);
-
-        for (String key : map.keySet()) {
-            YYLog.i(key + "=" + map.get(key));
-            URLenCodeparamContent = URLenCodeparamContent + key + "=" + toURLEncoded(map.get(key)) + "&";
-        }
-
-        URLenCodeparamContent =URLenCodeparamContent  + "sign="+ sign ;
-        return URLenCodeparamContent;
-    }
-
-    /*
-     **************************************************** 上报log日志签名工具
-     */
-
-
-    /**
-     * 将byte转为16进制
-     *
-     * @param bytes
-     * @return
-     */
-    private static String byte2Hex(byte[] bytes) {
-        StringBuffer stringBuffer = new StringBuffer();
-        String temp = null;
-        for (int i = 0; i < bytes.length; i++) {
-            temp = Integer.toHexString(bytes[i] & 0xFF);
-            if (temp.length() == 1) {
-                //1得到一位的进行补0操作
-                stringBuffer.append("0");
-            }
-            stringBuffer.append(temp);
-        }
-        return stringBuffer.toString();
-    }
-
-
-
-
-
-
-    public static String sha256Hex(String s) throws Exception {
-        MessageDigest md = MessageDigest.getInstance("SHA-256");
-        byte[] d = md.digest(s.getBytes("UTF-8"));
-        return  byte2Hex(d).toLowerCase();
-    }
-
-
-    public static byte[] hmac256(byte[] key, String msg) throws Exception {
-        Mac mac = Mac.getInstance("HmacSHA256");
-        SecretKeySpec secretKeySpec = new SecretKeySpec(key, mac.getAlgorithm());
-        mac.init(secretKeySpec);
-        return mac.doFinal(msg.getBytes("UTF-8"));
-    }
-
-
-    /*
-     * 签名
-     */
-    public static String sdkLogParamSign(String time, String value) {
-        String sha256_value = null;
-        try {
-            sha256_value = sha256Hex(value);
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-
-
-        String sign = "timestamp=" + time + "\n" + sha256_value;
-
-        String hmac_sha256_value = "";
-        try {
-
-            hmac_sha256_value = byte2Hex(hmac256(APP_KEY.getBytes("UTF-8"), sign)).toLowerCase();;
-
-
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-
-        return hmac_sha256_value;
-    }
-
-
-
-}
-

+ 0 - 41
library_base/src/main/java/cn/yyxx/commsdk/base/utils/sign/a2u/tn/utils/json/IGetCollection.java

@@ -1,41 +0,0 @@
-package com.yyrh.utils.a2u.tn.utils.json;
-
-import java.util.Collection;
-import java.util.Map;
-
-/**
- * The callback-interface for specifying type of collection which will be returned when parsing.
- * @see TnJson#parse(String, IGetCollection)
- */
-public interface IGetCollection {
-
-  /**
-   * Name of root element in a path. Using in call-back methods of IGetCollection.
-   * @see #forObject(String)
-   * @see #forList(String)
-   */
-  public static final String PATH_ROOT_KEY = JsonParser.PATH_ROOT_KEY;
-
-
-  /**
-   * This methow will be called when parcer need create new map.<br>
-   * If this method returns null, then map will be created with the default type - LinkedHashMap.
-   *
-   * @param path path of current element, starting from root. If this a root element, then path equal "root".
-   * @return the empty object who implementing interface from java.util.Map&lt;String, Object&gt;.
-   *
-   * @see #PATH_ROOT_KEY
-   */
-  Map<String, Object> forObject(String path);
-
-  /**
-   * This methow will be called when parcer need create new array.<br>
-   * If this method returns null, then array will be created with the default type - ArrayList.
-   *
-   * @param path path of current element, starting from root. If this a root element, then path equal "root".
-   * @return the empty object who implementing interface from java.util.Collection&lt;Object&gt;.
-   *
-   * @see #PATH_ROOT_KEY
-   */
-  Collection forList(String path);
-}

+ 0 - 550
library_base/src/main/java/cn/yyxx/commsdk/base/utils/sign/a2u/tn/utils/json/JsonParser.java

@@ -1,550 +0,0 @@
-package com.yyrh.utils.a2u.tn.utils.json;
-
-import java.math.BigInteger;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-/**
- * Parsing JSON string to Map object with JSON5
- * JSON for Humans https://spec.json5.org
- *
- */
-class JsonParser {
-
-  /**
-   * This name will get element in a returned map when json-string will be an array of values.
-   */
-  public static final String DEFAULT_LIST_KEY = "list";
-
-  /**
-   * Name of root element in a path. Using in call-back methods of IGetCollection.
-   * @see IGetCollection#forObject(String)
-   * @see IGetCollection#forList(String)
-   */
-  public static final String PATH_ROOT_KEY = "root";
-
-
-  private IGetCollection listener;
-
-
-  /**
-   * Inner immutable class for represent path by root of json-object
-   */
-  private class Path {
-    private String path;
-
-    public Path(String str) {
-      this.path = str;
-    }
-
-    public String getName() {
-      return path;
-    }
-
-    public Path add(String node) {
-      return new Path(path + '.' + node);
-    }
-
-  }
-
-  private static final String NULL = "null";
-  private static final String BOOL_TRUE = "true";
-  private static final String BOOL_FALSE = "false";
-  private static final String NUM_INFINITY = "infinity";
-  private static final String NUM_INFINITY_PSITIVE = "+infinity";
-  private static final String NUM_INFINITY_NEGATIVE = "-infinity";
-  private static final String NUM_NAN = "nan";
-
-  private static final char LF = 0x0A;
-  private static final char CR = 0x0D;
-  private static final char LS = 0x2028;
-  private static final char PS = 0x2029;
-
-
-  private Map<String, Object> resultMap; // result object
-  private String content;                // incoming json-string
-  private int maxLength;                 // cache of length the incoming json-string
-  private int index;                     // current accepted symbol
-
-
-  JsonParser() {
-    //hide this
-  }
-  JsonParser(IGetCollection listener) {
-    this.listener = listener;
-  }
-
-
-
-  /**
-   * Prepare and start parsing
-   * @param data json-string
-   * @return java-map object - result of parsing
-   */
-  Map<String, Object> doParse(String data) {
-    content = data.trim();
-    maxLength = content.length();
-    index = 0;
-
-    Path emptypath = new Path(PATH_ROOT_KEY);
-    resultMap = getCollectionForObject(emptypath);
-
-    parseEmpty(emptypath);
-
-    return resultMap;
-  }
-
-  private void parseEmpty(Path emptypath) {
-    while (index < maxLength) {
-      char c = getTokenBegin();
-      if (c == '{') {
-        index++;
-        resultMap = parseMap(emptypath);
-        return;
-      }
-      else if (c == '[') {
-        index++;
-        Collection list = parseList(emptypath);
-        resultMap.put(DEFAULT_LIST_KEY, list);
-      }
-
-      index++;
-    }
-  }
-
-  private Map<String, Object> parseMap(Path path) {
-    Map<String, Object> map = getCollectionForObject(path);
-
-    while (index < maxLength) {
-      char c = getTokenBegin(); //skip to begin
-
-      if (c == '}') {
-        index++;
-        return map;
-      }
-
-      String key = extractIdenty(path);
-
-      String pathForLog = path.getName() + "." + key;
-
-      c = getTokenBegin();
-      if (c != ':') {
-        throw new ParseException("Invalid character '" + charToLog(c) + "' at position " + index + ", path '" + pathForLog + "', expected ':'.", index, pathForLog);
-      }
-      index++;
-      Object val = extractValue(path.add(key));
-      map.put(key, val);
-
-      c = getTokenBegin();
-      if (c == '}') {
-        index++;
-        return map;
-      }
-      if (c == ',') {
-        index++;
-        continue;
-      }
-
-      throw new ParseException("Invalid character '" + charToLog(c) + "' at position " + index + ", last path '"+ pathForLog +"', expected ',' or '}'.", index, pathForLog);
-    }
-
-    return map;
-  }
-
-  @SuppressWarnings("unchecked")
-  private Collection parseList(Path path) {
-    Collection list = getCollectionForList(path);
-
-    while (index < maxLength) {
-      char c = getTokenBegin();
-
-      if (c == ']') {
-        index++;
-        return list;
-      }
-
-      if (c == ',') {
-        index++;
-        continue;
-      }
-
-      Object val = extractValue(path);
-      list.add(val);
-
-    }
-
-    return list;
-  }
-
-
-  /**
-   * Return a first symbol which has mean, starting at position = index.
-   * Comments will be ignored.
-   * index will point to this symbol.
-   */
-  private char getTokenBegin() {
-    while (index < maxLength) {
-      char c = content.charAt(index);
-      if (Character.isLetterOrDigit(c) || c == '"' || c == '\'' || c == '@' || c == '#' || c == '$' || c == '_' || c == '{' || c == '}' || c == ':' || c == '[' || c == ']' || c == ',' || c == '+' || c == '-' || c == '.') {
-        return c;
-      }
-
-      if (c == '\\') {
-        return c;
-      }
-
-      if (c == '/') {
-        char next = content.charAt(index + 1);
-        if (next == '/') {
-          skipToEndLine();
-        }
-        else if (next == '*') {
-          index += 2;
-          skipToEndComent();
-        }
-      }
-
-      index++;
-    }
-    return 0;
-  }
-
-  private void skipToEndLine() {
-    while (index < maxLength) {
-      char c = content.charAt(index);
-      if (isLineTerminator(c)) {
-        return;
-      }
-      index++;
-    }
-  }
-
-  private void skipToEndComent() {
-    while (index < maxLength) {
-      char c = content.charAt(index);
-      if (c == '*') {
-        index++;
-        c = content.charAt(index);
-        if (c == '/') {
-          return;
-        }
-      }
-      index++;
-    }
-  }
-
-
-
-  private String extractIdenty(Path path) {
-    char c = content.charAt(index);
-    char terminator = (c == '"' || c == '\'') ? c : 0;
-
-    StringBuilder b = new StringBuilder();
-    while (index < maxLength) {
-      c = content.charAt(index);
-      if (c == terminator) {
-        index++;
-        if (b.length() == 0) {
-          continue;
-        }
-        return b.toString().trim();
-      }
-      if (terminator == 0 && (c == ':' || c == '/' || isWhiteSpace(c))) {
-        return b.toString().trim();
-      }
-
-      if (c  == '\\') {
-        c = getCharFromEscapedText();
-      }
-      if ((terminator == 0 && (c== '\'' || c == '"')) || isLineTerminator(c)) {
-        throw new ParseException("Invalid character '"+ charToLog(c) +"' for identifier '"+ b.toString() +"' at position "+ index +", path '"+ path.getName() +"'.", index, path.getName());
-      }
-      else {
-        b.append(c);
-      }
-      index++;
-    }
-
-    return b.toString().trim();
-  }
-
-  private Object extractValue(Path path) {
-    char c = getTokenBegin();
-
-    if (c == '{') {
-      index++;
-      Map<String, ?> map = parseMap(path);
-      return map;
-    }
-    if (c == '[') {
-      index++;
-      Collection list = parseList(path);
-      return list;
-    }
-    if (c == '"' || c == '\'') {
-      String str = extractString();
-      return str;
-    }
-    else {
-      Object num = extractLiteral(path);
-      return num;
-    }
-
-  }
-
-
-  private Object extractLiteral(Path path) {
-    StringBuilder b = new StringBuilder();
-    while (index < maxLength) {
-      char c = content.charAt(index);
-      if (c == '+' && b.length() == 0) {
-        index++;
-      }
-      else if (Character.isLetterOrDigit(c) || c == '.' || c == '+' || c == '-') {
-        b.append(c);
-        index++;
-      }
-      else {
-        break;
-      }
-    }
-
-    String literal = b.toString().trim().toLowerCase();
-
-    switch (literal) {
-      case NULL:
-        return null;
-      case BOOL_TRUE:
-        return true;
-      case BOOL_FALSE:
-        return false;
-      case NUM_INFINITY:
-        return Double.POSITIVE_INFINITY;
-      case NUM_INFINITY_PSITIVE:
-        return Double.POSITIVE_INFINITY;
-      case NUM_INFINITY_NEGATIVE:
-        return Double.NEGATIVE_INFINITY;
-      case NUM_NAN:
-        return Double.NaN;
-    }
-
-    try {
-      return detectNumber(literal);
-    }
-    catch (Exception ex) {
-      throw new ParseException("Invalid literal '" + literal + "' at position " + index + ", path '"+ path.getName() +"'.", index, path.getName());
-    }
-
-  }
-
-  private Object detectNumber(String literal) {
-    boolean hasDot = literal.indexOf('.') >= 0;
-    boolean hasE = literal.indexOf('e') >= 0;
-    boolean hasX = literal.indexOf('x') >= 0;
-
-    if (hasDot || (hasE && ! hasX)) {
-      return Double.parseDouble(literal);
-    }
-
-    // Integer.MAX_VALUE dec == 2147483647 - 10 characters
-    // Integer.MAX_VALUE hex == 0x7fffffff - 8 characters + 2 (0x) = 10 characters
-    // Long.MAX_VALUE dec == 9223372036854775807 - 19 characters
-    // Long.MAX_VALUE hex == 0x7fffffffffffffff - 16 characters + 2 (0x) = 18 characters
-    //
-    // therefore
-    // for maxintlen == 9 or 9 characters dec / hex
-    // for maxlonglen == 18 or 17 characters dec / hex
-    int maxintlen = hasX ? 9 : 9;
-    int maxlonglen = hasX ? 17 : 18;
-    if (literal.charAt(0) == '-') {
-      maxintlen++;
-      maxlonglen++;
-    }
-    if (literal.length() <= maxintlen) {
-      return Integer.decode(literal);
-    }
-    if (literal.length() <= maxlonglen) {
-      return Long.decode(literal);
-    }
-    else {
-      return new BigInteger(literal);
-    }
-  }
-
-
-  private String extractString() {
-    char terminator = content.charAt(index);
-    index++;
-
-    StringBuilder b = new StringBuilder();
-    while (index < maxLength) {
-      char c = content.charAt(index);
-      if (c == '\\') {
-        char ce = getCharFromEscapedText();
-        b.append(ce);
-        index++;
-      }
-      else if (c == terminator) {
-        index++;
-        break;
-      }
-      else {
-        b.append(c);
-        index++;
-      }
-    }
-
-    return b.toString().trim();
-  }
-
-  /**
-   * Extract escaped sequences, and convert to char
-   * https://spec.json5.org/#escapes
-   *
-   * As result index will refer to the last accepted character
-   *
-   * @return matching character
-   */
-  private char getCharFromEscapedText() {
-    char resultChar;
-    index++;
-    char next = content.charAt(index);
-    switch (next) {
-      case 'b': resultChar = '\b'; break;
-      case 'f': resultChar = '\f'; break;
-      case 'n': resultChar = '\n'; break;
-      case 'r': resultChar = '\r'; break;
-      case 't': resultChar = '\t'; break;
-      case 'v': resultChar = 0x000B; break;
-      case '0': resultChar = 0x0000; break;
-      case '\'': resultChar = '\'';  break;
-      case '"': resultChar = '"';  break;
-      case '\\': resultChar = '\\'; break;
-      case 'u':
-        StringBuilder bu = new StringBuilder();
-        bu.append(content.charAt(++index));
-        bu.append(content.charAt(++index));
-        bu.append(content.charAt(++index));
-        bu.append(content.charAt(++index));
-        int hexValU = Integer.parseInt(bu.toString(), 16);
-        resultChar = (char) hexValU;
-        break;
-
-      case 'x':
-      case 'X':
-        StringBuilder bx = new StringBuilder();
-        char cx = content.charAt(index + 1); //index will refer to the last accepted character, therefore we need to use +1
-        while (isHexadecimalChar(cx)) {
-          bx.append(cx);
-          index++;
-          cx = content.charAt(index + 1);
-        }
-        int hexValX = Integer.parseInt(bx.toString(), 16);
-        resultChar = (char) hexValX;
-        break;
-
-      default: return next;
-
-    }
-
-    return resultChar;
-  }
-
-
-  /**
-   * Line terminator point out to end of single-line comment
-   */
-  private boolean isLineTerminator(char c) {
-    return c == LF || c == CR || c == LS || c == PS;
-  }
-  private boolean isWhiteSpace(char c) {
-    switch (c) {
-      case 0x0009:
-      case 0x000A:
-      case 0x000B:
-      case 0x000C:
-      case 0x000D:
-      case 0x0020:
-      case 0x0085:
-      case 0x00A0:
-      case 0x1680:
-      case 0x2000:
-      case 0x2001:
-      case 0x2002:
-      case 0x2003:
-      case 0x2004:
-      case 0x2005:
-      case 0x2006:
-      case 0x2007:
-      case 0x2008:
-      case 0x2009:
-      case 0x200A:
-      case 0x2028:
-      case 0x2029:
-      case 0x202F:
-      case 0x205F:
-      case 0x3000:
-        return true;
-      default: return false;
-    }
-  }
-  private boolean isHexadecimalChar(char c) {
-    if (c >= '0' && c <= '9') {
-      return true;
-    }
-    if (c >= 'A' && c <= 'F') {
-      return true;
-    }
-    if (c >= 'a' && c <= 'f') {
-      return true;
-    }
-    return false;
-  }
-
-  /**
-   * Transform character to string for log
-   */
-  private String charToLog(char c) {
-    switch (c) {
-      case '\b': return "\\b";
-      case '\f': return "\\f";
-      case '\n': return "\\n";
-      case '\r': return "\\r";
-      case '\t': return "\\t";
-      case '\'': return "'";
-      case '"': return "\"";
-      case LS: return "LS (0x2028)";
-      case PS: return "PS (0x2029)";
-
-      case 0: return "null (0x0000)";
-
-      default: return String.valueOf(c);
-    }
-
-  }
-
-  private Map<String, Object> getCollectionForObject(Path path) {
-    Map<String, Object> result = null;
-    if (listener != null) {
-      result = listener.forObject(path.getName());
-    }
-    if (result == null) {
-      result = new LinkedHashMap<>();
-    }
-    return result;
-  }
-
-  private Collection getCollectionForList(Path path) {
-    Collection result = null;
-    if (listener != null) {
-      result = listener.forList(path.getName());
-    }
-    if (result == null) {
-      result = new ArrayList();
-    }
-    return result;
-  }
-
-}

+ 0 - 465
library_base/src/main/java/cn/yyxx/commsdk/base/utils/sign/a2u/tn/utils/json/JsonSerializer.java

@@ -1,465 +0,0 @@
-package com.yyrh.utils.a2u.tn.utils.json;
-
-import java.lang.reflect.Array;
-import java.lang.reflect.Field;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.time.LocalDate;
-import java.time.LocalDateTime;
-import java.time.LocalTime;
-import java.time.format.DateTimeFormatter;
-import java.util.Collection;
-import java.util.Date;
-import java.util.Map;
-
-/**
- * MAP to JSON converter.<br>
- * Every value in the Map must be
- * <ul>
- *   <li>either a simple value: string, number, boolean, or other;</li>
- *   <li>either by a Map such as Map&lt;String, Object&gt;;</li>
- *   <li>either an array of values such as Collection&lt;Object&gt;.</li>
- * </ul>
- * <br>
- * Of course, you can use for json-object any class inheritor of the java.util.Map interface.<br>
- * For json-array you can use any class inheritor of the java.util.Collection interface.
- */
-class JsonSerializer {
-
-  private JsonSerializer() {
-    //hide this
-  }
-
-  /**
-   * Convert Map to JSON with builder
-   * @param data Object to convert. It can be Map, Collection, array, or any other object
-   * @param builder json generator tuning
-   * @return JSON-string
-   * @see TnJsonBuilder
-   */
-  public static String toJson(Object data, TnJsonBuilder builder) {
-    StringBuilder b = new StringBuilder();
-    addValue(data, b, builder, 0, "");
-    String json = b.toString();
-    return json;
-  }
-
-  private static void addValue(Object value, StringBuilder b, TnJsonBuilder builder, int level, String path) {
-
-    if (value == null) {
-      b.append("null");
-    }
-    else if (value instanceof Character) {
-      addString(String.valueOf(value), b, builder);
-    }
-    else if (value instanceof CharSequence) {
-      addString((CharSequence) value, b, builder);
-    }
-    else if (value instanceof Number) {
-      addNum(value, b);
-    }
-    else if (value instanceof Boolean) {
-      boolean v = (Boolean) value;
-      b.append(v ? "true" : "false");
-    }
-    else if (value instanceof Date) {
-      long v = ((Date)value).getTime();
-      b.append(v);
-    }
-
-    /**
-     * 由于 LocalDate LocalTime LocalDateTime 只能在8.0上运行,
-     * 且解析内容用不上,因此注释相关代码块,避免兼容问题
-     *
-    else if (value instanceof LocalDate) {
-      String strd = ((LocalDate)value).format(DateTimeFormatter.ISO_DATE);
-      b.append(strd);
-    }
-    else if (value instanceof LocalTime) {
-      String strt = ((LocalTime)value).format(DateTimeFormatter.ISO_TIME);
-      b.append(strt);
-    }
-    else if (value instanceof LocalDateTime) {
-      String strdt = ((LocalDateTime)value).format(DateTimeFormatter.ISO_DATE_TIME);
-      b.append(strdt);
-    }
-     */
-    else if (value instanceof Map) {
-      addMap((Map) value, b, builder, level, path);
-    }
-    else if (value instanceof Collection) {
-      addList((Collection) value, b, builder, level, path);
-    }
-    else if (value.getClass().isArray()) {
-      addArray(value, b, builder, level, path);
-    }
-    else {
-      addObj(value, b, builder, level, path);
-    }
-
-  }
-
-  private static void addString(CharSequence str, StringBuilder b, TnJsonBuilder builder) {
-    if (str == null) {
-      b.append("null");
-    }
-    else {
-      b.append(builder.quoteSymbol);
-
-      int len = str.length();
-      for (int p = 0; p < len; p++) {
-        char c = str.charAt(p);
-        if (Character.isLetterOrDigit(c)) {
-          b.append(c);
-        }
-        else if (c == '\n') {
-          if (builder.isAllowMultiRowString) {
-            b.append("/\n");
-          }
-          else if (builder.isStayReadable) {
-            b.append(charToReadable(c));
-          }
-          else {
-            b.append(c);
-          }
-        }
-        else if (c == builder.quoteSymbol) {
-          if (builder.isStayReadable) {
-            b.append(charToReadable(c));
-          }
-          else {
-            b.append(c);
-          }
-        }
-        else {
-          if (builder.isStayReadable) {
-            if (c == '\'' || c == '"') {
-              b.append(c);
-            }
-            else {
-              b.append(charToReadable(c));
-            }
-          }
-          else {
-            b.append(c);
-          }
-        }
-      }
-
-      b.append(builder.quoteSymbol);
-    }
-  }
-  private static String charToReadable(char c) {
-    switch (c) {
-      case ' ': return String.valueOf(c);
-      case '`': return String.valueOf(c);
-      case '~': return String.valueOf(c);
-      case '!': return String.valueOf(c);
-      case '@': return String.valueOf(c);
-      case '#': return String.valueOf(c);
-      case '$': return String.valueOf(c);
-      case '%': return String.valueOf(c);
-      case '^': return String.valueOf(c);
-      case '&': return String.valueOf(c);
-      case '*': return String.valueOf(c);
-      case '(': return String.valueOf(c);
-      case ')': return String.valueOf(c);
-      case '-': return String.valueOf(c);
-      case '_': return String.valueOf(c);
-      case '=': return String.valueOf(c);
-      case '+': return String.valueOf(c);
-      case '[': return String.valueOf(c);
-      case ']': return String.valueOf(c);
-      case '{': return String.valueOf(c);
-      case '}': return String.valueOf(c);
-      case ';': return String.valueOf(c);
-      case ':': return String.valueOf(c);
-      case '"': return "\\\"";
-      case '\'': return "\\'";
-      case '\\': return "\\\\";
-      case '|': return String.valueOf(c);
-      case '/': return "\\/";
-      case ',': return String.valueOf(c);
-      case '.': return String.valueOf(c);
-      case '?': return String.valueOf(c);
-      case '<': return String.valueOf(c);
-      case '>': return String.valueOf(c);
-      case '\b': return "\\b";
-      case '\f': return "\\f";
-      case '\n': return "\\n";
-      case '\r': return "\\r";
-      case '\t': return "\\t";
-      default: return unicodeEscaped(c);
-    }
-  }
-  private static String unicodeEscaped(char ch) {
-    if (ch < 0x10) {
-      return "\\u000" + Integer.toHexString(ch);
-    }
-    else if (ch < 0x100) {
-      return "\\u00" + Integer.toHexString(ch);
-    }
-    else if (ch < 0x1000) {
-      return "\\u0" + Integer.toHexString(ch);
-    }
-    return "\\u" + Integer.toHexString(ch);
-  }
-
-
-  private static void addNum(Object num, StringBuilder b) {
-    String v  = String.valueOf(num);
-    b.append(v);
-  }
-
-  private static void addMap(Map map, StringBuilder b, TnJsonBuilder builder, int level, String path) {
-    int valuelevel = level + 1;
-
-    b.append("{");
-    endLine(b, builder);
-
-    boolean hasEntry = false;
-    for(Object keyObj : map.keySet()) {
-      String key = String.valueOf(keyObj);
-      Object value = map.get(keyObj);
-      String valuePath = path+"."+key;
-
-      if (builder.pathHandler != null) {
-        value = builder.pathHandler.handlePath(valuePath, value);
-      }
-      if (value == null && !builder.isKeepNull) {
-        continue;
-      }
-      if (value != null && builder.typeHandler != null) {
-        value = builder.typeHandler.handleType(value);
-      }
-
-      key = codeKey(key, builder);
-
-      if (hasEntry) {
-        b.append(",");
-        endLine(b, builder);
-      }
-      else {
-        hasEntry = true;
-      }
-
-      startLine(b, builder, valuelevel);
-      b.append(key);
-
-      b.append(":");
-      if (builder.isFormated) {
-        b.append(" ");
-      }
-
-      addValue(value, b, builder, valuelevel, valuePath);
-    }
-
-    endLine(b, builder);
-    startLine(b, builder, level);
-    b.append("}");
-
-  }
-
-  private static String codeKey(CharSequence key, TnJsonBuilder builder) {
-    StringBuilder b = new StringBuilder();
-    int len = key.length();
-    boolean validIdenty = true;
-    for (int i=0; i < len; i++) {
-      char c = key.charAt(i);
-      if (Character.isLetterOrDigit(c)) {
-        b.append(c);
-      }
-      else {
-        b.append(c);
-        validIdenty = false;
-      }
-
-
-    }
-
-    if (!builder.isKeyQuoted && validIdenty && Character.isLetter(key.charAt(0))) {
-      return b.toString();
-    }
-    else {
-      return builder.quoteSymbol + b.toString() + builder.quoteSymbol;
-    }
-  }
-
-  private static void addList(Collection list, StringBuilder b, TnJsonBuilder builder, int level, String path) {
-    int itemlevel = level + 1;
-
-    b.append("[");
-
-    endLine(b, builder);
-    startLine(b, builder, itemlevel);
-
-    boolean hasEntry = false;
-    for (Object value : list) {
-
-      if (builder.pathHandler != null) {
-        value = builder.pathHandler.handlePath(path, value);
-      }
-      if (value == null && !builder.isKeepNull) {
-        continue;
-      }
-
-      if (hasEntry) {
-        b.append(",");
-        endLine(b, builder);
-        startLine(b, builder, itemlevel);
-      }
-      else {
-        hasEntry = true;
-      }
-
-
-      if (value != null && builder.typeHandler != null) {
-        value = builder.typeHandler.handleType(value);
-      }
-
-      addValue(value, b, builder, itemlevel, path);
-    }
-    endLine(b, builder);
-    startLine(b, builder, level);
-    b.append("]");
-
-  }
-
-  private static void addArray(Object array, StringBuilder b, TnJsonBuilder builder, int level, String path) {
-    int itemlevel = level + 1;
-
-    b.append("[");
-
-    endLine(b, builder);
-    startLine(b, builder, itemlevel);
-
-    boolean hasEntry = false;
-    int length = Array.getLength(array);
-    for (int i = 0; i < length; i ++) {
-      Object value = Array.get(array, i);
-      if (builder.pathHandler != null) {
-        value = builder.pathHandler.handlePath(path, value);
-      }
-      if (value == null && !builder.isKeepNull) {
-        continue;
-      }
-
-      if (hasEntry) {
-        b.append(",");
-        endLine(b, builder);
-        startLine(b, builder, itemlevel);
-      }
-      else {
-        hasEntry = true;
-      }
-
-      if (value != null && builder.typeHandler != null) {
-        value = builder.typeHandler.handleType(value);
-      }
-
-      addValue(value, b, builder, itemlevel, path);
-    }
-
-    endLine(b, builder);
-    startLine(b, builder, level);
-    b.append("]");
-
-  }
-
-  private static void addObj(Object obj, StringBuilder b, TnJsonBuilder builder, int level, String path) {
-
-    Class<?> cls = obj.getClass();
-
-    try {
-      Method toJsonMtd = cls.getDeclaredMethod("toJson");
-      toJsonMtd.setAccessible(true);
-      String string = (String) toJsonMtd.invoke(obj);
-      b.append(string);
-      return;
-    }
-    catch (NoSuchMethodException e) {
-      //no method, no problem
-    }
-    catch (InvocationTargetException | IllegalAccessException e) {
-      throw new SerializeException("Error on invoke method toJson by class: "+cls.getName()+", object: " + String.valueOf(obj)+".", e);
-    }
-    int valuelevel = level + 1;
-
-    b.append("{");
-    endLine(b, builder);
-
-    boolean hasEntry = false;
-    Field[] fields = cls.getDeclaredFields();
-    for (Field field : fields) {
-      int modifiers = field.getModifiers();
-      boolean allow = !field.isSynthetic() && !Modifier.isPrivate(modifiers) && !Modifier.isTransient(modifiers);
-      if (! allow) {
-        continue;
-      }
-
-      Object value = getObjValue(field, obj);
-
-      if (value == null && !builder.isKeepNull) {
-        continue;
-      }
-      if (value != null && builder.typeHandler != null) {
-        value = builder.typeHandler.handleType(value);
-      }
-
-      if (hasEntry) {
-        b.append(",");
-        endLine(b, builder);
-      }
-      else {
-        hasEntry = true;
-      }
-
-      startLine(b, builder, valuelevel);
-
-      b.append(field.getName());
-      b.append(":");
-
-      if (builder.isFormated) {
-        b.append(" ");
-      }
-
-      addValue(value, b, builder, level, path);
-    }
-    endLine(b, builder);
-    startLine(b, builder, level);
-    b.append("}");
-  }
-  private static Object getObjValue(Field field, Object fromObj) {
-    boolean accessible = field.isAccessible();
-    field.setAccessible(true);
-    try {
-      Object value = field.get(fromObj);
-      return value;
-    }
-    catch (Throwable t) {
-      throw new SerializeException("Error on extract value from object " + fromObj.getClass().getName() + " ("+String.valueOf(fromObj) + ") from field " + field.getName(), t);
-    }
-    finally {
-      field.setAccessible(accessible);
-    }
-  }
-
-
-
-  private static void endLine(StringBuilder b, TnJsonBuilder builder) {
-    if (builder.isFormated) {
-      b.append("\n");
-    }
-  }
-  private static void startLine(StringBuilder b, TnJsonBuilder builder, int level) {
-    if (!builder.isFormated) {
-      return;
-    }
-
-    for(int i=0; i<level; i++) {
-      b.append("  ");
-    }
-  }
-
-}

+ 0 - 55
library_base/src/main/java/cn/yyxx/commsdk/base/utils/sign/a2u/tn/utils/json/MapNavigator.java

@@ -1,55 +0,0 @@
-package com.yyrh.utils.a2u.tn.utils.json;
-
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Navigate by Map represented object.<br>
- * Every value in the Map must be
- * <ul>
- *   <li>either a simple value: string, number, boolean, or other;</li>
- *   <li>either by a Map such as Map&lt;String, Object&gt;;</li>
- *   <li>either an array of values such as Collection&lt;Object&gt;.</li>
- * </ul>
- */
-public class MapNavigator {
-
-  private MapNavigator() {
-    //hide this
-  }
-
-
-  /**
-   * Find value from map by path.
-   * @param map map with values
-   * @param path path with string-keys and dot as separator
-   * @return value
-   */
-  public static Object fromPath(Map map, String path) {
-
-    Object res = map;
-    List<String> pathList =  Arrays.asList(path.split("\\."));
-
-    StringBuilder node = new StringBuilder();
-
-    for (String pat : pathList) {
-      if (res == null) {
-        return null;
-      }
-      if (res instanceof Map) {
-        res = ((Map) res).get(pat);
-      }
-      else if (res instanceof List) {
-        int ix = Integer.parseInt(pat);
-        res = ((List) res).get(ix);
-      }
-      else {
-        throw new RuntimeException("Incorrect path: node=" + node.toString() + " is not a Map or List.");
-      }
-      node.append(".").append(pat);
-    }
-
-    return res;
-  }
-}

+ 0 - 31
library_base/src/main/java/cn/yyxx/commsdk/base/utils/sign/a2u/tn/utils/json/ParseException.java

@@ -1,31 +0,0 @@
-package com.yyrh.utils.a2u.tn.utils.json;
-
-/**
- * Exception on parse error
- */
-public class ParseException extends RuntimeException {
-
-  private int position;
-  private String path;
-
-  public ParseException(String s, int position, String path) {
-    super(s);
-    this.position = position;
-    this.path = path;
-  }
-
-  /**
-   * Position in json where occur error.
-   * @return position of invalid symbol
-   */
-  public int getPosition() {
-    return position;
-  }
-  /**
-   * Path in json where occur error.
-   * @return path where occur error
-   */
-  public String getPath() {
-    return path;
-  }
-}

+ 0 - 16
library_base/src/main/java/cn/yyxx/commsdk/base/utils/sign/a2u/tn/utils/json/SerializeException.java

@@ -1,16 +0,0 @@
-package com.yyrh.utils.a2u.tn.utils.json;
-
-/**
- * Exception on serialization error
- */
-public class SerializeException extends RuntimeException {
-
-  public SerializeException(String s) {
-    super(s);
-  }
-
-  public SerializeException(String s, Throwable cause) {
-    super(s, cause);
-  }
-
-}

+ 0 - 157
library_base/src/main/java/cn/yyxx/commsdk/base/utils/sign/a2u/tn/utils/json/TnJson.java

@@ -1,157 +0,0 @@
-package com.yyrh.utils.a2u.tn.utils.json;
-
-import java.util.Map;
-
-/**
- * Using face
- */
-public class TnJson {
-
-  private static final TnJsonBuilder SET_HARD         = TnJsonBuilder.init();
-  private static final TnJsonBuilder SET_LIGHT        = TnJsonBuilder.init().readable();
-  private static final TnJsonBuilder SET_FORMATTED    = TnJsonBuilder.init().readable().formated();
-  private static final TnJsonBuilder SET_JSON5        = TnJsonBuilder.init().readable().formated().withoutKeyQuote().allowMultiRowString();
-  private static final TnJsonBuilder SET_JSON5COMPACT = TnJsonBuilder.init().readable().withoutKeyQuote().singleQuote();
-
-  /**
-   * This name will get element in a returned map when json-string will be an array of values.
-   */
-  public static final String DEFAULT_LIST_KEY = JsonParser.DEFAULT_LIST_KEY;
-
-
-  /**
-   * JSON generation mode
-   * @see #toJson(Object, Mode)
-   */
-  public enum Mode {
-    /**
-     * Will be generated compact json-string, where any non-digital and non-letter character in string will be replaced with sequence uXXXX.<br>
-     * This mode is default, because it has max compatibility with other clients.
-     */
-    HARD,
-
-    /**
-     * Will be generated compact json-string, where non-digital and non-letter character in string will be stay in readable format, if it possible.<bR>
-     * This format is more compact, but is not all client can parse it.
-     */
-    LIGHT,
-
-    /**
-     * Will be generated json-string in pretty read format, where non-digital and non-letter character in string will be stay in readable format, if it possible.<bR>
-     *
-     */
-    FORMATTED,
-
-    /**
-     * Will be generated json-string in max human readable format json5.<br>
-     * See detail about json5 on https://json5.org/
-     */
-    JSON5,
-
-    /**
-     * JSON5 like, but without linefeed
-     */
-    JSON5COMPACT
-  }
-
-  public static TnJsonBuilder builder() {
-    return new TnJsonBuilder();
-  }
-
-
-  /**
-   * Convert Object to JSON.<br>
-   * Will be generated compact json-string, where any non-digital and non-letter character in string will be replaced with sequence uXXXX.
-   * @param data Object to convert it can be Map, Collection, array, or any other object
-   * @return JSON-string
-   */
-  public static String toJson(Object data) {
-    return SET_HARD.buildJson(data);
-  }
-
-  /**
-   * Convert Map to JSON with specify output string format
-   * @param data Object to convert. It can be Map, Collection, array, or any other object
-   * @param mode affects the format of resulting string
-   * @return JSON-string
-   * @see Mode
-   */
-  public static String toJson(Object data, Mode mode) {
-    switch (mode) {
-      case HARD:         return SET_HARD.buildJson(data);
-      case LIGHT:        return SET_LIGHT.buildJson(data);
-      case FORMATTED:    return SET_FORMATTED.buildJson(data);
-      case JSON5:        return SET_JSON5.buildJson(data);
-      case JSON5COMPACT: return SET_JSON5COMPACT.buildJson(data);
-      default:           return SET_HARD.buildJson(data);
-    }
-  }
-
-
-  /**
-   * Parsing JSON-string to Map.<br>
-   * Every value in the resulting Map will be:
-   * <ul>
-   *   <li>or a simple value (string or number or boolean),</li>
-   *   <li>or a LinkedHashMap with nested json-object,</li>
-   *   <li>or an ArrayList of values.</li>
-   * </ul>
-   *
-   * @param data incoming JSON-string.
-   * @return Map with data.<br>
-   * If JSON contain only array, such as [1,2] then will return Map
-   * with single element by key-name DEFAULT_ROOT, which contain list.
-   * @see #DEFAULT_LIST_KEY
-   *
-   */
-  public static Map<String, Object> parse(String data) {
-    try {
-      JsonParser p = new JsonParser();
-      return p.doParse(data);
-    }
-    catch (ParseException px) {
-      //Hide unnecessary log trace. If you want full trace - change it.
-      throw new ParseException(px.getMessage(), px.getPosition(), px.getPath());
-    }
-  }
-
-  /**
-   * Parsing JSON-string to Map with specifying returned collections.<br>
-   * For each element representing a non-simple value, will be called the corresponding method of listener,
-   * which allows you to set type of the returned object.
-   * @see IGetCollection
-   *
-   * @param data incoming JSON-string.
-   * @param listener callback listener.
-   * @return Map with data.<br>
-   * If JSON contain only array, such as [1,2] then will return Map
-   * with single element by key-name DEFAULT_LIST_KEY, which contain list.
-   * @see JsonParser#DEFAULT_LIST_KEY
-   */
-  public static Map<String, Object> parse(String data, IGetCollection listener) {
-    try {
-      JsonParser p = new JsonParser(listener);
-      return p.doParse(data);
-    }
-    catch (ParseException px) {
-      //Hide unnecessary log trace. If you want full trace - change it.
-      throw new ParseException(px.getMessage(), px.getPosition(), px.getPath());
-    }
-  }
-
-  TnJson() {
-    //hide constructor
-  }
-
-
-  /**
-   * Build JSON string. As default this method equivalent with static method toJson(), but this method using TnJsonBuilder
-   * @param data Object to convert. It can be Map, Collection, array, or any other object
-   * @return JSON-string
-   */
-  public String buildJson(Object data) {
-    return SET_HARD.buildJson(data);
-  }
-
-
-}

+ 0 - 146
library_base/src/main/java/cn/yyxx/commsdk/base/utils/sign/a2u/tn/utils/json/TnJsonBuilder.java

@@ -1,146 +0,0 @@
-package com.yyrh.utils.a2u.tn.utils.json;
-
-/**
- * json generation configurator
- */
-public class TnJsonBuilder extends TnJson {
-  boolean isKeyQuoted = true;
-  char quoteSymbol = '"';
-  boolean isFormated = false;
-  boolean isStayReadable = false;
-  boolean isAllowMultiRowString = false;
-  boolean isKeepNull = false;
-
-
-  /**
-   * Interfase for handing generating json in concrete path
-   */
-  public interface IPathHandler {
-    /**
-     * This methow will be called when json generator start serialize new value.<br>
-     * @param path path from root element witn dot as separator sample ".num", ".internal.cls"
-     * @param value value in this path
-     * @return the json-string or other value which be converted to json by standard rules
-     */
-    Object handlePath(String path, Object value);
-  }
-
-  IPathHandler pathHandler = null;
-
-
-  /**
-   * Interface for handing generating json by concrete type
-   */
-  public interface ITypeHandler {
-    /**
-     * This methow will be called when json generator start serialize new value.<br>
-     * @param value not null value for serialization
-     * @return the json-string or other value which be converted to json by standard rules
-     */
-    Object handleType(Object value);
-  }
-
-  ITypeHandler typeHandler = null;
-
-
-
-  TnJsonBuilder() {
-    //hide constructor
-  }
-
-
-
-  /**
-   * Create new builder
-   * @return new object with default settings
-   */
-  static TnJsonBuilder init() {
-    return new TnJsonBuilder();
-  }
-
-  /**
-   * Disable generating quotes in the key
-   * @return this builder
-   */
-  public TnJsonBuilder withoutKeyQuote() {
-    isKeyQuoted = false;
-    return this;
-  }
-
-  /**
-   * Use single quotes
-   * @return this builder
-   */
-  public TnJsonBuilder singleQuote() {
-    quoteSymbol = '\'';
-    return this;
-  }
-
-  /**
-   * Format the final json
-   * @return this builder
-   */
-  public TnJsonBuilder formated() {
-    isFormated = true;
-    return this;
-  }
-
-  /**
-   * Leave characters in a strings as readable as possible
-   * @return this builder
-   */
-  public TnJsonBuilder readable() {
-    isStayReadable = true;
-    return this;
-  }
-
-  /**
-   * Allow linefeed in a strings
-   * @return this builder
-   */
-  public TnJsonBuilder allowMultiRowString() {
-    isAllowMultiRowString = true;
-    return this;
-  }
-
-  /**
-   * Allow null values
-   * @return this builder
-   */
-  public TnJsonBuilder keepNull() {
-    isKeepNull = true;
-    return this;
-  }
-
-  /**
-   * Set handler for generating json in concrete path
-   * @param pathHandler handler @see IPathHandler
-   * @return this builder
-   */
-  public TnJsonBuilder handlePath(IPathHandler pathHandler) {
-    this.pathHandler = pathHandler;
-    return this;
-  }
-
-  /**
-   * Set handler for generating json by concrete type
-   * @param typeHandler handler @see ITypeHandler
-   * @return this builder
-   */
-  public TnJsonBuilder handleType(ITypeHandler typeHandler) {
-    this.typeHandler = typeHandler;
-    return this;
-  }
-
-
-  /**
-   * Building JSON by parameters in this builder
-   * @param data Object to convert. It can be Map, Collection, array, or any other object
-   * @return JSON-string
-   */
-  @Override
-  public String buildJson(Object data) {
-    return JsonSerializer.toJson(data, this);
-  }
-
-}

+ 1 - 0
library_channel/build.gradle

@@ -34,6 +34,7 @@ android {
 dependencies {
     compileOnly project(':library_base')
     compileOnly project(':library_channel_repository')
+    api files('../library_channel/libs/oaid_sdk_1.0.25.aar')
 }
 
 //apply from: 'buildJar.gradle'

BIN
library_channel/libs/oaid_sdk_1.0.25.aar


+ 12 - 0
library_channel/src/main/java/cn/yyxx/commsdk/impl/channel/msa/IMsaDeviceIdsCallback.java

@@ -0,0 +1,12 @@
+package cn.yyxx.commsdk.impl.channel.msa;
+
+import java.util.Map;
+
+/**
+ * @author #Suyghur.
+ * Created on 2021/04/23
+ */
+public interface IMsaDeviceIdsCallback {
+
+    void onIdsRead(int code, String msg, Map<String, String> ids);
+}

+ 66 - 0
library_channel/src/main/java/cn/yyxx/commsdk/impl/channel/msa/MsaDeviceIdsHandler.java

@@ -0,0 +1,66 @@
+package cn.yyxx.commsdk.impl.channel.msa;
+
+import android.content.Context;
+
+import com.bun.miitmdid.core.ErrorCode;
+import com.bun.miitmdid.core.MdidSdkHelper;
+import com.bun.miitmdid.interfaces.IIdentifierListener;
+import com.bun.miitmdid.interfaces.IdSupplier;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import cn.yyxx.support.hawkeye.LogUtils;
+import cn.yyxx.support.msa.IMsaDeviceIdsCallback;
+
+/**
+ * @author #Suyghur.
+ * Created on 2021/04/23
+ */
+public class MsaDeviceIdsHandler {
+
+    private static final String VERSION = "1.0.25";
+
+    public static String oaid = "";
+    public static String vaid = "";
+    public static String aaid = "";
+
+    public static void initMsaDeviceIds(Context context, final IMsaDeviceIdsCallback callback) {
+        LogUtils.i("attach msa sdk , version : " + VERSION);
+        int code = MdidSdkHelper.InitSdk(context, true, new IIdentifierListener() {
+            @Override
+            public void OnSupport(boolean isSupport, IdSupplier idSupplier) {
+                if (isSupport) {
+                    Map<String, String> ids = new HashMap<>();
+                    oaid = idSupplier.getOAID();
+                    vaid = idSupplier.getVAID();
+                    aaid = idSupplier.getAAID();
+                    ids.put("oaid", oaid);
+                    ids.put("vaid", vaid);
+                    ids.put("aaid", aaid);
+                    callback.onIdsRead(0, "获取MsaIds成功", ids);
+                } else {
+                    callback.onIdsRead(-1, "不支持的设备", null);
+                }
+            }
+        });
+
+        switch (code) {
+            case ErrorCode.INIT_ERROR_DEVICE_NOSUPPORT:
+                callback.onIdsRead(-1, "不支持的设备", null);
+                break;
+            case ErrorCode.INIT_ERROR_LOAD_CONFIGFILE:
+                callback.onIdsRead(-1, "加载配置文件出错", null);
+                break;
+            case ErrorCode.INIT_ERROR_MANUFACTURER_NOSUPPORT:
+                callback.onIdsRead(-1, "不支持的设备厂商", null);
+                break;
+            case ErrorCode.INIT_ERROR_RESULT_DELAY:
+                LogUtils.e("initMsaDeviceIds : 获取接口是异步的,结果会在回调中返回,回调执行的回调可能在工作线程");
+                break;
+            case ErrorCode.INIT_HELPER_CALL_ERROR:
+                callback.onIdsRead(-1, "反射调用出错", null);
+                break;
+        }
+    }
+}

+ 2 - 2
library_core/src/main/cpp/yyxxgame.cpp

@@ -68,7 +68,7 @@ jstring InvokeJob(JNIEnv *env,jobject clz,jstring data){
     }
     std::string timestamp = std::to_string(ts);
     std::string sort_signature = ToolKit::GetJsonSortSignature(root);
-    sort_signature.append("&time=").append(API_KEY);
+    sort_signature.append("&time=").append(timestamp).append(API_KEY);
     YYLog::D(env, "before md5: " + sort_signature);
     std::string sign = md5(sort_signature);
 
@@ -123,7 +123,7 @@ JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) {
     if (vm->GetEnv((void **) &env, JNI_VERSION_1_6) != JNI_OK) {
         return JNI_ERR;
     }
-    jclass clz = env->FindClass("cn/yyxx/commsdk/core/NTest");
+    jclass clz = env->FindClass("cn/yyxx/commsdk/core/SdkDrive");
     if (env->RegisterNatives(clz, gMethods, sizeof(gMethods) / sizeof(gMethods[0])) < 0) {
         return JNI_ERR;
     }

+ 1 - 1
library_core/src/main/java/cn/yyxx/commsdk/core/SdkBridge.java

@@ -39,7 +39,7 @@ public final class SdkBridge {
         impl.initAgreement(activity, callback);
     }
 
-    public void initialize(Activity activity, Boolean isLandscape, IInitialize callback) {
+    public void initialize(Activity activity, Boolean isLandscape, ICallback callback) {
         impl.initialize(activity, isLandscape, callback);
     }
 

+ 4 - 4
library_core/src/main/java/cn/yyxx/commsdk/core/NTest.java → library_core/src/main/java/cn/yyxx/commsdk/core/SdkDrive.java

@@ -2,17 +2,17 @@ package cn.yyxx.commsdk.core;
 
 import android.content.Context;
 
-public class NTest {
+public class SdkDrive {
 
     static {
         System.loadLibrary("yyxxgame");
     }
 
-    private NTest() {
+    private SdkDrive() {
 
     }
 
-    public static NTest getInstance() {
+    public static SdkDrive getInstance() {
         return NTestHolder.INSTANCE;
     }
 
@@ -31,6 +31,6 @@ public class NTest {
 //    public native String RsaEncrypt(String data);
 
     private static final class NTestHolder {
-        private static final NTest INSTANCE = new NTest();
+        private static final SdkDrive INSTANCE = new SdkDrive();
     }
 }

+ 320 - 0
library_core/src/main/java/cn/yyxx/commsdk/core/common/CommonOperationManager.java

@@ -0,0 +1,320 @@
+package cn.yyxx.commsdk.core.common;
+
+import android.annotation.SuppressLint;
+import android.app.Activity;
+import android.app.Application;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.SharedPreferences;
+import android.os.Build;
+import android.provider.Settings;
+import android.telephony.TelephonyManager;
+import android.text.TextUtils;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.List;
+import java.util.Map;
+
+import cn.yyxx.commsdk.base.entity.ResultInfo;
+import cn.yyxx.commsdk.base.internal.ICallback;
+import cn.yyxx.commsdk.base.internal.IRequestCallback;
+import cn.yyxx.commsdk.base.utils.Logger;
+import cn.yyxx.commsdk.core.SdkDrive;
+import cn.yyxx.commsdk.core.constants.Constants;
+import cn.yyxx.commsdk.core.network.SdkRequest;
+import cn.yyxx.commsdk.core.ui.dialog.PrivacyPolicyDialog;
+import cn.yyxx.commsdk.core.ui.dialog.SingleButtonDialog;
+import cn.yyxx.commsdk.core.utils.ManifestUtils;
+import cn.yyxx.commsdk.core.utils.ParamsUtils;
+import cn.yyxx.commsdk.core.utils.ResourceUtil;
+import cn.yyxx.commsdk.core.utils.SharedPreferencesUtils;
+import cn.yyxx.support.JsonUtils;
+import cn.yyxx.support.msa.IMsaDeviceIdsCallback;
+import cn.yyxx.support.msa.MsaDeviceIdsHandler;
+import cn.yyxx.support.permission.IPermissionCallback;
+import cn.yyxx.support.permission.Permission;
+import cn.yyxx.support.permission.PermissionKit;
+
+public class CommonOperationManager {
+    public static CommonOperationManager permissionManager = null;
+
+    private boolean hasIdsRead = false;
+
+
+    private CommonOperationManager(){}
+    public static CommonOperationManager getInstance(){
+        if (permissionManager == null){
+            permissionManager = new CommonOperationManager();
+        }
+        return permissionManager;
+    }
+    public void initAgreement(Activity activity, ICallback callback){
+
+        if (TextUtils.isEmpty(ParamsUtils.getGameCode(activity))){
+            new SingleButtonDialog.Builder(activity)
+                    .setPositiveButton(new DialogInterface.OnClickListener() {
+                        @Override
+                        public void onClick(DialogInterface dialog, int which) {
+
+                            System.exit(0);
+                        }
+                    })
+                    .Create(activity.getString(ResourceUtil.getStringId(activity,"yyxx_comm_params_error_tip")))
+                    .show();
+            return;
+        }
+
+
+        String isShowPolicy = SharedPreferencesUtils.getSharedPreferences(activity, Constants.SP_KEY,"isShowPolicy");
+
+        if (isShowPolicy.isEmpty()){
+            SdkRequest.getInstance().initAgreement(activity, new IRequestCallback() {
+                @Override
+                public void onResponse(ResultInfo resultInfo) {
+
+
+                    if (resultInfo.code == 400){
+                        new SingleButtonDialog.Builder(activity)
+                           .setPositiveButton(new DialogInterface.OnClickListener() {
+                            @Override
+                            public void onClick(DialogInterface dialog, int which) {
+
+                                System.exit(0);
+                            }
+                        })
+                           .Create(activity.getString(ResourceUtil.getStringId(activity,"yyxx_comm_network_error_tip")))
+                           .show();
+                        return;
+                    }
+                    String policy_url = "";
+
+                    try {
+                        if (JsonUtils.hasJsonKey(new JSONObject(resultInfo.data),"agreement_url")){
+
+                            JSONObject jsonObject = new JSONObject(resultInfo.data);
+                            policy_url = jsonObject.getString("agreement_url");
+
+                        }
+
+                    } catch (JSONException e) {
+                        e.printStackTrace();
+                    }
+                    if (policy_url.isEmpty()){
+                        requestPermission(activity,callback);
+                        return;
+                    }
+
+                    new PrivacyPolicyDialog(activity, policy_url, new PrivacyPolicyDialog.OnClosePageListener() {
+                        @Override
+                        public void onUserAgreePolicy() {
+                            SharedPreferencesUtils.setSharedPreferences( Constants.SP_KEY,"isShowPolicy","1",activity);
+                            requestPermission(activity,callback);
+                        }
+
+                        @Override
+                        public void onUserDisagreePolicy() {
+                            callback.onResult(Constants.CODE_FAIL,"User disagree policy");
+                        }
+                    }).show();
+                }
+            });
+
+        }else{
+            requestPermission(activity,callback);
+        }
+
+    }
+
+    public void initialize(Activity activity, Boolean isLandscape, ICallback callback){
+        SdkRequest.getInstance().initSdk(activity, new IRequestCallback() {
+            @Override
+            public void onResponse(ResultInfo resultInfo) {
+                    Logger.d(resultInfo.msg);
+            }
+        });
+    }
+
+
+    public void initMsaDeviceIds(Application application,Context context){
+        MsaDeviceIdsHandler.initMsaDeviceIds(application, new IMsaDeviceIdsCallback() {
+            @Override
+            public void onIdsRead(int code, String msg, Map<String, String> map) {
+                Logger.d("msa sdk attach , code : " + code + " , msg : " + msg);
+                hasIdsRead = true;
+            }
+        });
+    }
+    @SuppressLint("MissingPermission")
+    public String getIfa(Context context){
+        String ifa = "";
+        if (Build.VERSION.SDK_INT > Build.VERSION_CODES.P){
+
+                ifa = MsaDeviceIdsHandler.oaid;
+
+        }else{
+            if (PermissionKit.isGranted(context,Permission.READ_PHONE_STATE)){
+                @SuppressLint("ServiceCast") TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELECOM_SERVICE);
+                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+                    ifa = telephonyManager.getImei();
+                }else{
+                    ifa = telephonyManager.getDeviceId();
+                }
+            }
+        }
+
+        if (ifa.isEmpty()){
+            ifa = Settings.Secure.getString(context.getApplicationContext().getContentResolver(), Settings.Secure.ANDROID_ID);
+            if (ifa.isEmpty()){
+                ifa = userSimulateImei(context);
+            }
+        }
+
+        return ifa;
+    }
+
+
+    static String userSimulateImei(Context context){
+
+        String  simulateImei  = SharedPreferencesUtils.getSharedPreferences(context,Constants.SP_KEY, "simulateImei");
+
+        if (!simulateImei.isEmpty()){
+            return simulateImei;
+        }else {
+
+            // 用putString的方法保存数据
+            String encryptMD5to16 ="YYR" + simulateUniqueId().substring(8, 24);
+
+            SharedPreferencesUtils.setSharedPreferences(Constants.SP_KEY,"simulateImei",encryptMD5to16,context);
+
+
+            return encryptMD5to16;
+        }
+    }
+
+
+
+    //获得独一无二的Psuedo ID
+    public static String simulateUniqueId() {
+        String serial = null;
+
+        String m_szDevIDShort = "" +
+                Build.BOARD.length() % 10 + Build.BRAND.length() % 10 +
+
+                Build.CPU_ABI.length() % 10 + Build.DEVICE.length() % 10 +
+
+                Build.DISPLAY.length() % 10 + Build.HOST.length() % 10 +
+
+                Build.ID.length() % 10 + Build.MANUFACTURER.length() % 10 +
+
+                Build.MODEL.length() % 10 + Build.PRODUCT.length() % 10 +
+
+                Build.TAGS.length() % 10 + Build.TYPE.length() % 10 +
+
+                Build.USER.length() % 10; //13 位
+
+        String  time = m_szDevIDShort + (System.currentTimeMillis());
+        return  getMD5(time);
+    }
+
+    public static String getMD5(String content) {
+        String s = null;
+        char hexDigits[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
+                'a', 'b', 'c', 'd', 'e', 'f'};
+        try {
+            java.security.MessageDigest md = java.security.MessageDigest
+                    .getInstance("MD5");
+            md.update(content.getBytes());
+            byte tmp[] = md.digest();
+            char str[] = new char[16 * 2];
+            int k = 0;
+            for (int i = 0; i < 16; i++) {
+                byte byte0 = tmp[i];
+                str[k++] = hexDigits[byte0 >>> 4 & 0xf];
+                str[k++] = hexDigits[byte0 & 0xf];
+            }
+            s = new String(str);
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return s;
+    }
+
+
+    void requestPermission(Activity activity,ICallback callback){
+
+        if (!ManifestUtils.getMetaDataValue(activity,"yyxx.SkipPermission").isEmpty()){
+            callback.onResult(Constants.CODE_SUCCESS,"User agree policy");
+        }else if (!SharedPreferencesUtils.getSharedPreferences(activity,Constants.SP_KEY,"yyxxStopRequestPermission").isEmpty()){
+            callback.onResult(Constants.CODE_SUCCESS,"User agree policy");
+        }else{
+            goRequestPermission(activity, new PermissonCallBack() {
+                @Override
+                public void onResult(Result code) {
+                    if (code == Result.FINISH){
+                        SdkDrive.getInstance().initDrive(activity);
+                        callback.onResult(Constants.CODE_SUCCESS,"User agree policy");
+                    }
+                }
+            });
+        }
+
+    }
+
+
+    void goRequestPermission(Activity activity,PermissonCallBack permissonCallBack) {
+
+        PermissionKit.enablePermissionDialog = false;
+        PermissionKit.with()
+                .permission(Permission.READ_PHONE_STATE)
+                .permission(Permission.Group.STORAGE)
+                .request(activity, new IPermissionCallback() {
+                    @Override
+                    public void onGranted(List<String> list, boolean all) {
+                        permissonCallBack.onResult(Result.GRANT);
+                    }
+
+                    @Override
+                    public void onDenied(List<String> list, boolean never) {
+                        permissonCallBack.onResult(Result.DENIED);
+                    }
+
+                    @Override
+                    public void onProxyFinish() {
+
+                        permissonCallBack.onResult(Result.FINISH);
+
+
+                    }
+                });
+    }
+
+
+
+    public interface PermissonCallBack{
+        void onResult(Result code);
+    }
+
+
+    public enum Result{
+        /**
+         * 授权
+         */
+        GRANT,
+        /**
+         * 拒绝
+         */
+        DENIED,
+        /**
+         * 跳过
+         */
+        SKIP,
+        /**
+         * 首次拒绝,第二次不再申请
+         */
+        STOP,
+        FINISH
+    }
+}

+ 21 - 13
library_core/src/main/java/cn/yyxx/commsdk/core/impl/SdkBridgeImpl.java

@@ -5,29 +5,24 @@ import android.app.Application;
 import android.content.Context;
 import android.content.Intent;
 
-import org.json.JSONException;
-import org.json.JSONObject;
-
 import java.util.List;
 
-import cn.yyxx.commsdk.base.entity.ResultInfo;
 import cn.yyxx.commsdk.base.entity.SdkChargeInfo;
 import cn.yyxx.commsdk.base.entity.SdkRoleInfo;
 import cn.yyxx.commsdk.base.internal.ICallback;
 import cn.yyxx.commsdk.base.internal.IInitialize;
-import cn.yyxx.commsdk.base.internal.IRequestCallback;
-import cn.yyxx.commsdk.base.internal.feature.IFeature;
-import cn.yyxx.commsdk.core.constants.Constants;
+import cn.yyxx.commsdk.base.utils.Logger;
+import cn.yyxx.commsdk.core.SdkDrive;
+import cn.yyxx.commsdk.core.common.CommonOperationManager;
 import cn.yyxx.commsdk.core.network.SdkRequest;
-import cn.yyxx.commsdk.core.permission.PermissionManager;
-import cn.yyxx.commsdk.core.ui.dialog.PrivacyPolicyDialog;
-import cn.yyxx.commsdk.core.utils.SharedPreferencesUtils;
-import cn.yyxx.support.JsonUtils;
+import cn.yyxx.commsdk.core.utils.MMKVUtils;
 
 /**
  * @author #Suyghur.
  * Created on 2021/12/25
  */
+
+
 public final class SdkBridgeImpl {
 
     public SdkBridgeImpl(Context context) {
@@ -35,14 +30,27 @@ public final class SdkBridgeImpl {
     }
 
     public void attachBaseContext(Application application, Context context) {
+        Logger.i("application   attachBaseContext ...");
+        // 初始化Zap日志框架
+        Logger.initZap(application);
+
+
+
     }
 
     public void initApplication(Application application) {
+        Logger.i("initApplication ...");
+        MMKVUtils.getInstance().init(application);
     }
+
     public void initAgreement(Activity activity,ICallback callback) {
-        PermissionManager.getInstance().initAgreement(activity,callback);
+
+        CommonOperationManager.getInstance().initAgreement(activity,callback);
     }
-    public void initialize(Activity activity, Boolean isLandscape, IInitialize callback) {
+    public void initialize(Activity activity, Boolean isLandscape, ICallback callback) {
+
+        CommonOperationManager.getInstance().initialize(activity,isLandscape,callback);
+
     }
 
     public void onFloatCenterLogout(Activity activity, ICallback callback) {

+ 1 - 1
library_core/src/main/java/cn/yyxx/commsdk/core/network/Hosts.java

@@ -11,7 +11,7 @@ public class Hosts {
 
     public static final String  BASIC_URL_INIT_AGREEMENT = "agreement_init";
 
-    public static final String  BASIC_URL_INIT = "activate";
+    public static final String  BASIC_URL_INIT_SDK = "activate";
 
     public static final String  BASIC_URL_FAST_REGISTER = HOST +  "/fast_register";
     public static final String  BASIC_URL_USER_LOGIN = HOST + "/user_login";

+ 22 - 2
library_core/src/main/java/cn/yyxx/commsdk/core/network/SdkRequest.java

@@ -7,9 +7,11 @@ import android.content.Context;
 import org.json.JSONException;
 import org.json.JSONObject;
 
+import cn.yyxx.commsdk.base.internal.ICallback;
 import cn.yyxx.commsdk.base.internal.IRequestCallback;
 
-import cn.yyxx.commsdk.core.NTest;
+import cn.yyxx.commsdk.core.SdkDrive;
+import cn.yyxx.commsdk.core.common.CommonOperationManager;
 import cn.yyxx.commsdk.core.utils.ManifestUtils;
 import cn.yyxx.support.PropertiesUtils;
 
@@ -39,7 +41,25 @@ public class SdkRequest {
             e.printStackTrace();
         }
 
-        String paramText = NTest.getInstance().invokeJobWithoutParams(json.toString());
+        String paramText = SdkDrive.getInstance().invokeJobWithoutParams(json.toString());
+        VolleyRequest.post(context,HOST,paramText,callback);
+    }
+    public void  initSdk(Context context, IRequestCallback callback){
+
+        String ifa = CommonOperationManager.getInstance().getIfa(context);
+        String ifa_type = "1";
+
+
+        JSONObject json = new JSONObject();
+        try {
+            json.put("ifa",ifa);
+            json.put("ifa_type",ifa_type);
+            json.put("route_path",Hosts.BASIC_URL_INIT_SDK);
+        } catch (JSONException e) {
+            e.printStackTrace();
+        }
+
+        String paramText = SdkDrive.getInstance().invokeJob(json.toString());
         VolleyRequest.post(context,HOST,paramText,callback);
     }
 }

+ 2 - 13
library_core/src/main/java/cn/yyxx/commsdk/core/network/VolleyRequest.java

@@ -1,36 +1,25 @@
 package cn.yyxx.commsdk.core.network;
 
 import android.content.Context;
-import android.text.TextUtils;
-import android.util.Log;
 
 import org.json.JSONException;
 import org.json.JSONObject;
 
-import java.io.IOException;
 import java.io.UnsupportedEncodingException;
-import java.nio.charset.StandardCharsets;
 import java.util.HashMap;
 import java.util.Map;
 
 import cn.yyxx.commsdk.base.entity.ResultInfo;
 import cn.yyxx.commsdk.base.internal.IRequestCallback;
 import cn.yyxx.commsdk.base.utils.Logger;
-import cn.yyxx.commsdk.base.utils.sign.AESUtils;
-import cn.yyxx.commsdk.core.NTest;
-import cn.yyxx.support.FileUtils;
+import cn.yyxx.commsdk.core.SdkDrive;
 import cn.yyxx.support.JsonUtils;
 import cn.yyxx.support.volley.VolleySingleton;
 import cn.yyxx.support.volley.source.AuthFailureError;
 import cn.yyxx.support.volley.source.DefaultRetryPolicy;
-import cn.yyxx.support.volley.source.NetworkResponse;
-import cn.yyxx.support.volley.source.ParseError;
 import cn.yyxx.support.volley.source.Request;
 import cn.yyxx.support.volley.source.Response;
 import cn.yyxx.support.volley.source.VolleyError;
-import cn.yyxx.support.volley.source.toolbox.HttpHeaderParser;
-import cn.yyxx.support.volley.source.toolbox.JsonObjectRequest;
-import cn.yyxx.support.volley.source.toolbox.JsonRequest;
 import cn.yyxx.support.volley.source.toolbox.StringRequest;
 
 /**
@@ -58,7 +47,7 @@ public class VolleyRequest {
                 public void onResponse(String s) {
 
 
-                    String deData =  NTest.getInstance().parseJob(s);
+                    String deData =  SdkDrive.getInstance().parseJob(s);
 
                     ResultInfo resultInfo = new ResultInfo();
                     JSONObject json = null;

+ 0 - 150
library_core/src/main/java/cn/yyxx/commsdk/core/permission/PermissionManager.java

@@ -1,150 +0,0 @@
-package cn.yyxx.commsdk.core.permission;
-
-import android.app.Activity;
-
-import org.json.JSONException;
-import org.json.JSONObject;
-
-import java.util.List;
-
-import cn.yyxx.commsdk.base.entity.ResultInfo;
-import cn.yyxx.commsdk.base.internal.ICallback;
-import cn.yyxx.commsdk.base.internal.IRequestCallback;
-import cn.yyxx.commsdk.base.utils.Logger;
-import cn.yyxx.commsdk.core.constants.Constants;
-import cn.yyxx.commsdk.core.network.SdkRequest;
-import cn.yyxx.commsdk.core.ui.dialog.PrivacyPolicyDialog;
-import cn.yyxx.commsdk.core.utils.ManifestUtils;
-import cn.yyxx.commsdk.core.utils.SharedPreferencesUtils;
-import cn.yyxx.support.JsonUtils;
-import cn.yyxx.support.permission.IPermissionCallback;
-import cn.yyxx.support.permission.Permission;
-import cn.yyxx.support.permission.PermissionKit;
-
-public class PermissionManager {
-    public static PermissionManager permissionManager = null;
-    private PermissionManager(){}
-    public static PermissionManager getInstance(){
-        if (permissionManager == null){
-            permissionManager = new PermissionManager();
-        }
-        return permissionManager;
-    }
-    public void initAgreement(Activity activity, ICallback callback){
-
-
-        String isShowPolicy = SharedPreferencesUtils.getSharedPreferences(activity, Constants.SP_KEY,"isShowPolicy");
-
-        if (isShowPolicy.isEmpty()){
-            SdkRequest.getInstance().initAgreement(activity, new IRequestCallback() {
-                @Override
-                public void onResponse(ResultInfo resultInfo) {
-                    String policy_url = "";
-
-                    try {
-                        if (JsonUtils.hasJsonKey(new JSONObject(resultInfo.data),"agreement_url")){
-
-                            JSONObject jsonObject = new JSONObject(resultInfo.data);
-                            policy_url = jsonObject.getString("agreement_url");
-
-                        }
-
-                    } catch (JSONException e) {
-                        e.printStackTrace();
-                    }
-                    if (policy_url.isEmpty()){
-                        callback.onResult(Constants.CODE_SUCCESS,"Dont's show Policy");
-                        return;
-                    }
-
-                    new PrivacyPolicyDialog(activity, policy_url, new PrivacyPolicyDialog.OnClosePageListener() {
-                        @Override
-                        public void onUserAgreePolicy() {
-                            SharedPreferencesUtils.setSharedPreferences( Constants.SP_KEY,"isShowPolicy","1",activity);
-                            requestPermission(activity,callback);
-                        }
-
-                        @Override
-                        public void onUserDisagreePolicy() {
-                            callback.onResult(Constants.CODE_FAIL,"User disagree policy");
-                        }
-                    }).show();
-                }
-            });
-
-        }else{
-            requestPermission(activity,callback);
-        }
-
-
-
-    }
-    void requestPermission(Activity activity,ICallback callback){
-
-        if (!ManifestUtils.getMetaDataValue(activity,"yyxx.SkipPermission").isEmpty()){
-            callback.onResult(Constants.CODE_SUCCESS,"User agree policy");
-        }else if (!SharedPreferencesUtils.getSharedPreferences(activity,Constants.SP_KEY,"yyxxStopRequestPermission").isEmpty()){
-            callback.onResult(Constants.CODE_SUCCESS,"User agree policy");
-        }else{
-            goRequestPermission(activity, new PermissonCallBack() {
-                @Override
-                public void onResult(Result code) {
-                    if (code == Result.FINISH){
-                        callback.onResult(Constants.CODE_SUCCESS,"User agree policy");
-                    }
-                }
-            });
-        }
-
-    }
-
-
-    void goRequestPermission(Activity activity,PermissonCallBack permissonCallBack) {
-        PermissionKit.enablePermissionDialog = false;
-        PermissionKit.with()
-                .permission(Permission.READ_PHONE_STATE)
-                .permission(Permission.Group.STORAGE)
-                .request(activity, new IPermissionCallback() {
-                    @Override
-                    public void onGranted(List<String> list, boolean all) {
-                        permissonCallBack.onResult(Result.GRANT);
-                    }
-
-                    @Override
-                    public void onDenied(List<String> list, boolean never) {
-                        permissonCallBack.onResult(Result.DENIED);
-                    }
-
-                    @Override
-                    public void onProxyFinish() {
-
-                        permissonCallBack.onResult(Result.FINISH);
-
-                    }
-                });
-    }
-
-    public interface PermissonCallBack{
-        void onResult(Result code);
-    }
-
-    public enum Result{
-        /**
-         * 授权
-         */
-        GRANT,
-        /**
-         * 拒绝
-         */
-        DENIED,
-        /**
-         * 跳过
-         */
-        SKIP,
-        /**
-         * 首次拒绝,第二次不再申请
-         */
-        STOP,
-        FINISH
-    }
-}

+ 72 - 0
library_core/src/main/java/cn/yyxx/commsdk/core/ui/dialog/SingleButtonDialog.java

@@ -0,0 +1,72 @@
+package cn.yyxx.commsdk.core.ui.dialog;
+
+import android.app.Dialog;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.TextView;
+
+
+import cn.yyxx.commsdk.core.utils.ResourceUtil;
+
+
+public class SingleButtonDialog extends Dialog {
+
+	private	static TextView bt_exit_game,content;
+
+
+	private static SingleButtonDialog dialog;
+
+	public SingleButtonDialog(Context context, int theme) {
+		super(context, theme);
+
+	}
+	public  static class  Builder{
+		private Context context;
+		private OnClickListener positiveButtonClickListener;
+
+		public Builder(Context context){ this.context = context;}
+		public Builder setPositiveButton(OnClickListener listener){
+			this.positiveButtonClickListener = listener;
+			return this;
+		}
+
+		public void  dialogDismiss(){dialog.dismiss();}
+		public SingleButtonDialog Create(String msg){
+			{
+				LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+				dialog = new SingleButtonDialog(context, ResourceUtil.getStyleId(context,"yyxx_base_dialog"));
+				View layout;
+
+				layout =  inflater.inflate(ResourceUtil.getLayoutId(context, "yyxx_comm_ios_style_dialog"),null);
+
+
+
+				dialog.addContentView(layout,new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
+
+				bt_exit_game = dialog.findViewById(ResourceUtil.getId(context,
+						"confirm"));
+				content = dialog.findViewById(ResourceUtil.getId(context,
+						"content"));
+				content.setText(msg);
+
+				if (bt_exit_game!=null){
+					bt_exit_game.setOnClickListener(new View.OnClickListener() {
+						@Override
+						public void onClick(View view) {
+							positiveButtonClickListener.onClick(dialog,DialogInterface.BUTTON_POSITIVE);
+						}
+					});
+				}
+
+				}
+				return dialog;
+			}
+		}
+
+
+
+
+}

+ 68 - 0
library_core/src/main/java/cn/yyxx/commsdk/core/utils/MMKVUtils.java

@@ -0,0 +1,68 @@
+package cn.yyxx.commsdk.core.utils;
+
+import android.content.Context;
+
+import com.tencent.mmkv.MMKV;
+import com.tencent.mmkv.MMKVHandler;
+import com.tencent.mmkv.MMKVLogLevel;
+import com.tencent.mmkv.MMKVRecoverStrategic;
+
+import java.util.Locale;
+
+import cn.yyxx.commsdk.base.utils.Logger;
+
+
+/**
+ * @author #Suyghur.
+ * Created on 2021/10/15
+ */
+public class MMKVUtils implements MMKVHandler {
+
+    public MMKV userKV = null;
+    public MMKV orderKV = null;
+
+    private MMKVUtils() {
+
+    }
+
+    public static MMKVUtils getInstance() {
+        return MMKVUtilsHolder.INSTANCE;
+    }
+
+    public void init(Context context) {
+        String dir = String.format(Locale.getDefault(), "%s/sdk_info", context.getExternalFilesDir("").getAbsolutePath());
+        MMKV.initialize(context, dir, MMKVLogLevel.LevelInfo);
+        MMKV.registerHandler(this);
+        this.userKV = MMKV.mmkvWithID("user_info");
+        this.orderKV = MMKV.mmkvWithID("order_info");
+    }
+
+    public void release() {
+        MMKV.unregisterHandler();
+    }
+
+    @Override
+    public MMKVRecoverStrategic onMMKVCRCCheckFail(String mmapID) {
+        return MMKVRecoverStrategic.OnErrorDiscard;
+    }
+
+    @Override
+    public MMKVRecoverStrategic onMMKVFileLengthError(String mmapID) {
+        return MMKVRecoverStrategic.OnErrorDiscard;
+    }
+
+    @Override
+    public boolean wantLogRedirecting() {
+        return true;
+    }
+
+    @Override
+    public void mmkvLog(MMKVLogLevel level, String file, int line, String function, String message) {
+        String log = String.format(Locale.getDefault(), "<%s:%s::%s>%s", file, line, function, message);
+        Logger.d(log);
+    }
+
+    private static final class MMKVUtilsHolder {
+        private static final MMKVUtils INSTANCE = new MMKVUtils();
+    }
+}

+ 14 - 0
library_core/src/main/java/cn/yyxx/commsdk/core/utils/ParamsUtils.java

@@ -0,0 +1,14 @@
+package cn.yyxx.commsdk.core.utils;
+
+import android.content.Context;
+
+import cn.yyxx.support.PropertiesUtils;
+
+public class ParamsUtils {
+    private static String  CONFIG_FILE  =  "yyxx_cfg.properties";
+    private static String  YYXX_GAME_CODE  =  "YYXX_GAME_CODE";
+    private static String ASSETS_PATH = "yyxx_game";
+    public static String getGameCode(Context context){
+         return PropertiesUtils.getValue4Properties(context,CONFIG_FILE,ASSETS_PATH,YYXX_GAME_CODE);
+    }
+}

+ 8 - 0
library_core/src/main/res/drawable/yyxx_dialog_ios_bg.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
+    <solid android:color="@color/yyxx_comm_white"/>
+    <corners android:radius="10dp"/>
+    <stroke
+        android:width="0.1dp"
+        android:color="@color/yyxx_comm_dialog_line"/>
+</shape>

+ 46 - 0
library_core/src/main/res/layout/yyxx_comm_ios_style_dialog.xml

@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:orientation="vertical"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:background="@drawable/yyxx_dialog_ios_bg">
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_margin="20dp"
+        android:gravity="center_horizontal"
+        android:orientation="vertical">
+        <TextView
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:textColor="@color/yyxx_comm_black"
+            android:textSize="16sp"
+            android:text="@string/yyxx_comm_title_tip"/>
+
+        <TextView
+            android:id="@+id/content"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="10dp"
+            android:textColor="@color/yyxx_comm_black"
+            android:textSize="12sp"
+            android:gravity="center"
+            android:text="@string/yyxx_comm_network_error_tip"
+            />
+    </LinearLayout>
+
+    <View
+        android:layout_width="match_parent"
+        android:layout_height="1px"
+        android:background="@color/yyxx_comm_dialog_line"/>
+
+    <TextView
+        android:id="@+id/confirm"
+        android:layout_width="match_parent"
+        android:layout_height="40dp"
+        android:gravity="center"
+        android:layout_gravity="center_horizontal"
+        android:textColor="@color/yyxx_comm_blues"
+        android:textSize="16sp"
+        android:text="@string/yyxx_comm_confirm"/>
+    </LinearLayout>

+ 3 - 1
library_core/src/main/res/values/yyxx_comm_colors.xml

@@ -6,5 +6,7 @@
     <color name="yyxx_comm_white_70">#B3FFFFFF</color>
     <color name="yyxx_comm_text_deep_green">#87DB3E</color>
     <color name="yyxx_comm_text_light_blue">#198AC3</color>
-
+    <color name="yyxx_comm_black">#000000</color>
+    <color name="yyxx_comm_blues">#2abfff</color>
+    <color name="yyxx_comm_dialog_line">#999999</color>
 </resources>

+ 4 - 1
library_core/src/main/res/values/yyxx_comm_strings.xml

@@ -3,5 +3,8 @@
 
     <string name="yyxx_comm_disagreement">不同意</string>
     <string name="yyxx_comm_agreement">同意</string>
-
+    <string name="yyxx_comm_title_tip">温馨提示</string>
+    <string name="yyxx_comm_confirm">确定</string>
+    <string name="yyxx_comm_network_error_tip">网络出错,请检查网络</string>
+    <string name="yyxx_comm_params_error_tip">参数异常,请检查yyxx_cfg.properties中的YYXX_GAME_CODE值</string>
 </resources>

+ 30 - 0
library_core/src/main/res/values/yyxx_comm_styles.xml

@@ -0,0 +1,30 @@
+<resources>
+
+
+
+
+
+
+
+
+
+
+    <style name="yyxx_base_dialog" parent="@android:style/Theme.Dialog">
+    <item name="android:windowFrame">@null</item>
+    <!-- 边框 -->
+    <item name="android:windowIsFloating">true</item>
+    <!-- 是否浮现在activity之上 -->
+    <item name="android:windowIsTranslucent">false</item>
+    <!-- 半透明 -->
+    <item name="android:windowNoTitle">true</item>
+    <!-- 无标题 -->
+    <item name="android:windowBackground">@color/yyxx_comm_transparent</item>
+    <!-- 背景透明 -->
+    <item name="android:backgroundDimEnabled">false</item>
+    <item name="android:windowCloseOnTouchOutside">false</item>
+    <item name="android:windowFullscreen">true</item>
+
+    <!-- 模糊 -->
+    </style>
+
+</resources>

BIN
libs/oaid_sdk_1.0.25.jar