<?xml version="1.0" encoding="UTF-8"?>

<!-- Carrier Policy file for SRLTE+G open market with GWL+G DSDS roaming
     Startup and LPM->online in Full-RAT mode

$Header: //components/dev/mmcp.mpss/5.1/tsherwin.MMCP.MPSS.5.1.pm51ll/policyman/configurations/Carrier/CT/1xSRLTE+G_Full_Rat/OpenMarket/1xSRLTE_GWL+G_DSDS_roam/openMarket/carrier_policy.xml#1 $
-->
<policy name        = "generic"
        changelist  = "$Change: 8403908 $"
        enabled     = "true"
        schema_ver  = "1"
        policy_ver  = "92.2.3"
>

  <initial>
    <actions>

      <!-- List of the MCCs in which SRLTE is allowed -->
      <mcc_list name="sxlte_mccs"> 455 460 </mcc_list>

      <!-- "sxlte_plmns" list intentionally doesn't exist -->
      <!-- "sxlte_mccs" && !"sxlte_plmns" ==> sxlte_on_any_plmn -->

      <!-- List of the non-SVLTE MCCs in which CDMA and HDR are allowed -->
      <mcc_list name="c2k_roaming_mccs"> 440 450 </mcc_list>

      <!-- Define the OOS timer with a 1 minute interval -->
      <define_timer name="noservice" interval="1" units="min" id="1" />

      <!-- Define the 1x_oos timer with a 1 minute interval -->
      <define_timer name="1x_oos" interval="1" units="min" id="100" />

      <!-- Define device configuration as Single SIM -->
      <device_configuration num_sims="1" max_active="1">
        <config>
          <subs id="1" feature="srlte">
            <rat_capability base="none" >
              <include> CDMA HDR GSM WCDMA LTE </include>
            </rat_capability>
          </subs>
        </config>
      </device_configuration>

      <rat_capability subs="1" base="config" />

      <!-- Intial UE mode is CSFB when starting in full rat -->
      <ue_mode subs="1"> CSFB </ue_mode>

      <!-- Define a HOME RF band list that include GW and LTE bands -->
      <rf_band_list name="rf_bands_home">
        <gw_bands base="hardware" />
        <lte_bands base="none">
          <include> 0 2 4 6 37 38 39 40 </include>
        </lte_bands>
        <tds_bands base="none" />
      </rf_band_list>

      <!-- Define an RF band list that excludes TDS bands -->
      <rf_band_list name="rf_bands_gwl">
        <gw_bands base="hardware" />
        <lte_bands base="hardware" />
        <tds_bands base="none" />
      </rf_band_list>

      <!-- Define an RF band list that has GW bands -->
      <rf_band_list name="rf_bands_gw">
        <gw_bands base="hardware" />
        <lte_bands base="none" />
        <tds_bands base="none" />
      </rf_band_list>

      <!-- On any boot, include home bands -->
      <rf_bands subs="1" list="rf_bands_home" />

      <!-- Boolean: Is the device at home? -->
      <boolean_define name="home" initial="true" />
      <boolean_set name="home">
        <ue_mode_is subs="1"> 1X_CSFB_PREF </ue_mode_is>
      </boolean_set>

      <!-- Boolean: Is the device in c2k_roam? -->
      <boolean_define name="c2k_roam" initial="false" />

      <!-- On any boot, power up in limited camping -->
      <svc_mode subs="1"> ALL </svc_mode>

    </actions>
  </initial>

  <!-- RULE #1 -->
  <!-- If we are in LPM, stop the OOS timer.
  -->
  <rule precond="none">
    <conditions>
      <phone_operating_mode> SLEEP </phone_operating_mode>
    </conditions>
    <actions>
      <timer_stop name="noservice" />

      <!-- Enter full rat -->
      <rat_capability subs="1" base="config" />
      <rf_bands subs="1" list="rf_bands_gwl" />
      <svc_mode subs="1"> ALL </svc_mode>
      <ue_mode subs="1"> CSFB </ue_mode>
    </actions>
  </rule>

 <!--
  ====================================================================
    Rules to handle OOS situations and timers.
  ====================================================================
  -->

  <!-- RULE #2 -->
  <!-- If the oos timer has expired and there is no service on other
       subscriptions, enable Full RAT mode with DSDS and restart the timer.
  -->
  <rule precond="none">
    <conditions>
      <timer_expired name="noservice" />
      <service_status_in subs="non-mmode"> OOS POWER_SAVE </service_status_in>
    </conditions>
    <actions>
      <expired_timer_handled name="noservice" />
      <ue_mode subs="1"> CSFB </ue_mode>
      <rat_capability subs="1" base="config" />
      <rf_bands subs="1" list="rf_bands_gwl" />
      <svc_mode subs="1"> ALL </svc_mode>
      <timer_start name="noservice" />
    </actions>
  </rule>

  <!-- RULE #3 -->
  <!-- Stop timer, move to Full Camping and determine location if we have service on any SUBS.
  -->
  <rule precond="none">
    <conditions>
      <have_service />
    </conditions>
    <actions>
      <timer_stop name="noservice" />
      <svc_mode subs="1"> FULL </svc_mode>
      <boolean_set name="home">
        <location_mcc_in list="sxlte_mccs" />
      </boolean_set>
      <boolean_set name="c2k_roam">
        <location_mcc_in list="c2k_roaming_mccs" />
      </boolean_set>
      <continue />
    </actions>
  </rule>

<!--
  ====================================================================
    Rules to keep the UE in a specific mode.
  ====================================================================
  -->

  <!-- RULE #4 -->
  <!-- If SIM card is CSIM/RUIM and USIM is not available with UE in HOME/C2k countries then keep UE in CH+G DSDS.
  -->
  <rule precond="SIM_TYPE">
    <conditions>
      <any_of>
        <sim_type> CSIM </sim_type>
        <sim_type> RUIM </sim_type>
      </any_of>
      <not> <sim_type> 3G </sim_type> </not>
      <any_of>
        <boolean_test name="home" />
        <boolean_test name="c2k_roam" />
      </any_of>
    </conditions>
    <actions>
      <rat_capability subs="1" base="none">
        <include> CDMA HDR </include>
      </rat_capability>
      <rf_bands subs="1" list="rf_bands_gw" />
      <svc_mode subs="1"> FULL </svc_mode>
      <ue_mode subs="1"> CSFB </ue_mode>
    </actions>
  </rule>

  <!-- RULE #5 -->
  <!-- If we are online and we are OOS on all SUBS then start OOS timer.
  -->
  <rule precond="none">
    <conditions>
      <phone_operating_mode> ONLINE </phone_operating_mode>
      <not> <have_service /> </not>
    </conditions>
    <actions>
      <timer_start name="noservice" />
    </actions>
  </rule>

  <!--
  ====================================================================
    Rules where location info can be used and implement SRLTE.
  ====================================================================
  -->

  <!-- RULE #6 -->
  <!-- If we are home, stay in SRLTE configuration with CHL.
  -->
  <rule precond="none">
    <conditions>
      <have_service />
      <boolean_test name="home" />
    </conditions>
    <actions>
      <rf_bands subs="1" list="rf_bands_home" />
      <rat_capability subs="1" base="none">
        <include> CDMA HDR LTE </include>
      </rat_capability>
      <ue_mode subs="1"> 1X_CSFB_PREF </ue_mode>
    </actions>
  </rule>

  <!-- RULE #7 -->
  <!-- If we are Roam in c2k countries, stay in CSFB configuration with RAT capability CHGWL
  -->
  <rule precond="none">
    <conditions>
      <have_service />
      <boolean_test name="c2k_roam" />
    </conditions>
    <actions>
      <rf_bands subs="1" list="rf_bands_gwl" />
      <rat_capability subs="1" base="config" />
      <ue_mode subs="1"> CSFB </ue_mode>
    </actions>
  </rule>

  <!-- RULE #8 -->
  <!-- If we are Roam outside c2k countries, stay in CSFB configuration with RAT capability GWL
  -->
  <rule precond="none">
    <conditions>
      <have_service />
    </conditions>
    <actions>
      <rf_bands subs="1" list="rf_bands_gwl" />
      <rat_capability subs="1" base="none">
        <include> GSM WCDMA LTE </include>
      </rat_capability>
      <ue_mode subs="1"> CSFB </ue_mode>
    </actions>
  </rule>

</policy>

