OSDN Git Service

[ActivityManager] Improve multi-thread access the same provider
authorriddle_hsu <riddle_hsu@htc.com>
Wed, 1 Apr 2015 07:06:18 +0000 (15:06 +0800)
committerriddle_hsu <riddle_hsu@htc.com>
Wed, 1 Apr 2015 07:06:18 +0000 (15:06 +0800)
commit57307b21cbdb261eeca081051ed61540dcf905f8
treeb07aa6fbc84944d91c89d6cbf1eb2afc41b44656
parent562c6a71f98e921fe8def18991b2a26f153c683d
[ActivityManager] Improve multi-thread access the same provider

Application may use many threads to load data from provider.
If the target provider needs to start process, each access
will occupy one binder thread of system server until the
provider process started and published.

Sometimes application uses more than 16 threads to access
the same provider, and the provider process needs a little
long time to start, then all binder threads of system server
are waiting. But when the provider is ready, it is unable to
publish to notify those waiting threads because no availabe
binder thread to use. And device will become almost hang.

Improvement:
If there is already a thread acquiring provider, let other threads
(which try to acquire the same provider) wait the result of the
first one. That reduces IPC to save binder thread of system server.

Remove calling removeContentProvider in installProvider because
we have ensured only get one provider holder for the same provider,
the original race that gets a new useless holder will not happen.

Change-Id: I521f2603db8ced56912f5dc54342a70451e68381
core/java/android/app/ActivityThread.java