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

Commit 5d93c985 authored by Aishwarya Mallampati's avatar Aishwarya Mallampati
Browse files

Change mIsSatelliteServiceSupported to AtomicBoolean

Bug: 410895465
Test: atest
Test: 411247349
Flag: com.android.internal.telephony.flags.satellite_improve_multi_thread_design
Change-Id: I31d8133ace0778aac2b70f56c75947fbe133da7c
parent bb15e8fa
Loading
Loading
Loading
Loading
+5 −7
Original line number Diff line number Diff line
@@ -84,12 +84,10 @@ public class SatelliteModemInterface {
    /** All the atomic variables are declared here. */
    private AtomicBoolean mIsBound = new AtomicBoolean(false);
    private AtomicBoolean mIsBinding = new AtomicBoolean(false);
    // {@code true} to use the vendor satellite service and {@code false} to use the HAL.
    private AtomicBoolean mIsSatelliteServiceSupported = new AtomicBoolean(false);

    @NonNull private final Object mLock = new Object();
    /**
     * {@code true} to use the vendor satellite service and {@code false} to use the HAL.
     */
    private boolean mIsSatelliteServiceSupported;
    @Nullable private ISatellite mSatelliteService;
    @Nullable private SatelliteServiceConnection mSatelliteServiceConnection;
    @NonNull private String mVendorSatellitePackageName = "";
@@ -266,7 +264,7 @@ public class SatelliteModemInterface {
        mDemoSimulator = DemoSimulator.make(context, satelliteController);
        mVendorListener = new SatelliteListener(false);
        mDemoListener = new SatelliteListener(true);
        mIsSatelliteServiceSupported = getSatelliteServiceSupport();
        mIsSatelliteServiceSupported.set(getSatelliteServiceSupport());
        mSatelliteController = satelliteController;
        mExponentialBackoff = new ExponentialBackoff(REBIND_INITIAL_DELAY, REBIND_MAXIMUM_DELAY,
                REBIND_MULTIPLIER, looper, () -> {
@@ -1299,7 +1297,7 @@ public class SatelliteModemInterface {
    }

    public boolean isSatelliteServiceSupported() {
        return mIsSatelliteServiceSupported;
        return mIsSatelliteServiceSupported.get();
    }

    /** Check if vendor satellite service is connected */
@@ -1360,7 +1358,7 @@ public class SatelliteModemInterface {
        } else {
            mVendorSatellitePackageName = servicePackageName;
        }
        mIsSatelliteServiceSupported = getSatelliteServiceSupport();
        mIsSatelliteServiceSupported.set(getSatelliteServiceSupport());
        bindService();
        mExponentialBackoff.start();
    }