Audioflinger (AF) is a service with specific code in AV\MEDIA\MEDIASERVER\MAIN_MEDIASERVER.CPP:
intMainintargcChar**argv) {Signal (sigpipe, sig_ign); CharValue[property_value_max]; BOOLDolog = (Property_get ("ro.test_harness", Value,"0") >0) && (atoi (value) = =1); pid_t Childpid; //Fixme The advantage of making the process containing Media.log service the parent process of//the process that contains all of the other real services, was that it allows us to collect more//detailed information such as signal numbers, stop and continue, resource usage, etc. //But it's also more complex. Consider replacing this by independent processes, and using//binder on death notification instead. if(Dolog && (childpid = fork ())! =0) { //Media.log Service//Prctl (Pr_set_name, (unsigned long) "Media.log", 0, 0, 0); //Unfortunately PS ignores pr_set_name for the main thread, so use this ugly hackstrcpy (argv[0],"Media.log"); SP<ProcessState>proc (processstate::self ()); Medialogservice::instantiate (); Processstate::self ()-Startthreadpool (); ...
sp<ProcessState> proc (processstate::self ()); SP<IServiceManager> sm = Defaultservicemanager (); Alogi ("servicemanager:%p", SM.get()); Audioflinger::instantiate (); Mediaplayerservice::instantiate (); Cameraservice::instantiate (); Audiopolicyservice::instantiate (); Registerextensions (); Processstate::self (),Startthreadpool (); Ipcthreadstate::self (),Jointhreadpool (); }
Android 4.4KitKat Audioflinger Process Analysis