Compile tshark/wireshark for Android

It is a painful process and I would like to record the whole process.. I will provide a script in the end to assist, but the script should be used "AS IS."

To get wireshark working on Android, we will need many many libraries to start with. Most importantly, we need:

  • libpcap
  • glib
  • libiconv
  • libffi
  • gettext

To get these (and compiled correctly), we also need to get libgcrypt, libgpg-error, gmp, nettle, libtasn1, p11-kit, gnutls, xz, and libxml2. First we need to download all these. Navigate to a directory and use the following script to do so. Continue reading Compile tshark/wireshark for Android

Samsung Galaxy S8 Update Issue with Project Fi

I did not find online anyone mentioning about this. But after I update my S8 to Android Oreo (8.0, the latest system version), my Project Fi lost its data connections.

I found this issue after I left home taking an Uber. I was standing outside and there was no WiFi. My S8 behaved as usual until I notice there was no LTE sign in the status bar. I opened the Uber app and it said "No Internet Connections." I tried other apps and finally found my LTE was gone.

Okay, so long story short, if you encounter the same problem as I did, here is the solution. I do not know why it happens, but the update triggers a change in the network access point settings. For S8, if you navigate to

Settings > Connections > Mobile Networks > Access Point Names

You will see Project Fi -Tm is selected (there might be two of them). Click on the one that is already chosen and we'll edit the APN protocol. The update somehow changes the APN protocol to IPv6 only. Now change that to IPv4/IPv6.

Everything now gets back to normal. ­čśÇ

Google Updates When They Stop Supporting Pixel and Nexus Phones

Pixel will be supported until October 2019, and Nexus 6P is up to September 2018.

:'(

It is understandable, since as the generation of phones aggregate, it would be too busy to support all of them and it would be nearly impossible to have bugs in it.

But at the same time, it is sad to learn that when the old phones are still usable, it will be unsupported. The hardware won't expire till 5 years, 10 years maybe. But the software is outdated within 2 or 3 years. Why? Is it really necessary to stop supporting old phones that fast? Continue reading Google Updates When They Stop Supporting Pixel and Nexus Phones

Turn on/off Theater Mode on Android Wear Programatically

The simplest way is to leverage the adb shell to run settings put global theater_mode_on.

  • settings put global theater_mode_on 1 will turn on theater mode
  • settings put global theater_mode_on 0 will turn off theater mode

And the following is the java code to turn on theater mode.

Process su = Runtime.getRuntime().exec("su");
DataOutputStream os = new DataOutputStream(su.getOutputStream());
os.writeBytes("settings put global theater_mode_on 1\n");
os.flush();
os.close();

So we can automated the theater mode through scripts.

Notice that the total time to get it effective is about 2 seconds, and it will pop up a long toast, followed by the dark screen. The whole takes around 10 seconds. Afterwards, if ambient mode is on, the device will get into ambient mode.

Using Valgrind and Callgrind on Android

Lately we want to understand the cpu utilization of an Android app we wrote. We tried a few things like android-ndk-profiler and easy-performance-analyzer but they did not provide a very detailed results in terms of system calls. They are easy to use but don't tell the details we want to see. Valgrind is a very powerful profiling tool in Linux and we wondered to use that in Android. There are few topics in compiling that using Android NDK (mostly here). The answer contains detailed scripts, which is great, but there are certain confusions during the compilation. In short:

  1. There are a few bugs in the script
  2. Android-21 has a bug (issue of redefinition), but android-19 certainly works
  3. In our case, we need to analyze standalone Android binary executions

Therefore, here is my entry.

Continue reading Using Valgrind and Callgrind on Android