public final class LauncherHelper extends Object
Modifier and Type | Method and Description |
---|---|
static int |
countLaunchers()
Counts the number of launchers available.
|
static Application |
getApplication(Activity activity)
Gets the application that owns an activity.
|
static Application |
getApplication(BackgroundService bg)
Gets the application that owns the given background service.
|
static Activity |
getFirstActivity(Application application)
Gets the first activity of an application.
|
static boolean |
hasActivity(Application application)
Checks whether an application has some an activity.
|
static boolean |
hasService(Application application)
Checks whether an application has some background services.
|
static boolean |
isCurrentApplication(Application app)
Gets whether the application is the current application.
|
static boolean |
isCurrentLauncher(Application application)
Checks whether the main launcher is a given application.
|
static boolean |
isLauncher(Application application)
Checks whether an application is a launcher.
|
static boolean |
isResident(Application application)
Checks whether an application is resident.
|
static boolean |
isSystemApp(Application application)
Checks whether an application is a system app.
|
static void |
setNextLauncher()
Set the next launcher as default launcher.
|
static void |
show(Application application)
Shows an application.
|
static void |
show(Application application,
int timeout)
Shows an application.
|
static void |
start(Application application)
Starts an application if necessary.
|
static void |
start(Application application,
IProgressMonitor monitor)
Starts an application if necessary.
|
static void |
startAndShow(Application application)
Starts an application if necessary and shows its activity
|
static void |
startAndShow(Application application,
IProgressMonitor monitor)
Starts an application if necessary and shows its activity
|
public static int countLaunchers()
public static Application getApplication(Activity activity) throws IllegalArgumentException
activity
- the activity.IllegalArgumentException
- when the activity is null.public static Application getApplication(BackgroundService bg) throws IllegalArgumentException
bg
- the background service.IllegalArgumentException
- when the background service is null.public static Activity getFirstActivity(Application application) throws NullPointerException
application
- the application.null
otherwise.NullPointerException
- if application is null
.public static boolean hasActivity(Application application) throws NullPointerException
application
- the application.true
if the application has at least one activity.NullPointerException
- if application is null
.public static boolean hasService(Application application) throws NullPointerException
application
- the application.true
if the application has at least one background service.NullPointerException
- if application is null
.public static boolean isCurrentApplication(Application app)
app
- the Application to checktrue
if the application is the current application.public static boolean isCurrentLauncher(Application application) throws NullPointerException
application
- the application.true
if the given application is the current launcher.NullPointerException
- if application is null
.public static boolean isLauncher(Application application) throws NullPointerException
application
- the application.true
if the application is the launcher.NullPointerException
- if application is null
.public static boolean isResident(Application application) throws NullPointerException
application
- the application.true
if the application is resident.NullPointerException
- if application is null
.public static boolean isSystemApp(Application application) throws NullPointerException
application
- the application.true
if the application is a system app.NullPointerException
- if application is null
.public static void setNextLauncher()
public static void show(Application application) throws NullPointerException
application
- the application.NullPointerException
- if application is null
.public static void show(Application application, int timeout) throws NullPointerException
application
- the application.timeout
- the maximum amount of time to wait for an activity of this application to be registered before
cancelling this operationNullPointerException
- if application is null
.public static void start(Application application) throws ApplicationOperationException
application
- the application.IllegalStateException
- if the application state is not Application.State.INSTALLED
or Application.State.STARTED
state.SecurityException
- if a security manager exits and if the caller does not have the appropriate permissions.ApplicationOperationException
- If any unexpected errors occur while starting this application.NullPointerException
- if application is null
.public static void start(Application application, IProgressMonitor monitor) throws ApplicationOperationException
application
- the application.monitor
- the monitor to use to follow the start.IllegalStateException
- if the application state is not Application.State.INSTALLED
or Application.State.STARTED
state.SecurityException
- if a security manager exits and if the caller does not have the appropriate permissions.ApplicationOperationException
- If any unexpected errors occur while starting this application.NullPointerException
- if application is null
.public static void startAndShow(Application application) throws IllegalStateException, SecurityException, ApplicationOperationException, NullPointerException
application
- the application.IllegalStateException
- if the application state is not Application.State.INSTALLED
or Application.State.STARTED
state.SecurityException
- if a security manager exits and if the caller does not have the appropriate permissions.ApplicationOperationException
- If any unexpected errors occur while starting this application.NullPointerException
- if application is null
.public static void startAndShow(Application application, IProgressMonitor monitor) throws IllegalStateException, SecurityException, ApplicationOperationException, NullPointerException
application
- the application.monitor
- the monitor to use to follow the start.IllegalStateException
- if the application state is not Application.State.INSTALLED
or Application.State.STARTED
state.SecurityException
- if a security manager exits and if the caller does not have the appropriate permissions.ApplicationOperationException
- If any unexpected errors occur while starting this application.NullPointerException
- if application is null
.