title: Android permission denied when reading /proc/self/exe from non-main thread
body: <p>I'm trying to get the canonical path of /proc/self/exe. When I do this on the Main Thread it works, when I do this on an different thread it crashes with an IOException: "Permission denied":</p>
  
  <pre><code>                   DBG  E  Thread: main
                          E  Path: /system/bin/app_process32
                          E  Thread: Thread-21656
              System.err  W  java.io.IOException: Permission denied
                          W      at java.io.File.canonicalizePath(Native Method)
                          W      at java.io.File.getCanonicalPath(File.java:414)
                          W      at java.io.File.getCanonicalFile(File.java:428)
                          W      at com.quanturium.testbugprocselfexe.MyActivity.getPathOfExecutable(MyActivity.java:36)
                          W      at com.quanturium.testbugprocselfexe.MyActivity.access$000(MyActivity.java:12)
                          W      at com.quanturium.testbugprocselfexe.MyActivity$1.run(MyActivity.java:26)
                          W      at java.lang.Thread.run(Thread.java:818)
  </code></pre>
  
  <p>Code: </p>
  
  <pre><code>@Override
  protected void onCreate (Bundle savedInstanceState)
  {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
      getPathOfExecutable(); // Works as expected
  
      new Thread(new Runnable() {
          @Override
          public void run ()
          {
              getPathOfExecutable(); // Trigger the IOException: Permission denied
          }
      }).start();
  }
  
  private void getPathOfExecutable()
  {
      try
      {
          Log.e("DBG", "Thread: " + Thread.currentThread().getName());
          Log.e("DBG", "Path: " + new File("/proc/self/exe").getCanonicalFile().getPath());
      }
      catch (IOException e)
      {
          e.printStackTrace();
      }
  }
  </code></pre>
  
  <p>This error only happens when debuggable is configured to false in the build.gradle file</p>
  
  <p>Code to try it out: <a href="https://github.com/quanturium/TestBugProcSelfExe">https://github.com/quanturium/TestBugProcSelfExe</a></p>
  
  <p>Is this a bug or an intended behavior? What would be a workaround to get the path of the current executable?</p>