Android6.0之来电转接号码显示修改

手机来电转接界面是在,点开Dialer-搜索框右边的三个点-设置-通话账户(要先插卡)-中国移动或者中国联通--来电转接--第一行,显示始终转接

将所有来电转接到+86xxxxxxxxxxx

当按home键回到主界面,然后在设置里切换语言,然后在recent键回到来电转接设置界面时发现来电转接的号码变成了{0},

通过搜索字符串

package/service/Telephony/res/values/strings.xml:219:

<string name="sum_cfu_enabled">Forwarding all calls to <xliff:g id="phonenumber" example="555-1212">{0}</xliff:g></string>

发现引用的地方在package/service/Telephony/res/xml/callforward_options.xml

<com.android.phone.CallForwardEditPreference
android:key="button_cfu_key"
android:title="@string/labelCFU"
android:persistent="false"

android:summaryOn="@string/sum_cfu_enabled"
android:summaryOff="@string/sum_cfu_disabled"
android:dialogTitle="@string/labelCFU"

android:dialogMessage="@string/messageCFU"
phone:confirmMode="activation"
phone:serviceClass="voice"

phone:reason="unconditional"
android:singleLine="true"
android:autoText="false"
android:enabled="false" />

发现这是一个自定义的com.android.phone.CallForwardEditPreference

用eng的手机通过View视图查看工具可以发现

当前的界面是package/service/Telephony/src/com/android/phone/GsmUmtsCallForwardOptions.java

private static final String BUTTON_CFU_KEY   = "button_cfu_key";

PreferenceScreen prefSet = getPreferenceScreen();
mButtonCFU = (CallForwardEditPreference) prefSet.findPreference(BUTTON_CFU_KEY);

mButtonCFU.setParentActivity(this, mButtonCFU.reason);
mButtonCFB.setParentActivity(this, mButtonCFB.reason);

mPreferences.add(mButtonCFU);
mPreferences.add(mButtonCFB);

switch (requestCode) {
case CommandsInterface.CF_REASON_UNCONDITIONAL:
mButtonCFU.onPickActivityResult(getArabCharNumber(cursor.getString(0)));

@Override
public void onResume() {
super.onResume();

if (mFirstResume) {
if (mIcicle == null) {
if (DBG) Log.d(LOG_TAG, "start to init ");
mPreferences.get(mInitIndex).init(this, false, mPhone);
} else {
mInitIndex = mPreferences.size();

for (CallForwardEditPreference pref : mPreferences) {
Bundle bundle = mIcicle.getParcelable(pref.getKey());
pref.setToggled(bundle.getBoolean(KEY_TOGGLE));
pref.setEnabled(bundle.getBoolean(KEY_STATE));
CallForwardInfo cf = new CallForwardInfo();
cf.number = bundle.getString(KEY_NUMBER);
cf.status = bundle.getInt(KEY_STATUS);

pref.handleCallForwardResult(cf);
pref.init(this, true, mPhone);
}
}
mFirstResume = false;
mIcicle = null;
}
}

中的

cf.number = bundle.getString(KEY_NUMBER);
cf.status = bundle.getInt(KEY_STATUS);

pref.handleCallForwardResult(cf);

进到handleCallForwardResult()这个方法中

然后可以发现进到了package/service/Telephony/src/com/android/phone/CallForwardEditPreference.java中

void handleCallForwardResult(CallForwardInfo cf) {
callForwardInfo = cf;
if (DBG) Log.d(LOG_TAG, "handleGetCFResponse done, callForwardInfo=" + callForwardInfo);

setToggled(callForwardInfo.status == 1);
setPhoneNumber(callForwardInfo.number);
}

然后发现

private void updateSummaryText() {
if (isToggled()) {
CharSequence summaryOn;
final String number = getRawPhoneNumber();
if (number != null && number.length() > 0) {
// Wrap the number to preserve presentation in RTL languages.

String wrappedNumber = BidiFormatter.getInstance().unicodeWrap(
number, TextDirectionHeuristics.LTR);
String values[] = { wrappedNumber };

/// M: for Plug-in @{

ExtensionManager.getCallForwardExt().updateSummaryTimeSlotText(this, values);
/// }@

summaryOn = TextUtils.replace(mSummaryOnTemplate, SRC_TAGS, values);
} else {

summaryOn = getContext().getString(R.string.sum_cfu_enabled_no_number);
}
setSummaryOn(summaryOn);
}

}

所以在

/// }@ /// }@ 78
79 mPhone.getCallForwardingOption(reason, mPhone.getCallForwardingOption(reason, 79
  80 mHandler.obtainMessage(MyHandler.MESSAGE_GET_CF, mHandler.obtainMessage(MyHandler.MESSAGE_GET_CF, 80
  81 // unused in this case // unused in this case 81
  82 CommandsInterface.CF_ACTION_DISABLE, CommandsInterface.CF_ACTION_DISABLE, 82
  83 MyHandler.MESSAGE_GET_CF, null)); MyHandler.MESSAGE_GET_CF, null)); 83
  84 } } 84
  85 if (mTcpListener != null) { if (mTcpListener != null) { 85
  86 mTcpListener.onStarted(this, true); mTcpListener.onStarted(this, true); 86
  87 } } 87
      } else { 88
      updateSummaryText(); 89
  88 } } 90
  89 } } 91
  90     92
  91 @Override @Override 93
  92 protected void onBindDialogView(View view) { protected void onBindDialogView(View view) { 94
  93 // default the button clicked to be the cancel button. // default the button clicked to be the cancel button. 95
  94 mButtonClicked = DialogInterface.BUTTON_NEGATIVE; mButtonClicked = DialogInterface.BUTTON_NEGATIVE; 96
  95 super.onBindDialogView(view); super.onBindDialogView(view); 97
  96 /// M: for Plug-in @{ /// M: for Plug-in @{ 98
  97 ExtensionManager.getCallForwardExt().onBindDialogView(this, view); ExtensionManager.getCallForwardExt().onBindDialogView(this, view);

void init(TimeConsumingPreferenceListener listener, boolean skipReading, Phone phone) {
mPhone = phone;
mTcpListener = listener;

if (!skipReading) {
/// M: for Plug-in @{

} else {
updateSummaryText();
}
}

调用已经写好的updateSummaryText();方法便可以实现通过recent键进到来电转接界面来电转接号码的显示

Android6.0之来电转接号码显示修改的更多相关文章

  1. Android6.0 源码修改之 Contacts应用

    一.Contacts应用的主界面和联系人详情界面增加顶部菜单添加退出按钮 通过Hierarchy View 工具可以发现 主界面对应的类为 PeopleActivity 联系人详情界面对应的类为 Qu ...

  2. Android6.0 源码修改之 仿IOS添加全屏可拖拽浮窗返回按钮

    前言 之前写过屏蔽系统导航栏功能的文章,具体可看Android6.0 源码修改之屏蔽导航栏虚拟按键(Home和RecentAPP)/动态显示和隐藏NavigationBar 在某些特殊定制的版本中要求 ...

  3. android6.0搜索蓝牙无法显示问题解决

    1.android6.0版本搜索蓝牙需要开启位置信息 需在Manifest中添加权限: <uses-permission android:name="android.permissio ...

  4. 【Android】Android6.0读取通话记录

    需求:读取通话记录,然后列表显示,每条记录的数据包括姓名.号码.类型(来电.去电.未接,字体颜色分别为绿.蓝.红),然后长按条目弹出一个列表弹窗,显示[复制号码到拨号盘].[发短信].[打电话]. 先 ...

  5. Android6.0运行时权限管理

    自从Android6.0发布以来,在权限上做出了很大的变动,不再是之前的只要在manifest设置就可以任意获取权限,而是更加的注重用户的隐私和体验,不会再强迫用户因拒绝不该拥有的权限而导致的无法安装 ...

  6. Android6.0 中appcompat_v7 报错

    更新了AndroidSDK以后 各种错误,新建一个项目会附赠一个appcompat_v7,你只要知道这个是一个兼容包就可以了,具体的特性可以看相关介绍,其实也没啥特别的就是为了兼容低版本的呗, 但是呢 ...

  7. Android6.0权限大全和权限分类

    本文转载至: https://blog.csdn.net/qq_26440221/article/details/53097868 自从出了Android6.0权限管理之后,再也不能像以前那样粘贴复制 ...

  8. Android app 在线更新那点事儿(适配Android6.0、7.0、8.0)

    一.前言 app在线更新是一个比较常见需求,新版本发布时,用户进入我们的app,就会弹出更新提示框,第一时间更新新版本app.在线更新分为以下几个步骤: 1, 通过接口获取线上版本号,versionC ...

  9. [IMX6]Android6.0移植和分析

    0. 知识点 中断(设备树) [IMX6]设备树分析--dts 1. 编译 Android6.0内核移植(1):分析编译日志 Android6.0内核移植(2):kernel编译内核 单独烧录kern ...

随机推荐

  1. RGB颜色表

    RGB(255,23,140)是光的三原色,也即红绿蓝Red.Green.Blue,它们的最大值是255,相当于100%. 白色:rgb(255,255,255) 黑色:rgb(0,0,0) 红色:r ...

  2. android使用ksoap2调用sap的webservice

    public void on_clicked(View view) { Thread webserviceThread = new Thread() { public void run() { Str ...

  3. Css、javascript、dom(一)

    一:Css 1.1:position定义和用法 position 属性规定元素的定位类型. 可能的值 值 描述 absolute 生成绝对定位的元素,相对于 static 定位以外的第一个父元素进行定 ...

  4. Mac OS下基于Eclipse的Android调试环境搭建

    1.安装Eclipse:http://www.eclipse.org/downloads/,网页会自动检测适用的版本(Mac OS x64),下载“Eclipse IDE for java Devel ...

  5. maven项目和普通项目转换

     

  6. 《机器学习实战》学习笔记一K邻近算法

     一. K邻近算法思想:存在一个样本数据集合,称为训练样本集,并且每个数据都存在标签,即我们知道样本集中每一数据(这里的数据是一组数据,可以是n维向量)与所属分类的对应关系.输入没有标签的新数据后,将 ...

  7. 常用正则表达式大全,手机、电话、邮箱、身份证(最严格的验证)、IP地址、网址、日期等

    <script type="text/javascript">/* * 手机号码格式 * 只允许以13.15.18开头的号码 * 如:13012345678.15929 ...

  8. Popular Cows-POJ2186Tarjan

    Time Limit: 2000MS   Memory Limit: 65536K       Description Every cow's dream is to become the most ...

  9. 瘋子C++笔记

    瘋耔C++笔记 欢迎关注瘋耔新浪微博:http://weibo.com/cpjphone 参考:C++程序设计(谭浩强) 参考:http://c.biancheng.net/cpp/biancheng ...

  10. selenium启动Chrome浏览器和禁止证书错误提示弹出

    要把ChromeDriver放到代码中的文件夹中c://*******Application public static WebDriver WebDriverRun(WebDriver driver ...