[Samsung Galaxy Nexus] djmcnz:
Hide Menu on Lock Screen

Here's what you need to change to hide the menu button from the lock screen, verified with the stock lock screen and WidgetLocker.

It's a little bit different depending on the ROM you're using so may need to slightly adapt the code below.

This requires that you use a custom ID for the menu button, you can not use the existing /menu ID (because that gets visibility properties using a different mechanism).

This is for NavigationBarView.smali only, I'm not going to cover the XML changes (they're available previously in this topic). However I will say this: you must keep code for a standard menu button in your XML - if you don't want two menu buttons, change the stock one to have a width (portrait) of 0 and height (landscape) to 0 or set their visibility to "gone".

First you need to add the code for the button (you may already have this of course but if it uses the id "menu" you'll need to change it):

.method public get[COLOR="Red"][B]Menub[/B][/COLOR]Button()Landroid/view/View;
.locals 2

.prologue
.[COLOR="red"][B]line 136[/B][/COLOR]
iget-object v0, p0, Lcom/android/systemui/statusbar/phone/NavigationBarView;->mCurrentView:Landroid/view/View;

const v1, [COLOR="Red"][B]0x7f0c00a1[/B][/COLOR]

invoke-virtual {v0, v1}, Landroid/view/View;->findViewById(I)Landroid/view/View;

move-result-object v0

return-object v0
.end method

The bits in red will likely be different from mine so adjust as required.

Insert this directly beneath the ".end method" for "getHomeButton".

Now, the next bit differs depending on weather you have manually added a Search button and if so, how you did it.

You need to find this:

invoke-virtual {p0}, Lcom/android/systemui/statusbar/phone/NavigationBarView;->getHomeButton()Landroid/view/View;

move-result-object v6

Then Option A:

If it has the following directly below it, then you need to change it from:

invoke-virtual {p0}, Lcom/android/systemui/statusbar/phone/NavigationBarView;->[COLOR="red"][B]getSearchButton[/B][/COLOR]()Landroid/view/View;

move-result-object v7

To this:

invoke-virtual {p0}, Lcom/android/systemui/statusbar/phone/NavigationBarView;->[COLOR="Red"][B]getMenubButton[/B][/COLOR]()Landroid/view/View;

move-result-object v7

And that's all. The search button does not need this method to hide, the menu button does so all you're doing is redirecting that function to manage the (new) menu button.
​

Alternativly Option B:

If it does not have the following directly below it, then you need to add this:

invoke-virtual {p0}, Lcom/android/systemui/statusbar/phone/NavigationBarView;->[COLOR="red"][B][COLOR="red"][B]getMenubButton[/B][/COLOR][/B][/COLOR]()Landroid/view/View;

move-result-object v7

Change the bit in red to suit.

Now, you also need to find this:

invoke-virtual {p0}, Lcom/android/systemui/statusbar/phone/NavigationBarView;->getHomeButton()Landroid/view/View;

move-result-object v6

And add this to it:

invoke-virtual {p0}, Lcom/android/systemui/statusbar/phone/NavigationBarView;->[COLOR="red"][B]getMenubButton[/B][/COLOR]()Landroid/view/View;

move-result-object v7

So the end result looks like this:

invoke-virtual {p0}, Lcom/android/systemui/statusbar/phone/NavigationBarView;->getHomeButton()Landroid/view/View;

move-result-object v6

invoke-virtual {p0}, Lcom/android/systemui/statusbar/phone/NavigationBarView;->getMenubButton()Landroid/view/View;

move-result-object v7

if-eqz v1, :cond_6

In the above example I've used "v7" - you should use the number consecutively after the previous number in your smali (so if your "GetHomeButton is v5, you should use v6 for menu).

Enjoy. :)