ubuntu 在 R40e 上 還有 Debian 在 Sempron 2600 上

2012年7月27日 星期五

I/AudioService( 2563): AudioFocus abandonAudioFocus(): removing entry for android.media.AudioManager@2acbae28com.android.music.MediaPlaybackService$3@2acf7c78 E/JavaBinder( 2563): *** Uncaught remote exception! (Exceptions are not yet supported across processes.) E/JavaBinder( 2563): java.util.ConcurrentModificationException E/JavaBinder( 2563): at java.util.AbstractList$SimpleListIterator.next(AbstractList.java:64) E/JavaBinder( 2563): at android.media.AudioService.removeFocusStackEntry(AudioService.java:2214) E/JavaBinder( 2563): at android.media.AudioService.requestAudioFocus(AudioService.java:2331) E/JavaBinder( 2563): at android.media.IAudioService$Stub.onTransact(IAudioService.java:296) E/JavaBinder( 2563): at android.os.Binder.execTransact(Binder.java:320) E/JavaBinder( 2563): at com.android.server.SystemServer.init1(Native Method) E/JavaBinder( 2563): at com.android.server.SystemServer.main(SystemServer.java:730) E/JavaBinder( 2563): at java.lang.reflect.Method.invokeNative(Native Method) E/JavaBinder( 2563): at java.lang.reflect.Method.invoke(Method.java:507) E/JavaBinder( 2563): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839) E/JavaBinder( 2563): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) E/JavaBinder( 2563): at dalvik.system.NativeStart.main(Native Method) I/AudioService( 2563): Remote Control registerMediaButtonEventReceiver() for ComponentInfo{com.android.music/com.android.music.MediaButtonIntentReceiver}

2012年7月25日 星期三

Muscic 的暫停與繼續..

Music 的 MediaPlaybackService.java :

logcat -s MediaPlaybackService 來看..

可以看到,Music 在background 繼續播放,在收到 AudioManger 的通之後,才會停止: case FOCUSCHANGE: // This code is here so we can better synchronize it with the code that // handles fade-in // AudioFocus is a new feature: focus updates are made verbose on purpose switch (msg.arg1) { case AudioManager.AUDIOFOCUS_LOSS: Log.v(LOGTAG, "AudioFocus: received AUDIOFOCUS_LOSS"); if(isPlaying()) { mPausedByTransientLossOfFocus = false; } pause(); break;

但是其他的 event: AUDIOFOCUS_GAIN, AUDIOFOCUSE_LOSS_TRANSIENT 都沒收到。

從 code 來看, 這兩個 message 應該是在有電話進來的時候會有,先收到 LOSS_TRANSIENT。
等電話掛斷後,收到 AUDIOFOCUS_GAIN。




另外,BroadcastReceiver( ) 也有針對 play, pause, next, prev 的 cmd 操作,可以把 debugLog 修改一下: Log.v(LOGTAG,"mIntentReceiver.onReceive " + action + " / " + cmd);

這個 command 是給 Music app 自己用的 - 因為宣告成 class private variable.

上面的messasge 出來的是: V/MediaPlaybackService( 2610): mIntentReceiver.onReceive com.android.music.musicservicecommand / pause V/MediaPlaybackService( 2610): pause V/MediaPlaybackService( 2610): mIntentReceiver.onReceive com.android.music.musicservicecommand / pause V/MediaPlaybackService( 2610): pause V/MediaPlaybackService( 2610): onStartCommand

在 framework 裡找到用這個command(Intent) 的 code:

frameworks/base/core/java/android/widget/VideoView.java: private void openVideo() { if (mUri == null || mSurfaceHolder == null) { // not ready for playback just yet, will try again later return; } // Tell the music playback service to pause // TODO: these constants need to be published somewhere in the framework. Intent i = new Intent("com.android.music.musicservicecommand"); i.putExtra("command", "pause"); mContext.sendBroadcast(i);

Official UNIX tool for Windows

MS 官方的 unix tool: http://www.microsoft.com/en-us/download/details.aspx?id=2391

還有 nfs server for windows system 喔。

2012年7月20日 星期五

BandLuxe C331

log after eject /dev/sr1 (CDROM) [ 1980.712292] usb 2-1.1.4.2: USB disconnect, address 9 [ 1991.773362] usb 2-1.1.4.2: new high speed USB device using ehci_hcd and address 10 [ 1991.883062] usb 2-1.1.4.2: New USB device found, idVendor=1a8d, idProduct=2006 [ 1991.883068] usb 2-1.1.4.2: New USB device strings: Mfr=3, Product=2, SerialNumber=4 [ 1991.883072] usb 2-1.1.4.2: Product: BandLuxe 3.5G HSPA Adapter [ 1991.883075] usb 2-1.1.4.2: Manufacturer: BandRich [ 1991.883078] usb 2-1.1.4.2: SerialNumber: EE45B741112F4E2CB3F00AF0444EE4D1F1B8C491 [ 1991.883233] usb 2-1.1.4.2: configuration #1 chosen from 1 choice [ 1991.884062] cdc_acm 2-1.1.4.2:1.1: ttyACM0: USB ACM device [ 1991.884909] cdc_acm 2-1.1.4.2:1.3: ttyACM1: USB ACM device [ 1991.886971] eth1: register 'cdc_ether' at usb-0000:00:1d.0-1.1.4.2, CDC Ethernet Device, 00:26:fa:ee:45:b7 [ 1991.887235] scsi11 : SCSI emulation for USB Mass Storage devices [ 1991.887369] usb-storage: device found at 10 [ 1991.887373] usb-storage: waiting for device to settle before scanning [ 1996.883439] usb-storage: device scan complete [ 1996.883961] scsi 11:0:0:0: CD-ROM BandRich CDROM 0001 PQ: 0 ANSI: 0 [ 1996.884421] scsi 11:0:0:1: Direct-Access BandRich CDROM 0001 PQ: 0 ANSI: 0
browsers/BrowserProvider.java
提供的幫助有: private static final String[] SUGGEST_PROJECTION = new String[] { "_id", "url", "title", "bookmark", "user_entered" }; ... 發現這個好像是指.."在網址列輸入" 的部份...

Browser : Clear Search History -- Part I

找一下 "的網頁指出" ..
結果在:

base/core/res/res/values-zh-rTW/strings.xml:

使用者是:
base/core/java/android/webkit/CallbackProxy.java





猜是 confirm dialog:



所以是在處理 javascript 的 alert。

其中有 mWebChromeClient 不是 null 時,才會處理。

在 browser/Tab.java 中,有使用 setWebChromeClient..

所以... setWebViewClient( ) 和 setWebChromeClient( ) 的不同處是...?

ref: http://stackoverflow.com/questions/2835556/whats-the-difference-between-setwebviewclient-vs-setwebchromeclient

setWebChromeClient( ) 會處理 JS Alert。

拿 http://www.mkyong.com/tutorials/android-tutorial/ 的 WebView Example code 來測試這個 javascript alert 頁面。


試著拿掉 setWebChromeClient( ) 這行,執行時,就不會出現 dialog

2012年7月16日 星期一

還是一樣:把10.4 repo mirror 在 local

這次有異狀的就只有 mtd-utils 和 alsa-utils。
明明就有手動 clone,結果 c_patch 又 complain exist。
看一下 baseversion.xml,果然是寫 NEW。
手動改 CHANGE 會 fail,因為那個 patch 真的是 for NEW....

所以就只有回答 yes,讓她刪了。

完成:
project bionic/                                 branch imx_r10.4
project bootable/bootloader/uboot-imx/          branch imx_r10.4
project bootable/recovery/                      branch imx_r10.4
project build/                                  branch imx_r10.4
project development/                            branch imx_r10.4
project external/alsa-lib/                      branch imx_r10.4
project external/alsa-utils/                    branch imx_r10.4
project external/bluetooth/bluez/               branch imx_r10.4
project external/dhcpcd/                        branch imx_r10.4
project external/e2fsprogs/                     branch imx_r10.4
project external/genext2fs/                     branch imx_r10.4
project external/mtd-utils/                     branch imx_r10.4
project external/ppp/                           branch imx_r10.4
project external/sqlite/                        branch imx_r10.4
project external/wpa_supplicant/                branch imx_r10.4
project frameworks/base/                        branch imx_r10.4
project hardware/alsa_sound/                    branch imx_r10.4
project hardware/libhardware/                   branch imx_r10.4
project hardware/libhardware_legacy/            branch imx_r10.4
project hardware/ril/                           branch imx_r10.4
project kernel_imx/                             branch imx_r10.4
project packages/apps/Browser/                  branch imx_r10.4
project packages/apps/Camera/                   branch imx_r10.4
project packages/apps/CertInstaller/            branch imx_r10.4
project packages/apps/Gallery3D/                branch imx_r10.4
project packages/apps/Music/                    branch imx_r10.4
project packages/apps/Settings/                 branch imx_r10.4
project packages/apps/SoundRecorder/            branch imx_r10.4
project packages/inputmethods/PinyinIME/        branch imx_r10.4
project packages/providers/MediaProvider/       branch imx_r10.4
project packages/wallpapers/MagicSmoke/         branch imx_r10.4
project prebuilt/                               branch imx_r10.4
project system/core/                            branch imx_r10.4
project system/extras/                          branch imx_r10.4
project system/netd/                            branch imx_r10.4
project system/vold/                            branch imx_r10.4
實際上還要參考 baseversion.xml。一堆 NEW 的 folder 不會在 manifest.xml..

Helio 配 java 7

安裝 android SDK 會有error

follow 這個: http://stackoverflow.com/questions/142357/what-are-the-best-jvm-settings-for-eclipse/3275659#3275659
也沒效,只好 uninstall java7。
用 java 6 就 OK。

檢查一下,還有 19 個 NEW

2012年7月13日 星期五

localize android repo -- more more..

現在 repo 好像有點修改了,所以上次那篇: http://r40eubuntu.blogspot.tw/2011/05/code-default.html
要作一些修改...


複習:

要把整個 android source 都納入 repo 管理,並且放在 local server 中。

首先 repo init, sync 時,一定要用 --mirror 參數,否則 manifest.xml 的內容 (path) 不會正確。

這次 manifest.xml 的內容有點改變,以往 remote server name:address 是寫在 manifest.xml 裡。
現在好像會在 repo init 時,依照 init -u 的 source 改變。

所以一旦 mirror 到 local server 後,不用修改 manifest.xml。
之後 從 local server 作 repo init 的,都會從 local server clone。
關鍵好像是在 .repo/manifests.git/config

以前的 bsp 會提供一個修改過的 default.xml。現在(10.4)沒了,要自己刪檔,所以刪完 project 後, repo 就會 fail -- folder 與 manifest.xml 內容不一致。



次序錯了,一開始 manifest 開 branch 時,要用 imx_r10.4,所以那些新加的 project,也要tag imx_r10.4。

這樣 c_patch 完後,那些修改都可以直接 push (?)。


避免 雞 - 蛋 問題, test repo 的 client folder (就是完整 clone repo 的 folder) 最好有兩個。
一個測試用。一個是用來上 patch。


現在 google 都教人作 mirror 了...http://source.android.com/source/downloading.html#using-a-local-mirror

copy:



When using several clients, especially in situations where bandwidth is scarce, it is better to create a local mirror of the entire server content, and to sync clients from that mirror (which requires no network access). The download for a full mirror is smaller than the download of two clients, while containing more information.

These instructions assume that the mirror is created in /usr/local/aosp/mirror. The first step is to create and sync the mirror itself, which uses close to 13GB of network bandwidth and a similar amount of disk space. Notice the --mirror flag, which can only be specified when creating a new client:
$ mkdir -p /usr/local/aosp/mirror
$ cd /usr/local/aosp/mirror
$ repo init -u https://android.googlesource.com/mirror/manifest --mirror
$ repo sync
Once the mirror is synced, new clients can be created from it. Note that it's important to specify an absolute path:
$ mkdir -p /usr/local/aosp/master
$ cd /usr/local/aosp/master
$ repo init -u /usr/local/aosp/mirror/platform/manifest.git
$ repo sync
Finally, to sync a client against the server, the mirror needs to be synced against the server, then the client against the mirror:
$ cd /usr/local/aosp/mirror
$ repo sync
$ cd /usr/local/aosp/master
$ repo sync
It's possible to store the mirror on a LAN server and to access it over NFS, SSH or Git. It's also possible to store it on a removable drive and to pass that drive around between users or between machines.

2012年7月11日 星期三

找到 browser download file 的機制


其實就到處 grep download。

frame/base/core/java/android/webkit/CallbackProxy.java:
的 handleMessage(Message msg)

switch (msg.what) { .... case DOWNLOAD_FILE: if (mDownloadListener != null) { String url = msg.getData().getString("url"); String userAgent = msg.getData().getString("userAgent"); String contentDisposition = msg.getData().getString("contentDisposition"); String mimetype = msg.getData().getString("mimetype"); Long contentLength = msg.getData().getLong("contentLength"); mDownloadListener.onDownloadStart(url, userAgent, contentDisposition, mimetype, contentLength); } break;
但是grep DOWNLOAD_FILE,好像是 CallbackProxy.java 自己的 constant。

只有在 : public boolean onDownloadStart(String url, String userAgent,
使用到。


CallbackProxy -- call: DownloadListener.onDownloadStart
---結果 DownloadListener 是 interface,

有 implement DownloadListener 這個 interface 的有:
.. ? 只有 packages/apps/Browser/src/com/android/browser/BrowserActivity.java
.. 所以是 ap 自己要負責 ?

BrowserActivity 真的在 implement onDownloadStart( ) 時,很盡職的準備好 intent,然後用 StartActivity 叫起 DownloadManager (我猜的..)


所以要回去 trace CallbackProxy 了:

CallbackProxy.onDownloadStart( ) 準備好 message,然後CallbackProxy.handleMessage( ) 才去 call DownloadListener.onDownloadStart( )。
-- 所以是 callbackProxy.onDownloadStart 起的頭。

/framework/base/core/java/android/webkit/LoadListener.java:
void downloadFile() { // remove the cache WebViewWorker.getHandler().obtainMessage( WebViewWorker.MSG_REMOVE_CACHE, this).sendToTarget(); // Inform the client that they should download a file mBrowserFrame.getCallbackProxy().onDownloadStart(url(), mBrowserFrame.getUserAgentString(), mHeaders.getContentDisposition(), mMimeType, mContentLength); // Cancel the download. We need to stop the http load. // The native loader object will get cleared by the call to // cancel() but will also be cleared on the WebCore side // when this function returns. cancel(); }
然後....找不到 call downloadFile 的 code....

function 的 comment 非常好心的說明:
    /*
     * This function is called from native WebCore code to
     * notify this LoadListener that the content it is currently
     * downloading should be saved to a file and not sent to
     * WebCore.
     */
所以去找找 WebCore ..



改 Browser 就好。
download 的動作是 callback..

所以改 Browser 的 BrowserActivity.java:

其中:OnDownloadStartNoStream( ) 是負責將 download 排入 downloadmanager 的 function。
所以comment 掉 call 這個 function 的 code 就可以。

2012年7月10日 星期二

log on click download link

試著去點一個 download link...結果(沒放 SD card)出來:
I/ActivityManager( 2510): Starting: Intent { act=android.intent.action.VIEW cat=[android.intent.category.BROWSABLE] dat=http://dl.dropbox.com/u/8788910/A_Android/Camera360_2.7.0.apk cmp=com.android.browser/.BrowserActivity } from pid 3235
D/        ( 2510): enter Cmd: L 
V/http    ( 3235): 3619554 WebViewWorkerThread RequestQueue.queueRequest http://dl.dropbox.com/u/8788910/A_Android/Camera360_2.7.0.apk
V/http    ( 3235): 3619556 http1 RequestQueue.getRequest() => /u/8788910/A_Android/Camera360_2.7.0.apk
V/http    ( 3235): 3619557 http1 ConnectionThread: new request http://dl.dropbox.com:80 /u/8788910/A_Android/Camera360_2.7.0.apk
V/http    ( 3235): 3619557 http1 SEND pipe 0
I/ActivityManager( 2510): Starting: Intent { act=android.intent.action.VIEW cat=[android.intent.category.BROWSABLE] dat=http://dl.dropbox.com/u/8788910/A_Android/Camera360_2.7.0.apk cmp=com.android.browser/.BrowserActivity } from pid 3235
D/dalvikvm( 2753): GC_CONCURRENT freed 1449K, 73% free 1035K/3779K, external 4039K/5043K, paused 2ms+1ms
V/http    ( 3235): 3620967 http1 Connection.openHttpConnection() 1410 http://dl.dropbox.com:80
V/http    ( 3235): 3620971 http1 Request.sendRequest() http://dl.dropbox.com
V/http    ( 3235): 3620972 http1 Request.requestSent() http://dl.dropbox.com/u/8788910/A_Android/Camera360_2.7.0.apk
V/http    ( 3235): 3620973 http1 READ pipe 1
V/http    ( 3235): 3620974 http1 processRequests() reading /u/8788910/A_Android/Camera360_2.7.0.apk
D/        ( 2753): enter Cmd: G 
V/http    ( 3235): 3623524 http1 read: HTTP/1.1 200 OK
V/http    ( 3235): 3623524 http1 hdr 20 server: nginx/1.0.14
V/http    ( 3235): 3623524 http1 hdr 35 date: Tue, 10 Jul 2012 09:15:18 GMT
V/http    ( 3235): 3623524 http1 hdr 53 content-type: application/vnd.android.package-archive
V/http    ( 3235): 3623524 http1 hdr 17 connection: close
V/http    ( 3235): 3623525 http1 hdr 23 content-length: 3942344
V/http    ( 3235): 3623525 http1 hdr 30 x-robots-tag: noindex,nofollow
V/http    ( 3235): 3623525 http1 hdr 20 accept-ranges: bytes
V/http    ( 3235): 3623525 http1 hdr 11 etag: 5545n
V/http    ( 3235): 3623525 http1 hdr 14 pragma: public
V/http    ( 3235): 3623525 http1 hdr 24 cache-control: max-age=0
V/http    ( 3235): 3623526 http1 Request.readResponseStatus() 15 HTTP/1.1 200 OK
V/http    ( 3235): 3623537 WebViewCoreThread Request.cancel(): /u/8788910/A_Android/Camera360_2.7.0.apk
V/http    ( 3235): 3623538 WebViewCoreThread Connection.cancel(): connection closed http://dl.dropbox.com:80
V/http    ( 3235): 3623560 http1 httpFailure() ******* java.lang.IllegalStateException: Connection is not open count 0 http://dl.dropbox.com:80 /u/8788910/A_Android/Camera360_2.7.0.apk
V/http    ( 3235): 3623560 http1 processRequests(): no persist, closing http://dl.dropbox.com:80
V/http    ( 3235): 3623560 http1 Connection.clearPipe(): clearing pipe 0
V/http    ( 3235): 3623561 http1 SEND pipe 0
V/http    ( 3235): 3623661 http1 RequestQueue.getRequest(http://dl.dropbox.com:80) => null
V/http    ( 3235): 3623661 http1 DRAIN pipe 0
V/http    ( 3235): 3623661 http1 RequestQueue.getRequest() => null
V/http    ( 3235): 3623661 http1 ConnectionThread: Waiting for work
D/webviewglue( 3235): nativeDestroy view: 0x9329e0
I/DownloadManager( 2841): Initiating request for download 3

放入SD card 再試一次:
還是先把 status banner 打開好了,否則看不到是不是有 download...

2012年7月9日 星期一

RCU : read - copy - update

ref: http://nano-chicken.blogspot.tw/2011/02/linux-modules14-read-copy-update.html
這篇的圖說明很清楚。

原來圖示參考lwn : https://lwn.net/lwn/lwn/images/ns/kernel/brcu/

copy 一份:

圖示說明一個 writer 對應多個 reader。
writer 的 timing 分為三個階段,對應很多 reader 的 access period。

圖示說明在每個階段, 各 reader 讀到的是 新的還是舊的資料。

2012年7月6日 星期五

  • tasklet 被 tasklet_schedule( ) 多次,也只會run 一次。除非 tasklet_schedule( ) 時,她已經在執行,這樣就會 run 兩次 (包含正在 run 的這一次)

2012年7月2日 星期一

android tools for recovery .

android framework 中有寫好的 recovery function : bootable/recovery
大概就是靠著 bootloader 的 support,決定進入 recovery mode 時,以 boot device 上的 recovery partition 作為 root。

這個特殊的 root 的 init.rc ,讓 系統啟動後,執行 recovery 這個程式。

recovery 的source ,就在 bootable/recovery/ 中。



這個 platform 進入 recovery mode 是依靠 /cache partition 中的 recovery/command 這個檔。
bootloader 找到這個 file 長度不是 0,就會改以 boot_recovery 作為 boot command。

這個專屬的 recovery partition,build 的動作也是寫在 Build/core/Makefile 中: # ----------------------------------------------------------------- # Recovery image # If neither TARGET_NO_KERNEL nor TARGET_NO_RECOVERY are true ifeq (,$(filter true, $(TARGET_NO_RECOVERY) $(BUILD_TINY_ANDROID))) INSTALLED_RECOVERYIMAGE_TARGET := $(PRODUCT_OUT)/recovery.img recovery_initrc := $(call include-path-for, recovery)/etc/init.rc #recovery_kernel := $(INSTALLED_KERNEL_TARGET) # same as a non-recovery system #recovery_ramdisk := $(PRODUCT_OUT)/ramdisk-recovery.img #recovery_build_prop := $(INSTALLED_BUILD_PROP_TARGET) recovery_binary := $(call intermediates-dir-for,EXECUTABLES,recovery)/recovery recovery_resources_common := $(call include-path-for, recovery)/res recovery_resources_private := $(strip $(wildcard $(TARGET_DEVICE_DIR)/recovery/res)) recovery_resource_deps := $(shell find $(recovery_resources_common) \ $(recovery_resources_private) -type f) recovery_fstab := $(strip $(wildcard $(TARGET_DEVICE_DIR)/recovery.fstab)) ifeq ($(recovery_resources_private),) $(info No private recovery resources for TARGET_DEVICE $(TARGET_DEVICE)) endif ifeq ($(recovery_fstab),) $(info No recovery.fstab for TARGET_DEVICE $(TARGET_DEVICE)) endif


這個幾乎不能debug,因為沒有 console,而且只會把東西放到 /cache/recovery/log

很不方便,所以修改 init.rc,把 service recovery 的 option 加上 console。
然後把 recovery.c 的 main( ) 一開始 reopen stdout, stderr 的 code comment 掉,
就可以用 printf 來 debug 了 (唉~~)。

幾點:
  • 會用 console, framebuffer 顯示圖片,如果顯示不出來,查一下 bootloader 的 boot argument,main display port 要設對。
  • /cache/recovery/command 的內容格式很重要,每個option 最後都要是 cr, lf,開始不可以有空白。
  • 最後一行 不可以是 empty,也就是說,最後一個 option 不可以有 cr, lf。否則 recovery 這個程式會死掉,然後 init 又重開她

最後一點就改一下,加上 empty string 的check..

/cache/recovery/command 的內容是: --wipe_data 開頭跟最後都不可以有空白
這個會format data 和 cache partition. (當然,會把 recovery/log copy 回 /cache)

標籤

網誌存檔