[Galaxy 3 Themes and Apps] Jason-EX:
Swipe-to-remove Notification for Froyo​

Well I finally figure it all out. It looks simple, but it took me nearly two months to finish this. This should work in other Froyo phones as well. ;)

Disclaimer: I take no responsibility whatsoever. This is based on stock XXJPS framework, but it should also work with others.

To developers and themers, you are free to use this in your ROM, but please post a link to this thread and give proper credits to me and hansip87.

Credits/Thanks:

Big thanks to hansip87 for the original guide and for helping me.

Big thanks to marcellusbe for porting CM6. Can't make this without those codes.

Thanks to Arjav23 and kyrillos13 for some help.

a. Decompile "framework-res.apk"

b. Download "swipe-framework-res.zip" and extract those two files to "/res/anim/"

c. Open "/res/layout/status_bar_latest_event.xml"

Now change the "<LinearLayout" to "<com.android.server.status.LatestItemContainer" like this:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="65.0sp"
xmlns:android="http://schemas.android.com/apk/res/android">
<com.android.server.status.LatestItemView android:id="@id/content" android:background="@drawable/status_bar_item_background" android:paddingRight="6.0sp" android:focusable="true" android:clickable="true" android:layout_width="fill_parent" android:layout_height="64.0sp" />
<View android:background="@drawable/divider_horizontal_bright" android:layout_width="fill_parent" android:layout_height="1.0sp" />
</LinearLayout>

to this:

<?xml version="1.0" encoding="utf-8"?>
<[B]com.android.server.status.LatestItemContainer [/B]android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="65.0sp"
xmlns:android="http://schemas.android.com/apk/res/android">
<com.android.server.status.LatestItemView android:id="@id/content" android:background="@drawable/status_bar_item_background" android:paddingRight="6.0sp" android:focusable="true" android:clickable="true" android:layout_width="fill_parent" android:layout_height="64.0sp" />
<View android:background="@drawable/divider_horizontal_bright" android:layout_width="fill_parent" android:layout_height="1.0sp" />
</[B]com.android.server.status.LatestItemContainer[/B]>

d. Now the IDs for "slide_out_left_basic.xml" and "slide_out_right_basic.xml", so basically, compile it and then decompile it again.

e. Open "/res/value/public.xml" in Notepad++ and you should get something like this:

<public type="anim" name="slide_out_left_basic" id="[B]0x010a0048[/B]" />
<public type="anim" name="slide_out_right_basic" id="[B]0x010a0049[/B]" />

You may have a different ID depending on the ROM you're using, so just keep a note of it.

a. Decompile "services.jar"

b. Download "swipe-services.zip" and extract all three files to "/out/com/android/server/status/"

(If you already have the JB mods installed, then change "StatusBarService$41.smali" to "StatusBarService$42.smali".)

c. Open "LatestItemContainer$1.smali" and find this line:

.line 47
const v1,[B] 0x10a0049[/B]

(This code refers to the "slide_out_right_basic.xml" ID, so if you have a different one, just change it)

And this line:

.line 49
:cond_3c
const v1, [B]0x10a0048[/B]

(This one refers to the "slide_out_left_basic.xml" ID, so if you have a different one, just change it)

Save and close.

d. Open "/out/com/android/server/status/StatusBarService.smali"

Find this line:

invoke-virtual {v0, v1, v2, v3}, Landroid/view/LayoutInflater;->inflate(ILandroid/view/ViewGroup;Z)Landroid/view/View;

and below "move-result-object v17", remove these following line:

.line 1346
.local v17, row:Landroid/view/View;

then paste these lines:

[B] check-cast v17, Lcom/android/server/status/LatestItemContainer;

.line 1346
.local v17, row:Lcom/android/server/status/LatestItemContainer;
iget-boolean v4, v15, Lcom/android/server/status/NotificationData;->clearable:Z

if-eqz v4, :cond_ae

.line 1600
new-instance v4, Lcom/android/server/status/StatusBarService$41;

move-object v0, v4

move-object/from16 v1, p0

move-object v2, v15

invoke-direct {v0, v1, v2}, Lcom/android/server/status/StatusBarService$41;-><init>(Lcom/android/server/status/StatusBarService;Lcom/android/server/status/NotificationData;)V

move-object/from16 v0, v17

move-object v1, v4

invoke-virtual {v0, v1}, Lcom/android/server/status/LatestItemContainer;->setOnSwipeCallback(Ljava/lang/Runnable;)V

.line 1606
:cond_ae[/B]
const v4, 0x1020002

move-object/from16 v0, v17

move v1, v4

[B]invoke-virtual {v0, v1}, Lcom/android/server/status/LatestItemContainer;->findViewById(I)Landroid/view/View;[/B]

(remember, "StatusBarService$41")

Find this line:

invoke-virtual {v0, v1}, Landroid/view/View;->setDrawingCacheEnabled(Z)V

change to:

invoke-virtual {v0, v1}, Lcom/android/server/status/LatestItemContainer;->setDrawingCacheEnabled(Z)V

e. Open "/out/com/android/server/status/StatusBarService$NotificationCallbacks.smali" and add this code above "onNotificationClick"

.method public abstract onNotificationClear(Ljava/lang/String;Ljava/lang/String;I)V
.end method

f. Open "/out/com/android/server/NotificationManagerService$1.smali" and also add these codes above "onNotificationClick"

.method public onNotificationClear(Ljava/lang/String;Ljava/lang/String;I)V
.registers 10
.parameter "pkg"
.parameter "tag"
.parameter "id"

.prologue
.line 346
iget-object v0, p0, Lcom/android/server/NotificationManagerService$1;->this$0:Lcom/android/server/NotificationManagerService;

const/4 v4, 0x0

const/16 v5, 0x40

move-object v1, p1

move-object v2, p2

move v3, p3

#calls: Lcom/android/server/NotificationManagerService;->cancelNotification(Ljava/lang/String;Ljava/lang/String;III)V
invoke-static/range {v0 .. v5}, Lcom/android/server/NotificationManagerService;->access$500(Lcom/android/server/NotificationManagerService;Ljava/lang/String;Ljava/lang/String;III)V

.line 347
return-void
.end method

g. Save everything, compile, and you're finished ;)

​

NOTE (if you have JB mod installed): Tricky part is the smali numbering. You can't only change the file number, you also need to change the codes inside StatusBarService.smali to refer to it. Remember, $41 to $42. DO NOT GET BOTH MIXED UP!