Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2e1870c2 authored by Joanne Chung's avatar Joanne Chung
Browse files

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
parent 78b956de
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -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();
            }