[Addon Setting App] Uninstallation from device 77/213877/2
authorhyunduk.kim <hyunduk.kim@samsung.com>
Mon, 16 Sep 2019 06:23:59 +0000 (15:23 +0900)
committerhyunduk.kim <hyunduk.kim@samsung.com>
Tue, 17 Sep 2019 05:53:57 +0000 (22:53 -0700)
 When user selects 'X' button for unistallation,
 it not only removes the addon from addon DB file
 but also unistalls the addon package from device.

 - Handle pkgid(package id) field for each installed addon
 - The pkgid is passed to wrtjs when user selects to uninstall
 - WRTjs eventually invokes package manager API to uninstall
   the addon package as you can see in [1] and [2]
 - To use the package manager API, this app needs to have
   privilege http://tizen.org/privilege/packagemanager.install
   and also be packed to wgt with platform privilege level

 [1] https://review.tizen.org/gerrit/213786
 [2] https://review.tizen.org/gerrit/213787

Change-Id: I547ea9a3aea8487a5759c1886435911819b7491c
Signed-off-by: hyunduk.kim <hyunduk.kim@samsung.com>
addon_setting_app/config.xml
addon_setting_app/src/extension_manager.js

index b04d31d..5fca78d 100755 (executable)
@@ -6,6 +6,7 @@
     <feature name="http://tizen.org/feature/screen.size.all"/>
     <icon src="icon.png"/>
     <name>WebApp Addon Settings</name>
+    <tizen:privilege name="http://tizen.org/privilege/packagemanager.install"/>
     <tizen:privilege name="http://tizen.org/privilege/internet"/>
     <tizen:privilege name="http://tizen.org/privilege/download"/>
     <tizen:privilege name="http://tizen.org/privilege/filesystem.read"/>
index 7ccd34b..d4b2658 100644 (file)
       }
       this.saveJsonDB();
 
-      ipcRenderer.send(IPC_EXTENSIONS_UNINSTALLED, extension.name);
+      ipcRenderer.send(IPC_EXTENSIONS_UNINSTALLED, extension.name, extension.pkgid);
     }
 
     /* installer - get manifest info from path */
       else
         extension.type = 'WRT';
       extension.activate = true; // activate by default
+      let arr = ext_path.split("/");
+      let index = -1;
+      for (let i in arr) {
+          if (arr[i] == 'shared') {
+              index = i - 1;
+              break;
+          }
+      }
+      extension.pkgid = arr[index];
+
       return extension;
     }