views:

426

answers:

2

In my application I detect the out going call when a call is dialled from the dialer or contacts.

This works fine and I then pop up a dialog saying I have detected the call and then the user presses a button to close the dialog which calls finish() on that activity.

It all works fine except that when I then hold the home key to bring up the recently used apps the dialer icon is there.

And when it is clicked the dialog is brought back into focus in the foreground when the dialog activity should be dead and gone and not be able to be brought back to the foreground.

Here is a picture of what I mean.

Dialer error

So two questions arise, why would the dialer icon be getting placed there and why would it be recalling my activity to the foreground?

Here is the code for that Activity which has a dialog theme:

 public class CallDialogActivity extends Activity{

 boolean isRecording;
 AudioManager audio_service;

 public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.dialog);
      audio_service = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
      getWindow().addFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND);



      Bundle b = this.getIntent().getExtras();
      String number = b.getString("com.networks.NUMBER"); 
      String name = b.getString("com.networks.NAME"); 

      TextView tv = (TextView) findViewById(R.id.voip) ;
      tv.setText(name);

      Intent service = new Intent(CallAudio.CICERO_CALL_SERVICE);
         startService(service);

      final Button stop_Call_Button = (Button) findViewById(R.id.widget35);


      this.setVolumeControlStream(AudioManager.STREAM_VOICE_CALL);


        stop_Call_Button.setOnClickListener(new View.OnClickListener(){
  public void onClick(View v){


   Intent service = new Intent(CallAudio._CALL_SERVICE);

   //this is for Android 1.5 (sets speaker going for a few seconds before shutting down)


   stopService(service);
   Intent setIntent = new Intent(Intent.ACTION_MAIN);
         setIntent.addCategory(Intent.CATEGORY_HOME);
   setIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
   startActivity(setIntent); 
          finish();
             isRecording = false;

   }

 });

        final Button speaker_Button = (Button) findViewById(R.id.widget36);

         speaker_Button.setOnClickListener(new View.OnClickListener(){
       public void onClick(View v){

        if(true){
         audio_service.setSpeakerphoneOn(false);
        }
        else{
         audio_service.setSpeakerphoneOn(true);
        }

       }

      });

}

@Override protected void onResume() { super.onResume();

  }

  @Override
  protected void onPause() {

      super.onPause();
  }

  public void onCofigurationChanged(Configuration newConfig) { 

   super.onConfigurationChanged(newConfig); 

   }

}

It calls a service that uses AudioRecord to record from the Mic and AudioTrack to play it out the earpiece, nothing in the service to do with the dialler.

Has anyone any idea why this might be happening?

+1  A: 

The recently used apps menu doesn't care if the app has been finished. It just restarts it if so. It is showing things that have been recently used, not things that are currently running.

Lance Nanek
Thanks Lance, I am aware of that, the problem is with HTC's own dialer which they call Phone is what should be in the used apps menu and not the dialer, it appears they didnt implement there own dialer properly
Donal Rafferty
A: 

After some research it seems HTC's implementation of the dialer has some bugs in it, the dialer icon should never appear as the phone should be overriding it.

Donal Rafferty