Search in sources :

Example 76 with TelephonyManager

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

Example 77 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 78 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 79 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)

Example 80 with TelephonyManager

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

Aggregations

TelephonyManager (android.telephony.TelephonyManager)294 NetworkPolicyManager.uidRulesToString (android.net.NetworkPolicyManager.uidRulesToString)20 SubscriptionManager (android.telephony.SubscriptionManager)20 Test (org.junit.Test)15 ConnectivityManager (android.net.ConnectivityManager)14 Context (android.content.Context)11 Intent (android.content.Intent)11 NetworkIdentity (android.net.NetworkIdentity)11 Method (java.lang.reflect.Method)11 GsmCellLocation (android.telephony.gsm.GsmCellLocation)10 PackageManager (android.content.pm.PackageManager)9 SubscriptionInfo (android.telephony.SubscriptionInfo)9 IntentFilter (android.content.IntentFilter)8 IOException (java.io.IOException)8 PackageInfo (android.content.pm.PackageInfo)7 ServiceState (android.telephony.ServiceState)7 NetworkPolicy (android.net.NetworkPolicy)6 WifiManager (android.net.wifi.WifiManager)6 DevicePolicyManagerInternal (android.app.admin.DevicePolicyManagerInternal)5 SharedPreferences (android.content.SharedPreferences)5