Loading framework/java/android/bluetooth/BluetoothAdapter.java +12 −28 Original line number Original line Diff line number Diff line Loading @@ -472,12 +472,6 @@ public final class BluetoothAdapter { private static final int ADDRESS_LENGTH = 17; private static final int ADDRESS_LENGTH = 17; private static final int CONTROLLER_ENERGY_UPDATE_TIMEOUT_MILLIS = 30; /** @hide */ public static final int ACTIVITY_ENERGY_INFO_CACHED = 0; /** @hide */ public static final int ACTIVITY_ENERGY_INFO_REFRESHED = 1; /** /** * Lazily initialized singleton. Guaranteed final after first object * Lazily initialized singleton. Guaranteed final after first object * constructed. * constructed. Loading Loading @@ -1374,13 +1368,13 @@ public final class BluetoothAdapter { * @return a record with {@link BluetoothActivityEnergyInfo} or null if * @return a record with {@link BluetoothActivityEnergyInfo} or null if * report is unavailable or unsupported * report is unavailable or unsupported * @deprecated use the asynchronous * @deprecated use the asynchronous * {@link #requestControllerActivityEnergyInfo(int, ResultReceiver)} instead. * {@link #requestControllerActivityEnergyInfo(ResultReceiver)} instead. * @hide * @hide */ */ @Deprecated @Deprecated public BluetoothActivityEnergyInfo getControllerActivityEnergyInfo(int updateType) { public BluetoothActivityEnergyInfo getControllerActivityEnergyInfo(int updateType) { SynchronousResultReceiver receiver = new SynchronousResultReceiver(); SynchronousResultReceiver receiver = new SynchronousResultReceiver(); requestControllerActivityEnergyInfo(updateType, receiver); requestControllerActivityEnergyInfo(receiver); try { try { SynchronousResultReceiver.Result result = receiver.awaitResult(1000); SynchronousResultReceiver.Result result = receiver.awaitResult(1000); if (result.bundle != null) { if (result.bundle != null) { Loading @@ -1400,36 +1394,26 @@ public final class BluetoothAdapter { * A null value for the activity info object may be sent if the bluetooth service is * A null value for the activity info object may be sent if the bluetooth service is * unreachable or the device does not support reporting such information. * unreachable or the device does not support reporting such information. * * * @param updateType Type of info, cached vs refreshed. * @param result The callback to which to send the activity info. * @param result The callback to which to send the activity info. * @hide * @hide */ */ public void requestControllerActivityEnergyInfo(int updateType, ResultReceiver result) { public void requestControllerActivityEnergyInfo(ResultReceiver result) { if (getState() != STATE_ON) { result.send(0, null); return; } try { try { if (!mService.isActivityAndEnergyReportingSupported()) { synchronized(mManagerCallback) { result.send(0, null); if (mService != null) { return; } synchronized(this) { if (updateType == ACTIVITY_ENERGY_INFO_REFRESHED) { mService.getActivityEnergyInfoFromController(); wait(CONTROLLER_ENERGY_UPDATE_TIMEOUT_MILLIS); } mService.requestActivityInfo(result); mService.requestActivityInfo(result); result = null; } } } } catch (InterruptedException e) { Log.e(TAG, "getControllerActivityEnergyInfoCallback wait interrupted: " + e); result.send(0, null); } catch (RemoteException e) { } catch (RemoteException e) { Log.e(TAG, "getControllerActivityEnergyInfoCallback: " + e); Log.e(TAG, "getControllerActivityEnergyInfoCallback: " + e); } finally { if (result != null) { // Only send an immediate result if we failed. result.send(0, null); result.send(0, null); } } } } } /** /** * Return the set of {@link BluetoothDevice} objects that are bonded * Return the set of {@link BluetoothDevice} objects that are bonded Loading framework/java/android/bluetooth/IBluetooth.aidl +0 −1 Original line number Original line Diff line number Diff line Loading @@ -102,7 +102,6 @@ interface IBluetooth boolean isOffloadedFilteringSupported(); boolean isOffloadedFilteringSupported(); boolean isOffloadedScanBatchingSupported(); boolean isOffloadedScanBatchingSupported(); boolean isActivityAndEnergyReportingSupported(); boolean isActivityAndEnergyReportingSupported(); void getActivityEnergyInfoFromController(); BluetoothActivityEnergyInfo reportActivityInfo(); BluetoothActivityEnergyInfo reportActivityInfo(); /** /** Loading Loading
framework/java/android/bluetooth/BluetoothAdapter.java +12 −28 Original line number Original line Diff line number Diff line Loading @@ -472,12 +472,6 @@ public final class BluetoothAdapter { private static final int ADDRESS_LENGTH = 17; private static final int ADDRESS_LENGTH = 17; private static final int CONTROLLER_ENERGY_UPDATE_TIMEOUT_MILLIS = 30; /** @hide */ public static final int ACTIVITY_ENERGY_INFO_CACHED = 0; /** @hide */ public static final int ACTIVITY_ENERGY_INFO_REFRESHED = 1; /** /** * Lazily initialized singleton. Guaranteed final after first object * Lazily initialized singleton. Guaranteed final after first object * constructed. * constructed. Loading Loading @@ -1374,13 +1368,13 @@ public final class BluetoothAdapter { * @return a record with {@link BluetoothActivityEnergyInfo} or null if * @return a record with {@link BluetoothActivityEnergyInfo} or null if * report is unavailable or unsupported * report is unavailable or unsupported * @deprecated use the asynchronous * @deprecated use the asynchronous * {@link #requestControllerActivityEnergyInfo(int, ResultReceiver)} instead. * {@link #requestControllerActivityEnergyInfo(ResultReceiver)} instead. * @hide * @hide */ */ @Deprecated @Deprecated public BluetoothActivityEnergyInfo getControllerActivityEnergyInfo(int updateType) { public BluetoothActivityEnergyInfo getControllerActivityEnergyInfo(int updateType) { SynchronousResultReceiver receiver = new SynchronousResultReceiver(); SynchronousResultReceiver receiver = new SynchronousResultReceiver(); requestControllerActivityEnergyInfo(updateType, receiver); requestControllerActivityEnergyInfo(receiver); try { try { SynchronousResultReceiver.Result result = receiver.awaitResult(1000); SynchronousResultReceiver.Result result = receiver.awaitResult(1000); if (result.bundle != null) { if (result.bundle != null) { Loading @@ -1400,36 +1394,26 @@ public final class BluetoothAdapter { * A null value for the activity info object may be sent if the bluetooth service is * A null value for the activity info object may be sent if the bluetooth service is * unreachable or the device does not support reporting such information. * unreachable or the device does not support reporting such information. * * * @param updateType Type of info, cached vs refreshed. * @param result The callback to which to send the activity info. * @param result The callback to which to send the activity info. * @hide * @hide */ */ public void requestControllerActivityEnergyInfo(int updateType, ResultReceiver result) { public void requestControllerActivityEnergyInfo(ResultReceiver result) { if (getState() != STATE_ON) { result.send(0, null); return; } try { try { if (!mService.isActivityAndEnergyReportingSupported()) { synchronized(mManagerCallback) { result.send(0, null); if (mService != null) { return; } synchronized(this) { if (updateType == ACTIVITY_ENERGY_INFO_REFRESHED) { mService.getActivityEnergyInfoFromController(); wait(CONTROLLER_ENERGY_UPDATE_TIMEOUT_MILLIS); } mService.requestActivityInfo(result); mService.requestActivityInfo(result); result = null; } } } } catch (InterruptedException e) { Log.e(TAG, "getControllerActivityEnergyInfoCallback wait interrupted: " + e); result.send(0, null); } catch (RemoteException e) { } catch (RemoteException e) { Log.e(TAG, "getControllerActivityEnergyInfoCallback: " + e); Log.e(TAG, "getControllerActivityEnergyInfoCallback: " + e); } finally { if (result != null) { // Only send an immediate result if we failed. result.send(0, null); result.send(0, null); } } } } } /** /** * Return the set of {@link BluetoothDevice} objects that are bonded * Return the set of {@link BluetoothDevice} objects that are bonded Loading
framework/java/android/bluetooth/IBluetooth.aidl +0 −1 Original line number Original line Diff line number Diff line Loading @@ -102,7 +102,6 @@ interface IBluetooth boolean isOffloadedFilteringSupported(); boolean isOffloadedFilteringSupported(); boolean isOffloadedScanBatchingSupported(); boolean isOffloadedScanBatchingSupported(); boolean isActivityAndEnergyReportingSupported(); boolean isActivityAndEnergyReportingSupported(); void getActivityEnergyInfoFromController(); BluetoothActivityEnergyInfo reportActivityInfo(); BluetoothActivityEnergyInfo reportActivityInfo(); /** /** Loading