am bed59864: am 7d1d9f77: Merge "Allowing a ContentProvider to have a null authority." into lmp-dev

* commit 'bed598649b9eeae6d0112477113bb3904314a10e':
  Allowing a ContentProvider to have a null authority.
This commit is contained in:
Nicolas Prevot
2014-09-09 09:29:19 +00:00
committed by Android Git Automerger

View File

@@ -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;
}