Enforce configureRpcThreadpool before join.

This pattern:
/* BAD */ int main() {
/* BAD */     sp<IFoo> foo = new IFoo();
/* BAD */     ... = foo->registerAsService();
/* BAD */     ...
/* BAD */     joinRpcThreadpool();
/* BAD */     return 1;
/* BAD */ }

Causes two hwbinder threads to be created because one is
created when registerAsService is called and another is
created by the main thread joining the threadpool.

Rather than allow accidentally creating a second thread,
fail hard on this error. Creating a second thread when it
is not explicitly requested.

Instead this call should be added before registerAsService:
    configureRpcThreadpool(K, true /* willJoin */);

Where 'K' is the number of desired threads ('1' for
single-threaded services, '2' if two threads are actually
desired, and so on).

Fixes: 80102279
Test: Boot multiple Pixels
Change-Id: Ib3437f023ca0642649bcd85c1976d7cc42d2c336
1 file changed