title: java.lang.SecurityException: Permission Denial: opening provider com.google.android.apps.photos.content.GooglePhotosImageProvider
body: <p>All of the sudden, I started getting the following exception from devices running android 4.3 and above</p>
  
  <pre><code>java.lang.SecurityException: Permission Denial: opening provider com.google.android.apps.photos.content.GooglePhotosImageProvider from ProcessRecord{454ca9d0 5914:com.propertymanager/u0a10231} (pid=5914, uid=10231) requires com.google.android.apps.photos.permission.GOOGLE_PHOTOS or com.google.android.apps.photos.permission.GOOGLE_PHOTOS
          at android.os.Parcel.readException(Parcel.java:1431)
          at android.os.Parcel.readException(Parcel.java:1385)
          at android.app.ActivityManagerProxy.getContentProvider(ActivityManagerNative.java:2896)
          at android.app.ActivityThread.acquireProvider(ActivityThread.java:4755)
          at android.app.ContextImpl$ApplicationContentResolver.acquireUnstableProvider(ContextImpl.java:2480)
          at android.content.ContentResolver.acquireUnstableProvider(ContentResolver.java:1152)
          at android.content.ContentResolver.openTypedAssetFileDescriptor(ContentResolver.java:759)
          at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:665)
          at android.content.ContentResolver.openInputStream(ContentResolver.java:500)
          at com.myapp.xxxx.determineCorrectScale(SourceFile:148)
  </code></pre>
  
  <p>My The code causing it is </p>
  
  <pre><code>    public static int determineCorrectScale(Context con, Uri imagUri) {
          int scale = 1;
          InputStream imageStream = null;
  
                  imageStream = con.getContentResolver().openInputStream(imagUri);
  .
  .
  .
      }
  </code></pre>
  
  <p>Any help??</p>
  
  <p>EDIT:
  This is how  I let the user pick a picture before calling the above method</p>
  
  <pre><code>Intent choosePictureIntent = new Intent(Intent.ACTION_PICK, Images.Media.INTERNAL_CONTENT_URI);
  tartActivityForResult(choosePictureIntent, REQUEST_CHOOSE_IMAGE);
  </code></pre>
  
  <p>Here is the OnActivityResult:</p>
  
  <pre><code>protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
      super.onActivityResult(requestCode, resultCode, intent);
      if (resultCode == RESULT_OK) {
          switch (requestCode) {
          case REQUEST_CHOOSE_IMAGE:
  
              Uri selectedImage = intent.getData();
  
              try {
  
                  int scale = CommonFunc.determineCorrectScale(this, selectedImage);
  </code></pre>