Loading src/java/com/android/internal/telephony/satellite/SatelliteSOSMessageRecommender.java +29 −34 Original line number Diff line number Diff line Loading @@ -98,6 +98,7 @@ public class SatelliteSOSMessageRecommender extends Handler { private static final int CMD_SEND_EVENT_DISPLAY_EMERGENCY_MESSAGE_FORCEFULLY = 6; private static final int EVENT_SATELLITE_ACCESS_RESTRICTION_CHECKING_RESULT = 7; /** All the variables initialized inside the constructor are declared here. */ @NonNull private final Context mContext; @NonNull private final SatelliteController mSatelliteController; Loading @@ -106,29 +107,31 @@ public class SatelliteSOSMessageRecommender extends Handler { private ImsManager mImsManager; @NonNull private final FeatureFlags mFeatureFlags; @Nullable private PersistentLogger mPersistentLogger = null; private final ISatelliteProvisionStateCallback mISatelliteProvisionStateCallback; /** All the atomic variables are declared here. */ private AtomicBoolean mIsSatelliteAllowedForCurrentLocation = new AtomicBoolean(false); private AtomicBoolean mCheckingAccessRestrictionInProgress = new AtomicBoolean(false); protected final AtomicBoolean mIsSatelliteConnectedViaCarrierWithinHysteresisTime = new AtomicBoolean(false); protected final AtomicInteger mSubIdOfSatelliteConnectedViaCarrierWithinHysteresisTime = new AtomicInteger(SubscriptionManager.INVALID_SUBSCRIPTION_ID); private Connection mEmergencyConnection = null; private final ISatelliteProvisionStateCallback mISatelliteProvisionStateCallback; /** Key: Phone ID; Value: IMS RegistrationCallback */ private SparseArray<RegistrationManager.RegistrationCallback> mImsRegistrationCallbacks = new SparseArray<>(); @GuardedBy("mLock") private boolean mIsSatelliteAllowedForCurrentLocation = false; @GuardedBy("mLock") private boolean mCheckingAccessRestrictionInProgress = false; protected long mTimeoutMillis = 0; private final long mOemEnabledTimeoutMillis; protected final AtomicBoolean mIsSatelliteConnectedViaCarrierWithinHysteresisTime = new AtomicBoolean(false); protected final AtomicInteger mSubIdOfSatelliteConnectedViaCarrierWithinHysteresisTime = new AtomicInteger(SubscriptionManager.INVALID_SUBSCRIPTION_ID); @GuardedBy("mLock") private boolean mIsTimerTimedOut = false; protected int mCountOfTimerStarted = 0; private final Object mLock = new Object(); @Nullable private PersistentLogger mPersistentLogger = null; private boolean mIsTestEmergencyNumber = false; /** Loading Loading @@ -299,10 +302,8 @@ public class SatelliteSOSMessageRecommender extends Handler { mEmergencyConnection = connection; handleStateChangedEventForHysteresisTimer(); synchronized (mLock) { mCheckingAccessRestrictionInProgress = false; mIsSatelliteAllowedForCurrentLocation = false; } mCheckingAccessRestrictionInProgress.set(false); mIsSatelliteAllowedForCurrentLocation.set(false); } private void handleSatelliteProvisionStateChangedEvent(boolean provisioned) { Loading @@ -326,10 +327,10 @@ public class SatelliteSOSMessageRecommender extends Handler { return; } if (!mIsTimerTimedOut || mCheckingAccessRestrictionInProgress) { if (!mIsTimerTimedOut || mCheckingAccessRestrictionInProgress.get()) { plogd("mIsTimerTimedOut=" + mIsTimerTimedOut + ", mCheckingAccessRestrictionInProgress=" + mCheckingAccessRestrictionInProgress); + mCheckingAccessRestrictionInProgress.get()); return; } Loading Loading @@ -366,10 +367,8 @@ public class SatelliteSOSMessageRecommender extends Handler { } private boolean isSatelliteAllowed() { synchronized (mLock) { if (isSatelliteEmergencyMessagingViaCarrierAvailable()) return true; return mIsSatelliteAllowedForCurrentLocation; } return mIsSatelliteAllowedForCurrentLocation.get(); } private void updateSatelliteViaCarrierAvailability() { Loading Loading @@ -459,8 +458,8 @@ public class SatelliteSOSMessageRecommender extends Handler { mEmergencyConnection = null; mCountOfTimerStarted = 0; mIsTimerTimedOut = false; mCheckingAccessRestrictionInProgress = false; mIsSatelliteAllowedForCurrentLocation = false; mCheckingAccessRestrictionInProgress.set(false); mIsSatelliteAllowedForCurrentLocation.set(false); mIsTestEmergencyNumber = false; } } Loading Loading @@ -564,12 +563,10 @@ public class SatelliteSOSMessageRecommender extends Handler { } private void handleSatelliteAccessRestrictionCheckingResult(boolean satelliteAllowed) { synchronized (mLock) { mIsSatelliteAllowedForCurrentLocation = satelliteAllowed; mCheckingAccessRestrictionInProgress = false; mIsSatelliteAllowedForCurrentLocation.set(satelliteAllowed); mCheckingAccessRestrictionInProgress.set(false); evaluateSendingConnectionEventDisplayEmergencyMessage(); } } private void selectEmergencyCallWaitForConnectionTimeoutDuration() { if (isSatelliteEmergencyMessagingViaCarrierAvailable()) { Loading Loading @@ -790,13 +787,11 @@ public class SatelliteSOSMessageRecommender extends Handler { } private void requestIsSatelliteAllowedForCurrentLocation() { synchronized (mLock) { if (mCheckingAccessRestrictionInProgress) { if (mCheckingAccessRestrictionInProgress.get()) { plogd("requestIsSatelliteCommunicationAllowedForCurrentLocation was already sent"); return; } mCheckingAccessRestrictionInProgress = true; } mCheckingAccessRestrictionInProgress.set(true); OutcomeReceiver<Boolean, SatelliteManager.SatelliteException> callback = new OutcomeReceiver<>() { Loading Loading
src/java/com/android/internal/telephony/satellite/SatelliteSOSMessageRecommender.java +29 −34 Original line number Diff line number Diff line Loading @@ -98,6 +98,7 @@ public class SatelliteSOSMessageRecommender extends Handler { private static final int CMD_SEND_EVENT_DISPLAY_EMERGENCY_MESSAGE_FORCEFULLY = 6; private static final int EVENT_SATELLITE_ACCESS_RESTRICTION_CHECKING_RESULT = 7; /** All the variables initialized inside the constructor are declared here. */ @NonNull private final Context mContext; @NonNull private final SatelliteController mSatelliteController; Loading @@ -106,29 +107,31 @@ public class SatelliteSOSMessageRecommender extends Handler { private ImsManager mImsManager; @NonNull private final FeatureFlags mFeatureFlags; @Nullable private PersistentLogger mPersistentLogger = null; private final ISatelliteProvisionStateCallback mISatelliteProvisionStateCallback; /** All the atomic variables are declared here. */ private AtomicBoolean mIsSatelliteAllowedForCurrentLocation = new AtomicBoolean(false); private AtomicBoolean mCheckingAccessRestrictionInProgress = new AtomicBoolean(false); protected final AtomicBoolean mIsSatelliteConnectedViaCarrierWithinHysteresisTime = new AtomicBoolean(false); protected final AtomicInteger mSubIdOfSatelliteConnectedViaCarrierWithinHysteresisTime = new AtomicInteger(SubscriptionManager.INVALID_SUBSCRIPTION_ID); private Connection mEmergencyConnection = null; private final ISatelliteProvisionStateCallback mISatelliteProvisionStateCallback; /** Key: Phone ID; Value: IMS RegistrationCallback */ private SparseArray<RegistrationManager.RegistrationCallback> mImsRegistrationCallbacks = new SparseArray<>(); @GuardedBy("mLock") private boolean mIsSatelliteAllowedForCurrentLocation = false; @GuardedBy("mLock") private boolean mCheckingAccessRestrictionInProgress = false; protected long mTimeoutMillis = 0; private final long mOemEnabledTimeoutMillis; protected final AtomicBoolean mIsSatelliteConnectedViaCarrierWithinHysteresisTime = new AtomicBoolean(false); protected final AtomicInteger mSubIdOfSatelliteConnectedViaCarrierWithinHysteresisTime = new AtomicInteger(SubscriptionManager.INVALID_SUBSCRIPTION_ID); @GuardedBy("mLock") private boolean mIsTimerTimedOut = false; protected int mCountOfTimerStarted = 0; private final Object mLock = new Object(); @Nullable private PersistentLogger mPersistentLogger = null; private boolean mIsTestEmergencyNumber = false; /** Loading Loading @@ -299,10 +302,8 @@ public class SatelliteSOSMessageRecommender extends Handler { mEmergencyConnection = connection; handleStateChangedEventForHysteresisTimer(); synchronized (mLock) { mCheckingAccessRestrictionInProgress = false; mIsSatelliteAllowedForCurrentLocation = false; } mCheckingAccessRestrictionInProgress.set(false); mIsSatelliteAllowedForCurrentLocation.set(false); } private void handleSatelliteProvisionStateChangedEvent(boolean provisioned) { Loading @@ -326,10 +327,10 @@ public class SatelliteSOSMessageRecommender extends Handler { return; } if (!mIsTimerTimedOut || mCheckingAccessRestrictionInProgress) { if (!mIsTimerTimedOut || mCheckingAccessRestrictionInProgress.get()) { plogd("mIsTimerTimedOut=" + mIsTimerTimedOut + ", mCheckingAccessRestrictionInProgress=" + mCheckingAccessRestrictionInProgress); + mCheckingAccessRestrictionInProgress.get()); return; } Loading Loading @@ -366,10 +367,8 @@ public class SatelliteSOSMessageRecommender extends Handler { } private boolean isSatelliteAllowed() { synchronized (mLock) { if (isSatelliteEmergencyMessagingViaCarrierAvailable()) return true; return mIsSatelliteAllowedForCurrentLocation; } return mIsSatelliteAllowedForCurrentLocation.get(); } private void updateSatelliteViaCarrierAvailability() { Loading Loading @@ -459,8 +458,8 @@ public class SatelliteSOSMessageRecommender extends Handler { mEmergencyConnection = null; mCountOfTimerStarted = 0; mIsTimerTimedOut = false; mCheckingAccessRestrictionInProgress = false; mIsSatelliteAllowedForCurrentLocation = false; mCheckingAccessRestrictionInProgress.set(false); mIsSatelliteAllowedForCurrentLocation.set(false); mIsTestEmergencyNumber = false; } } Loading Loading @@ -564,12 +563,10 @@ public class SatelliteSOSMessageRecommender extends Handler { } private void handleSatelliteAccessRestrictionCheckingResult(boolean satelliteAllowed) { synchronized (mLock) { mIsSatelliteAllowedForCurrentLocation = satelliteAllowed; mCheckingAccessRestrictionInProgress = false; mIsSatelliteAllowedForCurrentLocation.set(satelliteAllowed); mCheckingAccessRestrictionInProgress.set(false); evaluateSendingConnectionEventDisplayEmergencyMessage(); } } private void selectEmergencyCallWaitForConnectionTimeoutDuration() { if (isSatelliteEmergencyMessagingViaCarrierAvailable()) { Loading Loading @@ -790,13 +787,11 @@ public class SatelliteSOSMessageRecommender extends Handler { } private void requestIsSatelliteAllowedForCurrentLocation() { synchronized (mLock) { if (mCheckingAccessRestrictionInProgress) { if (mCheckingAccessRestrictionInProgress.get()) { plogd("requestIsSatelliteCommunicationAllowedForCurrentLocation was already sent"); return; } mCheckingAccessRestrictionInProgress = true; } mCheckingAccessRestrictionInProgress.set(true); OutcomeReceiver<Boolean, SatelliteManager.SatelliteException> callback = new OutcomeReceiver<>() { Loading