[Sony Ericsson Xperia Mini, Mini Pro, Xperia Pro, A] havocgb:
Pulling Status Bar down from the right side for Quick Panel Toggles in Serajr's SystemUI​

This was the first SystemUI mod that I did. I have refined the code a bit after that with suggestions from Serajr (Thanks bro! :good: ) This is a pretty simple edit and do-able for beginners. I will try to explain each step rather than just asking you to copy paste code.

Define a new boolean mTouchRight in PhoneStatusBar class (\SystemUI.apk\smali\com\android\systemui\statusbar\phone\PhoneStatusBar.smali) along with the other .field lines in the beginning part of this smali file.

.field private mTouchRight:Z

Now define a new method interceptOneFingerStatusBarRightTap to check if the user is touching the statusbar on its right side and make mTouchRight true if he is and false if not. All this is done only if mExpanded is zero

.method private interceptOneFingerStatusBarRightTap(Landroid/view/MotionEvent;)V
.locals 2
.parameter "event"

.prologue
iget-boolean v1, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mExpanded:Z

if-nez v1, :cond_1

invoke-virtual {p1}, Landroid/view/MotionEvent;->getRawX()F

move-result v0

const/high16 v1, 0x435c

cmpl-float v0, v0, v1

if-ltz v0, :cond_0

const/4 v1, 0x1

iput-boolean v1, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mTouchRight:Z

goto :goto_0

:cond_0
const/4 v1, 0x0

iput-boolean v1, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mTouchRight:Z

:cond_1
:goto_0
return-void
.end method

You can just add such method definitions at the end of the smali file or in between. Just dont add it within another method!

Now we need to call this method in some function that handles touch events. I will talk about how to figure this out in a later post (Hint: coding logic+Names of variables and methods+using logcat).

In this case the method that we are interested in is interceptTouchEvent.

Original

if-ge v2, v3, :cond_0

iget-boolean v2, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mExpanded:Z

if-nez v2, :cond_5

:goto_2
invoke-virtual {p0, v5, v0}, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->prepareTracking(IZ)V

Change to

if-ge v2, v3, :cond_0

iget-boolean v2, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mExpanded:Z

if-nez v2, :cond_5

:goto_2
[COLOR="Red"]invoke-direct {p0, p1}, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->interceptOneFingerStatusBarRightTap(Landroid/view/MotionEvent;)V
[/COLOR]
invoke-virtual {p0, v5, v0}, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->prepareTracking(IZ)V

Next we need to make another new method to flip To QuickPanel in case mTouchRight is true.

.method private oneFingerStatusBarRightTapFlipToQuickPanel()V
.locals 1

.prologue
iget-boolean v0, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mTouchRight:Z

if-eqz v0, :cond_0

invoke-direct {p0}, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->fastFlipToQuickPanel()V

:cond_0
return-void
.end method

Now to find out where this method needs to be called, I did the same as what I did with interceptOneFingerStatusBarRightTap (which would be explained in a later post)

I found out that if the call is added in makeExpandedVisible method, as the statusbar starts to get pulled down, the flip-to-quickpanel happens.

Original makeExpandedVisible

iput-boolean v1, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mExpandedVisible:Z

invoke-virtual {p0, v1}, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->visibilityChanged(Z)V

const/16 v0, -0x2710

invoke-virtual {p0, v0}, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->updateExpandedViewPos(I)V

Change to:

iput-boolean v1, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mExpandedVisible:Z

[COLOR="Red"]invoke-direct {p0}, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->oneFingerStatusBarRightTapFlipToQuickPanel()V[/COLOR]

invoke-virtual {p0, v1}, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->visibilityChanged(Z)V

const/16 v0, -0x2710

invoke-virtual {p0, v0}, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->updateExpandedViewPos(I)V

You can also put the call in updateExpandedViewPos method in which case the flip would happen only after the notification panel is completely open. Don't put the call for the method in both makeExpandedVisible and updateExpandedViewPos. Only one of them

Original code:

if-ne p1, v8, :cond_5

move v6, v3

.local v6, pos:I

Change to:

if-ne p1, v8, :cond_5

move v6, v3

[COLOR="Red"]invoke-direct {p0}, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->oneFingerStatusBarRightTapFlipToQuickPanel()V[/COLOR]

.local v6, pos:I