/// <summary>
 /// Get the top activity on the given device.
 /// </summary>
 public static bool GetTopActivityInfo(AndroidBridge.ADB adb, IAndroidLogcatDevice device, ref string packageName, ref int packagePid)
 {
     if (device == null)
         return false;
     try
     {
         var cmd = "-s " + device.Id + " shell \"dumpsys activity\" ";
         AndroidLogcatInternalLog.Log("{0} {1}", adb.GetADBPath(), cmd);
         var output = adb.Run(new[] { cmd }, "Unable to get the top activity.");
         packagePid = AndroidLogcatUtilities.ParseTopActivityPackageInfo(output, out packageName);
         return packagePid != -1;
     }
     catch (Exception)
     {
         return false;
     }
 }
コード例 #2
0
 /// <summary>
 /// Get the top activity on the given device.
 /// </summary>
 public static bool GetTopActivityInfo(ADB adb, string deviceId, ref string packageName, ref int packagePid)
 {
     if (string.IsNullOrEmpty(deviceId))
     {
         return(false);
     }
     try
     {
         var cmd = "-s " + deviceId + " shell \"dumpsys activity\" ";
         AndroidLogcatInternalLog.Log("{0} {1}", adb.GetADBPath(), cmd);
         var output = adb.Run(new[] { cmd }, "Unable to get the top activity.");
         packagePid = AndroidLogcatUtilities.ParseTopActivityPackageInfo(output, out packageName);
         return(packagePid != -1);
     }
     catch (Exception)
     {
         return(false);
     }
 }