summaryrefslogtreecommitdiff
path: root/core/java/android/content/ContentProvider.java
diff options
context:
space:
mode:
authorNicolas Prevot <nprevot@google.com>2014-09-08 18:26:55 +0100
committerNicolas Prevot <nprevot@google.com>2014-09-08 18:28:43 +0100
commit6e412adaa70a25c6b47eb274736b67071e6e47c6 (patch)
treec976720e1b4dadde28a00733d1dabb01aad164cf /core/java/android/content/ContentProvider.java
parent5f183f0671dfa1d87ca6d741deb457170c432493 (diff)
Allowing a ContentProvider to have a null authority.
In this case, it will not be possible to query it with any uri. BUG: 17414813 Change-Id: I76e8ad91539904f3c52b5a3436b2f1bd5e4d0fdf
Diffstat (limited to 'core/java/android/content/ContentProvider.java')
-rw-r--r--core/java/android/content/ContentProvider.java22
1 files changed, 13 insertions, 9 deletions
diff --git a/core/java/android/content/ContentProvider.java b/core/java/android/content/ContentProvider.java
index fde8b2e0c9d9..2853c58d4b07 100644
--- a/core/java/android/content/ContentProvider.java
+++ b/core/java/android/content/ContentProvider.java
@@ -639,12 +639,14 @@ public abstract class ContentProvider implements ComponentCallbacks2 {
* @param authorities the semi-colon separated authorities of the ContentProvider.
*/
protected final void setAuthorities(String authorities) {
- if (authorities.indexOf(';') == -1) {
- mAuthority = authorities;
- mAuthorities = null;
- } else {
- mAuthority = null;
- mAuthorities = authorities.split(";");
+ if (authorities != null) {
+ if (authorities.indexOf(';') == -1) {
+ mAuthority = authorities;
+ mAuthorities = null;
+ } else {
+ mAuthority = null;
+ mAuthorities = authorities.split(";");
+ }
}
}
@@ -653,9 +655,11 @@ public abstract class ContentProvider implements ComponentCallbacks2 {
if (mAuthority != null) {
return mAuthority.equals(authority);
}
- int length = mAuthorities.length;
- for (int i = 0; i < length; i++) {
- if (mAuthorities[i].equals(authority)) return true;
+ if (mAuthorities != null) {
+ int length = mAuthorities.length;
+ for (int i = 0; i < length; i++) {
+ if (mAuthorities[i].equals(authority)) return true;
+ }
}
return false;
}