Merge "Fix "No Service" in QS when Airplane Mode" into qt-dev
am: e55986b8f9
Change-Id: Ifbfe0e38dedfb2c2a0cb2c20e8eef1b282fda530
This commit is contained in:
@@ -311,20 +311,23 @@ public class CarrierTextController {
|
|||||||
|
|
||||||
displayText = updateCarrierTextWithSimIoError(displayText, carrierNames, subOrderBySlot,
|
displayText = updateCarrierTextWithSimIoError(displayText, carrierNames, subOrderBySlot,
|
||||||
allSimsMissing);
|
allSimsMissing);
|
||||||
|
boolean airplaneMode = false;
|
||||||
// APM (airplane mode) != no carrier state. There are carrier services
|
// APM (airplane mode) != no carrier state. There are carrier services
|
||||||
// (e.g. WFC = Wi-Fi calling) which may operate in APM.
|
// (e.g. WFC = Wi-Fi calling) which may operate in APM.
|
||||||
if (!anySimReadyAndInService && WirelessUtils.isAirplaneModeOn(mContext)) {
|
if (!anySimReadyAndInService && WirelessUtils.isAirplaneModeOn(mContext)) {
|
||||||
displayText = getAirplaneModeMessage();
|
displayText = getAirplaneModeMessage();
|
||||||
|
airplaneMode = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TextUtils.isEmpty(displayText)) {
|
if (TextUtils.isEmpty(displayText) && !airplaneMode) {
|
||||||
displayText = TextUtils.join(mSeparator, carrierNames);
|
displayText = TextUtils.join(mSeparator, carrierNames);
|
||||||
}
|
}
|
||||||
final CarrierTextCallbackInfo info = new CarrierTextCallbackInfo(
|
final CarrierTextCallbackInfo info = new CarrierTextCallbackInfo(
|
||||||
displayText,
|
displayText,
|
||||||
carrierNames,
|
carrierNames,
|
||||||
!allSimsMissing,
|
!allSimsMissing,
|
||||||
subsIds);
|
subsIds,
|
||||||
|
airplaneMode);
|
||||||
postToCallback(info);
|
postToCallback(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -525,14 +528,22 @@ public class CarrierTextController {
|
|||||||
public final CharSequence[] listOfCarriers;
|
public final CharSequence[] listOfCarriers;
|
||||||
public final boolean anySimReady;
|
public final boolean anySimReady;
|
||||||
public final int[] subscriptionIds;
|
public final int[] subscriptionIds;
|
||||||
|
public boolean airplaneMode;
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
public CarrierTextCallbackInfo(CharSequence carrierText, CharSequence[] listOfCarriers,
|
public CarrierTextCallbackInfo(CharSequence carrierText, CharSequence[] listOfCarriers,
|
||||||
boolean anySimReady, int[] subscriptionIds) {
|
boolean anySimReady, int[] subscriptionIds) {
|
||||||
|
this(carrierText, listOfCarriers, anySimReady, subscriptionIds, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@VisibleForTesting
|
||||||
|
public CarrierTextCallbackInfo(CharSequence carrierText, CharSequence[] listOfCarriers,
|
||||||
|
boolean anySimReady, int[] subscriptionIds, boolean airplaneMode) {
|
||||||
this.carrierText = carrierText;
|
this.carrierText = carrierText;
|
||||||
this.listOfCarriers = listOfCarriers;
|
this.listOfCarriers = listOfCarriers;
|
||||||
this.anySimReady = anySimReady;
|
this.anySimReady = anySimReady;
|
||||||
this.subscriptionIds = subscriptionIds;
|
this.subscriptionIds = subscriptionIds;
|
||||||
|
this.airplaneMode = airplaneMode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -139,43 +139,49 @@ public class QSCarrierGroup extends LinearLayout implements
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateCarrierInfo(CarrierTextController.CarrierTextCallbackInfo info) {
|
public void updateCarrierInfo(CarrierTextController.CarrierTextCallbackInfo info) {
|
||||||
if (info.anySimReady) {
|
if (info.airplaneMode) {
|
||||||
boolean[] slotSeen = new boolean[SIM_SLOTS];
|
setVisibility(View.GONE);
|
||||||
if (info.listOfCarriers.length == info.subscriptionIds.length) {
|
} else {
|
||||||
for (int i = 0; i < SIM_SLOTS && i < info.listOfCarriers.length; i++) {
|
setVisibility(View.VISIBLE);
|
||||||
int slot = getSlotIndex(info.subscriptionIds[i]);
|
if (info.anySimReady) {
|
||||||
if (slot >= SIM_SLOTS) {
|
boolean[] slotSeen = new boolean[SIM_SLOTS];
|
||||||
Log.w(TAG, "updateInfoCarrier - slot: " + slot);
|
if (info.listOfCarriers.length == info.subscriptionIds.length) {
|
||||||
continue;
|
for (int i = 0; i < SIM_SLOTS && i < info.listOfCarriers.length; i++) {
|
||||||
|
int slot = getSlotIndex(info.subscriptionIds[i]);
|
||||||
|
if (slot >= SIM_SLOTS) {
|
||||||
|
Log.w(TAG, "updateInfoCarrier - slot: " + slot);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (slot == SubscriptionManager.INVALID_SIM_SLOT_INDEX) {
|
||||||
|
Log.e(TAG,
|
||||||
|
"Invalid SIM slot index for subscription: "
|
||||||
|
+ info.subscriptionIds[i]);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
mInfos[slot].visible = true;
|
||||||
|
slotSeen[slot] = true;
|
||||||
|
mCarrierGroups[slot].setCarrierText(
|
||||||
|
info.listOfCarriers[i].toString().trim());
|
||||||
|
mCarrierGroups[slot].setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
if (slot == SubscriptionManager.INVALID_SIM_SLOT_INDEX) {
|
for (int i = 0; i < SIM_SLOTS; i++) {
|
||||||
Log.e(TAG,
|
if (!slotSeen[i]) {
|
||||||
"Invalid SIM slot index for subscription: "
|
mInfos[i].visible = false;
|
||||||
+ info.subscriptionIds[i]);
|
mCarrierGroups[i].setVisibility(View.GONE);
|
||||||
continue;
|
}
|
||||||
}
|
|
||||||
mInfos[slot].visible = true;
|
|
||||||
slotSeen[slot] = true;
|
|
||||||
mCarrierGroups[slot].setCarrierText(info.listOfCarriers[i].toString().trim());
|
|
||||||
mCarrierGroups[slot].setVisibility(View.VISIBLE);
|
|
||||||
}
|
|
||||||
for (int i = 0; i < SIM_SLOTS; i++) {
|
|
||||||
if (!slotSeen[i]) {
|
|
||||||
mInfos[i].visible = false;
|
|
||||||
mCarrierGroups[i].setVisibility(View.GONE);
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
Log.e(TAG, "Carrier information arrays not of same length");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Log.e(TAG, "Carrier information arrays not of same length");
|
mInfos[0].visible = false;
|
||||||
}
|
mCarrierGroups[0].setCarrierText(info.carrierText);
|
||||||
} else {
|
mCarrierGroups[0].setVisibility(View.VISIBLE);
|
||||||
mInfos[0].visible = false;
|
for (int i = 1; i < SIM_SLOTS; i++) {
|
||||||
mCarrierGroups[0].setCarrierText(info.carrierText);
|
mInfos[i].visible = false;
|
||||||
mCarrierGroups[0].setVisibility(View.VISIBLE);
|
mCarrierGroups[i].setCarrierText("");
|
||||||
for (int i = 1; i < SIM_SLOTS; i++) {
|
mCarrierGroups[i].setVisibility(View.GONE);
|
||||||
mInfos[i].visible = false;
|
}
|
||||||
mCarrierGroups[i].setCarrierText("");
|
|
||||||
mCarrierGroups[i].setVisibility(View.GONE);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
handleUpdateState();
|
handleUpdateState();
|
||||||
|
|||||||
Reference in New Issue
Block a user