Package net_62v.external
Class MetaPackageManager
java.lang.Object
net_62v.external.MetaPackageManager
A class for installed packages management.
- Version:
- 1.1
- Author:
- [email protected]
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
Flush apps splash screen, must be called before you use the relevant api.static void
Release splash item to optimize app memory taken.static void
cleanPackageDataAsUser
(String pkg, int userId) Integer alias of cleanPackageDataAsUserstatic void
cleanPackageDataAsUser
(String pkg, String userName) Delete an user of a specific package
And will erase all user datastatic void
createEmptyUser
(String pkg, int userId) static void
createEmptyUser
(String pkg, String userName) Create an userstatic void
Create an user automatically, and the user name will be numeric.static void
Delete all app cachestatic void
deleteAppCache
(String appPackageName) Delete cache from an applicationstatic boolean
fixInternalAppAndReinstall
(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 ApplicationInfo
getApplicationInfo
(String appPkg) Get an application infostatic PackageInfo
getInnerAppPackageInfo
(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 Intent
getLaunchIntent
(String packageName, int userId) Obtain a launch intent of internal applicationsstatic Intent
getLaunchIntentForPackage
(Intent queryIntent) Get an application launch intentstatic PackageInfo
getPackageInfo
(String appPkg) Get a package infostatic ActivityInfo
getReceiverInfo
(ComponentName comp) Get an receiver infostatic boolean
isAppInstalledAsInternal
(String packageName) Check is an application installed by apk or xapk instead of clone.static boolean
isAppSplashExists
(String appPkg) Check if an app has a splash screenstatic boolean
isInnerAppInstalled
(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 void
Reload all package states, and reset the package system to the initial status.static ActivityInfo
resolveActivityInfo
(ComponentName componentName) Resolve an activity info from a componentNamestatic ActivityInfo
resolveActivityInfo
(Intent intent) Resolve an activity info from an intentstatic ActivityInfo
resolveIntentActivity
(Intent intent) Resolve an activity intentstatic String
uninstallAppFully
(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
-