use of com.android.internal.telephony.OperatorInfo in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class CellInfoUtil method getOperatorInfoFromCellInfo.
/**
* Wrap a cell info into an operator info.
*/
public static OperatorInfo getOperatorInfoFromCellInfo(CellInfo cellInfo) {
OperatorInfo oi;
if (cellInfo instanceof CellInfoLte) {
CellInfoLte lte = (CellInfoLte) cellInfo;
oi = new OperatorInfo((String) lte.getCellIdentity().getOperatorAlphaLong(), (String) lte.getCellIdentity().getOperatorAlphaShort(), lte.getCellIdentity().getMobileNetworkOperator());
} else if (cellInfo instanceof CellInfoWcdma) {
CellInfoWcdma wcdma = (CellInfoWcdma) cellInfo;
oi = new OperatorInfo((String) wcdma.getCellIdentity().getOperatorAlphaLong(), (String) wcdma.getCellIdentity().getOperatorAlphaShort(), wcdma.getCellIdentity().getMobileNetworkOperator());
} else if (cellInfo instanceof CellInfoGsm) {
CellInfoGsm gsm = (CellInfoGsm) cellInfo;
oi = new OperatorInfo((String) gsm.getCellIdentity().getOperatorAlphaLong(), (String) gsm.getCellIdentity().getOperatorAlphaShort(), gsm.getCellIdentity().getMobileNetworkOperator());
} else if (cellInfo instanceof CellInfoCdma) {
CellInfoCdma cdma = (CellInfoCdma) cellInfo;
oi = new OperatorInfo((String) cdma.getCellIdentity().getOperatorAlphaLong(), (String) cdma.getCellIdentity().getOperatorAlphaShort(), "");
} else {
Log.e(TAG, "Invalid CellInfo type");
oi = new OperatorInfo("", "", "");
}
return oi;
}
use of com.android.internal.telephony.OperatorInfo in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class NetworkSelectSettings method onPreferenceTreeClick.
@Override
public boolean onPreferenceTreeClick(Preference preference) {
if (preference != mSelectedPreference) {
stopNetworkQuery();
// Refresh the last selected item in case users reselect network.
if (mSelectedPreference != null) {
mSelectedPreference.setSummary(null);
}
mSelectedPreference = (NetworkOperatorPreference) preference;
CellInfo cellInfo = mSelectedPreference.getCellInfo();
mSelectedPreference.setSummary(R.string.network_connecting);
mMetricsFeatureProvider.action(getContext(), SettingsEnums.ACTION_MOBILE_NETWORK_MANUAL_SELECT_NETWORK);
// Set summary as "Disconnected" to the previously connected network
if (mConnectedPreferenceCategory.getPreferenceCount() > 0) {
NetworkOperatorPreference connectedNetworkOperator = (NetworkOperatorPreference) (mConnectedPreferenceCategory.getPreference(0));
if (!CellInfoUtil.getNetworkTitle(cellInfo).equals(CellInfoUtil.getNetworkTitle(connectedNetworkOperator.getCellInfo()))) {
connectedNetworkOperator.setSummary(R.string.network_disconnected);
}
}
setProgressBarVisible(true);
// Disable the screen until network is manually set
getPreferenceScreen().setEnabled(false);
final OperatorInfo operatorInfo = CellInfoUtil.getOperatorInfoFromCellInfo(cellInfo);
ThreadUtils.postOnBackgroundThread(() -> {
Message msg = mHandler.obtainMessage(EVENT_SET_NETWORK_SELECTION_MANUALLY_DONE);
msg.obj = mTelephonyManager.setNetworkSelectionModeManual(operatorInfo, true);
msg.sendToTarget();
});
}
return true;
}
Aggregations