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

Commit 73b81890 authored by Hui Wang's avatar Hui Wang
Browse files

Update annotation, constant name, and javadoc of cell broadcast API

Bug: 264252000
Test: atest CtsTelephonyTestCases
Test: atest com.android.internal.telephony.GsmCdmaPhoneTest
Test: atest CellBroadcastReceiverOemUnitTests
Change-Id: I1c187dbe91677094c5f0ec68faa2200ae6fe00b7
parent 3631da71
Loading
Loading
Loading
Loading
+8 −7
Original line number Diff line number Diff line
@@ -125,7 +125,8 @@ public final class CellBroadcastConfigTracker extends StateMachine {
                        transitionTo(mCdmaConfiguringState);
                    } else {
                        logd("Do nothing as the requested ranges are same as now");
                        request.getCallback().accept(TelephonyManager.CELLBROADCAST_RESULT_SUCCESS);
                        request.getCallback().accept(
                                TelephonyManager.CELL_BROADCAST_RESULT_SUCCESS);
                    }
                    retVal = HANDLED;
                    break;
@@ -167,7 +168,7 @@ public final class CellBroadcastConfigTracker extends StateMachine {
                    } else {
                        logd("Failed to set gsm config");
                        request.getCallback().accept(
                                TelephonyManager.CELLBROADCAST_RESULT_FAIL_CONFIG);
                                TelephonyManager.CELL_BROADCAST_RESULT_FAIL_CONFIG);
                        // transit to idle state on the failure case
                        transitionTo(mIdleState);
                    }
@@ -213,14 +214,14 @@ public final class CellBroadcastConfigTracker extends StateMachine {
                        } else {
                            logd("Done as no need to update ranges for 3gpp2");
                            request.getCallback().accept(
                                    TelephonyManager.CELLBROADCAST_RESULT_SUCCESS);
                                    TelephonyManager.CELL_BROADCAST_RESULT_SUCCESS);
                            // transit to idle state if there is no cdma config change
                            transitionTo(mIdleState);
                        }
                    } else {
                        logd("Failed to set gsm activation");
                        request.getCallback().accept(
                                TelephonyManager.CELLBROADCAST_RESULT_FAIL_ACTIVATION);
                                TelephonyManager.CELL_BROADCAST_RESULT_FAIL_ACTIVATION);
                        // transit to idle state on the failure case
                        transitionTo(mIdleState);
                    }
@@ -264,7 +265,7 @@ public final class CellBroadcastConfigTracker extends StateMachine {
                    } else {
                        logd("Failed to set cdma config");
                        request.getCallback().accept(
                                TelephonyManager.CELLBROADCAST_RESULT_FAIL_CONFIG);
                                TelephonyManager.CELL_BROADCAST_RESULT_FAIL_CONFIG);
                        // transit to idle state on the failure case
                        transitionTo(mIdleState);
                    }
@@ -303,11 +304,11 @@ public final class CellBroadcastConfigTracker extends StateMachine {
                    if (ar.exception == null) {
                        mCbRanges3gpp2 = request.get3gpp2Ranges();
                        request.getCallback().accept(
                                    TelephonyManager.CELLBROADCAST_RESULT_SUCCESS);
                                    TelephonyManager.CELL_BROADCAST_RESULT_SUCCESS);
                    } else {
                        logd("Failed to set cdma activation");
                        request.getCallback().accept(
                                TelephonyManager.CELLBROADCAST_RESULT_FAIL_ACTIVATION);
                                TelephonyManager.CELL_BROADCAST_RESULT_FAIL_ACTIVATION);
                    }
                    // transit to idle state anyway
                    transitionTo(mIdleState);
+1 −1
Original line number Diff line number Diff line
@@ -5190,7 +5190,7 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
     */
    public void setCellBroadcastIdRanges(
            @NonNull List<CellBroadcastIdRange> ranges, Consumer<Integer> callback) {
        callback.accept(TelephonyManager.CELLBROADCAST_RESULT_UNSUPPORTED);
        callback.accept(TelephonyManager.CELL_BROADCAST_RESULT_UNSUPPORTED);
    }

    public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
+9 −9
Original line number Diff line number Diff line
@@ -2255,7 +2255,7 @@ public class GsmCdmaPhoneTest extends TelephonyTest {
        mPhoneUT.mCi = mMockCi;

        mPhoneUT.setCellBroadcastIdRanges(ranges, r -> assertTrue(
                TelephonyManager.CELLBROADCAST_RESULT_SUCCESS == r));
                TelephonyManager.CELL_BROADCAST_RESULT_SUCCESS == r));
        waitForMs(100);

        verify(mMockCi, times(1)).setGsmBroadcastConfig(gsmCaptor.capture(), msgCaptor.capture());
@@ -2294,7 +2294,7 @@ public class GsmCdmaPhoneTest extends TelephonyTest {
                CdmaSmsBroadcastConfigInfo[].class);

        mPhoneUT.setCellBroadcastIdRanges(ranges, r -> assertTrue(
                TelephonyManager.CELLBROADCAST_RESULT_SUCCESS == r));
                TelephonyManager.CELL_BROADCAST_RESULT_SUCCESS == r));
        waitForMs(100);

        verify(mMockCi, times(1)).setGsmBroadcastConfig(any(), any());
@@ -2322,7 +2322,7 @@ public class GsmCdmaPhoneTest extends TelephonyTest {

        // Verify not to set cdma or gsm config as the config is not changed
        mPhoneUT.setCellBroadcastIdRanges(ranges, r -> assertTrue(
                TelephonyManager.CELLBROADCAST_RESULT_SUCCESS == r));
                TelephonyManager.CELL_BROADCAST_RESULT_SUCCESS == r));
        waitForMs(100);

        verify(mMockCi, times(1)).setCdmaBroadcastConfig(any(), any());
@@ -2334,7 +2334,7 @@ public class GsmCdmaPhoneTest extends TelephonyTest {

        // Verify to reset ranges with empty ranges list
        mPhoneUT.setCellBroadcastIdRanges(new ArrayList<>(), r -> assertTrue(
                TelephonyManager.CELLBROADCAST_RESULT_SUCCESS == r));
                TelephonyManager.CELL_BROADCAST_RESULT_SUCCESS == r));

        waitForMs(100);

@@ -2380,7 +2380,7 @@ public class GsmCdmaPhoneTest extends TelephonyTest {

        //Verify to set gsm and cdma config then activate again
        mPhoneUT.setCellBroadcastIdRanges(ranges, r -> assertTrue(
                TelephonyManager.CELLBROADCAST_RESULT_SUCCESS == r));
                TelephonyManager.CELL_BROADCAST_RESULT_SUCCESS == r));

        waitForMs(100);

@@ -2443,7 +2443,7 @@ public class GsmCdmaPhoneTest extends TelephonyTest {

        // Verify the result on setGsmBroadcastConfig failure
        mPhoneUT.setCellBroadcastIdRanges(ranges, r -> assertTrue(
                TelephonyManager.CELLBROADCAST_RESULT_FAIL_CONFIG == r));
                TelephonyManager.CELL_BROADCAST_RESULT_FAIL_CONFIG == r));
        waitForMs(100);

        verify(mMockCi, times(1)).setGsmBroadcastConfig(any(), msgCaptor.capture());
@@ -2461,7 +2461,7 @@ public class GsmCdmaPhoneTest extends TelephonyTest {

        // Verify the result on setGsmBroadcastActivation failure
        mPhoneUT.setCellBroadcastIdRanges(ranges, r -> assertTrue(
                TelephonyManager.CELLBROADCAST_RESULT_FAIL_ACTIVATION == r));
                TelephonyManager.CELL_BROADCAST_RESULT_FAIL_ACTIVATION == r));
        waitForMs(100);

        verify(mMockCi, times(2)).setGsmBroadcastConfig(any(), msgCaptor.capture());
@@ -2486,7 +2486,7 @@ public class GsmCdmaPhoneTest extends TelephonyTest {

        // Verify the result on setCdmaBroadcastConfig failure
        mPhoneUT.setCellBroadcastIdRanges(ranges, r -> assertTrue(
                TelephonyManager.CELLBROADCAST_RESULT_FAIL_CONFIG == r));
                TelephonyManager.CELL_BROADCAST_RESULT_FAIL_CONFIG == r));
        waitForMs(100);

        verify(mMockCi, times(3)).setGsmBroadcastConfig(any(), msgCaptor.capture());
@@ -2522,7 +2522,7 @@ public class GsmCdmaPhoneTest extends TelephonyTest {

        // Verify the result on setCdmaBroadcastActivation failure
        mPhoneUT.setCellBroadcastIdRanges(ranges, r -> assertTrue(
                TelephonyManager.CELLBROADCAST_RESULT_FAIL_ACTIVATION == r));
                TelephonyManager.CELL_BROADCAST_RESULT_FAIL_ACTIVATION == r));
        waitForMs(200);

        // Verify no more calls as there is no change of ranges for 3gpp