From f186348d8ef71a801df1771e05a4f8443e521875 Mon Sep 17 00:00:00 2001 From: Dongsun Lee Date: Tue, 31 Mar 2026 14:07:36 +0900 Subject: [PATCH] [Tizen.Security.DevicePolicyManager][TSCACR-646] Remove all deprecated APIs --- .../Interop/Interop.DevicePolicyManager.cs | 134 --------- .../Interop/Interop.Libraries.cs | 26 -- .../Tizen.Security.DevicePolicyManager.csproj | 15 - .../Tizen.Security.DevicePolicyManager.sln | 65 ---- .../BluetoothPolicy.cs | 283 ----------------- .../BrowserPolicy.cs | 178 ----------- .../DevicePolicy.cs | 35 --- .../DevicePolicyManager.cs | 154 ---------- .../EmailPolicy.cs | 178 ----------- .../LocationPolicy.cs | 178 ----------- .../MediaPolicy.cs | 283 ----------------- .../PasswordPolicy.cs | 199 ------------ .../PasswordQuality.cs | 59 ---- .../PolicyChangedEventArgs.cs | 47 --- .../StoragePolicy.cs | 178 ----------- .../TelephonyPolicy.cs | 177 ----------- .../UsbPolicy.cs | 178 ----------- .../WifiPolicy.cs | 284 ------------------ .../api/Tizen.Security.DevicePolicyManager.md | 24 -- 19 files changed, 2675 deletions(-) delete mode 100644 src/Tizen.Security.DevicePolicyManager/Interop/Interop.DevicePolicyManager.cs delete mode 100644 src/Tizen.Security.DevicePolicyManager/Interop/Interop.Libraries.cs delete mode 100644 src/Tizen.Security.DevicePolicyManager/Tizen.Security.DevicePolicyManager.csproj delete mode 100644 src/Tizen.Security.DevicePolicyManager/Tizen.Security.DevicePolicyManager.sln delete mode 100644 src/Tizen.Security.DevicePolicyManager/Tizen.Security.DevicePolicyManager/BluetoothPolicy.cs delete mode 100644 src/Tizen.Security.DevicePolicyManager/Tizen.Security.DevicePolicyManager/BrowserPolicy.cs delete mode 100644 src/Tizen.Security.DevicePolicyManager/Tizen.Security.DevicePolicyManager/DevicePolicy.cs delete mode 100644 src/Tizen.Security.DevicePolicyManager/Tizen.Security.DevicePolicyManager/DevicePolicyManager.cs delete mode 100644 src/Tizen.Security.DevicePolicyManager/Tizen.Security.DevicePolicyManager/EmailPolicy.cs delete mode 100644 src/Tizen.Security.DevicePolicyManager/Tizen.Security.DevicePolicyManager/LocationPolicy.cs delete mode 100644 src/Tizen.Security.DevicePolicyManager/Tizen.Security.DevicePolicyManager/MediaPolicy.cs delete mode 100644 src/Tizen.Security.DevicePolicyManager/Tizen.Security.DevicePolicyManager/PasswordPolicy.cs delete mode 100644 src/Tizen.Security.DevicePolicyManager/Tizen.Security.DevicePolicyManager/PasswordQuality.cs delete mode 100644 src/Tizen.Security.DevicePolicyManager/Tizen.Security.DevicePolicyManager/PolicyChangedEventArgs.cs delete mode 100644 src/Tizen.Security.DevicePolicyManager/Tizen.Security.DevicePolicyManager/StoragePolicy.cs delete mode 100644 src/Tizen.Security.DevicePolicyManager/Tizen.Security.DevicePolicyManager/TelephonyPolicy.cs delete mode 100644 src/Tizen.Security.DevicePolicyManager/Tizen.Security.DevicePolicyManager/UsbPolicy.cs delete mode 100644 src/Tizen.Security.DevicePolicyManager/Tizen.Security.DevicePolicyManager/WifiPolicy.cs delete mode 100644 src/Tizen.Security.DevicePolicyManager/doc/api/Tizen.Security.DevicePolicyManager.md diff --git a/src/Tizen.Security.DevicePolicyManager/Interop/Interop.DevicePolicyManager.cs b/src/Tizen.Security.DevicePolicyManager/Interop/Interop.DevicePolicyManager.cs deleted file mode 100644 index 1e4246e3ff8..00000000000 --- a/src/Tizen.Security.DevicePolicyManager/Interop/Interop.DevicePolicyManager.cs +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Copyright (c) 2018 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 - */ - -using System; -using System.Runtime.InteropServices; -using System.Runtime.InteropServices.Marshalling; - -internal static partial class Interop -{ - internal static partial class DevicePolicyManager - { - internal enum ErrorCode - { - None = Tizen.Internals.Errors.ErrorCode.None, - InvalidParameter = Tizen.Internals.Errors.ErrorCode.InvalidParameter, - TimeOut = Tizen.Internals.Errors.ErrorCode.TimedOut, - PermissionDenied = Tizen.Internals.Errors.ErrorCode.PermissionDenied, - ConnectionRefused = Tizen.Internals.Errors.ErrorCode.ConnectionRefused, - OutOfMemory = Tizen.Internals.Errors.ErrorCode.OutOfMemory - } - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate void PolicyChangedCallback(string name, string state, IntPtr userData); - // void (* dpm_policy_changed_cb)(const char* name, const char* state, void* user_data); - - [LibraryImport(Libraries.DevicePolicyManager, EntryPoint = "dpm_add_policy_changed_cb", StringMarshalling = StringMarshalling.Utf8)] - internal static partial int AddPolicyChangedCallback(IntPtr handle, string name, PolicyChangedCallback callback, IntPtr userData, out int callbackId); - // int dpm_add_policy_changed_cb(device_policy_manager_h handle, const char* name, dpm_policy_changed_cb callback, void* user_data, int* id) - - [LibraryImport(Libraries.DevicePolicyManager, EntryPoint = "dpm_remove_policy_changed_cb")] - internal static partial int RemovePolicyChangedCallback(IntPtr handle, int callbackId); - // int dpm_remove_policy_changed_cb(device_policy_manager_h handle, int id) - - [LibraryImport(Libraries.DevicePolicyManager, EntryPoint = "dpm_manager_create")] - internal static partial IntPtr CreateHandle(); - // device_policy_manager_h dpm_manager_create(void) - - [LibraryImport(Libraries.DevicePolicyManager, EntryPoint = "dpm_manager_destroy")] - internal static partial int DestroyHandle(IntPtr handle); - // int dpm_manager_destroy(device_policy_manager_h handle) - - [LibraryImport(Libraries.DevicePolicyManager, EntryPoint = "dpm_password_get_expires")] - internal static partial int PasswordGetExpires(IntPtr handle, out int value); - // int dpm_password_get_expires(device_policy_manager_h handle, int* value) - - [LibraryImport(Libraries.DevicePolicyManager, EntryPoint = "dpm_password_get_history")] - internal static partial int PasswordGetHistory(IntPtr handle, out int value); - // int dpm_password_get_history(device_policy_manager_h handle, int* value) - - [LibraryImport(Libraries.DevicePolicyManager, EntryPoint = "dpm_password_get_max_inactivity_time_device_lock")] - internal static partial int PasswordGetMaxInactivityTimeDeviceLock(IntPtr handle, out int value); - // int dpm_password_get_max_inactivity_time_device_lock(device_policy_manager_h handle, int* value) - - [LibraryImport(Libraries.DevicePolicyManager, EntryPoint = "dpm_password_get_maximum_failed_attempts_for_wipe")] - internal static partial int PasswordGetMaximumFailedAttemptsForWipe(IntPtr handle, out int value); - // int dpm_password_get_maximum_failed_attempts_for_wipe(device_policy_manager_h handle, int* value) - - [LibraryImport(Libraries.DevicePolicyManager, EntryPoint = "dpm_password_get_min_complex_chars")] - internal static partial int PasswordGetMinComplexChars(IntPtr handle, out int value); - // int dpm_password_get_min_complex_chars(device_policy_manager_h handle, int* value) - - [LibraryImport(Libraries.DevicePolicyManager, EntryPoint = "dpm_password_get_minimum_length")] - internal static partial int PasswordGetMinimumLength(IntPtr handle, out int value); - // int dpm_password_get_minimum_length(device_policy_manager_h handle, int* value) - - [LibraryImport(Libraries.DevicePolicyManager, EntryPoint = "dpm_password_get_quality")] - internal static partial int PasswordGetQuality(IntPtr handle, out int quality); - // int dpm_password_get_quality(device_policy_manager_h handle, int* quality) - - [LibraryImport(Libraries.DevicePolicyManager, EntryPoint = "dpm_restriction_get_messaging_state", StringMarshalling = StringMarshalling.Utf8)] - internal static partial int RestrictionGetMessagingState(IntPtr handle, string simId, out int allowed); - // int dpm_restriction_get_messaging_state(device_policy_manager_h handle, const char* sim_id, int* is_allowed) - - [LibraryImport(Libraries.DevicePolicyManager, EntryPoint = "dpm_restriction_get_popimap_email_state")] - internal static partial int RestrictionGetPopimapEmailState(IntPtr handle, out int allowed); - // int dpm_restriction_get_popimap_email_state(device_policy_manager_h handle, int* is_allowed) - - [LibraryImport(Libraries.DevicePolicyManager, EntryPoint = "dpm_restriction_get_wifi_state")] - internal static partial int RestrictionGetWifiState(IntPtr handle, out int allowed); - // int dpm_restriction_get_wifi_state(device_policy_manager_h handle, int* is_allowed) - - [LibraryImport(Libraries.DevicePolicyManager, EntryPoint = "dpm_restriction_get_wifi_hotspot_state")] - internal static partial int RestrictionGetWifiHotspotState(IntPtr handle, out int allowed); - // int dpm_restriction_get_wifi_hotspot_state(device_policy_manager_h handle, int* is_allowed) - - [LibraryImport(Libraries.DevicePolicyManager, EntryPoint = "dpm_restriction_get_bluetooth_mode_change_state")] - internal static partial int RestrictionGetBluetoothModeChangeState(IntPtr handle, out int allowed); - // int dpm_restriction_get_bluetooth_mode_change_state(device_policy_manager_h handle, int* is_allowed) - - [LibraryImport(Libraries.DevicePolicyManager, EntryPoint = "dpm_restriction_get_bluetooth_tethering_state")] - internal static partial int RestrictionGetBluetoothTetheringState(IntPtr handle, out int allowed); - // int dpm_restriction_get_bluetooth_tethering_state(device_policy_manager_h handle, int* is_allowed) - - [LibraryImport(Libraries.DevicePolicyManager, EntryPoint = "dpm_restriction_get_browser_state")] - internal static partial int RestrictionGetBrowserState(IntPtr handle, out int allowed); - // int dpm_restriction_get_browser_state(device_policy_manager_h handle, int* is_allowed) - - [LibraryImport(Libraries.DevicePolicyManager, EntryPoint = "dpm_restriction_get_camera_state")] - internal static partial int RestrictionGetCameraState(IntPtr handle, out int allowed); - // int dpm_restriction_get_camera_state(device_policy_manager_h handle, int* is_allowed) - - [LibraryImport(Libraries.DevicePolicyManager, EntryPoint = "dpm_restriction_get_microphone_state")] - internal static partial int RestrictionGetMicrophoneState(IntPtr handle, out int allowed); - // int dpm_restriction_get_microphone_state(device_policy_manager_h handle, int* is_allowed) - - [LibraryImport(Libraries.DevicePolicyManager, EntryPoint = "dpm_restriction_get_location_state")] - internal static partial int RestrictionGetLocationState(IntPtr handle, out int allowed); - // int dpm_restriction_get_location_state(device_policy_manager_h handle, int* is_allowed) - - [LibraryImport(Libraries.DevicePolicyManager, EntryPoint = "dpm_restriction_get_external_storage_state")] - internal static partial int RestrictionGetExternalStorageState(IntPtr handle, out int allowed); - // int dpm_restriction_get_external_storage_state(device_policy_manager_h handle, int* is_allowed) - - [LibraryImport(Libraries.DevicePolicyManager, EntryPoint = "dpm_restriction_get_usb_tethering_state")] - internal static partial int RestrictionGetUsbTetheringState(IntPtr handle, out int allowed); - // int dpm_restriction_get_usb_tethering_state(device_policy_manager_h handle, int* is_allowed) - } -} - - - diff --git a/src/Tizen.Security.DevicePolicyManager/Interop/Interop.Libraries.cs b/src/Tizen.Security.DevicePolicyManager/Interop/Interop.Libraries.cs deleted file mode 100644 index 4df465fd626..00000000000 --- a/src/Tizen.Security.DevicePolicyManager/Interop/Interop.Libraries.cs +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2018 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 - */ - -internal static partial class Interop -{ - internal static partial class Libraries - { - public const string DevicePolicyManager = "libdpm.so.0"; - } -} - - - diff --git a/src/Tizen.Security.DevicePolicyManager/Tizen.Security.DevicePolicyManager.csproj b/src/Tizen.Security.DevicePolicyManager/Tizen.Security.DevicePolicyManager.csproj deleted file mode 100644 index 91558b2b279..00000000000 --- a/src/Tizen.Security.DevicePolicyManager/Tizen.Security.DevicePolicyManager.csproj +++ /dev/null @@ -1,15 +0,0 @@ - - - - net8.0 - $(NoWarn);CS1591 - - - - mobile;wearable - - - - - - diff --git a/src/Tizen.Security.DevicePolicyManager/Tizen.Security.DevicePolicyManager.sln b/src/Tizen.Security.DevicePolicyManager/Tizen.Security.DevicePolicyManager.sln deleted file mode 100644 index cb5d5ce144b..00000000000 --- a/src/Tizen.Security.DevicePolicyManager/Tizen.Security.DevicePolicyManager.sln +++ /dev/null @@ -1,65 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.26124.0 -MinimumVisualStudioVersion = 15.0.26124.0 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Security.DevicePolicyManager", "Tizen.Security.DevicePolicyManager.csproj", "{AA4F6CF6-78E2-49D9-B73A-4FD63F7D90E3}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "..\Tizen\Tizen.csproj", "{13DD8158-41C1-4B9F-B398-9E82BB74210B}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{01B0E2DB-D4E8-4FB7-ACF1-A25C9920123F}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|Any CPU = Release|Any CPU - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {AA4F6CF6-78E2-49D9-B73A-4FD63F7D90E3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {AA4F6CF6-78E2-49D9-B73A-4FD63F7D90E3}.Debug|Any CPU.Build.0 = Debug|Any CPU - {AA4F6CF6-78E2-49D9-B73A-4FD63F7D90E3}.Debug|x64.ActiveCfg = Debug|Any CPU - {AA4F6CF6-78E2-49D9-B73A-4FD63F7D90E3}.Debug|x64.Build.0 = Debug|Any CPU - {AA4F6CF6-78E2-49D9-B73A-4FD63F7D90E3}.Debug|x86.ActiveCfg = Debug|Any CPU - {AA4F6CF6-78E2-49D9-B73A-4FD63F7D90E3}.Debug|x86.Build.0 = Debug|Any CPU - {AA4F6CF6-78E2-49D9-B73A-4FD63F7D90E3}.Release|Any CPU.ActiveCfg = Release|Any CPU - {AA4F6CF6-78E2-49D9-B73A-4FD63F7D90E3}.Release|Any CPU.Build.0 = Release|Any CPU - {AA4F6CF6-78E2-49D9-B73A-4FD63F7D90E3}.Release|x64.ActiveCfg = Release|Any CPU - {AA4F6CF6-78E2-49D9-B73A-4FD63F7D90E3}.Release|x64.Build.0 = Release|Any CPU - {AA4F6CF6-78E2-49D9-B73A-4FD63F7D90E3}.Release|x86.ActiveCfg = Release|Any CPU - {AA4F6CF6-78E2-49D9-B73A-4FD63F7D90E3}.Release|x86.Build.0 = Release|Any CPU - {13DD8158-41C1-4B9F-B398-9E82BB74210B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {13DD8158-41C1-4B9F-B398-9E82BB74210B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {13DD8158-41C1-4B9F-B398-9E82BB74210B}.Debug|x64.ActiveCfg = Debug|Any CPU - {13DD8158-41C1-4B9F-B398-9E82BB74210B}.Debug|x64.Build.0 = Debug|Any CPU - {13DD8158-41C1-4B9F-B398-9E82BB74210B}.Debug|x86.ActiveCfg = Debug|Any CPU - {13DD8158-41C1-4B9F-B398-9E82BB74210B}.Debug|x86.Build.0 = Debug|Any CPU - {13DD8158-41C1-4B9F-B398-9E82BB74210B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {13DD8158-41C1-4B9F-B398-9E82BB74210B}.Release|Any CPU.Build.0 = Release|Any CPU - {13DD8158-41C1-4B9F-B398-9E82BB74210B}.Release|x64.ActiveCfg = Release|Any CPU - {13DD8158-41C1-4B9F-B398-9E82BB74210B}.Release|x64.Build.0 = Release|Any CPU - {13DD8158-41C1-4B9F-B398-9E82BB74210B}.Release|x86.ActiveCfg = Release|Any CPU - {13DD8158-41C1-4B9F-B398-9E82BB74210B}.Release|x86.Build.0 = Release|Any CPU - {01B0E2DB-D4E8-4FB7-ACF1-A25C9920123F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {01B0E2DB-D4E8-4FB7-ACF1-A25C9920123F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {01B0E2DB-D4E8-4FB7-ACF1-A25C9920123F}.Debug|x64.ActiveCfg = Debug|Any CPU - {01B0E2DB-D4E8-4FB7-ACF1-A25C9920123F}.Debug|x64.Build.0 = Debug|Any CPU - {01B0E2DB-D4E8-4FB7-ACF1-A25C9920123F}.Debug|x86.ActiveCfg = Debug|Any CPU - {01B0E2DB-D4E8-4FB7-ACF1-A25C9920123F}.Debug|x86.Build.0 = Debug|Any CPU - {01B0E2DB-D4E8-4FB7-ACF1-A25C9920123F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {01B0E2DB-D4E8-4FB7-ACF1-A25C9920123F}.Release|Any CPU.Build.0 = Release|Any CPU - {01B0E2DB-D4E8-4FB7-ACF1-A25C9920123F}.Release|x64.ActiveCfg = Release|Any CPU - {01B0E2DB-D4E8-4FB7-ACF1-A25C9920123F}.Release|x64.Build.0 = Release|Any CPU - {01B0E2DB-D4E8-4FB7-ACF1-A25C9920123F}.Release|x86.ActiveCfg = Release|Any CPU - {01B0E2DB-D4E8-4FB7-ACF1-A25C9920123F}.Release|x86.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {F8F12835-C9A3-4982-9D07-F3C882536CA6} - EndGlobalSection -EndGlobal diff --git a/src/Tizen.Security.DevicePolicyManager/Tizen.Security.DevicePolicyManager/BluetoothPolicy.cs b/src/Tizen.Security.DevicePolicyManager/Tizen.Security.DevicePolicyManager/BluetoothPolicy.cs deleted file mode 100644 index 4284236c752..00000000000 --- a/src/Tizen.Security.DevicePolicyManager/Tizen.Security.DevicePolicyManager/BluetoothPolicy.cs +++ /dev/null @@ -1,283 +0,0 @@ -/* - * Copyright (c) 2018 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 - */ - -using System; - -namespace Tizen.Security.DevicePolicyManager -{ - /// - /// The BluetoothPolicy provides methods to manage Bluetooth policies. - /// - /// 6 - /// The BluetoothPolicy is created by . and the DevicePolicyManager instance must exists when using the BluetoothPolicy. - [Obsolete("Deprecated since API level 11.")] - public class BluetoothPolicy : DevicePolicy, IDisposable - { - /// - /// The Bluetooth policy name. This represents . - /// - /// This is used in . - /// 6 - [Obsolete("Deprecated since API level 11.")] - public static readonly string BluetoothPolicyName = "Bluetooth"; - - /// - /// The Bluetooth Tethering policy name. This represents . - /// - /// This is used in . - /// 6 - [Obsolete("Deprecated since API level 11.")] - public static readonly string BluetoothTetheringPolicyName = "BluetoothTethering"; - - private readonly string _bluetoothPolicyName = "bluetooth"; - private readonly string _bluetoothTetheringPolicyName = "bluetooth_tethering"; - private int _bluetoothCallbackId; - private int _bluetoothTetheringCallbackId; - private bool _disposed = false; - - private Interop.DevicePolicyManager.PolicyChangedCallback _bluetoothPolicyChangedCallback; - private Interop.DevicePolicyManager.PolicyChangedCallback _bluetoothTetheringPolicyChangedCallback; - private EventHandler _bluetoothPolicyChanged; - private EventHandler _bluetoothTetheringPolicyChanged; - - internal BluetoothPolicy(DevicePolicyManager dpm) : base(dpm) - { - } - - /// - /// A Destructor of BluetoothPolicy. - /// - [Obsolete("Deprecated since API level 11.")] - ~BluetoothPolicy() - { - this.Dispose(false); - } - - /// - /// Gets whether the the bluetooth state change is allowed or not. - /// - /// true if the change is allowed, false otherwise. The default value is true. - /// 6 - [Obsolete("Deprecated since API level 11.")] - public bool IsBluetoothAllowed - { - get - { - int state; - int ret = Interop.DevicePolicyManager.RestrictionGetBluetoothModeChangeState(_dpm.GetHandle(), out state); - if (ret != (int)Interop.DevicePolicyManager.ErrorCode.None) - { - Log.Error(Globals.LogTag, $"Failed to get bluetooth policy {ret}"); - return true; - } - - return state == 1; - } - } - - /// - /// Gets whether the bluetooth tethering state change is allowed or not. - /// - /// true if the change is allowed, false otherwise. The default value is true. - /// 6 - [Obsolete("Deprecated since API level 11.")] - public bool IsBluetoothTetheringAllowed - { - get - { - int state; - int ret = Interop.DevicePolicyManager.RestrictionGetBluetoothTetheringState(_dpm.GetHandle(), out state); - if (ret != (int)Interop.DevicePolicyManager.ErrorCode.None) - { - Log.Error(Globals.LogTag, $"Failed to get bluetooth tethering policy {ret}"); - return true; - } - - return state == 1; - } - } - - /// - /// Releases any unmanaged resources used by this object. - /// - [Obsolete("Deprecated since API level 11.")] - public void Dispose() - { - this.Dispose(true); - GC.SuppressFinalize(this); - } - - /// - /// Releases any unmanaged resources used by this object. Can also dispose any other disposable objects. - /// - /// If true, disposes any disposable objects. If false, does not dispose disposable objects. - [Obsolete("Deprecated since API level 11.")] - protected virtual void Dispose(bool disposing) - { - if (!_disposed) - { - if (disposing) - { - // to be used if there are any other disposable objects - } - - if (_bluetoothCallbackId != 0) - { - try - { - RemoveBluetoothPolicyChangedCallback(); - } - catch (Exception e) - { - Log.Error(Globals.LogTag, e.ToString()); - } - } - - if (_bluetoothTetheringCallbackId != 0) - { - try - { - RemoveBluetoothTetheringPolicyChangedCallback(); - } - catch (Exception e) - { - Log.Error(Globals.LogTag, e.ToString()); - } - } - - _disposed = true; - } - } - - /// - /// The BluetoothPolicyChanged event is raised when the Bluetooth policy is changed. - /// - /// This event will be removed automatically when BluetoothPolicy is destroyed. - /// 6 - [Obsolete("Deprecated since API level 11.")] - public event EventHandler BluetoothPolicyChanged - { - add - { - if (_bluetoothPolicyChanged == null) - { - AddBluetoothPolicyChangedCallback(); - } - - _bluetoothPolicyChanged += value; - } - - remove - { - _bluetoothPolicyChanged -= value; - if (_bluetoothPolicyChanged == null) - { - RemoveBluetoothPolicyChangedCallback(); - } - } - } - - private void AddBluetoothPolicyChangedCallback() - { - if (_bluetoothPolicyChangedCallback == null) - { - _bluetoothPolicyChangedCallback = (string name, string state, IntPtr userData) => - { - _bluetoothPolicyChanged?.Invoke(this, new PolicyChangedEventArgs(BluetoothPolicyName, state)); - }; - } - - int ret = Interop.DevicePolicyManager.AddPolicyChangedCallback(_dpm.GetHandle(), _bluetoothPolicyName, _bluetoothPolicyChangedCallback, IntPtr.Zero, out _bluetoothCallbackId); - if (ret != (int)Interop.DevicePolicyManager.ErrorCode.None) - { - Log.Error(Globals.LogTag, $"Failed to add policy changed callback, name {_bluetoothPolicyName}, ret : {ret}"); - throw DevicePolicyManagerErrorFactory.CreateException(ret); - } - } - - private void RemoveBluetoothPolicyChangedCallback() - { - int ret = Interop.DevicePolicyManager.RemovePolicyChangedCallback(_dpm.GetHandle(), _bluetoothCallbackId); - if (ret != (int)Interop.DevicePolicyManager.ErrorCode.None) - { - Log.Error(Globals.LogTag, $"Failed to remove policy changed callback, name {_bluetoothPolicyName}, ret : {ret}"); - throw DevicePolicyManagerErrorFactory.CreateException(ret); - } - - _bluetoothPolicyChangedCallback = null; - _bluetoothCallbackId = 0; - } - - /// - /// The BluetoothTetheringPolicyChanged event is raised when the Bluetooth tethering policy is changed. - /// - /// This event will be removed automatically when BluetoothPolicy is destroyed. - /// 6 - [Obsolete("Deprecated since API level 11.")] - public event EventHandler BluetoothTetheringPolicyChanged - { - add - { - if (_bluetoothTetheringPolicyChanged == null) - { - AddBluetoothTetheringPolicyChangedCallback(); - } - - _bluetoothTetheringPolicyChanged += value; - } - - remove - { - _bluetoothTetheringPolicyChanged -= value; - if (_bluetoothTetheringPolicyChanged == null) - { - RemoveBluetoothTetheringPolicyChangedCallback(); - } - } - } - - private void AddBluetoothTetheringPolicyChangedCallback() - { - if (_bluetoothTetheringPolicyChangedCallback == null) - { - _bluetoothTetheringPolicyChangedCallback = (string name, string state, IntPtr userData) => - { - _bluetoothTetheringPolicyChanged?.Invoke(this, new PolicyChangedEventArgs(BluetoothTetheringPolicyName, state)); - }; - } - - int ret = Interop.DevicePolicyManager.AddPolicyChangedCallback(_dpm.GetHandle(), _bluetoothTetheringPolicyName, _bluetoothTetheringPolicyChangedCallback, IntPtr.Zero, out _bluetoothTetheringCallbackId); - if (ret != (int)Interop.DevicePolicyManager.ErrorCode.None) - { - Log.Error(Globals.LogTag, $"Failed to add policy changed callback, name {_bluetoothTetheringPolicyName}, ret : {ret}"); - throw DevicePolicyManagerErrorFactory.CreateException(ret); - } - } - - private void RemoveBluetoothTetheringPolicyChangedCallback() - { - int ret = Interop.DevicePolicyManager.RemovePolicyChangedCallback(_dpm.GetHandle(), _bluetoothTetheringCallbackId); - if (ret != (int)Interop.DevicePolicyManager.ErrorCode.None) - { - Log.Error(Globals.LogTag, $"Failed to remove policy changed callback, name {_bluetoothTetheringPolicyName}, ret : {ret}"); - throw DevicePolicyManagerErrorFactory.CreateException(ret); - } - - _bluetoothTetheringPolicyChangedCallback = null; - _bluetoothTetheringCallbackId = 0; - } - } -} \ No newline at end of file diff --git a/src/Tizen.Security.DevicePolicyManager/Tizen.Security.DevicePolicyManager/BrowserPolicy.cs b/src/Tizen.Security.DevicePolicyManager/Tizen.Security.DevicePolicyManager/BrowserPolicy.cs deleted file mode 100644 index d158aebd94e..00000000000 --- a/src/Tizen.Security.DevicePolicyManager/Tizen.Security.DevicePolicyManager/BrowserPolicy.cs +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Copyright (c) 2018 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 - */ - -using System; - -namespace Tizen.Security.DevicePolicyManager -{ - /// - /// The BrowserPolicy provides methods to manage browser policies. - /// - /// 6 - /// The BrowserPolicy is created by . and the DevicePolicyManager instance must exists when using the BrowserPolicy. - [Obsolete("Deprecated since API level 11.")] - public class BrowserPolicy : DevicePolicy, IDisposable - { - /// - /// The Browser policy name. This represents . - /// - /// This is used in . - /// 6 - [Obsolete("Deprecated since API level 11.")] - public static readonly string BrowserPolicyName = "Browser"; - - private readonly string _browserPolicyName = "browser"; - private int _browserCallbackId; - private bool _disposed = false; - - private Interop.DevicePolicyManager.PolicyChangedCallback _browserPolicyChangedCallback; - private EventHandler _browserPolicyChanged; - - internal BrowserPolicy(DevicePolicyManager dpm) : base(dpm) - { - } - - /// - /// A Destructor of BrowserPolicy. - /// - [Obsolete("Deprecated since API level 11.")] - ~BrowserPolicy() - { - this.Dispose(false); - } - - /// - /// Gets whether the use of web browser is allowed or not. - /// - /// true if the use of web browser is allowed, false otherwise. The default value is true. - /// 6 - [Obsolete("Deprecated since API level 11.")] - public bool IsBrowserAllowed - { - get - { - int state; - int ret = Interop.DevicePolicyManager.RestrictionGetBrowserState(_dpm.GetHandle(), out state); - if (ret != (int)Interop.DevicePolicyManager.ErrorCode.None) - { - Log.Error(Globals.LogTag, $"Failed to get browser policy {ret}"); - return true; - } - - return state == 1; - } - } - - /// - /// Releases any unmanaged resources used by this object. - /// - [Obsolete("Deprecated since API level 11.")] - public void Dispose() - { - this.Dispose(true); - GC.SuppressFinalize(this); - } - - /// - /// Releases any unmanaged resources used by this object. Can also dispose any other disposable objects. - /// - /// If true, disposes any disposable objects. If false, does not dispose disposable objects. - [Obsolete("Deprecated since API level 11.")] - protected virtual void Dispose(bool disposing) - { - if (!_disposed) - { - if (disposing) - { - // to be used if there are any other disposable objects - } - - if (_browserCallbackId != 0) - { - try - { - RemoveBrowserPolicyChangedCallback(); - } - catch (Exception e) - { - Log.Error(Globals.LogTag, e.ToString()); - } - } - - _disposed = true; - } - } - - /// - /// The BrowserPolicyChanged event is raised when the browser policy is changed. - /// - /// This event will be removed automatically when BrowserPolicy is destroyed. - /// 6 - [Obsolete("Deprecated since API level 11.")] - public event EventHandler BrowserPolicyChanged - { - add - { - if (_browserPolicyChanged == null) - { - AddBrowserPolicyChangedCallback(); - } - - _browserPolicyChanged += value; - } - - remove - { - _browserPolicyChanged -= value; - if (_browserPolicyChanged == null) - { - RemoveBrowserPolicyChangedCallback(); - } - } - } - - private void AddBrowserPolicyChangedCallback() - { - if (_browserPolicyChangedCallback == null) - { - _browserPolicyChangedCallback = (string name, string state, IntPtr userData) => - { - _browserPolicyChanged?.Invoke(this, new PolicyChangedEventArgs(BrowserPolicyName, state)); - }; - } - - int ret = Interop.DevicePolicyManager.AddPolicyChangedCallback(_dpm.GetHandle(), _browserPolicyName, _browserPolicyChangedCallback, IntPtr.Zero, out _browserCallbackId); - if (ret != (int)Interop.DevicePolicyManager.ErrorCode.None) - { - Log.Error(Globals.LogTag, $"Failed to add policy changed callback, name {_browserPolicyName}, ret : {ret}"); - throw DevicePolicyManagerErrorFactory.CreateException(ret); - } - } - - private void RemoveBrowserPolicyChangedCallback() - { - int ret = Interop.DevicePolicyManager.RemovePolicyChangedCallback(_dpm.GetHandle(), _browserCallbackId); - if (ret != (int)Interop.DevicePolicyManager.ErrorCode.None) - { - Log.Error(Globals.LogTag, $"Failed to remove policy changed callback, name {_browserPolicyName}, ret : {ret}"); - throw DevicePolicyManagerErrorFactory.CreateException(ret); - } - - _browserPolicyChangedCallback = null; - _browserCallbackId = 0; - } - } -} diff --git a/src/Tizen.Security.DevicePolicyManager/Tizen.Security.DevicePolicyManager/DevicePolicy.cs b/src/Tizen.Security.DevicePolicyManager/Tizen.Security.DevicePolicyManager/DevicePolicy.cs deleted file mode 100644 index 3020fce4039..00000000000 --- a/src/Tizen.Security.DevicePolicyManager/Tizen.Security.DevicePolicyManager/DevicePolicy.cs +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2018 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 - */ - -using System; - -namespace Tizen.Security.DevicePolicyManager -{ - /// - /// The abstract class for Policy instances. - /// - /// 6 - [Obsolete("Deprecated since API level 11.")] - public abstract class DevicePolicy - { - protected internal readonly DevicePolicyManager _dpm; - - internal DevicePolicy(DevicePolicyManager dpm) - { - _dpm = dpm; - } - } -} diff --git a/src/Tizen.Security.DevicePolicyManager/Tizen.Security.DevicePolicyManager/DevicePolicyManager.cs b/src/Tizen.Security.DevicePolicyManager/Tizen.Security.DevicePolicyManager/DevicePolicyManager.cs deleted file mode 100644 index c31add33dfe..00000000000 --- a/src/Tizen.Security.DevicePolicyManager/Tizen.Security.DevicePolicyManager/DevicePolicyManager.cs +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Copyright (c) 2018 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 - */ - -using System; -using System.Collections.Generic; -using Tizen.Internals.Errors; - -namespace Tizen.Security.DevicePolicyManager -{ - /// - /// The DevicePolicyManager provides the methods to create handle for device policy. - /// - /// 6 - [Obsolete("Deprecated since API level 11.")] - public class DevicePolicyManager : IDisposable - { - private IntPtr _handle = IntPtr.Zero; - private bool _disposed = false; - - /// - /// A constructor of DevicePolicyManager that creates handle. - /// - /// 6 - /// Thrown when connection refused or a memory error occurred. - [Obsolete("Deprecated since API level 11.")] - public DevicePolicyManager() - { - _handle = Interop.DevicePolicyManager.CreateHandle(); - var lastError = ErrorFacts.GetLastResult(); - if (lastError != (int)Interop.DevicePolicyManager.ErrorCode.None) - { - throw DevicePolicyManagerErrorFactory.CreateException(ErrorFacts.GetLastResult()); - } - } - - /// - /// Method to creates an instance of Device Policy. - /// - /// The generic type to create. - /// An instance of policy. - /// 6 - /// Thrown when failed to create instance of the policy. - [Obsolete("Deprecated since API level 11.")] - public T GetPolicy() where T : DevicePolicy - { - try - { - T policy = Activator.CreateInstance(typeof(T), - System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance, - null, new object[] { this }, null) as T; - return policy; - } - catch (Exception e) - { - Log.Error(Globals.LogTag, $"Failed to create policy. {e.Message}"); - throw new InvalidOperationException("Failed to create policy."); - } - } - - internal IntPtr GetHandle() - { - return _disposed ? IntPtr.Zero : _handle; - } - - /// - /// A Destructor of DevicePolicyManager. - /// - [Obsolete("Deprecated since API level 11.")] - ~DevicePolicyManager() - { - this.Dispose(false); - } - - /// - /// Releases any unmanaged resources used by this object. Can also dispose any other disposable objects. - /// - /// If true, disposes any disposable objects. If false, does not dispose disposable objects. - [Obsolete("Deprecated since API level 11.")] - protected virtual void Dispose(bool disposing) - { - if (!_disposed) - { - if (disposing) - { - // to be used if there are any other disposable objects - } - - if (_handle != IntPtr.Zero) - { - int ret = Interop.DevicePolicyManager.DestroyHandle(_handle); - if (ret != (int)Interop.DevicePolicyManager.ErrorCode.None) - { - Log.Error(Globals.LogTag, $"Failed to destroy handle {ret}"); - } - - _handle = IntPtr.Zero; - } - - _disposed = true; - } - } - - /// - /// Releases any unmanaged resources used by this object. - /// - [Obsolete("Deprecated since API level 11.")] - public void Dispose() - { - this.Dispose(true); - GC.SuppressFinalize(this); - } - } - - static internal class Globals - { - internal const string LogTag = "Tizen.Security.DPM"; - } - - internal static class DevicePolicyManagerErrorFactory - { - static internal Exception CreateException(int error) - { - Interop.DevicePolicyManager.ErrorCode errCode = (Interop.DevicePolicyManager.ErrorCode)error; - switch (errCode) - { - case Interop.DevicePolicyManager.ErrorCode.InvalidParameter: - return new ArgumentException("Invalid parameter"); - case Interop.DevicePolicyManager.ErrorCode.TimeOut: - return new TimeoutException("Timeout"); - case Interop.DevicePolicyManager.ErrorCode.PermissionDenied: - return new UnauthorizedAccessException("Permission Denied"); - case Interop.DevicePolicyManager.ErrorCode.OutOfMemory: - return new InvalidOperationException("Out of memory"); - case Interop.DevicePolicyManager.ErrorCode.ConnectionRefused: - return new InvalidOperationException("Connection refused"); - default: - return new InvalidOperationException("Unknown Error Code"); - } - } - } -} diff --git a/src/Tizen.Security.DevicePolicyManager/Tizen.Security.DevicePolicyManager/EmailPolicy.cs b/src/Tizen.Security.DevicePolicyManager/Tizen.Security.DevicePolicyManager/EmailPolicy.cs deleted file mode 100644 index b10a629e61b..00000000000 --- a/src/Tizen.Security.DevicePolicyManager/Tizen.Security.DevicePolicyManager/EmailPolicy.cs +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Copyright (c) 2018 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 - */ - -using System; - -namespace Tizen.Security.DevicePolicyManager -{ - /// - /// The EmailPolicy provides methods to manage email policies. - /// - /// 6 - /// The EmailPolicy is created by . and the DevicePolicyManager instance must exists when using the EmailPolicy. - [Obsolete("Deprecated since API level 11.")] - public class EmailPolicy : DevicePolicy, IDisposable - { - /// - /// The PopImap email policy name. This represents . - /// - /// This is used in . - /// 6 - [Obsolete("Deprecated since API level 11.")] - public static readonly string PopImapEmailPolicyName = "PopImapEmail"; - - private readonly string _popImapPolicyName = "popimap_email"; - private int _popImapCallbackId; - private bool _disposed = false; - - private Interop.DevicePolicyManager.PolicyChangedCallback _popImapPolicyChangedCallback; - private EventHandler _popImapPolicyChanged; - - internal EmailPolicy(DevicePolicyManager dpm) : base(dpm) - { - } - - /// - /// A Destructor of EmailPolicy. - /// - [Obsolete("Deprecated since API level 11.")] - ~EmailPolicy() - { - this.Dispose(false); - } - - /// - /// Gets whether the access to POP or IMAP email is allowed or not. - /// - /// true if the POP or IMAP email is allowed, false otherwise. The default value is true. - /// 6 - [Obsolete("Deprecated since API level 11.")] - public bool IsPopImapAllowed - { - get - { - int state; - int ret = Interop.DevicePolicyManager.RestrictionGetPopimapEmailState(_dpm.GetHandle(), out state); - if (ret != (int)Interop.DevicePolicyManager.ErrorCode.None) - { - Log.Error(Globals.LogTag, $"Failed to get popimap email policy {ret}"); - return true; - } - - return state == 1; - } - } - - /// - /// Releases any unmanaged resources used by this object. - /// - [Obsolete("Deprecated since API level 11.")] - public void Dispose() - { - this.Dispose(true); - GC.SuppressFinalize(this); - } - - /// - /// Releases any unmanaged resources used by this object. Can also dispose any other disposable objects. - /// - /// If true, disposes any disposable objects. If false, does not dispose disposable objects. - [Obsolete("Deprecated since API level 11.")] - protected virtual void Dispose(bool disposing) - { - if (!_disposed) - { - if (disposing) - { - // to be used if there are any other disposable objects - } - - if (_popImapCallbackId != 0) - { - try - { - RemovePopImapPolicyChangedCallback(); - } - catch (Exception e) - { - Log.Error(Globals.LogTag, e.ToString()); - } - } - - _disposed = true; - } - } - - /// - /// The PopImapPolicyChanged event is raised when the popimap-email policy is changed. - /// - /// This event will be removed automatically when EmailPolicy is destroyed. - /// 6 - [Obsolete("Deprecated since API level 11.")] - public event EventHandler PopImapPolicyChanged - { - add - { - if (_popImapPolicyChanged == null) - { - AddPopImapPolicyChangedCallback(); - } - - _popImapPolicyChanged += value; - } - - remove - { - _popImapPolicyChanged -= value; - if (_popImapPolicyChanged == null) - { - RemovePopImapPolicyChangedCallback(); - } - } - } - - private void AddPopImapPolicyChangedCallback() - { - if (_popImapPolicyChangedCallback == null) - { - _popImapPolicyChangedCallback = (string name, string state, IntPtr userData) => - { - _popImapPolicyChanged?.Invoke(this, new PolicyChangedEventArgs(PopImapEmailPolicyName, state)); - }; - } - - int ret = Interop.DevicePolicyManager.AddPolicyChangedCallback(_dpm.GetHandle(), _popImapPolicyName, _popImapPolicyChangedCallback, IntPtr.Zero, out _popImapCallbackId); - if (ret != (int)Interop.DevicePolicyManager.ErrorCode.None) - { - Log.Error(Globals.LogTag, $"Failed to add policy changed callback, name {_popImapPolicyName}, ret : {ret}"); - throw DevicePolicyManagerErrorFactory.CreateException(ret); - } - } - - private void RemovePopImapPolicyChangedCallback() - { - int ret = Interop.DevicePolicyManager.RemovePolicyChangedCallback(_dpm.GetHandle(), _popImapCallbackId); - if (ret != (int)Interop.DevicePolicyManager.ErrorCode.None) - { - Log.Error(Globals.LogTag, $"Failed to remove policy changed callback, name {_popImapPolicyName}, ret : {ret}"); - throw DevicePolicyManagerErrorFactory.CreateException(ret); - } - - _popImapPolicyChangedCallback = null; - _popImapCallbackId = 0; - } - } -} diff --git a/src/Tizen.Security.DevicePolicyManager/Tizen.Security.DevicePolicyManager/LocationPolicy.cs b/src/Tizen.Security.DevicePolicyManager/Tizen.Security.DevicePolicyManager/LocationPolicy.cs deleted file mode 100644 index c7c76beb688..00000000000 --- a/src/Tizen.Security.DevicePolicyManager/Tizen.Security.DevicePolicyManager/LocationPolicy.cs +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Copyright (c) 2018 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 - */ - -using System; - -namespace Tizen.Security.DevicePolicyManager -{ - /// - /// The LocationPolicy provides methods to manage location policies. - /// - /// 6 - /// The LocationPolicy is created by . and the DevicePolicyManager instance must exists when using the LocationPolicy. - [Obsolete("Deprecated since API level 11.")] - public class LocationPolicy : DevicePolicy, IDisposable - { - /// - /// The Location policy name. This represents . - /// - /// This is used in . - /// 6 - [Obsolete("Deprecated since API level 11.")] - public static readonly string LocationPolicyName = "Location"; - - private readonly string _locationPolicyName = "location"; - private int _locationCallbackId; - private bool _disposed = false; - - private Interop.DevicePolicyManager.PolicyChangedCallback _locationPolicyChangedCallback; - private EventHandler _locationPolicyChanged; - - internal LocationPolicy(DevicePolicyManager dpm) : base(dpm) - { - } - - /// - /// A Destructor of LocationPolicy. - /// - [Obsolete("Deprecated since API level 11.")] - ~LocationPolicy() - { - this.Dispose(false); - } - - /// - /// Gets whether user is allowed to change location state or not. - /// - /// true if the location state change is allowed, false otherwise. The default value is true. - /// 6 - [Obsolete("Deprecated since API level 11.")] - public bool IsLocationAllowed - { - get - { - int state; - int ret = Interop.DevicePolicyManager.RestrictionGetLocationState(_dpm.GetHandle(), out state); - if (ret != (int)Interop.DevicePolicyManager.ErrorCode.None) - { - Log.Error(Globals.LogTag, $"Failed to get location policy {ret}"); - return true; - } - - return state == 1; - } - } - - /// - /// Releases any unmanaged resources used by this object. - /// - [Obsolete("Deprecated since API level 11.")] - public void Dispose() - { - this.Dispose(true); - GC.SuppressFinalize(this); - } - - /// - /// Releases any unmanaged resources used by this object. Can also dispose any other disposable objects. - /// - /// If true, disposes any disposable objects. If false, does not dispose disposable objects. - [Obsolete("Deprecated since API level 11.")] - protected virtual void Dispose(bool disposing) - { - if (!_disposed) - { - if (disposing) - { - // to be used if there are any other disposable objects - } - - if (_locationCallbackId != 0) - { - try - { - RemoveLocationPolicyChangedCallback(); - } - catch (Exception e) - { - Log.Error(Globals.LogTag, e.ToString()); - } - } - - _disposed = true; - } - } - - /// - /// The LocationPolicyChanged event is raised when the location policy is changed. - /// - /// This event will be removed automatically when LocationPolicy is destroyed. - /// 6 - [Obsolete("Deprecated since API level 11.")] - public event EventHandler LocationPolicyChanged - { - add - { - if (_locationPolicyChanged == null) - { - AddLocationPolicyChangedCallback(); - } - - _locationPolicyChanged += value; - } - - remove - { - _locationPolicyChanged -= value; - if (_locationPolicyChanged == null) - { - RemoveLocationPolicyChangedCallback(); - } - } - } - - private void AddLocationPolicyChangedCallback() - { - if (_locationPolicyChangedCallback == null) - { - _locationPolicyChangedCallback = (string name, string state, IntPtr userData) => - { - _locationPolicyChanged?.Invoke(this, new PolicyChangedEventArgs(LocationPolicyName, state)); - }; - } - - int ret = Interop.DevicePolicyManager.AddPolicyChangedCallback(_dpm.GetHandle(), _locationPolicyName, _locationPolicyChangedCallback, IntPtr.Zero, out _locationCallbackId); - if (ret != (int)Interop.DevicePolicyManager.ErrorCode.None) - { - Log.Error(Globals.LogTag, $"Failed to add policy changed callback, name {_locationPolicyName}, ret : {ret}"); - throw DevicePolicyManagerErrorFactory.CreateException(ret); - } - } - - private void RemoveLocationPolicyChangedCallback() - { - int ret = Interop.DevicePolicyManager.RemovePolicyChangedCallback(_dpm.GetHandle(), _locationCallbackId); - if (ret != (int)Interop.DevicePolicyManager.ErrorCode.None) - { - Log.Error(Globals.LogTag, $"Failed to remove policy changed callback, name {_locationPolicyName}, ret : {ret}"); - throw DevicePolicyManagerErrorFactory.CreateException(ret); - } - - _locationPolicyChangedCallback = null; - _locationCallbackId = 0; - } - } -} \ No newline at end of file diff --git a/src/Tizen.Security.DevicePolicyManager/Tizen.Security.DevicePolicyManager/MediaPolicy.cs b/src/Tizen.Security.DevicePolicyManager/Tizen.Security.DevicePolicyManager/MediaPolicy.cs deleted file mode 100644 index 2de1b34fc7d..00000000000 --- a/src/Tizen.Security.DevicePolicyManager/Tizen.Security.DevicePolicyManager/MediaPolicy.cs +++ /dev/null @@ -1,283 +0,0 @@ -/* - * Copyright (c) 2018 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 - */ - -using System; - -namespace Tizen.Security.DevicePolicyManager -{ - /// - /// The MediaPolicy provides methods to manage media policies. - /// - /// 6 - /// The MediaPolicy is created by . and the DevicePolicyManager instance must exists when using the MediaPolicy. - [Obsolete("Deprecated since API level 11.")] - public class MediaPolicy : DevicePolicy, IDisposable - { - /// - /// The Camera policy name. This represents . - /// - /// This is used in . - /// 6 - [Obsolete("Deprecated since API level 11.")] - public static readonly string CameraPolicyName = "Camera"; - - /// - /// The Microphone policy name. This represents . - /// - /// This is used in . - /// 6 - [Obsolete("Deprecated since API level 11.")] - public static readonly string MicrophonePolicyName = "Microphone"; - - private readonly string _cameraPolicyName = "camera"; - private readonly string _microphonePolicyName = "microphone"; - private int _cameraCallbackId; - private int _microphoneCallbackId; - private bool _disposed = false; - - private Interop.DevicePolicyManager.PolicyChangedCallback _cameraPolicyChangedCallback; - private Interop.DevicePolicyManager.PolicyChangedCallback _microphonePolicyChangedCallback; - private EventHandler _cameraPolicyChanged; - private EventHandler _microphonePolicyChanged; - - internal MediaPolicy(DevicePolicyManager dpm) : base(dpm) - { - } - - /// - /// A Destructor of MediaPolicy. - /// - [Obsolete("Deprecated since API level 11.")] - ~MediaPolicy() - { - this.Dispose(false); - } - - /// - /// Gets whether the use of camera is allowed or not. - /// - /// true if the use of camera is allowed, false otherwise. The default value is true. - /// 6 - [Obsolete("Deprecated since API level 11.")] - public bool IsCameraAllowed - { - get - { - int state; - int ret = Interop.DevicePolicyManager.RestrictionGetCameraState(_dpm.GetHandle(), out state); - if (ret != (int)Interop.DevicePolicyManager.ErrorCode.None) - { - Log.Error(Globals.LogTag, $"Failed to get camera policy {ret}"); - return true; - } - - return state == 1; - } - } - - /// - /// Gets whether the use of microphone is allowed or not. - /// - /// true if the use of microphone is allowed, false otherwise. The default value is true. - /// 6 - [Obsolete("Deprecated since API level 11.")] - public bool IsMicrophoneAllowed - { - get - { - int state; - int ret = Interop.DevicePolicyManager.RestrictionGetMicrophoneState(_dpm.GetHandle(), out state); - if (ret != (int)Interop.DevicePolicyManager.ErrorCode.None) - { - Log.Error(Globals.LogTag, $"Failed to get microphone policy {ret}"); - return true; - } - - return state == 1; - } - } - - /// - /// Releases any unmanaged resources used by this object. - /// - [Obsolete("Deprecated since API level 11.")] - public void Dispose() - { - this.Dispose(true); - GC.SuppressFinalize(this); - } - - /// - /// Releases any unmanaged resources used by this object. Can also dispose any other disposable objects. - /// - /// If true, disposes any disposable objects. If false, does not dispose disposable objects. - [Obsolete("Deprecated since API level 11.")] - protected virtual void Dispose(bool disposing) - { - if (!_disposed) - { - if (disposing) - { - // to be used if there are any other disposable objects - } - - if (_cameraCallbackId != 0) - { - try - { - RemoveCameraPolicyChangedCallback(); - } - catch (Exception e) - { - Log.Error(Globals.LogTag, e.ToString()); - } - } - - if (_microphoneCallbackId != 0) - { - try - { - RemoveMicrophonePolicyChangedCallback(); - } - catch (Exception e) - { - Log.Error(Globals.LogTag, e.ToString()); - } - } - - _disposed = true; - } - } - - /// - /// The CameraPolicyChanged event is raised when the camera policy is changed. - /// - /// This event will be removed automatically when MediaPolicy is destroyed. - /// 6 - [Obsolete("Deprecated since API level 11.")] - public event EventHandler CameraPolicyChanged - { - add - { - if (_cameraPolicyChanged == null) - { - AddCameraPolicyChangedCallback(); - } - - _cameraPolicyChanged += value; - } - - remove - { - _cameraPolicyChanged -= value; - if (_cameraPolicyChanged == null) - { - RemoveCameraPolicyChangedCallback(); - } - } - } - - private void AddCameraPolicyChangedCallback() - { - if (_cameraPolicyChangedCallback == null) - { - _cameraPolicyChangedCallback = (string name, string state, IntPtr userData) => - { - _cameraPolicyChanged?.Invoke(this, new PolicyChangedEventArgs(CameraPolicyName, state)); - }; - } - - int ret = Interop.DevicePolicyManager.AddPolicyChangedCallback(_dpm.GetHandle(), _cameraPolicyName, _cameraPolicyChangedCallback, IntPtr.Zero, out _cameraCallbackId); - if (ret != (int)Interop.DevicePolicyManager.ErrorCode.None) - { - Log.Error(Globals.LogTag, $"Failed to add policy changed callback, name {_cameraPolicyName}, ret : {ret}"); - throw DevicePolicyManagerErrorFactory.CreateException(ret); - } - } - - private void RemoveCameraPolicyChangedCallback() - { - int ret = Interop.DevicePolicyManager.RemovePolicyChangedCallback(_dpm.GetHandle(), _cameraCallbackId); - if (ret != (int)Interop.DevicePolicyManager.ErrorCode.None) - { - Log.Error(Globals.LogTag, $"Failed to remove policy changed callback, name {_cameraPolicyName}, ret : {ret}"); - throw DevicePolicyManagerErrorFactory.CreateException(ret); - } - - _cameraPolicyChangedCallback = null; - _cameraCallbackId = 0; - } - - /// - /// The MicrophonePolicyChanged event is raised when the microphone policy is changed. - /// - /// This event will be removed automatically when MediaPolicy is destroyed. - /// 6 - [Obsolete("Deprecated since API level 11.")] - public event EventHandler MicrophonePolicyChanged - { - add - { - if (_microphonePolicyChanged == null) - { - AddMicrophonePolicyChangedCallback(); - } - - _microphonePolicyChanged += value; - } - - remove - { - _microphonePolicyChanged -= value; - if (_microphonePolicyChanged == null) - { - RemoveMicrophonePolicyChangedCallback(); - } - } - } - - private void AddMicrophonePolicyChangedCallback() - { - if (_microphonePolicyChangedCallback == null) - { - _microphonePolicyChangedCallback = (string name, string state, IntPtr userData) => - { - _microphonePolicyChanged?.Invoke(this, new PolicyChangedEventArgs(MicrophonePolicyName, state)); - }; - } - - int ret = Interop.DevicePolicyManager.AddPolicyChangedCallback(_dpm.GetHandle(), _microphonePolicyName, _microphonePolicyChangedCallback, IntPtr.Zero, out _microphoneCallbackId); - if (ret != (int)Interop.DevicePolicyManager.ErrorCode.None) - { - Log.Error(Globals.LogTag, $"Failed to add policy changed callback, name {_microphonePolicyName}, ret : {ret}"); - throw DevicePolicyManagerErrorFactory.CreateException(ret); - } - } - - private void RemoveMicrophonePolicyChangedCallback() - { - int ret = Interop.DevicePolicyManager.RemovePolicyChangedCallback(_dpm.GetHandle(), _microphoneCallbackId); - if (ret != (int)Interop.DevicePolicyManager.ErrorCode.None) - { - Log.Error(Globals.LogTag, $"Failed to remove policy changed callback, name {_microphonePolicyName}, ret : {ret}"); - throw DevicePolicyManagerErrorFactory.CreateException(ret); - } - - _microphonePolicyChangedCallback = null; - _microphoneCallbackId = 0; - } - } -} \ No newline at end of file diff --git a/src/Tizen.Security.DevicePolicyManager/Tizen.Security.DevicePolicyManager/PasswordPolicy.cs b/src/Tizen.Security.DevicePolicyManager/Tizen.Security.DevicePolicyManager/PasswordPolicy.cs deleted file mode 100644 index fc027cd5cfb..00000000000 --- a/src/Tizen.Security.DevicePolicyManager/Tizen.Security.DevicePolicyManager/PasswordPolicy.cs +++ /dev/null @@ -1,199 +0,0 @@ -/* - * Copyright (c) 2018 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 - */ - -using System; - -namespace Tizen.Security.DevicePolicyManager -{ - /// - /// The PasswordPolicy provides methods to manage password policies. - /// - /// 6 - /// The PasswordPolicy is created by . and the DevicePolicyManager instance must exists when using the PasswordPolicy. - [Obsolete("Deprecated since API level 11.")] - public class PasswordPolicy : DevicePolicy - { - internal PasswordPolicy(DevicePolicyManager dpm) : base(dpm) - { - } - - /// - /// Gets the number of days password expires. - /// - /// Number of days after which the password expires. The default value is maximum of int. - /// 6 - /// http://tizen.org/privilege/dpm.password - /// partner - [Obsolete("Deprecated since API level 11.")] - public int DaysToExpiration - { - get - { - int value = int.MaxValue; - int ret = Interop.DevicePolicyManager.PasswordGetExpires(_dpm.GetHandle(), out value); - if (ret != (int)Interop.DevicePolicyManager.ErrorCode.None) - { - Log.Error(Globals.LogTag, $"Failed to get password expires policy {ret}"); - } - - return value; - } - } - - /// - /// Gets the number of min password history to avoid previous password. - /// - /// Number of previous passwords which cannot be used when settings a new password. The default value is 0. - /// 6 - /// http://tizen.org/privilege/dpm.password - /// partner - [Obsolete("Deprecated since API level 11.")] - public int MinimumPreviousHistory - { - get - { - int value = 0; - int ret = Interop.DevicePolicyManager.PasswordGetHistory(_dpm.GetHandle(), out value); - if (ret != (int)Interop.DevicePolicyManager.ErrorCode.None) - { - Log.Error(Globals.LogTag, $"Failed to get password history policy {ret}"); - } - - return value; - } - } - - /// - /// Gets the maximum number of seconds of inactivity time before the screen timeout occurs. - /// - /// Maximum inactivity time for device lock. The default value is maximum of int. - /// 6 - /// http://tizen.org/privilege/dpm.password - /// partner - [Obsolete("Deprecated since API level 11.")] - public int MaxInactivityTimeDeviceLock - { - get - { - int value = int.MaxValue; - int ret = Interop.DevicePolicyManager.PasswordGetMaxInactivityTimeDeviceLock(_dpm.GetHandle(), out value); - if (ret != (int)Interop.DevicePolicyManager.ErrorCode.None) - { - Log.Error(Globals.LogTag, $"Failed to get password maximum inactivity time policy {ret}"); - } - - return value; - } - } - - /// - /// Gets maximum number of failed attempts before device is wiped. - /// If user fails the last attempt, device will be wiped. - /// - /// Maximum count for failed passwords. The default value is maximum of int. - /// 6 - /// http://tizen.org/privilege/dpm.password - /// partner - [Obsolete("Deprecated since API level 11.")] - public int MaximumFailedAttemptsForWipe - { - get - { - int value = int.MaxValue; - int ret = Interop.DevicePolicyManager.PasswordGetMaximumFailedAttemptsForWipe(_dpm.GetHandle(), out value); - if (ret != (int)Interop.DevicePolicyManager.ErrorCode.None) - { - Log.Error(Globals.LogTag, $"Failed to get password maximum failed attempts policy {ret}"); - } - - return value; - } - } - - /// - /// Gets minimum complex char in password. - /// Complex characters are all non-alphabetic characters; that is, numbers and symbols. - /// - /// Number of minimum complex char in password. The default value is 0. - /// 6 - /// http://tizen.org/privilege/dpm.password - /// partner - [Obsolete("Deprecated since API level 11.")] - public int MinimumRequiredComplexChars - { - get - { - int value = 0; - int ret = Interop.DevicePolicyManager.PasswordGetMinComplexChars(_dpm.GetHandle(), out value); - if (ret != (int)Interop.DevicePolicyManager.ErrorCode.None) - { - Log.Error(Globals.LogTag, $"Failed to get password min complext chars policy {ret}"); - } - - return value; - } - } - - /// - /// Gets the minimum allowed password length. - /// - /// Allowed minimum password length. The default value is 0. - /// 6 - /// http://tizen.org/privilege/dpm.password - /// partner - [Obsolete("Deprecated since API level 11.")] - public int MinimumLength - { - get - { - int value = 0; - int ret = Interop.DevicePolicyManager.PasswordGetMinimumLength(_dpm.GetHandle(), out value); - if (ret != (int)Interop.DevicePolicyManager.ErrorCode.None) - { - Log.Error(Globals.LogTag, $"Failed to get password min length policy {ret}"); - } - - return value; - } - } - - /// - /// Gets password quality. - /// An administrator can get the password restrictions it is imposing. - /// - /// Password quality type, values of PasswordQuality. The default value is PasswordQuality UNSPECIFIED. - /// - /// 6 - /// http://tizen.org/privilege/dpm.password - /// partner - [Obsolete("Deprecated since API level 11.")] - public PasswordQuality Quality - { - get - { - int quality; - int ret = Interop.DevicePolicyManager.PasswordGetQuality(_dpm.GetHandle(), out quality); - if (ret != (int)Interop.DevicePolicyManager.ErrorCode.None) - { - Log.Error(Globals.LogTag, $"Failed to get password quality policy {ret}"); - return PasswordQuality.Unspecified; - } - - return (PasswordQuality)quality; - } - } - } -} diff --git a/src/Tizen.Security.DevicePolicyManager/Tizen.Security.DevicePolicyManager/PasswordQuality.cs b/src/Tizen.Security.DevicePolicyManager/Tizen.Security.DevicePolicyManager/PasswordQuality.cs deleted file mode 100644 index dfd891c60a3..00000000000 --- a/src/Tizen.Security.DevicePolicyManager/Tizen.Security.DevicePolicyManager/PasswordQuality.cs +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2018 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 - */ - -using System; - -namespace Tizen.Security.DevicePolicyManager -{ - /// - /// Enumeration for dpm password quality type - /// - /// 6 - [Obsolete("Deprecated since API level 11.")] - public enum PasswordQuality - { - /// - /// No requirements for password. - /// - /// 6 - Unspecified = 0x00, - /// - /// EAS(Exchange ActiveSync) requirement for simple password. - /// - /// 6 - Simple = 0x01, - /// - /// Some kind password required, but doesn't care what it is. - /// - /// 6 - Something = 0x10, - /// - /// Containing at least numeric character. - /// - /// 6 - Numeric = 0x20, - /// - /// Containing at least alphabetic (or other symbol) characters. - /// - /// 6 - Alphabetic = 0x40, - /// - /// Containing at least numeric and alphabetic characters. - /// - /// 6 - Alphanumeric = 0x80 - } -} diff --git a/src/Tizen.Security.DevicePolicyManager/Tizen.Security.DevicePolicyManager/PolicyChangedEventArgs.cs b/src/Tizen.Security.DevicePolicyManager/Tizen.Security.DevicePolicyManager/PolicyChangedEventArgs.cs deleted file mode 100644 index e56cf22e969..00000000000 --- a/src/Tizen.Security.DevicePolicyManager/Tizen.Security.DevicePolicyManager/PolicyChangedEventArgs.cs +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2018 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 - */ - -using System; - -namespace Tizen.Security.DevicePolicyManager -{ - /// - /// An extended EventArgs class contains the changed dpm policy state. - /// - /// 6 - [Obsolete("Deprecated since API level 11.")] - public class PolicyChangedEventArgs : EventArgs - { - internal PolicyChangedEventArgs(string name, string state) - { - PolicyName = name; - IsAllowed = state.Equals("allowed"); - } - - /// - /// Gets the name of the changed policy. - /// - /// Each policy that can raise event has the name. The policy name value is in each policy class. - [Obsolete("Deprecated since API level 11.")] - public string PolicyName { get; } - - /// - /// Gets the current state of the policy. - /// - [Obsolete("Deprecated since API level 11.")] - public bool IsAllowed { get; } - } -} diff --git a/src/Tizen.Security.DevicePolicyManager/Tizen.Security.DevicePolicyManager/StoragePolicy.cs b/src/Tizen.Security.DevicePolicyManager/Tizen.Security.DevicePolicyManager/StoragePolicy.cs deleted file mode 100644 index 2cda88e9a6b..00000000000 --- a/src/Tizen.Security.DevicePolicyManager/Tizen.Security.DevicePolicyManager/StoragePolicy.cs +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Copyright (c) 2018 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 - */ - -using System; - -namespace Tizen.Security.DevicePolicyManager -{ - /// - /// The StoragePolicy provides methods to manage storage policies. - /// - /// 6 - /// The StoragePolicy is created by . and the DevicePolicyManager instance must exists when using the StoragePolicy. - [Obsolete("Deprecated since API level 11.")] - public class StoragePolicy : DevicePolicy, IDisposable - { - /// - /// The External storage policy name. This represents . - /// - /// This is used in . - /// 6 - [Obsolete("Deprecated since API level 11.")] - public static readonly string ExternalStoragePolicyName = "ExternalStorage"; - - private readonly string _externalStoragePolicyName = "external_storage"; - private int _externalStorageCallbackId; - private bool _disposed = false; - - private Interop.DevicePolicyManager.PolicyChangedCallback _externalStoragePolicyChangedCallback; - private EventHandler _externalStoragePolicyChanged; - - internal StoragePolicy(DevicePolicyManager dpm) : base(dpm) - { - } - - /// - /// A Destructor of StoragePolicy. - /// - [Obsolete("Deprecated since API level 11.")] - ~StoragePolicy() - { - this.Dispose(false); - } - - /// - /// Gets whether the use of external storage is allowed or not. - /// - /// true if the use of external storage is allowed, false otherwise. The default value is true. - /// 6 - [Obsolete("Deprecated since API level 11.")] - public bool IsExternalStorageAllowed - { - get - { - int state; - int ret = Interop.DevicePolicyManager.RestrictionGetExternalStorageState(_dpm.GetHandle(), out state); - if (ret != (int)Interop.DevicePolicyManager.ErrorCode.None) - { - Log.Error(Globals.LogTag, $"Failed to get external storage policy {ret}"); - return true; - } - - return state == 1; - } - } - - /// - /// Releases any unmanaged resources used by this object. - /// - [Obsolete("Deprecated since API level 11.")] - public void Dispose() - { - this.Dispose(true); - GC.SuppressFinalize(this); - } - - /// - /// Releases any unmanaged resources used by this object. Can also dispose any other disposable objects. - /// - /// If true, disposes any disposable objects. If false, does not dispose disposable objects. - [Obsolete("Deprecated since API level 11.")] - protected virtual void Dispose(bool disposing) - { - if (!_disposed) - { - if (disposing) - { - // to be used if there are any other disposable objects - } - - if (_externalStorageCallbackId != 0) - { - try - { - RemoveExternalStoragePolicyChangedCallback(); - } - catch (Exception e) - { - Log.Error(Globals.LogTag, e.ToString()); - } - } - - _disposed = true; - } - } - - /// - /// The ExternalStoragePolicyChanged event is raised when the external storage policy is changed. - /// - /// This event will be removed automatically when StoragePolicy is destroyed. - /// 6 - [Obsolete("Deprecated since API level 11.")] - public event EventHandler ExternalStoragePolicyChanged - { - add - { - if (_externalStoragePolicyChanged == null) - { - AddExternalStoragePolicyChangedCallback(); - } - - _externalStoragePolicyChanged += value; - } - - remove - { - _externalStoragePolicyChanged -= value; - if (_externalStoragePolicyChanged == null) - { - RemoveExternalStoragePolicyChangedCallback(); - } - } - } - - private void AddExternalStoragePolicyChangedCallback() - { - if (_externalStoragePolicyChangedCallback == null) - { - _externalStoragePolicyChangedCallback = (string name, string state, IntPtr userData) => - { - _externalStoragePolicyChanged?.Invoke(this, new PolicyChangedEventArgs(ExternalStoragePolicyName, state)); - }; - } - - int ret = Interop.DevicePolicyManager.AddPolicyChangedCallback(_dpm.GetHandle(), _externalStoragePolicyName, _externalStoragePolicyChangedCallback, IntPtr.Zero, out _externalStorageCallbackId); - if (ret != (int)Interop.DevicePolicyManager.ErrorCode.None) - { - Log.Error(Globals.LogTag, $"Failed to add policy changed callback, name {_externalStoragePolicyName}, ret : {ret}"); - throw DevicePolicyManagerErrorFactory.CreateException(ret); - } - } - - private void RemoveExternalStoragePolicyChangedCallback() - { - int ret = Interop.DevicePolicyManager.RemovePolicyChangedCallback(_dpm.GetHandle(), _externalStorageCallbackId); - if (ret != (int)Interop.DevicePolicyManager.ErrorCode.None) - { - Log.Error(Globals.LogTag, $"Failed to remove policy changed callback, name {_externalStoragePolicyName}, ret : {ret}"); - throw DevicePolicyManagerErrorFactory.CreateException(ret); - } - - _externalStoragePolicyChangedCallback = null; - _externalStorageCallbackId = 0; - } - } -} \ No newline at end of file diff --git a/src/Tizen.Security.DevicePolicyManager/Tizen.Security.DevicePolicyManager/TelephonyPolicy.cs b/src/Tizen.Security.DevicePolicyManager/Tizen.Security.DevicePolicyManager/TelephonyPolicy.cs deleted file mode 100644 index 52a983546e3..00000000000 --- a/src/Tizen.Security.DevicePolicyManager/Tizen.Security.DevicePolicyManager/TelephonyPolicy.cs +++ /dev/null @@ -1,177 +0,0 @@ -/* - * Copyright (c) 2018 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 - */ - -using System; - -namespace Tizen.Security.DevicePolicyManager -{ - /// - /// The TelephonyPolicy provides methods to manage telephony policies. - /// - /// 6 - /// The TelephonyPolicy is created by . and the DevicePolicyManager instance must exists when using the TelephonyPolicy. - [Obsolete("Deprecated since API level 11.")] - public class TelephonyPolicy : DevicePolicy, IDisposable - { - /// - /// The Text messaging policy name. This represents . - /// - /// This is used in . - /// 6 - [Obsolete("Deprecated since API level 11.")] - public static readonly string MessagingPolicyName = "Messaging"; - - private readonly string _messagingPolicyName = "messaging"; - private int _messagingCallbackId; - private bool _disposed = false; - - private Interop.DevicePolicyManager.PolicyChangedCallback _messagingPolicyChangedCallback; - private EventHandler _messagingPolicyChanged; - - internal TelephonyPolicy(DevicePolicyManager dpm) : base(dpm) - { - } - - /// - /// A Destructor of TelephonyPolicy. - /// - [Obsolete("Deprecated since API level 11.")] - ~TelephonyPolicy() - { - this.Dispose(false); - } - - /// - /// Checks whether the text messaging is allowed or not. - /// - /// SIM identifier - /// true if the messaging is allowed, false otherwise. - /// 6 - /// Thrown when failed because of invalid parameter. - /// Thrown when failed because of timeout. - [Obsolete("Deprecated since API level 11.")] - public bool IsMessagingAllowed(string simId) - { - int state; - int ret = Interop.DevicePolicyManager.RestrictionGetMessagingState(_dpm.GetHandle(), simId, out state); - if (ret != (int)Interop.DevicePolicyManager.ErrorCode.None) - { - throw DevicePolicyManagerErrorFactory.CreateException(ret); - } - - return state == 1; - } - - /// - /// Releases any unmanaged resources used by this object. - /// - [Obsolete("Deprecated since API level 11.")] - public void Dispose() - { - this.Dispose(true); - GC.SuppressFinalize(this); - } - - /// - /// Releases any unmanaged resources used by this object. Can also dispose any other disposable objects. - /// - /// If true, disposes any disposable objects. If false, does not dispose disposable objects. - [Obsolete("Deprecated since API level 11.")] - protected virtual void Dispose(bool disposing) - { - if (!_disposed) - { - if (disposing) - { - // to be used if there are any other disposable objects - } - - if (_messagingCallbackId != 0) - { - try - { - RemoveMessagingPolicyChangedCallback(); - } - catch (Exception e) - { - Log.Error(Globals.LogTag, e.ToString()); - } - } - - _disposed = true; - } - } - - /// - /// The MessagingPolicyChanged event is raised when the messaging policy is changed. - /// - /// This event will be removed automatically when TelephonyPolicy is destroyed. - /// 6 - [Obsolete("Deprecated since API level 11.")] - public event EventHandler MessagingPolicyChanged - { - add - { - if (_messagingPolicyChanged == null) - { - AddMessagingPolicyChangedCallback(); - } - - _messagingPolicyChanged += value; - } - - remove - { - _messagingPolicyChanged -= value; - if (_messagingPolicyChanged == null) - { - RemoveMessagingPolicyChangedCallback(); - } - } - } - - private void AddMessagingPolicyChangedCallback() - { - if (_messagingPolicyChangedCallback == null) - { - _messagingPolicyChangedCallback = (string name, string state, IntPtr userData) => - { - _messagingPolicyChanged?.Invoke(this, new PolicyChangedEventArgs(MessagingPolicyName, state)); - }; - } - - int ret = Interop.DevicePolicyManager.AddPolicyChangedCallback(_dpm.GetHandle(), _messagingPolicyName, _messagingPolicyChangedCallback, IntPtr.Zero, out _messagingCallbackId); - if (ret != (int)Interop.DevicePolicyManager.ErrorCode.None) - { - Log.Error(Globals.LogTag, $"Failed to add policy changed callback, name {_messagingPolicyName}, ret : {ret}"); - throw DevicePolicyManagerErrorFactory.CreateException(ret); - } - } - - private void RemoveMessagingPolicyChangedCallback() - { - int ret = Interop.DevicePolicyManager.RemovePolicyChangedCallback(_dpm.GetHandle(), _messagingCallbackId); - if (ret != (int)Interop.DevicePolicyManager.ErrorCode.None) - { - Log.Error(Globals.LogTag, $"Failed to remove policy changed callback, name {_messagingPolicyName}, ret : {ret}"); - throw DevicePolicyManagerErrorFactory.CreateException(ret); - } - - _messagingPolicyChangedCallback = null; - _messagingCallbackId = 0; - } - } -} diff --git a/src/Tizen.Security.DevicePolicyManager/Tizen.Security.DevicePolicyManager/UsbPolicy.cs b/src/Tizen.Security.DevicePolicyManager/Tizen.Security.DevicePolicyManager/UsbPolicy.cs deleted file mode 100644 index e3a75c4d59a..00000000000 --- a/src/Tizen.Security.DevicePolicyManager/Tizen.Security.DevicePolicyManager/UsbPolicy.cs +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Copyright (c) 2018 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 - */ - -using System; - -namespace Tizen.Security.DevicePolicyManager -{ - /// - /// The UsbPolicy provides methods to manage usb policies. - /// - /// 6 - /// The UsbPolicy is created by . and the DevicePolicyManager instance must exists when using the UsbPolicy. - [Obsolete("Deprecated since API level 11.")] - public class UsbPolicy : DevicePolicy, IDisposable - { - /// - /// The Usb tethering policy name. This represents . - /// - /// This is used in . - /// 6 - [Obsolete("Deprecated since API level 11.")] - public static readonly string UsbTetheringPolicyName = "UsbTethering"; - - private readonly string _usbTetheringPolicyName = "usb_tethering"; - private int _usbTetheringCallbackId; - private bool _disposed = false; - - private Interop.DevicePolicyManager.PolicyChangedCallback _usbTetheringPolicyChangedCallback; - private EventHandler _usbTetheringPolicyChanged; - - internal UsbPolicy(DevicePolicyManager dpm) : base(dpm) - { - } - - /// - /// A Destructor of UsbPolicy. - /// - [Obsolete("Deprecated since API level 11.")] - ~UsbPolicy() - { - this.Dispose(false); - } - - /// - /// Gets whether the USB tethering state change is allowed. - /// - /// true if the change is allowed, false otherwise. The default value is true. - /// 6 - [Obsolete("Deprecated since API level 11.")] - public bool IsUsbTetheringAllowed - { - get - { - int state; - int ret = Interop.DevicePolicyManager.RestrictionGetUsbTetheringState(_dpm.GetHandle(), out state); - if (ret != (int)Interop.DevicePolicyManager.ErrorCode.None) - { - Log.Error(Globals.LogTag, $"Failed to get usb tethering state change policy {ret}"); - return true; - } - - return state == 1; - } - } - - /// - /// Releases any unmanaged resources used by this object. - /// - [Obsolete("Deprecated since API level 11.")] - public void Dispose() - { - this.Dispose(true); - GC.SuppressFinalize(this); - } - - /// - /// Releases any unmanaged resources used by this object. Can also dispose any other disposable objects. - /// - /// If true, disposes any disposable objects. If false, does not dispose disposable objects. - [Obsolete("Deprecated since API level 11.")] - protected virtual void Dispose(bool disposing) - { - if (!_disposed) - { - if (disposing) - { - // to be used if there are any other disposable objects - } - - if (_usbTetheringCallbackId != 0) - { - try - { - RemoveUsbTetheringPolicyChangedCallback(); - } - catch (Exception e) - { - Log.Error(Globals.LogTag, e.ToString()); - } - } - - _disposed = true; - } - } - - /// - /// The UsbTetheringPolicyChanged event is raised when the usb tethering policy is changed. - /// - /// This event will be removed automatically when UsbPolicy is destroyed. - /// 6 - [Obsolete("Deprecated since API level 11.")] - public event EventHandler UsbTetheringPolicyChanged - { - add - { - if (_usbTetheringPolicyChanged == null) - { - AddUsbTetheringPolicyChangedCallback(); - } - - _usbTetheringPolicyChanged += value; - } - - remove - { - _usbTetheringPolicyChanged -= value; - if (_usbTetheringPolicyChanged == null) - { - RemoveUsbTetheringPolicyChangedCallback(); - } - } - } - - private void AddUsbTetheringPolicyChangedCallback() - { - if (_usbTetheringPolicyChangedCallback == null) - { - _usbTetheringPolicyChangedCallback = (string name, string state, IntPtr userData) => - { - _usbTetheringPolicyChanged?.Invoke(this, new PolicyChangedEventArgs(UsbTetheringPolicyName, state)); - }; - } - - int ret = Interop.DevicePolicyManager.AddPolicyChangedCallback(_dpm.GetHandle(), _usbTetheringPolicyName, _usbTetheringPolicyChangedCallback, IntPtr.Zero, out _usbTetheringCallbackId); - if (ret != (int)Interop.DevicePolicyManager.ErrorCode.None) - { - Log.Error(Globals.LogTag, $"Failed to add policy changed callback, name {_usbTetheringPolicyName}, ret : {ret}"); - throw DevicePolicyManagerErrorFactory.CreateException(ret); - } - } - - private void RemoveUsbTetheringPolicyChangedCallback() - { - int ret = Interop.DevicePolicyManager.RemovePolicyChangedCallback(_dpm.GetHandle(), _usbTetheringCallbackId); - if (ret != (int)Interop.DevicePolicyManager.ErrorCode.None) - { - Log.Error(Globals.LogTag, $"Failed to remove policy changed callback, name {_usbTetheringPolicyName}, ret : {ret}"); - throw DevicePolicyManagerErrorFactory.CreateException(ret); - } - - _usbTetheringPolicyChangedCallback = null; - _usbTetheringCallbackId = 0; - } - } -} \ No newline at end of file diff --git a/src/Tizen.Security.DevicePolicyManager/Tizen.Security.DevicePolicyManager/WifiPolicy.cs b/src/Tizen.Security.DevicePolicyManager/Tizen.Security.DevicePolicyManager/WifiPolicy.cs deleted file mode 100644 index fc33860aaae..00000000000 --- a/src/Tizen.Security.DevicePolicyManager/Tizen.Security.DevicePolicyManager/WifiPolicy.cs +++ /dev/null @@ -1,284 +0,0 @@ -/* - * Copyright (c) 2018 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 - */ - -using System; - -namespace Tizen.Security.DevicePolicyManager -{ - /// - /// The WifiPolicy provides methods to manage wifi policies. - /// - /// 6 - /// The WifiPolicy is created by . and the DevicePolicyManager instance must exists when using the WifiPolicy. - [Obsolete("Deprecated since API level 11.")] - public class WifiPolicy : DevicePolicy, IDisposable - { - /// - /// The Wifi policy name. This represents . - /// - /// This is used in . - /// 6 - [Obsolete("Deprecated since API level 11.")] - public static readonly string WifiPolicyName = "Wifi"; - - /// - /// The Wifi hotspot policy name. This represents . - /// - /// This is used in . - /// 6 - [Obsolete("Deprecated since API level 11.")] - public static readonly string WifiHotspotPolicyName = "WifiHotspot"; - - private readonly string _wifiPolicyName = "wifi"; - private readonly string _wifiHotspotPolicyName = "wifi_hotspot"; - - private int _wifiCallbackId; - private int _wifiHotspotCallbackId; - private bool _disposed = false; - - private Interop.DevicePolicyManager.PolicyChangedCallback _wifiPolicyChangedCallback; - private Interop.DevicePolicyManager.PolicyChangedCallback _wifiHotspotStatePolicyChangedCallback; - private EventHandler _wifiPolicyChanged; - private EventHandler _wifiHotspotPolicyChanged; - - internal WifiPolicy(DevicePolicyManager dpm) : base(dpm) - { - } - - /// - /// A Destructor of WifiPolicy. - /// - [Obsolete("Deprecated since API level 11.")] - ~WifiPolicy() - { - this.Dispose(false); - } - - /// - /// Gets whether the Wi-Fi state change is allowed or not. - /// - /// true if the state change is allowed, false otherwise. The default value is true. - /// 6 - [Obsolete("Deprecated since API level 11.")] - public bool IsWifiAllowed - { - get - { - int state; - int ret = Interop.DevicePolicyManager.RestrictionGetWifiState(_dpm.GetHandle(), out state); - if (ret != (int)Interop.DevicePolicyManager.ErrorCode.None) - { - Log.Error(Globals.LogTag, $"Failed to get wifi policy {ret}"); - return true; - } - - return state == 1; - } - } - - /// - /// Gets whether the the Wi-Fi hotspot state change is allowed or not. - /// - /// true if the state change is allowed, false otherwise. The default value is true. - /// 6 - [Obsolete("Deprecated since API level 11.")] - public bool IsWifiHotspotAllowed - { - get - { - int state; - int ret = Interop.DevicePolicyManager.RestrictionGetWifiHotspotState(_dpm.GetHandle(), out state); - if (ret != (int)Interop.DevicePolicyManager.ErrorCode.None) - { - Log.Error(Globals.LogTag, $"Failed to get wifi hotspot policy {ret}"); - return true; - } - - return state == 1; - } - } - - /// - /// Releases any unmanaged resources used by this object. - /// - [Obsolete("Deprecated since API level 11.")] - public void Dispose() - { - this.Dispose(true); - GC.SuppressFinalize(this); - } - - /// - /// Releases any unmanaged resources used by this object. Can also dispose any other disposable objects. - /// - /// If true, disposes any disposable objects. If false, does not dispose disposable objects. - [Obsolete("Deprecated since API level 11.")] - protected virtual void Dispose(bool disposing) - { - if (!_disposed) - { - if (disposing) - { - // to be used if there are any other disposable objects - } - - if (_wifiCallbackId != 0) - { - try - { - RemoveWifiStatePolicyChangedCallback(); - } - catch (Exception e) - { - Log.Error(Globals.LogTag, e.ToString()); - } - } - - if (_wifiHotspotCallbackId != 0) - { - try - { - RemoveWifiHotspotPolicyChangedCallback(); - } - catch (Exception e) - { - Log.Error(Globals.LogTag, e.ToString()); - } - } - - _disposed = true; - } - } - - /// - /// The WifiPolicyChanged event is raised when the wifi state policy is changed. - /// - /// This event will be removed automatically when WifiPolicy is destroyed. - /// 6 - [Obsolete("Deprecated since API level 11.")] - public event EventHandler WifiPolicyChanged - { - add - { - if (_wifiPolicyChanged == null) - { - AddWifiStatePolicyChangedCallback(); - } - - _wifiPolicyChanged += value; - } - - remove - { - _wifiPolicyChanged -= value; - if (_wifiPolicyChanged == null) - { - RemoveWifiStatePolicyChangedCallback(); - } - } - } - - private void AddWifiStatePolicyChangedCallback() - { - if (_wifiPolicyChangedCallback == null) - { - _wifiPolicyChangedCallback = (string name, string state, IntPtr userData) => - { - _wifiPolicyChanged?.Invoke(this, new PolicyChangedEventArgs(WifiPolicyName, state)); - }; - } - - int ret = Interop.DevicePolicyManager.AddPolicyChangedCallback(_dpm.GetHandle(), _wifiPolicyName, _wifiPolicyChangedCallback, IntPtr.Zero, out _wifiCallbackId); - if (ret != (int)Interop.DevicePolicyManager.ErrorCode.None) - { - Log.Error(Globals.LogTag, $"Failed to add policy changed callback, name {_wifiPolicyName}, ret : {ret}"); - throw DevicePolicyManagerErrorFactory.CreateException(ret); - } - } - - private void RemoveWifiStatePolicyChangedCallback() - { - int ret = Interop.DevicePolicyManager.RemovePolicyChangedCallback(_dpm.GetHandle(), _wifiCallbackId); - if (ret != (int)Interop.DevicePolicyManager.ErrorCode.None) - { - Log.Error(Globals.LogTag, $"Failed to remove policy changed callback, name {_wifiPolicyName}, ret : {ret}"); - throw DevicePolicyManagerErrorFactory.CreateException(ret); - } - - _wifiPolicyChangedCallback = null; - _wifiCallbackId = 0; - } - - /// - /// The WifiHotspotPolicyChanged event is raised when the wifi hotspot policy is changed. - /// - /// This event will be removed automatically when WifiPolicy is destroyed. - /// 6 - [Obsolete("Deprecated since API level 11.")] - public event EventHandler WifiHotspotPolicyChanged - { - add - { - if (_wifiHotspotPolicyChanged == null) - { - AddWifiHotspotPolicyChangedCallback(); - } - - _wifiHotspotPolicyChanged += value; - } - - remove - { - _wifiHotspotPolicyChanged -= value; - if (_wifiHotspotPolicyChanged == null) - { - RemoveWifiHotspotPolicyChangedCallback(); - } - } - } - - private void AddWifiHotspotPolicyChangedCallback() - { - if (_wifiHotspotStatePolicyChangedCallback == null) - { - _wifiHotspotStatePolicyChangedCallback = (string name, string state, IntPtr userData) => - { - _wifiHotspotPolicyChanged?.Invoke(this, new PolicyChangedEventArgs(WifiHotspotPolicyName, state)); - }; - } - - int ret = Interop.DevicePolicyManager.AddPolicyChangedCallback(_dpm.GetHandle(), _wifiHotspotPolicyName, _wifiHotspotStatePolicyChangedCallback, IntPtr.Zero, out _wifiHotspotCallbackId); - if (ret != (int)Interop.DevicePolicyManager.ErrorCode.None) - { - Log.Error(Globals.LogTag, $"Failed to add policy changed callback, name {_wifiHotspotPolicyName}, ret : {ret}"); - throw DevicePolicyManagerErrorFactory.CreateException(ret); - } - } - - private void RemoveWifiHotspotPolicyChangedCallback() - { - int ret = Interop.DevicePolicyManager.RemovePolicyChangedCallback(_dpm.GetHandle(), _wifiHotspotCallbackId); - if (ret != (int)Interop.DevicePolicyManager.ErrorCode.None) - { - Log.Error(Globals.LogTag, $"Failed to remove policy changed callback, name {_wifiHotspotPolicyName}, ret : {ret}"); - throw DevicePolicyManagerErrorFactory.CreateException(ret); - } - - _wifiHotspotStatePolicyChangedCallback = null; - _wifiHotspotCallbackId = 0; - } - } -} diff --git a/src/Tizen.Security.DevicePolicyManager/doc/api/Tizen.Security.DevicePolicyManager.md b/src/Tizen.Security.DevicePolicyManager/doc/api/Tizen.Security.DevicePolicyManager.md deleted file mode 100644 index 35779899f12..00000000000 --- a/src/Tizen.Security.DevicePolicyManager/doc/api/Tizen.Security.DevicePolicyManager.md +++ /dev/null @@ -1,24 +0,0 @@ ---- -uid: Tizen.Security.DevicePolicyManager -summary: The Tizen.Security.DevicePolicyManager namespace provides classes to manage the device policy management framework. The device policy management framework provides APIs to create security-aware applications that are useful in enterprise settings. -remarks: *content ---- -## Overview -The primary purpose of the DPM(Device Policy Management) framework is to support enterprise applications. -The device policy API supports the policies listed in the below, and application can subscribe to those policies from events. - -### Policy List -|
Policy Name
|
Event
|
Description
| -|:--------|:--------|:--------| -|Wifi |WifiPolicyChanged |Specifies wether the use of Wi-Fi is allowed or not | -|WifiHotspot |WifiHotspotChanged |Specifies whether the use of Wi-Fi hotspot is allowed or not | -|Bluetooth |BluetoothPolicyChanged |Specifies whether the use of bluetooth is allowed or not | -|Camera |CameraPolicyChanged |Specifies whether the use of camera is allowed or not | -|Microphone |MicrophonePolicyChanged |Specifies whether the use of microphone is allowed or not | -|Location |LocationPolicyChanged |Specifies whether the use of GPS is allowed or not | -|ExternalStorage |ExternalStoragePolicyChanged |Specifies whether the use of external storage is allowed or not | -|Messaging |MessagingPolicyChanged |Specifies whether the use of text messaging is allowed or not | -|PopImapEmail |PopImapPolicyChanged |Specifies whether the use of POP/IMAP Email is allowed or not | -|Browser |BrowserPolicyChanged |Specifies whether the use of browser is allowed or not | -|BluetoothTethering |BluetoothTetheringPolicyChanged |Specifies whether the use of bluetooth tethering is allowed or not | -|UsbTethering |UsbTetheringPolicyChanged |Specifies whether the use of usb tethering is allowed or not | \ No newline at end of file