blob: e47abe288d222f521bd399b74ddb39f2d1859e30 [file] [log] [blame]
Jeff Sharkey344744b2016-01-28 19:03:30 -07001/*
2 * Copyright (C) 2016 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.os;
18
19import android.content.Intent;
20
21/**
22 * The exception that is thrown when an application exposes a {@code file://}
23 * {@link android.net.Uri} to another app.
24 * <p>
25 * This exposure is discouraged since the receiving app may not have access to
26 * the shared path. For example, the receiving app may not have requested the
27 * {@link android.Manifest.permission#READ_EXTERNAL_STORAGE} runtime permission,
28 * or the platform may be sharing the {@link android.net.Uri} across user
29 * profile boundaries.
30 * <p>
31 * Instead, apps should use {@code content://} Uris so the platform can extend
32 * temporary permission for the receiving app to access the resource.
33 * <p>
34 * This is only thrown for applications targeting {@link Build.VERSION_CODES#N}
35 * or higher. Applications targeting earlier SDK versions are allowed to share
36 * {@code file://} {@link android.net.Uri}, but it's strongly discouraged.
37 *
38 * @see android.support.v4.content.FileProvider
39 * @see Intent#FLAG_GRANT_READ_URI_PERMISSION
40 */
41public class FileUriExposedException extends RuntimeException {
42 public FileUriExposedException(String message) {
43 super(message);
44 }
45}