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

Commit a4e68c6b authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 11465908 from e80d36e2 to 24Q2-release

Change-Id: I8249c023ae1266882ae6ba9afb5d51922c36d293
parents e225a9b8 e80d36e2
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -287,7 +287,8 @@ public class DataProfileManager extends Handler {
                    log("Added " + dataProfile);

                    isInternetSupported |= apn.canHandleType(ApnSetting.TYPE_DEFAULT);
                    if (mDataConfigManager.isApnConfigAnomalyReportEnabled()) {
                    if (mDataConfigManager.isApnConfigAnomalyReportEnabled()
                            && apn.getEditedStatus() == Telephony.Carriers.UNEDITED) {
                        checkApnSetting(apn);
                    }
                }
+6 −1
Original line number Diff line number Diff line
@@ -101,6 +101,7 @@ public class DomainSelectionController {

    private ExponentialBackoff mBackoff;
    private boolean mBackoffStarted = false;
    private boolean mUnbind = false;

    // Retry the bind to the DomainSelectionService that has died after mBindRetry timeout.
    private Runnable mRestartBindingRunnable = new Runnable() {
@@ -470,12 +471,14 @@ public class DomainSelectionController {
     */
    public boolean bind(@NonNull ComponentName componentName) {
        mComponentName = componentName;
        mUnbind = false;
        return bind();
    }

    private boolean bind() {
        logd("bind isBindingOrBound=" + mIsBound);
        synchronized (mLock) {
            if (mUnbind) return false;
            if (!mIsBound) {
                mIsBound = true;
                Intent serviceIntent = new Intent(DomainSelectionService.SERVICE_INTERFACE)
@@ -512,6 +515,7 @@ public class DomainSelectionController {
     */
    public void unbind() {
        synchronized (mLock) {
            mUnbind = true;
            stopBackoffTimer();
            mIsBound = false;
            setServiceController(null);
@@ -548,7 +552,8 @@ public class DomainSelectionController {
    }

    private void notifyBindFailure() {
        logi("notifyBindFailure " + mBackoffStarted);
        logi("notifyBindFailure started=" + mBackoffStarted + ", unbind=" + mUnbind);
        if (mUnbind) return;
        if (mBackoffStarted) {
            mBackoff.notifyFailed();
        } else {
+36 −1
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ import static org.junit.Assert.assertEquals;
import android.net.Uri;
import android.os.Parcel;
import android.os.PersistableBundle;
import android.provider.Telephony;
import android.telephony.ServiceState;
import android.telephony.TelephonyManager;
import android.telephony.data.ApnSetting;
@@ -42,6 +43,7 @@ import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.net.InetAddress;
import java.util.List;
import java.util.Set;

public class ApnSettingTest extends TelephonyTest {

@@ -206,12 +208,16 @@ public class ApnSettingTest extends TelephonyTest {
        final String[] dummyStringArr = new String[] {"dummy"};
        final InetAddress dummyProxyAddress = InetAddress.getByAddress(new byte[]{0, 0, 0, 0});
        final Uri dummyUri = Uri.parse("www.google.com");

        final Set<String> excludedFields = Set.of("mEditedStatus");

        // base apn
        ApnSetting baseApn = createApnSetting(ApnSetting.TYPE_MMS | ApnSetting.TYPE_DEFAULT);
        Field[] fields = ApnSetting.class.getDeclaredFields();
        for (Field f : fields) {
            int modifiers = f.getModifiers();
            if (Modifier.isStatic(modifiers) || !Modifier.isFinal(modifiers)) {
            if (Modifier.isStatic(modifiers) || !Modifier.isFinal(modifiers)
                    || excludedFields.contains(f.getName())) {
                continue;
            }
            f.setAccessible(true);
@@ -414,4 +420,33 @@ public class ApnSettingTest extends TelephonyTest {
        // InfrastructureBitmask value set to '1(cellular)'
        assertEquals(infrastructureBitmask, apn2.getInfrastructureBitmask());
    }

    @Test
    public void testEditedStatus() {
        ApnSetting apn = new ApnSetting.Builder()
                .setId(1234)
                .setOperatorNumeric("310260")
                .setEntryName("mms")
                .setApnName("mms")
                .setApnTypeBitmask(ApnSetting.TYPE_MMS | ApnSetting.TYPE_DEFAULT)
                .setProtocol(ApnSetting.PROTOCOL_IPV4V6)
                .setNetworkTypeBitmask((int) (TelephonyManager.NETWORK_TYPE_BITMASK_LTE))
                .setEditedStatus(Telephony.Carriers.USER_EDITED)
                .build();
        assertEquals(Telephony.Carriers.USER_EDITED, apn.getEditedStatus());

        ApnSetting apn2 = new ApnSetting.Builder()
                .setId(1234)
                .setOperatorNumeric("310260")
                .setEntryName("mms")
                .setApnName("mms")
                .setApnTypeBitmask(ApnSetting.TYPE_MMS | ApnSetting.TYPE_DEFAULT)
                .setProtocol(ApnSetting.PROTOCOL_IPV4V6)
                .setNetworkTypeBitmask((int) (TelephonyManager.NETWORK_TYPE_BITMASK_LTE))
                .setEditedStatus(Telephony.Carriers.CARRIER_EDITED)
                .build();

        // The edited status should not affect equals
        assertEquals(apn, apn2);
    }
}
+47 −32
Original line number Diff line number Diff line
@@ -139,7 +139,8 @@ public class DataProfileManagerTest extends TelephonyTest {
                Telephony.Carriers.SKIP_464XLAT,
                Telephony.Carriers.ALWAYS_ON,
                Telephony.Carriers.INFRASTRUCTURE_BITMASK,
                Telephony.Carriers.ESIM_BOOTSTRAP_PROVISIONING
                Telephony.Carriers.ESIM_BOOTSTRAP_PROVISIONING,
                Telephony.Carriers.EDITED_STATUS
        };

        private int mPreferredApnSet = 0;
@@ -180,7 +181,8 @@ public class DataProfileManagerTest extends TelephonyTest {
                        -1,                     // skip_464xlat
                        0,                      // always_on
                        1,                      // INFRASTRUCTURE_CELLULAR
                        0                       // esim_bootstrap_provisioning
                        0,                      // esim_bootstrap_provisioning
                        0                       // UNEDITED
                },
                // default internet data profile for RAT CDMA, to test update preferred data profile
                new Object[]{
@@ -217,7 +219,8 @@ public class DataProfileManagerTest extends TelephonyTest {
                        -1,                     // skip_464xlat
                        0,                      // always_on
                        1,                      // INFRASTRUCTURE_CELLULAR
                        0                       // esim_bootstrap_provisioning
                        0,                      // esim_bootstrap_provisioning
                        0                       // UNEDITED
                },
                new Object[]{
                        2,                      // id
@@ -253,7 +256,8 @@ public class DataProfileManagerTest extends TelephonyTest {
                        -1,                     // skip_464xlat
                        0,                      // always_on
                        1,                      // INFRASTRUCTURE_CELLULAR
                        0                       // esim_bootstrap_provisioning
                        0,                      // esim_bootstrap_provisioning
                        0                       // UNEDITED
                },
                new Object[]{
                        3,                      // id
@@ -289,7 +293,8 @@ public class DataProfileManagerTest extends TelephonyTest {
                        -1,                     // skip_464xlat
                        0,                      // always_on
                        1,                      // INFRASTRUCTURE_CELLULAR
                        0                       // esim_bootstrap_provisioning
                        0,                      // esim_bootstrap_provisioning
                        0                       // UNEDITED
                },
                new Object[]{
                        4,                      // id
@@ -326,7 +331,8 @@ public class DataProfileManagerTest extends TelephonyTest {
                        -1,                     // skip_464xlat
                        0,                      // always_on
                        1,                      // INFRASTRUCTURE_CELLULAR
                        0                       // esim_bootstrap_provisioning
                        0,                      // esim_bootstrap_provisioning
                        0                       // UNEDITED
                },
                // This APN entry is created to test de-duping.
                new Object[]{
@@ -364,7 +370,8 @@ public class DataProfileManagerTest extends TelephonyTest {
                        -1,                     // skip_464xlat
                        0,                      // always_on
                        1,                      // INFRASTRUCTURE_CELLULAR
                        0                       // esim_bootstrap_provisioning
                        0,                      // esim_bootstrap_provisioning
                        0                       // UNEDITED
                },
                new Object[]{
                        6,                      // id
@@ -401,7 +408,8 @@ public class DataProfileManagerTest extends TelephonyTest {
                        -1,                     // skip_464xlat
                        0,                      // always_on
                        1,                      // INFRASTRUCTURE_CELLULAR
                        0                       // esim_bootstrap_provisioning
                        0,                      // esim_bootstrap_provisioning
                        0                       // UNEDITED
                },
                new Object[]{
                        7,                      // id
@@ -438,7 +446,8 @@ public class DataProfileManagerTest extends TelephonyTest {
                        -1,                     // skip_464xlat
                        0,                      // always_on
                        1,                      // INFRASTRUCTURE_CELLULAR
                        0                       // esim_bootstrap_provisioning
                        0,                      // esim_bootstrap_provisioning
                        0                       // UNEDITED
                },
                new Object[]{
                        8,                      // id
@@ -475,7 +484,8 @@ public class DataProfileManagerTest extends TelephonyTest {
                        -1,                     // skip_464xlat
                        0,                      // always_on
                        1,                      // INFRASTRUCTURE_CELLULAR
                        0                       // esim_bootstrap_provisioning
                        0,                      // esim_bootstrap_provisioning
                        0                       // UNEDITED
                },
                new Object[]{
                        9,                      // id
@@ -512,7 +522,8 @@ public class DataProfileManagerTest extends TelephonyTest {
                        -1,                     // skip_464xlat
                        0,                      // always_on
                        2,                      // INFRASTRUCTURE_SATELLITE
                        0                      // esim_bootstrap_provisioning
                        0,                      // esim_bootstrap_provisioning
                        0                       // UNEDITED
                },
                new Object[]{
                        10,                     // id
@@ -549,7 +560,8 @@ public class DataProfileManagerTest extends TelephonyTest {
                        -1,                     // skip_464xlat
                        0,                      // always_on
                        1,                      // INFRASTRUCTURE_CELLULAR
                        1                       // esim_bootstrap_provisioning
                        1,                      // esim_bootstrap_provisioning
                        0                       // UNEDITED
                },
                new Object[]{
                        11,                      // id
@@ -586,7 +598,8 @@ public class DataProfileManagerTest extends TelephonyTest {
                        -1,                     // skip_464xlat
                        0,                      // always_on
                        1,                      // INFRASTRUCTURE_SATELLITE
                        1                       // esim_bootstrap_provisioning
                        1,                      // esim_bootstrap_provisioning
                        0                       // UNEDITED
                },
                new Object[]{
                        12,                     // id
@@ -623,7 +636,8 @@ public class DataProfileManagerTest extends TelephonyTest {
                        -1,                     // skip_464xlat
                        0,                      // always_on
                        2,                      // INFRASTRUCTURE_SATELLITE
                        1                       // esim_bootstrap_provisioning
                        1,                      // esim_bootstrap_provisioning
                        0                       // UNEDITED
                },
                new Object[]{
                        13,                     // id
@@ -660,7 +674,8 @@ public class DataProfileManagerTest extends TelephonyTest {
                        -1,                     // skip_464xlat
                        0,                      // always_on
                        2,                      // INFRASTRUCTURE_SATELLITE
                        1                       // esim_bootstrap_provisioning
                        1,                      // esim_bootstrap_provisioning
                        0                       // UNEDITED
                }
        );

+18 −0
Original line number Diff line number Diff line
@@ -246,6 +246,24 @@ public class DomainSelectionControllerTest extends TelephonyTest {
        verify(mMockContext, times(1)).bindService(any(), any(), anyInt());
    }

    /**
     * Ensure that calling unbind stops automatic rebind from occurring.
     */
    @SmallTest
    @Test
    public void testUnbindCauseAutoBindCancelAfterBinderDied() throws RemoteException {
        ServiceConnection conn = bindAndConnectService();

        conn.onBindingDied(null /*null*/);
        mTestController.unbind();

        long delay = mTestController.getBindDelay();
        waitForHandlerActionDelayed(mHandler, delay, 2 * delay);

        // Unbind should stop the autobind from occurring.
        verify(mMockContext, times(1)).bindService(any(), any(), anyInt());
    }

    private void bindAndNullServiceError() {
        ServiceConnection connection = bindService(mTestComponentName);
        connection.onNullBinding(mTestComponentName);