return AUL_R_OK;
}
+
+API int aul_screen_connector_get_appid_by_surface_id_request(
+ unsigned int surface_id,
+ char **appid)
+{
+ int ret;
+ int fd;
+ bundle *b;
+ bundle *ret_kb;
+ app_pkt_t *pkt = NULL;
+ char *ret_appid = NULL;
+
+ if (appid == NULL) {
+ _E("Invalid parameter");
+ return AUL_R_ERROR;
+ }
+
+ b = bundle_create();
+ if (b == NULL) {
+ _E("out of memory");
+ return AUL_R_ERROR;
+ }
+
+ bundle_add_byte(b, "__AUL_SC_SURFACE__",
+ &surface_id, sizeof(unsigned int));
+
+ fd = aul_sock_send_bundle(AUL_UTIL_PID, getuid(),
+ GET_APPID_BY_SURFACE_ID, b, AUL_SOCK_ASYNC);
+
+ if (fd > 0) {
+ ret = aul_sock_recv_reply_pkt(fd, &pkt);
+ if (ret < 0 || pkt == NULL) {
+ _E("failed to get appid of %d", surface_id);
+ } else {
+ ret_kb = bundle_decode(pkt->data, pkt->len);
+ if (ret_kb) {
+ bundle_get_str(ret_kb, AUL_K_APPID, &ret_appid);
+ if (ret_appid)
+ *appid = strdup(ret_appid);
+ bundle_free(ret_kb);
+ if (*appid == NULL) {
+ _E("Out of memory");
+ bundle_free(b);
+ return AUL_R_ERROR;
+ }
+ }
+ }
+ } else {
+ ret = fd;
+ }
+
+ bundle_free(b);
+ if (ret < 0) {
+ _E("Failed to get appid");
+ return ret;
+ }
+
+ return AUL_R_OK;
+}