When the screen is off, you cannot slide down to reject the call. To answer a call, swipe up and down to change to a double button (answer button and reject button).

There are two reasons for this problem. First, the ui interface is too large compared to the machine, and the sliding distance is too long to be able to slide. Second, the sliding will just touch the home button of the physical private printing button on the screen. So I retreated to the desktop and couldn’t refuse

The activity of the screen call is: vendor/mediatek/proprietary/packages/apps/Dialer/java/com/android/incallui/InCallActivity.java

Solution:

Simply change the ui directly, and move the entire module of sliding to reject the answer to the appropriate place.

vendor/mediatek/proprietary/packages/apps/Dialer/java/com/android/incallui/answer/impl/answermethod/res/layout/swipe_up_down_method.xml

Change the android:layout_marginBottom attribute, which was originally 20dp. Just change the prompt text of "slide down to reject" at the bottom. Because the entire layout is <LinearLayout under <FrameLayout, the controls under android:orientation="vertical" are distributed vertically one by one

        <TextView
               android:id="@+id/incoming_swipe_to_reject_text"
                android:layout_width="wrap_content"
               android:layout_height="wrap_content"
               android:layout_marginBottom="150dp"    
               android:layout_gravity="center_horizontal"
                android:alpha="0"
                android:focusable="false"
                android:gravity="center_horizontal"
               android:text="@string/call_incoming_swipe_to_reject"
               android:textAppearance="@style/Dialer.Incall.TextAppearance.Hint"
                tools:alpha="1"/>
     </LinearLayout>

If you want to change the sliding logic, then in:

java/com/android/incallui/answer/impl/answermethod/FlingUpDownMethod.java

But the algorithm inside is relatively cumbersome and I don’t mind changing it here. After analyzing the reason, the source code design is fine. If the sliding distance is shortened, it is easy to accidentally touch

Native design slide to answer, button to answer in two ways, if you change to double button, you only need to

vendor/mediatek/proprietary/packages/apps/Dialer/java/com/android/incallui/answer/impl/answermethod/AnswerMethodFactory.java

exist

public static AnswerMethod createAnswerMethod(@NonNullActivity activity) {
    /*/tyd.yantao
        if (needTwoButton(activity)) {
        //*/
        if(true){
        //*/
          return new TwoButtonMethod();
        } else {
          return new FlingUpDownMethod();
        }

Guess you like

Origin blog.csdn.net/youthking1314/article/details/129620731