Merge "Add permission check and @RequiresPermission annotation"
This commit is contained in:
@@ -24976,6 +24976,7 @@ package android.media.tv {
|
||||
}
|
||||
|
||||
public final class TvInputManager {
|
||||
method public java.util.List<android.media.tv.TvContentRating> getBlockedRatings();
|
||||
method public int getInputState(java.lang.String);
|
||||
method public android.media.tv.TvInputInfo getTvInputInfo(java.lang.String);
|
||||
method public java.util.List<android.media.tv.TvInputInfo> getTvInputList();
|
||||
|
||||
@@ -25112,6 +25112,7 @@ package android.media.tv {
|
||||
}
|
||||
|
||||
public final class TvInputManager {
|
||||
method public java.util.List<android.media.tv.TvContentRating> getBlockedRatings();
|
||||
method public int getInputState(java.lang.String);
|
||||
method public android.media.tv.TvInputInfo getTvInputInfo(java.lang.String);
|
||||
method public java.util.List<android.media.tv.TvInputInfo> getTvInputList();
|
||||
|
||||
@@ -1329,9 +1329,7 @@ public final class TvInputManager {
|
||||
* Returns the list of blocked content ratings.
|
||||
*
|
||||
* @return the list of content ratings blocked by the user.
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
public List<TvContentRating> getBlockedRatings() {
|
||||
try {
|
||||
List<TvContentRating> ratings = new ArrayList<>();
|
||||
@@ -1387,6 +1385,7 @@ public final class TvInputManager {
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
@RequiresPermission(android.Manifest.permission.READ_CONTENT_RATING_SYSTEMS)
|
||||
public List<TvContentRatingSystemInfo> getTvContentRatingSystemList() {
|
||||
try {
|
||||
return mService.getTvContentRatingSystemList(mUserId);
|
||||
@@ -1551,6 +1550,7 @@ public final class TvInputManager {
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
@RequiresPermission(android.Manifest.permission.CAPTURE_TV_INPUT)
|
||||
public boolean isSingleSessionActive() {
|
||||
try {
|
||||
return mService.isSingleSessionActive(mUserId);
|
||||
|
||||
@@ -928,6 +928,12 @@ public final class TvInputManagerService extends SystemService {
|
||||
|
||||
@Override
|
||||
public List<TvContentRatingSystemInfo> getTvContentRatingSystemList(int userId) {
|
||||
if (mContext.checkCallingPermission(
|
||||
android.Manifest.permission.READ_CONTENT_RATING_SYSTEMS)
|
||||
!= PackageManager.PERMISSION_GRANTED) {
|
||||
throw new SecurityException(
|
||||
"The caller does not have permission to read content rating systems");
|
||||
}
|
||||
final int resolvedUserId = resolveCallingUserId(Binder.getCallingPid(),
|
||||
Binder.getCallingUid(), userId, "getTvContentRatingSystemList");
|
||||
final long identity = Binder.clearCallingIdentity();
|
||||
@@ -1875,11 +1881,7 @@ public final class TvInputManagerService extends SystemService {
|
||||
@Override
|
||||
public List<TvStreamConfig> getAvailableTvStreamConfigList(String inputId, int userId)
|
||||
throws RemoteException {
|
||||
if (mContext.checkCallingPermission(
|
||||
android.Manifest.permission.CAPTURE_TV_INPUT)
|
||||
!= PackageManager.PERMISSION_GRANTED) {
|
||||
throw new SecurityException("Requires CAPTURE_TV_INPUT permission");
|
||||
}
|
||||
ensureCaptureTvInputPermission();
|
||||
|
||||
final long identity = Binder.clearCallingIdentity();
|
||||
final int callingUid = Binder.getCallingUid();
|
||||
@@ -1897,11 +1899,7 @@ public final class TvInputManagerService extends SystemService {
|
||||
public boolean captureFrame(String inputId, Surface surface, TvStreamConfig config,
|
||||
int userId)
|
||||
throws RemoteException {
|
||||
if (mContext.checkCallingPermission(
|
||||
android.Manifest.permission.CAPTURE_TV_INPUT)
|
||||
!= PackageManager.PERMISSION_GRANTED) {
|
||||
throw new SecurityException("Requires CAPTURE_TV_INPUT permission");
|
||||
}
|
||||
ensureCaptureTvInputPermission();
|
||||
|
||||
final long identity = Binder.clearCallingIdentity();
|
||||
final int callingUid = Binder.getCallingUid();
|
||||
@@ -1934,6 +1932,7 @@ public final class TvInputManagerService extends SystemService {
|
||||
|
||||
@Override
|
||||
public boolean isSingleSessionActive(int userId) throws RemoteException {
|
||||
ensureCaptureTvInputPermission();
|
||||
final long identity = Binder.clearCallingIdentity();
|
||||
final int callingUid = Binder.getCallingUid();
|
||||
final int resolvedUserId = resolveCallingUserId(Binder.getCallingPid(), callingUid,
|
||||
@@ -1959,6 +1958,14 @@ public final class TvInputManagerService extends SystemService {
|
||||
}
|
||||
}
|
||||
|
||||
private void ensureCaptureTvInputPermission() {
|
||||
if (mContext.checkCallingPermission(
|
||||
android.Manifest.permission.CAPTURE_TV_INPUT)
|
||||
!= PackageManager.PERMISSION_GRANTED) {
|
||||
throw new SecurityException("Requires CAPTURE_TV_INPUT permission");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void requestChannelBrowsable(Uri channelUri, int userId)
|
||||
throws RemoteException {
|
||||
|
||||
Reference in New Issue
Block a user