Or Continue to Thread: [GUIDE] How to Add Clear All R…
Find Your Device:
13th February 2014, 09:33 PM   |  #2  
ivn888's Avatar
OP Senior Member
Flag NaN - Somewhere in Time
Thanks Meter: 859
290 posts
Join Date:Joined: Oct 2012
Donate to Me
Notes About the Mod:

- 1) Pay attention to lines numbers in methods we add when porting this mod to custom Roms!

Let's consider this method:

.method protected fitSystemWindows(Landroid/graphics/Rect;)Z
    .locals 2
    .parameter "insets"

    .line 856
    iget-object v1, p0, Lcom/android/systemui/recent/RecentsPanelView;->mClearRecents:Landroid/widget/ImageView;

    if-eqz v1, :cond_0

    .line 857
    iget-object v1, p0, Lcom/android/systemui/recent/RecentsPanelView;->mClearRecents:Landroid/widget/ImageView;

    invoke-virtual {v1}, Landroid/widget/ImageView;->getLayoutParams()Landroid/view/ViewGroup$LayoutParams;

    move-result-object v0

    check-cast v0, Landroid/view/ViewGroup$MarginLayoutParams;

   <etc etc -------->

When we add this code, we should check for that lines numbers and make sure that these are unique (use the search function on Your Notepad++) inside the smali! If Not, i.e. if You will find the same line number inside the .smali and inside another method, just change these numbers to +1 until it will be unique inside the smali (.line 858 and so on.)
Do this for al the methods You add!

2) - Pay attention to identical lines number inside the methods we add, keep it!

For example, check the line number 193

.method public removeAllViewsInLayout()V
    .locals 8

    .line 191
    iget-object v5, p0, Lcom/android/systemui/recent/RecentsVerticalScrollView;->mLinearLayout:Landroid/widget/LinearLayout;

    invoke-virtual {v5}, Landroid/widget/LinearLayout;->getChildCount()I

    move-result v1

    .line 192
    .local v1, count:I
    invoke-virtual {p0}, Lcom/android/systemui/recent/RecentsVerticalScrollView;->getScrollY()I

    move-result v4

    .line 193
    .local v4, scrollY:I
    const/4 v3, 0x0

    .local v3, i:I
    const/4 v2, 0x0

    .local v2, delayCounter:I
    if-ge v3, v1, :cond_1

    .line 194
    iget-object v5, p0, Lcom/android/systemui/recent/RecentsVerticalScrollView;->mLinearLayout:Landroid/widget/LinearLayout;

    invoke-virtual {v5, v3}, Landroid/widget/LinearLayout;->getChildAt(I)Landroid/view/View;

    move-result-object v0

    .line 195
    .local v0, child:Landroid/view/View;
    invoke-virtual {v0}, Landroid/view/View;->getBottom()I

    move-result v5

    if-le v5, v4, :cond_0

    .line 197
    add-int/lit8 v2, v2, 0x1

    .line 198
    new-instance v5, Lcom/android/systemui/recent/RecentsVerticalScrollView$6;

    invoke-direct {v5, p0, v0}, Lcom/android/systemui/recent/RecentsVerticalScrollView$6;-><init>(Lcom/android/systemui/recent/RecentsVerticalScrollView;Landroid/view/View;)V

    mul-int/lit16 v6, v2, 0x96

    int-to-long v6, v6

    invoke-virtual {p0, v5, v6, v7}, Lcom/android/systemui/recent/RecentsVerticalScrollView;->postDelayed(Ljava/lang/Runnable;J)Z

    .line 193
    add-int/lit8 v3, v3, 0x1

    goto :goto_0

    .line 207
    .end local v0           #child:Landroid/view/View;
.end method

In custom Roms we may need to change the lines numbers as previously stated to avoid conflicts with other identical lines nubers in different methods.
When we are doing these corrections we must keep identical lines numbers inside the methods we're adding!

Last edited by ivn888; 5th March 2014 at 12:19 PM.
The Following User Says Thank You to ivn888 For This Useful Post: [ View ]