Merge "Allow PeopleService to make blocking binder calls" into rvc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
4c0a5e276e
@@ -21,6 +21,7 @@ import android.annotation.WorkerThread;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
|
import android.os.Binder;
|
||||||
import android.provider.Telephony.BaseMmsColumns;
|
import android.provider.Telephony.BaseMmsColumns;
|
||||||
import android.provider.Telephony.Mms;
|
import android.provider.Telephony.Mms;
|
||||||
import android.telephony.PhoneNumberUtils;
|
import android.telephony.PhoneNumberUtils;
|
||||||
@@ -71,6 +72,8 @@ class MmsQueryHelper {
|
|||||||
// NOTE: The field Mms.DATE is stored in seconds, not milliseconds.
|
// NOTE: The field Mms.DATE is stored in seconds, not milliseconds.
|
||||||
String[] selectionArgs = new String[] { Long.toString(sinceTime / MILLIS_PER_SECONDS) };
|
String[] selectionArgs = new String[] { Long.toString(sinceTime / MILLIS_PER_SECONDS) };
|
||||||
boolean hasResults = false;
|
boolean hasResults = false;
|
||||||
|
Binder.allowBlockingForCurrentThread();
|
||||||
|
try {
|
||||||
try (Cursor cursor = mContext.getContentResolver().query(
|
try (Cursor cursor = mContext.getContentResolver().query(
|
||||||
Mms.CONTENT_URI, projection, selection, selectionArgs, null)) {
|
Mms.CONTENT_URI, projection, selection, selectionArgs, null)) {
|
||||||
if (cursor == null) {
|
if (cursor == null) {
|
||||||
@@ -97,6 +100,9 @@ class MmsQueryHelper {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
|
Binder.defaultBlockingForCurrentThread();
|
||||||
|
}
|
||||||
return hasResults;
|
return hasResults;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ package com.android.server.people.data;
|
|||||||
import android.annotation.WorkerThread;
|
import android.annotation.WorkerThread;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
|
import android.os.Binder;
|
||||||
import android.provider.Telephony.Sms;
|
import android.provider.Telephony.Sms;
|
||||||
import android.provider.Telephony.TextBasedSmsColumns;
|
import android.provider.Telephony.TextBasedSmsColumns;
|
||||||
import android.telephony.PhoneNumberUtils;
|
import android.telephony.PhoneNumberUtils;
|
||||||
@@ -65,6 +66,8 @@ class SmsQueryHelper {
|
|||||||
String selection = Sms.DATE + " > ?";
|
String selection = Sms.DATE + " > ?";
|
||||||
String[] selectionArgs = new String[] { Long.toString(sinceTime) };
|
String[] selectionArgs = new String[] { Long.toString(sinceTime) };
|
||||||
boolean hasResults = false;
|
boolean hasResults = false;
|
||||||
|
Binder.allowBlockingForCurrentThread();
|
||||||
|
try {
|
||||||
try (Cursor cursor = mContext.getContentResolver().query(
|
try (Cursor cursor = mContext.getContentResolver().query(
|
||||||
Sms.CONTENT_URI, projection, selection, selectionArgs, null)) {
|
Sms.CONTENT_URI, projection, selection, selectionArgs, null)) {
|
||||||
if (cursor == null) {
|
if (cursor == null) {
|
||||||
@@ -95,6 +98,9 @@ class SmsQueryHelper {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
|
Binder.defaultBlockingForCurrentThread();
|
||||||
|
}
|
||||||
return hasResults;
|
return hasResults;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user