Example #1
0
        /// <summary>
        /// Creates an <seealso cref="EventContainer"/> from a <seealso cref="LogReceiver.LogEntry"/>. </summary>
        /// <param name="entry">  the LogEntry from which pid, tid, and time info is copied. </param>
        /// <param name="tag"> the event tag value </param>
        /// <param name="data"> the data of the EventContainer. </param>
        internal EventContainer(LogReceiver.LogEntry entry, int tag, object data)
        {
            getType(data);
            mTag = tag;
            mData = data;

            pid = entry.pid;
            tid = entry.tid;
            sec = entry.sec;
            nsec = entry.nsec;
        }
Example #2
0
 internal GcEventContainer(LogReceiver.LogEntry entry, int tag, object data)
     : base(entry, tag, data)
 {
     init(data);
 }
Example #3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void runLogService(String logname, com.android.ddmlib.log.LogReceiver receiver) throws TimeoutException, AdbCommandRejectedException, java.io.IOException
		public  void runLogService(string logname, LogReceiver receiver)
		{
			AdbHelper.runLogService(AndroidDebugBridge.socketAddress, this, logname, receiver);
		}
Example #4
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void runEventLogService(com.android.ddmlib.log.LogReceiver receiver) throws TimeoutException, AdbCommandRejectedException, java.io.IOException
		public  void runEventLogService(LogReceiver receiver)
		{
			AdbHelper.runEventLogService(AndroidDebugBridge.socketAddress, this, receiver);
		}
Example #5
0
        public EventContainer parse(LogReceiver.LogEntry entry)
        {
            if (entry.len < 4)
            {
                return null;
            }

            int inOffset = 0;

            int tagValue = ArrayHelper.swap32bitFromArray(entry.data, inOffset);
            inOffset += 4;

            string tag = mTagMap[tagValue];
            if (tag == null)
            {
                Log.e("EventLogParser", string.Format("unknown tag number: {0:D}", tagValue));
            }

            List<object> list = new List<object>();
            if (parseBinaryEvent(entry.data, inOffset, list) == -1)
            {
                return null;
            }

            object data;
            if (list.Count == 1)
            {
                data = list[0];
            }
            else
            {
                data = list.ToArray();
            }

            EventContainer @event = null;
            if (tagValue == GcEventContainer.GC_EVENT_TAG)
            {
                @event = new GcEventContainer(entry, tagValue, data);
            }
            else
            {
                @event = new EventContainer(entry, tagValue, data);
            }

            return @event;
        }
Example #6
0
		/// <summary>
		/// Runs a log service on the <seealso cref="Device"/>, and provides its output to the <seealso cref="LogReceiver"/>.
		/// <p/>This call is blocking until <seealso cref="LogReceiver#isCancelled()"/> returns true. </summary>
		/// <param name="adbSockAddr"> the socket address to connect to adb </param>
		/// <param name="device"> the Device on which to run the service </param>
		/// <param name="logName"> the name of the log file to output </param>
		/// <param name="rcvr"> the <seealso cref="LogReceiver"/> to receive the log output </param>
		/// <exception cref="TimeoutException"> in case of timeout on the connection. </exception>
		/// <exception cref="AdbCommandRejectedException"> if adb rejects the command </exception>
		/// <exception cref="IOException"> in case of I/O error on the connection. </exception>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public static void runLogService(java.net.InetSocketAddress adbSockAddr, Device device, String logName, com.android.ddmlib.log.LogReceiver rcvr) throws TimeoutException, AdbCommandRejectedException, java.io.IOException
		public static void runLogService(EndPoint adbSockAddr, Device device, string logName, LogReceiver rcvr)
		{
			SocketChannel adbChan = null;

			try
			{
				adbChan = SocketChannel.open(adbSockAddr);
				adbChan.configureBlocking(false);

				// if the device is not -1, then we first tell adb we're looking to talk
				// to a specific device
				setDevice(adbChan, device);

				var request = formAdbRequest("log:" + logName);
				write(adbChan, request);

				AdbResponse resp = readAdbResponse(adbChan, false); // readDiagString
				if (resp.okay == false)
				{
					throw new AdbCommandRejectedException(resp.message);
				}

				var data = new byte[16384];
				ByteBuffer buf = ByteBuffer.wrap(data);
				while (true)
				{
					int count;

					if (rcvr != null && rcvr.cancelled)
					{
						break;
					}

					count = adbChan.read(buf);
					if (count < 0)
					{
						break;
					}
                    else if (count == 0)
                    {
                        Thread.Sleep(WAIT_TIME*5);
                    }
                    else
                    {
                        if (rcvr != null)
                        {
                            rcvr.parseNewData(buf.array(), buf.arrayOffset(), buf.position);
                        }
                        buf.rewind();
                    }
				}
			}
			finally
			{
				if (adbChan != null)
				{
					adbChan.close();
				}
			}
		}
Example #7
0
		/// <summary>
		/// Runs the Event log service on the <seealso cref="Device"/>, and provides its output to the
		/// <seealso cref="LogReceiver"/>.
		/// <p/>This call is blocking until <seealso cref="LogReceiver#isCancelled()"/> returns true. </summary>
		/// <param name="adbSockAddr"> the socket address to connect to adb </param>
		/// <param name="device"> the Device on which to run the service </param>
		/// <param name="rcvr"> the <seealso cref="LogReceiver"/> to receive the log output </param>
		/// <exception cref="TimeoutException"> in case of timeout on the connection. </exception>
		/// <exception cref="AdbCommandRejectedException"> if adb rejects the command </exception>
		/// <exception cref="IOException"> in case of I/O error on the connection. </exception>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public static void runEventLogService(java.net.InetSocketAddress adbSockAddr, Device device, com.android.ddmlib.log.LogReceiver rcvr) throws TimeoutException, AdbCommandRejectedException, java.io.IOException
		public static void runEventLogService(EndPoint adbSockAddr, Device device, LogReceiver rcvr)
		{
			runLogService(adbSockAddr, device, "events", rcvr); //$NON-NLS-1$
		}