Adding ITunerResourceManagerService interface into android.media.tv
This CL handles the frontend related APIs. Please see MediaCas and Lnb related APIs in the CL chain. Test: manual Bug: 147380513 Change-Id: I0c463dc29b39fdca0cba07a4a4a445d7a6054c14
This commit is contained in:
138
media/java/android/media/tv/tuner/ITunerResourceManager.aidl
Normal file
138
media/java/android/media/tv/tuner/ITunerResourceManager.aidl
Normal file
@@ -0,0 +1,138 @@
|
||||
/*
|
||||
* 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.media.tv.tuner.ITunerResourceManagerListener;
|
||||
import android.media.tv.tuner.ResourceClientProfile;
|
||||
import android.media.tv.tuner.TunerFrontendInfo;
|
||||
import android.media.tv.tuner.TunerFrontendRequest;
|
||||
|
||||
/**
|
||||
* Interface of the Tuner Resource Manager. It manages resources used by TV Tuners.
|
||||
* <p>Resources include:
|
||||
* <ul>
|
||||
* <li>TunerFrontend {@link android.media.tv.tuner.frontend}.
|
||||
* <li>TunerLnb {@link android.media.tv.tuner.Lnb}.
|
||||
* <li>MediaCas {@link android.media.MediaCas}.
|
||||
* <li>TvInputHardware {@link android.media.tv.TvInputHardwareInfo}.
|
||||
* <ul>
|
||||
*
|
||||
* <p>Expected workflow is:
|
||||
* <ul>
|
||||
* <li>Tuner Java/MediaCas/TIF update resources of the current device with TRM.
|
||||
* <li>Client registers its profile through {@link #registerClientProfile(ResourceClientProfile,
|
||||
* ITunerResourceManagerListener, int[])}.
|
||||
* <li>Client requests resources through request APIs.
|
||||
* <li>If the resource needs to be handed to a higher priority client from a lower priority
|
||||
* one, TRM calls ITunerResourceManagerListener registered by the lower priority client to release
|
||||
* the resource.
|
||||
* <ul>
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
interface ITunerResourceManager {
|
||||
/*
|
||||
* This API is used by the client to register their profile with the Tuner Resource manager.
|
||||
*
|
||||
* <p>The profile contains information that can show the base priority score of the client.
|
||||
*
|
||||
* @param profile {@link ResourceClientProfile} profile of the current client
|
||||
* @param listener {@link ITunerResourceManagerListener} a callback to
|
||||
* reclaim clients' resources when needed.
|
||||
* @param clientId returns a clientId from the resource manager when the
|
||||
* the client registers its profile.
|
||||
*/
|
||||
void registerClientProfile(in ResourceClientProfile profile,
|
||||
ITunerResourceManagerListener listener, out int[] clientId);
|
||||
|
||||
/*
|
||||
* This API is used by the client to unregister their profile with the Tuner Resource manager.
|
||||
*
|
||||
* @param clientId the client id that needs to be unregistered.
|
||||
*/
|
||||
void unregisterClientProfile(in int clientId);
|
||||
|
||||
/*
|
||||
* Updates a registered client's priority and niceValue.
|
||||
*
|
||||
* @param clientId the id of the client that is updating its profile.
|
||||
* @param priority the priority that the client would like to update to.
|
||||
* @param niceValue the nice value that the client would like to update to.
|
||||
*
|
||||
* @return true if the update is successful.
|
||||
*/
|
||||
boolean updateClientPriority(in int clientId, in int priority, in int niceValue);
|
||||
|
||||
/*
|
||||
* Updates the available Frontend resources information on the current device.
|
||||
*
|
||||
* <p><strong>Note:</strong> This update must happen before the first
|
||||
* {@link #requestFrontend(TunerFrontendRequest,int[])} and {@link #releaseFrontend(int)} call.
|
||||
*
|
||||
* @param infos an array of the available {@link TunerFrontendInfo} information.
|
||||
*/
|
||||
void setFrontendInfoList(in TunerFrontendInfo[] infos);
|
||||
|
||||
/*
|
||||
* This API is used by the Tuner framework to request an available frontend from the TunerHAL.
|
||||
*
|
||||
* <p>There are three possible scenarios:
|
||||
* <ul>
|
||||
* <li>If there is frontend available, the API would send the id back.
|
||||
*
|
||||
* <li>If no Frontend is available but the current request info can show higher priority than
|
||||
* other uses of Frontend, the API will send
|
||||
* {@link ITunerResourceManagerListener#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 frontend can be granted, the API would return false.
|
||||
* <ul>
|
||||
*
|
||||
* <p><strong>Note:</strong> {@link #setFrontendInfoList(TunerFrontendInfo[])} must be called
|
||||
* before this request.
|
||||
*
|
||||
* @param request {@link TunerFrontendRequest} information of the current request.
|
||||
* @param frontendId a one-element array to return the granted frontendId.
|
||||
*
|
||||
* @return true if there is frontend granted.
|
||||
*/
|
||||
boolean requestFrontend(in TunerFrontendRequest request, out int[] frontendId);
|
||||
|
||||
/*
|
||||
* Requests to share frontend with an existing client.
|
||||
*
|
||||
* <p><strong>Note:</strong> {@link #setFrontendInfoList(TunerFrontendInfo[])} must be called
|
||||
* before this request.
|
||||
*
|
||||
* @param selfClientId the id of the client that sends the request.
|
||||
* @param targetClientId the id of the client to share the frontend with.
|
||||
*/
|
||||
void shareFrontend(in int selfClientId, in int targetClientId);
|
||||
|
||||
/*
|
||||
* Notifies the TRM that the given frontend has been released.
|
||||
*
|
||||
* <p>Client must call this whenever it releases a Tuner frontend.
|
||||
*
|
||||
* <p><strong>Note:</strong> {@link #setFrontendInfoList(TunerFrontendInfo[])} must be called
|
||||
* before this release.
|
||||
*
|
||||
* @param frontendId the id of the released frontend.
|
||||
*/
|
||||
void releaseFrontend(in int frontendId);
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* Interface to receive callbacks from ITunerResourceManager.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
oneway interface ITunerResourceManagerListener {
|
||||
/*
|
||||
* TRM invokes this method when the client's resources need to be reclaimed.
|
||||
*
|
||||
* <p>This method is implemented in Tuner Framework to take the reclaiming
|
||||
* actions. It's a synchonized call. TRM would wait on the call to finish
|
||||
* then grant the resource.
|
||||
*/
|
||||
void onResourcesReclaim();
|
||||
}
|
||||
25
media/java/android/media/tv/tuner/ResourceClientProfile.aidl
Normal file
25
media/java/android/media/tv/tuner/ResourceClientProfile.aidl
Normal file
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* A profile of a resource client. This profile is used to register the client info
|
||||
* with the Tuner Resource Manager.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
parcelable ResourceClientProfile;
|
||||
129
media/java/android/media/tv/tuner/ResourceClientProfile.java
Normal file
129
media/java/android/media/tv/tuner/ResourceClientProfile.java
Normal file
@@ -0,0 +1,129 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* A profile of a resource client. This profile is used to register the client info
|
||||
* with the Tuner Resource Manager(TRM).
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public final class ResourceClientProfile implements Parcelable {
|
||||
static final String TAG = "ResourceClientProfile";
|
||||
|
||||
public static final
|
||||
@NonNull
|
||||
Parcelable.Creator<ResourceClientProfile> CREATOR =
|
||||
new Parcelable.Creator<ResourceClientProfile>() {
|
||||
@Override
|
||||
public ResourceClientProfile createFromParcel(Parcel source) {
|
||||
try {
|
||||
return new ResourceClientProfile(source);
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "Exception creating ResourceClientProfile from parcel", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceClientProfile[] newArray(int size) {
|
||||
return new ResourceClientProfile[size];
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* This is used by TRM to get TV App’s processId from TIF.
|
||||
* The processId will be used to identify foreground applications.
|
||||
*
|
||||
* <p>MediaCas, Tuner and TvInputHardwareManager get tvInputSessionId from TIS.
|
||||
* If mTvInputSessionId is UNKNOWN, the client is always background.
|
||||
*/
|
||||
private final String mTvInputSessionId;
|
||||
|
||||
/**
|
||||
* Usage of the client.
|
||||
*/
|
||||
private final int mUseCase;
|
||||
|
||||
private ResourceClientProfile(@NonNull Parcel source) {
|
||||
mTvInputSessionId = source.readString();
|
||||
mUseCase = source.readInt();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new {@link ResourceClientProfile} with the given parameters.
|
||||
*
|
||||
* @param tvInputSessionId the unique id of the session owned by the client.
|
||||
* @param useCase the usage of the client. Suggested priority hints are
|
||||
* {@link android.media.tv.TvInputService.PRIORITY_HINT_USE_CASE_TYPE_PLAYBACK}
|
||||
* {@link android.media.tv.TvInputService.PRIORITY_HINT_USE_CASE_TYPE_LIVE}
|
||||
* {@link android.media.tv.TvInputService.PRIORITY_HINT_USE_CASE_TYPE_RECORD}.
|
||||
* New [use case : priority value] pair can be defined in the manifest by the
|
||||
* OEM. Any undefined use case would cause IllegalArgumentException.
|
||||
*/
|
||||
public ResourceClientProfile(@NonNull String tvInputSessionId,
|
||||
int useCase) {
|
||||
mTvInputSessionId = tvInputSessionId;
|
||||
mUseCase = useCase;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the tv input session id of the client.
|
||||
*
|
||||
* @return the value of the tv input session id.
|
||||
*/
|
||||
@NonNull
|
||||
public String getTvInputSessionId() {
|
||||
return mTvInputSessionId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the user usage of the client.
|
||||
*
|
||||
* @return the value of use case.
|
||||
*/
|
||||
public int getUseCase() {
|
||||
return mUseCase;
|
||||
}
|
||||
|
||||
// Parcelable
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder b = new StringBuilder(128);
|
||||
b.append("ResourceClientProfile {tvInputSessionId=").append(mTvInputSessionId);
|
||||
b.append(", useCase=").append(mUseCase);
|
||||
b.append("}");
|
||||
return b.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(@NonNull Parcel dest, int flags) {
|
||||
dest.writeString(mTvInputSessionId);
|
||||
dest.writeInt(mUseCase);
|
||||
}
|
||||
}
|
||||
24
media/java/android/media/tv/tuner/TunerFrontendInfo.aidl
Normal file
24
media/java/android/media/tv/tuner/TunerFrontendInfo.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;
|
||||
|
||||
/**
|
||||
* Simple container of the FrontendInfo struct defined in the TunerHAL 1.0 interface.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
parcelable TunerFrontendInfo;
|
||||
141
media/java/android/media/tv/tuner/TunerFrontendInfo.java
Normal file
141
media/java/android/media/tv/tuner/TunerFrontendInfo.java
Normal file
@@ -0,0 +1,141 @@
|
||||
/*
|
||||
* 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.media.tv.tuner.frontend.FrontendSettings.Type;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.util.Log;
|
||||
|
||||
/**
|
||||
* Simple container of the FrontendInfo struct defined in the TunerHAL 1.0 interface.
|
||||
*
|
||||
* <p>Note that this object is defined to pass necessary frontend info between the
|
||||
* Tuner Resource Manager and the client. It includes partial information in
|
||||
* {@link FrontendInfo}.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public final class TunerFrontendInfo implements Parcelable {
|
||||
static final String TAG = "TunerFrontendInfo";
|
||||
|
||||
public static final
|
||||
@NonNull
|
||||
Parcelable.Creator<TunerFrontendInfo> CREATOR =
|
||||
new Parcelable.Creator<TunerFrontendInfo>() {
|
||||
@Override
|
||||
public TunerFrontendInfo createFromParcel(Parcel source) {
|
||||
try {
|
||||
return new TunerFrontendInfo(source);
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "Exception creating TunerFrontendInfo from parcel", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TunerFrontendInfo[] newArray(int size) {
|
||||
return new TunerFrontendInfo[size];
|
||||
}
|
||||
};
|
||||
|
||||
private final int mId;
|
||||
|
||||
@Type
|
||||
private final int mFrontendType;
|
||||
|
||||
/**
|
||||
* Frontends are assigned with the same exclusiveGroupId if they can't
|
||||
* function at same time. For instance, they share same hardware module.
|
||||
*/
|
||||
private final int mExclusiveGroupId;
|
||||
|
||||
private TunerFrontendInfo(@NonNull Parcel source) {
|
||||
mId = source.readInt();
|
||||
mFrontendType = source.readInt();
|
||||
mExclusiveGroupId = source.readInt();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new {@link TunerFrontendInfo} with the given parameters.
|
||||
*
|
||||
* @param frontendType the type of the frontend.
|
||||
* @param exclusiveGroupId the group id of the frontend. FE with the same
|
||||
group id can't function at the same time.
|
||||
*/
|
||||
public TunerFrontendInfo(int id,
|
||||
@Type int frontendType,
|
||||
int exclusiveGroupId) {
|
||||
mId = id;
|
||||
mFrontendType = frontendType;
|
||||
mExclusiveGroupId = exclusiveGroupId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the frontend id.
|
||||
*
|
||||
* @return the value of the frontend id.
|
||||
*/
|
||||
public int getId() {
|
||||
return mId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the application id that requests the tuner frontend resource.
|
||||
*
|
||||
* @return the value of the frontend type.
|
||||
*/
|
||||
@Type
|
||||
public int getFrontendType() {
|
||||
return mFrontendType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the exclusiveGroupId. Frontends with the same exclusiveGroupId
|
||||
* can't function at same time.
|
||||
*
|
||||
* @return the value of the exclusive group id.
|
||||
*/
|
||||
public int getExclusiveGroupId() {
|
||||
return mExclusiveGroupId;
|
||||
}
|
||||
|
||||
// Parcelable
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder b = new StringBuilder(128);
|
||||
b.append("TunerFrontendInfo {id=").append(mId);
|
||||
b.append(", frontendType=").append(mFrontendType);
|
||||
b.append(", exclusiveGroupId=").append(mExclusiveGroupId);
|
||||
b.append("}");
|
||||
return b.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(@NonNull Parcel dest, int flags) {
|
||||
dest.writeInt(mId);
|
||||
dest.writeInt(mFrontendType);
|
||||
dest.writeInt(mExclusiveGroupId);
|
||||
}
|
||||
}
|
||||
24
media/java/android/media/tv/tuner/TunerFrontendRequest.aidl
Normal file
24
media/java/android/media/tv/tuner/TunerFrontendRequest.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 Frontend.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
parcelable TunerFrontendRequest;
|
||||
114
media/java/android/media/tv/tuner/TunerFrontendRequest.java
Normal file
114
media/java/android/media/tv/tuner/TunerFrontendRequest.java
Normal file
@@ -0,0 +1,114 @@
|
||||
/*
|
||||
* 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.media.tv.tuner.frontend.FrontendSettings.Type;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.util.Log;
|
||||
|
||||
/**
|
||||
* Information required to request a Tuner Frontend.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public final class TunerFrontendRequest implements Parcelable {
|
||||
static final String TAG = "TunerFrontendRequest";
|
||||
|
||||
public static final
|
||||
@NonNull
|
||||
Parcelable.Creator<TunerFrontendRequest> CREATOR =
|
||||
new Parcelable.Creator<TunerFrontendRequest>() {
|
||||
@Override
|
||||
public TunerFrontendRequest createFromParcel(Parcel source) {
|
||||
try {
|
||||
return new TunerFrontendRequest(source);
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "Exception creating TunerFrontendRequest from parcel", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TunerFrontendRequest[] newArray(int size) {
|
||||
return new TunerFrontendRequest[size];
|
||||
}
|
||||
};
|
||||
|
||||
private final int mClientId;
|
||||
@Type
|
||||
private final int mFrontendType;
|
||||
|
||||
private TunerFrontendRequest(@NonNull Parcel source) {
|
||||
mClientId = source.readInt();
|
||||
mFrontendType = source.readInt();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new {@link TunerFrontendRequest} with the given parameters.
|
||||
*
|
||||
* @param clientId the unique id of the client returned when registering profile.
|
||||
* @param frontendType the type of the requested frontend.
|
||||
*/
|
||||
public TunerFrontendRequest(int clientId,
|
||||
@Type int frontendType) {
|
||||
mClientId = clientId;
|
||||
mFrontendType = frontendType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the client id that requests the tuner frontend resource.
|
||||
*
|
||||
* @return the value of the client id.
|
||||
*/
|
||||
public int getClientId() {
|
||||
return mClientId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the frontend type that the client requests for.
|
||||
*
|
||||
* @return the value of the requested frontend type.
|
||||
*/
|
||||
@Type
|
||||
public int getFrontendType() {
|
||||
return mFrontendType;
|
||||
}
|
||||
|
||||
// Parcelable
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder b = new StringBuilder(128);
|
||||
b.append("TunerFrontendRequest {clientId=").append(mClientId);
|
||||
b.append(", frontendType=").append(mFrontendType);
|
||||
b.append("}");
|
||||
return b.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(@NonNull Parcel dest, int flags) {
|
||||
dest.writeInt(mClientId);
|
||||
dest.writeInt(mFrontendType);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user