[mainline] decouple ServiceState.bitmaskHasTech and getBitmaskForTech
Bug: 146314969 Test: Build pass. make RunSettingsRoboTests ROBOTEST_FILTER=ApnEditorTest Change-Id: I1600a96a729fc3b555eab5bc80b069663c8eb00a
This commit is contained in:
@@ -27,7 +27,6 @@ import android.os.Bundle;
|
||||
import android.os.PersistableBundle;
|
||||
import android.provider.Telephony;
|
||||
import android.telephony.CarrierConfigManager;
|
||||
import android.telephony.ServiceState;
|
||||
import android.telephony.SubscriptionInfo;
|
||||
import android.telephony.SubscriptionManager;
|
||||
import android.telephony.TelephonyManager;
|
||||
@@ -1025,7 +1024,7 @@ public class ApnEditor extends SettingsPreferenceFragment
|
||||
bearerBitmask = 0;
|
||||
break;
|
||||
} else {
|
||||
bearerBitmask |= ServiceState.getBitmaskForTech(Integer.parseInt(bearer));
|
||||
bearerBitmask |= getBitmaskForTech(Integer.parseInt(bearer));
|
||||
}
|
||||
}
|
||||
callUpdate = setIntValueAndCheckIfDiff(values,
|
||||
@@ -1037,7 +1036,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
|
||||
@@ -1329,4 +1328,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;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user