Search in sources :

Example 91 with SubscriptionInfo

use of android.telephony.SubscriptionInfo in project android_packages_apps_Settings by DirtyUnicorns.

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);
    mNumSlots = tm.getSimCount();
    mSimCards = (PreferenceCategory) findPreference(SIM_CARD_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 92 with SubscriptionInfo

use of android.telephony.SubscriptionInfo in project android_packages_apps_Settings by DirtyUnicorns.

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

Example 93 with SubscriptionInfo

use of android.telephony.SubscriptionInfo in project android_packages_apps_Settings by DirtyUnicorns.

the class SimSettings method updateSmsValues.

private void updateSmsValues() {
    final Preference simPref = findPreference(KEY_SMS);
    final SubscriptionInfo sir = mSubscriptionManager.getDefaultSmsSubscriptionInfo();
    simPref.setTitle(R.string.sms_messages_title);
    if (DBG)
        log("[updateSmsValues] mSubInfoList=" + mSubInfoList);
    if (sir != null) {
        simPref.setSummary(sir.getDisplayName());
        simPref.setEnabled(mSelectableSubInfos.size() > 1);
    } else if (sir == null) {
        simPref.setSummary(R.string.sim_selection_required_pref);
        simPref.setEnabled(mSelectableSubInfos.size() >= 1);
    }
}
Also used : Preference(android.support.v7.preference.Preference) SubscriptionInfo(android.telephony.SubscriptionInfo)

Example 94 with SubscriptionInfo

use of android.telephony.SubscriptionInfo in project android_packages_apps_Dialer by MoKee.

the class SpeedDialListActivity method onItemClick.

@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    if (position == 0) {
        Intent intent = new Intent(ACTION_ADD_VOICEMAIL);
        intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        if (TelephonyManager.getDefault().getPhoneCount() > 1) {
            int sub = SubscriptionManager.getDefaultVoiceSubscriptionId();
            SubscriptionInfo subInfo = mSubscriptionManager.getActiveSubscriptionInfo(sub);
            if (subInfo != null) {
                intent.putExtra(SUB_ID_EXTRA, subInfo.getSubscriptionId());
                intent.putExtra(SUB_LABEL_EXTRA, subInfo.getDisplayName().toString());
            }
        }
        try {
            startActivity(intent);
        } catch (ActivityNotFoundException e) {
            Log.w(TAG, "Could not find voice mail setup activity");
        }
    } else {
        int number = position + 1;
        if (mEmergencyCallSpeedDial && (number == mSpeedDialKeyforEmergncyCall)) {
            Toast.makeText(SpeedDialListActivity.this, R.string.speed_dial_can_not_be_set, Toast.LENGTH_SHORT).show();
            return;
        }
        mItemPosition = number;
        final Record record = mRecords.get(number);
        if (record == null) {
            showAddSpeedDialDialog(number);
        } else {
            PopupMenu pm = new PopupMenu(this, view, Gravity.START);
            pm.getMenu().add(number, MENU_REPLACE, 0, R.string.speed_dial_replace);
            pm.getMenu().add(number, MENU_DELETE, 0, R.string.speed_dial_delete);
            pm.setOnMenuItemClickListener(this);
            pm.show();
        }
    }
}
Also used : ActivityNotFoundException(android.content.ActivityNotFoundException) Intent(android.content.Intent) SubscriptionInfo(android.telephony.SubscriptionInfo) PopupMenu(android.widget.PopupMenu)

Example 95 with SubscriptionInfo

use of android.telephony.SubscriptionInfo in project android_packages_apps_Dialer by MoKee.

the class InCallActivity method updateDsdaTabLabels.

private void updateDsdaTabLabels() {
    int tabCount = mDsdaTabLayout.getTabCount();
    for (int i = 0; i < tabCount; i++) {
        TabLayout.Tab tab = mDsdaTabLayout.getTabAt(i);
        int phoneId = (Integer) tab.getTag();
        SubscriptionInfo info = null;
        for (int j = 0; j < mSubInfos.size(); j++) {
            if (mSubInfos.get(j).getSimSlotIndex() == phoneId) {
                info = mSubInfos.get(j);
                break;
            }
        }
        tab.setText(info != null ? info.getDisplayName() : "SIM " + (i + 1));
    }
}
Also used : TabLayout(android.support.design.widget.TabLayout) SubscriptionInfo(android.telephony.SubscriptionInfo) Point(android.graphics.Point)

Aggregations

SubscriptionInfo (android.telephony.SubscriptionInfo)335 TelephonyManager (android.telephony.TelephonyManager)64 SubscriptionManager (android.telephony.SubscriptionManager)63 ArrayList (java.util.ArrayList)53 Test (org.junit.Test)49 Context (android.content.Context)38 Intent (android.content.Intent)38 Preference (android.support.v7.preference.Preference)27 PhoneAccountHandle (android.telecom.PhoneAccountHandle)18 IntentFilter (android.content.IntentFilter)16 Resources (android.content.res.Resources)16 ConnectivityManager (android.net.ConnectivityManager)15 Preference (androidx.preference.Preference)15 AlertDialog (android.app.AlertDialog)14 DialogInterface (android.content.DialogInterface)14 DataUsageController (com.android.settingslib.net.DataUsageController)14 View (android.view.View)13 PhoneAccount (android.telecom.PhoneAccount)11 TelecomManager (android.telecom.TelecomManager)11 PendingIntent (android.app.PendingIntent)9