5,604,730 Members 33,291 Now Online
XDA Developers Android and Mobile Development Forum

[GUIDE] How to Add Clear All Recents Button on Stock KitKat Android [13-02-2014]

Tip us?
 
ivn888
Old
(Last edited by ivn888; 13th February 2014 at 09:11 PM.)
#1  
ivn888's Avatar
Senior Member - OP
Thanks Meter 845
Posts: 289
Join Date: Oct 2012
Location: NaN - Somewhere in Time

 
DONATE TO ME
Default [GUIDE] How to Add Clear All Recents Button on Stock KitKat Android [13-02-2014]




Quote:
We need:

Resources:

A notepad: e.g. Notepad++

APKTOOL
Simple Guide to use

SystemUI.apk

+ = Add or Replace

- = Remove or to be removed


DECOMPILE THE SystemUI.apk!


FIRST: ADD RESOURCES (.png and xml) but not smalis!!! we will add later!!!

Quote:
+ ic_recents_clear.xml -----> SystemUI\res\drawable

+ ic_recents_clear_normal.png|ic_recents_clear_press ed.png -----> SystemUI\res\drawable-xxhdpi


Quote:
SystemUI/res/layout/status_bar_recent_panel.xml
Code:
            <LinearLayout android:orientation="vertical" android:id="@id/recents_linear_layout" android:fitsSystemWindows="true" android:clipChildren="false" android:clipToPadding="false" android:layout_width="fill_parent" android:layout_height="wrap_content" />
        </com.android.systemui.recent.RecentsVerticalScrollView>
+      <ImageView android:layout_gravity="top|right|center" android:id="@id/recents_clear" android:clickable="true" android:layout_width="50.0dip" android:layout_height="50.0dip" android:src="@drawable/ic_recents_clear" android:scaleType="center" />
    </FrameLayout>

Quote:
SystemUI/res/layout-land/status_bar_recent_panel.xml
Code:
            <LinearLayout android:layout_gravity="left" android:orientation="horizontal" android:id="@id/recents_linear_layout" android:fitsSystemWindows="true" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layoutDirection="ltr" />
        </com.android.systemui.recent.RecentsHorizontalScrollView>
+	<ImageView android:layout_gravity="top|right|center" android:id="@id/recents_clear" android:clickable="true" android:layout_width="50.0dip" android:layout_height="50.0dip" android:src="@drawable/ic_recents_clear" android:scaleType="center" />
    </FrameLayout>

Quote:
SystemUI\res\values\ids.xml
Code:
+ <item type="id" name="recents_clear">false</item>




Quote:
SystemUI/smali/com/android/systemui/recent/RecentsHorizontalScrollView.smali


Code:
<-------------------------------SEARCH FOR IT -------------------------->	
    invoke-super {p0, p1}, Landroid/widget/HorizontalScrollView;->onTouchEvent(Landroid/view/MotionEvent;)Z

    move-result v0

    if-eqz v0, :cond_1

    :cond_0
    const/4 v0, 0x1

:goto_0
    return v0

    :cond_1
    const/4 v0, 0x0

    goto :goto_0
.end method

.method public removeAllViewsInLayout()V
    .locals 8

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

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

    move-result v1

    .line 185
    .local v1, count:I
    invoke-virtual {p0}, Lcom/android/systemui/recent/RecentsHorizontalScrollView;->getScrollX()I

    move-result v4

    .line 187
    .local v4, scrollX:I
    const/4 v3, 0x0

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

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

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

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

    move-result-object v0

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

    move-result v5

    if-le v5, v4, :cond_0

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

    .line 192
    :cond_0
    new-instance v5, Lcom/android/systemui/recent/RecentsHorizontalScrollView$6;

    invoke-direct {v5, p0, v0}, Lcom/android/systemui/recent/RecentsHorizontalScrollView$6;-><init>(Lcom/android/systemui/recent/RecentsHorizontalScrollView;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/RecentsHorizontalScrollView;->postDelayed(Ljava/lang/Runnable;J)Z

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

    goto :goto_0

    .line 195
    .end local v0           #child:Landroid/view/View;
    :cond_1
    return-void
.end method

<-------------------------------SEARCH FOR IT -------------------------->
.method public removeViewInLayout(Landroid/view/View;)V
    .locals 0
    .parameter "view"

    .prologue
    .line 177
    invoke-virtual {p0, p1}, Lcom/android/systemui/recent/RecentsHorizontalScrollView;->dismissChild(Landroid/view/View;)V




Quote:
/SystemUI/smali/com/android/systemui/recent/RecentsVerticalScrollView.smali
Code:
<-------------------------------SEARCH FOR IT -------------------------->	
    invoke-super {p0, p1}, Landroid/widget/ScrollView;->onTouchEvent(Landroid/view/MotionEvent;)Z

    move-result v0

    if-eqz v0, :cond_1

    :cond_0
    const/4 v0, 0x1

    :goto_0
    return v0

    :cond_1
    const/4 v0, 0x0

    goto :goto_0
.end method

.method public removeAllViewsInLayout()V
    .locals 8

    .prologue
    .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
    :goto_0
    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
    :cond_0
    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;
    :cond_1
    return-void
.end method

<-------------------------------SEARCH FOR IT -------------------------->
.method public removeViewInLayout(Landroid/view/View;)V
    .locals 0
    .parameter "view"

    .prologue
    .line 185


Quote:
SystemUI/smali/com/android/systemui/recent/RecentsPanelView.smali

Code:
  .field private mCallUiHiddenBeforeNextReload:Z

+ .field private mClearRecents:Landroid/widget/ImageView;

  .field private mFitThumbnailToXY:Z



Quote:
SEARCH FOR
Code:
 .method private showImpl(Z)V
Quote:
Replace with:
Code:
.method private showImpl(Z)V
    .locals 9
    .parameter "show"

    .prologue
    const/16 v7, 0x8

    const/4 v5, 0x0

    const/4 v4, 0x1

    .line 337
    iget-object v6, p0, Lcom/android/systemui/recent/RecentsPanelView;->mContext:Landroid/content/Context;

    const-string v8, "recentapps"

    invoke-static {v6, v8}, Lcom/android/systemui/recent/RecentsPanelView;->sendCloseSystemWindows(Landroid/content/Context;Ljava/lang/String;)V

    .line 339
    iput-boolean p1, p0, Lcom/android/systemui/recent/RecentsPanelView;->mShowing:Z

    .line 341
    if-eqz p1, :cond_6

    .line 343
    iget-object v6, p0, Lcom/android/systemui/recent/RecentsPanelView;->mRecentTaskDescriptions:Ljava/util/ArrayList;

    if-eqz v6, :cond_2

    iget-object v6, p0, Lcom/android/systemui/recent/RecentsPanelView;->mRecentTaskDescriptions:Ljava/util/ArrayList;

    invoke-virtual {v6}, Ljava/util/ArrayList;->size()I

    move-result v6

    if-nez v6, :cond_2

    move v2, v4

    .line 345
    .local v2, noApps:Z
    :goto_0
    iget-object v6, p0, Lcom/android/systemui/recent/RecentsPanelView;->mRecentsNoApps:Landroid/view/View;

    const/high16 v8, 0x3f80

    invoke-virtual {v6, v8}, Landroid/view/View;->setAlpha(F)V

    .line 346
    iget-object v8, p0, Lcom/android/systemui/recent/RecentsPanelView;->mRecentsNoApps:Landroid/view/View;

    if-eqz v2, :cond_3

    move v6, v5

    :goto_1
    invoke-virtual {v8, v6}, Landroid/view/View;->setVisibility(I)V

    .line 348
    iget-object v6, p0, Lcom/android/systemui/recent/RecentsPanelView;->mContext:Landroid/content/Context;

    invoke-virtual {v6}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v6

    const-string v8, "clear_recents_button"

    invoke-static {v6, v8, v4}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I

    move-result v6

    if-ne v6, v4, :cond_4

    move v3, v4

    .line 350
    .local v3, showClearAllButton:Z
    :goto_2
    if-eqz v3, :cond_5

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

    if-eqz v2, :cond_0

    move v5, v7

    :cond_0
    invoke-virtual {v6, v5}, Landroid/widget/ImageView;->setVisibility(I)V

    .line 352
    iget-object v5, p0, Lcom/android/systemui/recent/RecentsPanelView;->mContext:Landroid/content/Context;

    invoke-virtual {v5}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v5

    const-string v6, "clear_recents_button_location"

    const/4 v7, 0x2

    invoke-static {v5, v6, v7}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I

    move-result v0

    .line 353
    .local v0, clearAllButtonLocation:I
    iget-object v5, p0, Lcom/android/systemui/recent/RecentsPanelView;->mClearRecents:Landroid/widget/ImageView;

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

    move-result-object v1

    check-cast v1, Landroid/widget/FrameLayout$LayoutParams;

    .line 354
    .local v1, layoutParams:Landroid/widget/FrameLayout$LayoutParams;
    packed-switch v0, :pswitch_data_0

    .line 366
    :pswitch_0
    const/16 v5, 0x53

    iput v5, v1, Landroid/widget/FrameLayout$LayoutParams;->gravity:I

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

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

    .line 374
    .end local v0           #clearAllButtonLocation:I
    .end local v1           #layoutParams:Landroid/widget/FrameLayout$LayoutParams;
    :goto_4
    const/4 v5, 0x0

    invoke-virtual {p0, v5}, Lcom/android/systemui/recent/RecentsPanelView;->onAnimationEnd(Landroid/animation/Animator;)V

    .line 375
    invoke-virtual {p0, v4}, Lcom/android/systemui/recent/RecentsPanelView;->setFocusable(Z)V

    .line 376
    invoke-virtual {p0, v4}, Lcom/android/systemui/recent/RecentsPanelView;->setFocusableInTouchMode(Z)V

    .line 377
    invoke-virtual {p0}, Lcom/android/systemui/recent/RecentsPanelView;->requestFocus()Z

    .line 386
    .end local v2           #noApps:Z
    .end local v3           #showClearAllButton:Z
    :cond_1
    :goto_5
    return-void

    :cond_2
    move v2, v5

    .line 343
    goto :goto_0

    .line 346
    .restart local v2       #noApps:Z
    :cond_3
    const/4 v6, 0x4

    goto :goto_1

    :cond_4
    move v3, v5

    .line 348
    goto :goto_2

    .line 356
    .restart local v0       #clearAllButtonLocation:I
    .restart local v1       #layoutParams:Landroid/widget/FrameLayout$LayoutParams;
    .restart local v3       #showClearAllButton:Z
    :pswitch_1
    const/16 v5, 0x33

    iput v5, v1, Landroid/widget/FrameLayout$LayoutParams;->gravity:I

    goto :goto_3

    .line 359
    :pswitch_2
    const/16 v5, 0x35

    iput v5, v1, Landroid/widget/FrameLayout$LayoutParams;->gravity:I

    goto :goto_3

    .line 362
    :pswitch_3
    const/16 v5, 0x55

    iput v5, v1, Landroid/widget/FrameLayout$LayoutParams;->gravity:I

    goto :goto_3

    .line 371
    .end local v0           #clearAllButtonLocation:I
    .end local v1           #layoutParams:Landroid/widget/FrameLayout$LayoutParams;
    :cond_5
    iget-object v5, p0, Lcom/android/systemui/recent/RecentsPanelView;->mClearRecents:Landroid/widget/ImageView;

    invoke-virtual {v5, v7}, Landroid/widget/ImageView;->setVisibility(I)V

    goto :goto_4

    .line 379
    .end local v2           #noApps:Z
    .end local v3           #showClearAllButton:Z
    :cond_6
    iput-boolean v5, p0, Lcom/android/systemui/recent/RecentsPanelView;->mWaitingToShow:Z

    .line 381
    iput-boolean v4, p0, Lcom/android/systemui/recent/RecentsPanelView;->mCallUiHiddenBeforeNextReload:Z

    .line 382
    iget-object v4, p0, Lcom/android/systemui/recent/RecentsPanelView;->mPopup:Landroid/widget/PopupMenu;

    if-eqz v4, :cond_1

    .line 383
    iget-object v4, p0, Lcom/android/systemui/recent/RecentsPanelView;->mPopup:Landroid/widget/PopupMenu;

    invoke-virtual {v4}, Landroid/widget/PopupMenu;->dismiss()V

    goto :goto_5

    .line 354
    :pswitch_data_0
    .packed-switch 0x0
        :pswitch_1
        :pswitch_2
        :pswitch_0
        :pswitch_3
    .end packed-switch
.end method

<------------------------------- UP TO HERE -------------------------->
.method private startApplicationDetailsActivity(Ljava/lang/String;)V
    .locals 4
    .parameter "packageName"



Code:
<-------------------------------SEARCH FOR IT -------------------------->
    .line 409
    invoke-super {p0, p1}, Landroid/view/ViewGroup;->dispatchHoverEvent(Landroid/view/MotionEvent;)Z

    move-result v2

    .line 411
    :goto_0
    return v2

    :cond_0
    const/4 v2, 0x1

    goto :goto_0
.end method

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

    .prologue
    .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;

    .line 858
    .local v0, lp:Landroid/view/ViewGroup$MarginLayoutParams;
    iget v1, p1, Landroid/graphics/Rect;->top:I

    iput v1, v0, Landroid/view/ViewGroup$MarginLayoutParams;->topMargin:I

    .line 859
    iget v1, p1, Landroid/graphics/Rect;->bottom:I

    iput v1, v0, Landroid/view/ViewGroup$MarginLayoutParams;->bottomMargin:I

    .line 860
    iget v1, p1, Landroid/graphics/Rect;->right:I

    iput v1, v0, Landroid/view/ViewGroup$MarginLayoutParams;->rightMargin:I

    .line 861
    iget v1, p1, Landroid/graphics/Rect;->left:I

    iput v1, v0, Landroid/view/ViewGroup$MarginLayoutParams;->leftMargin:I

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

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

    .line 865
    .end local v0           #lp:Landroid/view/ViewGroup$MarginLayoutParams;
    :cond_0
    invoke-super {p0, p1}, Landroid/widget/FrameLayout;->fitSystemWindows(Landroid/graphics/Rect;)Z

    move-result v1

    return v1
.end method

<-------------------------------SEARCH FOR IT -------------------------->
.method public handleLongPress(Landroid/view/View;Landroid/view/View;Landroid/view/View;)V
    .locals 4
    .parameter "selectedView"
    .parameter "anchorView"
    .parameter "thumbnailView"




Quote:
SEARCH FOR
Code:
.method protected onFinishInflate()V

Code:
<-------------------------------SEARCH FOR IT -------------------------->
   .line 448
    const v0, 0x7f07005d

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

    move-result-object v0

    iput-object v0, p0, Lcom/android/systemui/recent/RecentsPanelView;->mRecentsNoApps:Landroid/view/View;

.line 480
    const v0, 0x########

    invoke-virtual {p0, v0}, Lcom/android/systemui/recent/RecentsPanelView;->findViewById(I)Landroid/view/View;

    move-result-object v0

    check-cast v0, Landroid/widget/ImageView;

    iput-object v0, p0, Lcom/android/systemui/recent/RecentsPanelView;->mClearRecents:Landroid/widget/ImageView;

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

    if-eqz v0, :cond_0

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

    new-instance v1, Lcom/android/systemui/recent/RecentsPanelView$2;

    invoke-direct {v1, p0}, Lcom/android/systemui/recent/RecentsPanelView$2;-><init>(Lcom/android/systemui/recent/RecentsPanelView;)V

    invoke-virtual {v0, v1}, Landroid/widget/ImageView;->setOnClickListener(Landroid/view/View$OnClickListener;)V

<-------------------------------SEARCH FOR IT -------------------------->
    .line 450
    iget-object v0, p0, Lcom/android/systemui/recent/RecentsPanelView;->mRecentsScrim:Landroid/view/View;

    if-eqz v0, :cond_0

    .line 451
    invoke-static {}, Landroid/app/ActivityManager;->isHighEndGfx()Z

Quote:
NOTE:

########= add a fake ID, for example the one in .line 448 const v0, 0x7f07005d for now


NOW PAY ATTENTION

WE NEED


Code:
<public type="id" name="recents_clear" id="0x########" />
Quote:
1) Recompile the apk with the changes, preserving the signature

2) Decompile the new SystemUI that was just created

3) Open \res\values\public.xml and find and search for


Code:
<public type="id" name="recents_clear" id="0x########" />
Code:
######## = Your ID
and write down/copy/take note of the 10 digit id number (0x########)

Add to

Code:
.line 480
    const v0, 0x########
in RecentsPanelView.smali



Quote:
SystemUI/smali/com/android/systemui/recent/RecentsPanelView$RecentsScrollView.smali
Code:
  .method public abstract numItemsInOneScreenful()I
  .end method

+ .method public abstract removeAllViewsInLayout()V
+ .end method

  .method public abstract setAdapter(Lcom/android/systemui/recent/RecentsPanelView$TaskDescriptionAdapter;)V
  .end method


"FINISHED"
-----------------------------------------------------------------------





Quote:
Now it's time to fix some smali...

----> = BECOME

rename RecentsHorizontal/VerticalScrollView$#.smali

Code:
Recents(Horizontal|Vertical)ScrollView$7---->Recents(Horizontal|Vertical)ScrollView$8

Recents(Horizontal|Vertical)ScrollView$6---->Recents(Horizontal|Vertical)ScrollView$7
Quote:
AND ADD THE TWO SMALIS I PROVIDED:


Code:
+ RecentsHorizontalScrollView$6 -----> SystemUI\smali\com\android\systemui\recent

+ RecentsVerticalScrollView$6 -----> SystemUI\smali\com\android\systemui\recent


Quote:
Do some renaming also inside RecentsHorizontal/VerticalScrollView$#.smali;


Open Recents(Horizontal|Vertical)ScrollView$7 and Recents(Horizontal|Vertical)ScrollView$8 in Notepad++, and

FIND & REPLACE (respectively)
AN HINT

 


Code:
View$6 ----> View$7 (inside the smali $7 already renamed)

View$7 ----> View$8 (inside the smali $8 already renamed)


Quote:
Do the same also for some lines in
SystemUI/smali/com/android/systemui/recent/RecentsHorizontal|VerticalScrollView.smali's

Quote:
SystemUI/smali/com/android/systemui/recent/RecentsHorizontalScrollView.smali

Code:
    .line 323
-   new-instance v1, Lcom/android/systemui/recent/RecentsHorizontalScrollView$6;

-   invoke-direct {v1, p0}, Lcom/android/systemui/recent/RecentsHorizontalScrollView$6;-><init>(Lcom/android/systemui/recent/RecentsHorizontalScrollView;)V

    invoke-virtual {p0, v1}, Landroid/view/View;->post(Ljava/lang/Runnable;)Z
Code:
    .line 323
+   new-instance v1, Lcom/android/systemui/recent/RecentsHorizontalScrollView$7;

+   invoke-direct {v1, p0}, Lcom/android/systemui/recent/RecentsHorizontalScrollView$7;-><init>(Lcom/android/systemui/recent/RecentsHorizontalScrollView;)V

    invoke-virtual {p0, v1}, Landroid/view/View;->post(Ljava/lang/Runnable;)Z

Code:
    .line 337
    iget-object v5, p0, Lcom/android/systemui/recent/RecentsHorizontalScrollView;->mAdapter:Lcom/android/systemui/recent/RecentsPanelView$TaskDescriptionAdapter;

-   new-instance v6, Lcom/android/systemui/recent/RecentsHorizontalScrollView$7;

-   invoke-direct {v6, p0}, Lcom/android/systemui/recent/RecentsHorizontalScrollView$7;-><init>(Lcom/android/systemui/recent/RecentsHorizontalScrollView;)V
Code:
    .line 337
    iget-object v5, p0, Lcom/android/systemui/recent/RecentsHorizontalScrollView;->mAdapter:Lcom/android/systemui/recent/RecentsPanelView$TaskDescriptionAdapter;

+   new-instance v6, Lcom/android/systemui/recent/RecentsHorizontalScrollView$8;

+   invoke-direct {v6, p0}, Lcom/android/systemui/recent/RecentsHorizontalScrollView$8;-><init>(Lcom/android/systemui/recent/RecentsHorizontalScrollView;)V


Quote:
SystemUI/smali/com/android/systemui/recent/RecentsVerticalScrollView.smali




Code:
    .line 346
    iget-object v5, p0, Lcom/android/systemui/recent/RecentsVerticalScrollView;->mAdapter:Lcom/android/systemui/recent/RecentsPanelView$TaskDescriptionAdapter;

-   new-instance v6, Lcom/android/systemui/recent/RecentsVerticalScrollView$7;

-   invoke-direct {v6, p0}, Lcom/android/systemui/recent/RecentsVerticalScrollView$7;-><init>(Lcom/android/systemui/recent/RecentsVerticalScrollView;)V

Code:
    .line 346
    iget-object v5, p0, Lcom/android/systemui/recent/RecentsVerticalScrollView;->mAdapter:Lcom/android/systemui/recent/RecentsPanelView$TaskDescriptionAdapter;

+   new-instance v6, Lcom/android/systemui/recent/RecentsVerticalScrollView$8;

+   invoke-direct {v6, p0}, Lcom/android/systemui/recent/RecentsVerticalScrollView$8;-><init>(Lcom/android/systemui/recent/RecentsVerticalScrollView;)V


Code:
    .line 332
-   new-instance v1, Lcom/android/systemui/recent/RecentsVerticalScrollView$6;

-   invoke-direct {v1, p0}, Lcom/android/systemui/recent/RecentsVerticalScrollView$6;-><init>(Lcom/android/systemui/recent/RecentsVerticalScrollView;)V

Code:
    .line 332
+   new-instance v1, Lcom/android/systemui/recent/RecentsVerticalScrollView$7;

+   invoke-direct {v1, p0}, Lcom/android/systemui/recent/RecentsVerticalScrollView$7;-><init>(Lcom/android/systemui/recent/RecentsVerticalScrollView;)V


Quote:
Now it's time to fix some smali...

----> = BECOME

rename RecentsPanelView$#..smali

Code:
RecentsPanelView$3---->RecentsPanelView$4 

RecentsPanelView$2---->RecentsPanelView$3
Quote:
AND ADD THE TWO SMALI I PROVIDED:


Code:
+ RecentsPanelView$2.smali -----> SystemUI\smali\com\android\systemui\recent

Quote:
Now, Open RecentsPanelView$3 and RecentsPanelView$3 in Notepad++, and

FIND & REPLACE (respectively)
Code:
View$2 ----> View$3 (inside the smali $3 already renamed)

View$3 ----> View$4 (inside the smali $4 already renamed)

Quote:
Do the same also for some lines in
SystemUI/smali/com/android/systemui/recent/RecentsPanelView.smali

SystemUI/smali/com/android/systemui/recent/RecentsPanelView.smali


Code:
    .line 764
-   new-instance v1, Lcom/android/systemui/recent/RecentsPanelView$2;

-   invoke-direct {v1, p0, p1}, Lcom/android/systemui/recent/RecentsPanelView$2;-><init>(Lcom/android/systemui/recent/RecentsPanelView;Landroid/view/View;)V
Code:
    .line 764
+   new-instance v1, Lcom/android/systemui/recent/RecentsPanelView$3;

+   invoke-direct {v1, p0, p1}, Lcom/android/systemui/recent/RecentsPanelView$3;-><init>(Lcom/android/systemui/recent/RecentsPanelView;Landroid/view/View;)V

Code:
    .line 783
-   new-instance v1, Lcom/android/systemui/recent/RecentsPanelView$3;

-   invoke-direct {v1, p0, p3}, Lcom/android/systemui/recent/RecentsPanelView$3;-><init>(Lcom/android/systemui/recent/RecentsPanelView;Landroid/view/View;)V
Code:
    .line 783
+   new-instance v1, Lcom/android/systemui/recent/RecentsPanelView$4;

+   invoke-direct {v1, p0, p3}, Lcom/android/systemui/recent/RecentsPanelView$4;-><init>(Lcom/android/systemui/recent/RecentsPanelView;Landroid/view/View;)V



More info here: https://github.com/AOKP/frameworks_b...df2d4da53d4f15


Credits:

- @enricocid allow me to post his guide
- D4rKn3sSyS
- Roman Birg (Romanbb)

The Stuff Song (click to show)
 
The Following 2 Users Say Thank You to ivn888 For This Useful Post: [ Click to Expand ]
 
ivn888
Old
(Last edited by ivn888; 5th March 2014 at 11:19 AM.)
#2  
ivn888's Avatar
Senior Member - OP
Thanks Meter 845
Posts: 289
Join Date: Oct 2012
Location: NaN - Somewhere in Time

 
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:


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

    .prologue
    .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

Code:
.method public removeAllViewsInLayout()V
    .locals 8

    .prologue
    .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
    :goto_0
    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
    :cond_0
    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;
    :cond_1
    return-void
.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!






The Stuff Song (click to show)
 
The Following User Says Thank You to ivn888 For This Useful Post: [ Click to Expand ]
 
EnricoD
Old
#3  
EnricoD's Avatar
Recognized Contributor
Thanks Meter 3196
Posts: 1,860
Join Date: May 2013
Location: Roma
Thanks Bro for posting :P

RASTAKAT Rom /// BaNkS Minimal Gapps

RastaKat works



The Stuff Song (click to show)
 

 
ivn888
Old
#4  
ivn888's Avatar
Senior Member - OP
Thanks Meter 845
Posts: 289
Join Date: Oct 2012
Location: NaN - Somewhere in Time

 
DONATE TO ME
Added some notes about porting this mods to custom ROms in thread #2!

The Stuff Song (click to show)
 
The Following User Says Thank You to ivn888 For This Useful Post: [ Click to Expand ]
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes