Thursday, September 9, 2010

在froyo上找native memory leak

link

setprop libc.debug.malloc 1 or 5 or 10

javascript:void(0)

Tuesday, August 17, 2010

gcin on ubuntu

sudo vi /usr/lib/gtk-2.0/2.10.0/immodule-files.d/gcin.immodules

"gcin" "gcin Input Method" "gcin" "/usr/share/locale" "" <- 最後面本來是 "*" 把*拿掉

Wednesday, August 11, 2010

ubuntu lucid on lenovo x201

boot option 後面的 -- 刪除
加上xforcevesa i915.modeset=0

Tuesday, August 10, 2010

illegal forware reference in java

case 1:  比較常見的
class Test {
  String s = "hello";

  class inner {
    inner () {
        String s = s;  // <- illegal forward reference
    }
  }
}


case 2:  比較特別的 即使sStr是static也會


class Test2 {
  static {
    System.out.println(sStr);  // <- illegal forward reference
  }

  private static String sStr = "hello World";
}

Friday, July 30, 2010

android emulator support

SMS
    - external/qemu/telephony/modem_driver.c
    see http://developer.android.com/guide/developing/tools/emulator.html#sms for usage

MMS
    - N/A

Geolocation/GPS
    - external/qemu/android/gps.[c|h]

    - how to set
        - ddms :
            Emulator Control -> Location Controls -> {Manual, GPX, KML}

        - shell:
            $>telnet localhost
            gps fix
      
Sensor
    emulator has defined 4 sensors
    - acceleration
    - magnetic_field
    - orientation
    - temperature
    only accelerometer is enable, others need to be tested
    see external/qemu/android/hw-sensors.[c|h]
        external/qemu/android/avd/hardware-properties.ini
    for the changing orientation in emulator( Ctrl + F11),
    Android framework computes the orientation by looking at the accelerometer
    see external/qemu/android/hw-sensors.c _hwSensors_setCoarseOrientation

    for the measure units, see hardware/libhardware/include/hardware/sensors.h
  
Camera
    it forks a preview thread, and keeps generating a YUV422 SurfaceView

    see
    - frameworks/base/camera/libcameraservice/FakeCameara.[cpp|h]
    - frameworks/base/camera/libcameraservice/CameraHardwareStub.[cpp|h]
    to modify it to generate different preview screen


Vibration
    not implemented in emulator
    external/qemu/android/hw-control.c # hw_control_do_query only handles power:light:brightness
    and see /sys/class/timed_output/vibrator/enable on device

Backlight
    - external/qemu/android/hw-control.c

    there are 3 kinds of backlight:
        - lcd_backlight
        - keyboard_backlight
        - button_backlight
    but 'Documents' says only lcd_backlight is supported
    see extenal/qemu/docs/ANDROID-QEMUD-SERVICES.TXT #hw-control services

    but actually even lcd_backlight can not work
    because hardware module 'LIGHTS_HARDWARE_MODULE_ID' is only available when
    TARGET_BOARD_PLATFORM is msm7k or qsd8k_dirs
    see hardware/
  
    also see /sys/class/leds on device

Battery Level
    the implementation is in external/qemu/hw/goldfish_battery.c
    - adb shell dumpsys battery

    also it will create a file /sys/class/power_supply/battery on device

Signal Strength
    the implementation is in external/qemu/telephony/android_modem.c
    see the line
    '{ "+CSQ", "+CSQ: 7,99", NULL },  /* XXX: TODO: implement variable signal strength and error rates */'
    modify 7 to change to signal strength

CPU frequency
    N/A
    but we can get cpu usage by issuing adb
    - adb shell dumpsys cpuinfo

    before cupcake, in Development.apk, there's a option for displaying cpu usage on screen,
    but this isn't supported anymore
    see frameworks/base/libs/surfaceflinger/SurfaceFlinger.cpp  #SurfaceFlinger::onTransact

Wednesday, July 21, 2010

在dalvik跟v8中把jit code印出來

dalvik
 mydroid/dalvik/vm/Init.c
   see gDvmJit.printMe = true;


v8
mydroid/external/v8/src/flag-definitions.h
print_code
print_builtin_code

android kernel qemu-armv7

http://groups.google.com/group/android-ndk/browse_thread/thread/a19fc6df3d661d79?hl=en