Sunday, October 31, 2010

"setCPU for Root Users" saves the battery of your Android device

I've used setCPU for Root Users on my Nexus and now on my Desire HD to save battery : setCPU adjusts CPU speed to what is needed to perform the required tasks.

setCPU lets you adjust the lower and upper speed for your CPU. There's a "device selection" function in the menu that lets setCPU perform all the computing and suggest the appropriate values for your hardware. Here's a screenshot for the Desire HD.

The "Time in State" section from the "info" tab lists the time your phone has spent at different speeds. From the following screenshot, it appears the Desire HD CPU speed scales between 4 speeds from 245 MHz to 1024 MHz, spending most of its time between the upper and lower speed. The same screen on the Nexus One shows many different speeds, the Nexus spending most of its time on the lower speed (it naturally depends on how you use your Nexus).

As said in its name, setCPU for Root Users require root access.Rooting instructions can be found here :

Head to setCPU for Root Users's official page to get more informations on setCPU, specially on how to use setCPU to overclock / underclock your CPU.

Scan the following QR-code to download setCPU from the Android Market.

Saturday, October 30, 2010

Friday, October 29, 2010

HTC Desire HD (Ace)

Just receive my new Android phone : the HTC Desire HD (here in english HTC Desire HD).

Very nice phone.

But still not permanently rooted at the time of this writing.

Track Site : how to backup and restore your bookmarks

Before changing Android phone or making a factory reset, you need to backup your Track Site bookmarks before, in order to restore them on your new Android phone or after the factory reset.

1) Backup the bookmarks

To backup, go to "Menu" --> "More" --> "Backup".

The "track_sites.ini" file is created at the root of the SD card. The backup erase any file with the same name.

2.1) Factory reset

If you just make a factory reset, keeping the same phone, you don't have anything more to do, as long as you don't erase your SD card or format it : proceed with the factory reset, then restore your bookmarks following the instructions of section 3) below.

If you want to change your SD card or format it, you need to keep the backup (the "track_sites.ini" file) in a safe place before changing your SD card or formatting it, and then follow the instructions in the next 2.2) section

2.2) Transfer to a new phone

If you change your Android phone or your SD card or format your SD card, you need to transfer the "track_sites.ini" file from your old phone to the root of the SD card on your new Android phone.

This can be done in 2 ways :
  1. The easiest way (recommended) is by connecting your phone to a desktop computer (PC / Mac / Linux) and mounting it as an USB drive.

    This is direct on Mac.
    You need a driver on Windows.

    You just have to copy the "track_sites.ini" file from your old phone phone to the new one (or to a safe place on your computer if you want to format your SD card or change it).
    Then, unmount or disconnect the new phone from USB in order to be able to access the SD card contents.
  2. Developers can use the adb tool (see 2.2 bis) below).

3) Restore the bookmarks

To restore your bookmarks, go to "Menu" --> "More" --> "Restore"
The "track_sites.ini" file is read from the root of the SD card and it's content is loaded in the Track Site app.

Be aware of not loading the file multiple times as file bookmarks are added to the ones that may already exists.

2.2 bis) The adb (hard) way for the developers

The "USB debugging" option should have been activated on both phones ("Settings" --> "Applications" --> "Development" --> "USB debugging").

The full file path is /mnt/sdcard/track_sites.ini

And here is how to get it and transfer it :
  • a) ensure your phone is available

    mac:~ $ adb devices
    List of devices attached
    xxxxxxxxxxx6 device
  • b) ensure the file is where you think it is

    mac:~ $ adb shell
    # ls -l /mnt/sdcard/tra*.ini
    ----rwxr-x 1 system sdcard_r 30719 Oct 28 12:57 /mnt/sdcard/track_sites.ini
    # exit
    mac:~ $
  • c) then go to the directory where you want to download the file (Downloads in the following example) and pull it

    mac:~ $ cd Downloads/
    mac:Downloads $ adb pull /mnt/sdcard/track_sites.ini
    847 KB/s (30719 bytes in 0.035s)
    mac:~ $
  • d) then connect the new phone as in a).

    Ensure the old phone is disconnected from your system or you end up with 2 devices (2 lines) with the adb devices command.

    mac:Downloads $ adb devices
    List of devices attached
    xxxxxxxxxxx6 device
    yyyyyyyyyyy9 device
    mac:~ $
  • e) remove any /mnt/sdcard/track_sites.ini file from the destination.

    mac:Downloads $ adb -s yyyyyyyyyyy9 shell
    $ ls -l /mnt/sdcard/track_sites.ini
    ----rwxr-x system sdcard_rw 1241 2010-10-29 11:03 track_sites.ini
    $ rm /mnt/sdcard/track_sites.ini
    $ ls -l /mnt/sdcard/track_sites.ini
    /mnt/sdcard/track_sites.ini: No such file or directory
    $ exit
    mac:~ $
  • f) push the track_sites.ini file to its final location /mnt/sdcard/track_sites.ini.

    mac:Downloads $ adb -s yyyyyyyyyyy9 push track_sites.ini /mnt/sdcard/track_sites.ini
    1505 KB/s (30719 bytes in 0.019s)
    mac:~ $

Thursday, October 28, 2010

Nexus One - how to upgrade to CyanogenMod-6.1 V6.1.0-RC1 (10/27/2010) - instructions

I have just installed the CyanogenMod-6.1 first release candidate V6.1.0-N1-RC1 - 10/27/2010 (CyanogenMod-6.1 for Nexus One: Holy crap, it's full of AWESOME! V6.1.0-RC1 (10/27/2010)). Just keep in mind it is the 1st Release Candidate and as such, there are still some issues.

As the required radio image is still radio- (Radio Firmware: (FROYO RADIO, 4.06 OR HIGHER REQUIRED!)), I just have to upgrade to the new CyanogenMod-6.1 6.1.0-RC1.

I slightly depart from Cyanogen's instructions to upgrade :
  1. Do a Nandroid Backup !
    --->> steps 1) to 11) from Nexus One - how to upgrade to CyanogenMod-5 [stable 5.0.6 version of 04/15/2010] - detailled instructions
  2. Wipe : I add this step as it prevents problems with Google Apps ; just remember to save everything before (don't forget to backup your Track Site's data).
    The wipe has to be done while in recovery mode just after the Nandroid backup (the previous step).
    Here are the detailled steps :
    • from the "Android system recovery" screen you are just after the step 11), scroll down to the "Wipe" item using the trackball, press on the trackball to select the item
    • On the "Choose wipe item" screen, choose the "Wipe cache" item (the 2nd one) using the trackball. The "Wipe cache" seems to be enough and does not need to reinstall all applications. Press the trackball a 2nd time to confirm on the question that appears on the back of the screen.
    • The wipe starts and takes a few seconds to complete. At the end of the wipe, the cyan screen is restored. Press Volume down button to return to the previous screen "Android system recovery".
    • follow on with step 14) of the upgrade procedure
  3. Install the CyanogenMod-6.1 6.1.0-N1-RC1 - 10/27/2010 ROM (your Google apps will be backed up automatically)
    --->> steps 14) to 16) from Nexus One - how to upgrade to CyanogenMod-5 [stable 5.0.6 version of 04/15/2010] - detailled instructions. Don't reboot at this time and continue with the step below
  4. There's a 4th step to Cyanogen's instructions to install the most up to date version of Google apps : HDPI-20101025 (UPDATE 11/03 : Google Apps have been made available in a dedicated place : ; a wiki dedicated to Google Apps have been made available )
    --->> steps 15) and 18) from Nexus One - how to upgrade to CyanogenMod-5 [stable 5.0.6 version of 04/15/2010] - detailled instructions. At the end, just reboot (or power-down by selecting the right option with the trackball in step 17)).

The detailed instructions to follow are pretty much the same as for Nexus One - how to upgrade to CyanogenMod-6 V6.0.0-RC1 (07/11/2010) - instructions to get the 6.1.0-N1-RC1 - 10/27/2010 ROM installed.

Tuesday, October 19, 2010

ProGuard obfuscation : error Could not load definitions from resource proguard/ant/

I've just tried to obfuscate my TrackSite app with ProGuard following Dan Galpin's instructions from Proguard, Android, and the Licensing Server.

I've encountered the « Could not load definitions from resource proguard/ant/ » error during the ant release build :

[javac] /Users/raph/droid/android-sdk-mac/tools/ant/ant_rules_r3.xml:336: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
[javac] Compiling 1 source file to /Users/raph/droid/workspace/TrackSites/bin/classes

[taskdef] Could not load definitions from resource proguard/ant/ It could not be found.
[delete] Deleting: /Users/raph/droid/workspace/TrackSites/obf/original.jar
[jar] Building jar: /Users/raph/droid/workspace/TrackSites/obf/original.jar


The add-proguard-release.xml provided with the Proguard, Android, and the Licensing Server contains the following definitions at lines 19 and 29

<property name="proguard-jar" value="${proguard.dir}/proguard.jar" />
<taskdef resource="proguard/ant/" classpath="${proguard-jar}" />

This refers to a file. According to the article Obfuscating Your MIDlet Suite from the Sun Developer Network (look for section « Ant Script ») this file is included into the proguard.jar jar file distributed with ProGuard, inside the .jar file.

Then, the solution is to update the property at line 19 to point to the real location of the proguard.jar archive, that is located in the lib/ sub-directory. So the property's value should be « value="${proguard.dir}/lib/proguard.jar" »

<property name="proguard-jar" value="${proguard.dir}/lib/proguard.jar" />

The ant release build then looks like :

[javac] /Users/raph/droid/android-sdk-mac/tools/ant/ant_rules_r3.xml:336: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
[javac] Compiling 1 source file to /Users/raph/droid/workspace/TrackSites/bin/classes

[delete] Deleting: /Users/raph/droid/workspace/TrackSites/obf/original.jar
[jar] Building jar: /Users/raph/droid/workspace/TrackSites/obf/original.jar
[proguard] ProGuard, version 4.5.1
[proguard] Reading input...
[proguard] Reading program jar [/Users/raph/droid/workspace/TrackSites/obf/original.jar]
[proguard] Reading library jar [/Users/raph/droid/android-sdk-mac/platforms/android-8/android.jar]
[proguard] Reading library directory [/Users/raph/droid/workspace/TrackSites/libs]
[proguard] Initializing...
[proguard] Note: the configuration refers to the unknown class ''
[proguard] Note: there were 1 references to unknown classes.
[proguard] You should check your configuration for typos.
[proguard] Ignoring unused library classes...