From f70e373f32f38e87cb60d216515f2a2c1ef3354f Mon Sep 17 00:00:00 2001 From: Yoshiaki Naka Date: Fri, 24 Jan 2020 18:57:22 +0900 Subject: Unregister handler for multi-SIM configuration change StkAppService can stop itself and new instance of ServiceHandler can be created whenever the service starts worker thread. Registration of handler for multi-SIM configuration change should be done after it is instantiated and unregistration should also be done. Bug: 148240558 Test: Manual Change-Id: I21575bb445c5458e345644f465bf2841cd80a3a5 --- src/com/android/stk/StkAppService.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/com') diff --git a/src/com/android/stk/StkAppService.java b/src/com/android/stk/StkAppService.java index 4140d15..4a254ed 100644 --- a/src/com/android/stk/StkAppService.java +++ b/src/com/android/stk/StkAppService.java @@ -334,8 +334,6 @@ public class StkAppService extends Service implements Runnable { serviceThread.start(); mNotificationManager = (NotificationManager) mContext .getSystemService(Context.NOTIFICATION_SERVICE); - PhoneConfigurationManager.registerForMultiSimConfigChange(mServiceHandler, - EVENT_MULTI_SIM_CONFIG_CHANGED, null); sInstance = this; } @@ -418,6 +416,7 @@ public class StkAppService extends Service implements Runnable { unregisterHomeKeyEventReceiver(); sInstance = null; waitForLooper(); + PhoneConfigurationManager.unregisterForMultiSimConfigChange(mServiceHandler); mServiceLooper.quit(); } @@ -432,6 +431,9 @@ public class StkAppService extends Service implements Runnable { mServiceLooper = Looper.myLooper(); mServiceHandler = new ServiceHandler(); + PhoneConfigurationManager.registerForMultiSimConfigChange(mServiceHandler, + EVENT_MULTI_SIM_CONFIG_CHANGED, null); + Looper.loop(); } -- cgit v1.2.3