Loading core/java/com/android/internal/infra/ServiceConnector.java +13 −1 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ import android.os.Looper; import android.os.RemoteException; import android.os.UserHandle; import android.util.Log; import android.util.Slog; import java.io.PrintWriter; import java.util.ArrayDeque; Loading Loading @@ -562,10 +563,21 @@ public interface ServiceConnector<I extends IInterface> { void unbindJobThread() { cancelTimeout(); I service = mService; // TODO(b/224695239): This is actually checking wasConnected. Rename and/or fix // implementation based on what this should actually be checking. At least the first // check for calling unbind is the correct behavior, though. boolean wasBound = service != null; if (wasBound || mBinding) { try { mContext.unbindService(mServiceConnection); } catch (IllegalArgumentException e) { // TODO(b/224697137): Fix the race condition // that requires catching this (crashes if // service isn't currently bound). Slog.e(LOG_TAG, "Failed to unbind: " + e); } } if (wasBound) { dispatchOnServiceConnectionStatusChanged(service, false); mContext.unbindService(mServiceConnection); service.asBinder().unlinkToDeath(this, 0); mService = null; } Loading Loading
core/java/com/android/internal/infra/ServiceConnector.java +13 −1 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ import android.os.Looper; import android.os.RemoteException; import android.os.UserHandle; import android.util.Log; import android.util.Slog; import java.io.PrintWriter; import java.util.ArrayDeque; Loading Loading @@ -562,10 +563,21 @@ public interface ServiceConnector<I extends IInterface> { void unbindJobThread() { cancelTimeout(); I service = mService; // TODO(b/224695239): This is actually checking wasConnected. Rename and/or fix // implementation based on what this should actually be checking. At least the first // check for calling unbind is the correct behavior, though. boolean wasBound = service != null; if (wasBound || mBinding) { try { mContext.unbindService(mServiceConnection); } catch (IllegalArgumentException e) { // TODO(b/224697137): Fix the race condition // that requires catching this (crashes if // service isn't currently bound). Slog.e(LOG_TAG, "Failed to unbind: " + e); } } if (wasBound) { dispatchOnServiceConnectionStatusChanged(service, false); mContext.unbindService(mServiceConnection); service.asBinder().unlinkToDeath(this, 0); mService = null; } Loading