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

Commit d8ca37ec authored by Sungcheol Ahn's avatar Sungcheol Ahn
Browse files

Fixed to not show any notification if the carrier do not support the satellite

- Trigger if SelectedSatelliteSubId is valid

Bug: 382062074 383117423
Test: Manally tested Satellite
FLAG: EXEMPT bugfix
Change-Id: I298f597b93dd97014f3c9f0c15dd179969edc930
parent 578bb132
Loading
Loading
Loading
Loading
+40 −1
Original line number Diff line number Diff line
@@ -642,6 +642,7 @@ public class SatelliteController extends Handler {
    private static final String NOTIFICATION_CHANNEL_ID = "satellite";

    private final RegistrantList mSatelliteConfigUpdateChangedRegistrants = new RegistrantList();
    private final RegistrantList mSatelliteSubIdChangedRegistrants = new RegistrantList();
    private final BTWifiNFCStateReceiver mBTWifiNFCSateReceiver;
    private final UwbAdapterStateCallback mUwbAdapterStateCallback;

@@ -1004,6 +1005,24 @@ public class SatelliteController extends Handler {
        mSatelliteConfigUpdateChangedRegistrants.remove(h);
    }

    /**
     * Register a callback to change the satelliteSubId.
     * @param h Handler to notify
     * @param what msg.what when the message is delivered
     * @param obj AsyncResult.userObj when the message is delivered
     */
    public void registerForSatelliteSubIdChanged(Handler h, int what, Object obj) {
        Registrant r = new Registrant(h, what, obj);
        mSatelliteSubIdChangedRegistrants.add(r);
    }

    /**
     * Unregister a callback to get a updated satellite config data.
     * @param h Handler to notify
     */
    public void unregisterForSatelliteSubIdChanged(Handler h) {
        mSatelliteSubIdChangedRegistrants.remove(h);
    }
    /**
     * Get satelliteConfig from SatelliteConfigParser
     */
@@ -6255,6 +6274,12 @@ public class SatelliteController extends Handler {
                    if (info.isSatelliteESOSSupported()) {
                        if (mSubscriptionManagerService.isSatelliteProvisionedForNonIpDatagram(
                                info.getSubscriptionId())) {
                            Pair<String, Integer> subscriberIdPair = getSubscriberIdAndType(
                                    mSubscriptionManagerService.getSubscriptionInfo(subId));
                            String subscriberId = subscriberIdPair.first;
                            synchronized (mSatelliteTokenProvisionedLock) {
                                mProvisionedSubscriberId.put(subscriberId, true);
                            }
                            return true;
                        }
                    }
@@ -6578,7 +6603,16 @@ public class SatelliteController extends Handler {
        if(isSatelliteSupported == null) {
            return false;
        }
        return notifySatelliteAvailabilityEnabled && isSatelliteSupported;
        int subId = getSelectedSatelliteSubId();
        SubscriptionInfo subInfo = mSubscriptionManagerService.getSubscriptionInfo(subId);
        logd("isSatelliteSystemNotificationsEnabled: SatelliteSubId = " + subId);
        return notifySatelliteAvailabilityEnabled
                && isSatelliteSupported
                && isValidSubscriptionId(subId)
                && ((isSatelliteSupportedViaCarrier(subId)
                && (getCarrierRoamingNtnConnectType(subId)
                == CarrierConfigManager.CARRIER_ROAMING_NTN_CONNECT_MANUAL))
                || subInfo.isOnlyNonTerrestrialNetwork());
    }

    /**
@@ -7413,7 +7447,12 @@ public class SatelliteController extends Handler {
        }

        synchronized (mSatelliteTokenProvisionedLock) {
            int preSelectedSatelliteSubId = mSelectedSatelliteSubId;
            mSelectedSatelliteSubId = selectedSubId;
            if (preSelectedSatelliteSubId != mSelectedSatelliteSubId) {
                plogd("selectBindingSatelliteSubscription: SelectedSatelliteSubId changed");
                mSatelliteSubIdChangedRegistrants.notifyRegistrants();
            }
        }
        setSatellitePhone(selectedSubId);
        if (selectedSubId != SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
+8 −0
Original line number Diff line number Diff line
@@ -4336,6 +4336,7 @@ public class SatelliteControllerTest extends TelephonyTest {
        // 2 minutes later and hysteresis timeout is 1 minute
        mSatelliteControllerUT.elapsedRealtime = 2 * 60 * 1000;
        moveTimeForward(2 * 60 * 1000);
        mSatelliteControllerUT.selectedSatelliteSubId = SUB_ID1;
        processAllMessages();
        assertTrue(mSatelliteControllerUT.isCarrierRoamingNtnEligible(mPhone));
        verify(mPhone, times(1)).notifyCarrierRoamingNtnEligibleStateChanged(eq(true));
@@ -5044,6 +5045,7 @@ public class SatelliteControllerTest extends TelephonyTest {
                        getKeyPriority(testSubscriptionInfo2), k -> new ArrayList<>())
                .add(testSubscriptionInfo2);

        mSatelliteControllerUT.selectedSatelliteSubId = SUB_ID1;
        mSatelliteControllerUT.evaluateESOSProfilesPrioritizationTest();
        processAllMessages();
        assertEquals(oemSubId, mSatelliteControllerUT.getSelectedSatelliteSubId());
@@ -5060,6 +5062,7 @@ public class SatelliteControllerTest extends TelephonyTest {
                        getKeyPriority(testSubscriptionInfo2), k -> new ArrayList<>())
                .add(testSubscriptionInfo2);

        mSatelliteControllerUT.selectedSatelliteSubId = SUB_ID;
        mSatelliteControllerUT.evaluateESOSProfilesPrioritizationTest();
        processAllMessages();
        assertEquals(carrierSubId, mSatelliteControllerUT.getSelectedSatelliteSubId());
@@ -6165,6 +6168,7 @@ public class SatelliteControllerTest extends TelephonyTest {
        public String packageName = "com.example.app";
        public boolean isSatelliteBeingDisabled = false;
        public boolean mIsApplicationSupportsP2P = false;
        public int selectedSatelliteSubId = -1;

        TestSatelliteController(
                Context context, Looper looper, @NonNull FeatureFlags featureFlags) {
@@ -6267,6 +6271,10 @@ public class SatelliteControllerTest extends TelephonyTest {
            return new int[]{3, 5};
        }

        @Override
        public int getSelectedSatelliteSubId() {
            return selectedSatelliteSubId;
        }

        void setSatelliteProvisioned(@Nullable Boolean isProvisioned) {
            synchronized (mDeviceProvisionLock) {