Add Lnb related APIs into the TunerResourceManager interface
Update, request and release APIs are added in this CL. Test: manual Bug: 147380513 Change-Id: I084f091cef8a7c020afa93539a46725300b102c7
This commit is contained in:
@@ -21,6 +21,7 @@ import android.media.tv.tuner.ITunerResourceManagerListener;
|
||||
import android.media.tv.tuner.ResourceClientProfile;
|
||||
import android.media.tv.tuner.TunerFrontendInfo;
|
||||
import android.media.tv.tuner.TunerFrontendRequest;
|
||||
import android.media.tv.tuner.TunerLnbRequest;
|
||||
|
||||
/**
|
||||
* Interface of the Tuner Resource Manager. It manages resources used by TV Tuners.
|
||||
@@ -99,6 +100,16 @@ interface ITunerResourceManager {
|
||||
*/
|
||||
void updateCasInfo(in int casSystemId, in int maxSessionNum);
|
||||
|
||||
/*
|
||||
* Updates the available Lnb resource information on the current device.
|
||||
*
|
||||
* <p><strong>Note:</strong> This update must happen before the first
|
||||
* {@link #requestLnb(TunerLnbRequest, int[])} and {@link #releaseLnb(int)} call.
|
||||
*
|
||||
* @param lnbIds ids of the updating lnbs.
|
||||
*/
|
||||
void setLnbInfoList(in int[] lnbIds);
|
||||
|
||||
/*
|
||||
* This API is used by the Tuner framework to request an available frontend from the TunerHAL.
|
||||
*
|
||||
@@ -162,6 +173,30 @@ interface ITunerResourceManager {
|
||||
*/
|
||||
boolean requestCasSession(in CasSessionRequest request, out int[] sessionResourceId);
|
||||
|
||||
/*
|
||||
* This API is used by the Tuner framework to request an available Lnb from the TunerHAL.
|
||||
*
|
||||
* <p>There are three possible scenarios:
|
||||
* <ul>
|
||||
* <li>If there is Lnb available, the API would send the id back.
|
||||
*
|
||||
* <li>If no Lnb is available but the current request has a higher priority than other uses of
|
||||
* lnbs, the API will send {@link ITunerResourceManagerCallback#onResourcesReclaim()} 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 Lnb system can be granted, the API would return false.
|
||||
* <ul>
|
||||
*
|
||||
* <p><strong>Note:</strong> {@link #setLnbInfos(int[])} must be called before this request.
|
||||
*
|
||||
* @param request {@link TunerLnbRequest} information of the current request.
|
||||
* @param lnbId a one-element array to return the granted Lnb id.
|
||||
*
|
||||
* @return true if there is Lnb granted.
|
||||
*/
|
||||
boolean requestLnb(in TunerLnbRequest request, out int[] lnbId);
|
||||
|
||||
/*
|
||||
* Notifies the TRM that the given frontend has been released.
|
||||
*
|
||||
@@ -184,4 +219,15 @@ interface ITunerResourceManager {
|
||||
* @param sessionResourceId the id of the released CAS session.
|
||||
*/
|
||||
void releaseCasSession(in int sessionResourceId);
|
||||
|
||||
/*
|
||||
* Notifies the TRM that the Lnb with the given id was released.
|
||||
*
|
||||
* <p>Client must call this whenever it releases an Lnb.
|
||||
*
|
||||
* <p><strong>Note:</strong> {@link #setLnbInfos(int[])} must be called before this release.
|
||||
*
|
||||
* @param lnbId the id of the released Tuner Lnb.
|
||||
*/
|
||||
void releaseLnb(in int lnbId);
|
||||
}
|
||||
|
||||
24
media/java/android/media/tv/tuner/TunerLnbRequest.aidl
Normal file
24
media/java/android/media/tv/tuner/TunerLnbRequest.aidl
Normal file
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* 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.tuner;
|
||||
|
||||
/**
|
||||
* Information required to request a Tuner Lnb.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
parcelable TunerLnbRequest;
|
||||
96
media/java/android/media/tv/tuner/TunerLnbRequest.java
Normal file
96
media/java/android/media/tv/tuner/TunerLnbRequest.java
Normal file
@@ -0,0 +1,96 @@
|
||||
/*
|
||||
* 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.tuner;
|
||||
|
||||
import android.annotation.NonNull;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.util.Log;
|
||||
|
||||
/**
|
||||
* Information required to request a Tuner Lnb.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public final class TunerLnbRequest implements Parcelable {
|
||||
static final String TAG = "TunerLnbRequest";
|
||||
|
||||
public static final
|
||||
@NonNull
|
||||
Parcelable.Creator<TunerLnbRequest> CREATOR =
|
||||
new Parcelable.Creator<TunerLnbRequest>() {
|
||||
@Override
|
||||
public TunerLnbRequest createFromParcel(Parcel source) {
|
||||
try {
|
||||
return new TunerLnbRequest(source);
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "Exception creating TunerLnbRequest from parcel", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TunerLnbRequest[] newArray(int size) {
|
||||
return new TunerLnbRequest[size];
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Client id of the client that sends the request.
|
||||
*/
|
||||
private final int mClientId;
|
||||
|
||||
private TunerLnbRequest(@NonNull Parcel source) {
|
||||
mClientId = source.readInt();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new {@link TunerLnbRequest} with the given parameters.
|
||||
*
|
||||
* @param clientId the id of the client.
|
||||
*/
|
||||
public TunerLnbRequest(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("TunerLnbRequest {clientId=").append(mClientId);
|
||||
b.append("}");
|
||||
return b.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(@NonNull Parcel dest, int flags) {
|
||||
dest.writeInt(mClientId);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user