com.eloview.sdk
Class EloSecureUtil

java.lang.Object
  extended by com.eloview.sdk.EloSecureUtil

public class EloSecureUtil
extends java.lang.Object

EloSecure Utility is mainly used to call EloView SDK dependent functions like silentPackage installation , silentReboot etc.


Field Summary
static int ELO_GET_DEVICE_INFO
           
static int OTA_APPLY_FILE_ERROR
           
static int OTA_APPLY_IN_PROGRESS
           
static int OTA_CHECK_STATUS_GENERIC_ERROR
           
static int OTA_CHECK_STATUS_NEW
           
static int OTA_CHECK_STATUS_OLD
           
static int OTA_CHECK_STATUS_SAME
           
static int OTA_DOWNLOAD_GENERIC_ERROR
           
static int OTA_DOWNLOAD_LOCAL_FILE_ERROR
           
static int OTA_DOWNLOAD_LOCAL_FILE_PERCENTAGE
           
static int OTA_DOWNLOAD_LOCAL_FILE_SUCCESS
           
static int OTA_DOWNLOAD_REMOTE_FILE_ERROR
           
static int OTA_DOWNLOAD_REMOTE_FILE_PERCENTAGE
           
static int OTA_DOWNLOAD_REMOTE_FILE_SUCCESS
           
static int OTA_VERIFY_FILE_ERROR
           
static int OTA_VERIFY_SIGN_ERROR
           
static int OTA_VERIFY_SIGN_PERCENTAGE
           
static int OTA_VERIFY_SIGN_SUCCESS
           
 
Constructor Summary
EloSecureUtil()
           
 
Method Summary
static void applyOTA(Context ctx, Handler handler)
          This method is used to trigger underlying Android OS OTA mechanism.
static void captureScreenShot(Context ctx, BroadcastReceiver screenshotReceiver)
          This method is used to capture the screenshot from the device.
static void checkOTAStatus(Context ctx, java.lang.String buildPropUrl, Handler handler)
          This method is used to check whether pointed remote/local OTA is newer or older than current version.
static java.lang.Long downloadFile(Uri uri, java.util.Map<java.lang.String,java.lang.String> headers, java.lang.String destination, java.lang.String fileName, java.lang.String contentId, Context ctx)
           
static void getAddress(Context ctx, BroadcastReceiver addressReceiver)
          This method is used to get device Address
static void getAECMOrientation(Context ctx, BroadcastReceiver orientationReceiver)
          This method is used to get orientation of AECM device from EloSecure application.
static int getBrightness(Context ctx)
          This method is used to get device Brightness the device
static java.lang.String getDeviceInfo(Context ctx)
          This method is used to get device information from cloud ( Sync Call )
static boolean getDeviceInfo(Context ctx, Handler handler)
          This method is used to get device information from cloud ( Async Call )
static int[] getDownloadStatus(java.lang.Long downloadId, Context ctx)
           
static long getInprogressDownloadID(Context context, java.lang.String contentName)
           
static void getLocale(Context ctx, BroadcastReceiver localeReceiver)
          This method is used to get device system locale
static java.lang.String getSDKVersion()
          This method is used to get current EloView SDK Version
static void getSerialNumber(Context ctx, BroadcastReceiver serialNumberReceiver)
          This method is used to get device Serial Number
static int getVolume(Context ctx)
          This method is used to get device Volume the device
static boolean isEloViewSDKExists(Context ctx)
          Check for EloView SDK is available or not
static boolean registerDeviceInfoReceiver(Context ctx, BroadcastReceiver deviceInfoReceiver)
          This method is used to notify any change in device info
static boolean removecontentFromDownloadList(Context context, long downloadId)
           
static void removeContentFromDownloadQueue(Context context, java.lang.String contentName)
           
static void screenTurnOff(Context ctx, int mode)
          This method is used to turn off the screen
static void screenTurnOn(Context ctx, int mode)
          This method is used to turn on the screen
static void setBrightness(Context ctx, int val)
          This method is used to set device Brightness the device
static void setDisplayOff(Context ctx, int val)
          This method is used to Set Device Display OFF
static void setDisplayOn(Context ctx, int val)
          This method is used to Set Device Display ON
static void setLocale(Context ctx, java.lang.String localeStr)
          This method is used to set device system locale
static void setVolume(Context ctx, int val)
          This method is used to set device volume the device
static void silentPackageInstall(Context ctx, java.lang.String uri)
          This method is used to install new APK silently in background
static void silentPackageUninstall(Context ctx, java.lang.String packageName)
          This method is used to uninstall new APK silently in background
static void silentReboot(Context ctx)
          This method is used to reboot the device
static void startDownloadUpgradePackage(Context context, java.lang.String url, Handler handler)
          This method is used to download OTA file from remote http server or from local file path.
static boolean unregisterDeviceInfoReceiver(Context ctx, BroadcastReceiver deviceInfoReceiver)
          This method is used to unregister the device info change listener
static void unsecurePackageInstall(Context ctx, java.lang.String uri)
          This method is used to install apk using Standard Android package manager
static void verifyOTA(Context ctx, Handler handler)
          This method is used to verify the system signature of downloaded OTA file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OTA_DOWNLOAD_REMOTE_FILE_SUCCESS

public static final int OTA_DOWNLOAD_REMOTE_FILE_SUCCESS
See Also:
Constant Field Values

OTA_DOWNLOAD_REMOTE_FILE_ERROR

public static final int OTA_DOWNLOAD_REMOTE_FILE_ERROR
See Also:
Constant Field Values

OTA_DOWNLOAD_REMOTE_FILE_PERCENTAGE

public static final int OTA_DOWNLOAD_REMOTE_FILE_PERCENTAGE
See Also:
Constant Field Values

OTA_DOWNLOAD_LOCAL_FILE_SUCCESS

public static final int OTA_DOWNLOAD_LOCAL_FILE_SUCCESS
See Also:
Constant Field Values

OTA_DOWNLOAD_LOCAL_FILE_ERROR

public static final int OTA_DOWNLOAD_LOCAL_FILE_ERROR
See Also:
Constant Field Values

OTA_DOWNLOAD_LOCAL_FILE_PERCENTAGE

public static final int OTA_DOWNLOAD_LOCAL_FILE_PERCENTAGE
See Also:
Constant Field Values

OTA_DOWNLOAD_GENERIC_ERROR

public static final int OTA_DOWNLOAD_GENERIC_ERROR
See Also:
Constant Field Values

OTA_VERIFY_SIGN_SUCCESS

public static final int OTA_VERIFY_SIGN_SUCCESS
See Also:
Constant Field Values

OTA_VERIFY_SIGN_ERROR

public static final int OTA_VERIFY_SIGN_ERROR
See Also:
Constant Field Values

OTA_VERIFY_SIGN_PERCENTAGE

public static final int OTA_VERIFY_SIGN_PERCENTAGE
See Also:
Constant Field Values

OTA_VERIFY_FILE_ERROR

public static final int OTA_VERIFY_FILE_ERROR
See Also:
Constant Field Values

OTA_CHECK_STATUS_OLD

public static final int OTA_CHECK_STATUS_OLD
See Also:
Constant Field Values

OTA_CHECK_STATUS_NEW

public static final int OTA_CHECK_STATUS_NEW
See Also:
Constant Field Values

OTA_CHECK_STATUS_SAME

public static final int OTA_CHECK_STATUS_SAME
See Also:
Constant Field Values

OTA_CHECK_STATUS_GENERIC_ERROR

public static final int OTA_CHECK_STATUS_GENERIC_ERROR
See Also:
Constant Field Values

OTA_APPLY_FILE_ERROR

public static final int OTA_APPLY_FILE_ERROR
See Also:
Constant Field Values

OTA_APPLY_IN_PROGRESS

public static final int OTA_APPLY_IN_PROGRESS
See Also:
Constant Field Values

ELO_GET_DEVICE_INFO

public static final int ELO_GET_DEVICE_INFO
See Also:
Constant Field Values
Constructor Detail

EloSecureUtil

public EloSecureUtil()
Method Detail

isEloViewSDKExists

public static boolean isEloViewSDKExists(Context ctx)
Check for EloView SDK is available or not

Parameters:
ctx - A context object of the calling Class (Activity/Service).
Returns:
true if SDK available else false

getSDKVersion

public static java.lang.String getSDKVersion()
This method is used to get current EloView SDK Version


silentPackageInstall

public static void silentPackageInstall(Context ctx,
                                        java.lang.String uri)
This method is used to install new APK silently in background

Parameters:
ctx - A context object of the calling Class (Activity/Service).
uri - A uri pointing to the apk file which needs to be installed silently

silentPackageUninstall

public static void silentPackageUninstall(Context ctx,
                                          java.lang.String packageName)
This method is used to uninstall new APK silently in background

Parameters:
ctx - A context object of the calling Class (Activity/Service).
packageName - The name of the package that needs to be uninstalled

silentReboot

public static void silentReboot(Context ctx)
This method is used to reboot the device

Parameters:
ctx - A context object of the calling Class (Activity/Service).

captureScreenShot

public static void captureScreenShot(Context ctx,
                                     BroadcastReceiver screenshotReceiver)
This method is used to capture the screenshot from the device. Screen shot will be stored in "/sdcard/elo/screenshot/ic-screenshot.png"

Parameters:
ctx - A context object of the calling Class (Activity/Service).
screenshotReceiver - BroadcastReciever object to receive the screenshot location.

unsecurePackageInstall

public static void unsecurePackageInstall(Context ctx,
                                          java.lang.String uri)
This method is used to install apk using Standard Android package manager

Parameters:
ctx - A context object of the calling Class (Activity/Service).
uri - APK file path

getAECMOrientation

public static void getAECMOrientation(Context ctx,
                                      BroadcastReceiver orientationReceiver)
This method is used to get orientation of AECM device from EloSecure application.

Parameters:
ctx - A context object of the calling Class (Activity/Service).
orientationReceiver - A Receiver receives response of orientation JSON object.

setBrightness

public static void setBrightness(Context ctx,
                                 int val)
This method is used to set device Brightness the device

Parameters:
val - Integer value having range from 0 - 100

getBrightness

public static int getBrightness(Context ctx)
This method is used to get device Brightness the device

Parameters:
ctx - A context object of the calling Class (Activity/Service).
brightnessReceiver - to receive brightness value

setVolume

public static void setVolume(Context ctx,
                             int val)
This method is used to set device volume the device

Parameters:
ctx - A context object of the calling Class (Activity/Service).
val - Integer value having range from 0 - 100

getVolume

public static int getVolume(Context ctx)
This method is used to get device Volume the device

Parameters:
ctx - A context object of the calling Class (Activity/Service).
Returns:
integer val , possible val 0-100 , on error return -1

getSerialNumber

public static void getSerialNumber(Context ctx,
                                   BroadcastReceiver serialNumberReceiver)
This method is used to get device Serial Number

Parameters:
ctx - it must be Activity or Application context
serialNumberReceiver - to receive device Serial Number

setDisplayOn

public static void setDisplayOn(Context ctx,
                                int val)
This method is used to Set Device Display ON

Parameters:
ctx - it must be Activity or Application context

setDisplayOff

public static void setDisplayOff(Context ctx,
                                 int val)
This method is used to Set Device Display OFF

Parameters:
ctx - it must be Activity or Application context

getAddress

public static void getAddress(Context ctx,
                              BroadcastReceiver addressReceiver)
This method is used to get device Address

Parameters:
ctx - it must be Activity or Application context
addressReceiver - to receive device Address

setLocale

public static void setLocale(Context ctx,
                             java.lang.String localeStr)
This method is used to set device system locale

Parameters:
ctx - it must be Activity or Application context
localeStr - it must be locale string format like "ja_JP". Currently tested locale's "en_US" , "de_DE" , "es_ES" , "fr_FR" , "it_IT" , "zh_CN" , "ja_JP"

getLocale

public static void getLocale(Context ctx,
                             BroadcastReceiver localeReceiver)
This method is used to get device system locale

Parameters:
ctx - it must be Activity or Application context
localeReceiver - return value will be locale string format like "ja_JP". Currently tested locale's "en_US" , "de_DE" , "es_ES" , "fr_FR" , "it_IT" , "zh_CN" , "ja_JP"

getDeviceInfo

public static boolean getDeviceInfo(Context ctx,
                                    Handler handler)
This method is used to get device information from cloud ( Async Call )

Parameters:
ctx - it must be Activity or Application context
handler - to receive device information in properties format ( key/value format )

getDeviceInfo

public static java.lang.String getDeviceInfo(Context ctx)
This method is used to get device information from cloud ( Sync Call )

Parameters:
ctx - it must be Activity or Application context
Returns:
device information in properties format ( key/value format )

registerDeviceInfoReceiver

public static boolean registerDeviceInfoReceiver(Context ctx,
                                                 BroadcastReceiver deviceInfoReceiver)
This method is used to notify any change in device info

Parameters:
ctx - it must be Activity or Application context
deviceInfoReceiver - it must be BroadcastReceiver and it will return device info parameters in key/val pair format
Returns:
true if receiver successfully registered else false

unregisterDeviceInfoReceiver

public static boolean unregisterDeviceInfoReceiver(Context ctx,
                                                   BroadcastReceiver deviceInfoReceiver)
This method is used to unregister the device info change listener

Parameters:
ctx - it must be Activity or Application context
deviceInfoReceiver - it must be BroadcastReceiver that is registered
Returns:
true if receiver successfully unregistered else false

startDownloadUpgradePackage

public static void startDownloadUpgradePackage(Context context,
                                               java.lang.String url,
                                               Handler handler)
This method is used to download OTA file from remote http server or from local file path.

Parameters:
ctx - A context object of the calling Class (Activity/Service).
url - must be a string "http://server_url" or "file://local_file_path"
handler - handler to receive msg's about download success,error or download percentage

verifyOTA

public static void verifyOTA(Context ctx,
                             Handler handler)
This method is used to verify the system signature of downloaded OTA file.

Parameters:
ctx - A context object of the calling Class (Activity/Service).
handler - handler to receive msg's about verifying the signature of downloaded OTA file, verification percentage.

applyOTA

public static void applyOTA(Context ctx,
                            Handler handler)
This method is used to trigger underlying Android OS OTA mechanism.

Parameters:
ctx - A context object of the calling Class (Activity/Service).
handler - handler to receive msg's about file error

checkOTAStatus

public static void checkOTAStatus(Context ctx,
                                  java.lang.String buildPropUrl,
                                  Handler handler)
This method is used to check whether pointed remote/local OTA is newer or older than current version.

Parameters:
ctx - A context object of the calling Class (Activity/Service).
buildPropUrl - must be a string "http://build.prop_server_url" or "file://build.prop_local_file_path" build.prop is mandatory to check OTA version./
handler - handler to receive msg's about OTA version whether it is new , old or same.

screenTurnOff

public static void screenTurnOff(Context ctx,
                                 int mode)
This method is used to turn off the screen

Parameters:
ctx - it must be Activity or Application context
mode - Integer value of mode defines the source to turn on the display Default mode value is 0

screenTurnOn

public static void screenTurnOn(Context ctx,
                                int mode)
This method is used to turn on the screen

Parameters:
ctx - it must be Activity or Application context
mode - Integer value of mode defines the source to turn on the display Default mode value is 0

downloadFile

public static java.lang.Long downloadFile(Uri uri,
                                          java.util.Map<java.lang.String,java.lang.String> headers,
                                          java.lang.String destination,
                                          java.lang.String fileName,
                                          java.lang.String contentId,
                                          Context ctx)

getInprogressDownloadID

public static long getInprogressDownloadID(Context context,
                                           java.lang.String contentName)

removeContentFromDownloadQueue

public static void removeContentFromDownloadQueue(Context context,
                                                  java.lang.String contentName)

removecontentFromDownloadList

public static boolean removecontentFromDownloadList(Context context,
                                                    long downloadId)

getDownloadStatus

public static int[] getDownloadStatus(java.lang.Long downloadId,
                                      Context ctx)