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;
}
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;
}
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();
}
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());
}
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;
}
Aggregations