MTK-Android13-Dialer 通话界面定制修改(二)

产品涉及到一些电话相关项目,用到 系统 电话 Dialer, 需要定制化UI实现。

文章目录


前言

  • 部分产品涉及到Dialer 定制化,需要对UI进行修改。 大家常用的手机电话都是各大手机厂商进行了魔改,对于平板类型产品或者工业化产品(校话机-电话机)需要自己定制UI。或者说部分功能界面 该隐藏隐藏、该 仿电话就仿一下。
  • 其实之前有一篇总结已经修改了相关内容,参考也可修改。这里还是简单说明,相关的一些坑点进行简单说明、总结,方便后续开发提高效率。

一、 需求

如下,基本需求:

1、电话APP里通话界面保留"静音"、"视频通话"、"免提"按钮,其他按钮隐藏

2、电话APP里的视频通话界面左侧的免提、静音、视频通话按钮移到正下方,按下图布局,并放大图标按钮,左边其余四个按钮隐藏

3、左下角的镜头图标移到右上角

二、参考资料

强烈建议参考之前的总结知识点:MTK-Android13-Dialer 通话界面定制修改 有相关的源码阅读、理解。 方便自己熟悉源码 或者 借用AI 直接熟悉源码,针对性理解源码、理解相关模块。 针对性修改相关需求问题。

三、涉及到修改的文件

java 复制代码
        modified:   java/com/android/incallui/incall/impl/InCallFragment.java
        modified:   java/com/android/incallui/incall/impl/res/layout/frag_incall_voice.xml
        modified:   java/com/android/incallui/video/impl/VideoCallFragment.java
        modified:   java/com/android/incallui/video/impl/res/layout/frag_videocall.xml
        modified:   java/com/android/incallui/video/impl/res/layout/videocall_controls.xml

四、实现方案

1、拨打界面-待接听界面-拨打界面-UI隐藏-InCallFragment

这个主要做部分UI隐藏工作的。

路径:/vendor/mediatek/proprietary/packages/apps/Dialer/java/com/android/incallui/incall/impl/InCallFragment.java

java 复制代码
--- a/vendor/mediatek/proprietary/packages/apps/Dialer/java/com/android/incallui/incall/impl/InCallFragment.java
+++ b/vendor/mediatek/proprietary/packages/apps/Dialer/java/com/android/incallui/incall/impl/InCallFragment.java
@@ -78,7 +78,7 @@ import java.util.List;

 /** Fragment that shows UI for an ongoing voice call. */
 public class InCallFragment extends Fragment
-    implements InCallScreen,
+        implements InCallScreen,
         InCallButtonUi,
         OnClickListener,
         AudioRouteSelectorPresenter,
@@ -107,27 +107,38 @@ public class InCallFragment extends Fragment
   // initially show the attachment page. After a delay seconds we'll animate to the button grid.
   private final Handler handler = new Handler();
   private final Runnable pagerRunnable =
-      new Runnable() {
-        @Override
-        public void run() {
-          pager.setCurrentItem(adapter.getButtonGridPosition());
-        }
-      };
+          new Runnable() {
+            @Override
+            public void run() {
+              pager.setCurrentItem(adapter.getButtonGridPosition());
+            }
+          };

   private static boolean isSupportedButton(@InCallButtonIds int id) {
-    return id == InCallButtonIds.BUTTON_AUDIO
-        || id == InCallButtonIds.BUTTON_MUTE
-        || id == InCallButtonIds.BUTTON_DIALPAD
-        || id == InCallButtonIds.BUTTON_HOLD
+
+
+    return
+            id == InCallButtonIds.BUTTON_AUDIO
+                    || id == InCallButtonIds.BUTTON_MUTE;
+                    //|| id == InCallButtonIds.BUTTON_UPGRADE_TO_VIDEO;
+    /*return
+       // modify by fangchen start
+           id == InCallButtonIds.BUTTON_AUDIO
+          || id == InCallButtonIds.BUTTON_MUTE
+    //    || id == InCallButtonIds.BUTTON_DIALPAD
+    //    ||
+   // id == InCallButtonIds.BUTTON_HOLD
         || id == InCallButtonIds.BUTTON_SWAP
-        || id == InCallButtonIds.BUTTON_UPGRADE_TO_VIDEO
-        || id == InCallButtonIds.BUTTON_ADD_CALL
+         || id == InCallButtonIds.BUTTON_UPGRADE_TO_VIDEO
+   //     || id == InCallButtonIds.BUTTON_ADD_CALL
         || id == InCallButtonIds.BUTTON_MERGE
         || id == InCallButtonIds.BUTTON_MANAGE_VOICE_CONFERENCE
-        || id == InCallButtonIds.BUTTON_SWAP_SIM
+        //|| id == InCallButtonIds.BUTTON_SWAP_SIM
         || id == InCallButtonIds.BUTTON_UPGRADE_TO_RTT
         /// M: [Voice Record]
-        || id == InCallButtonIds.BUTTON_SWITCH_VOICE_RECORD
+    //    || id == InCallButtonIds.BUTTON_SWITCH_VOICE_RECORD
+
+       // modify by fangchen end
         /// M: [Hang Up]
         || id == InCallButtonIds.BUTTON_HANG_UP_ALL
         || id == InCallButtonIds.BUTTON_HANG_UP_HOLD
@@ -137,7 +148,7 @@ public class InCallFragment extends Fragment
         /// M: [One way video]
         || id == InCallButtonIds.BUTTON_ONE_WAY_VIDEO
         /// M: ALPS03949921, add switch_to_secondary to enable and disable.
-        || id == InCallButtonIds.BUTTON_SWITCH_TO_SECONDARY;
+        || id == InCallButtonIds.BUTTON_SWITCH_TO_SECONDARY;*/
   }

   @Override
@@ -152,8 +163,8 @@ public class InCallFragment extends Fragment
   public void onCreate(Bundle savedInstanceState) {
     super.onCreate(savedInstanceState);
     inCallButtonUiDelegate =
-        FragmentUtils.getParent(this, InCallButtonUiDelegateFactory.class)
-            .newInCallButtonUiDelegate();
+            FragmentUtils.getParent(this, InCallButtonUiDelegateFactory.class)
+                    .newInCallButtonUiDelegate();
     if (savedInstanceState != null) {
       inCallButtonUiDelegate.onRestoreInstanceState(savedInstanceState);
       stateRestored = true;
@@ -164,41 +175,41 @@ public class InCallFragment extends Fragment
   @Override
   @SuppressLint("MissingPermission")
   public View onCreateView(
-      @NonNull LayoutInflater layoutInflater,
-      @Nullable ViewGroup viewGroup,
-      @Nullable Bundle bundle) {
+          @NonNull LayoutInflater layoutInflater,
+          @Nullable ViewGroup viewGroup,
+          @Nullable Bundle bundle) {
     LogUtil.i("InCallFragment.onCreateView", null);
     getActivity().setTheme(R.style.Theme_InCallScreen);
     // Bypass to avoid StrictModeResourceMismatchViolation
     final View view =
-        StrictModeUtils.bypass(
-            () -> layoutInflater.inflate(R.layout.frag_incall_voice, viewGroup, false));
+            StrictModeUtils.bypass(
+                    () -> layoutInflater.inflate(R.layout.frag_incall_voice, viewGroup, false));
     contactGridManager =
-        new ContactGridManager(
-            view,
-            (ImageView) view.findViewById(R.id.contactgrid_avatar),
-            getResources().getDimensionPixelSize(R.dimen.incall_avatar_size),
-            true /* showAnonymousAvatar */);
+            new ContactGridManager(
+                    view,
+                    (ImageView) view.findViewById(R.id.contactgrid_avatar),
+                    getResources().getDimensionPixelSize(R.dimen.incall_avatar_size),
+                    true /* showAnonymousAvatar */);
     contactGridManager.onMultiWindowModeChanged(getActivity().isInMultiWindowMode());

     paginator = (InCallPaginator) view.findViewById(R.id.incall_paginator);
     pager = (LockableViewPager) view.findViewById(R.id.incall_pager);
     pager.setOnTouchListener(
-        (v, event) -> {
-          handler.removeCallbacks(pagerRunnable);
-          return false;
-        });
+            (v, event) -> {
+              handler.removeCallbacks(pagerRunnable);
+              return false;
+            });

     endCallButton = view.findViewById(R.id.incall_end_call);
     endCallButton.setOnClickListener(this);

     if (ContextCompat.checkSelfPermission(getContext(), permission.READ_PHONE_STATE)
-        != PackageManager.PERMISSION_GRANTED) {
+            != PackageManager.PERMISSION_GRANTED) {
       voiceNetworkType = TelephonyManager.NETWORK_TYPE_UNKNOWN;
     } else {
       LogUtil.d("InCallFragment.onCreateView", "getVoiceNetworkType");
       voiceNetworkType =
-          getContext().getSystemService(TelephonyManager.class).getVoiceNetworkType();
+              getContext().getSystemService(TelephonyManager.class).getVoiceNetworkType();
     }
     // TODO(a bug): Change to use corresponding phone type used for current call.
     /// M: Performance. @{
@@ -210,21 +221,21 @@ public class InCallFragment extends Fragment
     // Workaround to adjust padding for status bar and navigation bar since fitsSystemWindows
     // doesn't work well when switching with other fragments.
     view.addOnAttachStateChangeListener(
-        new OnAttachStateChangeListener() {
-          @Override
-          public void onViewAttachedToWindow(View v) {
-            View container = v.findViewById(R.id.incall_ui_container);
-            int topInset = v.getRootWindowInsets().getSystemWindowInsetTop();
-            int bottomInset = v.getRootWindowInsets().getSystemWindowInsetBottom();
-            if (topInset != container.getPaddingTop()) {
-              TransitionManager.beginDelayedTransition(((ViewGroup) container.getParent()));
-              container.setPadding(0, topInset, 0, bottomInset);
-            }
-          }
-
-          @Override
-          public void onViewDetachedFromWindow(View v) {}
-        });
+            new OnAttachStateChangeListener() {
+              @Override
+              public void onViewAttachedToWindow(View v) {
+                View container = v.findViewById(R.id.incall_ui_container);
+                int topInset = v.getRootWindowInsets().getSystemWindowInsetTop();
+                int bottomInset = v.getRootWindowInsets().getSystemWindowInsetBottom();
+                if (topInset != container.getPaddingTop()) {
+                  TransitionManager.beginDelayedTransition(((ViewGroup) container.getParent()));
+                  container.setPadding(0, topInset, 0, bottomInset);
+                }
+              }
+
+              @Override
+              public void onViewDetachedFromWindow(View v) {}
+            });
     return view;
   }

@@ -242,44 +253,51 @@ public class InCallFragment extends Fragment
     initVoiceRecorderIcon(view);
     /// @}
     inCallScreenDelegate =
-        FragmentUtils.getParent(this, InCallScreenDelegateFactory.class).newInCallScreenDelegate();
+            FragmentUtils.getParent(this, InCallScreenDelegateFactory.class).newInCallScreenDelegate();
     Assert.isNotNull(inCallScreenDelegate);

+    // modify by fangchen start
     buttonControllers.add(new ButtonController.MuteButtonController(inCallButtonUiDelegate));
     buttonControllers.add(new ButtonController.SpeakerButtonController(inCallButtonUiDelegate));
-    buttonControllers.add(new ButtonController.DialpadButtonController(inCallButtonUiDelegate));
-    buttonControllers.add(new ButtonController.HoldButtonController(inCallButtonUiDelegate));
-    buttonControllers.add(new ButtonController.AddCallButtonController(inCallButtonUiDelegate));
+    //  buttonControllers.add(new ButtonController.DialpadButtonController(inCallButtonUiDelegate));
+    //  buttonControllers.add(new ButtonController.HoldButtonController(inCallButtonUiDelegate));
+    //    buttonControllers.add(new ButtonController.AddCallButtonController(inCallButtonUiDelegate));
+    // modify by fangchen end
     buttonControllers.add(new ButtonController.SwapButtonController(inCallButtonUiDelegate));
     buttonControllers.add(new ButtonController.MergeButtonController(inCallButtonUiDelegate));
-    buttonControllers.add(new ButtonController.SwapSimButtonController(inCallButtonUiDelegate));
-    buttonControllers.add(
-        new ButtonController.UpgradeToVideoButtonController(inCallButtonUiDelegate));
+    //buttonControllers.add(new ButtonController.SwapSimButtonController(inCallButtonUiDelegate));
+    // modify by fangchen start
+   /* buttonControllers.add(
+            new ButtonController.UpgradeToVideoButtonController(inCallButtonUiDelegate));*/
+    // modify by fangchen end
     buttonControllers.add(new UpgradeToRttButtonController(inCallButtonUiDelegate));
     buttonControllers.add(
-        new ButtonController.ManageConferenceButtonController(inCallScreenDelegate));
+            new ButtonController.ManageConferenceButtonController(inCallScreenDelegate));
     buttonControllers.add(
-        new ButtonController.SwitchToSecondaryButtonController(inCallScreenDelegate));
+            new ButtonController.SwitchToSecondaryButtonController(inCallScreenDelegate));
     /// M: [Voice Record] @{
-    buttonControllers.add(
-        new ButtonController.SwitchVoiceRecordButtonController(inCallButtonUiDelegate));
+    // modify by fangchen start
+  /*  buttonControllers.add(
+        new ButtonController.SwitchVoiceRecordButtonController(inCallButtonUiDelegate));*/
+    // modify by fangchen end
     /// @}
     /// M: [Hang Up] @{
     buttonControllers.add(
-        new ButtonController.HangupAllButtonController(inCallScreenDelegate));
+            new ButtonController.HangupAllButtonController(inCallScreenDelegate));
     buttonControllers.add(
-        new ButtonController.HangupHoldButtonController(inCallScreenDelegate));
+            new ButtonController.HangupHoldButtonController(inCallScreenDelegate));
     /// @}
     /// M: [ECT(blind)] @{
     buttonControllers.add(
-        new ButtonController.ECTButtonController(inCallButtonUiDelegate));
+            new ButtonController.ECTButtonController(inCallButtonUiDelegate));
     buttonControllers.add(
-        new ButtonController.BlindECTButtonController(inCallButtonUiDelegate));
+            new ButtonController.BlindECTButtonController(inCallButtonUiDelegate));
     /// @}

     /// M: [One way video] @{
-    buttonControllers.add(
-        new ButtonController.UpgradeToOneWayVideoButtonController(inCallButtonUiDelegate));
+    /*buttonControllers.add(
+            new ButtonController.UpgradeToOneWayVideoButtonController(inCallButtonUiDelegate));
+    */
     /// @}

     inCallScreenDelegate.onInCallScreenDelegateInit(this);
@@ -309,7 +327,7 @@ public class InCallFragment extends Fragment
     if (view == endCallButton) {
       LogUtil.i("InCallFragment.onClick", "end call button clicked");
       Logger.get(getContext())
-          .logImpression(DialerImpression.Type.IN_CALL_DIALPAD_HANG_UP_BUTTON_PRESSED);
+              .logImpression(DialerImpression.Type.IN_CALL_DIALPAD_HANG_UP_BUTTON_PRESSED);
       inCallScreenDelegate.onEndCallClicked();
     } else {
       LogUtil.e("InCallFragment.onClick", "unknown view: " + view);
@@ -340,7 +358,7 @@ public class InCallFragment extends Fragment
   private void setAdapterMedia(MultimediaData multimediaData, boolean showInCallButtonGrid) {
     if (adapter == null) {
       adapter =
-          new InCallPagerAdapter(getChildFragmentManager(), multimediaData, showInCallButtonGrid);
+              new InCallPagerAdapter(getChildFragmentManager(), multimediaData, showInCallButtonGrid);
       pager.setAdapter(adapter);
     } else {
       adapter.setAttachments(multimediaData);
@@ -400,18 +418,18 @@ public class InCallFragment extends Fragment
   @Override
   public void setCallState(@NonNull PrimaryCallState primaryCallState) {
     LogUtil.i("InCallFragment.setCallState", primaryCallState.toString() +
-        ", Phonetype:" + phoneType);
+            ", Phonetype:" + phoneType);
     contactGridManager.setCallState(primaryCallState);
     getButtonController(InCallButtonIds.BUTTON_SWITCH_TO_SECONDARY)
-        .setAllowed(primaryCallState.swapToSecondaryButtonState() != ButtonState.NOT_SUPPORT);
+            .setAllowed(primaryCallState.swapToSecondaryButtonState() != ButtonState.NOT_SUPPORT);
     getButtonController(InCallButtonIds.BUTTON_SWITCH_TO_SECONDARY)
-        .setEnabled(primaryCallState.swapToSecondaryButtonState() == ButtonState.ENABLED);
+            .setEnabled(primaryCallState.swapToSecondaryButtonState() == ButtonState.ENABLED);
     /// M: Get voice network type and phone type according to call account @{
     updateInfoForButtonChooser(primaryCallState.state());
     /// @}
     buttonChooser =
-        ButtonChooserFactory.newButtonChooser(
-            voiceNetworkType, primaryCallState.isWifi(), phoneType);
+            ButtonChooserFactory.newButtonChooser(
+                    voiceNetworkType, primaryCallState.isWifi(), phoneType);
     updateButtonStates();
   }

@@ -457,7 +475,9 @@ public class InCallFragment extends Fragment
   public void onInCallScreenDialpadVisibilityChange(boolean isShowing) {
     LogUtil.i("InCallFragment.onInCallScreenDialpadVisibilityChange", "isShowing: " + isShowing);
     // Take note that the dialpad button isShowing
+    // modify by fangchen start
     getButtonController(InCallButtonIds.BUTTON_DIALPAD).setChecked(isShowing);
+    // modify by fangchen end

     // This check is needed because there is a race condition where we attempt to update
     // ButtonGridFragment before it is ready, so we check whether it is ready first and once it is
@@ -469,8 +489,8 @@ public class InCallFragment extends Fragment
     Activity activity = getActivity();
     Window window = activity.getWindow();
     window.setNavigationBarColor(
-        activity.getColor(
-            isShowing ? android.R.color.background_dark : android.R.color.transparent));
+            activity.getColor(
+                    isShowing ? android.R.color.background_dark : android.R.color.transparent));
   }

   @Override
@@ -486,26 +506,28 @@ public class InCallFragment extends Fragment
   @Override
   public void showButton(@InCallButtonIds int buttonId, boolean show) {
     LogUtil.v(
-        "InCallFragment.showButton",
-        "buttionId: %s, show: %b",
-        InCallButtonIdsExtension.toString(buttonId),
-        show);
+            "InCallFragment.showButton",
+            "buttionId: %s, show: %b",
+            InCallButtonIdsExtension.toString(buttonId),
+            show);
     if (isSupportedButton(buttonId)) {
       getButtonController(buttonId).setAllowed(show);
-      if (buttonId == InCallButtonIds.BUTTON_UPGRADE_TO_VIDEO && show) {
+      // modify by fangchen start
+      /*if (buttonId == InCallButtonIds.BUTTON_UPGRADE_TO_VIDEO && show) {
         Logger.get(getContext())
-            .logImpression(DialerImpression.Type.UPGRADE_TO_VIDEO_CALL_BUTTON_SHOWN);
-      }
+                .logImpression(DialerImpression.Type.UPGRADE_TO_VIDEO_CALL_BUTTON_SHOWN);
+      }*/
+      // modify by fangchen end
     }
   }

   @Override
   public void enableButton(@InCallButtonIds int buttonId, boolean enable) {
     LogUtil.v(
-        "InCallFragment.enableButton",
-        "buttonId: %s, enable: %b",
-        InCallButtonIdsExtension.toString(buttonId),
-        enable);
+            "InCallFragment.enableButton",
+            "buttonId: %s, enable: %b",
+            InCallButtonIdsExtension.toString(buttonId),
+            enable);
     if (isSupportedButton(buttonId)) {
       getButtonController(buttonId).setEnabled(enable);
     }
@@ -521,7 +543,9 @@ public class InCallFragment extends Fragment

   @Override
   public void setHold(boolean value) {
-    getButtonController(InCallButtonIds.BUTTON_HOLD).setChecked(value);
+    // modify by fangchen start
+    // getButtonController(InCallButtonIds.BUTTON_HOLD).setChecked(value);
+    // modify by fangchen end
   }

   @Override
@@ -535,24 +559,26 @@ public class InCallFragment extends Fragment
     /// M: do not show bluetooth device information. @{
     /// Google code: LogUtil.i("InCallFragment.setAudioState", "audioState: " + audioState);
     LogUtil.i("InCallFragment.setAudioState", "isMuted: " + audioState.isMuted() + ", route: "
-        + CallAudioState.audioRouteToString(audioState.getRoute()) + ", supportMask: "
-        + CallAudioState.audioRouteToString(audioState.getSupportedRouteMask()));
+            + CallAudioState.audioRouteToString(audioState.getRoute()) + ", supportMask: "
+            + CallAudioState.audioRouteToString(audioState.getSupportedRouteMask()));
     /// @}

     /// M: ALPS05941240 AudioRouteSelectorDialogFragment would not dismiss when call
     /// audio state changed. @{
     AudioRouteSelectorDialogFragment audioRouteSelectorDialog =
-        (AudioRouteSelectorDialogFragment) this.getChildFragmentManager().
-            findFragmentByTag(TAG_AUDIOROUTE_SELECTOR_FRAGMENT);
+            (AudioRouteSelectorDialogFragment) this.getChildFragmentManager().
+                    findFragmentByTag(TAG_AUDIOROUTE_SELECTOR_FRAGMENT);
     if (audioRouteSelectorDialog != null) {
-        audioRouteSelectorDialog.dismissAllowingStateLoss();
-        audioRouteSelectorDialog = null;
+      audioRouteSelectorDialog.dismissAllowingStateLoss();
+      audioRouteSelectorDialog = null;
     }
     /// @}

+// modify by fangchen start
     ((SpeakerButtonController) getButtonController(InCallButtonIds.BUTTON_AUDIO))
-        .setAudioState(audioState);
+            .setAudioState(audioState);
     getButtonController(InCallButtonIds.BUTTON_MUTE).setChecked(audioState.isMuted());
+    // modify by fangchen end
   }

   @Override
@@ -564,14 +590,14 @@ public class InCallFragment extends Fragment
       return;
     }
     int numVisibleButtons =
-        inCallButtonGridFragment.updateButtonStates(
-            buttonControllers, buttonChooser, voiceNetworkType, phoneType);
+            inCallButtonGridFragment.updateButtonStates(
+                    buttonControllers, buttonChooser, voiceNetworkType, phoneType);

     int visibility = numVisibleButtons == 0 ? View.GONE : View.VISIBLE;
     pager.setVisibility(visibility);
     if (adapter != null
-        && adapter.getCount() > 1
-        && getResources().getInteger(R.integer.incall_num_rows) > 1) {
+            && adapter.getCount() > 1
+            && getResources().getInteger(R.integer.incall_num_rows) > 1) {
       paginator.setVisibility(View.VISIBLE);
       pager.setSwipingLocked(false);
     } else {
@@ -598,7 +624,7 @@ public class InCallFragment extends Fragment
     /// M: ALPS05941240 AudioRouteSelectorDialogFragment would not dismiss when call
     /// audio state changed. @{
     AudioRouteSelectorDialogFragment.newInstance(inCallButtonUiDelegate.getCurrentAudioState())
-        .show(getChildFragmentManager(), TAG_AUDIOROUTE_SELECTOR_FRAGMENT);
+            .show(getChildFragmentManager(), TAG_AUDIOROUTE_SELECTOR_FRAGMENT);
     /// @}
   }

@@ -651,15 +677,15 @@ public class InCallFragment extends Fragment
     if (locationUi != null && !isVisible) {
       // Show the location fragment.
       getChildFragmentManager()
-          .beginTransaction()
-          .replace(R.id.incall_location_holder, locationUi)
-          .commitAllowingStateLoss();
+              .beginTransaction()
+              .replace(R.id.incall_location_holder, locationUi)
+              .commitAllowingStateLoss();
     } else if (locationUi == null && isVisible) {
       // Hide the location fragment
       getChildFragmentManager()
-          .beginTransaction()
-          .remove(getLocationFragment())
-          .commitAllowingStateLoss();
+              .beginTransaction()
+              .remove(getLocationFragment())
+              .commitAllowingStateLoss();
     }
   }

@@ -715,7 +741,9 @@ public class InCallFragment extends Fragment
     } else {
       updateVoiceRecordIcon(false);
     }
-    getButtonController(InCallButtonIds.BUTTON_SWITCH_VOICE_RECORD).setChecked(isRecording);
+    // modify by fangchen start
+    //   getButtonController(InCallButtonIds.BUTTON_SWITCH_VOICE_RECORD).setChecked(isRecording);
+    // modify by fangchen end
   }

   /// M: [Voice Record] recording indication icon

2、移动功能面板位置-底部对其-frag_incall_voice

更改位置,控制高度,路径:/vendor/mediatek/proprietary/packages/apps/Dialer/java/com/android/incallui/incall/impl/res/layout/frag_incall_voice.xml

就是如下效果:

3、 通话界面-UI隐藏-位置定义-VideoCallFragment

路径:/vendor/mediatek/proprietary/packages/apps/Dialer/java/com/android/incallui/video/impl/VideoCallFragment.java

也是控制通话界面中UI的隐藏与展示效果:

java 复制代码
--- a/vendor/mediatek/proprietary/packages/apps/Dialer/java/com/android/incallui/video/impl/VideoCallFragment.java
+++ b/vendor/mediatek/proprietary/packages/apps/Dialer/java/com/android/incallui/video/impl/VideoCallFragment.java
@@ -105,6 +105,7 @@ public class VideoCallFragment extends Fragment
         OnCheckedChangeListener,
         AudioRouteSelectorPresenter,
         OnSystemUiVisibilityChangeListener {
+  private static final String TAG = "VideoCallFragment";

   @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE)
   static final String ARG_CALL_ID = "call_id";
@@ -318,6 +319,10 @@ public class VideoCallFragment extends Fragment
     endCallButton.setOnClickListener(this);
     previewTextureView = (TextureView) view.findViewById(R.id.videocall_video_preview);
     previewTextureView.setClipToOutline(true);
+
+
+
+
     previewOffOverlay.setOnClickListener(
         new OnClickListener() {
           @Override
@@ -1452,7 +1457,10 @@ public class VideoCallFragment extends Fragment
             RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT);
     params.addRule(RelativeLayout.ALIGN_PARENT_START);
     params.addRule(RelativeLayout.ALIGN_PARENT_TOP);
-    previewTextureView.setLayoutParams(params);
+   // params.topMargin = 100;
+   // params.rightMargin = 100;
+     params.setMargins(0, 100, 100, 0);
+      previewTextureView.setLayoutParams(params);
     previewTextureView.setOutlineProvider(null);
     updateOverlayBackground();
     contactGridManager.setIsMiddleRowVisible(true);
@@ -1463,8 +1471,8 @@ public class VideoCallFragment extends Fragment
     previewOffBlurredImageView.setClipToOutline(false);

     /// M: ALPS03659894, update screen after request fail @{
-    previewTextureView.setTranslationY(0);
-    previewOffOverlay.setTranslationY(0);
+   // previewTextureView.setTranslationY(0);
+   // previewOffOverlay.setTranslationY(0);
     previewOffBlurredImageView.setTranslationY(0);
     /// @}
   }
@@ -1474,18 +1482,25 @@ public class VideoCallFragment extends Fragment
     Resources resources = getResources();
     RelativeLayout.LayoutParams params =
         new RelativeLayout.LayoutParams(
-            (int) resources.getDimension(R.dimen.videocall_preview_width),
-            (int) resources.getDimension(R.dimen.videocall_preview_height));
+                180,180);
+            /*(int) resources.getDimension(R.dimen.videocall_preview_width),
+            (int) resources.getDimension(R.dimen.videocall_preview_height));*/
     params.setMargins(
         0, 0, 0, (int) resources.getDimension(R.dimen.videocall_preview_margin_bottom));
     if (isLandscape()) {
       params.addRule(RelativeLayout.ALIGN_PARENT_END);
       params.setMarginEnd((int) resources.getDimension(R.dimen.videocall_preview_margin_end));
     } else {
-      params.addRule(RelativeLayout.ALIGN_PARENT_START);
+    // modify by fangchen   params.addRule(RelativeLayout.ALIGN_PARENT_START);
+      params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
       params.setMarginStart((int) resources.getDimension(R.dimen.videocall_preview_margin_start));
     }
-    params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
+// modify by fangchen     params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
+    params.addRule(RelativeLayout.ALIGN_PARENT_TOP);
+
+   // params.topMargin = 100;
+    //params.rightMargin = 100;
+    params.setMargins(0, 100, 100, 0);
     previewTextureView.setLayoutParams(params);
     previewTextureView.setOutlineProvider(circleOutlineProvider);
     updateOverlayBackground();
@@ -2002,36 +2017,45 @@ public class VideoCallFragment extends Fragment

   private void showExtButtons(@InCallButtonIds int buttonId, boolean show) {
     if (buttonId == InCallButtonIds.BUTTON_DOWNGRADE_TO_AUDIO) {
-      downgradeAudioButton.setVisibility(show ? View.VISIBLE : View.GONE);
+    // modify by fangchen   downgradeAudioButton.setVisibility(show ? View.VISIBLE : View.GONE);
+      downgradeAudioButton.setVisibility(View.GONE);
     } else if (buttonId == InCallButtonIds.BUTTON_HIDE_PREVIEW) {
-      hidePrviewButton.setVisibility(show ? View.VISIBLE : View.GONE);
+    // modify by fangchen  hidePrviewButton.setVisibility(show ? View.VISIBLE : View.GONE);
+      hidePrviewButton.setVisibility(View.GONE);
     } else if (buttonId == InCallButtonIds.BUTTON_ECT) {
-      ectButton.setVisibility(show ? View.VISIBLE : View.GONE);
+    // modify by fangchen    ectButton.setVisibility(show ? View.VISIBLE : View.GONE);
+      ectButton.setVisibility(View.GONE);
     } else if (buttonId == InCallButtonIds.BUTTON_BLIND_ECT) {
-      blindEctButton.setVisibility(show ? View.VISIBLE : View.GONE);
+     // modify by fangchen   blindEctButton.setVisibility(show ? View.VISIBLE : View.GONE);
+      blindEctButton.setVisibility(  View.GONE);
     /// [CMCC video ringtone] @{
     } else if (buttonId == InCallButtonIds.BUTTON_DIALPAD) {
-      dialpadButton.setVisibility(show ? View.VISIBLE : View.GONE);
+     // modify by fangchen   dialpadButton.setVisibility(show ? View.VISIBLE : View.GONE);
+      dialpadButton.setVisibility( View.GONE);
     /// [Video Conference] @{
     } else if (buttonId == InCallButtonIds.BUTTON_ADD_CALL) {
-      addCallButton.setVisibility(show ? View.VISIBLE : View.GONE);
+    // modify by fangchen   addCallButton.setVisibility(show ? View.VISIBLE : View.GONE);
+      addCallButton.setVisibility(  View.GONE);
     } else if (buttonId == InCallButtonIds.BUTTON_MERGE) {
-      mergeCallButton.setVisibility(show ? View.VISIBLE : View.GONE);
+    // modify by fangchen   mergeCallButton.setVisibility(show ? View.VISIBLE : View.GONE);
+      mergeCallButton.setVisibility( View.GONE);
     } else if (buttonId == InCallButtonIds.BUTTON_MANAGE_VIDEO_CONFERENCE) {
-      videoConferenceButton.setVisibility(show ? View.VISIBLE : View.GONE);
+    // modify by fangchen   videoConferenceButton.setVisibility(show ? View.VISIBLE : View.GONE);
+      videoConferenceButton.setVisibility( View.GONE);
     /// @}
     /// [Cancel upgrade] @{
     /// @}
     /// [Cancel upgrade] @{
@@ -1463,8 +1471,8 @@ public class VideoCallFragment extends Fragment
     previewOffBlurredImageView.setClipToOutline(false);

     /// M: ALPS03659894, update screen after request fail @{
-    previewTextureView.setTranslationY(0);
-    previewOffOverlay.setTranslationY(0);
+   // previewTextureView.setTranslationY(0);
+   // previewOffOverlay.setTranslationY(0);
     previewOffBlurredImageView.setTranslationY(0);
     /// @}
   }
@@ -1474,18 +1482,25 @@ public class VideoCallFragment extends Fragment
     Resources resources = getResources();
     RelativeLayout.LayoutParams params =
         new RelativeLayout.LayoutParams(
-            (int) resources.getDimension(R.dimen.videocall_preview_width),
-            (int) resources.getDimension(R.dimen.videocall_preview_height));
+                180,180);
+            /*(int) resources.getDimension(R.dimen.videocall_preview_width),
+            (int) resources.getDimension(R.dimen.videocall_preview_height));*/
     params.setMargins(
         0, 0, 0, (int) resources.getDimension(R.dimen.videocall_preview_margin_bottom));
     if (isLandscape()) {
       params.addRule(RelativeLayout.ALIGN_PARENT_END);
       params.setMarginEnd((int) resources.getDimension(R.dimen.videocall_preview_margin_end));
     } else {
-      params.addRule(RelativeLayout.ALIGN_PARENT_START);
+    // modify by fangchen   params.addRule(RelativeLayout.ALIGN_PARENT_START);
+      params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
       params.setMarginStart((int) resources.getDimension(R.dimen.videocall_preview_margin_start));
     }
-    params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
+// modify by fangchen     params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
+    params.addRule(RelativeLayout.ALIGN_PARENT_TOP);
+
+   // params.topMargin = 100;
+    //params.rightMargin = 100;
+    params.setMargins(0, 100, 100, 0);
     previewTextureView.setLayoutParams(params);
     previewTextureView.setOutlineProvider(circleOutlineProvider);
     updateOverlayBackground();
@@ -2002,36 +2017,45 @@ public class VideoCallFragment extends Fragment

   private void showExtButtons(@InCallButtonIds int buttonId, boolean show) {
     if (buttonId == InCallButtonIds.BUTTON_DOWNGRADE_TO_AUDIO) {
-      downgradeAudioButton.setVisibility(show ? View.VISIBLE : View.GONE);
+    // modify by fangchen   downgradeAudioButton.setVisibility(show ? View.VISIBLE : View.GONE);
+      downgradeAudioButton.setVisibility(View.GONE);
     } else if (buttonId == InCallButtonIds.BUTTON_HIDE_PREVIEW) {
-      hidePrviewButton.setVisibility(show ? View.VISIBLE : View.GONE);
+    // modify by fangchen  hidePrviewButton.setVisibility(show ? View.VISIBLE : View.GONE);
+      hidePrviewButton.setVisibility(View.GONE);
     } else if (buttonId == InCallButtonIds.BUTTON_ECT) {
-      ectButton.setVisibility(show ? View.VISIBLE : View.GONE);
+    // modify by fangchen    ectButton.setVisibility(show ? View.VISIBLE : View.GONE);
+      ectButton.setVisibility(View.GONE);
     } else if (buttonId == InCallButtonIds.BUTTON_BLIND_ECT) {
-      blindEctButton.setVisibility(show ? View.VISIBLE : View.GONE);
+     // modify by fangchen   blindEctButton.setVisibility(show ? View.VISIBLE : View.GONE);
+      blindEctButton.setVisibility(  View.GONE);
     /// [CMCC video ringtone] @{
     } else if (buttonId == InCallButtonIds.BUTTON_DIALPAD) {
-      dialpadButton.setVisibility(show ? View.VISIBLE : View.GONE);
+     // modify by fangchen   dialpadButton.setVisibility(show ? View.VISIBLE : View.GONE);
+      dialpadButton.setVisibility( View.GONE);
     /// [Video Conference] @{
     } else if (buttonId == InCallButtonIds.BUTTON_ADD_CALL) {
-      addCallButton.setVisibility(show ? View.VISIBLE : View.GONE);
+    // modify by fangchen   addCallButton.setVisibility(show ? View.VISIBLE : View.GONE);
+      addCallButton.setVisibility(  View.GONE);
     } else if (buttonId == InCallButtonIds.BUTTON_MERGE) {
-      mergeCallButton.setVisibility(show ? View.VISIBLE : View.GONE);
+    // modify by fangchen   mergeCallButton.setVisibility(show ? View.VISIBLE : View.GONE);
+      mergeCallButton.setVisibility( View.GONE);
     } else if (buttonId == InCallButtonIds.BUTTON_MANAGE_VIDEO_CONFERENCE) {
-      videoConferenceButton.setVisibility(show ? View.VISIBLE : View.GONE);
+    // modify by fangchen   videoConferenceButton.setVisibility(show ? View.VISIBLE : View.GONE);
+      videoConferenceButton.setVisibility( View.GONE);
     /// @}
     /// [Cancel upgrade] @{
     } else if (buttonId == InCallButtonIds.BUTTON_CANCEL_UPGRADE) {
-      cancelUpgradeButton.setVisibility(show ? View.VISIBLE : View.GONE);
+    // modify by fangchen   cancelUpgradeButton.setVisibility(show ? View.VISIBLE : View.GONE);
+      cancelUpgradeButton.setVisibility( View.GONE);
     /// @}
     /// [Video hold] @{
     } else if (buttonId == InCallButtonIds.BUTTON_HOLD) {
-      holdCallButton.setVisibility(show ? View.VISIBLE : View.GONE);
+    // modify by fangchen   holdCallButton.setVisibility(show ? View.VISIBLE : View.GONE);
+      holdCallButton.setVisibility( View.GONE);
     /// @}
     /// [Oneway Video] @{
-    } else if (buttonId == InCallButtonIds.BUTTON_UPGRADE_TO_VIDEO
-        && ExtensionManager.getInCallButtonExt().isOneWayVideoSupported()) {
-      upgradeCallButton.setVisibility(show ? View.VISIBLE : View.GONE);
+    } else if (buttonId == InCallButtonIds.BUTTON_UPGRADE_TO_VIDEO && ExtensionManager.getInCallButtonExt().isOneWayVideoSupported()) {
+          upgradeCallButton.setVisibility( View.VISIBLE  );
     }
     /// @}
   }
@@ -2139,9 +2163,13 @@ public class VideoCallFragment extends Fragment
             RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT);
     params.addRule(RelativeLayout.ALIGN_PARENT_START);
     params.addRule(RelativeLayout.ALIGN_PARENT_TOP);
+
+   // params.topMargin = 100;
+    //params.rightMargin = 100;
+    params.setMargins(0, 100, 100, 0);
     previewTextureView.setLayoutParams(params);
-    previewTextureView.setTranslationX(0);
-    previewTextureView.setTranslationY(0);
+  //  previewTextureView.setTranslationX(0);
+  //  previewTextureView.setTranslationY(0);
     previewTextureView.setOutlineProvider(null);

     previewOffBlurredImageView.setLayoutParams(params);
@@ -2173,10 +2201,12 @@ public class VideoCallFragment extends Fragment
       params.addRule(RelativeLayout.ALIGN_PARENT_END);
       params.setMarginEnd((int) resources.getDimension(R.dimen.videocall_preview_margin_end));
     } else {
-      params.addRule(RelativeLayout.ALIGN_PARENT_START);
+   //  modify by fangchen   params.addRule(RelativeLayout.ALIGN_PARENT_START);
+      params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
       params.setMarginStart((int) resources.getDimension(R.dimen.videocall_preview_margin_start));
     }
-    params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
+ // modify by fangchen start    params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
+    params.addRule(RelativeLayout.ALIGN_PARENT_TOP);
     remoteTextureView.setLayoutParams(params);
     remoteTextureView.setOutlineProvider(circleOutlineProvider);
     remoteTextureView.setClipToOutline(true);

4、通话界面-UI布局修改-用户预览-图像显示左下角移动到右上角

路径:/vendor/mediatek/proprietary/packages/apps/Dialer/java/com/android/incallui/video/impl/res/layout/frag_videocall.xml

修改如下:

java 复制代码
--- a/vendor/mediatek/proprietary/packages/apps/Dialer/java/com/android/incallui/video/impl/res/layout/frag_videocall.xml
+++ b/vendor/mediatek/proprietary/packages/apps/Dialer/java/com/android/incallui/video/impl/res/layout/frag_videocall.xml
@@ -62,6 +62,7 @@
     android:background="@color/videocall_overlay_background_color"
     tools:visibility="gone"/>

+  <!--
   <TextureView
     android:id="@+id/videocall_video_preview"
     android:layout_width="@dimen/videocall_preview_width"
@@ -71,6 +72,20 @@
     android:layout_alignParentBottom="true"
     android:layout_alignParentStart="true"
     android:importantForAccessibility="no"/>
+    -->
+
+
+  <TextureView
+      android:id="@+id/videocall_video_preview"
+      android:layout_width="180px"
+      android:layout_height="180px"
+      android:layout_marginTop="@dimen/videocall_preview_margin_bottom"
+      android:layout_marginEnd="@dimen/videocall_preview_margin_start"
+      android:layout_alignParentTop="true"
+      android:layout_alignParentRight="true"
+      android:importantForAccessibility="no"
+      android:layout_marginRight="100px"
+      />

   <ImageView
     android:id="@+id/videocall_preview_off_blurred_image_view"

5、通话界面-UI布局修改-功能菜单控制条左侧垂直显示改为-底部横向展示-隐藏部分UI

路径:/vendor/mediatek/proprietary/packages/apps/Dialer/java/com/android/incallui/video/impl/res/layout/videocall_controls.xml

修改如下

java 复制代码
--- a/vendor/mediatek/proprietary/packages/apps/Dialer/java/com/android/incallui/video/impl/res/layout/videocall_controls.xml
+++ b/vendor/mediatek/proprietary/packages/apps/Dialer/java/com/android/incallui/video/impl/res/layout/videocall_controls.xml
@@ -45,177 +45,7 @@
     android:layout_alignParentBottom="true"
     android:layout_alignParentStart="true"
     android:visibility="invisible"/>
-  <!-- M: add scroll view to add mediatek new features. @{ -->
-  <ScrollView
-    android:id="@+id/videocall_video_controls_scrollview"
-    android:layout_width="wrap_content"
-    android:layout_height="wrap_content"
-    android:layout_below="@+id/incall_contact_grid"
-    android:gravity="center_horizontal"
-    android:layout_above="@+id/videocall_video_preview_placeholder"
-    android:layout_alignEnd="@+id/videocall_video_preview_placeholder"
-    android:layout_alignStart="@+id/videocall_video_preview_placeholder"
-    android:fadeScrollbars="false"
-    android:verticalScrollbarPosition="left"
-    android:scrollbarStyle="outsideOverlay"
-    android:scrollIndicators="bottom|top"
-    android:visibility="visible"
-    android:layout_marginBottom="12dp">
-  <!-- @} -->
-  <LinearLayout
-    android:id="@+id/videocall_video_controls"
-    android:layout_width="wrap_content"
-    android:layout_height="wrap_content"
-    android:orientation="vertical"
-    android:visibility="invisible"
-    android:layout_marginBottom="@dimen/videocall_button_spacing"
-    tools:visibility="visible">
-    <com.android.incallui.video.impl.CheckableImageButton
-      android:id="@+id/videocall_speaker_button"
-      style="@style/Incall.Button.VideoCall"
-      android:layout_marginBottom="@dimen/videocall_button_spacing"
-      android:checked="true"
-      android:src="@drawable/quantum_ic_volume_up_vd_theme_24"
-      app:contentDescriptionChecked="@string/incall_content_description_speaker"
-      app:contentDescriptionUnchecked="@string/incall_content_description_earpiece"
-      />
-    <com.android.incallui.video.impl.CheckableImageButton
-      android:id="@+id/videocall_mute_button"
-      style="@style/Incall.Button.VideoCall"
-      android:layout_marginBottom="@dimen/videocall_button_spacing"
-      android:src="@drawable/quantum_ic_mic_off_vd_theme_24"
-      app:contentDescriptionChecked="@string/incall_content_description_muted"
-      app:contentDescriptionUnchecked="@string/incall_content_description_unmuted"
-      />
-    <com.android.incallui.video.impl.CheckableImageButton
-      android:id="@+id/videocall_mute_video"
-      style="@style/Incall.Button.VideoCall"
-      android:layout_marginBottom="@dimen/videocall_button_spacing"
-      android:src="@drawable/quantum_ic_videocam_off_vd_theme_24"
-      app:contentDescriptionChecked="@string/incall_content_description_video_off"
-      app:contentDescriptionUnchecked="@string/incall_content_description_video_on"
-      android:visibility="gone"
-      />
-    <include
-      layout="@layout/switch_camera_button"
-      android:layout_width="@dimen/videocall_button_size"
-      android:layout_height="@dimen/videocall_button_size"
-      android:layout_marginBottom="@dimen/videocall_button_spacing"/>

-  <!-- M: add mediatek new features. @{ -->
-    <ImageButton
-      android:id="@+id/videocall_downgrade_audio"
-      style="@style/Incall.Button.VideoCall"
-      android:layout_width="@dimen/videocall_button_size"
-      android:layout_height="@dimen/videocall_button_size"
-      android:src="@drawable/mtk_ic_downgrade_audio"
-      android:layout_marginBottom="@dimen/videocall_button_spacing"
-      android:visibility="gone"
-      />
-    <!-- [Oneway Video] @{ -->
-    <ImageButton
-      android:id="@+id/videocall_upgrade"
-      style="@style/Incall.Button.VideoCall"
-      android:layout_width="@dimen/videocall_button_size"
-      android:layout_height="@dimen/videocall_button_size"
-      android:src="@drawable/quantum_ic_videocam_vd_theme_24"
-      android:layout_marginBottom="@dimen/videocall_button_spacing"
-      android:visibility="gone"
-      />
-    <com.android.incallui.video.impl.CheckableImageButton
-      android:id="@+id/hide_preview"
-      style="@style/Incall.Button.VideoCall"
-      android:layout_width="@dimen/videocall_button_size"
-      android:layout_height="@dimen/videocall_button_size"
-      android:layout_marginBottom="@dimen/videocall_button_spacing"
-      android:src="@drawable/mtk_ic_hidepreview"
-      app:contentDescriptionChecked="@string/hideVideoPreview"
-      app:contentDescriptionUnchecked="@string/showVideoPreview"
-      android:visibility="gone"
-      />
-    <ImageButton
-      android:id="@+id/cancel_upgrade"
-      style="@style/Incall.Button.VideoCall"
-      android:layout_width="@dimen/videocall_button_size"
-      android:layout_height="@dimen/videocall_button_size"
-      android:src="@drawable/mtk_ic_cancelupgrade"
-      android:layout_marginBottom="@dimen/videocall_button_spacing"
-      android:visibility="gone"
-      />
-    <!-- [Video Conference] @{ -->
-    <ImageButton
-      android:id="@+id/add_call"
-      style="@style/Incall.Button.VideoCall"
-      android:layout_width="@dimen/videocall_button_size"
-      android:layout_height="@dimen/videocall_button_size"
-      android:src="@drawable/ic_addcall_white"
-      android:layout_marginBottom="@dimen/videocall_button_spacing"
-      />
-    <ImageButton
-      android:id="@+id/merge_call"
-      style="@style/Incall.Button.VideoCall"
-      android:layout_width="@dimen/videocall_button_size"
-      android:layout_height="@dimen/videocall_button_size"
-      android:src="@drawable/quantum_ic_call_merge_vd_theme_24"
-      android:layout_marginBottom="@dimen/videocall_button_spacing"
-      android:visibility="gone"
-      />
-    <ImageButton
-      android:id="@+id/manage_video_conference"
-      style="@style/Incall.Button.VideoCall"
-      android:layout_width="@dimen/videocall_button_size"
-      android:layout_height="@dimen/videocall_button_size"
-      android:src="@drawable/quantum_ic_group_vd_theme_24"
-      android:layout_marginBottom="@dimen/videocall_button_spacing"
-      android:visibility="gone"
-      />
-    <!-- @} -->
-    <ImageButton
-      android:id="@+id/transfer_call"
-      style="@style/Incall.Button.VideoCall"
-      android:layout_width="@dimen/videocall_button_size"
-      android:layout_height="@dimen/videocall_button_size"
-      android:src="@drawable/mtk_ic_toolbar_transfer"
-      android:layout_marginBottom="@dimen/videocall_button_spacing"
-      android:visibility="gone"
-      />
-    <ImageButton
-      android:id="@+id/blind_transfer_call"
-      style="@style/Incall.Button.VideoCall"
-      android:layout_width="@dimen/videocall_button_size"
-      android:layout_height="@dimen/videocall_button_size"
-      android:src="@drawable/mtk_ic_toolbar_transfer"
-      android:layout_marginBottom="@dimen/videocall_button_spacing"
-      android:visibility="gone"
-      />
-    <!-- [CMCC video ringtone] @{ -->
-    <com.android.incallui.video.impl.CheckableImageButton
-      android:id="@+id/video_dialpad"
-      style="@style/Incall.Button.VideoCall"
-      android:layout_width="@dimen/videocall_button_size"
-      android:layout_height="@dimen/videocall_button_size"
-      android:layout_marginBottom="@dimen/videocall_button_spacing"
-      android:src="@drawable/mtk_ic_dialpad"
-      app:contentDescriptionChecked="@string/incall_label_dialpad"
-      app:contentDescriptionUnchecked="@string/incall_label_dialpad"
-      />
-    <!-- @} -->
-    <!-- [Video hold] @{ -->
-    <com.android.incallui.video.impl.CheckableImageButton
-      android:id="@+id/hold_call"
-      style="@style/Incall.Button.VideoCall"
-      android:layout_width="@dimen/videocall_button_size"
-      android:layout_height="@dimen/videocall_button_size"
-      android:layout_marginBottom="@dimen/videocall_button_spacing"
-      android:src="@drawable/mtk_ic_pause"
-      app:contentDescriptionChecked="@string/incall_content_description_hold"
-      app:contentDescriptionUnchecked="@string/incall_content_description_unhold"
-      android:visibility="gone"
-      />
-    <!-- @} -->
-  </LinearLayout>
-  </ScrollView>
-  <!-- @} -->

   <FrameLayout
     android:id="@+id/videocall_switch_controls"
@@ -231,8 +61,7 @@
       android:contentDescription="@string/incall_content_description_swap_calls"
       android:src="@drawable/quantum_ic_swap_calls_vd_theme_24"
       android:visibility="gone"
-      tools:visibility="visible"
-      />
+       />
   </FrameLayout>

   <!-- [CMCC video ringtone] @{ -->
@@ -254,4 +83,206 @@
     android:contentDescription="@string/incall_content_description_end_call"
     android:visibility="visible"/>

+
+
+  <!-- M: add scroll view to add mediatek new features. @{ -->
+  <ScrollView
+      android:id="@+id/videocall_video_controls_scrollview"
+      android:layout_width="match_parent"
+      android:layout_height="wrap_content"
+       android:gravity="center_horizontal"
+      android:scrollbarStyle="outsideOverlay"
+      android:scrollIndicators="bottom|top"
+      android:visibility="visible"
+      android:layout_marginBottom="200dp"
+      android:layout_alignParentBottom="true"
+      >
+    <RelativeLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:gravity="center_horizontal"
+        >
+      <LinearLayout
+          android:id="@+id/videocall_video_controls"
+          android:layout_width="wrap_content"
+          android:layout_height="wrap_content"
+          android:orientation="horizontal"
+          android:layout_centerHorizontal="true"
+          android:layout_marginBottom="@dimen/videocall_button_spacing"
+          tools:visibility="visible">
+
+        <com.android.incallui.video.impl.CheckableImageButton
+            android:id="@+id/videocall_mute_button"
+            style="@style/Incall.Button.VideoCall"
+            android:layout_marginBottom="@dimen/videocall_button_spacing"
+            android:src="@drawable/quantum_ic_mic_off_vd_theme_24"
+            app:contentDescriptionChecked="@string/incall_content_description_muted"
+            app:contentDescriptionUnchecked="@string/incall_content_description_unmuted"
+            android:layout_marginLeft="50dp"
+            android:layout_marginRight="50dp"
+            />
+
+        <com.android.incallui.video.impl.CheckableImageButton
+            android:id="@+id/videocall_speaker_button"
+            style="@style/Incall.Button.VideoCall"
+            android:layout_marginBottom="@dimen/videocall_button_spacing"
+            android:checked="true"
+            android:src="@drawable/quantum_ic_volume_up_vd_theme_24"
+            app:contentDescriptionChecked="@string/incall_content_description_speaker"
+            app:contentDescriptionUnchecked="@string/incall_content_description_earpiece"
+            android:layout_marginLeft="50dp"
+            android:layout_marginRight="50dp"
+            />
+
+        <com.android.incallui.video.impl.CheckableImageButton
+            android:id="@+id/videocall_mute_video"
+            style="@style/Incall.Button.VideoCall"
+            android:layout_marginBottom="@dimen/videocall_button_spacing"
+            android:src="@drawable/quantum_ic_videocam_off_vd_theme_24"
+            app:contentDescriptionChecked="@string/incall_content_description_video_off"
+            app:contentDescriptionUnchecked="@string/incall_content_description_video_on"
+            android:layout_marginLeft="50dp"
+            android:layout_marginRight="50dp"
+            />
+
+        <ImageButton
+            android:id="@+id/videocall_upgrade"
+            style="@style/Incall.Button.VideoCall"
+            android:layout_width="@dimen/videocall_button_size"
+            android:layout_height="@dimen/videocall_button_size"
+            android:src="@drawable/quantum_ic_videocam_vd_theme_24"
+            android:layout_marginLeft="50dp"
+            android:layout_marginRight="50dp"
+            android:visibility="gone"
+            />
+
+        <include
+            layout="@layout/switch_camera_button"
+            android:layout_width="@dimen/videocall_button_size"
+            android:layout_height="@dimen/videocall_button_size"
+            android:layout_marginBottom="@dimen/videocall_button_spacing"
+            android:visibility="gone"
+            />
+
+        <!-- M: add mediatek new features. @{ -->
+        <ImageButton
+            android:id="@+id/videocall_downgrade_audio"
+            style="@style/Incall.Button.VideoCall"
+            android:layout_width="@dimen/videocall_button_size"
+            android:layout_height="@dimen/videocall_button_size"
+            android:src="@drawable/mtk_ic_downgrade_audio"
+            android:layout_marginBottom="@dimen/videocall_button_spacing"
+            android:visibility="gone"
+            />
+        <!-- [Oneway Video] @{ -->
+      <!--  <ImageButton
+            android:id="@+id/videocall_upgrade"
+            style="@style/Incall.Button.VideoCall"
+            android:layout_width="@dimen/videocall_button_size"
+            android:layout_height="@dimen/videocall_button_size"
+            android:src="@drawable/quantum_ic_videocam_vd_theme_24"
+            android:layout_marginBottom="@dimen/videocall_button_spacing"
+            android:visibility="gone"
+            />-->
+        <com.android.incallui.video.impl.CheckableImageButton
+            android:id="@+id/hide_preview"
+            style="@style/Incall.Button.VideoCall"
+            android:layout_width="@dimen/videocall_button_size"
+            android:layout_height="@dimen/videocall_button_size"
+            android:layout_marginBottom="@dimen/videocall_button_spacing"
+            android:src="@drawable/mtk_ic_hidepreview"
+            app:contentDescriptionChecked="@string/hideVideoPreview"
+            app:contentDescriptionUnchecked="@string/showVideoPreview"
+            android:visibility="gone"
+            />
+        <ImageButton
+            android:id="@+id/cancel_upgrade"
+            style="@style/Incall.Button.VideoCall"
+            android:layout_width="@dimen/videocall_button_size"
+            android:layout_height="@dimen/videocall_button_size"
+            android:src="@drawable/mtk_ic_cancelupgrade"
+            android:layout_marginBottom="@dimen/videocall_button_spacing"
+            android:visibility="gone"
+            />
+        <!-- [Video Conference] @{ -->
+        <ImageButton
+            android:id="@+id/add_call"
+            style="@style/Incall.Button.VideoCall"
+            android:layout_width="@dimen/videocall_button_size"
+            android:layout_height="@dimen/videocall_button_size"
+            android:src="@drawable/ic_addcall_white"
+            android:layout_marginBottom="@dimen/videocall_button_spacing"
+            />
+        <ImageButton
+            android:id="@+id/merge_call"
+            style="@style/Incall.Button.VideoCall"
+            android:layout_width="@dimen/videocall_button_size"
+            android:layout_height="@dimen/videocall_button_size"
+            android:src="@drawable/quantum_ic_call_merge_vd_theme_24"
+            android:layout_marginBottom="@dimen/videocall_button_spacing"
+            android:visibility="gone"
+            />
+        <ImageButton
+            android:id="@+id/manage_video_conference"
+            style="@style/Incall.Button.VideoCall"
+            android:layout_width="@dimen/videocall_button_size"
+            android:layout_height="@dimen/videocall_button_size"
+            android:src="@drawable/quantum_ic_group_vd_theme_24"
+            android:layout_marginBottom="@dimen/videocall_button_spacing"
+            android:visibility="gone"
+            />
+        <!-- @} -->
+        <ImageButton
+            android:id="@+id/transfer_call"
+            style="@style/Incall.Button.VideoCall"
+            android:layout_width="@dimen/videocall_button_size"
+            android:layout_height="@dimen/videocall_button_size"
+            android:src="@drawable/mtk_ic_toolbar_transfer"
+            android:layout_marginBottom="@dimen/videocall_button_spacing"
+            android:visibility="gone"
+            />
+        <ImageButton
+            android:id="@+id/blind_transfer_call"
+            style="@style/Incall.Button.VideoCall"
+            android:layout_width="@dimen/videocall_button_size"
+            android:layout_height="@dimen/videocall_button_size"
+            android:src="@drawable/mtk_ic_toolbar_transfer"
+            android:layout_marginBottom="@dimen/videocall_button_spacing"
+            android:visibility="gone"
+            />
+        <!-- [CMCC video ringtone] @{ -->
+        <com.android.incallui.video.impl.CheckableImageButton
+            android:id="@+id/video_dialpad"
+            style="@style/Incall.Button.VideoCall"
+            android:layout_width="@dimen/videocall_button_size"
+            android:layout_height="@dimen/videocall_button_size"
+            android:layout_marginBottom="@dimen/videocall_button_spacing"
+            android:src="@drawable/mtk_ic_dialpad"
+            app:contentDescriptionChecked="@string/incall_label_dialpad"
+            app:contentDescriptionUnchecked="@string/incall_label_dialpad"
+            android:visibility="gone"
+
+            />
+        <!-- @} -->
+        <!-- [Video hold] @{ -->
+        <com.android.incallui.video.impl.CheckableImageButton
+            android:id="@+id/hold_call"
+            style="@style/Incall.Button.VideoCall"
+            android:layout_width="@dimen/videocall_button_size"
+            android:layout_height="@dimen/videocall_button_size"
+            android:layout_marginBottom="@dimen/videocall_button_spacing"
+            android:src="@drawable/mtk_ic_pause"
+            app:contentDescriptionChecked="@string/incall_content_description_hold"
+            app:contentDescriptionUnchecked="@string/incall_content_description_unhold"
+            android:visibility="gone"
+            />
+        <!-- @} -->
+      </LinearLayout>
+
+    </RelativeLayout>
+    <!-- @} -->
+
+  </ScrollView>
+  <!-- @} -->
+
 </RelativeLayout>

五、经验之谈-坑点

在调试如下按钮时候,特别难调:

注意点:控制大小 布局里面要设置、控制位置 硬编码Java 里面要定义。 注意自适应和实际写死高度等细节问题,不然很难调试成功的。

总结