publicfinalbooleansendMessage(@NonNullMessagemsg){returnsendMessageDelayed(msg,0);}publicfinalbooleansendMessageDelayed(@NonNullMessagemsg,longdelayMillis){if(delayMillis<0){delayMillis=0;}returnsendMessageAtTime(msg,SystemClock.uptimeMillis()+delayMillis);}publicbooleansendMessageAtTime(@NonNullMessagemsg,longuptimeMillis){MessageQueuequeue=mQueue;if(queue==null){RuntimeExceptione=newRuntimeException(this+" sendMessageAtTime() called with no mQueue");Log.w("Looper",e.getMessage(),e);returnfalse;}returnenqueueMessage(queue,msg,uptimeMillis);}/**
* 核心在这里
*/privatebooleanenqueueMessage(@NonNullMessageQueuequeue,@NonNullMessagemsg,longuptimeMillis){msg.target=this;msg.workSourceUid=ThreadLocalWorkSource.getUid();if(mAsynchronous){msg.setAsynchronous(true);}returnqueue.enqueueMessage(msg,uptimeMillis);//最后调用的是queue.enqueueMessage
}