Merge "TIF: Rename setTvInputInfo to updateTvInputInfo" into nyc-dev

am: 519e0591fe

* commit '519e0591fe59bb03571e900ee53327d132e3e4b8':
  TIF: Rename setTvInputInfo to updateTvInputInfo
This commit is contained in:
Jae Seo
2016-02-17 02:55:59 +00:00
committed by android-build-merger
8 changed files with 51 additions and 42 deletions

View File

@@ -22977,7 +22977,7 @@ package android.media.tv {
method public void onInputRemoved(java.lang.String); method public void onInputRemoved(java.lang.String);
method public void onInputStateChanged(java.lang.String, int); method public void onInputStateChanged(java.lang.String, int);
method public void onInputUpdated(java.lang.String); method public void onInputUpdated(java.lang.String);
method public void onTvInputInfoChanged(android.media.tv.TvInputInfo); method public void onTvInputInfoUpdated(android.media.tv.TvInputInfo);
} }
public abstract class TvInputService extends android.app.Service { public abstract class TvInputService extends android.app.Service {
@@ -22985,7 +22985,7 @@ package android.media.tv {
method public final android.os.IBinder onBind(android.content.Intent); method public final android.os.IBinder onBind(android.content.Intent);
method public android.media.tv.TvInputService.RecordingSession onCreateRecordingSession(java.lang.String); method public android.media.tv.TvInputService.RecordingSession onCreateRecordingSession(java.lang.String);
method public abstract android.media.tv.TvInputService.Session onCreateSession(java.lang.String); method public abstract android.media.tv.TvInputService.Session onCreateSession(java.lang.String);
method public static final void setTvInputInfo(android.content.Context, android.media.tv.TvInputInfo); method public static final void updateTvInputInfo(android.content.Context, android.media.tv.TvInputInfo);
field public static final java.lang.String SERVICE_INTERFACE = "android.media.tv.TvInputService"; field public static final java.lang.String SERVICE_INTERFACE = "android.media.tv.TvInputService";
field public static final java.lang.String SERVICE_META_DATA = "android.media.tv.input"; field public static final java.lang.String SERVICE_META_DATA = "android.media.tv.input";
} }

View File

@@ -24720,7 +24720,7 @@ package android.media.tv {
method public void onInputRemoved(java.lang.String); method public void onInputRemoved(java.lang.String);
method public void onInputStateChanged(java.lang.String, int); method public void onInputStateChanged(java.lang.String, int);
method public void onInputUpdated(java.lang.String); method public void onInputUpdated(java.lang.String);
method public void onTvInputInfoChanged(android.media.tv.TvInputInfo); method public void onTvInputInfoUpdated(android.media.tv.TvInputInfo);
} }
public abstract class TvInputService extends android.app.Service { public abstract class TvInputService extends android.app.Service {
@@ -24732,7 +24732,7 @@ package android.media.tv {
method public java.lang.String onHardwareRemoved(android.media.tv.TvInputHardwareInfo); method public java.lang.String onHardwareRemoved(android.media.tv.TvInputHardwareInfo);
method public android.media.tv.TvInputInfo onHdmiDeviceAdded(android.hardware.hdmi.HdmiDeviceInfo); method public android.media.tv.TvInputInfo onHdmiDeviceAdded(android.hardware.hdmi.HdmiDeviceInfo);
method public java.lang.String onHdmiDeviceRemoved(android.hardware.hdmi.HdmiDeviceInfo); method public java.lang.String onHdmiDeviceRemoved(android.hardware.hdmi.HdmiDeviceInfo);
method public static final void setTvInputInfo(android.content.Context, android.media.tv.TvInputInfo); method public static final void updateTvInputInfo(android.content.Context, android.media.tv.TvInputInfo);
field public static final java.lang.String SERVICE_INTERFACE = "android.media.tv.TvInputService"; field public static final java.lang.String SERVICE_INTERFACE = "android.media.tv.TvInputService";
field public static final java.lang.String SERVICE_META_DATA = "android.media.tv.input"; field public static final java.lang.String SERVICE_META_DATA = "android.media.tv.input";
} }

View File

@@ -22986,7 +22986,7 @@ package android.media.tv {
method public void onInputRemoved(java.lang.String); method public void onInputRemoved(java.lang.String);
method public void onInputStateChanged(java.lang.String, int); method public void onInputStateChanged(java.lang.String, int);
method public void onInputUpdated(java.lang.String); method public void onInputUpdated(java.lang.String);
method public void onTvInputInfoChanged(android.media.tv.TvInputInfo); method public void onTvInputInfoUpdated(android.media.tv.TvInputInfo);
} }
public abstract class TvInputService extends android.app.Service { public abstract class TvInputService extends android.app.Service {
@@ -22994,7 +22994,7 @@ package android.media.tv {
method public final android.os.IBinder onBind(android.content.Intent); method public final android.os.IBinder onBind(android.content.Intent);
method public android.media.tv.TvInputService.RecordingSession onCreateRecordingSession(java.lang.String); method public android.media.tv.TvInputService.RecordingSession onCreateRecordingSession(java.lang.String);
method public abstract android.media.tv.TvInputService.Session onCreateSession(java.lang.String); method public abstract android.media.tv.TvInputService.Session onCreateSession(java.lang.String);
method public static final void setTvInputInfo(android.content.Context, android.media.tv.TvInputInfo); method public static final void updateTvInputInfo(android.content.Context, android.media.tv.TvInputInfo);
field public static final java.lang.String SERVICE_INTERFACE = "android.media.tv.TvInputService"; field public static final java.lang.String SERVICE_INTERFACE = "android.media.tv.TvInputService";
field public static final java.lang.String SERVICE_META_DATA = "android.media.tv.input"; field public static final java.lang.String SERVICE_META_DATA = "android.media.tv.input";
} }

View File

@@ -41,7 +41,7 @@ import android.view.Surface;
interface ITvInputManager { interface ITvInputManager {
List<TvInputInfo> getTvInputList(int userId); List<TvInputInfo> getTvInputList(int userId);
TvInputInfo getTvInputInfo(in String inputId, int userId); TvInputInfo getTvInputInfo(in String inputId, int userId);
void setTvInputInfo(in TvInputInfo inputInfo, int userId); void updateTvInputInfo(in TvInputInfo inputInfo, int userId);
int getTvInputState(in String inputId, int userId); int getTvInputState(in String inputId, int userId);
List<TvContentRatingSystemInfo> getTvContentRatingSystemList(int userId); List<TvContentRatingSystemInfo> getTvContentRatingSystemList(int userId);

View File

@@ -26,8 +26,6 @@ oneway interface ITvInputManagerCallback {
void onInputAdded(in String inputId); void onInputAdded(in String inputId);
void onInputRemoved(in String inputId); void onInputRemoved(in String inputId);
void onInputUpdated(in String inputId); void onInputUpdated(in String inputId);
void onInputStateChanged(in String inputId, int state); void onInputStateChanged(in String inputId, int state);
void onTvInputInfoUpdated(in TvInputInfo TvInputInfo);
void onTvInputInfoChanged(in TvInputInfo TvInputInfo);
} }

View File

@@ -727,11 +727,17 @@ public final class TvInputManager {
} }
/** /**
* This is called when the information about a given TV input has been changed. * This is called when the information about an existing TV input has been updated.
* *
* @param inputInfo TvInputInfo object that contains the information about the TV input. * <p>Because the system automatically creates a <code>TvInputInfo</code> object for each TV
* input based on the information collected from the <code>AndroidManifest.xml</code>, this
* method is only called back when such information has changed dynamically or when the TV
* input service implementation wants to pass additional information that is not specified
* by the manifest file, such as ability to record and tuner count.
*
* @param inputInfo The <code>TvInputInfo</code> object that contains new information.
*/ */
public void onTvInputInfoChanged(TvInputInfo inputInfo) { public void onTvInputInfoUpdated(TvInputInfo inputInfo) {
} }
} }
@@ -784,11 +790,11 @@ public final class TvInputManager {
}); });
} }
public void postTvInputInfoChanged(final TvInputInfo inputInfo) { public void postTvInputInfoUpdated(final TvInputInfo inputInfo) {
mHandler.post(new Runnable() { mHandler.post(new Runnable() {
@Override @Override
public void run() { public void run() {
mCallback.onTvInputInfoChanged(inputInfo); mCallback.onTvInputInfoUpdated(inputInfo);
} }
}); });
} }
@@ -1077,10 +1083,10 @@ public final class TvInputManager {
} }
@Override @Override
public void onTvInputInfoChanged(TvInputInfo inputInfo) { public void onTvInputInfoUpdated(TvInputInfo inputInfo) {
synchronized (mLock) { synchronized (mLock) {
for (TvInputCallbackRecord record : mCallbackRecords) { for (TvInputCallbackRecord record : mCallbackRecords) {
record.postTvInputInfoChanged(inputInfo); record.postTvInputInfoUpdated(inputInfo);
} }
} }
} }
@@ -1131,19 +1137,19 @@ public final class TvInputManager {
} }
/** /**
* Sets a new TvInputInfo object for a given input. * Updates information about an existing TV input.
* *
* <p>This is called internally only by {@link TvInputService}. * <p>This is called internally only by {@link TvInputService}.
* *
* @param inputInfo The TvInputInfo object to set. * @param inputInfo The <code>TvInputInfo</code> object that contains new information.
* @throws IllegalArgumentException if the argument is {@code null}. * @throws IllegalArgumentException if the argument is {@code null}.
*/ */
void setTvInputInfo(@NonNull TvInputInfo inputInfo) { void updateTvInputInfo(@NonNull TvInputInfo inputInfo) {
Preconditions.checkNotNull(inputInfo); Preconditions.checkNotNull(inputInfo);
try { try {
mService.setTvInputInfo(inputInfo, mUserId); mService.updateTvInputInfo(inputInfo, mUserId);
} catch (RemoteException e) { } catch (RemoteException e) {
throw new RuntimeException("Error trying to set " + inputInfo, e); throw new RuntimeException("Error trying to update " + inputInfo, e);
} }
} }

View File

@@ -255,23 +255,31 @@ public abstract class TvInputService extends Service {
return null; return null;
} }
/** /**
* Sets the TvInputInfo for this TV input. * Updates the <code>TvInputInfo</code> for an existing TV input. A TV input service
* implementation may call this method to pass the application and system an up-to-date
* <code>TvInputInfo</code> object that describes itself.
* *
* <p>The system service automatically creates the TvInputInfo for each TV input based on * <p>The system automatically creates a <code>TvInputInfo</code> object for each TV input,
* information collected from the AndroidManifest.xml, thus it is not necessary to call this * based on the information collected from the <code>AndroidManifest.xml</code>, thus it is not
* method unless the TV input has additional information to pass such as ability to record and * necessary to call this method unless such information has changed dynamically. This may be
* tuner count. Attempting to change information about a TV input that the calling package does * also used to pass additional information that is not specified by the manifest file, such as
* not own does nothing. * ability to record and tuner count. Use {@link TvInputInfo.Builder} to build a new
* <code>TvInputInfo</code> object.
*
* <p>Attempting to change information about a TV input that the calling package does not own
* does nothing.
* *
* @param context The application context. * @param context The application context.
* @param inputInfo The TvInputInfo object that contains that new information. * @param inputInfo The <code>TvInputInfo</code> object that contains new information.
* @see TvInputManager.TvInputCallback#onTvInputInfoUpdated(TvInputInfo)
*/ */
public static final void setTvInputInfo(Context context, TvInputInfo inputInfo) { public static final void updateTvInputInfo(Context context, TvInputInfo inputInfo) {
TvInputManager manager = (TvInputManager) context.getSystemService( TvInputManager manager = (TvInputManager) context.getSystemService(
Context.TV_INPUT_SERVICE); Context.TV_INPUT_SERVICE);
manager.setTvInputInfo(inputInfo); if (manager != null) {
manager.updateTvInputInfo(inputInfo);
}
} }
private boolean isPassthroughInput(String inputId) { private boolean isPassthroughInput(String inputId) {

View File

@@ -769,9 +769,9 @@ public final class TvInputManagerService extends SystemService {
} }
} }
private void setTvInputInfoLocked(UserState userState, TvInputInfo inputInfo) { private void updateTvInputInfoLocked(UserState userState, TvInputInfo inputInfo) {
if (DEBUG) { if (DEBUG) {
Slog.d(TAG, "setTvInputInfoLocked(inputInfo=" + inputInfo + ")"); Slog.d(TAG, "updateTvInputInfoLocked(inputInfo=" + inputInfo + ")");
} }
String inputId = inputInfo.getId(); String inputId = inputInfo.getId();
TvInputState inputState = userState.inputMap.get(inputId); TvInputState inputState = userState.inputMap.get(inputId);
@@ -779,16 +779,13 @@ public final class TvInputManagerService extends SystemService {
Slog.e(TAG, "failed to set input info - unknown input id " + inputId); Slog.e(TAG, "failed to set input info - unknown input id " + inputId);
return; return;
} }
if (inputState.info.equals(inputInfo)) {
return;
}
inputState.info = inputInfo; inputState.info = inputInfo;
for (ITvInputManagerCallback callback : userState.callbackSet) { for (ITvInputManagerCallback callback : userState.callbackSet) {
try { try {
callback.onTvInputInfoChanged(inputInfo); callback.onTvInputInfoUpdated(inputInfo);
} catch (RemoteException e) { } catch (RemoteException e) {
Slog.e(TAG, "failed to report changed input info to callback", e); Slog.e(TAG, "failed to report updated input info to callback", e);
} }
} }
} }
@@ -845,7 +842,7 @@ public final class TvInputManagerService extends SystemService {
} }
} }
public void setTvInputInfo(TvInputInfo inputInfo, int userId) { public void updateTvInputInfo(TvInputInfo inputInfo, int userId) {
String inputInfoPackageName = inputInfo.getServiceInfo().packageName; String inputInfoPackageName = inputInfo.getServiceInfo().packageName;
String callingPackageName = getCallingPackageName(); String callingPackageName = getCallingPackageName();
if (!TextUtils.equals(inputInfoPackageName, callingPackageName)) { if (!TextUtils.equals(inputInfoPackageName, callingPackageName)) {
@@ -854,12 +851,12 @@ public final class TvInputManagerService extends SystemService {
} }
final int resolvedUserId = resolveCallingUserId(Binder.getCallingPid(), final int resolvedUserId = resolveCallingUserId(Binder.getCallingPid(),
Binder.getCallingUid(), userId, "setTvInputInfo"); Binder.getCallingUid(), userId, "updateTvInputInfo");
final long identity = Binder.clearCallingIdentity(); final long identity = Binder.clearCallingIdentity();
try { try {
synchronized (mLock) { synchronized (mLock) {
UserState userState = getOrCreateUserStateLocked(resolvedUserId); UserState userState = getOrCreateUserStateLocked(resolvedUserId);
setTvInputInfoLocked(userState, inputInfo); updateTvInputInfoLocked(userState, inputInfo);
} }
} finally { } finally {
Binder.restoreCallingIdentity(identity); Binder.restoreCallingIdentity(identity);