1.提早关掉/dev/binderandroid
IPCThreadState::self()->stopProcess();atom
gAudioFlingerClient因为media server crash,会被clear,可是defaultServiceManager()是正常的,一直存在全局变量里spa
const sp<IAudioFlinger>& AudioSystem::get_audio_flinger() {code
Mutex::Autolock _l(gLock); if (gAudioFlinger == 0) { sp<IServiceManager> sm = defaultServiceManager(); sp<IBinder> binder; do { binder = sm->getService(String16("media.audio_flinger")); if (binder != 0) break; ALOGW("AudioFlinger not published, waiting..."); usleep(500000); } while (true);
Binder thread如何起来? 经过spawnPooledThread()能够起来相似"Binder_2"名字的thread.server
会有几个Binder thread?get
void ProcessState::spawnPooledThread(bool isMain) { if (mThreadPoolStarted) { int32_t s = android_atomic_add(1, &mThreadPoolSeq); char buf[16]; snprintf(buf, sizeof(buf), "Binder_%X", s); ALOGV("Spawning new pooled thread, name=%s\n", buf); sp<Thread> t = new PoolThread(isMain); t->run(buf); } }it