title: How to fix java.lang.SecurityException: This PhoneAccountHandle is not enabled for this user?
body: <p>I had the below given code working for me to make a self managed connecion service. But this has stopped working with this error:</p>
  <blockquote>
  <p>java.lang.SecurityException: This PhoneAccountHandle is not enabled for this user!</p>
  </blockquote>
  <p>Code:</p>
  <pre><code>class CallManager(context: Context) {
  val telecomManager: TelecomManager
  var phoneAccountHandle: PhoneAccountHandle
  var context: Context
  
  init {
      telecomManager = context.getSystemService(Context.TELECOM_SERVICE) as TelecomManager
      this.context = context
  
      val componentName = ComponentName(this.context, ConnService::class.java)
      phoneAccountHandle = PhoneAccountHandle(componentName,&quot;com.darkhorse.videocalltest&quot;)
  }
  
  fun register(){
      val phoneAccount = PhoneAccount.builder(phoneAccountHandle,&quot;com.darkhorse.videocalltest&quot;)
          .setCapabilities(PhoneAccount.CAPABILITY_CALL_PROVIDER) .setCapabilities(PhoneAccount.CAPABILITY_CONNECTION_MANAGER).build()
      telecomManager.registerPhoneAccount(phoneAccount)
  }
  
  fun incomingCall(caller: String?){
      val callInfo = Bundle()
      callInfo.putString(&quot;from&quot;, caller)
      telecomManager.addNewIncomingCall(phoneAccountHandle,callInfo)
      Log.i(&quot;incomingCall&quot;, &quot;incomingCall&quot;)
  }
  }
  </code></pre>
  <p>I am sure the same code was working fine earlier.</p>
  <p><a href="https://stackoverflow.com/questions/46097092/implement-a-system-managed-connectionservice">This question</a> doesn't help.</p>