2012年3月30日金曜日

android のgsmコマンド

android シミュレータで音声通話の動作確認をgsmコマンドで行うことが出来ます。

ただ、電話を掛けるのか、掛かってくるのかが、よくわからなかったので(書籍/ネット上の記事も若干混乱気味)、動作確認した結果をまとめました。しかし「電話をかける」コマンドはみつけられませんでしたが(GUIで電話は掛けられるので問題ないですけど)。
  • gsm call <電話番号>:指定した電話番号から着信する(電話がかかってくる)
  • gsm accept <電話番号>:(gsm callを実行し)着信中の電話番号に応答する(電話に出る)
  • gsm ??? <電話番号>:指定した電話番号に発信する(電話をかける)

実験して分かりましたが、canfelence callというのができるんですね。複数人と同時に通話ができるようです。

こんな感じで、一度に複数番号から着信状態にしたあとに、電話に応答するとconference callができます。

gsm call 1111111111
OK
gsm call 2222222222
OK
gsm call 3333333333
OK
gsm list
inbound from 1111111111 : incoming
inbound from 2222222222 : incoming
inbound from 3333333333 : incoming
OK




2012年3月3日土曜日

Mac OS X lion(10.7)でAndroid ICSをビルドする その1

Mac OS XのVirtualBoxでubuntu10.04(64bit)をインストールし、Android ICSをビルドしようとしました(ubuntuの方が慣れているので)。しかし、なぜかrepo syncで http errorが繰り返し出て、ダウンロードが終わりません。

そこで、VirtualBoxのubuntuでのビルドは止め、普通にMac OS X(lion)でAndroid ICSをビルドすることにします。
結論としては、ICSのビルドは通ってませんが...。ビルドが通れば更新しておきます。

参考にしたのは以下のサイトです。
・公式サイトSetting up a Mac OS X build environment

既にlionでのbuildに挑戦されているdangunさん(Buildできなかったとのことですが...)
【Android】LionでIce Cream SandwichをBuildできなかった

あと、SDK 10.5 の単独インストールについて
How to add base SDK for 10.5 in xCode 4

ざっくり概要としてはこんな感じです。
公式ページではsnoleopard:xCode3の環境を前提
➡でもlion:xCode4を使っている
➡するとSDK10.5が無いと、コンパイルエラー発生
➡なんとかSDK10.5を入れよう(Xcode3もインストール or SDK10.5のみインストールでもいける?)

以下を前提としており、私の環境(以下の括弧書き)では少々手順が異なりましたので、それをまとめます。
  • OS:snowleopard(lion)
  • Xcode:Xcode3(Xcode4)
  • ツールインストール:Macports(Homebrew)

以下、Setting up a Mac OS X build environment の構成に合わせて記載します。
■1. Creating a case sensitive disk image
  そのままのため、省略。

■2. Installing required packages
2-1. Xcodeのインストール
  lion のため、Xcode4 をインストール済み。
 しかし Android ICS のビルドには SDK 10.5 が必要なので、Xcode3.2.6 をダウンロードし、SDK 10.5 のみをインストールします。

xCode3 2.3.6 の dmgをマウントすると、以下にSDK 10.5のパッケージがあります。Finderからは見えないので、コンソールでこんな感じで見えるところに置いてから、インストールしました。
$ cp /Volumes/Xcode and iOS SDK/Packages/MacOSX10.5.pkg ~

※ちなみにSDK 10.5が無いとビルドする際に以下のエラーが出ます。

Checking build tools versions...
Please install the 10.5 SDK on this machine at /Developer/SDKs/MacOSX10.5.sdk
external/qemu/Makefile.android:82: *** Aborting the build..  Stop.


2-2. その他ツールのインストール
・Homebrewを使っているので、こんな感じでインストール。libsdlというFormulaは無かったので、"sdl"でインストール(問題ないはず)
$ brew install sdl gnupg

・gitはインストール済み。(何のタイミングでインストールされたか分かってません...)

■Reverting from make 3.82
make はインストール済み。またversion 3.8.1だったので問題なし(何のタイミングでインストールされたか分かってません...)

■Setting a file descriptor limit

  そのままのため、省略。

■そしてビルド実施...。
$. build/envsetup.sh
$ lunch vbox_x86-eng
$ make 

エラーが発生したので詳細確認。
$ make showcommands

============================================

PLATFORM_VERSION_CODENAME=REL

PLATFORM_VERSION=4.0.1

TARGET_PRODUCT=vbox_x86

TARGET_BUILD_VARIANT=eng

TARGET_BUILD_TYPE=release

TARGET_BUILD_APPS=

TARGET_ARCH=x86

TARGET_ARCH_VARIANT=x86

HOST_ARCH=x86

HOST_OS=darwin

HOST_BUILD_TYPE=release

BUILD_ID=ITL41D

============================================

host C: editdisklbl <= bootable/diskinstaller/editdisklbl/editdisklbl.c

cc -I bootable/diskinstaller/editdisklbl/../libdiskconfig -I bootable/diskinstaller/editdisklbl -I out/host/darwin-x86/obj/EXECUTABLES/editdisklbl_intermediates -I dalvik/libnativehelper/include/nativehelper -isystem system/core/include -isystem hardware/libhardware/include -isystem hardware/libhardware_legacy/include -isystem hardware/ril/include -isystem dalvik/libnativehelper/include -isystem frameworks/base/include -isystem frameworks/base/opengl/include -isystem frameworks/base/native/include -isystem external/skia/include -isystem tools/include -isystem out/host/darwin-x86/obj/include -c  -fno-exceptions -Wno-multichar -m32 -fPIC -include system/core/include/arch/darwin-x86/AndroidConfig.h -DANDROID -fmessage-length=0 -W -Wall -Wno-unused -Winit-self -Wpointer-arith -O2 -g -fno-strict-aliasing -DNDEBUG -UDEBUG  -O2 -g -W -Wall -Werror     -MD -o out/host/darwin-x86/obj/EXECUTABLES/editdisklbl_intermediates/editdisklbl.o bootable/diskinstaller/editdisklbl/editdisklbl.c

In file included from bootable/diskinstaller/editdisklbl/editdisklbl.c:29:

system/core/include/diskconfig/diskconfig.h:100: error: expected specifier-qualifier-list before ‘loff_t’

system/core/include/diskconfig/diskconfig.h:119: error: expected declaration specifiers or ‘...’ before ‘loff_t’

bootable/diskinstaller/editdisklbl/editdisklbl.c: In function ‘main’:

bootable/diskinstaller/editdisklbl/editdisklbl.c:191: error: ‘loff_t’ undeclared (first use in this function)

bootable/diskinstaller/editdisklbl/editdisklbl.c:191: error: (Each undeclared identifier is reported only once

bootable/diskinstaller/editdisklbl/editdisklbl.c:191: error: for each function it appears in.)

bootable/diskinstaller/editdisklbl/editdisklbl.c:191: error: expected ‘;’ before ‘offs’

bootable/diskinstaller/editdisklbl/editdisklbl.c:193: error: ‘offs’ undeclared (first use in this function)

bootable/diskinstaller/editdisklbl/editdisklbl.c:193: error: too many arguments to function ‘write_raw_image’

make: *** [out/host/darwin-x86/obj/EXECUTABLES/editdisklbl_intermediates/editdisklbl.o] Error 1



$ cc -v

Using built-in specs.

Target: i686-apple-darwin11

Configured with: /private/var/tmp/llvmgcc42/llvmgcc42-2336.1~22/src/configure --disable-checking --enable-werror --prefix=/Developer/usr/llvm-gcc-4.2 --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-prefix=llvm- --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 --enable-llvm=/private/var/tmp/llvmgcc42/llvmgcc42-2336.1~22/dst-llvmCore/Developer/usr/local --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/usr/include/c++/4.2.1

Thread model: posix

gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00)

(2012.03.03 17:36追記)
lunch vbox_x86-engだとビルドが通らない可能性を考え、lunch full-envで試しましたが、だめでした。
$. build/envsetup.sh
$ lunch full-eng
$ make 

以下、エラーです。
host C: libelf <= external/elfutils/lib/xmalloc.c
In file included from :0:
./external/elfutils/config-compat-darwin.h:42: error: static declaration of ‘strnlen’ follows non-static declaration
/usr/include/string.h:143: error: previous declaration of ‘strnlen’ was here
make: *** [out/host/darwin-x86/obj/STATIC_LIBRARIES/libelf_intermediates/lib/xmalloc.o] Error 1

(2012.3.9 7:40追記)
Xcode3+Xcode4の環境で試しました。
以下で、エラーとなります。Android Building | Google Groups で質問があるのもこの状態ですね。でも Android Building によるとコンパイルが通っても、正常に実行されないという記載があった気がします...
host Executable: triangleCM (out/host/darwin-x86/obj/EXECUTABLES/triangleCM_intermediates/triangleCM)

Undefined symbols:

  "__dyld_func_lookup", referenced from:

      _promoteLocalToGlobal in libSDL.a(SDL_dlcompat.o)

      _dlcompat_init_func in libSDL.a(SDL_dlcompat.o)

      _dlcompat_init_func in libSDL.a(SDL_dlcompat.o)

      _dlcompat_init_func in libSDL.a(SDL_dlcompat.o)

ld: symbol(s) not found

collect2: ld returned 1 exit status

make: *** [out/host/darwin-x86/obj/EXECUTABLES/triangleCM_intermediates/triangleCM] Error 1

問題の__dyld_func_lookupは、ここで定義されてました。これがリンクされればいいんでしょうか。未確認です。
$ nm -a /usr/lib/dylib1.10.5.o

                 U ___dso_handle

0000000000000014 T __dyld_func_lookup

0000000000000000 T dyld_stub_binding_helper

ootsuka-no-MacBook-Pro:/ ohtsuka$

2012年3月2日金曜日

Android Frameworkを変更すると沢山リビルドするのを止めたい

今、手元にbuild環境が無いので適切な例ではないかもしれません。

例えば...
frameworks/base/services/java/com/android/server/connectivity
をデバッグのため、少しログ出力を追加したとします。

確認のため、Androidビルドのトップディレクトリでmakeすると、依存関係からなのか、沢山ビルドが走ります。API I/Fを変えた訳ではないので、依存関係があってもビルドする必要はないと思うのですが...

(2012/3/4追記)
2012/3/2に参加した、AndroidのHangouts への参加者の皆さんよりアドバイスを頂きました。


imgを再生成するのではなく、imgを展開して変更のあったファイルだけ差し替えるとよいそうです。


以下参考URLです。
DEDIA Streetさん Desire X06HT – system.imgの展開

ただ、上記手順では、ファイルシステムを展開しています。
ファイルシステム として タイプyaffs2 で mountし、直接ファイル差し替えが出来ると思うので試してみます。

2012年3月1日木曜日

MacのVirtualBoxでUSBメモリを使う

USBメモリは、BUFFALOのRUF2-YUF8GS-BKです。
VirtualBoxは、Ver.4.1.8(Mac OS X lion上)です。

Android x86 ICSをビルドしたので、USBメモリからPC実機で起動しようとしました。
USBメモリに実行イメージをddコマンドで書き出す必要があるのですが、VirtualBox上のubuntuがどうしてもUSBメモリを認識してくれません。lsusbは固まります。
(USBメモリの抜き差しと、メニューのデバイス➡USBデバイスからチェックをつけたり外したりを、繰り返すと1回だけ認識しました、でも1回だけ...)

Mac上ではデバイスとして見えないので、VirtualBoxの管理下にUSBメモリはあるはずなんですが。

とりあえずは、VirtualBoxを起動しているHost PC(Mac)側にイメージを持ってきて、Macからddコマンドで書き出して起動は出来たんですけど。