leakcanary update
This commit is contained in:
@@ -202,9 +202,9 @@ dependencies {
|
||||
|
||||
api 'androidx.multidex:multidex:2.0.1'
|
||||
|
||||
debugApi "com.squareup.leakcanary:leakcanary-android:1.6.3"
|
||||
releaseApi "com.squareup.leakcanary:leakcanary-android-no-op:1.6.3"
|
||||
stagingApi "com.squareup.leakcanary:leakcanary-android-no-op:1.6.3"
|
||||
debugApi "com.squareup.leakcanary:leakcanary-android:2.4"
|
||||
releaseApi "com.squareup.leakcanary:leakcanary-android-no-op:2.4"
|
||||
stagingApi "com.squareup.leakcanary:leakcanary-android-no-op:2.4"
|
||||
|
||||
api "com.orhanobut:dialogplus:1.11@aar"
|
||||
|
||||
|
@@ -20,11 +20,9 @@ import androidx.multidex.MultiDex;
|
||||
|
||||
import com.alibaba.security.biometrics.activity.ALBiometricsActivity;
|
||||
import com.alibaba.security.biometrics.activity.ALBiometricsDialogActivity;
|
||||
import com.alibaba.security.biometrics.activity.BaseBioNavigatorActivity;
|
||||
import com.alibaba.security.realidentity.RPVerify;
|
||||
import com.alibaba.security.realidentity.activity.RPTakePhotoActivity;
|
||||
import com.alibaba.security.realidentity.activity.RPWebViewActivity;
|
||||
import com.baidu.mobstat.StatService;
|
||||
import com.bumptech.glide.request.target.ViewTarget;
|
||||
import com.coorchice.library.utils.LogUtils;
|
||||
import com.huawei.hms.support.common.ActivityMgr;
|
||||
@@ -54,19 +52,14 @@ import com.scwang.smartrefresh.header.MaterialHeader;
|
||||
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
|
||||
import com.scwang.smartrefresh.layout.footer.ClassicsFooter;
|
||||
import com.soundcloud.android.crop.CropImageActivity;
|
||||
import com.squareup.leakcanary.LeakCanary;
|
||||
import com.squareup.leakcanary.RefWatcher;
|
||||
import com.tencent.bugly.Bugly;
|
||||
import com.tencent.bugly.beta.Beta;
|
||||
import com.tencent.bugly.crashreport.CrashReport;
|
||||
import com.umeng.analytics.MobclickAgent;
|
||||
import com.umeng.commonsdk.UMConfigure;
|
||||
import com.yizhuan.erban.BuildConfig;
|
||||
import com.yizhuan.erban.MainActivity;
|
||||
import com.yizhuan.erban.MiddleActivity;
|
||||
import com.yizhuan.erban.NimMiddleActivity;
|
||||
import com.yizhuan.erban.R;
|
||||
import com.yizhuan.erban.flutter.ChannelConstants;
|
||||
import com.yizhuan.erban.flutter.XplanFlutterBoostCallback;
|
||||
import com.yizhuan.erban.flutter.XplanFlutterBoostDelegate;
|
||||
import com.yizhuan.erban.module_hall.HallDataManager;
|
||||
@@ -119,14 +112,10 @@ import java.io.IOException;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
import io.flutter.plugin.common.MethodChannel;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.plugins.RxJavaPlugins;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import io.realm.Realm;
|
||||
import io.realm.RealmConfiguration;
|
||||
import me.jessyan.autosize.AutoSizeConfig;
|
||||
import me.jessyan.autosize.external.ExternalAdaptManager;
|
||||
|
||||
import static com.yizhuan.xchat_android_constants.XChatConstants.HW_APP_ID;
|
||||
import static com.yizhuan.xchat_android_constants.XChatConstants.HW_CERTIFICATE_NAME;
|
||||
@@ -151,19 +140,9 @@ import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUS
|
||||
public class XChatApplication extends Application {
|
||||
public static final String TAG = "XChatApplication";
|
||||
private static XChatApplication instance;
|
||||
private RefWatcher mRefWatcher;
|
||||
|
||||
private static String oaid;
|
||||
private static boolean isSupportOaid = false;
|
||||
private static int errorCode;
|
||||
|
||||
public static String getOaid() {
|
||||
return oaid;
|
||||
}
|
||||
|
||||
// public static String getErrorCode() {
|
||||
// return String.valueOf(errorCode);
|
||||
// }
|
||||
public static boolean isSupportOaid() {
|
||||
return isSupportOaid;
|
||||
}
|
||||
@@ -174,7 +153,6 @@ public class XChatApplication extends Application {
|
||||
|
||||
public static void setIsSupportOaid(boolean isSupportOaid, int ErrorCode) {
|
||||
XChatApplication.isSupportOaid = isSupportOaid;
|
||||
XChatApplication.errorCode = ErrorCode;
|
||||
}
|
||||
|
||||
public static XChatApplication instance() {
|
||||
@@ -338,13 +316,7 @@ public class XChatApplication extends Application {
|
||||
@Override
|
||||
protected void attachBaseContext(Context base) {
|
||||
super.attachBaseContext(base);
|
||||
// you must install multiDex whatever tinker is installed!
|
||||
MultiDex.install(base);
|
||||
// try{
|
||||
// JLibrary.InitEntry(base);
|
||||
// }catch (Exception e){
|
||||
//
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
@@ -716,8 +688,6 @@ public class XChatApplication extends Application {
|
||||
|
||||
initRxNet(BasicConfig.INSTANCE.getAppContext(), UriProvider.JAVA_WEB_URL);
|
||||
|
||||
//内存泄漏监控
|
||||
setupLeakCanary();
|
||||
ConnectiveChangedReceiver.getInstance().init(this.getApplicationContext());
|
||||
/**
|
||||
* 使用到realm 数据库,这里配置数据库 这里必须先于模块初始化前进行初始化配置
|
||||
@@ -801,18 +771,6 @@ public class XChatApplication extends Application {
|
||||
}
|
||||
}
|
||||
|
||||
private void setupLeakCanary() {
|
||||
if (!BasicConfig.INSTANCE.isDebuggable()) {
|
||||
return;
|
||||
}
|
||||
if (LeakCanary.isInAnalyzerProcess(this)) {
|
||||
// This process is dedicated to LeakCanary for heap analysis.
|
||||
// You should not init your app in this process.
|
||||
return;
|
||||
}
|
||||
// enabledStrictMode();
|
||||
mRefWatcher = LeakCanary.install(this);
|
||||
}
|
||||
|
||||
private static void enabledStrictMode() {
|
||||
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
|
||||
@@ -837,10 +795,6 @@ public class XChatApplication extends Application {
|
||||
);
|
||||
}
|
||||
|
||||
public static RefWatcher getRefWatcher(Context context) {
|
||||
return instance().mRefWatcher;
|
||||
}
|
||||
|
||||
/**
|
||||
* debug 环境 受到实验室模式影响
|
||||
*/
|
||||
|
@@ -347,9 +347,6 @@ public abstract class BaseActivity extends RxAppCompatActivity
|
||||
|
||||
/* ImageLoadUtils.clearMemory(this);*/
|
||||
|
||||
if (XChatApplication.isDebug()) {
|
||||
XChatApplication.getRefWatcher(this).watch(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -150,9 +150,6 @@ public abstract class BaseFragment extends RxFragment implements KeyEvent.Callba
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
if (BasicConfig.INSTANCE.isDebuggable()) {
|
||||
XChatApplication.getRefWatcher(getActivity()).watch(this);
|
||||
}
|
||||
}
|
||||
|
||||
public int getRootLayoutId() {
|
||||
|
@@ -1,95 +0,0 @@
|
||||
package com.yizhuan.erban.utils;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.bun.miitmdid.core.ErrorCode;
|
||||
import com.bun.miitmdid.core.MdidSdkHelper;
|
||||
import com.bun.supplier.IIdentifierListener;
|
||||
import com.bun.supplier.IdSupplier;
|
||||
import com.yizhuan.erban.application.XChatApplication;
|
||||
|
||||
/**
|
||||
* Created by zheng on 2019/8/22.
|
||||
*/
|
||||
|
||||
public class MiitHelper implements IIdentifierListener {
|
||||
|
||||
private AppIdsUpdater _listener;
|
||||
|
||||
public MiitHelper(AppIdsUpdater callback) {
|
||||
_listener = callback;
|
||||
}
|
||||
|
||||
|
||||
public void getDeviceIds(Context cxt) {
|
||||
long timeb = System.currentTimeMillis();
|
||||
int nres = CallFromReflect(cxt);
|
||||
// int nres=DirectCall(cxt);
|
||||
long timee = System.currentTimeMillis();
|
||||
long offset = timee - timeb;
|
||||
if (nres == ErrorCode.INIT_ERROR_DEVICE_NOSUPPORT) {//1008612 不支持的设备
|
||||
XChatApplication.setIsSupportOaid(false, nres);
|
||||
} else if (nres == ErrorCode.INIT_ERROR_LOAD_CONFIGFILE) {//1008613 加载配置文件出错
|
||||
XChatApplication.setIsSupportOaid(false, nres);
|
||||
} else if (nres == ErrorCode.INIT_ERROR_MANUFACTURER_NOSUPPORT) {//1008611 不支持的设备厂商
|
||||
XChatApplication.setIsSupportOaid(false, nres);
|
||||
} else if (nres == ErrorCode.INIT_ERROR_RESULT_DELAY) {//1008614 获取接口是异步的,结果会在回调中返回,回调执行的回调可能在工作线程
|
||||
//TODO 这种情况,还不清楚怎么解决呢。暂且先返false
|
||||
XChatApplication.setIsSupportOaid(false, nres);
|
||||
} else if (nres == ErrorCode.INIT_HELPER_CALL_ERROR) {//1008615 反射调用出错
|
||||
XChatApplication.setIsSupportOaid(false, nres);
|
||||
}
|
||||
Log.d(getClass().getSimpleName(), "return value: " + String.valueOf(nres));
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 通过反射调用,解决android 9以后的类加载升级,导至找不到so中的方法
|
||||
*
|
||||
* */
|
||||
private int CallFromReflect(Context cxt) {
|
||||
return MdidSdkHelper.InitSdk(cxt, true, this);
|
||||
}
|
||||
|
||||
/*
|
||||
* 直接java调用,如果这样调用,在android 9以前没有题,在android 9以后会抛找不到so方法的异常
|
||||
* 解决办法是和JLibrary.InitEntry(cxt),分开调用,比如在A类中调用JLibrary.InitEntry(cxt),在B类中调用MdidSdk的方法
|
||||
* A和B不能存在直接和间接依赖关系,否则也会报错
|
||||
*
|
||||
* */
|
||||
// private int DirectCall(Context cxt) {
|
||||
// MdidSdk sdk = new MdidSdk();
|
||||
// return sdk.InitSdk(cxt, this);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void OnSupport(boolean isSupport, IdSupplier _supplier) {
|
||||
if(_supplier==null) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
String oaid=_supplier.getOAID();
|
||||
String vaid=_supplier.getVAID();
|
||||
String aaid=_supplier.getAAID();
|
||||
StringBuilder builder=new StringBuilder();
|
||||
// builder.append("support: ").append(isSupport?"true":"false").append("\n");
|
||||
// builder.append("OAID: ").append(oaid).append("\n");
|
||||
// builder.append("VAID: ").append(vaid).append("\n");
|
||||
// builder.append("AAID: ").append(aaid).append("\n");
|
||||
if(_listener!=null){
|
||||
_listener.OnIdsAvalid(oaid);
|
||||
}
|
||||
}catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public interface AppIdsUpdater {
|
||||
void OnIdsAvalid(@NonNull String ids);
|
||||
}
|
||||
|
||||
}
|
@@ -1,36 +0,0 @@
|
||||
package com.yizhuan.erban.utils;
|
||||
|
||||
import com.yizhuan.erban.application.XChatApplication;
|
||||
|
||||
/**
|
||||
* @author: hgb
|
||||
* @createTime: 2019/9/27
|
||||
* @description:
|
||||
* @changed by:
|
||||
*/
|
||||
public class OAIDUtil {
|
||||
|
||||
|
||||
/**
|
||||
* 获取唯一标识idfa
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
/**
|
||||
* 获取Oaid
|
||||
*
|
||||
* @return oaid或错误码
|
||||
*/
|
||||
public static String getOaid() {
|
||||
String idfa;
|
||||
if (XChatApplication.isSupportOaid()) {
|
||||
idfa = XChatApplication.getOaid();
|
||||
} else {
|
||||
idfa = null;
|
||||
// idfa = "获取失败,ErrorCode: " + XChatApplication.getErrorCode();
|
||||
}
|
||||
return idfa;
|
||||
}
|
||||
|
||||
|
||||
}
|
Reference in New Issue
Block a user