title: Android/ServiceManager.addService() java.lang.SecurityException
body: <p>I hava created system app. It has one aidl file and Service. I have implemented the aidl interface and addService in service method onStartCommand().</p>
  
  <pre><code>mBinder = getBDBinder();
      try {
          ServiceManager.addService("test", mBinder);
          BDLog.r(TAG, "create and add");
      } catch (SecurityException e) {
          BDLog.e(TAG, "Add service SecurityException");
      }
  </code></pre>
  
  <p>The SecurityException has happend.What can I do?
  I tried two methods to solove this problem, but it had no effect.</p>
  
  <ol>
  <li>setenforce 0</li>
  <li>add my service in service_context file</li>
  </ol>
  
  <p>Here is my manifest file:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="xxx.xxx.xxxx"
      android:sharedUserId="android.uid.system"
      android:versionCode="1200000"
      android:versionName="1.2.0" &gt;
  
      &lt;uses-feature android:name="android.hardware.type.watch" /&gt;
  
      &lt;uses-sdk
          android:minSdkVersion="14"
          android:targetSdkVersion="23" /&gt;
  
      &lt;uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /&gt;
      &lt;uses-permission android:name="android.permission.READ_SYNC_SETTINGS"/&gt;
      &lt;uses-permission android:name="android.permission.PACKAGE_USAGE_STATS" /&gt;
      &lt;uses-permission android:name="android.permission.WAKE_LOCK" /&gt;
      &lt;uses-permission android:name="android.permission.INTERNET"/&gt;
      &lt;application
          android:allowClearUserData="false"
          android:name=".xx"
          android:allowBackup="false"
          android:label="xx"&gt;
  
      &lt;/application&gt;
  &lt;/manifest&gt;
  </code></pre>