I Am a Flasher

I love to flash my phone. There, I said it. I’m out.

I’m a tinkerer. I love to learn how everything works. And once I understand how things work, I try to make them just a little bit better.

I currently own a Verizon Samsung Galaxy Nexus (toro). I used it stock for a couple of weeks, and then I rooted it and began exploring alternate ROMs. Verizon was dragging its heels bringing the latest version of the Android operating system to this phone and I wanted to experience the best Google had to offer.

For months, I tried various ROMs and kernels. I’ve probably flashed the phone over a hundred times. I eventually settled on Cyanogenmod 10.1 nightlies and either CM kernel or Franco kernel, depending on mood.

Over time and successive flashes of nightly builds, my phone became inexplicably slower and slower. It would stutter, pause, delay. Very frustrating, and as I was following all the best practices for flashing alternate ROMs, very puzzling.

I was using the same process with my Asus Nexus 7 tablet and its performance was worse than the phone’s.

A fan of the Stack Exchange network of sites, I posted this question to the Android Stack Exchange. I’ll quote from myself here:

I have a Verizon Galaxy Nexus (toro). I am running Cyanogenmod 10.1 ROM nightlies and I use CyanDelta Updater to stay up to date.

For a period of about 3 weeks, I updated to the latest nightly nearly every day using CyanDelta. Sometimes I’d download the full ROM instead of using CyanDelta. During this time, I never wiped the device (aka factory reset). I just applied the new release on top of the old.

Recently, my phone’s performance degraded significantly. There were long delays unlocking, long delays switching apps, long delays doing just about everything. The phone would freeze up, and the OS would ask if I wanted to end a process because it wasn’t responding. My podcatcher would stutter while playing.

Instead of switching to another ROM, I decided to first do a full wipe (factory reset). I used Titanium Backup to back up my user apps and data. In TeamWin Recovery, I did a factory reset, flashed the same CM 10.1 nightly I was running previously, restored my apps using Titanium, signed into accounts, etc.

My phone’s performance has been completely restored. It’s like night and day.

My question is: Why did that work? What is it about applying successive ROM versions that could cause a slowdown that a wipe would fix?

I love my new level of performance, but I also enjoy keeping up with the latest releases. It would seem I can’t have my jelly beans and eat them too. Now I’m reluctant to flash any updates without doing a full wipe.

I didn’t receive any good leads on answers. Every now and then I’d google for solutions. Late last week, I think I may have found a possible answer. I followed up my own question with an answer:

I’ve come up with one potential answer myself: TRIM

Solid state disks (SSDs) and some flash memory require the operating system to perform a kind of housekeeping task to maintain the efficiency of the device.

The operating system command TRIM is explained in this AnandTech article:

Its applicability to certain Android devices, including my Samsung Galaxy Nexus and ASUS Nexus 7 is explained in these XDA Developers threads:

An XDA member wrote an app called LagFix which purports to exercise the TRIM maintenance function, thus restoring write performance for the device.

Since I recently performed a complete factory reset, I’m no longer having performance problems and thus I can’t directly corroborate the purported benefits of LagFix. If I’m in a position where performance is suffering, I may do some benchmarking and see if LagFix improves the situation.

Please be aware if you plan to try LagFix that there are some devices that have chips that do NOT play nice with this utility. These chips have what’s come to be called a BrickBug, and if you run LagFix on one of these devices, you will irrevocably brick your device.

I highly recommend you follow the advice and read the LagFix FAQ. It points to a utility which can tell you if your device contains a chip that may suffer from the BrickBug.

One aspect I haven’t figured out yet is why a factory reset might restore performance. I’d like to figure out whether a factory reset performs a TRIM cleanup. My meager understanding of the TRIM process from my experience using PCs and SSDs is that if the OS doesn’t have integrated TRIM support, you need a separate utility to periodically sweep the disk.

I purchased the pro version of LagFix to support the developer and I have running on a schedule. I’m hoping that’s the end of my performance woes.

Chrome2Phone Hack – Sending arbitrary text

I use KeePass on my PC and KeePassDroid on my Android phone to manage the hundreds of unique passwords for all the sites and services I use. I keep the password database synced using Dropbox on both PC and Android.

I also use Google’s Chrome browser. The Chrome2Phone (C2P) extension is a great way for me to throw links, phone numbers, maps and other info to my phone from the web browser.

Logging into sites and services on the phone can be a pain because of the complexity of the random passwords I use. KeePassDroid is a bit of a speed bump. It occurred to me that I might be able to send a password to my phone’s clipboard using C2P. Ideally, I’d write a plugin for KeePass that could do what C2P does, but I came up with something else.

C2P supports sending text you highlight in a web page to your phone’s clipboard for pasting. If I could get my password into a web page on my PC, I could send it to the phone. I noticed that if I’m on a web page with a textbox, I can paste arbitrary text (like a password) into the textbox, highlight it, right click it, and send it to the phone. I’m security conscious enough to not want to go pasting my passwords into random textboxes hosted on sites I don’t control. With all the javascript flying around out there, the owner of the page could easily grab whatever I put in the textbox and save it for later perusal.  (We’ll set aside the question for now of, “Do you trust C2P enough to use it to send passwords?”)

What I needed was a single text box in a web page that I control and trust. I made the page, saved it on my hard disk, and launched it in a browser. Here’s that file:
<!DOCTYPE html>
<title>Chrome2Phone Hack</title>
<input type="text"/>

But C2P didn’t like the fact that the page was served locally, off my hard disk, and not from a web server.  It refused to show me the standard C2P options in the right-click context menu. Perhaps I’ll suggest a patch to C2P for this in the future. But for now…

I dragged the HTML file to the Public folder of my Dropbox account, right clicked it, and via the Dropbox context menu, got a public link for it. I’ll let Dropbox host my simple page so that C2P will work. I created a bookmark in my Chrome toolbar named “C2PHack”.

Now whenever I need to send arbitrary info to my phone, I can click my bookmark, paste my text into the textbox, highlight it, and send it to the phone.

Easy, right?