Remove CarrierIQ from rooted Android device

First of all, Thanks TrevE , the author of  Logging Test App. All I done in this article is just following what he did in his app.

These days, Carrier IQ brought an big earthquake in almost all popular mobile platforms including Android, iOS, Blackberry

How to check if your device is CIQed or not:

Update: just got in mind that no need to use PC side tools, just install and launchTerminal Emulator and run below commands one by one and check command output like adb method:

am start -n com.htc.android.iqagent/.test.MainActivity
am start -n com.carrieriq.iqagent.service/.ui.DebugSettings

( not requiring root, but android adb tool needed)

1. Make sure you have installed adb driver of your device; make sure you have got adb on your PC (download Android SDK and find it in platform-tools)
2. Execute following two commands:

</del>
<del>adb shell am start -n com.htc.android.iqagent/.test.MainActivity</del>
<del>adb shell am start -n com.carrieriq.iqagent.service/.ui.DebugSettings</del>
<del>


If both commands give you output like:

Error: Activity class {…} does not exist.

Congrats, your device has not been infected.

If no error output displayed, then you are infected. See below guides to remove

How to remove CarrierIQ:
( need root privilege in your device, root your device firstly and then install superuser app )

Caution: Do below at your own risk. I will not be responsible for any damage

1. If you are not familiar with shell commands, just use RootExplorer to do it instead:

  • click “Mount R/W” to remount a directory as read and write
  • Long press on an entry and select ‘Delete’ from the popup list to delete

2. commands below ( explanation starts with ‘#’)

#enter adb shell
adb shell
# got root privilege. make sure you have rooted your device and install Superuser.
#If you did not see a change from '$' to '#' after the command without any error, you do not root your device
su
#remount your /system with read&write privilege. every device got different arguments.
#Below is a Nexus S example, just an example, Nexus S does not include CIQ
#To get the correct argument, you could firstly use command 'mount' in the shell, then find the line contains '/system'

# e.g. I found "/dev/block/platform/s3c-sdhci.0/by-name/system /system ext4 ro,relatime,barrier=1,data=ordered 0 0"
#split them by white spaces. then see the command below, you will know how to remount your system

mount -o rw,remount -t ext4 /dev/block/platform/s3c-sdhci.0/by-name/system /system
# remove below files and folders
rm /system/bin/htcipcd
rm -r /app-cache/ciq/*
rm -r /app-cache/iqserver/*
rm -r /data/misc/agent_htc/*
rm -r /data/data/com.htc.android.iqagent/*
rm -r /data/data/com.htc.android.iqrd/*
#remount /system as Read Only again.
mount -o ro,remount -t ext4 /dev/block/platform/s3c-sdhci.0/by-name/system /system
#exit root
exit

That’s what I get from the application. Do not know if it works.
So plz tell me the check result after your did the remove part to see if the remove part works.

Using Android monkeyrunner from Eclipse, both in Windows and Linux!

This time I want to use English to make this article useful for all others in the world:)

As you know, Android MonkeyRunner is a good testing tool, but we could only develop monkeyrunner under a text editor like Vim, emacs, etc.

Diego Torres Milano wrote a blog to make Monkeyrunner running on Eclipse, he had done that on Linux. But according to his article, he mislead guys thinking that his solution also works on Windows. But after serveral tries by myself and others’ comments, it does not work in Windows at all.

Here I found a solution which also works on Windows(I have tried it by myself). And I believe that it also works on Linux, as the solution does not include any platform independent mechanism. Here we go 🙂

      1. Install/Update latest PyDev (2.2.4 at present, I think it does not relate to the PyDev version) by Eclipse Marketplace or direct install link, see guide here
      2. Extract Lib folder in ANDROID_SDK\tools\lib\jython.jar using 7-Zip/WinRAR  to ANDROID_SDK\tools\lib folder, which would be like ANDROID_SDK\tools\lib\Lib
      3. Add a Jython Interpreter under Window>Preferences>PyDev>Interpreter – Jython. Using the jython.jar from Android SDK\tools\lib folder.
      4. Please notice that adding Android SDK\tools\lib and monkeyrunner.jar in Libraries. See snapshot below: Monkeyrunner in Eclipse
      5. Click “Apply” and wait it finish. Press “OK”
      6. Now you can use this new MonkeyRunner Interpreter to set up a PyDev project. But please make sure to choose “Jython” and using Grammar version “2.5” as Jython itself is not catching up with Python. The latest Jython is 2.5.2, but Android SDK uses 2.5.0. It’s OK to replace the old one with the latest one. That’s another story. Snapshot of project setup:

Now you could write MonkeyRunner script with convenient features like auto-completion, grammmer error notice etc. Have fun:)

Notice: you cannot click the Run button to execute monkeyrunner script, it will not use monkeyrunner.bat to execute.

AndroidDriver for Selenium Python Client

My first real project!

这是我第一次想把自己工作相关的东西拿出来开源,这也是我觉得我迄今为止做成的最像个样也最有成就感的一个工程:

  • 一是之前自己都没有用SCM,现在用上git后发现真的非常之方便好用
  • 二是之前都是在博客上发布些自己写的小工具,不能真正和世界挂钩。其实自己写过很多和Android自动化测试相关的东西了,只是没公开而已。这次是给Selenium+Android写的,应该有挺多人能从我写的东西里面受益吧。

本来想是不是能争取做selenium的一个committer提交的,不过鉴于俺新手的水平,没敢提。先自己练着吧。。。

这个是我的开源项目地址:https://github.com/truebit/AndroidWebDriver4Python

说明文档,需要知道的都在里面了:https://github.com/truebit/AndroidWebDriver4Python/blob/master/README

现在是1.0-final版,做了20次的压力测试(真机和模拟器各10次),没有问题

下一步准备实现同时对多个设备的操作,应该不是啥大问题。

大家如果有什么问题或者建议请在GitHub提出来,也可以在微博上问我:@SeganW

题外话,在家的时候提交修改出现以下错误:

error: The requested URL returned error: 403 while accessing https://truebit@github.com/truebit/AndroidWebDriver4Python.git/info/refs

fatal: HTTP request failed

后来终于知道:原来GitHub只有ssh形式的clone代码才是可以读写的。要修改也挺简单:

编辑该repo目录下的.git/config文件,找到url那行,把前面的https://truebit改成ssh://github 改完的效果是这样的:

url = ssh://git@github.com/truebit/AndroidWebDriver4Python.git

改之前是

https://truebit@github.com/truebit/AndroidWebDriver4Python.git

其实就是从read-only的https改成read-write的ssh!