use of android.telephony.SubscriptionInfo in project android_frameworks_base by ResurrectionRemix.
the class KeyguardSimPukView method showDefaultMessage.
private void showDefaultMessage() {
if (mRemainingAttempts >= 0) {
mSecurityMessageDisplay.setMessage(getPukPasswordErrorMessage(mRemainingAttempts, true), true);
return;
}
int count = TelephonyManager.getDefault().getSimCount();
Resources rez = getResources();
final String msg;
int color = Color.WHITE;
if (count < 2) {
msg = rez.getString(R.string.kg_puk_enter_puk_hint);
} else {
SubscriptionInfo info = KeyguardUpdateMonitor.getInstance(mContext).getSubscriptionInfoForSubId(mSubId);
CharSequence displayName = info != null ? info.getDisplayName() : "";
msg = rez.getString(R.string.kg_puk_enter_puk_hint_multi, displayName);
if (info != null) {
color = info.getIconTint();
}
}
mSecurityMessageDisplay.setMessage(msg, true);
mSimImageView.setImageTintList(ColorStateList.valueOf(color));
new CheckSimPuk("", "", mSubId) {
void onSimLockChangedResponse(final int result, final int attemptsRemaining) {
Log.d(LOG_TAG, "onSimCheckResponse " + " dummy One result" + result + " attemptsRemaining=" + attemptsRemaining);
if (attemptsRemaining >= 0) {
mRemainingAttempts = attemptsRemaining;
mSecurityMessageDisplay.setMessage(getPukPasswordErrorMessage(attemptsRemaining, true), true);
}
}
}.start();
}
use of android.telephony.SubscriptionInfo in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class ResetNetwork method showFinalConfirmation.
private void showFinalConfirmation() {
Bundle args = new Bundle();
if (mSubscriptions != null && mSubscriptions.size() > 0) {
int selectedIndex = mSubscriptionSpinner.getSelectedItemPosition();
SubscriptionInfo subscription = mSubscriptions.get(selectedIndex);
args.putInt(PhoneConstants.SUBSCRIPTION_KEY, subscription.getSubscriptionId());
}
((SettingsActivity) getActivity()).startPreferencePanel(ResetNetworkConfirm.class.getName(), args, R.string.reset_network_confirm_title, null, null, 0);
}
use of android.telephony.SubscriptionInfo in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class SimSettings method onCreate.
@Override
public void onCreate(final Bundle bundle) {
super.onCreate(bundle);
mContext = getActivity();
mSubscriptionManager = SubscriptionManager.from(getActivity());
final TelephonyManager tm = (TelephonyManager) getActivity().getSystemService(Context.TELEPHONY_SERVICE);
mExtTelephony = IExtTelephony.Stub.asInterface(ServiceManager.getService("extphone"));
addPreferencesFromResource(R.xml.sim_settings);
mNoSims = (SwitchPreference) findPreference(SIM_EMPTY_SWITCH);
mNumSlots = tm.getSimCount();
mSimCards = (PreferenceCategory) findPreference(SIM_CARD_CATEGORY);
mMobileNetwork = (PreferenceCategory) findPreference(MOBILE_NETWORK_CATEGORY);
mAvailableSubInfos = new ArrayList<SubscriptionInfo>(mNumSlots);
mSelectableSubInfos = new ArrayList<SubscriptionInfo>();
SimSelectNotification.cancelNotification(getActivity());
IntentFilter intentFilter = new IntentFilter(ACTION_UICC_MANUAL_PROVISION_STATUS_CHANGED);
mContext.registerReceiver(mReceiver, intentFilter);
}
use of android.telephony.SubscriptionInfo in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class SimSettings method updateCellularDataValues.
private void updateCellularDataValues() {
final Preference simPref = findPreference(KEY_CELLULAR_DATA);
final SubscriptionInfo sir = mSubscriptionManager.getDefaultDataSubscriptionInfo();
simPref.setTitle(R.string.cellular_data_title);
if (DBG)
log("[updateCellularDataValues] mSubInfoList=" + mSubInfoList);
boolean callStateIdle = isCallStateIdle();
final boolean ecbMode = SystemProperties.getBoolean(TelephonyProperties.PROPERTY_INECM_MODE, false);
if (sir != null) {
simPref.setSummary(sir.getDisplayName());
// Enable data preference in msim mode and call state idle
simPref.setEnabled((mSelectableSubInfos.size() > 1) && callStateIdle && !ecbMode);
} else if (sir == null) {
simPref.setSummary(R.string.sim_selection_required_pref);
// Enable data preference in msim mode and call state idle
simPref.setEnabled((mSelectableSubInfos.size() >= 1) && callStateIdle && !ecbMode);
}
if (mNoSims != null) {
mNoSims.setEnabled(mSelectableSubInfos.size() >= 1);
}
}
use of android.telephony.SubscriptionInfo in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class SimSettings method updateSubscriptions.
private void updateSubscriptions() {
mSubInfoList = mSubscriptionManager.getActiveSubscriptionInfoList();
for (int i = 0; i < mNumSlots; ++i) {
Preference pref = mSimCards.findPreference("sim" + i);
if (pref instanceof SimPreference) {
mSimCards.removePreference(pref);
}
}
mMobileNetwork.removeAll();
mAvailableSubInfos.clear();
mSelectableSubInfos.clear();
for (int i = 0; i < mNumSlots; ++i) {
final SubscriptionInfo sir = mSubscriptionManager.getActiveSubscriptionInfoForSimSlotIndex(i);
final int subscriptionId = sir != null ? sir.getSubscriptionId() : SubscriptionManager.INVALID_SUBSCRIPTION_ID;
SimPreference simPreference = new SimEnablerPreference(getPrefContext(), sir, i);
simPreference.setOrder(i - mNumSlots);
mSimCards.addPreference(simPreference);
mAvailableSubInfos.add(sir);
if (sir != null && mUiccProvisionStatus[i] == PROVISIONED) {
mSelectableSubInfos.add(sir);
}
Intent mobileNetworkIntent = new Intent();
mobileNetworkIntent.setComponent(new ComponentName("com.android.phone", "com.android.phone.MobileNetworkSettings"));
SubscriptionManager.putPhoneIdAndSubIdExtra(mobileNetworkIntent, i, subscriptionId);
Preference mobileNetworkPref = new Preference(getActivity());
mobileNetworkPref.setTitle(getString(R.string.sim_mobile_network_settings_title, (i + 1)));
mobileNetworkPref.setIntent(mobileNetworkIntent);
mobileNetworkPref.setEnabled(subscriptionId != SubscriptionManager.INVALID_SUBSCRIPTION_ID);
mMobileNetwork.addPreference(mobileNetworkPref);
}
updateAllOptions();
}
Aggregations