From 1e58de31803def873cda5d93a83ee6b44be0426e Mon Sep 17 00:00:00 2001 From: Jaemin Ryu Date: Fri, 8 Jul 2016 19:24:51 +0900 Subject: [PATCH] Prevent multiple instantiation of ode app Change-Id: I6416e21a7331f721a119bf28611017a0c12e2b0d Signed-off-by: Jaemin Ryu --- server/security.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/server/security.cpp b/server/security.cpp index 112c621..2d4678a 100755 --- a/server/security.cpp +++ b/server/security.cpp @@ -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"); -- 2.7.4