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

Commit a67b2834 authored by Ashish Kumar Gaurav's avatar Ashish Kumar Gaurav Committed by Android (Google) Code Review
Browse files

Merge "Fixing tests failure due to unhandled exceptions" into udc-dev

parents b9991d2a 22047a39
Loading
Loading
Loading
Loading
+9 −8
Original line number Diff line number Diff line
@@ -342,15 +342,16 @@ public abstract class ContentProvider implements ContentInterface, ComponentCall
            final int enumCheckUriPermission =
                    GET_TYPE_ACCESSED_WITHOUT_PERMISSION__LOCATION__PROVIDER_CHECK_URI_PERMISSION;
            if (permissionCheckPassed) {
                try {
                    // Just for logging for mediaProvider cases
                    final ProviderInfo cpi = mContext.getPackageManager()
                            .resolveContentProvider(uri.getAuthority(),
                                PackageManager.ComponentInfoFlags.of(PackageManager.GET_META_DATA));
                                    PackageManager.ComponentInfoFlags.of(
                                            PackageManager.GET_META_DATA));
                    final int callingUserId = UserHandle.getUserId(callingUid);
                    final Uri userUri = (mSingleUser
                            && !UserHandle.isSameUser(mMyUid, callingUid))
                            ? maybeAddUserId(uri, callingUserId) : uri;
                try {
                    if (cpi.forceUriPermissions
                            && mInterface.checkUriPermission(uri,
                            callingUid, Intent.FLAG_GRANT_READ_URI_PERMISSION)
+7 −2
Original line number Diff line number Diff line
@@ -930,7 +930,8 @@ public abstract class ContentResolver implements ContentInterface {
        if (provider != null) {
            try {
                final StringResultListener resultListener = new StringResultListener();
                provider.getTypeAsync(url, new RemoteCallback(resultListener));
                provider.getTypeAsync(mContext.getAttributionSource(),
                        url, new RemoteCallback(resultListener));
                resultListener.waitForResult(CONTENT_PROVIDER_TIMEOUT_MILLIS);
                if (resultListener.exception != null) {
                    throw resultListener.exception;
@@ -944,7 +945,11 @@ public abstract class ContentResolver implements ContentInterface {
                Log.w(TAG, "Failed to get type for: " + url + " (" + e.getMessage() + ")");
                return null;
            } finally {
                try {
                    releaseProvider(provider);
                } catch (java.lang.NullPointerException e) {
                    // does nothing, Binder connection already null
                }
            }
        }