Move binder death handling logic to ServiceConnector#binderDied().

Bug: 233559082
Test: Manually tested by bug reporter
Change-Id: Idb19c135f7a30404c90c3c80427f57c91a9ab320
This commit is contained in:
Raphael Kim
2022-05-24 18:23:39 +00:00
parent 801a65da09
commit bd3f5caf5d

View File

@@ -118,13 +118,23 @@ class CompanionDeviceServiceConnector extends ServiceConnector.Impl<ICompanionDe
}
}
// This method is only called when app is force-closed via settings,
// but does not handle crashes. Binder death should be handled in #binderDied()
@Override
public void onBindingDied(@NonNull ComponentName name) {
// IMPORTANT: call super!
// IMPORTANT: call super! this will also invoke binderDied()
super.onBindingDied(name);
if (DEBUG) Log.d(TAG, "onBindingDied() " + mComponentName.toShortString());
}
@Override
public void binderDied() {
super.binderDied();
if (DEBUG) Log.d(TAG, "binderDied() " + mComponentName.toShortString());
// Handle primary process being killed
if (mListener != null) {
mListener.onBindingDied(mUserId, mComponentName.getPackageName());
}