Merge "[mainline] Decouple ServiceState.bitmaskHasTech and getBitmaskForTech"

This commit is contained in:
SongFerng Wang
2019-12-18 01:36:08 +00:00
committed by Gerrit Code Review

View File

@@ -29,7 +29,6 @@ import android.os.Bundle;
import android.os.PersistableBundle;
import android.provider.Telephony;
import android.telephony.CarrierConfigManager;
import android.telephony.ServiceState;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
@@ -1000,7 +999,7 @@ public class ApnEditor extends SettingsPreferenceFragment
bearerBitmask = 0;
break;
} else {
bearerBitmask |= ServiceState.getBitmaskForTech(Integer.parseInt(bearer));
bearerBitmask |= getBitmaskForTech(Integer.parseInt(bearer));
}
}
callUpdate = setIntValueAndCheckIfDiff(values,
@@ -1012,7 +1011,7 @@ public class ApnEditor extends SettingsPreferenceFragment
int bearerVal;
if (bearerBitmask == 0 || mBearerInitialVal == 0) {
bearerVal = 0;
} else if (ServiceState.bitmaskHasTech(bearerBitmask, mBearerInitialVal)) {
} else if (bitmaskHasTech(bearerBitmask, mBearerInitialVal)) {
bearerVal = mBearerInitialVal;
} else {
// bearer field was being used but bitmask has changed now and does not include the
@@ -1304,4 +1303,20 @@ public class ApnEditor extends SettingsPreferenceFragment
return (String) mData[index];
}
}
private static int getBitmaskForTech(int radioTech) {
if (radioTech >= 1) {
return (1 << (radioTech - 1));
}
return 0;
}
private static boolean bitmaskHasTech(int bearerBitmask, int radioTech) {
if (bearerBitmask == 0) {
return true;
} else if (radioTech >= 1) {
return ((bearerBitmask & (1 << (radioTech - 1))) != 0);
}
return false;
}
}