Merge "Make Advanceable a public API." into jb-dev
diff --git a/media/java/android/media/AudioTrack.java b/media/java/android/media/AudioTrack.java
index 7d4c282..f51a24a 100644
--- a/media/java/android/media/AudioTrack.java
+++ b/media/java/android/media/AudioTrack.java
@@ -340,6 +340,15 @@
}
}
+ // mask of all the channels supported by this implementation
+ private static final int SUPPORTED_OUT_CHANNELS =
+ AudioFormat.CHANNEL_OUT_FRONT_LEFT |
+ AudioFormat.CHANNEL_OUT_FRONT_RIGHT |
+ AudioFormat.CHANNEL_OUT_FRONT_CENTER |
+ AudioFormat.CHANNEL_OUT_LOW_FREQUENCY |
+ AudioFormat.CHANNEL_OUT_BACK_LEFT |
+ AudioFormat.CHANNEL_OUT_BACK_RIGHT |
+ AudioFormat.CHANNEL_OUT_BACK_CENTER;
// Convenience method for the constructor's parameter checks.
// This is where constructor IllegalArgumentException-s are thrown
@@ -392,10 +401,16 @@
mChannels = AudioFormat.CHANNEL_OUT_STEREO;
break;
default:
- mChannelCount = 0;
- mChannels = AudioFormat.CHANNEL_INVALID;
- mChannelConfiguration = AudioFormat.CHANNEL_CONFIGURATION_INVALID;
- throw(new IllegalArgumentException("Unsupported channel configuration."));
+ if ((channelConfig & SUPPORTED_OUT_CHANNELS) != channelConfig) {
+ // input channel configuration features unsupported channels
+ mChannelCount = 0;
+ mChannels = AudioFormat.CHANNEL_INVALID;
+ mChannelConfiguration = AudioFormat.CHANNEL_INVALID;
+ throw(new IllegalArgumentException("Unsupported channel configuration."));
+ } else {
+ mChannels = channelConfig;
+ mChannelCount = Integer.bitCount(channelConfig);
+ }
}
//--------------
@@ -623,8 +638,13 @@
channelCount = 2;
break;
default:
- loge("getMinBufferSize(): Invalid channel configuration.");
- return AudioTrack.ERROR_BAD_VALUE;
+ if ((channelConfig & SUPPORTED_OUT_CHANNELS) != channelConfig) {
+ // input channel configuration features unsupported channels
+ loge("getMinBufferSize(): Invalid channel configuration.");
+ return AudioTrack.ERROR_BAD_VALUE;
+ } else {
+ channelCount = Integer.bitCount(channelConfig);
+ }
}
if ((audioFormat != AudioFormat.ENCODING_PCM_16BIT)
diff --git a/services/java/com/android/server/ConnectivityService.java b/services/java/com/android/server/ConnectivityService.java
index faa8d3c..dd650bf 100644
--- a/services/java/com/android/server/ConnectivityService.java
+++ b/services/java/com/android/server/ConnectivityService.java
@@ -2422,15 +2422,15 @@
}
// Connectivity state changed:
- // [31-13] Reserved for future use
- // [12-9] Network subtype (for mobile network, as defined
+ // [31-14] Reserved for future use
+ // [13-10] Network subtype (for mobile network, as defined
// by TelephonyManager)
- // [8-3] Detailed state ordinal (as defined by
+ // [9-4] Detailed state ordinal (as defined by
// NetworkInfo.DetailedState)
- // [2-0] Network type (as defined by ConnectivityManager)
- int eventLogParam = (info.getType() & 0x7) |
- ((info.getDetailedState().ordinal() & 0x3f) << 3) |
- (info.getSubtype() << 9);
+ // [3-0] Network type (as defined by ConnectivityManager)
+ int eventLogParam = (info.getType() & 0xf) |
+ ((info.getDetailedState().ordinal() & 0x3f) << 4) |
+ (info.getSubtype() << 10);
EventLog.writeEvent(EventLogTags.CONNECTIVITY_STATE_CHANGED,
eventLogParam);
diff --git a/services/java/com/android/server/EventLogTags.logtags b/services/java/com/android/server/EventLogTags.logtags
index 249513f..41f7335 100644
--- a/services/java/com/android/server/EventLogTags.logtags
+++ b/services/java/com/android/server/EventLogTags.logtags
@@ -134,10 +134,10 @@
# ConnectivityService.java
# ---------------------------
# Connectivity state changed:
-# [31-13] Reserved for future use
-# [12- 9] Network subtype (for mobile network, as defined by TelephonyManager)
-# [ 8- 3] Detailed state ordinal (as defined by NetworkInfo.DetailedState)
-# [ 2- 0] Network type (as defined by ConnectivityManager)
+# [31-14] Reserved for future use
+# [13-10] Network subtype (for mobile network, as defined by TelephonyManager)
+# [ 9- 4] Detailed state ordinal (as defined by NetworkInfo.DetailedState)
+# [ 3- 0] Network type (as defined by ConnectivityManager)
50020 connectivity_state_changed (custom|1|5)