diff options
author | Yoshiaki Naka <yoshiaki.naka@sony.com> | 2020-01-24 18:57:22 +0900 |
---|---|---|
committer | Yoshiaki Naka <yoshiaki.naka@sony.com> | 2020-01-24 23:43:26 +0000 |
commit | f70e373f32f38e87cb60d216515f2a2c1ef3354f (patch) | |
tree | 99ff129ec3d7cae3c962c2025c8dbf9cad6e4f35 | |
parent | 4f5cc5e43da1ca2df851cf12f1408fcb846cb840 (diff) | |
download | Stk-f70e373f32f38e87cb60d216515f2a2c1ef3354f.tar.gz |
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
-rw-r--r-- | src/com/android/stk/StkAppService.java | 6 |
1 files changed, 4 insertions, 2 deletions
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(); } |