[MOD][GUIDE] Change Air Command Apps

Search This thread

Morningstar

Senior Member
Apr 2, 2006
1,390
2,531
CA
www.alliance-rom.com
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
Code:
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:
Code:
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:
Code:
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:
Code:
CUSTOM.PACKAGE.TWO
CUSTOM.ACTIVITY.TWO
Code:
CUSTOM.PACKAGE.THREE
CUSTOM.ACTIVITY.THREE
Code:
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:
Code:
    :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:
Code:
    :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:

Code:
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:

Code:
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.
screen.png


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

Attachments

  • SpenGestureManagerService$9.zip
    4.6 KB · Views: 124
  • screen.jpg
    screen.jpg
    78.6 KB · Views: 1,205
Last edited:
S

sawdoctor

Guest
Really good guide. It should work well with eteam's anyapp aircommand
 

CasTTeLLo

Senior Member
Mar 27, 2011
297
196
SGN3M & SGN4M
How many apps minimum/maksimum can be add? And what happen to rounded shape if use more than 4/5?

Sent from my SM-N910C using XDA Premium 4 mobile app
 

Morningstar

Senior Member
Apr 2, 2006
1,390
2,531
CA
www.alliance-rom.com
How many apps minimum/maksimum can be add? And what happen to rounded shape if use more than 4/5?

Sent from my SM-N910C using XDA Premium 4 mobile app
The minimum would be zero, as you could just place one of the existing, nonfunctional switch numbers in every spot, but I believe the maximum is 4. I don't have a Note 4 myself to test with, but @kevinoliva113 did pretty extensive testing for me...

By default, there are 7 (or maybe it was 8 lol), things already set in the array that controls it, and all the code for them seems to basically be there, but only 4 of them actually work. Basically, it looks like Samsung left the existing code from the Note 3, and just added the Note 4 stuff on top of it, as the other items are all the ones that were on the Note 3 (quick memo, S-finder, etc.). I think you could probably put the switches for those in the working slots and have those functions working, if you wanted, but I don't know of any way to get more then 4....
 

scalleygwags

Member
Nov 22, 2014
38
10
hartford
Google Pixel
sorry to be "that guy" but im green when it comes to reverse engineering on my android, i am unclear about what to do on step 7 when you say take the values and place in array. am i suppose to search the smali for "e.g..pswitch_ms4 " and replace with app/activity name? thanks in advance
 
Last edited:

Freeddi

Senior Member
Feb 20, 2014
1,771
284
Would this work on Note 4 with Android 5.0.1 too?

Sent from my SM-N910F using XDA Free mobile app
 

AndroidState

Senior Member
Mar 17, 2013
885
378
NY
One thing I love -adding V3 calculator, But this takes so much time it isn't worth it...
Anyway, Thanks for your guide and effort! :)
 

Morningstar

Senior Member
Apr 2, 2006
1,390
2,531
CA
www.alliance-rom.com
Sorry, haven't checked back here in a while....
sorry to be "that guy" but im green when it comes to reverse engineering on my android, i am unclear about what to do on step 7 when you say take the values and place in array. am i suppose to search the smali for "e.g..pswitch_ms4 " and replace with app/activity name? thanks in advance

Go to where you placed your package/activity names earlier, and scroll up from there until you find the first place it says "pswitch". That is going to be the 'value' for the package/activity below it...Now scroll the the end of the smali file, and you should see several "pswitch" lines all together. That is the array....Replace one of the existing 'values' with the one corresponding to your package/activity.

Would this work on Note 4 with Android 5.0.1 too?
Yes, but there's a good chance that the number at the end of the filename will be different, so you'd have to figure out which one is the equivalent. Also, the existing pswitch values will likely be different. I don't have a note 4, so I can't work it out myself, but if you'd be willing to do some testing, PM me and we might be able to work something out.



One thing I love -adding V3 calculator, But this takes so much time it isn't worth it...
Anyway, Thanks for your guide and effort! :)
It does take awhile, especially the first few times you do it. When you've done it dozens of times, as i have, it's second nature, but hopefully nobody will have to lol.
 
  • Like
Reactions: AndroidState

Morningstar

Senior Member
Apr 2, 2006
1,390
2,531
CA
www.alliance-rom.com
@Morningstar
My device Note 3 N900
My spen 5 select function have but I want 4 select function (remove pen window )function
Can you help me?
Changing the number of available functions is really beyond the scope of this guide....You would have to set one of them to point to nothing, rather than a specific activity (which may in itself cause nullpointer errors), then you'd have to change the pngs for the bg in framework' adjust the spacing of the remaining icons....It would be far, far easier just to set it to some other app, even if you never use it....
 

Freeddi

Senior Member
Feb 20, 2014
1,771
284
Yes, but there's a good chance that the number at the end of the filename will be different, so you'd have to figure out which one is the equivalent. Also, the existing pswitch values will likely be different. I don't have a note 4, so I can't work it out myself, but if you'd be willing to do some testing, PM me and we might be able to work something out.

Would lovely test it myself if its working on Note 4 or not. But now i see that i have to decompile/reconpile that File. I cant decompile/recompile. Have now Knowless about this.

Sent from my SM-N910F using XDA Free mobile app
 

Top Liked Posts

  • There are no posts matching your filters.
  • 12
    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
    Code:
    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:
    Code:
    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:
    Code:
    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:
    Code:
    CUSTOM.PACKAGE.TWO
    CUSTOM.ACTIVITY.TWO
    Code:
    CUSTOM.PACKAGE.THREE
    CUSTOM.ACTIVITY.THREE
    Code:
    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:
    Code:
        :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:
    Code:
        :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:

    Code:
    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:

    Code:
    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.
    screen.png


    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...
    1
    Works great.. Finally useful shortcuts. Check it out here on the Note 4. http://youtu.be/kiXKFdCg1TM
    1
    Sorry, haven't checked back here in a while....
    sorry to be "that guy" but im green when it comes to reverse engineering on my android, i am unclear about what to do on step 7 when you say take the values and place in array. am i suppose to search the smali for "e.g..pswitch_ms4 " and replace with app/activity name? thanks in advance

    Go to where you placed your package/activity names earlier, and scroll up from there until you find the first place it says "pswitch". That is going to be the 'value' for the package/activity below it...Now scroll the the end of the smali file, and you should see several "pswitch" lines all together. That is the array....Replace one of the existing 'values' with the one corresponding to your package/activity.

    Would this work on Note 4 with Android 5.0.1 too?
    Yes, but there's a good chance that the number at the end of the filename will be different, so you'd have to figure out which one is the equivalent. Also, the existing pswitch values will likely be different. I don't have a note 4, so I can't work it out myself, but if you'd be willing to do some testing, PM me and we might be able to work something out.



    One thing I love -adding V3 calculator, But this takes so much time it isn't worth it...
    Anyway, Thanks for your guide and effort! :)
    It does take awhile, especially the first few times you do it. When you've done it dozens of times, as i have, it's second nature, but hopefully nobody will have to lol.