Skip to content

Commit 1c040db

Browse files
committed
Fix crash in NetworkControllerImpl
Happened due to multiple entry points of configuration changes running on different threads. - Remove the unneeded listening for configuration broadcasts - Make the handling for configuration changes happen on the right thread - Happen to fix the tests :) Bug: 22560859 Change-Id: I194b4fa233f0a8a33c4ac3252ddec70a93822337
1 parent 29cf9ae commit 1c040db

2 files changed

Lines changed: 12 additions & 5 deletions

File tree

packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2910,7 +2910,7 @@ protected void onConfigurationChanged(Configuration newConfig) {
29102910
updateRowStates();
29112911
mIconController.updateResources();
29122912
mScreenPinningRequest.onConfigurationChanged();
2913-
mNetworkController.handleConfigurationChanged();
2913+
mNetworkController.onConfigurationChanged();
29142914
}
29152915

29162916
@Override

packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,6 @@ private void registerListeners() {
197197
filter.addAction(TelephonyIntents.SPN_STRINGS_UPDATED_ACTION);
198198
filter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
199199
filter.addAction(ConnectivityManager.INET_CONDITION_ACTION);
200-
filter.addAction(Intent.ACTION_CONFIGURATION_CHANGED);
201200
filter.addAction(Intent.ACTION_AIRPLANE_MODE_CHANGED);
202201
mContext.registerReceiver(this, filter, null, mReceiverHandler);
203202
mListening = true;
@@ -339,8 +338,6 @@ public void onReceive(Context context, Intent intent) {
339338
if (action.equals(ConnectivityManager.CONNECTIVITY_ACTION) ||
340339
action.equals(ConnectivityManager.INET_CONDITION_ACTION)) {
341340
updateConnectivity();
342-
} else if (action.equals(Intent.ACTION_CONFIGURATION_CHANGED)) {
343-
handleConfigurationChanged();
344341
} else if (action.equals(Intent.ACTION_AIRPLANE_MODE_CHANGED)) {
345342
refreshLocale();
346343
updateAirplaneMode(false);
@@ -373,8 +370,18 @@ public void onReceive(Context context, Intent intent) {
373370
}
374371
}
375372

376-
public void handleConfigurationChanged() {
373+
public void onConfigurationChanged() {
377374
mConfig = Config.readConfig(mContext);
375+
mReceiverHandler.post(new Runnable() {
376+
@Override
377+
public void run() {
378+
handleConfigurationChanged();
379+
}
380+
});
381+
}
382+
383+
@VisibleForTesting
384+
void handleConfigurationChanged() {
378385
for (MobileSignalController mobileSignalController : mMobileSignalControllers.values()) {
379386
mobileSignalController.setConfiguration(mConfig);
380387
}

0 commit comments

Comments
 (0)