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

Commit 48e41ffb authored by Evan Chen's avatar Evan Chen
Browse files

Fix UI flicker issue when selecting the device

Test: cts
Fix: 393509673
Flag: EXEMPT test fix
Change-Id: Ic950806bcc48e85ee0bb4b33e27b4c648f3d11d9
parent 7572fb79
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -65,6 +65,7 @@ import android.graphics.drawable.Icon;
import android.net.MacAddress;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.RemoteException;
import android.os.ResultReceiver;
import android.text.Spanned;
@@ -621,8 +622,10 @@ public class CompanionAssociationActivity extends FragmentActivity implements
            Slog.w(TAG, "Already selected.");
            return;
        }
        // Notify the adapter to highlight the selected item.
        mDeviceAdapter.setSelectedPosition(position);
        // Delay highlighting the selected item by posting to the main thread.
        // This helps avoid flicker in the user consent dialog after device selection.
        new Handler(
                Looper.getMainLooper()).post(() -> mDeviceAdapter.setSelectedPosition(position));

        mSelectedDevice = requireNonNull(selectedDevice);