Remove deprecated v7 MediaStyle + dependency

Remove the deprecated v7 MediaStyle and
DecoratedMediaCustomViewStyle classes as they have
been fully replaced with the v4.media versions in the
Media Compat Support Library.

This also allows us to remove the dependency between
AppCompat and Media Compat: it can now depend only on
support-core-utils and support-fragment. This exposed
a missing direct dependency between mediarouter and
media-compat.

Test: ./gradlew assemble && ./gradlew checkApi

BUG: 33042051
Change-Id: Iecafe01a56c1b5b5f5dbeae4e2d062f11698b353
diff --git a/v7/appcompat/api/current.txt b/v7/appcompat/api/current.txt
index 54db361..e514695 100644
--- a/v7/appcompat/api/current.txt
+++ b/v7/appcompat/api/current.txt
@@ -305,26 +305,12 @@
 
   public deprecated class NotificationCompat extends android.support.v4.app.NotificationCompat {
     ctor public deprecated NotificationCompat();
-    method public static deprecated android.support.v4.media.session.MediaSessionCompat.Token getMediaSession(android.app.Notification);
   }
 
   public static deprecated class NotificationCompat.Builder extends android.support.v4.app.NotificationCompat.Builder {
     ctor public deprecated NotificationCompat.Builder(android.content.Context);
   }
 
-  public static deprecated class NotificationCompat.DecoratedMediaCustomViewStyle extends android.support.v4.media.app.NotificationCompat.DecoratedMediaCustomViewStyle {
-    ctor public deprecated NotificationCompat.DecoratedMediaCustomViewStyle();
-  }
-
-  public static deprecated class NotificationCompat.MediaStyle extends android.support.v4.media.app.NotificationCompat.MediaStyle {
-    ctor public deprecated NotificationCompat.MediaStyle();
-    ctor public deprecated NotificationCompat.MediaStyle(android.support.v4.app.NotificationCompat.Builder);
-    method public deprecated android.support.v7.app.NotificationCompat.MediaStyle setCancelButtonIntent(android.app.PendingIntent);
-    method public deprecated android.support.v7.app.NotificationCompat.MediaStyle setMediaSession(android.support.v4.media.session.MediaSessionCompat.Token);
-    method public deprecated android.support.v7.app.NotificationCompat.MediaStyle setShowActionsInCompactView(int...);
-    method public deprecated android.support.v7.app.NotificationCompat.MediaStyle setShowCancelButton(boolean);
-  }
-
 }
 
 package android.support.v7.content.res {
diff --git a/v7/appcompat/build.gradle b/v7/appcompat/build.gradle
index 946faf0..a0e5290 100644
--- a/v7/appcompat/build.gradle
+++ b/v7/appcompat/build.gradle
@@ -2,7 +2,8 @@
 
 dependencies {
     api project(':support-annotations')
-    api project(':support-v4')
+    api project(':support-core-utils')
+    api project(':support-fragment')
     api project(':support-vector-drawable')
     api project(':animated-vector-drawable')
 
diff --git a/v7/appcompat/src/android/support/v7/app/NotificationCompat.java b/v7/appcompat/src/android/support/v7/app/NotificationCompat.java
index 6cb2c54..6b2b859 100644
--- a/v7/appcompat/src/android/support/v7/app/NotificationCompat.java
+++ b/v7/appcompat/src/android/support/v7/app/NotificationCompat.java
@@ -16,16 +16,7 @@
 
 package android.support.v7.app;
 
-import android.app.Notification;
-import android.app.PendingIntent;
 import android.content.Context;
-import android.os.Build;
-import android.os.Bundle;
-import android.os.IBinder;
-import android.os.Parcel;
-import android.support.v4.app.BundleCompat;
-import android.support.v4.media.session.MediaSessionCompat;
-import android.widget.RemoteViews;
 
 /**
  * An extension of {@link android.support.v4.app.NotificationCompat} which adds additional styles.
@@ -42,41 +33,6 @@
     }
 
     /**
-     * Extracts a {@link MediaSessionCompat.Token} from the extra values
-     * in the {@link MediaStyle} {@link android.app.Notification notification}.
-     *
-     * @param notification The notification to extract a {@link MediaSessionCompat.Token} from.
-     * @return The {@link MediaSessionCompat.Token} in the {@code notification} if it contains,
-     *         null otherwise.
-     * @deprecated Use {@link android.support.v4.media.app.NotificationCompat.MediaStyle
-     * #getMediaSession(Notification)}.
-     */
-    @Deprecated
-    public static MediaSessionCompat.Token getMediaSession(Notification notification) {
-        Bundle extras = getExtras(notification);
-        if (extras != null) {
-            if (Build.VERSION.SDK_INT >= 21) {
-                Object tokenInner = extras.getParcelable(EXTRA_MEDIA_SESSION);
-                if (tokenInner != null) {
-                    return MediaSessionCompat.Token.fromToken(tokenInner);
-                }
-            } else {
-                IBinder tokenInner = BundleCompat.getBinder(extras, EXTRA_MEDIA_SESSION);
-                if (tokenInner != null) {
-                    Parcel p = Parcel.obtain();
-                    p.writeStrongBinder(tokenInner);
-                    p.setDataPosition(0);
-                    MediaSessionCompat.Token token =
-                            MediaSessionCompat.Token.CREATOR.createFromParcel(p);
-                    p.recycle();
-                    return token;
-                }
-            }
-        }
-        return null;
-    }
-
-    /**
      * @deprecated All {@link android.support.v4.app.NotificationCompat.Style styles} can now be
      * used with {@link android.support.v4.app.NotificationCompat.Builder}.
      */
@@ -93,198 +49,4 @@
             super(context);
         }
     }
-
-    /**
-     * Notification style for media playback notifications.
-     *
-     * In the expanded form, {@link Notification#bigContentView}, up to 5
-     * {@link android.support.v4.app.NotificationCompat.Action}s specified with
-     * {@link android.support.v4.app.NotificationCompat.Builder#addAction(int, CharSequence,
-     * PendingIntent) addAction} will be shown as icon-only pushbuttons, suitable for transport
-     * controls. The Bitmap given to
-     * {@link android.support.v4.app.NotificationCompat.Builder#setLargeIcon(
-     * android.graphics.Bitmap) setLargeIcon()} will
-     * be treated as album artwork.
-     *
-     * Unlike the other styles provided here, MediaStyle can also modify the standard-size
-     * {@link Notification#contentView}; by providing action indices to
-     * {@link #setShowActionsInCompactView(int...)} you can promote up to 3 actions to be displayed
-     * in the standard view alongside the usual content.
-     *
-     * Notifications created with MediaStyle will have their category set to
-     * {@link Notification#CATEGORY_TRANSPORT CATEGORY_TRANSPORT} unless you set a different
-     * category using {@link android.support.v4.app.NotificationCompat.Builder#setCategory(String)
-     * setCategory()}.
-     *
-     * Finally, if you attach a {@link android.media.session.MediaSession.Token} using
-     * {@link android.support.v7.app.NotificationCompat.MediaStyle#setMediaSession}, the System UI
-     * can identify this as a notification representing an active media session and respond
-     * accordingly (by showing album artwork in the lockscreen, for example).
-     *
-     * To use this style with your Notification, feed it to
-     * {@link android.support.v4.app.NotificationCompat.Builder#setStyle} like so:
-     * <pre class="prettyprint">
-     * Notification noti = new NotificationCompat.Builder()
-     *     .setSmallIcon(R.drawable.ic_stat_player)
-     *     .setContentTitle(&quot;Track title&quot;)
-     *     .setContentText(&quot;Artist - Album&quot;)
-     *     .setLargeIcon(albumArtBitmap))
-     *     .setStyle(<b>new NotificationCompat.MediaStyle()</b>
-     *         .setMediaSession(mySession))
-     *     .build();
-     * </pre>
-     *
-     * @deprecated Use {@link android.support.v4.media.app.NotificationCompat.MediaStyle}.
-     */
-    @Deprecated
-    public static class MediaStyle extends
-            android.support.v4.media.app.NotificationCompat.MediaStyle {
-
-        /**
-         * @deprecated Use {@link android.support.v4.media.app.NotificationCompat.MediaStyle
-         * #MediaStyle()}
-         */
-        @Deprecated
-        public MediaStyle() {
-            super();
-        }
-
-        /**
-         * @deprecated Use {@link android.support.v4.media.app.NotificationCompat.MediaStyle
-         * #MediaStyle(android.support.v4.app.NotificationCompat.Builder)}
-         */
-        @Deprecated
-        public MediaStyle(android.support.v4.app.NotificationCompat.Builder builder) {
-            super(builder);
-        }
-
-        /**
-         * Requests up to 3 actions (by index in the order of addition) to be shown in the compact
-         * notification view.
-         *
-         * @param actions the indices of the actions to show in the compact notification view
-         *
-         * @deprecated Use {@link android.support.v4.media.app.NotificationCompat.MediaStyle
-         * #setShowActionsInCompactView(int...)}
-         */
-        @Deprecated
-        @Override
-        public MediaStyle setShowActionsInCompactView(int...actions) {
-            return (MediaStyle) super.setShowActionsInCompactView(actions);
-        }
-
-        /**
-         * Attaches a {@link MediaSessionCompat.Token} to this Notification
-         * to provide additional playback information and control to the SystemUI.
-         *
-         * @deprecated Use {@link android.support.v4.media.app.NotificationCompat.MediaStyle
-         * #setMediaSession(MediaSessionCompat.Token)}
-         */
-        @Deprecated
-        @Override
-        public MediaStyle setMediaSession(MediaSessionCompat.Token token) {
-            return (MediaStyle) super.setMediaSession(token);
-        }
-
-        /**
-         * Sets whether a cancel button at the top right should be shown in the notification on
-         * platforms before Lollipop.
-         *
-         * <p>Prior to Lollipop, there was a bug in the framework which prevented the developer to
-         * make a notification dismissable again after having used the same notification as the
-         * ongoing notification for a foreground service. When the notification was posted by
-         * {@link android.app.Service#startForeground}, but then the service exited foreground mode
-         * via {@link android.app.Service#stopForeground}, without removing the notification, the
-         * notification stayed ongoing, and thus not dismissable.
-         *
-         * <p>This is a common scenario for media notifications, as this is exactly the service
-         * lifecycle that happens when playing/pausing media. Thus, a workaround is provided by the
-         * support library: Instead of making the notification ongoing depending on the playback
-         * state, the support library provides the ability to add an explicit cancel button to the
-         * notification.
-         *
-         * <p>Note that the notification is enforced to be ongoing if a cancel button is shown to
-         * provide a consistent user experience.
-         *
-         * <p>Also note that this method is a no-op when running on Lollipop and later.
-         *
-         * @param show whether to show a cancel button
-         *
-         * @deprecated Use {@link android.support.v4.media.app.NotificationCompat.MediaStyle
-         * #setShowCancelButton(boolean)}
-         */
-        @Deprecated
-        @Override
-        public MediaStyle setShowCancelButton(boolean show) {
-            return (MediaStyle) super.setShowCancelButton(show);
-        }
-
-        /**
-         * Sets the pending intent to be sent when the cancel button is pressed. See {@link
-         * #setShowCancelButton}.
-         *
-         * @param pendingIntent the intent to be sent when the cancel button is pressed
-         *
-         * @deprecated Use {@link android.support.v4.media.app.NotificationCompat.MediaStyle
-         * #setCancelButtonIntent(PendingIntent)}
-         */
-        @Deprecated
-        @Override
-        public MediaStyle setCancelButtonIntent(PendingIntent pendingIntent) {
-            return (MediaStyle) super.setCancelButtonIntent(pendingIntent);
-        }
-    }
-
-    /**
-     * Notification style for media custom views that are decorated by the system.
-     *
-     * <p>Instead of providing a media notification that is completely custom, a developer can set
-     * this style and still obtain system decorations like the notification header with the expand
-     * affordance and actions.
-     *
-     * <p>Use {@link android.app.Notification.Builder#setCustomContentView(RemoteViews)},
-     * {@link android.app.Notification.Builder#setCustomBigContentView(RemoteViews)} and
-     * {@link android.app.Notification.Builder#setCustomHeadsUpContentView(RemoteViews)} to set the
-     * corresponding custom views to display.
-     *
-     * <p>To use this style with your Notification, feed it to
-     * {@link android.support.v4.app.NotificationCompat.Builder#setStyle(Style)} like so:
-     * <pre class="prettyprint">
-     * Notification noti = new Notification.Builder()
-     *     .setSmallIcon(R.drawable.ic_stat_player)
-     *     .setLargeIcon(albumArtBitmap))
-     *     .setCustomContentView(contentView)
-     *     .setStyle(<b>new NotificationCompat.DecoratedMediaCustomViewStyle()</b>
-     *          .setMediaSession(mySession))
-     *     .build();
-     * </pre>
-     *
-     * <p>If you are using this style, consider using the corresponding styles like
-     * {@link android.support.mediacompat.R.style#TextAppearance_Compat_Notification_Media} or
-     * {@link
-     * android.support.mediacompat.R.style#TextAppearance_Compat_Notification_Title_Media} in
-     * your custom views in order to get the correct styling on each platform version.
-     *
-     * @see android.support.v4.app.NotificationCompat.DecoratedCustomViewStyle
-     * @see android.support.v4.media.app.NotificationCompat.MediaStyle
-     *
-     * @deprecated Use
-     * {@link android.support.v4.media.app.NotificationCompat.DecoratedMediaCustomViewStyle} and
-     * {@link android.support.mediacompat.R.style#TextAppearance_Compat_Notification_Media} and
-     * {@link android.support.mediacompat.R.style#TextAppearance_Compat_Notification_Title_Media}.
-     */
-    @Deprecated
-    public static class DecoratedMediaCustomViewStyle extends
-            android.support.v4.media.app.NotificationCompat.DecoratedMediaCustomViewStyle {
-
-        /**
-         * @deprecated Use
-         * {@link android.support.v4.media.app.NotificationCompat.DecoratedMediaCustomViewStyle
-         * #DecoratedMediaCustomViewStyle()}.
-         */
-        @Deprecated
-        public DecoratedMediaCustomViewStyle() {
-            super();
-        }
-    }
 }
diff --git a/v7/mediarouter/build.gradle b/v7/mediarouter/build.gradle
index 00f9ea2..f301324 100644
--- a/v7/mediarouter/build.gradle
+++ b/v7/mediarouter/build.gradle
@@ -1,6 +1,7 @@
 apply plugin: android.support.SupportAndroidLibraryPlugin
 
 dependencies {
+    api project(":support-media-compat")
     api project(":appcompat-v7")
     api project(":palette-v7")