Class XposedService
-
- All Implemented Interfaces:
public final class XposedService
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final classXposedService.ServiceExceptionpublic interfaceXposedService.OnScopeEventListenerCallback interface for module scope request.
public interfaceXposedService.HotReloadCallbackCallback interface for hot reload requests.
-
Field Summary
Fields Modifier and Type Field Description public final static intAPI_101public final static intAPI_102public final static longPROP_CAP_SYSTEMpublic final static longPROP_CAP_REMOTEpublic final static longPROP_RT_API_PROTECTION
-
Method Summary
Modifier and Type Method Description intgetApiVersion()Get the Xposed API version of current implementation. StringgetFrameworkName()Get the Xposed framework name of current implementation. StringgetFrameworkVersion()Get the Xposed framework version of current implementation. longgetFrameworkVersionCode()Get the Xposed framework version code of current implementation. longgetFrameworkProperties()Gets the Xposed framework properties. List<String>getScope()Get the application scope of current module. voidrequestScope(List<String> packages, XposedService.OnScopeEventListener callback)Request to add a new app to the module scope. voidremoveScope(List<String> packages)Remove an app from the module scope. List<HookedTarget>getRunningTargets()Get a list of currently running processes that are hooked by the module. voidhotReloadModule(HookedTarget target, Bundle data, XposedService.HotReloadCallback callback)Request hot reload for the module in the specified process. synchronized SharedPreferencesgetRemotePreferences(String group)Get remote preferences from Xposed framework. synchronized voiddeleteRemotePreferences(String group)Delete a group of remote preferences. Array<String>listRemoteFiles()List all files in the module's shared data directory. ParcelFileDescriptoropenRemoteFile(String name)Open a file in the module's shared data directory. booleandeleteRemoteFile(String name)Delete a file in the module's shared data directory. -
-
Method Detail
-
getApiVersion
int getApiVersion()
Get the Xposed API version of current implementation.
- Returns:
API version
-
getFrameworkName
String getFrameworkName()
Get the Xposed framework name of current implementation.
- Returns:
Framework name
-
getFrameworkVersion
String getFrameworkVersion()
Get the Xposed framework version of current implementation.
- Returns:
Framework version
-
getFrameworkVersionCode
long getFrameworkVersionCode()
Get the Xposed framework version code of current implementation.
- Returns:
Framework version code
-
getFrameworkProperties
long getFrameworkProperties()
Gets the Xposed framework properties. Properties with prefix PROP_RT_ may change among launches.
- Returns:
Framework properties
-
requestScope
void requestScope(List<String> packages, XposedService.OnScopeEventListener callback)
Request to add a new app to the module scope.
- Parameters:
packages- Packages to be addedcallback- Callback to be invoked when the request is completed or error occurred
-
removeScope
void removeScope(List<String> packages)
Remove an app from the module scope.
- Parameters:
packages- Packages to be removed
-
getRunningTargets
List<HookedTarget> getRunningTargets()
Get a list of currently running processes that are hooked by the module.
Returned targets can be passed to hotReloadModule. The pid, uid, process name, and loaded version code are diagnostic values only.
- Returns:
The list of hooked processes
-
hotReloadModule
void hotReloadModule(HookedTarget target, Bundle data, XposedService.HotReloadCallback callback)
Request hot reload for the module in the specified process. The process must be one of the targets returned by getRunningTargets.
This method only validates and submits the request. The actual reload result is delivered asynchronously through
callback. If the framework cannot provide a valid new module generation for the target, the callback receives UNSUPPORTED.If the old module rejects reload by returning
falsefromonHotReloading, the callback receives FAILED with a null message. If reload fails because of an exception, the callback receives FAILED with a framework-provided diagnostic message.Hot reload is intended for loading a new module generation after the module app is updated. It should not be used to propagate configuration changes. For configuration updates, use getRemotePreferences and SharedPreferences.OnSharedPreferenceChangeListener.
The optional data should contain only classloader-neutral values that can be unmarshalled without the module's class loader. Do not put module-defined android.os.Parcelable or java.io.Serializable objects in this bundle.
- Parameters:
target- The target processdata- Optional data to be passed to the old modulecallback- Callback to be invoked when the request completes or fails
-
getRemotePreferences
synchronized SharedPreferences getRemotePreferences(String group)
Get remote preferences from Xposed framework. If the group does not exist, it will be created.
- Parameters:
group- Group name- Returns:
The preferences
-
deleteRemotePreferences
synchronized void deleteRemotePreferences(String group)
Delete a group of remote preferences.
- Parameters:
group- Group name
-
listRemoteFiles
Array<String> listRemoteFiles()
List all files in the module's shared data directory.
- Returns:
The file list
-
openRemoteFile
ParcelFileDescriptor openRemoteFile(String name)
Open a file in the module's shared data directory. The file will be created if not exists.
- Parameters:
name- File name, must not contain path separators and .- Returns:
The file descriptor
-
deleteRemoteFile
boolean deleteRemoteFile(String name)
Delete a file in the module's shared data directory.
- Parameters:
name- File name, must not contain path separators and .- Returns:
true if successful, false if the file does not exist
-
-
-
-