Merge "Add support for TvInputManager.acquireTvInputHardware CTS" into rvc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
f49fa1a9ea
@@ -1728,6 +1728,15 @@ package android.media.audiopolicy {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
package android.media.tv {
|
||||||
|
|
||||||
|
public final class TvInputManager {
|
||||||
|
method public void addHardwareDevice(int);
|
||||||
|
method public void removeHardwareDevice(int);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
package android.metrics {
|
package android.metrics {
|
||||||
|
|
||||||
public class LogMaker {
|
public class LogMaker {
|
||||||
|
|||||||
@@ -409,6 +409,8 @@ applications that come with the platform
|
|||||||
<permission name="android.permission.ACCESS_TV_DESCRAMBLER" />
|
<permission name="android.permission.ACCESS_TV_DESCRAMBLER" />
|
||||||
<permission name="android.permission.ACCESS_TV_TUNER" />
|
<permission name="android.permission.ACCESS_TV_TUNER" />
|
||||||
<permission name="android.permission.TUNER_RESOURCE_ACCESS" />
|
<permission name="android.permission.TUNER_RESOURCE_ACCESS" />
|
||||||
|
<!-- Permissions required for CTS test - TVInputManagerTest -->
|
||||||
|
<permission name="android.permission.TV_INPUT_HARDWARE" />
|
||||||
</privapp-permissions>
|
</privapp-permissions>
|
||||||
|
|
||||||
<privapp-permissions package="com.android.statementservice">
|
<privapp-permissions package="com.android.statementservice">
|
||||||
|
|||||||
@@ -111,4 +111,8 @@ interface ITvInputManager {
|
|||||||
// For preview channels and programs
|
// For preview channels and programs
|
||||||
void sendTvInputNotifyIntent(in Intent intent, int userId);
|
void sendTvInputNotifyIntent(in Intent intent, int userId);
|
||||||
void requestChannelBrowsable(in Uri channelUri, int userId);
|
void requestChannelBrowsable(in Uri channelUri, int userId);
|
||||||
|
|
||||||
|
// For CTS purpose only. Add/remove a TvInputHardware device
|
||||||
|
void addHardwareDevice(in int deviceId);
|
||||||
|
void removeHardwareDevice(in int deviceId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import android.annotation.Nullable;
|
|||||||
import android.annotation.RequiresPermission;
|
import android.annotation.RequiresPermission;
|
||||||
import android.annotation.SystemApi;
|
import android.annotation.SystemApi;
|
||||||
import android.annotation.SystemService;
|
import android.annotation.SystemService;
|
||||||
|
import android.annotation.TestApi;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.graphics.Rect;
|
import android.graphics.Rect;
|
||||||
@@ -1801,6 +1802,40 @@ public final class TvInputManager {
|
|||||||
executor, callback);
|
executor, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API to add a hardware device in the TvInputHardwareManager for CTS testing
|
||||||
|
* purpose.
|
||||||
|
*
|
||||||
|
* @param deviceId Id of the adding hardware device.
|
||||||
|
*
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
@TestApi
|
||||||
|
public void addHardwareDevice(int deviceId) {
|
||||||
|
try {
|
||||||
|
mService.addHardwareDevice(deviceId);
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
throw e.rethrowFromSystemServer();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API to remove a hardware device in the TvInputHardwareManager for CTS testing
|
||||||
|
* purpose.
|
||||||
|
*
|
||||||
|
* @param deviceId Id of the removing hardware device.
|
||||||
|
*
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
@TestApi
|
||||||
|
public void removeHardwareDevice(int deviceId) {
|
||||||
|
try {
|
||||||
|
mService.removeHardwareDevice(deviceId);
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
throw e.rethrowFromSystemServer();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private Hardware acquireTvInputHardwareInternal(int deviceId, TvInputInfo info,
|
private Hardware acquireTvInputHardwareInternal(int deviceId, TvInputInfo info,
|
||||||
String tvInputSessionId, int priorityHint,
|
String tvInputSessionId, int priorityHint,
|
||||||
Executor executor, final HardwareCallback callback) {
|
Executor executor, final HardwareCallback callback) {
|
||||||
|
|||||||
@@ -300,6 +300,9 @@
|
|||||||
<!-- Permissions needed to test shared libraries -->
|
<!-- Permissions needed to test shared libraries -->
|
||||||
<uses-permission android:name="android.permission.ACCESS_SHARED_LIBRARIES" />
|
<uses-permission android:name="android.permission.ACCESS_SHARED_LIBRARIES" />
|
||||||
|
|
||||||
|
<!-- Permissions required for CTS test - TVInputManagerTest -->
|
||||||
|
<uses-permission android:name="android.permission.TV_INPUT_HARDWARE" />
|
||||||
|
|
||||||
<application android:label="@string/app_label"
|
<application android:label="@string/app_label"
|
||||||
android:theme="@android:style/Theme.DeviceDefault.DayNight"
|
android:theme="@android:style/Theme.DeviceDefault.DayNight"
|
||||||
android:defaultToDeviceProtectedStorage="true"
|
android:defaultToDeviceProtectedStorage="true"
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package com.android.server.tv;
|
package com.android.server.tv;
|
||||||
|
|
||||||
|
import static android.media.AudioManager.DEVICE_NONE;
|
||||||
import static android.media.tv.TvInputManager.INPUT_STATE_CONNECTED;
|
import static android.media.tv.TvInputManager.INPUT_STATE_CONNECTED;
|
||||||
import static android.media.tv.TvInputManager.INPUT_STATE_CONNECTED_STANDBY;
|
import static android.media.tv.TvInputManager.INPUT_STATE_CONNECTED_STANDBY;
|
||||||
|
|
||||||
@@ -2047,6 +2048,36 @@ public final class TvInputManagerService extends SystemService {
|
|||||||
return clientPid;
|
return clientPid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a hardware device in the TvInputHardwareManager for CTS testing
|
||||||
|
* purpose.
|
||||||
|
*
|
||||||
|
* @param device id of the adding hardware device.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void addHardwareDevice(int deviceId) {
|
||||||
|
TvInputHardwareInfo info = new TvInputHardwareInfo.Builder()
|
||||||
|
.deviceId(deviceId)
|
||||||
|
.type(TvInputHardwareInfo.TV_INPUT_TYPE_HDMI)
|
||||||
|
.audioType(DEVICE_NONE)
|
||||||
|
.audioAddress("0")
|
||||||
|
.hdmiPortId(0)
|
||||||
|
.build();
|
||||||
|
mTvInputHardwareManager.onDeviceAvailable(info, null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove a hardware device in the TvInputHardwareManager for CTS testing
|
||||||
|
* purpose.
|
||||||
|
*
|
||||||
|
* @param device id of the removing hardware device.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void removeHardwareDevice(int deviceId) {
|
||||||
|
mTvInputHardwareManager.onDeviceUnavailable(deviceId);
|
||||||
|
}
|
||||||
|
|
||||||
private int getClientPidLocked(String sessionId)
|
private int getClientPidLocked(String sessionId)
|
||||||
throws IllegalStateException {
|
throws IllegalStateException {
|
||||||
if (mSessionIdToSessionStateMap.get(sessionId) == null) {
|
if (mSessionIdToSessionStateMap.get(sessionId) == null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user