Commits


Guobin Zhang authored and Gerrit Code Review committed 9e3e5266506
Two REMOVE_PROVIDER messages caused by race condition. Fix a bug in unstable ContentProvider. IllegalStateException: ref counts can't go to zero here: stable=0 unstable=0 IllegalStateException: unstable count < 0: -1 There is a race between main thread and background database thread. Main thread is responsible for handling the REMOVE_PROVIDER message. Database thread starts insert or query request again and again. acquireProvider in db thread will often snatch provider from the jaws of death, sometime it fails to remove REMOVE_PROVIDER which is already fired out from MessageQueue. But completeRemoveProvider in main thread gets suspended when trying to execute the critical section. If db thread released the provider before main thread resumes the execution, then two REMOVE_PROVIDER messages will be executed. Change-Id: I8588aa1d1a8bc444dcd2adf6f8bc3f055cebbdc4 Signed-off-by: Guobin Zhang <guobin.zhang@intel.com>