Ejemplo n.º 1
0
 /**
  * Start ringing announce for a given contact. It will also focus audio for us.
  *
  * @param remoteContact the contact to ring for. May resolve the contact ringtone if any.
  */
 public synchronized void startRing(String remoteContact) {
   saveAudioState();
   if (!ringer.isRinging()) {
     ringer.ring(remoteContact, service.getPrefs().getRingtone());
   } else {
     Log.d(THIS_FILE, "Already ringing ....");
   }
 }
Ejemplo n.º 2
0
 public void setSpeakerphoneOn(boolean on) throws SameThreadException {
   if (service != null && restartAudioWhenRoutingChange && !ringer.isRinging()) {
     service.setNoSnd();
     userWantSpeaker = on;
     service.setSnd();
   } else {
     userWantSpeaker = on;
     audioManager.setSpeakerphoneOn(on);
   }
   broadcastMediaChanged();
 }
Ejemplo n.º 3
0
 public void setBluetoothOn(boolean on) throws SameThreadException {
   Log.d(THIS_FILE, "Set BT " + on);
   if (service != null && restartAudioWhenRoutingChange && !ringer.isRinging()) {
     service.setNoSnd();
     userWantBluetooth = on;
     service.setSnd();
   } else {
     userWantBluetooth = on;
     bluetoothWrapper.setBluetoothOn(on);
   }
   broadcastMediaChanged();
 }
Ejemplo n.º 4
0
  public void adjustStreamVolume(int streamType, int direction, int flags) {
    broadcastVolumeWillBeUpdated(streamType, EXTRA_VALUE_UNKNOWN);
    audioManager.adjustStreamVolume(streamType, direction, flags);
    if (streamType == AudioManager.STREAM_RING) {
      // Update ringer
      ringer.updateRingerMode();
    }

    int inCallStream = Compatibility.getInCallStream(userWantBluetooth);
    if (streamType == inCallStream) {
      int maxLevel = audioManager.getStreamMaxVolume(inCallStream);
      float modifiedLevel = (audioManager.getStreamVolume(inCallStream) / (float) maxLevel) * 10.0f;
      // Update default stream level
      service.getPrefs().setPreferenceFloatValue(SipConfigManager.SND_STREAM_LEVEL, modifiedLevel);
    }
  }
Ejemplo n.º 5
0
 /**
  * Stop all ringing. <br>
  * Warning, this will not unfocus audio.
  */
 public synchronized void stopRing() {
   LogUtils.e("ringring", "stop");
   if (ringer.isRinging()) {
     ringer.stopRing();
   }
 }