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

Commit 59d25045 authored by Automerger Merge Worker's avatar Automerger Merge Worker
Browse files

Merge "Allow PeopleService to make blocking binder calls" into rvc-dev am: 4c0a5e27

Change-Id: I4c0754c593cc03ee4c0725119c9cd4b2818ccb4c
parents c3ac4d25 4c0a5e27
Loading
Loading
Loading
Loading
+29 −23
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import android.annotation.WorkerThread;
import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
import android.os.Binder;
import android.provider.Telephony.BaseMmsColumns;
import android.provider.Telephony.Mms;
import android.telephony.PhoneNumberUtils;
@@ -71,6 +72,8 @@ class MmsQueryHelper {
        // NOTE: The field Mms.DATE is stored in seconds, not milliseconds.
        String[] selectionArgs = new String[] { Long.toString(sinceTime / MILLIS_PER_SECONDS) };
        boolean hasResults = false;
        Binder.allowBlockingForCurrentThread();
        try {
            try (Cursor cursor = mContext.getContentResolver().query(
                    Mms.CONTENT_URI, projection, selection, selectionArgs, null)) {
                if (cursor == null) {
@@ -97,6 +100,9 @@ class MmsQueryHelper {
                    }
                }
            }
        } finally {
            Binder.defaultBlockingForCurrentThread();
        }
        return hasResults;
    }

+33 −27
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.server.people.data;
import android.annotation.WorkerThread;
import android.content.Context;
import android.database.Cursor;
import android.os.Binder;
import android.provider.Telephony.Sms;
import android.provider.Telephony.TextBasedSmsColumns;
import android.telephony.PhoneNumberUtils;
@@ -65,6 +66,8 @@ class SmsQueryHelper {
        String selection = Sms.DATE + " > ?";
        String[] selectionArgs = new String[] { Long.toString(sinceTime) };
        boolean hasResults = false;
        Binder.allowBlockingForCurrentThread();
        try {
            try (Cursor cursor = mContext.getContentResolver().query(
                    Sms.CONTENT_URI, projection, selection, selectionArgs, null)) {
                if (cursor == null) {
@@ -95,6 +98,9 @@ class SmsQueryHelper {
                    }
                }
            }
        } finally {
            Binder.defaultBlockingForCurrentThread();
        }
        return hasResults;
    }