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

Commit 8b1fd22b authored by Yorke Lee's avatar Yorke Lee Committed by Ed Mancebo
Browse files

Fix incorrect reported time for missed calls upon reboot

Bug: 17550526
Change-Id: I019e02649c0821b0e3e6b78a6b59e0fba51ad240
(cherry picked from commit a1cfd47b)
parent 7135a555
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -193,7 +193,7 @@ final class Call implements CreateConnectionResponse {
     * The time this call was created. Beyond logging and such, may also be used for bookkeeping
     * and specifically for marking certain call attempts as failed attempts.
     */
    private final long mCreationTimeMillis = System.currentTimeMillis();
    private long mCreationTimeMillis = System.currentTimeMillis();

    /** The gateway information associated with this call. This stores the original call handle
     * that the user is attempting to connect to via the gateway, the actual handle to dial in
@@ -580,6 +580,10 @@ final class Call implements CreateConnectionResponse {
        return mCreationTimeMillis;
    }

    void setCreationTimeMillis(long time) {
        mCreationTimeMillis = time;
    }

    long getConnectTimeMillis() {
        return mConnectTimeMillis;
    }
+12 −2
Original line number Diff line number Diff line
@@ -59,6 +59,14 @@ class MissedCallNotifier extends CallsManagerListenerBase {
        Calls.DURATION,
        Calls.TYPE,
    };

    private static final int CALL_LOG_COLUMN_ID = 0;
    private static final int CALL_LOG_COLUMN_NUMBER = 1;
    private static final int CALL_LOG_COLUMN_NUMBER_PRESENTATION = 2;
    private static final int CALL_LOG_COLUMN_DATE = 3;
    private static final int CALL_LOG_COLUMN_DURATION = 4;
    private static final int CALL_LOG_COLUMN_TYPE = 5;

    private static final int MISSED_CALL_NOTIFICATION_ID = 1;

    // notification light default constants
@@ -311,10 +319,11 @@ class MissedCallNotifier extends CallsManagerListenerBase {
                            // Get data about the missed call from the cursor
                            final String handleString = cursor.getString(
                                    cursor.getColumnIndexOrThrow(Calls.NUMBER));
                            final int presentation = cursor.getInt(cursor.getColumnIndexOrThrow(
                            Uri handle = Uri.parse(cursor.getString(CALL_LOG_COLUMN_NUMBER));
                            long date = cursor.getLong(CALL_LOG_COLUMN_DATE);
                            int presentation = cursor.getInt(cursor.getColumnIndexOrThrow(
                                    Calls.NUMBER_PRESENTATION));

                            final Uri handle;
                            if (presentation != Calls.PRESENTATION_ALLOWED
                                    || TextUtils.isEmpty(handleString)) {
                                handle = null;
@@ -329,6 +338,7 @@ class MissedCallNotifier extends CallsManagerListenerBase {
                                    false);
                            call.setDisconnectCause(new DisconnectCause(DisconnectCause.MISSED));
                            call.setState(CallState.DISCONNECTED);
                            call.setCreationTimeMillis(date);

                            // Listen for the update to the caller information before posting the
                            // notification so that we have the contact info and photo.