Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 02403e5c authored by Yorke Lee's avatar Yorke Lee
Browse files

Fix brief flash when clicking on a search result to dial

Delay the hiding of the search fragment so that the in-call ui has time
to show up.

Bug: 10780429
Change-Id: I0f44bbb10e221ad4480ed1acf6225e6d6b6411ce
parent 121b28e8
Loading
Loading
Loading
Loading
+21 −2
Original line number Diff line number Diff line
@@ -29,6 +29,8 @@ import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.provider.CallLog.Calls;
@@ -165,6 +167,21 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O

    private DialerDatabaseHelper mDialerDatabaseHelper;

    private static final int EVENT_DELAYED_HIDE_SEARCH = 1;

    // Wait this much time (in ms) before hiding the search fragment after clicking on
    // a search result to dial, to avoid jank
    private static final int CLEAR_SEARCH_DELAY = 500;

    final Handler mHandler = new Handler() {
        @Override
        public void handleMessage(Message msg) {
            if (msg.what == EVENT_DELAYED_HIDE_SEARCH) {
                hideDialpadAndSearchUi();
            }
        }
    };

    /**
     * Listener used when one of phone numbers in search UI is selected. This will initiate a
     * phone call using the phone number.
@@ -177,14 +194,16 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
                    // CallLog screen (search UI will be automatically exited).
                    PhoneNumberInteraction.startInteractionForPhoneCall(
                        DialtactsActivity.this, dataUri, getCallOrigin());
                    hideDialpadAndSearchUi();
                    mHandler.sendEmptyMessageDelayed(EVENT_DELAYED_HIDE_SEARCH,
                            CLEAR_SEARCH_DELAY);
                }

                @Override
                public void onCallNumberDirectly(String phoneNumber) {
                    Intent intent = CallUtil.getCallIntent(phoneNumber, getCallOrigin());
                    startActivity(intent);
                    hideDialpadAndSearchUi();
                    mHandler.sendEmptyMessageDelayed(EVENT_DELAYED_HIDE_SEARCH,
                            CLEAR_SEARCH_DELAY);
                }

                @Override