Package net_62v.external
Class MetaPackageManager
java.lang.Object
net_62v.external.MetaPackageManager
A class for installed packages management.
- Version:
- 1.1
- Author:
- king@62v.net
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidFlush apps splash screen, must be called before you use the relevant api.static voidRelease splash item to optimize app memory taken.static voidaddSinglePackageConfig(String packageName, String jsonConfig) Set custom rules for a single package, the json string be like:static voidOne key install GMS, calling this method will explicitly install the GMS.static voidcleanPackageDataAsUser(String pkg, int userId) Integer alias of cleanPackageDataAsUserstatic voidcleanPackageDataAsUser(String pkg, String userName) Delete an user of a specific package
And will erase all user datastatic voidcreateEmptyUser(String pkg, int userId) static voidcreateEmptyUser(String pkg, String userName) Create an userstatic voidCreate an user automatically, and the user name will be numeric.static booleandeleteAccount(Account account) Delete an account.static voidDelete all app cachestatic voiddeleteAppCache(String appPackageName) Delete cache from an applicationstatic booleanfixInternalAppAndReinstall(String packageName) When the host system updated, then may need to reinstall all packages.
Calling this method will help developer to reinstall the specific package.static ApplicationInfogetApplicationInfo(String appPkg) Get an application infostatic PackageInfogetInnerAppPackageInfo(String pkg, int flags) static List<ApplicationInfo> Obtain the installed application info list, only interior apps will be included.Get all installed applicationsstatic List<PackageInfo> Obtain the installed package info list, only interior apps will be included.static int[]getInstalledUserId(String pkg) Integer alias of getInstalledUserNamestatic String[]Get installed user name of a specific appstatic IntentgetLaunchIntent(String packageName, int userId) Obtain a launch intent of internal applicationsstatic IntentgetLaunchIntentForPackage(Intent queryIntent) Get an application launch intentstatic Account[]Retrieve an user list of all apps, you can detect if the user login the Google account.static PackageInfogetPackageInfo(String appPkg) Get a package infostatic ActivityInfogetReceiverInfo(ComponentName comp) Get an receiver infostatic booleanisAppInstalledAsInternal(String packageName) Check is an application installed by apk or xapk instead of clone.static booleanisAppSplashExists(String appPkg) Check if an app has a splash screenstatic booleanisInnerAppInstalled(String appPkg) Check if a specific app was installed,
Both individual and cloned app will be included in the search scope.static List<ResolveInfo> queryIntentActivities(Intent intent, String resolvedType, int flags) static List<ResolveInfo> queryIntentProviders(Intent intent, String resolvedType, int flags) static List<ResolveInfo> queryIntentReceivers(Intent intent, String resolvedType, int flags) static List<ResolveInfo> queryIntentServices(Intent intent, String resolvedType, int flags) static voidReload all package states, and reset the package system to the initial status.static ActivityInforesolveActivityInfo(ComponentName componentName) Resolve an activity info from a componentNamestatic ActivityInforesolveActivityInfo(Intent intent) Resolve an activity info from an intentstatic ActivityInforesolveIntentActivity(Intent intent) Resolve an activity intentstatic StringuninstallAppFully(String appPkg) Delete an application, and clear all users datastatic void
-
Constructor Details
-
MetaPackageManager
public MetaPackageManager()
-
-
Method Details
-
getInstalledInnerApps
Get all installed applications- Returns:
- internal installed applications
- Throws:
RemoteException
-
getInstalledPackageInfos
Obtain the installed package info list, only interior apps will be included.- Returns:
- internal installed package info list
- Throws:
RemoteException
-
getInstalledApplicationInfos
Obtain the installed application info list, only interior apps will be included.- Returns:
- internal installed application info list
- Throws:
RemoteException- Since:
- 1.1
-
isAppInstalledAsInternal
Check is an application installed by apk or xapk instead of clone.- Parameters:
packageName- package name- Returns:
- true if an app was installed by the individual mode.
- Throws:
RemoteException
-
resolveIntentActivity
Resolve an activity intent- Parameters:
intent- intent- Returns:
- ActivityInfo
- Throws:
RemoteException- See Also:
-
isInnerAppInstalled
Check if a specific app was installed,
Both individual and cloned app will be included in the search scope.- Parameters:
appPkg- package name- Returns:
- boolean
- Throws:
RemoteException
-
waitForBackgroundScanner
- Throws:
RemoteException
-
uninstallAppFully
Delete an application, and clear all users data- Parameters:
appPkg- package name- Returns:
- can be ignored
- Throws:
RemoteException
-
getPackageInfo
Get a package info- Parameters:
appPkg- package name- Returns:
- PackageInfo
- Throws:
RemoteException- See Also:
-
getApplicationInfo
Get an application info- Parameters:
appPkg- package name- Returns:
- ApplicationInfo
- Throws:
RemoteException- See Also:
-
getReceiverInfo
Get an receiver info- Parameters:
comp- component name- Returns:
- ApplicationInfo
- Throws:
RemoteException- See Also:
-
acquireObtainAppSplash
Flush apps splash screen, must be called before you use the relevant api.- Throws:
RemoteException
-
acquireReleaseAppSplash
Release splash item to optimize app memory taken.- Throws:
RemoteException
-
isAppSplashExists
Check if an app has a splash screen- Parameters:
appPkg- package name- Returns:
- if the specific app has a splash screen, then true
- Throws:
RemoteException
-
getInnerAppPackageInfo
- Throws:
RemoteException
-
getLaunchIntentForPackage
Get an application launch intent- Parameters:
queryIntent- can be setPackage([package name]) setAction(ACTION_MAIN) etc...- Returns:
- intent if success, null if not found app
- Throws:
RemoteException- See Also:
-
getInstalledUserName
Get installed user name of a specific app- Parameters:
pkg- package name- Returns:
- string array (user name array)
- Throws:
RemoteException
-
createEmptyUser
Create an user- Parameters:
pkg- package nameuserName- user name, also known as split region- Throws:
RemoteException
-
getInstalledUserId
Integer alias of getInstalledUserName- Parameters:
pkg- package name- Returns:
- int array (user name array)
- See Also:
-
createEmptyUserById
Create an user automatically, and the user name will be numeric.- Parameters:
pkg- package name
-
createEmptyUser
- See Also:
-
cleanPackageDataAsUser
Delete an user of a specific package
And will erase all user data- Parameters:
pkg- package nameuserName- user name- Throws:
RemoteException
-
cleanPackageDataAsUser
Integer alias of cleanPackageDataAsUser- Parameters:
pkg- package nameuserId- user name- Throws:
RemoteException- See Also:
-
queryIntentActivities
public static List<ResolveInfo> queryIntentActivities(Intent intent, String resolvedType, int flags) throws RemoteException - Parameters:
intent- intentresolvedType- type, can be null (intent.type)flags- flags- Returns:
- List of resolve info
- Throws:
RemoteException- See Also:
-
queryIntentReceivers
public static List<ResolveInfo> queryIntentReceivers(Intent intent, String resolvedType, int flags) throws RemoteException - Parameters:
intent- intentresolvedType- type, can be null (intent.type)flags- flags- Returns:
- List of resolve info
- Throws:
RemoteException- See Also:
-
queryIntentProviders
public static List<ResolveInfo> queryIntentProviders(Intent intent, String resolvedType, int flags) throws RemoteException - Parameters:
intent- intentresolvedType- type, can be null (intent.type)flags- flags- Returns:
- List of resolve info
- Throws:
RemoteException- See Also:
-
queryIntentServices
public static List<ResolveInfo> queryIntentServices(Intent intent, String resolvedType, int flags) throws RemoteException - Parameters:
intent- intentresolvedType- type, can be null (intent.type)flags- flags- Returns:
- List of resolve info
- Throws:
RemoteException- See Also:
-
resolveActivityInfo
Resolve an activity info from an intent- Parameters:
intent- intent- Returns:
- ActivityInfo
- Throws:
RemoteException- See Also:
-
resolveActivityInfo
Resolve an activity info from a componentName- Parameters:
componentName- component name- Returns:
- ActivityInfo
- Throws:
RemoteException- See Also:
-
getLaunchIntent
Obtain a launch intent of internal applications- Parameters:
packageName- package nameuserId- can be ignored and set to 0- Returns:
- Intent
- Throws:
RemoteException- See Also:
-
deleteAppCache
Delete cache from an application- Parameters:
appPackageName- package name- See Also:
-
deleteAllAppCache
public static void deleteAllAppCache()Delete all app cache -
fixInternalAppAndReinstall
When the host system updated, then may need to reinstall all packages.
Calling this method will help developer to reinstall the specific package.- Parameters:
packageName- package name to install- Returns:
- if successfully reinstalled, then return true, otherwise false (package not exist etc.)
- Throws:
RemoteException
-
reloadAllApps
Reload all package states, and reset the package system to the initial status.- Throws:
RemoteException
-
addSinglePackageConfig
public static void addSinglePackageConfig(String packageName, String jsonConfig) throws RemoteException Set custom rules for a single package, the json string be like:
{Note: All keys can be missed, will enforce the default configurations.
"switches":["BasicRedirect","DataRedirect","SecCompRedirect","ExternalRedirect"],
"data_path":"/data/user/0/com.xxmad.sample.mundo.app/files/my_storage/com.example.app",
"external_path":"/storage/emulated/0/app_shit/com.example.app"
}
switchessegment: Enable some switches.
SwitchBasicRedirect: Enable the hardcoded path redirection, which supports the hardcoded/data/datapath.
SwitchDataRedirect: Enable the data folder redirection (spoof data path), must associate with the BasicRedirect switch.
SwitchSecCompRedirect: Enable the seccomp filter.
SwitchExternalRedirect: Enable external storage path mock.
SwitchUnityChinaRedirect: Strip the Chinese Unity Engine path detection.
SwitchUnblockVivoGames: Bypass the vivo games login requirement.
SwitchShowAllNativeLibraries: Disable hidden native libraries.
data_pathsegment: Customized the app data path, deprecated, will conflict with the split region.
external_pathsegment: Customized the external storage root path, deprecated, will conflict with the scoped storage.- Parameters:
packageName- Application package name.jsonConfig- JSON format config string, please verify the string before you calling this function.- Throws:
RemoteException
-
batchInstallGoogleMobileService
One key install GMS, calling this method will explicitly install the GMS. All running app processes will be killed after execute this method.- Throws:
RemoteException
-
getLoginAccounts
Retrieve an user list of all apps, you can detect if the user login the Google account.- Returns:
- account array
- Throws:
RemoteException
-
deleteAccount
Delete an account.- Parameters:
account- account to delete- Returns:
- if the deletion success then true, otherwise false.
- Throws:
RemoteException
-