capi-network-tethering
storage
capi-base-utils-i18n
+ capi-message-port
)
FOREACH(flag ${pkgs_CFLAGS})
--- /dev/null
+/*
+ * Indicator
+ *
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * 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.
+ *
+ */
+
+
+#ifndef BG_COLOR_H_
+#define BG_COLOR_H_
+
+
+/*
+ * @brief Registers port for receiving messages from other applications.
+ * @remarks For now it is only used to change indicator background
+ *
+ * @param[in] data pointer to struct appdata(passed to app_service callback of Indicator-win app as void*)
+ */
+void message_port_register(void *data);
+void message_port_unregister(void);
+
+#endif /* BG_COLOR_H_ */
INDICATOR_ERROR_NO_DATA = -5,
} indicator_error_e;
+typedef enum {
+ BG_COLOR_DEFAULT = 0,
+ BG_COLOR_CALL_INCOMING,
+ BG_COLOR_CALL_END,
+ BG_COLOR_CALL_ON_HOLD,
+} bg_color_e;
+
typedef struct _Indicator_Data_Animation Indicator_Data_Animation;
struct _Indicator_Data_Animation
};
extern char *util_set_label_text_color(const char *txt);
+extern void util_bg_color_default_set(Evas_Object *layout);
+extern void util_bg_color_rgba_set(Evas_Object *layout, char r, char g, char b, char a);
+extern void util_bg_call_color_set(Evas_Object *layout, bg_color_e color);
extern const char *util_get_icon_dir(void);
extern void util_signal_emit(void* data, const char *emission, const char *source);
extern void util_part_text_emit(void* data, const char *part, const char *text);
BuildRequires: pkgconfig(pkgmgr-info)
BuildRequires: pkgconfig(edbus)
BuildRequires: pkgconfig(efl-assist)
-BuildRequires: pkgconfig(message-port)
+BuildRequires: pkgconfig(capi-message-port)
BuildRequires: pkgconfig(tzsh-indicator-service)
BuildRequires: pkgconfig(libtzplatform-config)
BuildRequires: pkgconfig(capi-system-device)
profile = mobile-3.0
# C Sources
-USER_SRCS = src/modules/information/video_play.c src/modules/information/earphone.c src/modules/information/toast_popup.c /src/modules/processing/call_divert.c src/modules/information/mp3_playing.c src/icon.c src/modules/modules.c src/modules/processing/transfer.c src/modules/processing/uploading.c src/modules/information/voice_recorder.c src/modules/information/noti.c src/modules/information/lowmem.c src/modules/information/fm_radio.c src/modules/setting/gps.c src/modules/processing/call.c src/modules/information/more_notify.c src/modules/setting/bluetooth.c src/tts.c src/modules/connection/connection.c src/modules/connection/wifi.c src/list.c src/modules/setting/nfc.c src/ticker.c src/modules/connection/dock.c src/main.c src/box.c src/modules/information/ext_storage.c src/modules/power/battery.c src/modules/connection/mobile_hotspot.c src/modules/home/search.c src/util.c src/modules/clock/clock.c src/modules/information/alarm.c src/modules/network/rssi.c src/modules/processing/downloading.c src/modules/setting/wifi-direct.c src/modules/connection/usb.c src/modules/setting/silent.c
+USER_SRCS = src/modules/information/video_play.c src/modules/information/earphone.c src/bg_color.c src/modules/information/toast_popup.c /src/modules/processing/call_divert.c src/modules/information/mp3_playing.c src/icon.c src/modules/modules.c src/modules/processing/transfer.c src/modules/processing/uploading.c src/modules/information/voice_recorder.c src/modules/information/noti.c src/modules/information/lowmem.c src/modules/information/fm_radio.c src/modules/setting/gps.c src/modules/processing/call.c src/modules/information/more_notify.c src/modules/setting/bluetooth.c src/tts.c src/modules/connection/connection.c src/modules/connection/wifi.c src/list.c src/modules/setting/nfc.c src/ticker.c src/modules/connection/dock.c src/main.c src/box.c src/modules/information/ext_storage.c src/modules/power/battery.c src/modules/connection/mobile_hotspot.c src/modules/home/search.c src/util.c src/modules/clock/clock.c src/modules/information/alarm.c src/modules/network/rssi.c src/modules/processing/downloading.c src/modules/setting/wifi-direct.c src/modules/connection/usb.c src/modules/setting/silent.c
# EDC Sources
USER_EDCS =
name: "ATO005";
color: 76 76 76 255;
}
+ color_class {
+ name: "W015L1";
+ color: 88 175 57 255;
+ }
+ color_class {
+ name: "F060L3";
+ color: 214 49 49 255;
+ }
+ color_class
+ {
+ name: "bg_custom";
+ color: 0 0 0 255;
+ }
+ color_class
+ {
+ name: "bg_default";
+ color: 0 0 0 0;
+ }
}
name: "indicator";
script {
public bg_set, badge_set, theme, changepad, changebg, changeHomePad;
+ public message(Msg_Type:type, id, ...)
+ {
+ if (type == MSG_INT_SET && id == 1)
+ {
+ new r, g, b, a;
+
+ r = getarg(2);
+ g = getarg(3);
+ b = getarg(4);
+ a = getarg(5);
+
+ set_state(PART:"background", "bg_custom", 0.0);
+ set_color_class("bg_custom", r, g, b, a);
+ }
+ }
}
styles
{
description {
state: "default" 0.0;
min: 0 INDICATOR_HEIGHT;
- color: 0 0 0 0;
+ color_class: "bg_default";
+ }
+ description {
+ state: "bg_custom" 0.0;
+ inherit: "default";
+ color_class: "bg_custom";
+ }
+ description {
+ state: "incoming_call" 0.0;
+ inherit: "default";
+ color_class: "W015L1";
+ }
+ description {
+ state: "end_call" 0.0;
+ inherit: "default";
+ color_class: "F060L3";
+ }
+ description {
+ state: "on_hold" 0.0;
+ inherit: "default";
+ color_class: "AO007";
}
}
part {
* BG and CLOCK
*
**********************************************************/
+
+ program {
+ name: "bg_color_default";
+ action: STATE_SET "default" 0.0;
+ signal: "bg.color.default";
+ source: "indicator.prog";
+ target: "background";
+ }
+
+ program {
+ name: "bg_color_call_incoming";
+ signal: "bg.color.call.incoming";
+ source: "indicator.prog";
+ script {
+ set_state(PART:"background", "incoming_call", 0.0);
+ }
+ }
+
+ program {
+ name: "bg_color_call_end";
+ signal: "bg.color.call.end";
+ source: "indicator.prog";
+ script {
+ set_state(PART:"background", "end_call", 0.0);
+ }
+ }
+
+ program {
+ name: "bg_color_call_on_hold";
+ signal: "bg.color.call.onhold";
+ source: "indicator.prog";
+ script {
+ set_state(PART:"background", "on_hold", 0.0);
+ }
+ }
+
program {
name: "bg_opaque";
action: STATE_SET "default" 0.0;
}
}
-}
\ No newline at end of file
+}
--- /dev/null
+/*
+ * Indicator
+ *
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * 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.
+ *
+ */
+
+#include "indicator.h"
+#include "log.h"
+#include "util.h"
+#include "main.h"
+
+#include <message_port.h>
+#include <bundle.h>
+
+#define KEY_INDICATOR_BG "indicator/bg/color"
+
+/*
+ * Values for KEY_INDICATOR_BG key
+ */
+#define VALUE_INDICATOR_BG_RGB "indicator/bg/color/rgb"
+#define KEY_VALUE_INDICATOR_BG_CALL "indicator/bg/color/call"
+
+/*
+ * Keys that are set if KEY_INDICATOR_BG is paired with VALUE_INDICATOR_BG_RGB
+ */
+#define KEY_R "bg/r"
+#define KEY_G "bg/g"
+#define KEY_B "bg/b"
+#define KEY_A "bg/a"
+
+/*
+ * Values for KEY_VALUE_INDICATOR_BG_CALL key
+ */
+#define VALUE_CALL_INCOMING_CALL "call/during_call"
+#define VALUE_CALL_ON_HOLD "call/on_hold"
+#define VALUE_CALL_END_CALL "call/end_call"
+#define VALUE_CALL_IDLE "call/idle"
+
+
+static int port_id;
+
+
+static void set_bg_for_call(struct appdata *ad, bundle *message)
+{
+ _D("set_bg_for_call");
+
+ char *call_state;
+ int ret;
+
+ ret = bundle_get_str(message, KEY_VALUE_INDICATOR_BG_CALL, &call_state);
+ retm_if(ret != BUNDLE_ERROR_NONE, "bundle_get_type failed[%d]:%s", ret, get_error_message(ret));
+
+ if (!strcmp(call_state, VALUE_CALL_INCOMING_CALL)) {
+ util_bg_call_color_set(ad->win.layout, BG_COLOR_CALL_INCOMING);
+ } else if (!strcmp(call_state, VALUE_CALL_ON_HOLD)) {
+ util_bg_call_color_set(ad->win.layout, BG_COLOR_CALL_ON_HOLD);
+ } else if (!strcmp(call_state, VALUE_CALL_END_CALL)) {
+ util_bg_call_color_set(ad->win.layout, BG_COLOR_CALL_END);
+ } else if (!strcmp(call_state, VALUE_CALL_IDLE)) {
+ util_bg_color_default_set(ad->win.layout);
+ } else {
+ _E("Invalid value!");
+ }
+}
+
+
+static void validate_and_set_bg_rgba(int rgba_r, int rgba_g, int rgba_b, int rgba_a)
+{
+ _D("validate_and_set_bg");
+
+ retm_if(rgba_r < 0 || rgba_r > 255, "R component of RGBA color scheme is invalid");
+ retm_if(rgba_g < 0 || rgba_g > 255, "G component of RGBA color scheme is invalid");
+ retm_if(rgba_b < 0 || rgba_b > 255, "B component of RGBA color scheme is invalid");
+ retm_if(rgba_a < 0 || rgba_a > 255, "A component of RGBA color scheme is invalid");
+}
+
+
+static void set_bg_rgba(struct appdata *ad, bundle *message)
+{
+ _D("set_bg_rgba");
+
+ void *rgba_r;
+ void *rgba_g;
+ void *rgba_b;
+ void *rgba_a;
+ int ret;
+ size_t size;
+
+ ret = bundle_get_byte(message, KEY_R, &rgba_r, &size);
+ retm_if(ret != BUNDLE_ERROR_NONE, "bundle_get_byte failed[%d]:%s", ret, get_error_message(ret));
+ ret = bundle_get_byte(message, KEY_G, &rgba_g, &size);
+ retm_if(ret != BUNDLE_ERROR_NONE, "bundle_get_byte failed[%d]:%s", ret, get_error_message(ret));
+ ret = bundle_get_byte(message, KEY_B, &rgba_b, &size);
+ retm_if(ret != BUNDLE_ERROR_NONE, "bundle_get_byte failed[%d]:%s", ret, get_error_message(ret));
+ ret = bundle_get_byte(message, KEY_A, &rgba_a, &size);
+ retm_if(ret != BUNDLE_ERROR_NONE, "bundle_get_byte failed[%d]:%s", ret, get_error_message(ret));
+
+ validate_and_set_bg_rgba(*(int *)rgba_r, *(int *)rgba_g, *(int *)rgba_b, *(int *)rgba_a);
+
+ util_bg_color_rgba_set(ad->win.layout, *(int *)rgba_r, *(int *)rgba_g, *(int *)rgba_b, *(int *)rgba_a);
+}
+
+
+static void message_port_cb(int trusted_local_port_id, const char *remote_app_id,
+ const char *remote_port, bool trusted_remote_port, bundle *message, void *data)
+{
+ _D("message_port_cb");
+
+ retm_if(!trusted_remote_port, "The remote port is untrusted");
+ int ret;
+ char *value;
+
+ struct appdata *ad;
+
+ ret_if(!data);
+ ad = data;
+
+ ret = bundle_get_str(message, KEY_INDICATOR_BG, &value);
+ retm_if(ret != BUNDLE_ERROR_NONE, "bundle_get_type failed[%d]:%s", ret, get_error_message(ret));
+
+ if (!strcmp(value, KEY_VALUE_INDICATOR_BG_CALL))
+ set_bg_for_call(ad, message);
+
+ else if (!strcmp(value, VALUE_INDICATOR_BG_RGB))
+ set_bg_rgba(ad, message);
+}
+
+
+void message_port_register(void *data)
+{
+ _D("message_port_register");
+
+ port_id = message_port_register_trusted_local_port("indicator/bg/color", message_port_cb, data);
+ retm_if(port_id < MESSAGE_PORT_ERROR_NONE,
+ "message_port_register_trusted_local_port failed[%d]:%s", port_id, get_error_message(port_id));
+}
+
+
+void message_port_unregister(void)
+{
+ _D("message_port_unregister");
+ int ret;
+
+ ret = message_port_unregister_trusted_local_port(port_id);
+ retm_if(ret != MESSAGE_PORT_ERROR_NONE, "message_port_unregister_trusted_local_port failed[%d]:%s", ret, get_error_message(ret));
+
+}
#include "log.h"
#include "indicator.h"
#include "ticker.h"
+#include "bg_color.h"
#define GRP_NAME "indicator"
#define WIN_TITLE "Illume Indicator"
ad->win.win = elm_win_add(NULL, "indicator", ELM_WIN_SOCKET_IMAGE);
ret_if(!(ad->win.win));
- elm_win_alpha_set(ad->win.win, EINA_TRUE);
-
dummy_win = elm_win_add(NULL, "indicator_dummy", ELM_WIN_BASIC);
if (dummy_win) {
elm_win_screen_size_get(dummy_win, NULL, NULL, &ad->win.port_w, &ad->win.land_w);
modules_fini(data);
ticker_fini(ad);
indicator_toast_popup_fini();
+ message_port_unregister();
#ifdef _SUPPORT_SCREEN_READER2
indicator_service_tts_fini(data);
#endif
#endif
feedback_initialize();
indicator_toast_popup_init(data);
+ message_port_register(data);
if (INDICATOR_ERROR_NONE != ticker_init(ad)) {
_E("Ticker cannot initialize");
}
return ret_str;
}
+void util_bg_color_rgba_set(Evas_Object *layout, char r, char g, char b, char a)
+{
+ Edje_Message_Int_Set *msg;
+
+ ret_if(!layout);
+
+ msg = malloc(sizeof(*msg) + 3 * sizeof(int));
+
+ msg->count = 4;
+ msg->val[0] = r;
+ msg->val[1] = g;
+ msg->val[2] = b;
+ msg->val[3] = a;
+
+ edje_object_message_send(elm_layout_edje_get(layout), EDJE_MESSAGE_INT_SET, 1, msg);
+ free(msg);
+}
+
+void util_bg_color_default_set(Evas_Object *layout)
+{
+ ret_if(!layout);
+
+ elm_layout_signal_emit(layout, "bg.color.default", "indicator.prog");
+}
+
+void util_bg_call_color_set(Evas_Object *layout, bg_color_e color)
+{
+ ret_if(!layout);
+
+ switch (color) {
+ case BG_COLOR_CALL_INCOMING:
+ elm_layout_signal_emit(layout, "bg.color.call.incoming", "indicator.prog");
+ break;
+ case BG_COLOR_CALL_END:
+ elm_layout_signal_emit(layout, "bg.color.call.end", "indicator.prog");
+ break;
+ case BG_COLOR_CALL_ON_HOLD:
+ elm_layout_signal_emit(layout, "bg.color.call.onhold", "indicator.prog");
+ break;
+ default:
+ util_bg_color_default_set(layout);
+ break;
+ }
+}
+
const char *util_get_icon_dir(void)
{
return util_get_res_file_path(DEFAULT_DIR);
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<manifest xmlns="http://tizen.org/ns/packages" api-version="3.0" package="org.tizen.indicator" version="1.0.0">
+<manifest xmlns="http://tizen.org/ns/packages" api-version="3.0" install-location="internal-only" package="org.tizen.indicator" version="1.0.0">
<profile name="mobile"/>
- <ui-application appid="org.tizen.indicator" exec="indicator-win" launch_mode="single" on-boot="true" multiple="false" nodisplay="true" taskmanage="false" type="capp">
+ <ui-application appid="org.tizen.indicator" exec="indicator-win" process-pool="true" launch_mode="single" on-boot="true" multiple="false" nodisplay="true" taskmanage="false" type="capp">
<label>indicator-win</label>
</ui-application>
<privileges>