You might consider defining constants for the various SIM modes ( ie. SIM_1_ACTIVE, SIM_2_ACTIVE, BOTH_SIM_INACTIVE ), as it'd make this code easier to understand.  Magic constants aren't a good thing.