Friday, August 31, 2012

Background Process, Linux:

  if we want to run the process as background,we have to use & symbol.

   bash>./ to run it as foreground service.

 To run it in background,

   bash>./ &

How to run the process as service in linux: [Always up]:

  1) while linux system is in init process, shell files available in /etc/init.d got executed

whenever the system is up,  .profilerc or .bashrc or /etc/init.d/ scripts are executed.
Add your process to run in background

 add below line in your .bashrc or in any /etc/init.d/*.sh scripts
  ./MyService &

In Linux, From command prompt, if I want to do some bulk copy,usually I do like this:

 i) in one command prompt, I will perform copy operation
 ii)In another command prompt, I will do other work

We can do the same thing in single command prompt... How to do it ?

 i) run copy operation in background operation
 ii) Continue your work

  >cp bigFolder folderB &
   it will immediately returns to prompt,since copy operation is performed in background.
Next line, I can do any operation.

 Once the copy operation is done, It will show below message in command prompt:

 2+1 cp Done.


If we want to mount any folder as sdcard in android device, then we need to look for vold scripts in android

To copy the files to embedded device from Desktop/Host machine:
1.we can mount NFS folder and we can copy from NFS
2.ADB- thru ADB push the files
3.Connect Desktop & embedded device through USB, mount the USB and copy the files through USB

Friday, August 24, 2012

Software Testing:

1.Everything is better if you make your tests before you implement the features

Known testing tools are there.
QTP, LoadRunner, TestRunner

TestRunner which is based on JUnit testing framework.It is used in android CTS testcase. CTS is using XML file for configuring testcases/testcase sequence. Junit is nothing Java testcases.

Ant is a opensource tool to automate the building process. It will use XML to build.
It is similar to make .(make file).

     Android Application project creation & building without eclipse can be automated using Ant tool.

Junit reference:

Using Ant to build android application project reference:

2.Monkey runner tool -Python based module which can control the device complete.
3.Monkey tool- UI/Application excerciser which can generate touch events random generator
which can be used for UI stress tool

4.Software testing books;
  i)Testing computer software
  ii) Lessons learned software testing
  iii)Automated testing -Introduction management and performance

5.Android CTS result
   Android CTS result xml has 3 states.
   i)Passed Testcases
   ii)Failed Testcases
   iii)NotExecuted testcases

   Testcases are listed under "NotExecuted" if it is not executed. This can happen only when Virtual machine is crashed and CTS testsuite is not able to proceed further testcases.

 Assume we have 10 testcases.First 3 testcases are passed. while running 4th testcase java virtual machine is crashed.Then CTS tool wont be able to communicate with the VM, so CTS result xml will list as follows:

  Passed testcases:3
  Failed testcases:0
  Not Executed    :7

  Kermit- can be used for bootstrap.supports transfer of text and binary file over serial communication
  X modem -file transfer protocol with Cyclic redundancy check
  Y modem -  allows multiple batch file transfer

7.JFFS2- support for NAND flash devices
  UBIFS- successor to JFFS2, it supports write caching.
      performs better when large raw flash NAND devices,Directory contents are using B+ trees.

8.Android camera:

Android camera HAL module is available in library.

 Android camera module has 4 components:
   i)Camera client
   ii)Camera service
   iii)Camera HAL module
   iv) Camera driver
  Camera client talks to the cameraservice.Cameraservice talks to camera HAL module.
Camera HAL module talks to camera driver.


9. Three Components of android adb:
   1.adb server [running on Desktop machine, adb start-server, adb kill-server to start and kill adb server, it is also called as adb host daemon]
   2.adb client [running on Desktop machine, adb logcat ]
   3.adb daemon [running on Android device which will receives data through ports from adb server, can also be mentioned as adb target daemon]
10. JDB which can be used to debug android applications

Wednesday, August 22, 2012

Problem solving steps:
1.Log effort on what I am doing for every half an hour or 1 hour work
2.Why we are struck up with problem ?

  i) we dont know what is the problem/what we are doing/why we are doing ?
  ii) Simply try to debug the problem
         Conceptualize the problem
  iii)No clarity on what we are doing, we will do the same thing again and again

3)For every half an hour or 1 hour, Think for 10 mins on what you are upto and what you are going to do?
4)Identify the possible set of problems and localize it one by one
5)For clarity, document what are all the possible approaches tried/why it is failed ?
6)Always start from the known things.[ our task is not do well things we dont know before.To solve
problems, in front of us right now...] It will also lead to know unknown things

7)Anyone can work on known things...
     I know that I know - 3 %
     I Know that I dont know=2%
     I dont know that I dont know -Unleashing this knowledge /handle this type of scenario unleashes your potential.

What to do if CTS tool is not detecting the android device but adb is detecting a device?

Sometimes if we have done any changes not compliant to android, then this problem will happen.

1) if the CTS tool is not detecting the andorid device, we need to check the
platform/tools/tradefederation source code. This is having DeviceStateMonitor module.

2) By running cts-tradefed, it will saves the logs in tmp/log_xxx.txt. we can check error logs
from here and match the platform/tools/tradefederation source code.

running cts-tradefed,
we will get CTS prompt.

cts-tf>list devices

list devices will give device and its state.

Device states are available,Unavailable and allocated.

Allocated state -Allocated state device is currently running tests.
Available state- Device is available CTS is able to detect the device
Unavailable state- Device can be

    To check "available" state, waitForDeviceAvailable() will be called from

// A device is currently considered "available" if and only if three events are true:
        // 1. Device is online aka visible via DDMS/adb
        // 2. Device's package manager is responsive
        // 3. Device's external storage is mounted


 waitForDeviceAvailable() function will be varying for every android version.

Tuesday, August 21, 2012

I)What is CTS ?
II)CTS components
III)How to Run CTS from end user level?
IV)How to run CTS from Windows?
V)CTS binaries and source code structure

I)Why we need CTS ?
CTS testcases tests whether any android apis are modified or any changes done in android that is not compliant to android standard.
Google approves binary only when all CTS testcases are successful. For google approval process,
CTS test cases are executed on device and output .xml is sent to google team.

They will also run the CTS testcases from their end. If there is no failure, then they will approve the binary for the release.
Most of the Mobile operators will expect that the binary should be approved by google.

For some failure cases, we can get a waiver from google. For example, if it is a android DTV/Setupbox, then there wont be any GPS device in it.So all the GPS testcases will fail or not applicable for that device. Waiver request should be reasonable.

II) CTS components:
    CTS is an automated testing application that includes two major components
 1)CTS test application runs on desktop & manages test execution]
 2)Junit testcases running on Mobile or emulator or android device
  JUnit testcases are written in Java and packaged in Android.apk files to run on target device[emulator or android device].
III)How to run CTS from end user level?
   1.CTS can be run from Source code in linux
 if we have android source code, android/CTS folder will be there.
 we can compile CTS by following steps

 source build/
 lunch sdk-eng
 make cts 

 Once the compilation is over, we can run
 from command line.
 From cts-tradefed it will gives cts prompt.In cts prompt,
 type "list devices" to list the connected devices/emulator.You can refer the android cts document for    more information on list of commands.

 [cts-tradefed binary will be available in out/host/linux-x86/bin/cts/android-cts/tools/]
 cts-tradefed is a script file to run JUnit testcases.

   2.CTS can be run from downloaded binary  
         we have to download android compatiblity test suite from android site.

we have to configure this folder in PATH variable
and then we can run
 cts-tradefed in commandline.

 IV)How to run CTS from Windows ? Is it possible ?
      It is possible to run CTS from windows.
 "JUnit testcases are written in Java and packaged in Android.apk files to run on target device" from android cts manual.

 cts-tradefed is a script which will configures java to run Junit testcases.

 Configure CTS in Windows OS:

 Step1: adb path should be configured in PATH variable and "adb devices" should list down the devices.
 Step 2:
    cts-tradefed script will contains the following lines:

JARS="ddmlib-prebuilt.jar tradefed-prebuilt.jar hosttestlib.jar cts-tradefed.jar"

for JAR in $JARS; do
checkFile ${JAR_DIR}/${JAR}

   java -cp ${JAR_PATH} -DCTS_ROOT=${CTS_ROOT}

Assume that I have downloaded ""  and unzipped it

My folder structure will be as follows:D:\android-cts-4.0.3_r3-linux_x86-arm\android-cts\tools
The simplification of this script is as follows for windows:

java -Xmx512M -cp D:\android-cts-4.0.3_r3-linux_x86-arm\android-cts\tools\cts-tradefed.jar;D:\android-cts-4.0.3_r3-linux_x86-arm\android-cts\tools\hosttestlib.jar;D:\android-cts-4.0.3_r3-linux_x86-arm\android-cts\tools\ddmlib-prebuilt.jar;D:\android-cts-4.0.3_r3-linux_x86-arm\android-cts\tools\tradefed-prebuilt.jar -DCTS_ROOT=D:\android-cts-4.0.3_r3-linux_x86-arm\

run this command in commandline then you will get cts prompt in windows OS too.

-cp is the class search path for the zip or jar files. whenever some class is encountered in jar file,java will look for it in class search path.
CTS_ROOT will be used internally in jar files, so we are setting CTS_ROOT by -DCTS_ROOT.
CTS_ROOT is D:\android-cts-4.0.3_r3-linux_x86-arm. not a D:\android-cts-4.0.3_r3-linux_x86-arm\android-cts.[by giving this, i got errors]

V) CTS Binaries & source code structure:
          1)cts-tradefed.jar source code path is "android_source_path/cts"

 ddmlib-prebuilt.jar and tradefed-prebuilt.jar is available as prebuilt binaries. No source code available

 tradefed-prebuilt.jar is a CTS component runs on Desktop machine and manages test execution. platform/tools/tradefederation is the source code folder path for tradefed-prebuilt.jar file.


Saturday, August 18, 2012


1)  MPEG TS file has multiple elementary [multiple audio track] streams... why ? what is the purpose of it?
I got lost once I got the info like TS can have multiple Program streams what is the purpose of it ???

Transport Stream had been originally designed for broadcast.
to carry several media over one bit stream, all the streams are muxed in to one stream and sent it over the network.
Consider DVB (digital TV): each transponder (= frequency) provides one bit stream. But you already need at least two streams for a TV channel: audio and video. And then a lot more that you'll never see carrying meta-information. So instead of transporting each of these streams on a separate frequency, they are multiplexed into one bit stream. That is the MPEG-TS (Transport Stream). A demuxer then takes this stream and separates it into substreams which carry the real information.
As to which audio stream is played: a TV channel can have several audio streams (for example, normal audio, audio with descriptions for visual impaired, another language, etc.). By default, a player will probably play the first audio stream but can switch audio streams at any time.

 TS can have multiple elementary streams which will have separate streams for video/audio/subtitle/Program timing information.

while we are using airtel/Tata sky SetTopBox, we can see the program information at what time, what is the program. This kind of information
is available in PSI of MPEG TS format.PSI means Program Specific Information. PSI contains information about @ what time and date,
what program is to be played.

For more:

2)Seek functionality for MPEG TS:

If we want to add seek functionality to MPEG TS what should we need to do?

   MPEG TS fileformat is not designed for random access. So It can be viewed sequentially.
Android stagefright doesnt have a seek functionality for TS file formats.
But VLC player has added seek functionality in TS fileformat based on PCR [Program clock Reference].

3)what is PCR :

To enable a decoder to present synchronized content, such as audio tracks matching the associated video, at least once each 100 ms a Program Clock Reference, or PCR is transmitted in the adaptation field of an MPEG-2 transport stream packet.
Decoder will calculate actual system time clock.

The PCR is a clock that represents 27 Mhz clock at the encoder side. Hence each tick of PCR clock represents the 1/27 Microseconds.

The first step is to be able to parse the PCR packet. The PCR ticks are maintained by a specific PID (mostly video but can be audio or alternative packets). When the PCR is present in the packet, it is of Adaptation field, type 2 or 3. You can refer to this or wiki for understanding how to parse PCR.

Once you get the PCR value of the packet - (use a 64 bit integer) you have a timestamp P0 for that packet. Now you can seek to exactly say 10 seconds, when you get next PCR packet, with a time stamp, P1 where

P1 = P0 + 10 * 27 * 10^6

So when you see another such packet containing timestamp P1 or more you can be sure of elapsing 10 seconds.PCR may find discontinuity hence, more calculation is needed at the point PCR base shifts.

From :

4)How to generate PTS[Presentation Timestamp] from PCR ?

PCR has 33+9 bits, the PTS 33 bits. The 33 bit-portion (called PCR_base) runs at 90kHz, as does the PTS. The remaining 9 bits are called PCR_ext and run at 27MHz.
 there should be a time-offset between the PTSs of the multiplexed streams and the PCR, it's usually in the range of a few hundred ms, depending on the stream.

The respective decoder needs some time to decode the data and get it ready for presentation at the time given by the respective PTS, that's why the PTSs are always "ahead" of the PCR. ISO-13818 and some DVB specs give specifics about buffering and (de)multiplexing.


Transport Stream had been originally designed for broadcast. Later it was adapted for usage with digital video cameras, recorders and players by adding a 4-byte timecode (TC) to standard 188-byte packets, which resulted in a 192-byte packet.This is what is informally called M2TS stream.
It is used in Bluray disc  and digital video cameras.

Timecode allows quick access to the any part of the stream either from a mediaplayer or from a non-linear video editing system.

6) SetTop Box:
    i)local cable operators give cable connection that is DVB-C signal
    ii)Tata sky or Airtel digital - we have to fix antenna to receive signal- this is called DVB-S (DVB-Satellite signal standard)

Internet Protocol television (IPTV) is a system through which television services are delivered using the Internet protocol suite over a packet-switched network such as the Internet, instead of being delivered through traditional terrestrial, satellite signal, and cable television formats.    

 IPTV provides  3 main services:
   i) Live TV-with or without interactivity related to the current TV show;
   ii) time-shifted television: catch-up TV (replays a TV show that was broadcast hours or days ago), start-over TV (replays the current TV show from its beginning);
   iii)video on demand (VOD): browse a catalog of videos, not related to TV programming

8) SD or HD TV
  High Definition (HD) is swiftly replacing Standard Definition (SD) when it comes to television broadcasts. HD has a high picture resolution of 1920x1080, with 2.07million+ pixels offering 5 times more detail than SD. It has a wide aspect ratio of 16:9 better suited for our eyes which have more horizontal than vertical span, as compared to an aspect ratio of 4:3 in SD.

9) what is Trick Play:
       -Ability to receive broadcast television shows with VCR-like functions such as pause, rewind, fast forward, replay and skip, collectively known as 'trick play', all while rendering a live video stream.


Friday, August 17, 2012

Problems faced while installing android application setup:

1.First time I have opened Android sample application, I got like "Android Native supported libraries"
need to be installed. I installed Android native libraries

2.In 64 bit Windows 7, I faced this problem:
 Android SDK installer [ installer_r08-windows.exe] is not detecting JDK.

I tried the following:
  i)Set the JDK bin/ JRE Bin in PATH variable, it is not working
  ii)Android SDK installation dialog shown that JDK folder path to be set in JAVA_HOME variable
   I did that it is also not working.
  1) Copied java.exe and javaw.exe from JDK bin to c:\windows\system32 and  c:\windows\sysWOW64
 Now android sdk setup is detecting JDK.

Following steps  are needed for ICS Android application Development Setup :

1.Downloaded the JDK7 and installed it in machine
2.Downloaded installer_r20.0.3-windows.exe from google site
3.Run the "installer_r20.0.3-windows.exe"
4.Followed the below blog to download ICS SDK
Now ICS SDKs are installed.Create the AVD for for any platform which requires for application development
5.Downloaded ADT plugin from google site
6.Downloaded the Eclipse classic
7.Downloaded the and set the tools/platform-tools  folder in PATH variable
8.Installed & Opened the Eclipse classic application
9.In Eclipse, Select    Install new software & select the localpath and add the ADT plugin zip file &
install the files
10.After the ADT plugin was installed, eclipse showed that it requires android support libraries...I installed that android support libraries too...

11.In eclipse->Preferences->Android->SDK location as "android_sdk_windows" folder path.
12.create new android application in eclipse
13.To run the application in emulator,
In Eclipse, Select Run->Run Configurations->Give Some string in "Name" box and select Launch default activity.
 In "Target" tab,select the AVD configuration to run the application

Thursday, August 16, 2012

Hyderabad is famous for following things:
1.Biryani [Hyderabadi biryani]
2.Irani chai
4.Haleem [paste kind of food made of mutton meat]

Things learnt today:

1.Chrome browser is having to HTML5 support.
2.what is USB modem stack?
    USB modem client is installed in mobile/device. USB Host driver is installed in laptop or system.
with the help of USB modem stack we can take mobile's internet connection to laptop or system.
In android, this is called tethering.

3.Wifi Hotspot in android mobiles:
    Android mobiles are having Wifi hotspot support. if mobile has internet connectivity, our mobile will acts like WiFi router . we can connect device or laptop
to that WiFi hotspot.
   To provide support WiFi hotspot, WiFi chip should be available in android /mobile device.
Accessing internet via Wifi hotspot is also called as WiFi tethering.

4.VoIP phone:
A VoIP phone uses voice over IP (VoIP) technologies allowing telephone calls to be made over an IP network such as the Internet instead of the ordinary PSTN system. Calls can traverse the Internet, or a private IP network such as that of a company. The phones use control protocols such as Session Initiation Protocol (SIP), Skinny Client Control Protocol (SCCP) or one of various proprietary protocols such as that used by Skype.
From :

Wednesday, August 15, 2012

In Embedded system, First we need to flash loader & then we need to install boot loader (U-BOOT).UBOOT  will configure the kernel  (also pass kernel arguments).

1. what is loader ?
A loader is the part of an operating system that is responsible for loading programs. It is one of the essential stages in the process of starting a program, as it places programs into memory and prepares them for execution. Loading a program involves reading the contents of executable file, the file containing the program text, into memory, and then carrying out other required preparatory tasks to prepare the executable for running. Once loading is complete, the operating system starts the program by passing control to the loaded program code.

2.why we are doing NAND ERASE/NAND WRITE commands for writing loader/U-BOOT/kernel in embedded linux?

In Embedded linux/devices, bootloader is flashed into flash memory.To write kernel/bootloader into flash memory, we
are using NAND ERASE/WRITE.NAND ERASE/WRITE are the commands to reprogram the ROM chips.

Flash memory is a non-volatile computer storage chip that can be electrically erased and reprogrammed. It was developed from EEPROM
(electrically erasable programmable read-only memory) and must be erased in fairly large blocks before these can be rewritten with new data.
The high density NAND type must also be programmed and read in (smaller) blocks, or pages,
while the NOR type allows a single machine word (byte) to be written or read independently.

Example for Flash memory: ROM, EPROM,EEPROM

3.what is Samba file system ?
   In windows, we can access the shared folder in a network. But in linux, if we want to share the folder across the network, we need to install the samba.
So that from any machine in the network, we can access the files as like local folder.

4.In Embedded system, First we need to flash loader & then we need to install boot loader (U-BOOT).UBOOT  will configure the kernel  (also pass kernel arguments).

5.we can use U-Boot to load kernel or other file from TFTP into RAM
6.tftp in embedded linux:
   For transfering the kernel/long files to embedded device,we can use
ii) serial port access
        But tftp will give faster data transfer of files. Reason is that tftp acts on ethernet/network.Ethernet gives 10 Mbps data transfer speed.
 Maximum data transfer in Serial port is 128Kbps or 192 kbps.
But tftp needs
          i) IP configuration [Ethernet hardware]
          ii)tftp client

7. NFS  [Network file system]:

Network file system will boot system files/libraries from the server. NFS client wont have any libraries.
It will just load the required system files/libraries from server.

  NFS use in Embedded system:
         i)In embedded system, instead of flashing binary every time to embedded device, we can just configure the development system's compiled library path in embedded device.
For every compilation, libraries got updated and embedded device will boot libraries everytime from development system.

  Things needed for accessing NFS:
    i) Ethernet[hardware for IP address]
    ii) NFS client

    If we want to get logs from android mobile/consumer device, what we can do ?

   i)we can connect the android mobile consumer device to system via USB and we can get logs via "adb logcat".
   ii) For android development, if we are using putty from windows system to access the Linux server which has source code.
But my device is connected to windows system. In such a scenario, we are able to take android logs from Linux server or windows system.
(But the android device should have IP address.)
How it is possible ?

  if the android consumer device is having IP address[ethernet support],we can connect to the device via IP address
          "adb connect android_device_ipaddress" can be used to connect to android device.Next if we are putting logs,we can get logs via adb logcat.

9.Embedded linux boot sequence:
   ROM Code -> BootStrap/Loader -> U Boot -> Kernel -> RootFiles

Tuesday, August 14, 2012

What the Jumper settings will do ?
 Jumper is used to make short circuites between two or more pins.
One of the real usage is Primary and secondary hard disk is configured via jumper settings.

How CPU usage is calculated ?
1.Assume if the CPU speed is 1KHz then it will executes 1000 cycles/second [/read 1000 bits per second]
  If we are doing program which requires 500 cycles/ second means then CPU usage is 50%. Rest of the 50 % can be used for other
process or program.
  if the program is more intensive and takes 1000 cycles/second to execute, then no more process can run that time. So CPU is so busy in executing the program.
For any external event/program it will respond slowly.

 Normally CPU speed is measured in GHz nowadays.

1KHz = 1000 Hz
1MHz = 1000 KHz
1GHz = 1000 MHz

Sunday, August 12, 2012

indian companies in jeans/shirts/pants

List of indian companies in jeans product:

Indian companies in jeans:

1.Flying machine
2.Shoppers stop
3.Mufti -available in shoppers stop,central,westside, globus
- available in Shoppers stop
- range from Rs 1000
4.New Port -Arvind mills india
5.Excalibur- Arvind mills india
6.integriti jeans
7.Spykar jeans
8.Numero uno
10.lawman pg3
11.Bare denim -Pantaloon group
12.Killer jeans - kewal clothing ltd
13.Trigger jeans
14. DJ & C jeans [from Big Bazaar]

Indian companies in Shirts & Pants:
2.Indian terrain[From chennai]
7.Color Plus [is from Raymond]
8.Pantaloon[their own brand clothes mostly]
9.Shoppers Stop [their own brand clothes mostly]

if you know any indian company in shirts/jeans business, Please replay
& add it too.

Thursday, August 02, 2012

Why YUV format is used in MPEG2/MPEG4/H264encoders for compression ?

  MPEG2/MPEG4/H264 is lossy compression.
RGGB will have image details/color information in all the RGB represented bytes.
if we are applying for lossy compression, there is a chance for losing bits information.
if LSB bits are affected there wont be a big change in image. If MSB bits of RGB is lost,
this will be bigger change in image and user can perceive/can observe the changes in image.

  In YUV format, image details will be available in Y data[ this will have monochrome/ black and white image]. U and V component is used to store color information.

  Eyes can't perceive color information changes than image information. But it can easily observe the changes in image information[Y data which will have black/white image]. So In lossy compression, encoders wont disturb the image information & will
disturb or compress more in color information [UV components]

     If we are using RGB, we cannot separate image information & color information.Because all the pixels will have the image information and color information.

This is the reason why we are using YUV format in lossy compression or MPEG2/MPEG4/H264 encoders.