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

Commit bbd05d76 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Revert "Removed BluetoothDevice#prepareToEnterProcess"" am: 168b5655...

Merge "Revert "Removed BluetoothDevice#prepareToEnterProcess"" am: 168b5655 am: a3b55d50 am: 17059798 am: fddbf6e9 am: 92bf843d

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1869964

Change-Id: Ib926a6c45bead4e50de93a371b97bfadad2a9fb0
parents cff20397 92bf843d
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -1186,6 +1186,11 @@ public final class BluetoothDevice implements Parcelable, Attributable {
        mAttributionSource = attributionSource;
    }

    /** {@hide} */
    public void prepareToEnterProcess(@NonNull AttributionSource attributionSource) {
        setAttributionSource(attributionSource);
    }

    @Override
    public boolean equals(@Nullable Object o) {
        if (o instanceof BluetoothDevice) {
+5 −8
Original line number Diff line number Diff line
@@ -62,15 +62,15 @@ public final class BluetoothManager {
    private static final String TAG = "BluetoothManager";
    private static final boolean DBG = false;

    private static AttributionSource sAttributionSource = null;
    private final AttributionSource mAttributionSource;
    private final BluetoothAdapter mAdapter;

    /**
     * @hide
     */
    public BluetoothManager(Context context) {
        sAttributionSource = resolveAttributionSource(context);
        mAdapter = BluetoothAdapter.createAdapter(sAttributionSource);
        mAttributionSource = resolveAttributionSource(context);
        mAdapter = BluetoothAdapter.createAdapter(mAttributionSource);
    }

    /** {@hide} */
@@ -79,9 +79,6 @@ public final class BluetoothManager {
        if (context != null) {
            res = context.getAttributionSource();
        }
        else if (sAttributionSource != null) {
            return sAttributionSource;
        }
        if (res == null) {
            res = ActivityThread.currentAttributionSource();
        }
@@ -201,8 +198,8 @@ public final class BluetoothManager {
            IBluetoothGatt iGatt = managerService.getBluetoothGatt();
            if (iGatt == null) return devices;
            devices = Attributable.setAttributionSource(
                    iGatt.getDevicesMatchingConnectionStates(states, sAttributionSource),
                    sAttributionSource);
                    iGatt.getDevicesMatchingConnectionStates(states, mAttributionSource),
                    mAttributionSource);
        } catch (RemoteException e) {
            Log.e(TAG, "", e);
        }
+11 −0
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ import android.annotation.SystemApi;
import android.annotation.TestApi;
import android.app.ActivityThread;
import android.app.AppGlobals;
import android.bluetooth.BluetoothDevice;
import android.compat.annotation.UnsupportedAppUsage;
import android.content.pm.ActivityInfo;
import android.content.pm.ApplicationInfo;
@@ -11688,6 +11689,16 @@ public class Intent implements Parcelable, Cloneable {
        if (fromProtectedComponent) {
            mLocalFlags |= LOCAL_FLAG_FROM_PROTECTED_COMPONENT;
        }

        // Special attribution fix-up logic for any BluetoothDevice extras
        // passed via Bluetooth intents
        if (mAction != null && mAction.startsWith("android.bluetooth.")
                && hasExtra(BluetoothDevice.EXTRA_DEVICE)) {
            final BluetoothDevice device = getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
            if (device != null) {
                device.prepareToEnterProcess(source);
            }
        }
    }

    /** @hide */