title: Android runtime permissions for System app
body: <p>I'm building an android app and made it as system app by placing it under /system/priv-app (building AOSP)
  Android OS version : 6.0.1 (api 23)</p>
  
  <pre><code>ApplicationInfo ai = packageManager.getApplicationInfo(
                      packageName, 0);
              // Check if FLAG_SYSTEM or FLAG_UPDATED_SYSTEM_APP are set.
              if (ai != null
                      &amp;&amp; (ai.flags &amp; (ApplicationInfo.FLAG_SYSTEM | ApplicationInfo.FLAG_UPDATED_SYSTEM_APP)) != 0) {
                  return true;
              }
  </code></pre>
  
  <p>This code retuns true (for system app)</p>
  
  <p>I've read that system apps will have all the runtime permissions like location, storage, etc.</p>
  
  <p>But it is still asking for permissions (system dialog) for location and storage.</p>
  
  <p><strong>What i've tried ?</strong></p>
  
  <p>1) used this permission in manifest <code>"android.Manifest.permission.GRANT_RUNTIME_PERMISSIONS"</code></p>
  
  <p>2) added few lines of code in framework</p>
  
  <pre><code>   services/core/java/com/android/server/pm/DefaultPermissionGrantPolicy.java
  </code></pre>
  
  <p>as mentioned <a href="https://github.com/ProjectDisco/android_frameworks_base/commit/da1408d4a3df46af11854bf68844be133c5a20d3#diff-b748b21a02a7dfa1cccd67d1a5b06dec" rel="nofollow noreferrer">here</a></p>
  
  <p>but still app is asking for permissions.</p>
  
  <p>note* : i'm also looking to get permissions for <code>android.permission.WRITE_SETTINGS</code>,  <code>WRITE_SECURE_SETTINGS</code> and <code>Draw over other apps</code> without asking/prompting the user</p>
  
  <p><strong><em>One more note</em> :*</strong></p>
  
  <p><strong>This app is for a custom hardware with custom OS, i have access to all of framework code</strong></p>