com.baidu.cafe.remote
Class Armser

java.lang.Object
  extended by com.baidu.cafe.remote.Armser

public class Armser
extends java.lang.Object


Field Summary
static int GPS_PROVIDER
           
static int ICON_ALARM_CLOCK
           
static int ICON_BATTERY
           
static int ICON_BLUETOOTH
           
static int ICON_CDMA_ERI
           
static int ICON_COM_ANDROID_SYSTEMUI
           
static int ICON_COM_BAIDU_INPUT
           
static int ICON_COM_BAIDU_SYNC
           
static int ICON_DATA_CONNECTION
           
static int ICON_GPS
           
static int ICON_HEADSET
           
static int ICON_MORE
           
static int ICON_PHONE_SIGNAL
           
static int ICON_SYNC_ACTIVE
           
static int ICON_SYNC_FAILING
           
static int ICON_TTY
           
static int ICON_VOLUME
           
static int ICON_WIFI
           
static java.lang.String[] iconName
           
static int NETWORK_PROVIDER
           
static int SCREEN_BRIGHTNESS_MODE_AUTOMATIC
           
static int SCREEN_BRIGHTNESS_MODE_MANUAL
           
 
Constructor Summary
Armser(android.content.Context context)
           
 
Method Summary
 java.lang.String addContact(java.lang.String name, java.lang.String phone)
          NOT READY YET, COMING SOON...
 boolean bind(android.content.Context context)
           
 void changeLanguage(java.lang.String language)
          change language
 boolean checkProcessAlive(java.lang.String processName)
          check the given processname alive or not
 boolean clearApplicationUserData(java.lang.String packageName)
          clear application's user data same as click SystemSettings->Applications->Manage Applications->XXXX application->Clear Data; suggest to use this function in teardown
 void clearLog()
          clear (flush) the entire log, by calling "logcat -c"
 void clickScreen(int x, int y)
          click on screen
 boolean clickView(java.lang.String searchKey, java.lang.String searchValue, int searchMode, int index, int timeout, int xOffset, int yOffset, int longClickTime, java.lang.String scrollViewId, int scrollViewIndex)
          click a view
 boolean clickViewById(java.lang.String id)
          click on a view by id without auto-scroll and xOffset = 0, yOffset = 0, timeout = 10000, index = 0
 boolean clickViewById(java.lang.String id, int index, int timeout, int xOffset, int yOffset, java.lang.String scrollViewId, int scrollViewIndex)
          click on a view by id
 boolean clickViewById(java.lang.String id, int index, int timeout, java.lang.String scrollViewId, int scrollViewIndex)
          click on a view by id and xOffset = 0, yOffset = 0
 boolean clickViewById(java.lang.String id, int index, java.lang.String scrollViewId, int scrollViewIndex)
          click on a view by id and xOffset = 0, yOffset = 0, timeout = 10000
 boolean clickViewById(java.lang.String id, java.lang.String scrollViewId, int scrollViewIndex)
          click on a view by id and xOffset = 0, yOffset = 0, timeout = 10000, index = 0
 boolean clickViewByText(java.lang.String text)
          click on a view by text without auto-scroll and xOffset=0, yOffset = 0, timeout=10000, index = 0, searchMode = LocalLib.SEARCHMODE_INCLUDE_MATCHING
 boolean clickViewByText(java.lang.String text, int searchMode)
          click on a view by text without auto-scroll and xOffset=0, yOffset = 0, timeout=10000, index = 0
 boolean clickViewByText(java.lang.String text, int searchMode, int index, int timeout, int xOffset, int yOffset, java.lang.String scrollViewId, int scrollViewIndex)
          click on a view by text
 boolean clickViewByText(java.lang.String text, int searchMode, int index, int timeout, java.lang.String scrollViewId, int scrollViewIndex)
          click on a view by text without offset
 boolean clickViewByText(java.lang.String text, int searchMode, int index, java.lang.String scrollViewId, int scrollViewIndex)
          click on a view by text without offset and timeout = 10000
 boolean clickViewByText(java.lang.String text, int searchMode, java.lang.String scrollViewId, int scrollViewIndex)
          click on a view by text without offset and timeout = 10000, index = 0
 void copyAssets(java.lang.String dist)
           
 void deleteAccount(java.lang.String name, java.lang.String type)
           
 int deleteContact(java.lang.String uriStr)
          NOT READY YET, COMING SOON...
 java.lang.String[] diffLog(java.lang.String[] logStart, java.lang.String[] logEnd)
          diff log
 void drag(float fromX, float toX, float fromY, float toY, int stepCount)
           
 void dragHalfScreenDown(int stepCount)
          drag from (mScreenHeight * 0.5f) to (mScreenHeight)
 void dragHalfScreenLeft(int stepCount)
          drag from (mScreenWidth * 0.5f) to (0)
 void dragHalfScreenRight(int stepCount)
          drag from (mScreenWidth * 0.5f) to (mScreenWidth)
 void dragHalfScreenUp(int stepCount)
          drag from (mScreenHeight * 0.5f) to (0)
 void dragQuarterScreenDown(int stepCount)
          drag from (mScreenHeight * 0.5f) to (mScreenHeight * 0.75f)
 void dragQuarterScreenLeft(int stepCount)
          drag from (mScreenWidth * 0.5f) to (mScreenWidth * 0.25f)
 void dragQuarterScreenRight(int stepCount)
          drag from (mScreenWidth * 0.5f) to (mScreenWidth * 0.75f)
 void dragQuarterScreenUp(int stepCount)
          drag from (mScreenHeight * 0.5f) to (mScreenHeight * 0.25f)
 void enterText(java.lang.String text)
          enter a string
 void expandStatusBar()
           
 void factoryResetWithEraseSD()
          factory reset with erase sd card
 void formatSD()
          format sd card
 java.lang.String formatSize(long size)
          formats a content size to be in the form of bytes, kilobytes, megabytes, etc
 java.lang.String getAccountName()
          get account name
 java.lang.String getAccountType()
          get account type
 java.lang.String getAllRunningActivities()
          NOT READY YET, COMING SOON...
 java.lang.String getAllRunningServices()
          NOT READY YET, COMING SOON...
 int getAudioMode()
          get the current audio mode
 int getAudioVolume(int streamType)
          get the audio volume
 int getAutoTimeState()
           
 boolean getBackgroundDataState()
           
 java.lang.String getBaseBandVersion()
          get baseband version e.g.
 java.lang.String getBatteryHealth()
          get battery status
 int getBatteryIconsmall()
          get resource id of battery small icon
 int getBatteryLevel()
          get battery level
 java.lang.String getBatteryPlugged()
          get battery plugged category
 boolean getBatteryPresent()
          get battery present
 int getBatteryScale()
          get battery scale
 java.lang.String getBatteryStatus()
          get battery status
 java.lang.String getBatteryTechnology()
          get battery technology
 int getBatteryTemperature()
          get battery temperature
 int getBatteryVoltage()
          get battery voltage
 java.lang.String getBlueToothAddress()
          get bluetooth address
 java.lang.String getBuildNumber()
          get build number
 java.lang.String getBuildVersion()
          get build version
 int getCurrentTaskActivitiesNumber()
           
 java.lang.String getDataState()
          get current data state
 java.lang.String getDeviceModel()
          get device model Full BMOS on Passion
 int getDisplayX()
          get width of screen
 int getDisplayY()
          get height of screen
 java.lang.String getFocusedWindow()
          get focused window name
 boolean getInputMethodStatus()
          get status of input method
 java.lang.String getKernelVersion()
          get kernel version
 java.lang.String[] getLog()
          get log information, by calling logcat with parameters "-d -v -time"
 java.lang.String[] getLog(java.lang.String filterSpecs)
          get log information, by calling logcat with parameters "-d -v -time" and filterSpecs
 java.lang.String[] getLog(java.lang.String[] command)
          get log information, by calling logcat with specified parameters
 boolean getMasterSyncAutomatically()
           
 long getMemoryInternalAvail()
          get available internal memory
 java.lang.String getMyPhoneNumber()
          get my phone number
 java.lang.String getNetworkType()
          get current network type
 int getNonMarketAppsAllowed()
          check nomarketappsallowed is available
 java.lang.String[] getPermissionsForPackage(java.lang.String packageName)
          get package's pemissions
 int getRingtoneMode()
          get the current ringtone mode
 int getScreenBrightness()
          NOT READY YET, COMING SOON...
 int getScreenBrightnessMode()
           
 java.lang.String getServerIP()
          get server ip
 int getSimCardState()
          get current sim card state
 java.lang.String getSmsState()
          NOT READY YET, COMING SOON...
 boolean getStatusBarIconState(int slot)
          get icon state on statusbar
 long getStorageCardAvail()
          get storage card total size
 long getStorageCardSize()
           
 java.lang.String getStringByName(java.lang.String name)
           
 java.lang.String getSystemProperties(java.lang.String key)
          get system property same as "adb shell get prop"
 java.lang.String getSystemTime()
          get system time e.g.
 java.lang.String getTopActivity()
          get top activity
 java.lang.String getTopPackage()
           
 int[] getViewCenterPointById(java.lang.String id)
          get view's center point coordinate by id
 int[] getViewCenterPointByText(java.lang.String text)
          get view's center point coordinate by id
 java.lang.String[] getViewProperties(java.lang.String searchKey, java.lang.String searchValue, int searchMode, int targetNumber, java.lang.String[] getKeys, boolean getNew)
          get view's properties from focused window
 int getWifiState()
          get current wifi state
 java.lang.String[] getWindowList()
          Lists all of the available windows in the system
 java.lang.String getWlanMacAddress()
          get current wifi mac address
 void goBack()
          press back key
 void goHome()
          press home key
 void goToSleep()
          force the devcie to go to sleep
 boolean hasAppsAccessingStorage()
          check if any app is accessing storage card
 void installApk(java.lang.String filename)
          you must use "isPackageInstalled(String)" to judge if it is installed finish.
 boolean installApkSync(java.lang.String filename, long timeout)
          install a apk in sdcard, return until it install finish.
 boolean isAccelerometerRotationEnabled()
           
 boolean isBluetoothEnabled()
          check bluetooth state
 boolean isHome()
          Judge whether top activity is home.
 boolean isLocationProviderEnabled(int provider)
           
 boolean isMusicActive()
          check if any music is active
 boolean isNetworkEnable()
          ping 8.8.8.8
 boolean isPackageInstalled(java.lang.String packageName)
          check a package is installed or not.
 boolean isScreenLocked()
          check if screen is locked
 boolean isScreenOn()
          check if screen is currently on
 boolean isStorageCardReadOnly()
          check if storage card is currently readonly
 boolean isStorageCardValid()
          check if storage card is currently valid
 boolean isViewServerOpen()
           
 boolean isWifiEnabled()
          check if wifi is currently enabled
 void killBackgroundProcesses(java.lang.String packageName)
          Have the system immediately kill all background processes associated with the given package.
 boolean launchActivity(java.lang.String className)
           
 boolean launchActivity(java.lang.String className, int flags)
          launch a activity via sent intent
 void longClickScreen(int x, int y, int time)
          long click on screen
 boolean longClickViewById(java.lang.String id, int time)
          long click on a view without auto-scroll and xOffset=0, yOffset = 0, timeout=10000, index = 0
 boolean longClickViewById(java.lang.String id, int index, int time)
          long click on a view without auto-scroll and xOffset=0, yOffset = 0, timeout=10000
 boolean longClickViewById(java.lang.String id, int index, int timeout, int time)
          long click on a view without auto-scroll and xOffset=0, yOffset = 0
 boolean longClickViewById(java.lang.String id, int index, int timeout, int xOffset, int yOffset, int time)
          long click on a view without auto-scroll
 boolean longClickViewByText(java.lang.String text, int time)
          long click on a view without auto-scroll and xOffset=0, yOffset = 0, timeout=10000, index = 0, searchMode = LocalLib.SEARCHMODE_INCLUDE_MATCHING
 boolean longClickViewByText(java.lang.String text, int searchMode, int time)
          long click on a view without auto-scroll and xOffset=0, yOffset = 0, timeout=10000, index = 0
 boolean longClickViewByText(java.lang.String text, int searchMode, int index, int time)
          long click on a view without auto-scroll and xOffset=0, yOffset = 0, timeout=10000
 boolean longClickViewByText(java.lang.String text, int searchMode, int index, int timeout, int time)
          long click on a view without auto-scroll and xOffset=0, yOffset = 0
 boolean longClickViewByText(java.lang.String text, int searchMode, int index, int timeout, int xOffset, int yOffset, int time)
          long click on a view without auto-scroll
 void longPressKey(int keyCode)
          send a key evnet of long press
 void mount()
          mount storage card
 void pressKey(int keyCode)
          send a key evnet
 void reboot()
          reboot device
 void rebootToBootloader()
          reboot device to bootloader
 void rebootToRecoveryMode()
          reboot device to recovery mode
 void recordVideo()
          NOT READY YET, COMING SOON...
 void recovery()
           
 java.lang.String runCmdOnServer(java.lang.String command)
          Deprecated. 
 void screenCap(java.lang.String prefix)
          take full screen cap,the function use /system/bin/screencap cmd
 void sendKeyEvent(int keycode)
          Deprecated. 
 void setAccelerometerRotationEnabled(boolean enabled)
           
 void setAirplaneMode(boolean enable)
          set airplane mode
 void setAudioMuteOff(int streamType)
          NOT READY YET, COMING SOON...
 void setAudioMuteOn(int streamType)
          NOT READY YET, COMING SOON...
 void setAudioVolumeDown(int streamType)
          set the audio volume down
 void setAudioVolumeUp(int streamType)
          set the audio volume up
 void setAutoTimeDisabled()
           
 void setAutoTimeEnabled()
           
 void setBackgroundDataSetting(boolean enabled)
           
 void setBluetoothState(boolean enabled)
          set bluetooth state
 void setDataConnectionDisabled()
          set mobile data disabled
 void setDataConnectionEnabled()
          set mobile data enalbed
 void setInputMethodShowOff()
          NOT READY YET, COMING SOON...
 void setInputMethodShowOn()
          NOT READY YET, COMING SOON...
 void setLocationProviderEnabled(int provider, boolean enabled)
           
 void setMasterSyncAutomatically(boolean sync)
           
 void setNonMarketAppsAllowed(boolean enabled)
          set nomarketappsallowed is available
 void setScreenBrightness(int brightness)
          set screen brightness
 void setScreenBrightnessMode(int mode)
           
 void setScreenLocked()
          NOT READY YET, COMING SOON...
 void setScreenOn()
          set screen still light
 void setScreenStayAwake(boolean isAwake)
          set the screen stay awake
 void setScreenTimeOut(int milisecond)
          set the timeout to lock screen
 void setScreenUnlocked()
          NOT READY YET, COMING SOON...
 void setScreenUnlockSecurityNone()
          set the screen unlock mode is none
 void setStatusBarHeight(int height)
           
 void setSystemProperties(java.lang.String key, java.lang.String val)
          set system property same as "adb shell set prop"
 void setSystemTime(java.lang.String time)
          set system time
 boolean setWifiDisabled()
          set wifi disabled
 boolean setWifiDisconnect()
          set wifi disconnect
 boolean setWifiEnabled()
          set wifi enabled
 boolean setWifiReconnect()
          set wifi reconnect
 boolean setWifiStartScan()
          set wifi starting scan now
 void sleep(int time)
          SystemClock.sleep(time);
 void sleepMini()
          sleep 200ms
 boolean unbind(android.content.Context context)
           
 void uninstallApk(java.lang.String packageName)
          uninstall an apk.
 void unmount()
          unmount storage card
 void updatePackagePermission(java.lang.String packageName, java.lang.String permissionName, int state)
          change package's pemission state for dynamic permission
 boolean waitForActivity(java.lang.String activityName, long timeout)
           
 void waitForAllDumpCompleted()
          only for CafeTestCase.tearDown() or testcase that doesn't inherit CafeTestCase and should be called only one time
 boolean waitforTopActivity(java.lang.String className, long timeout)
           
 boolean waitForView(java.lang.String searchKey, java.lang.String searchValue, int searchMode, int index, long timeout)
          wait for view appearing
 boolean waitForViewById(java.lang.String id, int index, long timeout)
          wait for view appearing by id and use LocalLib.SEARCHMODE_COMPLETE_MATCHING
 boolean waitForViewById(java.lang.String id, long timeout)
          wait for view appearing by id and use LocalLib.SEARCHMODE_COMPLETE_MATCHING and index=0
 boolean waitForViewByText(java.lang.String text, int searchMode, int index, long timeout)
          wait for view appearing by text
 boolean waitForViewByText(java.lang.String text, int index, long timeout)
          wait for view appearing by text and use LocalLib.SEARCHMODE_INCLUDE_MATCHING
 boolean waitForViewByText(java.lang.String text, long timeout)
          wait for view appearing by text and use LocalLib.SEARCHMODE_INCLUDE_MATCHING and index=0
 void writeLineToSdcard(java.lang.String filename, java.lang.String line)
          NOT READY YET, COMING SOON...
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SCREEN_BRIGHTNESS_MODE_AUTOMATIC

public static final int SCREEN_BRIGHTNESS_MODE_AUTOMATIC
See Also:
Constant Field Values

SCREEN_BRIGHTNESS_MODE_MANUAL

public static final int SCREEN_BRIGHTNESS_MODE_MANUAL
See Also:
Constant Field Values

GPS_PROVIDER

public static final int GPS_PROVIDER
See Also:
Constant Field Values

NETWORK_PROVIDER

public static final int NETWORK_PROVIDER
See Also:
Constant Field Values

ICON_MORE

public static final int ICON_MORE
See Also:
Constant Field Values

ICON_COM_BAIDU_SYNC

public static final int ICON_COM_BAIDU_SYNC
See Also:
Constant Field Values

ICON_COM_BAIDU_INPUT

public static final int ICON_COM_BAIDU_INPUT
See Also:
Constant Field Values

ICON_HEADSET

public static final int ICON_HEADSET
See Also:
Constant Field Values

ICON_COM_ANDROID_SYSTEMUI

public static final int ICON_COM_ANDROID_SYSTEMUI
See Also:
Constant Field Values

ICON_SYNC_FAILING

public static final int ICON_SYNC_FAILING
See Also:
Constant Field Values

ICON_SYNC_ACTIVE

public static final int ICON_SYNC_ACTIVE
See Also:
Constant Field Values

ICON_GPS

public static final int ICON_GPS
See Also:
Constant Field Values

ICON_BLUETOOTH

public static final int ICON_BLUETOOTH
See Also:
Constant Field Values

ICON_TTY

public static final int ICON_TTY
See Also:
Constant Field Values

ICON_VOLUME

public static final int ICON_VOLUME
See Also:
Constant Field Values

ICON_WIFI

public static final int ICON_WIFI
See Also:
Constant Field Values

ICON_CDMA_ERI

public static final int ICON_CDMA_ERI
See Also:
Constant Field Values

ICON_DATA_CONNECTION

public static final int ICON_DATA_CONNECTION
See Also:
Constant Field Values

ICON_PHONE_SIGNAL

public static final int ICON_PHONE_SIGNAL
See Also:
Constant Field Values

ICON_BATTERY

public static final int ICON_BATTERY
See Also:
Constant Field Values

ICON_ALARM_CLOCK

public static final int ICON_ALARM_CLOCK
See Also:
Constant Field Values

iconName

public static final java.lang.String[] iconName
Constructor Detail

Armser

public Armser(android.content.Context context)
Method Detail

bind

public boolean bind(android.content.Context context)

unbind

public boolean unbind(android.content.Context context)

getAccountName

public java.lang.String getAccountName()
get account name


getAccountType

public java.lang.String getAccountType()
get account type


getAllRunningActivities

public java.lang.String getAllRunningActivities()
NOT READY YET, COMING SOON...


getAllRunningServices

public java.lang.String getAllRunningServices()
NOT READY YET, COMING SOON...


setInputMethodShowOff

public void setInputMethodShowOff()
NOT READY YET, COMING SOON...


setInputMethodShowOn

public void setInputMethodShowOn()
NOT READY YET, COMING SOON...


isScreenLocked

public boolean isScreenLocked()
check if screen is locked

Returns:
true if screen is locked

setScreenLocked

public void setScreenLocked()
NOT READY YET, COMING SOON...


setScreenUnlocked

public void setScreenUnlocked()
NOT READY YET, COMING SOON...


getBatteryStatus

public java.lang.String getBatteryStatus()
get battery status

Returns:
one of the following value:
1. "unknown"
2. "charging"
3. "discharging",
4. "not charging",
5. "full"

getBatteryHealth

public java.lang.String getBatteryHealth()
get battery status

Returns:
one of the following value:
1. "unknown"
2. "good"
3. "overheat",
4. "dead",
5. "voltage"
6. "unspecified failure"

getBatteryPresent

public boolean getBatteryPresent()
get battery present

Returns:
true or false indicating whether a battery is present

getBatteryLevel

public int getBatteryLevel()
get battery level

Returns:
integer containing the current battery level from 0 to battery scale which can get by getBatteryScale() function

getBatteryScale

public int getBatteryScale()
get battery scale

Returns:
integer containing the maximum battery level

getBatteryIconsmall

public int getBatteryIconsmall()
get resource id of battery small icon

Returns:
integer containing the resource ID of a small status bar icon indicating the current battery state

getBatteryPlugged

public java.lang.String getBatteryPlugged()
get battery plugged category

Returns:
one of the following value:
0. null
1. "plugged ac"
2. "plugged usb"

getBatteryVoltage

public int getBatteryVoltage()
get battery voltage

Returns:
integer containing the current battery voltage level

getBatteryTemperature

public int getBatteryTemperature()
get battery temperature

Returns:
integer containing the current battery temperature

getBatteryTechnology

public java.lang.String getBatteryTechnology()
get battery technology

Returns:
string describing the technology of the current battery

getBlueToothAddress

public java.lang.String getBlueToothAddress()
get bluetooth address

Returns:
1. string of bluetooth addresss
2. "device not BT capable"
3. "Unavailable"

getBuildVersion

public java.lang.String getBuildVersion()
get build version


getBaseBandVersion

public java.lang.String getBaseBandVersion()
get baseband version e.g. "32.41.00.32H_5.08.00.04"


getDeviceModel

public java.lang.String getDeviceModel()
get device model Full BMOS on Passion


getBuildNumber

public java.lang.String getBuildNumber()
get build number

Returns:
string
e.g "full_passion-userdebug 2.3.3 GRI40 1.2.23-11395 test-keys"

getKernelVersion

public java.lang.String getKernelVersion()
get kernel version


recordVideo

public void recordVideo()
NOT READY YET, COMING SOON...


addContact

public java.lang.String addContact(java.lang.String name,
                                   java.lang.String phone)
NOT READY YET, COMING SOON...


deleteContact

public int deleteContact(java.lang.String uriStr)
NOT READY YET, COMING SOON...


getAudioMode

public int getAudioMode()
get the current audio mode

Returns:
integer
0: MODE_NORMAL, means not ringing and no call established
1: MODE_RINGTONE means an incoming is being signaled
2: MODE_IN_CALL means a telephony call is established
3: MODE_IN_COMMUNICATION meas an audio/video chat or VoIP call is established

getAudioVolume

public int getAudioVolume(int streamType)
get the audio volume

Parameters:
streamType -
-----------------------------
STREAM_VOICE_CALL 0
STREAM_SYSTEM 1
STREAM_RING 2
STREAM_MUSIC 3
STREAM_ALARM 4
STREAM_NOTIFICATION 5
STREAM_BLUETOOTH_SCO 6 (not defined in android SDK)
STREAM_SYSTEM_ENFORCED 7 (not defined in android SDK)
STREAM_DTMF 8
STREAM_TTS 9 (not defined in android SDK)
------------------------------
Returns:
the current volume index for the stream

getRingtoneMode

public int getRingtoneMode()
get the current ringtone mode

Returns:
integer, one of
0: RINGER_MODE_SILENT
1: RING_MODE_VIBRATE
2: RINGER_MODE_NORMAL

isMusicActive

public boolean isMusicActive()
check if any music is active

Returns:
true if any music tracks are active

setAudioVolumeDown

public void setAudioVolumeDown(int streamType)
set the audio volume down

Parameters:
streamType -
-----------------------------
STREAM_VOICE_CALL 0
STREAM_SYSTEM 1
STREAM_RING 2
STREAM_MUSIC 3
STREAM_ALARM 4
STREAM_NOTIFICATION 5
STREAM_BLUETOOTH_SCO 6 (not defined in android SDK)
STREAM_SYSTEM_ENFORCED 7 (not defined in android SDK)
STREAM_DTMF 8
STREAM_TTS 9 (not defined in android SDK)
------------------------------

setAudioVolumeUp

public void setAudioVolumeUp(int streamType)
set the audio volume up

Parameters:
streamType -
-----------------------------
STREAM_VOICE_CALL 0
STREAM_SYSTEM 1
STREAM_RING 2
STREAM_MUSIC 3
STREAM_ALARM 4
STREAM_NOTIFICATION 5
STREAM_BLUETOOTH_SCO 6 (not defined in android SDK)
STREAM_SYSTEM_ENFORCED 7 (not defined in android SDK)
STREAM_DTMF 8
STREAM_TTS 9 (not defined in android SDK)
------------------------------

setAudioMuteOn

public void setAudioMuteOn(int streamType)
NOT READY YET, COMING SOON...


setAudioMuteOff

public void setAudioMuteOff(int streamType)
NOT READY YET, COMING SOON...


getMemoryInternalAvail

public long getMemoryInternalAvail()
get available internal memory

Returns:
byte value, can be formated to string by formatSize(long size) function
e.g. 135553024

goToSleep

public void goToSleep()
force the devcie to go to sleep


isScreenOn

public boolean isScreenOn()
check if screen is currently on


reboot

public void reboot()
reboot device


rebootToRecoveryMode

public void rebootToRecoveryMode()
reboot device to recovery mode


rebootToBootloader

public void rebootToBootloader()
reboot device to bootloader


isStorageCardValid

public boolean isStorageCardValid()
check if storage card is currently valid


isStorageCardReadOnly

public boolean isStorageCardReadOnly()
check if storage card is currently readonly


writeLineToSdcard

public void writeLineToSdcard(java.lang.String filename,
                              java.lang.String line)
NOT READY YET, COMING SOON...


getStorageCardSize

public long getStorageCardSize()

getStorageCardAvail

public long getStorageCardAvail()
get storage card total size

Returns:
byte value, can be formated to string by formatSize(long size) function

hasAppsAccessingStorage

public boolean hasAppsAccessingStorage()
check if any app is accessing storage card


mount

public void mount()
mount storage card


unmount

public void unmount()
unmount storage card


getDisplayX

public int getDisplayX()
get width of screen


getDisplayY

public int getDisplayY()
get height of screen


getScreenBrightness

public int getScreenBrightness()
NOT READY YET, COMING SOON...


getSystemTime

public java.lang.String getSystemTime()
get system time e.g. "Nov 29, 2011 4:46:28 PM"


setScreenBrightness

public void setScreenBrightness(int brightness)
set screen brightness

Parameters:
brightness - , 0 ~ 255

setSystemTime

public void setSystemTime(java.lang.String time)
set system time

Parameters:
time - , format "yyyy/MM/dd hh:mm:ss", e.g. "2011/11/25 17:30:00"

getMyPhoneNumber

public java.lang.String getMyPhoneNumber()
get my phone number


getNetworkType

public java.lang.String getNetworkType()
get current network type

Returns:
EDGE, UMTS, etc...

getDataState

public java.lang.String getDataState()
get current data state

Returns:
"unknown", "Connected", "Suspended", "Connecting" or "Disconnected"

getSimCardState

public int getSimCardState()
get current sim card state

Returns:
0: SIM_STATE_UNKNOWN
1: SIM_STATE_ABSENT
2: SIM_STATE_PIN_REQUIRED
3: SIM_STATE_PUK_REQUIRED
4: SIM_STATE_NETWORK_LOCKED
5: SIM_STATE_READY

getSmsState

public java.lang.String getSmsState()
NOT READY YET, COMING SOON...


setAirplaneMode

public void setAirplaneMode(boolean enable)
set airplane mode

Parameters:
enable - true means open; false means closed

setDataConnectionDisabled

public void setDataConnectionDisabled()
set mobile data disabled


setDataConnectionEnabled

public void setDataConnectionEnabled()
set mobile data enalbed


formatSize

public java.lang.String formatSize(long size)
formats a content size to be in the form of bytes, kilobytes, megabytes, etc

Returns:
e.g. formatSize(123456789) = "118MB"

getWlanMacAddress

public java.lang.String getWlanMacAddress()
get current wifi mac address


getWifiState

public int getWifiState()
get current wifi state

Returns:
0: WIFI_STATE_DISABLING
1: WIFI_STATE_DISABLED
2: WIFI_STATE_ENABLING
3: WIFI_STATE_ENABLED
4: WIFI_STATE_UNKNOWN

isWifiEnabled

public boolean isWifiEnabled()
check if wifi is currently enabled


setWifiDisabled

public boolean setWifiDisabled()
set wifi disabled


setWifiEnabled

public boolean setWifiEnabled()
set wifi enabled


setWifiDisconnect

public boolean setWifiDisconnect()
set wifi disconnect


setWifiReconnect

public boolean setWifiReconnect()
set wifi reconnect


setWifiStartScan

public boolean setWifiStartScan()
set wifi starting scan now


getServerIP

public java.lang.String getServerIP()
get server ip

Returns:
null: if pc does not push the arms.xml

runCmdOnServer

@Deprecated
public java.lang.String runCmdOnServer(java.lang.String command)
Deprecated. 

run command by service side on PC


goHome

public void goHome()
press home key


goBack

public void goBack()
press back key


getTopActivity

public java.lang.String getTopActivity()
get top activity

Returns:
the name of top activity. ex. "com.baidu.baiduclock.BaiduClock"

launchActivity

public boolean launchActivity(java.lang.String className)
Parameters:
className - className of activity e.g."com.android.mms/.ui.ConversationList"
Returns:
whether the activity launched succeed

launchActivity

public boolean launchActivity(java.lang.String className,
                              int flags)
launch a activity via sent intent

Parameters:
className - className of activity e.g."com.android.mms/.ui.ConversationList"
flags - param for intent.setFlags()
Returns:
whether the activity launched succeed

waitForActivity

public boolean waitForActivity(java.lang.String activityName,
                               long timeout)
Parameters:
activityName - e.g.com.baidu.resmanager.filemanager.FileManagerActivity
timeout - the delay millisecond waiting for activity
Returns:
whether the activity appears

waitForViewById

public boolean waitForViewById(java.lang.String id,
                               long timeout)
wait for view appearing by id and use LocalLib.SEARCHMODE_COMPLETE_MATCHING and index=0

Parameters:
id - the id of target views
timeout - timeout of wait
Returns:
whether the view appears

waitForViewById

public boolean waitForViewById(java.lang.String id,
                               int index,
                               long timeout)
wait for view appearing by id and use LocalLib.SEARCHMODE_COMPLETE_MATCHING

Parameters:
id - the id of target views
index - the text of target views
timeout - timeout of wait
Returns:
whether the view appears

waitForViewByText

public boolean waitForViewByText(java.lang.String text,
                                 long timeout)
wait for view appearing by text and use LocalLib.SEARCHMODE_INCLUDE_MATCHING and index=0

Parameters:
text - the text of target views
timeout - timeout of wait
Returns:
whether the view appears

waitForViewByText

public boolean waitForViewByText(java.lang.String text,
                                 int index,
                                 long timeout)
wait for view appearing by text and use LocalLib.SEARCHMODE_INCLUDE_MATCHING

Parameters:
text - the text of target views
index - the index of search result
timeout - timeout of wait
Returns:
whether the view appears

waitForViewByText

public boolean waitForViewByText(java.lang.String text,
                                 int searchMode,
                                 int index,
                                 long timeout)
wait for view appearing by text

Parameters:
text - the text of target views
searchMode - the mode of search such as LocalLib.SEARCHMODE_COMPLETE_MATCHING and LocalLib.SEARCHMODE_INCLUDE_MATCHING
index - the index of search result
timeout - timeout of wait
Returns:
whether the view appears

waitForView

public boolean waitForView(java.lang.String searchKey,
                           java.lang.String searchValue,
                           int searchMode,
                           int index,
                           long timeout)
wait for view appearing

Parameters:
searchKey - the key to search view
searchValue - the value to search view
searchMode - the mode of search such as LocalLib.SEARCHMODE_COMPLETE_MATCHING and LocalLib.SEARCHMODE_INCLUDE_MATCHING
index - the index of search result
timeout - timeout of wait
Returns:
whether the view appears

enterText

public void enterText(java.lang.String text)
enter a string

Parameters:
text -

pressKey

public void pressKey(int keyCode)
send a key evnet

Parameters:
keyCode - e.g. KeyEvent.KEYCODE_HOME

longPressKey

public void longPressKey(int keyCode)
send a key evnet of long press

Parameters:
keyCode - e.g. KeyEvent.KEYCODE_HOME

clickScreen

public void clickScreen(int x,
                        int y)
click on screen

Parameters:
x - click.x
y - click.y

longClickScreen

public void longClickScreen(int x,
                            int y,
                            int time)
long click on screen

Parameters:
x - click.x
y - click.y
time - time of long press

clickViewById

public boolean clickViewById(java.lang.String id)
click on a view by id without auto-scroll and xOffset = 0, yOffset = 0, timeout = 10000, index = 0

Parameters:
id - id of view used to search
Returns:
whether the view is clicked

clickViewById

public boolean clickViewById(java.lang.String id,
                             java.lang.String scrollViewId,
                             int scrollViewIndex)
click on a view by id and xOffset = 0, yOffset = 0, timeout = 10000, index = 0

Parameters:
id - id of view used to search
scrollViewId - if want to click a item of {ListView, GridView, ScrollView}, get the id of {ListView, GridView, ScrollView}
scrollViewIndex - the index of target {ListView, GridView, ScrollView}
Returns:
whether the view is clicked

clickViewById

public boolean clickViewById(java.lang.String id,
                             int index,
                             java.lang.String scrollViewId,
                             int scrollViewIndex)
click on a view by id and xOffset = 0, yOffset = 0, timeout = 10000

Parameters:
id - id of view used to search
index - the index of target view
scrollViewId - if want to click a item of {ListView, GridView, ScrollView}, get the id of {ListView, GridView, ScrollView}
scrollViewIndex - the index of target {ListView, GridView, ScrollView}
Returns:
whether the view is clicked

clickViewById

public boolean clickViewById(java.lang.String id,
                             int index,
                             int timeout,
                             java.lang.String scrollViewId,
                             int scrollViewIndex)
click on a view by id and xOffset = 0, yOffset = 0

Parameters:
id - id of view used to search
index - the index of target view
timeout - timeout of dump
scrollViewId - if want to click a item of {ListView, GridView, ScrollView}, get the id of {ListView, GridView, ScrollView}
scrollViewIndex - the index of target {ListView, GridView, ScrollView}
Returns:
whether the view is clicked

clickViewById

public boolean clickViewById(java.lang.String id,
                             int index,
                             int timeout,
                             int xOffset,
                             int yOffset,
                             java.lang.String scrollViewId,
                             int scrollViewIndex)
click on a view by id

Parameters:
id - id of view used to search
index - the index of target view
timeout - timeout of dump
xOffset - Offset.x of target view's center point
yOffset - Offset.y of target view's center point
scrollViewId - if want to click a item of {ListView, GridView, ScrollView}, get the id of {ListView, GridView, ScrollView}
scrollViewIndex - the index of target {ListView, GridView, ScrollView}
Returns:
whether the view is clicked

clickViewByText

public boolean clickViewByText(java.lang.String text)
click on a view by text without auto-scroll and xOffset=0, yOffset = 0, timeout=10000, index = 0, searchMode = LocalLib.SEARCHMODE_INCLUDE_MATCHING

Parameters:
text - text of view used to search
Returns:
whether the view is clicked

clickViewByText

public boolean clickViewByText(java.lang.String text,
                               int searchMode)
click on a view by text without auto-scroll and xOffset=0, yOffset = 0, timeout=10000, index = 0

Parameters:
text - text of view used to search
searchMode - the mode of search such as LocalLib.SEARCHMODE_COMPLETE_MATCHING and LocalLib.SEARCHMODE_INCLUDE_MATCHING
Returns:
whether the view is clicked

clickViewByText

public boolean clickViewByText(java.lang.String text,
                               int searchMode,
                               java.lang.String scrollViewId,
                               int scrollViewIndex)
click on a view by text without offset and timeout = 10000, index = 0

Parameters:
text - text of view used to search
searchMode - the mode of search such as LocalLib.SEARCHMODE_COMPLETE_MATCHING and LocalLib.SEARCHMODE_INCLUDE_MATCHING
scrollViewId - if want to click a item of {ListView, GridView, ScrollView}, get the id of {ListView, GridView, ScrollView}
scrollViewIndex - the index of target {ListView, GridView, ScrollView}
Returns:
whether the view is clicked

clickViewByText

public boolean clickViewByText(java.lang.String text,
                               int searchMode,
                               int index,
                               java.lang.String scrollViewId,
                               int scrollViewIndex)
click on a view by text without offset and timeout = 10000

Parameters:
text - text of view used to search
searchMode - the mode of search such as LocalLib.SEARCHMODE_COMPLETE_MATCHING and LocalLib.SEARCHMODE_INCLUDE_MATCHING
index - the index of target view
scrollViewId - if want to click a item of {ListView, GridView, ScrollView}, get the id of {ListView, GridView, ScrollView}
scrollViewIndex - the index of target {ListView, GridView, ScrollView}
Returns:
whether the view is clicked

clickViewByText

public boolean clickViewByText(java.lang.String text,
                               int searchMode,
                               int index,
                               int timeout,
                               java.lang.String scrollViewId,
                               int scrollViewIndex)
click on a view by text without offset

Parameters:
text - text of view used to search
searchMode - the mode of search such as LocalLib.SEARCHMODE_COMPLETE_MATCHING and LocalLib.SEARCHMODE_INCLUDE_MATCHING
index - the index of target view
timeout - timeout of dump
scrollViewId - if want to click a item of {ListView, GridView, ScrollView}, get the id of {ListView, GridView, ScrollView}
scrollViewIndex - the index of target {ListView, GridView, ScrollView}
Returns:
whether the view is clicked

clickViewByText

public boolean clickViewByText(java.lang.String text,
                               int searchMode,
                               int index,
                               int timeout,
                               int xOffset,
                               int yOffset,
                               java.lang.String scrollViewId,
                               int scrollViewIndex)
click on a view by text

Parameters:
text - text of view used to search
searchMode - the mode of search such as LocalLib.SEARCHMODE_COMPLETE_MATCHING and LocalLib.SEARCHMODE_INCLUDE_MATCHING
index - the index of target view
timeout - timeout of dump
xOffset - Offset.x of target view's center point
yOffset - Offset.y of target view's center point
scrollViewId - if want to click a item of {ListView, GridView, ScrollView}, get the id of {ListView, GridView, ScrollView}
scrollViewIndex - the index of target {ListView, GridView, ScrollView}
Returns:
whether the view is clicked

longClickViewById

public boolean longClickViewById(java.lang.String id,
                                 int time)
long click on a view without auto-scroll and xOffset=0, yOffset = 0, timeout=10000, index = 0

Parameters:
id - id of view used to search
time - if time > 0, click will change to long click
Returns:
whether the view is clicked

longClickViewById

public boolean longClickViewById(java.lang.String id,
                                 int index,
                                 int time)
long click on a view without auto-scroll and xOffset=0, yOffset = 0, timeout=10000

Parameters:
id - id of view used to search
index - the index of target view
time - if time > 0, click will change to long click
Returns:
whether the view is clicked

longClickViewById

public boolean longClickViewById(java.lang.String id,
                                 int index,
                                 int timeout,
                                 int time)
long click on a view without auto-scroll and xOffset=0, yOffset = 0

Parameters:
id - id of view used to search
index - the index of target view
timeout - timeout of dump
time - if time > 0, click will change to long click
Returns:
whether the view is clicked

longClickViewById

public boolean longClickViewById(java.lang.String id,
                                 int index,
                                 int timeout,
                                 int xOffset,
                                 int yOffset,
                                 int time)
long click on a view without auto-scroll

Parameters:
id - id of view used to search
index - the index of target view
timeout - timeout of dump
xOffset - Offset.x of target view's center point
yOffset - Offset.y of target view's center point
time - if time > 0, click will change to long click
Returns:
whether the view is clicked

longClickViewByText

public boolean longClickViewByText(java.lang.String text,
                                   int time)
long click on a view without auto-scroll and xOffset=0, yOffset = 0, timeout=10000, index = 0, searchMode = LocalLib.SEARCHMODE_INCLUDE_MATCHING

Parameters:
text - text of view used to search
time - if time > 0, click will change to long click
Returns:
whether the view is clicked

longClickViewByText

public boolean longClickViewByText(java.lang.String text,
                                   int searchMode,
                                   int time)
long click on a view without auto-scroll and xOffset=0, yOffset = 0, timeout=10000, index = 0

Parameters:
text - text of view used to search
searchMode - the mode of search such as LocalLib.SEARCHMODE_COMPLETE_MATCHING and LocalLib.SEARCHMODE_INCLUDE_MATCHING
time - if time > 0, click will change to long click
Returns:
whether the view is clicked

longClickViewByText

public boolean longClickViewByText(java.lang.String text,
                                   int searchMode,
                                   int index,
                                   int time)
long click on a view without auto-scroll and xOffset=0, yOffset = 0, timeout=10000

Parameters:
text - text of view used to search
searchMode - the mode of search such as LocalLib.SEARCHMODE_COMPLETE_MATCHING and LocalLib.SEARCHMODE_INCLUDE_MATCHING
index - the index of target view
time - if time > 0, click will change to long click
Returns:
whether the view is clicked

longClickViewByText

public boolean longClickViewByText(java.lang.String text,
                                   int searchMode,
                                   int index,
                                   int timeout,
                                   int time)
long click on a view without auto-scroll and xOffset=0, yOffset = 0

Parameters:
text - text of view used to search
searchMode - the mode of search such as LocalLib.SEARCHMODE_COMPLETE_MATCHING and LocalLib.SEARCHMODE_INCLUDE_MATCHING
index - the index of target view
timeout - timeout of dump
time - if time > 0, click will change to long click
Returns:
whether the view is clicked

longClickViewByText

public boolean longClickViewByText(java.lang.String text,
                                   int searchMode,
                                   int index,
                                   int timeout,
                                   int xOffset,
                                   int yOffset,
                                   int time)
long click on a view without auto-scroll

Parameters:
text - text of view used to search
searchMode - the mode of search such as LocalLib.SEARCHMODE_COMPLETE_MATCHING and LocalLib.SEARCHMODE_INCLUDE_MATCHING
index - the index of target view
timeout - timeout of dump
xOffset - Offset.x of target view's center point
yOffset - Offset.y of target view's center point
time - if time > 0, click will change to long click
Returns:
whether the view is clicked

clickView

public boolean clickView(java.lang.String searchKey,
                         java.lang.String searchValue,
                         int searchMode,
                         int index,
                         int timeout,
                         int xOffset,
                         int yOffset,
                         int longClickTime,
                         java.lang.String scrollViewId,
                         int scrollViewIndex)
click a view

Parameters:
searchKey - name of view 's property used to search
searchValue - value of view 's property used to search
searchMode - the mode of search such as LocalLib.SEARCHMODE_COMPLETE_MATCHING and LocalLib.SEARCHMODE_INCLUDE_MATCHING
index - the index of target view
timeout - timeout of dump
xOffset - Offset.x of target view's center point
yOffset - Offset.y of target view's center point
longClickTime - if longClickTime > 0, click will change to long click
scrollViewId - if want to click a item of {ListView, GridView, ScrollView}, get the id of {ListView, GridView, ScrollView}
scrollViewIndex - the index of target {ListView, GridView, ScrollView}
Returns:
whether the view is clicked

dragQuarterScreenDown

public void dragQuarterScreenDown(int stepCount)
drag from (mScreenHeight * 0.5f) to (mScreenHeight * 0.75f)

Parameters:
stepCount - How many move steps to include in the drag

dragQuarterScreenUp

public void dragQuarterScreenUp(int stepCount)
drag from (mScreenHeight * 0.5f) to (mScreenHeight * 0.25f)

Parameters:
stepCount - How many move steps to include in the drag

dragQuarterScreenRight

public void dragQuarterScreenRight(int stepCount)
drag from (mScreenWidth * 0.5f) to (mScreenWidth * 0.75f)

Parameters:
stepCount - How many move steps to include in the drag

dragQuarterScreenLeft

public void dragQuarterScreenLeft(int stepCount)
drag from (mScreenWidth * 0.5f) to (mScreenWidth * 0.25f)

Parameters:
stepCount - How many move steps to include in the drag

dragHalfScreenDown

public void dragHalfScreenDown(int stepCount)
drag from (mScreenHeight * 0.5f) to (mScreenHeight)

Parameters:
stepCount - How many move steps to include in the drag

dragHalfScreenUp

public void dragHalfScreenUp(int stepCount)
drag from (mScreenHeight * 0.5f) to (0)

Parameters:
stepCount - How many move steps to include in the drag

dragHalfScreenRight

public void dragHalfScreenRight(int stepCount)
drag from (mScreenWidth * 0.5f) to (mScreenWidth)

Parameters:
stepCount - How many move steps to include in the drag

dragHalfScreenLeft

public void dragHalfScreenLeft(int stepCount)
drag from (mScreenWidth * 0.5f) to (0)

Parameters:
stepCount - How many move steps to include in the drag

drag

public void drag(float fromX,
                 float toX,
                 float fromY,
                 float toY,
                 int stepCount)

waitForAllDumpCompleted

public void waitForAllDumpCompleted()
only for CafeTestCase.tearDown() or testcase that doesn't inherit CafeTestCase and should be called only one time


sleep

public void sleep(int time)
SystemClock.sleep(time);

Parameters:
time - sleep time

sleepMini

public void sleepMini()
sleep 200ms


setScreenOn

public void setScreenOn()
set screen still light


sendKeyEvent

@Deprecated
public void sendKeyEvent(int keycode)
Deprecated. 

replaced by pressKey()

Parameters:
keycode -

waitforTopActivity

public boolean waitforTopActivity(java.lang.String className,
                                  long timeout)
Parameters:
className - ex. "com.baidu.baiduclock.BaiduClock"
timeout - delay. in terms of milliseconds
Returns:
true we got it

factoryResetWithEraseSD

public void factoryResetWithEraseSD()
factory reset with erase sd card


formatSD

public void formatSD()
format sd card


setScreenStayAwake

public void setScreenStayAwake(boolean isAwake)
set the screen stay awake

Parameters:
true: - stay awake

setScreenTimeOut

public void setScreenTimeOut(int milisecond)
set the timeout to lock screen

Parameters:
milisecond - : 15000/30000/60000/120000/600000/1800000 can be used

setScreenUnlockSecurityNone

public void setScreenUnlockSecurityNone()
set the screen unlock mode is none


changeLanguage

public void changeLanguage(java.lang.String language)
change language

Parameters:
language - : zh---Chinese en---English

installApk

public void installApk(java.lang.String filename)
you must use "isPackageInstalled(String)" to judge if it is installed finish. otherwise you can use public void InstallapkSync(String filename)

Parameters:
filename - : the apk name you want to install. for example: "/data/data/baidumap.apk"

uninstallApk

public void uninstallApk(java.lang.String packageName)
uninstall an apk. before this you can use isPackageInstalled(String) to detect that the package is installed or not.

Parameters:
packageName - : packagename you want to uninstall,

isPackageInstalled

public boolean isPackageInstalled(java.lang.String packageName)
check a package is installed or not.

Parameters:
packageName - : packagename you want to detect
Returns:
true installed false not installed

installApkSync

public boolean installApkSync(java.lang.String filename,
                              long timeout)
install a apk in sdcard, return until it install finish.

Parameters:
filename - : apk location you want to install ,"/sdcard/baidu.apk"
timeout - : the max time you can suffer
Returns:
true installed false not installed or timeout

getSystemProperties

public java.lang.String getSystemProperties(java.lang.String key)
get system property same as "adb shell get prop"

Parameters:
key - e.g. ro.baidu.build.software
Returns:
the property

setSystemProperties

public void setSystemProperties(java.lang.String key,
                                java.lang.String val)
set system property same as "adb shell set prop"

Parameters:
key - e.g. ro.baidu.build.software
val - e.g. cafe

getInputMethodStatus

public boolean getInputMethodStatus()
get status of input method

Returns:
true means VISIBLE; false means GONE

getViewProperties

public java.lang.String[] getViewProperties(java.lang.String searchKey,
                                            java.lang.String searchValue,
                                            int searchMode,
                                            int targetNumber,
                                            java.lang.String[] getKeys,
                                            boolean getNew)
get view's properties from focused window

Parameters:
searchKey - property's name use to search
searchValue - property's value use to search
searchMode - LocalLib.SEARCHMODE_COMPLETE_MATCHING LocalLib.SEARCHMODE_INCLUDE_MATCHING
targetNumber - target index in search result. Beacuse a pair of searchKey and searchValue can return not only one search result.
getKeys - property's name use to get
getNew - True means start a new dump. If UI has changed, use true. False means get propery from last dump. If UI has not changed, use false.
Returns:
String[] getValues

getFocusedWindow

public java.lang.String getFocusedWindow()
get focused window name

Returns:
the name of focused window

checkProcessAlive

public boolean checkProcessAlive(java.lang.String processName)
check the given processname alive or not

Returns:
true if it alive

getNonMarketAppsAllowed

public int getNonMarketAppsAllowed()
check nomarketappsallowed is available

Returns:
1 set 0 noset -1 unknow default is not set
Throws:
android.os.RemoteException

setNonMarketAppsAllowed

public void setNonMarketAppsAllowed(boolean enabled)
set nomarketappsallowed is available

Parameters:
true - enable false disable
Throws:
android.os.RemoteException

isBluetoothEnabled

public boolean isBluetoothEnabled()
check bluetooth state

Returns:
true enalbed false disabled

setBluetoothState

public void setBluetoothState(boolean enabled)
set bluetooth state

Parameters:
true - enabled false disabled

killBackgroundProcesses

public void killBackgroundProcesses(java.lang.String packageName)
Have the system immediately kill all background processes associated with the given package. This is the same as the kernel killing those processes to reclaim memory; the system will take care of restarting these processes in the future as needed.

Parameters:
packageName -

getWindowList

public java.lang.String[] getWindowList()
Lists all of the available windows in the system

Returns:
the window list

clearApplicationUserData

public boolean clearApplicationUserData(java.lang.String packageName)
clear application's user data same as click SystemSettings->Applications->Manage Applications->XXXX application->Clear Data; suggest to use this function in teardown

Parameters:
packageName - application's packageName

updatePackagePermission

public void updatePackagePermission(java.lang.String packageName,
                                    java.lang.String permissionName,
                                    int state)
change package's pemission state for dynamic permission

Parameters:
packageName - target package name
permissionName - permission name
state - ALWAYS_ASK_DISABLE = 0; ALWAYS_DISENABLE = 1; ALWAYS_ASK_ENABLE = 2; ALWAYS_ENABLE = 3;

getPermissionsForPackage

public java.lang.String[] getPermissionsForPackage(java.lang.String packageName)
get package's pemissions

Parameters:
packageName - target package name
Returns:
permissions string

getAutoTimeState

public int getAutoTimeState()

setAutoTimeEnabled

public void setAutoTimeEnabled()

setAutoTimeDisabled

public void setAutoTimeDisabled()

getStatusBarIconState

public boolean getStatusBarIconState(int slot)
get icon state on statusbar

Parameters:
slot - mSlot of StatusBarIconView e.g. 3G icon's name is data_connection
Returns:
state of icon; true means VISIBLE, false means GONE

getLog

public java.lang.String[] getLog()
get log information, by calling logcat with parameters "-d -v -time"

Returns:
string array, including log lines

getLog

public java.lang.String[] getLog(java.lang.String filterSpecs)
get log information, by calling logcat with parameters "-d -v -time" and filterSpecs

Parameters:
filterspecs - string including a series of [:priority]
Returns:
string array, including log lines

getLog

public java.lang.String[] getLog(java.lang.String[] command)
get log information, by calling logcat with specified parameters

Parameters:
command - sample here: new String[]{"logcat", "-d", "-v", "time", "-s", "MyTest:I"}
Returns:
string array, including log lines

clearLog

public void clearLog()
clear (flush) the entire log, by calling "logcat -c"


diffLog

public java.lang.String[] diffLog(java.lang.String[] logStart,
                                  java.lang.String[] logEnd)
diff log

Parameters:
logStart - , log in start time
logEnd - , log in end time
Returns:
String array, diff log between start time and end time

screenCap

public void screenCap(java.lang.String prefix)
take full screen cap,the function use /system/bin/screencap cmd


getViewCenterPointById

public int[] getViewCenterPointById(java.lang.String id)
get view's center point coordinate by id

Parameters:
id -
Returns:
coordinate array

getViewCenterPointByText

public int[] getViewCenterPointByText(java.lang.String text)
get view's center point coordinate by id

Parameters:
text -
Returns:
coordinate array

getScreenBrightnessMode

public int getScreenBrightnessMode()
Returns:
Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC | Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL

setScreenBrightnessMode

public void setScreenBrightnessMode(int mode)
Parameters:
mode - Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC | Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL

setLocationProviderEnabled

public void setLocationProviderEnabled(int provider,
                                       boolean enabled)
Parameters:
provider - LocationManager.GPS_PROVIDER | LocationManager.NETWORK_PROVIDER
enabled - true | false

isLocationProviderEnabled

public boolean isLocationProviderEnabled(int provider)
Parameters:
provider - LocationManager.GPS_PROVIDER | LocationManager.NETWORK_PROVIDER
Returns:
true | false

isAccelerometerRotationEnabled

public boolean isAccelerometerRotationEnabled()

setAccelerometerRotationEnabled

public void setAccelerometerRotationEnabled(boolean enabled)

getBackgroundDataState

public boolean getBackgroundDataState()

setBackgroundDataSetting

public void setBackgroundDataSetting(boolean enabled)

getMasterSyncAutomatically

public boolean getMasterSyncAutomatically()

setMasterSyncAutomatically

public void setMasterSyncAutomatically(boolean sync)

deleteAccount

public void deleteAccount(java.lang.String name,
                          java.lang.String type)
Parameters:
name - account name e.g. BIT_Eric
type - account type e.g. com.baidu

recovery

public void recovery()

getCurrentTaskActivitiesNumber

public int getCurrentTaskActivitiesNumber()

setStatusBarHeight

public void setStatusBarHeight(int height)

isViewServerOpen

public boolean isViewServerOpen()

isHome

public boolean isHome()
Judge whether top activity is home.


isNetworkEnable

public boolean isNetworkEnable()
ping 8.8.8.8

Returns:

getTopPackage

public java.lang.String getTopPackage()

copyAssets

public void copyAssets(java.lang.String dist)

expandStatusBar

public void expandStatusBar()

getStringByName

public java.lang.String getStringByName(java.lang.String name)