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

Commit 2d3584ca authored by Sergey Nikolaienkov's avatar Sergey Nikolaienkov Committed by Android (Google) Code Review
Browse files

Merge "Fix NPE in CompanionDeviceServiceConnector" into tm-dev

parents 0de55a34 6253682e
Loading
Loading
Loading
Loading
+9 −7
Original line number Diff line number Diff line
@@ -51,12 +51,12 @@ class CompanionDeviceServiceConnector extends ServiceConnector.Impl<ICompanionDe
        void onBindingDied(@UserIdInt int userId, @NonNull String packageName);
    }

    @UserIdInt
    private final int mUserId;
    @NonNull
    private final ComponentName mComponentName;
    @Nullable
    private Listener mListener;
    private final @UserIdInt int mUserId;
    private final @NonNull ComponentName mComponentName;
    // IMPORTANT: this can (and will!) be null (at the moment, CompanionApplicationController only
    // installs a listener to the primary ServiceConnector), hence we should always null-check the
    // reference before calling on it.
    private @Nullable Listener mListener;

    /**
     * Create a CompanionDeviceServiceConnector instance.
@@ -125,8 +125,10 @@ class CompanionDeviceServiceConnector extends ServiceConnector.Impl<ICompanionDe

        if (DEBUG) Log.d(TAG, "onBindingDied() " + mComponentName.toShortString());

        if (mListener != null) {
            mListener.onBindingDied(mUserId, mComponentName.getPackageName());
        }
    }

    @Override
    protected ICompanionDeviceService binderAsInterface(@NonNull IBinder service) {