Skip to content

Android Stuff

Notes, scripts, hacks.

Download all apk Files

#!/usr/bin/perl

use strict;
use warnings;

my $debug = 0;
my $apkDir = "./apks";
mkdir($apkDir) unless (-d $apkDir);

my $adb = '/home/flip/sandbox/android/android-sdk-linux/platform-tools/adb';
DEBUG("adb=%s", $adb);
die("Missing $adb") unless (-x $adb);

PRINT("Getting list of installes packages.");
my @pkgs = sort map { s/\s*package://; s/\r?\n//; $_ } qx{$adb shell pm list packages};
DEBUG("pkgs=%s", join(', ', @pkgs));


foreach my $package (@pkgs)
{
    DEBUG("Getting info for '%s'.", $package);

    my ($versionName) = map { s/.*versionName=//; s/\r?\n//; s/[() ]+/_/g; s/_+/_/g; $_ }
      grep { m/versionName/ } qx{$adb shell pm dump $package};

    my ($path) = map { s/\s*package://; s/\r?\n//; $_ }
      qx{$adb shell pm path $package};
    DEBUG("--> [%s] [%s]", $versionName, $path);

    my $apk = "$apkDir/$package-$versionName.apk";
    DEBUG("--> [%s] %s", $apk, -f $apk ? "have" : "new");

    if (!-f $apk)
    {
        PRINT("Downloading %s %s", $package, $versionName);
        my ($res) = map { s/\r?\n//; $_ } qx{$adb pull $path $apk 2>&1};
        DEBUG("res=%s", $res);
    }
}

sub DEBUG
{
    my ($fmt, @args) = @_;
    if ($debug)
    {
        if ($#args > -1) { printf(STDERR "D: $fmt\n", @args); }
        else             { print(STDERR "D: $fmt\n"); }
    }
}

sub PRINT
{
    my ($fmt, @args) = @_;
    if ($#args > -1) { printf("$fmt\n", @args); }
    else             { print("$fmt\n"); }
}

# eof

HTC Legend vs. Desire

Feature / Model Legend Desire D
Display 3.2 AMOLED 320x480 3.7 AMOLED 480x800 :-)
Touch multitouch, capacitive
CPU 600MHz 1000MHz :-)
RAM + ROM 384 + 512 512 + 576 :-|
OS Android 2.1 + sense UI
Storage uSD (32GB)
Power 1.3Ah Li-Ion 1.4Ah Li-Ion
Camera 5MP AF LED
wireless 802.11b/g
Bluetooth 2.1 EDR
GSM Quad, GPRS, EDGE
3G Dual, 7.2/2Mbps
Dimensions 112x56.3x11.5 119x60x11.9 :-|
Weight 126g 135g :-|
Radio FM
Navigation GPS, compass, accel.
Sensors proximity, ambient light
Buttons 4+2+trackball
Audio jack 3.5mm
USB micro 2.0
USB charging yes
Thethering USB
Standby time [min] 440 3G, 490 GSM 360 3G, 340 GSM :-(
Talk time [h] 560 3G, 440 GSM 390 3G, 400 GSM :-(
ActiveSync yes
Digitec neu 529.– 569.–
Digitec 1a zero25 529.– 529.–
Digitec 2a zero25 449.– 449.–
Sunrise neu n/a 698.–
Sunrise 1a zero25 n/a 529.–
Sunrise 2a zero25 n/a 399.–
Mediamarkt neu ?
Mediamarkt 1a zero25 549.– 599.–
Mediamarkt 2a zero25 489.– 499.–
Mobilezone neu 599.95 649.95

Appz

Legend ROMs

/etc/hosts

wget -O hosts1.txt http://www.mvps.org/winhelp2002/hosts.txt
wget -O hosts2.txt "http://pgl.yoyo.org/adservers/serverlist.php?showintro=0;hostformat=hosts;mimetype=plaintext"
flip -u hosts1.txt
flip -u hosts2.txt
sed '/^[ t]*#/d;/^[ t]*$/d;s/[ t]*#.*$//;s/t/ /g;s/  / /g' hosts1.txt > hosts1
sed '/^[ t]*#/d;/^[ t]*$/d;s/[ t]*#.*$//;s/t/ /g;s/  / /g' hosts2.txt > hosts2
echo "127.0.0.1 localhost" > hosts
cat hosts1 hosts2 | sort | uniq >> hosts

SD ReadAhead

adb reboot recovery
adb shell
mount /system
echo "echo 128 > /sys/devices/virtual/bdi/179:0/read_ahead_kb" > /system/etc/init.d/10_read_ahead
chgrp shell /system/etc/init.d/10_read_ahead
chmod 750 /system/etc/init.d/10_read_ahead

TODO

created: 2008-03-07, updated: 2015-10-10