Merge "Issue 5081351: isWiredHeadsetOn() permission."

This commit is contained in:
Eric Laurent
2011-08-12 18:48:35 -07:00
committed by Android (Google) Code Review
3 changed files with 6 additions and 12 deletions

View File

@@ -10253,7 +10253,7 @@ package android.media {
method public boolean isMicrophoneMute();
method public boolean isMusicActive();
method public boolean isSpeakerphoneOn();
method public boolean isWiredHeadsetOn();
method public deprecated boolean isWiredHeadsetOn();
method public void loadSoundEffects();
method public void playSoundEffect(int);
method public void playSoundEffect(int, float);

View File

@@ -1061,10 +1061,13 @@ public class AudioManager {
}
/**
* Checks whether audio routing to the wired headset is on or off.
* Checks whether a wired headset is connected or not.
* <p>This is not a valid indication that audio playback is
* actually over the wired headset as audio routing depends on other conditions.
*
* @return true if audio is being routed to/from wired headset;
* @return true if a wired headset is connected.
* false if otherwise
* @deprecated Use only to check is a headset is connected or not.
*/
public boolean isWiredHeadsetOn() {
if (AudioSystem.getDeviceConnectionState(DEVICE_OUT_WIRED_HEADSET,"")

View File

@@ -182,9 +182,6 @@ audio_policy_dev_state_t AudioPolicyService::getDeviceConnectionState(
if (mpAudioPolicy == NULL) {
return AUDIO_POLICY_DEVICE_STATE_UNAVAILABLE;
}
if (!checkPermission()) {
return AUDIO_POLICY_DEVICE_STATE_UNAVAILABLE;
}
return mpAudioPolicy->get_device_connection_state(mpAudioPolicy, device,
device_address);
}
@@ -250,9 +247,6 @@ audio_policy_forced_cfg_t AudioPolicyService::getForceUse(audio_policy_force_use
if (mpAudioPolicy == NULL) {
return AUDIO_POLICY_FORCE_NONE;
}
if (!checkPermission()) {
return AUDIO_POLICY_FORCE_NONE;
}
if (usage < 0 || usage >= AUDIO_POLICY_FORCE_USE_CNT) {
return AUDIO_POLICY_FORCE_NONE;
}
@@ -434,9 +428,6 @@ status_t AudioPolicyService::getStreamVolumeIndex(audio_stream_type_t stream, in
if (mpAudioPolicy == NULL) {
return NO_INIT;
}
if (!checkPermission()) {
return PERMISSION_DENIED;
}
if (stream < 0 || stream >= AUDIO_STREAM_CNT) {
return BAD_VALUE;
}