Commit 71abb014 authored by aldrin's avatar aldrin

TAG change DREAMLAND_TAG

parent 5c122f52
......@@ -353,29 +353,29 @@ public class Application extends ContextWrapper implements ComponentCallbacks2 {
*/
private static AtomicBoolean hasInited = new AtomicBoolean(false);
private static final String TAG = "LOAD_DREAMLAND";
private static final String DREAMLAND_TAG = "LOAD_DREAMLAND";
@UnsupportedAppUsage
/* package */ final void attach(Context context) {
if (hasInited.compareAndSet(false, true)) {
Log.i(TAG, "attach: " + context.getPackageName());
Log.i(DREAMLAND_TAG, "attach: " + context.getPackageName());
PackageInfo runtimePkg = findDreamlandApkFromInstalled(context);
if (runtimePkg == null){
Log.w(TAG, "未找到 dreamland 运行时apk,请安装!");
Log.w(DREAMLAND_TAG, "未找到 dreamland 运行时apk,请安装!");
}else{
String targetPackageSourceDir = runtimePkg.applicationInfo.publicSourceDir;
String nativeLibraryDir = runtimePkg.applicationInfo.nativeLibraryDir;
Log.i(TAG, "load apk path: " + targetPackageSourceDir);
Log.i(TAG, "load native path: " + nativeLibraryDir);
Log.i(DREAMLAND_TAG, "load apk path: " + targetPackageSourceDir);
Log.i(DREAMLAND_TAG, "load native path: " + nativeLibraryDir);
String dexDir = dexDir(context).getAbsolutePath();
try {
ClassLoader classLoader = new DexClassLoader(targetPackageSourceDir, dexDir, nativeLibraryDir, context.getClassLoader());
Class<?> runtimeClass = classLoader.loadClass("com.dreamland.runtime.DreamlandRuntime");
Method method = runtimeClass.getDeclaredMethod("callApplicationAttach", Context.class);
method.invoke(null, context);
Log.i(TAG, "加载 runtime 成功");
Log.i(DREAMLAND_TAG, "加载 runtime 成功");
}catch(Exception e){
Log.e(TAG, "加载模块发生异常", e);
Log.e(DREAMLAND_TAG, "加载模块发生异常", e);
}
}
}
......@@ -386,7 +386,7 @@ public class Application extends ContextWrapper implements ComponentCallbacks2 {
private static PackageInfo findDreamlandApkFromInstalled(Context context) {
PackageManager packageManager = context.getPackageManager();
if (packageManager == null){
Log.w(TAG, "packageManager 为 null");
Log.w(DREAMLAND_TAG, "packageManager 为 null");
return null;
}
for (PackageInfo pkg : packageManager.getInstalledPackages(PackageManager.GET_META_DATA)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment