Merge "Clear calling identify b4 Beam callback." into mnc-dr1.5-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
4bbd3c4819
@@ -371,40 +371,44 @@ public final class NfcActivityManager extends IAppCallback.Stub
|
|||||||
flags = state.flags;
|
flags = state.flags;
|
||||||
activity = state.activity;
|
activity = state.activity;
|
||||||
}
|
}
|
||||||
|
final long ident = Binder.clearCallingIdentity();
|
||||||
|
try {
|
||||||
|
// Make callbacks without lock
|
||||||
|
if (ndefCallback != null) {
|
||||||
|
message = ndefCallback.createNdefMessage(event);
|
||||||
|
}
|
||||||
|
if (urisCallback != null) {
|
||||||
|
uris = urisCallback.createBeamUris(event);
|
||||||
|
if (uris != null) {
|
||||||
|
ArrayList<Uri> validUris = new ArrayList<Uri>();
|
||||||
|
for (Uri uri : uris) {
|
||||||
|
if (uri == null) {
|
||||||
|
Log.e(TAG, "Uri not allowed to be null.");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
String scheme = uri.getScheme();
|
||||||
|
if (scheme == null || (!scheme.equalsIgnoreCase("file") &&
|
||||||
|
!scheme.equalsIgnoreCase("content"))) {
|
||||||
|
Log.e(TAG, "Uri needs to have " +
|
||||||
|
"either scheme file or scheme content");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
uri = ContentProvider.maybeAddUserId(uri, UserHandle.myUserId());
|
||||||
|
validUris.add(uri);
|
||||||
|
}
|
||||||
|
|
||||||
// Make callbacks without lock
|
uris = validUris.toArray(new Uri[validUris.size()]);
|
||||||
if (ndefCallback != null) {
|
|
||||||
message = ndefCallback.createNdefMessage(event);
|
|
||||||
}
|
|
||||||
if (urisCallback != null) {
|
|
||||||
uris = urisCallback.createBeamUris(event);
|
|
||||||
if (uris != null) {
|
|
||||||
ArrayList<Uri> validUris = new ArrayList<Uri>();
|
|
||||||
for (Uri uri : uris) {
|
|
||||||
if (uri == null) {
|
|
||||||
Log.e(TAG, "Uri not allowed to be null.");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
String scheme = uri.getScheme();
|
|
||||||
if (scheme == null || (!scheme.equalsIgnoreCase("file") &&
|
|
||||||
!scheme.equalsIgnoreCase("content"))) {
|
|
||||||
Log.e(TAG, "Uri needs to have " +
|
|
||||||
"either scheme file or scheme content");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
uri = ContentProvider.maybeAddUserId(uri, UserHandle.myUserId());
|
|
||||||
validUris.add(uri);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uris = validUris.toArray(new Uri[validUris.size()]);
|
|
||||||
}
|
}
|
||||||
}
|
if (uris != null && uris.length > 0) {
|
||||||
if (uris != null && uris.length > 0) {
|
for (Uri uri : uris) {
|
||||||
for (Uri uri : uris) {
|
// Grant the NFC process permission to read these URIs
|
||||||
// Grant the NFC process permission to read these URIs
|
activity.grantUriPermission("com.android.nfc", uri,
|
||||||
activity.grantUriPermission("com.android.nfc", uri,
|
Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||||
Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
}
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
|
Binder.restoreCallingIdentity(ident);
|
||||||
}
|
}
|
||||||
return new BeamShareData(message, uris, new UserHandle(UserHandle.myUserId()), flags);
|
return new BeamShareData(message, uris, new UserHandle(UserHandle.myUserId()), flags);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user