Loading media/java/android/media/tv/tunerresourcemanager/ITunerResourceManager.aidl +34 −0 Original line number Original line Diff line number Diff line Loading @@ -20,6 +20,7 @@ import android.media.tv.tunerresourcemanager.CasSessionRequest; import android.media.tv.tunerresourcemanager.IResourcesReclaimListener; import android.media.tv.tunerresourcemanager.IResourcesReclaimListener; import android.media.tv.tunerresourcemanager.ResourceClientProfile; import android.media.tv.tunerresourcemanager.ResourceClientProfile; import android.media.tv.tunerresourcemanager.TunerDemuxRequest; import android.media.tv.tunerresourcemanager.TunerDemuxRequest; import android.media.tv.tunerresourcemanager.TunerDescramblerRequest; import android.media.tv.tunerresourcemanager.TunerFrontendInfo; import android.media.tv.tunerresourcemanager.TunerFrontendInfo; import android.media.tv.tunerresourcemanager.TunerFrontendRequest; import android.media.tv.tunerresourcemanager.TunerFrontendRequest; import android.media.tv.tunerresourcemanager.TunerLnbRequest; import android.media.tv.tunerresourcemanager.TunerLnbRequest; Loading Loading @@ -171,6 +172,30 @@ interface ITunerResourceManager { */ */ boolean requestDemux(in TunerDemuxRequest request, out int[] demuxHandle); boolean requestDemux(in TunerDemuxRequest request, out int[] demuxHandle); /* * This API is used by the Tuner framework to request an available descrambler from the * TunerHAL. * * <p>There are three possible scenarios: * <ul> * <li>If there is descrambler available, the API would send the handle back. * * <li>If no Descrambler is available but the current request info can show higher priority than * other uses of Descrambler, the API will send * {@link IResourcesReclaimListener#onReclaimResources()} to the {@link Tuner}. Tuner would * handle the resource reclaim on the holder of lower priority and notify the holder of its * resource loss. * * <li>If no Descrambler can be granted, the API would return false. * <ul> * * @param request {@link TunerDescramblerRequest} information of the current request. * @param descramblerHandle a one-element array to return the granted descrambler handle. * * @return true if there is Descrambler granted. */ boolean requestDescrambler(in TunerDescramblerRequest request, out int[] descramblerHandle); /* /* * This API is used by the Tuner framework to request an available Cas session. This session * This API is used by the Tuner framework to request an available Cas session. This session * needs to be under the CAS system with the id indicated in the {@code request}. * needs to be under the CAS system with the id indicated in the {@code request}. Loading Loading @@ -242,6 +267,15 @@ interface ITunerResourceManager { */ */ void releaseDemux(in int demuxHandle); void releaseDemux(in int demuxHandle); /* * Notifies the TRM that the Descrambler with the given handle was released. * * <p>Client must call this whenever it releases a descrambler. * * @param demuxHandle the handle of the released Tuner Descrambler. */ void releaseDescrambler(in int descramblerHandle); /* /* * Notifies the TRM that the given Cas session has been released. * Notifies the TRM that the given Cas session has been released. * * Loading media/java/android/media/tv/tunerresourcemanager/TunerDescramblerRequest.aidl 0 → 100644 +24 −0 Original line number Original line Diff line number Diff line /* * Copyright 2020 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.media.tv.tunerresourcemanager; /** * Information required to request a Tuner Descrambler. * * @hide */ parcelable TunerDescramblerRequest; No newline at end of file media/java/android/media/tv/tunerresourcemanager/TunerDescramblerRequest.java 0 → 100644 +96 −0 Original line number Original line Diff line number Diff line /* * Copyright 2020 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.media.tv.tunerresourcemanager; import android.annotation.NonNull; import android.os.Parcel; import android.os.Parcelable; import android.util.Log; /** * Information required to request a Tuner Descrambler. * * @hide */ public final class TunerDescramblerRequest implements Parcelable { static final String TAG = "TunerDescramblerRequest"; public static final @NonNull Parcelable.Creator<TunerDescramblerRequest> CREATOR = new Parcelable.Creator<TunerDescramblerRequest>() { @Override public TunerDescramblerRequest createFromParcel(Parcel source) { try { return new TunerDescramblerRequest(source); } catch (Exception e) { Log.e(TAG, "Exception creating TunerDescramblerRequest from parcel", e); return null; } } @Override public TunerDescramblerRequest[] newArray(int size) { return new TunerDescramblerRequest[size]; } }; /** * Client id of the client that sends the request. */ private final int mClientId; private TunerDescramblerRequest(@NonNull Parcel source) { mClientId = source.readInt(); } /** * Constructs a new {@link TunerDescramblerRequest} with the given parameters. * * @param clientId id of the client. */ public TunerDescramblerRequest(int clientId) { mClientId = clientId; } /** * Returns the id of the client. */ public int getClientId() { return mClientId; } // Parcelable @Override public int describeContents() { return 0; } @NonNull @Override public String toString() { StringBuilder b = new StringBuilder(128); b.append("TunerDescramblerRequest {clientId=").append(mClientId); b.append("}"); return b.toString(); } @Override public void writeToParcel(@NonNull Parcel dest, int flags) { dest.writeInt(mClientId); } } media/java/android/media/tv/tunerresourcemanager/TunerResourceManager.java +49 −0 Original line number Original line Diff line number Diff line Loading @@ -291,6 +291,40 @@ public class TunerResourceManager { return result; return result; } } /** * Requests a Tuner Descrambler resource. * * <p>There are three possible scenarios: * <ul> * <li>If there is Descrambler available, the API would send the handle back. * * <li>If no Descrambler is available but the current request has a higher priority than other * uses of descramblers, the API will send * {@link IResourcesReclaimListener#onReclaimResources()} to the {@link Tuner}. Tuner would * handle the resource reclaim on the holder of lower priority and notify the holder of its * resource loss. * * <li>If no Descrambler system can be granted, the API would return false. * <ul> * * @param request {@link TunerDescramblerRequest} information of the current request. * @param descramblerHandle a one-element array to return the granted Descrambler handle. * If no Descrambler granted, this will return * {@link #INVALID_RESOURCE_HANDLE}. * * @return true if there is Descrambler granted. */ public boolean requestDescrambler(@NonNull TunerDescramblerRequest request, @NonNull int[] descramblerHandle) { boolean result = false; try { result = mService.requestDescrambler(request, descramblerHandle); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } return result; } /** /** * Requests a CAS session resource. * Requests a CAS session resource. * * Loading Loading @@ -391,6 +425,21 @@ public class TunerResourceManager { } } } } /** * Notifies the TRM that the Descrambler with the given handle has been released. * * <p>Client must call this whenever it releases an Descrambler. * * @param descramblerHandle the handle of the released Tuner Descrambler. */ public void releaseDescrambler(int descramblerHandle) { try { mService.releaseDescrambler(descramblerHandle); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** /** * Notifies the TRM that the given Cas session has been released. * Notifies the TRM that the given Cas session has been released. * * Loading services/core/java/com/android/server/tv/tunerresourcemanager/TunerResourceManagerService.java +17 −0 Original line number Original line Diff line number Diff line Loading @@ -25,6 +25,7 @@ import android.media.tv.tunerresourcemanager.IResourcesReclaimListener; import android.media.tv.tunerresourcemanager.ITunerResourceManager; import android.media.tv.tunerresourcemanager.ITunerResourceManager; import android.media.tv.tunerresourcemanager.ResourceClientProfile; import android.media.tv.tunerresourcemanager.ResourceClientProfile; import android.media.tv.tunerresourcemanager.TunerDemuxRequest; import android.media.tv.tunerresourcemanager.TunerDemuxRequest; import android.media.tv.tunerresourcemanager.TunerDescramblerRequest; import android.media.tv.tunerresourcemanager.TunerFrontendInfo; import android.media.tv.tunerresourcemanager.TunerFrontendInfo; import android.media.tv.tunerresourcemanager.TunerFrontendRequest; import android.media.tv.tunerresourcemanager.TunerFrontendRequest; import android.media.tv.tunerresourcemanager.TunerLnbRequest; import android.media.tv.tunerresourcemanager.TunerLnbRequest; Loading Loading @@ -198,6 +199,15 @@ public class TunerResourceManagerService extends SystemService { return true; return true; } } @Override public boolean requestDescrambler(@NonNull TunerDescramblerRequest request, @NonNull int[] descrambleHandle) { if (DEBUG) { Slog.d(TAG, "requestDescrambler(request=" + request + ")"); } return true; } @Override @Override public boolean requestCasSession( public boolean requestCasSession( @NonNull CasSessionRequest request, @NonNull int[] sessionResourceId) { @NonNull CasSessionRequest request, @NonNull int[] sessionResourceId) { Loading Loading @@ -230,6 +240,13 @@ public class TunerResourceManagerService extends SystemService { } } } } @Override public void releaseDescrambler(int descramblerHandle) { if (DEBUG) { Slog.d(TAG, "releaseDescrambler(descramblerHandle=" + descramblerHandle + ")"); } } @Override @Override public void releaseCasSession(int sessionResourceId) { public void releaseCasSession(int sessionResourceId) { if (DEBUG) { if (DEBUG) { Loading Loading
media/java/android/media/tv/tunerresourcemanager/ITunerResourceManager.aidl +34 −0 Original line number Original line Diff line number Diff line Loading @@ -20,6 +20,7 @@ import android.media.tv.tunerresourcemanager.CasSessionRequest; import android.media.tv.tunerresourcemanager.IResourcesReclaimListener; import android.media.tv.tunerresourcemanager.IResourcesReclaimListener; import android.media.tv.tunerresourcemanager.ResourceClientProfile; import android.media.tv.tunerresourcemanager.ResourceClientProfile; import android.media.tv.tunerresourcemanager.TunerDemuxRequest; import android.media.tv.tunerresourcemanager.TunerDemuxRequest; import android.media.tv.tunerresourcemanager.TunerDescramblerRequest; import android.media.tv.tunerresourcemanager.TunerFrontendInfo; import android.media.tv.tunerresourcemanager.TunerFrontendInfo; import android.media.tv.tunerresourcemanager.TunerFrontendRequest; import android.media.tv.tunerresourcemanager.TunerFrontendRequest; import android.media.tv.tunerresourcemanager.TunerLnbRequest; import android.media.tv.tunerresourcemanager.TunerLnbRequest; Loading Loading @@ -171,6 +172,30 @@ interface ITunerResourceManager { */ */ boolean requestDemux(in TunerDemuxRequest request, out int[] demuxHandle); boolean requestDemux(in TunerDemuxRequest request, out int[] demuxHandle); /* * This API is used by the Tuner framework to request an available descrambler from the * TunerHAL. * * <p>There are three possible scenarios: * <ul> * <li>If there is descrambler available, the API would send the handle back. * * <li>If no Descrambler is available but the current request info can show higher priority than * other uses of Descrambler, the API will send * {@link IResourcesReclaimListener#onReclaimResources()} to the {@link Tuner}. Tuner would * handle the resource reclaim on the holder of lower priority and notify the holder of its * resource loss. * * <li>If no Descrambler can be granted, the API would return false. * <ul> * * @param request {@link TunerDescramblerRequest} information of the current request. * @param descramblerHandle a one-element array to return the granted descrambler handle. * * @return true if there is Descrambler granted. */ boolean requestDescrambler(in TunerDescramblerRequest request, out int[] descramblerHandle); /* /* * This API is used by the Tuner framework to request an available Cas session. This session * This API is used by the Tuner framework to request an available Cas session. This session * needs to be under the CAS system with the id indicated in the {@code request}. * needs to be under the CAS system with the id indicated in the {@code request}. Loading Loading @@ -242,6 +267,15 @@ interface ITunerResourceManager { */ */ void releaseDemux(in int demuxHandle); void releaseDemux(in int demuxHandle); /* * Notifies the TRM that the Descrambler with the given handle was released. * * <p>Client must call this whenever it releases a descrambler. * * @param demuxHandle the handle of the released Tuner Descrambler. */ void releaseDescrambler(in int descramblerHandle); /* /* * Notifies the TRM that the given Cas session has been released. * Notifies the TRM that the given Cas session has been released. * * Loading
media/java/android/media/tv/tunerresourcemanager/TunerDescramblerRequest.aidl 0 → 100644 +24 −0 Original line number Original line Diff line number Diff line /* * Copyright 2020 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.media.tv.tunerresourcemanager; /** * Information required to request a Tuner Descrambler. * * @hide */ parcelable TunerDescramblerRequest; No newline at end of file
media/java/android/media/tv/tunerresourcemanager/TunerDescramblerRequest.java 0 → 100644 +96 −0 Original line number Original line Diff line number Diff line /* * Copyright 2020 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.media.tv.tunerresourcemanager; import android.annotation.NonNull; import android.os.Parcel; import android.os.Parcelable; import android.util.Log; /** * Information required to request a Tuner Descrambler. * * @hide */ public final class TunerDescramblerRequest implements Parcelable { static final String TAG = "TunerDescramblerRequest"; public static final @NonNull Parcelable.Creator<TunerDescramblerRequest> CREATOR = new Parcelable.Creator<TunerDescramblerRequest>() { @Override public TunerDescramblerRequest createFromParcel(Parcel source) { try { return new TunerDescramblerRequest(source); } catch (Exception e) { Log.e(TAG, "Exception creating TunerDescramblerRequest from parcel", e); return null; } } @Override public TunerDescramblerRequest[] newArray(int size) { return new TunerDescramblerRequest[size]; } }; /** * Client id of the client that sends the request. */ private final int mClientId; private TunerDescramblerRequest(@NonNull Parcel source) { mClientId = source.readInt(); } /** * Constructs a new {@link TunerDescramblerRequest} with the given parameters. * * @param clientId id of the client. */ public TunerDescramblerRequest(int clientId) { mClientId = clientId; } /** * Returns the id of the client. */ public int getClientId() { return mClientId; } // Parcelable @Override public int describeContents() { return 0; } @NonNull @Override public String toString() { StringBuilder b = new StringBuilder(128); b.append("TunerDescramblerRequest {clientId=").append(mClientId); b.append("}"); return b.toString(); } @Override public void writeToParcel(@NonNull Parcel dest, int flags) { dest.writeInt(mClientId); } }
media/java/android/media/tv/tunerresourcemanager/TunerResourceManager.java +49 −0 Original line number Original line Diff line number Diff line Loading @@ -291,6 +291,40 @@ public class TunerResourceManager { return result; return result; } } /** * Requests a Tuner Descrambler resource. * * <p>There are three possible scenarios: * <ul> * <li>If there is Descrambler available, the API would send the handle back. * * <li>If no Descrambler is available but the current request has a higher priority than other * uses of descramblers, the API will send * {@link IResourcesReclaimListener#onReclaimResources()} to the {@link Tuner}. Tuner would * handle the resource reclaim on the holder of lower priority and notify the holder of its * resource loss. * * <li>If no Descrambler system can be granted, the API would return false. * <ul> * * @param request {@link TunerDescramblerRequest} information of the current request. * @param descramblerHandle a one-element array to return the granted Descrambler handle. * If no Descrambler granted, this will return * {@link #INVALID_RESOURCE_HANDLE}. * * @return true if there is Descrambler granted. */ public boolean requestDescrambler(@NonNull TunerDescramblerRequest request, @NonNull int[] descramblerHandle) { boolean result = false; try { result = mService.requestDescrambler(request, descramblerHandle); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } return result; } /** /** * Requests a CAS session resource. * Requests a CAS session resource. * * Loading Loading @@ -391,6 +425,21 @@ public class TunerResourceManager { } } } } /** * Notifies the TRM that the Descrambler with the given handle has been released. * * <p>Client must call this whenever it releases an Descrambler. * * @param descramblerHandle the handle of the released Tuner Descrambler. */ public void releaseDescrambler(int descramblerHandle) { try { mService.releaseDescrambler(descramblerHandle); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** /** * Notifies the TRM that the given Cas session has been released. * Notifies the TRM that the given Cas session has been released. * * Loading
services/core/java/com/android/server/tv/tunerresourcemanager/TunerResourceManagerService.java +17 −0 Original line number Original line Diff line number Diff line Loading @@ -25,6 +25,7 @@ import android.media.tv.tunerresourcemanager.IResourcesReclaimListener; import android.media.tv.tunerresourcemanager.ITunerResourceManager; import android.media.tv.tunerresourcemanager.ITunerResourceManager; import android.media.tv.tunerresourcemanager.ResourceClientProfile; import android.media.tv.tunerresourcemanager.ResourceClientProfile; import android.media.tv.tunerresourcemanager.TunerDemuxRequest; import android.media.tv.tunerresourcemanager.TunerDemuxRequest; import android.media.tv.tunerresourcemanager.TunerDescramblerRequest; import android.media.tv.tunerresourcemanager.TunerFrontendInfo; import android.media.tv.tunerresourcemanager.TunerFrontendInfo; import android.media.tv.tunerresourcemanager.TunerFrontendRequest; import android.media.tv.tunerresourcemanager.TunerFrontendRequest; import android.media.tv.tunerresourcemanager.TunerLnbRequest; import android.media.tv.tunerresourcemanager.TunerLnbRequest; Loading Loading @@ -198,6 +199,15 @@ public class TunerResourceManagerService extends SystemService { return true; return true; } } @Override public boolean requestDescrambler(@NonNull TunerDescramblerRequest request, @NonNull int[] descrambleHandle) { if (DEBUG) { Slog.d(TAG, "requestDescrambler(request=" + request + ")"); } return true; } @Override @Override public boolean requestCasSession( public boolean requestCasSession( @NonNull CasSessionRequest request, @NonNull int[] sessionResourceId) { @NonNull CasSessionRequest request, @NonNull int[] sessionResourceId) { Loading Loading @@ -230,6 +240,13 @@ public class TunerResourceManagerService extends SystemService { } } } } @Override public void releaseDescrambler(int descramblerHandle) { if (DEBUG) { Slog.d(TAG, "releaseDescrambler(descramblerHandle=" + descramblerHandle + ")"); } } @Override @Override public void releaseCasSession(int sessionResourceId) { public void releaseCasSession(int sessionResourceId) { if (DEBUG) { if (DEBUG) { Loading