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.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier 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 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 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 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 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
-
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
-
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:
-
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:
-
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
-