Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f8a52c06 authored by Nicolas Prevot's avatar Nicolas Prevot Committed by Android (Google) Code Review
Browse files

Merge "Allowing a ContentProvider to have a null authority." into lmp-dev

parents 699a49b9 6e412ada
Loading
Loading
Loading
Loading
+13 −9
Original line number Diff line number Diff line
@@ -639,6 +639,7 @@ public abstract class ContentProvider implements ComponentCallbacks2 {
     * @param authorities the semi-colon separated authorities of the ContentProvider.
     */
    protected final void setAuthorities(String authorities) {
        if (authorities != null) {
            if (authorities.indexOf(';') == -1) {
                mAuthority = authorities;
                mAuthorities = null;
@@ -647,16 +648,19 @@ public abstract class ContentProvider implements ComponentCallbacks2 {
                mAuthorities = authorities.split(";");
            }
        }
    }

    /** @hide */
    protected final boolean matchesOurAuthorities(String authority) {
        if (mAuthority != null) {
            return mAuthority.equals(authority);
        }
        if (mAuthorities != null) {
            int length = mAuthorities.length;
            for (int i = 0; i < length; i++) {
                if (mAuthorities[i].equals(authority)) return true;
            }
        }
        return false;
    }