Don't activate VVM if carrier config changed without signal
CARRIER_CONFIG_CHANGED can be spammed during low signal condition,
which might repeatedly launch TaskSchedulerService and causes a long
wakelock.
In this CL, the activation task will not be queued if the cellular
signal is not available during the change.
Bug: 33693814
Change-Id: I0ed8e62b19589e4dfb47aafcf49a14448418feb4
Fixes: 33693814
Test: N/A
diff --git a/src/com/android/phone/vvm/omtp/SimChangeReceiver.java b/src/com/android/phone/vvm/omtp/SimChangeReceiver.java
index 5b201aa..a506a12 100644
--- a/src/com/android/phone/vvm/omtp/SimChangeReceiver.java
+++ b/src/com/android/phone/vvm/omtp/SimChangeReceiver.java
@@ -24,6 +24,7 @@
import android.os.UserManager;
import android.telecom.PhoneAccountHandle;
import android.telephony.CarrierConfigManager;
+import android.telephony.ServiceState;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
@@ -118,6 +119,12 @@
// can be recorded.
OmtpVvmSourceManager.getInstance(context).addPhoneStateListener(
phoneAccount);
+ if (context.getSystemService(TelephonyManager.class)
+ .getServiceStateForSubscriber(subId).getState()
+ != ServiceState.STATE_IN_SERVICE) {
+ VvmLog.i(TAG, "Cellular signal not available, not activating");
+ return;
+ }
carrierConfigHelper.startActivation();
} else {
if (carrierConfigHelper.isLegacyModeEnabled()) {