JAMES
LOPER

Basics of Android Development Bridge

If you want to hack your phone, to truly make it your own, you need to get an Android.

Android Development Bridge

ADB an official tool provided by Google. It allows you to tunnel into your device over the USB cable and run shell commands on the device. Shell commands are small snippets of code you can execute on your phone to do things like make the file system read/write, copy files, and do commands like reboot or play a sound. You can access ADB using Terminal on Mac or Command (CMD) on Windows, but first you have to set it up. Follow this guide from top to bottom, skipping the instructions for Windows if you have a Mac, etc.

Installation

Make sure your device is rooted. You can use ADB on a non-rooted phone, but for all the tutorials on my site ADB needs root to do the first command (su). If you are on Windows, you must install the USB driver for your device. Go to the product’s website, find Support, and browse for the USB drivers like this page for Motorola devices.

Download the tools package for Mac or Windows to your computer.

Open the archive, open android-sdk-windows, then open tools and extract the file called adb to your home folder (~/) on Mac or (C://) on Windows.

Mac

Open a Terminal window on your Mac by clicking the Spotlight icon in the corner, typing Terminal and pressing enter on Terminal. Move the terminal icon to somewhere in your dock so it will stay. Now every time you start up a new Terminal and want to run ADB, you’ll always want to start like this (remember to press return after each line):

export PATH=~/tools
adb shell

Windows

Open a Command Prompt on Windows XP by clicking Start > Run and typing in cmd, or on Windows 7 by clicking the Windows logo and simply typing in cmd and pressing Enter. Now every time you start up a new Command Prompt and want to run ADB, you’ll always want to start like this (remember to press return after each line):

C://adb.exe shell

Hack Away

Now this is where you run your awesome file editing commands. If you mess with the file system, you should end the ADB session by closing it back up, syncing, and rebooting the device, which is done like so:

mount -o ro,remount -t yaffs2 /dev/block/mtdblock4 /system
sync
reboot

ADB Example 1: Change Display DPI

Besides going into settings and simply adjusting your font size, you can actually make the entire UI bigger or smaller depending on your preference. To get a baseline, run this to get your default DPI:

adb shell dumpsys display | grep mBaseDisplayInfo

I say choose a native DPI, so the system doesn’t have to scale the UI graphics, possibly making them look sharper. Because of scaling algorithms, the best is to shoot for a multiple of 4 or 8, but even better and sharper are multiples of 160. Run this to set a new DPI:

adb shell wm density <NEW_DPI> && adb reboot