--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FShellLockManager.h
+ * @brief This is the header file for the LockManager class.
+ *
+ * This header file contains the declarations of the %LockManager class.
+ */
+
+#ifndef _FSHELL_LOCK_MANAGER_H_
+#define _FSHELL_LOCK_MANAGER_H_
+
+#include <unique_ptr.h>
+#include <FBaseObject.h>
+
+namespace Tizen { namespace Shell {
+
+/**
+ * @class LockManager
+ * @brief Manages state of lock screen.
+ *
+ * @since 2.1
+ *
+ * @final This class is not intended for extension.
+ *
+ * The %LockManager class manages information of lock screen.
+ */
+class _OSP_EXPORT_ LockManager
+ : public Tizen::Base::Object
+{
+public:
+ /**
+ * Gets the %LockManager instance.
+ *
+ * @since 2.1
+ *
+ * @return A pointer to the %LockManager instance, @n
+ * else @c null if it fails
+ *
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_OUT_OF_MEMORY The memory is insufficient.
+ * @exception E_SYSTEM The method cannot proceed due to a severe system error.
+ * @remarks The specific error code can be accessed using the GetLastResult() method.
+ */
+ static LockManager* GetInstance(void);
+
+ /**
+ * Checks whether the screen is locked.
+ *
+ * @since 2.1
+ *
+ * @return @c true if the screen is locked,
+ * else @c false
+ */
+ bool IsLocked(void) const;
+
+ /**
+ * Checks whether password lock screen is enabled by Settings.
+ *
+ * @since 2.1
+ *
+ * @return @c true if password lock screen is enabled,
+ * else @c false
+ */
+ bool IsSecureMode(void) const;
+
+ /**
+ * Unlocks current lock screen.
+
+ * @privlevel partner
+ * @privilege http://tizen.org/privilege/lockmanager
+ *
+ * @since 2.1
+ *
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @exception E_INVALID_OPERATION Can't unlock, because secure mode is enabled.
+ * @exception E_SYSTEM The method cannot proceed due to a severe system error.
+ *
+ * @remark This API call has no effect while secure mode is enabled.
+ */
+ result Unlock(void);
+
+private:
+ //
+ // This default constructor is intentionally declared as private to implement the %Singleton semantic.
+ //
+ // @since 2.1
+ //
+ LockManager(void);
+
+ //
+ // This destructor is intentionally declared as private to implement the %Singleton semantic.
+ //
+ // @since 2.1
+ //
+ virtual ~LockManager(void);
+
+ //
+ // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
+ //
+ // @since 2.1
+ //
+ LockManager(const LockManager& rhs);
+
+ //
+ // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
+ //
+ // @since 2.1
+ //
+ LockManager& operator =(const LockManager& rhs);
+
+ //
+ // Constructs the instance of this class.
+ //
+ // @since 2.1
+ //
+ // @return An error code
+ // @exception E_SUCCESS The method is successful.
+ // @exception E_SYSTEM The method cannot proceed due to a severe system error.
+ //
+ result Construct(void);
+
+ static void InitSingleton(void);\r
+ static void DestroySingleton(void);
+
+private:
+
+ static LockManager* __pTheInstance;\r
+ friend struct std::default_delete< LockManager >;
+ class _LockManagerImpl* __pLockManagerImpl;
+};
+
+}} // Tizen::Shell
+#endif /* _FSHELL_LOCK_MANAGER_H_ */
BuildRequires: pkgconfig(osp-image-core)
BuildRequires: pkgconfig(osp-media)
BuildRequires: pkgconfig(osp-net)
+BuildRequires: pkgconfig(vconf)
BuildRequires: osp-image-core-internal-devel
BuildRequires: osp-appfw-internal-devel
BuildRequires: osp-uifw-internal-devel
FShell_NotificationRequestImpl.cpp
FShell_NotificationManagerProxy.cpp
FShell_NotificationManagerIpcMessages.cpp
+# FShellShortcutManager.cpp
FShellHomeManager.cpp
+ FShellLockManager.cpp
+ FShell_LockManagerImpl.cpp
)
## Definitions
## SET LINKER FLAGS
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined -Wl,--as-needed")
+TARGET_LINK_LIBRARIES(${this_target} "-lpthread" )
TARGET_LINK_LIBRARIES(${this_target} "-lchromium" )
TARGET_LINK_LIBRARIES(${this_target} "-L/usr/lib/osp -losp-appfw" )
TARGET_LINK_LIBRARIES(${this_target} "-lcapi-appfw-application" )
TARGET_LINK_LIBRARIES(${this_target} "-leina" )
TARGET_LINK_LIBRARIES(${this_target} "-lecore_evas" )
TARGET_LINK_LIBRARIES(${this_target} "-lshortcut" )
+TARGET_LINK_LIBRARIES(${this_target} "-lvconf" )
SET_TARGET_PROPERTIES(${this_target}
PROPERTIES
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FShellLiveboxManager.cpp
+ * @brief This is the implementation for the LockManager class.
+ */
+
+#include <cstdlib>
+//#include <pthread.h>
+#include <unique_ptr.h>
+
+#include <FBaseLog.h>
+#include <FBaseSysLog.h>
+#include <FShellLockManager.h>
+#include <FShell_LockManagerImpl.h>
+
+namespace Tizen { namespace Shell {
+
+LockManager* LockManager::__pTheInstance = null;
+
+LockManager::LockManager()
+ :__pLockManagerImpl(null)
+{
+}
+
+LockManager::~LockManager()
+{
+}
+
+void
+LockManager::InitSingleton(void)
+{
+ SysLog(NID_APP, "Enter.");
+
+ std::unique_ptr<LockManager> pInst(new (std::nothrow) LockManager());
+ SysTryReturnVoidResult(NID_APP, pInst, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ result r = pInst->Construct();
+ SysTryReturnVoidResult(NID_APP, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ __pTheInstance = pInst.release();
+ std::atexit(DestroySingleton);
+
+ SysLog(NID_APP, "Exit.");
+}
+
+void
+LockManager::DestroySingleton(void)
+{
+ delete __pTheInstance;
+}
+
+LockManager*
+LockManager::GetInstance(void)
+{
+ static pthread_once_t onceBlock = PTHREAD_ONCE_INIT;
+ if (__pTheInstance == null)
+ {
+ SysLog(NID_APP, "Enter.");
+ ClearLastResult();
+ pthread_once(&onceBlock, InitSingleton);
+ result r = GetLastResult();
+ if (IsFailed(r))
+ {
+ onceBlock = PTHREAD_ONCE_INIT;
+ }
+ SysLog(NID_APP, "Exit.");
+ }
+ return __pTheInstance;
+}
+
+result
+LockManager::Construct(void)
+{
+ SysAssert(__pLockManagerImpl == null);
+
+ __pLockManagerImpl = _LockManagerImpl::GetInstance();
+
+ SysAssertf(__pLockManagerImpl, "Failed to construct _LockManagerImpl!!");
+ SysLog(NID_APP, "Successed.");
+ return E_SUCCESS;
+}
+
+bool
+LockManager::IsLocked(void) const
+{
+ return __pLockManagerImpl->IsLocked();
+}
+
+bool
+LockManager::IsSecureMode(void) const
+{
+ return __pLockManagerImpl->IsSecureMode();
+}
+
+result
+LockManager::Unlock(void)
+{
+ return __pLockManagerImpl->Unlock();
+}
+
+
+}} // Tizen::Shell
--- /dev/null
+/*
+ * FShell_LockManagerImpl.cpp
+ *
+ * Created on: Feb 15, 2013
+ * Author: jungmin76park
+ */
+
+#include <vconf.h>
+#include <FBaseLog.h>
+#include <FBaseSysLog.h>
+#include <FShell_LockManagerImpl.h>
+
+namespace Tizen { namespace Shell {
+
+#define VCONFKEY_IDLE_LOCK_STATE "memory/idle_lock/state"
+#define VCONFKEY_SETAPPL_PREFIX "db/setting"
+#define VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT VCONFKEY_SETAPPL_PREFIX"/screen_lock_type"
+
+enum
+{
+ VCONFKEY_IDLE_UNLOCK = 0x00,
+ VCONFKEY_IDLE_LOCK
+};
+
+enum
+{
+ SETTING_SCREEN_LOCK_TYPE_SWIPE = 0,
+ SETTING_SCREEN_LOCK_TYPE_MOTION,
+ SETTING_SCREEN_LOCK_TYPE_FACE_AND_VOICE,
+ SETTING_SCREEN_LOCK_TYPE_SIMPLE_PASSWORD,
+ SETTING_SCREEN_LOCK_TYPE_PASSWORD,
+ SETTING_SCREEN_LOCK_TYPE_OTHER,
+ SETTING_SCREEN_LOCK_TYPE_MAX
+};
+
+
+
+
+_LockManagerImpl::_LockManagerImpl()
+{
+}
+
+_LockManagerImpl::~_LockManagerImpl()
+{
+}
+
+_LockManagerImpl*
+_LockManagerImpl::GetInstance()
+{
+ static _LockManagerImpl* pLockManagerImpl = null;
+ if( pLockManagerImpl == null )
+ {
+ pLockManagerImpl = new (std::nothrow) _LockManagerImpl();
+ }
+
+ return pLockManagerImpl;
+}
+
+bool
+_LockManagerImpl::IsLocked(void) const
+{
+ int idleLockState = 0;
+ vconf_get_int(VCONFKEY_IDLE_LOCK_STATE, &idleLockState);
+ return (idleLockState == VCONFKEY_IDLE_LOCK);
+}
+
+bool
+_LockManagerImpl::IsSecureMode(void) const
+{
+ int screenLockType = 0;
+ vconf_get_int(VCONFKEY_IDLE_LOCK_STATE, &screenLockType);
+
+ switch(screenLockType)
+ {
+ case SETTING_SCREEN_LOCK_TYPE_SWIPE:
+ case SETTING_SCREEN_LOCK_TYPE_MOTION:
+ return false;
+
+ case SETTING_SCREEN_LOCK_TYPE_FACE_AND_VOICE:
+ case SETTING_SCREEN_LOCK_TYPE_SIMPLE_PASSWORD:
+ case SETTING_SCREEN_LOCK_TYPE_PASSWORD:
+ case SETTING_SCREEN_LOCK_TYPE_OTHER:
+ return true;
+
+ default:
+ SysAssert(false);
+ }
+
+ return false;
+}
+
+result
+_LockManagerImpl::Unlock(void)
+{
+ if( IsLocked() == false )
+ {
+ return E_SUCCESS;
+ }
+
+// SysTryReturnResult(NID_APP, !IsSecureMode(), E_INVALID_OPERATION, "Secured lock screen can't be unlocked.");
+
+ int errorCode = -1;
+ errorCode = vconf_set_int(VCONFKEY_IDLE_LOCK_STATE, VCONFKEY_IDLE_UNLOCK);
+ SysTryReturnResult(NID_SYS, errorCode == 0, E_SYSTEM, "Failed to set on VCONFKEY_REGIONFORMAT_TIME1224 vconf");
+
+ return E_SUCCESS;
+}
+
+
+}} // Tizen::Shell
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FShell_LockManagerImpl.h
+ * @brief This is the header file for the _LockManagerImpl class.
+ *
+ * This header file contains the declarations of the %_LockManagerImpl class.
+ */
+
+#ifndef _FSHELL_INTERNAL_LOCK_MANAGER_IMPL_H_
+#define _FSHELL_INTERNAL_LOCK_MANAGER_IMPL_H_
+
+#include <FBaseObject.h>
+
+namespace Tizen { namespace Shell {
+
+/**
+ * @class _LockManagerImpl
+ * @brief Manages state of lock screen.
+ *
+ * @since 2.1
+ *
+ * @final This class is not intended for extension.
+ *
+ * The %_LockManagerImpl class manages information of lock screen.
+ */
+class _OSP_EXPORT_ _LockManagerImpl
+ : public Tizen::Base::Object
+{
+public:
+ /**
+ * Gets the %_LockManagerImpl instance.
+ *
+ * @since 2.1
+ *
+ * @return A pointer to the %_LockManagerImpl instance, @n
+ * else @c null if it fails
+ *
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_OUT_OF_MEMORY The memory is insufficient.
+ * @exception E_SYSTEM The method cannot proceed due to a severe system error.
+ * @remarks The specific error code can be accessed using the GetLastResult() method.
+ */
+ static _LockManagerImpl* GetInstance(void);
+
+ /**
+ * Checks whether the screen is locked.
+ *
+ * @since 2.1
+ *
+ * @return @c true if the screen is locked,
+ * else @c false
+ */
+ bool IsLocked(void) const;
+
+ /**
+ * Checks whether password lock screen is enabled by Settings.
+ *
+ * @since 2.1
+ *
+ * @return @c true if password lock screen is enabled,
+ * else @c false
+ */
+ bool IsSecureMode(void) const;
+
+ /**
+ * Unlocks current lock screen.
+
+ * @privlevel partner
+ * @privilege http://tizen.org/privilege/lockmanager
+ *
+ * @since 2.1
+ *
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @exception E_INVALID_OPERATION Can't unlock, because secure mode is enabled.
+ * @exception E_SYSTEM The method cannot proceed due to a severe system error.
+ *
+ * @remark This API call has no effect while secure mode is enabled.
+ */
+ result Unlock(void);
+
+private:
+ //
+ // This default constructor is intentionally declared as private to implement the %Singleton semantic.
+ //
+ // @since 2.1
+ //
+ _LockManagerImpl(void);
+
+ //
+ // This destructor is intentionally declared as private to implement the %Singleton semantic.
+ //
+ // @since 2.1
+ //
+ virtual ~_LockManagerImpl(void);
+
+ //
+ // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
+ //
+ // @since 2.1
+ //
+ _LockManagerImpl(const _LockManagerImpl& rhs);
+
+ //
+ // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
+ //
+ // @since 2.1
+ //
+ _LockManagerImpl& operator =(const _LockManagerImpl& rhs);
+
+ //
+ // Constructs the instance of this class.
+ //
+ // @since 2.1
+ //
+ // @return An error code
+ // @exception E_SUCCESS The method is successful.
+ // @exception E_SYSTEM The method cannot proceed due to a severe system error.
+ //
+ result Construct(void);
+};
+
+}} // Tizen::Shell
+
+#endif /* _FSHELL_INTERNAL_LOCK_MANAGER_IMPL_H_ */