Android8.1 MTK平台 Dialer修改(来电全屏、归属地显示)

来电默认全屏

默认情况下,来电android是以通知窗口的形式显示,只在屏幕的顶部显示,现在改为全屏显示

修改位置

alps\vendor\mediatek\proprietary\packages\apps\Dialer\java\com\android\incallui\InCallPresenter.java

private boolean startUi(InCallState inCallState) {
      boolean isCallWaiting = mCallList.getActiveOrBackgroundCall() != null &&
              mCallList.getIncomingCall() != null;
        Log.e(this, "isCallWaiting=="+isCallWaiting + "  inCallState="+inCallState);
        Log.i(this, "  isIncoming="+inCallState.isIncoming());

      // If the screen is off, we need to make sure it gets turned on for incoming calls.
      // This normally works just fine thanks to FLAG_TURN_SCREEN_ON but that only works
      // when the activity is first created. Therefore, to ensure the screen is turned on
      // for the call waiting case, we finish() the current activity and start a new one.
      // There should be no jank from this since the screen is already off and will remain so
      // until our new activity is up.
      if (isCallWaiting) {
          if (mProximitySensor.isScreenReallyOff() && isActivityStarted()) {
              Log.i(this, "Restarting InCallActivity to turn screen on for call waiting");
              mInCallActivity.finish();
              return false;
          } else {
              Log.i(this, "show InCallActivity for waiting call");
              showInCall(false, false);
          }
      } else {
           ////cczheng add show Full Screen in call UI replace incall notification  
          //mStatusBarNotifier.updateNotification(mCallList);
          mContext.startActivity(InCallActivity.getIntent(
                    mContext, false/*showDialpad*/, false/*newOutgoingCall*/, true /* forFullScreen */));
      }
      return true;
   }

将 updateNotification 方式替换为 start InCallActivity

联系人已保存来电时,增加归属地显示

android原来的归属地显示条件为,当来电号码未存储为联系人时,也就是来电页面显示为号码时,号码下方会显示出来电归属地

当号码已经保存为联系人,来电页面显示联系人名称时,不显示来电归属地。需求来了,联系人情况也要显示来电归属地。

来电归属地查询的流程后面会单独介绍,可先看这篇 号码归属地识别-Android电话应用

image

效果图

修改位置

1、alps\vendor\mediatek\proprietary\packages\apps\Dialer\java\com\android\incallui\CallerInfoAsyncQuery.java

    void updateData(int token, Object cookie, Cursor cursor) {
    .....
    if (true/*TextUtils.isEmpty(mCallerInfo.name)*/) {//cczheng change true
        // Actually when no contacts match the incoming phone number,
        // the CallerInfo object is totally blank here (i.e. no name
        // *or* phoneNumber).  So we need to pass in cw.number as
        // a fallback number.
        mCallerInfo.updateGeoDescription(mQueryContext, cw.number);
     
    }
    ......
}

号码和姓名的情况都去查询归属地

2、alps\vendor\mediatek\proprietary\packages\apps\Dialer\java\com\android\incallui\CallCardPresenter.java

private void updatePrimaryDisplayInfo() {

......

mInCallScreen.setPrimary(
      new PrimaryInfo(
          number,
          mPrimary.updateNameIfRestricted(name),
          nameIsNumber,
          shouldShowLocationAsLabel(nameIsNumber, mPrimaryContactInfo.shouldShowLocation)
              ? mPrimaryContactInfo.location
              : number + "\n" + mPrimaryContactInfo.location/*null*/,/*cczheng change null to locationlabel*/
          isChildNumberShown || isCallSubjectShown ? null : mPrimaryContactInfo.label,
          mPrimaryContactInfo.photo,
          mPrimaryContactInfo.photoType,
          mPrimaryContactInfo.isSipCall,
          showContactPhoto,
          hasWorkCallProperty || isWorkContact,
          mPrimary.isSpam(),
          mPrimary.answeringDisconnectsForegroundVideoCall(),
          shouldShowLocation(),
          mPrimaryContactInfo.lookupKey,
          multimediaData,
          mPrimary.getNumberPresentation()));
.....
}

将原来的null替换为 号码和归属地拼接,\n 换行显示

3、alps\vendor\mediatek\proprietary\packages\apps\Dialer\java\com\android\incallui\contactgrid\res\layout\incall_contactgrid_bottom_row.xml

将id为 contactgrid_forwardNumber 和 contactgrid_bottom_text 的 android:singleLine="true" 改为 false,为了换行显示

修改这三个地方重新编译Dialer,push 查看效果ok

你可能感兴趣的:(Android8.1 MTK平台 Dialer修改(来电全屏、归属地显示))