use of android.telephony.TelephonyManager in project android_frameworks_base by ResurrectionRemix.
the class DataUsageController method getActiveSubscriberId.
private static String getActiveSubscriberId(Context context) {
final TelephonyManager tele = TelephonyManager.from(context);
final String actualSubscriberId = tele.getSubscriberId(SubscriptionManager.getDefaultDataSubscriptionId());
return actualSubscriberId;
}
use of android.telephony.TelephonyManager in project android_frameworks_base by ResurrectionRemix.
the class TwoGToggle method getScreenOffAction.
protected Runnable getScreenOffAction() {
return new Runnable() {
@Override
public void run() {
TelephonyManager tm = (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE);
Log.d(TAG, "2G = true");
tm.toggle2G(true);
}
};
}
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;
}
Aggregations