Merge branch 'dev_proguard' into 6.5.3
@ -55,8 +55,8 @@ public class FURenderer extends IFURenderer {
|
|||||||
private FURenderKit mFURenderKit;
|
private FURenderKit mFURenderKit;
|
||||||
|
|
||||||
/* AI道具*/
|
/* AI道具*/
|
||||||
private String BUNDLE_AI_FACE = "model" + File.separator + "ai_face_processor_lite.bundle";
|
public static String BUNDLE_AI_FACE = "model" + File.separator + "ai_face_processor_lite.bundle";
|
||||||
private String BUNDLE_AI_HUMAN = "model" + File.separator + "ai_human_processor.bundle";
|
public static String BUNDLE_AI_HUMAN = "model" + File.separator + "ai_human_processor.bundle";
|
||||||
|
|
||||||
/* GL 线程 ID */
|
/* GL 线程 ID */
|
||||||
private Long mGlThreadId = 0L;
|
private Long mGlThreadId = 0L;
|
||||||
|
@ -314,6 +314,35 @@ public class FileUtils {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String copyAssetsFile(Context context, String assetsPath, String fileName, String saveFileDir) {
|
||||||
|
File fileDir = new File(saveFileDir);
|
||||||
|
if (!fileDir.exists()) {
|
||||||
|
fileDir.mkdirs();
|
||||||
|
}
|
||||||
|
File file = new File(fileDir, fileName);
|
||||||
|
if (file.exists()) {
|
||||||
|
return file.getAbsolutePath();
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
InputStream inputStream = context.getAssets().open(assetsPath);
|
||||||
|
FileOutputStream fos = new FileOutputStream(file);
|
||||||
|
BufferedInputStream bis = new BufferedInputStream(inputStream);
|
||||||
|
BufferedOutputStream bos = new BufferedOutputStream(fos);
|
||||||
|
byte[] byteArray = new byte[1024];
|
||||||
|
int bytes = bis.read(byteArray);
|
||||||
|
while (bytes > 0) {
|
||||||
|
bos.write(byteArray, 0, bytes);
|
||||||
|
bos.flush();
|
||||||
|
bytes = bis.read(byteArray);
|
||||||
|
}
|
||||||
|
bos.close();
|
||||||
|
fos.close();
|
||||||
|
return file.getAbsolutePath();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取Uri文件绝对路径
|
* 获取Uri文件绝对路径
|
||||||
@ -522,6 +551,7 @@ public class FileUtils {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 遍历一个文件夹获取改文件夹下所有文件名
|
* 遍历一个文件夹获取改文件夹下所有文件名
|
||||||
|
*
|
||||||
* @param path
|
* @param path
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -563,7 +593,7 @@ public class FileUtils {
|
|||||||
* @param path String
|
* @param path String
|
||||||
* @return Boolean
|
* @return Boolean
|
||||||
*/
|
*/
|
||||||
public static Boolean checkIsVideo(Context context,String path) {
|
public static Boolean checkIsVideo(Context context, String path) {
|
||||||
MediaMetadataRetriever retriever = new MediaMetadataRetriever();
|
MediaMetadataRetriever retriever = new MediaMetadataRetriever();
|
||||||
try {
|
try {
|
||||||
retriever.setDataSource(context, Uri.fromFile(new File(path)));
|
retriever.setDataSource(context, Uri.fromFile(new File(path)));
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
package com.yunbao.faceunity;
|
package com.yunbao.faceunity;
|
||||||
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Example local unit test, which will execute on the development machine (host).
|
* Example local unit test, which will execute on the development machine (host).
|
||||||
@ -10,8 +7,5 @@ import static org.junit.Assert.*;
|
|||||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||||
*/
|
*/
|
||||||
public class ExampleUnitTest {
|
public class ExampleUnitTest {
|
||||||
@Test
|
|
||||||
public void addition_isCorrect() {
|
|
||||||
assertEquals(4, 2 + 2);
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -6,6 +6,9 @@ apply plugin: 'com.alibaba.arouter'
|
|||||||
android {
|
android {
|
||||||
dexOptions {
|
dexOptions {
|
||||||
jumboMode = true
|
jumboMode = true
|
||||||
|
}
|
||||||
|
project.tasks.getByName("tasks").doFirst {
|
||||||
|
|
||||||
}
|
}
|
||||||
/* applicationVariants.all { variant ->
|
/* applicationVariants.all { variant ->
|
||||||
variant.mergeAssetsProvider.configure {
|
variant.mergeAssetsProvider.configure {
|
||||||
@ -92,6 +95,13 @@ android {
|
|||||||
exclude 'lib/armeabi-v7a/libmmlic.so'
|
exclude 'lib/armeabi-v7a/libmmlic.so'
|
||||||
exclude 'lib/armeabi-v7a/libMNN_CL.so'
|
exclude 'lib/armeabi-v7a/libMNN_CL.so'
|
||||||
exclude 'lib/armeabi-v7a/libMNN_Express.so'
|
exclude 'lib/armeabi-v7a/libMNN_Express.so'
|
||||||
|
//美颜
|
||||||
|
if (rootProject.ext.manifestPlaceholders.isPluginModel) {
|
||||||
|
exclude 'lib/armeabi-v7a/libCNamaSDK.so'
|
||||||
|
exclude 'lib/arm64-v8a/libCNamaSDK.so'
|
||||||
|
exclude 'lib/armeabi-v7a/libfuai.so'
|
||||||
|
exclude 'lib/arm64-v8a/libfuai.so'
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
compileOptions {
|
compileOptions {
|
||||||
@ -99,6 +109,11 @@ android {
|
|||||||
targetCompatibility JavaVersion.VERSION_1_8
|
targetCompatibility JavaVersion.VERSION_1_8
|
||||||
}
|
}
|
||||||
applicationVariants.all { variant ->
|
applicationVariants.all { variant ->
|
||||||
|
println "清空build文件夹";
|
||||||
|
for (final def project in rootProject.getAllprojects()) {
|
||||||
|
delete project.buildDir
|
||||||
|
println project.buildDir
|
||||||
|
}
|
||||||
String variantName = variant.name.capitalize()
|
String variantName = variant.name.capitalize()
|
||||||
def processManifestTask = project.tasks.getByName("process${variantName}Manifest")
|
def processManifestTask = project.tasks.getByName("process${variantName}Manifest")
|
||||||
processManifestTask.doLast { pm ->
|
processManifestTask.doLast { pm ->
|
||||||
@ -139,9 +154,36 @@ android {
|
|||||||
'Asset/*',
|
'Asset/*',
|
||||||
'image_effect_shaders/*',
|
'image_effect_shaders/*',
|
||||||
'internal/*'
|
'internal/*'
|
||||||
|
//美颜基础组件
|
||||||
|
|
||||||
]))
|
]))
|
||||||
|
println "isPluginModel = " + rootProject.ext.manifestPlaceholders.isPluginModel
|
||||||
|
if (rootProject.ext.manifestPlaceholders.isPluginModel) {
|
||||||
|
delete(fileTree(dir: outputDir, includes: [
|
||||||
|
'model/ai_face_processor_lite.bundle',
|
||||||
|
'graphics/face_beautification.bundle'
|
||||||
|
]))
|
||||||
|
} else {
|
||||||
|
println "不删除bundle"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
variant.outputs.all {
|
||||||
|
def isGoogle = "link"
|
||||||
|
if (rootProject.ext.manifestPlaceholders.isGooglePlay) {
|
||||||
|
isGoogle = "Google"
|
||||||
|
}
|
||||||
|
def isPlugin = "all"
|
||||||
|
if (rootProject.ext.manifestPlaceholders.isPluginModel) {
|
||||||
|
isPlugin = "plugin"
|
||||||
|
}
|
||||||
|
def isTest = "测试服"
|
||||||
|
if (rootProject.ext.manifestPlaceholders.serverHost == "https://napi.yaoulive.com") {
|
||||||
|
isTest = "正式服"
|
||||||
|
}
|
||||||
|
outputFileName = "[${new Date().format("yyyy-MM-dd HHmmss", TimeZone.getTimeZone("GMT+8"))}]PDLive-${defaultConfig.versionName}-${isGoogle}-${isPlugin}-${variant.buildType.name}-${isTest}.apk"
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
signingConfigs {
|
signingConfigs {
|
||||||
release {
|
release {
|
||||||
@ -193,12 +235,17 @@ android {
|
|||||||
}
|
}
|
||||||
buildTypes {
|
buildTypes {
|
||||||
release {
|
release {
|
||||||
minifyEnabled false
|
minifyEnabled true
|
||||||
|
shrinkResources true
|
||||||
|
zipAlignEnabled true
|
||||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||||
signingConfig signingConfigs.release
|
signingConfig signingConfigs.release
|
||||||
}
|
}
|
||||||
debug {
|
debug {
|
||||||
minifyEnabled false
|
minifyEnabled false
|
||||||
|
shrinkResources false
|
||||||
|
zipAlignEnabled false
|
||||||
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||||
signingConfig signingConfigs.release
|
signingConfig signingConfigs.release
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
160
app/proguard-rules.pro
vendored
@ -12,17 +12,40 @@
|
|||||||
# If your project uses WebView with JS, uncomment the following
|
# If your project uses WebView with JS, uncomment the following
|
||||||
# and specify the fully qualified class name to the JavaScript interface
|
# and specify the fully qualified class name to the JavaScript interface
|
||||||
# class:
|
# class:
|
||||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||||
# public *;
|
public *;
|
||||||
#}
|
}
|
||||||
|
|
||||||
# Uncomment this to preserve the groupLast number information for
|
# Uncomment this to preserve the groupLast number information for
|
||||||
# debugging stack traces.
|
# debugging stack traces.
|
||||||
#-keepattributes SourceFile,LineNumberTable
|
-keepattributes SourceFile,LineNumberTable
|
||||||
|
|
||||||
# If you keep the groupLast number information, uncomment this to
|
# If you keep the groupLast number information, uncomment this to
|
||||||
# hide the original source file name.
|
# hide the original source file name.
|
||||||
#-renamesourcefileattribute SourceFile
|
-renamesourcefileattribute SourceFile
|
||||||
|
|
||||||
|
-keep class com.yunbao.**{
|
||||||
|
public <methods>;
|
||||||
|
protected <methods>;
|
||||||
|
}
|
||||||
|
-keep class * implements com.yunbao.common.bean.BaseModel {
|
||||||
|
*;
|
||||||
|
}
|
||||||
|
-keep class com.yunbao.common.bean.** {
|
||||||
|
*;
|
||||||
|
}
|
||||||
|
|
||||||
|
-keep class com.yunbao.common.views.weight.VerticalViewPager$LayoutParams{
|
||||||
|
*;
|
||||||
|
}
|
||||||
|
-keep class android.**{
|
||||||
|
*;
|
||||||
|
}
|
||||||
|
|
||||||
|
-keep class **.R$* {
|
||||||
|
public static <fields>;
|
||||||
|
}
|
||||||
|
-keep class com.tencent.** { *; }
|
||||||
-keep class com.adjust.sdk.**{ *; }
|
-keep class com.adjust.sdk.**{ *; }
|
||||||
-keep class com.google.android.gms.common.ConnectionResult {
|
-keep class com.google.android.gms.common.ConnectionResult {
|
||||||
int SUCCESS;
|
int SUCCESS;
|
||||||
@ -48,6 +71,13 @@
|
|||||||
-keep class okhttp3.internal.**{*;}
|
-keep class okhttp3.internal.**{*;}
|
||||||
|
|
||||||
-dontwarn okio.**
|
-dontwarn okio.**
|
||||||
|
#okhttp
|
||||||
|
-dontwarn okhttp3.**
|
||||||
|
-keep class okhttp3.**{*;}
|
||||||
|
|
||||||
|
#okio
|
||||||
|
-dontwarn okio.**
|
||||||
|
-keep class okio.**{*;}
|
||||||
|
|
||||||
# Retrofit
|
# Retrofit
|
||||||
|
|
||||||
@ -55,9 +85,10 @@
|
|||||||
|
|
||||||
-keep class retrofit2.** { *; }
|
-keep class retrofit2.** { *; }
|
||||||
|
|
||||||
-keepattributes Signature-keepattributes Exceptions
|
-keepattributes Signature-keepattributes,Exceptions
|
||||||
|
|
||||||
# RxJava RxAndroid
|
# RxJava RxAndroid
|
||||||
|
-dontwarn java.util.concurrent.Flow*
|
||||||
|
|
||||||
-dontwarn sun.misc.**
|
-dontwarn sun.misc.**
|
||||||
|
|
||||||
@ -69,20 +100,129 @@ long consumerIndex;
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
-keepclassmembers class rx.internal.util.unsafe.BaseLinkedQueueProducerNodeRef {
|
-keepclassmembers class rx.internal.util.unsafe.BaseLinkedQueueProducerNodeRef* {
|
||||||
|
|
||||||
rx.internal.util.atomic.LinkedQueueNode producerNode;
|
rx.internal.util.atomic.LinkedQueueNode* producerNode;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
-keepclassmembers class rx.internal.util.unsafe.BaseLinkedQueueConsumerNodeRef {
|
-keepclassmembers class rx.internal.util.unsafe.BaseLinkedQueueConsumerNodeRef* {
|
||||||
|
|
||||||
rx.internal.util.atomic.LinkedQueueNode consumerNode;
|
rx.internal.util.atomic.LinkedQueueNode* consumerNode;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Gson
|
# Gson
|
||||||
|
|
||||||
-keep class com.google.gson.stream.** { *; }
|
-keep class com.google.gson.stream.** { *; }
|
||||||
|
##---------------Begin: proguard configuration for Gson ----------
|
||||||
|
# Gson uses generic type information stored in a class file when working with fields. Proguard
|
||||||
|
# removes such information by default, so configure it to keep all of it.
|
||||||
|
-keepattributes Signature
|
||||||
|
|
||||||
|
# For using GSON @Expose annotation
|
||||||
|
-keepattributes *Annotation*
|
||||||
|
|
||||||
|
# Gson specific classes
|
||||||
|
-dontwarn sun.misc.**
|
||||||
|
#-keep class com.google.gson.stream.** { *; }
|
||||||
|
|
||||||
|
# Application classes that will be serialized/deserialized over Gson
|
||||||
|
-keep class com.google.gson.examples.android.model.** { <fields>; }
|
||||||
|
|
||||||
|
# Prevent proguard from stripping interface information from TypeAdapter, TypeAdapterFactory,
|
||||||
|
# JsonSerializer, JsonDeserializer instances (so they can be used in @JsonAdapter)
|
||||||
|
-keep class * extends com.google.gson.TypeAdapter
|
||||||
|
-keep class * implements com.google.gson.TypeAdapterFactory
|
||||||
|
-keep class * implements com.google.gson.JsonSerializer
|
||||||
|
-keep class * implements com.google.gson.JsonDeserializer
|
||||||
|
|
||||||
|
# Prevent R8 from leaving Data object members always null
|
||||||
|
-keepclassmembers,allowobfuscation class * {
|
||||||
|
@com.google.gson.annotations.SerializedName <fields>;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Retain generic signatures of TypeToken and its subclasses with R8 version 3.0 and higher.
|
||||||
|
-keep,allowobfuscation,allowshrinking class com.google.gson.reflect.TypeToken
|
||||||
|
-keep,allowobfuscation,allowshrinking class * extends com.google.gson.reflect.TypeToken
|
||||||
|
|
||||||
|
##---------------End: proguard configuration for Gson ----------
|
||||||
|
|
||||||
-keepattributes EnclosingMethod
|
-keepattributes EnclosingMethod
|
||||||
|
#--------融云
|
||||||
|
-keepattributes Exceptions,InnerClasses
|
||||||
|
-keepattributes Signature
|
||||||
|
-keep class io.rong.** {*;}
|
||||||
|
-keep class cn.rongcloud.** {*;}
|
||||||
|
-keep class * implements io.rong.imlib.model.MessageContent {*;}
|
||||||
|
-dontwarn io.rong.push.**
|
||||||
|
-dontnote com.xiaomi.**
|
||||||
|
-dontnote com.google.android.gms.gcm.**
|
||||||
|
-dontnote io.rong.**
|
||||||
|
# 下方混淆使用了融云 IMKit 提供的 locationKit 位置插件时才需要配置,可参考高德官网的混淆方式:https://lbs.amap.com/api/android-sdk/guide/create-project/dev-attention
|
||||||
|
-keep class com.amap.api.maps.**{*;}
|
||||||
|
-keep class com.autonavi.**{*;}
|
||||||
|
-keep class com.amap.api.trace.**{*;}
|
||||||
|
-keep class com.amap.api.location.**{*;}
|
||||||
|
-keep class com.amap.api.fence.**{*;}
|
||||||
|
-keep class com.loc.**{*;}
|
||||||
|
-keep class com.autonavi.aps.amapapi.model.**{*;}
|
||||||
|
-keep class com.amap.api.services.**{*;}
|
||||||
|
-ignorewarnings
|
||||||
|
|
||||||
|
#--------科大讯飞
|
||||||
|
-keep class com.iflytek.**{*;}
|
||||||
|
-keepattributes Signature
|
||||||
|
#EvenBus
|
||||||
|
-keepattributes *Annotation*
|
||||||
|
-keepclassmembers class * {
|
||||||
|
@org.greenrobot.eventbus.Subscribe <methods>;
|
||||||
|
}
|
||||||
|
-keep enum org.greenrobot.eventbus.ThreadMode { *; }
|
||||||
|
|
||||||
|
# If using AsyncExecutord, keep required constructor of default event used.
|
||||||
|
# Adjust the class name if a custom failure event type is used.
|
||||||
|
-keepclassmembers class org.greenrobot.eventbus.util.ThrowableFailureEvent {
|
||||||
|
<init>(java.lang.Throwable);
|
||||||
|
}
|
||||||
|
|
||||||
|
# Accessed via reflection, avoid renaming or removal
|
||||||
|
-keep class org.greenrobot.eventbus.android.AndroidComponentsImpl*
|
||||||
|
|
||||||
|
#--------ARouter
|
||||||
|
-keep public class com.alibaba.android.arouter.routes.**{*;}
|
||||||
|
-keep public class com.alibaba.android.arouter.facade.**{*;}
|
||||||
|
-keep class * implements com.alibaba.android.arouter.facade.template.ISyringe{*;}
|
||||||
|
|
||||||
|
# If you use the byType method to obtain Service, add the following rules to protect the interface:
|
||||||
|
-keep interface * implements com.alibaba.android.arouter.facade.template.IProvider
|
||||||
|
|
||||||
|
# If single-type injection is used, that is, no interface is defined to implement IProvider, the following rules need to be added to protect the implementation
|
||||||
|
# -keep class * implements com.alibaba.android.arouter.facade.template.IProvider
|
||||||
|
|
||||||
|
#----retrofit2
|
||||||
|
-keepattributes Signature, InnerClasses, EnclosingMethod
|
||||||
|
-keepattributes RuntimeVisibleAnnotations, RuntimeVisibleParameterAnnotations
|
||||||
|
-keepattributes AnnotationDefault
|
||||||
|
-keepclassmembers,allowshrinking,allowobfuscation interface * {
|
||||||
|
@retrofit2.http.* <methods>;
|
||||||
|
}
|
||||||
|
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement*
|
||||||
|
-dontwarn javax.annotation.**
|
||||||
|
-dontwarn kotlin.Unit
|
||||||
|
-dontwarn retrofit2.KotlinExtensions*
|
||||||
|
-dontwarn retrofit2.KotlinExtensions$*
|
||||||
|
-if interface * { @retrofit2.http.* <methods>; }
|
||||||
|
-keep,allowobfuscation interface <1>
|
||||||
|
-if interface * { @retrofit2.http.* <methods>; }
|
||||||
|
-keep,allowobfuscation interface * extends <1>
|
||||||
|
-keep,allowobfuscation,allowshrinking class kotlin.coroutines.Continuation
|
||||||
|
-if interface * { @retrofit2.http.* public *** *(...); }
|
||||||
|
-keep,allowoptimization,allowshrinking,allowobfuscation class <3>
|
||||||
|
|
||||||
|
#-----glide
|
||||||
|
-keep public class com.bumptech.glide.** {*;}
|
||||||
|
-keep public class jp.co.cyberagent.** {*;}
|
||||||
|
-dontwarn jp.co.cyberagent.android.gpuimage.**
|
||||||
|
|
||||||
|
-printconfiguration tmp/full-r8-config.txt
|
@ -11,9 +11,9 @@ import android.os.Bundle;
|
|||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
|
import android.os.Process;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.os.Process;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
@ -26,6 +26,7 @@ import com.google.firebase.FirebaseApp;
|
|||||||
import com.google.firebase.analytics.FirebaseAnalytics;
|
import com.google.firebase.analytics.FirebaseAnalytics;
|
||||||
import com.google.firebase.crashlytics.FirebaseCrashlytics;
|
import com.google.firebase.crashlytics.FirebaseCrashlytics;
|
||||||
import com.shayu.phonelive.utils.LogUtils;
|
import com.shayu.phonelive.utils.LogUtils;
|
||||||
|
import com.shayu.phonelive.utils.PluginManager;
|
||||||
import com.tencent.imsdk.v2.V2TIMGroupMemberInfo;
|
import com.tencent.imsdk.v2.V2TIMGroupMemberInfo;
|
||||||
import com.tencent.imsdk.v2.V2TIMManager;
|
import com.tencent.imsdk.v2.V2TIMManager;
|
||||||
import com.tencent.imsdk.v2.V2TIMSimpleMsgListener;
|
import com.tencent.imsdk.v2.V2TIMSimpleMsgListener;
|
||||||
@ -248,6 +249,7 @@ public class AppContext extends CommonAppContext {
|
|||||||
configSPApp();
|
configSPApp();
|
||||||
//初始化美颜SDK
|
//初始化美颜SDK
|
||||||
// FaceManager.initFaceUnity(this);
|
// FaceManager.initFaceUnity(this);
|
||||||
|
PluginManager.getInstance().loadAnchorPlugin();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -289,7 +291,7 @@ public class AppContext extends CommonAppContext {
|
|||||||
.setMainCrashHandler((t, e) -> {
|
.setMainCrashHandler((t, e) -> {
|
||||||
Log.e("ApplicationError", "主线程异常");//此处log只是展示,当debug为true时,主类内部log会打印异常信息
|
Log.e("ApplicationError", "主线程异常");//此处log只是展示,当debug为true时,主类内部log会打印异常信息
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
AppManager.runDebugCode(()->{
|
AppManager.runDebugCode(() -> {
|
||||||
//闪退后finish所有Activity并且杀死进程
|
//闪退后finish所有Activity并且杀死进程
|
||||||
for (WeakReference<Activity> activity : activities) {
|
for (WeakReference<Activity> activity : activities) {
|
||||||
if (activity != null && activity.get() != null) {
|
if (activity != null && activity.get() != null) {
|
||||||
|
198
app/src/main/java/com/shayu/phonelive/utils/PluginManager.java
Normal file
@ -0,0 +1,198 @@
|
|||||||
|
package com.shayu.phonelive.utils;
|
||||||
|
|
||||||
|
import static com.yunbao.faceunity.utils.FURenderer.BUNDLE_AI_FACE;
|
||||||
|
import static com.yunbao.faceunity.utils.FaceUnityConfig.BUNDLE_FACE_BEAUTIFICATION;
|
||||||
|
|
||||||
|
import android.os.Build;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
import com.yunbao.common.CommonAppContext;
|
||||||
|
import com.yunbao.common.utils.DownloadUtil;
|
||||||
|
import com.yunbao.common.utils.StringUtil;
|
||||||
|
import com.yunbao.faceunity.utils.FileUtils;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.zip.ZipEntry;
|
||||||
|
import java.util.zip.ZipInputStream;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 插件加载器
|
||||||
|
*/
|
||||||
|
public class PluginManager {
|
||||||
|
private static PluginManager manager;
|
||||||
|
private static final String TAG = "插件管理器";
|
||||||
|
private String anchorPluginDownloadUrl = "http://192.168.137.1:12345/shares/ce47aa99-3e73-4a79-8a2f-e17a2d527953";
|
||||||
|
|
||||||
|
private PluginManager() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public static PluginManager getInstance() {
|
||||||
|
if (manager == null) {
|
||||||
|
manager = new PluginManager();
|
||||||
|
}
|
||||||
|
return manager;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置主播插件下载地址
|
||||||
|
*/
|
||||||
|
public void setAnchorPluginDownloadUrl(String anchorPluginDownloadUrl) {
|
||||||
|
this.anchorPluginDownloadUrl = anchorPluginDownloadUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 加载主播插件
|
||||||
|
*/
|
||||||
|
public void loadAnchorPlugin() {
|
||||||
|
new Thread(() -> {
|
||||||
|
try {
|
||||||
|
if (Arrays.asList(CommonAppContext.sInstance.getAssets().list("")).contains("anchorPlugin.apk")) {
|
||||||
|
FileUtils.copyAssetsFile(CommonAppContext.sInstance,"anchorPlugin.apk","anchorPlugin.apk",CommonAppContext.sInstance.getFilesDir().getAbsolutePath() + File.separator + "plugin_download");
|
||||||
|
}
|
||||||
|
Log.d(TAG,"解压assets下的文件");
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
File sdk = new File(CommonAppContext.sInstance.getFilesDir().getAbsolutePath() + File.separator + "plugin_download" + File.separator + "anchorPlugin.apk");
|
||||||
|
if (!sdk.exists()) {
|
||||||
|
if (StringUtil.isEmpty(anchorPluginDownloadUrl)) {
|
||||||
|
Log.e(TAG, "主播下载地址为空");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
downloadAnchorSdk();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String outDir = CommonAppContext.sInstance.getFilesDir().getAbsolutePath() + File.separator + "plugin";
|
||||||
|
loadFaceSo(sdk, outDir);
|
||||||
|
loadFaceBundle(sdk, outDir);
|
||||||
|
}).start();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 加载美颜so文件
|
||||||
|
*
|
||||||
|
* @param plugin 插件apk文件
|
||||||
|
* @param outDir 解压路径
|
||||||
|
*/
|
||||||
|
private void loadFaceSo(File plugin, String outDir) {
|
||||||
|
unzip(plugin.getAbsolutePath(), outDir, ".so");
|
||||||
|
String[] abis = Build.SUPPORTED_ABIS;
|
||||||
|
String abi = Arrays.asList(abis).contains("arm64-v8a") ? "arm64-v8a" : "armeabi-v7a";
|
||||||
|
File plugins = new File(outDir + File.separator + "lib" + File.separator + abi);
|
||||||
|
loadSo(plugins, "libfuai");
|
||||||
|
loadSo(plugins, "libCNamaSDK");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置美颜Bundle文件
|
||||||
|
*
|
||||||
|
* @param plugin 插件apk文件
|
||||||
|
* @param outDir 解压路径
|
||||||
|
*/
|
||||||
|
private void loadFaceBundle(File plugin, String outDir) {
|
||||||
|
unzip(plugin.getAbsolutePath(), outDir, ".bundle");
|
||||||
|
BUNDLE_AI_FACE = outDir + File.separator + "assets" + File.separator + BUNDLE_AI_FACE;
|
||||||
|
BUNDLE_FACE_BEAUTIFICATION = outDir + File.separator + "assets" + File.separator + BUNDLE_FACE_BEAUTIFICATION;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 加载指定so
|
||||||
|
*
|
||||||
|
* @param dir so文件路径
|
||||||
|
* @param file so文件名字
|
||||||
|
*/
|
||||||
|
private void loadSo(File dir, String file) {
|
||||||
|
file += ".so";
|
||||||
|
if (new File(dir.getAbsolutePath() + File.separator + file).exists()) {
|
||||||
|
System.load(dir + File.separator + file);
|
||||||
|
Log.d(TAG, "加载成功 "+dir + File.separator + file );
|
||||||
|
} else {
|
||||||
|
Log.e(TAG, "不存在 "+dir + File.separator + file );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 下载主播插件包
|
||||||
|
*/
|
||||||
|
private void downloadAnchorSdk() {
|
||||||
|
String downloadDir = new File(CommonAppContext.sInstance.getFilesDir().getAbsolutePath() + File.separator + "plugin_download").getAbsolutePath();
|
||||||
|
new DownloadUtil().download("plugin", downloadDir, "anchorPlugin.apk", anchorPluginDownloadUrl, new DownloadUtil.Callback() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(File file) {
|
||||||
|
Log.d(TAG, "下载成功 "+file );
|
||||||
|
loadAnchorPlugin();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onProgress(int progress) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(Throwable e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 解压zip文件
|
||||||
|
*
|
||||||
|
* @param zip zip文件
|
||||||
|
* @param outDir 解压路径
|
||||||
|
* @param suffix 过滤
|
||||||
|
*/
|
||||||
|
private boolean unzip(String zip, String outDir, String suffix) {
|
||||||
|
FileOutputStream out;
|
||||||
|
byte buffer[] = new byte[1024];
|
||||||
|
try {
|
||||||
|
ZipInputStream zis = new ZipInputStream(new FileInputStream(zip));
|
||||||
|
ZipEntry entry = zis.getNextEntry();
|
||||||
|
while (entry != null) {
|
||||||
|
String name = entry.getName();
|
||||||
|
if (entry.isDirectory()) {
|
||||||
|
File newDir = new File(outDir + entry.getName());
|
||||||
|
newDir.mkdir();
|
||||||
|
} else if (name.endsWith(suffix)) {
|
||||||
|
File outputFile = new File(outDir + File.separator + name);
|
||||||
|
String outputPath = outputFile.getCanonicalPath();
|
||||||
|
name = outputPath
|
||||||
|
.substring(outputPath.lastIndexOf("/") + 1);
|
||||||
|
outputPath = outputPath.substring(0, outputPath
|
||||||
|
.lastIndexOf("/"));
|
||||||
|
File outputDir = new File(outputPath);
|
||||||
|
outputDir.mkdirs();
|
||||||
|
outputFile = new File(outputPath, name);
|
||||||
|
outputFile.createNewFile();
|
||||||
|
out = new FileOutputStream(outputFile);
|
||||||
|
|
||||||
|
int tmp = 0;
|
||||||
|
while ((tmp = zis.read(buffer)) > 0) {
|
||||||
|
out.write(buffer, 0, tmp);
|
||||||
|
}
|
||||||
|
/* do {
|
||||||
|
tmp = zis.read(buffer);
|
||||||
|
if (tmp <= 0) {
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
out.write(buffer, 0, tmp);
|
||||||
|
}
|
||||||
|
} while (true);*/
|
||||||
|
out.close();
|
||||||
|
}
|
||||||
|
entry = zis.getNextEntry();
|
||||||
|
}
|
||||||
|
zis.close();
|
||||||
|
return true;
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -174,8 +174,8 @@ dependencies {
|
|||||||
api 'com.squareup.retrofit2:retrofit:2.3.0'
|
api 'com.squareup.retrofit2:retrofit:2.3.0'
|
||||||
api 'com.squareup.retrofit2:adapter-rxjava2:2.3.0'
|
api 'com.squareup.retrofit2:adapter-rxjava2:2.3.0'
|
||||||
//gson解析
|
//gson解析
|
||||||
api 'com.squareup.retrofit2:converter-gson:2.3.0'
|
api 'com.squareup.retrofit2:converter-gson:2.3.0'//混淆
|
||||||
implementation "io.reactivex.rxjava2:rxjava:2.2.3"
|
implementation "io.reactivex.rxjava2:rxjava:2.2.3"//混淆
|
||||||
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
|
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
|
||||||
api 'com.jakewharton.rxbinding3:rxbinding:3.1.0'
|
api 'com.jakewharton.rxbinding3:rxbinding:3.1.0'
|
||||||
//loading样式库
|
//loading样式库
|
||||||
|
@ -1264,6 +1264,7 @@ public class LiveNetManager {
|
|||||||
callback.onSuccess(listResponseModel.getData().getInfo());
|
callback.onSuccess(listResponseModel.getData().getInfo());
|
||||||
}
|
}
|
||||||
}, throwable -> {
|
}, throwable -> {
|
||||||
|
throwable.printStackTrace();
|
||||||
if (callback != null) {
|
if (callback != null) {
|
||||||
callback.onError(throwable.getMessage());
|
callback.onError(throwable.getMessage());
|
||||||
}
|
}
|
||||||
|
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 33 KiB |
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 25 KiB |
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 32 KiB |
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 30 KiB |
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 30 KiB |
Before Width: | Height: | Size: 889 KiB After Width: | Height: | Size: 244 KiB |
Before Width: | Height: | Size: 911 KiB After Width: | Height: | Size: 248 KiB |
Before Width: | Height: | Size: 911 KiB After Width: | Height: | Size: 248 KiB |
Before Width: | Height: | Size: 895 KiB After Width: | Height: | Size: 244 KiB |
Before Width: | Height: | Size: 912 KiB After Width: | Height: | Size: 249 KiB |
Before Width: | Height: | Size: 894 KiB After Width: | Height: | Size: 242 KiB |
Before Width: | Height: | Size: 911 KiB After Width: | Height: | Size: 253 KiB |
Before Width: | Height: | Size: 895 KiB After Width: | Height: | Size: 246 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 8.5 KiB After Width: | Height: | Size: 8.5 KiB |
Before Width: | Height: | Size: 177 KiB After Width: | Height: | Size: 64 KiB |
Before Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 793 B |
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 7.0 KiB |
Before Width: | Height: | Size: 5.7 KiB After Width: | Height: | Size: 5.6 KiB |
Before Width: | Height: | Size: 732 KiB After Width: | Height: | Size: 686 KiB |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 60 KiB After Width: | Height: | Size: 32 KiB |
Before Width: | Height: | Size: 184 KiB After Width: | Height: | Size: 44 KiB |
Before Width: | Height: | Size: 549 KiB After Width: | Height: | Size: 125 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 744 B |
Before Width: | Height: | Size: 636 KiB After Width: | Height: | Size: 158 KiB |
Before Width: | Height: | Size: 53 KiB After Width: | Height: | Size: 53 KiB |
Before Width: | Height: | Size: 5.7 KiB After Width: | Height: | Size: 5.7 KiB |
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 884 B |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 980 B |
Before Width: | Height: | Size: 729 B After Width: | Height: | Size: 369 B |
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 753 B |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 546 B After Width: | Height: | Size: 522 B |
Before Width: | Height: | Size: 584 B After Width: | Height: | Size: 541 B |
Before Width: | Height: | Size: 632 B After Width: | Height: | Size: 563 B |
Before Width: | Height: | Size: 589 B After Width: | Height: | Size: 543 B |
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1018 B |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 757 B |
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 971 B |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 660 B After Width: | Height: | Size: 513 B |
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.6 KiB |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 5.0 KiB After Width: | Height: | Size: 4.9 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 6.6 KiB |
Before Width: | Height: | Size: 7.4 KiB After Width: | Height: | Size: 7.3 KiB |
Before Width: | Height: | Size: 8.0 KiB After Width: | Height: | Size: 8.0 KiB |
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 6.5 KiB |
Before Width: | Height: | Size: 1.2 MiB After Width: | Height: | Size: 415 KiB |
Before Width: | Height: | Size: 7.5 KiB After Width: | Height: | Size: 7.4 KiB |
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 2.6 KiB |