TIF: Rename requestUnblockContent to unblockContent

The method TvView.requestUnblockContent doesn't match the name of the
corresponding method in TvInputService, onUnblockContent, hence changed
the name to make it consistent with the current naming scheme.
This change deprecated the requestUnblockContent method as the first
step.

Bug: 19337627
Change-Id: I530209c4dca66305da90ffded7199fa3c1c1780c
diff --git a/api/system-current.txt b/api/system-current.txt
index 81a43c1..8fe3ac7 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -19375,7 +19375,7 @@
     method public java.util.List<android.media.tv.TvTrackInfo> getTracks(int);
     method protected void onLayout(boolean, int, int, int, int);
     method public boolean onUnhandledInputEvent(android.view.InputEvent);
-    method public void requestUnblockContent(android.media.tv.TvContentRating);
+    method public deprecated void requestUnblockContent(android.media.tv.TvContentRating);
     method public void reset();
     method public void selectTrack(int, java.lang.String);
     method public void sendAppPrivateCommand(java.lang.String, android.os.Bundle);
@@ -19393,6 +19393,7 @@
     method public void timeShiftSetPlaybackRate(float, int);
     method public void tune(java.lang.String, android.net.Uri);
     method public void tune(java.lang.String, android.net.Uri, android.os.Bundle);
+    method public void unblockContent(android.media.tv.TvContentRating);
   }
 
   public static abstract interface TvView.OnUnhandledInputEventListener {
diff --git a/media/java/android/media/tv/ITvInputManager.aidl b/media/java/android/media/tv/ITvInputManager.aidl
index b6491d8..078fb2f 100644
--- a/media/java/android/media/tv/ITvInputManager.aidl
+++ b/media/java/android/media/tv/ITvInputManager.aidl
@@ -72,7 +72,7 @@
     void relayoutOverlayView(in IBinder sessionToken, in Rect frame, int userId);
     void removeOverlayView(in IBinder sessionToken, int userId);
 
-    void requestUnblockContent(in IBinder sessionToken, in String unblockedRating, int userId);
+    void unblockContent(in IBinder sessionToken, in String unblockedRating, int userId);
 
     void timeShiftPause(in IBinder sessionToken, int userId);
     void timeShiftResume(in IBinder sessionToken, int userId);
diff --git a/media/java/android/media/tv/ITvInputSession.aidl b/media/java/android/media/tv/ITvInputSession.aidl
index a054200..17f3984 100644
--- a/media/java/android/media/tv/ITvInputSession.aidl
+++ b/media/java/android/media/tv/ITvInputSession.aidl
@@ -45,7 +45,7 @@
     void relayoutOverlayView(in Rect frame);
     void removeOverlayView();
 
-    void requestUnblockContent(in String unblockedRating);
+    void unblockContent(in String unblockedRating);
 
     void timeShiftPause();
     void timeShiftResume();
diff --git a/media/java/android/media/tv/ITvInputSessionWrapper.java b/media/java/android/media/tv/ITvInputSessionWrapper.java
index 95aaa7f..0191652 100644
--- a/media/java/android/media/tv/ITvInputSessionWrapper.java
+++ b/media/java/android/media/tv/ITvInputSessionWrapper.java
@@ -57,7 +57,7 @@
     private static final int DO_CREATE_OVERLAY_VIEW = 10;
     private static final int DO_RELAYOUT_OVERLAY_VIEW = 11;
     private static final int DO_REMOVE_OVERLAY_VIEW = 12;
-    private static final int DO_REQUEST_UNBLOCK_CONTENT = 13;
+    private static final int DO_UNBLOCK_CONTENT = 13;
     private static final int DO_TIME_SHIFT_PAUSE = 14;
     private static final int DO_TIME_SHIFT_RESUME = 15;
     private static final int DO_TIME_SHIFT_SEEK_TO = 16;
@@ -155,7 +155,7 @@
                 mTvInputSessionImpl.removeOverlayView(true);
                 break;
             }
-            case DO_REQUEST_UNBLOCK_CONTENT: {
+            case DO_UNBLOCK_CONTENT: {
                 mTvInputSessionImpl.unblockContent((String) msg.obj);
                 break;
             }
@@ -267,9 +267,9 @@
     }
 
     @Override
-    public void requestUnblockContent(String unblockedRating) {
+    public void unblockContent(String unblockedRating) {
         mCaller.executeOrSendMessage(mCaller.obtainMessageO(
-                DO_REQUEST_UNBLOCK_CONTENT, unblockedRating));
+                DO_UNBLOCK_CONTENT, unblockedRating));
     }
 
     @Override
diff --git a/media/java/android/media/tv/TvInputManager.java b/media/java/android/media/tv/TvInputManager.java
index 8c06f15..705aa3d6 100644
--- a/media/java/android/media/tv/TvInputManager.java
+++ b/media/java/android/media/tv/TvInputManager.java
@@ -1820,14 +1820,14 @@
         /**
          * Requests to unblock content blocked by parental controls.
          */
-        void requestUnblockContent(@NonNull TvContentRating unblockedRating) {
+        void unblockContent(@NonNull TvContentRating unblockedRating) {
             Preconditions.checkNotNull(unblockedRating);
             if (mToken == null) {
                 Log.w(TAG, "The session has been already released");
                 return;
             }
             try {
-                mService.requestUnblockContent(mToken, unblockedRating.flattenToString(), mUserId);
+                mService.unblockContent(mToken, unblockedRating.flattenToString(), mUserId);
             } catch (RemoteException e) {
                 throw new RuntimeException(e);
             }
diff --git a/media/java/android/media/tv/TvView.java b/media/java/android/media/tv/TvView.java
index 7e64b17..ebe281f 100644
--- a/media/java/android/media/tv/TvView.java
+++ b/media/java/android/media/tv/TvView.java
@@ -350,11 +350,27 @@
      * @param unblockedRating A TvContentRating to unblock.
      * @see TvInputService.Session#notifyContentBlocked(TvContentRating)
      * @hide
+     * @deprecated Use {@link #unblockContent} instead.
      */
+    @Deprecated
     @SystemApi
     public void requestUnblockContent(TvContentRating unblockedRating) {
+        unblockContent(unblockedRating);
+    }
+
+    /**
+     * Requests to unblock TV content according to the given rating.
+     *
+     * <p>This notifies TV input that blocked content is now OK to play.
+     *
+     * @param unblockedRating A TvContentRating to unblock.
+     * @see TvInputService.Session#notifyContentBlocked(TvContentRating)
+     * @hide
+     */
+    @SystemApi
+    public void unblockContent(TvContentRating unblockedRating) {
         if (mSession != null) {
-            mSession.requestUnblockContent(unblockedRating);
+            mSession.unblockContent(unblockedRating);
         }
     }
 
diff --git a/services/core/java/com/android/server/tv/TvInputManagerService.java b/services/core/java/com/android/server/tv/TvInputManagerService.java
index 56816f9..e649e48 100644
--- a/services/core/java/com/android/server/tv/TvInputManagerService.java
+++ b/services/core/java/com/android/server/tv/TvInputManagerService.java
@@ -1206,7 +1206,7 @@
         }
 
         @Override
-        public void requestUnblockContent(
+        public void unblockContent(
                 IBinder sessionToken, String unblockedRating, int userId) {
             final int callingUid = Binder.getCallingUid();
             final int resolvedUserId = resolveCallingUserId(Binder.getCallingPid(), callingUid,
@@ -1216,9 +1216,9 @@
                 synchronized (mLock) {
                     try {
                         getSessionLocked(sessionToken, callingUid, resolvedUserId)
-                                .requestUnblockContent(unblockedRating);
+                                .unblockContent(unblockedRating);
                     } catch (RemoteException | SessionNotFoundException e) {
-                        Slog.e(TAG, "error in requestUnblockContent", e);
+                        Slog.e(TAG, "error in unblockContent", e);
                     }
                 }
             } finally {