FORUMS

[How To] Modding stock Lollipop - guides

203 posts
Thanks Meter: 138
 
By d_ave, Senior Member on 1st June 2015, 11:30 AM
Post Reply Subscribe to Thread Email Thread
I'm starting this thread in order to share my findings about modding stock Lollipop apps for our beloved LG G2.

First of all, letís start with modding the LGSystemUI.apk

Youíll need a deodexed LGSystemUI.apk in order to have all mods working without any faults.
Thereís no need to have a fully deodexed rom, itís enough just to have a deodexed systemui, but I recommend you to pull the whole /system through adb and to deodex it using either Joel Droidís Lollipop deodexer or some other deodexing tool. Itís a lot easier to have a fully deodexed version of the rom stored on one of your drives and to take the apks you want to mod from there instead of deodexing them one by one manually.

Other tools that you will need include:
- TickleMyDroid (TMD) Ė very useful tool, which offers a nice interface, allows you to work on several roms at once and makes decompiling and recompiling as simple as pressing a button
- APKTool Ė latest possible version, at the moment on writing the guide the latest possible version is 2.0.0
- Notepad++ for editing
- 7zip Ė no comment necessary

You need to set the TMD to use the latest APKtool and youíre good to go.

Few words on the deodexing process itself. You donít need the whole rom to be deodexed, just the files youíre editing. Letís say you want to use your freshly deodexed LGSystemUI.apk. The only thing you need to do is to replace the stock LGSystemUI.apk with the deodexed one and to delete the LGSystemUI.odex from the /system/priv-app/LGSystemUI/arm/ folder. There are several ways to do that. You can either use Root Explorer or similar app, do it through the TWRP file browser or just make a flashable zip file, itís up to you.

Another few words on decompiling and recompiling. While recompiling always choose option 2 in the TMD Ė Recompile App With Original Signature. Otherwise youíll be facing a fc as soon as you reboot your phone with the freshly flashed mod.

Enabling the Clear and Cloudy weather effects on the lockscreen.

This one is easy.

1. Decompile the deodexed LGSystemUI.apk
2. Navigate to \LGSystemUI.apk\smali\com\lge\effect\weather and open WeatherEffect.smali
3. Now letís take a look at whatís inside the file. Locate the following segment:
Code:
:pswitch_2
    new-instance v0, Lcom/lge/effect/weather/thunder/ThunderWeather;

    .end local v0    # "weather":Lcom/lge/effect/weather/WeatherEffect;
    invoke-direct {v0, p0, p1}, Lcom/lge/effect/weather/thunder/ThunderWeather;-><init>(Landroid/content/Context;Lcom/lge/effect/lockscreen/LockScreenRenderer;)V

    .line 44
    .restart local v0    # "weather":Lcom/lge/effect/weather/WeatherEffect;
    invoke-direct {v0, p2}, Lcom/lge/effect/weather/WeatherEffect;->setWeather(I)V

    goto :goto_0
below it youíll find almost the same segment for Clear weather and for Cloudy weather. I say almost the same, because it looks like that:

Code:
:pswitch_3
    sget-boolean v1, Lcom/lge/effect/weather/WeatherEffect;->mIsDisney:Z

    if-ne v1, v2, :cond_0

    .line 48
    new-instance v0, Lcom/lge/effect/weather/clear/ClearWeather;

    .end local v0    # "weather":Lcom/lge/effect/weather/WeatherEffect;
    invoke-direct {v0, p0, p1}, Lcom/lge/effect/weather/clear/ClearWeather;-><init>(Landroid/content/Context;Lcom/lge/effect/lockscreen/LockScreenRenderer;)V

    .line 49
    .restart local v0    # "weather":Lcom/lge/effect/weather/WeatherEffect;
    invoke-direct {v0, p2}, Lcom/lge/effect/weather/WeatherEffect;->setWeather(I)V

    goto :goto_0
youíll notice that between the switch_3 and the new-instance rows there are several other rows. I have colored them red, so you can easily locate them. just delete them so the code looks like that:
Code:
:pswitch_3
    new-instance v0, Lcom/lge/effect/weather/clear/ClearWeather;

    .end local v0    # "weather":Lcom/lge/effect/weather/WeatherEffect;
    invoke-direct {v0, p0, p1}, Lcom/lge/effect/weather/clear/ClearWeather;-><init>(Landroid/content/Context;Lcom/lge/effect/lockscreen/LockScreenRenderer;)V

    .line 49
    .restart local v0    # "weather":Lcom/lge/effect/weather/WeatherEffect;
    invoke-direct {v0, p2}, Lcom/lge/effect/weather/WeatherEffect;->setWeather(I)V

    goto :goto_0
Do exactly the same for the Cloudy weather, which is just below the Clear Weather.
After youíre done, do just have to recompile and push back the file to the phone.

Removing the carrier label from the lockscreen

1. Decompile the deodexed LGSystemUI.apk
2. Navigate to \LGSystemUI.apk\res\layout
3. Open the file keyguard_message_area_dragview.xml
Hereís what you can expect to see:

Code:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignParentTop="true"
  xmlns:android="http://schemas.android.com/apk/res/android">
    <LinearLayout android:gravity="center" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content">
        <com.android.keyguard.KeyguardMessageArea android:layout_gravity="center" android:id="@id/keyguard_message_area_cmas" android:tag="cmas" android:clickable="true" android:layout_width="wrap_content" android:layout_height="wrap_content" style="@style/InfoTextStyle" />
    </LinearLayout>
    <com.android.keyguard.CarrierText android:id="@id/carrier_text_dragview" android:clickable="true" android:layout_width="fill_parent" android:layout_height="wrap_content" />
    <com.android.keyguard.KeyguardMessageArea android:layout_gravity="center" android:id="@id/keyguard_message_area_charger" android:tag="charger" android:clickable="true" android:layout_width="wrap_content" android:layout_height="wrap_content" style="@style/InfoTextStyle" />
    <com.android.keyguard.KeyguardMessageArea android:layout_gravity="center" android:id="@id/keyguard_message_area_owner" android:tag="owner" android:clickable="true" android:layout_width="wrap_content" android:layout_height="wrap_content" style="@style/InfoTextStyle" />
    <com.android.keyguard.KeyguardMessageArea android:layout_gravity="center" android:id="@id/keyguard_message_area_lockout" android:tag="lockout" android:clickable="true" android:layout_width="wrap_content" android:layout_height="wrap_content" style="@style/InfoTextStyle" />
</LinearLayout>
The carrier text is colored in red. You can replace it with the following:
Code:
<com.android.keyguard.CarrierText android:id="@id/carrier_text_dragview" android:visibility="gone" android:clickable="true" android:layout_width="0.0dip" android:layout_height="0.0dip" />
In general only the android:visibility=ĒgoneĒ is enough, but better to be safe with also setting the width and the height to 0.0dip.
Note also this:
Code:
<com.android.keyguard.KeyguardMessageArea android:layout_gravity="center" android:id="@id/keyguard_message_area_charger" android:tag="charger" android:clickable="true" android:layout_width="wrap_content" android:layout_height="wrap_content" style="@style/InfoTextStyle" />
This is the Charging text which appears while you charge your phone. In my mod I have removed it from this xml and placed it under the clock in order to avoid having a charging text hanging in the middle of nowhere on my screen.

Editing the lockscreen clock and date

1. Decompile the deodexed LGSystemUI.apk
2. Before playing with the clock itís advisable to remove the circle. The easiest way to do it is to locate the files lockscreen_clock_bg.png and lockscreen_clock_bg_dark.png inside the \LGSystemUI.apk\res\drawable-xxhdpi and to edit them with Photoshop or Gimp. Just make them transparent, thatíll be enough.
3. Navigate to \LGSystemUI.apk\res\layout
4. Open the file keyguard_circular_clock_view.xml
5. Hereís what you can expect to see:
Code:
<?xml version="1.0" encoding="utf-8"?>
<com.lge.systemui.widget.ClockWidgetView android:gravity="center" android:orientation="vertical" android:id="@id/lge_clock_widget" android:focusable="true" android:layout_width="fill_parent" android:layout_height="fill_parent"
  xmlns:android="http://schemas.android.com/apk/res/android">
    <LinearLayout android:gravity="center" android:layout_gravity="center|top" android:orientation="vertical" android:id="@id/lge_keyguard_status_view_clock_bg" android:background="@drawable/lockscreen_clock_bg_dark" android:focusable="true" android:layout_width="wrap_content" android:layout_height="wrap_content">
        <com.lge.systemui.widget.ClockView android:id="@id/lge_clock_view" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_centerVertical="true">
            <com.lge.adaptive.AdaptiveTextView android:textSize="@dimen/circular_ampm_font_size" android:ellipsize="none" android:id="@id/am_pm" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="@dimen/circular_ampm_margin_top" android:singleLine="true" android:layout_centerHorizontal="true" style="@style/lockscreenDefaultClockSubtext" />
            <com.lge.adaptive.AdaptiveTextView android:textSize="@dimen/circular_clock_font_size" android:ellipsize="none" android:gravity="center" android:id="@id/lge_clock_text" android:layout_width="wrap_content" android:layout_height="@dimen/circular_clock_view_height" android:singleLine="true" android:layout_below="@id/am_pm" android:layout_centerHorizontal="true" style="@style/lockscreenDefaultClockSubtext" />
        </com.lge.systemui.widget.ClockView>
        <com.lge.systemui.widget.DateView android:layout_gravity="center" android:orientation="vertical" android:id="@id/lge_date_view" android:layout_width="wrap_content" android:layout_height="wrap_content">
            <com.lge.adaptive.AdaptiveTextView android:textSize="@dimen/circular_date_font_size" android:textStyle="bold" android:layout_gravity="center" android:id="@id/date" android:layout_width="wrap_content" android:layout_height="wrap_content" android:singleLine="true" style="@style/lockscreenDefaultClockSubtext" />
            <com.lge.adaptive.AdaptiveTextView android:textSize="@dimen/circular_date_font_size" android:textStyle="bold" android:layout_gravity="center" android:id="@id/day" android:layout_width="wrap_content" android:layout_height="wrap_content" android:singleLine="true" style="@style/lockscreenDefaultClockSubtext" />
        </com.lge.systemui.widget.DateView>
    </LinearLayout>
</com.lge.systemui.widget.ClockWidgetView>
Here you can change several things in order to suit your needs. First of all take a look at the red part Ė this is the clock itself. This is am/pm indicator Ė if you wish you can set android:visibility=ĒgoneĒ and youíll get rid of it like this:
Code:
<com.lge.adaptive.AdaptiveTextView android:textSize="@dimen/circular_ampm_font_size" android:visibility="gone" android:ellipsize="none" android:id="@id/am_pm" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="@dimen/circular_ampm_margin_top" android:singleLine="true" android:layout_centerHorizontal="true" style="@style/lockscreenDefaultClockSubtext" />
The part colored in blue is the date and weekday.

If you want to change the size of the clock and the date you have to change everywhere you see in the file android:textSize="@dimen/circular_clock_font_size" with something like android:textSize="100.0dip". afterwards itís up to you to set the size you want.
Last edited by d_ave; 1st June 2015 at 09:38 PM.
The Following 18 Users Say Thank You to d_ave For This Useful Post: [ View ]
 
 
1st June 2015, 11:30 AM |#2  
d_ave's Avatar
OP Senior Member
Thanks Meter: 138
 
More
Reserved
The Following 2 Users Say Thank You to d_ave For This Useful Post: [ View ]
1st June 2015, 11:30 AM |#3  
d_ave's Avatar
OP Senior Member
Thanks Meter: 138
 
More
One more
The Following 2 Users Say Thank You to d_ave For This Useful Post: [ View ]
1st June 2015, 12:29 PM |#4  
blackcodetech's Avatar
Senior Member
Thanks Meter: 298
 
Donate to Me
More
Reserved!
waiting....
1st June 2015, 07:43 PM |#5  
BlushMaq's Avatar
Senior Member
Flag Nasik
Thanks Meter: 43
 
More
How to remove that ugly carrier name from status bar in at&t lg g2?
1st June 2015, 09:35 PM |#6  
glfsd's Avatar
Senior Member
Thanks Meter: 658
 
Donate to Me
More
@d_ave woooow!!!
2nd June 2015, 12:14 AM |#7  
jrk190's Avatar
Senior Member
Flag McLeansville
Thanks Meter: 91
 
More
What I'm most interested in is modifying the stock ROM to look like AOSP. I love AOSP, but none have the stability and features that stock has, yet stock is... Ugly.

Sent from my LG-F350K using XDA Free mobile app
3rd June 2015, 06:49 AM |#8  
manuelmagix's Avatar
Senior Member
Thanks Meter: 420
 
Donate to Me
More
Fantastic d_ave.
3rd June 2015, 10:27 AM |#9  
HAMID308's Avatar
Senior Member
Thanks Meter: 89
 
More
I deodexed LGSystemUI.apk but when i want to Decompile that give me this error:

Decompiling "LGSystemUI.apk",
in workarea "_WorkArea1", using "apktool_2.0.0.jar"

With Tickle My Android 10.4.2.
(tinyurl.com\ticklemyandroid)

----------------

I: Using Apktool 2.0.0 on LGSystemUI.apk
I: Loading resource table...
I: Decoding Shared Library (com.lge), pkgId: 2
I: Decoding AndroidManifest.xml with resources...
I: Loading resource table from file: C:\Users\Amir-Hamid\apktool\framework\1.apk
W: Could not decode attr value, using undecoded value instead: ns=androidprv, name=primaryUserOnly,
value=0xffffffff
W: Could not decode attr value, using undecoded value instead: ns=androidprv, name=primaryUserOnly,
value=0xffffffff
W: Could not decode attr value, using undecoded value instead: ns=android, name=theme, value=0x01030
594
W: Could not decode attr value, using undecoded value instead: ns=android, name=theme, value=0x01030
5ab
W: Could not decode attr value, using undecoded value instead: ns=android, name=theme, value=0x01030
5ab
W: Could not decode attr value, using undecoded value instead: ns=android, name=theme, value=0x01030
5ab
W: Could not decode attr value, using undecoded value instead: ns=android, name=theme, value=0x01030
5ab
W: Could not decode attr value, using undecoded value instead: ns=android, name=theme, value=0x01030
5ab
W: Could not decode attr value, using undecoded value instead: ns=android, name=theme, value=0x01030
5ab
W: Could not decode attr value, using undecoded value instead: ns=androidprv, name=primaryUserOnly,
value=0xffffffff
W: Could not decode attr value, using undecoded value instead: ns=androidprv, name=primaryUserOnly,
value=0xffffffff
W: Could not decode attr value, using undecoded value instead: ns=android, name=theme, value=0x020a0
1cb
Exception in thread "main" java.lang.NullPointerException
at java.io.Writer.write(Unknown Source)
at brut.androlib.res.util.ExtMXSerializer.writeAttrib uteValue(ExtMXSerializer.java:38)
at org.xmlpull.mxp1_serializer.MXSerializer.attribute (MXSerializer.java:673)
at org.xmlpull.v1.wrapper.classic.XmlSerializerDelega te.attribute(XmlSerializerDelegate.java
:106)
at org.xmlpull.v1.wrapper.classic.StaticXmlSerializer Wrapper.writeStartTag(StaticXmlSerializ
erWrapper.java:267)
at org.xmlpull.v1.wrapper.classic.StaticXmlSerializer Wrapper.event(StaticXmlSerializerWrappe
r.java:211)
at brut.androlib.res.decoder.XmlPullStreamDecoder$1.e vent(XmlPullStreamDecoder.java:83)
at brut.androlib.res.decoder.XmlPullStreamDecoder.dec ode(XmlPullStreamDecoder.java:141)
at brut.androlib.res.decoder.XmlPullStreamDecoder.dec odeManifest(XmlPullStreamDecoder.java:1
53)
at brut.androlib.res.decoder.ResFileDecoder.decodeMan ifest(ResFileDecoder.java:134)
at brut.androlib.res.AndrolibResources.decodeManifest WithResources(AndrolibResources.java:19
9)
at brut.androlib.Androlib.decodeManifestWithResources (Androlib.java:139)
at brut.androlib.ApkDecoder.decode(ApkDecoder.java:10 2)
at brut.apktool.Main.cmdDecode(Main.java:165)
at brut.apktool.Main.main(Main.java:81)

----------------

Decompile Not Successful!

Press any key to continue . . .

any help?


Edit:I solved problem by myself.you have to copy two files framework-res.apk & lge-res.apk in same folder as LGSystemUI.apk.
Last edited by HAMID308; 3rd June 2015 at 11:07 AM.
3rd June 2015, 12:35 PM |#10  
zioriky's Avatar
Senior Member
Flag Italia
Thanks Meter: 504
 
More
Quote:
Originally Posted by HAMID308

I deodexed LGSystemUI.apk but when i want to Decompile that give me this error:

Decompiling "LGSystemUI.apk",
in workarea "_WorkArea1", using "apktool_2.0.0.jar"

With Tickle My Android 10.4.2.
(tinyurl.com\ticklemyandroid)

----------------

I: Using Apktool 2.0.0 on LGSystemUI.apk
I: Loading resource table...
I: Decoding Shared Library (com.lge), pkgId: 2
I: Decoding AndroidManifest.xml with resources...
I: Loading resource table from file: C:\Users\Amir-Hamid\apktool\framework\1.apk
W: Could not decode attr value, using undecoded value instead: ns=androidprv, name=primaryUserOnly,
value=0xffffffff
W: Could not decode attr value, using undecoded value instead: ns=androidprv, name=primaryUserOnly,
value=0xffffffff
W: Could not decode attr value, using undecoded value instead: ns=android, name=theme, value=0x01030
594
W: Could not decode attr value, using undecoded value instead: ns=android, name=theme, value=0x01030
5ab
W: Could not decode attr value, using undecoded value instead: ns=android, name=theme, value=0x01030
5ab
W: Could not decode attr value, using undecoded value instead: ns=android, name=theme, value=0x01030
5ab
W: Could not decode attr value, using undecoded value instead: ns=android, name=theme, value=0x01030
5ab
W: Could not decode attr value, using undecoded value instead: ns=android, name=theme, value=0x01030
5ab
W: Could not decode attr value, using undecoded value instead: ns=android, name=theme, value=0x01030
5ab
W: Could not decode attr value, using undecoded value instead: ns=androidprv, name=primaryUserOnly,
value=0xffffffff
W: Could not decode attr value, using undecoded value instead: ns=androidprv, name=primaryUserOnly,
value=0xffffffff
W: Could not decode attr value, using undecoded value instead: ns=android, name=theme, value=0x020a0
1cb
Exception in thread "main" java.lang.NullPointerException
at java.io.Writer.write(Unknown Source)
at brut.androlib.res.util.ExtMXSerializer.writeAttrib uteValue(ExtMXSerializer.java:38)
at org.xmlpull.mxp1_serializer.MXSerializer.attribute (MXSerializer.java:673)
at org.xmlpull.v1.wrapper.classic.XmlSerializerDelega te.attribute(XmlSerializerDelegate.java
:106)
at org.xmlpull.v1.wrapper.classic.StaticXmlSerializer Wrapper.writeStartTag(StaticXmlSerializ
erWrapper.java:267)
at org.xmlpull.v1.wrapper.classic.StaticXmlSerializer Wrapper.event(StaticXmlSerializerWrappe
r.java:211)
at brut.androlib.res.decoder.XmlPullStreamDecoder$1.e vent(XmlPullStreamDecoder.java:83)
at brut.androlib.res.decoder.XmlPullStreamDecoder.dec ode(XmlPullStreamDecoder.java:141)
at brut.androlib.res.decoder.XmlPullStreamDecoder.dec odeManifest(XmlPullStreamDecoder.java:1
53)
at brut.androlib.res.decoder.ResFileDecoder.decodeMan ifest(ResFileDecoder.java:134)
at brut.androlib.res.AndrolibResources.decodeManifest WithResources(AndrolibResources.java:19
9)
at brut.androlib.Androlib.decodeManifestWithResources (Androlib.java:139)
at brut.androlib.ApkDecoder.decode(ApkDecoder.java:10 2)
at brut.apktool.Main.cmdDecode(Main.java:165)
at brut.apktool.Main.main(Main.java:81)

----------------

Decompile Not Successful!

Press any key to continue . . .

any help?


Edit:I solved problem by myself.you have to copy two files framework-res.apk & lge-res.apk in same folder as LGSystemUI.apk.

You have installed framework-res.apk and lge-res.apk of your rom?
4th June 2015, 12:04 AM |#11  
manuelmagix's Avatar
Senior Member
Thanks Meter: 420
 
Donate to Me
More
For sui, use apktool 2.0.0. rc4.
Last edited by manuelmagix; 4th June 2015 at 12:08 AM.

Read More
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes