diff options
-rw-r--r-- | api/4.xml | 4 | ||||
-rw-r--r-- | api/current.xml | 162 | ||||
-rw-r--r-- | core/java/android/server/BluetoothA2dpService.java | 10 | ||||
-rw-r--r-- | core/java/android/util/EventLog.java | 6 | ||||
-rw-r--r-- | core/java/android/view/Surface.java | 8 | ||||
-rw-r--r-- | core/java/android/webkit/CallbackProxy.java | 121 | ||||
-rwxr-xr-x | core/java/android/webkit/GeolocationPermissions.java | 8 | ||||
-rw-r--r-- | core/java/android/webkit/WebChromeClient.java | 17 | ||||
-rw-r--r-- | core/java/android/webkit/WebViewCore.java | 51 | ||||
-rw-r--r-- | core/java/com/google/android/gdata/client/QueryParamsImpl.java | 4 | ||||
-rw-r--r-- | libs/audioflinger/Android.mk | 1 | ||||
-rw-r--r-- | media/java/android/media/AudioManager.java | 34 | ||||
-rw-r--r-- | media/java/android/media/AudioService.java | 93 | ||||
-rw-r--r-- | media/java/android/media/IAudioService.aidl | 8 | ||||
-rw-r--r-- | opengl/libs/EGL/Loader.cpp | 2 | ||||
-rw-r--r-- | services/java/com/android/server/BackupManagerService.java | 66 |
16 files changed, 460 insertions, 135 deletions
diff --git a/api/4.xml b/api/4.xml index c8a2e83fd136..cac3ae82fc80 100644 --- a/api/4.xml +++ b/api/4.xml @@ -256713,7 +256713,7 @@ extends="java.lang.Enum" abstract="false" static="false" - final="true" + final="false" deprecated="not deprecated" visibility="public" > @@ -258766,7 +258766,7 @@ <package name="java.util.concurrent.locks" > <class name="AbstractQueuedSynchronizer" - extends="java.lang.Object" + extends="java.util.concurrent.locks.AbstractOwnableSynchronizer" abstract="true" static="false" final="false" diff --git a/api/current.xml b/api/current.xml index 3c79b907cb87..b1e9c83eee00 100644 --- a/api/current.xml +++ b/api/current.xml @@ -146779,7 +146779,7 @@ value="2" static="true" final="true" - deprecated="not deprecated" + deprecated="deprecated" visibility="public" > </field> @@ -146805,6 +146805,17 @@ visibility="public" > </field> +<field name="SURFACE_FROZEN" + type="int" + transient="false" + volatile="false" + value="2" + static="true" + final="true" + deprecated="not deprecated" + visibility="public" +> +</field> <field name="SURFACE_HIDDEN" type="int" transient="false" @@ -277754,7 +277765,7 @@ deprecated="not deprecated" visibility="public" > -<parameter name="o" type="E"> +<parameter name="e" type="E"> </parameter> </method> <method name="offer" @@ -277767,7 +277778,7 @@ deprecated="not deprecated" visibility="public" > -<parameter name="o" type="E"> +<parameter name="e" type="E"> </parameter> <parameter name="timeout" type="long"> </parameter> @@ -277825,7 +277836,7 @@ deprecated="not deprecated" visibility="public" > -<parameter name="o" type="E"> +<parameter name="e" type="E"> </parameter> <exception name="InterruptedException" type="java.lang.InterruptedException"> </exception> @@ -277885,7 +277896,20 @@ deprecated="not deprecated" visibility="public" > -<parameter name="o" type="E"> +<parameter name="e" type="E"> +</parameter> +</method> +<method name="contains" + return="boolean" + abstract="true" + native="false" + synchronized="false" + static="false" + final="false" + deprecated="not deprecated" + visibility="public" +> +<parameter name="o" type="java.lang.Object"> </parameter> </method> <method name="drainTo" @@ -277926,7 +277950,7 @@ deprecated="not deprecated" visibility="public" > -<parameter name="o" type="E"> +<parameter name="e" type="E"> </parameter> </method> <method name="offer" @@ -277939,7 +277963,7 @@ deprecated="not deprecated" visibility="public" > -<parameter name="o" type="E"> +<parameter name="e" type="E"> </parameter> <parameter name="timeout" type="long"> </parameter> @@ -277975,7 +277999,7 @@ deprecated="not deprecated" visibility="public" > -<parameter name="o" type="E"> +<parameter name="e" type="E"> </parameter> <exception name="InterruptedException" type="java.lang.InterruptedException"> </exception> @@ -277991,6 +278015,19 @@ visibility="public" > </method> +<method name="remove" + return="boolean" + abstract="true" + native="false" + synchronized="false" + static="false" + final="false" + deprecated="not deprecated" + visibility="public" +> +<parameter name="o" type="java.lang.Object"> +</parameter> +</method> <method name="take" return="E" abstract="true" @@ -278208,7 +278245,7 @@ deprecated="not deprecated" visibility="public" > -<parameter name="t" type="java.util.Map<? extends K, ? extends V>"> +<parameter name="m" type="java.util.Map<? extends K, ? extends V>"> </parameter> </constructor> <method name="contains" @@ -278371,7 +278408,7 @@ deprecated="not deprecated" visibility="public" > -<parameter name="o" type="E"> +<parameter name="e" type="E"> </parameter> </method> <method name="peek" @@ -278521,7 +278558,7 @@ deprecated="not deprecated" visibility="public" > -<parameter name="array" type="E[]"> +<parameter name="toCopyIn" type="E[]"> </parameter> </constructor> <method name="add" @@ -278549,7 +278586,7 @@ > <parameter name="index" type="int"> </parameter> -<parameter name="e" type="E"> +<parameter name="element" type="E"> </parameter> </method> <method name="addAll" @@ -278677,9 +278714,7 @@ deprecated="not deprecated" visibility="public" > -<parameter name="e" type="E"> -</parameter> -<parameter name="index" type="int"> +<parameter name="o" type="java.lang.Object"> </parameter> </method> <method name="indexOf" @@ -278692,7 +278727,9 @@ deprecated="not deprecated" visibility="public" > -<parameter name="o" type="java.lang.Object"> +<parameter name="e" type="E"> +</parameter> +<parameter name="index" type="int"> </parameter> </method> <method name="isEmpty" @@ -278727,9 +278764,7 @@ deprecated="not deprecated" visibility="public" > -<parameter name="e" type="E"> -</parameter> -<parameter name="index" type="int"> +<parameter name="o" type="java.lang.Object"> </parameter> </method> <method name="lastIndexOf" @@ -278742,7 +278777,9 @@ deprecated="not deprecated" visibility="public" > -<parameter name="o" type="java.lang.Object"> +<parameter name="e" type="E"> +</parameter> +<parameter name="index" type="int"> </parameter> </method> <method name="listIterator" @@ -278833,7 +278870,7 @@ > <parameter name="index" type="int"> </parameter> -<parameter name="e" type="E"> +<parameter name="element" type="E"> </parameter> </method> <method name="size" @@ -279197,7 +279234,7 @@ deprecated="not deprecated" visibility="public" > -<parameter name="o" type="E"> +<parameter name="e" type="E"> </parameter> </method> <method name="offer" @@ -279210,7 +279247,7 @@ deprecated="not deprecated" visibility="public" > -<parameter name="o" type="E"> +<parameter name="e" type="E"> </parameter> <parameter name="timeout" type="long"> </parameter> @@ -279238,12 +279275,6 @@ deprecated="not deprecated" visibility="public" > -<parameter name="time" type="long"> -</parameter> -<parameter name="unit" type="java.util.concurrent.TimeUnit"> -</parameter> -<exception name="InterruptedException" type="java.lang.InterruptedException"> -</exception> </method> <method name="poll" return="E" @@ -279255,6 +279286,12 @@ deprecated="not deprecated" visibility="public" > +<parameter name="timeout" type="long"> +</parameter> +<parameter name="unit" type="java.util.concurrent.TimeUnit"> +</parameter> +<exception name="InterruptedException" type="java.lang.InterruptedException"> +</exception> </method> <method name="put" return="void" @@ -279266,7 +279303,7 @@ deprecated="not deprecated" visibility="public" > -<parameter name="o" type="E"> +<parameter name="e" type="E"> </parameter> </method> <method name="remainingCapacity" @@ -280337,7 +280374,7 @@ deprecated="not deprecated" visibility="public" > -<parameter name="o" type="E"> +<parameter name="e" type="E"> </parameter> <parameter name="timeout" type="long"> </parameter> @@ -280356,7 +280393,7 @@ deprecated="not deprecated" visibility="public" > -<parameter name="o" type="E"> +<parameter name="e" type="E"> </parameter> </method> <method name="peek" @@ -280408,7 +280445,7 @@ deprecated="not deprecated" visibility="public" > -<parameter name="o" type="E"> +<parameter name="e" type="E"> </parameter> <exception name="InterruptedException" type="java.lang.InterruptedException"> </exception> @@ -280561,7 +280598,7 @@ deprecated="not deprecated" visibility="public" > -<parameter name="o" type="E"> +<parameter name="e" type="E"> </parameter> </method> <method name="offer" @@ -280574,7 +280611,7 @@ deprecated="not deprecated" visibility="public" > -<parameter name="o" type="E"> +<parameter name="e" type="E"> </parameter> <parameter name="timeout" type="long"> </parameter> @@ -280630,7 +280667,7 @@ deprecated="not deprecated" visibility="public" > -<parameter name="o" type="E"> +<parameter name="e" type="E"> </parameter> </method> <method name="remainingCapacity" @@ -281360,7 +281397,7 @@ deprecated="not deprecated" visibility="public" > -<parameter name="o" type="E"> +<parameter name="e" type="E"> </parameter> </method> <method name="peek" @@ -282065,7 +282102,7 @@ extends="java.lang.Enum" abstract="false" static="false" - final="true" + final="false" deprecated="not deprecated" visibility="public" > @@ -282079,9 +282116,9 @@ deprecated="not deprecated" visibility="public" > -<parameter name="duration" type="long"> +<parameter name="sourceDuration" type="long"> </parameter> -<parameter name="unit" type="java.util.concurrent.TimeUnit"> +<parameter name="sourceUnit" type="java.util.concurrent.TimeUnit"> </parameter> </method> <method name="sleep" @@ -284117,12 +284154,55 @@ </package> <package name="java.util.concurrent.locks" > -<class name="AbstractQueuedSynchronizer" +<class name="AbstractOwnableSynchronizer" extends="java.lang.Object" abstract="true" static="false" final="false" deprecated="not deprecated" + visibility="" +> +<implements name="java.io.Serializable"> +</implements> +<constructor name="AbstractOwnableSynchronizer" + type="java.util.concurrent.locks.AbstractOwnableSynchronizer" + static="false" + final="false" + deprecated="not deprecated" + visibility="protected" +> +</constructor> +<method name="getExclusiveOwnerThread" + return="java.lang.Thread" + abstract="false" + native="false" + synchronized="false" + static="false" + final="true" + deprecated="not deprecated" + visibility="protected" +> +</method> +<method name="setExclusiveOwnerThread" + return="void" + abstract="false" + native="false" + synchronized="false" + static="false" + final="true" + deprecated="not deprecated" + visibility="protected" +> +<parameter name="t" type="java.lang.Thread"> +</parameter> +</method> +</class> +<class name="AbstractQueuedSynchronizer" + extends="java.util.concurrent.locks.AbstractOwnableSynchronizer" + abstract="true" + static="false" + final="false" + deprecated="not deprecated" visibility="public" > <implements name="java.io.Serializable"> diff --git a/core/java/android/server/BluetoothA2dpService.java b/core/java/android/server/BluetoothA2dpService.java index fb436e557428..fb6ae28dc8cb 100644 --- a/core/java/android/server/BluetoothA2dpService.java +++ b/core/java/android/server/BluetoothA2dpService.java @@ -188,10 +188,12 @@ public class BluetoothA2dpService extends IBluetoothA2dp.Stub { private boolean isSinkDevice(String address) { String uuids[] = mBluetoothService.getRemoteUuids(address); UUID uuid; - for (String deviceUuid: uuids) { - uuid = UUID.fromString(deviceUuid); - if (BluetoothUuid.isAudioSink(uuid)) { - return true; + if (uuids != null) { + for (String deviceUuid: uuids) { + uuid = UUID.fromString(deviceUuid); + if (BluetoothUuid.isAudioSink(uuid)) { + return true; + } } } return false; diff --git a/core/java/android/util/EventLog.java b/core/java/android/util/EventLog.java index 0f0be7987ebc..81dd96e12884 100644 --- a/core/java/android/util/EventLog.java +++ b/core/java/android/util/EventLog.java @@ -124,10 +124,6 @@ public class EventLog { "A List must have fewer than " + Byte.MAX_VALUE + " items in it."); } - if (items.length < 1) { - throw new IllegalArgumentException( - "A List must have at least one item in it."); - } for (int i = 0; i < items.length; i++) { final Object item = items[i]; if (item == null) { @@ -223,7 +219,7 @@ public class EventLog { case LIST: if (mBuffer.remaining() < 1) return null; int length = mBuffer.get(); - if (length <= 0) return null; + if (length < 0) return null; Object[] array = new Object[length]; for (int i = 0; i < length; ++i) { array[i] = decodeObject(); diff --git a/core/java/android/view/Surface.java b/core/java/android/view/Surface.java index 9178131346f9..c4bf642f5686 100644 --- a/core/java/android/view/Surface.java +++ b/core/java/android/view/Surface.java @@ -107,8 +107,14 @@ public class Surface implements Parcelable { public static final int SURFACE_HIDDEN = 0x01; /** Freeze the surface. Equivalent to calling freeze() */ + public static final int SURFACE_FROZEN = 0x02; + + /** + * @deprecated use {@link #SURFACE_FROZEN} instead. + */ + @Deprecated public static final int SURACE_FROZEN = 0x02; - + /** Enable dithering when compositing this surface */ public static final int SURFACE_DITHER = 0x04; diff --git a/core/java/android/webkit/CallbackProxy.java b/core/java/android/webkit/CallbackProxy.java index a6d03470fbad..ed77ce883e30 100644 --- a/core/java/android/webkit/CallbackProxy.java +++ b/core/java/android/webkit/CallbackProxy.java @@ -72,39 +72,41 @@ class CallbackProxy extends Handler { private final Context mContext; // Message Ids - private static final int PAGE_STARTED = 100; - private static final int RECEIVED_ICON = 101; - private static final int RECEIVED_TITLE = 102; - private static final int OVERRIDE_URL = 103; - private static final int AUTH_REQUEST = 104; - private static final int SSL_ERROR = 105; - private static final int PROGRESS = 106; - private static final int UPDATE_VISITED = 107; - private static final int LOAD_RESOURCE = 108; - private static final int CREATE_WINDOW = 109; - private static final int CLOSE_WINDOW = 110; - private static final int SAVE_PASSWORD = 111; - private static final int JS_ALERT = 112; - private static final int JS_CONFIRM = 113; - private static final int JS_PROMPT = 114; - private static final int JS_UNLOAD = 115; - private static final int ASYNC_KEYEVENTS = 116; - private static final int TOO_MANY_REDIRECTS = 117; - private static final int DOWNLOAD_FILE = 118; - private static final int REPORT_ERROR = 119; - private static final int RESEND_POST_DATA = 120; - private static final int PAGE_FINISHED = 121; - private static final int REQUEST_FOCUS = 122; - private static final int SCALE_CHANGED = 123; - private static final int RECEIVED_CERTIFICATE = 124; - private static final int SWITCH_OUT_HISTORY = 125; - private static final int EXCEEDED_DATABASE_QUOTA = 126; - private static final int REACHED_APPCACHE_MAXSIZE = 127; - private static final int JS_TIMEOUT = 128; - private static final int ADD_MESSAGE_TO_CONSOLE = 129; + private static final int PAGE_STARTED = 100; + private static final int RECEIVED_ICON = 101; + private static final int RECEIVED_TITLE = 102; + private static final int OVERRIDE_URL = 103; + private static final int AUTH_REQUEST = 104; + private static final int SSL_ERROR = 105; + private static final int PROGRESS = 106; + private static final int UPDATE_VISITED = 107; + private static final int LOAD_RESOURCE = 108; + private static final int CREATE_WINDOW = 109; + private static final int CLOSE_WINDOW = 110; + private static final int SAVE_PASSWORD = 111; + private static final int JS_ALERT = 112; + private static final int JS_CONFIRM = 113; + private static final int JS_PROMPT = 114; + private static final int JS_UNLOAD = 115; + private static final int ASYNC_KEYEVENTS = 116; + private static final int TOO_MANY_REDIRECTS = 117; + private static final int DOWNLOAD_FILE = 118; + private static final int REPORT_ERROR = 119; + private static final int RESEND_POST_DATA = 120; + private static final int PAGE_FINISHED = 121; + private static final int REQUEST_FOCUS = 122; + private static final int SCALE_CHANGED = 123; + private static final int RECEIVED_CERTIFICATE = 124; + private static final int SWITCH_OUT_HISTORY = 125; + private static final int EXCEEDED_DATABASE_QUOTA = 126; + private static final int REACHED_APPCACHE_MAXSIZE = 127; + private static final int JS_TIMEOUT = 128; + private static final int ADD_MESSAGE_TO_CONSOLE = 129; + private static final int GEOLOCATION_PERMISSIONS_SHOW_PROMPT = 130; + private static final int GEOLOCATION_PERMISSIONS_HIDE_PROMPT = 131; // Message triggered by the client to resume execution - private static final int NOTIFY = 200; + private static final int NOTIFY = 200; // Result transportation object for returning results across thread // boundaries. @@ -438,6 +440,25 @@ class CallbackProxy extends Handler { } break; + case GEOLOCATION_PERMISSIONS_SHOW_PROMPT: + if (mWebChromeClient != null) { + HashMap<String, Object> map = + (HashMap<String, Object>) msg.obj; + String origin = (String) map.get("origin"); + GeolocationPermissions.Callback callback = + (GeolocationPermissions.Callback) + map.get("callback"); + mWebChromeClient.onGeolocationPermissionsShowPrompt(origin, + callback); + } + break; + + case GEOLOCATION_PERMISSIONS_HIDE_PROMPT: + if (mWebChromeClient != null) { + mWebChromeClient.onGeolocationPermissionsHidePrompt(); + } + break; + case JS_ALERT: if (mWebChromeClient != null) { final JsResult res = (JsResult) msg.obj; @@ -1192,6 +1213,44 @@ class CallbackProxy extends Handler { } /** + * Called by WebViewCore to instruct the browser to display a prompt to ask + * the user to set the Geolocation permission state for the given origin. + * @param origin The origin requesting Geolocation permsissions. + * @param callback The callback to call once a permission state has been + * obtained. + * @hide pending API council review. + */ + public void onGeolocationPermissionsShowPrompt(String origin, + GeolocationPermissions.Callback callback) { + if (mWebChromeClient == null) { + return; + } + + Message showMessage = + obtainMessage(GEOLOCATION_PERMISSIONS_SHOW_PROMPT); + HashMap<String, Object> map = new HashMap(); + map.put("origin", origin); + map.put("callback", callback); + showMessage.obj = map; + sendMessage(showMessage); + } + + /** + * Called by WebViewCore to instruct the browser to hide the Geolocation + * permissions prompt. + * origin. + * @hide pending API council review. + */ + public void onGeolocationPermissionsHidePrompt() { + if (mWebChromeClient == null) { + return; + } + + Message hideMessage = obtainMessage(GEOLOCATION_PERMISSIONS_HIDE_PROMPT); + sendMessage(hideMessage); + } + + /** * Called by WebViewCore when we have a message to be added to the JavaScript * error console. Sends a message to the Java side with the details. * @param message The message to add to the console. diff --git a/core/java/android/webkit/GeolocationPermissions.java b/core/java/android/webkit/GeolocationPermissions.java index 0f3079af7223..d06d7e2e9f0f 100755 --- a/core/java/android/webkit/GeolocationPermissions.java +++ b/core/java/android/webkit/GeolocationPermissions.java @@ -31,6 +31,14 @@ import java.util.Set; * @hide */ public final class GeolocationPermissions { + /** + * Callback interface used by the browser to report a Geolocation permission + * state set by the user in response to a permissions prompt. + */ + public interface Callback { + public void invoke(String origin, boolean allow, boolean remember); + }; + // Log tag private static final String TAG = "geolocationPermissions"; diff --git a/core/java/android/webkit/WebChromeClient.java b/core/java/android/webkit/WebChromeClient.java index fa78777cd9a3..d52406de7920 100644 --- a/core/java/android/webkit/WebChromeClient.java +++ b/core/java/android/webkit/WebChromeClient.java @@ -227,6 +227,20 @@ public class WebChromeClient { } /** + * Instructs the client to show a prompt to ask the user to set the + * Geolocation permission state for the specified origin. + * @hide pending API council approval. + */ + public void onGeolocationPermissionsShowPrompt(String origin, + GeolocationPermissions.Callback callback) {} + + /** + * Instructs the client to hide the Geolocation permissions prompt. + * @hide pending API council approval. + */ + public void onGeolocationPermissionsHidePrompt() {} + + /** * Tell the client that a JavaScript execution timeout has occured. And the * client may decide whether or not to interrupt the execution. If the * client returns true, the JavaScript will be interrupted. If the client @@ -249,6 +263,5 @@ public class WebChromeClient { * @param sourceID The name of the source file that caused the error. * @hide pending API council. */ - public void addMessageToConsole(String message, int lineNumber, String sourceID) { - } + public void addMessageToConsole(String message, int lineNumber, String sourceID) {} } diff --git a/core/java/android/webkit/WebViewCore.java b/core/java/android/webkit/WebViewCore.java index dfff9ac166b3..4afc4cd63d45 100644 --- a/core/java/android/webkit/WebViewCore.java +++ b/core/java/android/webkit/WebViewCore.java @@ -285,6 +285,33 @@ final class WebViewCore { } /** + * Shows a prompt to ask the user to set the Geolocation permission state + * for the given origin. + * @param origin The origin for which Geolocation permissions are + * requested. + */ + protected void geolocationPermissionsShowPrompt(String origin) { + mCallbackProxy.onGeolocationPermissionsShowPrompt(origin, + new GeolocationPermissions.Callback() { + public void invoke(String origin, boolean allow, boolean remember) { + GeolocationPermissionsData data = new GeolocationPermissionsData(); + data.mOrigin = origin; + data.mAllow = allow; + data.mRemember = remember; + // Marshall to WebCore thread. + sendMessage(EventHub.GEOLOCATION_PERMISSIONS_PROVIDE, data); + } + }); + } + + /** + * Hides the Geolocation permissions prompt. + */ + protected void geolocationPermissionsHidePrompt() { + mCallbackProxy.onGeolocationPermissionsHidePrompt(); + } + + /** * Invoke a javascript confirm dialog. * @param message The message displayed in the dialog. * @return True if the user confirmed or false if the user cancelled. @@ -465,6 +492,16 @@ final class WebViewCore { private native void nativeUpdatePluginState(int framePtr, int nodePtr, int state); + /** + * Provide WebCore with a Geolocation permission state for the specified + * origin. + * @param origin The origin for which Geolocation permissions are provided. + * @param allow Whether Geolocation permissions are allowed. + * @param remember Whether this decision should be remembered beyond the + * life of the current page. + */ + private native void nativeGeolocationPermissionsProvide(String origin, boolean allow, boolean remember); + // EventHub for processing messages private final EventHub mEventHub; // WebCore thread handler @@ -608,6 +645,12 @@ final class WebViewCore { int mState; } + static class GeolocationPermissionsData { + String mOrigin; + boolean mAllow; + boolean mRemember; + } + static final String[] HandlerDebugString = { "SCROLL_TEXT_INPUT", // = 99 "LOAD_URL", // = 100; @@ -733,6 +776,8 @@ final class WebViewCore { static final int DUMP_NAVTREE = 172; static final int SET_JS_FLAGS = 173; + // Geolocation + static final int GEOLOCATION_PERMISSIONS_PROVIDE = 180; // private message ids private static final int DESTROY = 200; @@ -1119,6 +1164,12 @@ final class WebViewCore { case SET_JS_FLAGS: nativeSetJsFlags((String)msg.obj); + + case GEOLOCATION_PERMISSIONS_PROVIDE: + GeolocationPermissionsData data = + (GeolocationPermissionsData) msg.obj; + nativeGeolocationPermissionsProvide(data.mOrigin, + data.mAllow, data.mRemember); break; case SYNC_SCROLL: diff --git a/core/java/com/google/android/gdata/client/QueryParamsImpl.java b/core/java/com/google/android/gdata/client/QueryParamsImpl.java index e27b36f0f4a1..fbe0d22930cb 100644 --- a/core/java/com/google/android/gdata/client/QueryParamsImpl.java +++ b/core/java/com/google/android/gdata/client/QueryParamsImpl.java @@ -60,6 +60,8 @@ public class QueryParamsImpl extends QueryParams { sb.append('?'); } for (String param : params) { + String value = mParams.get(param); + if (value == null) continue; if (first) { first = false; } else { @@ -67,7 +69,7 @@ public class QueryParamsImpl extends QueryParams { } sb.append(param); sb.append('='); - String value = mParams.get(param); + String encodedValue = null; try { diff --git a/libs/audioflinger/Android.mk b/libs/audioflinger/Android.mk index c10e02b7c370..f5c03bb16795 100644 --- a/libs/audioflinger/Android.mk +++ b/libs/audioflinger/Android.mk @@ -107,6 +107,7 @@ LOCAL_MODULE:= libaudioflinger ifeq ($(BOARD_HAVE_BLUETOOTH),true) LOCAL_CFLAGS += -DWITH_BLUETOOTH -DWITH_A2DP + LOCAL_SHARED_LIBRARIES += liba2dp endif ifeq ($(AUDIO_POLICY_TEST),true) diff --git a/media/java/android/media/AudioManager.java b/media/java/android/media/AudioManager.java index 040d4bc65758..60fc0e048b0d 100644 --- a/media/java/android/media/AudioManager.java +++ b/media/java/android/media/AudioManager.java @@ -649,10 +649,11 @@ public class AudioManager { * <var>false</var> to turn it off */ public void setSpeakerphoneOn(boolean on){ - if (on) { - AudioSystem.setForceUse(AudioSystem.FOR_COMMUNICATION, AudioSystem.FORCE_SPEAKER); - } else { - AudioSystem.setForceUse(AudioSystem.FOR_COMMUNICATION, AudioSystem.FORCE_NONE); + IAudioService service = getService(); + try { + service.setSpeakerphoneOn(on); + } catch (RemoteException e) { + Log.e(TAG, "Dead object in setSpeakerphoneOn", e); } } @@ -662,9 +663,11 @@ public class AudioManager { * @return true if speakerphone is on, false if it's off */ public boolean isSpeakerphoneOn() { - if (AudioSystem.getForceUse(AudioSystem.FOR_COMMUNICATION) == AudioSystem.FORCE_SPEAKER) { - return true; - } else { + IAudioService service = getService(); + try { + return service.isSpeakerphoneOn(); + } catch (RemoteException e) { + Log.e(TAG, "Dead object in isSpeakerphoneOn", e); return false; } } @@ -676,10 +679,11 @@ public class AudioManager { * <var>false</var> to not use bluetooth SCO for communications */ public void setBluetoothScoOn(boolean on){ - if (on) { - AudioSystem.setForceUse(AudioSystem.FOR_COMMUNICATION, AudioSystem.FORCE_BT_SCO); - } else { - AudioSystem.setForceUse(AudioSystem.FOR_COMMUNICATION, AudioSystem.FORCE_NONE); + IAudioService service = getService(); + try { + service.setBluetoothScoOn(on); + } catch (RemoteException e) { + Log.e(TAG, "Dead object in setBluetoothScoOn", e); } } @@ -690,9 +694,11 @@ public class AudioManager { * false if otherwise */ public boolean isBluetoothScoOn() { - if (AudioSystem.getForceUse(AudioSystem.FOR_COMMUNICATION) == AudioSystem.FORCE_BT_SCO) { - return true; - } else { + IAudioService service = getService(); + try { + return service.isBluetoothScoOn(); + } catch (RemoteException e) { + Log.e(TAG, "Dead object in isBluetoothScoOn", e); return false; } } diff --git a/media/java/android/media/AudioService.java b/media/java/android/media/AudioService.java index 30640c308d7b..1f9e3afd9038 100644 --- a/media/java/android/media/AudioService.java +++ b/media/java/android/media/AudioService.java @@ -47,7 +47,10 @@ import com.android.internal.telephony.ITelephony; import java.io.IOException; import java.util.ArrayList; - +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; /** * The implementation of the volume manager service. @@ -210,6 +213,12 @@ public class AudioService extends IAudioService.Stub { private int mHeadsetState; + // Devices currently connected + private HashMap <Integer, String> mConnectedDevices = new HashMap <Integer, String>(); + + // Forced device usage for communications + private int mForcedUseForComm; + /////////////////////////////////////////////////////////////////////////// // Construction /////////////////////////////////////////////////////////////////////////// @@ -220,7 +229,9 @@ public class AudioService extends IAudioService.Stub { mContentResolver = context.getContentResolver(); mVolumePanel = new VolumePanel(context, this); mSettingsObserver = new SettingsObserver(); - + mMode = AudioSystem.MODE_NORMAL; + mHeadsetState = 0; + mForcedUseForComm = AudioSystem.FORCE_NONE; createAudioSystemThread(); readPersistedSettings(); createStreamStates(); @@ -721,6 +732,46 @@ public class AudioService extends IAudioService.Stub { setRingerModeInt(getRingerMode(), false); } + /** @see AudioManager#setSpeakerphoneOn() */ + public void setSpeakerphoneOn(boolean on){ + if (on) { + AudioSystem.setForceUse(AudioSystem.FOR_COMMUNICATION, AudioSystem.FORCE_SPEAKER); + mForcedUseForComm = AudioSystem.FORCE_SPEAKER; + } else { + AudioSystem.setForceUse(AudioSystem.FOR_COMMUNICATION, AudioSystem.FORCE_NONE); + mForcedUseForComm = AudioSystem.FORCE_NONE; + } + } + + /** @see AudioManager#isSpeakerphoneOn() */ + public boolean isSpeakerphoneOn() { + if (mForcedUseForComm == AudioSystem.FORCE_SPEAKER) { + return true; + } else { + return false; + } + } + + /** @see AudioManager#setBluetoothScoOn() */ + public void setBluetoothScoOn(boolean on){ + if (on) { + AudioSystem.setForceUse(AudioSystem.FOR_COMMUNICATION, AudioSystem.FORCE_BT_SCO); + mForcedUseForComm = AudioSystem.FORCE_BT_SCO; + } else { + AudioSystem.setForceUse(AudioSystem.FOR_COMMUNICATION, AudioSystem.FORCE_NONE); + mForcedUseForComm = AudioSystem.FORCE_NONE; + } + } + + /** @see AudioManager#isBluetoothScoOn() */ + public boolean isBluetoothScoOn() { + if (mForcedUseForComm == AudioSystem.FORCE_BT_SCO) { + return true; + } else { + return false; + } + } + /////////////////////////////////////////////////////////////////////////// // Internal methods /////////////////////////////////////////////////////////////////////////// @@ -1188,16 +1239,33 @@ public class AudioService extends IAudioService.Stub { Log.e(TAG, "Media server died."); // Force creation of new IAudioflinger interface mMediaServerOk = false; - AudioSystem.getMode(); + AudioSystem.isMusicActive(); break; case MSG_MEDIA_SERVER_STARTED: Log.e(TAG, "Media server started."); + // Restore device connection states + Set set = mConnectedDevices.entrySet(); + Iterator i = set.iterator(); + while(i.hasNext()){ + Map.Entry device = (Map.Entry)i.next(); + AudioSystem.setDeviceConnectionState(((Integer)device.getKey()).intValue(), + AudioSystem.DEVICE_STATE_AVAILABLE, + (String)device.getValue()); + } + + // Restore call state + AudioSystem.setPhoneState(mMode); + + // Restore forced usage for communcations + AudioSystem.setForceUse(AudioSystem.FOR_COMMUNICATION, mForcedUseForComm); + // Restore stream volumes int numStreamTypes = AudioSystem.getNumStreamTypes(); for (int streamType = numStreamTypes - 1; streamType >= 0; streamType--) { int index; VolumeStreamState streamState = mStreamStates[streamType]; + AudioSystem.initStreamVolume(streamType, 0, (streamState.mIndexMax + 5) / 10); if (streamState.muteCount() == 0) { index = streamState.mIndex; } else { @@ -1205,7 +1273,10 @@ public class AudioService extends IAudioService.Stub { } setStreamVolumeIndex(streamType, index); } - setRingerMode(mRingerMode); + + // Restore ringer mode + setRingerModeInt(getRingerMode(), false); + mMediaServerOk = true; break; @@ -1276,10 +1347,12 @@ public class AudioService extends IAudioService.Stub { AudioSystem.setDeviceConnectionState(AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP, AudioSystem.DEVICE_STATE_UNAVAILABLE, address); + mConnectedDevices.remove(AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP); } else if (state == BluetoothA2dp.STATE_CONNECTED){ AudioSystem.setDeviceConnectionState(AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP, AudioSystem.DEVICE_STATE_AVAILABLE, address); + mConnectedDevices.put( new Integer(AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP), address); } } else if (action.equals(BluetoothIntent.HEADSET_AUDIO_STATE_CHANGED_ACTION)) { int state = intent.getIntExtra(BluetoothIntent.HEADSET_AUDIO_STATE, @@ -1289,10 +1362,12 @@ public class AudioService extends IAudioService.Stub { AudioSystem.setDeviceConnectionState(AudioSystem.DEVICE_OUT_BLUETOOTH_SCO, AudioSystem.DEVICE_STATE_UNAVAILABLE, address); + mConnectedDevices.remove(AudioSystem.DEVICE_OUT_BLUETOOTH_SCO); } else if (state == BluetoothHeadset.AUDIO_STATE_CONNECTED) { AudioSystem.setDeviceConnectionState(AudioSystem.DEVICE_OUT_BLUETOOTH_SCO, AudioSystem.DEVICE_STATE_AVAILABLE, address); + mConnectedDevices.put( new Integer(AudioSystem.DEVICE_OUT_BLUETOOTH_SCO), address); } } else if (action.equals(Intent.ACTION_HEADSET_PLUG)) { int state = intent.getIntExtra("state", 0); @@ -1301,55 +1376,65 @@ public class AudioService extends IAudioService.Stub { AudioSystem.setDeviceConnectionState(AudioSystem.DEVICE_OUT_WIRED_HEADSET, AudioSystem.DEVICE_STATE_UNAVAILABLE, ""); + mConnectedDevices.remove(AudioSystem.DEVICE_OUT_WIRED_HEADSET); } else if ((state & BIT_HEADSET) != 0 && (mHeadsetState & BIT_HEADSET) == 0) { AudioSystem.setDeviceConnectionState(AudioSystem.DEVICE_OUT_WIRED_HEADSET, AudioSystem.DEVICE_STATE_AVAILABLE, ""); + mConnectedDevices.put( new Integer(AudioSystem.DEVICE_OUT_WIRED_HEADSET), ""); } if ((state & BIT_HEADSET_NO_MIC) == 0 && (mHeadsetState & BIT_HEADSET_NO_MIC) != 0) { AudioSystem.setDeviceConnectionState(AudioSystem.DEVICE_OUT_WIRED_HEADPHONE, AudioSystem.DEVICE_STATE_UNAVAILABLE, ""); + mConnectedDevices.remove(AudioSystem.DEVICE_OUT_WIRED_HEADPHONE); } else if ((state & BIT_HEADSET_NO_MIC) != 0 && (mHeadsetState & BIT_HEADSET_NO_MIC) == 0) { AudioSystem.setDeviceConnectionState(AudioSystem.DEVICE_OUT_WIRED_HEADPHONE, AudioSystem.DEVICE_STATE_AVAILABLE, ""); + mConnectedDevices.put( new Integer(AudioSystem.DEVICE_OUT_WIRED_HEADPHONE), ""); } if ((state & BIT_TTY) == 0 && (mHeadsetState & BIT_TTY) != 0) { AudioSystem.setDeviceConnectionState(AudioSystem.DEVICE_OUT_TTY, AudioSystem.DEVICE_STATE_UNAVAILABLE, ""); + mConnectedDevices.remove(AudioSystem.DEVICE_OUT_TTY); } else if ((state & BIT_TTY) != 0 && (mHeadsetState & BIT_TTY) == 0) { AudioSystem.setDeviceConnectionState(AudioSystem.DEVICE_OUT_TTY, AudioSystem.DEVICE_STATE_AVAILABLE, ""); + mConnectedDevices.put( new Integer(AudioSystem.DEVICE_OUT_TTY), ""); } if ((state & BIT_FM_HEADSET) == 0 && (mHeadsetState & BIT_FM_HEADSET) != 0) { AudioSystem.setDeviceConnectionState(AudioSystem.DEVICE_OUT_FM_HEADPHONE, AudioSystem.DEVICE_STATE_UNAVAILABLE, ""); + mConnectedDevices.remove(AudioSystem.DEVICE_OUT_FM_HEADPHONE); } else if ((state & BIT_FM_HEADSET) != 0 && (mHeadsetState & BIT_FM_HEADSET) == 0) { AudioSystem.setDeviceConnectionState(AudioSystem.DEVICE_OUT_FM_HEADPHONE, AudioSystem.DEVICE_STATE_AVAILABLE, ""); + mConnectedDevices.put( new Integer(AudioSystem.DEVICE_OUT_FM_HEADPHONE), ""); } if ((state & BIT_FM_SPEAKER) == 0 && (mHeadsetState & BIT_FM_SPEAKER) != 0) { AudioSystem.setDeviceConnectionState(AudioSystem.DEVICE_OUT_FM_SPEAKER, AudioSystem.DEVICE_STATE_UNAVAILABLE, ""); + mConnectedDevices.remove(AudioSystem.DEVICE_OUT_FM_SPEAKER); } else if ((state & BIT_FM_SPEAKER) != 0 && (mHeadsetState & BIT_FM_SPEAKER) == 0) { AudioSystem.setDeviceConnectionState(AudioSystem.DEVICE_OUT_FM_SPEAKER, AudioSystem.DEVICE_STATE_AVAILABLE, ""); + mConnectedDevices.put( new Integer(AudioSystem.DEVICE_OUT_FM_SPEAKER), ""); } mHeadsetState = state; } diff --git a/media/java/android/media/IAudioService.aidl b/media/java/android/media/IAudioService.aidl index bb4252b3a2e9..d3d2d29ece8d 100644 --- a/media/java/android/media/IAudioService.aidl +++ b/media/java/android/media/IAudioService.aidl @@ -60,4 +60,12 @@ interface IAudioService { oneway void unloadSoundEffects(); oneway void reloadAudioSettings(); + + void setSpeakerphoneOn(boolean on); + + boolean isSpeakerphoneOn(); + + void setBluetoothScoOn(boolean on); + + boolean isBluetoothScoOn(); } diff --git a/opengl/libs/EGL/Loader.cpp b/opengl/libs/EGL/Loader.cpp index 7f3f1141d9a4..445e681e549f 100644 --- a/opengl/libs/EGL/Loader.cpp +++ b/opengl/libs/EGL/Loader.cpp @@ -149,7 +149,7 @@ void* Loader::open(EGLNativeDisplayType display, int impl, gl_hooks_t* hooks) hnd = new driver_t(dso); } else { // Always load EGL first - snprintf(path, PATH_MAX, "lib%s_%s.so", "EGL", tag); + snprintf(path, PATH_MAX, format, "EGL", tag); dso = load_driver(path, hooks, EGL); if (dso) { hnd = new driver_t(dso); diff --git a/services/java/com/android/server/BackupManagerService.java b/services/java/com/android/server/BackupManagerService.java index a8e5f8bf637e..67f38163ef9f 100644 --- a/services/java/com/android/server/BackupManagerService.java +++ b/services/java/com/android/server/BackupManagerService.java @@ -803,7 +803,7 @@ class BackupManagerService extends IBackupManager.Stub { class ClearDataObserver extends IPackageDataObserver.Stub { public void onRemoveCompleted(String packageName, boolean succeeded) - throws android.os.RemoteException { + throws RemoteException { synchronized(mClearDataLock) { mClearingData = false; mClearDataLock.notifyAll(); @@ -1666,58 +1666,66 @@ class BackupManagerService extends IBackupManager.Stub { } // --- Binder interface --- - public RestoreSet[] getAvailableRestoreSets() throws android.os.RemoteException { + public synchronized RestoreSet[] getAvailableRestoreSets() { mContext.enforceCallingOrSelfPermission(android.Manifest.permission.BACKUP, "getAvailableRestoreSets"); try { - synchronized(this) { if (mRestoreTransport == null) { Log.w(TAG, "Null transport getting restore sets"); - } else if (mRestoreSets == null) { // valid transport; do the one-time fetch + return null; + } + if (mRestoreSets == null) { // valid transport; do the one-time fetch mRestoreSets = mRestoreTransport.getAvailableRestoreSets(); if (mRestoreSets == null) EventLog.writeEvent(RESTORE_TRANSPORT_FAILURE_EVENT); } return mRestoreSets; - } - } catch (RuntimeException e) { - Log.d(TAG, "getAvailableRestoreSets exception"); - e.printStackTrace(); - throw e; + } catch (Exception e) { + Log.e(TAG, "Error in getAvailableRestoreSets", e); + return null; } } - public int performRestore(long token, IRestoreObserver observer) - throws android.os.RemoteException { - mContext.enforceCallingOrSelfPermission(android.Manifest.permission.BACKUP, "performRestore"); + public synchronized int performRestore(long token, IRestoreObserver observer) { + mContext.enforceCallingOrSelfPermission(android.Manifest.permission.BACKUP, + "performRestore"); - Log.d(TAG, "performRestore token=" + token + " observer=" + observer); + if (DEBUG) Log.d(TAG, "performRestore token=" + token + " observer=" + observer); - if (mRestoreSets != null) { - for (int i = 0; i < mRestoreSets.length; i++) { - if (token == mRestoreSets[i].token) { - mWakelock.acquire(); - Message msg = mBackupHandler.obtainMessage(MSG_RUN_RESTORE); - msg.obj = new RestoreParams(mRestoreTransport, observer, token); - mBackupHandler.sendMessage(msg); - return 0; - } + if (mRestoreTransport == null || mRestoreSets == null) { + Log.e(TAG, "Ignoring performRestore() with no restore set"); + return -1; + } + + for (int i = 0; i < mRestoreSets.length; i++) { + if (token == mRestoreSets[i].token) { + mWakelock.acquire(); + Message msg = mBackupHandler.obtainMessage(MSG_RUN_RESTORE); + msg.obj = new RestoreParams(mRestoreTransport, observer, token); + mBackupHandler.sendMessage(msg); + return 0; } - } else { - if (DEBUG) Log.v(TAG, "No current restore set, not doing restore"); } return -1; } - public void endRestoreSession() throws android.os.RemoteException { + public synchronized void endRestoreSession() { mContext.enforceCallingOrSelfPermission(android.Manifest.permission.BACKUP, "endRestoreSession"); - Log.d(TAG, "endRestoreSession"); + if (DEBUG) Log.d(TAG, "endRestoreSession"); + + synchronized (this) { + try { + if (mRestoreTransport != null) mRestoreTransport.finishRestore(); + } catch (Exception e) { + Log.e(TAG, "Error in finishRestore", e); + } finally { + mRestoreTransport = null; + } + } - mRestoreTransport.finishRestore(); - mRestoreTransport = null; - synchronized(BackupManagerService.this) { + synchronized (BackupManagerService.this) { if (BackupManagerService.this.mActiveRestoreSession == this) { BackupManagerService.this.mActiveRestoreSession = null; } else { |