Skip to content

Commit 7cfddd5

Browse files
again4youjaeyun-jung
authored andcommitted
[C-Api] Remove device-policy-manager dependency
Since device-policy-manager has been removed by the security team, this patch removes the related code from ML API. Signed-off-by: Sangjung Woo <sangjung.woo@samsung.com>
1 parent 1057a33 commit 7cfddd5

3 files changed

Lines changed: 0 additions & 96 deletions

File tree

c/meson.build

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ if (get_option('enable-tizen'))
1616
nns_capi_common_deps += dependency('dlog')
1717

1818
if get_option('enable-tizen-privilege-check')
19-
nns_capi_deps += dependency('dpm')
2019
if ((tizenVmajor < 7) or (tizenVmajor == 7 and tizenVminor < 5))
2120
nns_capi_deps += dependency('capi-privacy-privilege-manager')
2221
endif

c/src/ml-api-inference-tizen-privilege-check.c

Lines changed: 0 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
#include "ml-api-inference-internal.h"
2121
#include "ml-api-inference-pipeline-internal.h"
2222

23-
#include <restriction.h> /* device policy manager */
2423
#if TIZENPPM
2524
#include <privacy_privilege_manager.h>
2625
#endif
@@ -131,8 +130,6 @@ typedef struct
131130
{
132131
gboolean invalid; /**< flag to indicate rm handle is valid */
133132
gpointer rm_h; /**< rm handle */
134-
device_policy_manager_h dpm_h; /**< dpm handle */
135-
int dpm_cb_id; /**< dpm callback id */
136133
gboolean has_video_src; /**< pipeline includes video src */
137134
gboolean has_audio_src; /**< pipeline includes audio src */
138135
GHashTable *res_handles; /**< hash table of resource handles */
@@ -183,61 +180,6 @@ ml_tizen_check_privilege (const gchar * privilege)
183180
#define ml_tizen_check_privilege(...) (ML_ERROR_NONE)
184181
#endif /* TIZENPPM */
185182

186-
/**
187-
* @brief Function to check device policy.
188-
*/
189-
static int
190-
ml_tizen_dpm_check_restriction (device_policy_manager_h dpm_handle, int type)
191-
{
192-
int err = DPM_ERROR_NOT_PERMITTED;
193-
int dpm_is_allowed = 0;
194-
195-
switch (type) {
196-
case 1: /* camera */
197-
err = dpm_restriction_get_camera_state (dpm_handle, &dpm_is_allowed);
198-
break;
199-
case 2: /* mic */
200-
err = dpm_restriction_get_microphone_state (dpm_handle, &dpm_is_allowed);
201-
break;
202-
default:
203-
/* unknown type */
204-
break;
205-
}
206-
207-
if (err != DPM_ERROR_NONE || dpm_is_allowed != 1) {
208-
_ml_loge ("Failed, device policy is not allowed.");
209-
return ML_ERROR_PERMISSION_DENIED;
210-
}
211-
212-
return ML_ERROR_NONE;
213-
}
214-
215-
/**
216-
* @brief Callback to be called when device policy is changed.
217-
*/
218-
static void
219-
ml_tizen_dpm_policy_changed_cb (const char *name, const char *state,
220-
void *user_data)
221-
{
222-
ml_pipeline *p;
223-
224-
g_return_if_fail (state);
225-
g_return_if_fail (user_data);
226-
227-
p = (ml_pipeline *) user_data;
228-
229-
if (g_ascii_strcasecmp (state, "disallowed") == 0) {
230-
g_mutex_lock (&p->lock);
231-
232-
/* pause the pipeline */
233-
gst_element_set_state (p->element, GST_STATE_PAUSED);
234-
235-
g_mutex_unlock (&p->lock);
236-
}
237-
238-
return;
239-
}
240-
241183
/**
242184
* @brief Function to get key string of resource type to handle hash table.
243185
*/
@@ -760,16 +702,6 @@ ml_tizen_mm_res_release (gpointer handle, gboolean destroy)
760702
ml_tizen_mm_res_release_rm (mm_handle);
761703

762704
if (destroy) {
763-
if (mm_handle->dpm_h) {
764-
if (mm_handle->dpm_cb_id > 0) {
765-
dpm_remove_policy_changed_cb (mm_handle->dpm_h, mm_handle->dpm_cb_id);
766-
mm_handle->dpm_cb_id = 0;
767-
}
768-
769-
dpm_manager_destroy (mm_handle->dpm_h);
770-
mm_handle->dpm_h = NULL;
771-
}
772-
773705
g_hash_table_remove_all (mm_handle->res_handles);
774706
g_free (mm_handle);
775707
}
@@ -786,7 +718,6 @@ ml_tizen_mm_res_initialize (ml_pipeline_h pipe, gboolean has_video_src,
786718
pipeline_resource_s *res;
787719
tizen_mm_handle_s *mm_handle = NULL;
788720
int status = ML_ERROR_STREAMS_PIPE;
789-
int err;
790721

791722
p = (ml_pipeline *) pipe;
792723

@@ -818,16 +749,6 @@ ml_tizen_mm_res_initialize (ml_pipeline_h pipe, gboolean has_video_src,
818749
mm_handle->res_handles =
819750
g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
820751

821-
/* device policy manager */
822-
mm_handle->dpm_h = dpm_manager_create ();
823-
err = dpm_add_policy_changed_cb (mm_handle->dpm_h, "camera",
824-
ml_tizen_dpm_policy_changed_cb, pipe, &mm_handle->dpm_cb_id);
825-
if (err != DPM_ERROR_NONE) {
826-
_ml_loge ("Failed to add device policy callback.");
827-
status = ML_ERROR_PERMISSION_DENIED;
828-
goto rm_error;
829-
}
830-
831752
/* set mm handle */
832753
res->handle = mm_handle;
833754
}
@@ -938,21 +859,6 @@ ml_tizen_mm_res_acquire (ml_pipeline_h pipe, tizen_mm_res_type_e res_type)
938859
"Internal function error: the resource '%s' does not have a valid mm handle (NULL).",
939860
TIZEN_RES_MM);
940861

941-
/* check dpm state */
942-
if (mm_handle->has_video_src) {
943-
status = ml_tizen_dpm_check_restriction (mm_handle->dpm_h, 1);
944-
if (status != ML_ERROR_NONE)
945-
_ml_error_report_return (ML_ERROR_PERMISSION_DENIED,
946-
"Video camera source requires permission to access the camera; you do not have the permission. Your Tizen application is required to acquire video permission (DPM) from Tizen. Refer: https://docs.tizen.org/application/native/guides/security/dpm/");
947-
}
948-
949-
if (mm_handle->has_audio_src) {
950-
status = ml_tizen_dpm_check_restriction (mm_handle->dpm_h, 2);
951-
if (status != ML_ERROR_NONE)
952-
_ml_error_report_return (ML_ERROR_PERMISSION_DENIED,
953-
"Audio mic source requires permission to access the mic; you do not have the permission. Your Tizen application is required to acquire audio/mic permission (DPM) from Tizen. Refer: https://docs.tizen.org/application/native/guides/security/dpm/");
954-
}
955-
956862
/* check invalid handle */
957863
if (mm_handle->invalid)
958864
ml_tizen_mm_res_release (mm_handle, FALSE);

packaging/machine-learning-api.spec

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ BuildRequires: meson >= 0.50.0
104104
BuildRequires: pkgconfig(dlog)
105105

106106
%if 0%{?enable_tizen_privilege}
107-
BuildRequires: pkgconfig(dpm)
108107
%if (0%{tizen_version_major} < 7) || (0%{?tizen_version_major} == 7 && 0%{?tizen_version_minor} < 5)
109108
BuildRequires: pkgconfig(capi-privacy-privilege-manager)
110109
%endif

0 commit comments

Comments
 (0)