Package net_62v.external
Class MetaActivityManager
java.lang.Object
net_62v.external.MetaActivityManager
A class for components management, you can launch app by using this class.
- Version:
- 1.3
- Author:
- king@62v.net
- See Also:
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic voidYou can call this function in your main activity.
 Calling this method is not necessary.
 This method will boost the first application launch progress.static intbroadcastIntentAsUser(Intent intent, int username) static intbroadcastIntentAsUser(Intent intent, String username) Broadcast an intent to internal appstatic voidDelete all apps you've installed.static voidfinishApplicationActivity(String packageName, String className) Finish the specific app activities.
 You can call this method before you manually launch an activity by your custom intent.static voidforceScreenOrientationAsPackage(String packageName, int orientationMode) Set a package with specific properties, if package name is null then set the global orientation.static String[]getRunningAppInfoByPid(int pid) Return an array of the running app info,
 the return array's length is 3 and the index 0 is
 the package name, index 1 is the process name,
 index 2 is the split region.getRunningProcessInfo(String packageName) Get running app process infostatic voidinitialize(Context context) Initialize the environmentstatic booleanisAppRunning(String pkg) Detect if an app (with the default split region) is running or notstatic booleanisAppRunning(String pkg, int uid) Detect if an app is runningstatic booleanisAppRunning(String pkg, String splitRegion) Detect if an app is running or notstatic booleanDetect if an app is installed or notstatic voidKill all running applicationsstatic voidkillAppByPkg(int uid, String pkg) static voidkillAppByPkg(String pkg) Kill application process, with app relevant usersstatic voidkillAppByPkg(String splitRegion, String pkg) Kill application process by the specific package name and split regionstatic voidstatic voidlaunchActivityExistingAppProcess(String pkg, String username) Launch an app which is running directly, will success only if the app was launched (without hesitation).
 You must call the function isAppRunning before calling this methodstatic voidLaunch an app, mostly used function.static voidLaunch a specific package with the default user namestatic voidLaunch an app and initialize its environment.
 You can launch a specific app by this method.static voidlaunchExistingApp(String pkg, String username) Launch an existing app process, will be the same behaviour as launchActivityExistingAppProcess if the app is running
 If an app is already running, then move its splash screen to the display top.static voidlaunchIntent(Intent intent) Launch the specific intent with the default split region.static voidlaunchIntent(Intent intent, int uid) static voidlaunchIntent(Intent intent, String splitRegion) Launch a specific intent, you can launch an intent with specific extras or data here
 Can launch a disabled activity, and please add a NEW_TASK flag to launchstatic IntentobtainSplashLaunchIntent(int splitRegion, String pkg, Context context) Numeric user name methodstatic IntentobtainSplashLaunchIntent(String pkg, Context context) Obtain a splash screen intentstatic IntentobtainSplashLaunchIntent(String username, String pkg, Context context) Obtain a splash screen intentstatic voidsetUserName(String username) Set a default user name, and defaults 0static voidstartService(Intent intent, int userName) static voidstartService(Intent intent, String userName) Start a specific service, will automatic launch the affiliated process.
 You can launch an empty service for process waken purpose.
- 
Constructor Details- 
MetaActivityManagerpublic MetaActivityManager()
 
- 
- 
Method Details- 
obtainSplashLaunchIntentObtain a splash screen intent- Parameters:
- pkg- package name
- context- app context
- Throws:
- RemoteException
- See Also:
 
- 
launchAppLaunch a specific package with the default user name- Parameters:
- pkg- package name
- Throws:
- RemoteException
 
- 
launchActivityExistingAppProcess- Throws:
- RemoteException
- See Also:
 
- 
launchActivityExistingAppProcesspublic static void launchActivityExistingAppProcess(String pkg, String username) throws RemoteException Launch an app which is running directly, will success only if the app was launched (without hesitation).
 You must call the function isAppRunning before calling this method- Parameters:
- pkg- package name you want to launch
- username- user name, must be alphabetical
- Throws:
- RemoteException
 
- 
initializeInitialize the environment- Parameters:
- context- application base context
 
- 
isInnerPackageInstalledDetect if an app is installed or not- Parameters:
- pkg- package name
- Returns:
- if app was installed already then true, otherwise false.
- Throws:
- RemoteException
 
- 
isAppRunningDetect if an app (with the default split region) is running or not- Throws:
- RemoteException
- See Also:
 
- 
isAppRunningDetect if an app is running or not- Parameters:
- pkg- package name
- splitRegion- user name
- Returns:
- true if the app is running
- Throws:
- RemoteException
 
- 
launchExistingAppLaunch an existing app process, will be the same behaviour as launchActivityExistingAppProcess if the app is running
 If an app is already running, then move its splash screen to the display top.- Parameters:
- pkg- package name
- username- user name
- Throws:
- RemoteException
- See Also:
 
- 
isAppRunningDetect if an app is running- Parameters:
- pkg- package name
- uid- user name (alias of user name, use String.valueOf to convert)
- Returns:
- true if the app is running
- Throws:
- RemoteException
 
- 
killAllAppsKill all running applications- Throws:
- RemoteException
- See Also:
 
- 
launchAppLaunch an app, mostly used function.- Parameters:
- uid- userid, same as the String user name function.
- pkg- package name
- Throws:
- RemoteException
- See Also:
 
- 
launchAppLaunch an app and initialize its environment.
 You can launch a specific app by this method.- Parameters:
- splitRegion- user name, you can use the String.valueOf to convert
- pkg- package name- MetaActivityManager.launchApp("0", "com.whatsapp")
- Throws:
- RemoteException
 
- 
obtainSplashLaunchIntentpublic static Intent obtainSplashLaunchIntent(int splitRegion, String pkg, Context context) throws RemoteException Numeric user name method- Throws:
- RemoteException
- See Also:
 
- 
obtainSplashLaunchIntentpublic static Intent obtainSplashLaunchIntent(String username, String pkg, Context context) throws RemoteException Obtain a splash screen intent
 val splash = MetaActivityManager.obtainSplashLaunchIntent("0", "com.whatsapp", this)startActivity(splash)- Parameters:
- username- user name
- pkg- package name
- context- app context
- Returns:
- if null then application already launched, else you should call the startActivity function, and you must manual start the activity intent if return not null value
- Throws:
- RemoteException
- See Also:
 
- 
factoryResetpublic static void factoryReset()Delete all apps you've installed.- See Also:
 
- 
launchIntentLaunch the specific intent with the default split region.- Throws:
- RemoteException
- See Also:
 
- 
launchIntent- Throws:
- RemoteException
- See Also:
 
- 
launchIntentLaunch a specific intent, you can launch an intent with specific extras or data here
 Can launch a disabled activity, and please add a NEW_TASK flag to launch- Parameters:
- intent- intent you want to launch
- splitRegion- user name
- Throws:
- RemoteException
 
- 
startServiceStart a specific service, will automatic launch the affiliated process.
 You can launch an empty service for process waken purpose.- Parameters:
- intent- service intent you wanna start
- userName- split region
- Throws:
- RemoteException- may generate a remote exception when you call this method on a different process.
- Since:
- V1.1
 
- 
startService- Parameters:
- intent- service intent
- userName- user split region
- Throws:
- RemoteException
- See Also:
 
- 
killAppByPkgKill application process, with app relevant users- Parameters:
- pkg- package name
- Throws:
- RemoteException
 
- 
broadcastIntentAsUserBroadcast an intent to internal app- Parameters:
- intent- intent you want to broadcast
- username- user name
- Returns:
- 1 if success
- Throws:
- RemoteException
 
- 
broadcastIntentAsUser- Throws:
- RemoteException
- See Also:
 
- 
killAppByPkgKill application process by the specific package name and split region- Parameters:
- splitRegion- split region, also known as user name
- pkg- package name
- Throws:
- RemoteException
 
- 
killAppByPkg- Throws:
- RemoteException
- See Also:
 
- 
setUserNameSet a default user name, and defaults 0- Parameters:
- username- user name
 
- 
acquirePreloadNextProcessYou can call this function in your main activity.
 Calling this method is not necessary.
 This method will boost the first application launch progress.- Throws:
- RemoteException
- See Also:
 
- 
getRunningProcessInfopublic static List<ActivityManager.RunningAppProcessInfo> getRunningProcessInfo(String packageName) throws RemoteException Get running app process info- Parameters:
- packageName- package name can be specific to query
- Returns:
- List of the running application info
- Throws:
- RemoteException
- See Also:
 
- 
finishApplicationActivitypublic static void finishApplicationActivity(String packageName, String className) throws RemoteException Finish the specific app activities.
 You can call this method before you manually launch an activity by your custom intent.- Parameters:
- packageName- Package name
- className- Class name, can be null, if null then finish all relevant activities of the package name.
- Throws:
- RemoteException
 
- 
forceScreenOrientationAsPackagepublic static void forceScreenOrientationAsPackage(String packageName, int orientationMode) throws RemoteException Set a package with specific properties, if package name is null then set the global orientation.- Parameters:
- packageName- Specific a package name, can be null.
- orientationMode- 1 is landscape, 2 is portrait, 3 is fixed aspect, other value will set to default.
- Throws:
- RemoteException
 
- 
getRunningAppInfoByPidReturn an array of the running app info,
 the return array's length is 3 and the index 0 is
 the package name, index 1 is the process name,
 index 2 is the split region.
 If the package name is emptyString.isEmpty()then
 the passing pid is invalid or the specific process is not
 running inside the Mundo engine.- Parameters:
- pid- specific process id, see- Process.myPid()
- Returns:
- an array, normally it shouldn't be null.
- Throws:
- RemoteException
- Since:
- 1.3
 
 
-