Add display related feature to disable below API in TV 91/191091/3 accepted/tizen/unified/20181012.083533 submit/tizen/20181012.024418
authorlokilee73 <changjoo.lee@samsung.com>
Thu, 11 Oct 2018 08:03:12 +0000 (17:03 +0900)
committerlokilee73 <changjoo.lee@samsung.com>
Thu, 11 Oct 2018 11:22:07 +0000 (20:22 +0900)
ex) device_power_wakeup, device_display_change_state

Change-Id: I1ac4d9d8000c5c37539975e9469bb534d1c14d3f
Signed-off-by: lokilee73 <changjoo.lee@samsung.com>
doc/device_doc.h
include/display.h
include/power.h
src/common.c
src/common.h
src/display.c
src/power.c

index 881d6508e45bb2f9812bd59b2a2e100a53d3a42a..d30459ef731024cdd72771ba81a47e9ade864f85 100755 (executable)
  * It also supports the API to set the display brightness.
  * Application can receive the display event by callback function from the system.
  *
+ * @section CAPI_SYSTEM_DEVICE_DISPLAY_MODULE__FEATURE Related Features
+ * This API is related with the following features:\n
+ * - %http://tizen.org/feature/display.state\n
+ *
+ * It is recommended to design feature related codes in your application for reliability.\n
+ *
+ * You can check if a device supports the related features for this API by using @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE, thereby controlling the procedure of your application.\n
+ *
+ * To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n
+ *
+ * More details on featuring your application can be found from <a href="https://developer.tizen.org/development/tizen-studio/native-tools/configuring-your-app/manifest-text-editor#feature"><b>Feature List</b>.</a>
+ *
  */
 
 /**
  * The Power API provides the way to control the power service.
  * It can be made to hold the specific state to avoid changing display and CPU state internally.
  *
+ * @section CAPI_SYSTEM_DEVICE_POWER_MODULE__FEATURE Related Features
+ * This API is related with the following features:\n
+ * - %http://tizen.org/feature/display.state\n
+ *
+ * It is recommended to design feature related codes in your application for reliability.\n
+ *
+ * You can check if a device supports the related features for this API by using @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE, thereby controlling the procedure of your application.\n
+ *
+ * To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n
+ *
+ * More details on featuring your application can be found from <a href="https://developer.tizen.org/development/tizen-studio/native-tools/configuring-your-app/manifest-text-editor#feature"><b>Feature List</b>.</a>
+ *
  */
 
 /**
index b3b1c94532e0bf495e9ee31020df4a61573cac7b..ac1624c8a506b147f7e044696ee71326712a247c 100755 (executable)
@@ -160,6 +160,7 @@ int device_display_get_state(display_state_e *state);
  * @retval #DEVICE_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #DEVICE_ERROR_PERMISSION_DENIED Permission denied
  * @retval #DEVICE_ERROR_OPERATION_FAILED Operation failed
+ * @retval #DEVICE_ERROR_NOT_SUPPORTED Not supported device
  * @see device_power_request_lock()
  * @see device_power_release_lock()
  * @see device_add_callback
index 6bd135c7f242cb97493d407bd0a9da9ee5fb8ab1..9eaf2d429ec412ca42cf5cbcc8b8732b8287a3ae 100755 (executable)
@@ -108,6 +108,7 @@ int device_power_release_lock(power_lock_e type);
  * @retval #DEVICE_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #DEVICE_ERROR_PERMISSION_DENIED Permission denied
  * @retval #DEVICE_ERROR_OPERATION_FAILED Operation failed
+ * @retval #DEVICE_ERROR_NOT_SUPPORTED Not supported device
  * @post The device will be in #DISPLAY_STATE_NORMAL state.
  */
 int device_power_wakeup(bool dim) TIZEN_DEPRECATED_API;
index 7e690386d40feff5cf67a65ba9af6cf1d188a8e8..5f801b7f05b34d7023afd0541c12abc6810affbd 100755 (executable)
@@ -30,6 +30,7 @@
 
 #define MODEL_NAME      "http://tizen.org/system/model_name"
 #define MODEL_EMULATOR  "Emulator"
+#define DISPLAY_STATE_FEATURE     "http://tizen.org/feature/display.state"
 
 static inline char *trim_str(char *s)
 {
@@ -239,3 +240,19 @@ bool is_emulator(void)
 
        return emul;
 }
+
+int is_display_state_supported(void)
+{
+       int ret;
+       bool display_state_avail;
+
+       ret = system_info_get_platform_bool(DISPLAY_STATE_FEATURE, &display_state_avail);
+       if (ret < 0) {
+               _E("Failed to get value of display state feature");
+               return false;
+       } else if (ret == 0 && !display_state_avail) {
+               _D("Display state feature is not supported");
+               return false;
+       } else
+               return true;
+}
index 43da9f949094ccb3ee264575ec286109c841f301..4e720d6436a4c4fe2da3f9e615b90ca1335c42ca 100755 (executable)
@@ -83,4 +83,5 @@ int check_async_call_rate(void);
 #define TIZEN_FEATURE_TRACKER (_get_tizen_profile() == TIZEN_PROFILE_TV)
 
 bool is_emulator(void);
+int is_display_state_supported(void);
 #endif /* __COMMON_H__ */
index de915c0e8bd6570ac3787f1aac5e772dd0f36afb..f8d958fe2062859d5fc6975c7d7ccb2f569abfff 100755 (executable)
@@ -244,6 +244,10 @@ int device_display_change_state(display_state_e state)
        int ret;
        static int privilege = -1;
 
+       ret = is_display_state_supported();
+       if (!ret)
+               return DEVICE_ERROR_NOT_SUPPORTED;
+
        if (check_async_call_rate() < 0) {
                _E("Rejected by too frequent calls; %d (calls per sec.) limit is violated."
                                , CHECK_RATE_THRESHOLD);
index 58c1bbf26bed4e5824163177f00d61e0680969dc..92499d2e2db9519ee1ebe8e8fec414cc453bbebe 100755 (executable)
@@ -498,6 +498,12 @@ int device_power_release_lock(power_lock_e type)
 
 int device_power_wakeup(bool dim)
 {
+       int ret;
+
+       ret = is_display_state_supported();
+       if (!ret)
+               return DEVICE_ERROR_NOT_SUPPORTED;
+
        if (dim)
                return device_display_change_state(DISPLAY_STATE_SCREEN_DIM);