Commit 3f8a6ea3 authored by Administrator's avatar Administrator

支持访问模块资源

parent fdc7d731
package com.virjar.ratel.api;
import android.content.Context;
import android.content.res.Resources;
import com.virjar.ratel.api.hint.RatelEngineHistory;
import com.virjar.ratel.api.hint.RatelEngineVersion;
/**
* 提供访问模块资源的功能,包括皮肤,字体,图片,布局等<br>
* 如果资源已经加载过,那么本接口返回的是缓存对象
*/
@RatelEngineVersion(RatelEngineHistory.V_1_3_8)
public interface RatelResourceInterface {
/**
* 以一个特定的apk创建一个Resource对象
*
* @param moduleApkPath apk路径,一般为模块apk地址。Ratel框架下,可以在模块入口得到模块地址: com.virjar.ratel.api.rposed.callbacks.RC_LoadPackage.LoadPackageParam#modulePath
* @param moduleClassLoader 指向这个apk的classloader
* @return resource对象
*/
Resources createResource(String moduleApkPath, ClassLoader moduleClassLoader);
/**
* 以一个特定的apk创建一个Context对象
*
* @param moduleApkPath apk路径,一般为模块apk地址。Ratel框架下,可以在模块入口得到模块地址: com.virjar.ratel.api.rposed.callbacks.RC_LoadPackage.LoadPackageParam#modulePath
* @param moduleClassLoader 指向这个apk的classloader,如果你不需要通过inflater创建view对象,classloader可以为空
* @param baseContext context需要有一个父context,创建的context仅仅替换资源相关环境
* @return context对象
*/
Context createContext(String moduleApkPath, ClassLoader moduleClassLoader, Context baseContext);
}
...@@ -56,12 +56,22 @@ public class RatelToolKit { ...@@ -56,12 +56,22 @@ public class RatelToolKit {
/** /**
* 也是用户ID,不过转化为一个long类型,方便在ID空间震荡算法中作为随机数起点种子 * 也是用户ID,不过转化为一个long类型,方便在ID空间震荡算法中作为随机数起点种子
* 请注意他是PostInited的 * 请注意他是PostInited的<br>
* 另外请注意这个字段废弃了,请使用int类型的
*
* @see RatelToolKit#userIdentifierSeedInt
*/ */
@PostInited @PostInited
@Deprecated
public static long userIdentifierSeed; public static long userIdentifierSeed;
/** /**
* 也是用户ID,不过转化为一个int类型,方便在ID空间震荡算法中作为随机数起点种子
* 请注意他是PostInited的
*/
@PostInited
public static int userIdentifierSeedInt;
/**
* 虚拟化环境功能支持 * 虚拟化环境功能支持
*/ */
public static VirtualEnv virtualEnv = null; public static VirtualEnv virtualEnv = null;
...@@ -88,6 +98,11 @@ public class RatelToolKit { ...@@ -88,6 +98,11 @@ public class RatelToolKit {
public static SchedulerTaskBeanHandler schedulerTaskBeanHandler = null; public static SchedulerTaskBeanHandler schedulerTaskBeanHandler = null;
/** /**
* 提供主动访问模块布局资源的能力
*/
public static RatelResourceInterface ratelResourceInterface = null;
/**
* 设置为true之后,框架将会自动检测apk处于ANR态,并且ANR态将会自杀程序,避免apk卡屏 * 设置为true之后,框架将会自动检测apk处于ANR态,并且ANR态将会自杀程序,避免apk卡屏
*/ */
public static boolean killAppIfDetectANR = false; public static boolean killAppIfDetectANR = false;
......
...@@ -5,4 +5,5 @@ public class RatelEngineHistory { ...@@ -5,4 +5,5 @@ public class RatelEngineHistory {
public static final String V_1_2_5 = "1.2.5"; public static final String V_1_2_5 = "1.2.5";
public static final String V_1_2_7 = "1.2.7"; public static final String V_1_2_7 = "1.2.7";
public static final String V_1_2_8 = "1.2.8"; public static final String V_1_2_8 = "1.2.8";
public static final String V_1_3_8 = "1.3.8";
} }
...@@ -2,6 +2,8 @@ package com.virjar.ratel.api.rposed.callbacks; ...@@ -2,6 +2,8 @@ package com.virjar.ratel.api.rposed.callbacks;
import android.content.pm.ApplicationInfo; import android.content.pm.ApplicationInfo;
import com.virjar.ratel.api.hint.RatelEngineHistory;
import com.virjar.ratel.api.hint.RatelEngineVersion;
import com.virjar.ratel.api.rposed.IRposedHookLoadPackage; import com.virjar.ratel.api.rposed.IRposedHookLoadPackage;
import com.virjar.ratel.api.rposed.RposedBridge; import com.virjar.ratel.api.rposed.RposedBridge;
...@@ -53,6 +55,12 @@ public abstract class RC_LoadPackage extends RCallback implements IRposedHookLoa ...@@ -53,6 +55,12 @@ public abstract class RC_LoadPackage extends RCallback implements IRposedHookLoa
/** Set to {@code true} if this is the first (and main) application for this process. */ /** Set to {@code true} if this is the first (and main) application for this process. */
public boolean isFirstApplication; public boolean isFirstApplication;
/**
* The path to the module's APK. ratel增加,请注意需要在引擎版本高于 1.3.8之后才可以使用
*/
@RatelEngineVersion(RatelEngineHistory.V_1_3_8)
public String modulePath;
} }
/** @hide */ /** @hide */
......
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