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;
}
}
use of android.telephony.TelephonyManager in project android_frameworks_base by ResurrectionRemix.
the class DataConnectionStats method startMonitoring.
public void startMonitoring() {
TelephonyManager phone = (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE);
phone.listen(mPhoneStateListener, PhoneStateListener.LISTEN_SERVICE_STATE | PhoneStateListener.LISTEN_SIGNAL_STRENGTHS | PhoneStateListener.LISTEN_DATA_CONNECTION_STATE | PhoneStateListener.LISTEN_DATA_ACTIVITY);
IntentFilter filter = new IntentFilter();
filter.addAction(TelephonyIntents.ACTION_SIM_STATE_CHANGED);
filter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
filter.addAction(ConnectivityManager.INET_CONDITION_ACTION);
mContext.registerReceiver(this, filter);
}
use of android.telephony.TelephonyManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class SmsDefaultDialog method buildDialog.
private boolean buildDialog(String packageName) {
TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
if (!tm.isSmsCapable()) {
// No phone, no SMS
return false;
}
final AlertController.AlertParams p = mAlertParams;
p.mTitle = getString(R.string.sms_change_default_dialog_title);
mNewSmsApplicationData = SmsApplication.getSmsApplicationData(packageName, this);
if (mNewSmsApplicationData != null) {
// New default SMS app specified, change to that directly after the confirmation
// dialog.
SmsApplicationData oldSmsApplicationData = null;
ComponentName oldSmsComponent = SmsApplication.getDefaultSmsApplication(this, true);
if (oldSmsComponent != null) {
oldSmsApplicationData = SmsApplication.getSmsApplicationData(oldSmsComponent.getPackageName(), this);
if (oldSmsApplicationData.mPackageName.equals(mNewSmsApplicationData.mPackageName)) {
return false;
}
}
// Compose dialog; get
if (oldSmsApplicationData != null) {
p.mMessage = getString(R.string.sms_change_default_dialog_text, mNewSmsApplicationData.getApplicationName(this), oldSmsApplicationData.getApplicationName(this));
} else {
p.mMessage = getString(R.string.sms_change_default_no_previous_dialog_text, mNewSmsApplicationData.getApplicationName(this));
}
p.mPositiveButtonText = getString(R.string.yes);
p.mNegativeButtonText = getString(R.string.no);
p.mPositiveButtonListener = this;
p.mNegativeButtonListener = this;
} else {
// No new default SMS app specified, show a list of all SMS apps and let user to pick
p.mAdapter = new AppListAdapter();
p.mOnClickListener = this;
p.mNegativeButtonText = getString(R.string.cancel);
p.mNegativeButtonListener = this;
}
setupAlert();
return true;
}
use of android.telephony.TelephonyManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class CellularDataCondition method onActionClick.
@Override
public void onActionClick(int index) {
if (index == 0) {
TelephonyManager telephony = mManager.getContext().getSystemService(TelephonyManager.class);
telephony.setDataEnabled(true);
setActive(false);
} else {
throw new IllegalArgumentException("Unexpected index " + index);
}
}
use of android.telephony.TelephonyManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class TelephonyUtils method isWorldMode.
private static boolean isWorldMode(Context context) {
boolean worldModeOn = false;
final TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
Resources phoneResources = getPhoneResources(context);
if (phoneResources != null) {
int id = phoneResources.getIdentifier("config_world_mode", "string", "com.android.phone");
if (id > 0) {
final String configString = phoneResources.getString(id);
if (!TextUtils.isEmpty(configString)) {
String[] configArray = configString.split(";");
// and SIM GID value is also set and matches to the current SIM GID.
if (configArray != null && ((configArray.length == 1 && configArray[0].equalsIgnoreCase("true")) || (configArray.length == 2 && !TextUtils.isEmpty(configArray[1]) && tm != null && configArray[1].equalsIgnoreCase(tm.getGroupIdLevel1())))) {
worldModeOn = true;
}
}
} else {
Log.w(TAG, "couldn't find resource of config_world_mode");
}
}
return worldModeOn;
}
Aggregations