title: SELinux Permission Denied for a new framework service in android
body: <p>I have added a new System Service into Android Framework in earlier versions (4.4) following this tutorial from <a href="http://processors.wiki.ti.com/index.php/Android-Adding_SystemService" rel="nofollow">Texas Instruments</a></p>
  
  <p>But when I try to do a similar thing in Android Lollipop, the SELinux policy denies me to do so. 
  This is the output from logcat. </p>
  
  <pre><code>05-11 15:49:51.362   248   248 I SystemServer: Test Service Starting
  05-11 15:49:51.364   248   248 I TestManagerService: Started Test Manager Service
  05-11 15:49:51.370    54    54 E SELinux : avc:  denied  { add } for service=TestManagerService scontext=u:r:system_server:s0 tcontext=u:object_r:default_android_service:s0 tclass=service_manager
  05-11 15:49:51.371    54    54 E ServiceManager: add_service('TestManagerService',28) uid=1000 - PERMISSION DENIED
  05-11 15:49:51.378   248   248 E SystemServer: Failure starting TestManagerService
  05-11 15:49:51.378   248   248 E SystemServer: java.lang.SecurityException
  05-11 15:49:51.378   248   248 E SystemServer:  at android.os.BinderProxy.transactNative(Native Method)
  05-11 15:49:51.378   248   248 E SystemServer:  at android.os.BinderProxy.transact(Binder.java:496)
  05-11 15:49:51.378   248   248 E SystemServer:  at android.os.ServiceManagerProxy.addService(ServiceManagerNative.java:150)
  05-11 15:49:51.378   248   248 E SystemServer:  at android.os.ServiceManager.addService(ServiceManager.java:72)
  05-11 15:49:51.378   248   248 E SystemServer:  at com.android.server.SystemServer.startOtherServices(SystemServer.java:551)
  05-11 15:49:51.378   248   248 E SystemServer:  at com.android.server.SystemServer.run(SystemServer.java:257)
  05-11 15:49:51.378   248   248 E SystemServer:  at com.android.server.SystemServer.main(SystemServer.java:171)
  05-11 15:49:51.378   248   248 E SystemServer:  at java.lang.reflect.Method.invoke(Native Method)
  05-11 15:49:51.378   248   248 E SystemServer:  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:723)
  05-11 15:49:51.378   248   248 E SystemServer:  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:613)
  </code></pre>
  
  <p>I do not want to disable SELinux policy. I just want the policy to allow my new service too. What should I do? </p>