Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 783645e9 authored by Jae Seo's avatar Jae Seo
Browse files

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
parent 6e62a150
Loading
Loading
Loading
Loading
+4 −14
Original line number Diff line number Diff line
@@ -7325,7 +7325,6 @@ package android.content {
    field public static final java.lang.String TELEPHONY_SERVICE = "phone";
    field public static final java.lang.String TEXT_SERVICES_MANAGER_SERVICE = "textservices";
    field public static final java.lang.String TV_INPUT_SERVICE = "tv_input";
    field public static final java.lang.String TV_PARENTAL_CONTROL_SERVICE = "tv_parental_control";
    field public static final java.lang.String UI_MODE_SERVICE = "uimode";
    field public static final java.lang.String USB_SERVICE = "usb";
    field public static final java.lang.String USER_SERVICE = "user";
@@ -16992,8 +16991,12 @@ package android.media.tv {
    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();
    method public boolean isParentalControlsEnabled();
    method public boolean isRatingBlocked(android.media.tv.TvContentRating);
    method public void registerListener(android.media.tv.TvInputManager.TvInputListener, android.os.Handler);
    method public void unregisterListener(android.media.tv.TvInputManager.TvInputListener);
    field public static final java.lang.String ACTION_BLOCKED_RATINGS_CHANGED = "android.media.tv.action.BLOCKED_RATINGS_CHANGED";
    field public static final java.lang.String ACTION_PARENTAL_CONTROLS_ENABLED_CHANGED = "android.media.tv.action.PARENTAL_CONTROLS_ENABLED_CHANGED";
    field public static final int INPUT_STATE_CONNECTED = 0; // 0x0
    field public static final int INPUT_STATE_CONNECTED_STANDBY = 1; // 0x1
    field public static final int INPUT_STATE_DISCONNECTED = 2; // 0x2
@@ -17062,19 +17065,6 @@ package android.media.tv {
    method public void setOverlayViewEnabled(boolean);
  }
  public final class TvParentalControlManager {
    method public void addParentalControlListener(android.media.tv.TvParentalControlManager.ParentalControlListener, android.os.Handler);
    method public final boolean isEnabled();
    method public final boolean isRatingBlocked(android.media.tv.TvContentRating);
    method public void removeParentalControlListener(android.media.tv.TvParentalControlManager.ParentalControlListener);
  }
  public static abstract class TvParentalControlManager.ParentalControlListener {
    ctor public TvParentalControlManager.ParentalControlListener();
    method public void onBlockedRatingsChanged();
    method public void onEnabledChanged(boolean);
  }
  public final class TvTrackInfo implements android.os.Parcelable {
    method public boolean containsKey(java.lang.String);
    method public int describeContents();
+0 −6
Original line number Diff line number Diff line
@@ -77,7 +77,6 @@ import android.media.MediaRouter;
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 @@ class ContextImpl extends Context {
            }
        });

        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);
+0 −10
Original line number Diff line number Diff line
@@ -2821,16 +2821,6 @@ public abstract class Context {
     */
    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
+0 −14
Original line number Diff line number Diff line
@@ -3726,20 +3726,6 @@ public final class Settings {
         */
        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
+8 −0
Original line number Diff line number Diff line
@@ -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 -->
Loading