use of android.telephony.TelephonyManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class SimSettings method onResume.
@Override
public void onResume() {
super.onResume();
mSubscriptionManager.addOnSubscriptionsChangedListener(mOnSubscriptionsChangeListener);
updateSubscriptions();
final TelephonyManager tm = (TelephonyManager) getActivity().getSystemService(Context.TELEPHONY_SERVICE);
if (mSelectableSubInfos.size() > 1) {
Log.d(TAG, "Register for call state change");
for (int i = 0; i < mPhoneCount; i++) {
int subId = mSelectableSubInfos.get(i).getSubscriptionId();
tm.listen(getPhoneStateListener(i, subId), PhoneStateListener.LISTEN_CALL_STATE);
}
}
}
use of android.telephony.TelephonyManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class WifiCallingSettings method onPause.
@Override
public void onPause() {
super.onPause();
final Context context = getActivity();
if (mValidListener) {
mValidListener = false;
TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
tm.listen(mPhoneStateListener, PhoneStateListener.LISTEN_NONE);
mSwitchBar.removeOnSwitchChangeListener(this);
}
context.unregisterReceiver(mIntentReceiver);
}
use of android.telephony.TelephonyManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class WifiCallingSettings method onResume.
@Override
public void onResume() {
super.onResume();
final Context context = getActivity();
if (ImsManager.isWfcEnabledByPlatform(context)) {
TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
tm.listen(mPhoneStateListener, PhoneStateListener.LISTEN_CALL_STATE);
mSwitchBar.addOnSwitchChangeListener(this);
mValidListener = true;
}
// NOTE: Buttons will be enabled/disabled in mPhoneStateListener
boolean wfcEnabled = ImsManager.isWfcEnabledByUser(context) && ImsManager.isNonTtyOrTtyOnVolteEnabled(context);
mSwitch.setChecked(wfcEnabled);
int wfcMode = ImsManager.getWfcMode(context, false);
int wfcRoamingMode = ImsManager.getWfcMode(context, true);
mButtonWfcMode.setValue(Integer.toString(wfcMode));
mButtonWfcRoamingMode.setValue(Integer.toString(wfcRoamingMode));
updateButtonWfcMode(context, wfcEnabled, wfcMode, wfcRoamingMode);
context.registerReceiver(mIntentReceiver, mIntentFilter);
Intent intent = getActivity().getIntent();
if (intent.getBooleanExtra(Phone.EXTRA_KEY_ALERT_SHOW, false)) {
showAlert(intent);
}
}
use of android.telephony.TelephonyManager in project android_frameworks_base by ResurrectionRemix.
the class LocaleStore method getSimCountries.
private static Set<String> getSimCountries(Context context) {
Set<String> result = new HashSet<>();
TelephonyManager tm = TelephonyManager.from(context);
if (tm != null) {
String iso = tm.getSimCountryIso().toUpperCase(Locale.US);
if (!iso.isEmpty()) {
result.add(iso);
}
iso = tm.getNetworkCountryIso().toUpperCase(Locale.US);
if (!iso.isEmpty()) {
result.add(iso);
}
}
return result;
}
use of android.telephony.TelephonyManager in project android_frameworks_base by ResurrectionRemix.
the class OMADMAdapter method isSprint.
private static boolean isSprint(Context context) {
TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
String simOperator = tm.getSimOperator();
String imsi = tm.getSubscriberId();
/* Use MEID for sprint */
if ("310120".equals(simOperator) || (imsi != null && imsi.startsWith("310120"))) {
return true;
} else {
return false;
}
}
Aggregations