com.jcdecaux.jcdroid.system
Class JCDroidSystem

java.lang.Object
  extended by com.jcdecaux.jcdroid.system.JCDroidSystem

public class JCDroidSystem
extends java.lang.Object

Set of jcdroid system utils. This class simplifies device reboot, locale update, internalsettings wipe, CLI commands execution. If you're gentle enough, it might grind you some coffee.


Method Summary
 void displayNavigationBarOverlay()
          Displays a navigation bar overlay on screen.
 void executeNative(java.lang.String... args)
          Executes a command line process
 void forceStopPackage(java.lang.String packageName)
          Forces package to stop if it's running.
static JCDroidSystem getInstance(android.content.Context context)
          Returns a JCDroidSystem singleton.
 java.lang.String getMacAddress()
          Gets eth0 mac adress with following format XX-XX-XX-XX-XX
 java.lang.String getProperty(java.lang.String propName)
          Read a system property through getProp() native function
 boolean isDeviceConnected()
          Test if device is connected (has a valid IP address) on ethernet.
 boolean isDeviceEmulator()
          Test if current device is an emulator.
 void reboot(int delay)
          Triggers a reboot in delay ms
 boolean requestInternalSettingsUpdate()
          Notifies InternalSettings that it should reload its data.
 boolean setLocale(java.util.Locale locale)
          Change the system locale
 void setProperty(java.lang.String name, java.lang.String value)
          Define the value of a system property using setProp function
 void shutdown(int delay)
          Triggers a poweroff in delay ms
 void wipeInternalSettings()
          Wipes InternalSettings content.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static JCDroidSystem getInstance(android.content.Context context)
Returns a JCDroidSystem singleton.

Parameters:
context - rather used getApplicationContext()
Returns:

requestInternalSettingsUpdate

public boolean requestInternalSettingsUpdate()
Notifies InternalSettings that it should reload its data. Calling this method does *NOT* mean that internal settings will be refresh on the next instruction.

Returns:
true if the command has been sent.

wipeInternalSettings

public void wipeInternalSettings()
Wipes InternalSettings content. Caller must be a system user and hold Manifest.permission#MODIFY permission.


reboot

public void reboot(int delay)
Triggers a reboot in delay ms

Parameters:
delay - in ms before reboot is triggered

shutdown

public void shutdown(int delay)
Triggers a poweroff in delay ms

Parameters:
delay - in ms before shutdown is triggered

setLocale

public boolean setLocale(java.util.Locale locale)
Change the system locale

Parameters:
locale -
Returns:
true if local changed appropriately, false otherwise

forceStopPackage

public void forceStopPackage(java.lang.String packageName)
Forces package to stop if it's running. Caller must be a system user.

Parameters:
packageName - to stop.

getMacAddress

public java.lang.String getMacAddress()
Gets eth0 mac adress with following format XX-XX-XX-XX-XX

Returns:
formatted mac adress.

isDeviceEmulator

public boolean isDeviceEmulator()
Test if current device is an emulator.

Returns:
true if the device is an emulator.

isDeviceConnected

public boolean isDeviceConnected()
Test if device is connected (has a valid IP address) on ethernet. WARNING: if the device is an emulator, this method will always return true.

Returns:
true if the devise is connected

displayNavigationBarOverlay

public void displayNavigationBarOverlay()
Displays a navigation bar overlay on screen. Caller must hold Manifest.permission#DISPLAY_NAVIGATION_OVERLAY permission.


executeNative

public void executeNative(java.lang.String... args)
Executes a command line process

Parameters:
args - the command and its arguments. Eg: {"/bin/cp", "file1", "file2"}

setProperty

public void setProperty(java.lang.String name,
                        java.lang.String value)
Define the value of a system property using setProp function

Parameters:
name - of the property
value - of the property

getProperty

public java.lang.String getProperty(java.lang.String propName)
Read a system property through getProp() native function