Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 001db4af authored by David Duarte's avatar David Duarte Committed by Gerrit Code Review
Browse files

Merge "framework: Run google-java-format" into main

parents 0088cb9b ee52b7e8
Loading
Loading
Loading
Loading
+5 −7
Original line number Original line Diff line number Diff line
@@ -23,9 +23,9 @@ import android.content.AttributionSource;
import java.util.List;
import java.util.List;


/**
/**
 * Marker interface for a class which can have an {@link AttributionSource}
 * Marker interface for a class which can have an {@link AttributionSource} assigned to it; these
 * assigned to it; these are typically {@link android.os.Parcelable} classes
 * are typically {@link android.os.Parcelable} classes which need to be updated after crossing
 * which need to be updated after crossing Binder transaction boundaries.
 * Binder transaction boundaries.
 *
 *
 * @hide
 * @hide
 */
 */
@@ -35,8 +35,7 @@ public interface Attributable {


    /** @hide */
    /** @hide */
    static @Nullable <T extends Attributable> T setAttributionSource(
    static @Nullable <T extends Attributable> T setAttributionSource(
            @Nullable T attributable,
            @Nullable T attributable, @NonNull AttributionSource attributionSource) {
            @NonNull AttributionSource attributionSource) {
        if (attributable != null) {
        if (attributable != null) {
            attributable.setAttributionSource(attributionSource);
            attributable.setAttributionSource(attributionSource);
        }
        }
@@ -45,8 +44,7 @@ public interface Attributable {


    /** @hide */
    /** @hide */
    static @Nullable <T extends Attributable> List<T> setAttributionSource(
    static @Nullable <T extends Attributable> List<T> setAttributionSource(
            @Nullable List<T> attributableList,
            @Nullable List<T> attributableList, @NonNull AttributionSource attributionSource) {
            @NonNull AttributionSource attributionSource) {
        if (attributableList != null) {
        if (attributableList != null) {
            final int size = attributableList.size();
            final int size = attributableList.size();
            for (int i = 0; i < size; i++) {
            for (int i = 0; i < size; i++) {
+221 −245

File changed.

Preview size limit exceeded, changes collapsed.

+75 −82
Original line number Original line Diff line number Diff line
@@ -43,12 +43,10 @@ import java.util.List;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.TimeoutException;


/**
/**
 * This class provides the public APIs to control the Bluetooth A2DP Sink
 * This class provides the public APIs to control the Bluetooth A2DP Sink profile.
 * profile.
 *
 *
 * <p>BluetoothA2dpSink is a proxy object for controlling the Bluetooth A2DP Sink
 * <p>BluetoothA2dpSink is a proxy object for controlling the Bluetooth A2DP Sink Service via IPC.
 * Service via IPC. Use {@link BluetoothAdapter#getProfileProxy} to get
 * Use {@link BluetoothAdapter#getProfileProxy} to get the BluetoothA2dpSink proxy object.
 * the BluetoothA2dpSink proxy object.
 *
 *
 * @hide
 * @hide
 */
 */
@@ -59,19 +57,19 @@ public final class BluetoothA2dpSink implements BluetoothProfile {
    private static final boolean VDBG = false;
    private static final boolean VDBG = false;


    /**
    /**
     * Intent used to broadcast the change in connection state of the A2DP Sink
     * Intent used to broadcast the change in connection state of the A2DP Sink profile.
     * profile.
     *
     *
     * <p>This intent will have 3 extras:
     * <p>This intent will have 3 extras:
     *
     * <ul>
     * <ul>
     * <li> {@link #EXTRA_STATE} - The current state of the profile. </li>
     *   <li>{@link #EXTRA_STATE} - The current state of the profile.
     * <li> {@link #EXTRA_PREVIOUS_STATE}- The previous state of the profile.</li>
     *   <li>{@link #EXTRA_PREVIOUS_STATE}- The previous state of the profile.
     * <li> {@link BluetoothDevice#EXTRA_DEVICE} - The remote device. </li>
     *   <li>{@link BluetoothDevice#EXTRA_DEVICE} - The remote device.
     * </ul>
     * </ul>
     *
     *
     * <p>{@link #EXTRA_STATE} or {@link #EXTRA_PREVIOUS_STATE} can be any of
     * <p>{@link #EXTRA_STATE} or {@link #EXTRA_PREVIOUS_STATE} can be any of {@link
     * {@link #STATE_DISCONNECTED}, {@link #STATE_CONNECTING},
     * #STATE_DISCONNECTED}, {@link #STATE_CONNECTING}, {@link #STATE_CONNECTED}, {@link
     * {@link #STATE_CONNECTED}, {@link #STATE_DISCONNECTING}.
     * #STATE_DISCONNECTING}.
     *
     *
     * @hide
     * @hide
     */
     */
@@ -89,8 +87,7 @@ public final class BluetoothA2dpSink implements BluetoothProfile {
    private IBluetoothA2dpSink mService;
    private IBluetoothA2dpSink mService;


    /**
    /**
     * Create a BluetoothA2dp proxy object for interacting with the local
     * Create a BluetoothA2dp proxy object for interacting with the local Bluetooth A2DP service.
     * Bluetooth A2DP service.
     */
     */
    /* package */ BluetoothA2dpSink(Context context, BluetoothAdapter adapter) {
    /* package */ BluetoothA2dpSink(Context context, BluetoothAdapter adapter) {
        mAdapter = adapter;
        mAdapter = adapter;
@@ -126,23 +123,21 @@ public final class BluetoothA2dpSink implements BluetoothProfile {
    /**
    /**
     * Initiate connection to a profile of the remote bluetooth device.
     * Initiate connection to a profile of the remote bluetooth device.
     *
     *
     * <p> Currently, the system supports only 1 connection to the
     * <p>Currently, the system supports only 1 connection to the A2DP profile. The API will
     * A2DP profile. The API will automatically disconnect connected
     * automatically disconnect connected devices before connecting.
     * devices before connecting.
     *
     *
     * <p> This API returns false in scenarios like the profile on the
     * <p>This API returns false in scenarios like the profile on the device is already connected or
     * device is already connected or Bluetooth is not turned on.
     * Bluetooth is not turned on. When this API returns true, it is guaranteed that connection
     * When this API returns true, it is guaranteed that
     * state intent for the profile will be broadcasted with the state. Users can get the connection
     * connection state intent for the profile will be broadcasted with
     * state of the profile from this intent.
     * the state. Users can get the connection state of the profile
     * from this intent.
     *
     *
     * @param device Remote Bluetooth Device
     * @param device Remote Bluetooth Device
     * @return false on immediate error, true otherwise
     * @return false on immediate error, true otherwise
     * @hide
     * @hide
     */
     */
    @RequiresBluetoothConnectPermission
    @RequiresBluetoothConnectPermission
    @RequiresPermission(allOf = {
    @RequiresPermission(
            allOf = {
                android.Manifest.permission.BLUETOOTH_CONNECT,
                android.Manifest.permission.BLUETOOTH_CONNECT,
                android.Manifest.permission.BLUETOOTH_PRIVILEGED,
                android.Manifest.permission.BLUETOOTH_PRIVILEGED,
            })
            })
@@ -168,20 +163,16 @@ public final class BluetoothA2dpSink implements BluetoothProfile {
    /**
    /**
     * Initiate disconnection from a profile
     * Initiate disconnection from a profile
     *
     *
     * <p> This API will return false in scenarios like the profile on the
     * <p>This API will return false in scenarios like the profile on the Bluetooth device is not in
     * Bluetooth device is not in connected state etc. When this API returns,
     * connected state etc. When this API returns, true, it is guaranteed that the connection state
     * true, it is guaranteed that the connection state change
     * change intent will be broadcasted with the state. Users can get the disconnection state of
     * intent will be broadcasted with the state. Users can get the
     * the profile from this intent.
     * disconnection state of the profile from this intent.
     *
     *
     * <p> If the disconnection is initiated by a remote device, the state
     * <p>If the disconnection is initiated by a remote device, the state will transition from
     * will transition from {@link #STATE_CONNECTED} to
     * {@link #STATE_CONNECTED} to {@link #STATE_DISCONNECTED}. If the disconnect is initiated by
     * {@link #STATE_DISCONNECTED}. If the disconnect is initiated by the
     * the host (local) device the state will transition from {@link #STATE_CONNECTED} to state
     * host (local) device the state will transition from
     * {@link #STATE_DISCONNECTING} to state {@link #STATE_DISCONNECTED}. The transition to {@link
     * {@link #STATE_CONNECTED} to state {@link #STATE_DISCONNECTING} to
     * #STATE_DISCONNECTING} can be used to distinguish between the two scenarios.
     * state {@link #STATE_DISCONNECTED}. The transition to
     * {@link #STATE_DISCONNECTING} can be used to distinguish between the
     * two scenarios.
     *
     *
     * @param device Remote Bluetooth Device
     * @param device Remote Bluetooth Device
     * @return false on immediate error, true otherwise
     * @return false on immediate error, true otherwise
@@ -298,14 +289,12 @@ public final class BluetoothA2dpSink implements BluetoothProfile {
    }
    }


    /**
    /**
     * Get the current audio configuration for the A2DP source device,
     * Get the current audio configuration for the A2DP source device, or null if the device has no
     * or null if the device has no audio configuration
     * audio configuration
     *
     *
     * @param device Remote bluetooth device.
     * @param device Remote bluetooth device.
     * @return audio configuration for the device, or null
     * @return audio configuration for the device, or null
     *
     *     <p>{@see BluetoothAudioConfig}
     * {@see BluetoothAudioConfig}
     *
     * @hide
     * @hide
     */
     */
    @RequiresLegacyBluetoothPermission
    @RequiresLegacyBluetoothPermission
@@ -334,8 +323,8 @@ public final class BluetoothA2dpSink implements BluetoothProfile {
    /**
    /**
     * Set priority of the profile
     * Set priority of the profile
     *
     *
     * <p> The device should already be paired.
     * <p>The device should already be paired. Priority can be one of {@link #PRIORITY_ON} or {@link
     * Priority can be one of {@link #PRIORITY_ON} or {@link #PRIORITY_OFF}
     * #PRIORITY_OFF}
     *
     *
     * @param device Paired bluetooth device
     * @param device Paired bluetooth device
     * @param priority
     * @param priority
@@ -343,7 +332,8 @@ public final class BluetoothA2dpSink implements BluetoothProfile {
     * @hide
     * @hide
     */
     */
    @RequiresBluetoothConnectPermission
    @RequiresBluetoothConnectPermission
    @RequiresPermission(allOf = {
    @RequiresPermission(
            allOf = {
                android.Manifest.permission.BLUETOOTH_CONNECT,
                android.Manifest.permission.BLUETOOTH_CONNECT,
                android.Manifest.permission.BLUETOOTH_PRIVILEGED,
                android.Manifest.permission.BLUETOOTH_PRIVILEGED,
            })
            })
@@ -355,9 +345,9 @@ public final class BluetoothA2dpSink implements BluetoothProfile {
    /**
    /**
     * Set connection policy of the profile
     * Set connection policy of the profile
     *
     *
     * <p> The device should already be paired.
     * <p>The device should already be paired. Connection policy can be one of {@link
     * Connection policy can be one of {@link #CONNECTION_POLICY_ALLOWED},
     * #CONNECTION_POLICY_ALLOWED}, {@link #CONNECTION_POLICY_FORBIDDEN}, {@link
     * {@link #CONNECTION_POLICY_FORBIDDEN}, {@link #CONNECTION_POLICY_UNKNOWN}
     * #CONNECTION_POLICY_UNKNOWN}
     *
     *
     * @param device Paired bluetooth device
     * @param device Paired bluetooth device
     * @param connectionPolicy is the connection policy to set to for this profile
     * @param connectionPolicy is the connection policy to set to for this profile
@@ -366,19 +356,21 @@ public final class BluetoothA2dpSink implements BluetoothProfile {
     */
     */
    @SystemApi
    @SystemApi
    @RequiresBluetoothConnectPermission
    @RequiresBluetoothConnectPermission
    @RequiresPermission(allOf = {
    @RequiresPermission(
            allOf = {
                android.Manifest.permission.BLUETOOTH_CONNECT,
                android.Manifest.permission.BLUETOOTH_CONNECT,
                android.Manifest.permission.BLUETOOTH_PRIVILEGED
                android.Manifest.permission.BLUETOOTH_PRIVILEGED
            })
            })
    public boolean setConnectionPolicy(@NonNull BluetoothDevice device,
    public boolean setConnectionPolicy(
            @ConnectionPolicy int connectionPolicy) {
            @NonNull BluetoothDevice device, @ConnectionPolicy int connectionPolicy) {
        if (DBG) log("setConnectionPolicy(" + device + ", " + connectionPolicy + ")");
        if (DBG) log("setConnectionPolicy(" + device + ", " + connectionPolicy + ")");
        final IBluetoothA2dpSink service = getService();
        final IBluetoothA2dpSink service = getService();
        final boolean defaultValue = false;
        final boolean defaultValue = false;
        if (service == null) {
        if (service == null) {
            Log.w(TAG, "Proxy not attached to service");
            Log.w(TAG, "Proxy not attached to service");
            if (DBG) log(Log.getStackTraceString(new Throwable()));
            if (DBG) log(Log.getStackTraceString(new Throwable()));
        } else if (isEnabled() && isValidDevice(device)
        } else if (isEnabled()
                && isValidDevice(device)
                && (connectionPolicy == BluetoothProfile.CONNECTION_POLICY_FORBIDDEN
                && (connectionPolicy == BluetoothProfile.CONNECTION_POLICY_FORBIDDEN
                        || connectionPolicy == BluetoothProfile.CONNECTION_POLICY_ALLOWED)) {
                        || connectionPolicy == BluetoothProfile.CONNECTION_POLICY_ALLOWED)) {
            try {
            try {
@@ -395,15 +387,16 @@ public final class BluetoothA2dpSink implements BluetoothProfile {
    /**
    /**
     * Get the priority of the profile.
     * Get the priority of the profile.
     *
     *
     * <p> The priority can be any of:
     * <p>The priority can be any of: {@link #PRIORITY_OFF}, {@link #PRIORITY_ON}, {@link
     * {@link #PRIORITY_OFF}, {@link #PRIORITY_ON}, {@link #PRIORITY_UNDEFINED}
     * #PRIORITY_UNDEFINED}
     *
     *
     * @param device Bluetooth device
     * @param device Bluetooth device
     * @return priority of the device
     * @return priority of the device
     * @hide
     * @hide
     */
     */
    @RequiresBluetoothConnectPermission
    @RequiresBluetoothConnectPermission
    @RequiresPermission(allOf = {
    @RequiresPermission(
            allOf = {
                android.Manifest.permission.BLUETOOTH_CONNECT,
                android.Manifest.permission.BLUETOOTH_CONNECT,
                android.Manifest.permission.BLUETOOTH_PRIVILEGED,
                android.Manifest.permission.BLUETOOTH_PRIVILEGED,
            })
            })
@@ -415,9 +408,8 @@ public final class BluetoothA2dpSink implements BluetoothProfile {
    /**
    /**
     * Get the connection policy of the profile.
     * Get the connection policy of the profile.
     *
     *
     * <p> The connection policy can be any of:
     * <p>The connection policy can be any of: {@link #CONNECTION_POLICY_ALLOWED}, {@link
     * {@link #CONNECTION_POLICY_ALLOWED}, {@link #CONNECTION_POLICY_FORBIDDEN},
     * #CONNECTION_POLICY_FORBIDDEN}, {@link #CONNECTION_POLICY_UNKNOWN}
     * {@link #CONNECTION_POLICY_UNKNOWN}
     *
     *
     * @param device Bluetooth device
     * @param device Bluetooth device
     * @return connection policy of the device
     * @return connection policy of the device
@@ -425,7 +417,8 @@ public final class BluetoothA2dpSink implements BluetoothProfile {
     */
     */
    @SystemApi
    @SystemApi
    @RequiresBluetoothConnectPermission
    @RequiresBluetoothConnectPermission
    @RequiresPermission(allOf = {
    @RequiresPermission(
            allOf = {
                android.Manifest.permission.BLUETOOTH_CONNECT,
                android.Manifest.permission.BLUETOOTH_CONNECT,
                android.Manifest.permission.BLUETOOTH_PRIVILEGED,
                android.Manifest.permission.BLUETOOTH_PRIVILEGED,
            })
            })
@@ -453,12 +446,12 @@ public final class BluetoothA2dpSink implements BluetoothProfile {
     *
     *
     * @param device BluetoothDevice device
     * @param device BluetoothDevice device
     * @return true if audio is playing (A2dp is streaming music), false otherwise
     * @return true if audio is playing (A2dp is streaming music), false otherwise
     *
     * @hide
     * @hide
     */
     */
    @SystemApi
    @SystemApi
    @RequiresBluetoothConnectPermission
    @RequiresBluetoothConnectPermission
    @RequiresPermission(allOf = {
    @RequiresPermission(
            allOf = {
                android.Manifest.permission.BLUETOOTH_CONNECT,
                android.Manifest.permission.BLUETOOTH_CONNECT,
                android.Manifest.permission.BLUETOOTH_PRIVILEGED,
                android.Manifest.permission.BLUETOOTH_PRIVILEGED,
            })
            })
@@ -484,7 +477,7 @@ public final class BluetoothA2dpSink implements BluetoothProfile {
    /**
    /**
     * Helper for converting a state to a string.
     * Helper for converting a state to a string.
     *
     *
     * For debug use only - strings are not internationalized.
     * <p>For debug use only - strings are not internationalized.
     *
     *
     * @hide
     * @hide
     */
     */
+33 −19
Original line number Original line Diff line number Diff line
@@ -29,9 +29,8 @@ import java.util.Collections;
import java.util.List;
import java.util.List;


/**
/**
 * Record of energy and activity information from controller and
 * Record of energy and activity information from controller and underlying bt stack state.Timestamp
 * underlying bt stack state.Timestamp the record with system
 * the record with system time.
 * time.
 *
 *
 * @hide
 * @hide
 */
 */
@@ -46,7 +45,9 @@ public final class BluetoothActivityEnergyInfo implements Parcelable {
    private List<UidTraffic> mUidTraffic;
    private List<UidTraffic> mUidTraffic;


    /** @hide */
    /** @hide */
    @IntDef(prefix = { "BT_STACK_STATE_" }, value = {
    @IntDef(
            prefix = {"BT_STACK_STATE_"},
            value = {
                BT_STACK_STATE_INVALID,
                BT_STACK_STATE_INVALID,
                BT_STACK_STATE_STATE_ACTIVE,
                BT_STACK_STATE_STATE_ACTIVE,
                BT_STACK_STATE_STATE_SCANNING,
                BT_STACK_STATE_STATE_SCANNING,
@@ -61,8 +62,13 @@ public final class BluetoothActivityEnergyInfo implements Parcelable {
    public static final int BT_STACK_STATE_STATE_IDLE = 3;
    public static final int BT_STACK_STATE_STATE_IDLE = 3;


    /** @hide */
    /** @hide */
    public BluetoothActivityEnergyInfo(long timestamp, int stackState,
    public BluetoothActivityEnergyInfo(
            long txTime, long rxTime, long idleTime, long energyUsed) {
            long timestamp,
            int stackState,
            long txTime,
            long rxTime,
            long idleTime,
            long energyUsed) {
        mTimestamp = timestamp;
        mTimestamp = timestamp;
        mBluetoothStackState = stackState;
        mBluetoothStackState = stackState;
        mControllerTxTimeMs = txTime;
        mControllerTxTimeMs = txTime;
@@ -86,13 +92,20 @@ public final class BluetoothActivityEnergyInfo implements Parcelable {
    @Override
    @Override
    public String toString() {
    public String toString() {
        return "BluetoothActivityEnergyInfo{"
        return "BluetoothActivityEnergyInfo{"
                + " mTimestamp=" + mTimestamp
                + " mTimestamp="
                + " mBluetoothStackState=" + mBluetoothStackState
                + mTimestamp
                + " mControllerTxTimeMs=" + mControllerTxTimeMs
                + " mBluetoothStackState="
                + " mControllerRxTimeMs=" + mControllerRxTimeMs
                + mBluetoothStackState
                + " mControllerIdleTimeMs=" + mControllerIdleTimeMs
                + " mControllerTxTimeMs="
                + " mControllerEnergyUsed=" + mControllerEnergyUsed
                + mControllerTxTimeMs
                + " mUidTraffic=" + mUidTraffic
                + " mControllerRxTimeMs="
                + mControllerRxTimeMs
                + " mControllerIdleTimeMs="
                + mControllerIdleTimeMs
                + " mControllerEnergyUsed="
                + mControllerEnergyUsed
                + " mUidTraffic="
                + mUidTraffic
                + " }";
                + " }";
    }
    }


@@ -193,7 +206,8 @@ public final class BluetoothActivityEnergyInfo implements Parcelable {
     * @return true if the record Tx time, Rx time, and Idle time are more than 0.
     * @return true if the record Tx time, Rx time, and Idle time are more than 0.
     */
     */
    public boolean isValid() {
    public boolean isValid() {
        return ((mControllerTxTimeMs >= 0) && (mControllerRxTimeMs >= 0)
        return ((mControllerTxTimeMs >= 0)
                && (mControllerRxTimeMs >= 0)
                && (mControllerIdleTimeMs >= 0));
                && (mControllerIdleTimeMs >= 0));
    }
    }
}
}
+1603 −1537

File changed.

Preview size limit exceeded, changes collapsed.

Loading