[Google Pixel Guides, News, & Discussion] daddylonglegs:
Hi all!

I was extremely disheartened when I discovered that XPosed and thus GravityBox would not work on my Google Pixel (or any phone with Nougat for that matter).

There are so many little tweaks to the OS that GravityBox can enable and I felt like I could not live without them. Having the day of the week in the status bar was a big one for me. It was such a big deal to me that I spent days messing with my Pixel, accidentally bricking it and wiping it and restoring it more times than I want to admit, just to get the day of the week in the status bar. Now I know I could have just downloaded an app that did it, but they always required a separate program running at all times and I hated that idea, especially since Android has the feature built-in.

So the problem is that GravityBox was able to modify the SystemUI.apk, but Xposed and thus GravityBox does not work with Nougat. Manually editing the SystemUI.apk on my Pixel always caused a lockup where SystemUI would crash and I could not boot my phone.

So after several weeks trying to figure this out, and with the help of other members, I was able to get these GravityBox-like tweaks to work on the Google Pixel! (though I definitely need some help getting code to make other tweaks, so if any of you know the codes of other tweaks, post them please!).

Anyway:

(as you can see I was able to unlock new SystemUI settings in the stock Android settings menu, as well as the date and day of the week in my status bar)

Step 1:

Make sure your Pixel is rooted with Magisk. I am using V12 because V13 caused my phone to be unusable for some reason (even with the Pixel guide). If you need the Magisk version that is for the Pixel specifically; the download, as well as a great guide, is available here: https://android.gadgethacks.com/how-to/install-magisk-your-pixel-pixel-xl-0177522/

Step 2:

Create a backup in TWRP. Use TWRP 3.0.2.0-RC1 for saltfish/Pixel. I had issues with RC2 not restoring my backups properly. When you choose backup, select the following: Boot, System Image (not system!), Vendor Image (not Vendor!), Data, and EFS. I have zero issues restoring my pixel with those selected (and System and Vendor de-selected). You don't have to do this step, but I like to do it in case a mistake is made.

Step 3:

After you have Magisk installed, you will need to download the zip from the link below. I titled it magiskXDAhelperWORKSnavbarENABLEd4.zip.

Please excuse the silly file name. I had to make so many different zips that I had to give them weird titles so I knew which ones worked and which ones didn't. :)

Install that Zip in TWRP. Reboot.

You should now notice in your status bar that you have the day of the week and the date. You will also have a new option in your System UI Tuner settings called "Navigation Bar". This will let you edit the navigation bar to your heart's content; as well as the option to remove the brightness slider if for some reason you'd want to.

In short, Android has these options built into the OS, but they don't have easy ways to enable or adjust them. I have no idea why. Anyway, long story short: XML files need to be edited to enable these types of settings or features. These tweaks are NOT separate programs constantly running on your phone which is why I love them.

Anyway you might not want the tweaks I included which is fine (day and date in status bar and extra options in settings menu). All you need to do is delete the layout and xml folders I created (and the XML files inside them) in magiskXDAhelperWORKSnavbarENABLEd4.zip\eviltheme\system\priv-app\SystemUIGoogle.apk\res

You will see later on how you will use the folders and files you create in the zip to make changes you like!

So back to the beginning: directly messing with your systemui.apk can be dangerous, [MENTION=4280397]djb77[/MENTION] was nice enough to create a Magisk module that allows you to make these XML edits, without messing with your systemUI.apk. It basically finds these changes on your phone and makes the changes when your phone boots. It's great and safe, but unfortunately does not work with the Pixel due to the dual partitions the device has. [MENTION=5346465]Tulsadiver[/MENTION] is an awesome member of the XDA community and edited the module to work with the Pixel. Tulsadiver's edited module is what is inside of the magiskXDAhelperWORKSnavbarENABLEd4.zip I provided below, with the only difference being I added my XML edits that allows for the day of the week and date in the status bar, and the extra options unlocked in the SystemUI Tuner in the settings menu.

You can see where my edited XML files are in the zip and it will help you understand how this all works. Extract my magiskXDAhelperWORKSnavbarENABLEd4.zip and you will see a bunch of folders and files. Open the EvilTheme folder, then system folder, then the priv-app folder. Then the SystemUIGoogle.apk folder (it is named SystemUiGoogle.apk but it is NOT an apk. It is just a folder with that name). If you did not notice yet, this is how the actual SystemUIGoogle.apk is stored on your Pixel. SystemUiGoogle.apk is stored in the system/priv-app/SystemUIGoogle/ folder on your phone. So basically, this magiskXDAhelperWORKSnavbarENABLEd4.zip structure sort of "mimics" where things reside on your system folder. You will see if you decompile your SystemUIGoogle.apk that inside it has a /res folder and a /layout and /xml folder (amongst others) and you will notice the magiskXDAhelperWORKSnavbarENABLEd4.zip has it, too. Those contain the changes I made to enable what I mentioned.

Step 4

You might notice if you look at my XML files in the magiskXDAhelperWORKSnavbarENABLEd4.zip, they are a garbled mess. This is because they need to be in the "recompiled" format on your phone. You will notice if you decompile the SystemUiGoogle.apk, that those same XML files are nice and readable. So if you want to make any tweaks, you need to decompile your SystemUiGoogle.apk, edit the XML files you like, then recompile. Then because you are only using the XML files (and not the recompiled SystemUiGoogle.apk), you would use 7zip to unzip the SystemUiGoogle.apk and pick out the files that you edited. This time they will be a garbled mess, which is what you want. You then add them to their respective folder in magiskXDAhelperWORKSnavbarENABLEd4.zip

If you need help decompiling and recompiling the SystemUiGoogle.apk, I can help.

Get Tickle My Android here: https://xdaforums.com/showthread.php?t=1633333

Make sure you get it up and running by following the directions there.

I will guide you through decompiling and recompiling since it is a bit different because Google renamed systemui.apk to SystemUiGoogle.apk for who knows what reason.

Once it is running, Go to the "settings menu".

Now select the "change favorite files" menu.

Press 1 and make that favorite file system/framework/framework-res.apk

Now go back to that menu and press 2 and make that favorite file system/priv-app/SystemUIGoogle/SystemUIGoogle.apk

Again we are doing this because TickleMyAndroid won't be able to find those due to them being renamed on the Pixel.

Now go back to the main menu, and choose the Theming Menu

Now choose the Pull Menu

Choose the option near the bottom that says Pull/Set Favorite File and pull AND install the 1st one (system/framework/framework-res.apk). You will only need to do this once. You do not need to do this again in the future unless you use a new computer or something.

Now you want to decompile your SystemUIGoogle.apk that is on your phone.

"Pull" the file from the favorites option; making sure you select the 2nd one this time. SystemUIGoogle.apk will be pulled from your phone and decompiled.

You will find the decompiled SystemUIGoogle.apk in your Tickle My Android folder, and in the \_WorkArea1\_working\SystemUIGoogle.apk folder (like on the zip I uploaded, this SystemUIGoogle.apk is the name of a folder and is NOT an apk!).

Now say you want to edit your status bar to have the date and day of the week in the status bar (make believe there are no folders or files in eviltheme/system that already do this for you). The code for that is this:

The file that needs to be edited is res\layout\status_bar.xml

Find this line: com.android.systemui.statusbar.policy.Clock and remove that entire code block and replace it with this:

<TextClock android:format12Hour="EEE MMM dd h:mm a" android:format24Hour="EEE HH:mm" android:textAppearance="@style/TextAppearance.StatusBar.Clock" android:id="@id/clock" android:paddingLeft="3.0dip" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="bottom" android:singleLine="true" />

Save the XML file.

Now we need to put that file in the magiskXDAhelperWORKSnavbarENABLEd4.zip in the proper location and flash it in TWRP. But remember, we can't put in the "easy to read" .XML. It needs to be the garbled one you get when the apk is compiled. So in TickleMyAndroid, simply go to "recompile app with original signature" in the the "quick menu". Choose SystemUIGoogle.apk. Find the recompiled one that was just created. Unzip it (yes you can unzip an apk!) and look for status_bar.xml

Take this status_bar.xml and place it in the magiskXDAhelperWORKSnavbarENABLEd4.zip in the \eviltheme\system\priv-app\SystemUIGoogle.apk\res\layout folder and that's it! Flash the zip in TWRP and when you reboot, you should see your changes! Congrats! You've successfully "edited" your SystemUI.apk without ever touching the original file, and without needing to stay on Marshmallow to use XPosed/Gravitybox!

Since this took me such a long time to figure out (even with the help of XDA forum members!) I figured a nice guide like this would be helpful to others and I could pay it forward.

I am going to reserve the next post for us all to post nice systemui XML and other edits that will give us nice custom tweaks! So if you know some, please reply with them because finding them online can be a nightmare (not to mention some of them I have yet to be able to find!).

Enjoy! :D