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

Commit e19ee7cb authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge changes from topic "AtPhonebook"

* changes:
  Fix AtPhonebookTest breakage
  Revert "Comment one verify in two tests that is currently failing."
parents beb3ab3d 0fd11214
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -71,7 +71,8 @@ public class AtPhonebook {
    private static final String INCOMING_CALL_WHERE = Calls.TYPE + "=" + Calls.INCOMING_TYPE;
    private static final String MISSED_CALL_WHERE = Calls.TYPE + "=" + Calls.MISSED_TYPE;

    private class PhonebookResult {
    @VisibleForTesting
    class PhonebookResult {
        public Cursor cursor; // result set of last query
        public int numberColumn;
        public int numberPresentationColumn;
@@ -388,7 +389,8 @@ public class AtPhonebook {
     *  If force then re-query that phonebook
     *  Returns null if the cursor is not ready
     */
    private synchronized PhonebookResult getPhonebookResult(String pb, boolean force) {
    @VisibleForTesting
    synchronized PhonebookResult getPhonebookResult(String pb, boolean force) {
        if (pb == null) {
            return null;
        }
@@ -470,7 +472,8 @@ public class AtPhonebook {
        mCheckingAccessPermission = false;
    }

    private synchronized int getMaxPhoneBookSize(int currSize) {
    @VisibleForTesting
    synchronized int getMaxPhoneBookSize(int currSize) {
        // some car kits ignore the current size and request max phone book
        // size entries. Thus, it takes a long time to transfer all the
        // entries. Use a heuristic to calculate the max phone book size
+10 −8
Original line number Diff line number Diff line
@@ -110,11 +110,11 @@ public class AtPhonebookTest {

    @Test
    public void handleCpbsCommand() {
        //Check removed in order to have clean instrumentation runs
        //TODO b/255833353: Fix
        //mAtPhonebook.handleCpbsCommand(INVALID_COMMAND, AtPhonebook.TYPE_READ, mTestDevice);
        //verify(mNativeInterface).atResponseString(mTestDevice,
        //        "+CPBS: \"" + "ME" + "\"," + 0 + "," + 256);
        mAtPhonebook.handleCpbsCommand(INVALID_COMMAND, AtPhonebook.TYPE_READ, mTestDevice);
        int size = mAtPhonebook.getPhonebookResult("ME", true).cursor.getCount();
        int maxSize = mAtPhonebook.getMaxPhoneBookSize(size);
        verify(mNativeInterface).atResponseString(mTestDevice,
                "+CPBS: \"" + "ME" + "\"," + size + "," + maxSize);

        mAtPhonebook.handleCpbsCommand(INVALID_COMMAND, AtPhonebook.TYPE_TEST, mTestDevice);
        verify(mNativeInterface).atResponseString(mTestDevice,
@@ -140,9 +140,11 @@ public class AtPhonebookTest {
    @Test
    public void handleCpbrCommand() {
        mAtPhonebook.handleCpbrCommand(INVALID_COMMAND, AtPhonebook.TYPE_TEST, mTestDevice);
        //Check removed in order to have clean instrumentation runs
        //TODO b/255833353: Fix
        //verify(mNativeInterface).atResponseString(mTestDevice, "+CPBR: (1-" + 1 + "),30,30");
        int size = mAtPhonebook.getPhonebookResult("ME", true).cursor.getCount();
        if (size == 0) {
            size = 1;
        }
        verify(mNativeInterface).atResponseString(mTestDevice, "+CPBR: (1-" + size + "),30,30");
        verify(mNativeInterface).atResponseCode(mTestDevice, HeadsetHalConstants.AT_RESPONSE_OK,
                -1);