public static bool RequestPrivilege(uint privilegeId)
        {
            if (!isInitialized())
            {
                return(false);
            }
            var result = Native.RequestPrivilege(privilegeId);

            MLLog.Debug(kLogTag, "requesting privilege id {0}: {1}", privilegeId, result.ToString());
            return(result == ResultCode.Granted);
        }
        public static bool IsPrivilegeApproved(uint privilegeId)
        {
            if (!isInitialized())
            {
                return(false);
            }
            var result = Native.CheckPrivilege(privilegeId);

            MLLog.Debug(kLogTag, "checking privilege id {0}: {1}", privilegeId, result.ToString());
            return(result == ResultCode.Granted);
        }
        internal static void Shutdown()
        {
            // TODO :: Need to enfore access on main thread only..
            lock (s_LockObject)
            {
                s_RefCount--;
                if (s_RefCount > 0)
                {
                    return;
                }
            }
            MLLog.Debug(kLogTag, "Stopping Privileges Service");
            Application.quitting -= Shutdown;
            var result = Native.Shutdown();

            MLLog.Assert(result == ResultCode.Ok, kLogTag, "Failed to shutdown privileges service");
        }
        internal static void Initialize()
        {
            // TODO :: Need to enfore access on main thread only..
            lock (s_LockObject)
            {
                s_RefCount++;
                if (s_RefCount != 1)
                {
                    return;
                }
            }
            MLLog.Debug(kLogTag, "Starting Privileges Service");
            var result = Native.Startup();

            MLLog.Assert(result == ResultCode.Ok, kLogTag, "Failed to initialize privileges service");
            // on app shutdown, we're tearing the world down anyways, so futzing with the ref count is okay.
            Application.quitting += () => { Shutdown(); };
        }
 static void Log(string msg) => MLLog.Debug(kLogTag, $"{msg}");
 static void DebugLog(string msg)
 {
     MLLog.Debug(kLogTag, msg);
 }