title: Call handling on Android
body: <p>I came across this problem several times in google group Android, here on SO and other communication platform. I'm aiming for the functionalities of the internal interface com.android.internal.telephony.Phone</p>
  
  <p>Right now I managed to answer a call programmatically and also answer the second call (and thus put first call on hold) via TelephonyManager's <code>getITelephony()</code> and Reflection for <code>answerRingingCall()/endCall()</code></p>
  
  <p>Now I'm trying to access the function <code>conference() throws CallStateException</code> from the Phone interface mentioned above.</p>
  
  <p>Therefore I've created a package with the class Phone.aidl</p>
  
  <pre><code>package com.android.internal.telephony;
  
  interface Phone {
  
  void conference();
  void switchHoldingAndActive();
  }
  </code></pre>
  
  <p>This class generates the Phone interface with the 2 functions in the /gen/ folder.
  Now I created a class to extend this Stub</p>
  
  <pre><code>import android.os.RemoteException;
  import com.android.internal.telephony.Phone;
  public class Gdata extends Phone.Stub {
  public void conference() throws RemoteException {}
  public void switchHoldingAndActive() throws RemoteException {}
  }
  </code></pre>
  
  <p>If i try to run this in my activity it looks like this</p>
  
  <pre><code>public void onClick(View v) {
  try {
  Gdata gd = new Gdata();
                  gd.conference();
                  Log.i("Conference", "working....");
              } catch (Exception e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
                  Log.i("Conference", "not working....");
              }}
      });
  </code></pre>
  
  <p>Now to my output on LogCat, what actually makes this case interesting:
  First when loading my Gdata class</p>
  
  <pre><code>01-25 15:30:31.023: D/dalvikvm(5993): Note: class     Lcom/android/internal/telephony/Phone$Stub; has 295 unimplemented (abstract) methods
  </code></pre>
  
  <p>Then right after it, after my two functions are declared in the Gdata class</p>
  
  <pre><code>01-25 15:30:31.023: D/dalvikvm(5993): Note: class Lcom/android/internal/telephony/Phone$Stub$Proxy; has 293 unimplemented (abstract) methods
  </code></pre>
  
  <p>This is actually indicating that I caught the right class with my Phone.aidl and also the right methods/functions. For example: If I implement in my Phone.aidl a random void called fun() then the dalvikvm gives me an error and quits the application immediately - so this proves also that the methods in my Phone.aidl were assigned correctly to the internal interface-methods. </p>
  
  <p>I don't neither errors nor warnings but something seems to be missing because it actually doesn't do the conference() function while having one calls on hold and one active call.</p>
  
  <p>I've also implemented the method switchHoldingAndActive(), this one also doesn't give me any error/warning but it also doesn't work.</p>
  
  <p>I've been working on that issue for a couple of weeks now and my actual state makes me feel like I'm quite near the answer. Could anybody help me out with that?</p>