summaryrefslogtreecommitdiff
authorZhiwei Yan <zhiwei.yan@amlogic.com>2017-04-26 05:13:53 (GMT)
committer Tellen Yu <tellen.yu@amlogic.com>2017-04-27 09:19:13 (GMT)
commitc8edc869ef5c8b3cb864537da8932a9cd639699f (patch)
tree2d70ba4d4ce5c6f915a07cbdb238ece9119b3e94
parentfd84fb9edbab37cb4b7200d2bf2c2f356c017124 (diff)
downloadSubTitle-c8edc869ef5c8b3cb864537da8932a9cd639699f.zip
SubTitle-c8edc869ef5c8b3cb864537da8932a9cd639699f.tar.gz
SubTitle-c8edc869ef5c8b3cb864537da8932a9cd639699f.tar.bz2
pd#143342:ensure start and stop cc according to right proccess
Change-Id: Ia0cc9b24aea5b6b078cd682f0811717a98771d7f
Diffstat
-rw-r--r--src/com/droidlogic/SubTitleService/SubTitleService.java29
1 files changed, 17 insertions, 12 deletions
diff --git a/src/com/droidlogic/SubTitleService/SubTitleService.java b/src/com/droidlogic/SubTitleService/SubTitleService.java
index 418b50e..bb5f109 100644
--- a/src/com/droidlogic/SubTitleService/SubTitleService.java
+++ b/src/com/droidlogic/SubTitleService/SubTitleService.java
@@ -105,6 +105,7 @@ public class SubTitleService extends ISubTitleService.Stub {
//ccsubtitleview
private CcSubView ccSubView = null;
+ private boolean isccrunning = false;
public SubTitleService(Context context) {
LOGI("[SubTitleService]");
@@ -204,6 +205,7 @@ public class SubTitleService extends ISubTitleService.Stub {
public void close() {
LOGI("[close]");
+ StopCcSub();
if (mSubtitleUtils != null) {
mSubtitleUtils.setSubtitleNumber(0);
mSubtitleUtils = null;
@@ -217,9 +219,6 @@ public class SubTitleService extends ISubTitleService.Stub {
mSubTotal = -1;
mSetSubId = -1;
- if (isViewAdded) {
- StopCcSub();
- }
sendCloseMsg();
}
@@ -421,18 +420,24 @@ public class SubTitleService extends ISubTitleService.Stub {
}
private void ccStart() {
- LOGI("cc subtitle start");
- ccSubView.startCC();
- ccSubView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
- ccSubView.show();
- ccSubView.setActive(true);
+ if (!isccrunning) {
+ LOGI("cc subtitle start");
+ ccSubView.startCC();
+ ccSubView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
+ ccSubView.show();
+ ccSubView.setActive(true);
+ isccrunning = true;
+ }
}
private void ccStop() {
- LOGI("cc subtitle stop");
- ccSubView.hide();
- ccSubView.setActive(false);
- ccSubView.stopCC();
+ if (isccrunning) {
+ LOGI("cc subtitle stop");
+ isccrunning = false;
+ ccSubView.hide();
+ ccSubView.setActive(false);
+ ccSubView.stopCC();
+ }
}
private void sendOpenMsg(int idx) {