Add log to help debug bind TCS twice.

In b/156555486, we find two consecutive requests may cause bind TCS
twice. It is wired mBinding is false here, it should be true when
TCMS binds the TCS for 1st request. The only possibility is that
willBind is false or onServiceDisconnected, onBindingDied or
onNullBinding was called to set mService null and mBinding false.
The test fail cannot be reproduce locally with many tries. Add log
to help debug the same bug next time.

Bug: 156555486
Test: Hard to see the fail case, see local added normal log
Change-Id: I04600b00322ef2dcc2162770672c797d42f5e98c
This commit is contained in:
Joanne Chung
2020-05-26 21:27:45 +08:00
parent 78b956deb1
commit 2e1870c23b

View File

@@ -883,6 +883,9 @@ public final class TextClassificationManagerService extends ITextClassifierServi
Slog.d(LOG_TAG, "Binding to " + serviceIntent.getComponent());
willBind = mContext.bindServiceAsUser(
serviceIntent, mConnection, mBindServiceFlags, UserHandle.of(mUserId));
if (!willBind) {
Slog.e(LOG_TAG, "Could not bind to " + componentName);
}
mBinding = willBind;
} finally {
Binder.restoreCallingIdentity(identity);
@@ -955,16 +958,19 @@ public final class TextClassificationManagerService extends ITextClassifierServi
@Override
public void onServiceDisconnected(ComponentName name) {
Slog.i(LOG_TAG, "onServiceDisconnected called with " + name);
cleanupService();
}
@Override
public void onBindingDied(ComponentName name) {
Slog.i(LOG_TAG, "onBindingDied called with " + name);
cleanupService();
}
@Override
public void onNullBinding(ComponentName name) {
Slog.i(LOG_TAG, "onNullBinding called with " + name);
cleanupService();
}