private int GetPidFromPackageName(string packageName, string deviceId)
        {
            var adb    = GetCachedAdb();
            var device = GetAndroidDeviceFromCache(adb, deviceId);

            return(AndroidLogcatUtilities.GetPidFromPackageName(adb, device, deviceId, packageName));
        }
        private int GetPidFromPackageName(Dictionary <string, int> cache, string packageName, IAndroidLogcatDevice device)
        {
            if (device == null)
            {
                return(-1);
            }
            // Getting pid for packages is a very costly operation, use cache to make less queries
            int pid;

            if (cache != null && cache.TryGetValue(packageName, out pid))
            {
                return(pid);
            }

            pid = AndroidLogcatUtilities.GetPidFromPackageName(m_Runtime.Tools.ADB, device, packageName);
            if (cache != null)
            {
                cache[packageName] = pid;
            }
            return(pid);
        }