Methods Summary |
---|
public void | addMix(AudioMix mix)Add an {@link AudioMix} to be part of the audio policy being built.
if (mix == null) {
throw new IllegalArgumentException("Illegal null AudioMix argument");
}
mMixes.add(mix);
|
public int | describeContents()
return 0;
|
protected java.lang.String | getRegistration()
return mRegistrationId;
|
public int | hashCode()
return Objects.hash(mMixes);
|
private static java.lang.String | mixTypeId(int type)
if (type == AudioMix.MIX_TYPE_PLAYERS) return "p";
else if (type == AudioMix.MIX_TYPE_RECORDERS) return "r";
else return "i";
|
protected void | setRegistration(java.lang.String regId)
final boolean currentRegNull = (mRegistrationId == null) || mRegistrationId.isEmpty();
final boolean newRegNull = (regId == null) || regId.isEmpty();
if (!currentRegNull && !newRegNull && !mRegistrationId.equals(regId)) {
Log.e(TAG, "Invalid registration transition from " + mRegistrationId + " to " + regId);
return;
}
mRegistrationId = regId == null ? "" : regId;
int mixIndex = 0;
for (AudioMix mix : mMixes) {
if (!mRegistrationId.isEmpty()) {
mix.setRegistration(mRegistrationId + "mix" + mixTypeId(mix.getMixType()) + ":"
+ mixIndex++);
} else {
mix.setRegistration("");
}
}
|
public java.lang.String | toLogFriendlyString()
String textDump = new String("android.media.audiopolicy.AudioPolicyConfig:\n");
textDump += mMixes.size() + " AudioMix: "+ mRegistrationId + "\n";
for(AudioMix mix : mMixes) {
// write mix route flags
textDump += "* route flags=0x" + Integer.toHexString(mix.getRouteFlags()) + "\n";
// write mix format
textDump += " rate=" + mix.getFormat().getSampleRate() + "Hz\n";
textDump += " encoding=" + mix.getFormat().getEncoding() + "\n";
textDump += " channels=0x";
textDump += Integer.toHexString(mix.getFormat().getChannelMask()).toUpperCase() +"\n";
// write mix rules
final ArrayList<AttributeMatchCriterion> criteria = mix.getRule().getCriteria();
for (AttributeMatchCriterion criterion : criteria) {
switch(criterion.mRule) {
case AudioMixingRule.RULE_EXCLUDE_ATTRIBUTE_USAGE:
textDump += " exclude usage ";
textDump += criterion.mAttr.usageToString();
break;
case AudioMixingRule.RULE_MATCH_ATTRIBUTE_USAGE:
textDump += " match usage ";
textDump += criterion.mAttr.usageToString();
break;
case AudioMixingRule.RULE_EXCLUDE_ATTRIBUTE_CAPTURE_PRESET:
textDump += " exclude capture preset ";
textDump += criterion.mAttr.getCapturePreset();
break;
case AudioMixingRule.RULE_MATCH_ATTRIBUTE_CAPTURE_PRESET:
textDump += " match capture preset ";
textDump += criterion.mAttr.getCapturePreset();
break;
default:
textDump += "invalid rule!";
}
textDump += "\n";
}
}
return textDump;
|
public void | writeToParcel(android.os.Parcel dest, int flags)
dest.writeInt(mMixes.size());
for (AudioMix mix : mMixes) {
// write mix route flags
dest.writeInt(mix.getRouteFlags());
// write mix format
dest.writeInt(mix.getFormat().getSampleRate());
dest.writeInt(mix.getFormat().getEncoding());
dest.writeInt(mix.getFormat().getChannelMask());
// write mix rules
final ArrayList<AttributeMatchCriterion> criteria = mix.getRule().getCriteria();
dest.writeInt(criteria.size());
for (AttributeMatchCriterion criterion : criteria) {
criterion.writeToParcel(dest);
}
}
|