Merge "add a method for non session" into tm-dev am: fd2350064a

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16941696

Change-Id: I914ea9c4ddb77df3eee230376942afc574224094
This commit is contained in:
Henry Fang
2022-02-18 23:59:25 +00:00
committed by Automerger Merge Worker
2 changed files with 38 additions and 8 deletions

View File

@@ -6789,7 +6789,8 @@ package android.media.tv {
method @NonNull @RequiresPermission(android.Manifest.permission.TIS_EXTENSION_INTERFACE) public java.util.List<java.lang.String> getAvailableExtensionInterfaceNames(@NonNull String);
method @RequiresPermission(android.Manifest.permission.CAPTURE_TV_INPUT) public java.util.List<android.media.tv.TvStreamConfig> getAvailableTvStreamConfigList(String);
method @RequiresPermission("android.permission.TUNER_RESOURCE_ACCESS") public int getClientPid(@NonNull String);
method @RequiresPermission("android.permission.TUNER_RESOURCE_ACCESS") public int getClientPriority(int, @Nullable String);
method @RequiresPermission("android.permission.TUNER_RESOURCE_ACCESS") public int getClientPriority(int, @NonNull String);
method @RequiresPermission("android.permission.TUNER_RESOURCE_ACCESS") public int getClientPriority(int);
method @NonNull @RequiresPermission(android.Manifest.permission.ACCESS_TUNED_INFO) public java.util.List<android.media.tv.TunedInfo> getCurrentTunedInfos();
method @NonNull @RequiresPermission("android.permission.DVB_DEVICE") public java.util.List<android.media.tv.DvbDeviceInfo> getDvbDeviceList();
method @Nullable @RequiresPermission(android.Manifest.permission.TIS_EXTENSION_INTERFACE) public android.os.IBinder getExtensionInterface(@NonNull String, @NonNull String);

View File

@@ -1863,12 +1863,9 @@ public final class TvInputManager {
* Returns a priority for the given use case type and the client's foreground or background
* status.
*
* @param useCase the use case type of the client. When the given use case type is invalid,
* the default use case type will be used. {@see TvInputService#PriorityHintUseCaseType}.
* @param sessionId the unique id of the session owned by the client. When {@code null},
* the caller will be used as a client. When the session is invalid, background status
* will be used as a client's status. Otherwise, TV app corresponding to the given
* session id will be used as a client.
* @param useCase the use case type of the client.
* {@see TvInputService#PriorityHintUseCaseType}.
* @param sessionId the unique id of the session owned by the client.
* {@see TvInputService#onCreateSession(String, String)}.
*
* @return the use case priority value for the given use case type and the client's foreground
@@ -1879,10 +1876,34 @@ public final class TvInputManager {
@SystemApi
@RequiresPermission(android.Manifest.permission.TUNER_RESOURCE_ACCESS)
public int getClientPriority(@TvInputService.PriorityHintUseCaseType int useCase,
@Nullable String sessionId) {
@NonNull String sessionId) {
Preconditions.checkNotNull(sessionId);
if (!isValidUseCase(useCase)) {
throw new IllegalArgumentException("Invalid use case: " + useCase);
}
return getClientPriorityInternal(useCase, sessionId);
};
/**
* Returns a priority for the given use case type and the caller's foreground or background
* status.
*
* @param useCase the use case type of the caller.
* {@see TvInputService#PriorityHintUseCaseType}.
*
* @return the use case priority value for the given use case type and the caller's foreground
* or background status.
*
* @hide
*/
@SystemApi
@RequiresPermission(android.Manifest.permission.TUNER_RESOURCE_ACCESS)
public int getClientPriority(@TvInputService.PriorityHintUseCaseType int useCase) {
if (!isValidUseCase(useCase)) {
throw new IllegalArgumentException("Invalid use case: " + useCase);
}
return getClientPriorityInternal(useCase, null);
};
/**
* Creates a recording {@link Session} for a given TV input.
*
@@ -1935,6 +1956,14 @@ public final class TvInputManager {
}
}
private boolean isValidUseCase(int useCase) {
return useCase == TvInputService.PRIORITY_HINT_USE_CASE_TYPE_BACKGROUND
|| useCase == TvInputService.PRIORITY_HINT_USE_CASE_TYPE_SCAN
|| useCase == TvInputService.PRIORITY_HINT_USE_CASE_TYPE_PLAYBACK
|| useCase == TvInputService.PRIORITY_HINT_USE_CASE_TYPE_LIVE
|| useCase == TvInputService.PRIORITY_HINT_USE_CASE_TYPE_RECORD;
}
/**
* Returns the TvStreamConfig list of the given TV input.
*