Merge "AudioService: enable reusing an AudioPolicy"
This commit is contained in:
committed by
Android (Google) Code Review
commit
4fc108418a
@@ -3801,7 +3801,7 @@ public class AudioManager {
|
||||
final IAudioService service = getService();
|
||||
try {
|
||||
service.unregisterAudioPolicyAsync(policy.cb());
|
||||
policy.setRegistration(null);
|
||||
policy.reset();
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
}
|
||||
@@ -3823,7 +3823,7 @@ public class AudioManager {
|
||||
try {
|
||||
policy.invalidateCaptorsAndInjectors();
|
||||
service.unregisterAudioPolicy(policy.cb());
|
||||
policy.setRegistration(null);
|
||||
policy.reset();
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
}
|
||||
|
||||
@@ -487,6 +487,11 @@ public class AudioRecord implements AudioRouting, MicrophoneDirection,
|
||||
}
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
public AudioAttributes getAudioAttributes() {
|
||||
return mAudioAttributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builder class for {@link AudioRecord} objects.
|
||||
* Use this class to configure and create an <code>AudioRecord</code> instance. By setting the
|
||||
|
||||
@@ -553,6 +553,12 @@ public class AudioPolicy {
|
||||
}
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
public void reset() {
|
||||
setRegistration(null);
|
||||
mConfig.reset();
|
||||
}
|
||||
|
||||
public void setRegistration(String regId) {
|
||||
synchronized (mLock) {
|
||||
mRegistrationId = regId;
|
||||
@@ -566,6 +572,11 @@ public class AudioPolicy {
|
||||
sendMsg(MSG_POLICY_STATUS_CHANGE);
|
||||
}
|
||||
|
||||
/**@hide*/
|
||||
public String getRegistration() {
|
||||
return mRegistrationId;
|
||||
}
|
||||
|
||||
private boolean policyReadyToUse() {
|
||||
synchronized (mLock) {
|
||||
if (mStatus != POLICY_STATUS_REGISTERED) {
|
||||
|
||||
@@ -162,7 +162,7 @@ public class AudioPolicyConfig implements Parcelable {
|
||||
|
||||
public String toLogFriendlyString () {
|
||||
String textDump = new String("android.media.audiopolicy.AudioPolicyConfig:\n");
|
||||
textDump += mMixes.size() + " AudioMix: "+ mRegistrationId + "\n";
|
||||
textDump += mMixes.size() + " AudioMix, reg:" + mRegistrationId + "\n";
|
||||
for(AudioMix mix : mMixes) {
|
||||
// write mix route flags
|
||||
textDump += "* route flags=0x" + Integer.toHexString(mix.getRouteFlags()) + "\n";
|
||||
@@ -220,6 +220,10 @@ public class AudioPolicyConfig implements Parcelable {
|
||||
return textDump;
|
||||
}
|
||||
|
||||
protected void reset() {
|
||||
mMixCounter = 0;
|
||||
}
|
||||
|
||||
protected void setRegistration(String regId) {
|
||||
final boolean currentRegNull = (mRegistrationId == null) || mRegistrationId.isEmpty();
|
||||
final boolean newRegNull = (regId == null) || regId.isEmpty();
|
||||
|
||||
Reference in New Issue
Block a user