From c83343f7ee333376d23a2bbc619d3b4e6b7a6120 Mon Sep 17 00:00:00 2001
From: Janis Danisevskis
Date: Tue, 15 Mar 2016 12:14:53 +0000
Subject: [PATCH] Document restricted app private file permissions
Make the docs reflect changes in private file access permissions.
Starting with API level 24 app private files are exclusively accessible
to the owning app. Files can no longer be shared by name because apps
cannot relax the files system permissions.
Bug: 27636012
Change-Id: Ibcb5032986c819829fa13ba07a74f20f2997e995
---
docs/html/guide/topics/data/data-storage.jd | 13 +++++++++++++
docs/html/training/basics/data-storage/files.jd | 8 +++++++-
2 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/docs/html/guide/topics/data/data-storage.jd b/docs/html/guide/topics/data/data-storage.jd
index 46db371a92818..0d3bb4d151183 100644
--- a/docs/html/guide/topics/data/data-storage.jd
+++ b/docs/html/guide/topics/data/data-storage.jd
@@ -178,6 +178,19 @@ android.content.Context#MODE_APPEND}, {@link
android.content.Context#MODE_WORLD_READABLE}, and {@link
android.content.Context#MODE_WORLD_WRITEABLE}.
+Note: The constants {@link
+android.content.Context#MODE_WORLD_READABLE} and {@link
+android.content.Context#MODE_WORLD_WRITEABLE} have been deprecated since API level 17. Since
+API level 24 their use will result in a {@link java.lang.SecurityException} to be thrown.
+This means that apps targeting API level 24 and higher
+cannot share private files by name, and attempts to share a "file://" URI will result in a
+{@link android.os.FileUriExposedException} to be thrown. If your app needs to share private
+files with other apps, it may use a {@link android.support.v4.content.FileProvider} with
+the {@link android.content.Intent.FLAG_GRANT_READ_URI_PERMISSION}.
+See also Sharing Files.
+
+
To read a file from internal storage:
diff --git a/docs/html/training/basics/data-storage/files.jd b/docs/html/training/basics/data-storage/files.jd
index 49a9169e3f566..983d59a47f4e3 100644
--- a/docs/html/training/basics/data-storage/files.jd
+++ b/docs/html/training/basics/data-storage/files.jd
@@ -59,7 +59,7 @@ The following lists summarize the facts about each storage space.
Internal storage:
- It's always available.
-- Files saved here are accessible by only your app by default.
+- Files saved here are accessible by only your app.
- When the user uninstalls your app, the system removes all your app's files from
internal storage.
@@ -83,6 +83,12 @@ place for files that don't require access restrictions and for files that you wa
with other apps or allow the user to access with a computer.
+
+Note: Before API level 24, internal files could be made accessible to other
+apps by means of relaxing file system permissions. This is no longer the case. If you wish
+to make the content of a private file accessible to other apps, your app may use the
+{@link android.support.v4.content.FileProvider}. See Sharing Files.
Tip: Although apps are installed onto the internal storage by