title: Can't access a customProvider from another app. It says it's missing permissions it already has
body: <p>I'm trying to make an app that access a SQLite table from another app with a custom content provider. I'm getting the following error:</p>
  
  <pre><code>java.lang.SecurityException: Permission Denial: reading com.example.carlos.gymlog.MiContentProvider uri content://mi.uri.porquesi/sesiones from pid=2375, uid=10064 requires android.permission.permRead, or grantUriPermission()
  </code></pre>
  
  <p>However, my "sender" app (the one with the database) already has the required permissions:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.example.carlos.gymlog" &gt;
  
      &lt;application
          android:allowBackup="true"
          android:icon="@drawable/ic_launcher"
          android:label="@string/app_name"
          android:theme="@style/MiTema" &gt;
          &lt;activity
              android:name=".Principal"
              android:label="@string/app_name" &gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.MAIN" /&gt;
  
                  &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
          &lt;provider android:name="MiContentProvider"
              android:authorities="mi.uri.porquesi"
              android:readPermission="android.permission.permRead"
              android:exported="true"
              android:grantUriPermissions="true"&gt; &lt;/provider&gt;
  
      &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>
  
  <p>This is the code that causes the error in the "receiver" app (the one that tries to access the other):</p>
  
  <pre><code>ArrayList&lt;Sesion&gt; sacarDatos(Context c){
  
          Uri cUri = Uri.parse("content://mi.uri.porquesi/sesiones");
          ContentProviderClient miCP = c.getContentResolver().acquireContentProviderClient(cUri);
  
          ArrayList&lt;Sesion&gt; sesiones = null;
          try {
              Cursor cur  = miCP.query(cUri, null, null, null, null);
              sesiones = new ArrayList&lt;Sesion&gt;();
              cur.moveToFirst();
              Sesion sesion = null;
              do {
                  sesion = new Sesion(cur.getInt(0),cur.getInt(1),cur.getInt(2),cur.getInt(3));
                  sesiones.add(sesion);
              } while (cur.moveToNext());
  
          } catch (RemoteException e) {
              e.printStackTrace();
          }
          return sesiones;
      }
  </code></pre>
  
  <p>And lastly, this is my custom content provider:</p>
  
  <pre><code>public class MiContentProvider extends android.content.ContentProvider {
  
      private static final String uri = "content://mi.uri.porquesi";
  
      public static final Uri CONTENT_URI = Uri.parse(uri);
  
  
      @Override
      public boolean onCreate() {
  
          return true;
      }
  
      @Override
      public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
  
          BaseDatosHelper miBD = new BaseDatosHelper(getContext(), "SESIONES", null, 1);
          SQLiteDatabase db = miBD.getWritableDatabase();
          SQLiteQueryBuilder qb  = new SQLiteQueryBuilder();
          qb.setTables("SESIONES");
  
          Cursor cur = qb.query(db,projection,selection,selectionArgs,"","",sortOrder);
          cur.setNotificationUri(getContext().getContentResolver(),uri);
          return cur;
      }
  </code></pre>
  
  <p>(the rest of the methods like insert() aren't implemented, they just return null or whatever it is, I just want to select data not insert it).</p>
  
  <p>EDIT: </p>
  
  <p>My app A has </p>
  
  <pre><code> &lt;provider android:name="MiContentProvider"
          android:authorities="mi.uri.porquesi"
          android:exported="true"
          android:permission="mi.permision"
          android:grantUriPermissions="true"&gt; &lt;/provider&gt;
      &lt;permission
          android:name="mi.permision"
          /&gt;
  </code></pre>
  
  <p>( just a random temporal name) </p>
  
  <p>In app B, I've included </p>
  
  <pre><code>&lt;uses-permission android:name="mi.permision"/&gt;
  </code></pre>
  
  <p>However, now I get: </p>
  
  <pre><code>java.lang.SecurityException: Permission Denial: opening provider com.example.carlos.gymlog.MiContentProvider from ProcessRecord{335efe6e 3116:com.example.carlos.sample/u0a67} (pid=3116, uid=10067) requires mi.permision or mi.permision
  </code></pre>
  
  <p>So it recognizes that I need my custom permission, but it doesn't recognize that my app B is using it. Why??</p>