TEXT 28
Android.txt Guest on 10th February 2021 12:40:43 AM
  1. Google Android adventures
  2.  
  3. Entry: CPS and Activities
  4. Date: Thu Jan  7 15:43:57 CET 2010
  5.  
  6. The android application model is designed to limit memory usage.  One
  7. of the main components visible to the application programmer is the
  8. ``swapping out'' of activities.
  9.  
  10. Whenver an application looses focus its onPause() method is called.
  11. At this time, all Activity state needs to be saved in a Bundle: it
  12. might happen that the process running the VM hosting the Activity gets
  13. killed by the low memory killer in case memory is needed elsewhere.
  14.  
  15. If you combine this with the highly a-synchronous nature of the
  16. android API, an application written in CPS becomes attractive.
  17.  
  18. The main question is: how to represent tree / graph structures as an
  19. Intent?
  20.  
  21.  
  22. Entry: Building native applications
  23. Date: Fri Jan 29 12:48:40 CET 2010
  24.  
  25. The simplest approach is to add a new application to the main build
  26. tree, by adding a directory that contains an Android.mk file in the
  27. style of:
  28.  
  29. # See examples:
  30. #  system/core/sh/Android.mk
  31. #  system/core/cpio/Android.mk
  32.  
  33. LOCAL_PATH:= $(call my-dir)
  34. include $(CLEAR_VARS)
  35.  
  36. LOCAL_SRC_FILES:= \
  37.       program.c
  38.  
  39. LOCAL_MODULE:= program
  40.  
  41. include $(BUILD_EXECUTABLE)
  42.  
  43.  
  44. To see what the build actially does, run this:
  45.  
  46. $ make showcommands program
  47.  
  48. target thumb C: program <= program/program.c
  49.  
  50. prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/bin/arm-eabi-gcc  -I system/core/include   -I hardware/libhardware/include   -I hardware/libhardware_legacy/include   -I hardware/ril/include   -I dalvik/libnativehelper/include   -I frameworks/base/include   -I frameworks/base/opengl/include   -I external/skia/include   -I out/target/product/generic/obj/include   -I bionic/libc/arch-arm/include   -I bionic/libc/include   -I bionic/libstdc++/include   -I bionic/libc/kernel/common   -I bionic/libc/kernel/arch-arm   -I bionic/libm/include   -I bionic/libm/include/arch/arm   -I bionic/libthread_db/include   -I program   -I out/target/product/generic/obj/EXECUTABLES/program_intermediates   -I out/target/product/generic/obj/SHARED_LIBRARIES/libwebcore_intermediates  -c  -fno-exceptions -Wno-multichar -msoft-float -fpic -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums -march=armv5te -mtune=xscale  -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5TE__ -include system/core/include/arch/linux-arm/AndroidConfig.h -I system/core/include/arch/linux-arm/ -mthumb-interwork -DANDROID -fmessage-length=0 -W -Wall -Wno-unused -Werror=return-type -DSK_RELEASE -DNDEBUG -g -Wstrict-aliasing=2 -finline-functions -fno-inline-functions-called-once -fgcse-after-reload -frerun-cse-after-loop -frename-registers -DNDEBUG -UDEBUG -mthumb -Os -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64      -MD -o out/target/product/generic/obj/EXECUTABLES/program_intermediates/program.o program/program.c
  51.  
  52. target Executable: program (out/target/product/generic/obj/EXECUTABLES/program_intermediates/LINKED/program)
  53.  
  54. prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/bin/arm-eabi-g++ -nostdlib -Bdynamic -Wl,-T,build/core/armelf.x -Wl,-dynamic-linker,/system/bin/linker -Wl,--gc-sections -Wl,-z,nocopyreloc -o out/target/product/generic/obj/EXECUTABLES/program_intermediates/LINKED/program -Lout/target/product/generic/obj/lib -Wl,-rpath-link=out/target/product/generic/obj/lib -lc -lstdc++ -lm  out/target/product/generic/obj/lib/crtbegin_dynamic.o         out/target/product/generic/obj/EXECUTABLES/program_intermediates/program.o       -Wl,--no-undefined /usr/people/beschout.nba/sw/android-google/prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/bin/../lib/gcc/arm-eabi/4.2.1/interwork/libgcc.a out/target/product/generic/obj/lib/crtend_android.o
  55.  
  56. target Non-prelinked: program (out/target/product/generic/symbols/system/bin/program)
  57.  
  58. out/host/linux-x86/bin/acp -fpt out/target/product/generic/obj/EXECUTABLES/program_intermediates/LINKED/program out/target/product/generic/symbols/system/bin/program
  59.  
  60. target Strip: program (out/target/product/generic/obj/EXECUTABLES/program_intermediates/program)
  61.  
  62. out/host/linux-x86/bin/soslim --strip --shady --quiet out/target/product/generic/symbols/system/bin/program --outfile out/target/product/generic/obj/EXECUTABLES/program_intermediates/program
  63. Install: out/target/product/generic/system/bin/program
  64. out/host/linux-x86/bin/acp -fpt out/target/product/generic/obj/EXECUTABLES/program_intermediates/program out/target/product/generic/system/bin/program
  65.  
  66.  
  67. From this we can distill a Makefile:
  68.  
  69.  
  70.  
  71. # This is a small hack to use commands snarfed from the main android
  72. # system build to compile native applications.
  73. #
  74. # To obtain commands:
  75. #
  76. #   - create a symbolic link: ln -s mtsa-watchdog $(ANDROID_SRC)
  77. #   - make showcommands mtsa-watchdog
  78. #   - observe commands, and replace .c and .o with parameters to create templates
  79.  
  80. ANDROID_SRC := ~/sw_local/android-google
  81. HERE := $(shell pwd)
  82.  
  83. # The commands below simply replace the .o .c and application files
  84. # with parameters $(1) $(2) and use the $(call ...) construct to
  85. # substitute.
  86.  
  87.  
  88. # Note: all targets need to use absolute paths.  I.e. to manually build targets use:
  89. #
  90. #   make `pwd`/watchdog.o
  91.  
  92. # <1:in> <2:out>
  93. android_compile = prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/bin/arm-eabi-gcc  -I system/core/include   -I hardware/libhardware/include   -I hardware/libhardware_legacy/include   -I hardware/ril/include   -I dalvik/libnativehelper/include   -I frameworks/base/include   -I frameworks/base/opengl/include   -I external/skia/include   -I out/target/product/generic/obj/include   -I bionic/libc/arch-arm/include   -I bionic/libc/include   -I bionic/libstdc++/include   -I bionic/libc/kernel/common   -I bionic/libc/kernel/arch-arm   -I bionic/libm/include   -I bionic/libm/include/arch/arm   -I bionic/libthread_db/include   -I program   -I out/target/product/generic/obj/EXECUTABLES/program_intermediates   -I out/target/product/generic/obj/SHARED_LIBRARIES/libwebcore_intermediates  -c  -fno-exceptions -Wno-multichar -msoft-float -fpic -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums -march=armv5te -mtune=xscale  -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5TE__ -include system/core/include/arch/linux-arm/AndroidConfig.h -I system/core/include/arch/linux-arm/ -mthumb-interwork -DANDROID -fmessage-length=0 -W -Wall -Wno-unused -Werror=return-type -DSK_RELEASE -DNDEBUG -g -Wstrict-aliasing=2 -finline-functions -fno-inline-functions-called-once -fgcse-after-reload -frerun-cse-after-loop -frename-registers -DNDEBUG -UDEBUG -mthumb -Os -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64      -MD -o $(2) $(1)
  94.  
  95. # <1:in> <2:out>
  96. android_link = prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/bin/arm-eabi-g++ -nostdlib -Bdynamic -Wl,-T,build/core/armelf.x -Wl,-dynamic-linker,/system/bin/linker -Wl,--gc-sections -Wl,-z,nocopyreloc -o $(2) -Lout/target/product/generic/obj/lib -Wl,-rpath-link=out/target/product/generic/obj/lib -lc -lstdc++ -lm  out/target/product/generic/obj/lib/crtbegin_dynamic.o  $(1) -Wl,--no-undefined /usr/people/beschout.nba/sw/android-google/prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/bin/../lib/gcc/arm-eabi/4.2.1/interwork/libgcc.a out/target/product/generic/obj/lib/crtend_android.o
  97.  
  98. %.o: %.c
  99.       cd $(ANDROID_SRC) ; $(call android_compile,$<,[email protected])
  100.  
  101. %.x: %.o
  102.       cd $(ANDROID_SRC) ; $(call android_link,$<,[email protected])
  103.  
  104.  
  105. .PHONY: all clean
  106.  
  107.  
  108. TARGETS := $(HERE)/program.x
  109. all: $(TARGETS)
  110.  
  111. clean:
  112.       rm -rf *.o *~ *.d $(TARGETS)
  113.  
  114.  
  115. Entry: Picking up
  116. Date: Fri Apr 26 22:08:11 EDT 2013
  117.  
  118. Got 2 RepublicWireless (RW) phones:
  119.  
  120.  
  121. - LG Optimus S[1], rooted, no service.  Test device.
  122. Qualcomm Snapdragon S1 MSM7627
  123. Single core, 600 MHz
  124. 320 x 480 pixels, 3.2"
  125. 0.14 GB Flash (up to 32G uSD)
  126.  
  127. - Motorola Defy XT[2], rooted, service.  Active phone.
  128. Qualcomm Snapdragon S1 MSM7227A
  129. Single core, 1000 MHz, ARM Cortex-A5
  130. 480 x 854 pixels, 3.7"
  131. Adreno 200 (enhanced) GPU
  132. 512 MB RAM, 1GB Flash (up to 32G uSD)
  133.  
  134. [1] http://www.phonearena.com/phones/LG-Optimus-S_id4963
  135. [2] http://www.phonearena.com/phones/Motorola-DEFY-XT_id6959
  136. [3] http://en.wikipedia.org/wiki/Snapdragon_%28system_on_chip%29
  137.  
  138.  
  139. Entry: Install Debian on android
  140. Date: Mon Apr 29 15:53:57 EDT 2013
  141.  
  142. # workstation: generate "debian" directory.
  143. sudo debootstrap --arch=armel --foreign  squeeze  debian  http://http.debian.net/debian
  144.  
  145. # copy "debian" dir to an ext2/ext3 partition on an SD card and run:
  146. export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PATH
  147. chroot "debian" /bin/bash -l
  148. debootstrap/debootstrap --second-stage
  149.  
  150.  
  151. Entry: Getting a project to build
  152. Date: Wed May  8 23:24:23 EDT 2013
  153.  
  154. [email protected]:~/kmook/android$ /opt/xc/android/android-sdk-linux/tools/android update project --path .
  155. Error: The project either has no target set or the target is invalid.
  156.  
  157. It's from an old one, set to android-4.  Should be 10 (gingerbread 2.3).
  158.  
  159.  
  160. Entry: Android NDK
  161. Date: Tue May 14 15:26:43 EDT 2013
  162.  
  163. Seems to be a separate install.  Can it be installed using the android
  164. tool?  Doesn't look like it.  Seems they actively discourage use:
  165.  
  166.   "In general, you should only use the NDK if it is essential to your
  167.    app -— never because you simply prefer to program in C/C++."
  168.  
  169.  
  170.  
  171. [1] http://developer.android.com/tools/sdk/ndk/index.html
  172. [2] http://dl.google.com/android/ndk/android-ndk-r8e-linux-x86_64.tar.bz2
  173.  
  174.  
  175. Entry: SDL on Android
  176. Date: Tue May 14 16:24:54 EDT 2013
  177.  
  178. The idea is to have an app that runs both on Linux/GLX and Android
  179. OpenGL ES.  How to proceed?
  180.  
  181. [1] http://www.libsdl.org/tmp/SDL/README.android
  182.  
  183.  
  184. Entry: Android audio
  185. Date: Tue May 14 20:29:40 EDT 2013
  186.  
  187. Basically, java player thread calls into JNI to get the next batch of
  188. samples.
  189.  
  190. [1] https://groups.google.com/forum/?fromgroups=#!msg/android-ndk/n5VIQONagTk/7gAMrRL4tvIJ
  191. [2] http://audioprograming.wordpress.com/2012/10/18/a-simple-synth-in-android-step-by-step-guide-using-the-java-sdk/
  192.  
  193.  
  194. Entry: Android Audio latency
  195. Date: Tue May 14 21:44:22 EDT 2013
  196.  
  197. It looks like this is not going to be the best platform for writing
  198. audio apps..  Min bufsize I get currently is 4800 samples.
  199.  
  200. From [3]: Android 2.3 exposes OpenSL ES 1.0 as part of their NDK.
  201.  
  202. [1] http://stackoverflow.com/questions/14842803/low-latency-audio-playback-on-android
  203. [2] http://www.khronos.org/opensles/
  204. [3] http://en.wikipedia.org/wiki/OpenSL_ES
  205.  
  206.  
  207.  
  208. Entry: Droid 2 Global - bootloader
  209. Date: Fri Jun 21 15:20:14 EDT 2013
  210.  
  211. Turn on phone with both volume buttons pressed.  It comes up with the
  212. following on the screen:
  213.  
  214.   Bootloader
  215.   D0.11
  216.  
  217.   Battery OK
  218.   OK to Program
  219.   Transfer Mode:
  220.   USB
  221.  
  222.  
  223. From dmesg:
  224.  
  225. [2045389.304844] usb 3-3.4.3: new high-speed USB device number 26 using ehci_hcd
  226. [2045389.398399] usb 3-3.4.3: New USB device found, idVendor=22b8, idProduct=4280
  227. [2045389.398411] usb 3-3.4.3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
  228. [2045389.398421] usb 3-3.4.3: Product: S Flash OMAP3630 MI
  229. [2045389.398428] usb 3-3.4.3: Manufacturer: Motorola Inc.
  230.  
  231.  
  232. Some steps for band-unlocking here:
  233. http://rootzwiki.com/topic/25828-instruction-files-on-how-to-un-bricked-rooted-and-band-unlock-droid-2-global-with-629-rom/
  234.  
  235. Arduous process.  For now, I think I'm going to downgrade it to 608 so
  236. at least I have a rooted phone.
  237.  
  238. system:   4.6.629.A956.Verizon.en.US
  239. build:    4.5.1_57_D2GA-59
  240. android:  2.3.4
  241. baseband: N_01.82.00R
  242. kernel:   2.6.32.9-g177d714 [email protected] #1
  243. ERI:      5
  244. PRL:      53096
  245.  
  246.            
  247.  
  248.  
  249. Entry: Building Android
  250. Date: Mon Jun 24 15:14:29 EDT 2013
  251.  
  252. [1] http://source.android.com/source/building.html
  253.  
  254.  
  255. Entry: SCR331 CCID card reader
  256. Date: Mon Jun 24 16:00:22 EDT 2013
  257.  
  258. [2306563.172235] usb 3-3.4.4: new full-speed USB device number 38 using ehci_hcd
  259. [2306563.291844] usb 3-3.4.4: New USB device found, idVendor=04e6, idProduct=e001
  260. [2306563.291857] usb 3-3.4.4: New USB device strings: Mfr=1, Product=2, SerialNumber=5
  261. [2306563.291867] usb 3-3.4.4: Product: SCRx31 USB Smart Card Reader
  262. [2306563.291875] usb 3-3.4.4: Manufacturer: SCM Microsystems Inc.
  263. [2306563.291881] usb 3-3.4.4: SerialNumber: 21121250210402
  264. [2306563.377393] WARNING! power/level is deprecated; use power/control instead
  265.  
  266. apt-get install pcsc-tools
  267.  
  268.  
  269. ~# pcsc_scan
  270.  
  271.  
  272. Mon Jun 24 15:59:18 2013
  273. Reader 0: SCM Microsystems Inc. SCR 331 [CCID Interface] (21121250210402) 00 00
  274.   Card state: Card inserted,
  275.   ATR: 3B 98 96 00 93 94 03 08 05 03 03 03
  276.  
  277. ATR: 3B 98 96 00 93 94 03 08 05 03 03 03
  278. + TS = 3B --> Direct Convention
  279. + T0 = 98, Y(1): 1001, K: 8 (historical bytes)
  280.   TA(1) = 96 --> Fi=512, Di=32, 16 cycles/ETU
  281.     250000 bits/s at 4 MHz, fMax for Fi = 5 MHz => 312500 bits/s
  282.   TD(1) = 00 --> Y(i+1) = 0000, Protocol T = 0
  283. -----
  284. + Historical bytes: 93 94 03 08 05 03 03 03
  285.   Category indicator byte: 93 (proprietary format)
  286.  
  287. Possibly identified card (using /usr/share/pcsc/smartcard_list.txt):
  288.         NONE
  289.  
  290. Your card is not present in the database.
  291. You can get the latest version of the database from
  292.   http://ludovic.rousseau.free.fr/softwares/pcsc-tools/smartcard_list.txt
  293. or use: wget http://ludovic.rousseau.free.fr/softwares/pcsc-tools/smartcard_list.txt --output-document=/root/.cache/smartcard_list.txt
  294.  
  295. If your ATR is still not in the latest version then please send a mail
  296. to <[email protected]> containing:
  297. - your ATR
  298. - a card description (in english)
  299.  
  300.  
  301.  
  302.  
  303. So card gives ATR (answer to reset[1]) but otherwise is not recognized
  304. by the scan tool (not a PC/SC[2] card?).
  305.  
  306.  
  307. Movin forward: osmo-sim-auth[3] might be a good place to start:
  308.  
  309. apt-get install python-pyscard
  310.  
  311.  
  312. [1] http://en.wikipedia.org/wiki/Answer_to_reset
  313. [2] http://en.wikipedia.org/wiki/PC/SC
  314. [3] http://openbsc.osmocom.org/trac/wiki/osmo-sim-auth
  315.  
  316.  
  317.  
  318. Entry: Root nexus one 2.3.6 GRK39F
  319. Date: Mon Jun 24 17:57:10 EDT 2013
  320.  
  321. fastboot oem unlock
  322.  
  323. https://code.google.com/p/bexboot/
  324.  
  325. This boot.img can be flashed via fastboot to root a Nexus One with Android 2.3.6 (GRK39F).
  326. Note: Your bootloader needs to be unlocked before you can use it!
  327.  
  328.     Download bexboot.v2.GRK39F_OTA.zip, create a new folder on your computer and extract the Bexboot zip archive into that folder.
  329.     Connect your device via USB to your computer.
  330.     Put your device in USB debugging mode (Settings > Applications > Development > USB Debugging).
  331.     Put your device in bootloader mode. Therefore open a terminal, cd to the directory where you extracted the files to and type:
  332.         Windows
  333.         adb-windows reboot bootloader
  334.         Mac
  335.         adb-mac reboot bootloader
  336.         Linux
  337.         adb-linux reboot bootloader
  338.     In bootloader mode, type in the terminal:
  339.         Windows
  340.         fastboot-windows flash boot bexboot.v2.img followed by
  341.         fastboot-windows reboot
  342.         Mac
  343.         fastboot-mac flash boot bexboot.v2.img followed by
  344.         fastboot-mac reboot
  345.         Linux
  346.         fastboot-linux flash boot bexboot.v2.img followed by
  347.         fastboot-linux reboot
  348.  
  349.  
  350.  
  351. Entry: Building 2.3.6 GRK39F
  352. Date: Wed Jun 26 10:10:54 EDT 2013
  353.  
  354. I'd like to build binaries that work on the Nexus One with 2.3.6
  355. GRK39F.  From [1] it gives the tag to use:
  356.  
  357. GRK39F      android-2.3.6_r1  Nexus One, Nexus S
  358.  
  359.  
  360. Following [2] the version can be checked out as:
  361.  
  362. repo init -u https://android.googlesource.com/platform/manifest -b android-2.3.6_r1
  363. repo sync
  364. . build/envsetup.sh
  365. lunch full-eng
  366. make -j8
  367.  
  368.  
  369. Doesn't build.  Then I followed the apt-get install from here[3].
  370.  
  371.  
  372.  
  373.  
  374. [1] http://source.android.com/source/build-numbers.html
  375. [2] http://source.android.com/source/downloading.html
  376. [3] http://sycurelab.ecs.syr.edu/

Paste is for source code and general debugging text.

Login or Register to edit, delete and keep track of your pastes and more.

Raw Paste

Login or Register to edit or fork this paste. It's free.