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

Commit b858ffbe authored by Amin Shaikh's avatar Amin Shaikh Committed by android-build-merger
Browse files

Merge changes from topic 'disabled-reason'

am: d0fc3f13

Change-Id: I09e7dff673a56fb3c51cde827ae783da32407a70
parents df6f7b93 d0fc3f13
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -1301,6 +1301,7 @@ public class WifiConfiguration implements Parcelable {
            setConnectChoice(source.getConnectChoice());
            setConnectChoiceTimestamp(source.getConnectChoiceTimestamp());
            setHasEverConnected(source.getHasEverConnected());
            setNotRecommended(source.isNotRecommended());
        }

        public void writeToParcel(Parcel dest) {
+32 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;

import android.os.Parcel;
import android.net.wifi.WifiConfiguration.NetworkSelectionStatus;

import org.junit.Before;
import org.junit.Test;
@@ -66,4 +67,35 @@ public class WifiConfigurationTest {

        assertArrayEquals(bytes, rebytes);
    }

    @Test
    public void testNetworkSelectionStatusCopy() {
        NetworkSelectionStatus networkSelectionStatus = new NetworkSelectionStatus();
        networkSelectionStatus.setNotRecommended(true);

        NetworkSelectionStatus copy = new NetworkSelectionStatus();
        copy.copy(networkSelectionStatus);

        assertEquals(networkSelectionStatus.isNotRecommended(), copy.isNotRecommended());
    }

    @Test
    public void testNetworkSelectionStatusParcel() {
        NetworkSelectionStatus networkSelectionStatus = new NetworkSelectionStatus();
        networkSelectionStatus.setNotRecommended(true);

        Parcel parcelW = Parcel.obtain();
        networkSelectionStatus.writeToParcel(parcelW);
        byte[] bytes = parcelW.marshall();
        parcelW.recycle();

        Parcel parcelR = Parcel.obtain();
        parcelR.unmarshall(bytes, 0, bytes.length);
        parcelR.setDataPosition(0);

        NetworkSelectionStatus copy = new NetworkSelectionStatus();
        copy.readFromParcel(parcelR);

        assertEquals(networkSelectionStatus.isNotRecommended(), copy.isNotRecommended());
    }
}