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:
- [email protected]
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
You can call this function in your main activity.
Calling this method is not necessary.
This method will boost the first application launch progress.static int
broadcastIntentAsUser
(Intent intent, int username) static int
broadcastIntentAsUser
(Intent intent, String username) Broadcast an intent to internal appstatic void
Delete all apps you've installed.static void
finishApplicationActivity
(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 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 void
initialize
(Context context) Initialize the environmentstatic boolean
isAppRunning
(String pkg) Detect if an app (with the default split region) is running or notstatic boolean
isAppRunning
(String pkg, int uid) Detect if an app is runningstatic boolean
isAppRunning
(String pkg, String splitRegion) Detect if an app is running or notstatic boolean
Detect if an app is installed or notstatic void
Kill all running applicationsstatic void
killAppByPkg
(int uid, String pkg) static void
killAppByPkg
(String pkg) Kill application process, with app relevant usersstatic void
killAppByPkg
(String splitRegion, String pkg) Kill application process by the specific package name and split regionstatic void
static void
launchActivityExistingAppProcess
(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 void
Launch an app, mostly used function.static void
Launch a specific package with the default user namestatic void
Launch an app and initialize its environment.
You can launch a specific app by this method.static void
launchExistingApp
(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 void
launchIntent
(Intent intent) Launch the specific intent with the default split region.static void
launchIntent
(Intent intent, int uid) static void
launchIntent
(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 Intent
obtainSplashLaunchIntent
(int splitRegion, String pkg, Context context) Numeric user name methodstatic Intent
obtainSplashLaunchIntent
(String pkg, Context context) Obtain a splash screen intentstatic Intent
obtainSplashLaunchIntent
(String username, String pkg, Context context) Obtain a splash screen intentstatic void
setUserName
(String username) Set a default user name, and defaults 0static void
startService
(Intent intent, int userName) static void
startService
(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
-
MetaActivityManager
public MetaActivityManager()
-
-
Method Details
-
obtainSplashLaunchIntent
Obtain a splash screen intent- Parameters:
pkg
- package namecontext
- app context- Throws:
RemoteException
- See Also:
-
launchApp
Launch a specific package with the default user name- Parameters:
pkg
- package name- Throws:
RemoteException
-
launchActivityExistingAppProcess
- Throws:
RemoteException
- See Also:
-
launchActivityExistingAppProcess
public 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 launchusername
- user name, must be alphabetical- Throws:
RemoteException
-
initialize
Initialize the environment- Parameters:
context
- application base context
-
isInnerPackageInstalled
Detect if an app is installed or not- Parameters:
pkg
- package name- Returns:
- if app was installed already then true, otherwise false.
- Throws:
RemoteException
-
isAppRunning
Detect if an app (with the default split region) is running or not- Throws:
RemoteException
- See Also:
-
isAppRunning
Detect if an app is running or not- Parameters:
pkg
- package namesplitRegion
- user name- Returns:
- true if the app is running
- Throws:
RemoteException
-
launchExistingApp
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.- Parameters:
pkg
- package nameusername
- user name- Throws:
RemoteException
- See Also:
-
isAppRunning
Detect if an app is running- Parameters:
pkg
- package nameuid
- user name (alias of user name, use String.valueOf to convert)- Returns:
- true if the app is running
- Throws:
RemoteException
-
killAllApps
Kill all running applications- Throws:
RemoteException
- See Also:
-
launchApp
Launch an app, mostly used function.- Parameters:
uid
- userid, same as the String user name function.pkg
- package name- Throws:
RemoteException
- See Also:
-
launchApp
Launch 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 convertpkg
- package nameMetaActivityManager.launchApp("0", "com.whatsapp")
- Throws:
RemoteException
-
obtainSplashLaunchIntent
public static Intent obtainSplashLaunchIntent(int splitRegion, String pkg, Context context) throws RemoteException Numeric user name method- Throws:
RemoteException
- See Also:
-
obtainSplashLaunchIntent
public 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 namepkg
- package namecontext
- 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:
-
factoryReset
public static void factoryReset()Delete all apps you've installed.- See Also:
-
launchIntent
Launch the specific intent with the default split region.- Throws:
RemoteException
- See Also:
-
launchIntent
- Throws:
RemoteException
- See Also:
-
launchIntent
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 launch- Parameters:
intent
- intent you want to launchsplitRegion
- user name- Throws:
RemoteException
-
startService
Start 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 startuserName
- 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 intentuserName
- user split region- Throws:
RemoteException
- See Also:
-
killAppByPkg
Kill application process, with app relevant users- Parameters:
pkg
- package name- Throws:
RemoteException
-
broadcastIntentAsUser
Broadcast an intent to internal app- Parameters:
intent
- intent you want to broadcastusername
- user name- Returns:
- 1 if success
- Throws:
RemoteException
-
broadcastIntentAsUser
- Throws:
RemoteException
- See Also:
-
killAppByPkg
Kill application process by the specific package name and split region- Parameters:
splitRegion
- split region, also known as user namepkg
- package name- Throws:
RemoteException
-
killAppByPkg
- Throws:
RemoteException
- See Also:
-
setUserName
Set a default user name, and defaults 0- Parameters:
username
- user name
-
acquirePreloadNextProcess
You 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:
-
getRunningProcessInfo
public 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:
-
finishApplicationActivity
public 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 nameclassName
- Class name, can be null, if null then finish all relevant activities of the package name.- Throws:
RemoteException
-
getRunningAppInfoByPid
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.
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, seeProcess.myPid()
- Returns:
- an array, normally it shouldn't be null.
- Throws:
RemoteException
- Since:
- 1.3
-