Search in sources :

Example 26 with SubscriptionInfo

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();
}
Also used : SubscriptionInfo(android.telephony.SubscriptionInfo) Resources(android.content.res.Resources)

Example 27 with SubscriptionInfo

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

Example 28 with SubscriptionInfo

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

Example 29 with SubscriptionInfo

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);
    }
}
Also used : Preference(android.support.v7.preference.Preference) SwitchPreference(android.support.v14.preference.SwitchPreference) SubscriptionInfo(android.telephony.SubscriptionInfo)

Example 30 with SubscriptionInfo

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();
}
Also used : Preference(android.support.v7.preference.Preference) SwitchPreference(android.support.v14.preference.SwitchPreference) SubscriptionInfo(android.telephony.SubscriptionInfo) Intent(android.content.Intent) ComponentName(android.content.ComponentName)

Aggregations

SubscriptionInfo (android.telephony.SubscriptionInfo)89 ArrayList (java.util.ArrayList)27 Intent (android.content.Intent)14 SubscriptionManager (android.telephony.SubscriptionManager)13 IntentFilter (android.content.IntentFilter)12 Resources (android.content.res.Resources)9 TelephonyManager (android.telephony.TelephonyManager)9 ServiceState (android.telephony.ServiceState)7 BitSet (java.util.BitSet)7 RemoteException (android.os.RemoteException)5 Preference (android.support.v7.preference.Preference)5 IccCardConstants (com.android.internal.telephony.IccCardConstants)5 State (com.android.internal.telephony.IccCardConstants.State)5 ContentResolver (android.content.ContentResolver)4 PersistentDataBlockManager (android.service.persistentdata.PersistentDataBlockManager)4 SwitchPreference (android.support.v14.preference.SwitchPreference)4 PhoneAccountHandle (android.telecom.PhoneAccountHandle)4 TelecomManager (android.telecom.TelecomManager)3 TargetApi (android.annotation.TargetApi)2 AlertDialog (android.app.AlertDialog)2