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

Commit a9dec58d authored by Chi Zhang's avatar Chi Zhang Committed by Android (Google) Code Review
Browse files

Merge "Do not count WFC under APM in cellular service state." into sc-dev

parents a8c9a6d8 93398636
Loading
Loading
Loading
Loading
+8 −4
Original line number Original line Diff line number Diff line
@@ -189,11 +189,15 @@ public class ServiceStateStats {
        return copy;
        return copy;
    }
    }


    /**
     * Returns {@code true} if modem radio is turned off (e.g. airplane mode).
     *
     * <p>Currently this is approximated by voice service state being {@code STATE_POWER_OFF}.
     */
    private static boolean isModemOff(ServiceState state) {
    private static boolean isModemOff(ServiceState state) {
        // NOTE: Wifi calls can be made in airplane mode, where voice reg state is POWER_OFF but
        // TODO(b/189335473): we should get this info from phone's radio power state, which is
        // data reg state is IN_SERVICE. In this case, service state should still be tracked.
        // updated separately
        return state.getVoiceRegState() == ServiceState.STATE_POWER_OFF
        return state.getVoiceRegState() == ServiceState.STATE_POWER_OFF;
                && state.getDataRegState() == ServiceState.STATE_POWER_OFF;
    }
    }


    private static @NetworkType int getVoiceRat(Phone phone, ServiceState state) {
    private static @NetworkType int getVoiceRat(Phone phone, ServiceState state) {
+1 −15
Original line number Original line Diff line number Diff line
@@ -198,21 +198,7 @@ public class ServiceStateStatsTest extends TelephonyTest {
        mServiceStateStats.incTimeMillis(100L);
        mServiceStateStats.incTimeMillis(100L);
        mServiceStateStats.conclude();
        mServiceStateStats.conclude();


        // Duration for Wifi calling should be counted and there should not be any switch
        // There should be no new switches, service states, or added durations
        ArgumentCaptor<CellularServiceState> captor =
                ArgumentCaptor.forClass(CellularServiceState.class);
        verify(mPersistAtomsStorage)
                .addCellularServiceStateAndCellularDataServiceSwitch(captor.capture(), eq(null));
        CellularServiceState state = captor.getValue();
        assertEquals(TelephonyManager.NETWORK_TYPE_IWLAN, state.voiceRat);
        assertEquals(TelephonyManager.NETWORK_TYPE_UNKNOWN, state.dataRat);
        assertEquals(ServiceState.ROAMING_TYPE_NOT_ROAMING, state.voiceRoamingType);
        assertEquals(ServiceState.ROAMING_TYPE_NOT_ROAMING, state.dataRoamingType);
        assertFalse(state.isEndc);
        assertEquals(0, state.simSlotIndex);
        assertFalse(state.isMultiSim);
        assertEquals(CARRIER1_ID, state.carrierId);
        assertEquals(100L, state.totalTimeMillis);
        verifyNoMoreInteractions(mPersistAtomsStorage);
        verifyNoMoreInteractions(mPersistAtomsStorage);
    }
    }