Search in sources :

Example 26 with TelephonyManager

use of android.telephony.TelephonyManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class TetherSettings method setDefaultValue.

private boolean setDefaultValue(Context ctx, boolean default_ssid, boolean clear_password) {
    WifiManager wifiManager = (WifiManager) ctx.getSystemService(Context.WIFI_SERVICE);
    if (wifiManager == null) {
        return false;
    }
    WifiConfiguration wifiAPConfig = wifiManager.getWifiApConfiguration();
    if (wifiAPConfig == null) {
        return false;
    }
    if (default_ssid) {
        TelephonyManager tm = (TelephonyManager) ctx.getSystemService(Context.TELEPHONY_SERVICE);
        String deviceId = tm.getDeviceId();
        String lastFourDigits = "";
        if ((deviceId != null) && (deviceId.length() > 3)) {
            lastFourDigits = deviceId.substring(deviceId.length() - 4);
        }
        wifiAPConfig.SSID = Build.MODEL;
        if ((!TextUtils.isEmpty(lastFourDigits)) && (wifiAPConfig.SSID != null) && (wifiAPConfig.SSID.indexOf(lastFourDigits) < 0)) {
            wifiAPConfig.SSID += " " + lastFourDigits;
        }
    }
    if (clear_password) {
        wifiAPConfig.preSharedKey = "";
    }
    wifiManager.setWifiApConfiguration(wifiAPConfig);
    return true;
}
Also used : WifiManager(android.net.wifi.WifiManager) WifiConfiguration(android.net.wifi.WifiConfiguration) TelephonyManager(android.telephony.TelephonyManager)

Example 27 with TelephonyManager

use of android.telephony.TelephonyManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class DefaultPhonePreference method isAvailable.

@Override
public boolean isAvailable(Context context) {
    final TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    if (!tm.isVoiceCapable()) {
        return false;
    }
    final UserManager um = (UserManager) context.getSystemService(Context.USER_SERVICE);
    final boolean hasUserRestriction = um.hasUserRestriction(UserManager.DISALLOW_OUTGOING_CALLS);
    final CharSequence[] entries = getEntries();
    return !hasUserRestriction && entries != null && entries.length > 0;
}
Also used : TelephonyManager(android.telephony.TelephonyManager) UserManager(android.os.UserManager)

Example 28 with TelephonyManager

use of android.telephony.TelephonyManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class DefaultSmsPreference method isAvailable.

@Override
public boolean isAvailable(Context context) {
    boolean isRestrictedUser = UserManager.get(context).getUserInfo(UserHandle.myUserId()).isRestricted();
    TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    return !isRestrictedUser && tm.isSmsCapable();
}
Also used : TelephonyManager(android.telephony.TelephonyManager)

Example 29 with TelephonyManager

use of android.telephony.TelephonyManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class ImeiInformation method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mSubscriptionManager = SubscriptionManager.from(getContext());
    final TelephonyManager telephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
    initPreferenceScreen(telephonyManager.getSimCount());
}
Also used : TelephonyManager(android.telephony.TelephonyManager)

Example 30 with TelephonyManager

use of android.telephony.TelephonyManager in project android_frameworks_base by DirtyUnicorns.

the class CarrierLabel method getOperatorName.

private String getOperatorName() {
    String operatorName = getContext().getString(R.string.quick_settings_wifi_no_network);
    TelephonyManager telephonyManager = (TelephonyManager) getContext().getSystemService(Context.TELEPHONY_SERVICE);
    if (isCN) {
        String operator = telephonyManager.getNetworkOperator();
        if (TextUtils.isEmpty(operator)) {
            operator = telephonyManager.getSimOperator();
        }
        SpnOverride mSpnOverride = new SpnOverride();
        operatorName = mSpnOverride.getSpn(operator);
    } else {
        operatorName = telephonyManager.getNetworkOperatorName();
    }
    if (TextUtils.isEmpty(operatorName)) {
        operatorName = telephonyManager.getSimOperatorName();
    }
    return operatorName;
}
Also used : TelephonyManager(android.telephony.TelephonyManager) SpnOverride(com.android.systemui.du.carrierlabel.SpnOverride)

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