[Galaxy Note 4 General] Morningstar:
Hello XDA,

The Air Command feature on the Note 4 is an excellent concept, with all sorts of potential. Unfortunately, that potential is severely crippled by Samsung's decision to hard-code the available apps, and prevent users from changing them...Until now.

This guide will show you how to change the default Air Command apps (Action Memo, Smart Select, Image Clip, and Screen Write) to whatever apps you choose. In order to do this, you must have working knowledge of how to decompile, modify, and recompile .jar and .apk files. If you do not know how to do this, stop here, and come back when you do, as I won't respond to any questions asking how to decompile/recompile in this thread.

***Before proceeding,

MAKE A BACKUP.

***

***This mod entails making modifications to your phone's framework files. Any mistakes***

***can, and almost certainly will, prevent your phone from booting properly. If you choose to ***

***proceed with this mod, you are doing so at your own risk. I am not responsible for loss of data,***

***damaged devices, sudden onset male pattern baldness and impotence, or any***

***other consequences that may arise as a result of this mod.***

***Did I mention making a backup?***​

With that out of the way, let's get to it.

1) Start by pulling services.jar from /system/framework, and decompiling it.

2) Download the attached zip file, extract it to a location of your choice, and copy the included SpenGestureManagerService$9.smali to /com/android/server/smartclip in your decompiled services.jar, overwriting the existing one.

3) Now in order to set your own apps, you will need to know the package name of the app, and the name of the activity that you want to open from that app, which, for most of you, will be the main activity. To find the package name, go to App Info or Application Manager on your phone, find your app, and look at the line underneath the app's name. This is the package name. Note that it is all lowercase; this is important. Some examples include:

com.android.chrome

com.visionobjects.calculator

com.steadfastinnovation.android.projectpapyrus

com.quoord.tapatalkxdapre.activity​

Alternatively, you can decompile the app and look at its' AndroidManifest.xml. Somewhere on the 2nd line will be

package="your.package.name"

To find the activity, you can use a launcher like Nova Launcher, long-press the home screen to add a shortcut, select 'Áctivities', go to your app's name, and then try to locate the main activity. Alternatively, you can again look at the AndroidManifest.xml from the decompiled app, and locate it that way. It's not always entirely clear which activity is the main one, so in some cases it may take some trial-and-error to locate. Again, take note of the capitalization; it is important. Some examples are:

com.google.android.apps.chrome.Main

com.visionobjects.calculator.activity.MainActivity

com.steadfastinnovation.android.projectpapyrus.application.HeadlessMainActivity

com.quoord.tapatalkxdapre.activity.MainActivity​

4) Once you have the package name and activity name of the app(s) you want to use, go ahead and open the file you just copied with Notepad++.

***Note: I have left all the original code intact, so the stock functions can still be used if you want.***

***You can change as many of the stock functions as you wish, but I have included 'blanks' for all 4.***​

5) To add your first app, search for:

CUSTOM.PACKAGE.ONE

Replace it with the package name from your app. Do not remove the enclosing parentheses, and pay attention to the capitalization.

The next line will include:

CUSTOM.ACTIVITY.ONE

Replace this with the activity name from your app. Again, be sure to keep the parentheses, and watch the capitalization.

If you are changing more than one app, repeat the last two steps. The only thing different will be the lines that you need to search for/replace. The others are:

CUSTOM.PACKAGE.TWO
CUSTOM.ACTIVITY.TWO

CUSTOM.PACKAGE.THREE
CUSTOM.ACTIVITY.THREE

CUSTOM.PACKAGE.FOUR
CUSTOM.ACTIVITY.FOUR

6) Once you have added the packages and activites you want, scroll to the very end of the file, where you will see the following array:

:pswitch_data_0
.packed-switch 0x0
:pswitch_0
:pswitch_1
:pswitch_3
:pswitch_4
:pswitch_5
:pswitch_6
:pswitch_7
:pswitch_2
.end packed-switch
.end method

Here it is again, with the functions labeled:

:pswitch_data_0
.packed-switch 0x0
:pswitch_0 ACTION MEMO
:pswitch_1
:pswitch_3 SCREEN WRITE
:pswitch_4
:pswitch_5
:pswitch_6 IMAGE CLIP
:pswitch_7
:pswitch_2 SMART SELECT
.end packed-switch
.end method

If you want to use any of the default options, take note of their numbers:

Action Memo = :pswitch_0

Smart Select = :pswitch_2

Image Clip = :pswitch_6

Screen Write = :pswitch_3

7) Each of the custom apps that you added package/activity names for has a unique number associated with it. Using the same 1-4 numbering as before, they are as follows:

CUSTOM.PACKAGE.ONE = :pswitch_ms1

CUSTOM.PACKAGE.TWO = :pswitch_ms2

CUSTOM.PACKAGE.THREE = :pswitch_ms3

CUSTOM.PACKAGE.FOUR = :pswitch_ms4

Simply take the :pswitch values of the custom apps and/or stock apps that you'd like to use, and place them in the array in any order you'd like. Be aware that changing any of the :pswitch values other than the 4 that I labeled above will have no effect.

8) After you have made your changes, recompile services.jar, push to /system/framework, set permissions, reboot, and enjoy your new, more useful Air Command!

CHANGING THE TEXT AND ICONS

​

Once you've changed the apps that your Air Command opens, you'll probably want to change the associated icons and text as well. To do so, you will need to decompile your framework-res.apk, found in /system/apps.

The default icons will be found in the /res/drawable folders in your decompiled framework-res. Their names are:

airbutton_global_icon_quickmemo
airbutton_global_icon_flashannotation
airbutton_global_icon_easyclip
airbutton_global_icon_pinmode

The text for each of the Air Command items can be found in /res/values/strings.xml. Their names are:

Action memo
Screen write
Image clip
Smart select

Note that you will most likely also have to change the same strings in /res/values-en-rUS/strings.xml to see any effect.

Once you've finsihed making your changes, recompile your framework-res.apk, push it to /system/framework, set permissions, and reboot!

That's it! I hope you enjoy!

I will do my best to answer any questions you may have, but be aware that I do not have a Note 4, so I cannot do any testing or try to replicate any issues. The following screenshot/video are taken from the same mod I did for my Note 3, but are a good representation of what this mod/guide will achieve.

[youtube]gbPJXHx-J0Q[/youtube]

Finally, I'd like to give a huge thank you to @kevinoliva113 for testing for me. Over, and over, and over. Without him this would not have been possible...