internal delegate bool AppInfoCategoryCallback(string category, IntPtr userData);
//bool (*app_info_category_cb) (const char *category, void *user_data)
+ internal delegate bool AppInfoResControlCallback(string resType, string minResVersion, string maxResVersion, string autoClose, IntPtr userUdata);
+ //bool (*app_info_res_control_cb) (const char *res_type, const char *min_res_version, const char *max_res_version, const char *auto_close, void *user_data);
+
[DllImport(Libraries.AppManager, EntryPoint = "app_manager_set_app_context_event_cb")]
internal static extern ErrorCode AppManagerSetAppContextEvent(AppManagerAppContextEventCallback callback, IntPtr userData);
//int app_manager_set_app_context_event_cb( app_manager_app_context_event_cb callback, void * user_data)
internal static extern ErrorCode AppInfoMetadataFilterForeach(IntPtr handle, AppInfoFilterCallback callback, IntPtr userData);
//int app_info_metadata_filter_foreach (app_info_metadata_filter_h handle, app_info_filter_cb callback, void *user_data)
+ [DllImport(Libraries.AppManager, EntryPoint = "app_info_foreach_res_control")]
+ internal static extern ErrorCode AppInfoForeachResControl(IntPtr handle, AppInfoResControlCallback callback, IntPtr userData);
+
[NativeStruct("struct rua_rec", Include="rua.h", PkgConfig="rua")]
[StructLayout(LayoutKind.Sequential)]
internal struct RuaRec
}
/// <summary>
+ /// Gets the resource controls.
+ /// </summary>
+ /// <since_tizen> 9 </since_tizen>
+ public IEnumerable<ResourceControl> ResourceControls
+ {
+ get
+ {
+ List<ResourceControl> resourceControls = new List<ResourceControl>();
+ Interop.ApplicationManager.AppInfoResControlCallback cb = (string resType, string minResourceVersion, string maxResourceVersion, string isAutoClose, IntPtr userData) =>
+ {
+ resourceControls.Add(new ResourceControl(resType, minResourceVersion, maxResourceVersion, isAutoClose == "true"));
+ return true;
+ };
+
+ IntPtr infoHandle = GetInfoHandle();
+ if (infoHandle != null)
+ {
+ err = Interop.ApplicationManager.AppInfoForeachResControl(infoHandle, cb, IntPtr.Zero);
+ if (err != Interop.ApplicationManager.ErrorCode.None)
+ {
+ Log.Warn(LogTag, "Failed to get the resource controls of " + _applicationId + ". err = " + err);
+ }
+ }
+
+ return resourceControls;
+ }
+ }
+
+ /// <summary>
/// Gets the localized label of the application for the given locale.
/// </summary>
/// <param name="locale">Locale.</param>
--- /dev/null
+/*
+ * Copyright (c) 2021 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 System.Text;
+
+namespace Tizen.Applications
+{
+ /// <summary>
+ /// Represents the resource control information.
+ /// </summary>
+ /// <since_tizen> 9 </since_tizen>
+ public class ResourceControl
+ {
+ internal ResourceControl(string resourceType, string minResourceVersion, string maxResourceVersion, bool isAutoClose)
+ {
+ ResourceType = resourceType;
+ MinResourceVersion = minResourceVersion ?? null;
+ MaxResourceVersion = maxResourceVersion ?? null;
+ IsAutoClose = isAutoClose;
+ }
+
+ /// <summary>
+ /// The resource type.
+ /// </summary>
+ /// <since_tizen> 9 </since_tizen>
+ public string ResourceType { get; }
+
+ /// <summary>
+ /// The minimum version of required resource package.
+ /// </summary>
+ /// <since_tizen> 9 </since_tizen>
+ public string MinResourceVersion { get; }
+
+ /// <summary>
+ /// The maximum version of required resource package.
+ /// </summary>
+ /// <since_tizen> 9 </since_tizen>
+ public string MaxResourceVersion { get; }
+
+ /// <summary>
+ /// The auto close property.
+ /// </summary>
+ /// <since_tizen> 9 </since_tizen>
+ public bool IsAutoClose { get; }
+ }
+}