intmain(){fprintf(stderr,"=============================================================================\n");fprintf(stderr,"WARNING: Flat (text file, non-zipped) bugreports are deprecated.\n");fprintf(stderr,"WARNING: Please generate zipped bugreports instead.\n");fprintf(stderr,"WARNING: On the host use: adb bugreport filename.zip\n");fprintf(stderr,"WARNING: On the device use: bugreportz\n");fprintf(stderr,"WARNING: bugreportz will output the filename to use with adb pull.\n");fprintf(stderr,"=============================================================================\n\n\n");return0;}
intmain(intargc,char*argv[]){//省略
// TODO: code below was copy-and-pasted from bugreport.cpp (except by the
// timeout value);
// should be reused instead.
// Start the dumpstatez service.
//启动相关的 dumpstate服务
if(stream_data){property_set("ctl.start","dumpstate");}else{property_set("ctl.start","dumpstatez");}// Socket will not be available until service starts.
ints=-1;for(inti=0;i<20;i++){//与dumpstate进行本地socket跨进程通讯
s=socket_local_client("dumpstate",ANDROID_SOCKET_NAMESPACE_RESERVED,SOCK_STREAM);if(s>=0)break;// Try again in 1 second.
sleep(1);}intret;//socket接受相关的数据进行处理
if(stream_data){ret=bugreportz_stream(s);}else{ret=bugreportz(s,show_progress);}returnret;}