#include <stdio.h>
#include <stdint.h>
+#include <linux/input.h>
#include <libsyscommon/resource-manager.h>
#include <libsyscommon/resource-type.h>
#include <system/syscommon-plugin-deviced-power.h>
#include "power.h"
#include "power-suspend.h"
+#include "power-event-lock.h"
typedef union {
int32_t i32;
vital_state_changed(mode);
}
break;
+ case DEVICED_POWER_ATTR_INT_ADD_DOZE_SOURCE:
+ case DEVICED_POWER_ATTR_INT_REMOVE_DOZE_SOURCE:
+ {
+ int doze_source_id = *(const int *) data;
+ enum eventlock_type type;
+
+ /* currently only allow 2 type of source */
+ switch (doze_source_id) {
+ case KEY_POWER:
+ type = EL_KEY_POWER;
+ break;
+ case KEY_BLUETOOTH:
+ type = EL_KEY_BLUETOOTH;
+ break;
+ default:
+ return -EINVAL;
+ }
+
+ if (attr->id == DEVICED_POWER_ATTR_INT_ADD_DOZE_SOURCE)
+ event_wake_lock(type);
+ else /* DEVICED_POWER_ATTR_INT_REMOVE_DOZE_SOURCE */
+ event_wake_unlock(type);
+ }
+ break;
default:
return -EINVAL;
}
.set_2_tuple = set_tuple2_power_attr_data,
.is_supported = syscommon_resman_resource_attr_supported_always,
},
+ }, {
+ .name = "DEVICED_POWER_ATTR_INT_ADD_DOZE_SOURCE",
+ .id = DEVICED_POWER_ATTR_INT_ADD_DOZE_SOURCE,
+ .type = SYSCOMMON_RESMAN_DATA_TYPE_INT,
+ .flag = SYSCOMMON_RESMAN_RESOURCE_FLAG_PUBLIC,
+ .ops = {
+ .set = set_power_attr_data,
+ .is_supported = syscommon_resman_resource_attr_supported_always,
+ },
+ }, {
+ .name = "DEVICED_POWER_ATTR_INT_REMOVE_DOZE_SOURCE",
+ .id = DEVICED_POWER_ATTR_INT_REMOVE_DOZE_SOURCE,
+ .type = SYSCOMMON_RESMAN_DATA_TYPE_INT,
+ .flag = SYSCOMMON_RESMAN_RESOURCE_FLAG_PUBLIC,
+ .ops = {
+ .set = set_power_attr_data,
+ .is_supported = syscommon_resman_resource_attr_supported_always,
+ },
}
};