use of android.telephony.RadioAccessFamily in project android_frameworks_opt_telephony by LineageOS.
the class ProxyController method completeRadioCapabilityTransaction.
@UnsupportedAppUsage
private void completeRadioCapabilityTransaction() {
// Create the intent to broadcast
Intent intent;
logd("onFinishRadioCapabilityResponse: success=" + !mTransactionFailed);
if (!mTransactionFailed) {
ArrayList<RadioAccessFamily> phoneRAFList = new ArrayList<RadioAccessFamily>();
for (int i = 0; i < mPhones.length; i++) {
int raf = mPhones[i].getRadioAccessFamily();
logd("radioAccessFamily[" + i + "]=" + raf);
RadioAccessFamily phoneRC = new RadioAccessFamily(i, raf);
phoneRAFList.add(phoneRC);
}
intent = new Intent(TelephonyIntents.ACTION_SET_RADIO_CAPABILITY_DONE);
intent.putParcelableArrayListExtra(TelephonyIntents.EXTRA_RADIO_ACCESS_FAMILY, phoneRAFList);
// make messages about the old transaction obsolete (specifically the timeout)
mRadioCapabilitySessionId = mUniqueIdGenerator.getAndIncrement();
// Reinitialize
clearTransaction();
} else {
intent = new Intent(TelephonyIntents.ACTION_SET_RADIO_CAPABILITY_FAILED);
// now revert.
mTransactionFailed = false;
RadioAccessFamily[] rafs = new RadioAccessFamily[mPhones.length];
for (int phoneId = 0; phoneId < mPhones.length; phoneId++) {
rafs[phoneId] = new RadioAccessFamily(phoneId, mOldRadioAccessFamily[phoneId]);
}
doSetRadioCapabilities(rafs);
}
// Broadcast that we're done
mContext.sendBroadcast(intent, android.Manifest.permission.READ_PHONE_STATE);
}
use of android.telephony.RadioAccessFamily in project android_frameworks_opt_telephony by LineageOS.
the class SubscriptionController method setDefaultDataSubId.
@UnsupportedAppUsage
@Override
public void setDefaultDataSubId(int subId) {
enforceModifyPhoneState("setDefaultDataSubId");
final long identity = Binder.clearCallingIdentity();
try {
if (subId == SubscriptionManager.DEFAULT_SUBSCRIPTION_ID) {
throw new RuntimeException("setDefaultDataSubId called with DEFAULT_SUB_ID");
}
ProxyController proxyController = ProxyController.getInstance();
int len = TelephonyManager.from(mContext).getActiveModemCount();
logdl("[setDefaultDataSubId] num phones=" + len + ", subId=" + subId);
if (SubscriptionManager.isValidSubscriptionId(subId)) {
// Only re-map modems if the new default data sub is valid
RadioAccessFamily[] rafs = new RadioAccessFamily[len];
boolean atLeastOneMatch = false;
for (int phoneId = 0; phoneId < len; phoneId++) {
Phone phone = PhoneFactory.getPhone(phoneId);
int raf;
int id = phone.getSubId();
if (id == subId) {
// TODO Handle the general case of N modems and M subscriptions.
raf = proxyController.getMaxRafSupported();
atLeastOneMatch = true;
} else {
// TODO Handle the general case of N modems and M subscriptions.
raf = proxyController.getMinRafSupported();
}
logdl("[setDefaultDataSubId] phoneId=" + phoneId + " subId=" + id + " RAF=" + raf);
rafs[phoneId] = new RadioAccessFamily(phoneId, raf);
}
if (atLeastOneMatch) {
proxyController.setRadioCapability(rafs);
} else {
if (DBG)
logdl("[setDefaultDataSubId] no valid subId's found - not updating.");
}
}
int previousDefaultSub = getDefaultSubId();
setGlobalSetting(Settings.Global.MULTI_SIM_DATA_CALL_SUBSCRIPTION, subId);
MultiSimSettingController.getInstance().notifyDefaultDataSubChanged();
broadcastDefaultDataSubIdChanged(subId);
if (previousDefaultSub != getDefaultSubId()) {
sendDefaultChangedBroadcast(getDefaultSubId());
}
} finally {
Binder.restoreCallingIdentity(identity);
}
}
Aggregations