Merge "AudioService: better vol adjustment logs" into qt-dev

This commit is contained in:
Jean-Michel Trivi
2019-04-15 16:42:06 +00:00
committed by Android (Google) Code Review
2 changed files with 18 additions and 3 deletions

View File

@@ -1523,9 +1523,11 @@ public class AudioService extends IAudioService.Stub
+ ", flags=" + flags + ", caller=" + caller
+ ", volControlStream=" + mVolumeControlStream
+ ", userSelect=" + mUserSelectedVolumeControlStream);
sVolumeLogger.log(new VolumeEvent(VolumeEvent.VOL_ADJUST_SUGG_VOL, suggestedStreamType,
direction/*val1*/, flags/*val2*/, new StringBuilder(callingPackage)
.append("/").append(caller).append(" uid:").append(uid).toString()));
if (direction != AudioManager.ADJUST_SAME) {
sVolumeLogger.log(new VolumeEvent(VolumeEvent.VOL_ADJUST_SUGG_VOL, suggestedStreamType,
direction/*val1*/, flags/*val2*/, new StringBuilder(callingPackage)
.append("/").append(caller).append(" uid:").append(uid).toString()));
}
final int streamType;
synchronized (mForceControlStreamLock) {
// Request lock in case mVolumeControlStream is changed by other thread.
@@ -6320,6 +6322,11 @@ public class AudioService extends IAudioService.Stub
@Override
public void adjustStreamVolumeForUid(int streamType, int direction, int flags,
String callingPackage, int uid) {
if (direction != AudioManager.ADJUST_SAME) {
sVolumeLogger.log(new VolumeEvent(VolumeEvent.VOL_ADJUST_VOL_UID, streamType,
direction/*val1*/, flags/*val2*/, new StringBuilder(callingPackage)
.append(" uid:").append(uid).toString()));
}
adjustStreamVolume(streamType, direction, flags, callingPackage,
callingPackage, uid);
}

View File

@@ -94,6 +94,7 @@ public class AudioServiceEvents {
static final int VOL_SET_STREAM_VOL = 2;
static final int VOL_SET_HEARING_AID_VOL = 3;
static final int VOL_SET_AVRCP_VOL = 4;
static final int VOL_ADJUST_VOL_UID = 5;
final int mOp;
final int mStream;
@@ -160,6 +161,13 @@ public class AudioServiceEvents {
return new StringBuilder("setAvrcpVolume:")
.append(" index:").append(mVal1)
.toString();
case VOL_ADJUST_VOL_UID:
return new StringBuilder("adjustStreamVolumeForUid(stream:")
.append(AudioSystem.streamToString(mStream))
.append(" dir:").append(AudioManager.adjustToString(mVal1))
.append(" flags:0x").append(Integer.toHexString(mVal2))
.append(") from ").append(mCaller)
.toString();
default: return new StringBuilder("FIXME invalid op:").append(mOp).toString();
}
}