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

Commit 1f265a6f authored by Alina Zaidi's avatar Alina Zaidi
Browse files

Cache last focussed display id in LocalBluetoothManager

This is used by Bluetooth paring dialog to make sure it opens on external display when triggered from external display

Bug: 416872340
Flag: EXEMPT, usage of the new method to query the cached display id will be flag guard
Test: manually tested that the dialog opens on external display when triggered from external display

Change-Id: I6976954e018b4013bc3886c67e151fe54c1e3b1b
parent adade2db
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -52,6 +52,7 @@ public class LocalBluetoothManager {

    /** The broadcast receiver event manager. */
    private final BluetoothEventManager mEventManager;
    private int mCachedFocussedDisplayId = -1;

    @Nullable
    public static synchronized LocalBluetoothManager getInstance(Context context,
@@ -149,6 +150,7 @@ public class LocalBluetoothManager {
        if (context != null) {
            Log.d(TAG, "setting foreground activity to non-null context");
            mForegroundActivity = new WeakReference<>(context);
            mCachedFocussedDisplayId = context.getDisplayId();
        } else {
            if (mForegroundActivity != null) {
                Log.d(TAG, "setting foreground activity to null");
@@ -169,6 +171,11 @@ public class LocalBluetoothManager {
        return mProfileManager;
    }

    /** The displayId cached from the latest focussed display. */
    public int getCachedFocussedDisplayId() {
        return mCachedFocussedDisplayId;
    }

    public interface BluetoothManagerCallback {
        void onBluetoothManagerInitialized(Context appContext,
                LocalBluetoothManager bluetoothManager);