ubuntu 在 R40e 上 還有 Debian 在 Sempron 2600 上

2013年7月29日 星期一

hTC sensation , 改 CWM recovery. 安裝Thinkingbridge

放入 PG58IMG.zip ,按volume-down 和 power 開機進入hboot,
他自己就升級了,然後就說 CID error。

先把 PGM58IMG.zip 刪除,開入 hboot,選 fastboot, 按下power 進入 fastboot。
用 fastboot command:
$ fastboot getvar cid
cid: HTC__621
finished. total time: 0.002s
google 了一下,這是 carrier id。

要改萬用 cid:
$ fastboot oem writecid 11111111
...
(bootloader) Start Verify: 0
(bootloader) erase sector 65504 ~ 65535 (32)
(bootloader) mipi_dsi_cmd_config:panel_id=0x940021
(bootloader) width=540 height=960
(bootloader) mipi_dsi_cmd_config:panel_id=0x940021
(bootloader) width=540 height=960
OKAY [  1.677s]
finished. total time: 1.678s
之後關機,再把PGM58IMG.zip copy 到 sd,volume-down + power 開進 hboot。
就出現 "Update ?"
按 power 選 OK 後,就開始 update...............
然後就 按 power 確認 reboot,趕快把 sd 抽出來,刪掉 PGM58IMG.zip

下次 volume+power 開機進入 hboot,選 recovery.. 就會進入 CWM 了。


然後選 backup...

原先安裝 KANG 的版本,但是不裝gapp 時還 OK,可以開機,裝完GAPP後就沒辦法開了 (可能是 GAPP版本太新/不合)

最後安裝的是thinkingbridge 的版本 :
thinkingbridge_pyramid-userdebug 4.2.2 JDQ39E eng.woorim.20130627.214502 test-keys
gapp 是 201303 的版本

使用起來,好像還 OK...

..只是充電好像有點問題...
..google map 轉動時,畫面會閃動 (update 沒有sync 到 frame refresh time)
..很耗電,睡覺時放著 4 hr, 耗掉 40%..
還有不定時重開機...
  • 切到mass-storage mode
  • 從 status bar 啟動 wifi


ref:
  • http://bbs.dospy.com/thread-14084264-1-461-1.html
  • http://www.theandroidsoul.com/cwm-clockworkmod-recovery-6-0-htc-sensation-guide/
  • http://forum.xda-developers.com/showthread.php?t=2341088
  • http://forum.xda-developers.com/showthread.php?t=2115520

有點怪怪的地方...
  • 沒放 SD card 好像不會進 hboot
  • power off 後,不拔電池好像沒有真的斷電-- htc 網站好像也有這麼說。
  • 外殼好像有問題,有時候按下volume down 會沒效
  • CWM 6.0 好像不能用,刷完幾個 ROM都一直重複開到 recovery,後來改 4.0.X 的CWM 後,刷 ROM 才成功(一個 bruce ?)


使用一週後的心得:

太耗電了,100%的電,用不到 8 hrs。
把 3G 關掉,睡覺4hrs,耗電0%,但是打開3G的化,睡覺 4hr, 耗電30%。查看都是screen 耗電 (螢幕都關著還耗電?)

只開Wifi 也一樣。

還有3G找電信商,每次都錯誤。

只有這兩點,其他function 都工作蠻好的。
camera, bt, wifi, usb-tether, hotspot...etc

已經offline 的 ubuntu 版本的 repo 集散地 : old-releases.ubuntu.com

ubuntu 改版的速度很快,所以一些不是 LTS 的版本,一下子就下架了,
repository sever 也移除了。

如果還有舊的 server,仍然使用這些下架版本,要apt-get install 新 package 就會 fail。

這時候就要改一下 source.list

ubuntu 把這些下架,不再mantain 的 版本都放在: old-releases.ubuntu.com

以 10.10 (maverick) 為例,把 sources.list 改成:
deb http://old-releases.ubuntu.com/ubuntu/ maverick main restricted universe multiverse
deb http://old-releases.ubuntu.com/ubuntu/ maverick-updates main restricted universe multiverse
deb http://old-releases.ubuntu.com/ubuntu/ maverick-security main restricted universe multiverse


ref: Old Repository Ubuntu 10.10 Maverick Meerkat

2013年7月23日 星期二

imx53 bootlog - bsp 10.3.2 on qsb


U-Boot 2009.08-00333-g9e1496a (Jul 23 2013 - 15:31:46)

CPU:   Freescale i.MX53 family 2.1V at 800 MHz
mx53 pll1: 800MHz
mx53 pll2: 400MHz
mx53 pll3: 216MHz
mx53 pll4: 455MHz
ipg clock     : 66666666Hz
ipg per clock : 33333333Hz
uart clock    : 66666666Hz
cspi clock    : 54000000Hz
ahb clock     : 133333333Hz
axi_a clock   : 400000000Hz
axi_b clock   : 200000000Hz
emi_slow clock: 133333333Hz
ddr clock     : 400000000Hz
esdhc1 clock  : 80000000Hz
esdhc2 clock  : 80000000Hz
esdhc3 clock  : 80000000Hz
esdhc4 clock  : 80000000Hz
nfc clock     : 26666666Hz
Board: MX53-LOCO 1.0
Boot Reason: [POR]
Boot Device: SD
I2C:   ready
DRAM:   1 GB
MMC:   FSL_ESDHC: 0, FSL_ESDHC: 1
*** Warning - bad CRC or MMC, using default environment

In:    serial
Out:   serial
Err:   serial
da9052_i2c_is_connected - i2c write success....
Serial reinitilized!
Checking for recovery command file...
Net:   got MAC address from IIM: 00:04:9f:01:b4:e0
FEC0 [PRIME]
Warning: FEC0 MAC addresses don't match:
Address in SROM is         00:04:9f:01:b4:e0
Address in environment is  00:04:9f:00:ea:d3

Hit any key to stop autoboot:  0

MMC read: dev # 0, block # 2048,count 8192 ...
8192 blocks read: OK

MMC read: dev # 0, block # 12288,count 768 ...
768 blocks read: OK
## Booting kernel from Legacy Image at 70800000 ...
   Image Name:   Linux-2.6.35.3-01268-g2a94aa9
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    3326256 Bytes =  3.2 MB
   Load Address: 70008000
   Entry Point:  70008000
   Verifying Checksum ... OK
## Loading init Ramdisk from Legacy Image at 70d00000 ...
   Image Name:   Android Root Filesystem
   Image Type:   ARM Linux RAMDisk Image (uncompressed)
   Data Size:    312320 Bytes = 305 kB
   Load Address: 70308000
   Entry Point:  70308000
   Verifying Checksum ... OK
   Loading Kernel Image ... OK
OK

Starting kernel ...

Initializing cgroup subsys cpu
Linux version 2.6.35.3-01268-g2a94aa9 (charles-chang@robot) (gcc version 4.4.3 (GCC) ) #2 PREEMPT Tue Jul 23 15:45:49 CST 2013
CPU: ARMv7 Processor [412fc085] revision 5 (ARMv7), cr=10c53c7f
CPU: VIPT nonaliasing data cache, VIPT nonaliasing instruction cache
Machine: Freescale MX53 LOCO Board
Memory policy: ECC disabled, Data cache writeback
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 213860
Kernel command line: console=ttymxc0 init=/init androidboot.console=ttymxc0 di0_primary pmem=32M,64M fbmem=5M gpu_memory=64M dcc=off video=mxcdi1fb:YUV444,TV-NTSC tve calibration
PID hash table entries: 2048 (order: 1, 8192 bytes)
Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
allocated 6952960 bytes of page_cgroup
please try 'cgroup_disable=memory' option if you don't want memory cgroups
Memory: 512MB 334MB = 846MB total
Memory: 842028k/842028k available, 24276k reserved, 342016K highmem
Virtual kernel memory layout:
    vector  : 0xffff0000 - 0xffff1000   (   4 kB)
    fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
    DMA     : 0xfde00000 - 0xffe00000   (  32 MB)
    vmalloc : 0xe0800000 - 0xf4000000   ( 312 MB)
    lowmem  : 0xc0000000 - 0xe0000000   ( 512 MB)
    pkmap   : 0xbfe00000 - 0xc0000000   (   2 MB)
    modules : 0xbf000000 - 0xbfe00000   (  14 MB)
      .init : 0xc0008000 - 0xc0039000   ( 196 kB)
      .text : 0xc0039000 - 0xc0893000   (8552 kB)
      .data : 0xc08b4000 - 0xc091cc60   ( 420 kB)
SLUB: Genslabs=11, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
Hierarchical RCU implementation.
        RCU-based detection of stalled CPUs is disabled.
        Verbose stalled-CPUs detection is disabled.
NR_IRQS:368
MXC GPIO hardware
MXC IRQ initialized
MXC_Early serial console at MMIO 0x53fbc000 (options '115200')
bootconsole [ttymxc0] enabled
Console: colour dummy device 80x30
Calibrating delay loop... 999.42 BogoMIPS (lpj=4997120)
pid_max: default: 32768 minimum: 301
Security Framework initialized
Mount-cache hash table entries: 512
Initializing cgroup subsys debug
Initializing cgroup subsys ns
Initializing cgroup subsys cpuacct
Initializing cgroup subsys memory
Initializing cgroup subsys devices
Initializing cgroup subsys freezer
Initializing cgroup subsys blkio
CPU: Testing write buffer coherency: ok
regulator: core version 0.5
NET: Registered protocol family 16
i.MX IRAM pool: 128 KB@0xe0840000
IRAM READY
CPU is i.MX53 Revision 2.1
Using SDMA I.API
MXC DMA API initialized
IMX usb wakeup probe
IMX usb wakeup probe
bio: create slab  at 0
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
da9052_i2c_is_connected - i2c read success....
regulator: DA9052_LDO1: 600 <--> 1800 mV at 1300 mV normal
regulator: DA9052_LDO2: 600 <--> 1800 mV at 1300 mV normal
regulator: DA9052_LDO3: 1725 <--> 3300 mV at 3300 mV normal
regulator: DA9052_LDO4: 1725 <--> 3300 mV at 2775 mV normal
regulator: DA9052_LDO5: 1200 <--> 3600 mV at 1300 mV normal
regulator: DA9052_LDO6: 1200 <--> 3600 mV at 1300 mV normal
regulator: DA9052_LDO7: 1200 <--> 3600 mV at 2750 mV normal
regulator: DA9052_LDO8: 1200 <--> 3600 mV at 1800 mV normal
regulator: DA9052_LDO9: 1250 <--> 3650 mV at 1500 mV normal
regulator: DA9052_LDO10: 1200 <--> 3600 mV at 1300 mV normal
regulator: DA9052_BUCK_CORE: 500 <--> 2075 mV at 1250 mV normal
regulator: DA9052_BUCK_PRO: 500 <--> 2075 mV at 1300 mV normal
regulator: DA9052_BUCK_MEM: 925 <--> 2500 mV at 1500 mV normal
regulator: DA9052_BUCK_PERI: 1800 <--> 3600 mV at 3600 mV normal
DA9053 chip ID reg read=0xa3
BB version probed
IPU DMFC NORMAL mode: 1(0~1), 5B(4,5), 5F(6,7)
Advanced Linux Sound Architecture Driver Version 1.0.23.
Bluetooth: Core ver 2.15
NET: Registered protocol family 31
Bluetooth: HCI device and connection manager initialized
Bluetooth: HCI socket layer initialized
Switching to clocksource mxc_timer1
NET: Registered protocol family 2
IP route cache hash table entries: 16384 (order: 4, 65536 bytes)
TCP established hash table entries: 65536 (order: 7, 524288 bytes)
TCP bind hash table entries: 65536 (order: 6, 262144 bytes)
TCP: Hash tables configured (established 65536 bind 65536)
TCP reno registered
UDP hash table entries: 256 (order: 0, 4096 bytes)
UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
NET: Registered protocol family 1
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
Unpacking initramfs...
Freeing initrd memory: 304K
LPMode driver module loaded
Static Power Management for Freescale i.MX5
PM driver module loaded
sdram autogating driver module loaded
Bus freq driver module loaded
DI0 is primary
mxc_dvfs_core_probe
DVFS driver module loaded
i.MXC CPU frequency driver
DVFS PER driver module loaded
highmem bounce pool size: 64 pages
ashmem: initialized
msgmni has been set to 977
alg: No test for stdrng (krng)
cryptodev: driver loaded.
io scheduler noop registered
io scheduler deadline registered
io scheduler cfq registered (default)
regulator: get() with no identifier
By setting, SII driver will not be enabled
By setting, LDB driver will not be enabled
mxc_ipu mxc_ipu: Channel already disabled 9
mxc_ipu mxc_ipu: Channel already uninitialized 9
mxc_ipu mxc_ipu: Channel already disabled 7
mxc_ipu mxc_ipu: Channel already uninitialized 7
mxc_ipu mxc_ipu: Channel already disabled 10
mxc_ipu mxc_ipu: Channel already uninitialized 10
Serial: MXC Internal UART driver
mxcintuart.0: ttymxc0 at MMIO 0x53fbc000 (irq = 31) is a Freescale i.MX
console [ttymxc0] enabled, bootconsole disabled
console [ttymxc0] enabled, bootconsole disabled
mxcintuart.1: ttymxc1 at MMIO 0x53fc0000 (irq = 32) is a Freescale i.MX
mxcintuart.2: ttymxc2 at MMIO 0x5000c000 (irq = 33) is a Freescale i.MX
mxcintuart.3: ttymxc3 at MMIO 0x53ff0000 (irq = 13) is a Freescale i.MX
mxcintuart.4: ttymxc4 at MMIO 0x63f90000 (irq = 86) is a Freescale i.MX
loop: module loaded
pmem_adsp: 1 init
pmem_gpu: 1 init
MXC MTD nand Driver 3.0
i.MX GPMI NFC
vcan: Virtual CAN interface driver
Freescale FlexCAN Driver
FEC Ethernet Driver
fec_enet_mii_bus: probed
PPP generic driver version 2.4.2
PPP Deflate Compression module registered
PPP BSD Compression module registered
PPP MPPE Compression module registered
NET: Registered protocol family 24
tun: Universal TUN/TAP device driver, 1.6
tun: (C) 1999-2004 Max Krasnyansky 
ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
fsl-ehci fsl-ehci.1: Freescale On-Chip EHCI Host Controller
fsl-ehci fsl-ehci.1: new USB bus registered, assigned bus number 1
fsl-ehci fsl-ehci.1: irq 14, io base 0x53f80200
fsl-ehci fsl-ehci.1: USB 2.0 started, EHCI 1.00
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 1 port detected
usbcore: registered new interface driver cdc_acm
cdc_acm: v0.26:USB Abstract Control Model driver for USB modems and ISDN adapters
Initializing USB Mass Storage driver...
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
usbcore: registered new interface driver usbserial
usbserial: USB Serial Driver core
USB Serial support registered for GSM modem (1-port)
usbcore: registered new interface driver option
option: v0.7.2:USB Driver for GSM modems
ARC USBOTG Device Controller driver (1 August 2005)
Android usb driver initialize
android_usb gadget: android_usb ready
fsl-usb2-udc: bind to driver android_usb
android gadget: register function adb
android gadget: register function usb_mass_storage
android gadget: register function rndis
rndis_function_bind_config MAC: 00:00:00:00:00:00
android_usb gadget: using random self ethernet address
android_usb gadget: using random host ethernet address
usb0: MAC 6e:56:e7:87:0e:92
usb0: HOST MAC 8a:fe:4a:2d:29:62
android_usb gadget: usb_mass_storage, version: 2009/09/11
android_usb gadget: Number of LUNs=3
 lun0: LUN: removable file: (no medium)
 lun1: LUN: removable file: (no medium)
 lun2: LUN: removable file: (no medium)
f_accessory init
android gadget: register function accessory
mice: could not register psaux device, error: -16
mice: PS/2 mouse device common for all mice
input: gpio-keys as /devices/platform/gpio-keys/input/input0
MXC keypad loaded
egalax_ts 2-0004: request gpio failed:-16
egalax_ts 2-0004: egalax_ts: failed to read firmware version
egalax_ts: probe of 2-0004 failed with error -5
p1003_fwv33 2-0041: couldn't read panel infomation.
p1003_fwv33: probe of 2-0041 failed with error -5
DA9052 TSI Device Driver, v1.0
input: da9052_tsi as /devices/virtual/input/input1
TSI Drv Successfully Inserted da9052_tsi
input: da9052-onkey as /devices/platform/imx-i2c.0/i2c-0/0-0048/da9052-onkey/input/input2
using rtc device, da9052-rtc, for alarms
da9052-rtc da9052-rtc: rtc core: registered da9052-rtc as rtc0
i2c /dev entries driver
IR NEC protocol handler initialized
IR RC5(x) protocol handler initialized
IR RC6 protocol handler initialized
IR JVC protocol handler initialized
IR Sony protocol handler initialized
Linux video capture interface: v2.00
mxc_v4l2_output mxc_v4l2_output.0: Registered device video1
usbcore: registered new interface driver uvcvideo
USB Video Class driver (v0.1.0)
APM Battery Driver
check mma8450 chip ID
mma8450 0-001c: build time Jul 23 2013 15:43:38
input: mma8450 as /devices/virtual/input/input3
add mma8450 i2c driver
MXC WatchDog Driver 2.0
MXC Watchdog # 0 Timer: initial timeout 60 sec
device-mapper: ioctl: 4.17.0-ioctl (2010-03-05) initialised: dm-devel@redhat.com
Bluetooth: Virtual HCI driver ver 1.3
Bluetooth: HCI UART driver ver 2.2
Bluetooth: HCIATH3K protocol initialized
Bluetooth: Generic Bluetooth USB driver ver 0.6
usbcore: registered new interface driver btusb
VPU initialized
mxc_asrc registered
gpu mmu disabled
mxsdhci: MXC Secure Digital Host Controller Interface driver
mxsdhci: MXC SDHCI Controller Driver.
mmc0: SDHCI detect irq 0 irq 1 INTERNAL DMA
mxsdhci: MXC SDHCI Controller Driver.
mmc1: SDHCI detect irq 203 irq 3 INTERNAL DMA
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
logger: created 64K log 'log_main'
logger: created 256K log 'log_events'
logger: created 64K log 'log_radio'
logger: created 64K log 'log_system'
Cirrus Logic CS42888 ALSA SoC Codec Driver
sgtl5000-i2c 1-000a: SGTL5000 revision 17
mxc_spdif mxc_spdif.0: MXC SPDIF Audio Transmitter
No device for codec mxc spdif
No device for DAI mxc spdif
No device for DAI imx-ssi-1-0
No device for DAI imx-ssi-1-1
No device for DAI imx-ssi-2-0
No device for DAI imx-ssi-2-1
No device for DAI imx-spdif-dai
DMA Sound Buffer Allocated: Playback UseIram=1 ext_ram=0 buf->addr=f8016000 buf->area=e0856000 size=24576
DMA Sound Buffer Allocated: Capture  UseIram=1 ext_ram=1 buf->addr=8f350000 buf->area=fe901000 size=24576
asoc: SGTL5000 <-> imx-ssi-2-0 mapping ok
mmc0: new high speed SD card at address 1234
mmcblk0: mmc0:1234 SA02G 1.83 GiB
 mmcblk0: p1 p2 p3 < p5 p6 > p4
DMA Sound Buffer Allocated: Playback UseIram=1 ext_ram=1 buf->addr=8f3b8000 buf->area=fe907000 size=24576
asoc: mxc spdif <-> imx-spdif-dai mapping ok
ALSA device list:
  #0: imx-3stack (SGTL5000)
  #1: imx-3stack-spdif (mxc spdif)
nf_conntrack version 0.5.0 (13161 buckets, 52644 max)
IPv4 over IPv4 tunneling driver
GRE over IPv4 tunneling driver
ip_tables: (C) 2000-2006 Netfilter Core Team
TCP cubic registered
NET: Registered protocol family 10
IPv6 over IPv4 tunneling driver
NET: Registered protocol family 17
NET: Registered protocol family 15
can: controller area network core (rev 20090105 abi 8)
NET: Registered protocol family 29
can: raw protocol (rev 20090105)
can: broadcast manager protocol (rev 20090105 t)
Bluetooth: L2CAP ver 2.14
Bluetooth: L2CAP socket layer initialized
Bluetooth: SCO (Voice Link) ver 0.6
Bluetooth: SCO socket layer initialized
Bluetooth: RFCOMM TTY layer initialized
Bluetooth: RFCOMM socket layer initialized
Bluetooth: RFCOMM ver 1.11
Bluetooth: BNEP (Ethernet Emulation) ver 1.3
Bluetooth: BNEP filters: protocol multicast
Bluetooth: HIDP (Human Interface Emulation) ver 1.2
L2TP core driver, V2.0
PPPoL2TP kernel driver, V2.0
VFP support v0.3: implementor 41 architecture 3 part 30 variant c rev 2
regulator_init_complete: incomplete constraints, leaving DA9052_BUCK_PERI on
regulator_init_complete: incomplete constraints, leaving DA9052_BUCK_MEM on
regulator_init_complete: incomplete constraints, leaving DA9052_BUCK_PRO on
regulator_init_complete: incomplete constraints, leaving DA9052_BUCK_CORE on
regulator_init_complete: incomplete constraints, leaving DA9052_LDO10 on
regulator_init_complete: incomplete constraints, leaving DA9052_LDO9 on
regulator_init_complete: incomplete constraints, leaving DA9052_LDO8 on
regulator_init_complete: incomplete constraints, leaving DA9052_LDO6 on
regulator_init_complete: incomplete constraints, leaving DA9052_LDO5 on
regulator_init_complete: incomplete constraints, leaving DA9052_LDO4 on
regulator_init_complete: incomplete constraints, leaving DA9052_LDO3 on
regulator_init_complete: incomplete constraints, leaving DA9052_LDO2 on
regulator_init_complete: incomplete constraints, leaving DA9052_LDO1 on
da9052-rtc da9052-rtc: setting system clock to 2000-01-01 00:00:00 UTC (946684800)
Freeing init memory: 196K
init: cannot open '/initlogo.rle'
EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
EXT4-fs (mmcblk0p5): mounted filesystem with ordered data mode. Opts: noauto_da_alloc
EXT4-fs (mmcblk0p6): mounted filesystem with ordered data mode. Opts: (null)
init: cannot find '/system/etc/install-recovery.sh', disabling 'flash_recovery'
init: cannot find '/system/bin/magd', disabling 'magd'
enabling adb
# warning: `rild' uses 32-bit capabilities (legacy support in use)
pmem: request for physical address of pmem region from process 2166.
Unhandled fault: external abort on non-linefetch (0x1018) at 0x40a85054

server 的 gitweb 又活了

上次server 換硬碟後 gitweb 就掛了,大概是 copy 的動作不完全,所以 gitweb error log 一堆 png 找不到。
最近因為修復 git difftool ( http://mygitcommand.blogspot.tw/2013/07/git-difftool-readonly.html ) 所以移除過 git,
連帶 gitweb, git-daemon 也一併被除,
所以只好重裝。

結果就好了,這次重新設定 gitweb 的repo 到 git-daemon root,不限定某個 project

2013年7月11日 星期四

2013年7月10日 星期三

OMXPlayer, MediaSanner, MediaPlayer, VideoView...

OMXPlayer is an Interface Only:
-- framework/base/include/media/OMXPlayer.h
class OMXPlayer : public MediaPlayerInterface
{
public:
                        OMXPlayer(int nMediaType = 0);
    virtual             ~OMXPlayer();

    virtual status_t    initCheck();
    virtual status_t    setDataSource(const char *url, const KeyedVector *headers);
    virtual status_t    setDataSource(int fd, int64_t offset, int64_t length);
    virtual status_t    setVideoSurface(const sp& surface);
    virtual status_t    setVideoSurface(const android::sp& surface);
    virtual status_t    setVideoSurfaceTexture(const android::sp& surfaceTexture);
    virtual status_t    prepare();
    virtual status_t    prepareAsync();
    virtual status_t    start();
    virtual status_t    stop();
    virtual status_t    pause();
    virtual bool        isPlaying();
....

實做的大概是: frameworks/base/media/libmediaplayerservice/MediaPlayerService.cpp

..
實際上,這也是個空殼而已,真的 player 是在 prebuild .so 。在 device 下的 propriety/libs 下有一些 _omx_player_..


用較簡單的 Gallery 來看,啟動到最後,是 MovieView.java
這是一個 Activity,onCreate 後就直接播放影片了。

MovieView 只有實做三個 callback:
  • onCreate : new MovieViewControl
  • onPause : call MovieViewControl.onPause
  • onResume : call MovieViewControl.onResume
  • onWindowFocusChanged : call MovieViewControl.onResume/li>

Video 播放直接關聯到 VideoView 這個 layout,
在 res/layout/movie_view.xml 中放入一個 object:
    <VideoView android:id="@+id/surface_view"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_centerInParent="true" />

然後在 source:
    private final VideoView mVideoView;
     .....
       mVideoView = (VideoView) rootView.findViewById(R.id.surface_view);
 
取得 VideoView 元件後,就可以對 VideoView 操作:
如果有時作幾個 需要的interface,就可以接著設定:
        mVideoView.setOnErrorListener(this);
        mVideoView.setOnCompletionListener(this);

設定要撥的file (uri),和 control.
        mVideoView.setVideoURI(mUri);
        mMediaController = new MediaController(context);
        mVideoView.setMediaController(mMediaController);
然後,就可以開始播放:
        mVideoView.start();


另外一個是在 development/samples/ApiDemos/src/com/example/android/apis/media/MeduaPlayerDemo_Video.java

還有有關 scanfile 的 sample code,在 development/samples 下也有...
development/samples/ApiDemos/src/com/example/android/apis/content/ExternalStorage.java

這一段code:
        File path = Environment.getExternalStoragePublicDirectory(
                Environment.DIRECTORY_PICTURES);
        File file = new File(path, "DemoPicture.jpg");

        ....
        ....
            // Tell the media scanner about the new file so that it is
            // immediately available to the user.
            MediaScannerConnection.scanFile(this,
                    new String[] { file.toString() }, null,
                    new MediaScannerConnection.OnScanCompletedListener() {
                public void onScanCompleted(String path, Uri uri) {
                    Log.i("ExternalStorage", "Scanned " + path + ":");
                    Log.i("ExternalStorage", "-> uri=" + uri);
                }
            });


所以可以把 file path 丟到這裡scan 轉成 media Uri
?


最後拿 developement/sample 的 MediaPlayerDemo_Video.java 來測試。
原來是用 file path,改成用 scan 後的 Uri。

diff 是:

Gallery3D 決定 storage 在不在的 code..

因為已經 trace 過三次,每次還是忘記,所以記一下好了...

src/com/cooliris/media/ImageManager.java:
    public static boolean hasStorage(boolean requireWriteAccess) {
        String state = Environment.getExternalStorageState();
        if (Environment.MEDIA_MOUNTED.equals(state)) {
            if (requireWriteAccess) {
                boolean writable = checkFsWritable();
  ....

所以去找 Environmemt.getExternalStorageState()..
core/java/android/os/Environment.java
    public static String getExternalStorageState() {
        return getMediaState(EXTERNAL_STORAGE_DIRECTORY_EXTSD.getPath());
    }

所以改這個 EXTSD, SD 就可以決定是用哪一個 SD slot 作判斷依據 (或是用 usb..)


但是如果要 MediaScanner Scan 的話,要改:

2013年7月9日 星期二

不用 build sdk,讓 app 使用擴充 framework api 的方法 -- eclipse 中加入 libs

要是修改了 android framework,而 app 要使用這些 新的 api。
eclipse 一定會 complain 說 找不到這些 api。

正確的方法大概是build sdk 出來安裝到 eclipse。
但是 build sdk 很花時間(其實是不會作)。

比較簡單的方法就是找出 framework 中這些使用到的 api build 出來的 jar 檔,
把他當作是 libs 加到 app 的 project 中。

framework/core build 出來的 jar都會在 out/target/common/obj/JAVA_LIBRARIES/...
依照classs 分別放在不同的目錄中,都叫做 class.jar

舉例來說...

假設擴充了 sdcard, udisk 的路數量,增加了 api:
./java/android/os/Environment.java:540:    public static String getExternalExtSD2StorageState() {


用 grep 搜尋 lib folder ,在 framework_intermediates 下的 binary 找到 match。
所以把 framework_intermediates/class.jar copy 到 eclipse project folder 下的 libs 目錄(自己 create)。

然後規劃 eclipse 的 build path 要包含這個 class.jar:
  • 先 refresh 一次 project,讓 eclipse 顯示剛剛 copy 的 libs/class.jar
  • 在 libs/class.jar 按右鍵,選 build-path -- add build-path
這樣在 project 的 Referenced Libraries 下就會出現 class.jar,可以展開來看裡面包含的 class。

這樣就可以 build 了。

有時候可能要copy 很多個 class.jar,就要記得 rename..

2013年7月2日 星期二

變更 set date, time 的 dialog 大小..

先在 framework/base/core/res/res/drawable-hdpi 看到 timepicker_down_normal.9.png 這個圖。
然後 framework/base/core/res/res/layout/number_picker.xml 使用到 timepicker_down_normal.9.png
然後 framework/base/core/java/android/widget/NumberPicker.java: inflater.inflate(R.layout.number_picker, this, true)
然後就一堆...
  • core/java/android/widget/TimePicker.java
  • core/java/android/widget/DatePicker.java
DateTimeSettings -- TimePickerDialog(layout/time_picker_dialog) -- TimePicker

標籤

網誌存檔