INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include)
-SET(dependents "elementary evas ui-gadget-1 capi-network-tethering capi-network-connection capi-network-wifi notification efl-extension")
+SET(dependents "elementary evas ui-gadget-1 capi-network-tethering capi-network-connection capi-network-wifi notification aul bundle efl-extension dpm")
SET(CMAKE_BUILD_TYPE "Release")
void _teth_on(mh_appdata_t* ad);
void _prepare_popup_type(int type);
void _handle_mobile_data_onoff(mh_appdata_t *ad);
+void _create_security_restriction_noti(tethering_type_e type);
#ifdef __cplusplus
}
Name: ug-setting-mobileap-efl
Summary: Tethering UI Gadget Library
-Version: 1.0.139
+Version: 1.0.140
Release: 1
Group: App/Network
License: Flora-1.1
BuildRequires: pkgconfig(capi-network-tethering)
BuildRequires: pkgconfig(capi-network-connection)
BuildRequires: pkgconfig(notification)
+BuildRequires: pkgconfig(aul)
+BuildRequires: pkgconfig(bundle)
BuildRequires: pkgconfig(efl-extension)
+BuildRequires: pkgconfig(dpm)
BuildRequires: cmake
BuildRequires: edje-bin
BuildRequires: gettext-tools
#include <efl_extension.h>
#include <app_control_internal.h>
+#include <bundle.h>
+#include <aul.h>
#include "mh_common_utility.h"
#include "mobile_hotspot.h"
#include "mh_popup.h"
#include "mh_string.h"
+#define MAX_BUF_SIZE (256u)
+#define NETPOPUP "net.netpopup"
+
static mh_popup_type_e popup_type = MH_POPUP_NONE;
static Evas_Object *popup_content = NULL;
static char *popup_string = NULL;
return;
}
+
+void _create_security_restriction_noti(tethering_type_e type)
+{
+ bundle *b = NULL;
+ char restricted_type[MAX_BUF_SIZE] = {0, };
+ int ret;
+
+ switch (type) {
+ case TETHERING_TYPE_WIFI:
+ g_strlcpy(restricted_type, "wifi tethering", MAX_BUF_SIZE - 1);
+ break;
+ case TETHERING_TYPE_USB:
+ g_strlcpy(restricted_type, "usb tethering", MAX_BUF_SIZE - 1);
+ break;
+ case TETHERING_TYPE_BT:
+ g_strlcpy(restricted_type, "bt tethering", MAX_BUF_SIZE - 1);
+ break;
+ default:
+ ERR("Invalid type.\n");
+ return;
+ }
+ b = bundle_create();
+
+ bundle_add(b, "_SYSPOPUP_TYPE_", "toast_popup");
+ bundle_add(b, "_SYSPOPUP_CONTENT_", "security restriction");
+ bundle_add(b, "_RESTRICTED_TYPE_", restricted_type);
+
+ DBG("Launch security restriction alert network popup");
+ ret = aul_launch_app(NETPOPUP, b);
+ if (ret < 0)
+ ERR("Fail to launch syspopup");
+
+ bundle_free(b);
+ return;
+}
#include <time.h>
#include <limits.h>
#include <efl_extension.h>
+#include <dpm/restriction.h>
#include "mh_view_main.h"
#include "mh_popup.h"
return;
}
+static int __is_allowed(tethering_type_e type)
+{
+ int state = 0;
+ dpm_context_h context = NULL;
+ dpm_restriction_policy_h policy = NULL;
+
+ context = dpm_context_create();
+ if (context == NULL) {
+ ERR("Failed to create dpm context!!");
+ return 0;
+ }
+
+ policy = dpm_context_acquire_restriction_policy(context);
+ if (policy == NULL) {
+ ERR("Failed to create policy handle");
+ dpm_context_destroy(context);
+ return 0;
+ }
+
+ switch(type) {
+ case TETHERING_TYPE_WIFI:
+ dpm_restriction_get_wifi_hotspot_state(policy, &state);
+ break;
+ case TETHERING_TYPE_USB:
+ dpm_restriction_get_usb_tethering_state(policy, &state);
+ break;
+ case TETHERING_TYPE_BT:
+ dpm_restriction_get_bluetooth_tethering_state(policy, &state);
+ break;
+ default:
+ break;
+ }
+
+ dpm_context_release_restriction_policy(context, policy);
+ dpm_context_destroy(context);
+
+ return state;
+}
+
static void __wifi_onoff_changed_cb(void *data, Evas_Object *obj,
void *event_info)
{
__MOBILE_AP_FUNC_ENTER__;
+ if (!__is_allowed(TETHERING_TYPE_WIFI)) {
+ ERR("Wi-Fi tethering is restricted!!");
+ elm_check_state_set(obj, EINA_FALSE);
+ _create_security_restriction_noti(TETHERING_TYPE_WIFI);
+ return;
+ }
+
if (data == NULL) {
ERR("The param is NULL\n");
return;
{
__MOBILE_AP_FUNC_ENTER__;
+ if (!__is_allowed(TETHERING_TYPE_BT)) {
+ ERR("BT tethering is restricted!!");
+ elm_check_state_set(obj, EINA_FALSE);
+ _create_security_restriction_noti(TETHERING_TYPE_BT);
+ return;
+ }
+
if (data == NULL) {
ERR("The param is NULL\n");
return;
{
__MOBILE_AP_FUNC_ENTER__;
+ if (!__is_allowed(TETHERING_TYPE_USB)) {
+ ERR("USB tethering is restricted!!");
+ elm_check_state_set(obj, EINA_FALSE);
+ _create_security_restriction_noti(TETHERING_TYPE_USB);
+ return;
+ }
+
if (data == NULL) {
ERR("The param is NULL\n");
return;
<privilege>http://tizen.org/privilege/network.get</privilege>
<privilege>http://tizen.org/privilege/network.set</privilege>
<privilege>http://tizen.org/privilege/network.profile</privilege>
+ <privilege>http://tizen.org/privilege/appmanager.launch</privilege>
</privileges>
</manifest>