Monday, March 11, 2013
Android memory corruption
Gotta know this one http://stackoverflow.com/questions/2298208/how-to-discover-memory-usage-of-my-application-in-android/2299813#2299813
Friday, January 25, 2013
Start call settings with newer Android
Newer Android remove the access to call settings app. It can launched with this
adb shell am start -a com.android.phone.CallFeaturesSetting.ADD_VOICEMAIL
adb shell am start -a com.android.phone.CallFeaturesSetting.ADD_VOICEMAIL
Wednesday, August 5, 2009
enable wifi ad hoc on Andrid
Android comes with wifi ad hoc disable by default. I have always wanted to use my Android the cheap way. I do not have data plan. Typically I am either at home or work. My android is configured to connect to my home router via wifi. We can not have a wifi router at work. So a peer to peer connection would let my pc tether for my Android phone's internet connection. And today I found it amazingly easy to do.
1. edit /system/etc/wifi/tiwlan.ini
adb pull /system/etc/wifi/tiwlan.ini .
vi tiwlan.ini
find line "WiFiAdhoc = 0" and make the 0 1. This would probably already be ok. But somewhere I copied and pasted 2 more lines below, so now that block looks like
WiFiAdhoc = 1
dot11DesiredSSID = YOUR_SSID
dot11DesiredBSSType = 0
....
2 edit /data/misc/wifi/wpa_supplicant.conf
This is for security. Of course if you want to use it every day.
adb pull /data/misc/wifi/wpa_supplicant.conf .
vi wpa_supplicant.conf
if it is and empty file, paste in below and modify your ssid and wep_key0
update_config=0
ctrl_interface=tiwlan0
eapol_version=2
ap_scan=2
fast_reauth=1
network={
ssid="YOUR_SSID"
scan_ssid=0
mode=1
key_mgmt=NONE
group=WEP104
auth_alg=SHARED
wep_key0="13alphanumeri"
}
if it not an empty, you must already have a ap connection configuration. Just paste in the network clause. Then it seems one or both of the below 2 lines is a must have to have security turned on.
eapol_version=2
ap_scan=2
Then your pc or linux will be able to find the ssid specifed in the network clause as soon as wifi is turned on on Android. Connect and enter the preset wep_key. Make sure the pc or linux is configured to share internet connection.
Pretty sweet.
Thursday, May 14, 2009
command line launching Android app
am start -a android.intent.action.MAIN -n com.android.settings/.Settings
Sunday, February 22, 2009
PAN and SSH Android phone
Again, internet is good stuff. Without it, none of this would be this easy.
To do anything below, the phone must be rootable. G1 dev phone, or hacked G1 commercial. There is hacking info all over the web. Maybe someday I will come back and sort it up and place it here.
Enabling PAN on Android.
Android does not come with PAN enabled. The default Bluetooth profiles are Handsfree and Headset. When tried with "pand" command, error return says "Failed to open control socket: Protocol not supported". This means it needs bnep.ko module.
To enable PAN, I needed to build bnep.ko kernel module and insmod it on the device. Here is a very good tutorial. I pretty much followed it.
But it did work for me initially. When loading the ko module, it told me "insmod: init_module 'bnep.ko' failed (Exec format error)". Dmesg gets "bnep: version magic '2.6.27-01843-gfea26b0 preempt mod_unload modversions ARMv6 ' should be '2.6.25-01843-gfea26b0 preempt mod_unload ARMv6 '". Ahh! So the version of my kernel source is newer than the one in my phone. Then I went off to www.kernel.org and downloaded version 2.6.25, and repeated the same work, config, make modules, adb push bnep.ko, insmod. Dallah!
Then set up a pand NAP
# pand -s -r NAP
Now if I see NAP in my service list
# sdptool browse local
...
Service Name: Network Access Point
Service Description: BlueZ PAN Service
Service Provider: BlueZ PAN
Service RecHandle: 0x10002
Service Class ID List:
"Network Access Point" (0x1116)
Protocol Descriptor List:
"L2CAP" (0x0100)
PSM: 15
"BNEP" (0x000f)
Version: 0x0100
SEQ16: 800 806
Language Base Attr List:
code_ISO639: 0x656e
encoding: 0x6a
base_offset: 0x100
Profile Descriptor List:
"Network Access Point" (0x1116)
Version: 0x0100
A simple "pand -c " from my computer, I had 2 devices connected via PAN. Of course I had to assign them IP address manually. A little tricky with Android is that, ifconfig does not print anything. But I figured out that before they could ping each other, I had to explicitly
# ifconfig bnep0 up
SSH from PAN'ed Android phone
Natually, I wanted to try ssh once the 2 devices can see each other on the same subnet. But here is what I get
# ssh ktang@192.168.11.4
ssh: Warning: Reading the random source seems to have blocked.
If you experience problems, you probably need to find a better entropy source.
Internet never fails me. Here is some good info. Smart people everywhere. Briefly, this is the cure.
# ls /dev/random
/dev/random
# ls /dev/urandom
/dev/urandom
# mv /dev/random /dev/random.bk
# ln -s /dev/urandom /dev/random
# ssh ktang@192.168.11.4
ssh: Warning: failed creating //.ssh: Read-only file system
Host '192.168.11.4' is not in the trusted hosts file.
(fingerprint md5 ..................................)
Do you want to continue connecting? (y/n)
y
Password:
Last login: Sun Feb 22 02:08:36 2009 from tanglin
TangMac:~ ktang$
Made me happy!
To do anything below, the phone must be rootable. G1 dev phone, or hacked G1 commercial. There is hacking info all over the web. Maybe someday I will come back and sort it up and place it here.
Enabling PAN on Android.
Android does not come with PAN enabled. The default Bluetooth profiles are Handsfree and Headset. When tried with "pand" command, error return says "Failed to open control socket: Protocol not supported". This means it needs bnep.ko module.
To enable PAN, I needed to build bnep.ko kernel module and insmod it on the device. Here is a very good tutorial. I pretty much followed it.
But it did work for me initially. When loading the ko module, it told me "insmod: init_module 'bnep.ko' failed (Exec format error)". Dmesg gets "bnep: version magic '2.6.27-01843-gfea26b0 preempt mod_unload modversions ARMv6 ' should be '2.6.25-01843-gfea26b0 preempt mod_unload ARMv6 '". Ahh! So the version of my kernel source is newer than the one in my phone. Then I went off to www.kernel.org and downloaded version 2.6.25, and repeated the same work, config, make modules, adb push bnep.ko, insmod. Dallah!
Then set up a pand NAP
# pand -s -r NAP
Now if I see NAP in my service list
# sdptool browse local
...
Service Name: Network Access Point
Service Description: BlueZ PAN Service
Service Provider: BlueZ PAN
Service RecHandle: 0x10002
Service Class ID List:
"Network Access Point" (0x1116)
Protocol Descriptor List:
"L2CAP" (0x0100)
PSM: 15
"BNEP" (0x000f)
Version: 0x0100
SEQ16: 800 806
Language Base Attr List:
code_ISO639: 0x656e
encoding: 0x6a
base_offset: 0x100
Profile Descriptor List:
"Network Access Point" (0x1116)
Version: 0x0100
A simple "pand -c " from my computer, I had 2 devices connected via PAN. Of course I had to assign them IP address manually. A little tricky with Android is that, ifconfig does not print anything. But I figured out that before they could ping each other, I had to explicitly
# ifconfig bnep0 up
SSH from PAN'ed Android phone
Natually, I wanted to try ssh once the 2 devices can see each other on the same subnet. But here is what I get
# ssh ktang@192.168.11.4
ssh: Warning: Reading the random source seems to have blocked.
If you experience problems, you probably need to find a better entropy source.
Internet never fails me. Here is some good info. Smart people everywhere. Briefly, this is the cure.
# ls /dev/random
/dev/random
# ls /dev/urandom
/dev/urandom
# mv /dev/random /dev/random.bk
# ln -s /dev/urandom /dev/random
# ssh ktang@192.168.11.4
ssh: Warning: failed creating //.ssh: Read-only file system
Host '192.168.11.4' is not in the trusted hosts file.
(fingerprint md5 ..................................)
Do you want to continue connecting? (y/n)
y
Password:
Last login: Sun Feb 22 02:08:36 2009 from tanglin
TangMac:~ ktang$
Made me happy!
Sunday, February 15, 2009
enabling ip forward
ktang@TangLin:~$ sysctl net.ipv4.ip_forward
net.ipv4.ip_forward = 0
ktang@TangLin:~$ sudo vi /etc/sysctl.conf
ktang@TangLin:~$ sudo sysctl -p /etc/sysctl.conf
kernel.printk = 4 4 1 7
kernel.maps_protect = 1
fs.inotify.max_user_watches = 524288
vm.mmap_min_addr = 65536
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.all.rp_filter = 1
net.ipv4.ip_forward = 1
ktang@TangLin:~$ sysctl net.ipv4.ip_forward
net.ipv4.ip_forward = 1
Here is a great site of cheap sheet
net.ipv4.ip_forward = 0
ktang@TangLin:~$ sudo vi /etc/sysctl.conf
ktang@TangLin:~$ sudo sysctl -p /etc/sysctl.conf
kernel.printk = 4 4 1 7
kernel.maps_protect = 1
fs.inotify.max_user_watches = 524288
vm.mmap_min_addr = 65536
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.all.rp_filter = 1
net.ipv4.ip_forward = 1
ktang@TangLin:~$ sysctl net.ipv4.ip_forward
net.ipv4.ip_forward = 1
Here is a great site of cheap sheet
Wednesday, January 21, 2009
Installing Adobe Flash Player 10 on Ubuntu Hardy
Due to the previously mentioned 2 GB limit with flash player 9, I attempted to upgrade Hardy with Adobe provided player 10 deb.
sudo apt-get install remove --purge flashplugin-nonfree libflashsupport
dpkg -i install_flash_player_10_linux.deb
But it did not work. After all the googling fun, this link was helpful. Briefly this is the key:
sudo ln -s /usr/lib/libssl3.so.1d /usr/lib/libssl3.so
sudo ln -s /usr/lib/libnss3.so.1d /usr/lib/libnss3.so
sudo ln -s /usr/lib/libnspr4.so.0d /usr/lib/libnspr4.so
sudo ln -s /usr/lib/libsmime3.so.1d /usr/lib/libsmime3.so
sudo ln -s /usr/lib/libplds4.so.0d /usr/lib/libplds4.so
sudo ln -s /usr/lib/libplc4.so.0d /usr/lib/libplc4.so
Yeah, it worked, for me at least.
sudo apt-get install remove --purge flashplugin-nonfree libflashsupport
dpkg -i install_flash_player_10_linux.deb
But it did not work. After all the googling fun, this link was helpful. Briefly this is the key:
sudo ln -s /usr/lib/libssl3.so.1d /usr/lib/libssl3.so
sudo ln -s /usr/lib/libnss3.so.1d /usr/lib/libnss3.so
sudo ln -s /usr/lib/libnspr4.so.0d /usr/lib/libnspr4.so
sudo ln -s /usr/lib/libsmime3.so.1d /usr/lib/libsmime3.so
sudo ln -s /usr/lib/libplds4.so.0d /usr/lib/libplds4.so
sudo ln -s /usr/lib/libplc4.so.0d /usr/lib/libplc4.so
Yeah, it worked, for me at least.
Subscribe to:
Posts (Atom)