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");

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

Build Standalone Binaries in C for Android

Procedure is simple. Here is the detailed steps and hopefully it is helpful for others.


  • Know your Android system code, whether it's android-18, or android-22, or others. Here we assume android-21.
  • Download the latest NDK. Here we assume NDK path is /home/happyz/ndk (or simply ~/ndk)
  • Figure out the gcc version, either 4.8 or 4.9. If not, update it.
  • Assume the output folder you want to store the toolchain is at ~/androidLib/
  • Our system is Ubuntu 64-bit, therefore we need to specify --system=linux-x86_64

Continue reading Build Standalone Binaries in C for Android

Build CM10.2 for Quincyatt from Source

It's just taking too much time to figure out the steps.. It'll be good to record what I have done in case I forget it..

System Spec

  • Ubuntu, eight-core, i7-2600 3.4GHz
  • Samsung Galaxy Note (quincyatt)


For environment setup:

sudo apt-get install openjdk-7-jdk
sudo apt-get install python
sudo apt-get install git-core
sudo apt-get install gnupg flex bison gperf \
  build-essential zip curl zlib1g-dev libc6-dev \
  lib32ncurses5-dev ia32-libs x11proto-core-dev \
  libx11-dev lib32readline5-dev lib32z-dev \
  libgl1-mesa-dev g++-multilib mingw32 tofrodos \
  python-markdown libxml2-utils

For Android SDK:

Download and install SDK following the instruction here

Continue reading Build CM10.2 for Quincyatt from Source