public class Package extends AccountManager
silentPackageInstall.silentPackageUninstall.enablePackage.disablePackage.stopPackage.setWhitelistAppPermission. So it will allow runtime permission for the whitelisted package at installation.clearWhitelistAppPermission.clearAllWhitelistAppPermissionenableWhitelistPackages (new rule will be created or added to existing rule) and disableWhitelistPackages (all packages will be enabled)getPackageStatussetAppAutostartPinned, remove this setting using removeAppAutoStartPinned and get status of the pinned app using getAppAutoStartPinnedStatusunregisterPackageInstallAPIListener,
unregisterPackageStatusChangeListener, unregisterPackageUninstallAPIListener,
unregisterWhitelistAPIListener, unregisterWhitelistAppPermissionListener
Application Install Example:
1. Precondition: push the application package (apk file) to the sdcard partition on the device "adb push /sdcard/example.apk"
2. Get an auth token using getEloAccessToken
3. Install the application using silentPackageInstall. This process may take up to a minute. When complete, an install listener will register and will receive an update regarding the installation.
4. The installation listener will be automatically unregistered upon success
| Modifier and Type | Field and Description |
|---|---|
static int |
APP_AUTO_START_PINNING_CODE
Response code for setting app pinning and app auto start on boot
|
static int |
INSTALL_LISTENER_REGISTERED
Install listener has been registered and will be called when an app installation is complete
|
static int |
INSTALL_LISTENER_UNREGISTERED
Install listener was unregistered, no callback will be issued when an install completes
|
static int |
INSTALLER_RESULT_CODE
Used to send a response when a package installation is attempted.
|
static Package |
instance |
static int |
LISTENER_REGISTRATION_ERROR
There was an error while trying to register the listener
|
static int |
PACKAGE_STATUS_CHANGE_CODE
Used to notify whether the package status changed successfully or not
|
static int |
PACKAGE_STATUS_CHANGE_LISTENER_CODE
Used to notify whether the listener has been registered or not
|
static int |
PACKAGE_STATUS_RESULT_CODE
Used to send the status of a given package (enabled or disabled)
|
static int |
SET_PACKAGE_NAME_PERMISSION_RESULT_CODE
Used to notify whether the package app permission status changed successfully or not
|
static int |
SET_WHITELIST_APP_PERMISSION_RESULT_CODE
Used to notify whether the package app permission status changed successfully or not
|
static int |
SET_WHITELIST_RULE_RESULT_CODE
Used to notify whether package whitelist rule status change was successful or not
|
static int |
STOP_PROCESS_CODE
Used to send a response when the package has been stopped
|
static int |
UNINSTALL_LISTENER_REGISTERED
Uninstall listener has been registered and will be called when a package is uninstalled
|
static int |
UNINSTALL_LISTENER_UNREGISTERED
Uninstall listener was unregistered, no callback will be issued when a package is uninstalled
|
ACCESS_TOKEN_INVALID, ACCESS_TOKEN_VALID, API_ACCESS_TOKEN_INVALID, API_ACCESS_TOKEN_VALID, IS_USER_LOGIN_OAUTH, isPolaris, KEY_SERVER_ELO_POLARIS_DEV, KEY_SERVER_PRODUCTION_POLARIS, KEY_SERVER_QA_POLARIS, KEY_SERVER_STAGING_POLARIS, OAUTH_TOKEN_INVALID, OAUTH_TOKEN_VALID, REQUEST_AUTH_LOGIN, REQUEST_AUTH_LOGOUT, SETUP_OAUTH_ERROR, SETUP_OAUTH_SUCCESS, TOKEN_VERIFY_FAIL, TOKEN_VERIFY_SUCCESSACTION_SET_EST_REQUEST, ELO_FOLDER, ELO_NETWORK_CONF_CSV_FILE, ELO_WIFI_CONFIG_FOLDER, GENERIC_ERROR, isFROM, OAUTH_PATH_TOKEN, OAUTH_PATH_VERIFY, REQUEST_TOKEN, STR_CUSTOM_ANIM_IMAGE_FILE, STR_CUSTOM_ANIM_VIDEO_FILE, STR_CUSTOM_BRAND_LOGO_FILE, STR_CUSTOM_BRAND_NAME_FILE, STR_CUSTOM_BRAND_POWERED_BY_LOGO_FILE, STR_CUSTOM_LOCALE_NAME_FILE, STR_CUSTOM_WALLPAPER, STR_ELO_PATH_FOR_CUSTOM_ANIMATION, STR_SDCARD_ELO_DIR_PATH, VERIFY_TOKEN| Constructor and Description |
|---|
Package() |
| Modifier and Type | Method and Description |
|---|---|
void |
clearAllWhitelistAppPermission(android.content.Context context,
java.lang.String accessToken,
boolean clearAllPackage,
android.os.Handler handler)
This method used to clear all whitelisted packages so system don't allow runtime permissions on installation time.
|
void |
clearWhitelistAppPermission(android.content.Context context,
java.lang.String accessToken,
java.lang.String packageName,
android.os.Handler handler)
This method used to clear whitelisted packages so system don't allow runtime permissions on installation time.
|
void |
disablePackage(android.content.Context context,
java.lang.String accessToken,
java.lang.String packageName,
android.os.Handler handler)
This method is used to disable a given package.
|
void |
disableWhitelistPackages(android.content.Context context,
java.lang.String accessToken,
android.os.Handler handler)
This method is used to disable whitelisting rules for packages.
|
void |
enableDisableSettingsPackage(java.lang.String accessToken,
android.content.Context context,
java.lang.String packageState,
android.os.Handler handler)
This method is used to enable/disable a settings package(com.android.settings).
|
void |
enablePackage(android.content.Context context,
java.lang.String accessToken,
java.lang.String packageName,
android.os.Handler handler)
This method is used to enable the given package if it is currently installed
and is disabled.
|
void |
enableWhitelistPackages(android.content.Context context,
java.lang.String accessToken,
java.lang.String json,
android.os.Handler handler)
This method is used to set rules for enabling/disabling packages.
|
void |
getAppAutoStartPinnedStatus(android.content.Context context,
java.lang.String accessToken,
android.os.Handler handler)
API used to get information if the feature to auto start a task and lock it is currently enabled or not.
|
void |
getPackageStatus(android.content.Context context,
java.lang.String accessToken,
java.lang.String packageName,
android.os.Handler handler)
This method is used to check if a given package is enabled or disabled.
|
void |
removeAppAutostartPinned(android.content.Context context,
java.lang.String accessToken,
java.lang.String password,
boolean tempUnlock,
android.os.Handler handler)
API used to remove starting a task on boot and locking it.
|
void |
setAppAutostartPinned(android.content.Context context,
java.lang.String accessToken,
java.lang.String newPassword,
java.lang.String oldPassword,
java.lang.String packageName,
android.os.Handler handler)
API used to start a task on boot and lock it.
|
void |
SetPackageNameandPermission(android.content.Context context,
java.lang.String accessToken,
java.lang.String packageName,
java.lang.String packagePermission,
android.os.Handler handler)
This method is used to set Package name and Permission
|
void |
setWhitelistAppPermission(android.content.Context context,
java.lang.String accessToken,
java.lang.String packageName,
android.os.Handler handler)
This method used to whitelist the given package.
On package installation system will automatically allow runtime permissions for the whitelisted packages. So application doesn't popup runtime permission dialog. |
void |
silentPackageInstall(android.content.Context context,
java.lang.String accessToken,
java.lang.String uri,
android.os.Handler handler)
This method is used to install an APK silently in background
|
void |
silentPackageUninstall(android.content.Context context,
java.lang.String accessToken,
java.lang.String packageName,
android.os.Handler handler)
This method is used to uninstall package silently in background
|
void |
stopPackage(android.content.Context context,
java.lang.String accessToken,
java.lang.String packageName,
android.os.Handler handler)
This method is used to stop a running package.
|
void |
unregisterPackageInstallAPIListener(android.content.Context context)
This method is used to unregister the broadcast receiver registered when the
silentPackageInstall(Context, String, String, Handler) (Context, String, Handler)} API.is used in your application. |
void |
unregisterPackageStatusChangeListener(android.content.Context context)
This method is used to unregister the broadcast receiver registered when using the
enablePackage(Context, String, String, Handler) and.disablePackage(Context, String, String, Handler) APIs in your application. |
void |
unregisterPackageUninstallAPIListener(android.content.Context context)
This method is used to unregister the broadcast receiver registered when the
silentPackageUninstall(Context, String, String, Handler) API.is used in your application. |
void |
unregisterWhitelistAPIListener(android.content.Context context)
This method is used to unregister the broadcast receiver registered when the
enableWhitelistPackages(Context, String, String, Handler) or disableWhitelistPackages(Context, String, Handler) APIs are used in your application
is used in your App
Please make sure to call this in the "onPause" and "onDestroy" methods in your activity Lifecycle if you made use of
the two APIs. |
void |
unregisterWhitelistAppPermissionListener(android.content.Context context)
This method is used to unregister the broadcast receiver registered when using the
setWhitelistAppPermission(Context, String, String, Handler) API.Please make sure to call this in the "onPause" and "onDestroy" methods in your activity Lifecycle if you made use of setWhitelistAppPermission(Context, String, String, Handler) API. |
configureOAuthHostedUI, destroyOAuth, getBaseUri, getClientId, getEloAccessToken, getEloOAuthToken, getEnvironment, getProperty, isPolaris, isPolarisLocked, logoutOAuth, onOAuthActivityResult, selectEnvironment, setDefaultEnvironment, setProperty, stopOAuth, unregisterAccountManagerListener, verifyEloTokenclone, getEloIntentWithFlag, getMigrate, isDevice7Inch, isDeviceM100public static final int INSTALL_LISTENER_REGISTERED
public static final int UNINSTALL_LISTENER_REGISTERED
public static final int INSTALL_LISTENER_UNREGISTERED
public static final int UNINSTALL_LISTENER_UNREGISTERED
public static final int LISTENER_REGISTRATION_ERROR
public static final int INSTALLER_RESULT_CODE
public static final int STOP_PROCESS_CODE
public static final int PACKAGE_STATUS_CHANGE_LISTENER_CODE
public static final int PACKAGE_STATUS_CHANGE_CODE
public static final int PACKAGE_STATUS_RESULT_CODE
public static final int SET_WHITELIST_APP_PERMISSION_RESULT_CODE
public static final int SET_WHITELIST_RULE_RESULT_CODE
public static final int APP_AUTO_START_PINNING_CODE
public static final int SET_PACKAGE_NAME_PERMISSION_RESULT_CODE
public static Package instance
public void enableWhitelistPackages(android.content.Context context,
java.lang.String accessToken,
java.lang.String json,
android.os.Handler handler)
context - A context object of the calling Class (Activity/Service).accessToken - An offline JWT Token.json - A json object containing the whitelist rules (eg: package name, type (package launching), action (allow, block). Refer test app for example)handler - A handler to receive one or more of the following callback messages:
AccountManager.TOKEN_VERIFY_FAIL
Consts.GENERIC_ERROR
SET_WHITELIST_APP_PERMISSION_RESULT_CODE
public void disableWhitelistPackages(android.content.Context context,
java.lang.String accessToken,
android.os.Handler handler)
context - A context object of the calling Class (Activity/Service).accessToken - An offline JWT Token.handler - A handler to receive one or more of the following callback messages:
AccountManager.TOKEN_VERIFY_FAIL
Consts.GENERIC_ERROR
SET_WHITELIST_APP_PERMISSION_RESULT_CODE
public void silentPackageInstall(android.content.Context context,
java.lang.String accessToken,
java.lang.String uri,
android.os.Handler handler)
context - A context object of the calling Class (Activity/Service).accessToken - An offline JWT Token.uri - A uri pointing to the apk file which needs to be installed
silentlyhandler - A handler to receive one or more of the following callback messages:
AccountManager.TOKEN_VERIFY_FAIL
Consts.GENERIC_ERROR
INSTALL_LISTENER_REGISTERED
INSTALLER_RESULT_CODE
public void SetPackageNameandPermission(android.content.Context context,
java.lang.String accessToken,
java.lang.String packageName,
java.lang.String packagePermission,
android.os.Handler handler)
context - A context object of the calling Class (Activity/Service).accessToken - An offline JWT Token.packageName - Provide PackageNamepackagePermission - Provide packagePermissionhandler - A handler to receive one or more of the following callback messages:
AccountManager.TOKEN_VERIFY_FAIL
Consts.GENERIC_ERROR
INSTALL_LISTENER_REGISTERED
INSTALLER_RESULT_CODE
public void silentPackageUninstall(android.content.Context context,
java.lang.String accessToken,
java.lang.String packageName,
android.os.Handler handler)
context - A context object of the calling Class (Activity/Service).accessToken - An offline JWT Token.packageName - The name of the package that needs to be uninstalledhandler - A handler to receive one or more of the following callback messages:
AccountManager.TOKEN_VERIFY_FAIL
Consts.GENERIC_ERROR
UNINSTALL_LISTENER_REGISTERED
INSTALLER_RESULT_CODE
public void stopPackage(android.content.Context context,
java.lang.String accessToken,
java.lang.String packageName,
android.os.Handler handler)
context - A context object of the calling Class (Activity/Service).accessToken - An offline JWT Token.packageName - The name of the package that needs to be stopped/killedhandler - A handler to receive one or more of the following callback messages:
AccountManager.TOKEN_VERIFY_FAIL
Consts.GENERIC_ERROR
STOP_PROCESS_CODE
public void disablePackage(android.content.Context context,
java.lang.String accessToken,
java.lang.String packageName,
android.os.Handler handler)
context - A context object of the calling Class (Activity/Service).accessToken - An offline JWT Token.packageName - package name that is to be disablehandler - A handler to receive one or more of the following callback messages:
AccountManager.TOKEN_VERIFY_FAIL
Consts.GENERIC_ERROR
LISTENER_REGISTRATION_ERROR
PACKAGE_STATUS_CHANGE_CODE
Note: Only the following system packages will be allowed to be disabled as disabling
some of the system apps may interfere with the core OS functionality.
com.android.providers.calendar
com.android.wallpapercropper
com.android.messaging
com.oem.camera
com.android.providers.userdictionary
org.codeaurora.gallery
com.android.dreams.phototable
com.android.dialer
com.elotouch.paypointdiagnostics
org.codeaurora.bluetooth
com.android.musicfx
com.android.music
com.android.providers.telephony
com.android.phone
com.android.mms.service
com.android.providers.media
com.android.wallpaper.livepicker
com.android.keychain
com.android.documentsui
com.android.htmlviewer
com.android.location.fused
com.android.emergency
com.example.eloViewSDKTestApp
com.elo.peripheral
com.elotouch.miami.testapp
com.elo.homescreen
com.android.providers.downloads.ui
com.android.providers.downloads
com.veniosg.dir
com.android.bips
com.android.systemui.theme.dark
com.android.providers.contacts
com.oem.location
com.android.wallpaperbackup
com.android.smspush
com.android.carrierconfig
com.android.deskclock
com.android.cellbroadcastreceiver
com.android.carrierdefaultapp
com.android.server.telecom
com.android.calllogbackup
com.android.calendar
com.android.calculator2
com.android.bookmarkprovider
com.android.bluetooth
com.android.bluetoothmidiservice
com.android.providers.blockednumber
com.dsi.ant.server
com.android.webview
com.android.egg
com.sis.autotool
com.google.android.calendar
public void enableDisableSettingsPackage(java.lang.String accessToken,
android.content.Context context,
java.lang.String packageState,
android.os.Handler handler)
accessToken - An offline JWT Token.context - A context object of the calling Class (Activity/Service).packageState - package state that is to be true/false.handler - A handler to receive one or more of the following callback messages:
AccountManager.TOKEN_VERIFY_FAIL
Consts.GENERIC_ERROR
LISTENER_REGISTRATION_ERROR
PACKAGE_STATUS_CHANGE_CODE
public void enablePackage(android.content.Context context,
java.lang.String accessToken,
java.lang.String packageName,
android.os.Handler handler)
context - A context object of the calling Class (Activity/Service).accessToken - An offline JWT Token.packageName - package name that is to be enablehandler - A handler to receive one or more of the following callback messages:
AccountManager.TOKEN_VERIFY_FAIL
Consts.GENERIC_ERROR
LISTENER_REGISTRATION_ERROR
PACKAGE_STATUS_CHANGE_CODE
public void getPackageStatus(android.content.Context context,
java.lang.String accessToken,
java.lang.String packageName,
android.os.Handler handler)
context - A context object of the calling Class (Activity/Service).accessToken - An offline JWT Token.packageName - PackageName of the package user needs to know is enabled or disabledhandler - A handler to receive one or more of the following callback messages:
AccountManager.TOKEN_VERIFY_FAIL
PACKAGE_STATUS_RESULT_CODE
public void setAppAutostartPinned(android.content.Context context,
java.lang.String accessToken,
java.lang.String newPassword,
java.lang.String oldPassword,
java.lang.String packageName,
android.os.Handler handler)
context - ContextnewPassword - new PIN to be set for unpinning an appoldPassword - old PIN which was set for unpinning an app. This is required while changing the pin. This can be empty if it's the first time setting
the pin.accessToken - Offline or online tokenpackageName - List of apps to use for auto start and pinning on boot in a decreasing order of priorityhandler - A handler to receive one of the following callback messages:
APP_AUTO_START_PINNING_CODE
AccountManager.TOKEN_VERIFY_FAIL
Consts.GENERIC_ERROR
public void removeAppAutostartPinned(android.content.Context context,
java.lang.String accessToken,
java.lang.String password,
boolean tempUnlock,
android.os.Handler handler)
context - Contextpassword - device pin required to unlock the taskaccessToken - Offline or online tokentempUnlock - A boolean value indicating whether the task should be unlocked temporarily (true) or permanently (false).handler - A handler to receive one of the following callback messages:
APP_AUTO_START_PINNING_CODE
AccountManager.TOKEN_VERIFY_FAIL
Consts.GENERIC_ERROR
public void getAppAutoStartPinnedStatus(android.content.Context context,
java.lang.String accessToken,
android.os.Handler handler)
context - ContextaccessToken - Offline or online tokenhandler - A handler to receive one of the following callback messages:
APP_AUTO_START_PINNING_CODE
AccountManager.TOKEN_VERIFY_FAIL
Consts.GENERIC_ERROR
public void setWhitelistAppPermission(android.content.Context context,
java.lang.String accessToken,
java.lang.String packageName,
android.os.Handler handler)
After applying change on install time whitelisted package will grant all permissions automatically.
context - ContextaccessToken - String Offline TokenpackageName - WhiteListPackageNamehandler - A handler to receive one of the following callback messages:
AccountManager.TOKEN_VERIFY_FAIL
RESPONSE_SET_WHITELIST_PKG_APP_PERMISSION
Consts.GENERIC_ERROR
public void clearWhitelistAppPermission(android.content.Context context,
java.lang.String accessToken,
java.lang.String packageName,
android.os.Handler handler)
context - ContextaccessToken - String Offline TokenpackageName - Stringhandler - A handler to receive one of the following callback messages:
AccountManager.TOKEN_VERIFY_FAIL
RESPONSE_SET_WHITELIST_PKG_APP_PERMISSION
Consts.GENERIC_ERROR
public void clearAllWhitelistAppPermission(android.content.Context context,
java.lang.String accessToken,
boolean clearAllPackage,
android.os.Handler handler)
context - ContextaccessToken - String Offline TokenclearAllPackage - Booleanhandler - A handler to receive one of the following callback messages:
AccountManager.TOKEN_VERIFY_FAIL
RESPONSE_SET_WHITELIST_PKG_APP_PERMISSION
Consts.GENERIC_ERROR
public void unregisterWhitelistAppPermissionListener(android.content.Context context)
setWhitelistAppPermission(Context, String, String, Handler) API.setWhitelistAppPermission(Context, String, String, Handler) API. This ensures the receiver is not leaked.context - Context in which the Network APIs were usedpublic void unregisterWhitelistAPIListener(android.content.Context context)
enableWhitelistPackages(Context, String, String, Handler) disableWhitelistPackages(Context, String, Handler) APIs are used in your application
is used in your App
Please make sure to call this in the "onPause" and "onDestroy" methods in your activity Lifecycle if you made use of
the two APIs. This ensures the receiver is not leaked.context - Context in which the Network APIs were usedpublic void unregisterPackageInstallAPIListener(android.content.Context context)
silentPackageInstall(Context, String, String, Handler) (Context, String, Handler)} API.silentPackageInstall(Context, String, String, Handler) API. This ensures the receiver is not leaked.context - Context in which the Network APIs were usedpublic void unregisterPackageUninstallAPIListener(android.content.Context context)
silentPackageUninstall(Context, String, String, Handler) API.silentPackageUninstall(Context, String, String, Handler) API. This ensures the receiver is not leaked.context - Context in which the Network APIs were usedpublic void unregisterPackageStatusChangeListener(android.content.Context context)
enablePackage(Context, String, String, Handler) and.disablePackage(Context, String, String, Handler) APIs in your application.
Please make sure to call this in the "onPause" and "onDestroy" methods in your activity Lifecycle if you made use of
any of these two APIs. This ensures the receiver is not leaked.context - Context in which the Network APIs were used