Wednesday, November 26, 2014

(updated 12/10/14!) Xposed: The Answer to All My Problems! Hacking the Moto E...


Notes

This post is a synopsis of the customizations I've done to my Android devices so far. However, this is perhaps the most interminable and ongoing project that I am working on, so I may update certain information from time to time. If I do so, I'll highlight what has been changed, so that anyone trying to replicate the procedures outlined below will be have an up to date reference.

Secondly, although this information is more specific toward Motorola users with unlocked bootloaders, I'm going to add a lot of information that will help people achieve similar results, independent of the device used. Those are my goals.

Device Info & Background

After about a year of putting off getting a new cellphone, I finally bought a new one (or two). I did not want to spend a lot of money on a phone, but the phone had to be awesome, so that's partially why I waited so long. By awesome, I mean:

  • Carrier unlocked GSM so I can switch SIM cards and never be stuck with one particular carrier.
  • The phone's bootloader absolutely must be able to be unlocked, preferably without the OEM's consent or knowledge, as to avoid loosing my warranty, (you Europeans are lucky, I envy you.)
  • Of course, the phone must be rootable, but that should go without saying, as unlocked bootloader == you can do whatever.
  • I really wanted a Google Nexus, because those phones can be unlocked with one adb command, have the most support, and always get the newest Android version first. I got the next best(ish) thing, because I was tired of waiting and could not deal with my cracked up Galaxy Centura anymore. *

* Speaking of the Centura, I'd like to take this opportunity to acknowledge and thank the guys at AndroidArea51 for making that horrible device so much better with their Centura ROMS. Check out their site linked above. They make ROMS for a lot of obscure, not-so-popular phones that nobody else wants to bother with, and they do it for you, for free, and only to better the world!

Anyway, I also wanted a new, rugged, nice phone that would get at least an update to Android 5, in case I decide to keep it on a rooted stock ROM (which at this point, I have done although still waiting for Lollipop!)

Well, Motorola has made this all possible with their release of the Moto E (Codename "Condor"; XT1021, 1022, & 1023). The Condor is not the greatest or latest phone out there, but it's priced right, has just enough specs to do the job and not lag, and best of all, the GSM version of this phone (only the GSM!! not the CDMA version!!!) qualifies for the Moto Bootloader Unlock Program! This makes up for the lower specs immensely. After all, what good will your $600 Galaxy S5 do you if you cannot unleash the full power of the kernel, enjoy the freedoms of open source software, and above all, enjoy freedom of choice?

N00b Note: Unlocking your bootloader is not for the feint hearted! You can seriously mess shit up if you don't follow directions, research, and read, read, read first! I'm not saying don't do it, I'm saying be careful!

The Moto E uses Motorola's Fastboot bootloader, which is much like Odin on Samsung devices, except it's finickier than Odin. For instance, there are many situations where you can render your device useless if you're not really careful. Of course, it is almost always fixable, so fear not. Let's get to it.

Buy a Moto E off Amazon, they're only $119 right now (Remember, GSM only*)! First, you are going to need to unlock your bootloader. I'm sorry, but currently there is no way around this...no more one click roots, guys... (Motorola will give you an unlock code that you will then enter from your PC in fastboot mode, and eureka, you can now do what you want to do with your phone)

*EDIT: I initially purchased the CDMA version of this phone, and was very, very pissed off when I realized how far the Android world has come regarding locking their shit down. I returned it and bought the correct version. Don't make that mistake.

But don't do this yet. If you are impatient like me, and start to alter your system as soon as you take it out of the box, you are going to cause yourself much more headache in the long run. First, decide whether you want to upgrade your O.S. to 4.4.3 or 4.4.4 , mine came with 4.4.2 on it and I went to 4.4.3 but not 4.4.4 because there is no reason to do so (it just kills cool features). Although this does not matter so much because we have an unlockable boot-loader, and can do whatever the hell we want, it will save you some trouble because if you do alter any system files and take an OTA update, you will brick your phone. If you unlock or root before updating, you will have to wipe your phone, reflash to stock, unroot, and flash the stock firmware again before updating. Trust me, that is a pain in the ass.

The Good Stuff

Everyone wants Cyanogenmod. It's simply the best, most featured-packed, yet bloat-free, secure, stable, and awesome ROM out there for (supported) Android devices. Cyanogen has ported its mod for a diverse range of devices, while new or less common phones like mine often have unofficial, beta builds available for testing and further development. Eventually they become 'official' builds, after their stability has been proven, as per the open source communities peer review system, and the GPL.

This particular phone was finicky when i tried installing CM11 'Condor' (can be found on Github here). After flashing cyanogenmod, the phone functioned great, except mobile data did not  work.

I also had to install "GAPPS" (all the Google Apps in a separate zip) in order to get all of the Google Play framework and programs. I don't know if I downloaded the wrong version or something, but the Google apps were buggy as hell, and they were constantly crashing. I tried a lot of work arounds, but at this point I really needed my phone to just work, so I had to flash my original system again through my custom recovery, which is painless if you do it correctly. Measure twice, bake once!

In the end, after flashing back to rooted stock 4.4.3, using TWRP (no, not some nasty some Miley Cyrus gesture, but rather Team Win Recovery), which is an excellent program, and in my opinion, the best custom recovery available for Android devices right now, as there are many amazing features, including touch support! (So no more thumbing around with the volume and power buttons like in {the old} ClockworkMod!)


I considered installed AreaRom's Moto E rom, but after having to rotate TextSecure PGP keys several times (even after restoring from a Nandroid backup), I got tired of the whole thing and just stuck to rooted stock. I probably will try AreaRom's Moto E ROM at some point, but for now...

Xposed Is Solving All My Problems

I took a closer look at the Xposed framework module, which is something I kept seeing everywhere on the xda forums, but had not really looked into. It is a module for rooted devices that lets you tweak every aspect of your system, like freaking magic... the best part is that all you need to do is install one APK file and reboot a couple times, and you are good to go! So what exactly is Xposed?

Well, it is framework developed by some really ingenious people, for rooted Android (4.0+ ..?) devices that allows you to download modules written by other members of the Android Dev community (or write your own), and these modules let you customize just about everything on your device. Here's a quote from a reddit thread listing some of the modifications one user was able to perform with the Xposed framework: (source)

I also haven't seen any performance issues, and I'm running quite a few modules...
  • AcDisplay (Modified lockscreen/notification screen)
  • ActivityForceNewTask (Forces apps to open new tasks when opening another app so that you don't have the wrong app showing in recent tasks)
  • Always Correct! (Forces correction on the keyboard for all fields)
  • CrappaLinks (Unshortens links before actually going to them, so that you don't have to open chrome first)
  • Gesture Navigation (Multi-touch OS-wide gestures)
  • GravityBox [KK] (TONS of visual enhancements... and more)
  • Greenify (Keep those pesky apps in check)
  • LWInRecents (Live Wallpaper shows in recent tasks)
  • MinMinGuard (Removes ad frames, works in conjunction with AdAway)
  • WakeLock Terminator (Keeping apps in check, once again, especially Nlp wakelocks from google play services)
  • Xposed GEL Settings (Customize Google Experience Launcher)
  • Youtube AdAway (Obvious)
  • Preference Injector (Puts my modules that offer an interface into the settings app for convenience)
  • DarkTube (Dark theme for Youtube. Came out very recently)
  • Hide Xposed IME (Hides the irritating notification to switch input methods
  • Keep Trash (Takes the trash button out of the overflow menu in Keep)
  • No KeyboardAutoPopup (Hides the keyboard when apps want to force it open on launch)
  • Play Store Link in App Info (Puts a button to the play store in the app info in settings)
  • StopSwitchDelay (forces certain apps to launch quickly from google now)
  • Xposed Light Sensor Filter (Sometimes the Nexus 5 light sensor reports very high levels randomly... This evens those spikes out.)
As you can see, you can do quite a bit. GravityBox has at least as many customizations as the rest of the list combined, too. Too many to list.
You get the point. This framework essentially allows me to build my own custom ROM for my phone, and you can do the same with yours!  Here is a couple things I've done with Xposed modules so far:

  • Enabled App Ops (the most awesome feature ever that Google killed in 4.4.2 ... retards.) This allows me to individually grant or deny all app permissions, including the system apps! Fuck you YouTube, you don't need access to my GPS or Camera! Victory at last!!!
  • Added a 'reboot' option to my power down menu, with options to soft reboot, reboot to bootloader, and recovery. (this is a big deal to me, because I hate having to use 3rd party apps to do things that the native system can handle just fine...)
  • Installed Greenify, which is a progam that seriously improvs your batter life, and system performance by forcing apps to 'hibernate' when they are not in use. And holy hell, it works great.
  • Made it so Google Maps can never ask me to turn on wifi again! No more evil world wide router mapping! #freedom
  • Update (11/27/14): Installed Xprivacy, and it is certainty interesting. This app lets you restrict what type of information apps can access without touching the permissions like app ops does. Instead, it feeds the apps bogus information. For example, if you say Youtube can't access your location, a mock (fake) location will be given to Youtube. That's powerful, but definitively something that needs to be locked down hard. I'm still figuring out what the advantages are to this over simply denying the permission to begin with. I suppose it could be a good work around for controlling privacy in situations where app ops breaks functionality. When I figure out more I'll post back.
  • Update (12/10/14) I have installed Gravity Box, which in my opinion is a must have module if you are running Xposed. It contains a large, diverse selection of tweaks that allow you to do anything from changing the color of your status bar to enabling a 'smart radio' to better manage your  device.  Also, I'd like to add that Xprivacy is awesome. I love how I can now feed apps bogus randomized information when I want to restrict a permission. It is indeed a good work around for some apps that need certain permissions when app ops will break functionality. Besides Titanium Backup Pro, this may be the only other app I actually pay for. The pro features allow you to restrict system apps as well. I think it's worth it. I rarely pay for software, but when it comes to apps that need SU permissions, it is DEFINITIVELY a case of "better safe than sorry." 
    • Unfortunatly, Xposed does tend to take up a lot of RAM (if you run a lot of modules), so I may attempt to rebuild the OS inside a virtual machine and than flash all my customizations to my phone, so that I do not need to run anything in the background.
    • Something is draining my battery pretty bad, the phone tells me it is the screen, but I can't imagine why... working on that Oh by the way, see my post about IMSI catcher detection here. There is something funny going on... cell towers don't just get up and start flying around...
    • Also, AT&T has terrible service when I go to the country. It works fine in the city and in my home, so it is not a huge deal, but I wish I could get a signal when I'm out in the middle of nowhere, like I could on Verizon. Oh well, you win some and loose some. Perhaps a Tmobile sim card would be a good investment. Will check it out and update later.
That's all I have done so far, and my phone is now doing what I want it to do, simply working with the stock ROM. This is groundbreaking stuff for people like me whom possess a device that is not officially supported by Cyanogenmod (which has all these features and more enabled out of the box).

Prerequisites of Awe
  • Either root access, or any phone with an unlocked bootloader (these tend to go hand in hand). If your phones bootloader cannot be unlocked with the OEM's consent, do some research about root exploits. Sunshine, Framaroot, and Towelroot are three that I know work on many devices running 4.4.3 and under.
  • Once you have either, you can get the other. We need the SU binary installed, and write access to the system partition before doing anything cool.
  • ICS (4.0) or later. (Update 10/27/14) This is no longer true. Xposed has been ported for Gingerbread (2.3.x) devices as well!
  • That's about it!
Enjoy!

No comments:

Post a Comment