am 1e5e3748: am 67f29573: am bb2aa63b: am a2e929e1: Tighten enforcement of file modes.
* commit '1e5e3748d4d431e48bd4b6a461ab3a9127beff7d':
Tighten enforcement of file modes.
diff --git a/core/java/android/content/ContentProvider.java b/core/java/android/content/ContentProvider.java
index 23d8f46..612ff0b 100644
--- a/core/java/android/content/ContentProvider.java
+++ b/core/java/android/content/ContentProvider.java
@@ -238,7 +238,7 @@
@Override
public ParcelFileDescriptor openFile(Uri uri, String mode)
throws FileNotFoundException {
- if (mode != null && mode.startsWith("rw")) enforceWritePermission(uri);
+ if (mode != null && mode.indexOf('w') != -1) enforceWritePermission(uri);
else enforceReadPermission(uri);
return ContentProvider.this.openFile(uri, mode);
}
@@ -246,7 +246,7 @@
@Override
public AssetFileDescriptor openAssetFile(Uri uri, String mode)
throws FileNotFoundException {
- if (mode != null && mode.startsWith("rw")) enforceWritePermission(uri);
+ if (mode != null && mode.indexOf('w') != -1) enforceWritePermission(uri);
else enforceReadPermission(uri);
return ContentProvider.this.openAssetFile(uri, mode);
}