java getresources方法_Java Application.getResources方法代码示例

java getresources方法_Java Application.getResources方法代码示例importandroid.app.Application;//导入方法依赖的package包/类/***Inittheframework**@paramapplication*@return*@throwsException*/publicvoidinit(Applicationapplication,booleanreset)throwsAssertionArr…

import android.app.Application; //导入方法依赖的package包/类

/**

* Init the framework

*

* @param application

* @return

* @throws Exception

*/

public void init(Application application,boolean reset) throws AssertionArrayException, Exception {

if(application==null){

throw new RuntimeException(“application is null”);

}

ApplicationInfo app_info = application.getApplicationInfo();

sAPKSource = app_info.sourceDir;

boolean DEBUG = (app_info.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;

RuntimeVariables.androidApplication = application;

RuntimeVariables.delegateResources = application.getResources();

DelegateResources.walkroundActionMenuTextColor(RuntimeVariables.delegateResources);

Framework.containerVersion = RuntimeVariables.sInstalledVersionName;

ClassLoader cl = Atlas.class.getClassLoader();

Framework.systemClassLoader = cl;

// defineAndVerify

String packageName = application.getPackageName();

//

DelegateClassLoader newClassLoader = new DelegateClassLoader(cl);

// init RuntimeVariables

RuntimeVariables.delegateClassLoader = newClassLoader;

AndroidHack.injectClassLoader(packageName, newClassLoader);

AndroidHack.injectInstrumentationHook(new InstrumentationHook(AndroidHack.getInstrumentation(), application.getBaseContext()));

// add listeners

bundleLifecycleHandler = new BundleLifecycleHandler();

Framework.syncBundleListeners.add(bundleLifecycleHandler);

frameworkLifecycleHandler = new FrameworkLifecycleHandler();

Framework.frameworkListeners.add(frameworkLifecycleHandler);

try {

ActivityManagerDelegate activityManagerProxy = new ActivityManagerDelegate();

Object gDefault = null;

if(Build.VERSION.SDK_INT>25 || (Build.VERSION.SDK_INT==25&&Build.VERSION.PREVIEW_SDK_INT>0)){

gDefault=AtlasHacks.ActivityManager_IActivityManagerSingleton.get(AtlasHacks.ActivityManager.getmClass());

}else{

gDefault=AtlasHacks.ActivityManagerNative_gDefault.get(AtlasHacks.ActivityManagerNative.getmClass());

}

AtlasHacks.Singleton_mInstance.hijack(gDefault, activityManagerProxy);

}catch(Throwable e){}

AndroidHack.hackH();

}

今天的文章java getresources方法_Java Application.getResources方法代码示例分享到此就结束了,感谢您的阅读,如果确实帮到您,您可以动动手指转发给其他人。

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
如需转载请保留出处:https://bianchenghao.cn/25678.html

(0)
编程小号编程小号

相关推荐

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注