Search in sources :

Example 16 with TelephonyManager

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;
}
Also used : TelephonyManager(android.telephony.TelephonyManager)

Example 17 with TelephonyManager

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);
        }
    };
}
Also used : TelephonyManager(android.telephony.TelephonyManager)

Example 18 with TelephonyManager

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);
}
Also used : Context(android.content.Context) TelephonyManager(android.telephony.TelephonyManager)

Example 19 with TelephonyManager

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);
    }
}
Also used : Context(android.content.Context) TelephonyManager(android.telephony.TelephonyManager) Intent(android.content.Intent)

Example 20 with TelephonyManager

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;
}
Also used : TelephonyManager(android.telephony.TelephonyManager) HashSet(java.util.HashSet)

Aggregations

TelephonyManager (android.telephony.TelephonyManager)679 SubscriptionInfo (android.telephony.SubscriptionInfo)64 ConnectivityManager (android.net.ConnectivityManager)59 SubscriptionManager (android.telephony.SubscriptionManager)53 Context (android.content.Context)42 Method (java.lang.reflect.Method)40 Intent (android.content.Intent)34 IOException (java.io.IOException)30 SuppressLint (android.annotation.SuppressLint)29 ArrayList (java.util.ArrayList)26 PhoneAccountHandle (android.telecom.PhoneAccountHandle)24 NetworkTemplate (android.net.NetworkTemplate)22 NetworkPolicyManager.uidRulesToString (android.net.NetworkPolicyManager.uidRulesToString)20 PhoneAccount (android.telecom.PhoneAccount)19 Test (org.junit.Test)18 Preference (android.support.v7.preference.Preference)17 TelecomManager (android.telecom.TelecomManager)17 View (android.view.View)17 DialogInterface (android.content.DialogInterface)16 Resources (android.content.res.Resources)16