Loading Android.mk +1 −0 Original line number Diff line number Diff line Loading @@ -90,6 +90,7 @@ LOCAL_SRC_FILES += \ core/java/android/backup/IRestoreSession.aidl \ core/java/android/bluetooth/IBluetooth.aidl \ core/java/android/bluetooth/IBluetoothA2dp.aidl \ core/java/android/bluetooth/IBluetoothCallback.aidl \ core/java/android/bluetooth/IBluetoothHeadset.aidl \ core/java/android/bluetooth/IBluetoothPbap.aidl \ core/java/android/content/IContentService.aidl \ Loading api/current.xml +489 −4 Original line number Diff line number Diff line Loading @@ -25618,7 +25618,7 @@ visibility="public" > </method> <method name="listenUsingRfcomm" <method name="listenUsingRfcommWithServiceRecord" return="android.bluetooth.BluetoothServerSocket" abstract="false" native="false" Loading @@ -25630,7 +25630,7 @@ > <parameter name="name" type="java.lang.String"> </parameter> <parameter name="uuid" type="android.os.ParcelUuid"> <parameter name="uuid" type="java.util.UUID"> </parameter> <exception name="IOException" type="java.io.IOException"> </exception> Loading Loading @@ -26804,7 +26804,7 @@ > <implements name="android.os.Parcelable"> </implements> <method name="createRfcommSocket" <method name="createRfcommSocketToServiceRecord" return="android.bluetooth.BluetoothSocket" abstract="false" native="false" Loading @@ -26814,7 +26814,7 @@ deprecated="not deprecated" visibility="public" > <parameter name="channel" type="int"> <parameter name="uuid" type="java.util.UUID"> </parameter> <exception name="IOException" type="java.io.IOException"> </exception> Loading Loading @@ -27216,6 +27216,81 @@ </package> <package name="android.content" > <class name="AbstractThreadedSyncAdapter" extends="java.lang.Object" abstract="true" static="false" final="false" deprecated="not deprecated" visibility="public" > <constructor name="AbstractThreadedSyncAdapter" type="android.content.AbstractThreadedSyncAdapter" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="context" type="android.content.Context"> </parameter> <parameter name="autoInitialize" type="boolean"> </parameter> </constructor> <method name="getContext" return="android.content.Context" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="getSyncAdapterBinder" return="android.os.IBinder" abstract="false" native="false" synchronized="false" static="false" final="true" deprecated="not deprecated" visibility="public" > </method> <method name="onPerformSync" return="void" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="account" type="android.accounts.Account"> </parameter> <parameter name="extras" type="android.os.Bundle"> </parameter> <parameter name="authority" type="java.lang.String"> </parameter> <parameter name="provider" type="android.content.ContentProviderClient"> </parameter> <parameter name="syncResult" type="android.content.SyncResult"> </parameter> </method> <field name="LOG_SYNC_DETAILS" type="int" transient="false" volatile="false" value="2743" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> </class> <class name="ActivityNotFoundException" extends="java.lang.RuntimeException" abstract="false" Loading Loading @@ -38092,6 +38167,416 @@ > </field> </class> <class name="SyncContext" extends="java.lang.Object" abstract="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <method name="getSyncContextBinder" return="android.os.IBinder" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="onFinished" return="void" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="result" type="android.content.SyncResult"> </parameter> </method> </class> <class name="SyncResult" extends="java.lang.Object" abstract="false" static="false" final="true" deprecated="not deprecated" visibility="public" > <implements name="android.os.Parcelable"> </implements> <constructor name="SyncResult" type="android.content.SyncResult" static="false" final="false" deprecated="not deprecated" visibility="public" > </constructor> <method name="clear" return="void" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="describeContents" return="int" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="hasError" return="boolean" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="hasHardError" return="boolean" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="hasSoftError" return="boolean" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="madeSomeProgress" return="boolean" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="toDebugString" return="java.lang.String" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="writeToParcel" return="void" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="parcel" type="android.os.Parcel"> </parameter> <parameter name="flags" type="int"> </parameter> </method> <field name="ALREADY_IN_PROGRESS" type="android.content.SyncResult" transient="false" volatile="false" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="CREATOR" type="android.os.Parcelable.Creator" transient="false" volatile="false" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="databaseError" type="boolean" transient="false" volatile="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </field> <field name="fullSyncRequested" type="boolean" transient="false" volatile="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </field> <field name="moreRecordsToGet" type="boolean" transient="false" volatile="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </field> <field name="partialSyncUnavailable" type="boolean" transient="false" volatile="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </field> <field name="stats" type="android.content.SyncStats" transient="false" volatile="false" static="false" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="syncAlreadyInProgress" type="boolean" transient="false" volatile="false" static="false" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="tooManyDeletions" type="boolean" transient="false" volatile="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </field> <field name="tooManyRetries" type="boolean" transient="false" volatile="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </field> </class> <class name="SyncStats" extends="java.lang.Object" abstract="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <implements name="android.os.Parcelable"> </implements> <constructor name="SyncStats" type="android.content.SyncStats" static="false" final="false" deprecated="not deprecated" visibility="public" > </constructor> <constructor name="SyncStats" type="android.content.SyncStats" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="in" type="android.os.Parcel"> </parameter> </constructor> <method name="clear" return="void" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="describeContents" return="int" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="writeToParcel" return="void" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="dest" type="android.os.Parcel"> </parameter> <parameter name="flags" type="int"> </parameter> </method> <field name="CREATOR" type="android.os.Parcelable.Creator" transient="false" volatile="false" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="numAuthExceptions" type="long" transient="false" volatile="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </field> <field name="numConflictDetectedExceptions" type="long" transient="false" volatile="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </field> <field name="numDeletes" type="long" transient="false" volatile="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </field> <field name="numEntries" type="long" transient="false" volatile="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </field> <field name="numInserts" type="long" transient="false" volatile="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </field> <field name="numIoExceptions" type="long" transient="false" volatile="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </field> <field name="numParseExceptions" type="long" transient="false" volatile="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </field> <field name="numSkippedEntries" type="long" transient="false" volatile="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </field> <field name="numUpdates" type="long" transient="false" volatile="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </field> </class> <interface name="SyncStatusObserver" abstract="true" static="false" core/java/android/app/ActivityThread.java +25 −14 Original line number Diff line number Diff line Loading @@ -4075,6 +4075,9 @@ public final class ActivityThread { if(prc.count == 0) { // Schedule the actual remove asynchronously, since we // don't know the context this will be called in. // TODO: it would be nice to post a delayed message, so // if we come back and need the same provider quickly // we will still have it available. Message msg = mH.obtainMessage(H.REMOVE_PROVIDER, provider); mH.sendMessage(msg); } //end if Loading @@ -4085,22 +4088,35 @@ public final class ActivityThread { final void completeRemoveProvider(IContentProvider provider) { IBinder jBinder = provider.asBinder(); String name = null; synchronized(mProviderMap) { ProviderRefCount prc = mProviderRefCountMap.get(jBinder); if(prc != null && prc.count == 0) { mProviderRefCountMap.remove(jBinder); //invoke removeProvider to dereference provider removeProviderLocked(provider); name = removeProviderLocked(provider); } } if (name != null) { try { if(localLOGV) Log.v(TAG, "removeProvider::Invoking " + "ActivityManagerNative.removeContentProvider(" + name); ActivityManagerNative.getDefault().removeContentProvider( getApplicationThread(), name); } catch (RemoteException e) { //do nothing content provider object is dead any way } //end catch } } public final void removeProviderLocked(IContentProvider provider) { public final String removeProviderLocked(IContentProvider provider) { if (provider == null) { return; return null; } IBinder providerBinder = provider.asBinder(); boolean amRemoveFlag = false; String name = null; // remove the provider from mProviderMap Iterator<ProviderRecord> iter = mProviderMap.values().iterator(); Loading @@ -4111,7 +4127,7 @@ public final class ActivityThread { //find if its published by this process itself if(pr.mLocalProvider != null) { if(localLOGV) Log.i(TAG, "removeProvider::found local provider returning"); return; return name; } if(localLOGV) Log.v(TAG, "removeProvider::Not local provider Unlinking " + "death recipient"); Loading @@ -4119,18 +4135,13 @@ public final class ActivityThread { myBinder.unlinkToDeath(pr, 0); iter.remove(); //invoke remove only once for the very first name seen if(!amRemoveFlag) { try { if(localLOGV) Log.v(TAG, "removeProvider::Invoking " + "ActivityManagerNative.removeContentProvider("+pr.mName); ActivityManagerNative.getDefault().removeContentProvider(getApplicationThread(), pr.mName); amRemoveFlag = true; } catch (RemoteException e) { //do nothing content provider object is dead any way } //end catch if(name == null) { name = pr.mName; } } //end if myBinder } //end while iter return name; } final void removeDeadProvider(String name, IContentProvider provider) { Loading core/java/android/bluetooth/BluetoothAdapter.java +31 −9 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ import java.util.HashSet; import java.util.LinkedList; import java.util.Random; import java.util.Set; import java.util.UUID; /** * Represents the local Bluetooth adapter. Loading Loading @@ -564,8 +565,16 @@ public final class BluetoothAdapter { } /** * Randomly picks RFCOMM channels until none are left. * Picks RFCOMM channels until none are left. * Avoids reserved channels. * Ideally we would pick random channels, but in the current implementation * we start with the channel that is the hash of the UUID, and try every * available channel from there. This means that in most cases a given * uuid will use the same channel. This is a workaround for a Bluez SDP * bug where we are not updating the cache when the channel changes for a * uuid. * TODO: Fix the Bluez SDP caching bug, and go back to random channel * selection */ private static class RfcommChannelPicker { private static final int[] RESERVED_RFCOMM_CHANNELS = new int[] { Loading @@ -579,7 +588,9 @@ public final class BluetoothAdapter { private final LinkedList<Integer> mChannels; // local list of channels left to try public RfcommChannelPicker() { private final UUID mUuid; public RfcommChannelPicker(UUID uuid) { synchronized (RfcommChannelPicker.class) { if (sChannels == null) { // lazy initialization of non-reserved rfcomm channels Loading @@ -594,13 +605,21 @@ public final class BluetoothAdapter { } mChannels = (LinkedList<Integer>)sChannels.clone(); } mUuid = uuid; } /* Returns next random channel, or -1 if we're out */ /* Returns next channel, or -1 if we're out */ public int nextChannel() { if (mChannels.size() == 0) { return -1; int channel = mUuid.hashCode(); // always pick the same channel to try first Integer channelInt; while (mChannels.size() > 0) { channelInt = new Integer(channel); if (mChannels.remove(channelInt)) { return channel; } channel = (channel % BluetoothSocket.MAX_RFCOMM_CHANNEL) + 1; } return mChannels.remove(sRandom.nextInt(mChannels.size())); return -1; } } Loading Loading @@ -644,6 +663,8 @@ public final class BluetoothAdapter { * can use the same UUID to query our SDP server and discover which channel * to connect to. This SDP record will be removed when this socket is * closed, or if this application closes unexpectedly. * <p>Use {@link BluetoothDevice#createRfcommSocketToServiceRecord} to * connect to this socket from another device using the same {@link UUID}. * <p>Requires {@link android.Manifest.permission#BLUETOOTH} * @param name service name for SDP record * @param uuid uuid for SDP record Loading @@ -651,9 +672,9 @@ public final class BluetoothAdapter { * @throws IOException on error, for example Bluetooth not available, or * insufficient permissions, or channel in use. */ public BluetoothServerSocket listenUsingRfcomm(String name, ParcelUuid uuid) public BluetoothServerSocket listenUsingRfcommWithServiceRecord(String name, UUID uuid) throws IOException { RfcommChannelPicker picker = new RfcommChannelPicker(); RfcommChannelPicker picker = new RfcommChannelPicker(uuid); BluetoothServerSocket socket; int channel; Loading Loading @@ -687,7 +708,8 @@ public final class BluetoothAdapter { int handle = -1; try { handle = mService.addRfcommServiceRecord(name, uuid, channel, new Binder()); handle = mService.addRfcommServiceRecord(name, new ParcelUuid(uuid), channel, new Binder()); } catch (RemoteException e) {Log.e(TAG, "", e);} if (handle == -1) { try { Loading core/java/android/bluetooth/BluetoothDevice.java +51 −17 Original line number Diff line number Diff line Loading @@ -316,21 +316,16 @@ public final class BluetoothDevice implements Parcelable { */ public static final String EXTRA_UUID = "android.bluetooth.device.extra.UUID"; private static IBluetooth sService; /* Guarenteed constant after first object constructed */ /** * Lazy initialization. Guaranteed final after first object constructed, or * getService() called. * TODO: Unify implementation of sService amongst BluetoothFoo API's */ private static IBluetooth sService; private final String mAddress; /** * Create a new BluetoothDevice * Bluetooth MAC address must be upper case, such as "00:11:22:33:AA:BB", * and is validated in this constructor. * @param address valid Bluetooth MAC address * @throws RuntimeException Bluetooth is not available on this platform * @throws IllegalArgumentException address is invalid * @hide */ /*package*/ BluetoothDevice(String address) { /*package*/ static IBluetooth getService() { synchronized (BluetoothDevice.class) { if (sService == null) { IBinder b = ServiceManager.getService(Context.BLUETOOTH_SERVICE); Loading @@ -340,7 +335,20 @@ public final class BluetoothDevice implements Parcelable { sService = IBluetooth.Stub.asInterface(b); } } return sService; } /** * Create a new BluetoothDevice * Bluetooth MAC address must be upper case, such as "00:11:22:33:AA:BB", * and is validated in this constructor. * @param address valid Bluetooth MAC address * @throws RuntimeException Bluetooth is not available on this platform * @throws IllegalArgumentException address is invalid * @hide */ /*package*/ BluetoothDevice(String address) { getService(); // ensures sService is initialized if (!BluetoothAdapter.checkBluetoothAddress(address)) { throw new IllegalArgumentException(address + " is not a valid Bluetooth address"); } Loading Loading @@ -551,7 +559,7 @@ public final class BluetoothDevice implements Parcelable { */ public boolean fetchUuidsWithSdp() { try { return sService.fetchRemoteUuidsWithSdp(mAddress); return sService.fetchRemoteUuids(mAddress, null, null); } catch (RemoteException e) {Log.e(TAG, "", e);} return false; } Loading Loading @@ -598,7 +606,7 @@ public final class BluetoothDevice implements Parcelable { /** * Create an RFCOMM {@link BluetoothSocket} ready to start a secure * outgoing connection to this remote device. * outgoing connection to this remote device on given channel. * <p>The remote device will be authenticated and communication on this * socket will be encrypted. * <p>Use {@link BluetoothSocket#connect} to intiate the outgoing Loading @@ -610,9 +618,34 @@ public final class BluetoothDevice implements Parcelable { * @return a RFCOMM BluetoothServerSocket ready for an outgoing connection * @throws IOException on error, for example Bluetooth not available, or * insufficient permissions * @hide */ public BluetoothSocket createRfcommSocket(int channel) throws IOException { return new BluetoothSocket(BluetoothSocket.TYPE_RFCOMM, -1, true, true, this, channel); return new BluetoothSocket(BluetoothSocket.TYPE_RFCOMM, -1, true, true, this, channel, null); } /** * Create an RFCOMM {@link BluetoothSocket} ready to start a secure * outgoing connection to this remote device using SDP lookup of uuid. * <p>This is designed to be used with {@link * BluetoothAdapter#listenUsingRfcommWithServiceRecord} for peer-peer * Bluetooth applications. * <p>Use {@link BluetoothSocket#connect} to intiate the outgoing * connection. This will also perform an SDP lookup of the given uuid to * determine which channel to connect to. * <p>The remote device will be authenticated and communication on this * socket will be encrypted. * <p>Requires {@link android.Manifest.permission#BLUETOOTH} * * @param uuid service record uuid to lookup RFCOMM channel * @return a RFCOMM BluetoothServerSocket ready for an outgoing connection * @throws IOException on error, for example Bluetooth not available, or * insufficient permissions */ public BluetoothSocket createRfcommSocketToServiceRecord(UUID uuid) throws IOException { return new BluetoothSocket(BluetoothSocket.TYPE_RFCOMM, -1, true, true, this, -1, new ParcelUuid(uuid)); } /** Loading @@ -628,7 +661,8 @@ public final class BluetoothDevice implements Parcelable { * @hide */ public BluetoothSocket createInsecureRfcommSocket(int port) throws IOException { return new BluetoothSocket(BluetoothSocket.TYPE_RFCOMM, -1, false, false, this, port); return new BluetoothSocket(BluetoothSocket.TYPE_RFCOMM, -1, false, false, this, port, null); } /** Loading @@ -640,7 +674,7 @@ public final class BluetoothDevice implements Parcelable { * @hide */ public BluetoothSocket createScoSocket() throws IOException { return new BluetoothSocket(BluetoothSocket.TYPE_SCO, -1, true, true, this, -1); return new BluetoothSocket(BluetoothSocket.TYPE_SCO, -1, true, true, this, -1, null); } /** Loading Loading
Android.mk +1 −0 Original line number Diff line number Diff line Loading @@ -90,6 +90,7 @@ LOCAL_SRC_FILES += \ core/java/android/backup/IRestoreSession.aidl \ core/java/android/bluetooth/IBluetooth.aidl \ core/java/android/bluetooth/IBluetoothA2dp.aidl \ core/java/android/bluetooth/IBluetoothCallback.aidl \ core/java/android/bluetooth/IBluetoothHeadset.aidl \ core/java/android/bluetooth/IBluetoothPbap.aidl \ core/java/android/content/IContentService.aidl \ Loading
api/current.xml +489 −4 Original line number Diff line number Diff line Loading @@ -25618,7 +25618,7 @@ visibility="public" > </method> <method name="listenUsingRfcomm" <method name="listenUsingRfcommWithServiceRecord" return="android.bluetooth.BluetoothServerSocket" abstract="false" native="false" Loading @@ -25630,7 +25630,7 @@ > <parameter name="name" type="java.lang.String"> </parameter> <parameter name="uuid" type="android.os.ParcelUuid"> <parameter name="uuid" type="java.util.UUID"> </parameter> <exception name="IOException" type="java.io.IOException"> </exception> Loading Loading @@ -26804,7 +26804,7 @@ > <implements name="android.os.Parcelable"> </implements> <method name="createRfcommSocket" <method name="createRfcommSocketToServiceRecord" return="android.bluetooth.BluetoothSocket" abstract="false" native="false" Loading @@ -26814,7 +26814,7 @@ deprecated="not deprecated" visibility="public" > <parameter name="channel" type="int"> <parameter name="uuid" type="java.util.UUID"> </parameter> <exception name="IOException" type="java.io.IOException"> </exception> Loading Loading @@ -27216,6 +27216,81 @@ </package> <package name="android.content" > <class name="AbstractThreadedSyncAdapter" extends="java.lang.Object" abstract="true" static="false" final="false" deprecated="not deprecated" visibility="public" > <constructor name="AbstractThreadedSyncAdapter" type="android.content.AbstractThreadedSyncAdapter" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="context" type="android.content.Context"> </parameter> <parameter name="autoInitialize" type="boolean"> </parameter> </constructor> <method name="getContext" return="android.content.Context" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="getSyncAdapterBinder" return="android.os.IBinder" abstract="false" native="false" synchronized="false" static="false" final="true" deprecated="not deprecated" visibility="public" > </method> <method name="onPerformSync" return="void" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="account" type="android.accounts.Account"> </parameter> <parameter name="extras" type="android.os.Bundle"> </parameter> <parameter name="authority" type="java.lang.String"> </parameter> <parameter name="provider" type="android.content.ContentProviderClient"> </parameter> <parameter name="syncResult" type="android.content.SyncResult"> </parameter> </method> <field name="LOG_SYNC_DETAILS" type="int" transient="false" volatile="false" value="2743" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> </class> <class name="ActivityNotFoundException" extends="java.lang.RuntimeException" abstract="false" Loading Loading @@ -38092,6 +38167,416 @@ > </field> </class> <class name="SyncContext" extends="java.lang.Object" abstract="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <method name="getSyncContextBinder" return="android.os.IBinder" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="onFinished" return="void" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="result" type="android.content.SyncResult"> </parameter> </method> </class> <class name="SyncResult" extends="java.lang.Object" abstract="false" static="false" final="true" deprecated="not deprecated" visibility="public" > <implements name="android.os.Parcelable"> </implements> <constructor name="SyncResult" type="android.content.SyncResult" static="false" final="false" deprecated="not deprecated" visibility="public" > </constructor> <method name="clear" return="void" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="describeContents" return="int" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="hasError" return="boolean" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="hasHardError" return="boolean" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="hasSoftError" return="boolean" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="madeSomeProgress" return="boolean" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="toDebugString" return="java.lang.String" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="writeToParcel" return="void" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="parcel" type="android.os.Parcel"> </parameter> <parameter name="flags" type="int"> </parameter> </method> <field name="ALREADY_IN_PROGRESS" type="android.content.SyncResult" transient="false" volatile="false" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="CREATOR" type="android.os.Parcelable.Creator" transient="false" volatile="false" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="databaseError" type="boolean" transient="false" volatile="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </field> <field name="fullSyncRequested" type="boolean" transient="false" volatile="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </field> <field name="moreRecordsToGet" type="boolean" transient="false" volatile="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </field> <field name="partialSyncUnavailable" type="boolean" transient="false" volatile="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </field> <field name="stats" type="android.content.SyncStats" transient="false" volatile="false" static="false" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="syncAlreadyInProgress" type="boolean" transient="false" volatile="false" static="false" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="tooManyDeletions" type="boolean" transient="false" volatile="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </field> <field name="tooManyRetries" type="boolean" transient="false" volatile="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </field> </class> <class name="SyncStats" extends="java.lang.Object" abstract="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <implements name="android.os.Parcelable"> </implements> <constructor name="SyncStats" type="android.content.SyncStats" static="false" final="false" deprecated="not deprecated" visibility="public" > </constructor> <constructor name="SyncStats" type="android.content.SyncStats" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="in" type="android.os.Parcel"> </parameter> </constructor> <method name="clear" return="void" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="describeContents" return="int" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="writeToParcel" return="void" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="dest" type="android.os.Parcel"> </parameter> <parameter name="flags" type="int"> </parameter> </method> <field name="CREATOR" type="android.os.Parcelable.Creator" transient="false" volatile="false" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="numAuthExceptions" type="long" transient="false" volatile="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </field> <field name="numConflictDetectedExceptions" type="long" transient="false" volatile="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </field> <field name="numDeletes" type="long" transient="false" volatile="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </field> <field name="numEntries" type="long" transient="false" volatile="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </field> <field name="numInserts" type="long" transient="false" volatile="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </field> <field name="numIoExceptions" type="long" transient="false" volatile="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </field> <field name="numParseExceptions" type="long" transient="false" volatile="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </field> <field name="numSkippedEntries" type="long" transient="false" volatile="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </field> <field name="numUpdates" type="long" transient="false" volatile="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </field> </class> <interface name="SyncStatusObserver" abstract="true" static="false"
core/java/android/app/ActivityThread.java +25 −14 Original line number Diff line number Diff line Loading @@ -4075,6 +4075,9 @@ public final class ActivityThread { if(prc.count == 0) { // Schedule the actual remove asynchronously, since we // don't know the context this will be called in. // TODO: it would be nice to post a delayed message, so // if we come back and need the same provider quickly // we will still have it available. Message msg = mH.obtainMessage(H.REMOVE_PROVIDER, provider); mH.sendMessage(msg); } //end if Loading @@ -4085,22 +4088,35 @@ public final class ActivityThread { final void completeRemoveProvider(IContentProvider provider) { IBinder jBinder = provider.asBinder(); String name = null; synchronized(mProviderMap) { ProviderRefCount prc = mProviderRefCountMap.get(jBinder); if(prc != null && prc.count == 0) { mProviderRefCountMap.remove(jBinder); //invoke removeProvider to dereference provider removeProviderLocked(provider); name = removeProviderLocked(provider); } } if (name != null) { try { if(localLOGV) Log.v(TAG, "removeProvider::Invoking " + "ActivityManagerNative.removeContentProvider(" + name); ActivityManagerNative.getDefault().removeContentProvider( getApplicationThread(), name); } catch (RemoteException e) { //do nothing content provider object is dead any way } //end catch } } public final void removeProviderLocked(IContentProvider provider) { public final String removeProviderLocked(IContentProvider provider) { if (provider == null) { return; return null; } IBinder providerBinder = provider.asBinder(); boolean amRemoveFlag = false; String name = null; // remove the provider from mProviderMap Iterator<ProviderRecord> iter = mProviderMap.values().iterator(); Loading @@ -4111,7 +4127,7 @@ public final class ActivityThread { //find if its published by this process itself if(pr.mLocalProvider != null) { if(localLOGV) Log.i(TAG, "removeProvider::found local provider returning"); return; return name; } if(localLOGV) Log.v(TAG, "removeProvider::Not local provider Unlinking " + "death recipient"); Loading @@ -4119,18 +4135,13 @@ public final class ActivityThread { myBinder.unlinkToDeath(pr, 0); iter.remove(); //invoke remove only once for the very first name seen if(!amRemoveFlag) { try { if(localLOGV) Log.v(TAG, "removeProvider::Invoking " + "ActivityManagerNative.removeContentProvider("+pr.mName); ActivityManagerNative.getDefault().removeContentProvider(getApplicationThread(), pr.mName); amRemoveFlag = true; } catch (RemoteException e) { //do nothing content provider object is dead any way } //end catch if(name == null) { name = pr.mName; } } //end if myBinder } //end while iter return name; } final void removeDeadProvider(String name, IContentProvider provider) { Loading
core/java/android/bluetooth/BluetoothAdapter.java +31 −9 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ import java.util.HashSet; import java.util.LinkedList; import java.util.Random; import java.util.Set; import java.util.UUID; /** * Represents the local Bluetooth adapter. Loading Loading @@ -564,8 +565,16 @@ public final class BluetoothAdapter { } /** * Randomly picks RFCOMM channels until none are left. * Picks RFCOMM channels until none are left. * Avoids reserved channels. * Ideally we would pick random channels, but in the current implementation * we start with the channel that is the hash of the UUID, and try every * available channel from there. This means that in most cases a given * uuid will use the same channel. This is a workaround for a Bluez SDP * bug where we are not updating the cache when the channel changes for a * uuid. * TODO: Fix the Bluez SDP caching bug, and go back to random channel * selection */ private static class RfcommChannelPicker { private static final int[] RESERVED_RFCOMM_CHANNELS = new int[] { Loading @@ -579,7 +588,9 @@ public final class BluetoothAdapter { private final LinkedList<Integer> mChannels; // local list of channels left to try public RfcommChannelPicker() { private final UUID mUuid; public RfcommChannelPicker(UUID uuid) { synchronized (RfcommChannelPicker.class) { if (sChannels == null) { // lazy initialization of non-reserved rfcomm channels Loading @@ -594,13 +605,21 @@ public final class BluetoothAdapter { } mChannels = (LinkedList<Integer>)sChannels.clone(); } mUuid = uuid; } /* Returns next random channel, or -1 if we're out */ /* Returns next channel, or -1 if we're out */ public int nextChannel() { if (mChannels.size() == 0) { return -1; int channel = mUuid.hashCode(); // always pick the same channel to try first Integer channelInt; while (mChannels.size() > 0) { channelInt = new Integer(channel); if (mChannels.remove(channelInt)) { return channel; } channel = (channel % BluetoothSocket.MAX_RFCOMM_CHANNEL) + 1; } return mChannels.remove(sRandom.nextInt(mChannels.size())); return -1; } } Loading Loading @@ -644,6 +663,8 @@ public final class BluetoothAdapter { * can use the same UUID to query our SDP server and discover which channel * to connect to. This SDP record will be removed when this socket is * closed, or if this application closes unexpectedly. * <p>Use {@link BluetoothDevice#createRfcommSocketToServiceRecord} to * connect to this socket from another device using the same {@link UUID}. * <p>Requires {@link android.Manifest.permission#BLUETOOTH} * @param name service name for SDP record * @param uuid uuid for SDP record Loading @@ -651,9 +672,9 @@ public final class BluetoothAdapter { * @throws IOException on error, for example Bluetooth not available, or * insufficient permissions, or channel in use. */ public BluetoothServerSocket listenUsingRfcomm(String name, ParcelUuid uuid) public BluetoothServerSocket listenUsingRfcommWithServiceRecord(String name, UUID uuid) throws IOException { RfcommChannelPicker picker = new RfcommChannelPicker(); RfcommChannelPicker picker = new RfcommChannelPicker(uuid); BluetoothServerSocket socket; int channel; Loading Loading @@ -687,7 +708,8 @@ public final class BluetoothAdapter { int handle = -1; try { handle = mService.addRfcommServiceRecord(name, uuid, channel, new Binder()); handle = mService.addRfcommServiceRecord(name, new ParcelUuid(uuid), channel, new Binder()); } catch (RemoteException e) {Log.e(TAG, "", e);} if (handle == -1) { try { Loading
core/java/android/bluetooth/BluetoothDevice.java +51 −17 Original line number Diff line number Diff line Loading @@ -316,21 +316,16 @@ public final class BluetoothDevice implements Parcelable { */ public static final String EXTRA_UUID = "android.bluetooth.device.extra.UUID"; private static IBluetooth sService; /* Guarenteed constant after first object constructed */ /** * Lazy initialization. Guaranteed final after first object constructed, or * getService() called. * TODO: Unify implementation of sService amongst BluetoothFoo API's */ private static IBluetooth sService; private final String mAddress; /** * Create a new BluetoothDevice * Bluetooth MAC address must be upper case, such as "00:11:22:33:AA:BB", * and is validated in this constructor. * @param address valid Bluetooth MAC address * @throws RuntimeException Bluetooth is not available on this platform * @throws IllegalArgumentException address is invalid * @hide */ /*package*/ BluetoothDevice(String address) { /*package*/ static IBluetooth getService() { synchronized (BluetoothDevice.class) { if (sService == null) { IBinder b = ServiceManager.getService(Context.BLUETOOTH_SERVICE); Loading @@ -340,7 +335,20 @@ public final class BluetoothDevice implements Parcelable { sService = IBluetooth.Stub.asInterface(b); } } return sService; } /** * Create a new BluetoothDevice * Bluetooth MAC address must be upper case, such as "00:11:22:33:AA:BB", * and is validated in this constructor. * @param address valid Bluetooth MAC address * @throws RuntimeException Bluetooth is not available on this platform * @throws IllegalArgumentException address is invalid * @hide */ /*package*/ BluetoothDevice(String address) { getService(); // ensures sService is initialized if (!BluetoothAdapter.checkBluetoothAddress(address)) { throw new IllegalArgumentException(address + " is not a valid Bluetooth address"); } Loading Loading @@ -551,7 +559,7 @@ public final class BluetoothDevice implements Parcelable { */ public boolean fetchUuidsWithSdp() { try { return sService.fetchRemoteUuidsWithSdp(mAddress); return sService.fetchRemoteUuids(mAddress, null, null); } catch (RemoteException e) {Log.e(TAG, "", e);} return false; } Loading Loading @@ -598,7 +606,7 @@ public final class BluetoothDevice implements Parcelable { /** * Create an RFCOMM {@link BluetoothSocket} ready to start a secure * outgoing connection to this remote device. * outgoing connection to this remote device on given channel. * <p>The remote device will be authenticated and communication on this * socket will be encrypted. * <p>Use {@link BluetoothSocket#connect} to intiate the outgoing Loading @@ -610,9 +618,34 @@ public final class BluetoothDevice implements Parcelable { * @return a RFCOMM BluetoothServerSocket ready for an outgoing connection * @throws IOException on error, for example Bluetooth not available, or * insufficient permissions * @hide */ public BluetoothSocket createRfcommSocket(int channel) throws IOException { return new BluetoothSocket(BluetoothSocket.TYPE_RFCOMM, -1, true, true, this, channel); return new BluetoothSocket(BluetoothSocket.TYPE_RFCOMM, -1, true, true, this, channel, null); } /** * Create an RFCOMM {@link BluetoothSocket} ready to start a secure * outgoing connection to this remote device using SDP lookup of uuid. * <p>This is designed to be used with {@link * BluetoothAdapter#listenUsingRfcommWithServiceRecord} for peer-peer * Bluetooth applications. * <p>Use {@link BluetoothSocket#connect} to intiate the outgoing * connection. This will also perform an SDP lookup of the given uuid to * determine which channel to connect to. * <p>The remote device will be authenticated and communication on this * socket will be encrypted. * <p>Requires {@link android.Manifest.permission#BLUETOOTH} * * @param uuid service record uuid to lookup RFCOMM channel * @return a RFCOMM BluetoothServerSocket ready for an outgoing connection * @throws IOException on error, for example Bluetooth not available, or * insufficient permissions */ public BluetoothSocket createRfcommSocketToServiceRecord(UUID uuid) throws IOException { return new BluetoothSocket(BluetoothSocket.TYPE_RFCOMM, -1, true, true, this, -1, new ParcelUuid(uuid)); } /** Loading @@ -628,7 +661,8 @@ public final class BluetoothDevice implements Parcelable { * @hide */ public BluetoothSocket createInsecureRfcommSocket(int port) throws IOException { return new BluetoothSocket(BluetoothSocket.TYPE_RFCOMM, -1, false, false, this, port); return new BluetoothSocket(BluetoothSocket.TYPE_RFCOMM, -1, false, false, this, port, null); } /** Loading @@ -640,7 +674,7 @@ public final class BluetoothDevice implements Parcelable { * @hide */ public BluetoothSocket createScoSocket() throws IOException { return new BluetoothSocket(BluetoothSocket.TYPE_SCO, -1, true, true, this, -1); return new BluetoothSocket(BluetoothSocket.TYPE_SCO, -1, true, true, this, -1, null); } /** Loading