В IPCClientBaseProvider.prepareSpecificApp() объясняется маловероятный кейс, когда onServiceDisconnected() вызывается без onServiceConnected(). Однако там есть небольшая помарка, которая путает при попытке понять объяснение:
} else if (connectionInfo.connectionState == ConnectionInfo.CONNECTION_STATE_DISCONNECTED) {
// Refresh latch because we've tried to connect to service, but onServiceDisconnected()
// was called and we did reset provider, so we need wait for onServiceConnected() again.
//
// IMPORTANT!
// I'm not sure if onServiceDisconnected() can be called without onServiceConnected(). Because
// if it does, there is possibility of this situation:
// We have called bind() during prepare() on some thread (T1), then we called prepareSpecificApp() in
// getSpecificAppSilentAuthInfos() so we called latch.await() on this thread (T2). Then onServiceConnected()
// is called on T1. We have to call bind again() without blocking the T2 (or have to wait until
// system recreates service, but c'mon...).
//
// But I hope this situation will never become.
connectionInfo.latch.countDown()
connectionInfo.latch = latch
}
Ошибка в следующей фразе: Then onServiceConnected() is called on T1.
Так как речь идёт о вызове onServiceDisconnected() без onServiceСonnected(), то правильно будет сказать Then onServiceDisconnected() is called on T1 - то есть после bind() вызовется не onServiceConnected(), а сразу onServiceDisconnected().
Описание
В
IPCClientBaseProvider.prepareSpecificApp()
объясняется маловероятный кейс, когдаonServiceDisconnected()
вызывается безonServiceConnected()
. Однако там есть небольшая помарка, которая путает при попытке понять объяснение:Ошибка в следующей фразе:
Then onServiceConnected() is called on T1
.Так как речь идёт о вызове
onServiceDisconnected()
безonServiceСonnected()
, то правильно будет сказатьThen onServiceDisconnected() is called on T1
- то есть послеbind()
вызовется неonServiceConnected()
, а сразуonServiceDisconnected()
.