TIF: Merge TvParentalControlManager into TvInputManager

This change addresses the following API council feedback.

TvParentalControlManager:
-- Replace the listener interface with a broadcast Intent with well-known
   action, something like ACTION_BLOCKED_RATINGS_CHANGED.
-- TvParentalControlManager goes away, and two remaining methods move to
   TvInputManager.

== Implementation changes ==
-- The user-selected rating preferences should be stored in an XML file, and
   loaded at boot by your internal system service.  It should _not_ be stored in
   a Secure/Global setting.

Bug: 16542165
Change-Id: I278df963576652ec9163a66c1ef99419fcdb36c2
diff --git a/core/java/android/app/ContextImpl.java b/core/java/android/app/ContextImpl.java
index 175b6a5..5f606a61 100644
--- a/core/java/android/app/ContextImpl.java
+++ b/core/java/android/app/ContextImpl.java
@@ -77,7 +77,6 @@
 import android.media.projection.MediaProjectionManager;
 import android.media.session.MediaSessionManager;
 import android.media.tv.ITvInputManager;
-import android.media.tv.TvParentalControlManager;
 import android.media.tv.TvInputManager;
 import android.net.ConnectivityManager;
 import android.net.IConnectivityManager;
@@ -733,11 +732,6 @@
             }
         });
 
-        registerService(TV_PARENTAL_CONTROL_SERVICE, new ServiceFetcher() {
-                public Object getService(ContextImpl ctx) {
-                    return new TvParentalControlManager(ctx);
-                }});
-
         registerService(NETWORK_SCORE_SERVICE, new ServiceFetcher() {
             public Object createService(ContextImpl ctx) {
                 return new NetworkScoreManager(ctx);
diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java
index 95c62e0..f3a7b1c1 100644
--- a/core/java/android/content/Context.java
+++ b/core/java/android/content/Context.java
@@ -2822,16 +2822,6 @@
     public static final String TV_INPUT_SERVICE = "tv_input";
 
     /**
-     * Use with {@link #getSystemService} to retrieve a
-     * {@link android.media.tv.TvParentalControlManager} for obtaining parental
-     * control settings and listening to their changes.
-     *
-     * @see #getSystemService
-     * @see android.media.tv.TvParentalControlManager
-     */
-    public static final String TV_PARENTAL_CONTROL_SERVICE = "tv_parental_control";
-
-    /**
      * {@link android.net.NetworkScoreManager} for managing network scoring.
      * @see #getSystemService
      * @see android.net.NetworkScoreManager
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index eed250a..5d5be4a 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -3726,20 +3726,6 @@
          */
         public static final String PARENTAL_CONTROL_REDIRECT_URL = "parental_control_redirect_url";
 
-
-        /**
-         * Whether the TV parental control is enabled.
-         * @hide
-         */
-        public static final String TV_PARENTAL_CONTROL_ENABLED = "tv_parental_control_enabled";
-
-        /**
-         * List of TV content ratings blocked by the user. (comma-delimited)
-         * @hide
-         */
-        public static final String TV_PARENTAL_CONTROL_BLOCKED_RATINGS =
-                "tv_parental_control_blocked_ratings";
-
         /**
          * Settings classname to launch when Settings is clicked from All
          * Applications.  Needed because of user testing between the old
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index 38dccbe..d7aea39 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -2183,6 +2183,14 @@
         android:description="@string/permdesc_bindTvInput"
         android:protectionLevel="signature|system" />
 
+    <!-- @SystemApi Allows an application to modify parental controls
+         <p>Not for use by third-party applications.
+         @hide -->
+    <permission android:name="android.permission.MODIFY_PARENTAL_CONTROLS"
+        android:label="@string/permlab_modifyParentalControls"
+        android:description="@string/permdesc_modifyParentalControls"
+        android:protectionLevel="signature" />
+
     <!-- Must be required by a {@link android.media.routing.MediaRouteService}
          to ensure that only the system can interact with it.
          @hide -->
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index c6ee89f..139c07f 100644
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -1174,6 +1174,12 @@
         interface of a TV input. Should never be needed for normal apps.</string>
 
     <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+    <string name="permlab_modifyParentalControls">modify parental controls</string>
+    <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+    <string name="permdesc_modifyParentalControls">Allows the holder to modify the system\'s
+        parental controls data. Should never be needed for normal apps.</string>
+
+    <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
     <string name="permlab_manageDeviceAdmins">add or remove a device admin</string>
     <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
     <string name="permdesc_manageDeviceAdmins">Allows the holder to add or remove active device