当前位置: 首页>>代码示例>>Java>>正文


Java TelecomManager.getPhoneAccount方法代码示例

本文整理汇总了Java中android.telecom.TelecomManager.getPhoneAccount方法的典型用法代码示例。如果您正苦于以下问题:Java TelecomManager.getPhoneAccount方法的具体用法?Java TelecomManager.getPhoneAccount怎么用?Java TelecomManager.getPhoneAccount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.telecom.TelecomManager的用法示例。


在下文中一共展示了TelecomManager.getPhoneAccount方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getDefaultVoiceSubscriptionSimSlot

import android.telecom.TelecomManager; //导入方法依赖的package包/类
private int getDefaultVoiceSubscriptionSimSlot() {
    try {
        final TelecomManager telecomManager =
                (TelecomManager) mContext.getSystemService(Context.TELECOM_SERVICE);
        final TelephonyManager telephonyManager =
                (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE);
        PhoneAccountHandle pah = (PhoneAccountHandle) XposedHelpers.callMethod(telecomManager,
                "getUserSelectedOutgoingPhoneAccount");
        if (pah != null) {
            PhoneAccount pa = telecomManager.getPhoneAccount(pah);
            int subId = getSubIdForPhoneAccount(telephonyManager, pa);
            SubscriptionInfo si = mSubMgr.getActiveSubscriptionInfo(subId);
            if (si != null) {
                return si.getSimSlotIndex();
            }
        }
        return -1;
    } catch (Throwable t) {
        XposedBridge.log(t);
        return -1;
    }
}
 
开发者ID:WrBug,项目名称:GravityBox,代码行数:23,代码来源:SubscriptionManager.java

示例2: getSubItemList

import android.telecom.TelecomManager; //导入方法依赖的package包/类
private List<IIconListAdapterItem> getSubItemList(final SubType subType) {
    List<IIconListAdapterItem> list = new ArrayList<>();
    if (subType == SubType.VOICE) {
        list.add(new SubListItem(null));
        final TelecomManager telecomManager = 
                (TelecomManager) mContext.getSystemService(Context.TELECOM_SERVICE);
        final TelephonyManager telephonyManager =
                (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE);
        final Iterator<PhoneAccountHandle> phoneAccounts =
                telecomManager.getCallCapablePhoneAccounts().listIterator();
        while (phoneAccounts.hasNext()) {
            final PhoneAccount phoneAccount =
                    telecomManager.getPhoneAccount(phoneAccounts.next());
            int subId = getSubIdForPhoneAccount(telephonyManager, phoneAccount);
            if (subId != -1) {
                list.add(new SubListItem(mSubMgr.getActiveSubscriptionInfo(subId)));
            }
        }
    } else {
        for (SubscriptionInfo si : mSubMgr.getActiveSubscriptionInfoList())
            if (si != null)
                list.add(new SubListItem(si));
    }
    return list;
}
 
开发者ID:WrBug,项目名称:GravityBox,代码行数:26,代码来源:SubscriptionManager.java

示例3: subscriptionToPhoneAccountHandle

import android.telecom.TelecomManager; //导入方法依赖的package包/类
private PhoneAccountHandle subscriptionToPhoneAccountHandle(final SubscriptionInfo subInfo) {
    if (subInfo == null)
        return null;

    final TelecomManager telecomManager =
            (TelecomManager) mContext.getSystemService(Context.TELECOM_SERVICE);
    final TelephonyManager telephonyManager =
            (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE);
    final Iterator<PhoneAccountHandle> phoneAccounts =
            telecomManager.getCallCapablePhoneAccounts().listIterator();
    while (phoneAccounts.hasNext()) {
        final PhoneAccountHandle phoneAccountHandle = phoneAccounts.next();
        final PhoneAccount phoneAccount = telecomManager.getPhoneAccount(phoneAccountHandle);
        if (subInfo.getSubscriptionId() == getSubIdForPhoneAccount(telephonyManager, phoneAccount)) {
            return phoneAccountHandle;
        }
    }

    return null;
}
 
开发者ID:WrBug,项目名称:GravityBox,代码行数:21,代码来源:SubscriptionManager.java

示例4: getSimColor

import android.telecom.TelecomManager; //导入方法依赖的package包/类
public static int getSimColor(Context context, int id) {
    int highlightColor = 0;
    TelecomManager telecomManager = (TelecomManager) context.getSystemService(Context.TELECOM_SERVICE);
    if (telecomManager != null) {
        if (ActivityCompat.checkSelfPermission(context, Manifest.permission.READ_PHONE_STATE) != PackageManager.PERMISSION_GRANTED) {
            // TODO: Consider calling
            //    ActivityCompat#requestPermissions
            // here to request the missing permissions, and then overriding
            //   public void onRequestPermissionsResult(int requestCode, String[] permissions,
            //                                          int[] grantResults)
            // to handle the case where the user grants the permission. See the documentation
            // for ActivityCompat#requestPermissions for more details.
            return -1;
        }
        List<PhoneAccountHandle> phoneAccountHandleList = telecomManager.getCallCapablePhoneAccounts();

        PhoneAccount phoneAccount = telecomManager.getPhoneAccount(phoneAccountHandleList.get(id));
        if (phoneAccount != null) {
            highlightColor = phoneAccount.getHighlightColor();
        }
    }
    return highlightColor;
}
 
开发者ID:yippeesoft,项目名称:NotifyTools,代码行数:24,代码来源:SimUtils.java


注:本文中的android.telecom.TelecomManager.getPhoneAccount方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。