Cyanogen with a broken screen

Jun 1, 2016

Yada, yada, yada, and I had an LG Nexus with a broken screen with me which I didn’t have any use for. Besides, the screen was broken and, though everything else seemed to work, it wasn’t possible to even unlock it by drawing a pattern on the screen.

However, that was a perfectly good screen I could use for displaying, say, the time and a perfectly good
microphone and speaker there I could use for “OK Google” voice searches.

I decided to take this on as a challenge for the weekend and I’ve decided to write this guide to document what did, and what didn’t, work.

The installation went smoothly, but then as soon as I started the phone in normal mode, it shut itself down after about 5 seconds on the setup screen.

At first, I thought that it was a hardware issue. Perhaps the screen was broken in such a way that it pressed the power button? But the phone didn’t shut-down in recovery mode. Hence, it had to be something else.

There were a few posts on the Internet with similar symptoms, but nothing which targeted the exact problem that I had.

I tried to move down a version of Android and that did the trick. I rebooted into recovery and then installed the last version of Cyanogen instead:

This version didn’t restart on reboot and I didn’t investigate what was the problem with the newer version; I was picking my battles.

I had breached enemy lines.

Enabling debugging mode

So I had an Android phone which was staring at me with an enthusiastic message from the Cyanogen team, but I couldn’t do anything yet: the screen was still unresponsive.

There are ways of controlling the phone from the adb shell, but they require debugging to be enabled. It was not enabled by default on the Cyanogen ROM. Hence, running adb devices didn’t list the attached phone.

There are a lot of posts on the Internet describing how to enable debugging mode.
Some of them require editing a SQLite database (i.e. settings.db) and some required editing .prop files (i.e. /system/build.prop and/or /defaults.prop).

Any form of editing of settings.db. It simply kept the phone from booting properly (it stayed on the booting animation). Fixing the issue required a fresh installation each time. I tried several variations of the editing process: keeping the journal file, removing the journal file, with correct permissions, with 777 permissions, with correct ownership, etc.

Changing the build.prop alone didn’t have any effect either: the phone booted but it did not show up upon running adb devices.

I tried chancing the build.prop in cm-12.1-20151007-SNAPSHOT-YOG4PAO334-mako.zip/system/build.prop, repackaged the zip archive and tried a fresh install but that didn’t make the device debuggable either.

After I had the screen-cast working, turning on Bluetooth and pairing it with my Keyboard and Trackpad was a breeze.

The keep has been breached!

OK Google

Now I could already use the phone as a wall-clock by using the Clock app. I turned on development mode on the phone and stopped it from turning of the screen while charging and kept it attached to a spare charger forever. I also removed the Lock screen completely.

Now to get OK Google to work, I had to install Google Apps on it. So back to Recovery Mode went the phone.
I downloaded Google Apps (ARM versions) and sideloaded it into the phone. I restarted in normal mode, updated Google services, downloaded all dependencies and enabled “OK Google” recognition at all screens.

Now I could wake up in the morning and shout at my phone “OK Google, what is the weather like today?” and it would promptly tell me that it was overcast and rainy. :)