Class FozaPackageManager

java.lang.Object
lu.die.fozacompatibility.FozaPackageManager

public class FozaPackageManager extends Object
Author:
king@62v.net
See Also:
  • PackageManager
  • Constructor Details

    • FozaPackageManager

      public FozaPackageManager()
  • Method Details

    • get

      public static FozaPackageManager get()
    • getInstalledInnerApps

      public List<android.content.pm.PackageInfo> getInstalledInnerApps()
      Get all installed applications
      Returns:
      internal installed applications
    • isAppInstalledAsInternal

      public boolean isAppInstalledAsInternal(String packageName)
      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

      public File 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]
      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

      public boolean isInnerAppInstalled(String appPkg)
      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

      public String uninstallAppFully(String appPkg)
      Delete an application, and clear all users data
      Parameters:
      appPkg - package name
      Returns:
      can be ignored
    • getPackageInfo

      public android.content.pm.PackageInfo getPackageInfo(String appPkg)
      Get a package info
      Parameters:
      appPkg - package name
      Returns:
      PackageInfo
      See Also:
      • PackageManager.getPackageInfo(String, int)
    • getApplicationInfo

      public android.content.pm.ApplicationInfo getApplicationInfo(String appPkg)
      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.
      See Also:
    • acquireReleaseAppSplash

      public void acquireReleaseAppSplash()
    • isAppSplashExists

      public boolean isAppSplashExists(String appPkg)
      Check if an app has a splash screen
      Parameters:
      appPkg - package name
      Returns:
      if the specific app has a splash screen, then true
    • getInnerAppPackageInfo

      public android.content.pm.PackageInfo getInnerAppPackageInfo(String pkg, int flags)
    • 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

      public String[] getInstalledUserName(String pkg)
      Get installed user name of a specific app
      Parameters:
      pkg - package name
      Returns:
      string array (user name array)
    • createEmptyUser

      public void createEmptyUser(String pkg, String userName)
      Create an user
      Parameters:
      pkg - package name
      userName - user name
    • getInstalledUserId

      public int[] getInstalledUserId(String pkg)
      Integer alias of getInstalledUserName
      Parameters:
      pkg - package name
      Returns:
      int array (user name array)
      See Also:
    • createEmptyUserById

      public void createEmptyUserById(String pkg)
      Create an user automatically, and the user name will be numeric.
      Parameters:
      pkg - package name
    • createEmptyUser

      public void createEmptyUser(String pkg, int userId)
    • cleanPackageDataAsUser

      public void cleanPackageDataAsUser(String pkg, String userName)
      Delete an user of a specific package And will erase all user data
      Parameters:
      pkg - package name
      userName - user name
    • cleanPackageDataAsUser

      public void cleanPackageDataAsUser(String pkg, int userId)
      Integer alias of cleanPackageDataAsUser
      Parameters:
      pkg - package name
      userId - 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 - intent
      resolvedType - type, can be null (intent.type)
      flags - flags
      userId - 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 - intent
      resolvedType - type, can be null (intent.type)
      flags - flags
      userId - 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 - intent
      resolvedType - type, can be null (intent.type)
      flags - flags
      userId - 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 - intent
      resolvedType - type, can be null (intent.type)
      flags - flags
      userId - 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 - intent
      userId - 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 name
      userId - can be ignored and set to 0
      Returns:
      ActivityInfo
      See Also:
      • PackageManager.getActivityInfo(ComponentName, int)
    • getLaunchIntent

      public android.content.Intent getLaunchIntent(String packageName, int userId)
      Obtain a launch intent of internal applications
      Parameters:
      packageName - package name
      userId - can be ignored and set to 0
      Returns:
      Intent
      See Also:
      • PackageManager.getLaunchIntentForPackage(String)
    • setNetFilterRules

      public void setNetFilterRules(String s)
    • setEnabledEmbedClassMaker

      public void setEnabledEmbedClassMaker(boolean b)
    • deleteAppCache

      public void deleteAppCache(String appPackageName)
      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