Merge "Simplify synchronized code and add comments"
This commit is contained in:
@@ -304,6 +304,7 @@ public class AudioSystem
|
||||
/** @hide Media server died. see ErrorCallback */
|
||||
public static final int AUDIO_STATUS_SERVER_DIED = 100;
|
||||
|
||||
// all accesses must be synchronized (AudioSystem.class)
|
||||
private static ErrorCallback sErrorCallback;
|
||||
|
||||
/** @hide
|
||||
@@ -340,11 +341,9 @@ public class AudioSystem
|
||||
@UnsupportedAppUsage
|
||||
private static void errorCallbackFromNative(int error)
|
||||
{
|
||||
ErrorCallback errorCallback = null;
|
||||
ErrorCallback errorCallback;
|
||||
synchronized (AudioSystem.class) {
|
||||
if (sErrorCallback != null) {
|
||||
errorCallback = sErrorCallback;
|
||||
}
|
||||
errorCallback = sErrorCallback;
|
||||
}
|
||||
if (errorCallback != null) {
|
||||
errorCallback.onError(error);
|
||||
@@ -364,6 +363,7 @@ public class AudioSystem
|
||||
//keep in sync with include/media/AudioPolicy.h
|
||||
private final static int DYNAMIC_POLICY_EVENT_MIX_STATE_UPDATE = 0;
|
||||
|
||||
// all accesses must be synchronized (AudioSystem.class)
|
||||
private static DynamicPolicyCallback sDynPolicyCallback;
|
||||
|
||||
/** @hide */
|
||||
@@ -378,11 +378,9 @@ public class AudioSystem
|
||||
@UnsupportedAppUsage
|
||||
private static void dynamicPolicyCallbackFromNative(int event, String regId, int val)
|
||||
{
|
||||
DynamicPolicyCallback cb = null;
|
||||
DynamicPolicyCallback cb;
|
||||
synchronized (AudioSystem.class) {
|
||||
if (sDynPolicyCallback != null) {
|
||||
cb = sDynPolicyCallback;
|
||||
}
|
||||
cb = sDynPolicyCallback;
|
||||
}
|
||||
if (cb != null) {
|
||||
switch(event) {
|
||||
@@ -426,6 +424,7 @@ public class AudioSystem
|
||||
int activeSource, String packName);
|
||||
}
|
||||
|
||||
// all accesses must be synchronized (AudioSystem.class)
|
||||
private static AudioRecordingCallback sRecordingCallback;
|
||||
|
||||
/** @hide */
|
||||
@@ -458,7 +457,7 @@ public class AudioSystem
|
||||
int source, int portId, boolean silenced, int[] recordingFormat,
|
||||
AudioEffect.Descriptor[] clientEffects, AudioEffect.Descriptor[] effects,
|
||||
int activeSource) {
|
||||
AudioRecordingCallback cb = null;
|
||||
AudioRecordingCallback cb;
|
||||
synchronized (AudioSystem.class) {
|
||||
cb = sRecordingCallback;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user