现象:机器开机4G显示三角空框,但是可以正常上网。重启模块后显示正常
原因:模块注册状态广播后,安卓上层没有监听到
解决方法:
一.Android7
方案1:diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java
index 34a03bf..962a773 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java
@@ -323,7 +323,7 @@ public class MobileSignalController extends SignalController<
return false;
case ServiceState.STATE_OUT_OF_SERVICE:
case ServiceState.STATE_EMERGENCY_ONLY:
- return mServiceState.getDataRegState() == ServiceState.STATE_IN_SERVICE;
+ //return mServiceState.getDataRegState() == ServiceState.STATE_IN_SERVICE;
default:
return true;
}
方案2
diff --git a/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java b/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java
index 03c46e8b37..694599206e 100644
--- a/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java
+++ b/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java
@@ -316,8 +316,16 @@ public class MobileSignalController extends SignalController<
} else if (action.equals(TelephonyIntents.ACTION_DEFAULT_DATA_SUBSCRIPTION_CHANGED)) {
updateDataSim();
notifyListenersIfNecessary();
- }
- }
+ }else if(action.equals(TelephonyIntents.ACTION_SERVICE_STATE_CHANGED)){
+ ServiceState mLastServiceState = ServiceState.newFromBundle(intent.getExtras());
+
+ if(mLastServiceState != null && (mServiceState == null || mServiceState.getVoiceRegState() != mLastServiceState.getVoiceRegState())){
+ //Log.v(TAG,"handleBroadcast mLastServiceState:"+mLastServiceState.getVoiceRegState());
+ mServiceState = mLastServiceState;
+ updateTelephony();
+ }
+ }
+ }
private void updateDataSim() {
int defaultDataSub = mDefaults.getDefaultDataSubId();
diff --git a/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java b/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java
index 622595f765..2fd0cce8ed 100644
--- a/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java
+++ b/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java
@@ -396,6 +396,11 @@ public class NetworkControllerImpl extends BroadcastReceiver
// emergency state.
recalculateEmergency();
}
+
+ for (MobileSignalController controller : mMobileSignalControllers.values()) {
+ controller.handleBroadcast(intent);
+ }
+
} else {
int subId = intent.getIntExtra(PhoneConstants.SUBSCRIPTION_KEY,
SubscriptionManager.INVALID_SUBSCRIPTION_ID);
二,安卓八
方案1.
diff --git a/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java b/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java
index 03c46e8b37..694599206e 100644
--- a/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java
+++ b/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java
@@ -316,8 +316,16 @@ public class MobileSignalController extends SignalController<
} else if (action.equals(TelephonyIntents.ACTION_DEFAULT_DATA_SUBSCRIPTION_CHANGED)) {
updateDataSim();
notifyListenersIfNecessary();
- }
- }
+ }else if(action.equals(TelephonyIntents.ACTION_SERVICE_STATE_CHANGED)){
+ ServiceState mLastServiceState = ServiceState.newFromBundle(intent.getExtras());
+
+ if(mLastServiceState != null && (mServiceState == null || mServiceState.getVoiceRegState() != mLastServiceState.getVoiceRegState())){
+ //Log.v(TAG,"handleBroadcast mLastServiceState:"+mLastServiceState.getVoiceRegState());
+ mServiceState = mLastServiceState;
+ updateTelephony();
+ }
+ }
+ }
private void updateDataSim() {
int defaultDataSub = mDefaults.getDefaultDataSubId();
diff --git a/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java b/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java
index 622595f765..2fd0cce8ed 100644
--- a/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java
+++ b/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java
@@ -396,6 +396,11 @@ public class NetworkControllerImpl extends BroadcastReceiver
// emergency state.
recalculateEmergency();
}
+
+ for (MobileSignalController controller : mMobileSignalControllers.values()) {
+ controller.handleBroadcast(intent);
+ }
+
} else {
int subId = intent.getIntExtra(PhoneConstants.SUBSCRIPTION_KEY,
SubscriptionManager.INVALID_SUBSCRIPTION_ID);
.方案2:
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java
index 34a03bf..962a773 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java
@@ -323,7 +323,7 @@ public class MobileSignalController extends SignalController<
return false;
case ServiceState.STATE_OUT_OF_SERVICE:
case ServiceState.STATE_EMERGENCY_ONLY:
- return mServiceState.getDataRegState() == ServiceState.STATE_IN_SERVICE;
+ //return mServiceState.getDataRegState() == ServiceState.STATE_IN_SERVICE;
default:
return true;
}
如果觉得我的文章对您有用,请随意打赏。你的支持将鼓励我继续创作!