author | wei wang <wei.wang@amlogic.com> | 2018-01-16 02:47:24 (GMT) |
---|---|---|
committer | Wei Wang <wei.wang@amlogic.com> | 2018-01-17 02:53:34 (GMT) |
commit | 594385083818563d03e2830eb9acb00456135a74 (patch) | |
tree | 21388618111cc28f4d42e0a38f71c5c54a7f182a | |
parent | 41e91ce7574343824581059e5a8ebcfd3c075b19 (diff) | |
download | TvInput-594385083818563d03e2830eb9acb00456135a74.zip TvInput-594385083818563d03e2830eb9acb00456135a74.tar.gz TvInput-594385083818563d03e2830eb9acb00456135a74.tar.bz2 |
TvInput:release Handler when session is released [1/1]
PD# 158559
Change-Id: I2fbed997bc3ce92eadcc880f1ac3948a0b69880c
3 files changed, 19 insertions, 10 deletions
diff --git a/DroidLogicTvInput/src/com/droidlogic/tvinput/services/AV1InputService.java b/DroidLogicTvInput/src/com/droidlogic/tvinput/services/AV1InputService.java index ee16530..da02412 100644 --- a/DroidLogicTvInput/src/com/droidlogic/tvinput/services/AV1InputService.java +++ b/DroidLogicTvInput/src/com/droidlogic/tvinput/services/AV1InputService.java @@ -307,6 +307,9 @@ public class AV1InputService extends DroidLogicTvInputService { } protected void releaseWorkThread() { + if (mHandler != null) { + mHandler.removeCallbacksAndMessages(null); + } if (mHandlerThread != null) { mHandlerThread.quit(); mHandlerThread = null; diff --git a/DroidLogicTvInput/src/com/droidlogic/tvinput/services/AV2InputService.java b/DroidLogicTvInput/src/com/droidlogic/tvinput/services/AV2InputService.java index 5db5903..bc410f9 100644 --- a/DroidLogicTvInput/src/com/droidlogic/tvinput/services/AV2InputService.java +++ b/DroidLogicTvInput/src/com/droidlogic/tvinput/services/AV2InputService.java @@ -307,6 +307,9 @@ public class AV2InputService extends DroidLogicTvInputService { } protected void releaseWorkThread() { + if (mHandler != null) { + mHandler.removeCallbacksAndMessages(null); + } if (mHandlerThread != null) { mHandlerThread.quit(); mHandlerThread = null; diff --git a/DroidLogicTvInput/src/com/droidlogic/tvinput/services/DTVInputService.java b/DroidLogicTvInput/src/com/droidlogic/tvinput/services/DTVInputService.java index 0aeeecf..afa9ff5 100644 --- a/DroidLogicTvInput/src/com/droidlogic/tvinput/services/DTVInputService.java +++ b/DroidLogicTvInput/src/com/droidlogic/tvinput/services/DTVInputService.java @@ -541,6 +541,7 @@ public class DTVInputService extends DroidLogicTvInputService implements TvContr public void doRelease() { Log.d(TAG, "release:"+this); super.doRelease(); + cancelAllMessagesInQuene(); if (mSystemControlManager.getPropertyBoolean("persist.sys.getdtvtime.isneed", false)) { int autoTimeValue = Settings.Global.getInt(mContext.getContentResolver(), Settings.Global.AUTO_TIME, 0); NtpTrustedTime mTime = NtpTrustedTime.getInstance(mContext); @@ -718,12 +719,14 @@ public class DTVInputService extends DroidLogicTvInputService implements TvContr } } - protected void releaseWorkThread() { - Log.d(TAG, "releaseWorkThread"); + protected void cancelAllMessagesInQuene() { if (mHandler != null) { mHandler.removeCallbacksAndMessages(null); } + } + protected void releaseWorkThread() { + Log.d(TAG, "releaseWorkThread") if (mHandlerThread != null) { mHandlerThread.quit(); mHandlerThread = null; @@ -751,18 +754,17 @@ public class DTVInputService extends DroidLogicTvInputService implements TvContr } protected void switchToSourceInput(Uri uri) { - if (mHandler != null) + if (mHandler != null) { + mHandler.removeMessages(MSG_PLAY); + resetWorkThread(); mHandler.obtainMessage(MSG_PLAY, uri).sendToTarget(); + } } protected void doPlay(Uri uri) { - if (mHandler != null) - mHandler.removeMessages(MSG_PLAY); - mCurrentUri = uri; - + Log.d(TAG, "doPlay uri=" + uri + " this:"+ this); stopSubtitle(); - resetWorkThread(); mUnblockedRatingSet.clear(); mChannelBlocked = -1; @@ -2094,7 +2096,7 @@ public class DTVInputService extends DroidLogicTvInputService implements TvContr } protected void stopSubtitle(boolean stopRetry) { - Log.d(TAG, "stop Subtitle[stopRetry:"+stopRetry+"]"); + Log.d(TAG, "stop Subtitle[stopRetry:"+stopRetry+"],session:"+this); synchronized (mSubtitleLock) { @@ -3194,7 +3196,8 @@ public class DTVInputService extends DroidLogicTvInputService implements TvContr { Log.d(TAG, "Will send msg to Session handler"); synchronized (this) { - mCurrentSession.onUpdateTsPlay(c.getId()); + if (mCurrentSession != null) + mCurrentSession.onUpdateTsPlay(c.getId()); notifyChannelRetuned(c.getUri()); } break; |