Prevent multiple instantiation of ode app 44/79144/1
authorJaemin Ryu <jm77.ryu@samsung.com>
Fri, 8 Jul 2016 10:24:51 +0000 (19:24 +0900)
committerJaemin Ryu <jm77.ryu@samsung.com>
Fri, 8 Jul 2016 10:26:00 +0000 (19:26 +0900)
Change-Id: I6416e21a7331f721a119bf28611017a0c12e2b0d
Signed-off-by: Jaemin Ryu <jm77.ryu@samsung.com>
server/security.cpp

index 112c621..2d4678a 100755 (executable)
@@ -64,6 +64,11 @@ int SecurityPolicy::lockoutScreen()
 {
        try {
                Launchpad launchpad(context.getPeerUid());
+               if (launchpad.isRunning(APPID_LOCKSCREEN)) {
+                       launchpad.resume(APPID_LOCKSCREEN);
+                       return 0;
+               }
+
                launchpad.launch(APPID_LOCKSCREEN);
    } catch (runtime::Exception &e) {
                ERROR("Failed to launch lockscreen: " + APPID_LOCKSCREEN);
@@ -87,6 +92,11 @@ int SecurityPolicy::setInternalStorageEncryption(bool encrypt)
                bundle.add("viewtype", encrypt ? "ENCRYPT_DEVICE" : "DECRYPT_DEVICE");
 
                Launchpad launchpad(context.getPeerUid());
+               if (launchpad.isRunning(APPID_DEVICE_ENCRYPTION) == false) {
+                       launchpad.resume(APPID_DEVICE_ENCRYPTION);
+                       return 0;
+               }
+
                launchpad.launch(APPID_DEVICE_ENCRYPTION, bundle);
        } catch (runtime::Exception& e) {
                ERROR("Failed to start device encryption");
@@ -120,6 +130,11 @@ int SecurityPolicy::setExternalStorageEncryption(bool encrypt)
                bundle.add("viewtype", encrypt ? "ENCRYPT_SD_CARD" : "DECRYPT_SD_CARD");
 
                Launchpad launchpad(context.getPeerUid());
+               if (launchpad.isRunning(APPID_DEVICE_ENCRYPTION)) {
+                       launchpad.resume(APPID_DEVICE_ENCRYPTION);
+                       return 0;
+               }
+
                launchpad.launch(APPID_DEVICE_ENCRYPTION, bundle);
        } catch (runtime::Exception& e) {
                ERROR("Failed to start sd card encryption");