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

Commit dd4c27dd authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 7312245 from 5261468910d024cf57ea1756dbbebcfd3d1720cd to sc-release

Change-Id: I4a1ce7ca0835119eaecd1e802545aa011e43b098
parents ee16b2af 5c567501
Loading
Loading
Loading
Loading
+38 −21
Original line number Diff line number Diff line
@@ -473,7 +473,7 @@ public final class BluetoothA2dp implements BluetoothProfile {
            final IBluetoothA2dp service = getService();
            if (service != null && isEnabled()
                    && ((device == null) || isValidDevice(device))) {
                return service.setActiveDevice(device);
                return service.setActiveDevice(device, mAttributionSource);
            }
            if (service == null) Log.w(TAG, "Proxy not attached to service");
            return false;
@@ -500,7 +500,7 @@ public final class BluetoothA2dp implements BluetoothProfile {
        try {
            final IBluetoothA2dp service = getService();
            if (service != null && isEnabled()) {
                return service.getActiveDevice();
                return service.getActiveDevice(mAttributionSource);
            }
            if (service == null) Log.w(TAG, "Proxy not attached to service");
            return null;
@@ -560,7 +560,7 @@ public final class BluetoothA2dp implements BluetoothProfile {
                        && connectionPolicy != BluetoothProfile.CONNECTION_POLICY_ALLOWED) {
                    return false;
                }
                return service.setConnectionPolicy(device, connectionPolicy);
                return service.setConnectionPolicy(device, connectionPolicy, mAttributionSource);
            }
            if (service == null) Log.w(TAG, "Proxy not attached to service");
            return false;
@@ -590,7 +590,8 @@ public final class BluetoothA2dp implements BluetoothProfile {
            final IBluetoothA2dp service = getService();
            if (service != null && isEnabled()
                    && isValidDevice(device)) {
                return BluetoothAdapter.connectionPolicyToPriority(service.getPriority(device));
                return BluetoothAdapter.connectionPolicyToPriority(
                        service.getPriority(device, mAttributionSource));
            }
            if (service == null) Log.w(TAG, "Proxy not attached to service");
            return BluetoothProfile.PRIORITY_OFF;
@@ -612,14 +613,18 @@ public final class BluetoothA2dp implements BluetoothProfile {
     * @hide
     */
    @SystemApi
    @RequiresPermission(Manifest.permission.BLUETOOTH_PRIVILEGED)
    @RequiresBluetoothConnectPermission
    @RequiresPermission(allOf = {
            android.Manifest.permission.BLUETOOTH_CONNECT,
            android.Manifest.permission.BLUETOOTH_PRIVILEGED,
    })
    public @ConnectionPolicy int getConnectionPolicy(@NonNull BluetoothDevice device) {
        if (VDBG) log("getConnectionPolicy(" + device + ")");
        try {
            final IBluetoothA2dp service = getService();
            if (service != null && isEnabled()
                    && isValidDevice(device)) {
                return service.getConnectionPolicy(device);
                return service.getConnectionPolicy(device, mAttributionSource);
            }
            if (service == null) Log.w(TAG, "Proxy not attached to service");
            return BluetoothProfile.CONNECTION_POLICY_FORBIDDEN;
@@ -664,7 +669,7 @@ public final class BluetoothA2dp implements BluetoothProfile {
        try {
            final IBluetoothA2dp service = getService();
            if (service != null && isEnabled()) {
                service.setAvrcpAbsoluteVolume(volume);
                service.setAvrcpAbsoluteVolume(volume, mAttributionSource);
            }
            if (service == null) Log.w(TAG, "Proxy not attached to service");
        } catch (RemoteException e) {
@@ -685,7 +690,7 @@ public final class BluetoothA2dp implements BluetoothProfile {
            final IBluetoothA2dp service = getService();
            if (service != null && isEnabled()
                    && isValidDevice(device)) {
                return service.isA2dpPlaying(device);
                return service.isA2dpPlaying(device, mAttributionSource);
            }
            if (service == null) Log.w(TAG, "Proxy not attached to service");
            return false;
@@ -737,7 +742,7 @@ public final class BluetoothA2dp implements BluetoothProfile {
        try {
            final IBluetoothA2dp service = getService();
            if (service != null && isEnabled()) {
                return service.getCodecStatus(device);
                return service.getCodecStatus(device, mAttributionSource);
            }
            if (service == null) {
                Log.w(TAG, "Proxy not attached to service");
@@ -772,7 +777,7 @@ public final class BluetoothA2dp implements BluetoothProfile {
        try {
            final IBluetoothA2dp service = getService();
            if (service != null && isEnabled()) {
                service.setCodecConfigPreference(device, codecConfig);
                service.setCodecConfigPreference(device, codecConfig, mAttributionSource);
            }
            if (service == null) Log.w(TAG, "Proxy not attached to service");
            return;
@@ -829,9 +834,9 @@ public final class BluetoothA2dp implements BluetoothProfile {
            final IBluetoothA2dp service = getService();
            if (service != null && isEnabled()) {
                if (enable) {
                    service.enableOptionalCodecs(device);
                    service.enableOptionalCodecs(device, mAttributionSource);
                } else {
                    service.disableOptionalCodecs(device);
                    service.disableOptionalCodecs(device, mAttributionSource);
                }
            }
            if (service == null) Log.w(TAG, "Proxy not attached to service");
@@ -860,7 +865,7 @@ public final class BluetoothA2dp implements BluetoothProfile {
        try {
            final IBluetoothA2dp service = getService();
            if (service != null && isEnabled() && isValidDevice(device)) {
                return service.supportsOptionalCodecs(device);
                return service.supportsOptionalCodecs(device, mAttributionSource);
            }
            if (service == null) Log.w(TAG, "Proxy not attached to service");
            return OPTIONAL_CODECS_SUPPORT_UNKNOWN;
@@ -888,7 +893,7 @@ public final class BluetoothA2dp implements BluetoothProfile {
        try {
            final IBluetoothA2dp service = getService();
            if (service != null && isEnabled() && isValidDevice(device)) {
                return service.getOptionalCodecsEnabled(device);
                return service.getOptionalCodecsEnabled(device, mAttributionSource);
            }
            if (service == null) Log.w(TAG, "Proxy not attached to service");
            return OPTIONAL_CODECS_PREF_UNKNOWN;
@@ -924,7 +929,7 @@ public final class BluetoothA2dp implements BluetoothProfile {
            final IBluetoothA2dp service = getService();
            if (service != null && isEnabled()
                    && isValidDevice(device)) {
                service.setOptionalCodecsEnabled(device, value);
                service.setOptionalCodecsEnabled(device, value, mAttributionSource);
            }
            if (service == null) Log.w(TAG, "Proxy not attached to service");
            return;
@@ -946,13 +951,17 @@ public final class BluetoothA2dp implements BluetoothProfile {
     * @hide
     */
    @SystemApi
    @RequiresPermission(Manifest.permission.BLUETOOTH_PRIVILEGED)
    @RequiresBluetoothConnectPermission
    @RequiresPermission(allOf = {
            android.Manifest.permission.BLUETOOTH_CONNECT,
            android.Manifest.permission.BLUETOOTH_PRIVILEGED,
    })
    public @Type int getDynamicBufferSupport() {
        if (VDBG) log("getDynamicBufferSupport()");
        try {
            final IBluetoothA2dp service = getService();
            if (service != null && isEnabled()) {
                return service.getDynamicBufferSupport();
                return service.getDynamicBufferSupport(mAttributionSource);
            }
            if (service == null) Log.w(TAG, "Proxy not attached to service");
            return DYNAMIC_BUFFER_SUPPORT_NONE;
@@ -973,13 +982,17 @@ public final class BluetoothA2dp implements BluetoothProfile {
     * @hide
     */
    @SystemApi
    @RequiresPermission(Manifest.permission.BLUETOOTH_PRIVILEGED)
    @RequiresBluetoothConnectPermission
    @RequiresPermission(allOf = {
            android.Manifest.permission.BLUETOOTH_CONNECT,
            android.Manifest.permission.BLUETOOTH_PRIVILEGED,
    })
    public @Nullable BufferConstraints getBufferConstraints() {
        if (VDBG) log("getBufferConstraints()");
        try {
            final IBluetoothA2dp service = getService();
            if (service != null && isEnabled()) {
                return service.getBufferConstraints();
                return service.getBufferConstraints(mAttributionSource);
            }
            if (service == null) Log.w(TAG, "Proxy not attached to service");
            return null;
@@ -999,14 +1012,18 @@ public final class BluetoothA2dp implements BluetoothProfile {
     * @hide
     */
    @SystemApi
    @RequiresPermission(Manifest.permission.BLUETOOTH_PRIVILEGED)
    @RequiresBluetoothConnectPermission
    @RequiresPermission(allOf = {
            android.Manifest.permission.BLUETOOTH_CONNECT,
            android.Manifest.permission.BLUETOOTH_PRIVILEGED,
    })
    public boolean setBufferLengthMillis(@BluetoothCodecConfig.SourceCodecType int codec,
            int value) {
        if (VDBG) log("setBufferLengthMillis(" + codec + ", " + value + ")");
        try {
            final IBluetoothA2dp service = getService();
            if (service != null && isEnabled()) {
                return service.setBufferLengthMillis(codec, value);
                return service.setBufferLengthMillis(codec, value, mAttributionSource);
            }
            if (service == null) Log.w(TAG, "Proxy not attached to service");
            return false;
+30 −13
Original line number Diff line number Diff line
@@ -132,13 +132,17 @@ public final class BluetoothA2dpSink implements BluetoothProfile {
     * @return false on immediate error, true otherwise
     * @hide
     */
    @RequiresPermission(Manifest.permission.BLUETOOTH_PRIVILEGED)
    @RequiresBluetoothConnectPermission
    @RequiresPermission(allOf = {
            android.Manifest.permission.BLUETOOTH_CONNECT,
            android.Manifest.permission.BLUETOOTH_PRIVILEGED,
    })
    public boolean connect(BluetoothDevice device) {
        if (DBG) log("connect(" + device + ")");
        final IBluetoothA2dpSink service = getService();
        if (service != null && isEnabled() && isValidDevice(device)) {
            try {
                return service.connect(device);
                return service.connect(device, mAttributionSource);
            } catch (RemoteException e) {
                Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable()));
                return false;
@@ -179,7 +183,7 @@ public final class BluetoothA2dpSink implements BluetoothProfile {
        final IBluetoothA2dpSink service = getService();
        if (service != null && isEnabled() && isValidDevice(device)) {
            try {
                return service.disconnect(device);
                return service.disconnect(device, mAttributionSource);
            } catch (RemoteException e) {
                Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable()));
                return false;
@@ -203,7 +207,7 @@ public final class BluetoothA2dpSink implements BluetoothProfile {
        if (service != null && isEnabled()) {
            try {
                return BluetoothDevice.setAttributionSource(
                        service.getConnectedDevices(), mAttributionSource);
                        service.getConnectedDevices(mAttributionSource), mAttributionSource);
            } catch (RemoteException e) {
                Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable()));
                return new ArrayList<BluetoothDevice>();
@@ -227,7 +231,8 @@ public final class BluetoothA2dpSink implements BluetoothProfile {
        if (service != null && isEnabled()) {
            try {
                return BluetoothDevice.setAttributionSource(
                        service.getDevicesMatchingConnectionStates(states), mAttributionSource);
                        service.getDevicesMatchingConnectionStates(states, mAttributionSource),
                        mAttributionSource);
            } catch (RemoteException e) {
                Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable()));
                return new ArrayList<BluetoothDevice>();
@@ -250,7 +255,7 @@ public final class BluetoothA2dpSink implements BluetoothProfile {
        final IBluetoothA2dpSink service = getService();
        if (service != null && isEnabled() && isValidDevice(device)) {
            try {
                return service.getConnectionState(device);
                return service.getConnectionState(device, mAttributionSource);
            } catch (RemoteException e) {
                Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable()));
                return BluetoothProfile.STATE_DISCONNECTED;
@@ -279,7 +284,7 @@ public final class BluetoothA2dpSink implements BluetoothProfile {
        final IBluetoothA2dpSink service = getService();
        if (service != null && isEnabled() && isValidDevice(device)) {
            try {
                return service.getAudioConfig(device);
                return service.getAudioConfig(device, mAttributionSource);
            } catch (RemoteException e) {
                Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable()));
                return null;
@@ -338,7 +343,7 @@ public final class BluetoothA2dpSink implements BluetoothProfile {
                return false;
            }
            try {
                return service.setConnectionPolicy(device, connectionPolicy);
                return service.setConnectionPolicy(device, connectionPolicy, mAttributionSource);
            } catch (RemoteException e) {
                Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable()));
                return false;
@@ -358,7 +363,11 @@ public final class BluetoothA2dpSink implements BluetoothProfile {
     * @return priority of the device
     * @hide
     */
    @RequiresPermission(Manifest.permission.BLUETOOTH_PRIVILEGED)
    @RequiresBluetoothConnectPermission
    @RequiresPermission(allOf = {
            android.Manifest.permission.BLUETOOTH_CONNECT,
            android.Manifest.permission.BLUETOOTH_PRIVILEGED,
    })
    public int getPriority(BluetoothDevice device) {
        if (VDBG) log("getPriority(" + device + ")");
        return BluetoothAdapter.connectionPolicyToPriority(getConnectionPolicy(device));
@@ -376,13 +385,17 @@ public final class BluetoothA2dpSink implements BluetoothProfile {
     * @hide
     */
    @SystemApi
    @RequiresPermission(Manifest.permission.BLUETOOTH_PRIVILEGED)
    @RequiresBluetoothConnectPermission
    @RequiresPermission(allOf = {
            android.Manifest.permission.BLUETOOTH_CONNECT,
            android.Manifest.permission.BLUETOOTH_PRIVILEGED,
    })
    public @ConnectionPolicy int getConnectionPolicy(@NonNull BluetoothDevice device) {
        if (VDBG) log("getConnectionPolicy(" + device + ")");
        final IBluetoothA2dpSink service = getService();
        if (service != null && isEnabled() && isValidDevice(device)) {
            try {
                return service.getConnectionPolicy(device);
                return service.getConnectionPolicy(device, mAttributionSource);
            } catch (RemoteException e) {
                Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable()));
                return BluetoothProfile.CONNECTION_POLICY_FORBIDDEN;
@@ -401,12 +414,16 @@ public final class BluetoothA2dpSink implements BluetoothProfile {
     * @hide
     */
    @SystemApi
    @RequiresPermission(Manifest.permission.BLUETOOTH_PRIVILEGED)
    @RequiresBluetoothConnectPermission
    @RequiresPermission(allOf = {
            android.Manifest.permission.BLUETOOTH_CONNECT,
            android.Manifest.permission.BLUETOOTH_PRIVILEGED,
    })
    public boolean isAudioPlaying(@NonNull BluetoothDevice device) {
        final IBluetoothA2dpSink service = getService();
        if (service != null && isEnabled() && isValidDevice(device)) {
            try {
                return service.isA2dpPlaying(device);
                return service.isA2dpPlaying(device, mAttributionSource);
            } catch (RemoteException e) {
                Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable()));
                return false;
+15 −14
Original line number Diff line number Diff line
@@ -981,7 +981,7 @@ public final class BluetoothAdapter {
        }
        String packageName = ActivityThread.currentPackageName();
        try {
            return mManagerService.disableBle(packageName, mToken);
            return mManagerService.disableBle(mAttributionSource, mToken);
        } catch (RemoteException e) {
            Log.e(TAG, "", e);
        }
@@ -1028,7 +1028,7 @@ public final class BluetoothAdapter {
        }
        String packageName = ActivityThread.currentPackageName();
        try {
            return mManagerService.enableBle(packageName, mToken);
            return mManagerService.enableBle(mAttributionSource, mToken);
        } catch (RemoteException e) {
            Log.e(TAG, "", e);
        }
@@ -1193,7 +1193,7 @@ public final class BluetoothAdapter {
            return true;
        }
        try {
            return mManagerService.enable(ActivityThread.currentPackageName());
            return mManagerService.enable(mAttributionSource);
        } catch (RemoteException e) {
            Log.e(TAG, "", e);
        }
@@ -1226,7 +1226,7 @@ public final class BluetoothAdapter {
    @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)
    public boolean disable() {
        try {
            return mManagerService.disable(ActivityThread.currentPackageName(), true);
            return mManagerService.disable(mAttributionSource, true);
        } catch (RemoteException e) {
            Log.e(TAG, "", e);
        }
@@ -1246,7 +1246,7 @@ public final class BluetoothAdapter {
    public boolean disable(boolean persist) {

        try {
            return mManagerService.disable(ActivityThread.currentPackageName(), persist);
            return mManagerService.disable(mAttributionSource, persist);
        } catch (RemoteException e) {
            Log.e(TAG, "", e);
        }
@@ -1267,7 +1267,7 @@ public final class BluetoothAdapter {
    })
    public String getAddress() {
        try {
            return mManagerService.getAddress();
            return mManagerService.getAddress(mAttributionSource);
        } catch (RemoteException e) {
            Log.e(TAG, "", e);
        }
@@ -1285,7 +1285,7 @@ public final class BluetoothAdapter {
    @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)
    public String getName() {
        try {
            return mManagerService.getName();
            return mManagerService.getName(mAttributionSource);
        } catch (RemoteException e) {
            Log.e(TAG, "", e);
        }
@@ -1297,7 +1297,7 @@ public final class BluetoothAdapter {
    @RequiresPermission(android.Manifest.permission.BLUETOOTH_ADVERTISE)
    public int getNameLengthForAdvertise() {
        try {
            return mService.getNameLengthForAdvertise();
            return mService.getNameLengthForAdvertise(mAttributionSource);
        } catch (RemoteException e) {
            Log.e(TAG, "", e);
        }
@@ -1316,7 +1316,8 @@ public final class BluetoothAdapter {
        try {
            mServiceLock.readLock().lock();
            if (mService != null && mService.factoryReset()
                    && mManagerService != null && mManagerService.onFactoryReset()) {
                    && mManagerService != null
                    && mManagerService.onFactoryReset(mAttributionSource)) {
                return true;
            }
            Log.e(TAG, "factoryReset(): Setting persist.bluetooth.factoryreset to retry later");
@@ -1910,7 +1911,7 @@ public final class BluetoothAdapter {
            mServiceLock.readLock().lock();
            if (mService != null) {
                if (DBG) Log.d(TAG, "removeActiveDevice, profiles: " + profiles);
                return mService.removeActiveDevice(profiles);
                return mService.removeActiveDevice(profiles, mAttributionSource);
            }
        } catch (RemoteException e) {
            Log.e(TAG, "", e);
@@ -1962,7 +1963,7 @@ public final class BluetoothAdapter {
                if (DBG) {
                    Log.d(TAG, "setActiveDevice, device: " + device + ", profiles: " + profiles);
                }
                return mService.setActiveDevice(device, profiles);
                return mService.setActiveDevice(device, profiles, mAttributionSource);
            }
        } catch (RemoteException e) {
            Log.e(TAG, "", e);
@@ -1995,7 +1996,7 @@ public final class BluetoothAdapter {
        try {
            mServiceLock.readLock().lock();
            if (mService != null) {
                return mService.connectAllEnabledProfiles(device);
                return mService.connectAllEnabledProfiles(device, mAttributionSource);
            }
        } catch (RemoteException e) {
            Log.e(TAG, "", e);
@@ -2027,7 +2028,7 @@ public final class BluetoothAdapter {
        try {
            mServiceLock.readLock().lock();
            if (mService != null) {
                return mService.disconnectAllEnabledProfiles(device);
                return mService.disconnectAllEnabledProfiles(device, mAttributionSource);
            }
        } catch (RemoteException e) {
            Log.e(TAG, "", e);
@@ -3219,7 +3220,7 @@ public final class BluetoothAdapter {
            return true;
        }
        try {
            return mManagerService.enableNoAutoConnect(ActivityThread.currentPackageName());
            return mManagerService.enableNoAutoConnect(mAttributionSource);
        } catch (RemoteException e) {
            Log.e(TAG, "", e);
        }
+7 −6
Original line number Diff line number Diff line
@@ -136,7 +136,7 @@ public final class BluetoothAvrcpController implements BluetoothProfile {
        if (service != null && isEnabled()) {
            try {
                return BluetoothDevice.setAttributionSource(
                        service.getConnectedDevices(), mAttributionSource);
                        service.getConnectedDevices(mAttributionSource), mAttributionSource);
            } catch (RemoteException e) {
                Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable()));
                return new ArrayList<BluetoothDevice>();
@@ -159,7 +159,8 @@ public final class BluetoothAvrcpController implements BluetoothProfile {
        if (service != null && isEnabled()) {
            try {
                return BluetoothDevice.setAttributionSource(
                        service.getDevicesMatchingConnectionStates(states), mAttributionSource);
                        service.getDevicesMatchingConnectionStates(states, mAttributionSource),
                        mAttributionSource);
            } catch (RemoteException e) {
                Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable()));
                return new ArrayList<BluetoothDevice>();
@@ -181,7 +182,7 @@ public final class BluetoothAvrcpController implements BluetoothProfile {
                getService();
        if (service != null && isEnabled() && isValidDevice(device)) {
            try {
                return service.getConnectionState(device);
                return service.getConnectionState(device, mAttributionSource);
            } catch (RemoteException e) {
                Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable()));
                return BluetoothProfile.STATE_DISCONNECTED;
@@ -205,7 +206,7 @@ public final class BluetoothAvrcpController implements BluetoothProfile {
                getService();
        if (service != null && isEnabled()) {
            try {
                settings = service.getPlayerSettings(device);
                settings = service.getPlayerSettings(device, mAttributionSource);
            } catch (RemoteException e) {
                Log.e(TAG, "Error talking to BT service in getMetadata() " + e);
                return null;
@@ -226,7 +227,7 @@ public final class BluetoothAvrcpController implements BluetoothProfile {
                getService();
        if (service != null && isEnabled()) {
            try {
                return service.setPlayerApplicationSetting(plAppSetting);
                return service.setPlayerApplicationSetting(plAppSetting, mAttributionSource);
            } catch (RemoteException e) {
                Log.e(TAG, "Error talking to BT service in setPlayerApplicationSetting() " + e);
                return false;
@@ -249,7 +250,7 @@ public final class BluetoothAvrcpController implements BluetoothProfile {
                getService();
        if (service != null && isEnabled()) {
            try {
                service.sendGroupNavigationCmd(device, keyCode, keyState);
                service.sendGroupNavigationCmd(device, keyCode, keyState, mAttributionSource);
                return;
            } catch (RemoteException e) {
                Log.e(TAG, "Error talking to BT service in sendGroupNavigationCmd()", e);
+1 −3
Original line number Diff line number Diff line
@@ -1376,9 +1376,7 @@ public final class BluetoothDevice implements Parcelable {
            return false;
        }
        try {
            return service.setRemoteAlias(this, alias,
                    mAttributionSource.getPackageName(),
                    mAttributionSource);
            return service.setRemoteAlias(this, alias, mAttributionSource);
        } catch (RemoteException e) {
            Log.e(TAG, "", e);
        }
Loading