[Guide][CM10.1 and CM10.2] Transparent status bar

Proverbs2

Senior Member
Feb 1, 2012
291
319
0
I realize that there are already a number of guides on this topic in other forums, but it took me a while to figure out how to get the transparent status bar working on my DEFY with the latest CM10.1 and CM10.2 builds by Quarx, so I decided to share my procedure in case anyone else is interested. If you just want a flashable zip, check out this thread by thekguy, who has already shared flashable zips for a transparent status bar on some of the recent CM10.1 and CM10.2 builds.

What you'll need:

smali and baksmali
apktool and apktool-install-windows
7-zip
Notepad++

1. Put all the smali, baksmali, and apktool files into the same folder on your PC. (The apktool files must be extracted first, using 7-zip.)
2. Open the CM10.1 or CM10.2 zip file using 7-zip. (Do not extract it, just open it.)
3. Browse to \system\framework, and drag the files “android.policy.jar” and “framework-res.apk” out to a separate folder.
4. Also browse to \system\app and drag out “SystemUI.apk”
5. Open “android.policy.jar” with 7-zip, and drag out the file “classes.dex”
6. Put “classes.dex,” “framework-res.apk,” and “SystemUI.apk” into the same folder used in step 1.
7. Open a CMD prompt and change to that directory (or hold the shift key then right click the mouse and select “Open command window here”).
8. Type the following commands, which install the resources needed by your apks for decompiling and recompiling:

apktool if framework-res.apk​

apktool if SystemUI.apk​

9. Type the following command, which decompiles classes.dex (replace 1.4.2 with whatever version you downloaded):

java -jar baksmali-1.4.2.jar -o classout/ classes.dex​

10. Back in the folder, go into the new classout directory that was created.
11. Browse to \com\android\internal\policy\impl, and open the file “PhoneWindowManager.smali” using notepad++
12. Search for this:
Code:
.method public getSystemDecorRectLw(Landroid/graphics/Rect;)I
then scroll down to the corresponding “.end method”
13. The four lines above that ".end method" look like this:
Code:
:cond_26
const/4 v0, 0x0

goto :goto_1a
14. Replace those lines with this:

Code:
const/4 v0, 0x0

return v0
15. Immediately above the lines you just edited, you should see something like:
Code:
.line 3052
(The line number may differ depending on the build.) Leave that line and also leave a blank line above it, but delete everything else above it up to (but not including) the line that says:
Code:
iput v0, p1, Landroid/graphics/Rect;->bottom:I
16. Save the file and exit.
17. Go back to your CMD prompt and enter this command, which recompiles the classes.dex file with your changes:

java -jar smali-1.4.2.jar classout -o classes.dex​

18. Using 7-zip, drag classes.dex back to where you got it from in android.policy.jar, then drag android.policy.jar back where you got it from in the CM10.1 or CM10.2 zip file.
19. Go back to the CMD prompt again, and enter this command to decompile SystemUI.apk:

apktool d SystemUI.apk​

20. In the “SystemUI” folder that was just created, navigate to /res/layout/, and open “status_bar.xml” in notepad++
21. Search for:
Code:
<com.android.systemui.statusbar.phone.PhoneStatusBarView android:id="@id/status_bar" android:background="@drawable/status_bar_background" android:focusable="true" android:fitsSystemWindows="true" android:descendantFocusability="afterDescendants" android:layout_width="fill_parent" android:layout_height="fill_parent"
22. In that line, replace "@drawable/status_bar_background" with the hexadecimal code for the desired transparency, e.g. "#33000000" for a black-tinted status bar that is 20% opaque (i.e., 80% transparent).

Note: When defining the color of the status bar, the format is #AARRGGBB, where AA is the hex alpha value, RR is the red value, GG is the green value, and BB is the blue value. Hexadecimal uses numerals 0–9 to represent values zero to nine, and letters A-F to represent values 10-15. Thus, FF for the alpha value would be fully opaque, and 00 would be fully transparent. If you want your status bar transparency to match the lockscreen transparency, use "#70000000" (thanks to roofrider for mentioning that in this post.)​

23. Save the file and exit.
24. Optional step to disable the autodimming of notification icons, so that they are more visible on light backgrounds:
Navigate to res/values/, and open “dimens.xml” in notepad++
Search for
Code:
<item type="dimen" name="status_bar_icon_drawing_alpha">65.0%</item>
Change 65.0% to 100%
Save the file and exit.​
25. Go back to the CMD prompt again, and enter this command to recompile:

apktool b SystemUI​

26. If you've edited the files correctly, it should compile with no errors and create a folder named “dist” in the decompiled folder. Open that “dist” folder, and you’ll find the recompiled “SystemUI.apk”
28. Using 7-zip, drag the new SystemUI.apk back to where it belongs in the CM10.1 or CM10.2 zip file.
29. Flash your modified CM file, and enjoy!


Credits:
- Quarx, Blechd0se, and everyone else in these forums who helps to keep the DEFY alive!
- Adi Aisiteru Reborn, for this guide, which I've adapted for Quarx's latest nightly
- thekguy, for mentioning in this thread that Adi Aisiteru Reborn's guide could be adapted for the DEFY
- XperienceD, for this awesome guide, upon which I relied heavily
- krd_medico, for providing a similar guide for CM7, from which I learned a lot
 
Last edited:

thekguy

Senior Member
Nov 13, 2009
845
252
0
Mumbai
Just wanted to add that line numbers change in android.policy.jar whenever framework is changed by CyanogenMod commits, so the line numbers do not match for every build

Sent from my MB526 using Tapatalk 2
 
Last edited:
  • Like
Reactions: Proverbs2

roofrider

Senior Member
Jul 24, 2011
7,042
903
0
Bangalore, IN
Excellent guide! Saved me a lot of trouble, got it working on my Galaxy Mini.
Btw Adi Aisiteru Reborn was wrong when he said "#88000000" will result in 80% transparency. It'll only give 46% transparency.
That is the only part that got me stalling for a bit as what you said was different from what he said, but you are correct here.

Now to centering the clock.

Btw, i'm using #6b #70 so it matches with the lockscreen transparency, it's not perfect but it's close enough perfect! Also need to figure out a way to control the lockscreen transparency so i can have a more transparent statusbar.


It's 56% transparent.
 
Last edited:
  • Like
Reactions: Proverbs2

camry89

Senior Member
Jan 19, 2012
56
33
0
25
Sunnyvale, CA
Cant compile the classes.dex :(


$ java -jar smali.jar classout -o classes.dex

UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalStateException: Cannot get the location of a label that hasn't been placed yet.
at org.jf.dexlib2.builder.Label.getLocation(Label.java:54)
at org.jf.dexlib2.builder.Label.getCodeAddress(Label.java:48)
at org.jf.dexlib2.builder.BuilderOffsetInstruction.internalGetCodeOffset(BuilderOffsetInstruction.java:60)
at org.jf.dexlib2.builder.BuilderOffsetInstruction.getCodeOffset(BuilderOffsetInstruction.java:50)
at org.jf.dexlib2.writer.InstructionWriter.write(InstructionWriter.java:189)
at org.jf.dexlib2.writer.DexWriter.writeCodeItem(DexWriter.java:944)
at org.jf.dexlib2.writer.DexWriter.writeDebugAndCodeItems(DexWriter.java:759)
at org.jf.dexlib2.writer.DexWriter.writeTo(DexWriter.java:214)
at org.jf.dexlib2.writer.DexWriter.writeTo(DexWriter.java:192)
at org.jf.smali.main.main(main.java:229)
 
  • Like
Reactions: update-addicted