优化sleep同步封装获取powerind

Change-Id: I31a062dc4b4ad5845478cf1767e0315ad78864f4
diff --git a/mbtk/include/mbtk/mbtk_sleep.h b/mbtk/include/mbtk/mbtk_sleep.h
index f36a6bf..4e8b71f 100755
--- a/mbtk/include/mbtk/mbtk_sleep.h
+++ b/mbtk/include/mbtk/mbtk_sleep.h
@@ -33,18 +33,23 @@
 #include <linux/input.h>
 
 #include "mbtk_type.h"
-// #include "mbtk_info_api.h"
-
 
 /*************************************************************
     Constants and Macros
 *************************************************************/
 typedef void (*mbtk_sleep_callback_func)(const void* data, int data_len);
 
+#define LOCK_MAX_SIZE       129
+#define EPOLL_SIZE_HINT     128
 
-// static bool autosleep_enable = FALSE;
+/*
+This module is system sleep, the system cannot sleep when the lock exists
+To verify whether it is in sleep state, it is necessary to test the power consumption
+Power management principle, as long as a wakelock lock exists, the system will not enter the Suspend state
+So the name can be arbitrarily chosen to indicate that such a lock is needed so that the system does not sleep
+*/
+#define MTBK_POWERIND           "/system/etc/powerind"      //1806
 
-#define LOCK_MAX_SIZE 129
 
 /*************************************************************
     Definitions:enum,struct,union,class
@@ -65,6 +70,7 @@
 /*************************************************************
     Public Function Declaration
 *************************************************************/
+int mbtk_powerrind_get();
 int mbtk_autosuspend_enable(char enable);
 int mbtk_wakelock_create(const char* name , size_t len);
 int mbtk_wakelock_lock(int fd);
diff --git a/mbtk/libmbtk_lib/sleep/mbtk_sleep.c b/mbtk/libmbtk_lib/sleep/mbtk_sleep.c
old mode 100644
new mode 100755
index ab25410..c861a5a
--- a/mbtk/libmbtk_lib/sleep/mbtk_sleep.c
+++ b/mbtk/libmbtk_lib/sleep/mbtk_sleep.c
@@ -2,8 +2,6 @@
 #include <sys/epoll.h>
 #include <sys/timerfd.h>
 
-
-
 #include "mbtk_sleep.h"
 #include "mbtk_log.h"
 #include "mbtk_utils.h"
@@ -12,13 +10,27 @@
 
 static mbtk_lock_name_s mbtk_lock_name[LOCK_MAX_SIZE]={0};
 
-#define EPOLL_SIZE_HINT    128
 int g_mEpollFd = -1;
 mbtk_sleep_callback_func g_sleep_timer_cb;
 int g_sleep_timer_fd = 0;
 pthread_t g_timer_thread_id;
 
+int mbtk_powerrind_get()
+{
+    char buffer[4];
+    int ret = 0;
 
+    int fd = open(MTBK_POWERIND, O_RDWR | O_SYNC, 0662);
+    if (fd != -1)
+    {
+        mbtk_read(fd, buffer, strlen(buffer)+1);
+        close(fd);
+    }
+
+    ret = atoi(buffer);
+
+    return ret;
+}
 
 
 int mbtk_autosuspend_enable(char enable)