[xposed - source] LG G2 KitKat (stock) Xposed mods

Search This thread

garyd9

Inactive Recognized Developer
Sep 13, 2006
2,643
2,732
53
Pittsburgh, PA
I realize that xposed isn't quite released for the LG G2 kitkat stock firmware at the time of this post, but something being "not quite yet released" never slowed xda-developers down...

This thread is dedicated to various mods to the stock LG UI that can be done with xposed. It's only for SOURCE CODE and fragments. Please, don't upload or link any compiled projects here.

If you don't do your own development and/or don't work with xposed, this thread isn't for you.

Please don't ask for support in general xposed development here. Again, this is just a place for people to share code.
 
Last edited:

garyd9

Inactive Recognized Developer
Sep 13, 2006
2,643
2,732
53
Pittsburgh, PA
Battery icon

The xposed framework tutorials have samples for replacing the battery icon. However, you should use apktool to open up LGSystemUI.apk (priv-app) to see that there are many different versions of the battery on the G2. For example, the standard battery replacement code doesn't work on AT&T phones (D800.)

So, you might end up having to replace several resources:
Code:
		resparam.res.setReplacement("com.android.systemui", "drawable", "stat_sys_battery", modRes.fwd(R.drawable.stat_sys_battery));
		resparam.res.setReplacement("com.android.systemui", "drawable", "stat_sys_battery_atnt", modRes.fwd(R.drawable.stat_sys_battery));
		resparam.res.setReplacement("com.android.systemui", "drawable", "stat_sys_battery_charge", modRes.fwd(R.drawable.stat_sys_battery_charge));
 

garyd9

Inactive Recognized Developer
Sep 13, 2006
2,643
2,732
53
Pittsburgh, PA
Getting rid of the carrier logo (on the left side of the status bar)

Fairly simple (and there are multiple ways) For example, in the handleLoadPackage() for com.android.systemui, the following works:
Code:
findAndHookMethod("com.lge.systemui.widget.OperatorTextView", 
		lpparam.classLoader, 
		"setTextOperator", CharSequence.class,
		new XC_MethodHook() {
			@Override
			protected void afterHookedMethod(MethodHookParam param) throws Throwable {
				XposedHelpers.callMethod(param.thisObject,"setVisibility", 0x8);
			}			
		});
 

garyd9

Inactive Recognized Developer
Sep 13, 2006
2,643
2,732
53
Pittsburgh, PA
Not happy with the fact that LG shoves that soft "menu" key in your face all the time? Want to replace it with a "recent app" type softkey (that's more android and less samsung)? This one is kind of involved in order to be complete...

All of these fragments take place in the handleLoadPackage() for com.android.systemui...

First, just change the "menu" button to always be a "recent apps" button:

Code:
findAndHookMethod("com.lge.systemui.navigationbar.NavigationBarManager", 
		lpparam.classLoader, 
		"updateButtonSet", /* no params */
		new XC_MethodHook() {
			@Override
			protected void afterHookedMethod(MethodHookParam param) throws Throwable {
				String p = (String) XposedHelpers.getObjectField(param.thisObject, "mButtonSet");
				// replace "menu" with recent apps, and get rid of the recentappsdummy
				p = p.replace("Menu", "RecentApps").replace("RecentAppsDummy", "");
				XposedHelpers.setObjectField(param.thisObject, "mButtonSet", p);
			}					
		});
That's pretty easy. However, you've just lost the "menu" button which is really needed for several LG stock apps (as they don't use an overflow button.) To handle that, here's a fragment (in the same handler) that will capture any long presses of the "recents" button and send a MENU command instead. While we're at it, go ahead and disable the old-fashioned "long press home -> recents"
Code:
findAndHookMethod("com.android.systemui.statusbar.policy.KeyButtonView", 
		lpparam.classLoader, 
		"sendEvent", int.class, int.class,
		new XC_MethodReplacement() {
			@Override
			protected Object replaceHookedMethod(MethodHookParam param) throws Throwable {
				// get the mcode of the button
				final int sDUMMYKEYCODE = 0x1bb;
						
				Integer mcode = XposedHelpers.getIntField(param.thisObject, "mCode");
						
				// deal with long press events
				if ((Integer)param.args[1] == KeyEvent.FLAG_LONG_PRESS) {
							
					if (mcode == KeyEvent.KEYCODE_HOME) {
						// swallow the home long press - it should do nothing
					} else if (mcode == KeyEvent.KEYCODE_APP_SWITCH) {
						// long press of recents gives the menu
						// set this key to have the menu code..
						XposedHelpers.setIntField(param.thisObject, "mCode", KeyEvent.KEYCODE_MENU);
						// send an 'action down'
						XposedHelpers.callMethod(param.thisObject, "sendEvent", KeyEvent.ACTION_DOWN, 0, SystemClock.uptimeMillis());
						// set the mcode to a known "fake" so the action_up is handled properly
						XposedHelpers.setIntField(param.thisObject, "mCode",  sDUMMYKEYCODE); 
					} 
				} else if (mcode == sDUMMYKEYCODE) {
					// the recents key has its code set to DUMMYKEYCODE when it sends
					// an action_down to flag that this was a long press.  Now that the
					// dummykeycode has been sent again, simulate a menu action_up
					XposedHelpers.setIntField(param.thisObject, "mCode",  KeyEvent.KEYCODE_MENU);
					XposedHelpers.callMethod(param.thisObject, "sendEvent", KeyEvent.ACTION_UP, 0, SystemClock.uptimeMillis());
					XposedHelpers.setIntField(param.thisObject, "mCode",  KeyEvent.KEYCODE_APP_SWITCH);
				} else {
					// no special processing, so just pass the sendEvent along normally.
					XposedHelpers.callMethod(param.thisObject, "sendEvent", param.args[0],param.args[1], SystemClock.uptimeMillis());
				}		
				return null;
			}			
		});
 

garyd9

Inactive Recognized Developer
Sep 13, 2006
2,643
2,732
53
Pittsburgh, PA
Here's a couple of fragments that just change some resource bools to alter the UI. The first one turns off the volume slider on the notification dropdown and the second turns off the option for "quick voice" when you press/hold the home softkey. Both are in the handleInitPackageResources() for com.android.systemui:
Code:
resparam.res.setReplacement("com.android.systemui",
		"bool", 
		"config_systemui_feature_volumeslider", 
		false);

resparam.res.setReplacement("com.android.systemui",
		"bool", 
		"config_systemui_feature_qvoice", 
		false);
 

G-Bus

Senior Member
Jan 13, 2011
570
146
Montreal
Getting rid of the carrier logo (on the left side of the status bar)

Fairly simple (and there are multiple ways) For example, in the handleLoadPackage() for com.android.systemui, the following works:
Code:
findAndHookMethod("com.lge.systemui.widget.OperatorTextView", 
lpparam.classLoader, 
"setTextOperator", CharSequence.class,
new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
XposedHelpers.callMethod(param.thisObject,"setVisibility", 0x8);
}
});

Where do I find that file? I cant stand the the carrier name in the status bar.
 

zeroxia

Senior Member
Oct 28, 2011
122
19
Here's a couple of fragments that just change some resource bools to alter the UI. The first one turns off the volume slider on the notification dropdown and the second turns off the option for "quick voice" when you press/hold the home softkey. Both are in the handleInitPackageResources() for com.android.systemui:
Code:
resparam.res.setReplacement("com.android.systemui",
		"bool", 
		"config_systemui_feature_volumeslider", 
		false);

resparam.res.setReplacement("com.android.systemui",
		"bool", 
		"config_systemui_feature_qvoice", 
		false);

Why do you hate the volume slider? It's very convenient to adjust volume without grabbing the phone up to fumble with volume keys on the rear side. Well actually my complaint is none of the Xposed modules for G2 has an option to ENABLE it for Verizon VS980... :( :( :(
 

bberryhill0

Senior Member
Feb 15, 2009
593
152
Well actually my complaint is none of the Xposed modules for G2 has an option to ENABLE it for Verizon VS980... :( :( :(
I was wondering what all the talk about hiding the volume slider was about. What volume slider? Wait isn't that the brightness slider?


Swyped from my Verizon LG G2 using Tapatalk 4.4.7
 

Top Liked Posts

  • There are no posts matching your filters.
  • 18
    I realize that xposed isn't quite released for the LG G2 kitkat stock firmware at the time of this post, but something being "not quite yet released" never slowed xda-developers down...

    This thread is dedicated to various mods to the stock LG UI that can be done with xposed. It's only for SOURCE CODE and fragments. Please, don't upload or link any compiled projects here.

    If you don't do your own development and/or don't work with xposed, this thread isn't for you.

    Please don't ask for support in general xposed development here. Again, this is just a place for people to share code.
    4
    Battery icon

    The xposed framework tutorials have samples for replacing the battery icon. However, you should use apktool to open up LGSystemUI.apk (priv-app) to see that there are many different versions of the battery on the G2. For example, the standard battery replacement code doesn't work on AT&T phones (D800.)

    So, you might end up having to replace several resources:
    Code:
    		resparam.res.setReplacement("com.android.systemui", "drawable", "stat_sys_battery", modRes.fwd(R.drawable.stat_sys_battery));
    		resparam.res.setReplacement("com.android.systemui", "drawable", "stat_sys_battery_atnt", modRes.fwd(R.drawable.stat_sys_battery));
    		resparam.res.setReplacement("com.android.systemui", "drawable", "stat_sys_battery_charge", modRes.fwd(R.drawable.stat_sys_battery_charge));
    4
    Getting rid of the carrier logo (on the left side of the status bar)

    Fairly simple (and there are multiple ways) For example, in the handleLoadPackage() for com.android.systemui, the following works:
    Code:
    findAndHookMethod("com.lge.systemui.widget.OperatorTextView", 
    		lpparam.classLoader, 
    		"setTextOperator", CharSequence.class,
    		new XC_MethodHook() {
    			@Override
    			protected void afterHookedMethod(MethodHookParam param) throws Throwable {
    				XposedHelpers.callMethod(param.thisObject,"setVisibility", 0x8);
    			}			
    		});
    4
    Here's a couple of fragments that just change some resource bools to alter the UI. The first one turns off the volume slider on the notification dropdown and the second turns off the option for "quick voice" when you press/hold the home softkey. Both are in the handleInitPackageResources() for com.android.systemui:
    Code:
    resparam.res.setReplacement("com.android.systemui",
    		"bool", 
    		"config_systemui_feature_volumeslider", 
    		false);
    
    resparam.res.setReplacement("com.android.systemui",
    		"bool", 
    		"config_systemui_feature_qvoice", 
    		false);
    4
    Dude this will work on art?

    Dude, like what do think, man? Like, does xposed work with ART, dude?

    Sent from my LG-D800