Rename TvChannelInfo to TunedInfo
Bug: 163350497 Test: atest mmm Change-Id: I1365a393547049fd17647f99a00d93987ea6f96b
This commit is contained in:
@@ -25,7 +25,7 @@ import android.media.tv.ITvInputClient;
|
||||
import android.media.tv.ITvInputHardware;
|
||||
import android.media.tv.ITvInputHardwareCallback;
|
||||
import android.media.tv.ITvInputManagerCallback;
|
||||
import android.media.tv.TvChannelInfo;
|
||||
import android.media.tv.TunedInfo;
|
||||
import android.media.tv.TvContentRatingSystemInfo;
|
||||
import android.media.tv.TvInputHardwareInfo;
|
||||
import android.media.tv.TvInputInfo;
|
||||
@@ -89,7 +89,7 @@ interface ITvInputManager {
|
||||
void timeShiftSetPlaybackParams(in IBinder sessionToken, in PlaybackParams params, int userId);
|
||||
void timeShiftEnablePositionTracking(in IBinder sessionToken, boolean enable, int userId);
|
||||
|
||||
List<TvChannelInfo> getCurrentTvChannelInfos(int userId);
|
||||
List<TunedInfo> getCurrentTunedInfos(int userId);
|
||||
|
||||
// For the recording session
|
||||
void startRecording(in IBinder sessionToken, in Uri programUri, in Bundle params, int userId);
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package android.media.tv;
|
||||
|
||||
import android.media.tv.TvChannelInfo;
|
||||
import android.media.tv.TunedInfo;
|
||||
import android.media.tv.TvInputInfo;
|
||||
|
||||
/**
|
||||
@@ -29,5 +29,5 @@ oneway interface ITvInputManagerCallback {
|
||||
void onInputUpdated(in String inputId);
|
||||
void onInputStateChanged(in String inputId, int state);
|
||||
void onTvInputInfoUpdated(in TvInputInfo TvInputInfo);
|
||||
void onCurrentTvChannelInfosUpdated(in List<TvChannelInfo> currentTvChannelInfos);
|
||||
void onCurrentTunedInfosUpdated(in List<TunedInfo> currentTunedInfos);
|
||||
}
|
||||
|
||||
@@ -16,4 +16,4 @@
|
||||
|
||||
package android.media.tv;
|
||||
|
||||
parcelable TvChannelInfo;
|
||||
parcelable TunedInfo;
|
||||
@@ -31,11 +31,12 @@ import java.util.Objects;
|
||||
|
||||
|
||||
/**
|
||||
* This class is used to specify information of a TV channel.
|
||||
* Contains information about a {@link TvInputService.Session} that is currently tuned to a channel
|
||||
* or pass-through input.
|
||||
* @hide
|
||||
*/
|
||||
public final class TvChannelInfo implements Parcelable {
|
||||
static final String TAG = "TvChannelInfo";
|
||||
public final class TunedInfo implements Parcelable {
|
||||
static final String TAG = "TunedInfo";
|
||||
|
||||
/**
|
||||
* App tag for {@link #getAppTag()}: the corresponding application of the channel is the same as
|
||||
@@ -67,21 +68,21 @@ public final class TvChannelInfo implements Parcelable {
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface AppType {}
|
||||
|
||||
public static final @NonNull Parcelable.Creator<TvChannelInfo> CREATOR =
|
||||
new Parcelable.Creator<TvChannelInfo>() {
|
||||
public static final @NonNull Parcelable.Creator<TunedInfo> CREATOR =
|
||||
new Parcelable.Creator<TunedInfo>() {
|
||||
@Override
|
||||
public TvChannelInfo createFromParcel(Parcel source) {
|
||||
public TunedInfo createFromParcel(Parcel source) {
|
||||
try {
|
||||
return new TvChannelInfo(source);
|
||||
return new TunedInfo(source);
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "Exception creating TvChannelInfo from parcel", e);
|
||||
Log.e(TAG, "Exception creating TunedInfo from parcel", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TvChannelInfo[] newArray(int size) {
|
||||
return new TvChannelInfo[size];
|
||||
public TunedInfo[] newArray(int size) {
|
||||
return new TunedInfo[size];
|
||||
}
|
||||
};
|
||||
|
||||
@@ -94,7 +95,7 @@ public final class TvChannelInfo implements Parcelable {
|
||||
private final int mAppTag;
|
||||
|
||||
/** @hide */
|
||||
public TvChannelInfo(
|
||||
public TunedInfo(
|
||||
String inputId, @Nullable Uri channelUri, boolean isRecordingSession,
|
||||
boolean isForeground, @AppType int appType, int appTag) {
|
||||
mInputId = inputId;
|
||||
@@ -106,7 +107,7 @@ public final class TvChannelInfo implements Parcelable {
|
||||
}
|
||||
|
||||
|
||||
private TvChannelInfo(Parcel source) {
|
||||
private TunedInfo(Parcel source) {
|
||||
mInputId = source.readString();
|
||||
String uriString = source.readString();
|
||||
mChannelUri = uriString == null ? null : Uri.parse(uriString);
|
||||
@@ -194,11 +195,11 @@ public final class TvChannelInfo implements Parcelable {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (!(o instanceof TvChannelInfo)) {
|
||||
if (!(o instanceof TunedInfo)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
TvChannelInfo other = (TvChannelInfo) o;
|
||||
TunedInfo other = (TunedInfo) o;
|
||||
|
||||
return TextUtils.equals(mInputId, other.getInputId())
|
||||
&& Objects.equals(mChannelUri, other.mChannelUri)
|
||||
@@ -901,12 +901,13 @@ public final class TvInputManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* This is called when the information about current TV channels has been updated.
|
||||
* This is called when the information about current tuned information has been updated.
|
||||
*
|
||||
* @param tvChannelInfos a list of {@link TvChannelInfo} objects of new current channels.
|
||||
* @param tunedInfos a list of {@link TunedInfo} objects of new tuned information.
|
||||
* @hide
|
||||
*/
|
||||
public void onCurrentTvChannelInfosUpdated(@NonNull List<TvChannelInfo> tvChannelInfos) {
|
||||
public void onCurrentTunedInfosUpdated(
|
||||
@NonNull List<TunedInfo> tunedInfos) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -968,12 +969,11 @@ public final class TvInputManager {
|
||||
});
|
||||
}
|
||||
|
||||
public void postCurrentTvChannelInfosUpdated(
|
||||
final List<TvChannelInfo> currentTvChannelInfos) {
|
||||
public void onCurrentTunedInfosUpdated(final List<TunedInfo> currentTunedInfos) {
|
||||
mHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mCallback.onCurrentTvChannelInfosUpdated(currentTvChannelInfos);
|
||||
mCallback.onCurrentTunedInfosUpdated(currentTunedInfos);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -1283,10 +1283,10 @@ public final class TvInputManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCurrentTvChannelInfosUpdated(List<TvChannelInfo> currentTvChannelInfos) {
|
||||
public void onCurrentTunedInfosUpdated(List<TunedInfo> currentTunedInfos) {
|
||||
synchronized (mLock) {
|
||||
for (TvInputCallbackRecord record : mCallbackRecords) {
|
||||
record.postCurrentTvChannelInfosUpdated(currentTvChannelInfos);
|
||||
record.onCurrentTunedInfosUpdated(currentTunedInfos);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1981,18 +1981,18 @@ public final class TvInputManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of TV channel information for {@link TvInputService.Session} that are
|
||||
* Returns the list of session information for {@link TvInputService.Session} that are
|
||||
* currently in use.
|
||||
* <p> Permission com.android.providers.tv.permission.ACCESS_WATCHED_PROGRAMS is required to get
|
||||
* the channel URIs. If the permission is not granted, {@link TvChannelInfo#getChannelUri()}
|
||||
* returns {@code null}.
|
||||
* the channel URIs. If the permission is not granted,
|
||||
* {@link TunedInfo#getChannelUri()} returns {@code null}.
|
||||
* @hide
|
||||
*/
|
||||
@RequiresPermission("com.android.providers.tv.permission.ACCESS_WATCHED_PROGRAMS")
|
||||
@NonNull
|
||||
public List<TvChannelInfo> getCurrentTvChannelInfos() {
|
||||
public List<TunedInfo> getCurrentTunedInfos() {
|
||||
try {
|
||||
return mService.getCurrentTvChannelInfos(mUserId);
|
||||
return mService.getCurrentTunedInfos(mUserId);
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ import android.media.tv.ITvInputService;
|
||||
import android.media.tv.ITvInputServiceCallback;
|
||||
import android.media.tv.ITvInputSession;
|
||||
import android.media.tv.ITvInputSessionCallback;
|
||||
import android.media.tv.TvChannelInfo;
|
||||
import android.media.tv.TunedInfo;
|
||||
import android.media.tv.TvContentRating;
|
||||
import android.media.tv.TvContentRatingSystemInfo;
|
||||
import android.media.tv.TvContract;
|
||||
@@ -90,7 +90,6 @@ import com.android.internal.util.DumpUtils;
|
||||
import com.android.internal.util.IndentingPrintWriter;
|
||||
import com.android.server.IoThread;
|
||||
import com.android.server.SystemService;
|
||||
import com.android.server.SystemService.TargetUser;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileDescriptor;
|
||||
@@ -114,7 +113,7 @@ public final class TvInputManagerService extends SystemService {
|
||||
private static final boolean DEBUG = false;
|
||||
private static final String TAG = "TvInputManagerService";
|
||||
private static final String DVB_DIRECTORY = "/dev/dvb";
|
||||
private static final int APP_TAG_SELF = TvChannelInfo.APP_TAG_SELF;
|
||||
private static final int APP_TAG_SELF = TunedInfo.APP_TAG_SELF;
|
||||
private static final String PERMISSION_ACCESS_WATCHED_PROGRAMS =
|
||||
"com.android.providers.tv.permission.ACCESS_WATCHED_PROGRAMS";
|
||||
|
||||
@@ -860,9 +859,9 @@ public final class TvInputManagerService extends SystemService {
|
||||
try {
|
||||
ITvInputManagerCallback callback = userState.mCallbacks.getBroadcastItem(i);
|
||||
Pair<Integer, Integer> pidUid = userState.callbackPidUidMap.get(callback);
|
||||
List<TvChannelInfo> infos = getCurrentTvChannelInfosInternalLocked(
|
||||
List<TunedInfo> infos = getCurrentTunedInfosInternalLocked(
|
||||
userState, pidUid.first, pidUid.second);
|
||||
callback.onCurrentTvChannelInfosUpdated(infos);
|
||||
callback.onCurrentTunedInfosUpdated(infos);
|
||||
} catch (RemoteException e) {
|
||||
Slog.e(TAG, "failed to report updated current channel infos to callback", e);
|
||||
}
|
||||
@@ -2097,14 +2096,14 @@ public final class TvInputManagerService extends SystemService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TvChannelInfo> getCurrentTvChannelInfos(@UserIdInt int userId) {
|
||||
public List<TunedInfo> getCurrentTunedInfos(@UserIdInt int userId) {
|
||||
int callingPid = Binder.getCallingPid();
|
||||
int callingUid = Binder.getCallingUid();
|
||||
final int resolvedUserId = resolveCallingUserId(callingPid, callingUid, userId,
|
||||
"getTvCurrentChannelInfos");
|
||||
synchronized (mLock) {
|
||||
UserState userState = getOrCreateUserStateLocked(resolvedUserId);
|
||||
return getCurrentTvChannelInfosInternalLocked(userState, callingPid, callingUid);
|
||||
return getCurrentTunedInfosInternalLocked(userState, callingPid, callingUid);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2278,9 +2277,9 @@ public final class TvInputManagerService extends SystemService {
|
||||
}
|
||||
}
|
||||
|
||||
private List<TvChannelInfo> getCurrentTvChannelInfosInternalLocked(
|
||||
private List<TunedInfo> getCurrentTunedInfosInternalLocked(
|
||||
UserState userState, int callingPid, int callingUid) {
|
||||
List<TvChannelInfo> channelInfos = new ArrayList<>();
|
||||
List<TunedInfo> channelInfos = new ArrayList<>();
|
||||
boolean watchedProgramsAccess = hasAccessWatchedProgramsPermission(callingPid, callingUid);
|
||||
for (SessionState state : userState.sessionStateMap.values()) {
|
||||
if (state.isCurrent) {
|
||||
@@ -2288,7 +2287,7 @@ public final class TvInputManagerService extends SystemService {
|
||||
int appType;
|
||||
if (state.callingUid == callingUid) {
|
||||
appTag = APP_TAG_SELF;
|
||||
appType = TvChannelInfo.APP_TYPE_SELF;
|
||||
appType = TunedInfo.APP_TYPE_SELF;
|
||||
} else {
|
||||
appTag = userState.mAppTagMap.get(state.callingUid);
|
||||
if (appTag == null) {
|
||||
@@ -2296,10 +2295,10 @@ public final class TvInputManagerService extends SystemService {
|
||||
userState.mAppTagMap.put(state.callingUid, appTag);
|
||||
}
|
||||
appType = isSystemApp(state.componentName.getPackageName())
|
||||
? TvChannelInfo.APP_TYPE_SYSTEM
|
||||
: TvChannelInfo.APP_TYPE_NON_SYSTEM;
|
||||
? TunedInfo.APP_TYPE_SYSTEM
|
||||
: TunedInfo.APP_TYPE_NON_SYSTEM;
|
||||
}
|
||||
channelInfos.add(new TvChannelInfo(
|
||||
channelInfos.add(new TunedInfo(
|
||||
state.inputId,
|
||||
watchedProgramsAccess ? state.currentChannel : null,
|
||||
state.isRecordingSession,
|
||||
|
||||
Reference in New Issue
Block a user