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