[IOT-2811][ES] Fix mediator android app crash. 41/22841/2
authorSenthil Kumar G S <senthil.gs@samsung.com>
Sat, 14 Oct 2017 13:11:53 +0000 (18:41 +0530)
committerAshok Babu Channa <ashok.channa@samsung.com>
Sun, 15 Oct 2017 19:09:18 +0000 (19:09 +0000)
Reason for crash:-
OcProvisioning.provisionClose() should be called only
when iotivity stack is built with security. But mediator android
app invoked it without checking whether the stack is built with security.

Change-Id: Ic2af9d649a4dce79d2bfd9daebc2c80b7dfaa2eb
Signed-off-by: Senthil Kumar G S <senthil.gs@samsung.com>
service/easy-setup/sampleapp/mediator/android/EasySetup/app/src/main/java/org/iotivity/service/easysetup/EasysetupActivity.java

index 3b5d2e6..d75845d 100755 (executable)
@@ -399,6 +399,13 @@ public class EasysetupActivity extends Activity
             OcProvisioning.provisionClose();
         } catch (OcException e) {
             Log.e(TAG, "provisionClose error: " + e.getMessage());
+        } catch (UnsatisfiedLinkError e) {
+            // Note : Easy setup is built with SECURED = 0, but user still selects Security feature
+            // while running the Mediator App it couldn't find "libocprovision.so".
+            // As per the programmer guide, security feature should be invoked only if build is done with SECURED = 1.
+            mSecurityMode.setChecked(false);
+            Log.e(TAG, "Easy setup is built with secured = 0, but executed with security feature");
+            return;
         }
     }