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

Unverified Commit 036c7c72 authored by Kevin F. Haggerty's avatar Kevin F. Haggerty
Browse files

Merge tag 'android-12.1.0_r5' into staging/lineage-19.1_merge-android-12.1.0_r5

Android 12.1.0 Release 5 (SP2A.220505.002)

* tag 'android-12.1.0_r5':
  Handle null bindings returned from ConnectionService.

Change-Id: I653c19eb31d2b46498028661f26fe54e482e32a8
parents 6cafc5b1 40b73e5d
Loading
Loading
Loading
Loading
+24 −1
Original line number Diff line number Diff line
@@ -150,7 +150,6 @@ public abstract class ServiceBinder {
                    Log.i(this, "Service bound %s", componentName);

                    Log.addEvent(mCall, LogUtils.Events.CS_BOUND, componentName);
                    mCall = null;

                    // Unbind request was queued so unbind immediately.
                    if (mIsBindingAborted) {
@@ -192,6 +191,30 @@ public abstract class ServiceBinder {
                Log.endSession();
            }
        }

        /**
         * Handles the case where the {@link ConnectionService} we bound to returned a null binding.
         * We want to unbind from the service and cleanup and call resources at this time.
         * @param componentName The component of the {@link ConnectionService}.
         */
        @Override
        public void onNullBinding(ComponentName componentName) {
            try {
                Log.startSession("SBC.oNB");
                synchronized (mLock) {
                    Log.w(this, "Null binding %s", componentName);
                    Log.addEvent(mCall, "NULL_BINDING", componentName);
                    String componentStr = componentName == null ? "null" : componentName.toString();
                    android.util.EventLog.writeEvent(0x534e4554, "211114016", -1, componentStr);
                    logServiceDisconnected("onNullBinding");
                    mContext.unbindService(this);
                    clearAbort();
                    handleFailedConnection();
                }
            } finally {
                Log.endSession();
            }
        }
    }

    private void handleDisconnect() {