Patch webOS Modifying a Stock App While Keeping the Original

From WebOS Internals
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.


Modify-stock-app.jpg


I have been able to copy a pre-existing app, rename it and keep the original in the launcher. Now able to launch either original or the modified app - both show up in the Launcher. Am also doing it from the mountable USB drive. This allows your mod apps to continue working even after the original has been updated from the App Catalog or through the Updates app.

Prerequisites

If not familiar with Linux or vi editor, see the Basic Linux Usage Guide.

Your Pre must first be rooted.

Instructions

First setup the ability to launch the app from /media/internal (the USB drive). Props to dsevil.

Edit /etc/palm/luna.conf and look for this line:

ApplicationPath=/usr/lib/luna/applications:/var/luna/applications:/var/usr/lib/luna/applications:/usr/palm/applications:/var/usr/palm/applications

and add this to end of it:

:/media/internal/applications

Execute the following command to make a new directory (if it doesn't already exist):

mkdir /media/internal/applications

Now, as an example, perform the following to copy the Amazon Store app:

cd /usr/palm/applications
cp -rp com.palm.app.amazonstore /media/internal/applications
cd /media/internal/applications/

Mark modified apps with an 'x' before the app name to distinguish it from the original. Note the 'x' before appname.

mv com.palm.app.amazonstore   com.palm.app.xamazonstore
cd *amazonstore
vi appinfo.json  

(add x in title and xApp in id)

{
        "title": "x Amazon MP3", 
        "id": "com.palm.app.xamazonstore",    
        # Keep other lines the same.
}

Could also use title "Amazon 3G" if doing the Amazon 3G mod. Can be anything as long as it's not a duplicate of another app in the launcher.

As an alternative to vi editor, if the device is connected as USB Drive you can edit the appinfo.json directly from your computer. Connecting the device as a USB Drive turns all device radios off, any SSH session will be dropped.

Using luna-send to refresh the Launcher panel

sudo luna-send -n 1 palm://com.palm.applicationManager/rescan {}

Alternatively, If you have the [[[adding-the-ipkg-repository |Optware Package Feed]]] reset Luna. When you cycle LunaSysMgr it will look like your device is rebooting but will boot a little faster.

sudo /sbin/stop LunaSysMgr
sudo /sbin/start LunaSysMgr


Your new app should appear in your app list with both the original app and one ready to be modified. Press x in the Launcher to search for the new one. Now you can mount the app copy from Windows/Mac and use Windows/Mac based tools to edit. You can even edit the .html file in main app directory with Frontpage or other HTML editor on computer. Reboot or restart Luna for changes to take effect. Do this with virtually any existing app, internal or 3rd party. If the original apps are updated through the app catalog, you can still keep your isolated mod copies working. After a major Palm webOS release, you may need to ensure the luna.conf file still has the AppPath change.

To copy any other pre-installed apps, grab them from... /usr/palm/applications (internal apps) /var/usr/palm/applications (3rd party apps)

As always, please do not distribute code to others that isn't your own. Use this information at your own risk. Warning: Beware of low level internal apps. I tried to copy the Phone app and ran into major issues with the two colliding.

Discuss

Discuss this method on Pre Central

Author

xorg

Contributors

dsevil (application path),

Demo

On the top-right is an example of the Amazon Store app, with both the original and mod versions appearing on launcher. Note the 'x' on the modified version.