diff options
| -rw-r--r-- | api/current.txt | 8 | ||||
| -rw-r--r-- | core/java/android/tv/ITvInputSessionWrapper.java | 5 | ||||
| -rw-r--r-- | core/java/android/tv/TvInputManager.java | 2 | ||||
| -rw-r--r-- | core/java/android/tv/TvInputService.java | 43 | ||||
| -rw-r--r-- | core/java/android/tv/TvInputSession.java | 55 |
5 files changed, 17 insertions, 96 deletions
diff --git a/api/current.txt b/api/current.txt index 15351dee1464..1976dcfa1753 100644 --- a/api/current.txt +++ b/api/current.txt @@ -27714,14 +27714,6 @@ package android.tv { method public abstract boolean onTune(android.net.Uri); } - public abstract class TvInputSession { - ctor public TvInputSession(); - method public void release(); - method public void setSurface(android.view.Surface); - method public void setVolume(float); - method public void tune(android.net.Uri); - } - } package android.util { diff --git a/core/java/android/tv/ITvInputSessionWrapper.java b/core/java/android/tv/ITvInputSessionWrapper.java index fd4e1e367597..66fe5e1e4bff 100644 --- a/core/java/android/tv/ITvInputSessionWrapper.java +++ b/core/java/android/tv/ITvInputSessionWrapper.java @@ -19,6 +19,7 @@ package android.tv; import android.content.Context; import android.net.Uri; import android.os.Message; +import android.tv.TvInputService.TvInputSessionImpl; import android.util.Log; import android.view.Surface; @@ -38,10 +39,10 @@ public class ITvInputSessionWrapper extends ITvInputSession.Stub implements Hand private static final int DO_SET_VOLUME = 3; private static final int DO_TUNE = 4; - private TvInputSession mTvInputSession; + private TvInputSessionImpl mTvInputSession; private final HandlerCaller mCaller; - public ITvInputSessionWrapper(Context context, TvInputSession session) { + public ITvInputSessionWrapper(Context context, TvInputSessionImpl session) { mCaller = new HandlerCaller(context, null, this, true /* asyncHandler */); mTvInputSession = session; } diff --git a/core/java/android/tv/TvInputManager.java b/core/java/android/tv/TvInputManager.java index 0b6ab6427ade..4cf2b3595fd5 100644 --- a/core/java/android/tv/TvInputManager.java +++ b/core/java/android/tv/TvInputManager.java @@ -282,7 +282,7 @@ public final class TvInputManager { } /** - * Creates a {@link TvInputSession} interface for a given TV input. + * Creates a {@link Session} for a given TV input. * <p> * The number of sessions that can be created at the same time is limited by the capability of * the given TV input. diff --git a/core/java/android/tv/TvInputService.java b/core/java/android/tv/TvInputService.java index e43cc950bd7f..d7f6c328a5aa 100644 --- a/core/java/android/tv/TvInputService.java +++ b/core/java/android/tv/TvInputService.java @@ -123,7 +123,7 @@ public abstract class TvInputService extends Service { public abstract TvInputSessionImpl onCreateSession(); /** - * Base class for derived classes to implement to provide {@link TvInputSession}. + * Base class for derived classes to implement to provide {@link TvInputManager.Session}. */ public abstract static class TvInputSessionImpl { /** @@ -155,52 +155,35 @@ public abstract class TvInputService extends Service { * @return {@code true} the tuning was successful, {@code false} otherwise. */ public abstract boolean onTune(Uri channelUri); - } - - /** - * Internal implementation of {@link TvInputSession}. This takes care of basic maintenance of - * the TV input session but most behavior must be implemented in {@link TvInputSessionImpl} - * returned by {@link TvInputService#onCreateSession}. - */ - private static class TvInputSessionImplInternal extends TvInputSession { - private final TvInputSessionImpl mSessionImpl; - - public TvInputSessionImplInternal(TvInputSessionImpl sessionImpl) { - mSessionImpl = sessionImpl; - } /** * This method is called when the application would like to stop using the current input * session. */ - @Override - public final void release() { - mSessionImpl.onRelease(); + void release() { + onRelease(); } /** - * Calls {@link TvInputSessionImpl#onSetSurface}. + * Calls {@link onSetSurface}. */ - @Override - public final void setSurface(Surface surface) { - mSessionImpl.onSetSurface(surface); + void setSurface(Surface surface) { + onSetSurface(surface); // TODO: Handle failure. } /** - * Calls {@link TvInputSessionImpl#onSetVolume}. + * Calls {@link onSetVolume}. */ - @Override - public final void setVolume(float volume) { - mSessionImpl.onSetVolume(volume); + void setVolume(float volume) { + onSetVolume(volume); } /** - * Calls {@link TvInputSessionImpl#onTune}. + * Calls {@link onTune}. */ - @Override - public final void tune(Uri channelUri) { - mSessionImpl.onTune(channelUri); + void tune(Uri channelUri) { + onTune(channelUri); // TODO: Handle failure. } } @@ -222,7 +205,7 @@ public abstract class TvInputService extends Service { return; } ITvInputSession stub = new ITvInputSessionWrapper(TvInputService.this, - new TvInputSessionImplInternal(sessionImpl)); + sessionImpl); cb.onSessionCreated(stub); } catch (RemoteException e) { Log.e(TAG, "error in onSessionCreated"); diff --git a/core/java/android/tv/TvInputSession.java b/core/java/android/tv/TvInputSession.java deleted file mode 100644 index cdd363b70606..000000000000 --- a/core/java/android/tv/TvInputSession.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (C) 2014 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package android.tv; - -import android.net.Uri; -import android.view.Surface; - -/** - * The TvInputSession provides the per-session functionality of TvInputService. - */ -public abstract class TvInputSession { - /** - * This method is called when the application would like to stop using the current input - * session. - */ - public void release() { } - - /** - * Sets the {@link Surface} for the current input session on which the TV input renders video. - * - * @param surface {@link Surface} to be used for the video playback of this session. - */ - public void setSurface(Surface surface) { } - - /** - * This method is called when the application needs to handle the change of audio focus by - * setting the relative volume of the current TV input service session. - * - * @param volume Volume scale from 0.0 to 1.0. - */ - // TODO: Remove this once it becomes irrelevant for applications to handle audio focus. The plan - // is to introduce some new concepts that will solve a number of problems in audio policy today. - public void setVolume(float volume) { } - - /** - * Tunes to a given channel. - * - * @param channelUri The URI of the channel. - */ - public void tune(Uri channelUri) { } -} |