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

Commit 06f857d4 authored by Debashish Chatterjee's avatar Debashish Chatterjee
Browse files

Call log auto refresh.

Modified ExtendedCursor to support registration/unregistration
of contentObserver & datasetObserver on the cursor.

Automatic refresh of voicemail when inserted through the voicemail
content provider still does not work because call log uri is not
notified in this case. This will require a fix in the content provider.

Moved the call to reset new flag from onResume() to onStop() such that
calls are now marked as read when the user leaves the call log screen.
If entries were continued to be marked as read in onResume() then it
triggers a refresh and moves the entries from "new" to the
"old" section immediately. We want the entrie to remain in the "new"
section until the user exits the call log screen.

bug: 5055868

Change-Id: Iaef05ae721df1ab19dc001e17f4cd7be4019863e
parent f1acd266
Loading
Loading
Loading
Loading
+11 −3
Original line number Diff line number Diff line
@@ -868,7 +868,6 @@ public class CallLogFragment extends ListFragment implements ViewPagerVisibility
        mVoiceMailNumber = ((TelephonyManager) getActivity().getSystemService(
                Context.TELEPHONY_SERVICE)).getVoiceMailNumber();
        mCallLogQueryHandler = new CallLogQueryHandler(getActivity().getContentResolver(), this);

        setHasOptionsMenu(true);
    }

@@ -964,11 +963,21 @@ public class CallLogFragment extends ListFragment implements ViewPagerVisibility
    @Override
    public void onPause() {
        super.onPause();

        // Kill the requests thread
        mAdapter.stopRequestProcessing();
    }

    @Override
    public void onStop() {
        super.onStop();
        resetNewCallsFlag();
        // Clear notifications only when window gains focus.  This activity won't
        // immediately receive focus if the keyguard screen is above it.
        if (getActivity().hasWindowFocus()) {
            removeMissedCallNotifications();
        }
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
@@ -1158,7 +1167,6 @@ public class CallLogFragment extends ListFragment implements ViewPagerVisibility
        // again once being shown.
        mAdapter.invalidateCache();
        startCallsQuery();
        resetNewCallsFlag();
        startVoicemailStatusQuery();
        mAdapter.mPreDrawListener = null; // Let it restart the thread after next draw
        // Clear notifications only when window gains focus.  This activity won't
+23 −1
Original line number Diff line number Diff line
@@ -19,7 +19,9 @@ package com.android.contacts.calllog;
import com.android.common.io.MoreCloseables;

import android.database.AbstractCursor;
import android.database.ContentObserver;
import android.database.Cursor;
import android.database.DataSetObserver;

/**
 * Wraps a cursor to add an additional column with the same value for all rows.
@@ -129,4 +131,24 @@ public class ExtendedCursor extends AbstractCursor {
        MoreCloseables.closeQuietly(mCursor);
        super.close();
    }

    @Override
    public void registerContentObserver(ContentObserver observer) {
        mCursor.registerContentObserver(observer);
    }

    @Override
    public void unregisterContentObserver(ContentObserver observer) {
        mCursor.unregisterContentObserver(observer);
    }

    @Override
    public void registerDataSetObserver(DataSetObserver observer) {
        mCursor.registerDataSetObserver(observer);
    }

    @Override
    public void unregisterDataSetObserver(DataSetObserver observer) {
        mCursor.unregisterDataSetObserver(observer);
    }
}