Merge "Move binder death handling logic to ServiceConnector#binderDied()." into tm-dev am: 0bdc2763a9

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18585033

Change-Id: Ibc28d7ee8fc981d1d39ebdc399f4830a4a763af5
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Raphael Kim
2022-05-27 21:20:54 +00:00
committed by Automerger Merge Worker

View File

@@ -119,13 +119,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 @Override
public void onBindingDied(@NonNull ComponentName name) { public void onBindingDied(@NonNull ComponentName name) {
// IMPORTANT: call super! // IMPORTANT: call super! this will also invoke binderDied()
super.onBindingDied(name); super.onBindingDied(name);
if (DEBUG) Log.d(TAG, "onBindingDied() " + mComponentName.toShortString()); 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) { if (mListener != null) {
mListener.onBindingDied(mUserId, mComponentName.getPackageName()); mListener.onBindingDied(mUserId, mComponentName.getPackageName());
} }