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

Commit e5ad71ec authored by Automerger Merge Worker's avatar Automerger Merge Worker
Browse files

Merge "Throw IOException on multiple connects." am: 632e5154 am: ead7c0e4

Change-Id: I51690e73f8db042a7457afbcadc8003fe476b100
parents 01233f33 ead7c0e4
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -455,12 +455,12 @@ public final class Tag implements Parcelable {
     *
     * @hide
     */
    public synchronized void setConnectedTechnology(int technology) {
        if (mConnectedTechnology == -1) {
            mConnectedTechnology = technology;
        } else {
            throw new IllegalStateException("Close other technology first!");
    public synchronized boolean setConnectedTechnology(int technology) {
        if (mConnectedTechnology != -1) {
            return false;
        }
        mConnectedTechnology = technology;
        return true;
    }

    /**
+4 −1
Original line number Diff line number Diff line
@@ -75,7 +75,10 @@ abstract class BasicTagTechnology implements TagTechnology {

            if (errorCode == ErrorCodes.SUCCESS) {
                // Store this in the tag object
                mTag.setConnectedTechnology(mSelectedTechnology);
                if (!mTag.setConnectedTechnology(mSelectedTechnology)) {
                    Log.e(TAG, "Close other technology first!");
                    throw new IOException("Only one TagTechnology can be connected at a time.");
                }
                mIsConnected = true;
            } else if (errorCode == ErrorCodes.ERROR_NOT_SUPPORTED) {
                throw new UnsupportedOperationException("Connecting to " +