Package lu.die.fozacompatibility
Class FozaPackageManager
java.lang.Object
lu.die.fozacompatibility.FozaPackageManager
- Author:
- king@62v.net
- See Also:
-
PackageManager
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidFlush apps splash screen, must be called before you use the relevant api.voidvoidcleanPackageDataAsUser(String pkg, int userId) Integer alias of cleanPackageDataAsUservoidcleanPackageDataAsUser(String pkg, String userName) Delete an user of a specific package And will erase all user datavoidcreateEmptyUser(String pkg, int userId) voidcreateEmptyUser(String pkg, String userName) Create an uservoidCreate an user automatically, and the user name will be numeric.voidDelete all app cachevoiddeleteAppCache(String appPackageName) Delete cache from an applicationstatic FozaPackageManagerget()getAppExternalDirLocked(String appPkg) Obtain an external relative (not absolutely path) path by package name The path will mostly like to be /storage/emulated/0/Android/obb/[Your Package Name]/scopedStorage/[appPkg]android.content.pm.ApplicationInfogetApplicationInfo(String appPkg) Get an application infoandroid.content.pm.PackageInfogetInnerAppPackageInfo(String pkg, int flags) List<android.content.pm.PackageInfo>Get all installed applicationsint[]getInstalledUserId(String pkg) Integer alias of getInstalledUserNameString[]Get installed user name of a specific appandroid.content.IntentgetLaunchIntent(String packageName, int userId) Obtain a launch intent of internal applicationsandroid.content.IntentgetLaunchIntentForPackage(android.content.Intent queryIntent) Get an application launch intentandroid.content.pm.PackageInfogetPackageInfo(String appPkg) Get a package infoandroid.content.pm.ActivityInfogetReceiverInfo(android.content.ComponentName comp) Get an receiver infovoidFix the installed app structure after the system upgrade Sometime will be useful, and mostly unused.booleanisAppInstalledAsInternal(String packageName) Check is an application installed by apk or xapk instead of clone.booleanisAppSplashExists(String appPkg) Check if an app has a splash screenbooleanisInnerAppInstalled(String appPkg) Check if a specific app was installed, Both individual and cloned app will be included in the search scope.List<android.content.pm.ResolveInfo>queryIntentActivities(android.content.Intent intent, String resolvedType, int flags, int userId) List<android.content.pm.ResolveInfo>queryIntentProviders(android.content.Intent intent, String resolvedType, int flags, int userId) List<android.content.pm.ResolveInfo>queryIntentReceivers(android.content.Intent intent, String resolvedType, int flags, int userId) List<android.content.pm.ResolveInfo>queryIntentServices(android.content.Intent intent, String resolvedType, int flags, int userId) android.content.pm.ActivityInforesolveActivityInfo(android.content.ComponentName componentName, int userId) Resolve an activity info from a componentNameandroid.content.pm.ActivityInforesolveActivityInfo(android.content.Intent intent, int userId) Resolve an activity info from an intentandroid.content.pm.ActivityInforesolveIntentActivity(android.content.Intent intent) Resolve an activity intentvoidsetDumpDex(boolean b) voidsetEnabledEmbedClassMaker(boolean b) voidsetEnableIoRedirect(boolean b) voidsetInternalAppEnhancement(boolean b) voidvoidsetUnityGamingMode(boolean b) uninstallAppFully(String appPkg) Delete an application, and clear all users datavoid
-
Constructor Details
-
FozaPackageManager
public FozaPackageManager()
-
-
Method Details
-
get
-
getInstalledInnerApps
Get all installed applications- Returns:
- internal installed applications
-
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.
-
getAppExternalDirLocked
Obtain an external relative (not absolutely path) path by package name The path will mostly like to be /storage/emulated/0/Android/obb/[Your Package Name]/scopedStorage/[appPkg]- Parameters:
appPkg- package name- Returns:
- A relative path, please do not hardcode the external path.
-
resolveIntentActivity
public android.content.pm.ActivityInfo resolveIntentActivity(android.content.Intent intent) Resolve an activity intent- Parameters:
intent- intent- Returns:
- ActivityInfo
- See Also:
-
PackageManager.resolveActivity(Intent, int)
-
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
-
waitForBackgroundScanner
public void waitForBackgroundScanner() -
uninstallAppFully
Delete an application, and clear all users data- Parameters:
appPkg- package name- Returns:
- can be ignored
-
getPackageInfo
Get a package info- Parameters:
appPkg- package name- Returns:
- PackageInfo
- See Also:
-
PackageManager.getPackageInfo(String, int)
-
getApplicationInfo
Get an application info- Parameters:
appPkg- package name- Returns:
- ApplicationInfo
- See Also:
-
PackageManager.getApplicationInfo(String, int)
-
getReceiverInfo
public android.content.pm.ActivityInfo getReceiverInfo(android.content.ComponentName comp) Get an receiver info- Parameters:
comp- component name- Returns:
- ApplicationInfo
- See Also:
-
PackageManager.getReceiverInfo(ComponentName, int)
-
acquireObtainAppSplash
public void acquireObtainAppSplash()Flush apps splash screen, must be called before you use the relevant api. -
acquireReleaseAppSplash
public void acquireReleaseAppSplash() -
isAppSplashExists
Check if an app has a splash screen- Parameters:
appPkg- package name- Returns:
- if the specific app has a splash screen, then true
-
getInnerAppPackageInfo
-
getLaunchIntentForPackage
public android.content.Intent getLaunchIntentForPackage(android.content.Intent queryIntent) 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
- See Also:
-
PackageManager.getLaunchIntentForPackage(String)
-
getInstalledUserName
Get installed user name of a specific app- Parameters:
pkg- package name- Returns:
- string array (user name array)
-
createEmptyUser
Create an user- Parameters:
pkg- package nameuserName- user name
-
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
-
cleanPackageDataAsUser
Delete an user of a specific package And will erase all user data- Parameters:
pkg- package nameuserName- user name
-
cleanPackageDataAsUser
Integer alias of cleanPackageDataAsUser- Parameters:
pkg- package nameuserId- user name- See Also:
-
setEnableIoRedirect
public void setEnableIoRedirect(boolean b) -
setUnityGamingMode
public void setUnityGamingMode(boolean b) -
invalidCacheAndRestart
public void invalidCacheAndRestart()Fix the installed app structure after the system upgrade Sometime will be useful, and mostly unused. -
setInternalAppEnhancement
public void setInternalAppEnhancement(boolean b) -
setDumpDex
public void setDumpDex(boolean b) -
queryIntentActivities
public List<android.content.pm.ResolveInfo> queryIntentActivities(android.content.Intent intent, String resolvedType, int flags, int userId) - Parameters:
intent- intentresolvedType- type, can be null (intent.type)flags- flagsuserId- can be ignored and set to 0- Returns:
- List of resolve info
- See Also:
-
PackageManager.queryIntentActivities(Intent, int)
-
queryIntentReceivers
public List<android.content.pm.ResolveInfo> queryIntentReceivers(android.content.Intent intent, String resolvedType, int flags, int userId) - Parameters:
intent- intentresolvedType- type, can be null (intent.type)flags- flagsuserId- can be ignored and set to 0- Returns:
- List of resolve info
- See Also:
-
PackageManager.queryBroadcastReceivers(Intent, int)
-
queryIntentProviders
public List<android.content.pm.ResolveInfo> queryIntentProviders(android.content.Intent intent, String resolvedType, int flags, int userId) - Parameters:
intent- intentresolvedType- type, can be null (intent.type)flags- flagsuserId- can be ignored and set to 0- Returns:
- List of resolve info
- See Also:
-
PackageManager.queryIntentContentProviders(Intent, int)
-
queryIntentServices
public List<android.content.pm.ResolveInfo> queryIntentServices(android.content.Intent intent, String resolvedType, int flags, int userId) - Parameters:
intent- intentresolvedType- type, can be null (intent.type)flags- flagsuserId- can be ignored and set to 0- Returns:
- List of resolve info
- See Also:
-
PackageManager.queryIntentServices(Intent, int)
-
resolveActivityInfo
public android.content.pm.ActivityInfo resolveActivityInfo(android.content.Intent intent, int userId) Resolve an activity info from an intent- Parameters:
intent- intentuserId- can be ignored and set to 0- Returns:
- ActivityInfo
- See Also:
-
PackageManager.resolveActivity(Intent, int)
-
resolveActivityInfo
public android.content.pm.ActivityInfo resolveActivityInfo(android.content.ComponentName componentName, int userId) Resolve an activity info from a componentName- Parameters:
componentName- component nameuserId- can be ignored and set to 0- Returns:
- ActivityInfo
- See Also:
-
PackageManager.getActivityInfo(ComponentName, int)
-
getLaunchIntent
Obtain a launch intent of internal applications- Parameters:
packageName- package nameuserId- can be ignored and set to 0- Returns:
- Intent
- See Also:
-
PackageManager.getLaunchIntentForPackage(String)
-
setNetFilterRules
-
setEnabledEmbedClassMaker
public void setEnabledEmbedClassMaker(boolean b) -
deleteAppCache
Delete cache from an application- Parameters:
appPackageName- package name- See Also:
-
Context.getCacheDir()Context.getCodeCacheDir()Context.getExternalCacheDirs()
-
deleteAllAppCache
public void deleteAllAppCache()Delete all app cache
-