Android Programming Press on the image to return to the main documentation page.

OSLibrary

Written by XverhelstX

List of types:

OperatingSystem

OperatingSystem


Permissions:

android.permission.INTERNET
android.permission.REBOOT
android.permission.DUMP
android.permission.ACCESS_NETWORK_STATE
android.permission.BATTERY_STATS
android.permission.KILL_BACKGROUND_PROCESSES
android.permission.WRITE_SETTINGS
android.permission.GET_TASKS

Events:

None

Members:


  AvailableExternalMemorySize As Long [read only]

  AvailableInternalMemorySize As Long [read only]

  AvailableMemory As Long [read only]

  BatteryLevel As String [read only]

  BatteryReceiver

  Board As String [read only]

  Bootloader As String [read only]

  Brand As String [read only]

  calculateCPUusage As Float

  Codename As String [read only]

  CountDownTimer (duration As Long)

  CPUABI As String [read only]

  CPUABI2 As String [read only]

  density As Float

  densityDpi As Int

  Device As String [read only]

  Display As String [read only]

  ElaspedCPUTime As Long [read only]

  externalMemoryAvailable As Boolean

  Fingerprint As String [read only]

  formatSize (size As Long) As String

  getAvailableBlocks (Path As String) As Int

  getBlockCount (Path As String) As Int

  getBlockSize (Path As String) As Int

  getFreeBlocks (Path As String) As Int

  getGidForName (name As String) As Int

  getInfo (name As String) As String

  getRecentTasks (maxNum As Int, flags As Int) As java.util.List

  getRunningServices (maxNum As Int) As java.util.List

  getRunningTasks (maxNum As Int) As java.util.List

  getUidForName (name As String) As Int

  goToSleep (time As Long)

  Hardware As String [read only]

  heightPixels As Int

  Host As String [read only]

  ID As String [read only]

  Incremental As String [read only]

  Initialize (EventName As String)

  installPackage (packageFile As java.io.File)

  killBackgroundProcesses (packageName As String)

  killProcess (pid As Int)

  Manufacturer As String [read only]

  Model As String [read only]

  myPid As Int

  myTid As Int

  myUid As Int

  OS As String

  PackagesInfo

  physicalScreenHeight As Float

  physicalScreenWidth As Float

  Product As String [read only]

  Radio As String [read only]

  ReadCPUinfo As String

  reboot (Reason As String)

  rebootWipeUserData

  Release As String [read only]

  restat (Path As String)

  RunningAppProcess As java.util.List [read only]

  RunningAppProcesses As java.util.List [read only]

  RunningAppProcessInfo (list1 As java.util.List, list2 As java.util.List, list3 As java.util.List) As java.util.List

  RunningServiceInfo (maxNum As Int, list1 As java.util.List, list2 As java.util.List, list3 As java.util.List) As java.util.List

  RunningTaskInfo (maxNum As Int, list1 As java.util.List, list2 As java.util.List, list3 As java.util.List) As java.util.List

  scaledDensity As Float

  SDK As Int [read only]

  sendSignal (pid As Int, signal As Int)

  Serial As String [read only]

  setLowMemory As Boolean

  setThreadPriority (tid As Int, priority As Int)

  supportsProcesses As Boolean

  Tags As String [read only]

  Threshold As Long [read only]

  Time As Long [read only]

  TotalExternalMemorySize As Long [read only]

  TotalInternalMemorySize As Long [read only]

  Type As String [read only]

  User As String [read only]

  userActivity (when As Long, noChangeLights As Boolean)

  widthPixels As Int

  xdpi As Float

  ydpi As Float

Members description:

AvailableExternalMemorySize As Long [read only]
Returns the available external memory size.
Returns -1 if the external memory is unavailable.
AvailableInternalMemorySize As Long [read only]
Returns the available internal memory size.
AvailableMemory As Long [read only]
The total available memory on the system. This number should not be considered absolute: due to the nature of the kernel,
a significant portion of this memory is actually in use and needed for the overall system to run well.
BatteryLevel As String [read only]
Returns the battery level.
BatteryReceiver
Registers the battery receiver. Call this before getBatteryLevel.
Board As String [read only]
Returns the name of the underlying board, like "goldfish".
Bootloader As String [read only]
Returns the system bootloader version number.
Since api level 8.
Brand As String [read only]
Returns the brand (e.g., carrier) the software is customized for, if any.
calculateCPUusage As Float
This calculates the CPU usage.
Return type: @return:
Codename As String [read only]
The current development codename, or the string "REL" if this is a release build.
API level 4.
CountDownTimer (duration As Long)
Makes a countdown timer from duration (in ms).
2 events are raised:
eventname_ontick
eventname_onfinish (OS as String)
CPUABI As String [read only]
Returns the name of the instruction set (CPU type + ABI convention) of native code.
Since api level 4.
CPUABI2 As String [read only]
Returns the name of the second instruction set (CPU type + ABI convention) of native code.
Since api level 8.
density As Float
The logical density of the display. This is a scaling factor for the Density Independent Pixel unit,
where one DIP is one pixel on an approximately 160 dpi screen (for example a 240x320, 1.5"x2" screen),
providing the baseline of the system's display. Thus on a 160dpi screen this density value will be 1;
on a 120 dpi screen it would be .75; etc.
This value does not exactly follow the real screen size (as given by xdpi and ydpi, but rather is used to
scale the size of the overall UI in steps based on gross changes in the display dpi. For example, a 240x320
screen will have a density of 1 even if its width is 1.8", 1.3", etc. However, if the screen resolution is
increased to 320x480 but the screen size remained 1.5"x2" then the density would be increased (probably to 1.5).
Return type: @return:
densityDpi As Int
The screen density expressed as dots-per-inch. May be either DENSITY_LOW, DENSITY_MEDIUM, or DENSITY_HIGH.
http://developer.android.com/reference/android/util/DisplayMetrics.html#densityDpi
Return type: @return:
Device As String [read only]
Returns the name of the industrial design.
Display As String [read only]
Returns a build ID string meant for displaying to the user
API level 3
ElaspedCPUTime As Long [read only]
Returns elapsed milliseconds of the time this process has run.
externalMemoryAvailable As Boolean
Returns if the external memory is available.
Fingerprint As String [read only]
Returns a string that uniquely identifies this build. Do not attempt to parse this value.
formatSize (size As Long) As String
getAvailableBlocks (Path As String) As Int
The number of blocks that are free on the file system and available to applications.
getBlockCount (Path As String) As Int
The total number of blocks on the file system.
getBlockSize (Path As String) As Int
The size, in bytes, of a block on the file system.
getFreeBlocks (Path As String) As Int
The total number of blocks that are free on the file system, including reserved blocks (that are not available to normal applications).
getGidForName (name As String) As Int
Returns the GID assigned to a particular user name, or -1 if there is none.
getInfo (name As String) As String
getRecentTasks (maxNum As Int, flags As Int) As java.util.List
Return a list of the tasks that the user has recently launched, with the most recent being first and older ones after in order.
maxNum:
flags:
Return type: @return:
getRunningServices (maxNum As Int) As java.util.List
Return a list of the services that are currently running.
maxNum The maximum number of entries to return in the list. The actual number returned may be smaller, depending on how many services are running.
Return type: @return:
getRunningTasks (maxNum As Int) As java.util.List
RReturn a list of the tasks that are currently running, with the most recent being first and older ones after in order. Note that "running" does not mean any of the task's code is currently loaded or activity --
the task may have been frozen by the system, so that it can be restarted in its previous state when next brought to the foreground.
Return type: @return:
getUidForName (name As String) As Int
Returns the UID assigned to a particular user name, or -1 if there is none.
goToSleep (time As Long)
Force the device to go to sleep. Overrides all the wake locks that are held

time is used to order this correctly with the wake lock calls. The time should be in the SystemClock.uptimeMillis() time base.
Hardware As String [read only]
Returns the name of the hardware (from the kernel command line or /proc).
API level 8.
heightPixels As Int
The absolute height of the display in pixels.
Return type: @return:
Host As String [read only]
Returns the host.
ID As String [read only]
Returns either a changelist number, or a label like "M4-rc20".
Incremental As String [read only]
The internal value used by the underlying source control to represent this build. E.g., a perforce changelist number or a git hash.
Initialize (EventName As String)
Initializes the Operating System Library.
installPackage (packageFile As java.io.File)
Reboots the device in order to install the given update package.
killBackgroundProcesses (packageName As String)
Have the system immediately kill all background processes associated with the given package.
packageName:
killProcess (pid As Int)
Kill the process with the given PID.
Manufacturer As String [read only]
Returns the manufacturer of the product/hardware.
Model As String [read only]
Returns the end-user-visible name for the end product.
myPid As Int
Returns the identifier of this process, which can be used with killProcess(int) and sendSignal(int, int).
myTid As Int
Returns the identifier of this process's user.
myUid As Int
Returns the identifier of the calling thread, which be used with setThreadPriority(int, int).
OS As String
PackagesInfo
physicalScreenHeight As Float
ydpi * heightPixels to calculate the Physical Height Screen.
Return type: @return:
physicalScreenWidth As Float
xdpi * widthPixels to calculate the Physical Width Screen
Return type: @return:
Product As String [read only]
Returns the name of the overall product.
Radio As String [read only]
Returns the name of the overall product.
Api Level 8
ReadCPUinfo As String
Reads all info about the CPU.
Return type: @return:
reboot (Reason As String)
Reboot the device. Will not return if the reboot is successful.
reason code to pass to the kernel (e.g., "recovery") to request special boot modes, or null.
Api level 8
rebootWipeUserData
Reboots the device and wipes the user data partition.
Release As String [read only]
The user-visible version string. E.g., "1.0" or "3.4b5".
restat (Path As String)
Perform a restat of the file system referenced by this object.
RunningAppProcess As java.util.List [read only]
Gets a list of all running application processess.
RunningAppProcesses As java.util.List [read only]
Returns a list of application processes that are running on the device.
RunningAppProcessInfo (list1 As java.util.List, list2 As java.util.List, list3 As java.util.List) As java.util.List
Gives information about the running app processes.
Declare and Initialize 3 lists
list1: returns the process names.
list2: returns the pid.
list3: returns the process name and pid.
Return type: @return:
RunningServiceInfo (maxNum As Int, list1 As java.util.List, list2 As java.util.List, list3 As java.util.List) As java.util.List
Gives information about the running services.
Declare and Initialize 3 lists
list1: returns the service name.
list2: returns the pid.
list3: returns the service name and pid.
Return type: @return:
RunningTaskInfo (maxNum As Int, list1 As java.util.List, list2 As java.util.List, list3 As java.util.List) As java.util.List
Gives information about the running tasks.
Declare and Initialize 3 lists
list1: returns a unique id.
list2: returns number of activities in this task.
list3: returns number of activities that are currently running (not stopped and persisted) in this task.
Return type: @return:
scaledDensity As Float
A scaling factor for fonts displayed on the display.
This is the same as density, except that it may be adjusted in smaller increments at runtime based on a user preference for the font size.
Return type: @return:
SDK As Int [read only]
The user-visible SDK version of the framework
sendSignal (pid As Int, signal As Int)
Send a signal to the given process.
Serial As String [read only]
Returns the name of the overall product.
Api Level 9
setLowMemory As Boolean
Set to true if the system considers itself to currently be in a low memory situation.
setThreadPriority (tid As Int, priority As Int)
Set the priority of a thread, based on Linux priorities.
supportsProcesses As Boolean
Determine whether the current environment supports multiple processes.
Tags As String [read only]
Returns Comma-separated tags describing the build, like "unsigned,debug".
Threshold As Long [read only]
The threshold of availMem at which we consider memory to be low and start
killing background services and other non-extraneous processes.
Time As Long [read only]
Returns the time.
TotalExternalMemorySize As Long [read only]
Returns the available internal memory size.
Returns -1 if the internal memory is unavailable.
TotalInternalMemorySize As Long [read only]
Returns the total internal memory size.
Type As String [read only]
Returns the type of build, like "user" or "eng".
User As String [read only]
userActivity (when As Long, noChangeLights As Boolean)
User activity happened.
Turns the device from whatever state it's in to full on, and resets the auto-off timer.

when is used to order this correctly with the wake lock calls. This time should be in the SystemClock.uptimeMillis() time base.

noChangeLights should be true if you don't want the lights to turn on because of this event. This is set when the power key goes down.
We want the device to stay on while the button is down, but we're about to turn off. Otherwise the lights flash on and then off and it looks weird.
widthPixels As Int
The absolute width of the display in pixels.
Return type: @return:
xdpi As Float
The exact physical pixels per inch of the screen in the X dimension.
Return type: @return:
ydpi As Float
The exact physical pixels per inch of the screen in the Y dimension
Return type: @return:
Top