title: Get Android system permissions by putting app in /system/app?
body: <p>Experimenting with some newer Android APIs from the AOSP, I have found some that require the android.permission.BLUETOOTH_PRIVILEGED permission.  According to the <a href="http://developer.android.com/reference/android/Manifest.permission.html#BLUETOOTH_PRIVILEGED" rel="noreferrer">docs</a>, the permission "is not available to third party applications." </p>
  
  <p>I have read elsewhere that you can get system level permissions on a rooted device by installing your app in the /system/app directory.  I have tried this on my rooted Nexus 5, but my app still does not get the desired privilege. (See code and LogCat output below.)</p>
  
  <p><a href="https://stackoverflow.com/questions/9731004/how-to-grant-system-permissions-to-my-android-app">An alternative I have heard</a> is to build your own custom Android ROM, then sign the app with the same key.  I could do this, but would strongly prefer to be able to use a stock image if it is possible.  </p>
  
  <p>So which is it?  Is it possible to get system level permissions on a rooted phone with a stock image?  If so, am I doing something wrong?</p>
  
  <p>Activity:</p>
  
  <pre><code>@Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      if ((this.getApplicationInfo().flags &amp; ApplicationInfo.FLAG_SYSTEM) != 0) {
          Log.d(TAG, "This is a system application");
      }
      else {
          Log.d(TAG, "This is not a system application");         
      }
      if (getApplicationContext().checkCallingOrSelfPermission("android.permission.BLUETOOTH_PRIVILEGED") == PackageManager.PERMISSION_GRANTED) {
          Log.d(TAG, "I have android.permission.BLUETOOTH_PRIVILEGED");
      }
      else {
          Log.d(TAG, "I do not have android.permission.BLUETOOTH_PRIVILEGED");            
      }       
      ...     
  
  }
  </code></pre>
  
  <p>LogCat output:</p>
  
  <pre><code>W/PackageManager(  788): Not granting permission android.permission.BLUETOOTH_PRIVILEGED to package com.radiusnetworks.testapp (protectionLevel=18 flags=0x8be47)
  I/ActivityManager(  788): Start proc com.radiusnetworks.testapp for activity com.radiusnetworks.testapp/.MainActivity: pid=3124 uid=10075 gids={50075, 3002, 3001}
  D/MainActivity( 3124): This is a system application
  D/MainActivity( 3124): I do not have android.permission.BLUETOOTH_PRIVILEGED
  </code></pre>
  
  <p>Manifest:</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.radiusnetworks.testapp"
      android:versionCode="1"
      android:versionName="1.0" &gt;
  
    &lt;uses-sdk
      android:minSdkVersion="19"
      android:targetSdkVersion="19" /&gt;
    &lt;uses-permission android:name="android.permission.BLUETOOTH" /&gt; 
    &lt;uses-permission
       android:name="android.permission.BLUETOOTH_PRIVILEGED"/&gt;    
    &lt;uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /&gt;     
  
    &lt;application
      android:allowBackup="true"
      android:icon="@drawable/ic_launcher"
      android:label="@string/app_name"
      android:theme="@style/AppTheme" &gt;
      &lt;activity
          android:name="com.radiusnetworks.testapp.MainActivity"
          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;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>