package android.support.animation {

  public abstract class DynamicAnimation<T extends android.support.animation.DynamicAnimation<T>> {
    method public T addEndListener(android.support.animation.DynamicAnimation.OnAnimationEndListener);
    method public T addUpdateListener(android.support.animation.DynamicAnimation.OnAnimationUpdateListener);
    method public void cancel();
    method public float getMinimumVisibleChange();
    method public boolean isRunning();
    method public void removeEndListener(android.support.animation.DynamicAnimation.OnAnimationEndListener);
    method public void removeUpdateListener(android.support.animation.DynamicAnimation.OnAnimationUpdateListener);
    method public T setMaxValue(float);
    method public T setMinValue(float);
    method public T setMinimumVisibleChange(float);
    method public T setStartValue(float);
    method public T setStartVelocity(float);
    method public void start();
    field public static final android.support.animation.DynamicAnimation.ViewProperty ALPHA;
    field public static final float MIN_VISIBLE_CHANGE_ALPHA = 0.00390625f;
    field public static final float MIN_VISIBLE_CHANGE_PIXELS = 1.0f;
    field public static final float MIN_VISIBLE_CHANGE_ROTATION_DEGREES = 0.1f;
    field public static final float MIN_VISIBLE_CHANGE_SCALE = 0.002f;
    field public static final android.support.animation.DynamicAnimation.ViewProperty ROTATION;
    field public static final android.support.animation.DynamicAnimation.ViewProperty ROTATION_X;
    field public static final android.support.animation.DynamicAnimation.ViewProperty ROTATION_Y;
    field public static final android.support.animation.DynamicAnimation.ViewProperty SCALE_X;
    field public static final android.support.animation.DynamicAnimation.ViewProperty SCALE_Y;
    field public static final android.support.animation.DynamicAnimation.ViewProperty SCROLL_X;
    field public static final android.support.animation.DynamicAnimation.ViewProperty SCROLL_Y;
    field public static final android.support.animation.DynamicAnimation.ViewProperty TRANSLATION_X;
    field public static final android.support.animation.DynamicAnimation.ViewProperty TRANSLATION_Y;
    field public static final android.support.animation.DynamicAnimation.ViewProperty TRANSLATION_Z;
    field public static final android.support.animation.DynamicAnimation.ViewProperty X;
    field public static final android.support.animation.DynamicAnimation.ViewProperty Y;
    field public static final android.support.animation.DynamicAnimation.ViewProperty Z;
  }

  public static abstract interface DynamicAnimation.OnAnimationEndListener {
    method public abstract void onAnimationEnd(android.support.animation.DynamicAnimation, boolean, float, float);
  }

  public static abstract interface DynamicAnimation.OnAnimationUpdateListener {
    method public abstract void onAnimationUpdate(android.support.animation.DynamicAnimation, float, float);
  }

  public static abstract class DynamicAnimation.ViewProperty extends android.support.animation.FloatPropertyCompat {
  }

  public final class FlingAnimation extends android.support.animation.DynamicAnimation {
    ctor public FlingAnimation(android.support.animation.FloatValueHolder);
    ctor public FlingAnimation(K, android.support.animation.FloatPropertyCompat<K>);
    method public float getFriction();
    method public android.support.animation.FlingAnimation setFriction(float);
    method public android.support.animation.FlingAnimation setMaxValue(float);
    method public android.support.animation.FlingAnimation setMinValue(float);
    method public android.support.animation.FlingAnimation setStartVelocity(float);
  }

  public abstract class FloatPropertyCompat<T> {
    ctor public FloatPropertyCompat(java.lang.String);
    method public static <T> android.support.animation.FloatPropertyCompat<T> createFloatPropertyCompat(android.util.FloatProperty<T>);
    method public abstract float getValue(T);
    method public abstract void setValue(T, float);
  }

  public final class FloatValueHolder {
    ctor public FloatValueHolder();
    ctor public FloatValueHolder(float);
    method public float getValue();
    method public void setValue(float);
  }

  public final class SpringAnimation extends android.support.animation.DynamicAnimation {
    ctor public SpringAnimation(android.support.animation.FloatValueHolder);
    ctor public SpringAnimation(K, android.support.animation.FloatPropertyCompat<K>);
    ctor public SpringAnimation(K, android.support.animation.FloatPropertyCompat<K>, float);
    method public void animateToFinalPosition(float);
    method public boolean canSkipToEnd();
    method public android.support.animation.SpringForce getSpring();
    method public android.support.animation.SpringAnimation setSpring(android.support.animation.SpringForce);
    method public void skipToEnd();
  }

  public final class SpringForce {
    ctor public SpringForce();
    ctor public SpringForce(float);
    method public float getDampingRatio();
    method public float getFinalPosition();
    method public float getStiffness();
    method public android.support.animation.SpringForce setDampingRatio(float);
    method public android.support.animation.SpringForce setFinalPosition(float);
    method public android.support.animation.SpringForce setStiffness(float);
    field public static final float DAMPING_RATIO_HIGH_BOUNCY = 0.2f;
    field public static final float DAMPING_RATIO_LOW_BOUNCY = 0.75f;
    field public static final float DAMPING_RATIO_MEDIUM_BOUNCY = 0.5f;
    field public static final float DAMPING_RATIO_NO_BOUNCY = 1.0f;
    field public static final float STIFFNESS_HIGH = 10000.0f;
    field public static final float STIFFNESS_LOW = 200.0f;
    field public static final float STIFFNESS_MEDIUM = 1500.0f;
    field public static final float STIFFNESS_VERY_LOW = 50.0f;
  }

}

package android.support.app.recommendation {

  public final class ContentRecommendation {
    method public java.lang.String getBackgroundImageUri();
    method public int getBadgeImageResourceId();
    method public int getColor();
    method public android.graphics.Bitmap getContentImage();
    method public android.support.app.recommendation.ContentRecommendation.IntentData getContentIntent();
    method public java.lang.String[] getContentTypes();
    method public android.support.app.recommendation.ContentRecommendation.IntentData getDismissIntent();
    method public java.lang.String[] getGenres();
    method public java.lang.String getGroup();
    method public java.lang.String getIdTag();
    method public java.lang.String getMaturityRating();
    method public android.app.Notification getNotificationObject(android.content.Context);
    method public java.lang.String getPricingType();
    method public java.lang.String getPricingValue();
    method public java.lang.String getPrimaryContentType();
    method public int getProgressMax();
    method public int getProgressValue();
    method public long getRunningTime();
    method public java.lang.String getSortKey();
    method public java.lang.String getSourceName();
    method public int getStatus();
    method public java.lang.String getText();
    method public java.lang.String getTitle();
    method public boolean hasProgressInfo();
    method public boolean isAutoDismiss();
    method public void setAutoDismiss(boolean);
    method public void setGroup(java.lang.String);
    method public void setProgress(int, int);
    method public void setSortKey(java.lang.String);
    method public void setStatus(int);
    field public static final java.lang.String CONTENT_MATURITY_ALL = "android.contentMaturity.all";
    field public static final java.lang.String CONTENT_MATURITY_HIGH = "android.contentMaturity.high";
    field public static final java.lang.String CONTENT_MATURITY_LOW = "android.contentMaturity.low";
    field public static final java.lang.String CONTENT_MATURITY_MEDIUM = "android.contentMaturity.medium";
    field public static final java.lang.String CONTENT_PRICING_FREE = "android.contentPrice.free";
    field public static final java.lang.String CONTENT_PRICING_PREORDER = "android.contentPrice.preorder";
    field public static final java.lang.String CONTENT_PRICING_PURCHASE = "android.contentPrice.purchase";
    field public static final java.lang.String CONTENT_PRICING_RENTAL = "android.contentPrice.rental";
    field public static final java.lang.String CONTENT_PRICING_SUBSCRIPTION = "android.contentPrice.subscription";
    field public static final int CONTENT_STATUS_AVAILABLE = 2; // 0x2
    field public static final int CONTENT_STATUS_PENDING = 1; // 0x1
    field public static final int CONTENT_STATUS_READY = 0; // 0x0
    field public static final int CONTENT_STATUS_UNAVAILABLE = 3; // 0x3
    field public static final java.lang.String CONTENT_TYPE_APP = "android.contentType.app";
    field public static final java.lang.String CONTENT_TYPE_BOOK = "android.contentType.book";
    field public static final java.lang.String CONTENT_TYPE_COMIC = "android.contentType.comic";
    field public static final java.lang.String CONTENT_TYPE_GAME = "android.contentType.game";
    field public static final java.lang.String CONTENT_TYPE_MAGAZINE = "android.contentType.magazine";
    field public static final java.lang.String CONTENT_TYPE_MOVIE = "android.contentType.movie";
    field public static final java.lang.String CONTENT_TYPE_MUSIC = "android.contentType.music";
    field public static final java.lang.String CONTENT_TYPE_NEWS = "android.contentType.news";
    field public static final java.lang.String CONTENT_TYPE_PODCAST = "android.contentType.podcast";
    field public static final java.lang.String CONTENT_TYPE_RADIO = "android.contentType.radio";
    field public static final java.lang.String CONTENT_TYPE_SERIAL = "android.contentType.serial";
    field public static final java.lang.String CONTENT_TYPE_SPORTS = "android.contentType.sports";
    field public static final java.lang.String CONTENT_TYPE_TRAILER = "android.contentType.trailer";
    field public static final java.lang.String CONTENT_TYPE_VIDEO = "android.contentType.video";
    field public static final java.lang.String CONTENT_TYPE_WEBSITE = "android.contentType.website";
    field public static final int INTENT_TYPE_ACTIVITY = 1; // 0x1
    field public static final int INTENT_TYPE_BROADCAST = 2; // 0x2
    field public static final int INTENT_TYPE_SERVICE = 3; // 0x3
  }

  public static final class ContentRecommendation.Builder {
    ctor public ContentRecommendation.Builder();
    method public android.support.app.recommendation.ContentRecommendation build();
    method public android.support.app.recommendation.ContentRecommendation.Builder setAutoDismiss(boolean);
    method public android.support.app.recommendation.ContentRecommendation.Builder setBackgroundImageUri(java.lang.String);
    method public android.support.app.recommendation.ContentRecommendation.Builder setBadgeIcon(int);
    method public android.support.app.recommendation.ContentRecommendation.Builder setColor(int);
    method public android.support.app.recommendation.ContentRecommendation.Builder setContentImage(android.graphics.Bitmap);
    method public android.support.app.recommendation.ContentRecommendation.Builder setContentIntentData(int, android.content.Intent, int, android.os.Bundle);
    method public android.support.app.recommendation.ContentRecommendation.Builder setContentTypes(java.lang.String[]);
    method public android.support.app.recommendation.ContentRecommendation.Builder setDismissIntentData(int, android.content.Intent, int, android.os.Bundle);
    method public android.support.app.recommendation.ContentRecommendation.Builder setGenres(java.lang.String[]);
    method public android.support.app.recommendation.ContentRecommendation.Builder setGroup(java.lang.String);
    method public android.support.app.recommendation.ContentRecommendation.Builder setIdTag(java.lang.String);
    method public android.support.app.recommendation.ContentRecommendation.Builder setMaturityRating(java.lang.String);
    method public android.support.app.recommendation.ContentRecommendation.Builder setPricingInformation(java.lang.String, java.lang.String);
    method public android.support.app.recommendation.ContentRecommendation.Builder setProgress(int, int);
    method public android.support.app.recommendation.ContentRecommendation.Builder setRunningTime(long);
    method public android.support.app.recommendation.ContentRecommendation.Builder setSortKey(java.lang.String);
    method public android.support.app.recommendation.ContentRecommendation.Builder setSourceName(java.lang.String);
    method public android.support.app.recommendation.ContentRecommendation.Builder setStatus(int);
    method public android.support.app.recommendation.ContentRecommendation.Builder setText(java.lang.String);
    method public android.support.app.recommendation.ContentRecommendation.Builder setTitle(java.lang.String);
  }

  public static abstract class ContentRecommendation.ContentMaturity implements java.lang.annotation.Annotation {
  }

  public static abstract class ContentRecommendation.ContentPricing implements java.lang.annotation.Annotation {
  }

  public static abstract class ContentRecommendation.ContentStatus implements java.lang.annotation.Annotation {
  }

  public static abstract class ContentRecommendation.ContentType implements java.lang.annotation.Annotation {
  }

  public static class ContentRecommendation.IntentData {
    ctor public ContentRecommendation.IntentData();
  }

  public static abstract class ContentRecommendation.IntentType implements java.lang.annotation.Annotation {
  }

  public final class RecommendationExtender implements android.app.Notification.Extender {
    ctor public RecommendationExtender();
    ctor public RecommendationExtender(android.app.Notification);
    method public android.app.Notification.Builder extend(android.app.Notification.Builder);
    method public java.lang.String[] getContentTypes();
    method public java.lang.String[] getGenres();
    method public java.lang.String getMaturityRating();
    method public java.lang.String getPricingType();
    method public java.lang.String getPricingValue();
    method public java.lang.String getPrimaryContentType();
    method public long getRunningTime();
    method public int getStatus();
    method public android.support.app.recommendation.RecommendationExtender setContentTypes(java.lang.String[]);
    method public android.support.app.recommendation.RecommendationExtender setGenres(java.lang.String[]);
    method public android.support.app.recommendation.RecommendationExtender setMaturityRating(java.lang.String);
    method public android.support.app.recommendation.RecommendationExtender setPricingInformation(java.lang.String, java.lang.String);
    method public android.support.app.recommendation.RecommendationExtender setRunningTime(long);
    method public android.support.app.recommendation.RecommendationExtender setStatus(int);
  }

}

package android.support.content {

  public class ContentPager {
    ctor public ContentPager(android.content.ContentResolver, android.support.content.ContentPager.QueryRunner);
    ctor public ContentPager(android.content.ContentResolver, android.support.content.ContentPager.QueryRunner, int);
    method public static android.os.Bundle createArgs(int, int);
    method public android.support.content.Query query(android.net.Uri, java.lang.String[], android.os.Bundle, android.os.CancellationSignal, android.support.content.ContentPager.ContentCallback);
    method public void reset();
    field public static final int CURSOR_DISPOSITION_COPIED = 1; // 0x1
    field public static final int CURSOR_DISPOSITION_PAGED = 2; // 0x2
    field public static final int CURSOR_DISPOSITION_REPAGED = 3; // 0x3
    field public static final int CURSOR_DISPOSITION_WRAPPED = 4; // 0x4
    field public static final java.lang.String EXTRA_HONORED_ARGS = "android.content.extra.HONORED_ARGS";
    field public static final java.lang.String EXTRA_REQUESTED_LIMIT = "android-support:extra-ignored-limit";
    field public static final java.lang.String EXTRA_SUGGESTED_LIMIT = "android-support:extra-suggested-limit";
    field public static final java.lang.String EXTRA_TOTAL_COUNT = "android.content.extra.TOTAL_COUNT";
    field public static final java.lang.String QUERY_ARG_LIMIT = "android:query-arg-limit";
    field public static final java.lang.String QUERY_ARG_OFFSET = "android:query-arg-offset";
  }

  public static abstract interface ContentPager.ContentCallback {
    method public abstract void onCursorReady(android.support.content.Query, android.database.Cursor);
  }

  public static abstract class ContentPager.CursorDisposition implements java.lang.annotation.Annotation {
  }

  public static abstract interface ContentPager.QueryRunner {
    method public abstract void cancel(android.support.content.Query);
    method public abstract boolean isRunning(android.support.content.Query);
    method public abstract void query(android.support.content.Query, android.support.content.ContentPager.QueryRunner.Callback);
  }

  public static abstract interface ContentPager.QueryRunner.Callback {
    method public abstract void onQueryFinished(android.support.content.Query, android.database.Cursor);
    method public abstract android.database.Cursor runQueryInBackground(android.support.content.Query);
  }

  public final class LoaderQueryRunner implements android.support.content.ContentPager.QueryRunner {
    ctor public LoaderQueryRunner(android.content.Context, android.app.LoaderManager);
    method public void cancel(android.support.content.Query);
    method public boolean isRunning(android.support.content.Query);
    method public void query(android.support.content.Query, android.support.content.ContentPager.QueryRunner.Callback);
  }

  public final class Query {
    method public int getId();
    method public int getLimit();
    method public int getOffset();
    method public android.net.Uri getUri();
  }

}

package android.support.customtabs {

  public class CustomTabsCallback {
    ctor public CustomTabsCallback();
    method public void extraCallback(java.lang.String, android.os.Bundle);
    method public void onMessageChannelReady(android.os.Bundle);
    method public void onNavigationEvent(int, android.os.Bundle);
    method public void onPostMessage(java.lang.String, android.os.Bundle);
    field public static final int NAVIGATION_ABORTED = 4; // 0x4
    field public static final int NAVIGATION_FAILED = 3; // 0x3
    field public static final int NAVIGATION_FINISHED = 2; // 0x2
    field public static final int NAVIGATION_STARTED = 1; // 0x1
    field public static final int TAB_HIDDEN = 6; // 0x6
    field public static final int TAB_SHOWN = 5; // 0x5
  }

  public class CustomTabsClient {
    method public static boolean bindCustomTabsService(android.content.Context, java.lang.String, android.support.customtabs.CustomTabsServiceConnection);
    method public static boolean connectAndInitialize(android.content.Context, java.lang.String);
    method public android.os.Bundle extraCommand(java.lang.String, android.os.Bundle);
    method public static java.lang.String getPackageName(android.content.Context, java.util.List<java.lang.String>);
    method public static java.lang.String getPackageName(android.content.Context, java.util.List<java.lang.String>, boolean);
    method public android.support.customtabs.CustomTabsSession newSession(android.support.customtabs.CustomTabsCallback);
    method public boolean warmup(long);
  }

  public final class CustomTabsIntent {
    method public static int getMaxToolbarItems();
    method public void launchUrl(android.content.Context, android.net.Uri);
    method public static android.content.Intent setAlwaysUseBrowserUI(android.content.Intent);
    method public static boolean shouldAlwaysUseBrowserUI(android.content.Intent);
    field public static final java.lang.String EXTRA_ACTION_BUTTON_BUNDLE = "android.support.customtabs.extra.ACTION_BUTTON_BUNDLE";
    field public static final java.lang.String EXTRA_CLOSE_BUTTON_ICON = "android.support.customtabs.extra.CLOSE_BUTTON_ICON";
    field public static final java.lang.String EXTRA_DEFAULT_SHARE_MENU_ITEM = "android.support.customtabs.extra.SHARE_MENU_ITEM";
    field public static final java.lang.String EXTRA_ENABLE_INSTANT_APPS = "android.support.customtabs.extra.EXTRA_ENABLE_INSTANT_APPS";
    field public static final java.lang.String EXTRA_ENABLE_URLBAR_HIDING = "android.support.customtabs.extra.ENABLE_URLBAR_HIDING";
    field public static final java.lang.String EXTRA_EXIT_ANIMATION_BUNDLE = "android.support.customtabs.extra.EXIT_ANIMATION_BUNDLE";
    field public static final java.lang.String EXTRA_MENU_ITEMS = "android.support.customtabs.extra.MENU_ITEMS";
    field public static final java.lang.String EXTRA_REMOTEVIEWS = "android.support.customtabs.extra.EXTRA_REMOTEVIEWS";
    field public static final java.lang.String EXTRA_REMOTEVIEWS_CLICKED_ID = "android.support.customtabs.extra.EXTRA_REMOTEVIEWS_CLICKED_ID";
    field public static final java.lang.String EXTRA_REMOTEVIEWS_PENDINGINTENT = "android.support.customtabs.extra.EXTRA_REMOTEVIEWS_PENDINGINTENT";
    field public static final java.lang.String EXTRA_REMOTEVIEWS_VIEW_IDS = "android.support.customtabs.extra.EXTRA_REMOTEVIEWS_VIEW_IDS";
    field public static final java.lang.String EXTRA_SECONDARY_TOOLBAR_COLOR = "android.support.customtabs.extra.SECONDARY_TOOLBAR_COLOR";
    field public static final java.lang.String EXTRA_SESSION = "android.support.customtabs.extra.SESSION";
    field public static final java.lang.String EXTRA_TINT_ACTION_BUTTON = "android.support.customtabs.extra.TINT_ACTION_BUTTON";
    field public static final java.lang.String EXTRA_TITLE_VISIBILITY_STATE = "android.support.customtabs.extra.TITLE_VISIBILITY";
    field public static final java.lang.String EXTRA_TOOLBAR_COLOR = "android.support.customtabs.extra.TOOLBAR_COLOR";
    field public static final java.lang.String EXTRA_TOOLBAR_ITEMS = "android.support.customtabs.extra.TOOLBAR_ITEMS";
    field public static final java.lang.String KEY_DESCRIPTION = "android.support.customtabs.customaction.DESCRIPTION";
    field public static final java.lang.String KEY_ICON = "android.support.customtabs.customaction.ICON";
    field public static final java.lang.String KEY_ID = "android.support.customtabs.customaction.ID";
    field public static final java.lang.String KEY_MENU_ITEM_TITLE = "android.support.customtabs.customaction.MENU_ITEM_TITLE";
    field public static final java.lang.String KEY_PENDING_INTENT = "android.support.customtabs.customaction.PENDING_INTENT";
    field public static final int NO_TITLE = 0; // 0x0
    field public static final int SHOW_PAGE_TITLE = 1; // 0x1
    field public static final int TOOLBAR_ACTION_BUTTON_ID = 0; // 0x0
    field public final android.content.Intent intent;
    field public final android.os.Bundle startAnimationBundle;
  }

  public static final class CustomTabsIntent.Builder {
    ctor public CustomTabsIntent.Builder();
    ctor public CustomTabsIntent.Builder(android.support.customtabs.CustomTabsSession);
    method public android.support.customtabs.CustomTabsIntent.Builder addDefaultShareMenuItem();
    method public android.support.customtabs.CustomTabsIntent.Builder addMenuItem(java.lang.String, android.app.PendingIntent);
    method public deprecated android.support.customtabs.CustomTabsIntent.Builder addToolbarItem(int, android.graphics.Bitmap, java.lang.String, android.app.PendingIntent) throws java.lang.IllegalStateException;
    method public android.support.customtabs.CustomTabsIntent build();
    method public android.support.customtabs.CustomTabsIntent.Builder enableUrlBarHiding();
    method public android.support.customtabs.CustomTabsIntent.Builder setActionButton(android.graphics.Bitmap, java.lang.String, android.app.PendingIntent, boolean);
    method public android.support.customtabs.CustomTabsIntent.Builder setActionButton(android.graphics.Bitmap, java.lang.String, android.app.PendingIntent);
    method public android.support.customtabs.CustomTabsIntent.Builder setCloseButtonIcon(android.graphics.Bitmap);
    method public android.support.customtabs.CustomTabsIntent.Builder setExitAnimations(android.content.Context, int, int);
    method public android.support.customtabs.CustomTabsIntent.Builder setInstantAppsEnabled(boolean);
    method public android.support.customtabs.CustomTabsIntent.Builder setSecondaryToolbarColor(int);
    method public android.support.customtabs.CustomTabsIntent.Builder setSecondaryToolbarViews(android.widget.RemoteViews, int[], android.app.PendingIntent);
    method public android.support.customtabs.CustomTabsIntent.Builder setShowTitle(boolean);
    method public android.support.customtabs.CustomTabsIntent.Builder setStartAnimations(android.content.Context, int, int);
    method public android.support.customtabs.CustomTabsIntent.Builder setToolbarColor(int);
  }

  public abstract class CustomTabsService extends android.app.Service {
    ctor public CustomTabsService();
    method protected boolean cleanUpSession(android.support.customtabs.CustomTabsSessionToken);
    method protected abstract android.os.Bundle extraCommand(java.lang.String, android.os.Bundle);
    method protected abstract boolean mayLaunchUrl(android.support.customtabs.CustomTabsSessionToken, android.net.Uri, android.os.Bundle, java.util.List<android.os.Bundle>);
    method protected abstract boolean newSession(android.support.customtabs.CustomTabsSessionToken);
    method public android.os.IBinder onBind(android.content.Intent);
    method protected abstract int postMessage(android.support.customtabs.CustomTabsSessionToken, java.lang.String, android.os.Bundle);
    method protected abstract boolean requestPostMessageChannel(android.support.customtabs.CustomTabsSessionToken, android.net.Uri);
    method protected abstract boolean updateVisuals(android.support.customtabs.CustomTabsSessionToken, android.os.Bundle);
    method protected abstract boolean warmup(long);
    field public static final java.lang.String ACTION_CUSTOM_TABS_CONNECTION = "android.support.customtabs.action.CustomTabsService";
    field public static final java.lang.String KEY_URL = "android.support.customtabs.otherurls.URL";
    field public static final int RESULT_FAILURE_DISALLOWED = -1; // 0xffffffff
    field public static final int RESULT_FAILURE_MESSAGING_ERROR = -3; // 0xfffffffd
    field public static final int RESULT_FAILURE_REMOTE_ERROR = -2; // 0xfffffffe
    field public static final int RESULT_SUCCESS = 0; // 0x0
  }

  public static abstract class CustomTabsService.Result implements java.lang.annotation.Annotation {
  }

  public abstract class CustomTabsServiceConnection implements android.content.ServiceConnection {
    ctor public CustomTabsServiceConnection();
    method public abstract void onCustomTabsServiceConnected(android.content.ComponentName, android.support.customtabs.CustomTabsClient);
    method public final void onServiceConnected(android.content.ComponentName, android.os.IBinder);
  }

  public final class CustomTabsSession {
    method public boolean mayLaunchUrl(android.net.Uri, android.os.Bundle, java.util.List<android.os.Bundle>);
    method public int postMessage(java.lang.String, android.os.Bundle);
    method public boolean requestPostMessageChannel(android.net.Uri);
    method public boolean setActionButton(android.graphics.Bitmap, java.lang.String);
    method public boolean setSecondaryToolbarViews(android.widget.RemoteViews, int[], android.app.PendingIntent);
    method public deprecated boolean setToolbarItem(int, android.graphics.Bitmap, java.lang.String);
  }

  public class CustomTabsSessionToken {
    method public android.support.customtabs.CustomTabsCallback getCallback();
    method public static android.support.customtabs.CustomTabsSessionToken getSessionTokenFromIntent(android.content.Intent);
    method public boolean isAssociatedWith(android.support.customtabs.CustomTabsSession);
  }

  public class PostMessageService extends android.app.Service {
    ctor public PostMessageService();
    method public android.os.IBinder onBind(android.content.Intent);
  }

  public abstract class PostMessageServiceConnection implements android.content.ServiceConnection {
    ctor public PostMessageServiceConnection(android.support.customtabs.CustomTabsSessionToken);
    method public boolean bindSessionToPostMessageService(android.content.Context, java.lang.String);
    method public final boolean notifyMessageChannelReady(android.os.Bundle);
    method public void onPostMessageServiceConnected();
    method public void onPostMessageServiceDisconnected();
    method public final void onServiceConnected(android.content.ComponentName, android.os.IBinder);
    method public final void onServiceDisconnected(android.content.ComponentName);
    method public final boolean postMessage(java.lang.String, android.os.Bundle);
    method public void unbindFromContext(android.content.Context);
  }

}

package android.support.design.widget {

  public class AppBarLayout extends android.widget.LinearLayout {
    ctor public AppBarLayout(android.content.Context);
    ctor public AppBarLayout(android.content.Context, android.util.AttributeSet);
    method public void addOnOffsetChangedListener(android.support.design.widget.AppBarLayout.OnOffsetChangedListener);
    method protected android.support.design.widget.AppBarLayout.LayoutParams generateDefaultLayoutParams();
    method public android.support.design.widget.AppBarLayout.LayoutParams generateLayoutParams(android.util.AttributeSet);
    method protected android.support.design.widget.AppBarLayout.LayoutParams generateLayoutParams(android.view.ViewGroup.LayoutParams);
    method public deprecated float getTargetElevation();
    method public final int getTotalScrollRange();
    method public void removeOnOffsetChangedListener(android.support.design.widget.AppBarLayout.OnOffsetChangedListener);
    method public void setExpanded(boolean);
    method public void setExpanded(boolean, boolean);
    method public deprecated void setTargetElevation(float);
  }

  public static class AppBarLayout.Behavior extends android.support.design.widget.HeaderBehavior {
    ctor public AppBarLayout.Behavior();
    ctor public AppBarLayout.Behavior(android.content.Context, android.util.AttributeSet);
    method public boolean onLayoutChild(android.support.design.widget.CoordinatorLayout, android.support.design.widget.AppBarLayout, int);
    method public boolean onMeasureChild(android.support.design.widget.CoordinatorLayout, android.support.design.widget.AppBarLayout, int, int, int, int);
    method public void onNestedPreScroll(android.support.design.widget.CoordinatorLayout, android.support.design.widget.AppBarLayout, android.view.View, int, int, int[], int);
    method public void onNestedScroll(android.support.design.widget.CoordinatorLayout, android.support.design.widget.AppBarLayout, android.view.View, int, int, int, int, int);
    method public void onRestoreInstanceState(android.support.design.widget.CoordinatorLayout, android.support.design.widget.AppBarLayout, android.os.Parcelable);
    method public android.os.Parcelable onSaveInstanceState(android.support.design.widget.CoordinatorLayout, android.support.design.widget.AppBarLayout);
    method public boolean onStartNestedScroll(android.support.design.widget.CoordinatorLayout, android.support.design.widget.AppBarLayout, android.view.View, android.view.View, int, int);
    method public void onStopNestedScroll(android.support.design.widget.CoordinatorLayout, android.support.design.widget.AppBarLayout, android.view.View, int);
    method public void setDragCallback(android.support.design.widget.AppBarLayout.Behavior.DragCallback);
  }

  public static abstract class AppBarLayout.Behavior.DragCallback {
    ctor public AppBarLayout.Behavior.DragCallback();
    method public abstract boolean canDrag(android.support.design.widget.AppBarLayout);
  }

  protected static class AppBarLayout.Behavior.SavedState extends android.support.v4.view.AbsSavedState {
    ctor public AppBarLayout.Behavior.SavedState(android.os.Parcel, java.lang.ClassLoader);
    ctor public AppBarLayout.Behavior.SavedState(android.os.Parcelable);
    field public static final android.os.Parcelable.Creator<android.support.design.widget.AppBarLayout.Behavior.SavedState> CREATOR;
  }

  public static class AppBarLayout.LayoutParams extends android.widget.LinearLayout.LayoutParams {
    ctor public AppBarLayout.LayoutParams(android.content.Context, android.util.AttributeSet);
    ctor public AppBarLayout.LayoutParams(int, int);
    ctor public AppBarLayout.LayoutParams(int, int, float);
    ctor public AppBarLayout.LayoutParams(android.view.ViewGroup.LayoutParams);
    ctor public AppBarLayout.LayoutParams(android.view.ViewGroup.MarginLayoutParams);
    ctor public AppBarLayout.LayoutParams(android.widget.LinearLayout.LayoutParams);
    ctor public AppBarLayout.LayoutParams(android.support.design.widget.AppBarLayout.LayoutParams);
    method public int getScrollFlags();
    method public android.view.animation.Interpolator getScrollInterpolator();
    method public void setScrollFlags(int);
    method public void setScrollInterpolator(android.view.animation.Interpolator);
    field public static final int SCROLL_FLAG_ENTER_ALWAYS = 4; // 0x4
    field public static final int SCROLL_FLAG_ENTER_ALWAYS_COLLAPSED = 8; // 0x8
    field public static final int SCROLL_FLAG_EXIT_UNTIL_COLLAPSED = 2; // 0x2
    field public static final int SCROLL_FLAG_SCROLL = 1; // 0x1
    field public static final int SCROLL_FLAG_SNAP = 16; // 0x10
  }

  public static abstract interface AppBarLayout.OnOffsetChangedListener {
    method public abstract void onOffsetChanged(android.support.design.widget.AppBarLayout, int);
  }

  public static class AppBarLayout.ScrollingViewBehavior extends android.support.design.widget.HeaderScrollingViewBehavior {
    ctor public AppBarLayout.ScrollingViewBehavior();
    ctor public AppBarLayout.ScrollingViewBehavior(android.content.Context, android.util.AttributeSet);
    method public boolean layoutDependsOn(android.support.design.widget.CoordinatorLayout, android.view.View, android.view.View);
    method public boolean onDependentViewChanged(android.support.design.widget.CoordinatorLayout, android.view.View, android.view.View);
    method public boolean onRequestChildRectangleOnScreen(android.support.design.widget.CoordinatorLayout, android.view.View, android.graphics.Rect, boolean);
  }

  public abstract class BaseTransientBottomBar<B extends android.support.design.widget.BaseTransientBottomBar<B>> {
    ctor protected BaseTransientBottomBar(android.view.ViewGroup, android.view.View, android.support.design.widget.BaseTransientBottomBar.ContentViewCallback);
    method public B addCallback(android.support.design.widget.BaseTransientBottomBar.BaseCallback<B>);
    method public void dismiss();
    method public android.content.Context getContext();
    method public int getDuration();
    method public android.view.View getView();
    method public boolean isShown();
    method public boolean isShownOrQueued();
    method public B removeCallback(android.support.design.widget.BaseTransientBottomBar.BaseCallback<B>);
    method public B setDuration(int);
    method public void show();
    field public static final int LENGTH_INDEFINITE = -2; // 0xfffffffe
    field public static final int LENGTH_LONG = 0; // 0x0
    field public static final int LENGTH_SHORT = -1; // 0xffffffff
  }

  public static abstract class BaseTransientBottomBar.BaseCallback<B> {
    ctor public BaseTransientBottomBar.BaseCallback();
    method public void onDismissed(B, int);
    method public void onShown(B);
    field public static final int DISMISS_EVENT_ACTION = 1; // 0x1
    field public static final int DISMISS_EVENT_CONSECUTIVE = 4; // 0x4
    field public static final int DISMISS_EVENT_MANUAL = 3; // 0x3
    field public static final int DISMISS_EVENT_SWIPE = 0; // 0x0
    field public static final int DISMISS_EVENT_TIMEOUT = 2; // 0x2
  }

  public static abstract interface BaseTransientBottomBar.ContentViewCallback {
    method public abstract void animateContentIn(int, int);
    method public abstract void animateContentOut(int, int);
  }

  public class BottomNavigationView extends android.widget.FrameLayout {
    ctor public BottomNavigationView(android.content.Context);
    ctor public BottomNavigationView(android.content.Context, android.util.AttributeSet);
    ctor public BottomNavigationView(android.content.Context, android.util.AttributeSet, int);
    method public int getItemBackgroundResource();
    method public android.content.res.ColorStateList getItemIconTintList();
    method public android.content.res.ColorStateList getItemTextColor();
    method public int getMaxItemCount();
    method public android.view.Menu getMenu();
    method public int getSelectedItemId();
    method public void inflateMenu(int);
    method public void setItemBackgroundResource(int);
    method public void setItemIconTintList(android.content.res.ColorStateList);
    method public void setItemTextColor(android.content.res.ColorStateList);
    method public void setOnNavigationItemReselectedListener(android.support.design.widget.BottomNavigationView.OnNavigationItemReselectedListener);
    method public void setOnNavigationItemSelectedListener(android.support.design.widget.BottomNavigationView.OnNavigationItemSelectedListener);
    method public void setSelectedItemId(int);
  }

  public static abstract interface BottomNavigationView.OnNavigationItemReselectedListener {
    method public abstract void onNavigationItemReselected(android.view.MenuItem);
  }

  public static abstract interface BottomNavigationView.OnNavigationItemSelectedListener {
    method public abstract boolean onNavigationItemSelected(android.view.MenuItem);
  }

  public class BottomSheetBehavior<V extends android.view.View> extends android.support.design.widget.CoordinatorLayout.Behavior {
    ctor public BottomSheetBehavior();
    ctor public BottomSheetBehavior(android.content.Context, android.util.AttributeSet);
    method public static <V extends android.view.View> android.support.design.widget.BottomSheetBehavior<V> from(V);
    method public final int getPeekHeight();
    method public boolean getSkipCollapsed();
    method public final int getState();
    method public boolean isHideable();
    method public void onNestedPreScroll(android.support.design.widget.CoordinatorLayout, V, android.view.View, int, int, int[]);
    method public boolean onStartNestedScroll(android.support.design.widget.CoordinatorLayout, V, android.view.View, android.view.View, int);
    method public void onStopNestedScroll(android.support.design.widget.CoordinatorLayout, V, android.view.View);
    method public void setBottomSheetCallback(android.support.design.widget.BottomSheetBehavior.BottomSheetCallback);
    method public void setHideable(boolean);
    method public final void setPeekHeight(int);
    method public void setSkipCollapsed(boolean);
    method public final void setState(int);
    field public static final int PEEK_HEIGHT_AUTO = -1; // 0xffffffff
    field public static final int STATE_COLLAPSED = 4; // 0x4
    field public static final int STATE_DRAGGING = 1; // 0x1
    field public static final int STATE_EXPANDED = 3; // 0x3
    field public static final int STATE_HIDDEN = 5; // 0x5
    field public static final int STATE_SETTLING = 2; // 0x2
  }

  public static abstract class BottomSheetBehavior.BottomSheetCallback {
    ctor public BottomSheetBehavior.BottomSheetCallback();
    method public abstract void onSlide(android.view.View, float);
    method public abstract void onStateChanged(android.view.View, int);
  }

  protected static class BottomSheetBehavior.SavedState extends android.support.v4.view.AbsSavedState {
    ctor public BottomSheetBehavior.SavedState(android.os.Parcel);
    ctor public BottomSheetBehavior.SavedState(android.os.Parcel, java.lang.ClassLoader);
    ctor public BottomSheetBehavior.SavedState(android.os.Parcelable, int);
    field public static final android.os.Parcelable.Creator<android.support.design.widget.BottomSheetBehavior.SavedState> CREATOR;
  }

  public class BottomSheetDialog extends android.support.v7.app.AppCompatDialog {
    ctor public BottomSheetDialog(android.content.Context);
    ctor public BottomSheetDialog(android.content.Context, int);
    ctor protected BottomSheetDialog(android.content.Context, boolean, android.content.DialogInterface.OnCancelListener);
  }

  public class BottomSheetDialogFragment extends android.support.v7.app.AppCompatDialogFragment {
    ctor public BottomSheetDialogFragment();
  }

  public class CollapsingToolbarLayout extends android.widget.FrameLayout {
    ctor public CollapsingToolbarLayout(android.content.Context);
    ctor public CollapsingToolbarLayout(android.content.Context, android.util.AttributeSet);
    ctor public CollapsingToolbarLayout(android.content.Context, android.util.AttributeSet, int);
    method protected android.support.design.widget.CollapsingToolbarLayout.LayoutParams generateDefaultLayoutParams();
    method public android.widget.FrameLayout.LayoutParams generateLayoutParams(android.util.AttributeSet);
    method protected android.widget.FrameLayout.LayoutParams generateLayoutParams(android.view.ViewGroup.LayoutParams);
    method public int getCollapsedTitleGravity();
    method public android.graphics.Typeface getCollapsedTitleTypeface();
    method public android.graphics.drawable.Drawable getContentScrim();
    method public int getExpandedTitleGravity();
    method public int getExpandedTitleMarginBottom();
    method public int getExpandedTitleMarginEnd();
    method public int getExpandedTitleMarginStart();
    method public int getExpandedTitleMarginTop();
    method public android.graphics.Typeface getExpandedTitleTypeface();
    method public long getScrimAnimationDuration();
    method public int getScrimVisibleHeightTrigger();
    method public android.graphics.drawable.Drawable getStatusBarScrim();
    method public java.lang.CharSequence getTitle();
    method public boolean isTitleEnabled();
    method public void setCollapsedTitleGravity(int);
    method public void setCollapsedTitleTextAppearance(int);
    method public void setCollapsedTitleTextColor(int);
    method public void setCollapsedTitleTextColor(android.content.res.ColorStateList);
    method public void setCollapsedTitleTypeface(android.graphics.Typeface);
    method public void setContentScrim(android.graphics.drawable.Drawable);
    method public void setContentScrimColor(int);
    method public void setContentScrimResource(int);
    method public void setExpandedTitleColor(int);
    method public void setExpandedTitleGravity(int);
    method public void setExpandedTitleMargin(int, int, int, int);
    method public void setExpandedTitleMarginBottom(int);
    method public void setExpandedTitleMarginEnd(int);
    method public void setExpandedTitleMarginStart(int);
    method public void setExpandedTitleMarginTop(int);
    method public void setExpandedTitleTextAppearance(int);
    method public void setExpandedTitleTextColor(android.content.res.ColorStateList);
    method public void setExpandedTitleTypeface(android.graphics.Typeface);
    method public void setScrimAnimationDuration(long);
    method public void setScrimVisibleHeightTrigger(int);
    method public void setScrimsShown(boolean);
    method public void setScrimsShown(boolean, boolean);
    method public void setStatusBarScrim(android.graphics.drawable.Drawable);
    method public void setStatusBarScrimColor(int);
    method public void setStatusBarScrimResource(int);
    method public void setTitle(java.lang.CharSequence);
    method public void setTitleEnabled(boolean);
  }

  public static class CollapsingToolbarLayout.LayoutParams extends android.widget.FrameLayout.LayoutParams {
    ctor public CollapsingToolbarLayout.LayoutParams(android.content.Context, android.util.AttributeSet);
    ctor public CollapsingToolbarLayout.LayoutParams(int, int);
    ctor public CollapsingToolbarLayout.LayoutParams(int, int, int);
    ctor public CollapsingToolbarLayout.LayoutParams(android.view.ViewGroup.LayoutParams);
    ctor public CollapsingToolbarLayout.LayoutParams(android.view.ViewGroup.MarginLayoutParams);
    ctor public CollapsingToolbarLayout.LayoutParams(android.widget.FrameLayout.LayoutParams);
    method public int getCollapseMode();
    method public float getParallaxMultiplier();
    method public void setCollapseMode(int);
    method public void setParallaxMultiplier(float);
    field public static final int COLLAPSE_MODE_OFF = 0; // 0x0
    field public static final int COLLAPSE_MODE_PARALLAX = 2; // 0x2
    field public static final int COLLAPSE_MODE_PIN = 1; // 0x1
  }

  public class CoordinatorLayout extends android.view.ViewGroup implements android.support.v4.view.NestedScrollingParent2 {
    ctor public CoordinatorLayout(android.content.Context);
    ctor public CoordinatorLayout(android.content.Context, android.util.AttributeSet);
    ctor public CoordinatorLayout(android.content.Context, android.util.AttributeSet, int);
    method public void dispatchDependentViewsChanged(android.view.View);
    method public boolean doViewsOverlap(android.view.View, android.view.View);
    method protected android.support.design.widget.CoordinatorLayout.LayoutParams generateDefaultLayoutParams();
    method public android.support.design.widget.CoordinatorLayout.LayoutParams generateLayoutParams(android.util.AttributeSet);
    method protected android.support.design.widget.CoordinatorLayout.LayoutParams generateLayoutParams(android.view.ViewGroup.LayoutParams);
    method public java.util.List<android.view.View> getDependencies(android.view.View);
    method public java.util.List<android.view.View> getDependents(android.view.View);
    method public android.graphics.drawable.Drawable getStatusBarBackground();
    method public boolean isPointInChildBounds(android.view.View, int, int);
    method public void onAttachedToWindow();
    method public void onDetachedFromWindow();
    method public void onDraw(android.graphics.Canvas);
    method protected void onLayout(boolean, int, int, int, int);
    method public void onLayoutChild(android.view.View, int);
    method public void onMeasureChild(android.view.View, int, int, int, int);
    method public void onNestedPreScroll(android.view.View, int, int, int[], int);
    method public void onNestedScroll(android.view.View, int, int, int, int, int);
    method public void onNestedScrollAccepted(android.view.View, android.view.View, int, int);
    method public boolean onStartNestedScroll(android.view.View, android.view.View, int, int);
    method public void onStopNestedScroll(android.view.View, int);
    method public void setStatusBarBackground(android.graphics.drawable.Drawable);
    method public void setStatusBarBackgroundColor(int);
    method public void setStatusBarBackgroundResource(int);
  }

  public static abstract class CoordinatorLayout.Behavior<V extends android.view.View> {
    ctor public CoordinatorLayout.Behavior();
    ctor public CoordinatorLayout.Behavior(android.content.Context, android.util.AttributeSet);
    method public boolean blocksInteractionBelow(android.support.design.widget.CoordinatorLayout, V);
    method public boolean getInsetDodgeRect(android.support.design.widget.CoordinatorLayout, V, android.graphics.Rect);
    method public int getScrimColor(android.support.design.widget.CoordinatorLayout, V);
    method public float getScrimOpacity(android.support.design.widget.CoordinatorLayout, V);
    method public static java.lang.Object getTag(android.view.View);
    method public boolean layoutDependsOn(android.support.design.widget.CoordinatorLayout, V, android.view.View);
    method public android.support.v4.view.WindowInsetsCompat onApplyWindowInsets(android.support.design.widget.CoordinatorLayout, V, android.support.v4.view.WindowInsetsCompat);
    method public void onAttachedToLayoutParams(android.support.design.widget.CoordinatorLayout.LayoutParams);
    method public boolean onDependentViewChanged(android.support.design.widget.CoordinatorLayout, V, android.view.View);
    method public void onDependentViewRemoved(android.support.design.widget.CoordinatorLayout, V, android.view.View);
    method public void onDetachedFromLayoutParams();
    method public boolean onInterceptTouchEvent(android.support.design.widget.CoordinatorLayout, V, android.view.MotionEvent);
    method public boolean onLayoutChild(android.support.design.widget.CoordinatorLayout, V, int);
    method public boolean onMeasureChild(android.support.design.widget.CoordinatorLayout, V, int, int, int, int);
    method public boolean onNestedFling(android.support.design.widget.CoordinatorLayout, V, android.view.View, float, float, boolean);
    method public boolean onNestedPreFling(android.support.design.widget.CoordinatorLayout, V, android.view.View, float, float);
    method public deprecated void onNestedPreScroll(android.support.design.widget.CoordinatorLayout, V, android.view.View, int, int, int[]);
    method public void onNestedPreScroll(android.support.design.widget.CoordinatorLayout, V, android.view.View, int, int, int[], int);
    method public deprecated void onNestedScroll(android.support.design.widget.CoordinatorLayout, V, android.view.View, int, int, int, int);
    method public void onNestedScroll(android.support.design.widget.CoordinatorLayout, V, android.view.View, int, int, int, int, int);
    method public deprecated void onNestedScrollAccepted(android.support.design.widget.CoordinatorLayout, V, android.view.View, android.view.View, int);
    method public void onNestedScrollAccepted(android.support.design.widget.CoordinatorLayout, V, android.view.View, android.view.View, int, int);
    method public boolean onRequestChildRectangleOnScreen(android.support.design.widget.CoordinatorLayout, V, android.graphics.Rect, boolean);
    method public void onRestoreInstanceState(android.support.design.widget.CoordinatorLayout, V, android.os.Parcelable);
    method public android.os.Parcelable onSaveInstanceState(android.support.design.widget.CoordinatorLayout, V);
    method public deprecated boolean onStartNestedScroll(android.support.design.widget.CoordinatorLayout, V, android.view.View, android.view.View, int);
    method public boolean onStartNestedScroll(android.support.design.widget.CoordinatorLayout, V, android.view.View, android.view.View, int, int);
    method public deprecated void onStopNestedScroll(android.support.design.widget.CoordinatorLayout, V, android.view.View);
    method public void onStopNestedScroll(android.support.design.widget.CoordinatorLayout, V, android.view.View, int);
    method public boolean onTouchEvent(android.support.design.widget.CoordinatorLayout, V, android.view.MotionEvent);
    method public static void setTag(android.view.View, java.lang.Object);
  }

  public static abstract class CoordinatorLayout.DefaultBehavior implements java.lang.annotation.Annotation {
  }

  public static class CoordinatorLayout.LayoutParams extends android.view.ViewGroup.MarginLayoutParams {
    ctor public CoordinatorLayout.LayoutParams(int, int);
    ctor public CoordinatorLayout.LayoutParams(android.support.design.widget.CoordinatorLayout.LayoutParams);
    ctor public CoordinatorLayout.LayoutParams(android.view.ViewGroup.MarginLayoutParams);
    ctor public CoordinatorLayout.LayoutParams(android.view.ViewGroup.LayoutParams);
    method public int getAnchorId();
    method public android.support.design.widget.CoordinatorLayout.Behavior getBehavior();
    method public void setAnchorId(int);
    method public void setBehavior(android.support.design.widget.CoordinatorLayout.Behavior);
    field public int anchorGravity;
    field public int dodgeInsetEdges;
    field public int gravity;
    field public int insetEdge;
    field public int keyline;
  }

  protected static class CoordinatorLayout.SavedState extends android.support.v4.view.AbsSavedState {
    ctor public CoordinatorLayout.SavedState(android.os.Parcel, java.lang.ClassLoader);
    ctor public CoordinatorLayout.SavedState(android.os.Parcelable);
    field public static final android.os.Parcelable.Creator<android.support.design.widget.CoordinatorLayout.SavedState> CREATOR;
  }

  public class FloatingActionButton extends android.support.design.widget.VisibilityAwareImageButton {
    ctor public FloatingActionButton(android.content.Context);
    ctor public FloatingActionButton(android.content.Context, android.util.AttributeSet);
    ctor public FloatingActionButton(android.content.Context, android.util.AttributeSet, int);
    method public float getCompatElevation();
    method public android.graphics.drawable.Drawable getContentBackground();
    method public boolean getContentRect(android.graphics.Rect);
    method public int getRippleColor();
    method public int getSize();
    method public boolean getUseCompatPadding();
    method public void hide();
    method public void hide(android.support.design.widget.FloatingActionButton.OnVisibilityChangedListener);
    method public void setBackgroundDrawable(android.graphics.drawable.Drawable);
    method public void setCompatElevation(float);
    method public void setRippleColor(int);
    method public void setSize(int);
    method public void setUseCompatPadding(boolean);
    method public void show();
    method public void show(android.support.design.widget.FloatingActionButton.OnVisibilityChangedListener);
    field public static final int SIZE_AUTO = -1; // 0xffffffff
    field public static final int SIZE_MINI = 1; // 0x1
    field public static final int SIZE_NORMAL = 0; // 0x0
  }

  public static class FloatingActionButton.Behavior extends android.support.design.widget.CoordinatorLayout.Behavior {
    ctor public FloatingActionButton.Behavior();
    ctor public FloatingActionButton.Behavior(android.content.Context, android.util.AttributeSet);
    method public boolean getInsetDodgeRect(android.support.design.widget.CoordinatorLayout, android.support.design.widget.FloatingActionButton, android.graphics.Rect);
    method public boolean isAutoHideEnabled();
    method public boolean onDependentViewChanged(android.support.design.widget.CoordinatorLayout, android.support.design.widget.FloatingActionButton, android.view.View);
    method public boolean onLayoutChild(android.support.design.widget.CoordinatorLayout, android.support.design.widget.FloatingActionButton, int);
    method public void setAutoHideEnabled(boolean);
  }

  public static abstract class FloatingActionButton.OnVisibilityChangedListener {
    ctor public FloatingActionButton.OnVisibilityChangedListener();
    method public void onHidden(android.support.design.widget.FloatingActionButton);
    method public void onShown(android.support.design.widget.FloatingActionButton);
  }

   abstract class HeaderBehavior<V extends android.view.View> extends android.support.design.widget.ViewOffsetBehavior {
    ctor public HeaderBehavior();
    ctor public HeaderBehavior(android.content.Context, android.util.AttributeSet);
  }

   abstract class HeaderScrollingViewBehavior extends android.support.design.widget.ViewOffsetBehavior {
    ctor public HeaderScrollingViewBehavior();
    ctor public HeaderScrollingViewBehavior(android.content.Context, android.util.AttributeSet);
    method public final int getOverlayTop();
    method protected void layoutChild(android.support.design.widget.CoordinatorLayout, android.view.View, int);
    method public boolean onMeasureChild(android.support.design.widget.CoordinatorLayout, android.view.View, int, int, int, int);
    method public final void setOverlayTop(int);
  }

  public class NavigationView extends android.widget.FrameLayout {
    ctor public NavigationView(android.content.Context);
    ctor public NavigationView(android.content.Context, android.util.AttributeSet);
    ctor public NavigationView(android.content.Context, android.util.AttributeSet, int);
    method public void addHeaderView(android.view.View);
    method public int getHeaderCount();
    method public android.view.View getHeaderView(int);
    method public android.graphics.drawable.Drawable getItemBackground();
    method public android.content.res.ColorStateList getItemIconTintList();
    method public android.content.res.ColorStateList getItemTextColor();
    method public android.view.Menu getMenu();
    method public android.view.View inflateHeaderView(int);
    method public void inflateMenu(int);
    method public void removeHeaderView(android.view.View);
    method public void setCheckedItem(int);
    method public void setItemBackground(android.graphics.drawable.Drawable);
    method public void setItemBackgroundResource(int);
    method public void setItemIconTintList(android.content.res.ColorStateList);
    method public void setItemTextAppearance(int);
    method public void setItemTextColor(android.content.res.ColorStateList);
    method public void setNavigationItemSelectedListener(android.support.design.widget.NavigationView.OnNavigationItemSelectedListener);
  }

  public static abstract interface NavigationView.OnNavigationItemSelectedListener {
    method public abstract boolean onNavigationItemSelected(android.view.MenuItem);
  }

  public static class NavigationView.SavedState extends android.support.v4.view.AbsSavedState {
    ctor public NavigationView.SavedState(android.os.Parcel, java.lang.ClassLoader);
    ctor public NavigationView.SavedState(android.os.Parcelable);
    field public static final android.os.Parcelable.Creator<android.support.design.widget.NavigationView.SavedState> CREATOR;
    field public android.os.Bundle menuState;
  }

  public final class Snackbar extends android.support.design.widget.BaseTransientBottomBar {
    method public static android.support.design.widget.Snackbar make(android.view.View, java.lang.CharSequence, int);
    method public static android.support.design.widget.Snackbar make(android.view.View, int, int);
    method public android.support.design.widget.Snackbar setAction(int, android.view.View.OnClickListener);
    method public android.support.design.widget.Snackbar setAction(java.lang.CharSequence, android.view.View.OnClickListener);
    method public android.support.design.widget.Snackbar setActionTextColor(android.content.res.ColorStateList);
    method public android.support.design.widget.Snackbar setActionTextColor(int);
    method public deprecated android.support.design.widget.Snackbar setCallback(android.support.design.widget.Snackbar.Callback);
    method public android.support.design.widget.Snackbar setText(java.lang.CharSequence);
    method public android.support.design.widget.Snackbar setText(int);
    field public static final int LENGTH_INDEFINITE = -2; // 0xfffffffe
    field public static final int LENGTH_LONG = 0; // 0x0
    field public static final int LENGTH_SHORT = -1; // 0xffffffff
  }

  public static class Snackbar.Callback extends android.support.design.widget.BaseTransientBottomBar.BaseCallback {
    ctor public Snackbar.Callback();
    method public void onDismissed(android.support.design.widget.Snackbar, int);
    method public void onShown(android.support.design.widget.Snackbar);
    field public static final int DISMISS_EVENT_ACTION = 1; // 0x1
    field public static final int DISMISS_EVENT_CONSECUTIVE = 4; // 0x4
    field public static final int DISMISS_EVENT_MANUAL = 3; // 0x3
    field public static final int DISMISS_EVENT_SWIPE = 0; // 0x0
    field public static final int DISMISS_EVENT_TIMEOUT = 2; // 0x2
  }

  public class SwipeDismissBehavior<V extends android.view.View> extends android.support.design.widget.CoordinatorLayout.Behavior {
    ctor public SwipeDismissBehavior();
    method public boolean canSwipeDismissView(android.view.View);
    method public int getDragState();
    method public void setDragDismissDistance(float);
    method public void setEndAlphaSwipeDistance(float);
    method public void setListener(android.support.design.widget.SwipeDismissBehavior.OnDismissListener);
    method public void setSensitivity(float);
    method public void setStartAlphaSwipeDistance(float);
    method public void setSwipeDirection(int);
    field public static final int STATE_DRAGGING = 1; // 0x1
    field public static final int STATE_IDLE = 0; // 0x0
    field public static final int STATE_SETTLING = 2; // 0x2
    field public static final int SWIPE_DIRECTION_ANY = 2; // 0x2
    field public static final int SWIPE_DIRECTION_END_TO_START = 1; // 0x1
    field public static final int SWIPE_DIRECTION_START_TO_END = 0; // 0x0
  }

  public static abstract interface SwipeDismissBehavior.OnDismissListener {
    method public abstract void onDismiss(android.view.View);
    method public abstract void onDragStateChanged(int);
  }

  public final class TabItem extends android.view.View {
    ctor public TabItem(android.content.Context);
    ctor public TabItem(android.content.Context, android.util.AttributeSet);
  }

  public class TabLayout extends android.widget.HorizontalScrollView {
    ctor public TabLayout(android.content.Context);
    ctor public TabLayout(android.content.Context, android.util.AttributeSet);
    ctor public TabLayout(android.content.Context, android.util.AttributeSet, int);
    method public void addOnTabSelectedListener(android.support.design.widget.TabLayout.OnTabSelectedListener);
    method public void addTab(android.support.design.widget.TabLayout.Tab);
    method public void addTab(android.support.design.widget.TabLayout.Tab, int);
    method public void addTab(android.support.design.widget.TabLayout.Tab, boolean);
    method public void addTab(android.support.design.widget.TabLayout.Tab, int, boolean);
    method public void clearOnTabSelectedListeners();
    method public android.widget.FrameLayout.LayoutParams generateLayoutParams(android.util.AttributeSet);
    method public int getSelectedTabPosition();
    method public android.support.design.widget.TabLayout.Tab getTabAt(int);
    method public int getTabCount();
    method public int getTabGravity();
    method public int getTabMode();
    method public android.content.res.ColorStateList getTabTextColors();
    method public android.support.design.widget.TabLayout.Tab newTab();
    method public void removeAllTabs();
    method public void removeOnTabSelectedListener(android.support.design.widget.TabLayout.OnTabSelectedListener);
    method public void removeTab(android.support.design.widget.TabLayout.Tab);
    method public void removeTabAt(int);
    method public deprecated void setOnTabSelectedListener(android.support.design.widget.TabLayout.OnTabSelectedListener);
    method public void setScrollPosition(int, float, boolean);
    method public void setSelectedTabIndicatorColor(int);
    method public void setSelectedTabIndicatorHeight(int);
    method public void setTabGravity(int);
    method public void setTabMode(int);
    method public void setTabTextColors(android.content.res.ColorStateList);
    method public void setTabTextColors(int, int);
    method public deprecated void setTabsFromPagerAdapter(android.support.v4.view.PagerAdapter);
    method public void setupWithViewPager(android.support.v4.view.ViewPager);
    method public void setupWithViewPager(android.support.v4.view.ViewPager, boolean);
    field public static final int GRAVITY_CENTER = 1; // 0x1
    field public static final int GRAVITY_FILL = 0; // 0x0
    field public static final int MODE_FIXED = 1; // 0x1
    field public static final int MODE_SCROLLABLE = 0; // 0x0
  }

  public static abstract interface TabLayout.OnTabSelectedListener {
    method public abstract void onTabReselected(android.support.design.widget.TabLayout.Tab);
    method public abstract void onTabSelected(android.support.design.widget.TabLayout.Tab);
    method public abstract void onTabUnselected(android.support.design.widget.TabLayout.Tab);
  }

  public static final class TabLayout.Tab {
    method public java.lang.CharSequence getContentDescription();
    method public android.view.View getCustomView();
    method public android.graphics.drawable.Drawable getIcon();
    method public int getPosition();
    method public java.lang.Object getTag();
    method public java.lang.CharSequence getText();
    method public boolean isSelected();
    method public void select();
    method public android.support.design.widget.TabLayout.Tab setContentDescription(int);
    method public android.support.design.widget.TabLayout.Tab setContentDescription(java.lang.CharSequence);
    method public android.support.design.widget.TabLayout.Tab setCustomView(android.view.View);
    method public android.support.design.widget.TabLayout.Tab setCustomView(int);
    method public android.support.design.widget.TabLayout.Tab setIcon(android.graphics.drawable.Drawable);
    method public android.support.design.widget.TabLayout.Tab setIcon(int);
    method public android.support.design.widget.TabLayout.Tab setTag(java.lang.Object);
    method public android.support.design.widget.TabLayout.Tab setText(java.lang.CharSequence);
    method public android.support.design.widget.TabLayout.Tab setText(int);
    field public static final int INVALID_POSITION = -1; // 0xffffffff
  }

  public static class TabLayout.TabLayoutOnPageChangeListener implements android.support.v4.view.ViewPager.OnPageChangeListener {
    ctor public TabLayout.TabLayoutOnPageChangeListener(android.support.design.widget.TabLayout);
    method public void onPageScrollStateChanged(int);
    method public void onPageScrolled(int, float, int);
    method public void onPageSelected(int);
  }

  public static class TabLayout.ViewPagerOnTabSelectedListener implements android.support.design.widget.TabLayout.OnTabSelectedListener {
    ctor public TabLayout.ViewPagerOnTabSelectedListener(android.support.v4.view.ViewPager);
    method public void onTabReselected(android.support.design.widget.TabLayout.Tab);
    method public void onTabSelected(android.support.design.widget.TabLayout.Tab);
    method public void onTabUnselected(android.support.design.widget.TabLayout.Tab);
  }

  public class TextInputEditText extends android.support.v7.widget.AppCompatEditText {
    ctor public TextInputEditText(android.content.Context);
    ctor public TextInputEditText(android.content.Context, android.util.AttributeSet);
    ctor public TextInputEditText(android.content.Context, android.util.AttributeSet, int);
  }

  public class TextInputLayout extends android.widget.LinearLayout {
    ctor public TextInputLayout(android.content.Context);
    ctor public TextInputLayout(android.content.Context, android.util.AttributeSet);
    ctor public TextInputLayout(android.content.Context, android.util.AttributeSet, int);
    method public int getCounterMaxLength();
    method public android.widget.EditText getEditText();
    method public java.lang.CharSequence getError();
    method public java.lang.CharSequence getHint();
    method public java.lang.CharSequence getPasswordVisibilityToggleContentDescription();
    method public android.graphics.drawable.Drawable getPasswordVisibilityToggleDrawable();
    method public android.graphics.Typeface getTypeface();
    method public boolean isCounterEnabled();
    method public boolean isErrorEnabled();
    method public boolean isHintAnimationEnabled();
    method public boolean isHintEnabled();
    method public boolean isPasswordVisibilityToggleEnabled();
    method public android.os.Parcelable onSaveInstanceState();
    method public void setCounterEnabled(boolean);
    method public void setCounterMaxLength(int);
    method public void setError(java.lang.CharSequence);
    method public void setErrorEnabled(boolean);
    method public void setErrorTextAppearance(int);
    method public void setHint(java.lang.CharSequence);
    method public void setHintAnimationEnabled(boolean);
    method public void setHintEnabled(boolean);
    method public void setHintTextAppearance(int);
    method public void setPasswordVisibilityToggleContentDescription(int);
    method public void setPasswordVisibilityToggleContentDescription(java.lang.CharSequence);
    method public void setPasswordVisibilityToggleDrawable(int);
    method public void setPasswordVisibilityToggleDrawable(android.graphics.drawable.Drawable);
    method public void setPasswordVisibilityToggleEnabled(boolean);
    method public void setPasswordVisibilityToggleTintList(android.content.res.ColorStateList);
    method public void setPasswordVisibilityToggleTintMode(android.graphics.PorterDuff.Mode);
    method public void setTypeface(android.graphics.Typeface);
  }

   class ViewOffsetBehavior<V extends android.view.View> extends android.support.design.widget.CoordinatorLayout.Behavior {
    ctor public ViewOffsetBehavior();
    ctor public ViewOffsetBehavior(android.content.Context, android.util.AttributeSet);
    method public int getLeftAndRightOffset();
    method public int getTopAndBottomOffset();
    method protected void layoutChild(android.support.design.widget.CoordinatorLayout, V, int);
    method public boolean setLeftAndRightOffset(int);
    method public boolean setTopAndBottomOffset(int);
  }

   class VisibilityAwareImageButton extends android.widget.ImageButton {
    ctor public VisibilityAwareImageButton(android.content.Context);
    ctor public VisibilityAwareImageButton(android.content.Context, android.util.AttributeSet);
    ctor public VisibilityAwareImageButton(android.content.Context, android.util.AttributeSet, int);
  }

}

package android.support.graphics.drawable {

  public abstract interface Animatable2Compat {
    method public abstract void clearAnimationCallbacks();
    method public abstract void registerAnimationCallback(android.support.graphics.drawable.Animatable2Compat.AnimationCallback);
    method public abstract boolean unregisterAnimationCallback(android.support.graphics.drawable.Animatable2Compat.AnimationCallback);
  }

  public static abstract class Animatable2Compat.AnimationCallback {
    ctor public Animatable2Compat.AnimationCallback();
    method public void onAnimationEnd(android.graphics.drawable.Drawable);
    method public void onAnimationStart(android.graphics.drawable.Drawable);
  }

  public class AnimatedVectorDrawableCompat extends android.support.graphics.drawable.VectorDrawableCommon implements android.support.graphics.drawable.Animatable2Compat {
    method public void clearAnimationCallbacks();
    method public static void clearAnimationCallbacks(android.graphics.drawable.Drawable);
    method public static android.support.graphics.drawable.AnimatedVectorDrawableCompat create(android.content.Context, int);
    method public static android.support.graphics.drawable.AnimatedVectorDrawableCompat createFromXmlInner(android.content.Context, android.content.res.Resources, org.xmlpull.v1.XmlPullParser, android.util.AttributeSet, android.content.res.Resources.Theme) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
    method public void draw(android.graphics.Canvas);
    method public int getOpacity();
    method public boolean isRunning();
    method public void registerAnimationCallback(android.support.graphics.drawable.Animatable2Compat.AnimationCallback);
    method public static void registerAnimationCallback(android.graphics.drawable.Drawable, android.support.graphics.drawable.Animatable2Compat.AnimationCallback);
    method public void setAlpha(int);
    method public void setColorFilter(android.graphics.ColorFilter);
    method public void start();
    method public void stop();
    method public boolean unregisterAnimationCallback(android.support.graphics.drawable.Animatable2Compat.AnimationCallback);
    method public static boolean unregisterAnimationCallback(android.graphics.drawable.Drawable, android.support.graphics.drawable.Animatable2Compat.AnimationCallback);
  }

   abstract class VectorDrawableCommon extends android.graphics.drawable.Drawable {
  }

  public class VectorDrawableCompat extends android.support.graphics.drawable.VectorDrawableCommon {
    method public static android.support.graphics.drawable.VectorDrawableCompat create(android.content.res.Resources, int, android.content.res.Resources.Theme);
    method public static android.support.graphics.drawable.VectorDrawableCompat createFromXmlInner(android.content.res.Resources, org.xmlpull.v1.XmlPullParser, android.util.AttributeSet, android.content.res.Resources.Theme) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
    method public void draw(android.graphics.Canvas);
    method public int getOpacity();
    method public void setAlpha(int);
    method public void setColorFilter(android.graphics.ColorFilter);
  }

}

package android.support.media {

  public class ExifInterface {
    ctor public ExifInterface(java.lang.String) throws java.io.IOException;
    ctor public ExifInterface(java.io.InputStream) throws java.io.IOException;
    method public void flipHorizontally();
    method public void flipVertically();
    method public double getAltitude(double);
    method public java.lang.String getAttribute(java.lang.String);
    method public double getAttributeDouble(java.lang.String, double);
    method public int getAttributeInt(java.lang.String, int);
    method public deprecated boolean getLatLong(float[]);
    method public double[] getLatLong();
    method public byte[] getThumbnail();
    method public android.graphics.Bitmap getThumbnailBitmap();
    method public byte[] getThumbnailBytes();
    method public long[] getThumbnailRange();
    method public boolean hasThumbnail();
    method public boolean isThumbnailCompressed();
    method public void resetOrientation();
    method public void rotate(int);
    method public void saveAttributes() throws java.io.IOException;
    method public void setAltitude(double);
    method public void setAttribute(java.lang.String, java.lang.String);
    method public void setGpsInfo(android.location.Location);
    method public void setLatLong(double, double);
    field public static final int ORIENTATION_FLIP_HORIZONTAL = 2; // 0x2
    field public static final int ORIENTATION_FLIP_VERTICAL = 4; // 0x4
    field public static final int ORIENTATION_NORMAL = 1; // 0x1
    field public static final int ORIENTATION_ROTATE_180 = 3; // 0x3
    field public static final int ORIENTATION_ROTATE_270 = 8; // 0x8
    field public static final int ORIENTATION_ROTATE_90 = 6; // 0x6
    field public static final int ORIENTATION_TRANSPOSE = 5; // 0x5
    field public static final int ORIENTATION_TRANSVERSE = 7; // 0x7
    field public static final int ORIENTATION_UNDEFINED = 0; // 0x0
    field public static final java.lang.String TAG_APERTURE_VALUE = "ApertureValue";
    field public static final java.lang.String TAG_ARTIST = "Artist";
    field public static final java.lang.String TAG_BITS_PER_SAMPLE = "BitsPerSample";
    field public static final java.lang.String TAG_BRIGHTNESS_VALUE = "BrightnessValue";
    field public static final java.lang.String TAG_CFA_PATTERN = "CFAPattern";
    field public static final java.lang.String TAG_COLOR_SPACE = "ColorSpace";
    field public static final java.lang.String TAG_COMPONENTS_CONFIGURATION = "ComponentsConfiguration";
    field public static final java.lang.String TAG_COMPRESSED_BITS_PER_PIXEL = "CompressedBitsPerPixel";
    field public static final java.lang.String TAG_COMPRESSION = "Compression";
    field public static final java.lang.String TAG_CONTRAST = "Contrast";
    field public static final java.lang.String TAG_COPYRIGHT = "Copyright";
    field public static final java.lang.String TAG_CUSTOM_RENDERED = "CustomRendered";
    field public static final java.lang.String TAG_DATETIME = "DateTime";
    field public static final java.lang.String TAG_DATETIME_DIGITIZED = "DateTimeDigitized";
    field public static final java.lang.String TAG_DATETIME_ORIGINAL = "DateTimeOriginal";
    field public static final java.lang.String TAG_DEFAULT_CROP_SIZE = "DefaultCropSize";
    field public static final java.lang.String TAG_DEVICE_SETTING_DESCRIPTION = "DeviceSettingDescription";
    field public static final java.lang.String TAG_DIGITAL_ZOOM_RATIO = "DigitalZoomRatio";
    field public static final java.lang.String TAG_DNG_VERSION = "DNGVersion";
    field public static final java.lang.String TAG_EXIF_VERSION = "ExifVersion";
    field public static final java.lang.String TAG_EXPOSURE_BIAS_VALUE = "ExposureBiasValue";
    field public static final java.lang.String TAG_EXPOSURE_INDEX = "ExposureIndex";
    field public static final java.lang.String TAG_EXPOSURE_MODE = "ExposureMode";
    field public static final java.lang.String TAG_EXPOSURE_PROGRAM = "ExposureProgram";
    field public static final java.lang.String TAG_EXPOSURE_TIME = "ExposureTime";
    field public static final java.lang.String TAG_FILE_SOURCE = "FileSource";
    field public static final java.lang.String TAG_FLASH = "Flash";
    field public static final java.lang.String TAG_FLASHPIX_VERSION = "FlashpixVersion";
    field public static final java.lang.String TAG_FLASH_ENERGY = "FlashEnergy";
    field public static final java.lang.String TAG_FOCAL_LENGTH = "FocalLength";
    field public static final java.lang.String TAG_FOCAL_LENGTH_IN_35MM_FILM = "FocalLengthIn35mmFilm";
    field public static final java.lang.String TAG_FOCAL_PLANE_RESOLUTION_UNIT = "FocalPlaneResolutionUnit";
    field public static final java.lang.String TAG_FOCAL_PLANE_X_RESOLUTION = "FocalPlaneXResolution";
    field public static final java.lang.String TAG_FOCAL_PLANE_Y_RESOLUTION = "FocalPlaneYResolution";
    field public static final java.lang.String TAG_F_NUMBER = "FNumber";
    field public static final java.lang.String TAG_GAIN_CONTROL = "GainControl";
    field public static final java.lang.String TAG_GPS_ALTITUDE = "GPSAltitude";
    field public static final java.lang.String TAG_GPS_ALTITUDE_REF = "GPSAltitudeRef";
    field public static final java.lang.String TAG_GPS_AREA_INFORMATION = "GPSAreaInformation";
    field public static final java.lang.String TAG_GPS_DATESTAMP = "GPSDateStamp";
    field public static final java.lang.String TAG_GPS_DEST_BEARING = "GPSDestBearing";
    field public static final java.lang.String TAG_GPS_DEST_BEARING_REF = "GPSDestBearingRef";
    field public static final java.lang.String TAG_GPS_DEST_DISTANCE = "GPSDestDistance";
    field public static final java.lang.String TAG_GPS_DEST_DISTANCE_REF = "GPSDestDistanceRef";
    field public static final java.lang.String TAG_GPS_DEST_LATITUDE = "GPSDestLatitude";
    field public static final java.lang.String TAG_GPS_DEST_LATITUDE_REF = "GPSDestLatitudeRef";
    field public static final java.lang.String TAG_GPS_DEST_LONGITUDE = "GPSDestLongitude";
    field public static final java.lang.String TAG_GPS_DEST_LONGITUDE_REF = "GPSDestLongitudeRef";
    field public static final java.lang.String TAG_GPS_DIFFERENTIAL = "GPSDifferential";
    field public static final java.lang.String TAG_GPS_DOP = "GPSDOP";
    field public static final java.lang.String TAG_GPS_IMG_DIRECTION = "GPSImgDirection";
    field public static final java.lang.String TAG_GPS_IMG_DIRECTION_REF = "GPSImgDirectionRef";
    field public static final java.lang.String TAG_GPS_LATITUDE = "GPSLatitude";
    field public static final java.lang.String TAG_GPS_LATITUDE_REF = "GPSLatitudeRef";
    field public static final java.lang.String TAG_GPS_LONGITUDE = "GPSLongitude";
    field public static final java.lang.String TAG_GPS_LONGITUDE_REF = "GPSLongitudeRef";
    field public static final java.lang.String TAG_GPS_MAP_DATUM = "GPSMapDatum";
    field public static final java.lang.String TAG_GPS_MEASURE_MODE = "GPSMeasureMode";
    field public static final java.lang.String TAG_GPS_PROCESSING_METHOD = "GPSProcessingMethod";
    field public static final java.lang.String TAG_GPS_SATELLITES = "GPSSatellites";
    field public static final java.lang.String TAG_GPS_SPEED = "GPSSpeed";
    field public static final java.lang.String TAG_GPS_SPEED_REF = "GPSSpeedRef";
    field public static final java.lang.String TAG_GPS_STATUS = "GPSStatus";
    field public static final java.lang.String TAG_GPS_TIMESTAMP = "GPSTimeStamp";
    field public static final java.lang.String TAG_GPS_TRACK = "GPSTrack";
    field public static final java.lang.String TAG_GPS_TRACK_REF = "GPSTrackRef";
    field public static final java.lang.String TAG_GPS_VERSION_ID = "GPSVersionID";
    field public static final java.lang.String TAG_IMAGE_DESCRIPTION = "ImageDescription";
    field public static final java.lang.String TAG_IMAGE_LENGTH = "ImageLength";
    field public static final java.lang.String TAG_IMAGE_UNIQUE_ID = "ImageUniqueID";
    field public static final java.lang.String TAG_IMAGE_WIDTH = "ImageWidth";
    field public static final java.lang.String TAG_INTEROPERABILITY_INDEX = "InteroperabilityIndex";
    field public static final java.lang.String TAG_ISO_SPEED_RATINGS = "ISOSpeedRatings";
    field public static final java.lang.String TAG_JPEG_INTERCHANGE_FORMAT = "JPEGInterchangeFormat";
    field public static final java.lang.String TAG_JPEG_INTERCHANGE_FORMAT_LENGTH = "JPEGInterchangeFormatLength";
    field public static final java.lang.String TAG_LIGHT_SOURCE = "LightSource";
    field public static final java.lang.String TAG_MAKE = "Make";
    field public static final java.lang.String TAG_MAKER_NOTE = "MakerNote";
    field public static final java.lang.String TAG_MAX_APERTURE_VALUE = "MaxApertureValue";
    field public static final java.lang.String TAG_METERING_MODE = "MeteringMode";
    field public static final java.lang.String TAG_MODEL = "Model";
    field public static final java.lang.String TAG_NEW_SUBFILE_TYPE = "NewSubfileType";
    field public static final java.lang.String TAG_OECF = "OECF";
    field public static final java.lang.String TAG_ORF_ASPECT_FRAME = "AspectFrame";
    field public static final java.lang.String TAG_ORF_PREVIEW_IMAGE_LENGTH = "PreviewImageLength";
    field public static final java.lang.String TAG_ORF_PREVIEW_IMAGE_START = "PreviewImageStart";
    field public static final java.lang.String TAG_ORF_THUMBNAIL_IMAGE = "ThumbnailImage";
    field public static final java.lang.String TAG_ORIENTATION = "Orientation";
    field public static final java.lang.String TAG_PHOTOMETRIC_INTERPRETATION = "PhotometricInterpretation";
    field public static final java.lang.String TAG_PIXEL_X_DIMENSION = "PixelXDimension";
    field public static final java.lang.String TAG_PIXEL_Y_DIMENSION = "PixelYDimension";
    field public static final java.lang.String TAG_PLANAR_CONFIGURATION = "PlanarConfiguration";
    field public static final java.lang.String TAG_PRIMARY_CHROMATICITIES = "PrimaryChromaticities";
    field public static final java.lang.String TAG_REFERENCE_BLACK_WHITE = "ReferenceBlackWhite";
    field public static final java.lang.String TAG_RELATED_SOUND_FILE = "RelatedSoundFile";
    field public static final java.lang.String TAG_RESOLUTION_UNIT = "ResolutionUnit";
    field public static final java.lang.String TAG_ROWS_PER_STRIP = "RowsPerStrip";
    field public static final java.lang.String TAG_RW2_ISO = "ISO";
    field public static final java.lang.String TAG_RW2_JPG_FROM_RAW = "JpgFromRaw";
    field public static final java.lang.String TAG_RW2_SENSOR_BOTTOM_BORDER = "SensorBottomBorder";
    field public static final java.lang.String TAG_RW2_SENSOR_LEFT_BORDER = "SensorLeftBorder";
    field public static final java.lang.String TAG_RW2_SENSOR_RIGHT_BORDER = "SensorRightBorder";
    field public static final java.lang.String TAG_RW2_SENSOR_TOP_BORDER = "SensorTopBorder";
    field public static final java.lang.String TAG_SAMPLES_PER_PIXEL = "SamplesPerPixel";
    field public static final java.lang.String TAG_SATURATION = "Saturation";
    field public static final java.lang.String TAG_SCENE_CAPTURE_TYPE = "SceneCaptureType";
    field public static final java.lang.String TAG_SCENE_TYPE = "SceneType";
    field public static final java.lang.String TAG_SENSING_METHOD = "SensingMethod";
    field public static final java.lang.String TAG_SHARPNESS = "Sharpness";
    field public static final java.lang.String TAG_SHUTTER_SPEED_VALUE = "ShutterSpeedValue";
    field public static final java.lang.String TAG_SOFTWARE = "Software";
    field public static final java.lang.String TAG_SPATIAL_FREQUENCY_RESPONSE = "SpatialFrequencyResponse";
    field public static final java.lang.String TAG_SPECTRAL_SENSITIVITY = "SpectralSensitivity";
    field public static final java.lang.String TAG_STRIP_BYTE_COUNTS = "StripByteCounts";
    field public static final java.lang.String TAG_STRIP_OFFSETS = "StripOffsets";
    field public static final java.lang.String TAG_SUBFILE_TYPE = "SubfileType";
    field public static final java.lang.String TAG_SUBJECT_AREA = "SubjectArea";
    field public static final java.lang.String TAG_SUBJECT_DISTANCE = "SubjectDistance";
    field public static final java.lang.String TAG_SUBJECT_DISTANCE_RANGE = "SubjectDistanceRange";
    field public static final java.lang.String TAG_SUBJECT_LOCATION = "SubjectLocation";
    field public static final java.lang.String TAG_SUBSEC_TIME = "SubSecTime";
    field public static final java.lang.String TAG_SUBSEC_TIME_DIGITIZED = "SubSecTimeDigitized";
    field public static final java.lang.String TAG_SUBSEC_TIME_ORIGINAL = "SubSecTimeOriginal";
    field public static final java.lang.String TAG_THUMBNAIL_IMAGE_LENGTH = "ThumbnailImageLength";
    field public static final java.lang.String TAG_THUMBNAIL_IMAGE_WIDTH = "ThumbnailImageWidth";
    field public static final java.lang.String TAG_TRANSFER_FUNCTION = "TransferFunction";
    field public static final java.lang.String TAG_USER_COMMENT = "UserComment";
    field public static final java.lang.String TAG_WHITE_BALANCE = "WhiteBalance";
    field public static final java.lang.String TAG_WHITE_POINT = "WhitePoint";
    field public static final java.lang.String TAG_X_RESOLUTION = "XResolution";
    field public static final java.lang.String TAG_Y_CB_CR_COEFFICIENTS = "YCbCrCoefficients";
    field public static final java.lang.String TAG_Y_CB_CR_POSITIONING = "YCbCrPositioning";
    field public static final java.lang.String TAG_Y_CB_CR_SUB_SAMPLING = "YCbCrSubSampling";
    field public static final java.lang.String TAG_Y_RESOLUTION = "YResolution";
    field public static final int WHITEBALANCE_AUTO = 0; // 0x0
    field public static final int WHITEBALANCE_MANUAL = 1; // 0x1
  }

}

package android.support.media.tv {

  public final class Channel {
    method public static android.support.media.tv.Channel fromCursor(android.database.Cursor);
    method public int getAppLinkColor();
    method public android.net.Uri getAppLinkIconUri();
    method public android.content.Intent getAppLinkIntent() throws java.net.URISyntaxException;
    method public android.net.Uri getAppLinkIntentUri();
    method public android.net.Uri getAppLinkPosterArtUri();
    method public java.lang.String getAppLinkText();
    method public java.lang.String getDescription();
    method public java.lang.String getDisplayName();
    method public java.lang.String getDisplayNumber();
    method public long getId();
    method public java.lang.String getInputId();
    method public byte[] getInternalProviderDataByteArray();
    method public java.lang.Long getInternalProviderFlag1();
    method public java.lang.Long getInternalProviderFlag2();
    method public java.lang.Long getInternalProviderFlag3();
    method public java.lang.Long getInternalProviderFlag4();
    method public java.lang.String getInternalProviderId();
    method public java.lang.String getNetworkAffiliation();
    method public int getOriginalNetworkId();
    method public java.lang.String getPackageName();
    method public int getServiceId();
    method public java.lang.String getServiceType();
    method public int getTransportStreamId();
    method public java.lang.String getType();
    method public java.lang.String getVideoFormat();
    method public boolean isBrowsable();
    method public boolean isLocked();
    method public boolean isSearchable();
    method public boolean isTransient();
    method public android.content.ContentValues toContentValues();
  }

  public static final class Channel.Builder {
    ctor public Channel.Builder();
    ctor public Channel.Builder(android.support.media.tv.Channel);
    method public android.support.media.tv.Channel build();
    method public android.support.media.tv.Channel.Builder setAppLinkColor(int);
    method public android.support.media.tv.Channel.Builder setAppLinkIconUri(android.net.Uri);
    method public android.support.media.tv.Channel.Builder setAppLinkIntent(android.content.Intent);
    method public android.support.media.tv.Channel.Builder setAppLinkIntentUri(android.net.Uri);
    method public android.support.media.tv.Channel.Builder setAppLinkPosterArtUri(android.net.Uri);
    method public android.support.media.tv.Channel.Builder setAppLinkText(java.lang.String);
    method public android.support.media.tv.Channel.Builder setDescription(java.lang.String);
    method public android.support.media.tv.Channel.Builder setDisplayName(java.lang.String);
    method public android.support.media.tv.Channel.Builder setDisplayNumber(java.lang.String);
    method public android.support.media.tv.Channel.Builder setInputId(java.lang.String);
    method public android.support.media.tv.Channel.Builder setInternalProviderData(byte[]);
    method public android.support.media.tv.Channel.Builder setInternalProviderData(java.lang.String);
    method public android.support.media.tv.Channel.Builder setInternalProviderFlag1(long);
    method public android.support.media.tv.Channel.Builder setInternalProviderFlag2(long);
    method public android.support.media.tv.Channel.Builder setInternalProviderFlag3(long);
    method public android.support.media.tv.Channel.Builder setInternalProviderFlag4(long);
    method public android.support.media.tv.Channel.Builder setInternalProviderId(java.lang.String);
    method public android.support.media.tv.Channel.Builder setNetworkAffiliation(java.lang.String);
    method public android.support.media.tv.Channel.Builder setOriginalNetworkId(int);
    method public android.support.media.tv.Channel.Builder setSearchable(boolean);
    method public android.support.media.tv.Channel.Builder setServiceId(int);
    method public android.support.media.tv.Channel.Builder setServiceType(java.lang.String);
    method public android.support.media.tv.Channel.Builder setTransient(boolean);
    method public android.support.media.tv.Channel.Builder setTransportStreamId(int);
    method public android.support.media.tv.Channel.Builder setType(java.lang.String);
    method public android.support.media.tv.Channel.Builder setVideoFormat(java.lang.String);
  }

  public class ChannelLogoUtils {
    ctor public ChannelLogoUtils();
    method public static android.graphics.Bitmap loadChannelLogo(android.content.Context, long);
    method public static boolean storeChannelLogo(android.content.Context, long, android.net.Uri);
    method public static boolean storeChannelLogo(android.content.Context, long, android.graphics.Bitmap);
  }

  public final class PreviewProgram {
    method public boolean equals(java.lang.Object);
    method public static android.support.media.tv.PreviewProgram fromCursor(android.database.Cursor);
    method public long getChannelId();
    method public int getWeight();
    method public android.content.ContentValues toContentValues();
    method public java.lang.String toString();
  }

  public static final class PreviewProgram.Builder {
    ctor public PreviewProgram.Builder();
    ctor public PreviewProgram.Builder(android.support.media.tv.PreviewProgram);
    method public android.support.media.tv.PreviewProgram build();
    method public android.support.media.tv.PreviewProgram.Builder setChannelId(long);
    method public android.support.media.tv.PreviewProgram.Builder setWeight(int);
  }

  public final class Program implements java.lang.Comparable {
    method public int compareTo(android.support.media.tv.Program);
    method public boolean equals(java.lang.Object);
    method public static android.support.media.tv.Program fromCursor(android.database.Cursor);
    method public java.lang.String[] getBroadcastGenres();
    method public long getChannelId();
    method public long getEndTimeUtcMillis();
    method public long getStartTimeUtcMillis();
    method public int hashCode();
    method public boolean isRecordingProhibited();
    method public android.content.ContentValues toContentValues();
    method public java.lang.String toString();
  }

  public static class Program.Builder {
    ctor public Program.Builder();
    ctor public Program.Builder(android.support.media.tv.Program);
    method public android.support.media.tv.Program build();
    method public android.support.media.tv.Program.Builder setBroadcastGenres(java.lang.String[]);
    method public android.support.media.tv.Program.Builder setChannelId(long);
    method public android.support.media.tv.Program.Builder setEndTimeUtcMillis(long);
    method public android.support.media.tv.Program.Builder setRecordingProhibited(boolean);
    method public android.support.media.tv.Program.Builder setStartTimeUtcMillis(long);
  }

  public final class TvContractCompat {
    method public static android.net.Uri buildChannelLogoUri(long);
    method public static android.net.Uri buildChannelLogoUri(android.net.Uri);
    method public static android.net.Uri buildChannelUri(long);
    method public static android.net.Uri buildChannelUriForPassthroughInput(java.lang.String);
    method public static android.net.Uri buildChannelsUriForInput(java.lang.String);
    method public static java.lang.String buildInputId(android.content.ComponentName);
    method public static android.net.Uri buildPreviewProgramUri(long);
    method public static android.net.Uri buildPreviewProgramsUriForChannel(long);
    method public static android.net.Uri buildPreviewProgramsUriForChannel(android.net.Uri);
    method public static android.net.Uri buildProgramUri(long);
    method public static android.net.Uri buildProgramsUriForChannel(long);
    method public static android.net.Uri buildProgramsUriForChannel(android.net.Uri);
    method public static android.net.Uri buildProgramsUriForChannel(long, long, long);
    method public static android.net.Uri buildProgramsUriForChannel(android.net.Uri, long, long);
    method public static android.net.Uri buildRecordedProgramUri(long);
    method public static android.net.Uri buildWatchNextProgramUri(long);
    method public static boolean isChannelUri(android.net.Uri);
    method public static boolean isChannelUriForPassthroughInput(android.net.Uri);
    method public static boolean isChannelUriForTunerInput(android.net.Uri);
    method public static boolean isProgramUri(android.net.Uri);
    method public static boolean isRecordedProgramUri(android.net.Uri);
    method public static void requestChannelBrowsable(android.content.Context, long);
    field public static final java.lang.String ACTION_INITIALIZE_PROGRAMS = "android.media.tv.action.INITIALIZE_PROGRAMS";
    field public static final java.lang.String ACTION_PREVIEW_PROGRAM_ADDED_TO_WATCH_NEXT = "android.media.tv.action.PREVIEW_PROGRAM_ADDED_TO_WATCH_NEXT";
    field public static final java.lang.String ACTION_PREVIEW_PROGRAM_BROWSABLE_DISABLED = "android.media.tv.action.PREVIEW_PROGRAM_BROWSABLE_DISABLED";
    field public static final java.lang.String ACTION_REQUEST_CHANNEL_BROWSABLE = "android.media.tv.action.REQUEST_CHANNEL_BROWSABLE";
    field public static final java.lang.String ACTION_WATCH_NEXT_PROGRAM_BROWSABLE_DISABLED = "android.media.tv.action.WATCH_NEXT_PROGRAM_BROWSABLE_DISABLED";
    field public static final java.lang.String AUTHORITY = "android.media.tv";
    field public static final java.lang.String EXTRA_CHANNEL_ID = "android.media.tv.extra.CHANNEL_ID";
    field public static final java.lang.String EXTRA_PREVIEW_PROGRAM_ID = "android.media.tv.extra.PREVIEW_PROGRAM_ID";
    field public static final java.lang.String EXTRA_WATCH_NEXT_PROGRAM_ID = "android.media.tv.extra.WATCH_NEXT_PROGRAM_ID";
  }

  public static abstract interface TvContractCompat.BaseTvColumns {
    field public static final java.lang.String COLUMN_PACKAGE_NAME = "package_name";
  }

  public static final class TvContractCompat.Channels implements android.support.media.tv.TvContractCompat.BaseTvColumns {
    method public static java.lang.String getVideoResolution(java.lang.String);
    field public static final java.lang.String COLUMN_APP_LINK_COLOR = "app_link_color";
    field public static final java.lang.String COLUMN_APP_LINK_ICON_URI = "app_link_icon_uri";
    field public static final java.lang.String COLUMN_APP_LINK_INTENT_URI = "app_link_intent_uri";
    field public static final java.lang.String COLUMN_APP_LINK_POSTER_ART_URI = "app_link_poster_art_uri";
    field public static final java.lang.String COLUMN_APP_LINK_TEXT = "app_link_text";
    field public static final java.lang.String COLUMN_BROWSABLE = "browsable";
    field public static final java.lang.String COLUMN_DESCRIPTION = "description";
    field public static final java.lang.String COLUMN_DISPLAY_NAME = "display_name";
    field public static final java.lang.String COLUMN_DISPLAY_NUMBER = "display_number";
    field public static final java.lang.String COLUMN_INPUT_ID = "input_id";
    field public static final java.lang.String COLUMN_INTERNAL_PROVIDER_DATA = "internal_provider_data";
    field public static final java.lang.String COLUMN_INTERNAL_PROVIDER_FLAG1 = "internal_provider_flag1";
    field public static final java.lang.String COLUMN_INTERNAL_PROVIDER_FLAG2 = "internal_provider_flag2";
    field public static final java.lang.String COLUMN_INTERNAL_PROVIDER_FLAG3 = "internal_provider_flag3";
    field public static final java.lang.String COLUMN_INTERNAL_PROVIDER_FLAG4 = "internal_provider_flag4";
    field public static final java.lang.String COLUMN_INTERNAL_PROVIDER_ID = "internal_provider_id";
    field public static final java.lang.String COLUMN_LOCKED = "locked";
    field public static final java.lang.String COLUMN_NETWORK_AFFILIATION = "network_affiliation";
    field public static final java.lang.String COLUMN_ORIGINAL_NETWORK_ID = "original_network_id";
    field public static final java.lang.String COLUMN_SEARCHABLE = "searchable";
    field public static final java.lang.String COLUMN_SERVICE_ID = "service_id";
    field public static final java.lang.String COLUMN_SERVICE_TYPE = "service_type";
    field public static final java.lang.String COLUMN_TRANSIENT = "transient";
    field public static final java.lang.String COLUMN_TRANSPORT_STREAM_ID = "transport_stream_id";
    field public static final java.lang.String COLUMN_TYPE = "type";
    field public static final java.lang.String COLUMN_VERSION_NUMBER = "version_number";
    field public static final java.lang.String COLUMN_VIDEO_FORMAT = "video_format";
    field public static final java.lang.String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/channel";
    field public static final java.lang.String CONTENT_TYPE = "vnd.android.cursor.dir/channel";
    field public static final android.net.Uri CONTENT_URI;
    field public static final java.lang.String SERVICE_TYPE_AUDIO = "SERVICE_TYPE_AUDIO";
    field public static final java.lang.String SERVICE_TYPE_AUDIO_VIDEO = "SERVICE_TYPE_AUDIO_VIDEO";
    field public static final java.lang.String SERVICE_TYPE_OTHER = "SERVICE_TYPE_OTHER";
    field public static final java.lang.String TYPE_1SEG = "TYPE_1SEG";
    field public static final java.lang.String TYPE_ATSC_C = "TYPE_ATSC_C";
    field public static final java.lang.String TYPE_ATSC_M_H = "TYPE_ATSC_M_H";
    field public static final java.lang.String TYPE_ATSC_T = "TYPE_ATSC_T";
    field public static final java.lang.String TYPE_CMMB = "TYPE_CMMB";
    field public static final java.lang.String TYPE_DTMB = "TYPE_DTMB";
    field public static final java.lang.String TYPE_DVB_C = "TYPE_DVB_C";
    field public static final java.lang.String TYPE_DVB_C2 = "TYPE_DVB_C2";
    field public static final java.lang.String TYPE_DVB_H = "TYPE_DVB_H";
    field public static final java.lang.String TYPE_DVB_S = "TYPE_DVB_S";
    field public static final java.lang.String TYPE_DVB_S2 = "TYPE_DVB_S2";
    field public static final java.lang.String TYPE_DVB_SH = "TYPE_DVB_SH";
    field public static final java.lang.String TYPE_DVB_T = "TYPE_DVB_T";
    field public static final java.lang.String TYPE_DVB_T2 = "TYPE_DVB_T2";
    field public static final java.lang.String TYPE_ISDB_C = "TYPE_ISDB_C";
    field public static final java.lang.String TYPE_ISDB_S = "TYPE_ISDB_S";
    field public static final java.lang.String TYPE_ISDB_T = "TYPE_ISDB_T";
    field public static final java.lang.String TYPE_ISDB_TB = "TYPE_ISDB_TB";
    field public static final java.lang.String TYPE_NTSC = "TYPE_NTSC";
    field public static final java.lang.String TYPE_OTHER = "TYPE_OTHER";
    field public static final java.lang.String TYPE_PAL = "TYPE_PAL";
    field public static final java.lang.String TYPE_PREVIEW = "TYPE_PREVIEW";
    field public static final java.lang.String TYPE_SECAM = "TYPE_SECAM";
    field public static final java.lang.String TYPE_S_DMB = "TYPE_S_DMB";
    field public static final java.lang.String TYPE_T_DMB = "TYPE_T_DMB";
    field public static final java.lang.String VIDEO_FORMAT_1080I = "VIDEO_FORMAT_1080I";
    field public static final java.lang.String VIDEO_FORMAT_1080P = "VIDEO_FORMAT_1080P";
    field public static final java.lang.String VIDEO_FORMAT_2160P = "VIDEO_FORMAT_2160P";
    field public static final java.lang.String VIDEO_FORMAT_240P = "VIDEO_FORMAT_240P";
    field public static final java.lang.String VIDEO_FORMAT_360P = "VIDEO_FORMAT_360P";
    field public static final java.lang.String VIDEO_FORMAT_4320P = "VIDEO_FORMAT_4320P";
    field public static final java.lang.String VIDEO_FORMAT_480I = "VIDEO_FORMAT_480I";
    field public static final java.lang.String VIDEO_FORMAT_480P = "VIDEO_FORMAT_480P";
    field public static final java.lang.String VIDEO_FORMAT_576I = "VIDEO_FORMAT_576I";
    field public static final java.lang.String VIDEO_FORMAT_576P = "VIDEO_FORMAT_576P";
    field public static final java.lang.String VIDEO_FORMAT_720P = "VIDEO_FORMAT_720P";
    field public static final java.lang.String VIDEO_RESOLUTION_ED = "VIDEO_RESOLUTION_ED";
    field public static final java.lang.String VIDEO_RESOLUTION_FHD = "VIDEO_RESOLUTION_FHD";
    field public static final java.lang.String VIDEO_RESOLUTION_HD = "VIDEO_RESOLUTION_HD";
    field public static final java.lang.String VIDEO_RESOLUTION_SD = "VIDEO_RESOLUTION_SD";
    field public static final java.lang.String VIDEO_RESOLUTION_UHD = "VIDEO_RESOLUTION_UHD";
  }

  public static final class TvContractCompat.Channels.Logo {
    field public static final java.lang.String CONTENT_DIRECTORY = "logo";
  }

  public static final class TvContractCompat.PreviewPrograms implements android.support.media.tv.TvContractCompat.BaseTvColumns {
    field public static final int ASPECT_RATIO_16_9 = 0; // 0x0
    field public static final int ASPECT_RATIO_1_1 = 3; // 0x3
    field public static final int ASPECT_RATIO_2_3 = 4; // 0x4
    field public static final int ASPECT_RATIO_3_2 = 1; // 0x1
    field public static final int ASPECT_RATIO_4_3 = 2; // 0x2
    field public static final int AVAILABILITY_AVAILABLE = 0; // 0x0
    field public static final int AVAILABILITY_FREE_WITH_SUBSCRIPTION = 1; // 0x1
    field public static final int AVAILABILITY_PAID_CONTENT = 2; // 0x2
    field public static final java.lang.String COLUMN_AUDIO_LANGUAGE = "audio_language";
    field public static final java.lang.String COLUMN_AUTHOR = "author";
    field public static final java.lang.String COLUMN_AVAILABILITY = "availability";
    field public static final java.lang.String COLUMN_BROWSABLE = "browsable";
    field public static final java.lang.String COLUMN_CANONICAL_GENRE = "canonical_genre";
    field public static final java.lang.String COLUMN_CHANNEL_ID = "channel_id";
    field public static final java.lang.String COLUMN_CONTENT_ID = "content_id";
    field public static final java.lang.String COLUMN_CONTENT_RATING = "content_rating";
    field public static final java.lang.String COLUMN_DURATION_MILLIS = "duration_millis";
    field public static final java.lang.String COLUMN_EPISODE_DISPLAY_NUMBER = "episode_display_number";
    field public static final java.lang.String COLUMN_EPISODE_TITLE = "episode_title";
    field public static final java.lang.String COLUMN_INTENT_URI = "intent_uri";
    field public static final java.lang.String COLUMN_INTERACTION_COUNT = "interaction_count";
    field public static final java.lang.String COLUMN_INTERACTION_TYPE = "interaction_type";
    field public static final java.lang.String COLUMN_INTERNAL_PROVIDER_DATA = "internal_provider_data";
    field public static final java.lang.String COLUMN_INTERNAL_PROVIDER_FLAG1 = "internal_provider_flag1";
    field public static final java.lang.String COLUMN_INTERNAL_PROVIDER_FLAG2 = "internal_provider_flag2";
    field public static final java.lang.String COLUMN_INTERNAL_PROVIDER_FLAG3 = "internal_provider_flag3";
    field public static final java.lang.String COLUMN_INTERNAL_PROVIDER_FLAG4 = "internal_provider_flag4";
    field public static final java.lang.String COLUMN_INTERNAL_PROVIDER_ID = "internal_provider_id";
    field public static final java.lang.String COLUMN_ITEM_COUNT = "item_count";
    field public static final java.lang.String COLUMN_LAST_PLAYBACK_POSITION_MILLIS = "last_playback_position_millis";
    field public static final java.lang.String COLUMN_LIVE = "live";
    field public static final java.lang.String COLUMN_LOGO_URI = "logo_uri";
    field public static final java.lang.String COLUMN_LONG_DESCRIPTION = "long_description";
    field public static final java.lang.String COLUMN_OFFER_PRICE = "offer_price";
    field public static final java.lang.String COLUMN_POSTER_ART_ASPECT_RATIO = "poster_art_aspect_ratio";
    field public static final java.lang.String COLUMN_POSTER_ART_URI = "poster_art_uri";
    field public static final java.lang.String COLUMN_PREVIEW_VIDEO_URI = "preview_video_uri";
    field public static final java.lang.String COLUMN_RELEASE_DATE = "release_date";
    field public static final java.lang.String COLUMN_REVIEW_RATING = "review_rating";
    field public static final java.lang.String COLUMN_REVIEW_RATING_STYLE = "review_rating_style";
    field public static final java.lang.String COLUMN_SEARCHABLE = "searchable";
    field public static final java.lang.String COLUMN_SEASON_DISPLAY_NUMBER = "season_display_number";
    field public static final java.lang.String COLUMN_SEASON_TITLE = "season_title";
    field public static final java.lang.String COLUMN_SHORT_DESCRIPTION = "short_description";
    field public static final java.lang.String COLUMN_STARTING_PRICE = "starting_price";
    field public static final java.lang.String COLUMN_THUMBNAIL_ASPECT_RATIO = "poster_thumbnail_aspect_ratio";
    field public static final java.lang.String COLUMN_THUMBNAIL_URI = "thumbnail_uri";
    field public static final java.lang.String COLUMN_TITLE = "title";
    field public static final java.lang.String COLUMN_TRANSIENT = "transient";
    field public static final java.lang.String COLUMN_TYPE = "type";
    field public static final java.lang.String COLUMN_VERSION_NUMBER = "version_number";
    field public static final java.lang.String COLUMN_VIDEO_HEIGHT = "video_height";
    field public static final java.lang.String COLUMN_VIDEO_WIDTH = "video_width";
    field public static final java.lang.String COLUMN_WEIGHT = "weight";
    field public static final java.lang.String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/preview_program";
    field public static final java.lang.String CONTENT_TYPE = "vnd.android.cursor.dir/preview_program";
    field public static final android.net.Uri CONTENT_URI;
    field public static final int INTERACTION_TYPE_FANS = 3; // 0x3
    field public static final int INTERACTION_TYPE_FOLLOWERS = 2; // 0x2
    field public static final int INTERACTION_TYPE_LIKES = 4; // 0x4
    field public static final int INTERACTION_TYPE_LISTENS = 1; // 0x1
    field public static final int INTERACTION_TYPE_THUMBS = 5; // 0x5
    field public static final int INTERACTION_TYPE_VIEWERS = 6; // 0x6
    field public static final int INTERACTION_TYPE_VIEWS = 0; // 0x0
    field public static final int REVIEW_RATING_STYLE_PERCENTAGE = 2; // 0x2
    field public static final int REVIEW_RATING_STYLE_STARS = 0; // 0x0
    field public static final int REVIEW_RATING_STYLE_THUMBS_UP_DOWN = 1; // 0x1
    field public static final int TYPE_ALBUM = 8; // 0x8
    field public static final int TYPE_ARTIST = 9; // 0x9
    field public static final int TYPE_CHANNEL = 6; // 0x6
    field public static final int TYPE_CLIP = 4; // 0x4
    field public static final int TYPE_EVENT = 5; // 0x5
    field public static final int TYPE_MOVIE = 0; // 0x0
    field public static final int TYPE_PLAYLIST = 10; // 0xa
    field public static final int TYPE_STATION = 11; // 0xb
    field public static final int TYPE_TRACK = 7; // 0x7
    field public static final int TYPE_TV_EPISODE = 3; // 0x3
    field public static final int TYPE_TV_SEASON = 2; // 0x2
    field public static final int TYPE_TV_SERIES = 1; // 0x1
  }

  public static final class TvContractCompat.Programs implements android.support.media.tv.TvContractCompat.BaseTvColumns {
    field public static final java.lang.String COLUMN_AUDIO_LANGUAGE = "audio_language";
    field public static final java.lang.String COLUMN_BROADCAST_GENRE = "broadcast_genre";
    field public static final java.lang.String COLUMN_CANONICAL_GENRE = "canonical_genre";
    field public static final java.lang.String COLUMN_CHANNEL_ID = "channel_id";
    field public static final java.lang.String COLUMN_CONTENT_RATING = "content_rating";
    field public static final java.lang.String COLUMN_END_TIME_UTC_MILLIS = "end_time_utc_millis";
    field public static final java.lang.String COLUMN_EPISODE_DISPLAY_NUMBER = "episode_display_number";
    field public static final deprecated java.lang.String COLUMN_EPISODE_NUMBER = "episode_number";
    field public static final java.lang.String COLUMN_EPISODE_TITLE = "episode_title";
    field public static final java.lang.String COLUMN_INTERNAL_PROVIDER_DATA = "internal_provider_data";
    field public static final java.lang.String COLUMN_INTERNAL_PROVIDER_FLAG1 = "internal_provider_flag1";
    field public static final java.lang.String COLUMN_INTERNAL_PROVIDER_FLAG2 = "internal_provider_flag2";
    field public static final java.lang.String COLUMN_INTERNAL_PROVIDER_FLAG3 = "internal_provider_flag3";
    field public static final java.lang.String COLUMN_INTERNAL_PROVIDER_FLAG4 = "internal_provider_flag4";
    field public static final java.lang.String COLUMN_LONG_DESCRIPTION = "long_description";
    field public static final java.lang.String COLUMN_POSTER_ART_URI = "poster_art_uri";
    field public static final java.lang.String COLUMN_RECORDING_PROHIBITED = "recording_prohibited";
    field public static final java.lang.String COLUMN_REVIEW_RATING = "review_rating";
    field public static final java.lang.String COLUMN_REVIEW_RATING_STYLE = "review_rating_style";
    field public static final java.lang.String COLUMN_SEARCHABLE = "searchable";
    field public static final java.lang.String COLUMN_SEASON_DISPLAY_NUMBER = "season_display_number";
    field public static final deprecated java.lang.String COLUMN_SEASON_NUMBER = "season_number";
    field public static final java.lang.String COLUMN_SEASON_TITLE = "season_title";
    field public static final java.lang.String COLUMN_SHORT_DESCRIPTION = "short_description";
    field public static final java.lang.String COLUMN_START_TIME_UTC_MILLIS = "start_time_utc_millis";
    field public static final java.lang.String COLUMN_THUMBNAIL_URI = "thumbnail_uri";
    field public static final java.lang.String COLUMN_TITLE = "title";
    field public static final java.lang.String COLUMN_VERSION_NUMBER = "version_number";
    field public static final java.lang.String COLUMN_VIDEO_HEIGHT = "video_height";
    field public static final java.lang.String COLUMN_VIDEO_WIDTH = "video_width";
    field public static final java.lang.String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/program";
    field public static final java.lang.String CONTENT_TYPE = "vnd.android.cursor.dir/program";
    field public static final android.net.Uri CONTENT_URI;
    field public static final int REVIEW_RATING_STYLE_PERCENTAGE = 2; // 0x2
    field public static final int REVIEW_RATING_STYLE_STARS = 0; // 0x0
    field public static final int REVIEW_RATING_STYLE_THUMBS_UP_DOWN = 1; // 0x1
  }

  public static final class TvContractCompat.Programs.Genres {
    method public static java.lang.String[] decode(java.lang.String);
    method public static java.lang.String encode(java.lang.String...);
    method public static boolean isCanonical(java.lang.String);
    field public static final java.lang.String ANIMAL_WILDLIFE = "ANIMAL_WILDLIFE";
    field public static final java.lang.String ARTS = "ARTS";
    field public static final java.lang.String COMEDY = "COMEDY";
    field public static final java.lang.String DRAMA = "DRAMA";
    field public static final java.lang.String EDUCATION = "EDUCATION";
    field public static final java.lang.String ENTERTAINMENT = "ENTERTAINMENT";
    field public static final java.lang.String FAMILY_KIDS = "FAMILY_KIDS";
    field public static final java.lang.String GAMING = "GAMING";
    field public static final java.lang.String LIFE_STYLE = "LIFE_STYLE";
    field public static final java.lang.String MOVIES = "MOVIES";
    field public static final java.lang.String MUSIC = "MUSIC";
    field public static final java.lang.String NEWS = "NEWS";
    field public static final java.lang.String PREMIER = "PREMIER";
    field public static final java.lang.String SHOPPING = "SHOPPING";
    field public static final java.lang.String SPORTS = "SPORTS";
    field public static final java.lang.String TECH_SCIENCE = "TECH_SCIENCE";
    field public static final java.lang.String TRAVEL = "TRAVEL";
  }

  public static final class TvContractCompat.RecordedPrograms implements android.support.media.tv.TvContractCompat.BaseTvColumns {
    field public static final java.lang.String COLUMN_AUDIO_LANGUAGE = "audio_language";
    field public static final java.lang.String COLUMN_BROADCAST_GENRE = "broadcast_genre";
    field public static final java.lang.String COLUMN_CANONICAL_GENRE = "canonical_genre";
    field public static final java.lang.String COLUMN_CHANNEL_ID = "channel_id";
    field public static final java.lang.String COLUMN_CONTENT_RATING = "content_rating";
    field public static final java.lang.String COLUMN_END_TIME_UTC_MILLIS = "end_time_utc_millis";
    field public static final java.lang.String COLUMN_EPISODE_DISPLAY_NUMBER = "episode_display_number";
    field public static final java.lang.String COLUMN_EPISODE_TITLE = "episode_title";
    field public static final java.lang.String COLUMN_INPUT_ID = "input_id";
    field public static final java.lang.String COLUMN_INTERNAL_PROVIDER_DATA = "internal_provider_data";
    field public static final java.lang.String COLUMN_INTERNAL_PROVIDER_FLAG1 = "internal_provider_flag1";
    field public static final java.lang.String COLUMN_INTERNAL_PROVIDER_FLAG2 = "internal_provider_flag2";
    field public static final java.lang.String COLUMN_INTERNAL_PROVIDER_FLAG3 = "internal_provider_flag3";
    field public static final java.lang.String COLUMN_INTERNAL_PROVIDER_FLAG4 = "internal_provider_flag4";
    field public static final java.lang.String COLUMN_LONG_DESCRIPTION = "long_description";
    field public static final java.lang.String COLUMN_POSTER_ART_URI = "poster_art_uri";
    field public static final java.lang.String COLUMN_RECORDING_DATA_BYTES = "recording_data_bytes";
    field public static final java.lang.String COLUMN_RECORDING_DATA_URI = "recording_data_uri";
    field public static final java.lang.String COLUMN_RECORDING_DURATION_MILLIS = "recording_duration_millis";
    field public static final java.lang.String COLUMN_RECORDING_EXPIRE_TIME_UTC_MILLIS = "recording_expire_time_utc_millis";
    field public static final java.lang.String COLUMN_REVIEW_RATING = "review_rating";
    field public static final java.lang.String COLUMN_REVIEW_RATING_STYLE = "review_rating_style";
    field public static final java.lang.String COLUMN_SEARCHABLE = "searchable";
    field public static final java.lang.String COLUMN_SEASON_DISPLAY_NUMBER = "season_display_number";
    field public static final java.lang.String COLUMN_SEASON_TITLE = "season_title";
    field public static final java.lang.String COLUMN_SHORT_DESCRIPTION = "short_description";
    field public static final java.lang.String COLUMN_START_TIME_UTC_MILLIS = "start_time_utc_millis";
    field public static final java.lang.String COLUMN_THUMBNAIL_URI = "thumbnail_uri";
    field public static final java.lang.String COLUMN_TITLE = "title";
    field public static final java.lang.String COLUMN_VERSION_NUMBER = "version_number";
    field public static final java.lang.String COLUMN_VIDEO_HEIGHT = "video_height";
    field public static final java.lang.String COLUMN_VIDEO_WIDTH = "video_width";
    field public static final java.lang.String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/recorded_program";
    field public static final java.lang.String CONTENT_TYPE = "vnd.android.cursor.dir/recorded_program";
    field public static final android.net.Uri CONTENT_URI;
    field public static final int REVIEW_RATING_STYLE_PERCENTAGE = 2; // 0x2
    field public static final int REVIEW_RATING_STYLE_STARS = 0; // 0x0
    field public static final int REVIEW_RATING_STYLE_THUMBS_UP_DOWN = 1; // 0x1
  }

  public static final class TvContractCompat.WatchNextPrograms implements android.support.media.tv.TvContractCompat.BaseTvColumns {
    field public static final int ASPECT_RATIO_16_9 = 0; // 0x0
    field public static final int ASPECT_RATIO_1_1 = 3; // 0x3
    field public static final int ASPECT_RATIO_2_3 = 4; // 0x4
    field public static final int ASPECT_RATIO_3_2 = 1; // 0x1
    field public static final int ASPECT_RATIO_4_3 = 2; // 0x2
    field public static final int AVAILABILITY_AVAILABLE = 0; // 0x0
    field public static final int AVAILABILITY_FREE_WITH_SUBSCRIPTION = 1; // 0x1
    field public static final int AVAILABILITY_PAID_CONTENT = 2; // 0x2
    field public static final java.lang.String COLUMN_AUDIO_LANGUAGE = "audio_language";
    field public static final java.lang.String COLUMN_AUTHOR = "author";
    field public static final java.lang.String COLUMN_AVAILABILITY = "availability";
    field public static final java.lang.String COLUMN_BROWSABLE = "browsable";
    field public static final java.lang.String COLUMN_CANONICAL_GENRE = "canonical_genre";
    field public static final java.lang.String COLUMN_CONTENT_ID = "content_id";
    field public static final java.lang.String COLUMN_CONTENT_RATING = "content_rating";
    field public static final java.lang.String COLUMN_DURATION_MILLIS = "duration_millis";
    field public static final java.lang.String COLUMN_EPISODE_DISPLAY_NUMBER = "episode_display_number";
    field public static final java.lang.String COLUMN_EPISODE_TITLE = "episode_title";
    field public static final java.lang.String COLUMN_INTENT_URI = "intent_uri";
    field public static final java.lang.String COLUMN_INTERACTION_COUNT = "interaction_count";
    field public static final java.lang.String COLUMN_INTERACTION_TYPE = "interaction_type";
    field public static final java.lang.String COLUMN_INTERNAL_PROVIDER_DATA = "internal_provider_data";
    field public static final java.lang.String COLUMN_INTERNAL_PROVIDER_FLAG1 = "internal_provider_flag1";
    field public static final java.lang.String COLUMN_INTERNAL_PROVIDER_FLAG2 = "internal_provider_flag2";
    field public static final java.lang.String COLUMN_INTERNAL_PROVIDER_FLAG3 = "internal_provider_flag3";
    field public static final java.lang.String COLUMN_INTERNAL_PROVIDER_FLAG4 = "internal_provider_flag4";
    field public static final java.lang.String COLUMN_INTERNAL_PROVIDER_ID = "internal_provider_id";
    field public static final java.lang.String COLUMN_ITEM_COUNT = "item_count";
    field public static final java.lang.String COLUMN_LAST_ENGAGEMENT_TIME_UTC_MILLIS = "last_engagement_time_utc_millis";
    field public static final java.lang.String COLUMN_LAST_PLAYBACK_POSITION_MILLIS = "last_playback_position_millis";
    field public static final java.lang.String COLUMN_LIVE = "live";
    field public static final java.lang.String COLUMN_LOGO_URI = "logo_uri";
    field public static final java.lang.String COLUMN_LONG_DESCRIPTION = "long_description";
    field public static final java.lang.String COLUMN_OFFER_PRICE = "offer_price";
    field public static final java.lang.String COLUMN_POSTER_ART_ASPECT_RATIO = "poster_art_aspect_ratio";
    field public static final java.lang.String COLUMN_POSTER_ART_URI = "poster_art_uri";
    field public static final java.lang.String COLUMN_PREVIEW_VIDEO_URI = "preview_video_uri";
    field public static final java.lang.String COLUMN_RELEASE_DATE = "release_date";
    field public static final java.lang.String COLUMN_REVIEW_RATING = "review_rating";
    field public static final java.lang.String COLUMN_REVIEW_RATING_STYLE = "review_rating_style";
    field public static final java.lang.String COLUMN_SEARCHABLE = "searchable";
    field public static final java.lang.String COLUMN_SEASON_DISPLAY_NUMBER = "season_display_number";
    field public static final java.lang.String COLUMN_SEASON_TITLE = "season_title";
    field public static final java.lang.String COLUMN_SHORT_DESCRIPTION = "short_description";
    field public static final java.lang.String COLUMN_STARTING_PRICE = "starting_price";
    field public static final java.lang.String COLUMN_THUMBNAIL_ASPECT_RATIO = "poster_thumbnail_aspect_ratio";
    field public static final java.lang.String COLUMN_THUMBNAIL_URI = "thumbnail_uri";
    field public static final java.lang.String COLUMN_TITLE = "title";
    field public static final java.lang.String COLUMN_TRANSIENT = "transient";
    field public static final java.lang.String COLUMN_TYPE = "type";
    field public static final java.lang.String COLUMN_VERSION_NUMBER = "version_number";
    field public static final java.lang.String COLUMN_VIDEO_HEIGHT = "video_height";
    field public static final java.lang.String COLUMN_VIDEO_WIDTH = "video_width";
    field public static final java.lang.String COLUMN_WATCH_NEXT_TYPE = "watch_next_type";
    field public static final java.lang.String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/watch_next_program";
    field public static final java.lang.String CONTENT_TYPE = "vnd.android.cursor.dir/watch_next_program";
    field public static final android.net.Uri CONTENT_URI;
    field public static final int INTERACTION_TYPE_FANS = 3; // 0x3
    field public static final int INTERACTION_TYPE_FOLLOWERS = 2; // 0x2
    field public static final int INTERACTION_TYPE_LIKES = 4; // 0x4
    field public static final int INTERACTION_TYPE_LISTENS = 1; // 0x1
    field public static final int INTERACTION_TYPE_THUMBS = 5; // 0x5
    field public static final int INTERACTION_TYPE_VIEWERS = 6; // 0x6
    field public static final int INTERACTION_TYPE_VIEWS = 0; // 0x0
    field public static final int REVIEW_RATING_STYLE_PERCENTAGE = 2; // 0x2
    field public static final int REVIEW_RATING_STYLE_STARS = 0; // 0x0
    field public static final int REVIEW_RATING_STYLE_THUMBS_UP_DOWN = 1; // 0x1
    field public static final int TYPE_ALBUM = 8; // 0x8
    field public static final int TYPE_ARTIST = 9; // 0x9
    field public static final int TYPE_CHANNEL = 6; // 0x6
    field public static final int TYPE_CLIP = 4; // 0x4
    field public static final int TYPE_EVENT = 5; // 0x5
    field public static final int TYPE_MOVIE = 0; // 0x0
    field public static final int TYPE_PLAYLIST = 10; // 0xa
    field public static final int TYPE_STATION = 11; // 0xb
    field public static final int TYPE_TRACK = 7; // 0x7
    field public static final int TYPE_TV_EPISODE = 3; // 0x3
    field public static final int TYPE_TV_SEASON = 2; // 0x2
    field public static final int TYPE_TV_SERIES = 1; // 0x1
    field public static final int WATCH_NEXT_TYPE_CONTINUE = 0; // 0x0
    field public static final int WATCH_NEXT_TYPE_NEW = 2; // 0x2
    field public static final int WATCH_NEXT_TYPE_NEXT = 1; // 0x1
    field public static final int WATCH_NEXT_TYPE_WATCHLIST = 3; // 0x3
  }

  public final class WatchNextProgram {
    method public boolean equals(java.lang.Object);
    method public static android.support.media.tv.WatchNextProgram fromCursor(android.database.Cursor);
    method public long getLastEngagementTimeUtcMillis();
    method public int getWatchNextType();
    method public android.content.ContentValues toContentValues();
    method public java.lang.String toString();
  }

  public static final class WatchNextProgram.Builder {
    ctor public WatchNextProgram.Builder();
    ctor public WatchNextProgram.Builder(android.support.media.tv.WatchNextProgram);
    method public android.support.media.tv.WatchNextProgram build();
    method public android.support.media.tv.WatchNextProgram.Builder setLastEngagementTimeUtcMillis(long);
    method public android.support.media.tv.WatchNextProgram.Builder setWatchNextType(int);
  }

}

package android.support.percent {

  public deprecated class PercentFrameLayout extends android.widget.FrameLayout {
    ctor public PercentFrameLayout(android.content.Context);
    ctor public PercentFrameLayout(android.content.Context, android.util.AttributeSet);
    ctor public PercentFrameLayout(android.content.Context, android.util.AttributeSet, int);
    method protected android.support.percent.PercentFrameLayout.LayoutParams generateDefaultLayoutParams();
    method public android.support.percent.PercentFrameLayout.LayoutParams generateLayoutParams(android.util.AttributeSet);
  }

  public static deprecated class PercentFrameLayout.LayoutParams extends android.widget.FrameLayout.LayoutParams implements android.support.percent.PercentLayoutHelper.PercentLayoutParams {
    ctor public PercentFrameLayout.LayoutParams(android.content.Context, android.util.AttributeSet);
    ctor public PercentFrameLayout.LayoutParams(int, int);
    ctor public PercentFrameLayout.LayoutParams(int, int, int);
    ctor public PercentFrameLayout.LayoutParams(android.view.ViewGroup.LayoutParams);
    ctor public PercentFrameLayout.LayoutParams(android.view.ViewGroup.MarginLayoutParams);
    ctor public PercentFrameLayout.LayoutParams(android.widget.FrameLayout.LayoutParams);
    ctor public PercentFrameLayout.LayoutParams(android.support.percent.PercentFrameLayout.LayoutParams);
    method public android.support.percent.PercentLayoutHelper.PercentLayoutInfo getPercentLayoutInfo();
  }

  public deprecated class PercentLayoutHelper {
    ctor public PercentLayoutHelper(android.view.ViewGroup);
    method public void adjustChildren(int, int);
    method public static void fetchWidthAndHeight(android.view.ViewGroup.LayoutParams, android.content.res.TypedArray, int, int);
    method public static android.support.percent.PercentLayoutHelper.PercentLayoutInfo getPercentLayoutInfo(android.content.Context, android.util.AttributeSet);
    method public boolean handleMeasuredStateTooSmall();
    method public void restoreOriginalParams();
  }

  public static deprecated class PercentLayoutHelper.PercentLayoutInfo {
    ctor public PercentLayoutHelper.PercentLayoutInfo();
    method public void fillLayoutParams(android.view.ViewGroup.LayoutParams, int, int);
    method public deprecated void fillMarginLayoutParams(android.view.ViewGroup.MarginLayoutParams, int, int);
    method public void fillMarginLayoutParams(android.view.View, android.view.ViewGroup.MarginLayoutParams, int, int);
    method public void restoreLayoutParams(android.view.ViewGroup.LayoutParams);
    method public void restoreMarginLayoutParams(android.view.ViewGroup.MarginLayoutParams);
    field public float aspectRatio;
    field public float bottomMarginPercent;
    field public float endMarginPercent;
    field public float heightPercent;
    field public float leftMarginPercent;
    field public float rightMarginPercent;
    field public float startMarginPercent;
    field public float topMarginPercent;
    field public float widthPercent;
  }

  public static abstract deprecated interface PercentLayoutHelper.PercentLayoutParams {
    method public abstract android.support.percent.PercentLayoutHelper.PercentLayoutInfo getPercentLayoutInfo();
  }

  public deprecated class PercentRelativeLayout extends android.widget.RelativeLayout {
    ctor public PercentRelativeLayout(android.content.Context);
    ctor public PercentRelativeLayout(android.content.Context, android.util.AttributeSet);
    ctor public PercentRelativeLayout(android.content.Context, android.util.AttributeSet, int);
    method protected android.support.percent.PercentRelativeLayout.LayoutParams generateDefaultLayoutParams();
    method public android.support.percent.PercentRelativeLayout.LayoutParams generateLayoutParams(android.util.AttributeSet);
  }

  public static deprecated class PercentRelativeLayout.LayoutParams extends android.widget.RelativeLayout.LayoutParams implements android.support.percent.PercentLayoutHelper.PercentLayoutParams {
    ctor public PercentRelativeLayout.LayoutParams(android.content.Context, android.util.AttributeSet);
    ctor public PercentRelativeLayout.LayoutParams(int, int);
    ctor public PercentRelativeLayout.LayoutParams(android.view.ViewGroup.LayoutParams);
    ctor public PercentRelativeLayout.LayoutParams(android.view.ViewGroup.MarginLayoutParams);
    method public android.support.percent.PercentLayoutHelper.PercentLayoutInfo getPercentLayoutInfo();
  }

}

package android.support.text.emoji {

  public class EmojiCompat {
    method public static android.support.text.emoji.EmojiCompat get();
    method public java.lang.String getAssetSignature();
    method public int getLoadState();
    method public static boolean handleDeleteSurroundingText(android.view.inputmethod.InputConnection, android.text.Editable, int, int, boolean);
    method public static boolean handleOnKeyDown(android.text.Editable, int, android.view.KeyEvent);
    method public boolean hasEmojiGlyph(java.lang.CharSequence);
    method public boolean hasEmojiGlyph(java.lang.CharSequence, int);
    method public static android.support.text.emoji.EmojiCompat init(android.support.text.emoji.EmojiCompat.Config);
    method public java.lang.CharSequence process(java.lang.CharSequence);
    method public java.lang.CharSequence process(java.lang.CharSequence, int, int);
    method public java.lang.CharSequence process(java.lang.CharSequence, int, int, int);
    method public java.lang.CharSequence process(java.lang.CharSequence, int, int, int, int);
    method public void registerInitCallback(android.support.text.emoji.EmojiCompat.InitCallback);
    method public void unregisterInitCallback(android.support.text.emoji.EmojiCompat.InitCallback);
    field public static final java.lang.String EDITOR_INFO_METAVERSION_KEY = "android.support.text.emoji.emojiCompat_metadataVersion";
    field public static final java.lang.String EDITOR_INFO_REPLACE_ALL_KEY = "android.support.text.emoji.emojiCompat_replaceAll";
    field public static final int LOAD_STATE_FAILED = 2; // 0x2
    field public static final int LOAD_STATE_LOADING = 0; // 0x0
    field public static final int LOAD_STATE_SUCCEEDED = 1; // 0x1
    field public static final int REPLACE_STRATEGY_ALL = 1; // 0x1
    field public static final int REPLACE_STRATEGY_DEFAULT = 0; // 0x0
    field public static final int REPLACE_STRATEGY_NON_EXISTENT = 2; // 0x2
  }

  public static abstract class EmojiCompat.Config {
    ctor protected EmojiCompat.Config(android.support.text.emoji.EmojiCompat.MetadataRepoLoader);
    method protected final android.support.text.emoji.EmojiCompat.MetadataRepoLoader getMetadataRepoLoader();
    method public android.support.text.emoji.EmojiCompat.Config registerInitCallback(android.support.text.emoji.EmojiCompat.InitCallback);
    method public android.support.text.emoji.EmojiCompat.Config setEmojiSpanIndicatorColor(int);
    method public android.support.text.emoji.EmojiCompat.Config setEmojiSpanIndicatorEnabled(boolean);
    method public android.support.text.emoji.EmojiCompat.Config setReplaceAll(boolean);
    method public android.support.text.emoji.EmojiCompat.Config unregisterInitCallback(android.support.text.emoji.EmojiCompat.InitCallback);
  }

  public static abstract class EmojiCompat.InitCallback {
    ctor public EmojiCompat.InitCallback();
    method public void onFailed(java.lang.Throwable);
    method public void onInitialized();
  }

  public static abstract interface EmojiCompat.MetadataRepoLoader {
    method public abstract void load(android.support.text.emoji.EmojiCompat.MetadataRepoLoaderCallback);
  }

  public static abstract class EmojiCompat.MetadataRepoLoaderCallback {
    ctor public EmojiCompat.MetadataRepoLoaderCallback();
    method public abstract void onFailed(java.lang.Throwable);
    method public abstract void onLoaded(android.support.text.emoji.MetadataRepo);
  }

  public abstract class EmojiSpan extends android.text.style.ReplacementSpan {
    method public int getSize(android.graphics.Paint, java.lang.CharSequence, int, int, android.graphics.Paint.FontMetricsInt);
  }

  public class FontRequestEmojiCompatConfig extends android.support.text.emoji.EmojiCompat.Config {
    ctor public FontRequestEmojiCompatConfig(android.content.Context, android.support.v4.provider.FontRequest);
    method public android.support.text.emoji.FontRequestEmojiCompatConfig setHandler(android.os.Handler);
    method public android.support.text.emoji.FontRequestEmojiCompatConfig setRetryPolicy(android.support.text.emoji.FontRequestEmojiCompatConfig.RetryPolicy);
  }

  public static class FontRequestEmojiCompatConfig.ExponentialBackoffRetryPolicy extends android.support.text.emoji.FontRequestEmojiCompatConfig.RetryPolicy {
    ctor public FontRequestEmojiCompatConfig.ExponentialBackoffRetryPolicy(long);
    method public long getRetryDelay();
  }

  public static abstract class FontRequestEmojiCompatConfig.RetryPolicy {
    ctor public FontRequestEmojiCompatConfig.RetryPolicy();
    method public abstract long getRetryDelay();
  }

  public final class MetadataRepo {
    method public static android.support.text.emoji.MetadataRepo create(android.graphics.Typeface, java.io.InputStream) throws java.io.IOException;
    method public static android.support.text.emoji.MetadataRepo create(android.graphics.Typeface, java.nio.ByteBuffer) throws java.io.IOException;
    method public static android.support.text.emoji.MetadataRepo create(android.content.res.AssetManager, java.lang.String) throws java.io.IOException;
  }

}

package android.support.text.emoji.bundled {

  public class BundledEmojiCompatConfig extends android.support.text.emoji.EmojiCompat.Config {
    ctor public BundledEmojiCompatConfig(android.content.Context);
  }

}

package android.support.text.emoji.widget {

  public class EmojiAppCompatButton extends android.support.v7.widget.AppCompatButton {
    ctor public EmojiAppCompatButton(android.content.Context);
    ctor public EmojiAppCompatButton(android.content.Context, android.util.AttributeSet);
    ctor public EmojiAppCompatButton(android.content.Context, android.util.AttributeSet, int);
  }

  public class EmojiAppCompatEditText extends android.support.v7.widget.AppCompatEditText {
    ctor public EmojiAppCompatEditText(android.content.Context);
    ctor public EmojiAppCompatEditText(android.content.Context, android.util.AttributeSet);
    ctor public EmojiAppCompatEditText(android.content.Context, android.util.AttributeSet, int);
    method public int getMaxEmojiCount();
    method public void setMaxEmojiCount(int);
  }

  public class EmojiAppCompatTextView extends android.support.v7.widget.AppCompatTextView {
    ctor public EmojiAppCompatTextView(android.content.Context);
    ctor public EmojiAppCompatTextView(android.content.Context, android.util.AttributeSet);
    ctor public EmojiAppCompatTextView(android.content.Context, android.util.AttributeSet, int);
  }

  public class EmojiButton extends android.widget.Button {
    ctor public EmojiButton(android.content.Context);
    ctor public EmojiButton(android.content.Context, android.util.AttributeSet);
    ctor public EmojiButton(android.content.Context, android.util.AttributeSet, int);
    ctor public EmojiButton(android.content.Context, android.util.AttributeSet, int, int);
  }

  public class EmojiEditText extends android.widget.EditText {
    ctor public EmojiEditText(android.content.Context);
    ctor public EmojiEditText(android.content.Context, android.util.AttributeSet);
    ctor public EmojiEditText(android.content.Context, android.util.AttributeSet, int);
    ctor public EmojiEditText(android.content.Context, android.util.AttributeSet, int, int);
    method public int getMaxEmojiCount();
    method public void setMaxEmojiCount(int);
  }

  public final class EmojiEditTextHelper {
    ctor public EmojiEditTextHelper(android.widget.EditText);
    method public android.text.method.KeyListener getKeyListener(android.text.method.KeyListener);
    method public int getMaxEmojiCount();
    method public android.view.inputmethod.InputConnection onCreateInputConnection(android.view.inputmethod.InputConnection, android.view.inputmethod.EditorInfo);
    method public void setMaxEmojiCount(int);
  }

  public class EmojiExtractTextLayout extends android.widget.LinearLayout {
    ctor public EmojiExtractTextLayout(android.content.Context);
    ctor public EmojiExtractTextLayout(android.content.Context, android.util.AttributeSet);
    ctor public EmojiExtractTextLayout(android.content.Context, android.util.AttributeSet, int);
    ctor public EmojiExtractTextLayout(android.content.Context, android.util.AttributeSet, int, int);
    method public int getEmojiReplaceStrategy();
    method public void onUpdateExtractingViews(android.inputmethodservice.InputMethodService, android.view.inputmethod.EditorInfo);
    method public void setEmojiReplaceStrategy(int);
  }

  public class EmojiTextView extends android.widget.TextView {
    ctor public EmojiTextView(android.content.Context);
    ctor public EmojiTextView(android.content.Context, android.util.AttributeSet);
    ctor public EmojiTextView(android.content.Context, android.util.AttributeSet, int);
    ctor public EmojiTextView(android.content.Context, android.util.AttributeSet, int, int);
  }

  public final class EmojiTextViewHelper {
    ctor public EmojiTextViewHelper(android.widget.TextView);
    method public android.text.InputFilter[] getFilters(android.text.InputFilter[]);
    method public void setAllCaps(boolean);
    method public void updateTransformationMethod();
    method public android.text.method.TransformationMethod wrapTransformationMethod(android.text.method.TransformationMethod);
  }

}

package android.support.transition {

  public class ArcMotion extends android.support.transition.PathMotion {
    ctor public ArcMotion();
    ctor public ArcMotion(android.content.Context, android.util.AttributeSet);
    method public float getMaximumAngle();
    method public float getMinimumHorizontalAngle();
    method public float getMinimumVerticalAngle();
    method public android.graphics.Path getPath(float, float, float, float);
    method public void setMaximumAngle(float);
    method public void setMinimumHorizontalAngle(float);
    method public void setMinimumVerticalAngle(float);
  }

  public class AutoTransition extends android.support.transition.TransitionSet {
    ctor public AutoTransition();
    ctor public AutoTransition(android.content.Context, android.util.AttributeSet);
  }

  public class ChangeBounds extends android.support.transition.Transition {
    ctor public ChangeBounds();
    ctor public ChangeBounds(android.content.Context, android.util.AttributeSet);
    method public void captureEndValues(android.support.transition.TransitionValues);
    method public void captureStartValues(android.support.transition.TransitionValues);
    method public boolean getResizeClip();
    method public void setResizeClip(boolean);
  }

  public class ChangeClipBounds extends android.support.transition.Transition {
    ctor public ChangeClipBounds();
    ctor public ChangeClipBounds(android.content.Context, android.util.AttributeSet);
    method public void captureEndValues(android.support.transition.TransitionValues);
    method public void captureStartValues(android.support.transition.TransitionValues);
  }

  public class ChangeImageTransform extends android.support.transition.Transition {
    ctor public ChangeImageTransform();
    ctor public ChangeImageTransform(android.content.Context, android.util.AttributeSet);
    method public void captureEndValues(android.support.transition.TransitionValues);
    method public void captureStartValues(android.support.transition.TransitionValues);
  }

  public class ChangeScroll extends android.support.transition.Transition {
    ctor public ChangeScroll();
    ctor public ChangeScroll(android.content.Context, android.util.AttributeSet);
    method public void captureEndValues(android.support.transition.TransitionValues);
    method public void captureStartValues(android.support.transition.TransitionValues);
  }

  public class ChangeTransform extends android.support.transition.Transition {
    ctor public ChangeTransform();
    ctor public ChangeTransform(android.content.Context, android.util.AttributeSet);
    method public void captureEndValues(android.support.transition.TransitionValues);
    method public void captureStartValues(android.support.transition.TransitionValues);
    method public boolean getReparent();
    method public boolean getReparentWithOverlay();
    method public void setReparent(boolean);
    method public void setReparentWithOverlay(boolean);
  }

  public class CircularPropagation extends android.support.transition.VisibilityPropagation {
    ctor public CircularPropagation();
    method public long getStartDelay(android.view.ViewGroup, android.support.transition.Transition, android.support.transition.TransitionValues, android.support.transition.TransitionValues);
    method public void setPropagationSpeed(float);
  }

  public class Explode extends android.support.transition.Visibility {
    ctor public Explode();
    ctor public Explode(android.content.Context, android.util.AttributeSet);
  }

  public class Fade extends android.support.transition.Visibility {
    ctor public Fade(int);
    ctor public Fade();
    ctor public Fade(android.content.Context, android.util.AttributeSet);
    field public static final int IN = 1; // 0x1
    field public static final int OUT = 2; // 0x2
  }

  public abstract class PathMotion {
    ctor public PathMotion();
    ctor public PathMotion(android.content.Context, android.util.AttributeSet);
    method public abstract android.graphics.Path getPath(float, float, float, float);
  }

  public class PatternPathMotion extends android.support.transition.PathMotion {
    ctor public PatternPathMotion();
    ctor public PatternPathMotion(android.content.Context, android.util.AttributeSet);
    ctor public PatternPathMotion(android.graphics.Path);
    method public android.graphics.Path getPath(float, float, float, float);
    method public android.graphics.Path getPatternPath();
    method public void setPatternPath(android.graphics.Path);
  }

  public class Scene {
    ctor public Scene(android.view.ViewGroup);
    ctor public Scene(android.view.ViewGroup, android.view.View);
    method public void enter();
    method public void exit();
    method public static android.support.transition.Scene getSceneForLayout(android.view.ViewGroup, int, android.content.Context);
    method public android.view.ViewGroup getSceneRoot();
    method public void setEnterAction(java.lang.Runnable);
    method public void setExitAction(java.lang.Runnable);
  }

  public class SidePropagation extends android.support.transition.VisibilityPropagation {
    ctor public SidePropagation();
    method public long getStartDelay(android.view.ViewGroup, android.support.transition.Transition, android.support.transition.TransitionValues, android.support.transition.TransitionValues);
    method public void setPropagationSpeed(float);
    method public void setSide(int);
  }

  public class Slide extends android.support.transition.Visibility {
    ctor public Slide();
    ctor public Slide(int);
    ctor public Slide(android.content.Context, android.util.AttributeSet);
    method public int getSlideEdge();
    method public void setSlideEdge(int);
  }

  public abstract class Transition {
    ctor public Transition();
    ctor public Transition(android.content.Context, android.util.AttributeSet);
    method public android.support.transition.Transition addListener(android.support.transition.Transition.TransitionListener);
    method public android.support.transition.Transition addTarget(android.view.View);
    method public android.support.transition.Transition addTarget(int);
    method public android.support.transition.Transition addTarget(java.lang.String);
    method public android.support.transition.Transition addTarget(java.lang.Class);
    method public abstract void captureEndValues(android.support.transition.TransitionValues);
    method public abstract void captureStartValues(android.support.transition.TransitionValues);
    method public android.support.transition.Transition clone();
    method public android.animation.Animator createAnimator(android.view.ViewGroup, android.support.transition.TransitionValues, android.support.transition.TransitionValues);
    method public android.support.transition.Transition excludeChildren(android.view.View, boolean);
    method public android.support.transition.Transition excludeChildren(int, boolean);
    method public android.support.transition.Transition excludeChildren(java.lang.Class, boolean);
    method public android.support.transition.Transition excludeTarget(android.view.View, boolean);
    method public android.support.transition.Transition excludeTarget(int, boolean);
    method public android.support.transition.Transition excludeTarget(java.lang.String, boolean);
    method public android.support.transition.Transition excludeTarget(java.lang.Class, boolean);
    method public long getDuration();
    method public android.graphics.Rect getEpicenter();
    method public android.support.transition.Transition.EpicenterCallback getEpicenterCallback();
    method public android.animation.TimeInterpolator getInterpolator();
    method public java.lang.String getName();
    method public android.support.transition.PathMotion getPathMotion();
    method public android.support.transition.TransitionPropagation getPropagation();
    method public long getStartDelay();
    method public java.util.List<java.lang.Integer> getTargetIds();
    method public java.util.List<java.lang.String> getTargetNames();
    method public java.util.List<java.lang.Class> getTargetTypes();
    method public java.util.List<android.view.View> getTargets();
    method public java.lang.String[] getTransitionProperties();
    method public android.support.transition.TransitionValues getTransitionValues(android.view.View, boolean);
    method public boolean isTransitionRequired(android.support.transition.TransitionValues, android.support.transition.TransitionValues);
    method public android.support.transition.Transition removeListener(android.support.transition.Transition.TransitionListener);
    method public android.support.transition.Transition removeTarget(android.view.View);
    method public android.support.transition.Transition removeTarget(int);
    method public android.support.transition.Transition removeTarget(java.lang.String);
    method public android.support.transition.Transition removeTarget(java.lang.Class);
    method public android.support.transition.Transition setDuration(long);
    method public void setEpicenterCallback(android.support.transition.Transition.EpicenterCallback);
    method public android.support.transition.Transition setInterpolator(android.animation.TimeInterpolator);
    method public void setMatchOrder(int...);
    method public void setPathMotion(android.support.transition.PathMotion);
    method public void setPropagation(android.support.transition.TransitionPropagation);
    method public android.support.transition.Transition setStartDelay(long);
    field public static final int MATCH_ID = 3; // 0x3
    field public static final int MATCH_INSTANCE = 1; // 0x1
    field public static final int MATCH_ITEM_ID = 4; // 0x4
    field public static final int MATCH_NAME = 2; // 0x2
  }

  public static abstract class Transition.EpicenterCallback {
    ctor public Transition.EpicenterCallback();
    method public abstract android.graphics.Rect onGetEpicenter(android.support.transition.Transition);
  }

  public static abstract interface Transition.TransitionListener {
    method public abstract void onTransitionCancel(android.support.transition.Transition);
    method public abstract void onTransitionEnd(android.support.transition.Transition);
    method public abstract void onTransitionPause(android.support.transition.Transition);
    method public abstract void onTransitionResume(android.support.transition.Transition);
    method public abstract void onTransitionStart(android.support.transition.Transition);
  }

  public class TransitionInflater {
    method public static android.support.transition.TransitionInflater from(android.content.Context);
    method public android.support.transition.Transition inflateTransition(int);
    method public android.support.transition.TransitionManager inflateTransitionManager(int, android.view.ViewGroup);
  }

  public class TransitionListenerAdapter implements android.support.transition.Transition.TransitionListener {
    ctor public TransitionListenerAdapter();
    method public void onTransitionCancel(android.support.transition.Transition);
    method public void onTransitionEnd(android.support.transition.Transition);
    method public void onTransitionPause(android.support.transition.Transition);
    method public void onTransitionResume(android.support.transition.Transition);
    method public void onTransitionStart(android.support.transition.Transition);
  }

  public class TransitionManager {
    ctor public TransitionManager();
    method public static void beginDelayedTransition(android.view.ViewGroup);
    method public static void beginDelayedTransition(android.view.ViewGroup, android.support.transition.Transition);
    method public static void endTransitions(android.view.ViewGroup);
    method public static void go(android.support.transition.Scene);
    method public static void go(android.support.transition.Scene, android.support.transition.Transition);
    method public void setTransition(android.support.transition.Scene, android.support.transition.Transition);
    method public void setTransition(android.support.transition.Scene, android.support.transition.Scene, android.support.transition.Transition);
    method public void transitionTo(android.support.transition.Scene);
  }

  public abstract class TransitionPropagation {
    ctor public TransitionPropagation();
    method public abstract void captureValues(android.support.transition.TransitionValues);
    method public abstract java.lang.String[] getPropagationProperties();
    method public abstract long getStartDelay(android.view.ViewGroup, android.support.transition.Transition, android.support.transition.TransitionValues, android.support.transition.TransitionValues);
  }

  public class TransitionSet extends android.support.transition.Transition {
    ctor public TransitionSet();
    ctor public TransitionSet(android.content.Context, android.util.AttributeSet);
    method public android.support.transition.TransitionSet addListener(android.support.transition.Transition.TransitionListener);
    method public android.support.transition.TransitionSet addTarget(android.view.View);
    method public android.support.transition.TransitionSet addTarget(int);
    method public android.support.transition.TransitionSet addTarget(java.lang.String);
    method public android.support.transition.TransitionSet addTarget(java.lang.Class);
    method public android.support.transition.TransitionSet addTransition(android.support.transition.Transition);
    method public void captureEndValues(android.support.transition.TransitionValues);
    method public void captureStartValues(android.support.transition.TransitionValues);
    method public int getOrdering();
    method public android.support.transition.Transition getTransitionAt(int);
    method public int getTransitionCount();
    method public android.support.transition.TransitionSet removeListener(android.support.transition.Transition.TransitionListener);
    method public android.support.transition.TransitionSet removeTarget(int);
    method public android.support.transition.TransitionSet removeTarget(android.view.View);
    method public android.support.transition.TransitionSet removeTarget(java.lang.Class);
    method public android.support.transition.TransitionSet removeTarget(java.lang.String);
    method public android.support.transition.TransitionSet removeTransition(android.support.transition.Transition);
    method public android.support.transition.TransitionSet setDuration(long);
    method public android.support.transition.TransitionSet setInterpolator(android.animation.TimeInterpolator);
    method public android.support.transition.TransitionSet setOrdering(int);
    method public android.support.transition.TransitionSet setStartDelay(long);
    field public static final int ORDERING_SEQUENTIAL = 1; // 0x1
    field public static final int ORDERING_TOGETHER = 0; // 0x0
  }

  public class TransitionValues {
    ctor public TransitionValues();
    field public final java.util.Map<java.lang.String, java.lang.Object> values;
    field public android.view.View view;
  }

  public abstract class Visibility extends android.support.transition.Transition {
    ctor public Visibility();
    ctor public Visibility(android.content.Context, android.util.AttributeSet);
    method public void captureEndValues(android.support.transition.TransitionValues);
    method public void captureStartValues(android.support.transition.TransitionValues);
    method public int getMode();
    method public boolean isVisible(android.support.transition.TransitionValues);
    method public android.animation.Animator onAppear(android.view.ViewGroup, android.support.transition.TransitionValues, int, android.support.transition.TransitionValues, int);
    method public android.animation.Animator onAppear(android.view.ViewGroup, android.view.View, android.support.transition.TransitionValues, android.support.transition.TransitionValues);
    method public android.animation.Animator onDisappear(android.view.ViewGroup, android.support.transition.TransitionValues, int, android.support.transition.TransitionValues, int);
    method public android.animation.Animator onDisappear(android.view.ViewGroup, android.view.View, android.support.transition.TransitionValues, android.support.transition.TransitionValues);
    method public void setMode(int);
    field public static final int MODE_IN = 1; // 0x1
    field public static final int MODE_OUT = 2; // 0x2
  }

  public abstract class VisibilityPropagation extends android.support.transition.TransitionPropagation {
    ctor public VisibilityPropagation();
    method public void captureValues(android.support.transition.TransitionValues);
    method public java.lang.String[] getPropagationProperties();
    method public int getViewVisibility(android.support.transition.TransitionValues);
    method public int getViewX(android.support.transition.TransitionValues);
    method public int getViewY(android.support.transition.TransitionValues);
  }

}

package android.support.v13.app {

  public class ActivityCompat extends android.support.v4.app.ActivityCompat {
    ctor protected ActivityCompat();
    method public static android.support.v13.view.DragAndDropPermissionsCompat requestDragAndDropPermissions(android.app.Activity, android.view.DragEvent);
  }

  public class FragmentCompat {
    ctor public FragmentCompat();
    method public static void requestPermissions(android.app.Fragment, java.lang.String[], int);
    method public static deprecated void setMenuVisibility(android.app.Fragment, boolean);
    method public static void setUserVisibleHint(android.app.Fragment, boolean);
    method public static boolean shouldShowRequestPermissionRationale(android.app.Fragment, java.lang.String);
  }

  public static abstract interface FragmentCompat.OnRequestPermissionsResultCallback {
    method public abstract void onRequestPermissionsResult(int, java.lang.String[], int[]);
  }

  public abstract class FragmentPagerAdapter extends android.support.v4.view.PagerAdapter {
    ctor public FragmentPagerAdapter(android.app.FragmentManager);
    method public abstract android.app.Fragment getItem(int);
    method public long getItemId(int);
    method public boolean isViewFromObject(android.view.View, java.lang.Object);
  }

  public abstract class FragmentStatePagerAdapter extends android.support.v4.view.PagerAdapter {
    ctor public FragmentStatePagerAdapter(android.app.FragmentManager);
    method public abstract android.app.Fragment getItem(int);
    method public boolean isViewFromObject(android.view.View, java.lang.Object);
  }

  public class FragmentTabHost extends android.widget.TabHost implements android.widget.TabHost.OnTabChangeListener {
    ctor public FragmentTabHost(android.content.Context);
    ctor public FragmentTabHost(android.content.Context, android.util.AttributeSet);
    method public void addTab(android.widget.TabHost.TabSpec, java.lang.Class<?>, android.os.Bundle);
    method public void onTabChanged(java.lang.String);
    method public deprecated void setup();
    method public void setup(android.content.Context, android.app.FragmentManager);
    method public void setup(android.content.Context, android.app.FragmentManager, int);
  }

}

package android.support.v13.view {

  public final class DragAndDropPermissionsCompat {
    method public void release();
  }

  public class DragStartHelper {
    ctor public DragStartHelper(android.view.View, android.support.v13.view.DragStartHelper.OnDragStartListener);
    method public void attach();
    method public void detach();
    method public void getTouchPosition(android.graphics.Point);
    method public boolean onLongClick(android.view.View);
    method public boolean onTouch(android.view.View, android.view.MotionEvent);
  }

  public static abstract interface DragStartHelper.OnDragStartListener {
    method public abstract boolean onDragStart(android.view.View, android.support.v13.view.DragStartHelper);
  }

  public deprecated class ViewCompat extends android.support.v4.view.ViewCompat {
  }

}

package android.support.v13.view.inputmethod {

  public final class EditorInfoCompat {
    ctor public EditorInfoCompat();
    method public static java.lang.String[] getContentMimeTypes(android.view.inputmethod.EditorInfo);
    method public static void setContentMimeTypes(android.view.inputmethod.EditorInfo, java.lang.String[]);
    field public static final int IME_FLAG_FORCE_ASCII = -2147483648; // 0x80000000
    field public static final int IME_FLAG_NO_PERSONALIZED_LEARNING = 16777216; // 0x1000000
  }

  public final class InputConnectionCompat {
    ctor public InputConnectionCompat();
    method public static boolean commitContent(android.view.inputmethod.InputConnection, android.view.inputmethod.EditorInfo, android.support.v13.view.inputmethod.InputContentInfoCompat, int, android.os.Bundle);
    method public static android.view.inputmethod.InputConnection createWrapper(android.view.inputmethod.InputConnection, android.view.inputmethod.EditorInfo, android.support.v13.view.inputmethod.InputConnectionCompat.OnCommitContentListener);
    field public static int INPUT_CONTENT_GRANT_READ_URI_PERMISSION;
  }

  public static abstract interface InputConnectionCompat.OnCommitContentListener {
    method public abstract boolean onCommitContent(android.support.v13.view.inputmethod.InputContentInfoCompat, int, android.os.Bundle);
  }

  public final class InputContentInfoCompat {
    ctor public InputContentInfoCompat(android.net.Uri, android.content.ClipDescription, android.net.Uri);
    method public android.net.Uri getContentUri();
    method public android.content.ClipDescription getDescription();
    method public android.net.Uri getLinkUri();
    method public void releasePermission();
    method public void requestPermission();
    method public java.lang.Object unwrap();
    method public static android.support.v13.view.inputmethod.InputContentInfoCompat wrap(java.lang.Object);
  }

}

package android.support.v14.preference {

  public class EditTextPreferenceDialogFragment extends android.support.v14.preference.PreferenceDialogFragment {
    ctor public EditTextPreferenceDialogFragment();
    method public static android.support.v14.preference.EditTextPreferenceDialogFragment newInstance(java.lang.String);
    method public void onDialogClosed(boolean);
  }

  public class ListPreferenceDialogFragment extends android.support.v14.preference.PreferenceDialogFragment {
    ctor public ListPreferenceDialogFragment();
    method public static android.support.v14.preference.ListPreferenceDialogFragment newInstance(java.lang.String);
    method public void onDialogClosed(boolean);
  }

  public class MultiSelectListPreference extends android.support.v7.preference.DialogPreference {
    ctor public MultiSelectListPreference(android.content.Context, android.util.AttributeSet, int, int);
    ctor public MultiSelectListPreference(android.content.Context, android.util.AttributeSet, int);
    ctor public MultiSelectListPreference(android.content.Context, android.util.AttributeSet);
    ctor public MultiSelectListPreference(android.content.Context);
    method public int findIndexOfValue(java.lang.String);
    method public java.lang.CharSequence[] getEntries();
    method public java.lang.CharSequence[] getEntryValues();
    method protected boolean[] getSelectedItems();
    method public java.util.Set<java.lang.String> getValues();
    method public void setEntries(java.lang.CharSequence[]);
    method public void setEntries(int);
    method public void setEntryValues(java.lang.CharSequence[]);
    method public void setEntryValues(int);
    method public void setValues(java.util.Set<java.lang.String>);
  }

  public class MultiSelectListPreferenceDialogFragment extends android.support.v14.preference.PreferenceDialogFragment {
    ctor public MultiSelectListPreferenceDialogFragment();
    method public static android.support.v14.preference.MultiSelectListPreferenceDialogFragment newInstance(java.lang.String);
    method public void onDialogClosed(boolean);
  }

  public abstract class PreferenceDialogFragment extends android.app.DialogFragment implements android.content.DialogInterface.OnClickListener {
    ctor public PreferenceDialogFragment();
    method public android.support.v7.preference.DialogPreference getPreference();
    method protected void onBindDialogView(android.view.View);
    method public void onClick(android.content.DialogInterface, int);
    method protected android.view.View onCreateDialogView(android.content.Context);
    method public abstract void onDialogClosed(boolean);
    method protected void onPrepareDialogBuilder(android.app.AlertDialog.Builder);
    field protected static final java.lang.String ARG_KEY = "key";
  }

  public abstract class PreferenceFragment extends android.app.Fragment implements android.support.v7.preference.DialogPreference.TargetFragment android.support.v7.preference.PreferenceManager.OnDisplayPreferenceDialogListener android.support.v7.preference.PreferenceManager.OnNavigateToScreenListener android.support.v7.preference.PreferenceManager.OnPreferenceTreeClickListener {
    ctor public PreferenceFragment();
    method public void addPreferencesFromResource(int);
    method public android.support.v7.preference.Preference findPreference(java.lang.CharSequence);
    method public final android.support.v7.widget.RecyclerView getListView();
    method public android.support.v7.preference.PreferenceManager getPreferenceManager();
    method public android.support.v7.preference.PreferenceScreen getPreferenceScreen();
    method protected android.support.v7.widget.RecyclerView.Adapter onCreateAdapter(android.support.v7.preference.PreferenceScreen);
    method public android.support.v7.widget.RecyclerView.LayoutManager onCreateLayoutManager();
    method public abstract void onCreatePreferences(android.os.Bundle, java.lang.String);
    method public android.support.v7.widget.RecyclerView onCreateRecyclerView(android.view.LayoutInflater, android.view.ViewGroup, android.os.Bundle);
    method public void onDisplayPreferenceDialog(android.support.v7.preference.Preference);
    method public void onNavigateToScreen(android.support.v7.preference.PreferenceScreen);
    method public boolean onPreferenceTreeClick(android.support.v7.preference.Preference);
    method public void scrollToPreference(java.lang.String);
    method public void scrollToPreference(android.support.v7.preference.Preference);
    method public void setDivider(android.graphics.drawable.Drawable);
    method public void setDividerHeight(int);
    method public void setPreferenceScreen(android.support.v7.preference.PreferenceScreen);
    method public void setPreferencesFromResource(int, java.lang.String);
    field public static final java.lang.String ARG_PREFERENCE_ROOT = "android.support.v7.preference.PreferenceFragmentCompat.PREFERENCE_ROOT";
  }

  public static abstract interface PreferenceFragment.OnPreferenceDisplayDialogCallback {
    method public abstract boolean onPreferenceDisplayDialog(android.support.v14.preference.PreferenceFragment, android.support.v7.preference.Preference);
  }

  public static abstract interface PreferenceFragment.OnPreferenceStartFragmentCallback {
    method public abstract boolean onPreferenceStartFragment(android.support.v14.preference.PreferenceFragment, android.support.v7.preference.Preference);
  }

  public static abstract interface PreferenceFragment.OnPreferenceStartScreenCallback {
    method public abstract boolean onPreferenceStartScreen(android.support.v14.preference.PreferenceFragment, android.support.v7.preference.PreferenceScreen);
  }

  public class SwitchPreference extends android.support.v7.preference.TwoStatePreference {
    ctor public SwitchPreference(android.content.Context, android.util.AttributeSet, int, int);
    ctor public SwitchPreference(android.content.Context, android.util.AttributeSet, int);
    ctor public SwitchPreference(android.content.Context, android.util.AttributeSet);
    ctor public SwitchPreference(android.content.Context);
    method public java.lang.CharSequence getSwitchTextOff();
    method public java.lang.CharSequence getSwitchTextOn();
    method public void setSwitchTextOff(java.lang.CharSequence);
    method public void setSwitchTextOff(int);
    method public void setSwitchTextOn(java.lang.CharSequence);
    method public void setSwitchTextOn(int);
  }

}

package android.support.v17.leanback.app {

  public final class BackgroundManager {
    method public void attach(android.view.Window);
    method public void attachToView(android.view.View);
    method public void clearDrawable();
    method public final int getColor();
    method public deprecated android.graphics.drawable.Drawable getDefaultDimLayer();
    method public deprecated android.graphics.drawable.Drawable getDimLayer();
    method public android.graphics.drawable.Drawable getDrawable();
    method public static android.support.v17.leanback.app.BackgroundManager getInstance(android.app.Activity);
    method public boolean isAttached();
    method public boolean isAutoReleaseOnStop();
    method public void release();
    method public void setAutoReleaseOnStop(boolean);
    method public void setBitmap(android.graphics.Bitmap);
    method public void setColor(int);
    method public deprecated void setDimLayer(android.graphics.drawable.Drawable);
    method public void setDrawable(android.graphics.drawable.Drawable);
    method public void setThemeDrawableResourceId(int);
  }

  public class BaseFragment extends android.support.v17.leanback.app.BrandedFragment {
    method protected java.lang.Object createEntranceTransition();
    method public final android.support.v17.leanback.app.ProgressBarManager getProgressBarManager();
    method protected void onEntranceTransitionEnd();
    method protected void onEntranceTransitionPrepare();
    method protected void onEntranceTransitionStart();
    method public void prepareEntranceTransition();
    method protected void runEntranceTransition(java.lang.Object);
    method public void startEntranceTransition();
  }

   abstract class BaseRowFragment extends android.app.Fragment {
    method public final android.support.v17.leanback.widget.ObjectAdapter getAdapter();
    method public final android.support.v17.leanback.widget.ItemBridgeAdapter getBridgeAdapter();
    method public final android.support.v17.leanback.widget.PresenterSelector getPresenterSelector();
    method public int getSelectedPosition();
    method public final android.support.v17.leanback.widget.VerticalGridView getVerticalGridView();
    method public void onTransitionEnd();
    method public boolean onTransitionPrepare();
    method public void onTransitionStart();
    method public final void setAdapter(android.support.v17.leanback.widget.ObjectAdapter);
    method public void setAlignment(int);
    method public final void setPresenterSelector(android.support.v17.leanback.widget.PresenterSelector);
    method public void setSelectedPosition(int);
    method public void setSelectedPosition(int, boolean);
  }

   abstract class BaseRowSupportFragment extends android.support.v4.app.Fragment {
    method public final android.support.v17.leanback.widget.ObjectAdapter getAdapter();
    method public final android.support.v17.leanback.widget.ItemBridgeAdapter getBridgeAdapter();
    method public final android.support.v17.leanback.widget.PresenterSelector getPresenterSelector();
    method public int getSelectedPosition();
    method public final android.support.v17.leanback.widget.VerticalGridView getVerticalGridView();
    method public void onTransitionEnd();
    method public boolean onTransitionPrepare();
    method public void onTransitionStart();
    method public final void setAdapter(android.support.v17.leanback.widget.ObjectAdapter);
    method public void setAlignment(int);
    method public final void setPresenterSelector(android.support.v17.leanback.widget.PresenterSelector);
    method public void setSelectedPosition(int);
    method public void setSelectedPosition(int, boolean);
  }

  public class BaseSupportFragment extends android.support.v17.leanback.app.BrandedSupportFragment {
    method protected java.lang.Object createEntranceTransition();
    method public final android.support.v17.leanback.app.ProgressBarManager getProgressBarManager();
    method protected void onEntranceTransitionEnd();
    method protected void onEntranceTransitionPrepare();
    method protected void onEntranceTransitionStart();
    method public void prepareEntranceTransition();
    method protected void runEntranceTransition(java.lang.Object);
    method public void startEntranceTransition();
  }

  public class BrandedFragment extends android.app.Fragment {
    ctor public BrandedFragment();
    method public android.graphics.drawable.Drawable getBadgeDrawable();
    method public int getSearchAffordanceColor();
    method public android.support.v17.leanback.widget.SearchOrbView.Colors getSearchAffordanceColors();
    method public java.lang.CharSequence getTitle();
    method public android.view.View getTitleView();
    method public android.support.v17.leanback.widget.TitleViewAdapter getTitleViewAdapter();
    method public void installTitleView(android.view.LayoutInflater, android.view.ViewGroup, android.os.Bundle);
    method public final boolean isShowingTitle();
    method public android.view.View onInflateTitleView(android.view.LayoutInflater, android.view.ViewGroup, android.os.Bundle);
    method public void setBadgeDrawable(android.graphics.drawable.Drawable);
    method public void setOnSearchClickedListener(android.view.View.OnClickListener);
    method public void setSearchAffordanceColor(int);
    method public void setSearchAffordanceColors(android.support.v17.leanback.widget.SearchOrbView.Colors);
    method public void setTitle(java.lang.CharSequence);
    method public void setTitleView(android.view.View);
    method public void showTitle(boolean);
    method public void showTitle(int);
  }

  public class BrandedSupportFragment extends android.support.v4.app.Fragment {
    ctor public BrandedSupportFragment();
    method public android.graphics.drawable.Drawable getBadgeDrawable();
    method public int getSearchAffordanceColor();
    method public android.support.v17.leanback.widget.SearchOrbView.Colors getSearchAffordanceColors();
    method public java.lang.CharSequence getTitle();
    method public android.view.View getTitleView();
    method public android.support.v17.leanback.widget.TitleViewAdapter getTitleViewAdapter();
    method public void installTitleView(android.view.LayoutInflater, android.view.ViewGroup, android.os.Bundle);
    method public final boolean isShowingTitle();
    method public android.view.View onInflateTitleView(android.view.LayoutInflater, android.view.ViewGroup, android.os.Bundle);
    method public void setBadgeDrawable(android.graphics.drawable.Drawable);
    method public void setOnSearchClickedListener(android.view.View.OnClickListener);
    method public void setSearchAffordanceColor(int);
    method public void setSearchAffordanceColors(android.support.v17.leanback.widget.SearchOrbView.Colors);
    method public void setTitle(java.lang.CharSequence);
    method public void setTitleView(android.view.View);
    method public void showTitle(boolean);
    method public void showTitle(int);
  }

  public class BrowseFragment extends android.support.v17.leanback.app.BaseFragment {
    ctor public BrowseFragment();
    method public static android.os.Bundle createArgs(android.os.Bundle, java.lang.String, int);
    method public void enableMainFragmentScaling(boolean);
    method public deprecated void enableRowScaling(boolean);
    method public android.support.v17.leanback.widget.ObjectAdapter getAdapter();
    method public int getBrandColor();
    method public android.support.v17.leanback.app.HeadersFragment getHeadersFragment();
    method public int getHeadersState();
    method public android.app.Fragment getMainFragment();
    method public final android.support.v17.leanback.app.BrowseFragment.MainFragmentAdapterRegistry getMainFragmentRegistry();
    method public android.support.v17.leanback.widget.OnItemViewClickedListener getOnItemViewClickedListener();
    method public android.support.v17.leanback.widget.OnItemViewSelectedListener getOnItemViewSelectedListener();
    method public android.support.v17.leanback.app.RowsFragment getRowsFragment();
    method public int getSelectedPosition();
    method public android.support.v17.leanback.widget.RowPresenter.ViewHolder getSelectedRowViewHolder();
    method public final boolean isHeadersTransitionOnBackEnabled();
    method public boolean isInHeadersTransition();
    method public boolean isShowingHeaders();
    method public android.support.v17.leanback.app.HeadersFragment onCreateHeadersFragment();
    method public void setAdapter(android.support.v17.leanback.widget.ObjectAdapter);
    method public void setBrandColor(int);
    method public void setBrowseTransitionListener(android.support.v17.leanback.app.BrowseFragment.BrowseTransitionListener);
    method public void setHeaderPresenterSelector(android.support.v17.leanback.widget.PresenterSelector);
    method public void setHeadersState(int);
    method public final void setHeadersTransitionOnBackEnabled(boolean);
    method public void setOnItemViewClickedListener(android.support.v17.leanback.widget.OnItemViewClickedListener);
    method public void setOnItemViewSelectedListener(android.support.v17.leanback.widget.OnItemViewSelectedListener);
    method public void setSelectedPosition(int);
    method public void setSelectedPosition(int, boolean);
    method public void setSelectedPosition(int, boolean, android.support.v17.leanback.widget.Presenter.ViewHolderTask);
    method public void startHeadersTransition(boolean);
    field public static final int HEADERS_DISABLED = 3; // 0x3
    field public static final int HEADERS_ENABLED = 1; // 0x1
    field public static final int HEADERS_HIDDEN = 2; // 0x2
  }

  public static class BrowseFragment.BrowseTransitionListener {
    ctor public BrowseFragment.BrowseTransitionListener();
    method public void onHeadersTransitionStart(boolean);
    method public void onHeadersTransitionStop(boolean);
  }

  public static abstract class BrowseFragment.FragmentFactory<T extends android.app.Fragment> {
    ctor public BrowseFragment.FragmentFactory();
    method public abstract T createFragment(java.lang.Object);
  }

  public static abstract interface BrowseFragment.FragmentHost {
    method public abstract void notifyDataReady(android.support.v17.leanback.app.BrowseFragment.MainFragmentAdapter);
    method public abstract void notifyViewCreated(android.support.v17.leanback.app.BrowseFragment.MainFragmentAdapter);
    method public abstract void showTitleView(boolean);
  }

  public static class BrowseFragment.ListRowFragmentFactory extends android.support.v17.leanback.app.BrowseFragment.FragmentFactory {
    ctor public BrowseFragment.ListRowFragmentFactory();
    method public android.support.v17.leanback.app.RowsFragment createFragment(java.lang.Object);
  }

  public static class BrowseFragment.MainFragmentAdapter<T extends android.app.Fragment> {
    ctor public BrowseFragment.MainFragmentAdapter(T);
    method public final T getFragment();
    method public final android.support.v17.leanback.app.BrowseFragment.FragmentHost getFragmentHost();
    method public boolean isScalingEnabled();
    method public boolean isScrolling();
    method public void onTransitionEnd();
    method public boolean onTransitionPrepare();
    method public void onTransitionStart();
    method public void setAlignment(int);
    method public void setEntranceTransitionState(boolean);
    method public void setExpand(boolean);
    method public void setScalingEnabled(boolean);
  }

  public static abstract interface BrowseFragment.MainFragmentAdapterProvider {
    method public abstract android.support.v17.leanback.app.BrowseFragment.MainFragmentAdapter getMainFragmentAdapter();
  }

  public static final class BrowseFragment.MainFragmentAdapterRegistry {
    ctor public BrowseFragment.MainFragmentAdapterRegistry();
    method public android.app.Fragment createFragment(java.lang.Object);
    method public void registerFragment(java.lang.Class, android.support.v17.leanback.app.BrowseFragment.FragmentFactory);
  }

  public static class BrowseFragment.MainFragmentRowsAdapter<T extends android.app.Fragment> {
    ctor public BrowseFragment.MainFragmentRowsAdapter(T);
    method public android.support.v17.leanback.widget.RowPresenter.ViewHolder findRowViewHolderByPosition(int);
    method public final T getFragment();
    method public int getSelectedPosition();
    method public void setAdapter(android.support.v17.leanback.widget.ObjectAdapter);
    method public void setOnItemViewClickedListener(android.support.v17.leanback.widget.OnItemViewClickedListener);
    method public void setOnItemViewSelectedListener(android.support.v17.leanback.widget.OnItemViewSelectedListener);
    method public void setSelectedPosition(int, boolean, android.support.v17.leanback.widget.Presenter.ViewHolderTask);
    method public void setSelectedPosition(int, boolean);
  }

  public static abstract interface BrowseFragment.MainFragmentRowsAdapterProvider {
    method public abstract android.support.v17.leanback.app.BrowseFragment.MainFragmentRowsAdapter getMainFragmentRowsAdapter();
  }

  public class BrowseSupportFragment extends android.support.v17.leanback.app.BaseSupportFragment {
    ctor public BrowseSupportFragment();
    method public static android.os.Bundle createArgs(android.os.Bundle, java.lang.String, int);
    method public void enableMainFragmentScaling(boolean);
    method public deprecated void enableRowScaling(boolean);
    method public android.support.v17.leanback.widget.ObjectAdapter getAdapter();
    method public int getBrandColor();
    method public int getHeadersState();
    method public android.support.v17.leanback.app.HeadersSupportFragment getHeadersSupportFragment();
    method public android.support.v4.app.Fragment getMainFragment();
    method public final android.support.v17.leanback.app.BrowseSupportFragment.MainFragmentAdapterRegistry getMainFragmentRegistry();
    method public android.support.v17.leanback.widget.OnItemViewClickedListener getOnItemViewClickedListener();
    method public android.support.v17.leanback.widget.OnItemViewSelectedListener getOnItemViewSelectedListener();
    method public android.support.v17.leanback.app.RowsSupportFragment getRowsSupportFragment();
    method public int getSelectedPosition();
    method public android.support.v17.leanback.widget.RowPresenter.ViewHolder getSelectedRowViewHolder();
    method public final boolean isHeadersTransitionOnBackEnabled();
    method public boolean isInHeadersTransition();
    method public boolean isShowingHeaders();
    method public android.support.v17.leanback.app.HeadersSupportFragment onCreateHeadersSupportFragment();
    method public void setAdapter(android.support.v17.leanback.widget.ObjectAdapter);
    method public void setBrandColor(int);
    method public void setBrowseTransitionListener(android.support.v17.leanback.app.BrowseSupportFragment.BrowseTransitionListener);
    method public void setHeaderPresenterSelector(android.support.v17.leanback.widget.PresenterSelector);
    method public void setHeadersState(int);
    method public final void setHeadersTransitionOnBackEnabled(boolean);
    method public void setOnItemViewClickedListener(android.support.v17.leanback.widget.OnItemViewClickedListener);
    method public void setOnItemViewSelectedListener(android.support.v17.leanback.widget.OnItemViewSelectedListener);
    method public void setSelectedPosition(int);
    method public void setSelectedPosition(int, boolean);
    method public void setSelectedPosition(int, boolean, android.support.v17.leanback.widget.Presenter.ViewHolderTask);
    method public void startHeadersTransition(boolean);
    field public static final int HEADERS_DISABLED = 3; // 0x3
    field public static final int HEADERS_ENABLED = 1; // 0x1
    field public static final int HEADERS_HIDDEN = 2; // 0x2
  }

  public static class BrowseSupportFragment.BrowseTransitionListener {
    ctor public BrowseSupportFragment.BrowseTransitionListener();
    method public void onHeadersTransitionStart(boolean);
    method public void onHeadersTransitionStop(boolean);
  }

  public static abstract class BrowseSupportFragment.FragmentFactory<T extends android.support.v4.app.Fragment> {
    ctor public BrowseSupportFragment.FragmentFactory();
    method public abstract T createFragment(java.lang.Object);
  }

  public static abstract interface BrowseSupportFragment.FragmentHost {
    method public abstract void notifyDataReady(android.support.v17.leanback.app.BrowseSupportFragment.MainFragmentAdapter);
    method public abstract void notifyViewCreated(android.support.v17.leanback.app.BrowseSupportFragment.MainFragmentAdapter);
    method public abstract void showTitleView(boolean);
  }

  public static class BrowseSupportFragment.ListRowFragmentFactory extends android.support.v17.leanback.app.BrowseSupportFragment.FragmentFactory {
    ctor public BrowseSupportFragment.ListRowFragmentFactory();
    method public android.support.v17.leanback.app.RowsSupportFragment createFragment(java.lang.Object);
  }

  public static class BrowseSupportFragment.MainFragmentAdapter<T extends android.support.v4.app.Fragment> {
    ctor public BrowseSupportFragment.MainFragmentAdapter(T);
    method public final T getFragment();
    method public final android.support.v17.leanback.app.BrowseSupportFragment.FragmentHost getFragmentHost();
    method public boolean isScalingEnabled();
    method public boolean isScrolling();
    method public void onTransitionEnd();
    method public boolean onTransitionPrepare();
    method public void onTransitionStart();
    method public void setAlignment(int);
    method public void setEntranceTransitionState(boolean);
    method public void setExpand(boolean);
    method public void setScalingEnabled(boolean);
  }

  public static abstract interface BrowseSupportFragment.MainFragmentAdapterProvider {
    method public abstract android.support.v17.leanback.app.BrowseSupportFragment.MainFragmentAdapter getMainFragmentAdapter();
  }

  public static final class BrowseSupportFragment.MainFragmentAdapterRegistry {
    ctor public BrowseSupportFragment.MainFragmentAdapterRegistry();
    method public android.support.v4.app.Fragment createFragment(java.lang.Object);
    method public void registerFragment(java.lang.Class, android.support.v17.leanback.app.BrowseSupportFragment.FragmentFactory);
  }

  public static class BrowseSupportFragment.MainFragmentRowsAdapter<T extends android.support.v4.app.Fragment> {
    ctor public BrowseSupportFragment.MainFragmentRowsAdapter(T);
    method public android.support.v17.leanback.widget.RowPresenter.ViewHolder findRowViewHolderByPosition(int);
    method public final T getFragment();
    method public int getSelectedPosition();
    method public void setAdapter(android.support.v17.leanback.widget.ObjectAdapter);
    method public void setOnItemViewClickedListener(android.support.v17.leanback.widget.OnItemViewClickedListener);
    method public void setOnItemViewSelectedListener(android.support.v17.leanback.widget.OnItemViewSelectedListener);
    method public void setSelectedPosition(int, boolean, android.support.v17.leanback.widget.Presenter.ViewHolderTask);
    method public void setSelectedPosition(int, boolean);
  }

  public static abstract interface BrowseSupportFragment.MainFragmentRowsAdapterProvider {
    method public abstract android.support.v17.leanback.app.BrowseSupportFragment.MainFragmentRowsAdapter getMainFragmentRowsAdapter();
  }

  public class DetailsFragment extends android.support.v17.leanback.app.BaseFragment {
    ctor public DetailsFragment();
    method public android.support.v17.leanback.widget.ObjectAdapter getAdapter();
    method public android.support.v17.leanback.widget.BaseOnItemViewClickedListener getOnItemViewClickedListener();
    method public android.support.v17.leanback.widget.DetailsParallax getParallax();
    method public android.support.v17.leanback.app.RowsFragment getRowsFragment();
    method protected deprecated android.view.View inflateTitle(android.view.LayoutInflater, android.view.ViewGroup, android.os.Bundle);
    method protected void onSetDetailsOverviewRowStatus(android.support.v17.leanback.widget.FullWidthDetailsOverviewRowPresenter, android.support.v17.leanback.widget.FullWidthDetailsOverviewRowPresenter.ViewHolder, int, int, int);
    method protected void onSetRowStatus(android.support.v17.leanback.widget.RowPresenter, android.support.v17.leanback.widget.RowPresenter.ViewHolder, int, int, int);
    method public void setAdapter(android.support.v17.leanback.widget.ObjectAdapter);
    method public void setOnItemViewClickedListener(android.support.v17.leanback.widget.BaseOnItemViewClickedListener);
    method public void setOnItemViewSelectedListener(android.support.v17.leanback.widget.BaseOnItemViewSelectedListener);
    method public void setSelectedPosition(int);
    method public void setSelectedPosition(int, boolean);
    method protected void setupDetailsOverviewRowPresenter(android.support.v17.leanback.widget.FullWidthDetailsOverviewRowPresenter);
    method protected void setupPresenter(android.support.v17.leanback.widget.Presenter);
  }

  public class DetailsFragmentBackgroundController {
    ctor public DetailsFragmentBackgroundController(android.support.v17.leanback.app.DetailsFragment);
    method public boolean canNavigateToVideoFragment();
    method public void enableParallax();
    method public void enableParallax(android.graphics.drawable.Drawable, android.graphics.drawable.Drawable, android.support.v17.leanback.widget.ParallaxTarget.PropertyValuesHolderTarget);
    method public final android.app.Fragment findOrCreateVideoFragment();
    method public final android.graphics.drawable.Drawable getBottomDrawable();
    method public final android.graphics.Bitmap getCoverBitmap();
    method public final android.graphics.drawable.Drawable getCoverDrawable();
    method public final int getParallaxDrawableMaxOffset();
    method public final android.support.v17.leanback.media.PlaybackGlue getPlaybackGlue();
    method public final int getSolidColor();
    method public android.support.v17.leanback.media.PlaybackGlueHost onCreateGlueHost();
    method public android.app.Fragment onCreateVideoFragment();
    method public final void setCoverBitmap(android.graphics.Bitmap);
    method public final void setParallaxDrawableMaxOffset(int);
    method public final void setSolidColor(int);
    method public void setupVideoPlayback(android.support.v17.leanback.media.PlaybackGlue);
    method public final void switchToRows();
    method public final void switchToVideo();
  }

  public class DetailsSupportFragment extends android.support.v17.leanback.app.BaseSupportFragment {
    ctor public DetailsSupportFragment();
    method public android.support.v17.leanback.widget.ObjectAdapter getAdapter();
    method public android.support.v17.leanback.widget.BaseOnItemViewClickedListener getOnItemViewClickedListener();
    method public android.support.v17.leanback.widget.DetailsParallax getParallax();
    method public android.support.v17.leanback.app.RowsSupportFragment getRowsSupportFragment();
    method protected deprecated android.view.View inflateTitle(android.view.LayoutInflater, android.view.ViewGroup, android.os.Bundle);
    method protected void onSetDetailsOverviewRowStatus(android.support.v17.leanback.widget.FullWidthDetailsOverviewRowPresenter, android.support.v17.leanback.widget.FullWidthDetailsOverviewRowPresenter.ViewHolder, int, int, int);
    method protected void onSetRowStatus(android.support.v17.leanback.widget.RowPresenter, android.support.v17.leanback.widget.RowPresenter.ViewHolder, int, int, int);
    method public void setAdapter(android.support.v17.leanback.widget.ObjectAdapter);
    method public void setOnItemViewClickedListener(android.support.v17.leanback.widget.BaseOnItemViewClickedListener);
    method public void setOnItemViewSelectedListener(android.support.v17.leanback.widget.BaseOnItemViewSelectedListener);
    method public void setSelectedPosition(int);
    method public void setSelectedPosition(int, boolean);
    method protected void setupDetailsOverviewRowPresenter(android.support.v17.leanback.widget.FullWidthDetailsOverviewRowPresenter);
    method protected void setupPresenter(android.support.v17.leanback.widget.Presenter);
  }

  public class DetailsSupportFragmentBackgroundController {
    ctor public DetailsSupportFragmentBackgroundController(android.support.v17.leanback.app.DetailsSupportFragment);
    method public boolean canNavigateToVideoSupportFragment();
    method public void enableParallax();
    method public void enableParallax(android.graphics.drawable.Drawable, android.graphics.drawable.Drawable, android.support.v17.leanback.widget.ParallaxTarget.PropertyValuesHolderTarget);
    method public final android.support.v4.app.Fragment findOrCreateVideoSupportFragment();
    method public final android.graphics.drawable.Drawable getBottomDrawable();
    method public final android.graphics.Bitmap getCoverBitmap();
    method public final android.graphics.drawable.Drawable getCoverDrawable();
    method public final int getParallaxDrawableMaxOffset();
    method public final android.support.v17.leanback.media.PlaybackGlue getPlaybackGlue();
    method public final int getSolidColor();
    method public android.support.v17.leanback.media.PlaybackGlueHost onCreateGlueHost();
    method public android.support.v4.app.Fragment onCreateVideoSupportFragment();
    method public final void setCoverBitmap(android.graphics.Bitmap);
    method public final void setParallaxDrawableMaxOffset(int);
    method public final void setSolidColor(int);
    method public void setupVideoPlayback(android.support.v17.leanback.media.PlaybackGlue);
    method public final void switchToRows();
    method public final void switchToVideo();
  }

  public class ErrorFragment extends android.support.v17.leanback.app.BrandedFragment {
    ctor public ErrorFragment();
    method public android.graphics.drawable.Drawable getBackgroundDrawable();
    method public android.view.View.OnClickListener getButtonClickListener();
    method public java.lang.String getButtonText();
    method public android.graphics.drawable.Drawable getImageDrawable();
    method public java.lang.CharSequence getMessage();
    method public boolean isBackgroundTranslucent();
    method public void setBackgroundDrawable(android.graphics.drawable.Drawable);
    method public void setButtonClickListener(android.view.View.OnClickListener);
    method public void setButtonText(java.lang.String);
    method public void setDefaultBackground(boolean);
    method public void setImageDrawable(android.graphics.drawable.Drawable);
    method public void setMessage(java.lang.CharSequence);
  }

  public class ErrorSupportFragment extends android.support.v17.leanback.app.BrandedSupportFragment {
    ctor public ErrorSupportFragment();
    method public android.graphics.drawable.Drawable getBackgroundDrawable();
    method public android.view.View.OnClickListener getButtonClickListener();
    method public java.lang.String getButtonText();
    method public android.graphics.drawable.Drawable getImageDrawable();
    method public java.lang.CharSequence getMessage();
    method public boolean isBackgroundTranslucent();
    method public void setBackgroundDrawable(android.graphics.drawable.Drawable);
    method public void setButtonClickListener(android.view.View.OnClickListener);
    method public void setButtonText(java.lang.String);
    method public void setDefaultBackground(boolean);
    method public void setImageDrawable(android.graphics.drawable.Drawable);
    method public void setMessage(java.lang.CharSequence);
  }

  public class GuidedStepFragment extends android.app.Fragment {
    ctor public GuidedStepFragment();
    method public static int add(android.app.FragmentManager, android.support.v17.leanback.app.GuidedStepFragment);
    method public static int add(android.app.FragmentManager, android.support.v17.leanback.app.GuidedStepFragment, int);
    method public static int addAsRoot(android.app.Activity, android.support.v17.leanback.app.GuidedStepFragment, int);
    method public void collapseAction(boolean);
    method public void collapseSubActions();
    method public void expandAction(android.support.v17.leanback.widget.GuidedAction, boolean);
    method public void expandSubActions(android.support.v17.leanback.widget.GuidedAction);
    method public android.support.v17.leanback.widget.GuidedAction findActionById(long);
    method public int findActionPositionById(long);
    method public android.support.v17.leanback.widget.GuidedAction findButtonActionById(long);
    method public int findButtonActionPositionById(long);
    method public void finishGuidedStepFragments();
    method public android.view.View getActionItemView(int);
    method public java.util.List<android.support.v17.leanback.widget.GuidedAction> getActions();
    method public android.view.View getButtonActionItemView(int);
    method public java.util.List<android.support.v17.leanback.widget.GuidedAction> getButtonActions();
    method public static android.support.v17.leanback.app.GuidedStepFragment getCurrentGuidedStepFragment(android.app.FragmentManager);
    method public android.support.v17.leanback.widget.GuidanceStylist getGuidanceStylist();
    method public android.support.v17.leanback.widget.GuidedActionsStylist getGuidedActionsStylist();
    method public android.support.v17.leanback.widget.GuidedActionsStylist getGuidedButtonActionsStylist();
    method public int getSelectedActionPosition();
    method public int getSelectedButtonActionPosition();
    method public int getUiStyle();
    method public boolean isExpanded();
    method public boolean isFocusOutEndAllowed();
    method public boolean isFocusOutStartAllowed();
    method public boolean isSubActionsExpanded();
    method public void notifyActionChanged(int);
    method public void notifyButtonActionChanged(int);
    method protected void onAddSharedElementTransition(android.app.FragmentTransaction, android.support.v17.leanback.app.GuidedStepFragment);
    method public void onCreateActions(java.util.List<android.support.v17.leanback.widget.GuidedAction>, android.os.Bundle);
    method public android.support.v17.leanback.widget.GuidedActionsStylist onCreateActionsStylist();
    method public android.view.View onCreateBackgroundView(android.view.LayoutInflater, android.view.ViewGroup, android.os.Bundle);
    method public void onCreateButtonActions(java.util.List<android.support.v17.leanback.widget.GuidedAction>, android.os.Bundle);
    method public android.support.v17.leanback.widget.GuidedActionsStylist onCreateButtonActionsStylist();
    method public android.support.v17.leanback.widget.GuidanceStylist.Guidance onCreateGuidance(android.os.Bundle);
    method public android.support.v17.leanback.widget.GuidanceStylist onCreateGuidanceStylist();
    method public void onGuidedActionClicked(android.support.v17.leanback.widget.GuidedAction);
    method public void onGuidedActionEditCanceled(android.support.v17.leanback.widget.GuidedAction);
    method public deprecated void onGuidedActionEdited(android.support.v17.leanback.widget.GuidedAction);
    method public long onGuidedActionEditedAndProceed(android.support.v17.leanback.widget.GuidedAction);
    method public void onGuidedActionFocused(android.support.v17.leanback.widget.GuidedAction);
    method protected void onProvideFragmentTransitions();
    method public int onProvideTheme();
    method public boolean onSubGuidedActionClicked(android.support.v17.leanback.widget.GuidedAction);
    method public void openInEditMode(android.support.v17.leanback.widget.GuidedAction);
    method public void popBackStackToGuidedStepFragment(java.lang.Class, int);
    method public void setActions(java.util.List<android.support.v17.leanback.widget.GuidedAction>);
    method public void setButtonActions(java.util.List<android.support.v17.leanback.widget.GuidedAction>);
    method public void setSelectedActionPosition(int);
    method public void setSelectedButtonActionPosition(int);
    method public void setUiStyle(int);
    field public static final java.lang.String EXTRA_UI_STYLE = "uiStyle";
    field public static final int UI_STYLE_ACTIVITY_ROOT = 2; // 0x2
    field public static final deprecated int UI_STYLE_DEFAULT = 0; // 0x0
    field public static final int UI_STYLE_ENTRANCE = 1; // 0x1
    field public static final int UI_STYLE_REPLACE = 0; // 0x0
  }

  public class GuidedStepSupportFragment extends android.support.v4.app.Fragment {
    ctor public GuidedStepSupportFragment();
    method public static int add(android.support.v4.app.FragmentManager, android.support.v17.leanback.app.GuidedStepSupportFragment);
    method public static int add(android.support.v4.app.FragmentManager, android.support.v17.leanback.app.GuidedStepSupportFragment, int);
    method public static int addAsRoot(android.support.v4.app.FragmentActivity, android.support.v17.leanback.app.GuidedStepSupportFragment, int);
    method public void collapseAction(boolean);
    method public void collapseSubActions();
    method public void expandAction(android.support.v17.leanback.widget.GuidedAction, boolean);
    method public void expandSubActions(android.support.v17.leanback.widget.GuidedAction);
    method public android.support.v17.leanback.widget.GuidedAction findActionById(long);
    method public int findActionPositionById(long);
    method public android.support.v17.leanback.widget.GuidedAction findButtonActionById(long);
    method public int findButtonActionPositionById(long);
    method public void finishGuidedStepSupportFragments();
    method public android.view.View getActionItemView(int);
    method public java.util.List<android.support.v17.leanback.widget.GuidedAction> getActions();
    method public android.view.View getButtonActionItemView(int);
    method public java.util.List<android.support.v17.leanback.widget.GuidedAction> getButtonActions();
    method public static android.support.v17.leanback.app.GuidedStepSupportFragment getCurrentGuidedStepSupportFragment(android.support.v4.app.FragmentManager);
    method public android.support.v17.leanback.widget.GuidanceStylist getGuidanceStylist();
    method public android.support.v17.leanback.widget.GuidedActionsStylist getGuidedActionsStylist();
    method public android.support.v17.leanback.widget.GuidedActionsStylist getGuidedButtonActionsStylist();
    method public int getSelectedActionPosition();
    method public int getSelectedButtonActionPosition();
    method public int getUiStyle();
    method public boolean isExpanded();
    method public boolean isFocusOutEndAllowed();
    method public boolean isFocusOutStartAllowed();
    method public boolean isSubActionsExpanded();
    method public void notifyActionChanged(int);
    method public void notifyButtonActionChanged(int);
    method protected void onAddSharedElementTransition(android.support.v4.app.FragmentTransaction, android.support.v17.leanback.app.GuidedStepSupportFragment);
    method public void onCreateActions(java.util.List<android.support.v17.leanback.widget.GuidedAction>, android.os.Bundle);
    method public android.support.v17.leanback.widget.GuidedActionsStylist onCreateActionsStylist();
    method public android.view.View onCreateBackgroundView(android.view.LayoutInflater, android.view.ViewGroup, android.os.Bundle);
    method public void onCreateButtonActions(java.util.List<android.support.v17.leanback.widget.GuidedAction>, android.os.Bundle);
    method public android.support.v17.leanback.widget.GuidedActionsStylist onCreateButtonActionsStylist();
    method public android.support.v17.leanback.widget.GuidanceStylist.Guidance onCreateGuidance(android.os.Bundle);
    method public android.support.v17.leanback.widget.GuidanceStylist onCreateGuidanceStylist();
    method public void onGuidedActionClicked(android.support.v17.leanback.widget.GuidedAction);
    method public void onGuidedActionEditCanceled(android.support.v17.leanback.widget.GuidedAction);
    method public deprecated void onGuidedActionEdited(android.support.v17.leanback.widget.GuidedAction);
    method public long onGuidedActionEditedAndProceed(android.support.v17.leanback.widget.GuidedAction);
    method public void onGuidedActionFocused(android.support.v17.leanback.widget.GuidedAction);
    method protected void onProvideFragmentTransitions();
    method public int onProvideTheme();
    method public boolean onSubGuidedActionClicked(android.support.v17.leanback.widget.GuidedAction);
    method public void openInEditMode(android.support.v17.leanback.widget.GuidedAction);
    method public void popBackStackToGuidedStepSupportFragment(java.lang.Class, int);
    method public void setActions(java.util.List<android.support.v17.leanback.widget.GuidedAction>);
    method public void setButtonActions(java.util.List<android.support.v17.leanback.widget.GuidedAction>);
    method public void setSelectedActionPosition(int);
    method public void setSelectedButtonActionPosition(int);
    method public void setUiStyle(int);
    field public static final java.lang.String EXTRA_UI_STYLE = "uiStyle";
    field public static final int UI_STYLE_ACTIVITY_ROOT = 2; // 0x2
    field public static final deprecated int UI_STYLE_DEFAULT = 0; // 0x0
    field public static final int UI_STYLE_ENTRANCE = 1; // 0x1
    field public static final int UI_STYLE_REPLACE = 0; // 0x0
  }

  public class HeadersFragment extends android.support.v17.leanback.app.BaseRowFragment {
    ctor public HeadersFragment();
    method public boolean isScrolling();
    method public void setOnHeaderClickedListener(android.support.v17.leanback.app.HeadersFragment.OnHeaderClickedListener);
    method public void setOnHeaderViewSelectedListener(android.support.v17.leanback.app.HeadersFragment.OnHeaderViewSelectedListener);
  }

  public static abstract interface HeadersFragment.OnHeaderClickedListener {
    method public abstract void onHeaderClicked(android.support.v17.leanback.widget.RowHeaderPresenter.ViewHolder, android.support.v17.leanback.widget.Row);
  }

  public static abstract interface HeadersFragment.OnHeaderViewSelectedListener {
    method public abstract void onHeaderSelected(android.support.v17.leanback.widget.RowHeaderPresenter.ViewHolder, android.support.v17.leanback.widget.Row);
  }

  public class HeadersSupportFragment extends android.support.v17.leanback.app.BaseRowSupportFragment {
    ctor public HeadersSupportFragment();
    method public boolean isScrolling();
    method public void setOnHeaderClickedListener(android.support.v17.leanback.app.HeadersSupportFragment.OnHeaderClickedListener);
    method public void setOnHeaderViewSelectedListener(android.support.v17.leanback.app.HeadersSupportFragment.OnHeaderViewSelectedListener);
  }

  public static abstract interface HeadersSupportFragment.OnHeaderClickedListener {
    method public abstract void onHeaderClicked(android.support.v17.leanback.widget.RowHeaderPresenter.ViewHolder, android.support.v17.leanback.widget.Row);
  }

  public static abstract interface HeadersSupportFragment.OnHeaderViewSelectedListener {
    method public abstract void onHeaderSelected(android.support.v17.leanback.widget.RowHeaderPresenter.ViewHolder, android.support.v17.leanback.widget.Row);
  }

  public abstract deprecated class MediaControllerGlue extends android.support.v17.leanback.app.PlaybackControlGlue {
    ctor public MediaControllerGlue(android.content.Context, android.support.v17.leanback.app.PlaybackOverlayFragment, int[]);
    ctor public MediaControllerGlue(android.content.Context, android.support.v17.leanback.app.PlaybackOverlayFragment, int[], int[]);
    method public void attachToMediaController(android.support.v4.media.session.MediaControllerCompat);
    method public void detach();
    method public int getCurrentPosition();
    method public int getCurrentSpeedId();
    method public android.graphics.drawable.Drawable getMediaArt();
    method public final android.support.v4.media.session.MediaControllerCompat getMediaController();
    method public int getMediaDuration();
    method public java.lang.CharSequence getMediaSubtitle();
    method public java.lang.CharSequence getMediaTitle();
    method public long getSupportedActions();
    method public boolean hasValidMedia();
    method public boolean isMediaPlaying();
    method protected void pausePlayback();
    method protected void skipToNext();
    method protected void skipToPrevious();
    method protected void startPlayback(int);
  }

  public abstract class OnboardingFragment extends android.app.Fragment {
    ctor public OnboardingFragment();
    method public final int getArrowBackgroundColor();
    method public final int getArrowColor();
    method protected final int getCurrentPageIndex();
    method public final int getDescriptionViewTextColor();
    method public final int getDotBackgroundColor();
    method public final int getIconResourceId();
    method public final int getLogoResourceId();
    method protected abstract int getPageCount();
    method protected abstract java.lang.CharSequence getPageDescription(int);
    method protected abstract java.lang.CharSequence getPageTitle(int);
    method public final java.lang.CharSequence getStartButtonText();
    method public final int getTitleViewTextColor();
    method protected final boolean isLogoAnimationFinished();
    method protected void moveToNextPage();
    method protected void moveToPreviousPage();
    method protected abstract android.view.View onCreateBackgroundView(android.view.LayoutInflater, android.view.ViewGroup);
    method protected abstract android.view.View onCreateContentView(android.view.LayoutInflater, android.view.ViewGroup);
    method protected android.animation.Animator onCreateDescriptionAnimator();
    method protected android.animation.Animator onCreateEnterAnimation();
    method protected abstract android.view.View onCreateForegroundView(android.view.LayoutInflater, android.view.ViewGroup);
    method protected android.animation.Animator onCreateLogoAnimation();
    method protected android.animation.Animator onCreateTitleAnimator();
    method protected void onFinishFragment();
    method protected void onLogoAnimationFinished();
    method protected void onPageChanged(int, int);
    method public int onProvideTheme();
    method public void setArrowBackgroundColor(int);
    method public void setArrowColor(int);
    method public void setDescriptionViewTextColor(int);
    method public void setDotBackgroundColor(int);
    method public final void setIconResouceId(int);
    method public final void setLogoResourceId(int);
    method public void setStartButtonText(java.lang.CharSequence);
    method public void setTitleViewTextColor(int);
    method protected final void startEnterAnimation(boolean);
  }

  public abstract class OnboardingSupportFragment extends android.support.v4.app.Fragment {
    ctor public OnboardingSupportFragment();
    method public final int getArrowBackgroundColor();
    method public final int getArrowColor();
    method protected final int getCurrentPageIndex();
    method public final int getDescriptionViewTextColor();
    method public final int getDotBackgroundColor();
    method public final int getIconResourceId();
    method public final int getLogoResourceId();
    method protected abstract int getPageCount();
    method protected abstract java.lang.CharSequence getPageDescription(int);
    method protected abstract java.lang.CharSequence getPageTitle(int);
    method public final java.lang.CharSequence getStartButtonText();
    method public final int getTitleViewTextColor();
    method protected final boolean isLogoAnimationFinished();
    method protected void moveToNextPage();
    method protected void moveToPreviousPage();
    method protected abstract android.view.View onCreateBackgroundView(android.view.LayoutInflater, android.view.ViewGroup);
    method protected abstract android.view.View onCreateContentView(android.view.LayoutInflater, android.view.ViewGroup);
    method protected android.animation.Animator onCreateDescriptionAnimator();
    method protected android.animation.Animator onCreateEnterAnimation();
    method protected abstract android.view.View onCreateForegroundView(android.view.LayoutInflater, android.view.ViewGroup);
    method protected android.animation.Animator onCreateLogoAnimation();
    method protected android.animation.Animator onCreateTitleAnimator();
    method protected void onFinishFragment();
    method protected void onLogoAnimationFinished();
    method protected void onPageChanged(int, int);
    method public int onProvideTheme();
    method public void setArrowBackgroundColor(int);
    method public void setArrowColor(int);
    method public void setDescriptionViewTextColor(int);
    method public void setDotBackgroundColor(int);
    method public final void setIconResouceId(int);
    method public final void setLogoResourceId(int);
    method public void setStartButtonText(java.lang.CharSequence);
    method public void setTitleViewTextColor(int);
    method protected final void startEnterAnimation(boolean);
  }

  public abstract deprecated class PlaybackControlGlue extends android.support.v17.leanback.media.PlaybackControlGlue {
    ctor public PlaybackControlGlue(android.content.Context, int[]);
    ctor public PlaybackControlGlue(android.content.Context, int[], int[]);
    ctor public PlaybackControlGlue(android.content.Context, android.support.v17.leanback.app.PlaybackOverlayFragment, int[]);
    ctor public PlaybackControlGlue(android.content.Context, android.support.v17.leanback.app.PlaybackOverlayFragment, int[], int[]);
    method public android.support.v17.leanback.widget.PlaybackControlsRowPresenter createControlsRowAndPresenter();
    method protected android.support.v17.leanback.widget.SparseArrayObjectAdapter createPrimaryActionsAdapter(android.support.v17.leanback.widget.PresenterSelector);
    method public android.support.v17.leanback.app.PlaybackOverlayFragment getFragment();
    method public deprecated android.support.v17.leanback.widget.OnItemViewClickedListener getOnItemViewClickedListener();
    method public final void next();
    method protected void onRowChanged(android.support.v17.leanback.widget.PlaybackControlsRow);
    method public final void pause();
    method protected deprecated void pausePlayback();
    method public final void play(int);
    method public final void previous();
    method public deprecated void setOnItemViewClickedListener(android.support.v17.leanback.widget.OnItemViewClickedListener);
    method protected deprecated void skipToNext();
    method protected deprecated void skipToPrevious();
    method protected deprecated void startPlayback(int);
  }

  public static abstract deprecated interface PlaybackControlGlue.InputEventHandler {
    method public abstract boolean handleInputEvent(android.view.InputEvent);
  }

  public abstract deprecated class PlaybackControlSupportGlue extends android.support.v17.leanback.app.PlaybackControlGlue {
    ctor public PlaybackControlSupportGlue(android.content.Context, int[]);
    ctor public PlaybackControlSupportGlue(android.content.Context, int[], int[]);
    ctor public PlaybackControlSupportGlue(android.content.Context, android.support.v17.leanback.app.PlaybackOverlaySupportFragment, int[]);
    ctor public PlaybackControlSupportGlue(android.content.Context, android.support.v17.leanback.app.PlaybackOverlaySupportFragment, int[], int[]);
    field public static final int ACTION_CUSTOM_LEFT_FIRST = 1; // 0x1
    field public static final int ACTION_CUSTOM_RIGHT_FIRST = 4096; // 0x1000
    field public static final int ACTION_FAST_FORWARD = 128; // 0x80
    field public static final int ACTION_PLAY_PAUSE = 64; // 0x40
    field public static final int ACTION_REWIND = 32; // 0x20
    field public static final int ACTION_SKIP_TO_NEXT = 256; // 0x100
    field public static final int ACTION_SKIP_TO_PREVIOUS = 16; // 0x10
    field public static final int PLAYBACK_SPEED_FAST_L0 = 10; // 0xa
    field public static final int PLAYBACK_SPEED_FAST_L1 = 11; // 0xb
    field public static final int PLAYBACK_SPEED_FAST_L2 = 12; // 0xc
    field public static final int PLAYBACK_SPEED_FAST_L3 = 13; // 0xd
    field public static final int PLAYBACK_SPEED_FAST_L4 = 14; // 0xe
    field public static final int PLAYBACK_SPEED_INVALID = -1; // 0xffffffff
    field public static final int PLAYBACK_SPEED_NORMAL = 1; // 0x1
    field public static final int PLAYBACK_SPEED_PAUSED = 0; // 0x0
  }

  public class PlaybackFragment extends android.app.Fragment {
    ctor public PlaybackFragment();
    method public deprecated void fadeOut();
    method public android.support.v17.leanback.widget.ObjectAdapter getAdapter();
    method public int getBackgroundType();
    method public android.support.v17.leanback.app.ProgressBarManager getProgressBarManager();
    method public void hideControlsOverlay(boolean);
    method public boolean isControlsOverlayAutoHideEnabled();
    method public boolean isControlsOverlayVisible();
    method public deprecated boolean isFadingEnabled();
    method public void notifyPlaybackRowChanged();
    method protected void onBufferingStateChanged(boolean);
    method protected void onError(int, java.lang.CharSequence);
    method protected void onVideoSizeChanged(int, int);
    method public void setAdapter(android.support.v17.leanback.widget.ObjectAdapter);
    method public void setBackgroundType(int);
    method public void setControlsOverlayAutoHideEnabled(boolean);
    method public deprecated void setFadingEnabled(boolean);
    method public void setHostCallback(android.support.v17.leanback.media.PlaybackGlueHost.HostCallback);
    method public void setOnItemViewClickedListener(android.support.v17.leanback.widget.BaseOnItemViewClickedListener);
    method public void setOnItemViewSelectedListener(android.support.v17.leanback.widget.BaseOnItemViewSelectedListener);
    method public final void setOnKeyInterceptListener(android.view.View.OnKeyListener);
    method public void setOnPlaybackItemViewClickedListener(android.support.v17.leanback.widget.BaseOnItemViewClickedListener);
    method public void setPlaybackRow(android.support.v17.leanback.widget.Row);
    method public void setPlaybackRowPresenter(android.support.v17.leanback.widget.PlaybackRowPresenter);
    method public void setPlaybackSeekUiClient(android.support.v17.leanback.widget.PlaybackSeekUi.Client);
    method public void setSelectedPosition(int);
    method public void setSelectedPosition(int, boolean);
    method public void showControlsOverlay(boolean);
    method public void tickle();
    field public static final int BG_DARK = 1; // 0x1
    field public static final int BG_LIGHT = 2; // 0x2
    field public static final int BG_NONE = 0; // 0x0
  }

  public class PlaybackFragmentGlueHost extends android.support.v17.leanback.media.PlaybackGlueHost implements android.support.v17.leanback.widget.PlaybackSeekUi {
    ctor public PlaybackFragmentGlueHost(android.support.v17.leanback.app.PlaybackFragment);
    method public void fadeOut();
    method public void setPlaybackSeekUiClient(android.support.v17.leanback.widget.PlaybackSeekUi.Client);
  }

  public deprecated class PlaybackOverlayFragment extends android.support.v17.leanback.app.DetailsFragment {
    ctor public PlaybackOverlayFragment();
    method public void fadeOut();
    method public int getBackgroundType();
    method public final android.support.v17.leanback.app.PlaybackControlGlue.InputEventHandler getEventHandler();
    method public android.support.v17.leanback.app.PlaybackOverlayFragment.OnFadeCompleteListener getFadeCompleteListener();
    method public final deprecated android.support.v17.leanback.app.PlaybackOverlayFragment.InputEventHandler getInputEventHandler();
    method public boolean isFadingEnabled();
    method public void setBackgroundType(int);
    method public final void setEventHandler(android.support.v17.leanback.app.PlaybackControlGlue.InputEventHandler);
    method public void setFadeCompleteListener(android.support.v17.leanback.app.PlaybackOverlayFragment.OnFadeCompleteListener);
    method public void setFadingEnabled(boolean);
    method public final deprecated void setInputEventHandler(android.support.v17.leanback.app.PlaybackOverlayFragment.InputEventHandler);
    method public void tickle();
    field public static final int BG_DARK = 1; // 0x1
    field public static final int BG_LIGHT = 2; // 0x2
    field public static final int BG_NONE = 0; // 0x0
  }

  public static abstract deprecated interface PlaybackOverlayFragment.InputEventHandler implements android.support.v17.leanback.app.PlaybackControlGlue.InputEventHandler {
  }

  public static class PlaybackOverlayFragment.OnFadeCompleteListener {
    ctor public PlaybackOverlayFragment.OnFadeCompleteListener();
    method public void onFadeInComplete();
    method public void onFadeOutComplete();
  }

  public deprecated class PlaybackOverlaySupportFragment extends android.support.v17.leanback.app.DetailsSupportFragment {
    ctor public PlaybackOverlaySupportFragment();
    method public void fadeOut();
    method public int getBackgroundType();
    method public final android.support.v17.leanback.app.PlaybackControlGlue.InputEventHandler getEventHandler();
    method public android.support.v17.leanback.app.PlaybackOverlaySupportFragment.OnFadeCompleteListener getFadeCompleteListener();
    method public final deprecated android.support.v17.leanback.app.PlaybackOverlaySupportFragment.InputEventHandler getInputEventHandler();
    method public boolean isFadingEnabled();
    method public void setBackgroundType(int);
    method public final void setEventHandler(android.support.v17.leanback.app.PlaybackControlGlue.InputEventHandler);
    method public void setFadeCompleteListener(android.support.v17.leanback.app.PlaybackOverlaySupportFragment.OnFadeCompleteListener);
    method public void setFadingEnabled(boolean);
    method public final deprecated void setInputEventHandler(android.support.v17.leanback.app.PlaybackOverlaySupportFragment.InputEventHandler);
    method public void tickle();
    field public static final int BG_DARK = 1; // 0x1
    field public static final int BG_LIGHT = 2; // 0x2
    field public static final int BG_NONE = 0; // 0x0
  }

  public static abstract deprecated interface PlaybackOverlaySupportFragment.InputEventHandler implements android.support.v17.leanback.app.PlaybackControlGlue.InputEventHandler {
  }

  public static class PlaybackOverlaySupportFragment.OnFadeCompleteListener {
    ctor public PlaybackOverlaySupportFragment.OnFadeCompleteListener();
    method public void onFadeInComplete();
    method public void onFadeOutComplete();
  }

  public class PlaybackSupportFragment extends android.support.v4.app.Fragment {
    ctor public PlaybackSupportFragment();
    method public deprecated void fadeOut();
    method public android.support.v17.leanback.widget.ObjectAdapter getAdapter();
    method public int getBackgroundType();
    method public android.support.v17.leanback.app.ProgressBarManager getProgressBarManager();
    method public void hideControlsOverlay(boolean);
    method public boolean isControlsOverlayAutoHideEnabled();
    method public boolean isControlsOverlayVisible();
    method public deprecated boolean isFadingEnabled();
    method public void notifyPlaybackRowChanged();
    method protected void onBufferingStateChanged(boolean);
    method protected void onError(int, java.lang.CharSequence);
    method protected void onVideoSizeChanged(int, int);
    method public void setAdapter(android.support.v17.leanback.widget.ObjectAdapter);
    method public void setBackgroundType(int);
    method public void setControlsOverlayAutoHideEnabled(boolean);
    method public deprecated void setFadingEnabled(boolean);
    method public void setHostCallback(android.support.v17.leanback.media.PlaybackGlueHost.HostCallback);
    method public void setOnItemViewClickedListener(android.support.v17.leanback.widget.BaseOnItemViewClickedListener);
    method public void setOnItemViewSelectedListener(android.support.v17.leanback.widget.BaseOnItemViewSelectedListener);
    method public final void setOnKeyInterceptListener(android.view.View.OnKeyListener);
    method public void setOnPlaybackItemViewClickedListener(android.support.v17.leanback.widget.BaseOnItemViewClickedListener);
    method public void setPlaybackRow(android.support.v17.leanback.widget.Row);
    method public void setPlaybackRowPresenter(android.support.v17.leanback.widget.PlaybackRowPresenter);
    method public void setPlaybackSeekUiClient(android.support.v17.leanback.widget.PlaybackSeekUi.Client);
    method public void setSelectedPosition(int);
    method public void setSelectedPosition(int, boolean);
    method public void showControlsOverlay(boolean);
    method public void tickle();
    field public static final int BG_DARK = 1; // 0x1
    field public static final int BG_LIGHT = 2; // 0x2
    field public static final int BG_NONE = 0; // 0x0
  }

  public class PlaybackSupportFragmentGlueHost extends android.support.v17.leanback.media.PlaybackGlueHost implements android.support.v17.leanback.widget.PlaybackSeekUi {
    ctor public PlaybackSupportFragmentGlueHost(android.support.v17.leanback.app.PlaybackSupportFragment);
    method public void fadeOut();
    method public void setPlaybackSeekUiClient(android.support.v17.leanback.widget.PlaybackSeekUi.Client);
  }

  public final class ProgressBarManager {
    ctor public ProgressBarManager();
    method public void disableProgressBar();
    method public void enableProgressBar();
    method public long getInitialDelay();
    method public void hide();
    method public void setInitialDelay(long);
    method public void setProgressBarView(android.view.View);
    method public void setRootView(android.view.ViewGroup);
    method public void show();
  }

  public class RowsFragment extends android.support.v17.leanback.app.BaseRowFragment implements android.support.v17.leanback.app.BrowseFragment.MainFragmentAdapterProvider android.support.v17.leanback.app.BrowseFragment.MainFragmentRowsAdapterProvider {
    ctor public RowsFragment();
    method public deprecated void enableRowScaling(boolean);
    method protected android.support.v17.leanback.widget.VerticalGridView findGridViewFromRoot(android.view.View);
    method public android.support.v17.leanback.widget.RowPresenter.ViewHolder findRowViewHolderByPosition(int);
    method public android.support.v17.leanback.app.BrowseFragment.MainFragmentAdapter getMainFragmentAdapter();
    method public android.support.v17.leanback.app.BrowseFragment.MainFragmentRowsAdapter getMainFragmentRowsAdapter();
    method public android.support.v17.leanback.widget.BaseOnItemViewClickedListener getOnItemViewClickedListener();
    method public android.support.v17.leanback.widget.BaseOnItemViewSelectedListener getOnItemViewSelectedListener();
    method public android.support.v17.leanback.widget.RowPresenter.ViewHolder getRowViewHolder(int);
    method public boolean isScrolling();
    method public void setEntranceTransitionState(boolean);
    method public void setExpand(boolean);
    method public void setOnItemViewClickedListener(android.support.v17.leanback.widget.BaseOnItemViewClickedListener);
    method public void setOnItemViewSelectedListener(android.support.v17.leanback.widget.BaseOnItemViewSelectedListener);
    method public void setSelectedPosition(int, boolean, android.support.v17.leanback.widget.Presenter.ViewHolderTask);
  }

  public static class RowsFragment.MainFragmentAdapter extends android.support.v17.leanback.app.BrowseFragment.MainFragmentAdapter {
    ctor public RowsFragment.MainFragmentAdapter(android.support.v17.leanback.app.RowsFragment);
  }

  public static class RowsFragment.MainFragmentRowsAdapter extends android.support.v17.leanback.app.BrowseFragment.MainFragmentRowsAdapter {
    ctor public RowsFragment.MainFragmentRowsAdapter(android.support.v17.leanback.app.RowsFragment);
  }

  public class RowsSupportFragment extends android.support.v17.leanback.app.BaseRowSupportFragment implements android.support.v17.leanback.app.BrowseSupportFragment.MainFragmentAdapterProvider android.support.v17.leanback.app.BrowseSupportFragment.MainFragmentRowsAdapterProvider {
    ctor public RowsSupportFragment();
    method public deprecated void enableRowScaling(boolean);
    method protected android.support.v17.leanback.widget.VerticalGridView findGridViewFromRoot(android.view.View);
    method public android.support.v17.leanback.widget.RowPresenter.ViewHolder findRowViewHolderByPosition(int);
    method public android.support.v17.leanback.app.BrowseSupportFragment.MainFragmentAdapter getMainFragmentAdapter();
    method public android.support.v17.leanback.app.BrowseSupportFragment.MainFragmentRowsAdapter getMainFragmentRowsAdapter();
    method public android.support.v17.leanback.widget.BaseOnItemViewClickedListener getOnItemViewClickedListener();
    method public android.support.v17.leanback.widget.BaseOnItemViewSelectedListener getOnItemViewSelectedListener();
    method public android.support.v17.leanback.widget.RowPresenter.ViewHolder getRowViewHolder(int);
    method public boolean isScrolling();
    method public void setEntranceTransitionState(boolean);
    method public void setExpand(boolean);
    method public void setOnItemViewClickedListener(android.support.v17.leanback.widget.BaseOnItemViewClickedListener);
    method public void setOnItemViewSelectedListener(android.support.v17.leanback.widget.BaseOnItemViewSelectedListener);
    method public void setSelectedPosition(int, boolean, android.support.v17.leanback.widget.Presenter.ViewHolderTask);
  }

  public static class RowsSupportFragment.MainFragmentAdapter extends android.support.v17.leanback.app.BrowseSupportFragment.MainFragmentAdapter {
    ctor public RowsSupportFragment.MainFragmentAdapter(android.support.v17.leanback.app.RowsSupportFragment);
  }

  public static class RowsSupportFragment.MainFragmentRowsAdapter extends android.support.v17.leanback.app.BrowseSupportFragment.MainFragmentRowsAdapter {
    ctor public RowsSupportFragment.MainFragmentRowsAdapter(android.support.v17.leanback.app.RowsSupportFragment);
  }

  public class SearchFragment extends android.app.Fragment {
    ctor public SearchFragment();
    method public static android.os.Bundle createArgs(android.os.Bundle, java.lang.String);
    method public static android.os.Bundle createArgs(android.os.Bundle, java.lang.String, java.lang.String);
    method public void displayCompletions(java.util.List<java.lang.String>);
    method public void displayCompletions(android.view.inputmethod.CompletionInfo[]);
    method public android.graphics.drawable.Drawable getBadgeDrawable();
    method public android.content.Intent getRecognizerIntent();
    method public android.support.v17.leanback.app.RowsFragment getRowsFragment();
    method public java.lang.String getTitle();
    method public static android.support.v17.leanback.app.SearchFragment newInstance(java.lang.String);
    method public void setBadgeDrawable(android.graphics.drawable.Drawable);
    method public void setOnItemViewClickedListener(android.support.v17.leanback.widget.OnItemViewClickedListener);
    method public void setOnItemViewSelectedListener(android.support.v17.leanback.widget.OnItemViewSelectedListener);
    method public void setSearchAffordanceColors(android.support.v17.leanback.widget.SearchOrbView.Colors);
    method public void setSearchAffordanceColorsInListening(android.support.v17.leanback.widget.SearchOrbView.Colors);
    method public void setSearchQuery(java.lang.String, boolean);
    method public void setSearchQuery(android.content.Intent, boolean);
    method public void setSearchResultProvider(android.support.v17.leanback.app.SearchFragment.SearchResultProvider);
    method public void setSpeechRecognitionCallback(android.support.v17.leanback.widget.SpeechRecognitionCallback);
    method public void setTitle(java.lang.String);
    method public void startRecognition();
  }

  public static abstract interface SearchFragment.SearchResultProvider {
    method public abstract android.support.v17.leanback.widget.ObjectAdapter getResultsAdapter();
    method public abstract boolean onQueryTextChange(java.lang.String);
    method public abstract boolean onQueryTextSubmit(java.lang.String);
  }

  public class SearchSupportFragment extends android.support.v4.app.Fragment {
    ctor public SearchSupportFragment();
    method public static android.os.Bundle createArgs(android.os.Bundle, java.lang.String);
    method public static android.os.Bundle createArgs(android.os.Bundle, java.lang.String, java.lang.String);
    method public void displayCompletions(java.util.List<java.lang.String>);
    method public void displayCompletions(android.view.inputmethod.CompletionInfo[]);
    method public android.graphics.drawable.Drawable getBadgeDrawable();
    method public android.content.Intent getRecognizerIntent();
    method public android.support.v17.leanback.app.RowsSupportFragment getRowsSupportFragment();
    method public java.lang.String getTitle();
    method public static android.support.v17.leanback.app.SearchSupportFragment newInstance(java.lang.String);
    method public void setBadgeDrawable(android.graphics.drawable.Drawable);
    method public void setOnItemViewClickedListener(android.support.v17.leanback.widget.OnItemViewClickedListener);
    method public void setOnItemViewSelectedListener(android.support.v17.leanback.widget.OnItemViewSelectedListener);
    method public void setSearchAffordanceColors(android.support.v17.leanback.widget.SearchOrbView.Colors);
    method public void setSearchAffordanceColorsInListening(android.support.v17.leanback.widget.SearchOrbView.Colors);
    method public void setSearchQuery(java.lang.String, boolean);
    method public void setSearchQuery(android.content.Intent, boolean);
    method public void setSearchResultProvider(android.support.v17.leanback.app.SearchSupportFragment.SearchResultProvider);
    method public void setSpeechRecognitionCallback(android.support.v17.leanback.widget.SpeechRecognitionCallback);
    method public void setTitle(java.lang.String);
    method public void startRecognition();
  }

  public static abstract interface SearchSupportFragment.SearchResultProvider {
    method public abstract android.support.v17.leanback.widget.ObjectAdapter getResultsAdapter();
    method public abstract boolean onQueryTextChange(java.lang.String);
    method public abstract boolean onQueryTextSubmit(java.lang.String);
  }

  public class VerticalGridFragment extends android.support.v17.leanback.app.BaseFragment {
    ctor public VerticalGridFragment();
    method public android.support.v17.leanback.widget.ObjectAdapter getAdapter();
    method public android.support.v17.leanback.widget.VerticalGridPresenter getGridPresenter();
    method public android.support.v17.leanback.widget.OnItemViewClickedListener getOnItemViewClickedListener();
    method public void setAdapter(android.support.v17.leanback.widget.ObjectAdapter);
    method public void setGridPresenter(android.support.v17.leanback.widget.VerticalGridPresenter);
    method public void setOnItemViewClickedListener(android.support.v17.leanback.widget.OnItemViewClickedListener);
    method public void setOnItemViewSelectedListener(android.support.v17.leanback.widget.OnItemViewSelectedListener);
    method public void setSelectedPosition(int);
  }

  public class VerticalGridSupportFragment extends android.support.v17.leanback.app.BaseSupportFragment {
    ctor public VerticalGridSupportFragment();
    method public android.support.v17.leanback.widget.ObjectAdapter getAdapter();
    method public android.support.v17.leanback.widget.VerticalGridPresenter getGridPresenter();
    method public android.support.v17.leanback.widget.OnItemViewClickedListener getOnItemViewClickedListener();
    method public void setAdapter(android.support.v17.leanback.widget.ObjectAdapter);
    method public void setGridPresenter(android.support.v17.leanback.widget.VerticalGridPresenter);
    method public void setOnItemViewClickedListener(android.support.v17.leanback.widget.OnItemViewClickedListener);
    method public void setOnItemViewSelectedListener(android.support.v17.leanback.widget.OnItemViewSelectedListener);
    method public void setSelectedPosition(int);
  }

  public class VideoFragment extends android.support.v17.leanback.app.PlaybackFragment {
    ctor public VideoFragment();
    method public android.view.SurfaceView getSurfaceView();
    method public void setSurfaceHolderCallback(android.view.SurfaceHolder.Callback);
  }

  public class VideoFragmentGlueHost extends android.support.v17.leanback.app.PlaybackFragmentGlueHost implements android.support.v17.leanback.media.SurfaceHolderGlueHost {
    ctor public VideoFragmentGlueHost(android.support.v17.leanback.app.VideoFragment);
    method public void setSurfaceHolderCallback(android.view.SurfaceHolder.Callback);
  }

  public class VideoSupportFragment extends android.support.v17.leanback.app.PlaybackSupportFragment {
    ctor public VideoSupportFragment();
    method public android.view.SurfaceView getSurfaceView();
    method public void setSurfaceHolderCallback(android.view.SurfaceHolder.Callback);
  }

  public class VideoSupportFragmentGlueHost extends android.support.v17.leanback.app.PlaybackSupportFragmentGlueHost implements android.support.v17.leanback.media.SurfaceHolderGlueHost {
    ctor public VideoSupportFragmentGlueHost(android.support.v17.leanback.app.VideoSupportFragment);
    method public void setSurfaceHolderCallback(android.view.SurfaceHolder.Callback);
  }

}

package android.support.v17.leanback.database {

  public abstract class CursorMapper {
    ctor public CursorMapper();
    method protected abstract java.lang.Object bind(android.database.Cursor);
    method protected abstract void bindColumns(android.database.Cursor);
    method public java.lang.Object convert(android.database.Cursor);
  }

}

package android.support.v17.leanback.graphics {

  public class BoundsRule {
    ctor public BoundsRule();
    ctor public BoundsRule(android.support.v17.leanback.graphics.BoundsRule);
    method public void calculateBounds(android.graphics.Rect, android.graphics.Rect);
    field public android.support.v17.leanback.graphics.BoundsRule.ValueRule bottom;
    field public android.support.v17.leanback.graphics.BoundsRule.ValueRule left;
    field public android.support.v17.leanback.graphics.BoundsRule.ValueRule right;
    field public android.support.v17.leanback.graphics.BoundsRule.ValueRule top;
  }

  public static final class BoundsRule.ValueRule {
    method public static android.support.v17.leanback.graphics.BoundsRule.ValueRule absoluteValue(int);
    method public int getAbsoluteValue();
    method public float getFraction();
    method public static android.support.v17.leanback.graphics.BoundsRule.ValueRule inheritFromParent(float);
    method public static android.support.v17.leanback.graphics.BoundsRule.ValueRule inheritFromParentWithOffset(float, int);
    method public void setAbsoluteValue(int);
    method public void setFraction(float);
  }

  public final class ColorFilterCache {
    method public static android.support.v17.leanback.graphics.ColorFilterCache getColorFilterCache(int);
    method public android.graphics.ColorFilter getFilterForLevel(float);
  }

  public final class ColorFilterDimmer {
    method public void applyFilterToView(android.view.View);
    method public static android.support.v17.leanback.graphics.ColorFilterDimmer create(android.support.v17.leanback.graphics.ColorFilterCache, float, float);
    method public static android.support.v17.leanback.graphics.ColorFilterDimmer createDefault(android.content.Context);
    method public android.graphics.ColorFilter getColorFilter();
    method public android.graphics.Paint getPaint();
    method public void setActiveLevel(float);
  }

  public final class ColorOverlayDimmer {
    method public int applyToColor(int);
    method public static android.support.v17.leanback.graphics.ColorOverlayDimmer createColorOverlayDimmer(int, float, float);
    method public static android.support.v17.leanback.graphics.ColorOverlayDimmer createDefault(android.content.Context);
    method public void drawColorOverlay(android.graphics.Canvas, android.view.View, boolean);
    method public int getAlpha();
    method public float getAlphaFloat();
    method public android.graphics.Paint getPaint();
    method public boolean needsDraw();
    method public void setActiveLevel(float);
  }

  public class CompositeDrawable extends android.graphics.drawable.Drawable implements android.graphics.drawable.Drawable.Callback {
    ctor public CompositeDrawable();
    method public void addChildDrawable(android.graphics.drawable.Drawable);
    method public void draw(android.graphics.Canvas);
    method public android.support.v17.leanback.graphics.CompositeDrawable.ChildDrawable getChildAt(int);
    method public int getChildCount();
    method public android.graphics.drawable.Drawable getDrawable(int);
    method public int getOpacity();
    method public void invalidateDrawable(android.graphics.drawable.Drawable);
    method public void removeChild(int);
    method public void removeDrawable(android.graphics.drawable.Drawable);
    method public void scheduleDrawable(android.graphics.drawable.Drawable, java.lang.Runnable, long);
    method public void setAlpha(int);
    method public void setChildDrawableAt(int, android.graphics.drawable.Drawable);
    method public void setColorFilter(android.graphics.ColorFilter);
    method public void unscheduleDrawable(android.graphics.drawable.Drawable, java.lang.Runnable);
  }

  public static final class CompositeDrawable.ChildDrawable {
    ctor public CompositeDrawable.ChildDrawable(android.graphics.drawable.Drawable, android.support.v17.leanback.graphics.CompositeDrawable);
    method public android.support.v17.leanback.graphics.BoundsRule getBoundsRule();
    method public android.graphics.drawable.Drawable getDrawable();
    method public void recomputeBounds();
    field public static final android.util.Property<android.support.v17.leanback.graphics.CompositeDrawable.ChildDrawable, java.lang.Integer> BOTTOM_ABSOLUTE;
    field public static final android.util.Property<android.support.v17.leanback.graphics.CompositeDrawable.ChildDrawable, java.lang.Float> BOTTOM_FRACTION;
    field public static final android.util.Property<android.support.v17.leanback.graphics.CompositeDrawable.ChildDrawable, java.lang.Integer> LEFT_ABSOLUTE;
    field public static final android.util.Property<android.support.v17.leanback.graphics.CompositeDrawable.ChildDrawable, java.lang.Float> LEFT_FRACTION;
    field public static final android.util.Property<android.support.v17.leanback.graphics.CompositeDrawable.ChildDrawable, java.lang.Integer> RIGHT_ABSOLUTE;
    field public static final android.util.Property<android.support.v17.leanback.graphics.CompositeDrawable.ChildDrawable, java.lang.Float> RIGHT_FRACTION;
    field public static final android.util.Property<android.support.v17.leanback.graphics.CompositeDrawable.ChildDrawable, java.lang.Integer> TOP_ABSOLUTE;
    field public static final android.util.Property<android.support.v17.leanback.graphics.CompositeDrawable.ChildDrawable, java.lang.Float> TOP_FRACTION;
  }

  public class FitWidthBitmapDrawable extends android.graphics.drawable.Drawable {
    ctor public FitWidthBitmapDrawable();
    method public void draw(android.graphics.Canvas);
    method public android.graphics.Bitmap getBitmap();
    method public int getOpacity();
    method public android.graphics.Rect getSource();
    method public int getVerticalOffset();
    method public void setAlpha(int);
    method public void setBitmap(android.graphics.Bitmap);
    method public void setColorFilter(android.graphics.ColorFilter);
    method public void setSource(android.graphics.Rect);
    method public void setVerticalOffset(int);
    field public static final android.util.Property<android.support.v17.leanback.graphics.FitWidthBitmapDrawable, java.lang.Integer> PROPERTY_VERTICAL_OFFSET;
  }

}

package android.support.v17.leanback.media {

  public abstract class MediaControllerGlue extends android.support.v17.leanback.media.PlaybackControlGlue {
    ctor public MediaControllerGlue(android.content.Context, int[], int[]);
    method public void attachToMediaController(android.support.v4.media.session.MediaControllerCompat);
    method public void detach();
    method public int getCurrentPosition();
    method public int getCurrentSpeedId();
    method public android.graphics.drawable.Drawable getMediaArt();
    method public final android.support.v4.media.session.MediaControllerCompat getMediaController();
    method public int getMediaDuration();
    method public java.lang.CharSequence getMediaSubtitle();
    method public java.lang.CharSequence getMediaTitle();
    method public long getSupportedActions();
    method public boolean hasValidMedia();
    method public boolean isMediaPlaying();
  }

  public class MediaPlayerAdapter extends android.support.v17.leanback.media.PlayerAdapter {
    ctor public MediaPlayerAdapter(android.content.Context);
    method protected boolean onError(int, int);
    method protected boolean onInfo(int, int);
    method protected void onSeekComplete();
    method public void pause();
    method public void play();
    method public void release();
    method public void reset();
    method public boolean setDataSource(android.net.Uri);
  }

  public class PlaybackBannerControlGlue<T extends android.support.v17.leanback.media.PlayerAdapter> extends android.support.v17.leanback.media.PlaybackBaseControlGlue {
    ctor public PlaybackBannerControlGlue(android.content.Context, int[], T);
    ctor public PlaybackBannerControlGlue(android.content.Context, int[], int[], T);
    method public int[] getFastForwardSpeeds();
    method public int[] getRewindSpeeds();
    method public long getSupportedActions();
    method public void onActionClicked(android.support.v17.leanback.widget.Action);
    method protected android.support.v17.leanback.widget.PlaybackRowPresenter onCreateRowPresenter();
    method public boolean onKey(android.view.View, int, android.view.KeyEvent);
    field public static final int ACTION_CUSTOM_LEFT_FIRST = 1; // 0x1
    field public static final int ACTION_CUSTOM_RIGHT_FIRST = 4096; // 0x1000
    field public static final int ACTION_FAST_FORWARD = 128; // 0x80
    field public static final int ACTION_PLAY_PAUSE = 64; // 0x40
    field public static final int ACTION_REWIND = 32; // 0x20
    field public static final int ACTION_SKIP_TO_NEXT = 256; // 0x100
    field public static final int ACTION_SKIP_TO_PREVIOUS = 16; // 0x10
    field public static final int PLAYBACK_SPEED_FAST_L0 = 10; // 0xa
    field public static final int PLAYBACK_SPEED_FAST_L1 = 11; // 0xb
    field public static final int PLAYBACK_SPEED_FAST_L2 = 12; // 0xc
    field public static final int PLAYBACK_SPEED_FAST_L3 = 13; // 0xd
    field public static final int PLAYBACK_SPEED_FAST_L4 = 14; // 0xe
    field public static final int PLAYBACK_SPEED_INVALID = -1; // 0xffffffff
    field public static final int PLAYBACK_SPEED_NORMAL = 1; // 0x1
    field public static final int PLAYBACK_SPEED_PAUSED = 0; // 0x0
  }

  public abstract class PlaybackBaseControlGlue<T extends android.support.v17.leanback.media.PlayerAdapter> extends android.support.v17.leanback.media.PlaybackGlue implements android.support.v17.leanback.widget.OnActionClickedListener android.view.View.OnKeyListener {
    ctor public PlaybackBaseControlGlue(android.content.Context, T);
    method public android.graphics.drawable.Drawable getArt();
    method public final long getBufferedPosition();
    method public android.support.v17.leanback.widget.PlaybackControlsRow getControlsRow();
    method public long getCurrentPosition();
    method public final long getDuration();
    method public android.support.v17.leanback.widget.PlaybackRowPresenter getPlaybackRowPresenter();
    method public final T getPlayerAdapter();
    method public java.lang.CharSequence getSubtitle();
    method public java.lang.CharSequence getTitle();
    method public boolean isControlsOverlayAutoHideEnabled();
    method public final boolean isPlaying();
    method public final boolean isPrepared();
    method protected static void notifyItemChanged(android.support.v17.leanback.widget.ArrayObjectAdapter, java.lang.Object);
    method public abstract void onActionClicked(android.support.v17.leanback.widget.Action);
    method protected void onCreatePrimaryActions(android.support.v17.leanback.widget.ArrayObjectAdapter);
    method protected abstract android.support.v17.leanback.widget.PlaybackRowPresenter onCreateRowPresenter();
    method protected void onCreateSecondaryActions(android.support.v17.leanback.widget.ArrayObjectAdapter);
    method public abstract boolean onKey(android.view.View, int, android.view.KeyEvent);
    method protected void onPlayCompleted();
    method protected void onPlayStateChanged();
    method protected void onPreparedStateChanged();
    method public final void seekTo(long);
    method public void setArt(android.graphics.drawable.Drawable);
    method public void setControlsOverlayAutoHideEnabled(boolean);
    method public void setControlsRow(android.support.v17.leanback.widget.PlaybackControlsRow);
    method public void setPlaybackRowPresenter(android.support.v17.leanback.widget.PlaybackRowPresenter);
    method public void setSubtitle(java.lang.CharSequence);
    method public void setTitle(java.lang.CharSequence);
  }

  public abstract class PlaybackControlGlue extends android.support.v17.leanback.media.PlaybackGlue implements android.support.v17.leanback.widget.OnActionClickedListener android.view.View.OnKeyListener {
    ctor public PlaybackControlGlue(android.content.Context, int[]);
    ctor public PlaybackControlGlue(android.content.Context, int[], int[]);
    method public void enableProgressUpdating(boolean);
    method public android.support.v17.leanback.widget.PlaybackControlsRow getControlsRow();
    method public deprecated android.support.v17.leanback.widget.PlaybackControlsRowPresenter getControlsRowPresenter();
    method public abstract int getCurrentPosition();
    method public abstract int getCurrentSpeedId();
    method public int[] getFastForwardSpeeds();
    method public abstract android.graphics.drawable.Drawable getMediaArt();
    method public abstract int getMediaDuration();
    method public abstract java.lang.CharSequence getMediaSubtitle();
    method public abstract java.lang.CharSequence getMediaTitle();
    method public android.support.v17.leanback.widget.PlaybackRowPresenter getPlaybackRowPresenter();
    method public int[] getRewindSpeeds();
    method public abstract long getSupportedActions();
    method public int getUpdatePeriod();
    method public abstract boolean hasValidMedia();
    method public boolean isFadingEnabled();
    method public abstract boolean isMediaPlaying();
    method public void onActionClicked(android.support.v17.leanback.widget.Action);
    method protected void onCreateControlsRowAndPresenter();
    method protected void onCreatePrimaryActions(android.support.v17.leanback.widget.SparseArrayObjectAdapter);
    method protected void onCreateSecondaryActions(android.support.v17.leanback.widget.ArrayObjectAdapter);
    method public boolean onKey(android.view.View, int, android.view.KeyEvent);
    method protected void onMetadataChanged();
    method protected void onStateChanged();
    method public void play(int);
    method public final void play();
    method public void setControlsRow(android.support.v17.leanback.widget.PlaybackControlsRow);
    method public deprecated void setControlsRowPresenter(android.support.v17.leanback.widget.PlaybackControlsRowPresenter);
    method public void setFadingEnabled(boolean);
    method public void setPlaybackRowPresenter(android.support.v17.leanback.widget.PlaybackRowPresenter);
    method public void updateProgress();
    field public static final int ACTION_CUSTOM_LEFT_FIRST = 1; // 0x1
    field public static final int ACTION_CUSTOM_RIGHT_FIRST = 4096; // 0x1000
    field public static final int ACTION_FAST_FORWARD = 128; // 0x80
    field public static final int ACTION_PLAY_PAUSE = 64; // 0x40
    field public static final int ACTION_REWIND = 32; // 0x20
    field public static final int ACTION_SKIP_TO_NEXT = 256; // 0x100
    field public static final int ACTION_SKIP_TO_PREVIOUS = 16; // 0x10
    field public static final int PLAYBACK_SPEED_FAST_L0 = 10; // 0xa
    field public static final int PLAYBACK_SPEED_FAST_L1 = 11; // 0xb
    field public static final int PLAYBACK_SPEED_FAST_L2 = 12; // 0xc
    field public static final int PLAYBACK_SPEED_FAST_L3 = 13; // 0xd
    field public static final int PLAYBACK_SPEED_FAST_L4 = 14; // 0xe
    field public static final int PLAYBACK_SPEED_INVALID = -1; // 0xffffffff
    field public static final int PLAYBACK_SPEED_NORMAL = 1; // 0x1
    field public static final int PLAYBACK_SPEED_PAUSED = 0; // 0x0
  }

  public abstract class PlaybackGlue {
    ctor public PlaybackGlue(android.content.Context);
    method public void addPlayerCallback(android.support.v17.leanback.media.PlaybackGlue.PlayerCallback);
    method public android.content.Context getContext();
    method public android.support.v17.leanback.media.PlaybackGlueHost getHost();
    method protected java.util.List<android.support.v17.leanback.media.PlaybackGlue.PlayerCallback> getPlayerCallbacks();
    method public boolean isPlaying();
    method public boolean isPrepared();
    method public deprecated boolean isReadyForPlayback();
    method public void next();
    method protected void onAttachedToHost(android.support.v17.leanback.media.PlaybackGlueHost);
    method protected void onDetachedFromHost();
    method protected void onHostPause();
    method protected void onHostResume();
    method protected void onHostStart();
    method protected void onHostStop();
    method public void pause();
    method public void play();
    method public void previous();
    method public void removePlayerCallback(android.support.v17.leanback.media.PlaybackGlue.PlayerCallback);
    method public final void setHost(android.support.v17.leanback.media.PlaybackGlueHost);
    method public deprecated void setPlayerCallback(android.support.v17.leanback.media.PlaybackGlue.PlayerCallback);
  }

  public static abstract class PlaybackGlue.PlayerCallback {
    ctor public PlaybackGlue.PlayerCallback();
    method public void onPlayCompleted(android.support.v17.leanback.media.PlaybackGlue);
    method public void onPlayStateChanged(android.support.v17.leanback.media.PlaybackGlue);
    method public void onPreparedStateChanged(android.support.v17.leanback.media.PlaybackGlue);
    method public deprecated void onReadyForPlayback();
  }

  public abstract class PlaybackGlueHost {
    ctor public PlaybackGlueHost();
    method public deprecated void fadeOut();
    method public android.support.v17.leanback.media.PlaybackGlueHost.PlayerCallback getPlayerCallback();
    method public void hideControlsOverlay(boolean);
    method public boolean isControlsOverlayAutoHideEnabled();
    method public boolean isControlsOverlayVisible();
    method public void notifyPlaybackRowChanged();
    method public void setControlsOverlayAutoHideEnabled(boolean);
    method public deprecated void setFadingEnabled(boolean);
    method public void setHostCallback(android.support.v17.leanback.media.PlaybackGlueHost.HostCallback);
    method public void setOnActionClickedListener(android.support.v17.leanback.widget.OnActionClickedListener);
    method public void setOnKeyInterceptListener(android.view.View.OnKeyListener);
    method public void setPlaybackRow(android.support.v17.leanback.widget.Row);
    method public void setPlaybackRowPresenter(android.support.v17.leanback.widget.PlaybackRowPresenter);
    method public void showControlsOverlay(boolean);
  }

  public static abstract class PlaybackGlueHost.HostCallback {
    ctor public PlaybackGlueHost.HostCallback();
    method public void onHostDestroy();
    method public void onHostPause();
    method public void onHostResume();
    method public void onHostStart();
    method public void onHostStop();
  }

  public static class PlaybackGlueHost.PlayerCallback {
    ctor public PlaybackGlueHost.PlayerCallback();
    method public void onBufferingStateChanged(boolean);
    method public void onError(int, java.lang.CharSequence);
    method public void onVideoSizeChanged(int, int);
  }

  public class PlaybackTransportControlGlue<T extends android.support.v17.leanback.media.PlayerAdapter> extends android.support.v17.leanback.media.PlaybackBaseControlGlue {
    ctor public PlaybackTransportControlGlue(android.content.Context, T);
    method public final android.support.v17.leanback.widget.PlaybackSeekDataProvider getSeekProvider();
    method public final boolean isSeekEnabled();
    method public void onActionClicked(android.support.v17.leanback.widget.Action);
    method protected android.support.v17.leanback.widget.PlaybackRowPresenter onCreateRowPresenter();
    method public boolean onKey(android.view.View, int, android.view.KeyEvent);
    method public final void setSeekEnabled(boolean);
    method public final void setSeekProvider(android.support.v17.leanback.widget.PlaybackSeekDataProvider);
  }

  public abstract class PlayerAdapter {
    ctor public PlayerAdapter();
    method public long getBufferedPosition();
    method public final android.support.v17.leanback.media.PlayerAdapter.Callback getCallback();
    method public long getCurrentPosition();
    method public long getDuration();
    method public boolean isPlaying();
    method public boolean isPrepared();
    method public void onAttachedToHost(android.support.v17.leanback.media.PlaybackGlueHost);
    method public void onDetachedFromHost();
    method public abstract void pause();
    method public abstract void play();
    method public void seekTo(long);
    method public final void setCallback(android.support.v17.leanback.media.PlayerAdapter.Callback);
    method public void setProgressUpdatingEnabled(boolean);
  }

  public static class PlayerAdapter.Callback {
    ctor public PlayerAdapter.Callback();
    method public void onBufferedPositionChanged(android.support.v17.leanback.media.PlayerAdapter);
    method public void onBufferingStateChanged(android.support.v17.leanback.media.PlayerAdapter, boolean);
    method public void onCurrentPositionChanged(android.support.v17.leanback.media.PlayerAdapter);
    method public void onDurationChanged(android.support.v17.leanback.media.PlayerAdapter);
    method public void onError(android.support.v17.leanback.media.PlayerAdapter, int, java.lang.String);
    method public void onPlayCompleted(android.support.v17.leanback.media.PlayerAdapter);
    method public void onPlayStateChanged(android.support.v17.leanback.media.PlayerAdapter);
    method public void onPreparedStateChanged(android.support.v17.leanback.media.PlayerAdapter);
    method public void onVideoSizeChanged(android.support.v17.leanback.media.PlayerAdapter, int, int);
  }

  public abstract interface SurfaceHolderGlueHost {
    method public abstract void setSurfaceHolderCallback(android.view.SurfaceHolder.Callback);
  }

}

package android.support.v17.leanback.system {

  public class Settings {
    method public boolean getBoolean(java.lang.String);
    method public static android.support.v17.leanback.system.Settings getInstance(android.content.Context);
    method public void setBoolean(java.lang.String, boolean);
    field public static final java.lang.String PREFER_STATIC_SHADOWS = "PREFER_STATIC_SHADOWS";
  }

}

package android.support.v17.leanback.widget {

  public abstract class AbstractDetailsDescriptionPresenter extends android.support.v17.leanback.widget.Presenter {
    ctor public AbstractDetailsDescriptionPresenter();
    method protected abstract void onBindDescription(android.support.v17.leanback.widget.AbstractDetailsDescriptionPresenter.ViewHolder, java.lang.Object);
    method public final void onBindViewHolder(android.support.v17.leanback.widget.Presenter.ViewHolder, java.lang.Object);
    method public final android.support.v17.leanback.widget.AbstractDetailsDescriptionPresenter.ViewHolder onCreateViewHolder(android.view.ViewGroup);
    method public void onUnbindViewHolder(android.support.v17.leanback.widget.Presenter.ViewHolder);
  }

  public static class AbstractDetailsDescriptionPresenter.ViewHolder extends android.support.v17.leanback.widget.Presenter.ViewHolder {
    ctor public AbstractDetailsDescriptionPresenter.ViewHolder(android.view.View);
    method public android.widget.TextView getBody();
    method public android.widget.TextView getSubtitle();
    method public android.widget.TextView getTitle();
  }

  public abstract class AbstractMediaItemPresenter extends android.support.v17.leanback.widget.RowPresenter {
    ctor public AbstractMediaItemPresenter();
    ctor public AbstractMediaItemPresenter(int);
    method protected android.support.v17.leanback.widget.RowPresenter.ViewHolder createRowViewHolder(android.view.ViewGroup);
    method public android.support.v17.leanback.widget.Presenter getActionPresenter();
    method protected int getMediaPlayState(java.lang.Object);
    method public int getThemeId();
    method public boolean hasMediaRowSeparator();
    method protected abstract void onBindMediaDetails(android.support.v17.leanback.widget.AbstractMediaItemPresenter.ViewHolder, java.lang.Object);
    method public void onBindMediaPlayState(android.support.v17.leanback.widget.AbstractMediaItemPresenter.ViewHolder);
    method protected void onBindRowActions(android.support.v17.leanback.widget.AbstractMediaItemPresenter.ViewHolder);
    method protected void onUnbindMediaDetails(android.support.v17.leanback.widget.AbstractMediaItemPresenter.ViewHolder);
    method public void onUnbindMediaPlayState(android.support.v17.leanback.widget.AbstractMediaItemPresenter.ViewHolder);
    method public void setActionPresenter(android.support.v17.leanback.widget.Presenter);
    method public void setBackgroundColor(int);
    method public void setHasMediaRowSeparator(boolean);
    method public void setThemeId(int);
    field public static final int PLAY_STATE_INITIAL = 0; // 0x0
    field public static final int PLAY_STATE_PAUSED = 1; // 0x1
    field public static final int PLAY_STATE_PLAYING = 2; // 0x2
  }

  public static class AbstractMediaItemPresenter.ViewHolder extends android.support.v17.leanback.widget.RowPresenter.ViewHolder {
    ctor public AbstractMediaItemPresenter.ViewHolder(android.view.View);
    method public android.view.ViewGroup getMediaItemActionsContainer();
    method public android.view.View getMediaItemDetailsView();
    method public android.widget.TextView getMediaItemDurationView();
    method public android.widget.TextView getMediaItemNameView();
    method public android.widget.TextView getMediaItemNumberView();
    method public android.widget.ViewFlipper getMediaItemNumberViewFlipper();
    method public android.view.View getMediaItemPausedView();
    method public android.view.View getMediaItemPlayingView();
    method public android.support.v17.leanback.widget.MultiActionsProvider.MultiAction[] getMediaItemRowActions();
    method public android.view.View getMediaItemRowSeparator();
    method public android.view.View getSelectorView();
    method public void notifyActionChanged(android.support.v17.leanback.widget.MultiActionsProvider.MultiAction);
    method public void notifyDetailsChanged();
    method public void notifyPlayStateChanged();
    method public void onBindRowActions();
    method public void setSelectedMediaItemNumberView(int);
  }

  public abstract class AbstractMediaListHeaderPresenter extends android.support.v17.leanback.widget.RowPresenter {
    ctor public AbstractMediaListHeaderPresenter(android.content.Context, int);
    ctor public AbstractMediaListHeaderPresenter();
    method protected android.support.v17.leanback.widget.RowPresenter.ViewHolder createRowViewHolder(android.view.ViewGroup);
    method protected abstract void onBindMediaListHeaderViewHolder(android.support.v17.leanback.widget.AbstractMediaListHeaderPresenter.ViewHolder, java.lang.Object);
    method public void setBackgroundColor(int);
  }

  public static class AbstractMediaListHeaderPresenter.ViewHolder extends android.support.v17.leanback.widget.RowPresenter.ViewHolder {
    ctor public AbstractMediaListHeaderPresenter.ViewHolder(android.view.View);
    method public android.widget.TextView getHeaderView();
  }

  public class Action {
    ctor public Action(long);
    ctor public Action(long, java.lang.CharSequence);
    ctor public Action(long, java.lang.CharSequence, java.lang.CharSequence);
    ctor public Action(long, java.lang.CharSequence, java.lang.CharSequence, android.graphics.drawable.Drawable);
    method public final void addKeyCode(int);
    method public final android.graphics.drawable.Drawable getIcon();
    method public final long getId();
    method public final java.lang.CharSequence getLabel1();
    method public final java.lang.CharSequence getLabel2();
    method public final void removeKeyCode(int);
    method public final boolean respondsToKeyCode(int);
    method public final void setIcon(android.graphics.drawable.Drawable);
    method public final void setId(long);
    method public final void setLabel1(java.lang.CharSequence);
    method public final void setLabel2(java.lang.CharSequence);
    field public static final long NO_ID = -1L; // 0xffffffffffffffffL
  }

  public class ArrayObjectAdapter extends android.support.v17.leanback.widget.ObjectAdapter {
    ctor public ArrayObjectAdapter(android.support.v17.leanback.widget.PresenterSelector);
    ctor public ArrayObjectAdapter(android.support.v17.leanback.widget.Presenter);
    ctor public ArrayObjectAdapter();
    method public void add(java.lang.Object);
    method public void add(int, java.lang.Object);
    method public void addAll(int, java.util.Collection);
    method public void clear();
    method public java.lang.Object get(int);
    method public int indexOf(java.lang.Object);
    method public void notifyArrayItemRangeChanged(int, int);
    method public boolean remove(java.lang.Object);
    method public int removeItems(int, int);
    method public void replace(int, java.lang.Object);
    method public int size();
    method public <E> java.util.List<E> unmodifiableList();
  }

  public class BaseCardView extends android.widget.FrameLayout {
    ctor public BaseCardView(android.content.Context);
    ctor public BaseCardView(android.content.Context, android.util.AttributeSet);
    ctor public BaseCardView(android.content.Context, android.util.AttributeSet, int);
    method protected android.support.v17.leanback.widget.BaseCardView.LayoutParams generateDefaultLayoutParams();
    method public android.support.v17.leanback.widget.BaseCardView.LayoutParams generateLayoutParams(android.util.AttributeSet);
    method protected android.support.v17.leanback.widget.BaseCardView.LayoutParams generateLayoutParams(android.view.ViewGroup.LayoutParams);
    method public int getCardType();
    method public deprecated int getExtraVisibility();
    method public int getInfoVisibility();
    method public boolean isSelectedAnimationDelayed();
    method public void setCardType(int);
    method public deprecated void setExtraVisibility(int);
    method public void setInfoVisibility(int);
    method public void setSelectedAnimationDelayed(boolean);
    field public static final int CARD_REGION_VISIBLE_ACTIVATED = 1; // 0x1
    field public static final int CARD_REGION_VISIBLE_ALWAYS = 0; // 0x0
    field public static final int CARD_REGION_VISIBLE_SELECTED = 2; // 0x2
    field public static final int CARD_TYPE_INFO_OVER = 1; // 0x1
    field public static final int CARD_TYPE_INFO_UNDER = 2; // 0x2
    field public static final int CARD_TYPE_INFO_UNDER_WITH_EXTRA = 3; // 0x3
    field public static final int CARD_TYPE_MAIN_ONLY = 0; // 0x0
  }

  public static class BaseCardView.LayoutParams extends android.widget.FrameLayout.LayoutParams {
    ctor public BaseCardView.LayoutParams(android.content.Context, android.util.AttributeSet);
    ctor public BaseCardView.LayoutParams(int, int);
    ctor public BaseCardView.LayoutParams(android.view.ViewGroup.LayoutParams);
    ctor public BaseCardView.LayoutParams(android.support.v17.leanback.widget.BaseCardView.LayoutParams);
    field public static final int VIEW_TYPE_EXTRA = 2; // 0x2
    field public static final int VIEW_TYPE_INFO = 1; // 0x1
    field public static final int VIEW_TYPE_MAIN = 0; // 0x0
    field public int viewType;
  }

  public abstract class BaseGridView extends android.support.v7.widget.RecyclerView {
    method public void addOnChildViewHolderSelectedListener(android.support.v17.leanback.widget.OnChildViewHolderSelectedListener);
    method public void animateIn();
    method public void animateOut();
    method public int getChildDrawingOrder(int, int);
    method public deprecated int getHorizontalMargin();
    method public int getHorizontalSpacing();
    method public int getInitialPrefetchItemCount();
    method public int getItemAlignmentOffset();
    method public float getItemAlignmentOffsetPercent();
    method public int getItemAlignmentViewId();
    method public android.support.v17.leanback.widget.BaseGridView.OnUnhandledKeyListener getOnUnhandledKeyListener();
    method public final int getSaveChildrenLimitNumber();
    method public final int getSaveChildrenPolicy();
    method public int getSelectedPosition();
    method public deprecated int getVerticalMargin();
    method public int getVerticalSpacing();
    method public void getViewSelectedOffsets(android.view.View, int[]);
    method public int getWindowAlignment();
    method public int getWindowAlignmentOffset();
    method public float getWindowAlignmentOffsetPercent();
    method public boolean hasPreviousViewInSameRow(int);
    method public boolean isChildLayoutAnimated();
    method public boolean isFocusDrawingOrderEnabled();
    method public final boolean isFocusSearchDisabled();
    method public boolean isItemAlignmentOffsetWithPadding();
    method public boolean isScrollEnabled();
    method public boolean isWindowAlignmentPreferKeyLineOverHighEdge();
    method public boolean isWindowAlignmentPreferKeyLineOverLowEdge();
    method public boolean onRequestFocusInDescendants(int, android.graphics.Rect);
    method public void removeOnChildViewHolderSelectedListener(android.support.v17.leanback.widget.OnChildViewHolderSelectedListener);
    method public void setAnimateChildLayout(boolean);
    method public void setChildrenVisibility(int);
    method public void setFocusDrawingOrderEnabled(boolean);
    method public final void setFocusSearchDisabled(boolean);
    method public void setGravity(int);
    method public void setHasOverlappingRendering(boolean);
    method public deprecated void setHorizontalMargin(int);
    method public void setHorizontalSpacing(int);
    method public void setInitialPrefetchItemCount(int);
    method public void setItemAlignmentOffset(int);
    method public void setItemAlignmentOffsetPercent(float);
    method public void setItemAlignmentOffsetWithPadding(boolean);
    method public void setItemAlignmentViewId(int);
    method public deprecated void setItemMargin(int);
    method public void setItemSpacing(int);
    method public void setLayoutEnabled(boolean);
    method public void setOnChildLaidOutListener(android.support.v17.leanback.widget.OnChildLaidOutListener);
    method public void setOnChildSelectedListener(android.support.v17.leanback.widget.OnChildSelectedListener);
    method public void setOnChildViewHolderSelectedListener(android.support.v17.leanback.widget.OnChildViewHolderSelectedListener);
    method public void setOnKeyInterceptListener(android.support.v17.leanback.widget.BaseGridView.OnKeyInterceptListener);
    method public void setOnMotionInterceptListener(android.support.v17.leanback.widget.BaseGridView.OnMotionInterceptListener);
    method public void setOnTouchInterceptListener(android.support.v17.leanback.widget.BaseGridView.OnTouchInterceptListener);
    method public void setOnUnhandledKeyListener(android.support.v17.leanback.widget.BaseGridView.OnUnhandledKeyListener);
    method public void setPruneChild(boolean);
    method public final void setSaveChildrenLimitNumber(int);
    method public final void setSaveChildrenPolicy(int);
    method public void setScrollEnabled(boolean);
    method public void setSelectedPosition(int);
    method public void setSelectedPosition(int, int);
    method public void setSelectedPosition(int, android.support.v17.leanback.widget.ViewHolderTask);
    method public void setSelectedPositionSmooth(int);
    method public void setSelectedPositionSmooth(int, android.support.v17.leanback.widget.ViewHolderTask);
    method public deprecated void setVerticalMargin(int);
    method public void setVerticalSpacing(int);
    method public void setWindowAlignment(int);
    method public void setWindowAlignmentOffset(int);
    method public void setWindowAlignmentOffsetPercent(float);
    method public void setWindowAlignmentPreferKeyLineOverHighEdge(boolean);
    method public void setWindowAlignmentPreferKeyLineOverLowEdge(boolean);
    field public static final float ITEM_ALIGN_OFFSET_PERCENT_DISABLED = -1.0f;
    field public static final int SAVE_ALL_CHILD = 3; // 0x3
    field public static final int SAVE_LIMITED_CHILD = 2; // 0x2
    field public static final int SAVE_NO_CHILD = 0; // 0x0
    field public static final int SAVE_ON_SCREEN_CHILD = 1; // 0x1
    field public static final int WINDOW_ALIGN_BOTH_EDGE = 3; // 0x3
    field public static final int WINDOW_ALIGN_HIGH_EDGE = 2; // 0x2
    field public static final int WINDOW_ALIGN_LOW_EDGE = 1; // 0x1
    field public static final int WINDOW_ALIGN_NO_EDGE = 0; // 0x0
    field public static final float WINDOW_ALIGN_OFFSET_PERCENT_DISABLED = -1.0f;
  }

  public static abstract interface BaseGridView.OnKeyInterceptListener {
    method public abstract boolean onInterceptKeyEvent(android.view.KeyEvent);
  }

  public static abstract interface BaseGridView.OnMotionInterceptListener {
    method public abstract boolean onInterceptMotionEvent(android.view.MotionEvent);
  }

  public static abstract interface BaseGridView.OnTouchInterceptListener {
    method public abstract boolean onInterceptTouchEvent(android.view.MotionEvent);
  }

  public static abstract interface BaseGridView.OnUnhandledKeyListener {
    method public abstract boolean onUnhandledKey(android.view.KeyEvent);
  }

  public abstract interface BaseOnItemViewClickedListener<T> {
    method public abstract void onItemClicked(android.support.v17.leanback.widget.Presenter.ViewHolder, java.lang.Object, android.support.v17.leanback.widget.RowPresenter.ViewHolder, T);
  }

  public abstract interface BaseOnItemViewSelectedListener<T> {
    method public abstract void onItemSelected(android.support.v17.leanback.widget.Presenter.ViewHolder, java.lang.Object, android.support.v17.leanback.widget.RowPresenter.ViewHolder, T);
  }

  public class BrowseFrameLayout extends android.widget.FrameLayout {
    ctor public BrowseFrameLayout(android.content.Context);
    ctor public BrowseFrameLayout(android.content.Context, android.util.AttributeSet);
    ctor public BrowseFrameLayout(android.content.Context, android.util.AttributeSet, int);
    method public android.support.v17.leanback.widget.BrowseFrameLayout.OnChildFocusListener getOnChildFocusListener();
    method public android.support.v17.leanback.widget.BrowseFrameLayout.OnFocusSearchListener getOnFocusSearchListener();
    method public void setOnChildFocusListener(android.support.v17.leanback.widget.BrowseFrameLayout.OnChildFocusListener);
    method public void setOnDispatchKeyListener(android.view.View.OnKeyListener);
    method public void setOnFocusSearchListener(android.support.v17.leanback.widget.BrowseFrameLayout.OnFocusSearchListener);
  }

  public static abstract interface BrowseFrameLayout.OnChildFocusListener {
    method public abstract void onRequestChildFocus(android.view.View, android.view.View);
    method public abstract boolean onRequestFocusInDescendants(int, android.graphics.Rect);
  }

  public static abstract interface BrowseFrameLayout.OnFocusSearchListener {
    method public abstract android.view.View onFocusSearch(android.view.View, int);
  }

  public final class ClassPresenterSelector extends android.support.v17.leanback.widget.PresenterSelector {
    ctor public ClassPresenterSelector();
    method public android.support.v17.leanback.widget.ClassPresenterSelector addClassPresenter(java.lang.Class<?>, android.support.v17.leanback.widget.Presenter);
    method public android.support.v17.leanback.widget.ClassPresenterSelector addClassPresenterSelector(java.lang.Class<?>, android.support.v17.leanback.widget.PresenterSelector);
    method public android.support.v17.leanback.widget.Presenter getPresenter(java.lang.Object);
  }

  public class ControlButtonPresenterSelector extends android.support.v17.leanback.widget.PresenterSelector {
    ctor public ControlButtonPresenterSelector();
    method public android.support.v17.leanback.widget.Presenter getPresenter(java.lang.Object);
    method public android.support.v17.leanback.widget.Presenter getPrimaryPresenter();
    method public android.support.v17.leanback.widget.Presenter getSecondaryPresenter();
  }

  public class CursorObjectAdapter extends android.support.v17.leanback.widget.ObjectAdapter {
    ctor public CursorObjectAdapter(android.support.v17.leanback.widget.PresenterSelector);
    ctor public CursorObjectAdapter(android.support.v17.leanback.widget.Presenter);
    ctor public CursorObjectAdapter();
    method public void changeCursor(android.database.Cursor);
    method public void close();
    method public java.lang.Object get(int);
    method public final android.database.Cursor getCursor();
    method public final android.support.v17.leanback.database.CursorMapper getMapper();
    method protected final void invalidateCache(int);
    method protected final void invalidateCache(int, int);
    method public boolean isClosed();
    method protected void onCursorChanged();
    method protected void onMapperChanged();
    method public final void setMapper(android.support.v17.leanback.database.CursorMapper);
    method public int size();
    method public android.database.Cursor swapCursor(android.database.Cursor);
  }

  public class DetailsOverviewLogoPresenter extends android.support.v17.leanback.widget.Presenter {
    ctor public DetailsOverviewLogoPresenter();
    method public boolean isBoundToImage(android.support.v17.leanback.widget.DetailsOverviewLogoPresenter.ViewHolder, android.support.v17.leanback.widget.DetailsOverviewRow);
    method public void onBindViewHolder(android.support.v17.leanback.widget.Presenter.ViewHolder, java.lang.Object);
    method public android.view.View onCreateView(android.view.ViewGroup);
    method public android.support.v17.leanback.widget.Presenter.ViewHolder onCreateViewHolder(android.view.ViewGroup);
    method public void onUnbindViewHolder(android.support.v17.leanback.widget.Presenter.ViewHolder);
    method public void setContext(android.support.v17.leanback.widget.DetailsOverviewLogoPresenter.ViewHolder, android.support.v17.leanback.widget.FullWidthDetailsOverviewRowPresenter.ViewHolder, android.support.v17.leanback.widget.FullWidthDetailsOverviewRowPresenter);
  }

  public static class DetailsOverviewLogoPresenter.ViewHolder extends android.support.v17.leanback.widget.Presenter.ViewHolder {
    ctor public DetailsOverviewLogoPresenter.ViewHolder(android.view.View);
    method public android.support.v17.leanback.widget.FullWidthDetailsOverviewRowPresenter getParentPresenter();
    method public android.support.v17.leanback.widget.FullWidthDetailsOverviewRowPresenter.ViewHolder getParentViewHolder();
    method public boolean isSizeFromDrawableIntrinsic();
    method public void setSizeFromDrawableIntrinsic(boolean);
    field protected android.support.v17.leanback.widget.FullWidthDetailsOverviewRowPresenter mParentPresenter;
    field protected android.support.v17.leanback.widget.FullWidthDetailsOverviewRowPresenter.ViewHolder mParentViewHolder;
  }

  public class DetailsOverviewRow extends android.support.v17.leanback.widget.Row {
    ctor public DetailsOverviewRow(java.lang.Object);
    method public final deprecated void addAction(android.support.v17.leanback.widget.Action);
    method public final deprecated void addAction(int, android.support.v17.leanback.widget.Action);
    method public android.support.v17.leanback.widget.Action getActionForKeyCode(int);
    method public final deprecated java.util.List<android.support.v17.leanback.widget.Action> getActions();
    method public final android.support.v17.leanback.widget.ObjectAdapter getActionsAdapter();
    method public final android.graphics.drawable.Drawable getImageDrawable();
    method public final java.lang.Object getItem();
    method public boolean isImageScaleUpAllowed();
    method public final deprecated boolean removeAction(android.support.v17.leanback.widget.Action);
    method public final void setActionsAdapter(android.support.v17.leanback.widget.ObjectAdapter);
    method public final void setImageBitmap(android.content.Context, android.graphics.Bitmap);
    method public final void setImageDrawable(android.graphics.drawable.Drawable);
    method public void setImageScaleUpAllowed(boolean);
    method public final void setItem(java.lang.Object);
  }

  public static class DetailsOverviewRow.Listener {
    ctor public DetailsOverviewRow.Listener();
    method public void onActionsAdapterChanged(android.support.v17.leanback.widget.DetailsOverviewRow);
    method public void onImageDrawableChanged(android.support.v17.leanback.widget.DetailsOverviewRow);
    method public void onItemChanged(android.support.v17.leanback.widget.DetailsOverviewRow);
  }

  public deprecated class DetailsOverviewRowPresenter extends android.support.v17.leanback.widget.RowPresenter {
    ctor public DetailsOverviewRowPresenter(android.support.v17.leanback.widget.Presenter);
    method protected android.support.v17.leanback.widget.RowPresenter.ViewHolder createRowViewHolder(android.view.ViewGroup);
    method public int getBackgroundColor();
    method public android.support.v17.leanback.widget.OnActionClickedListener getOnActionClickedListener();
    method public boolean isStyleLarge();
    method public final boolean isUsingDefaultSelectEffect();
    method public void setBackgroundColor(int);
    method public void setOnActionClickedListener(android.support.v17.leanback.widget.OnActionClickedListener);
    method public final void setSharedElementEnterTransition(android.app.Activity, java.lang.String, long);
    method public final void setSharedElementEnterTransition(android.app.Activity, java.lang.String);
    method public void setStyleLarge(boolean);
  }

  public final class DetailsOverviewRowPresenter.ViewHolder extends android.support.v17.leanback.widget.RowPresenter.ViewHolder {
    ctor public DetailsOverviewRowPresenter.ViewHolder(android.view.View, android.support.v17.leanback.widget.Presenter);
    field public final android.support.v17.leanback.widget.Presenter.ViewHolder mDetailsDescriptionViewHolder;
  }

  public class DetailsParallax extends android.support.v17.leanback.widget.RecyclerViewParallax {
    ctor public DetailsParallax();
    method public android.support.v17.leanback.widget.Parallax.IntProperty getOverviewRowBottom();
    method public android.support.v17.leanback.widget.Parallax.IntProperty getOverviewRowTop();
  }

  public class DividerPresenter extends android.support.v17.leanback.widget.Presenter {
    ctor public DividerPresenter();
    method public void onBindViewHolder(android.support.v17.leanback.widget.Presenter.ViewHolder, java.lang.Object);
    method public android.support.v17.leanback.widget.Presenter.ViewHolder onCreateViewHolder(android.view.ViewGroup);
    method public void onUnbindViewHolder(android.support.v17.leanback.widget.Presenter.ViewHolder);
  }

  public class DividerRow extends android.support.v17.leanback.widget.Row {
    ctor public DividerRow();
    method public final boolean isRenderedAsRowView();
  }

  public abstract interface FacetProvider {
    method public abstract java.lang.Object getFacet(java.lang.Class<?>);
  }

  public abstract interface FacetProviderAdapter {
    method public abstract android.support.v17.leanback.widget.FacetProvider getFacetProvider(int);
  }

  public abstract interface FocusHighlight {
    field public static final int ZOOM_FACTOR_LARGE = 3; // 0x3
    field public static final int ZOOM_FACTOR_MEDIUM = 2; // 0x2
    field public static final int ZOOM_FACTOR_NONE = 0; // 0x0
    field public static final int ZOOM_FACTOR_SMALL = 1; // 0x1
    field public static final int ZOOM_FACTOR_XSMALL = 4; // 0x4
  }

  public class FocusHighlightHelper {
    ctor public FocusHighlightHelper();
    method public static void setupBrowseItemFocusHighlight(android.support.v17.leanback.widget.ItemBridgeAdapter, int, boolean);
    method public static deprecated void setupHeaderItemFocusHighlight(android.support.v17.leanback.widget.VerticalGridView);
    method public static deprecated void setupHeaderItemFocusHighlight(android.support.v17.leanback.widget.VerticalGridView, boolean);
    method public static void setupHeaderItemFocusHighlight(android.support.v17.leanback.widget.ItemBridgeAdapter);
    method public static void setupHeaderItemFocusHighlight(android.support.v17.leanback.widget.ItemBridgeAdapter, boolean);
  }

  public abstract interface FragmentAnimationProvider {
    method public abstract void onImeAppearing(java.util.List<android.animation.Animator>);
    method public abstract void onImeDisappearing(java.util.List<android.animation.Animator>);
  }

  public class FullWidthDetailsOverviewRowPresenter extends android.support.v17.leanback.widget.RowPresenter {
    ctor public FullWidthDetailsOverviewRowPresenter(android.support.v17.leanback.widget.Presenter);
    ctor public FullWidthDetailsOverviewRowPresenter(android.support.v17.leanback.widget.Presenter, android.support.v17.leanback.widget.DetailsOverviewLogoPresenter);
    method protected android.support.v17.leanback.widget.RowPresenter.ViewHolder createRowViewHolder(android.view.ViewGroup);
    method public final int getActionsBackgroundColor();
    method public final int getAlignmentMode();
    method public final int getBackgroundColor();
    method public final int getInitialState();
    method protected int getLayoutResourceId();
    method public android.support.v17.leanback.widget.OnActionClickedListener getOnActionClickedListener();
    method public final boolean isParticipatingEntranceTransition();
    method public final boolean isUsingDefaultSelectEffect();
    method public final void notifyOnBindLogo(android.support.v17.leanback.widget.FullWidthDetailsOverviewRowPresenter.ViewHolder);
    method protected void onLayoutLogo(android.support.v17.leanback.widget.FullWidthDetailsOverviewRowPresenter.ViewHolder, int, boolean);
    method protected void onLayoutOverviewFrame(android.support.v17.leanback.widget.FullWidthDetailsOverviewRowPresenter.ViewHolder, int, boolean);
    method protected void onStateChanged(android.support.v17.leanback.widget.FullWidthDetailsOverviewRowPresenter.ViewHolder, int);
    method public final void setActionsBackgroundColor(int);
    method public final void setAlignmentMode(int);
    method public final void setBackgroundColor(int);
    method public final void setInitialState(int);
    method public final void setListener(android.support.v17.leanback.widget.FullWidthDetailsOverviewRowPresenter.Listener);
    method public void setOnActionClickedListener(android.support.v17.leanback.widget.OnActionClickedListener);
    method public final void setParticipatingEntranceTransition(boolean);
    method public final void setState(android.support.v17.leanback.widget.FullWidthDetailsOverviewRowPresenter.ViewHolder, int);
    field public static final int ALIGN_MODE_MIDDLE = 1; // 0x1
    field public static final int ALIGN_MODE_START = 0; // 0x0
    field public static final int STATE_FULL = 1; // 0x1
    field public static final int STATE_HALF = 0; // 0x0
    field public static final int STATE_SMALL = 2; // 0x2
    field protected int mInitialState;
  }

  public static abstract class FullWidthDetailsOverviewRowPresenter.Listener {
    ctor public FullWidthDetailsOverviewRowPresenter.Listener();
    method public void onBindLogo(android.support.v17.leanback.widget.FullWidthDetailsOverviewRowPresenter.ViewHolder);
  }

  public class FullWidthDetailsOverviewRowPresenter.ViewHolder extends android.support.v17.leanback.widget.RowPresenter.ViewHolder {
    ctor public FullWidthDetailsOverviewRowPresenter.ViewHolder(android.view.View, android.support.v17.leanback.widget.Presenter, android.support.v17.leanback.widget.DetailsOverviewLogoPresenter);
    method protected android.support.v17.leanback.widget.DetailsOverviewRow.Listener createRowListener();
    method public final android.view.ViewGroup getActionsRow();
    method public final android.view.ViewGroup getDetailsDescriptionFrame();
    method public final android.support.v17.leanback.widget.Presenter.ViewHolder getDetailsDescriptionViewHolder();
    method public final android.support.v17.leanback.widget.DetailsOverviewLogoPresenter.ViewHolder getLogoViewHolder();
    method public final android.view.ViewGroup getOverviewView();
    method public final int getState();
    field protected final android.support.v17.leanback.widget.DetailsOverviewRow.Listener mRowListener;
  }

  public class FullWidthDetailsOverviewRowPresenter.ViewHolder.DetailsOverviewRowListener extends android.support.v17.leanback.widget.DetailsOverviewRow.Listener {
    ctor public FullWidthDetailsOverviewRowPresenter.ViewHolder.DetailsOverviewRowListener();
  }

  public class FullWidthDetailsOverviewSharedElementHelper extends android.support.v17.leanback.widget.FullWidthDetailsOverviewRowPresenter.Listener {
    ctor public FullWidthDetailsOverviewSharedElementHelper();
    method public boolean getAutoStartSharedElementTransition();
    method public void setAutoStartSharedElementTransition(boolean);
    method public void setSharedElementEnterTransition(android.app.Activity, java.lang.String);
    method public void setSharedElementEnterTransition(android.app.Activity, java.lang.String, long);
    method public void startPostponedEnterTransition();
  }

  public class GuidanceStylist implements android.support.v17.leanback.widget.FragmentAnimationProvider {
    ctor public GuidanceStylist();
    method public android.widget.TextView getBreadcrumbView();
    method public android.widget.TextView getDescriptionView();
    method public android.widget.ImageView getIconView();
    method public android.widget.TextView getTitleView();
    method public android.view.View onCreateView(android.view.LayoutInflater, android.view.ViewGroup, android.support.v17.leanback.widget.GuidanceStylist.Guidance);
    method public void onDestroyView();
    method public void onImeAppearing(java.util.List<android.animation.Animator>);
    method public void onImeDisappearing(java.util.List<android.animation.Animator>);
    method public int onProvideLayoutId();
  }

  public static class GuidanceStylist.Guidance {
    ctor public GuidanceStylist.Guidance(java.lang.String, java.lang.String, java.lang.String, android.graphics.drawable.Drawable);
    method public java.lang.String getBreadcrumb();
    method public java.lang.String getDescription();
    method public android.graphics.drawable.Drawable getIconDrawable();
    method public java.lang.String getTitle();
  }

  public class GuidedAction extends android.support.v17.leanback.widget.Action {
    ctor protected GuidedAction();
    method public int getCheckSetId();
    method public java.lang.CharSequence getDescription();
    method public int getDescriptionEditInputType();
    method public int getDescriptionInputType();
    method public java.lang.CharSequence getEditDescription();
    method public int getEditInputType();
    method public java.lang.CharSequence getEditTitle();
    method public int getInputType();
    method public android.content.Intent getIntent();
    method public java.util.List<android.support.v17.leanback.widget.GuidedAction> getSubActions();
    method public java.lang.CharSequence getTitle();
    method public boolean hasEditableActivatorView();
    method public boolean hasMultilineDescription();
    method public boolean hasNext();
    method public boolean hasSubActions();
    method public boolean hasTextEditable();
    method public boolean infoOnly();
    method public final boolean isAutoSaveRestoreEnabled();
    method public boolean isChecked();
    method public boolean isDescriptionEditable();
    method public boolean isEditTitleUsed();
    method public boolean isEditable();
    method public boolean isEnabled();
    method public boolean isFocusable();
    method public void onRestoreInstanceState(android.os.Bundle, java.lang.String);
    method public void onSaveInstanceState(android.os.Bundle, java.lang.String);
    method public void setChecked(boolean);
    method public void setDescription(java.lang.CharSequence);
    method public void setEditDescription(java.lang.CharSequence);
    method public void setEditTitle(java.lang.CharSequence);
    method public void setEnabled(boolean);
    method public void setFocusable(boolean);
    method public void setIntent(android.content.Intent);
    method public void setSubActions(java.util.List<android.support.v17.leanback.widget.GuidedAction>);
    method public void setTitle(java.lang.CharSequence);
    field public static final long ACTION_ID_CANCEL = -5L; // 0xfffffffffffffffbL
    field public static final long ACTION_ID_CONTINUE = -7L; // 0xfffffffffffffff9L
    field public static final long ACTION_ID_CURRENT = -3L; // 0xfffffffffffffffdL
    field public static final long ACTION_ID_FINISH = -6L; // 0xfffffffffffffffaL
    field public static final long ACTION_ID_NEXT = -2L; // 0xfffffffffffffffeL
    field public static final long ACTION_ID_NO = -9L; // 0xfffffffffffffff7L
    field public static final long ACTION_ID_OK = -4L; // 0xfffffffffffffffcL
    field public static final long ACTION_ID_YES = -8L; // 0xfffffffffffffff8L
    field public static final int CHECKBOX_CHECK_SET_ID = -1; // 0xffffffff
    field public static final int DEFAULT_CHECK_SET_ID = 1; // 0x1
    field public static final int NO_CHECK_SET = 0; // 0x0
  }

  public static class GuidedAction.Builder extends android.support.v17.leanback.widget.GuidedAction.BuilderBase {
    ctor public deprecated GuidedAction.Builder();
    ctor public GuidedAction.Builder(android.content.Context);
    method public android.support.v17.leanback.widget.GuidedAction build();
  }

  public static abstract class GuidedAction.BuilderBase<B extends android.support.v17.leanback.widget.GuidedAction.BuilderBase> {
    ctor public GuidedAction.BuilderBase(android.content.Context);
    method protected final void applyValues(android.support.v17.leanback.widget.GuidedAction);
    method public B autoSaveRestoreEnabled(boolean);
    method public B checkSetId(int);
    method public B checked(boolean);
    method public B clickAction(long);
    method public B description(java.lang.CharSequence);
    method public B description(int);
    method public B descriptionEditInputType(int);
    method public B descriptionEditable(boolean);
    method public B descriptionInputType(int);
    method public B editDescription(java.lang.CharSequence);
    method public B editDescription(int);
    method public B editInputType(int);
    method public B editTitle(java.lang.CharSequence);
    method public B editTitle(int);
    method public B editable(boolean);
    method public B enabled(boolean);
    method public B focusable(boolean);
    method public android.content.Context getContext();
    method public B hasEditableActivatorView(boolean);
    method public B hasNext(boolean);
    method public B icon(android.graphics.drawable.Drawable);
    method public B icon(int);
    method public deprecated B iconResourceId(int, android.content.Context);
    method public B id(long);
    method public B infoOnly(boolean);
    method public B inputType(int);
    method public B intent(android.content.Intent);
    method public B multilineDescription(boolean);
    method public B subActions(java.util.List<android.support.v17.leanback.widget.GuidedAction>);
    method public B title(java.lang.CharSequence);
    method public B title(int);
  }

  public class GuidedActionEditText extends android.widget.EditText implements android.support.v17.leanback.widget.ImeKeyMonitor {
    ctor public GuidedActionEditText(android.content.Context);
    ctor public GuidedActionEditText(android.content.Context, android.util.AttributeSet);
    ctor public GuidedActionEditText(android.content.Context, android.util.AttributeSet, int);
    method public void setImeKeyListener(android.support.v17.leanback.widget.ImeKeyMonitor.ImeKeyListener);
  }

  public class GuidedActionsStylist implements android.support.v17.leanback.widget.FragmentAnimationProvider {
    ctor public GuidedActionsStylist();
    method public void collapseAction(boolean);
    method public void expandAction(android.support.v17.leanback.widget.GuidedAction, boolean);
    method public android.support.v17.leanback.widget.VerticalGridView getActionsGridView();
    method public android.support.v17.leanback.widget.GuidedAction getExpandedAction();
    method public int getItemViewType(android.support.v17.leanback.widget.GuidedAction);
    method public android.support.v17.leanback.widget.VerticalGridView getSubActionsGridView();
    method public final boolean isBackKeyToCollapseActivatorView();
    method public final boolean isBackKeyToCollapseSubActions();
    method public boolean isButtonActions();
    method public boolean isExpandTransitionSupported();
    method public boolean isExpanded();
    method public boolean isInExpandTransition();
    method public boolean isSubActionsExpanded();
    method public void onAnimateItemChecked(android.support.v17.leanback.widget.GuidedActionsStylist.ViewHolder, boolean);
    method public void onAnimateItemFocused(android.support.v17.leanback.widget.GuidedActionsStylist.ViewHolder, boolean);
    method public void onAnimateItemPressed(android.support.v17.leanback.widget.GuidedActionsStylist.ViewHolder, boolean);
    method public void onAnimateItemPressedCancelled(android.support.v17.leanback.widget.GuidedActionsStylist.ViewHolder);
    method public void onBindActivatorView(android.support.v17.leanback.widget.GuidedActionsStylist.ViewHolder, android.support.v17.leanback.widget.GuidedAction);
    method public void onBindCheckMarkView(android.support.v17.leanback.widget.GuidedActionsStylist.ViewHolder, android.support.v17.leanback.widget.GuidedAction);
    method public void onBindChevronView(android.support.v17.leanback.widget.GuidedActionsStylist.ViewHolder, android.support.v17.leanback.widget.GuidedAction);
    method public void onBindViewHolder(android.support.v17.leanback.widget.GuidedActionsStylist.ViewHolder, android.support.v17.leanback.widget.GuidedAction);
    method public android.view.View onCreateView(android.view.LayoutInflater, android.view.ViewGroup);
    method public android.support.v17.leanback.widget.GuidedActionsStylist.ViewHolder onCreateViewHolder(android.view.ViewGroup);
    method public android.support.v17.leanback.widget.GuidedActionsStylist.ViewHolder onCreateViewHolder(android.view.ViewGroup, int);
    method public void onDestroyView();
    method protected deprecated void onEditingModeChange(android.support.v17.leanback.widget.GuidedActionsStylist.ViewHolder, android.support.v17.leanback.widget.GuidedAction, boolean);
    method protected void onEditingModeChange(android.support.v17.leanback.widget.GuidedActionsStylist.ViewHolder, boolean, boolean);
    method public void onImeAppearing(java.util.List<android.animation.Animator>);
    method public void onImeDisappearing(java.util.List<android.animation.Animator>);
    method public int onProvideItemLayoutId();
    method public int onProvideItemLayoutId(int);
    method public int onProvideLayoutId();
    method public boolean onUpdateActivatorView(android.support.v17.leanback.widget.GuidedActionsStylist.ViewHolder, android.support.v17.leanback.widget.GuidedAction);
    method public void onUpdateExpandedViewHolder(android.support.v17.leanback.widget.GuidedActionsStylist.ViewHolder);
    method public void openInEditMode(android.support.v17.leanback.widget.GuidedAction);
    method public void setAsButtonActions();
    method public final void setBackKeyToCollapseActivatorView(boolean);
    method public final void setBackKeyToCollapseSubActions(boolean);
    method public deprecated void setEditingMode(android.support.v17.leanback.widget.GuidedActionsStylist.ViewHolder, android.support.v17.leanback.widget.GuidedAction, boolean);
    method public deprecated void setExpandedViewHolder(android.support.v17.leanback.widget.GuidedActionsStylist.ViewHolder);
    method protected void setupImeOptions(android.support.v17.leanback.widget.GuidedActionsStylist.ViewHolder, android.support.v17.leanback.widget.GuidedAction);
    method public deprecated void startExpandedTransition(android.support.v17.leanback.widget.GuidedActionsStylist.ViewHolder);
    field public static final int VIEW_TYPE_DATE_PICKER = 1; // 0x1
    field public static final int VIEW_TYPE_DEFAULT = 0; // 0x0
  }

  public static class GuidedActionsStylist.ViewHolder extends android.support.v7.widget.RecyclerView.ViewHolder implements android.support.v17.leanback.widget.FacetProvider {
    ctor public GuidedActionsStylist.ViewHolder(android.view.View);
    ctor public GuidedActionsStylist.ViewHolder(android.view.View, boolean);
    method public android.support.v17.leanback.widget.GuidedAction getAction();
    method public android.widget.ImageView getCheckmarkView();
    method public android.widget.ImageView getChevronView();
    method public android.view.View getContentView();
    method public android.widget.TextView getDescriptionView();
    method public android.widget.EditText getEditableDescriptionView();
    method public android.widget.EditText getEditableTitleView();
    method public android.view.View getEditingView();
    method public java.lang.Object getFacet(java.lang.Class<?>);
    method public android.widget.ImageView getIconView();
    method public android.widget.TextView getTitleView();
    method public boolean isInEditing();
    method public boolean isInEditingActivatorView();
    method public boolean isInEditingDescription();
    method public boolean isInEditingText();
    method public boolean isInEditingTitle();
    method public boolean isSubAction();
  }

  public class GuidedDatePickerAction extends android.support.v17.leanback.widget.GuidedAction {
    ctor public GuidedDatePickerAction();
    method public long getDate();
    method public java.lang.String getDatePickerFormat();
    method public long getMaxDate();
    method public long getMinDate();
    method public void setDate(long);
  }

  public static final class GuidedDatePickerAction.Builder extends android.support.v17.leanback.widget.GuidedDatePickerAction.BuilderBase {
    ctor public GuidedDatePickerAction.Builder(android.content.Context);
    method public android.support.v17.leanback.widget.GuidedDatePickerAction build();
  }

  public static abstract class GuidedDatePickerAction.BuilderBase<B extends android.support.v17.leanback.widget.GuidedDatePickerAction.BuilderBase> extends android.support.v17.leanback.widget.GuidedAction.BuilderBase {
    ctor public GuidedDatePickerAction.BuilderBase(android.content.Context);
    method protected final void applyDatePickerValues(android.support.v17.leanback.widget.GuidedDatePickerAction);
    method public B date(long);
    method public B datePickerFormat(java.lang.String);
    method public B maxDate(long);
    method public B minDate(long);
  }

  public class HeaderItem {
    ctor public HeaderItem(long, java.lang.String);
    ctor public HeaderItem(java.lang.String);
    method public java.lang.CharSequence getContentDescription();
    method public java.lang.CharSequence getDescription();
    method public final long getId();
    method public final java.lang.String getName();
    method public void setContentDescription(java.lang.CharSequence);
    method public void setDescription(java.lang.CharSequence);
  }

  public class HorizontalGridView extends android.support.v17.leanback.widget.BaseGridView {
    ctor public HorizontalGridView(android.content.Context);
    ctor public HorizontalGridView(android.content.Context, android.util.AttributeSet);
    ctor public HorizontalGridView(android.content.Context, android.util.AttributeSet, int);
    method public final boolean getFadingLeftEdge();
    method public final int getFadingLeftEdgeLength();
    method public final int getFadingLeftEdgeOffset();
    method public final boolean getFadingRightEdge();
    method public final int getFadingRightEdgeLength();
    method public final int getFadingRightEdgeOffset();
    method protected void initAttributes(android.content.Context, android.util.AttributeSet);
    method public final void setFadingLeftEdge(boolean);
    method public final void setFadingLeftEdgeLength(int);
    method public final void setFadingLeftEdgeOffset(int);
    method public final void setFadingRightEdge(boolean);
    method public final void setFadingRightEdgeLength(int);
    method public final void setFadingRightEdgeOffset(int);
    method public void setNumRows(int);
    method public void setRowHeight(int);
  }

  public final class HorizontalHoverCardSwitcher extends android.support.v17.leanback.widget.PresenterSwitcher {
    ctor public HorizontalHoverCardSwitcher();
    method protected void insertView(android.view.View);
    method public void select(android.support.v17.leanback.widget.HorizontalGridView, android.view.View, java.lang.Object);
  }

  public class ImageCardView extends android.support.v17.leanback.widget.BaseCardView {
    ctor public deprecated ImageCardView(android.content.Context, int);
    ctor public ImageCardView(android.content.Context, android.util.AttributeSet, int);
    ctor public ImageCardView(android.content.Context);
    ctor public ImageCardView(android.content.Context, android.util.AttributeSet);
    method public android.graphics.drawable.Drawable getBadgeImage();
    method public java.lang.CharSequence getContentText();
    method public android.graphics.drawable.Drawable getInfoAreaBackground();
    method public android.graphics.drawable.Drawable getMainImage();
    method public final android.widget.ImageView getMainImageView();
    method public java.lang.CharSequence getTitleText();
    method public void setBadgeImage(android.graphics.drawable.Drawable);
    method public void setContentText(java.lang.CharSequence);
    method public void setInfoAreaBackground(android.graphics.drawable.Drawable);
    method public void setInfoAreaBackgroundColor(int);
    method public void setMainImage(android.graphics.drawable.Drawable);
    method public void setMainImage(android.graphics.drawable.Drawable, boolean);
    method public void setMainImageAdjustViewBounds(boolean);
    method public void setMainImageDimensions(int, int);
    method public void setMainImageScaleType(android.widget.ImageView.ScaleType);
    method public void setTitleText(java.lang.CharSequence);
    field public static final int CARD_TYPE_FLAG_CONTENT = 2; // 0x2
    field public static final int CARD_TYPE_FLAG_ICON_LEFT = 8; // 0x8
    field public static final int CARD_TYPE_FLAG_ICON_RIGHT = 4; // 0x4
    field public static final int CARD_TYPE_FLAG_IMAGE_ONLY = 0; // 0x0
    field public static final int CARD_TYPE_FLAG_TITLE = 1; // 0x1
  }

  public abstract interface ImeKeyMonitor {
    method public abstract void setImeKeyListener(android.support.v17.leanback.widget.ImeKeyMonitor.ImeKeyListener);
  }

  public static abstract interface ImeKeyMonitor.ImeKeyListener {
    method public abstract boolean onKeyPreIme(android.widget.EditText, int, android.view.KeyEvent);
  }

  public final class ItemAlignmentFacet {
    ctor public ItemAlignmentFacet();
    method public android.support.v17.leanback.widget.ItemAlignmentFacet.ItemAlignmentDef[] getAlignmentDefs();
    method public boolean isMultiAlignment();
    method public void setAlignmentDefs(android.support.v17.leanback.widget.ItemAlignmentFacet.ItemAlignmentDef[]);
    field public static final float ITEM_ALIGN_OFFSET_PERCENT_DISABLED = -1.0f;
  }

  public static class ItemAlignmentFacet.ItemAlignmentDef {
    ctor public ItemAlignmentFacet.ItemAlignmentDef();
    method public final int getItemAlignmentFocusViewId();
    method public final int getItemAlignmentOffset();
    method public final float getItemAlignmentOffsetPercent();
    method public final int getItemAlignmentViewId();
    method public boolean isAlignedToTextViewBaseLine();
    method public final boolean isItemAlignmentOffsetWithPadding();
    method public final void setAlignedToTextViewBaseline(boolean);
    method public final void setItemAlignmentFocusViewId(int);
    method public final void setItemAlignmentOffset(int);
    method public final void setItemAlignmentOffsetPercent(float);
    method public final void setItemAlignmentOffsetWithPadding(boolean);
    method public final void setItemAlignmentViewId(int);
  }

  public class ItemBridgeAdapter extends android.support.v7.widget.RecyclerView.Adapter implements android.support.v17.leanback.widget.FacetProviderAdapter {
    ctor public ItemBridgeAdapter(android.support.v17.leanback.widget.ObjectAdapter, android.support.v17.leanback.widget.PresenterSelector);
    ctor public ItemBridgeAdapter(android.support.v17.leanback.widget.ObjectAdapter);
    ctor public ItemBridgeAdapter();
    method public void clear();
    method public android.support.v17.leanback.widget.FacetProvider getFacetProvider(int);
    method public int getItemCount();
    method public java.util.ArrayList<android.support.v17.leanback.widget.Presenter> getPresenterMapper();
    method public android.support.v17.leanback.widget.ItemBridgeAdapter.Wrapper getWrapper();
    method protected void onAddPresenter(android.support.v17.leanback.widget.Presenter, int);
    method protected void onAttachedToWindow(android.support.v17.leanback.widget.ItemBridgeAdapter.ViewHolder);
    method protected void onBind(android.support.v17.leanback.widget.ItemBridgeAdapter.ViewHolder);
    method public final void onBindViewHolder(android.support.v7.widget.RecyclerView.ViewHolder, int);
    method protected void onCreate(android.support.v17.leanback.widget.ItemBridgeAdapter.ViewHolder);
    method public final android.support.v7.widget.RecyclerView.ViewHolder onCreateViewHolder(android.view.ViewGroup, int);
    method protected void onDetachedFromWindow(android.support.v17.leanback.widget.ItemBridgeAdapter.ViewHolder);
    method protected void onUnbind(android.support.v17.leanback.widget.ItemBridgeAdapter.ViewHolder);
    method public final void onViewAttachedToWindow(android.support.v7.widget.RecyclerView.ViewHolder);
    method public final void onViewDetachedFromWindow(android.support.v7.widget.RecyclerView.ViewHolder);
    method public final void onViewRecycled(android.support.v7.widget.RecyclerView.ViewHolder);
    method public void setAdapter(android.support.v17.leanback.widget.ObjectAdapter);
    method public void setAdapterListener(android.support.v17.leanback.widget.ItemBridgeAdapter.AdapterListener);
    method public void setPresenter(android.support.v17.leanback.widget.PresenterSelector);
    method public void setPresenterMapper(java.util.ArrayList<android.support.v17.leanback.widget.Presenter>);
    method public void setWrapper(android.support.v17.leanback.widget.ItemBridgeAdapter.Wrapper);
  }

  public static class ItemBridgeAdapter.AdapterListener {
    ctor public ItemBridgeAdapter.AdapterListener();
    method public void onAddPresenter(android.support.v17.leanback.widget.Presenter, int);
    method public void onAttachedToWindow(android.support.v17.leanback.widget.ItemBridgeAdapter.ViewHolder);
    method public void onBind(android.support.v17.leanback.widget.ItemBridgeAdapter.ViewHolder);
    method public void onCreate(android.support.v17.leanback.widget.ItemBridgeAdapter.ViewHolder);
    method public void onDetachedFromWindow(android.support.v17.leanback.widget.ItemBridgeAdapter.ViewHolder);
    method public void onUnbind(android.support.v17.leanback.widget.ItemBridgeAdapter.ViewHolder);
  }

  public class ItemBridgeAdapter.ViewHolder extends android.support.v7.widget.RecyclerView.ViewHolder implements android.support.v17.leanback.widget.FacetProvider {
    method public final java.lang.Object getExtraObject();
    method public java.lang.Object getFacet(java.lang.Class<?>);
    method public final java.lang.Object getItem();
    method public final android.support.v17.leanback.widget.Presenter getPresenter();
    method public final android.support.v17.leanback.widget.Presenter.ViewHolder getViewHolder();
    method public void setExtraObject(java.lang.Object);
  }

  public static abstract class ItemBridgeAdapter.Wrapper {
    ctor public ItemBridgeAdapter.Wrapper();
    method public abstract android.view.View createWrapper(android.view.View);
    method public abstract void wrap(android.view.View, android.view.View);
  }

  public class ItemBridgeAdapterShadowOverlayWrapper extends android.support.v17.leanback.widget.ItemBridgeAdapter.Wrapper {
    ctor public ItemBridgeAdapterShadowOverlayWrapper(android.support.v17.leanback.widget.ShadowOverlayHelper);
    method public android.view.View createWrapper(android.view.View);
    method public void wrap(android.view.View, android.view.View);
  }

  public class ListRow extends android.support.v17.leanback.widget.Row {
    ctor public ListRow(android.support.v17.leanback.widget.HeaderItem, android.support.v17.leanback.widget.ObjectAdapter);
    ctor public ListRow(long, android.support.v17.leanback.widget.HeaderItem, android.support.v17.leanback.widget.ObjectAdapter);
    ctor public ListRow(android.support.v17.leanback.widget.ObjectAdapter);
    method public final android.support.v17.leanback.widget.ObjectAdapter getAdapter();
    method public java.lang.CharSequence getContentDescription();
    method public void setContentDescription(java.lang.CharSequence);
  }

  public final class ListRowHoverCardView extends android.widget.LinearLayout {
    ctor public ListRowHoverCardView(android.content.Context);
    ctor public ListRowHoverCardView(android.content.Context, android.util.AttributeSet);
    ctor public ListRowHoverCardView(android.content.Context, android.util.AttributeSet, int);
    method public final java.lang.CharSequence getDescription();
    method public final java.lang.CharSequence getTitle();
    method public final void setDescription(java.lang.CharSequence);
    method public final void setTitle(java.lang.CharSequence);
  }

  public class ListRowPresenter extends android.support.v17.leanback.widget.RowPresenter {
    ctor public ListRowPresenter();
    ctor public ListRowPresenter(int);
    ctor public ListRowPresenter(int, boolean);
    method protected void applySelectLevelToChild(android.support.v17.leanback.widget.ListRowPresenter.ViewHolder, android.view.View);
    method public final boolean areChildRoundedCornersEnabled();
    method protected android.support.v17.leanback.widget.RowPresenter.ViewHolder createRowViewHolder(android.view.ViewGroup);
    method protected android.support.v17.leanback.widget.ShadowOverlayHelper.Options createShadowOverlayOptions();
    method public final void enableChildRoundedCorners(boolean);
    method public int getExpandedRowHeight();
    method public final int getFocusZoomFactor();
    method public final android.support.v17.leanback.widget.PresenterSelector getHoverCardPresenterSelector();
    method public int getRecycledPoolSize(android.support.v17.leanback.widget.Presenter);
    method public int getRowHeight();
    method public final boolean getShadowEnabled();
    method public final deprecated int getZoomFactor();
    method public final boolean isFocusDimmerUsed();
    method public final boolean isKeepChildForeground();
    method public boolean isUsingDefaultListSelectEffect();
    method public final boolean isUsingDefaultSelectEffect();
    method public boolean isUsingDefaultShadow();
    method public boolean isUsingZOrder(android.content.Context);
    method public void setExpandedRowHeight(int);
    method public final void setHoverCardPresenterSelector(android.support.v17.leanback.widget.PresenterSelector);
    method public final void setKeepChildForeground(boolean);
    method public void setNumRows(int);
    method public void setRecycledPoolSize(android.support.v17.leanback.widget.Presenter, int);
    method public void setRowHeight(int);
    method public final void setShadowEnabled(boolean);
  }

  public static class ListRowPresenter.SelectItemViewHolderTask extends android.support.v17.leanback.widget.Presenter.ViewHolderTask {
    ctor public ListRowPresenter.SelectItemViewHolderTask(int);
    method public int getItemPosition();
    method public android.support.v17.leanback.widget.Presenter.ViewHolderTask getItemTask();
    method public boolean isSmoothScroll();
    method public void setItemPosition(int);
    method public void setItemTask(android.support.v17.leanback.widget.Presenter.ViewHolderTask);
    method public void setSmoothScroll(boolean);
  }

  public static class ListRowPresenter.ViewHolder extends android.support.v17.leanback.widget.RowPresenter.ViewHolder {
    ctor public ListRowPresenter.ViewHolder(android.view.View, android.support.v17.leanback.widget.HorizontalGridView, android.support.v17.leanback.widget.ListRowPresenter);
    method public final android.support.v17.leanback.widget.ItemBridgeAdapter getBridgeAdapter();
    method public final android.support.v17.leanback.widget.HorizontalGridView getGridView();
    method public android.support.v17.leanback.widget.Presenter.ViewHolder getItemViewHolder(int);
    method public final android.support.v17.leanback.widget.ListRowPresenter getListRowPresenter();
    method public int getSelectedPosition();
  }

  public final class ListRowView extends android.widget.LinearLayout {
    ctor public ListRowView(android.content.Context);
    ctor public ListRowView(android.content.Context, android.util.AttributeSet);
    ctor public ListRowView(android.content.Context, android.util.AttributeSet, int);
    method public android.support.v17.leanback.widget.HorizontalGridView getGridView();
  }

  public abstract interface MultiActionsProvider {
    method public abstract android.support.v17.leanback.widget.MultiActionsProvider.MultiAction[] getActions();
  }

  public static class MultiActionsProvider.MultiAction {
    ctor public MultiActionsProvider.MultiAction(long);
    method public android.graphics.drawable.Drawable getCurrentDrawable();
    method public android.graphics.drawable.Drawable[] getDrawables();
    method public long getId();
    method public int getIndex();
    method public void incrementIndex();
    method public void setDrawables(android.graphics.drawable.Drawable[]);
    method public void setIndex(int);
  }

  public abstract class ObjectAdapter {
    ctor public ObjectAdapter(android.support.v17.leanback.widget.PresenterSelector);
    ctor public ObjectAdapter(android.support.v17.leanback.widget.Presenter);
    ctor public ObjectAdapter();
    method public abstract java.lang.Object get(int);
    method public long getId(int);
    method public final android.support.v17.leanback.widget.Presenter getPresenter(java.lang.Object);
    method public final android.support.v17.leanback.widget.PresenterSelector getPresenterSelector();
    method public final boolean hasStableIds();
    method public boolean isImmediateNotifySupported();
    method protected final void notifyChanged();
    method public final void notifyItemRangeChanged(int, int);
    method protected final void notifyItemRangeInserted(int, int);
    method protected final void notifyItemRangeRemoved(int, int);
    method protected void onHasStableIdsChanged();
    method protected void onPresenterSelectorChanged();
    method public final void registerObserver(android.support.v17.leanback.widget.ObjectAdapter.DataObserver);
    method public final void setHasStableIds(boolean);
    method public final void setPresenterSelector(android.support.v17.leanback.widget.PresenterSelector);
    method public abstract int size();
    method public final void unregisterAllObservers();
    method public final void unregisterObserver(android.support.v17.leanback.widget.ObjectAdapter.DataObserver);
    field public static final int NO_ID = -1; // 0xffffffff
  }

  public static abstract class ObjectAdapter.DataObserver {
    ctor public ObjectAdapter.DataObserver();
    method public void onChanged();
    method public void onItemRangeChanged(int, int);
    method public void onItemRangeInserted(int, int);
    method public void onItemRangeRemoved(int, int);
  }

  public abstract interface OnActionClickedListener {
    method public abstract void onActionClicked(android.support.v17.leanback.widget.Action);
  }

  public abstract interface OnChildLaidOutListener {
    method public abstract void onChildLaidOut(android.view.ViewGroup, android.view.View, int, long);
  }

  public abstract deprecated interface OnChildSelectedListener {
    method public abstract void onChildSelected(android.view.ViewGroup, android.view.View, int, long);
  }

  public abstract class OnChildViewHolderSelectedListener {
    ctor public OnChildViewHolderSelectedListener();
    method public void onChildViewHolderSelected(android.support.v7.widget.RecyclerView, android.support.v7.widget.RecyclerView.ViewHolder, int, int);
    method public void onChildViewHolderSelectedAndPositioned(android.support.v7.widget.RecyclerView, android.support.v7.widget.RecyclerView.ViewHolder, int, int);
  }

  public abstract interface OnItemViewClickedListener implements android.support.v17.leanback.widget.BaseOnItemViewClickedListener {
  }

  public abstract interface OnItemViewSelectedListener implements android.support.v17.leanback.widget.BaseOnItemViewSelectedListener {
  }

  public class PageRow extends android.support.v17.leanback.widget.Row {
    ctor public PageRow(android.support.v17.leanback.widget.HeaderItem);
    method public final boolean isRenderedAsRowView();
  }

  public abstract class Parallax<PropertyT extends android.util.Property> {
    ctor public Parallax();
    method public android.support.v17.leanback.widget.ParallaxEffect addEffect(android.support.v17.leanback.widget.Parallax.PropertyMarkerValue...);
    method public final PropertyT addProperty(java.lang.String);
    method public abstract PropertyT createProperty(java.lang.String, int);
    method public java.util.List<android.support.v17.leanback.widget.ParallaxEffect> getEffects();
    method public abstract float getMaxValue();
    method public final java.util.List<PropertyT> getProperties();
    method public void removeAllEffects();
    method public void removeEffect(android.support.v17.leanback.widget.ParallaxEffect);
    method public void updateValues();
  }

  public static class Parallax.FloatProperty extends android.util.Property {
    ctor public Parallax.FloatProperty(java.lang.String, int);
    method public final android.support.v17.leanback.widget.Parallax.PropertyMarkerValue at(float, float);
    method public final android.support.v17.leanback.widget.Parallax.PropertyMarkerValue atAbsolute(float);
    method public final android.support.v17.leanback.widget.Parallax.PropertyMarkerValue atFraction(float);
    method public final android.support.v17.leanback.widget.Parallax.PropertyMarkerValue atMax();
    method public final android.support.v17.leanback.widget.Parallax.PropertyMarkerValue atMin();
    method public final java.lang.Float get(android.support.v17.leanback.widget.Parallax);
    method public final int getIndex();
    method public final float getValue(android.support.v17.leanback.widget.Parallax);
    method public final void set(android.support.v17.leanback.widget.Parallax, java.lang.Float);
    method public final void setValue(android.support.v17.leanback.widget.Parallax, float);
    field public static final float UNKNOWN_AFTER = 3.4028235E38f;
    field public static final float UNKNOWN_BEFORE = -3.4028235E38f;
  }

  public static class Parallax.IntProperty extends android.util.Property {
    ctor public Parallax.IntProperty(java.lang.String, int);
    method public final android.support.v17.leanback.widget.Parallax.PropertyMarkerValue at(int, float);
    method public final android.support.v17.leanback.widget.Parallax.PropertyMarkerValue atAbsolute(int);
    method public final android.support.v17.leanback.widget.Parallax.PropertyMarkerValue atFraction(float);
    method public final android.support.v17.leanback.widget.Parallax.PropertyMarkerValue atMax();
    method public final android.support.v17.leanback.widget.Parallax.PropertyMarkerValue atMin();
    method public final java.lang.Integer get(android.support.v17.leanback.widget.Parallax);
    method public final int getIndex();
    method public final int getValue(android.support.v17.leanback.widget.Parallax);
    method public final void set(android.support.v17.leanback.widget.Parallax, java.lang.Integer);
    method public final void setValue(android.support.v17.leanback.widget.Parallax, int);
    field public static final int UNKNOWN_AFTER = 2147483647; // 0x7fffffff
    field public static final int UNKNOWN_BEFORE = -2147483648; // 0x80000000
  }

  public static class Parallax.PropertyMarkerValue<PropertyT> {
    ctor public Parallax.PropertyMarkerValue(PropertyT);
    method public PropertyT getProperty();
  }

  public abstract class ParallaxEffect {
    method public final void addTarget(android.support.v17.leanback.widget.ParallaxTarget);
    method public final java.util.List<android.support.v17.leanback.widget.Parallax.PropertyMarkerValue> getPropertyRanges();
    method public final java.util.List<android.support.v17.leanback.widget.ParallaxTarget> getTargets();
    method public final void performMapping(android.support.v17.leanback.widget.Parallax);
    method public final void removeTarget(android.support.v17.leanback.widget.ParallaxTarget);
    method public final void setPropertyRanges(android.support.v17.leanback.widget.Parallax.PropertyMarkerValue...);
    method public final android.support.v17.leanback.widget.ParallaxEffect target(android.support.v17.leanback.widget.ParallaxTarget);
    method public final android.support.v17.leanback.widget.ParallaxEffect target(java.lang.Object, android.animation.PropertyValuesHolder);
    method public final <T, V extends java.lang.Number> android.support.v17.leanback.widget.ParallaxEffect target(T, android.util.Property<T, V>);
  }

  public abstract class ParallaxTarget {
    ctor public ParallaxTarget();
    method public void directUpdate(java.lang.Number);
    method public boolean isDirectMapping();
    method public void update(float);
  }

  public static final class ParallaxTarget.DirectPropertyTarget<T, V extends java.lang.Number> extends android.support.v17.leanback.widget.ParallaxTarget {
    ctor public ParallaxTarget.DirectPropertyTarget(java.lang.Object, android.util.Property<T, V>);
  }

  public static final class ParallaxTarget.PropertyValuesHolderTarget extends android.support.v17.leanback.widget.ParallaxTarget {
    ctor public ParallaxTarget.PropertyValuesHolderTarget(java.lang.Object, android.animation.PropertyValuesHolder);
  }

  public class PlaybackControlsRow extends android.support.v17.leanback.widget.Row {
    ctor public PlaybackControlsRow(java.lang.Object);
    ctor public PlaybackControlsRow();
    method public android.support.v17.leanback.widget.Action getActionForKeyCode(int);
    method public android.support.v17.leanback.widget.Action getActionForKeyCode(android.support.v17.leanback.widget.ObjectAdapter, int);
    method public long getBufferedPosition();
    method public deprecated int getBufferedProgress();
    method public deprecated long getBufferedProgressLong();
    method public long getCurrentPosition();
    method public deprecated int getCurrentTime();
    method public deprecated long getCurrentTimeLong();
    method public long getDuration();
    method public final android.graphics.drawable.Drawable getImageDrawable();
    method public final java.lang.Object getItem();
    method public final android.support.v17.leanback.widget.ObjectAdapter getPrimaryActionsAdapter();
    method public final android.support.v17.leanback.widget.ObjectAdapter getSecondaryActionsAdapter();
    method public deprecated int getTotalTime();
    method public deprecated long getTotalTimeLong();
    method public void setBufferedPosition(long);
    method public deprecated void setBufferedProgress(int);
    method public deprecated void setBufferedProgressLong(long);
    method public void setCurrentPosition(long);
    method public deprecated void setCurrentTime(int);
    method public deprecated void setCurrentTimeLong(long);
    method public void setDuration(long);
    method public final void setImageBitmap(android.content.Context, android.graphics.Bitmap);
    method public final void setImageDrawable(android.graphics.drawable.Drawable);
    method public void setOnPlaybackProgressChangedListener(android.support.v17.leanback.widget.PlaybackControlsRow.OnPlaybackProgressCallback);
    method public final void setPrimaryActionsAdapter(android.support.v17.leanback.widget.ObjectAdapter);
    method public final void setSecondaryActionsAdapter(android.support.v17.leanback.widget.ObjectAdapter);
    method public deprecated void setTotalTime(int);
    method public deprecated void setTotalTimeLong(long);
  }

  public static class PlaybackControlsRow.ClosedCaptioningAction extends android.support.v17.leanback.widget.PlaybackControlsRow.MultiAction {
    ctor public PlaybackControlsRow.ClosedCaptioningAction(android.content.Context);
    ctor public PlaybackControlsRow.ClosedCaptioningAction(android.content.Context, int);
    field public static final int INDEX_OFF = 0; // 0x0
    field public static final int INDEX_ON = 1; // 0x1
    field public static deprecated int OFF;
    field public static deprecated int ON;
  }

  public static class PlaybackControlsRow.FastForwardAction extends android.support.v17.leanback.widget.PlaybackControlsRow.MultiAction {
    ctor public PlaybackControlsRow.FastForwardAction(android.content.Context);
    ctor public PlaybackControlsRow.FastForwardAction(android.content.Context, int);
  }

  public static class PlaybackControlsRow.HighQualityAction extends android.support.v17.leanback.widget.PlaybackControlsRow.MultiAction {
    ctor public PlaybackControlsRow.HighQualityAction(android.content.Context);
    ctor public PlaybackControlsRow.HighQualityAction(android.content.Context, int);
    field public static final int INDEX_OFF = 0; // 0x0
    field public static final int INDEX_ON = 1; // 0x1
    field public static deprecated int OFF;
    field public static deprecated int ON;
  }

  public static class PlaybackControlsRow.MoreActions extends android.support.v17.leanback.widget.Action {
    ctor public PlaybackControlsRow.MoreActions(android.content.Context);
  }

  public static abstract class PlaybackControlsRow.MultiAction extends android.support.v17.leanback.widget.Action {
    ctor public PlaybackControlsRow.MultiAction(int);
    method public int getActionCount();
    method public android.graphics.drawable.Drawable getDrawable(int);
    method public int getIndex();
    method public java.lang.String getLabel(int);
    method public java.lang.String getSecondaryLabel(int);
    method public void nextIndex();
    method public void setDrawables(android.graphics.drawable.Drawable[]);
    method public void setIndex(int);
    method public void setLabels(java.lang.String[]);
    method public void setSecondaryLabels(java.lang.String[]);
  }

  public static class PlaybackControlsRow.OnPlaybackProgressCallback {
    ctor public PlaybackControlsRow.OnPlaybackProgressCallback();
    method public void onBufferedPositionChanged(android.support.v17.leanback.widget.PlaybackControlsRow, long);
    method public void onCurrentPositionChanged(android.support.v17.leanback.widget.PlaybackControlsRow, long);
    method public void onDurationChanged(android.support.v17.leanback.widget.PlaybackControlsRow, long);
  }

  public static class PlaybackControlsRow.PictureInPictureAction extends android.support.v17.leanback.widget.Action {
    ctor public PlaybackControlsRow.PictureInPictureAction(android.content.Context);
  }

  public static class PlaybackControlsRow.PlayPauseAction extends android.support.v17.leanback.widget.PlaybackControlsRow.MultiAction {
    ctor public PlaybackControlsRow.PlayPauseAction(android.content.Context);
    field public static final int INDEX_PAUSE = 1; // 0x1
    field public static final int INDEX_PLAY = 0; // 0x0
    field public static deprecated int PAUSE;
    field public static deprecated int PLAY;
  }

  public static class PlaybackControlsRow.RepeatAction extends android.support.v17.leanback.widget.PlaybackControlsRow.MultiAction {
    ctor public PlaybackControlsRow.RepeatAction(android.content.Context);
    ctor public PlaybackControlsRow.RepeatAction(android.content.Context, int);
    ctor public PlaybackControlsRow.RepeatAction(android.content.Context, int, int);
    field public static deprecated int ALL;
    field public static final int INDEX_ALL = 1; // 0x1
    field public static final int INDEX_NONE = 0; // 0x0
    field public static final int INDEX_ONE = 2; // 0x2
    field public static deprecated int NONE;
    field public static deprecated int ONE;
  }

  public static class PlaybackControlsRow.RewindAction extends android.support.v17.leanback.widget.PlaybackControlsRow.MultiAction {
    ctor public PlaybackControlsRow.RewindAction(android.content.Context);
    ctor public PlaybackControlsRow.RewindAction(android.content.Context, int);
  }

  public static class PlaybackControlsRow.ShuffleAction extends android.support.v17.leanback.widget.PlaybackControlsRow.MultiAction {
    ctor public PlaybackControlsRow.ShuffleAction(android.content.Context);
    ctor public PlaybackControlsRow.ShuffleAction(android.content.Context, int);
    field public static final int INDEX_OFF = 0; // 0x0
    field public static final int INDEX_ON = 1; // 0x1
    field public static deprecated int OFF;
    field public static deprecated int ON;
  }

  public static class PlaybackControlsRow.SkipNextAction extends android.support.v17.leanback.widget.Action {
    ctor public PlaybackControlsRow.SkipNextAction(android.content.Context);
  }

  public static class PlaybackControlsRow.SkipPreviousAction extends android.support.v17.leanback.widget.Action {
    ctor public PlaybackControlsRow.SkipPreviousAction(android.content.Context);
  }

  public static abstract class PlaybackControlsRow.ThumbsAction extends android.support.v17.leanback.widget.PlaybackControlsRow.MultiAction {
    ctor public PlaybackControlsRow.ThumbsAction(int, android.content.Context, int, int);
    field public static final int INDEX_OUTLINE = 1; // 0x1
    field public static final int INDEX_SOLID = 0; // 0x0
    field public static deprecated int OUTLINE;
    field public static deprecated int SOLID;
  }

  public static class PlaybackControlsRow.ThumbsDownAction extends android.support.v17.leanback.widget.PlaybackControlsRow.ThumbsAction {
    ctor public PlaybackControlsRow.ThumbsDownAction(android.content.Context);
  }

  public static class PlaybackControlsRow.ThumbsUpAction extends android.support.v17.leanback.widget.PlaybackControlsRow.ThumbsAction {
    ctor public PlaybackControlsRow.ThumbsUpAction(android.content.Context);
  }

  public class PlaybackControlsRowPresenter extends android.support.v17.leanback.widget.PlaybackRowPresenter {
    ctor public PlaybackControlsRowPresenter(android.support.v17.leanback.widget.Presenter);
    ctor public PlaybackControlsRowPresenter();
    method public boolean areSecondaryActionsHidden();
    method protected android.support.v17.leanback.widget.RowPresenter.ViewHolder createRowViewHolder(android.view.ViewGroup);
    method public int getBackgroundColor();
    method public android.support.v17.leanback.widget.OnActionClickedListener getOnActionClickedListener();
    method public int getProgressColor();
    method public void setBackgroundColor(int);
    method public void setOnActionClickedListener(android.support.v17.leanback.widget.OnActionClickedListener);
    method public void setProgressColor(int);
    method public void setSecondaryActionsHidden(boolean);
    method public void showBottomSpace(android.support.v17.leanback.widget.PlaybackControlsRowPresenter.ViewHolder, boolean);
    method public void showPrimaryActions(android.support.v17.leanback.widget.PlaybackControlsRowPresenter.ViewHolder);
  }

  public class PlaybackControlsRowPresenter.ViewHolder extends android.support.v17.leanback.widget.PlaybackRowPresenter.ViewHolder {
    field public final android.support.v17.leanback.widget.Presenter.ViewHolder mDescriptionViewHolder;
  }

  public abstract class PlaybackRowPresenter extends android.support.v17.leanback.widget.RowPresenter {
    ctor public PlaybackRowPresenter();
    method public void onReappear(android.support.v17.leanback.widget.RowPresenter.ViewHolder);
  }

  public static class PlaybackRowPresenter.ViewHolder extends android.support.v17.leanback.widget.RowPresenter.ViewHolder {
    ctor public PlaybackRowPresenter.ViewHolder(android.view.View);
  }

  public class PlaybackSeekDataProvider {
    ctor public PlaybackSeekDataProvider();
    method public long[] getSeekPositions();
    method public void getThumbnail(int, android.support.v17.leanback.widget.PlaybackSeekDataProvider.ResultCallback);
    method public void reset();
  }

  public static class PlaybackSeekDataProvider.ResultCallback {
    ctor public PlaybackSeekDataProvider.ResultCallback();
    method public void onThumbnailLoaded(android.graphics.Bitmap, int);
  }

  public abstract interface PlaybackSeekUi {
    method public abstract void setPlaybackSeekUiClient(android.support.v17.leanback.widget.PlaybackSeekUi.Client);
  }

  public static class PlaybackSeekUi.Client {
    ctor public PlaybackSeekUi.Client();
    method public android.support.v17.leanback.widget.PlaybackSeekDataProvider getPlaybackSeekDataProvider();
    method public boolean isSeekEnabled();
    method public void onSeekFinished(boolean);
    method public void onSeekPositionChanged(long);
    method public void onSeekStarted();
  }

  public class PlaybackTransportRowPresenter extends android.support.v17.leanback.widget.PlaybackRowPresenter {
    ctor public PlaybackTransportRowPresenter();
    method protected android.support.v17.leanback.widget.RowPresenter.ViewHolder createRowViewHolder(android.view.ViewGroup);
    method public float getDefaultSeekIncrement();
    method public android.support.v17.leanback.widget.OnActionClickedListener getOnActionClickedListener();
    method public int getProgressColor();
    method protected void onProgressBarClicked(android.support.v17.leanback.widget.PlaybackTransportRowPresenter.ViewHolder);
    method public void setDefaultSeekIncrement(float);
    method public void setDescriptionPresenter(android.support.v17.leanback.widget.Presenter);
    method public void setOnActionClickedListener(android.support.v17.leanback.widget.OnActionClickedListener);
    method public void setProgressColor(int);
  }

  public class PlaybackTransportRowPresenter.ViewHolder extends android.support.v17.leanback.widget.PlaybackRowPresenter.ViewHolder implements android.support.v17.leanback.widget.PlaybackSeekUi {
    ctor public PlaybackTransportRowPresenter.ViewHolder(android.view.View, android.support.v17.leanback.widget.Presenter);
    method public final android.widget.TextView getCurrentPositionView();
    method public final android.support.v17.leanback.widget.Presenter.ViewHolder getDescriptionViewHolder();
    method public final android.widget.TextView getDurationView();
    method protected void onSetCurrentPositionLabel(long);
    method protected void onSetDurationLabel(long);
    method public void setPlaybackSeekUiClient(android.support.v17.leanback.widget.PlaybackSeekUi.Client);
  }

  public abstract class Presenter implements android.support.v17.leanback.widget.FacetProvider {
    ctor public Presenter();
    method protected static void cancelAnimationsRecursive(android.view.View);
    method public final java.lang.Object getFacet(java.lang.Class<?>);
    method public abstract void onBindViewHolder(android.support.v17.leanback.widget.Presenter.ViewHolder, java.lang.Object);
    method public abstract android.support.v17.leanback.widget.Presenter.ViewHolder onCreateViewHolder(android.view.ViewGroup);
    method public abstract void onUnbindViewHolder(android.support.v17.leanback.widget.Presenter.ViewHolder);
    method public void onViewAttachedToWindow(android.support.v17.leanback.widget.Presenter.ViewHolder);
    method public void onViewDetachedFromWindow(android.support.v17.leanback.widget.Presenter.ViewHolder);
    method public final void setFacet(java.lang.Class<?>, java.lang.Object);
    method public void setOnClickListener(android.support.v17.leanback.widget.Presenter.ViewHolder, android.view.View.OnClickListener);
  }

  public static class Presenter.ViewHolder implements android.support.v17.leanback.widget.FacetProvider {
    ctor public Presenter.ViewHolder(android.view.View);
    method public final java.lang.Object getFacet(java.lang.Class<?>);
    method public final void setFacet(java.lang.Class<?>, java.lang.Object);
    field public final android.view.View view;
  }

  public static abstract class Presenter.ViewHolderTask {
    ctor public Presenter.ViewHolderTask();
    method public void run(android.support.v17.leanback.widget.Presenter.ViewHolder);
  }

  public abstract class PresenterSelector {
    ctor public PresenterSelector();
    method public abstract android.support.v17.leanback.widget.Presenter getPresenter(java.lang.Object);
    method public android.support.v17.leanback.widget.Presenter[] getPresenters();
  }

  public abstract class PresenterSwitcher {
    ctor public PresenterSwitcher();
    method public void clear();
    method public final android.view.ViewGroup getParentViewGroup();
    method public void init(android.view.ViewGroup, android.support.v17.leanback.widget.PresenterSelector);
    method protected abstract void insertView(android.view.View);
    method protected void onViewSelected(android.view.View);
    method public void select(java.lang.Object);
    method protected void showView(android.view.View, boolean);
    method public void unselect();
  }

  public class RecyclerViewParallax extends android.support.v17.leanback.widget.Parallax {
    ctor public RecyclerViewParallax();
    method public android.support.v17.leanback.widget.RecyclerViewParallax.ChildPositionProperty createProperty(java.lang.String, int);
    method public float getMaxValue();
    method public android.support.v7.widget.RecyclerView getRecyclerView();
    method public void setRecyclerView(android.support.v7.widget.RecyclerView);
  }

  public static final class RecyclerViewParallax.ChildPositionProperty extends android.support.v17.leanback.widget.Parallax.IntProperty {
    method public android.support.v17.leanback.widget.RecyclerViewParallax.ChildPositionProperty adapterPosition(int);
    method public android.support.v17.leanback.widget.RecyclerViewParallax.ChildPositionProperty fraction(float);
    method public int getAdapterPosition();
    method public float getFraction();
    method public int getOffset();
    method public int getViewId();
    method public android.support.v17.leanback.widget.RecyclerViewParallax.ChildPositionProperty offset(int);
    method public android.support.v17.leanback.widget.RecyclerViewParallax.ChildPositionProperty viewId(int);
  }

  public class Row {
    ctor public Row(long, android.support.v17.leanback.widget.HeaderItem);
    ctor public Row(android.support.v17.leanback.widget.HeaderItem);
    ctor public Row();
    method public final android.support.v17.leanback.widget.HeaderItem getHeaderItem();
    method public final long getId();
    method public boolean isRenderedAsRowView();
    method public final void setHeaderItem(android.support.v17.leanback.widget.HeaderItem);
    method public final void setId(long);
  }

  public class RowHeaderPresenter extends android.support.v17.leanback.widget.Presenter {
    ctor public RowHeaderPresenter();
    method protected static float getFontDescent(android.widget.TextView, android.graphics.Paint);
    method public int getSpaceUnderBaseline(android.support.v17.leanback.widget.RowHeaderPresenter.ViewHolder);
    method public boolean isNullItemVisibilityGone();
    method public void onBindViewHolder(android.support.v17.leanback.widget.Presenter.ViewHolder, java.lang.Object);
    method public android.support.v17.leanback.widget.Presenter.ViewHolder onCreateViewHolder(android.view.ViewGroup);
    method protected void onSelectLevelChanged(android.support.v17.leanback.widget.RowHeaderPresenter.ViewHolder);
    method public void onUnbindViewHolder(android.support.v17.leanback.widget.Presenter.ViewHolder);
    method public void setNullItemVisibilityGone(boolean);
    method public final void setSelectLevel(android.support.v17.leanback.widget.RowHeaderPresenter.ViewHolder, float);
  }

  public static class RowHeaderPresenter.ViewHolder extends android.support.v17.leanback.widget.Presenter.ViewHolder {
    ctor public RowHeaderPresenter.ViewHolder(android.view.View);
    method public final float getSelectLevel();
  }

  public final class RowHeaderView extends android.widget.TextView {
    ctor public RowHeaderView(android.content.Context);
    ctor public RowHeaderView(android.content.Context, android.util.AttributeSet);
    ctor public RowHeaderView(android.content.Context, android.util.AttributeSet, int);
  }

  public abstract class RowPresenter extends android.support.v17.leanback.widget.Presenter {
    ctor public RowPresenter();
    method protected abstract android.support.v17.leanback.widget.RowPresenter.ViewHolder createRowViewHolder(android.view.ViewGroup);
    method protected void dispatchItemSelectedListener(android.support.v17.leanback.widget.RowPresenter.ViewHolder, boolean);
    method public void freeze(android.support.v17.leanback.widget.RowPresenter.ViewHolder, boolean);
    method public final android.support.v17.leanback.widget.RowHeaderPresenter getHeaderPresenter();
    method public final android.support.v17.leanback.widget.RowPresenter.ViewHolder getRowViewHolder(android.support.v17.leanback.widget.Presenter.ViewHolder);
    method public final boolean getSelectEffectEnabled();
    method public final float getSelectLevel(android.support.v17.leanback.widget.Presenter.ViewHolder);
    method public final int getSyncActivatePolicy();
    method protected void initializeRowViewHolder(android.support.v17.leanback.widget.RowPresenter.ViewHolder);
    method protected boolean isClippingChildren();
    method public boolean isUsingDefaultSelectEffect();
    method protected void onBindRowViewHolder(android.support.v17.leanback.widget.RowPresenter.ViewHolder, java.lang.Object);
    method public final void onBindViewHolder(android.support.v17.leanback.widget.Presenter.ViewHolder, java.lang.Object);
    method public final android.support.v17.leanback.widget.Presenter.ViewHolder onCreateViewHolder(android.view.ViewGroup);
    method protected void onRowViewAttachedToWindow(android.support.v17.leanback.widget.RowPresenter.ViewHolder);
    method protected void onRowViewDetachedFromWindow(android.support.v17.leanback.widget.RowPresenter.ViewHolder);
    method protected void onRowViewExpanded(android.support.v17.leanback.widget.RowPresenter.ViewHolder, boolean);
    method protected void onRowViewSelected(android.support.v17.leanback.widget.RowPresenter.ViewHolder, boolean);
    method protected void onSelectLevelChanged(android.support.v17.leanback.widget.RowPresenter.ViewHolder);
    method protected void onUnbindRowViewHolder(android.support.v17.leanback.widget.RowPresenter.ViewHolder);
    method public final void onUnbindViewHolder(android.support.v17.leanback.widget.Presenter.ViewHolder);
    method public final void onViewAttachedToWindow(android.support.v17.leanback.widget.Presenter.ViewHolder);
    method public final void onViewDetachedFromWindow(android.support.v17.leanback.widget.Presenter.ViewHolder);
    method public void setEntranceTransitionState(android.support.v17.leanback.widget.RowPresenter.ViewHolder, boolean);
    method public final void setHeaderPresenter(android.support.v17.leanback.widget.RowHeaderPresenter);
    method public final void setRowViewExpanded(android.support.v17.leanback.widget.Presenter.ViewHolder, boolean);
    method public final void setRowViewSelected(android.support.v17.leanback.widget.Presenter.ViewHolder, boolean);
    method public final void setSelectEffectEnabled(boolean);
    method public final void setSelectLevel(android.support.v17.leanback.widget.Presenter.ViewHolder, float);
    method public final void setSyncActivatePolicy(int);
    field public static final int SYNC_ACTIVATED_CUSTOM = 0; // 0x0
    field public static final int SYNC_ACTIVATED_TO_EXPANDED = 1; // 0x1
    field public static final int SYNC_ACTIVATED_TO_EXPANDED_AND_SELECTED = 3; // 0x3
    field public static final int SYNC_ACTIVATED_TO_SELECTED = 2; // 0x2
  }

  public static class RowPresenter.ViewHolder extends android.support.v17.leanback.widget.Presenter.ViewHolder {
    ctor public RowPresenter.ViewHolder(android.view.View);
    method public final android.support.v17.leanback.widget.RowHeaderPresenter.ViewHolder getHeaderViewHolder();
    method public final android.support.v17.leanback.widget.BaseOnItemViewClickedListener getOnItemViewClickedListener();
    method public final android.support.v17.leanback.widget.BaseOnItemViewSelectedListener getOnItemViewSelectedListener();
    method public android.view.View.OnKeyListener getOnKeyListener();
    method public final android.support.v17.leanback.widget.Row getRow();
    method public final java.lang.Object getRowObject();
    method public final float getSelectLevel();
    method public java.lang.Object getSelectedItem();
    method public android.support.v17.leanback.widget.Presenter.ViewHolder getSelectedItemViewHolder();
    method public final boolean isExpanded();
    method public final boolean isSelected();
    method public final void setActivated(boolean);
    method public final void setOnItemViewClickedListener(android.support.v17.leanback.widget.BaseOnItemViewClickedListener);
    method public final void setOnItemViewSelectedListener(android.support.v17.leanback.widget.BaseOnItemViewSelectedListener);
    method public void setOnKeyListener(android.view.View.OnKeyListener);
    method public final void syncActivatedStatus(android.view.View);
    field protected final android.support.v17.leanback.graphics.ColorOverlayDimmer mColorDimmer;
  }

  public class SearchBar extends android.widget.RelativeLayout {
    ctor public SearchBar(android.content.Context);
    ctor public SearchBar(android.content.Context, android.util.AttributeSet);
    ctor public SearchBar(android.content.Context, android.util.AttributeSet, int);
    method public void displayCompletions(java.util.List<java.lang.String>);
    method public void displayCompletions(android.view.inputmethod.CompletionInfo[]);
    method public android.graphics.drawable.Drawable getBadgeDrawable();
    method public java.lang.CharSequence getHint();
    method public java.lang.String getTitle();
    method public boolean isRecognizing();
    method public void setBadgeDrawable(android.graphics.drawable.Drawable);
    method public void setPermissionListener(android.support.v17.leanback.widget.SearchBar.SearchBarPermissionListener);
    method public void setSearchAffordanceColors(android.support.v17.leanback.widget.SearchOrbView.Colors);
    method public void setSearchAffordanceColorsInListening(android.support.v17.leanback.widget.SearchOrbView.Colors);
    method public void setSearchBarListener(android.support.v17.leanback.widget.SearchBar.SearchBarListener);
    method public void setSearchQuery(java.lang.String);
    method public void setSpeechRecognitionCallback(android.support.v17.leanback.widget.SpeechRecognitionCallback);
    method public void setSpeechRecognizer(android.speech.SpeechRecognizer);
    method public void setTitle(java.lang.String);
    method public void startRecognition();
    method public void stopRecognition();
  }

  public static abstract interface SearchBar.SearchBarListener {
    method public abstract void onKeyboardDismiss(java.lang.String);
    method public abstract void onSearchQueryChange(java.lang.String);
    method public abstract void onSearchQuerySubmit(java.lang.String);
  }

  public static abstract interface SearchBar.SearchBarPermissionListener {
    method public abstract void requestAudioPermission();
  }

  public class SearchEditText extends android.support.v17.leanback.widget.StreamingTextView {
    ctor public SearchEditText(android.content.Context);
    ctor public SearchEditText(android.content.Context, android.util.AttributeSet);
    ctor public SearchEditText(android.content.Context, android.util.AttributeSet, int);
    method public void setOnKeyboardDismissListener(android.support.v17.leanback.widget.SearchEditText.OnKeyboardDismissListener);
  }

  public static abstract interface SearchEditText.OnKeyboardDismissListener {
    method public abstract void onKeyboardDismiss();
  }

  public class SearchOrbView extends android.widget.FrameLayout implements android.view.View.OnClickListener {
    ctor public SearchOrbView(android.content.Context);
    ctor public SearchOrbView(android.content.Context, android.util.AttributeSet);
    ctor public SearchOrbView(android.content.Context, android.util.AttributeSet, int);
    method public void enableOrbColorAnimation(boolean);
    method public int getOrbColor();
    method public android.support.v17.leanback.widget.SearchOrbView.Colors getOrbColors();
    method public android.graphics.drawable.Drawable getOrbIcon();
    method public void onClick(android.view.View);
    method public void setOnOrbClickedListener(android.view.View.OnClickListener);
    method public void setOrbColor(int);
    method public deprecated void setOrbColor(int, int);
    method public void setOrbColors(android.support.v17.leanback.widget.SearchOrbView.Colors);
    method public void setOrbIcon(android.graphics.drawable.Drawable);
  }

  public static class SearchOrbView.Colors {
    ctor public SearchOrbView.Colors(int);
    ctor public SearchOrbView.Colors(int, int);
    ctor public SearchOrbView.Colors(int, int, int);
    method public static int getBrightColor(int);
    field public int brightColor;
    field public int color;
    field public int iconColor;
  }

  public class SectionRow extends android.support.v17.leanback.widget.Row {
    ctor public SectionRow(android.support.v17.leanback.widget.HeaderItem);
    ctor public SectionRow(long, java.lang.String);
    ctor public SectionRow(java.lang.String);
    method public final boolean isRenderedAsRowView();
  }

  public class ShadowOverlayContainer extends android.widget.FrameLayout {
    ctor public ShadowOverlayContainer(android.content.Context);
    ctor public ShadowOverlayContainer(android.content.Context, android.util.AttributeSet);
    ctor public ShadowOverlayContainer(android.content.Context, android.util.AttributeSet, int);
    method public int getShadowType();
    method public android.view.View getWrappedView();
    method public deprecated void initialize(boolean, boolean);
    method public deprecated void initialize(boolean, boolean, boolean);
    method public static void prepareParentForShadow(android.view.ViewGroup);
    method public void setOverlayColor(int);
    method public void setShadowFocusLevel(float);
    method public static boolean supportsDynamicShadow();
    method public static boolean supportsShadow();
    method public void useDynamicShadow();
    method public void useDynamicShadow(float, float);
    method public void useStaticShadow();
    method public void wrap(android.view.View);
    field public static final int SHADOW_DYNAMIC = 3; // 0x3
    field public static final int SHADOW_NONE = 1; // 0x1
    field public static final int SHADOW_STATIC = 2; // 0x2
  }

  public final class ShadowOverlayHelper {
    method public android.support.v17.leanback.widget.ShadowOverlayContainer createShadowOverlayContainer(android.content.Context);
    method public int getShadowType();
    method public boolean needsOverlay();
    method public boolean needsRoundedCorner();
    method public boolean needsWrapper();
    method public void onViewCreated(android.view.View);
    method public void prepareParentForShadow(android.view.ViewGroup);
    method public static void setNoneWrapperOverlayColor(android.view.View, int);
    method public static void setNoneWrapperShadowFocusLevel(android.view.View, float);
    method public void setOverlayColor(android.view.View, int);
    method public void setShadowFocusLevel(android.view.View, float);
    method public static boolean supportsDynamicShadow();
    method public static boolean supportsForeground();
    method public static boolean supportsRoundedCorner();
    method public static boolean supportsShadow();
    field public static final int SHADOW_DYNAMIC = 3; // 0x3
    field public static final int SHADOW_NONE = 1; // 0x1
    field public static final int SHADOW_STATIC = 2; // 0x2
  }

  public static final class ShadowOverlayHelper.Builder {
    ctor public ShadowOverlayHelper.Builder();
    method public android.support.v17.leanback.widget.ShadowOverlayHelper build(android.content.Context);
    method public android.support.v17.leanback.widget.ShadowOverlayHelper.Builder keepForegroundDrawable(boolean);
    method public android.support.v17.leanback.widget.ShadowOverlayHelper.Builder needsOverlay(boolean);
    method public android.support.v17.leanback.widget.ShadowOverlayHelper.Builder needsRoundedCorner(boolean);
    method public android.support.v17.leanback.widget.ShadowOverlayHelper.Builder needsShadow(boolean);
    method public android.support.v17.leanback.widget.ShadowOverlayHelper.Builder options(android.support.v17.leanback.widget.ShadowOverlayHelper.Options);
    method public android.support.v17.leanback.widget.ShadowOverlayHelper.Builder preferZOrder(boolean);
  }

  public static final class ShadowOverlayHelper.Options {
    ctor public ShadowOverlayHelper.Options();
    method public android.support.v17.leanback.widget.ShadowOverlayHelper.Options dynamicShadowZ(float, float);
    method public final float getDynamicShadowFocusedZ();
    method public final float getDynamicShadowUnfocusedZ();
    method public final int getRoundedCornerRadius();
    method public android.support.v17.leanback.widget.ShadowOverlayHelper.Options roundedCornerRadius(int);
    field public static final android.support.v17.leanback.widget.ShadowOverlayHelper.Options DEFAULT;
  }

  public final class SinglePresenterSelector extends android.support.v17.leanback.widget.PresenterSelector {
    ctor public SinglePresenterSelector(android.support.v17.leanback.widget.Presenter);
    method public android.support.v17.leanback.widget.Presenter getPresenter(java.lang.Object);
  }

  public class SparseArrayObjectAdapter extends android.support.v17.leanback.widget.ObjectAdapter {
    ctor public SparseArrayObjectAdapter(android.support.v17.leanback.widget.PresenterSelector);
    ctor public SparseArrayObjectAdapter(android.support.v17.leanback.widget.Presenter);
    ctor public SparseArrayObjectAdapter();
    method public void clear(int);
    method public void clear();
    method public java.lang.Object get(int);
    method public int indexOf(java.lang.Object);
    method public int indexOf(int);
    method public java.lang.Object lookup(int);
    method public void notifyArrayItemRangeChanged(int, int);
    method public void set(int, java.lang.Object);
    method public int size();
  }

  public class SpeechOrbView extends android.support.v17.leanback.widget.SearchOrbView {
    ctor public SpeechOrbView(android.content.Context);
    ctor public SpeechOrbView(android.content.Context, android.util.AttributeSet);
    ctor public SpeechOrbView(android.content.Context, android.util.AttributeSet, int);
    method public void setListeningOrbColors(android.support.v17.leanback.widget.SearchOrbView.Colors);
    method public void setNotListeningOrbColors(android.support.v17.leanback.widget.SearchOrbView.Colors);
    method public void setSoundLevel(int);
    method public void showListening();
    method public void showNotListening();
  }

  public abstract interface SpeechRecognitionCallback {
    method public abstract void recognizeSpeech();
  }

   class StreamingTextView extends android.widget.EditText {
    ctor public StreamingTextView(android.content.Context, android.util.AttributeSet);
    ctor public StreamingTextView(android.content.Context, android.util.AttributeSet, int);
    method public static boolean isLayoutRtl(android.view.View);
    method public void reset();
    method public void setFinalRecognizedText(java.lang.CharSequence);
    method public void updateRecognizedText(java.lang.String, java.lang.String);
    method public void updateRecognizedText(java.lang.String, java.util.List<java.lang.Float>);
  }

  public class TitleHelper {
    ctor public TitleHelper(android.view.ViewGroup, android.view.View);
    method public android.support.v17.leanback.widget.BrowseFrameLayout.OnFocusSearchListener getOnFocusSearchListener();
    method public android.view.ViewGroup getSceneRoot();
    method public android.view.View getTitleView();
    method public void showTitle(boolean);
  }

  public class TitleView extends android.widget.FrameLayout implements android.support.v17.leanback.widget.TitleViewAdapter.Provider {
    ctor public TitleView(android.content.Context);
    ctor public TitleView(android.content.Context, android.util.AttributeSet);
    ctor public TitleView(android.content.Context, android.util.AttributeSet, int);
    method public void enableAnimation(boolean);
    method public android.graphics.drawable.Drawable getBadgeDrawable();
    method public android.support.v17.leanback.widget.SearchOrbView.Colors getSearchAffordanceColors();
    method public android.view.View getSearchAffordanceView();
    method public java.lang.CharSequence getTitle();
    method public android.support.v17.leanback.widget.TitleViewAdapter getTitleViewAdapter();
    method public void setBadgeDrawable(android.graphics.drawable.Drawable);
    method public void setOnSearchClickedListener(android.view.View.OnClickListener);
    method public void setSearchAffordanceColors(android.support.v17.leanback.widget.SearchOrbView.Colors);
    method public void setTitle(java.lang.CharSequence);
    method public void updateComponentsVisibility(int);
  }

  public abstract class TitleViewAdapter {
    ctor public TitleViewAdapter();
    method public android.graphics.drawable.Drawable getBadgeDrawable();
    method public android.support.v17.leanback.widget.SearchOrbView.Colors getSearchAffordanceColors();
    method public abstract android.view.View getSearchAffordanceView();
    method public java.lang.CharSequence getTitle();
    method public void setAnimationEnabled(boolean);
    method public void setBadgeDrawable(android.graphics.drawable.Drawable);
    method public void setOnSearchClickedListener(android.view.View.OnClickListener);
    method public void setSearchAffordanceColors(android.support.v17.leanback.widget.SearchOrbView.Colors);
    method public void setTitle(java.lang.CharSequence);
    method public void updateComponentsVisibility(int);
    field public static final int BRANDING_VIEW_VISIBLE = 2; // 0x2
    field public static final int FULL_VIEW_VISIBLE = 6; // 0x6
    field public static final int SEARCH_VIEW_VISIBLE = 4; // 0x4
  }

  public static abstract interface TitleViewAdapter.Provider {
    method public abstract android.support.v17.leanback.widget.TitleViewAdapter getTitleViewAdapter();
  }

  public class VerticalGridPresenter extends android.support.v17.leanback.widget.Presenter {
    ctor public VerticalGridPresenter();
    ctor public VerticalGridPresenter(int);
    ctor public VerticalGridPresenter(int, boolean);
    method public final boolean areChildRoundedCornersEnabled();
    method protected android.support.v17.leanback.widget.VerticalGridPresenter.ViewHolder createGridViewHolder(android.view.ViewGroup);
    method protected android.support.v17.leanback.widget.ShadowOverlayHelper.Options createShadowOverlayOptions();
    method public final void enableChildRoundedCorners(boolean);
    method public final int getFocusZoomFactor();
    method public final boolean getKeepChildForeground();
    method public int getNumberOfColumns();
    method public final android.support.v17.leanback.widget.OnItemViewClickedListener getOnItemViewClickedListener();
    method public final android.support.v17.leanback.widget.OnItemViewSelectedListener getOnItemViewSelectedListener();
    method public final boolean getShadowEnabled();
    method protected void initializeGridViewHolder(android.support.v17.leanback.widget.VerticalGridPresenter.ViewHolder);
    method public final boolean isFocusDimmerUsed();
    method public boolean isUsingDefaultShadow();
    method public boolean isUsingZOrder(android.content.Context);
    method public void onBindViewHolder(android.support.v17.leanback.widget.Presenter.ViewHolder, java.lang.Object);
    method public final android.support.v17.leanback.widget.VerticalGridPresenter.ViewHolder onCreateViewHolder(android.view.ViewGroup);
    method public void onUnbindViewHolder(android.support.v17.leanback.widget.Presenter.ViewHolder);
    method public void setEntranceTransitionState(android.support.v17.leanback.widget.VerticalGridPresenter.ViewHolder, boolean);
    method public final void setKeepChildForeground(boolean);
    method public void setNumberOfColumns(int);
    method public final void setOnItemViewClickedListener(android.support.v17.leanback.widget.OnItemViewClickedListener);
    method public final void setOnItemViewSelectedListener(android.support.v17.leanback.widget.OnItemViewSelectedListener);
    method public final void setShadowEnabled(boolean);
  }

  public static class VerticalGridPresenter.ViewHolder extends android.support.v17.leanback.widget.Presenter.ViewHolder {
    ctor public VerticalGridPresenter.ViewHolder(android.support.v17.leanback.widget.VerticalGridView);
    method public android.support.v17.leanback.widget.VerticalGridView getGridView();
  }

  public class VerticalGridView extends android.support.v17.leanback.widget.BaseGridView {
    ctor public VerticalGridView(android.content.Context);
    ctor public VerticalGridView(android.content.Context, android.util.AttributeSet);
    ctor public VerticalGridView(android.content.Context, android.util.AttributeSet, int);
    method protected void initAttributes(android.content.Context, android.util.AttributeSet);
    method public void setColumnWidth(int);
    method public void setNumColumns(int);
  }

  public abstract interface ViewHolderTask {
    method public abstract void run(android.support.v7.widget.RecyclerView.ViewHolder);
  }

}

package android.support.v17.leanback.widget.picker {

  public class Picker extends android.widget.FrameLayout {
    ctor public Picker(android.content.Context, android.util.AttributeSet, int);
    method public void addOnValueChangedListener(android.support.v17.leanback.widget.picker.Picker.PickerValueListener);
    method public float getActivatedVisibleItemCount();
    method public android.support.v17.leanback.widget.picker.PickerColumn getColumnAt(int);
    method public int getColumnsCount();
    method protected int getPickerItemHeightPixels();
    method public final int getPickerItemLayoutId();
    method public final int getPickerItemTextViewId();
    method public int getSelectedColumn();
    method public final java.lang.CharSequence getSeparator();
    method public float getVisibleItemCount();
    method public void onColumnValueChanged(int, int);
    method public void removeOnValueChangedListener(android.support.v17.leanback.widget.picker.Picker.PickerValueListener);
    method public void setActivatedVisibleItemCount(float);
    method public void setColumnAt(int, android.support.v17.leanback.widget.picker.PickerColumn);
    method public void setColumnValue(int, int, boolean);
    method public void setColumns(java.util.List<android.support.v17.leanback.widget.picker.PickerColumn>);
    method public final void setPickerItemTextViewId(int);
    method public void setSelectedColumn(int);
    method public final void setSeparator(java.lang.CharSequence);
    method public void setVisibleItemCount(float);
  }

  public static abstract interface Picker.PickerValueListener {
    method public abstract void onValueChanged(android.support.v17.leanback.widget.picker.Picker, int);
  }

  public class PickerColumn {
    ctor public PickerColumn();
    method public int getCount();
    method public int getCurrentValue();
    method public java.lang.CharSequence getLabelFor(int);
    method public java.lang.String getLabelFormat();
    method public int getMaxValue();
    method public int getMinValue();
    method public java.lang.CharSequence[] getStaticLabels();
    method public void setCurrentValue(int);
    method public void setLabelFormat(java.lang.String);
    method public void setMaxValue(int);
    method public void setMinValue(int);
    method public void setStaticLabels(java.lang.CharSequence[]);
  }

  public class TimePicker extends android.support.v17.leanback.widget.picker.Picker {
    ctor public TimePicker(android.content.Context, android.util.AttributeSet);
    ctor public TimePicker(android.content.Context, android.util.AttributeSet, int);
    method public int getHour();
    method public int getMinute();
    method public boolean is24Hour();
    method public boolean isPm();
    method public void setHour(int);
    method public void setIs24Hour(boolean);
    method public void setMinute(int);
  }

}

package android.support.v17.preference {

  public abstract class BaseLeanbackPreferenceFragment extends android.support.v14.preference.PreferenceFragment {
    ctor public BaseLeanbackPreferenceFragment();
  }

  public class LeanbackListPreferenceDialogFragment extends android.support.v17.preference.LeanbackPreferenceDialogFragment {
    ctor public LeanbackListPreferenceDialogFragment();
    method public static android.support.v17.preference.LeanbackListPreferenceDialogFragment newInstanceMulti(java.lang.String);
    method public static android.support.v17.preference.LeanbackListPreferenceDialogFragment newInstanceSingle(java.lang.String);
    method public android.support.v7.widget.RecyclerView.Adapter onCreateAdapter();
  }

  public class LeanbackListPreferenceDialogFragment.AdapterMulti extends android.support.v7.widget.RecyclerView.Adapter implements android.support.v17.preference.LeanbackListPreferenceDialogFragment.ViewHolder.OnItemClickListener {
    ctor public LeanbackListPreferenceDialogFragment.AdapterMulti(java.lang.CharSequence[], java.lang.CharSequence[], java.util.Set<java.lang.String>);
    method public int getItemCount();
    method public void onBindViewHolder(android.support.v17.preference.LeanbackListPreferenceDialogFragment.ViewHolder, int);
    method public android.support.v17.preference.LeanbackListPreferenceDialogFragment.ViewHolder onCreateViewHolder(android.view.ViewGroup, int);
    method public void onItemClick(android.support.v17.preference.LeanbackListPreferenceDialogFragment.ViewHolder);
  }

  public class LeanbackListPreferenceDialogFragment.AdapterSingle extends android.support.v7.widget.RecyclerView.Adapter implements android.support.v17.preference.LeanbackListPreferenceDialogFragment.ViewHolder.OnItemClickListener {
    ctor public LeanbackListPreferenceDialogFragment.AdapterSingle(java.lang.CharSequence[], java.lang.CharSequence[], java.lang.CharSequence);
    method public int getItemCount();
    method public void onBindViewHolder(android.support.v17.preference.LeanbackListPreferenceDialogFragment.ViewHolder, int);
    method public android.support.v17.preference.LeanbackListPreferenceDialogFragment.ViewHolder onCreateViewHolder(android.view.ViewGroup, int);
    method public void onItemClick(android.support.v17.preference.LeanbackListPreferenceDialogFragment.ViewHolder);
  }

  public static class LeanbackListPreferenceDialogFragment.ViewHolder extends android.support.v7.widget.RecyclerView.ViewHolder implements android.view.View.OnClickListener {
    ctor public LeanbackListPreferenceDialogFragment.ViewHolder(android.view.View, android.support.v17.preference.LeanbackListPreferenceDialogFragment.ViewHolder.OnItemClickListener);
    method public android.view.ViewGroup getContainer();
    method public android.widget.TextView getTitleView();
    method public android.widget.Checkable getWidgetView();
    method public void onClick(android.view.View);
  }

  public static abstract interface LeanbackListPreferenceDialogFragment.ViewHolder.OnItemClickListener {
    method public abstract void onItemClick(android.support.v17.preference.LeanbackListPreferenceDialogFragment.ViewHolder);
  }

  public class LeanbackPreferenceDialogFragment extends android.app.Fragment {
    ctor public LeanbackPreferenceDialogFragment();
    method public android.support.v7.preference.DialogPreference getPreference();
    field public static final java.lang.String ARG_KEY = "key";
  }

  public abstract class LeanbackPreferenceFragment extends android.support.v17.preference.BaseLeanbackPreferenceFragment {
    ctor public LeanbackPreferenceFragment();
    method public void setTitle(java.lang.CharSequence);
  }

  public abstract class LeanbackSettingsFragment extends android.app.Fragment implements android.support.v14.preference.PreferenceFragment.OnPreferenceDisplayDialogCallback android.support.v14.preference.PreferenceFragment.OnPreferenceStartFragmentCallback android.support.v14.preference.PreferenceFragment.OnPreferenceStartScreenCallback {
    ctor public LeanbackSettingsFragment();
    method public boolean onPreferenceDisplayDialog(android.support.v14.preference.PreferenceFragment, android.support.v7.preference.Preference);
    method public abstract void onPreferenceStartInitialScreen();
    method public void startImmersiveFragment(android.app.Fragment);
    method public void startPreferenceFragment(android.app.Fragment);
  }

}

package android.support.v4.accessibilityservice {

  public final class AccessibilityServiceInfoCompat {
    method public static java.lang.String capabilityToString(int);
    method public static java.lang.String feedbackTypeToString(int);
    method public static java.lang.String flagToString(int);
    method public static deprecated boolean getCanRetrieveWindowContent(android.accessibilityservice.AccessibilityServiceInfo);
    method public static int getCapabilities(android.accessibilityservice.AccessibilityServiceInfo);
    method public static deprecated java.lang.String getDescription(android.accessibilityservice.AccessibilityServiceInfo);
    method public static deprecated java.lang.String getId(android.accessibilityservice.AccessibilityServiceInfo);
    method public static deprecated android.content.pm.ResolveInfo getResolveInfo(android.accessibilityservice.AccessibilityServiceInfo);
    method public static deprecated java.lang.String getSettingsActivityName(android.accessibilityservice.AccessibilityServiceInfo);
    method public static java.lang.String loadDescription(android.accessibilityservice.AccessibilityServiceInfo, android.content.pm.PackageManager);
    field public static final int CAPABILITY_CAN_FILTER_KEY_EVENTS = 8; // 0x8
    field public static final int CAPABILITY_CAN_REQUEST_ENHANCED_WEB_ACCESSIBILITY = 4; // 0x4
    field public static final int CAPABILITY_CAN_REQUEST_TOUCH_EXPLORATION = 2; // 0x2
    field public static final int CAPABILITY_CAN_RETRIEVE_WINDOW_CONTENT = 1; // 0x1
    field public static final deprecated int DEFAULT = 1; // 0x1
    field public static final int FEEDBACK_ALL_MASK = -1; // 0xffffffff
    field public static final int FEEDBACK_BRAILLE = 32; // 0x20
    field public static final int FLAG_INCLUDE_NOT_IMPORTANT_VIEWS = 2; // 0x2
    field public static final int FLAG_REPORT_VIEW_IDS = 16; // 0x10
    field public static final int FLAG_REQUEST_ENHANCED_WEB_ACCESSIBILITY = 8; // 0x8
    field public static final int FLAG_REQUEST_FILTER_KEY_EVENTS = 32; // 0x20
    field public static final int FLAG_REQUEST_TOUCH_EXPLORATION_MODE = 4; // 0x4
  }

}

package android.support.v4.app {

  public deprecated class ActionBarDrawerToggle implements android.support.v4.widget.DrawerLayout.DrawerListener {
    ctor public ActionBarDrawerToggle(android.app.Activity, android.support.v4.widget.DrawerLayout, int, int, int);
    ctor public ActionBarDrawerToggle(android.app.Activity, android.support.v4.widget.DrawerLayout, boolean, int, int, int);
    method public boolean isDrawerIndicatorEnabled();
    method public void onConfigurationChanged(android.content.res.Configuration);
    method public void onDrawerClosed(android.view.View);
    method public void onDrawerOpened(android.view.View);
    method public void onDrawerSlide(android.view.View, float);
    method public void onDrawerStateChanged(int);
    method public boolean onOptionsItemSelected(android.view.MenuItem);
    method public void setDrawerIndicatorEnabled(boolean);
    method public void setHomeAsUpIndicator(android.graphics.drawable.Drawable);
    method public void setHomeAsUpIndicator(int);
    method public void syncState();
  }

  public static abstract deprecated interface ActionBarDrawerToggle.Delegate {
    method public abstract android.graphics.drawable.Drawable getThemeUpIndicator();
    method public abstract void setActionBarDescription(int);
    method public abstract void setActionBarUpIndicator(android.graphics.drawable.Drawable, int);
  }

  public static abstract deprecated interface ActionBarDrawerToggle.DelegateProvider {
    method public abstract android.support.v4.app.ActionBarDrawerToggle.Delegate getDrawerToggleDelegate();
  }

  public class ActivityCompat extends android.support.v4.content.ContextCompat {
    ctor protected ActivityCompat();
    method public static void finishAffinity(android.app.Activity);
    method public static void finishAfterTransition(android.app.Activity);
    method public static android.net.Uri getReferrer(android.app.Activity);
    method public static boolean invalidateOptionsMenu(android.app.Activity);
    method public static void postponeEnterTransition(android.app.Activity);
    method public static void requestPermissions(android.app.Activity, java.lang.String[], int);
    method public static void setEnterSharedElementCallback(android.app.Activity, android.support.v4.app.SharedElementCallback);
    method public static void setExitSharedElementCallback(android.app.Activity, android.support.v4.app.SharedElementCallback);
    method public static boolean shouldShowRequestPermissionRationale(android.app.Activity, java.lang.String);
    method public static void startActivityForResult(android.app.Activity, android.content.Intent, int, android.os.Bundle);
    method public static void startIntentSenderForResult(android.app.Activity, android.content.IntentSender, int, android.content.Intent, int, int, int, android.os.Bundle) throws android.content.IntentSender.SendIntentException;
    method public static void startPostponedEnterTransition(android.app.Activity);
  }

  public static abstract interface ActivityCompat.OnRequestPermissionsResultCallback {
    method public abstract void onRequestPermissionsResult(int, java.lang.String[], int[]);
  }

  public final class ActivityManagerCompat {
    method public static boolean isLowRamDevice(android.app.ActivityManager);
  }

  public class ActivityOptionsCompat {
    ctor protected ActivityOptionsCompat();
    method public android.graphics.Rect getLaunchBounds();
    method public static android.support.v4.app.ActivityOptionsCompat makeBasic();
    method public static android.support.v4.app.ActivityOptionsCompat makeClipRevealAnimation(android.view.View, int, int, int, int);
    method public static android.support.v4.app.ActivityOptionsCompat makeCustomAnimation(android.content.Context, int, int);
    method public static android.support.v4.app.ActivityOptionsCompat makeScaleUpAnimation(android.view.View, int, int, int, int);
    method public static android.support.v4.app.ActivityOptionsCompat makeSceneTransitionAnimation(android.app.Activity, android.view.View, java.lang.String);
    method public static android.support.v4.app.ActivityOptionsCompat makeSceneTransitionAnimation(android.app.Activity, android.support.v4.util.Pair<android.view.View, java.lang.String>...);
    method public static android.support.v4.app.ActivityOptionsCompat makeTaskLaunchBehind();
    method public static android.support.v4.app.ActivityOptionsCompat makeThumbnailScaleUpAnimation(android.view.View, android.graphics.Bitmap, int, int);
    method public void requestUsageTimeReport(android.app.PendingIntent);
    method public android.support.v4.app.ActivityOptionsCompat setLaunchBounds(android.graphics.Rect);
    method public android.os.Bundle toBundle();
    method public void update(android.support.v4.app.ActivityOptionsCompat);
    field public static final java.lang.String EXTRA_USAGE_TIME_REPORT = "android.activity.usage_time";
    field public static final java.lang.String EXTRA_USAGE_TIME_REPORT_PACKAGES = "android.usage_time_packages";
  }

  public final class AlarmManagerCompat {
    method public static void setAlarmClock(android.app.AlarmManager, long, android.app.PendingIntent, android.app.PendingIntent);
    method public static void setAndAllowWhileIdle(android.app.AlarmManager, int, long, android.app.PendingIntent);
    method public static void setExact(android.app.AlarmManager, int, long, android.app.PendingIntent);
    method public static void setExactAndAllowWhileIdle(android.app.AlarmManager, int, long, android.app.PendingIntent);
  }

  public class AppLaunchChecker {
    ctor public AppLaunchChecker();
    method public static boolean hasStartedFromLauncher(android.content.Context);
    method public static void onActivityCreate(android.app.Activity);
  }

  public final class AppOpsManagerCompat {
    method public static int noteOp(android.content.Context, java.lang.String, int, java.lang.String);
    method public static int noteProxyOp(android.content.Context, java.lang.String, java.lang.String);
    method public static java.lang.String permissionToOp(java.lang.String);
    field public static final int MODE_ALLOWED = 0; // 0x0
    field public static final int MODE_DEFAULT = 3; // 0x3
    field public static final int MODE_IGNORED = 1; // 0x1
  }

  public final class BundleCompat {
    method public static android.os.IBinder getBinder(android.os.Bundle, java.lang.String);
    method public static void putBinder(android.os.Bundle, java.lang.String, android.os.IBinder);
  }

  public class DialogFragment extends android.support.v4.app.Fragment implements android.content.DialogInterface.OnCancelListener android.content.DialogInterface.OnDismissListener {
    ctor public DialogFragment();
    method public void dismiss();
    method public void dismissAllowingStateLoss();
    method public android.app.Dialog getDialog();
    method public boolean getShowsDialog();
    method public int getTheme();
    method public boolean isCancelable();
    method public void onCancel(android.content.DialogInterface);
    method public android.app.Dialog onCreateDialog(android.os.Bundle);
    method public void onDismiss(android.content.DialogInterface);
    method public void setCancelable(boolean);
    method public void setShowsDialog(boolean);
    method public void setStyle(int, int);
    method public void show(android.support.v4.app.FragmentManager, java.lang.String);
    method public int show(android.support.v4.app.FragmentTransaction, java.lang.String);
    field public static final int STYLE_NORMAL = 0; // 0x0
    field public static final int STYLE_NO_FRAME = 2; // 0x2
    field public static final int STYLE_NO_INPUT = 3; // 0x3
    field public static final int STYLE_NO_TITLE = 1; // 0x1
  }

  public class Fragment implements android.content.ComponentCallbacks android.view.View.OnCreateContextMenuListener {
    ctor public Fragment();
    method public void dump(java.lang.String, java.io.FileDescriptor, java.io.PrintWriter, java.lang.String[]);
    method public final boolean equals(java.lang.Object);
    method public final android.support.v4.app.FragmentActivity getActivity();
    method public boolean getAllowEnterTransitionOverlap();
    method public boolean getAllowReturnTransitionOverlap();
    method public final android.os.Bundle getArguments();
    method public final android.support.v4.app.FragmentManager getChildFragmentManager();
    method public android.content.Context getContext();
    method public java.lang.Object getEnterTransition();
    method public java.lang.Object getExitTransition();
    method public final android.support.v4.app.FragmentManager getFragmentManager();
    method public final java.lang.Object getHost();
    method public final int getId();
    method public final android.view.LayoutInflater getLayoutInflater();
    method public android.support.v4.app.LoaderManager getLoaderManager();
    method public final android.support.v4.app.Fragment getParentFragment();
    method public java.lang.Object getReenterTransition();
    method public final android.content.res.Resources getResources();
    method public final boolean getRetainInstance();
    method public java.lang.Object getReturnTransition();
    method public java.lang.Object getSharedElementEnterTransition();
    method public java.lang.Object getSharedElementReturnTransition();
    method public final java.lang.String getString(int);
    method public final java.lang.String getString(int, java.lang.Object...);
    method public final java.lang.String getTag();
    method public final android.support.v4.app.Fragment getTargetFragment();
    method public final int getTargetRequestCode();
    method public final java.lang.CharSequence getText(int);
    method public boolean getUserVisibleHint();
    method public android.view.View getView();
    method public final int hashCode();
    method public static android.support.v4.app.Fragment instantiate(android.content.Context, java.lang.String);
    method public static android.support.v4.app.Fragment instantiate(android.content.Context, java.lang.String, android.os.Bundle);
    method public final boolean isAdded();
    method public final boolean isDetached();
    method public final boolean isHidden();
    method public final boolean isInLayout();
    method public final boolean isRemoving();
    method public final boolean isResumed();
    method public final boolean isStateSaved();
    method public final boolean isVisible();
    method public void onActivityCreated(android.os.Bundle);
    method public void onActivityResult(int, int, android.content.Intent);
    method public void onAttach(android.content.Context);
    method public deprecated void onAttach(android.app.Activity);
    method public void onAttachFragment(android.support.v4.app.Fragment);
    method public void onConfigurationChanged(android.content.res.Configuration);
    method public boolean onContextItemSelected(android.view.MenuItem);
    method public void onCreate(android.os.Bundle);
    method public android.view.animation.Animation onCreateAnimation(int, boolean, int);
    method public android.animation.Animator onCreateAnimator(int, boolean, int);
    method public void onCreateContextMenu(android.view.ContextMenu, android.view.View, android.view.ContextMenu.ContextMenuInfo);
    method public void onCreateOptionsMenu(android.view.Menu, android.view.MenuInflater);
    method public android.view.View onCreateView(android.view.LayoutInflater, android.view.ViewGroup, android.os.Bundle);
    method public void onDestroy();
    method public void onDestroyOptionsMenu();
    method public void onDestroyView();
    method public void onDetach();
    method public android.view.LayoutInflater onGetLayoutInflater(android.os.Bundle);
    method public void onHiddenChanged(boolean);
    method public void onInflate(android.content.Context, android.util.AttributeSet, android.os.Bundle);
    method public deprecated void onInflate(android.app.Activity, android.util.AttributeSet, android.os.Bundle);
    method public void onLowMemory();
    method public void onMultiWindowModeChanged(boolean);
    method public boolean onOptionsItemSelected(android.view.MenuItem);
    method public void onOptionsMenuClosed(android.view.Menu);
    method public void onPause();
    method public void onPictureInPictureModeChanged(boolean);
    method public void onPrepareOptionsMenu(android.view.Menu);
    method public void onRequestPermissionsResult(int, java.lang.String[], int[]);
    method public void onResume();
    method public void onSaveInstanceState(android.os.Bundle);
    method public void onStart();
    method public void onStop();
    method public void onViewCreated(android.view.View, android.os.Bundle);
    method public void onViewStateRestored(android.os.Bundle);
    method public void postponeEnterTransition();
    method public void registerForContextMenu(android.view.View);
    method public final void requestPermissions(java.lang.String[], int);
    method public void setAllowEnterTransitionOverlap(boolean);
    method public void setAllowReturnTransitionOverlap(boolean);
    method public void setArguments(android.os.Bundle);
    method public void setEnterSharedElementCallback(android.support.v4.app.SharedElementCallback);
    method public void setEnterTransition(java.lang.Object);
    method public void setExitSharedElementCallback(android.support.v4.app.SharedElementCallback);
    method public void setExitTransition(java.lang.Object);
    method public void setHasOptionsMenu(boolean);
    method public void setInitialSavedState(android.support.v4.app.Fragment.SavedState);
    method public void setMenuVisibility(boolean);
    method public void setReenterTransition(java.lang.Object);
    method public void setRetainInstance(boolean);
    method public void setReturnTransition(java.lang.Object);
    method public void setSharedElementEnterTransition(java.lang.Object);
    method public void setSharedElementReturnTransition(java.lang.Object);
    method public void setTargetFragment(android.support.v4.app.Fragment, int);
    method public void setUserVisibleHint(boolean);
    method public boolean shouldShowRequestPermissionRationale(java.lang.String);
    method public void startActivity(android.content.Intent);
    method public void startActivity(android.content.Intent, android.os.Bundle);
    method public void startActivityForResult(android.content.Intent, int);
    method public void startActivityForResult(android.content.Intent, int, android.os.Bundle);
    method public void startIntentSenderForResult(android.content.IntentSender, int, android.content.Intent, int, int, int, android.os.Bundle) throws android.content.IntentSender.SendIntentException;
    method public void startPostponedEnterTransition();
    method public void unregisterForContextMenu(android.view.View);
  }

  public static class Fragment.InstantiationException extends java.lang.RuntimeException {
    ctor public Fragment.InstantiationException(java.lang.String, java.lang.Exception);
  }

  public static class Fragment.SavedState implements android.os.Parcelable {
    method public int describeContents();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.support.v4.app.Fragment.SavedState> CREATOR;
  }

  public class FragmentActivity extends android.app.Activity implements android.support.v4.app.ActivityCompat.OnRequestPermissionsResultCallback {
    ctor public FragmentActivity();
    method public java.lang.Object getLastCustomNonConfigurationInstance();
    method public android.support.v4.app.FragmentManager getSupportFragmentManager();
    method public android.support.v4.app.LoaderManager getSupportLoaderManager();
    method public void onAttachFragment(android.support.v4.app.Fragment);
    method public void onMultiWindowModeChanged(boolean);
    method public void onPictureInPictureModeChanged(boolean);
    method protected void onResumeFragments();
    method public java.lang.Object onRetainCustomNonConfigurationInstance();
    method public final java.lang.Object onRetainNonConfigurationInstance();
    method public void setEnterSharedElementCallback(android.support.v4.app.SharedElementCallback);
    method public void setExitSharedElementCallback(android.support.v4.app.SharedElementCallback);
    method public void startActivityFromFragment(android.support.v4.app.Fragment, android.content.Intent, int);
    method public void startActivityFromFragment(android.support.v4.app.Fragment, android.content.Intent, int, android.os.Bundle);
    method public void startIntentSenderFromFragment(android.support.v4.app.Fragment, android.content.IntentSender, int, android.content.Intent, int, int, int, android.os.Bundle) throws android.content.IntentSender.SendIntentException;
    method public void supportFinishAfterTransition();
    method public deprecated void supportInvalidateOptionsMenu();
    method public void supportPostponeEnterTransition();
    method public void supportStartPostponedEnterTransition();
    method public final void validateRequestPermissionsRequestCode(int);
  }

  public abstract class FragmentContainer {
    ctor public FragmentContainer();
    method public android.support.v4.app.Fragment instantiate(android.content.Context, java.lang.String, android.os.Bundle);
    method public abstract android.view.View onFindViewById(int);
    method public abstract boolean onHasView();
  }

  public class FragmentController {
    method public void attachHost(android.support.v4.app.Fragment);
    method public static final android.support.v4.app.FragmentController createController(android.support.v4.app.FragmentHostCallback<?>);
    method public void dispatchActivityCreated();
    method public void dispatchConfigurationChanged(android.content.res.Configuration);
    method public boolean dispatchContextItemSelected(android.view.MenuItem);
    method public void dispatchCreate();
    method public boolean dispatchCreateOptionsMenu(android.view.Menu, android.view.MenuInflater);
    method public void dispatchDestroy();
    method public void dispatchDestroyView();
    method public void dispatchLowMemory();
    method public void dispatchMultiWindowModeChanged(boolean);
    method public boolean dispatchOptionsItemSelected(android.view.MenuItem);
    method public void dispatchOptionsMenuClosed(android.view.Menu);
    method public void dispatchPause();
    method public void dispatchPictureInPictureModeChanged(boolean);
    method public boolean dispatchPrepareOptionsMenu(android.view.Menu);
    method public void dispatchReallyStop();
    method public void dispatchResume();
    method public void dispatchStart();
    method public void dispatchStop();
    method public void doLoaderDestroy();
    method public void doLoaderRetain();
    method public void doLoaderStart();
    method public void doLoaderStop(boolean);
    method public void dumpLoaders(java.lang.String, java.io.FileDescriptor, java.io.PrintWriter, java.lang.String[]);
    method public boolean execPendingActions();
    method public android.support.v4.app.Fragment findFragmentByWho(java.lang.String);
    method public java.util.List<android.support.v4.app.Fragment> getActiveFragments(java.util.List<android.support.v4.app.Fragment>);
    method public int getActiveFragmentsCount();
    method public android.support.v4.app.FragmentManager getSupportFragmentManager();
    method public android.support.v4.app.LoaderManager getSupportLoaderManager();
    method public void noteStateNotSaved();
    method public android.view.View onCreateView(android.view.View, java.lang.String, android.content.Context, android.util.AttributeSet);
    method public void reportLoaderStart();
    method public deprecated void restoreAllState(android.os.Parcelable, java.util.List<android.support.v4.app.Fragment>);
    method public void restoreAllState(android.os.Parcelable, android.support.v4.app.FragmentManagerNonConfig);
    method public void restoreLoaderNonConfig(android.support.v4.util.SimpleArrayMap<java.lang.String, android.support.v4.app.LoaderManager>);
    method public android.support.v4.util.SimpleArrayMap<java.lang.String, android.support.v4.app.LoaderManager> retainLoaderNonConfig();
    method public android.support.v4.app.FragmentManagerNonConfig retainNestedNonConfig();
    method public deprecated java.util.List<android.support.v4.app.Fragment> retainNonConfig();
    method public android.os.Parcelable saveAllState();
  }

  public abstract class FragmentHostCallback<E> extends android.support.v4.app.FragmentContainer {
    ctor public FragmentHostCallback(android.content.Context, android.os.Handler, int);
    method public void onDump(java.lang.String, java.io.FileDescriptor, java.io.PrintWriter, java.lang.String[]);
    method public android.view.View onFindViewById(int);
    method public abstract E onGetHost();
    method public android.view.LayoutInflater onGetLayoutInflater();
    method public int onGetWindowAnimations();
    method public boolean onHasView();
    method public boolean onHasWindowAnimations();
    method public void onRequestPermissionsFromFragment(android.support.v4.app.Fragment, java.lang.String[], int);
    method public boolean onShouldSaveFragmentState(android.support.v4.app.Fragment);
    method public boolean onShouldShowRequestPermissionRationale(java.lang.String);
    method public void onStartActivityFromFragment(android.support.v4.app.Fragment, android.content.Intent, int);
    method public void onStartActivityFromFragment(android.support.v4.app.Fragment, android.content.Intent, int, android.os.Bundle);
    method public void onStartIntentSenderFromFragment(android.support.v4.app.Fragment, android.content.IntentSender, int, android.content.Intent, int, int, int, android.os.Bundle) throws android.content.IntentSender.SendIntentException;
    method public void onSupportInvalidateOptionsMenu();
  }

  public abstract class FragmentManager {
    ctor public FragmentManager();
    method public abstract void addOnBackStackChangedListener(android.support.v4.app.FragmentManager.OnBackStackChangedListener);
    method public abstract android.support.v4.app.FragmentTransaction beginTransaction();
    method public abstract void dump(java.lang.String, java.io.FileDescriptor, java.io.PrintWriter, java.lang.String[]);
    method public static void enableDebugLogging(boolean);
    method public abstract boolean executePendingTransactions();
    method public abstract android.support.v4.app.Fragment findFragmentById(int);
    method public abstract android.support.v4.app.Fragment findFragmentByTag(java.lang.String);
    method public abstract android.support.v4.app.FragmentManager.BackStackEntry getBackStackEntryAt(int);
    method public abstract int getBackStackEntryCount();
    method public abstract android.support.v4.app.Fragment getFragment(android.os.Bundle, java.lang.String);
    method public abstract java.util.List<android.support.v4.app.Fragment> getFragments();
    method public abstract android.support.v4.app.Fragment getPrimaryNavigationFragment();
    method public abstract boolean isDestroyed();
    method public abstract boolean isStateSaved();
    method public abstract void popBackStack();
    method public abstract void popBackStack(java.lang.String, int);
    method public abstract void popBackStack(int, int);
    method public abstract boolean popBackStackImmediate();
    method public abstract boolean popBackStackImmediate(java.lang.String, int);
    method public abstract boolean popBackStackImmediate(int, int);
    method public abstract void putFragment(android.os.Bundle, java.lang.String, android.support.v4.app.Fragment);
    method public abstract void registerFragmentLifecycleCallbacks(android.support.v4.app.FragmentManager.FragmentLifecycleCallbacks, boolean);
    method public abstract void removeOnBackStackChangedListener(android.support.v4.app.FragmentManager.OnBackStackChangedListener);
    method public abstract android.support.v4.app.Fragment.SavedState saveFragmentInstanceState(android.support.v4.app.Fragment);
    method public abstract void unregisterFragmentLifecycleCallbacks(android.support.v4.app.FragmentManager.FragmentLifecycleCallbacks);
    field public static final int POP_BACK_STACK_INCLUSIVE = 1; // 0x1
  }

  public static abstract interface FragmentManager.BackStackEntry {
    method public abstract java.lang.CharSequence getBreadCrumbShortTitle();
    method public abstract int getBreadCrumbShortTitleRes();
    method public abstract java.lang.CharSequence getBreadCrumbTitle();
    method public abstract int getBreadCrumbTitleRes();
    method public abstract int getId();
    method public abstract java.lang.String getName();
  }

  public static abstract class FragmentManager.FragmentLifecycleCallbacks {
    ctor public FragmentManager.FragmentLifecycleCallbacks();
    method public void onFragmentActivityCreated(android.support.v4.app.FragmentManager, android.support.v4.app.Fragment, android.os.Bundle);
    method public void onFragmentAttached(android.support.v4.app.FragmentManager, android.support.v4.app.Fragment, android.content.Context);
    method public void onFragmentCreated(android.support.v4.app.FragmentManager, android.support.v4.app.Fragment, android.os.Bundle);
    method public void onFragmentDestroyed(android.support.v4.app.FragmentManager, android.support.v4.app.Fragment);
    method public void onFragmentDetached(android.support.v4.app.FragmentManager, android.support.v4.app.Fragment);
    method public void onFragmentPaused(android.support.v4.app.FragmentManager, android.support.v4.app.Fragment);
    method public void onFragmentPreAttached(android.support.v4.app.FragmentManager, android.support.v4.app.Fragment, android.content.Context);
    method public void onFragmentPreCreated(android.support.v4.app.FragmentManager, android.support.v4.app.Fragment, android.os.Bundle);
    method public void onFragmentResumed(android.support.v4.app.FragmentManager, android.support.v4.app.Fragment);
    method public void onFragmentSaveInstanceState(android.support.v4.app.FragmentManager, android.support.v4.app.Fragment, android.os.Bundle);
    method public void onFragmentStarted(android.support.v4.app.FragmentManager, android.support.v4.app.Fragment);
    method public void onFragmentStopped(android.support.v4.app.FragmentManager, android.support.v4.app.Fragment);
    method public void onFragmentViewCreated(android.support.v4.app.FragmentManager, android.support.v4.app.Fragment, android.view.View, android.os.Bundle);
    method public void onFragmentViewDestroyed(android.support.v4.app.FragmentManager, android.support.v4.app.Fragment);
  }

  public static abstract interface FragmentManager.OnBackStackChangedListener {
    method public abstract void onBackStackChanged();
  }

  public class FragmentManagerNonConfig {
  }

  public abstract class FragmentPagerAdapter extends android.support.v4.view.PagerAdapter {
    ctor public FragmentPagerAdapter(android.support.v4.app.FragmentManager);
    method public abstract android.support.v4.app.Fragment getItem(int);
    method public long getItemId(int);
    method public boolean isViewFromObject(android.view.View, java.lang.Object);
  }

  public abstract class FragmentStatePagerAdapter extends android.support.v4.view.PagerAdapter {
    ctor public FragmentStatePagerAdapter(android.support.v4.app.FragmentManager);
    method public abstract android.support.v4.app.Fragment getItem(int);
    method public boolean isViewFromObject(android.view.View, java.lang.Object);
  }

  public class FragmentTabHost extends android.widget.TabHost implements android.widget.TabHost.OnTabChangeListener {
    ctor public FragmentTabHost(android.content.Context);
    ctor public FragmentTabHost(android.content.Context, android.util.AttributeSet);
    method public void addTab(android.widget.TabHost.TabSpec, java.lang.Class<?>, android.os.Bundle);
    method public void onTabChanged(java.lang.String);
    method public deprecated void setup();
    method public void setup(android.content.Context, android.support.v4.app.FragmentManager);
    method public void setup(android.content.Context, android.support.v4.app.FragmentManager, int);
  }

  public abstract class FragmentTransaction {
    ctor public FragmentTransaction();
    method public abstract android.support.v4.app.FragmentTransaction add(android.support.v4.app.Fragment, java.lang.String);
    method public abstract android.support.v4.app.FragmentTransaction add(int, android.support.v4.app.Fragment);
    method public abstract android.support.v4.app.FragmentTransaction add(int, android.support.v4.app.Fragment, java.lang.String);
    method public abstract android.support.v4.app.FragmentTransaction addSharedElement(android.view.View, java.lang.String);
    method public abstract android.support.v4.app.FragmentTransaction addToBackStack(java.lang.String);
    method public abstract android.support.v4.app.FragmentTransaction attach(android.support.v4.app.Fragment);
    method public abstract int commit();
    method public abstract int commitAllowingStateLoss();
    method public abstract void commitNow();
    method public abstract void commitNowAllowingStateLoss();
    method public abstract android.support.v4.app.FragmentTransaction detach(android.support.v4.app.Fragment);
    method public abstract android.support.v4.app.FragmentTransaction disallowAddToBackStack();
    method public abstract android.support.v4.app.FragmentTransaction hide(android.support.v4.app.Fragment);
    method public abstract boolean isAddToBackStackAllowed();
    method public abstract boolean isEmpty();
    method public abstract android.support.v4.app.FragmentTransaction remove(android.support.v4.app.Fragment);
    method public abstract android.support.v4.app.FragmentTransaction replace(int, android.support.v4.app.Fragment);
    method public abstract android.support.v4.app.FragmentTransaction replace(int, android.support.v4.app.Fragment, java.lang.String);
    method public abstract android.support.v4.app.FragmentTransaction runOnCommit(java.lang.Runnable);
    method public abstract deprecated android.support.v4.app.FragmentTransaction setAllowOptimization(boolean);
    method public abstract android.support.v4.app.FragmentTransaction setBreadCrumbShortTitle(int);
    method public abstract android.support.v4.app.FragmentTransaction setBreadCrumbShortTitle(java.lang.CharSequence);
    method public abstract android.support.v4.app.FragmentTransaction setBreadCrumbTitle(int);
    method public abstract android.support.v4.app.FragmentTransaction setBreadCrumbTitle(java.lang.CharSequence);
    method public abstract android.support.v4.app.FragmentTransaction setCustomAnimations(int, int);
    method public abstract android.support.v4.app.FragmentTransaction setCustomAnimations(int, int, int, int);
    method public abstract android.support.v4.app.FragmentTransaction setPrimaryNavigationFragment(android.support.v4.app.Fragment);
    method public abstract android.support.v4.app.FragmentTransaction setReorderingAllowed(boolean);
    method public abstract android.support.v4.app.FragmentTransaction setTransition(int);
    method public abstract android.support.v4.app.FragmentTransaction setTransitionStyle(int);
    method public abstract android.support.v4.app.FragmentTransaction show(android.support.v4.app.Fragment);
    field public static final int TRANSIT_ENTER_MASK = 4096; // 0x1000
    field public static final int TRANSIT_EXIT_MASK = 8192; // 0x2000
    field public static final int TRANSIT_FRAGMENT_CLOSE = 8194; // 0x2002
    field public static final int TRANSIT_FRAGMENT_FADE = 4099; // 0x1003
    field public static final int TRANSIT_FRAGMENT_OPEN = 4097; // 0x1001
    field public static final int TRANSIT_NONE = 0; // 0x0
    field public static final int TRANSIT_UNSET = -1; // 0xffffffff
  }

  public class FrameMetricsAggregator {
    ctor public FrameMetricsAggregator();
    ctor public FrameMetricsAggregator(int);
    method public void add(android.app.Activity);
    method public android.util.SparseIntArray[] getMetrics();
    method public android.util.SparseIntArray[] remove(android.app.Activity);
    method public android.util.SparseIntArray[] reset();
    method public android.util.SparseIntArray[] stop();
    field public static final int ANIMATION_DURATION = 256; // 0x100
    field public static final int ANIMATION_INDEX = 8; // 0x8
    field public static final int COMMAND_DURATION = 32; // 0x20
    field public static final int COMMAND_INDEX = 5; // 0x5
    field public static final int DELAY_DURATION = 128; // 0x80
    field public static final int DELAY_INDEX = 7; // 0x7
    field public static final int DRAW_DURATION = 8; // 0x8
    field public static final int DRAW_INDEX = 3; // 0x3
    field public static final int EVERY_DURATION = 511; // 0x1ff
    field public static final int INPUT_DURATION = 2; // 0x2
    field public static final int INPUT_INDEX = 1; // 0x1
    field public static final int LAYOUT_MEASURE_DURATION = 4; // 0x4
    field public static final int LAYOUT_MEASURE_INDEX = 2; // 0x2
    field public static final int SWAP_DURATION = 64; // 0x40
    field public static final int SWAP_INDEX = 6; // 0x6
    field public static final int SYNC_DURATION = 16; // 0x10
    field public static final int SYNC_INDEX = 4; // 0x4
    field public static final int TOTAL_DURATION = 1; // 0x1
    field public static final int TOTAL_INDEX = 0; // 0x0
  }

  public abstract class JobIntentService extends android.app.Service {
    ctor public JobIntentService();
    method public static void enqueueWork(android.content.Context, java.lang.Class, int, android.content.Intent);
    method public static void enqueueWork(android.content.Context, android.content.ComponentName, int, android.content.Intent);
    method public boolean isStopped();
    method public android.os.IBinder onBind(android.content.Intent);
    method protected abstract void onHandleWork(android.content.Intent);
    method public boolean onStopCurrentWork();
    method public void setInterruptIfStopped(boolean);
  }

  public class ListFragment extends android.support.v4.app.Fragment {
    ctor public ListFragment();
    method public android.widget.ListAdapter getListAdapter();
    method public android.widget.ListView getListView();
    method public long getSelectedItemId();
    method public int getSelectedItemPosition();
    method public void onListItemClick(android.widget.ListView, android.view.View, int, long);
    method public void setEmptyText(java.lang.CharSequence);
    method public void setListAdapter(android.widget.ListAdapter);
    method public void setListShown(boolean);
    method public void setListShownNoAnimation(boolean);
    method public void setSelection(int);
  }

  public abstract class LoaderManager {
    ctor public LoaderManager();
    method public abstract void destroyLoader(int);
    method public abstract void dump(java.lang.String, java.io.FileDescriptor, java.io.PrintWriter, java.lang.String[]);
    method public static void enableDebugLogging(boolean);
    method public abstract <D> android.support.v4.content.Loader<D> getLoader(int);
    method public boolean hasRunningLoaders();
    method public abstract <D> android.support.v4.content.Loader<D> initLoader(int, android.os.Bundle, android.support.v4.app.LoaderManager.LoaderCallbacks<D>);
    method public abstract <D> android.support.v4.content.Loader<D> restartLoader(int, android.os.Bundle, android.support.v4.app.LoaderManager.LoaderCallbacks<D>);
  }

  public static abstract interface LoaderManager.LoaderCallbacks<D> {
    method public abstract android.support.v4.content.Loader<D> onCreateLoader(int, android.os.Bundle);
    method public abstract void onLoadFinished(android.support.v4.content.Loader<D>, D);
    method public abstract void onLoaderReset(android.support.v4.content.Loader<D>);
  }

  public final class NavUtils {
    method public static android.content.Intent getParentActivityIntent(android.app.Activity);
    method public static android.content.Intent getParentActivityIntent(android.content.Context, java.lang.Class<?>) throws android.content.pm.PackageManager.NameNotFoundException;
    method public static android.content.Intent getParentActivityIntent(android.content.Context, android.content.ComponentName) throws android.content.pm.PackageManager.NameNotFoundException;
    method public static java.lang.String getParentActivityName(android.app.Activity);
    method public static java.lang.String getParentActivityName(android.content.Context, android.content.ComponentName) throws android.content.pm.PackageManager.NameNotFoundException;
    method public static void navigateUpFromSameTask(android.app.Activity);
    method public static void navigateUpTo(android.app.Activity, android.content.Intent);
    method public static boolean shouldUpRecreateTask(android.app.Activity, android.content.Intent);
    field public static final java.lang.String PARENT_ACTIVITY = "android.support.PARENT_ACTIVITY";
  }

  public class NotificationCompat {
    ctor public NotificationCompat();
    method public static android.support.v4.app.NotificationCompat.Action getAction(android.app.Notification, int);
    method public static int getActionCount(android.app.Notification);
    method public static int getBadgeIconType(android.app.Notification);
    method public static java.lang.String getCategory(android.app.Notification);
    method public static java.lang.String getChannelId(android.app.Notification);
    method public static android.os.Bundle getExtras(android.app.Notification);
    method public static java.lang.String getGroup(android.app.Notification);
    method public static int getGroupAlertBehavior(android.app.Notification);
    method public static boolean getLocalOnly(android.app.Notification);
    method public static java.lang.String getShortcutId(android.app.Notification);
    method public static java.lang.String getSortKey(android.app.Notification);
    method public static long getTimeoutAfter(android.app.Notification);
    method public static boolean isGroupSummary(android.app.Notification);
    field public static final int BADGE_ICON_LARGE = 2; // 0x2
    field public static final int BADGE_ICON_NONE = 0; // 0x0
    field public static final int BADGE_ICON_SMALL = 1; // 0x1
    field public static final java.lang.String CATEGORY_ALARM = "alarm";
    field public static final java.lang.String CATEGORY_CALL = "call";
    field public static final java.lang.String CATEGORY_EMAIL = "email";
    field public static final java.lang.String CATEGORY_ERROR = "err";
    field public static final java.lang.String CATEGORY_EVENT = "event";
    field public static final java.lang.String CATEGORY_MESSAGE = "msg";
    field public static final java.lang.String CATEGORY_PROGRESS = "progress";
    field public static final java.lang.String CATEGORY_PROMO = "promo";
    field public static final java.lang.String CATEGORY_RECOMMENDATION = "recommendation";
    field public static final java.lang.String CATEGORY_REMINDER = "reminder";
    field public static final java.lang.String CATEGORY_SERVICE = "service";
    field public static final java.lang.String CATEGORY_SOCIAL = "social";
    field public static final java.lang.String CATEGORY_STATUS = "status";
    field public static final java.lang.String CATEGORY_SYSTEM = "sys";
    field public static final java.lang.String CATEGORY_TRANSPORT = "transport";
    field public static final int COLOR_DEFAULT = 0; // 0x0
    field public static final int DEFAULT_ALL = -1; // 0xffffffff
    field public static final int DEFAULT_LIGHTS = 4; // 0x4
    field public static final int DEFAULT_SOUND = 1; // 0x1
    field public static final int DEFAULT_VIBRATE = 2; // 0x2
    field public static final java.lang.String EXTRA_AUDIO_CONTENTS_URI = "android.audioContents";
    field public static final java.lang.String EXTRA_BACKGROUND_IMAGE_URI = "android.backgroundImageUri";
    field public static final java.lang.String EXTRA_BIG_TEXT = "android.bigText";
    field public static final java.lang.String EXTRA_COMPACT_ACTIONS = "android.compactActions";
    field public static final java.lang.String EXTRA_CONVERSATION_TITLE = "android.conversationTitle";
    field public static final java.lang.String EXTRA_INFO_TEXT = "android.infoText";
    field public static final java.lang.String EXTRA_LARGE_ICON = "android.largeIcon";
    field public static final java.lang.String EXTRA_LARGE_ICON_BIG = "android.largeIcon.big";
    field public static final java.lang.String EXTRA_MEDIA_SESSION = "android.mediaSession";
    field public static final java.lang.String EXTRA_MESSAGES = "android.messages";
    field public static final java.lang.String EXTRA_PEOPLE = "android.people";
    field public static final java.lang.String EXTRA_PICTURE = "android.picture";
    field public static final java.lang.String EXTRA_PROGRESS = "android.progress";
    field public static final java.lang.String EXTRA_PROGRESS_INDETERMINATE = "android.progressIndeterminate";
    field public static final java.lang.String EXTRA_PROGRESS_MAX = "android.progressMax";
    field public static final java.lang.String EXTRA_REMOTE_INPUT_HISTORY = "android.remoteInputHistory";
    field public static final java.lang.String EXTRA_SELF_DISPLAY_NAME = "android.selfDisplayName";
    field public static final java.lang.String EXTRA_SHOW_CHRONOMETER = "android.showChronometer";
    field public static final java.lang.String EXTRA_SHOW_WHEN = "android.showWhen";
    field public static final java.lang.String EXTRA_SMALL_ICON = "android.icon";
    field public static final java.lang.String EXTRA_SUB_TEXT = "android.subText";
    field public static final java.lang.String EXTRA_SUMMARY_TEXT = "android.summaryText";
    field public static final java.lang.String EXTRA_TEMPLATE = "android.template";
    field public static final java.lang.String EXTRA_TEXT = "android.text";
    field public static final java.lang.String EXTRA_TEXT_LINES = "android.textLines";
    field public static final java.lang.String EXTRA_TITLE = "android.title";
    field public static final java.lang.String EXTRA_TITLE_BIG = "android.title.big";
    field public static final int FLAG_AUTO_CANCEL = 16; // 0x10
    field public static final int FLAG_FOREGROUND_SERVICE = 64; // 0x40
    field public static final int FLAG_GROUP_SUMMARY = 512; // 0x200
    field public static final deprecated int FLAG_HIGH_PRIORITY = 128; // 0x80
    field public static final int FLAG_INSISTENT = 4; // 0x4
    field public static final int FLAG_LOCAL_ONLY = 256; // 0x100
    field public static final int FLAG_NO_CLEAR = 32; // 0x20
    field public static final int FLAG_ONGOING_EVENT = 2; // 0x2
    field public static final int FLAG_ONLY_ALERT_ONCE = 8; // 0x8
    field public static final int FLAG_SHOW_LIGHTS = 1; // 0x1
    field public static final int GROUP_ALERT_ALL = 0; // 0x0
    field public static final int GROUP_ALERT_CHILDREN = 2; // 0x2
    field public static final int GROUP_ALERT_SUMMARY = 1; // 0x1
    field public static final int PRIORITY_DEFAULT = 0; // 0x0
    field public static final int PRIORITY_HIGH = 1; // 0x1
    field public static final int PRIORITY_LOW = -1; // 0xffffffff
    field public static final int PRIORITY_MAX = 2; // 0x2
    field public static final int PRIORITY_MIN = -2; // 0xfffffffe
    field public static final int STREAM_DEFAULT = -1; // 0xffffffff
    field public static final int VISIBILITY_PRIVATE = 0; // 0x0
    field public static final int VISIBILITY_PUBLIC = 1; // 0x1
    field public static final int VISIBILITY_SECRET = -1; // 0xffffffff
  }

  public static class NotificationCompat.Action {
    ctor public NotificationCompat.Action(int, java.lang.CharSequence, android.app.PendingIntent);
    method public android.app.PendingIntent getActionIntent();
    method public boolean getAllowGeneratedReplies();
    method public android.support.v4.app.RemoteInput[] getDataOnlyRemoteInputs();
    method public android.os.Bundle getExtras();
    method public int getIcon();
    method public android.support.v4.app.RemoteInput[] getRemoteInputs();
    method public java.lang.CharSequence getTitle();
    field public android.app.PendingIntent actionIntent;
    field public int icon;
    field public java.lang.CharSequence title;
  }

  public static final class NotificationCompat.Action.Builder {
    ctor public NotificationCompat.Action.Builder(int, java.lang.CharSequence, android.app.PendingIntent);
    ctor public NotificationCompat.Action.Builder(android.support.v4.app.NotificationCompat.Action);
    method public android.support.v4.app.NotificationCompat.Action.Builder addExtras(android.os.Bundle);
    method public android.support.v4.app.NotificationCompat.Action.Builder addRemoteInput(android.support.v4.app.RemoteInput);
    method public android.support.v4.app.NotificationCompat.Action build();
    method public android.support.v4.app.NotificationCompat.Action.Builder extend(android.support.v4.app.NotificationCompat.Action.Extender);
    method public android.os.Bundle getExtras();
    method public android.support.v4.app.NotificationCompat.Action.Builder setAllowGeneratedReplies(boolean);
  }

  public static abstract interface NotificationCompat.Action.Extender {
    method public abstract android.support.v4.app.NotificationCompat.Action.Builder extend(android.support.v4.app.NotificationCompat.Action.Builder);
  }

  public static final class NotificationCompat.Action.WearableExtender implements android.support.v4.app.NotificationCompat.Action.Extender {
    ctor public NotificationCompat.Action.WearableExtender();
    ctor public NotificationCompat.Action.WearableExtender(android.support.v4.app.NotificationCompat.Action);
    method public android.support.v4.app.NotificationCompat.Action.WearableExtender clone();
    method public android.support.v4.app.NotificationCompat.Action.Builder extend(android.support.v4.app.NotificationCompat.Action.Builder);
    method public java.lang.CharSequence getCancelLabel();
    method public java.lang.CharSequence getConfirmLabel();
    method public boolean getHintDisplayActionInline();
    method public boolean getHintLaunchesActivity();
    method public java.lang.CharSequence getInProgressLabel();
    method public boolean isAvailableOffline();
    method public android.support.v4.app.NotificationCompat.Action.WearableExtender setAvailableOffline(boolean);
    method public android.support.v4.app.NotificationCompat.Action.WearableExtender setCancelLabel(java.lang.CharSequence);
    method public android.support.v4.app.NotificationCompat.Action.WearableExtender setConfirmLabel(java.lang.CharSequence);
    method public android.support.v4.app.NotificationCompat.Action.WearableExtender setHintDisplayActionInline(boolean);
    method public android.support.v4.app.NotificationCompat.Action.WearableExtender setHintLaunchesActivity(boolean);
    method public android.support.v4.app.NotificationCompat.Action.WearableExtender setInProgressLabel(java.lang.CharSequence);
  }

  public static class NotificationCompat.BigPictureStyle extends android.support.v4.app.NotificationCompat.Style {
    ctor public NotificationCompat.BigPictureStyle();
    ctor public NotificationCompat.BigPictureStyle(android.support.v4.app.NotificationCompat.Builder);
    method public android.support.v4.app.NotificationCompat.BigPictureStyle bigLargeIcon(android.graphics.Bitmap);
    method public android.support.v4.app.NotificationCompat.BigPictureStyle bigPicture(android.graphics.Bitmap);
    method public android.support.v4.app.NotificationCompat.BigPictureStyle setBigContentTitle(java.lang.CharSequence);
    method public android.support.v4.app.NotificationCompat.BigPictureStyle setSummaryText(java.lang.CharSequence);
  }

  public static class NotificationCompat.BigTextStyle extends android.support.v4.app.NotificationCompat.Style {
    ctor public NotificationCompat.BigTextStyle();
    ctor public NotificationCompat.BigTextStyle(android.support.v4.app.NotificationCompat.Builder);
    method public android.support.v4.app.NotificationCompat.BigTextStyle bigText(java.lang.CharSequence);
    method public android.support.v4.app.NotificationCompat.BigTextStyle setBigContentTitle(java.lang.CharSequence);
    method public android.support.v4.app.NotificationCompat.BigTextStyle setSummaryText(java.lang.CharSequence);
  }

  public static class NotificationCompat.Builder {
    ctor public NotificationCompat.Builder(android.content.Context, java.lang.String);
    ctor public deprecated NotificationCompat.Builder(android.content.Context);
    method public android.support.v4.app.NotificationCompat.Builder addAction(int, java.lang.CharSequence, android.app.PendingIntent);
    method public android.support.v4.app.NotificationCompat.Builder addAction(android.support.v4.app.NotificationCompat.Action);
    method public android.support.v4.app.NotificationCompat.Builder addExtras(android.os.Bundle);
    method public android.support.v4.app.NotificationCompat.Builder addPerson(java.lang.String);
    method public android.app.Notification build();
    method public android.support.v4.app.NotificationCompat.Builder extend(android.support.v4.app.NotificationCompat.Extender);
    method public android.os.Bundle getExtras();
    method public deprecated android.app.Notification getNotification();
    method protected static java.lang.CharSequence limitCharSequenceLength(java.lang.CharSequence);
    method public android.support.v4.app.NotificationCompat.Builder setAutoCancel(boolean);
    method public android.support.v4.app.NotificationCompat.Builder setBadgeIconType(int);
    method public android.support.v4.app.NotificationCompat.Builder setCategory(java.lang.String);
    method public android.support.v4.app.NotificationCompat.Builder setChannelId(java.lang.String);
    method public android.support.v4.app.NotificationCompat.Builder setColor(int);
    method public android.support.v4.app.NotificationCompat.Builder setColorized(boolean);
    method public android.support.v4.app.NotificationCompat.Builder setContent(android.widget.RemoteViews);
    method public android.support.v4.app.NotificationCompat.Builder setContentInfo(java.lang.CharSequence);
    method public android.support.v4.app.NotificationCompat.Builder setContentIntent(android.app.PendingIntent);
    method public android.support.v4.app.NotificationCompat.Builder setContentText(java.lang.CharSequence);
    method public android.support.v4.app.NotificationCompat.Builder setContentTitle(java.lang.CharSequence);
    method public android.support.v4.app.NotificationCompat.Builder setCustomBigContentView(android.widget.RemoteViews);
    method public android.support.v4.app.NotificationCompat.Builder setCustomContentView(android.widget.RemoteViews);
    method public android.support.v4.app.NotificationCompat.Builder setCustomHeadsUpContentView(android.widget.RemoteViews);
    method public android.support.v4.app.NotificationCompat.Builder setDefaults(int);
    method public android.support.v4.app.NotificationCompat.Builder setDeleteIntent(android.app.PendingIntent);
    method public android.support.v4.app.NotificationCompat.Builder setExtras(android.os.Bundle);
    method public android.support.v4.app.NotificationCompat.Builder setFullScreenIntent(android.app.PendingIntent, boolean);
    method public android.support.v4.app.NotificationCompat.Builder setGroup(java.lang.String);
    method public android.support.v4.app.NotificationCompat.Builder setGroupAlertBehavior(int);
    method public android.support.v4.app.NotificationCompat.Builder setGroupSummary(boolean);
    method public android.support.v4.app.NotificationCompat.Builder setLargeIcon(android.graphics.Bitmap);
    method public android.support.v4.app.NotificationCompat.Builder setLights(int, int, int);
    method public android.support.v4.app.NotificationCompat.Builder setLocalOnly(boolean);
    method public android.support.v4.app.NotificationCompat.Builder setNumber(int);
    method public android.support.v4.app.NotificationCompat.Builder setOngoing(boolean);
    method public android.support.v4.app.NotificationCompat.Builder setOnlyAlertOnce(boolean);
    method public android.support.v4.app.NotificationCompat.Builder setPriority(int);
    method public android.support.v4.app.NotificationCompat.Builder setProgress(int, int, boolean);
    method public android.support.v4.app.NotificationCompat.Builder setPublicVersion(android.app.Notification);
    method public android.support.v4.app.NotificationCompat.Builder setRemoteInputHistory(java.lang.CharSequence[]);
    method public android.support.v4.app.NotificationCompat.Builder setShortcutId(java.lang.String);
    method public android.support.v4.app.NotificationCompat.Builder setShowWhen(boolean);
    method public android.support.v4.app.NotificationCompat.Builder setSmallIcon(int);
    method public android.support.v4.app.NotificationCompat.Builder setSmallIcon(int, int);
    method public android.support.v4.app.NotificationCompat.Builder setSortKey(java.lang.String);
    method public android.support.v4.app.NotificationCompat.Builder setSound(android.net.Uri);
    method public android.support.v4.app.NotificationCompat.Builder setSound(android.net.Uri, int);
    method public android.support.v4.app.NotificationCompat.Builder setStyle(android.support.v4.app.NotificationCompat.Style);
    method public android.support.v4.app.NotificationCompat.Builder setSubText(java.lang.CharSequence);
    method public android.support.v4.app.NotificationCompat.Builder setTicker(java.lang.CharSequence);
    method public android.support.v4.app.NotificationCompat.Builder setTicker(java.lang.CharSequence, android.widget.RemoteViews);
    method public android.support.v4.app.NotificationCompat.Builder setTimeoutAfter(long);
    method public android.support.v4.app.NotificationCompat.Builder setUsesChronometer(boolean);
    method public android.support.v4.app.NotificationCompat.Builder setVibrate(long[]);
    method public android.support.v4.app.NotificationCompat.Builder setVisibility(int);
    method public android.support.v4.app.NotificationCompat.Builder setWhen(long);
    field public java.util.ArrayList<java.lang.String> mPeople;
  }

  public static final class NotificationCompat.CarExtender implements android.support.v4.app.NotificationCompat.Extender {
    ctor public NotificationCompat.CarExtender();
    ctor public NotificationCompat.CarExtender(android.app.Notification);
    method public android.support.v4.app.NotificationCompat.Builder extend(android.support.v4.app.NotificationCompat.Builder);
    method public int getColor();
    method public android.graphics.Bitmap getLargeIcon();
    method public android.support.v4.app.NotificationCompat.CarExtender.UnreadConversation getUnreadConversation();
    method public android.support.v4.app.NotificationCompat.CarExtender setColor(int);
    method public android.support.v4.app.NotificationCompat.CarExtender setLargeIcon(android.graphics.Bitmap);
    method public android.support.v4.app.NotificationCompat.CarExtender setUnreadConversation(android.support.v4.app.NotificationCompat.CarExtender.UnreadConversation);
  }

  public static class NotificationCompat.CarExtender.UnreadConversation {
    method public long getLatestTimestamp();
    method public java.lang.String[] getMessages();
    method public java.lang.String getParticipant();
    method public java.lang.String[] getParticipants();
    method public android.app.PendingIntent getReadPendingIntent();
    method public android.support.v4.app.RemoteInput getRemoteInput();
    method public android.app.PendingIntent getReplyPendingIntent();
  }

  public static class NotificationCompat.CarExtender.UnreadConversation.Builder {
    ctor public NotificationCompat.CarExtender.UnreadConversation.Builder(java.lang.String);
    method public android.support.v4.app.NotificationCompat.CarExtender.UnreadConversation.Builder addMessage(java.lang.String);
    method public android.support.v4.app.NotificationCompat.CarExtender.UnreadConversation build();
    method public android.support.v4.app.NotificationCompat.CarExtender.UnreadConversation.Builder setLatestTimestamp(long);
    method public android.support.v4.app.NotificationCompat.CarExtender.UnreadConversation.Builder setReadPendingIntent(android.app.PendingIntent);
    method public android.support.v4.app.NotificationCompat.CarExtender.UnreadConversation.Builder setReplyAction(android.app.PendingIntent, android.support.v4.app.RemoteInput);
  }

  public static class NotificationCompat.DecoratedCustomViewStyle extends android.support.v4.app.NotificationCompat.Style {
    ctor public NotificationCompat.DecoratedCustomViewStyle();
  }

  public static abstract interface NotificationCompat.Extender {
    method public abstract android.support.v4.app.NotificationCompat.Builder extend(android.support.v4.app.NotificationCompat.Builder);
  }

  public static class NotificationCompat.InboxStyle extends android.support.v4.app.NotificationCompat.Style {
    ctor public NotificationCompat.InboxStyle();
    ctor public NotificationCompat.InboxStyle(android.support.v4.app.NotificationCompat.Builder);
    method public android.support.v4.app.NotificationCompat.InboxStyle addLine(java.lang.CharSequence);
    method public android.support.v4.app.NotificationCompat.InboxStyle setBigContentTitle(java.lang.CharSequence);
    method public android.support.v4.app.NotificationCompat.InboxStyle setSummaryText(java.lang.CharSequence);
  }

  public static class NotificationCompat.MessagingStyle extends android.support.v4.app.NotificationCompat.Style {
    ctor public NotificationCompat.MessagingStyle(java.lang.CharSequence);
    method public void addCompatExtras(android.os.Bundle);
    method public android.support.v4.app.NotificationCompat.MessagingStyle addMessage(java.lang.CharSequence, long, java.lang.CharSequence);
    method public android.support.v4.app.NotificationCompat.MessagingStyle addMessage(android.support.v4.app.NotificationCompat.MessagingStyle.Message);
    method public static android.support.v4.app.NotificationCompat.MessagingStyle extractMessagingStyleFromNotification(android.app.Notification);
    method public java.lang.CharSequence getConversationTitle();
    method public java.util.List<android.support.v4.app.NotificationCompat.MessagingStyle.Message> getMessages();
    method public java.lang.CharSequence getUserDisplayName();
    method public android.support.v4.app.NotificationCompat.MessagingStyle setConversationTitle(java.lang.CharSequence);
    field public static final int MAXIMUM_RETAINED_MESSAGES = 25; // 0x19
  }

  public static final class NotificationCompat.MessagingStyle.Message {
    ctor public NotificationCompat.MessagingStyle.Message(java.lang.CharSequence, long, java.lang.CharSequence);
    method public java.lang.String getDataMimeType();
    method public android.net.Uri getDataUri();
    method public android.os.Bundle getExtras();
    method public java.lang.CharSequence getSender();
    method public java.lang.CharSequence getText();
    method public long getTimestamp();
    method public android.support.v4.app.NotificationCompat.MessagingStyle.Message setData(java.lang.String, android.net.Uri);
  }

  public static abstract class NotificationCompat.Style {
    ctor public NotificationCompat.Style();
    method public android.app.Notification build();
    method public void setBuilder(android.support.v4.app.NotificationCompat.Builder);
  }

  public static final class NotificationCompat.WearableExtender implements android.support.v4.app.NotificationCompat.Extender {
    ctor public NotificationCompat.WearableExtender();
    ctor public NotificationCompat.WearableExtender(android.app.Notification);
    method public android.support.v4.app.NotificationCompat.WearableExtender addAction(android.support.v4.app.NotificationCompat.Action);
    method public android.support.v4.app.NotificationCompat.WearableExtender addActions(java.util.List<android.support.v4.app.NotificationCompat.Action>);
    method public android.support.v4.app.NotificationCompat.WearableExtender addPage(android.app.Notification);
    method public android.support.v4.app.NotificationCompat.WearableExtender addPages(java.util.List<android.app.Notification>);
    method public android.support.v4.app.NotificationCompat.WearableExtender clearActions();
    method public android.support.v4.app.NotificationCompat.WearableExtender clearPages();
    method public android.support.v4.app.NotificationCompat.WearableExtender clone();
    method public android.support.v4.app.NotificationCompat.Builder extend(android.support.v4.app.NotificationCompat.Builder);
    method public java.util.List<android.support.v4.app.NotificationCompat.Action> getActions();
    method public android.graphics.Bitmap getBackground();
    method public java.lang.String getBridgeTag();
    method public int getContentAction();
    method public int getContentIcon();
    method public int getContentIconGravity();
    method public boolean getContentIntentAvailableOffline();
    method public int getCustomContentHeight();
    method public int getCustomSizePreset();
    method public java.lang.String getDismissalId();
    method public android.app.PendingIntent getDisplayIntent();
    method public int getGravity();
    method public boolean getHintAmbientBigPicture();
    method public boolean getHintAvoidBackgroundClipping();
    method public boolean getHintContentIntentLaunchesActivity();
    method public boolean getHintHideIcon();
    method public int getHintScreenTimeout();
    method public boolean getHintShowBackgroundOnly();
    method public java.util.List<android.app.Notification> getPages();
    method public boolean getStartScrollBottom();
    method public android.support.v4.app.NotificationCompat.WearableExtender setBackground(android.graphics.Bitmap);
    method public android.support.v4.app.NotificationCompat.WearableExtender setBridgeTag(java.lang.String);
    method public android.support.v4.app.NotificationCompat.WearableExtender setContentAction(int);
    method public android.support.v4.app.NotificationCompat.WearableExtender setContentIcon(int);
    method public android.support.v4.app.NotificationCompat.WearableExtender setContentIconGravity(int);
    method public android.support.v4.app.NotificationCompat.WearableExtender setContentIntentAvailableOffline(boolean);
    method public android.support.v4.app.NotificationCompat.WearableExtender setCustomContentHeight(int);
    method public android.support.v4.app.NotificationCompat.WearableExtender setCustomSizePreset(int);
    method public android.support.v4.app.NotificationCompat.WearableExtender setDismissalId(java.lang.String);
    method public android.support.v4.app.NotificationCompat.WearableExtender setDisplayIntent(android.app.PendingIntent);
    method public android.support.v4.app.NotificationCompat.WearableExtender setGravity(int);
    method public android.support.v4.app.NotificationCompat.WearableExtender setHintAmbientBigPicture(boolean);
    method public android.support.v4.app.NotificationCompat.WearableExtender setHintAvoidBackgroundClipping(boolean);
    method public android.support.v4.app.NotificationCompat.WearableExtender setHintContentIntentLaunchesActivity(boolean);
    method public android.support.v4.app.NotificationCompat.WearableExtender setHintHideIcon(boolean);
    method public android.support.v4.app.NotificationCompat.WearableExtender setHintScreenTimeout(int);
    method public android.support.v4.app.NotificationCompat.WearableExtender setHintShowBackgroundOnly(boolean);
    method public android.support.v4.app.NotificationCompat.WearableExtender setStartScrollBottom(boolean);
    field public static final int SCREEN_TIMEOUT_LONG = -1; // 0xffffffff
    field public static final int SCREEN_TIMEOUT_SHORT = 0; // 0x0
    field public static final int SIZE_DEFAULT = 0; // 0x0
    field public static final int SIZE_FULL_SCREEN = 5; // 0x5
    field public static final int SIZE_LARGE = 4; // 0x4
    field public static final int SIZE_MEDIUM = 3; // 0x3
    field public static final int SIZE_SMALL = 2; // 0x2
    field public static final int SIZE_XSMALL = 1; // 0x1
    field public static final int UNSET_ACTION_INDEX = -1; // 0xffffffff
  }

  public final class NotificationCompatExtras {
    field public static final java.lang.String EXTRA_ACTION_EXTRAS = "android.support.actionExtras";
    field public static final java.lang.String EXTRA_GROUP_KEY = "android.support.groupKey";
    field public static final java.lang.String EXTRA_GROUP_SUMMARY = "android.support.isGroupSummary";
    field public static final java.lang.String EXTRA_LOCAL_ONLY = "android.support.localOnly";
    field public static final java.lang.String EXTRA_REMOTE_INPUTS = "android.support.remoteInputs";
    field public static final java.lang.String EXTRA_SORT_KEY = "android.support.sortKey";
  }

  public abstract class NotificationCompatSideChannelService extends android.app.Service {
    ctor public NotificationCompatSideChannelService();
    method public abstract void cancel(java.lang.String, int, java.lang.String);
    method public abstract void cancelAll(java.lang.String);
    method public abstract void notify(java.lang.String, int, java.lang.String, android.app.Notification);
    method public android.os.IBinder onBind(android.content.Intent);
  }

  public final class NotificationManagerCompat {
    method public boolean areNotificationsEnabled();
    method public void cancel(int);
    method public void cancel(java.lang.String, int);
    method public void cancelAll();
    method public static android.support.v4.app.NotificationManagerCompat from(android.content.Context);
    method public static java.util.Set<java.lang.String> getEnabledListenerPackages(android.content.Context);
    method public int getImportance();
    method public void notify(int, android.app.Notification);
    method public void notify(java.lang.String, int, android.app.Notification);
    field public static final java.lang.String ACTION_BIND_SIDE_CHANNEL = "android.support.BIND_NOTIFICATION_SIDE_CHANNEL";
    field public static final java.lang.String EXTRA_USE_SIDE_CHANNEL = "android.support.useSideChannel";
    field public static final int IMPORTANCE_DEFAULT = 3; // 0x3
    field public static final int IMPORTANCE_HIGH = 4; // 0x4
    field public static final int IMPORTANCE_LOW = 2; // 0x2
    field public static final int IMPORTANCE_MAX = 5; // 0x5
    field public static final int IMPORTANCE_MIN = 1; // 0x1
    field public static final int IMPORTANCE_NONE = 0; // 0x0
    field public static final int IMPORTANCE_UNSPECIFIED = -1000; // 0xfffffc18
  }

  public final class RemoteInput extends android.support.v4.app.RemoteInputCompatBase.RemoteInput {
    method public static void addDataResultToIntent(android.support.v4.app.RemoteInput, android.content.Intent, java.util.Map<java.lang.String, android.net.Uri>);
    method public static void addResultsToIntent(android.support.v4.app.RemoteInput[], android.content.Intent, android.os.Bundle);
    method public boolean getAllowFreeFormInput();
    method public java.util.Set<java.lang.String> getAllowedDataTypes();
    method public java.lang.CharSequence[] getChoices();
    method public static java.util.Map<java.lang.String, android.net.Uri> getDataResultsFromIntent(android.content.Intent, java.lang.String);
    method public android.os.Bundle getExtras();
    method public java.lang.CharSequence getLabel();
    method public java.lang.String getResultKey();
    method public static android.os.Bundle getResultsFromIntent(android.content.Intent);
    method public boolean isDataOnly();
    field public static final java.lang.String EXTRA_RESULTS_DATA = "android.remoteinput.resultsData";
    field public static final java.lang.String RESULTS_CLIP_LABEL = "android.remoteinput.results";
  }

  public static final class RemoteInput.Builder {
    ctor public RemoteInput.Builder(java.lang.String);
    method public android.support.v4.app.RemoteInput.Builder addExtras(android.os.Bundle);
    method public android.support.v4.app.RemoteInput build();
    method public android.os.Bundle getExtras();
    method public android.support.v4.app.RemoteInput.Builder setAllowDataType(java.lang.String, boolean);
    method public android.support.v4.app.RemoteInput.Builder setAllowFreeFormInput(boolean);
    method public android.support.v4.app.RemoteInput.Builder setChoices(java.lang.CharSequence[]);
    method public android.support.v4.app.RemoteInput.Builder setLabel(java.lang.CharSequence);
  }

   deprecated class RemoteInputCompatBase {
  }

  public static abstract class RemoteInputCompatBase.RemoteInput {
    ctor public RemoteInputCompatBase.RemoteInput();
    method protected abstract boolean getAllowFreeFormInput();
    method protected abstract java.util.Set<java.lang.String> getAllowedDataTypes();
    method protected abstract java.lang.CharSequence[] getChoices();
    method protected abstract android.os.Bundle getExtras();
    method protected abstract java.lang.CharSequence getLabel();
    method protected abstract java.lang.String getResultKey();
  }

  public final class ServiceCompat {
    method public static void stopForeground(android.app.Service, int);
    field public static final int START_STICKY = 1; // 0x1
    field public static final int STOP_FOREGROUND_DETACH = 2; // 0x2
    field public static final int STOP_FOREGROUND_REMOVE = 1; // 0x1
  }

  public final class ShareCompat {
    method public static void configureMenuItem(android.view.MenuItem, android.support.v4.app.ShareCompat.IntentBuilder);
    method public static void configureMenuItem(android.view.Menu, int, android.support.v4.app.ShareCompat.IntentBuilder);
    method public static android.content.ComponentName getCallingActivity(android.app.Activity);
    method public static java.lang.String getCallingPackage(android.app.Activity);
    field public static final java.lang.String EXTRA_CALLING_ACTIVITY = "android.support.v4.app.EXTRA_CALLING_ACTIVITY";
    field public static final java.lang.String EXTRA_CALLING_PACKAGE = "android.support.v4.app.EXTRA_CALLING_PACKAGE";
  }

  public static class ShareCompat.IntentBuilder {
    method public android.support.v4.app.ShareCompat.IntentBuilder addEmailBcc(java.lang.String);
    method public android.support.v4.app.ShareCompat.IntentBuilder addEmailBcc(java.lang.String[]);
    method public android.support.v4.app.ShareCompat.IntentBuilder addEmailCc(java.lang.String);
    method public android.support.v4.app.ShareCompat.IntentBuilder addEmailCc(java.lang.String[]);
    method public android.support.v4.app.ShareCompat.IntentBuilder addEmailTo(java.lang.String);
    method public android.support.v4.app.ShareCompat.IntentBuilder addEmailTo(java.lang.String[]);
    method public android.support.v4.app.ShareCompat.IntentBuilder addStream(android.net.Uri);
    method public android.content.Intent createChooserIntent();
    method public static android.support.v4.app.ShareCompat.IntentBuilder from(android.app.Activity);
    method public android.content.Intent getIntent();
    method public android.support.v4.app.ShareCompat.IntentBuilder setChooserTitle(java.lang.CharSequence);
    method public android.support.v4.app.ShareCompat.IntentBuilder setChooserTitle(int);
    method public android.support.v4.app.ShareCompat.IntentBuilder setEmailBcc(java.lang.String[]);
    method public android.support.v4.app.ShareCompat.IntentBuilder setEmailCc(java.lang.String[]);
    method public android.support.v4.app.ShareCompat.IntentBuilder setEmailTo(java.lang.String[]);
    method public android.support.v4.app.ShareCompat.IntentBuilder setHtmlText(java.lang.String);
    method public android.support.v4.app.ShareCompat.IntentBuilder setStream(android.net.Uri);
    method public android.support.v4.app.ShareCompat.IntentBuilder setSubject(java.lang.String);
    method public android.support.v4.app.ShareCompat.IntentBuilder setText(java.lang.CharSequence);
    method public android.support.v4.app.ShareCompat.IntentBuilder setType(java.lang.String);
    method public void startChooser();
  }

  public static class ShareCompat.IntentReader {
    method public static android.support.v4.app.ShareCompat.IntentReader from(android.app.Activity);
    method public android.content.ComponentName getCallingActivity();
    method public android.graphics.drawable.Drawable getCallingActivityIcon();
    method public android.graphics.drawable.Drawable getCallingApplicationIcon();
    method public java.lang.CharSequence getCallingApplicationLabel();
    method public java.lang.String getCallingPackage();
    method public java.lang.String[] getEmailBcc();
    method public java.lang.String[] getEmailCc();
    method public java.lang.String[] getEmailTo();
    method public java.lang.String getHtmlText();
    method public android.net.Uri getStream();
    method public android.net.Uri getStream(int);
    method public int getStreamCount();
    method public java.lang.String getSubject();
    method public java.lang.CharSequence getText();
    method public java.lang.String getType();
    method public boolean isMultipleShare();
    method public boolean isShareIntent();
    method public boolean isSingleShare();
  }

  public abstract class SharedElementCallback {
    ctor public SharedElementCallback();
    method public android.os.Parcelable onCaptureSharedElementSnapshot(android.view.View, android.graphics.Matrix, android.graphics.RectF);
    method public android.view.View onCreateSnapshotView(android.content.Context, android.os.Parcelable);
    method public void onMapSharedElements(java.util.List<java.lang.String>, java.util.Map<java.lang.String, android.view.View>);
    method public void onRejectSharedElements(java.util.List<android.view.View>);
    method public void onSharedElementEnd(java.util.List<java.lang.String>, java.util.List<android.view.View>, java.util.List<android.view.View>);
    method public void onSharedElementStart(java.util.List<java.lang.String>, java.util.List<android.view.View>, java.util.List<android.view.View>);
    method public void onSharedElementsArrived(java.util.List<java.lang.String>, java.util.List<android.view.View>, android.support.v4.app.SharedElementCallback.OnSharedElementsReadyListener);
  }

  public static abstract interface SharedElementCallback.OnSharedElementsReadyListener {
    method public abstract void onSharedElementsReady();
  }

  public final class TaskStackBuilder implements java.lang.Iterable {
    method public android.support.v4.app.TaskStackBuilder addNextIntent(android.content.Intent);
    method public android.support.v4.app.TaskStackBuilder addNextIntentWithParentStack(android.content.Intent);
    method public android.support.v4.app.TaskStackBuilder addParentStack(android.app.Activity);
    method public android.support.v4.app.TaskStackBuilder addParentStack(java.lang.Class<?>);
    method public android.support.v4.app.TaskStackBuilder addParentStack(android.content.ComponentName);
    method public static android.support.v4.app.TaskStackBuilder create(android.content.Context);
    method public android.content.Intent editIntentAt(int);
    method public static deprecated android.support.v4.app.TaskStackBuilder from(android.content.Context);
    method public deprecated android.content.Intent getIntent(int);
    method public int getIntentCount();
    method public android.content.Intent[] getIntents();
    method public android.app.PendingIntent getPendingIntent(int, int);
    method public android.app.PendingIntent getPendingIntent(int, int, android.os.Bundle);
    method public deprecated java.util.Iterator<android.content.Intent> iterator();
    method public void startActivities();
    method public void startActivities(android.os.Bundle);
  }

  public static abstract interface TaskStackBuilder.SupportParentable {
    method public abstract android.content.Intent getSupportParentActivityIntent();
  }

}

package android.support.v4.content {

  public abstract class AsyncTaskLoader<D> extends android.support.v4.content.Loader {
    ctor public AsyncTaskLoader(android.content.Context);
    method public void cancelLoadInBackground();
    method public boolean isLoadInBackgroundCanceled();
    method public abstract D loadInBackground();
    method public void onCanceled(D);
    method protected D onLoadInBackground();
    method public void setUpdateThrottle(long);
  }

  public final class ContentResolverCompat {
    method public static android.database.Cursor query(android.content.ContentResolver, android.net.Uri, java.lang.String[], java.lang.String, java.lang.String[], java.lang.String, android.support.v4.os.CancellationSignal);
  }

  public class ContextCompat {
    ctor protected ContextCompat();
    method public static int checkSelfPermission(android.content.Context, java.lang.String);
    method public static android.content.Context createDeviceProtectedStorageContext(android.content.Context);
    method public static java.io.File getCodeCacheDir(android.content.Context);
    method public static final int getColor(android.content.Context, int);
    method public static final android.content.res.ColorStateList getColorStateList(android.content.Context, int);
    method public static java.io.File getDataDir(android.content.Context);
    method public static final android.graphics.drawable.Drawable getDrawable(android.content.Context, int);
    method public static java.io.File[] getExternalCacheDirs(android.content.Context);
    method public static java.io.File[] getExternalFilesDirs(android.content.Context, java.lang.String);
    method public static final java.io.File getNoBackupFilesDir(android.content.Context);
    method public static java.io.File[] getObbDirs(android.content.Context);
    method public static boolean isDeviceProtectedStorage(android.content.Context);
    method public static boolean startActivities(android.content.Context, android.content.Intent[]);
    method public static boolean startActivities(android.content.Context, android.content.Intent[], android.os.Bundle);
    method public static void startActivity(android.content.Context, android.content.Intent, android.os.Bundle);
    method public static void startForegroundService(android.content.Context, android.content.Intent);
  }

  public class CursorLoader extends android.support.v4.content.AsyncTaskLoader {
    ctor public CursorLoader(android.content.Context);
    ctor public CursorLoader(android.content.Context, android.net.Uri, java.lang.String[], java.lang.String, java.lang.String[], java.lang.String);
    method public void deliverResult(android.database.Cursor);
    method public java.lang.String[] getProjection();
    method public java.lang.String getSelection();
    method public java.lang.String[] getSelectionArgs();
    method public java.lang.String getSortOrder();
    method public android.net.Uri getUri();
    method public android.database.Cursor loadInBackground();
    method public void onCanceled(android.database.Cursor);
    method public void setProjection(java.lang.String[]);
    method public void setSelection(java.lang.String);
    method public void setSelectionArgs(java.lang.String[]);
    method public void setSortOrder(java.lang.String);
    method public void setUri(android.net.Uri);
  }

  public class FileProvider extends android.content.ContentProvider {
    ctor public FileProvider();
    method public int delete(android.net.Uri, java.lang.String, java.lang.String[]);
    method public java.lang.String getType(android.net.Uri);
    method public static android.net.Uri getUriForFile(android.content.Context, java.lang.String, java.io.File);
    method public android.net.Uri insert(android.net.Uri, android.content.ContentValues);
    method public boolean onCreate();
    method public android.database.Cursor query(android.net.Uri, java.lang.String[], java.lang.String, java.lang.String[], java.lang.String);
    method public int update(android.net.Uri, android.content.ContentValues, java.lang.String, java.lang.String[]);
  }

  public final class IntentCompat {
    method public static deprecated android.content.Intent makeMainActivity(android.content.ComponentName);
    method public static android.content.Intent makeMainSelectorActivity(java.lang.String, java.lang.String);
    method public static deprecated android.content.Intent makeRestartActivityTask(android.content.ComponentName);
    field public static final deprecated java.lang.String ACTION_EXTERNAL_APPLICATIONS_AVAILABLE = "android.intent.action.EXTERNAL_APPLICATIONS_AVAILABLE";
    field public static final deprecated java.lang.String ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE = "android.intent.action.EXTERNAL_APPLICATIONS_UNAVAILABLE";
    field public static final java.lang.String CATEGORY_LEANBACK_LAUNCHER = "android.intent.category.LEANBACK_LAUNCHER";
    field public static final deprecated java.lang.String EXTRA_CHANGED_PACKAGE_LIST = "android.intent.extra.changed_package_list";
    field public static final deprecated java.lang.String EXTRA_CHANGED_UID_LIST = "android.intent.extra.changed_uid_list";
    field public static final java.lang.String EXTRA_HTML_TEXT = "android.intent.extra.HTML_TEXT";
    field public static final java.lang.String EXTRA_START_PLAYBACK = "android.intent.extra.START_PLAYBACK";
    field public static final deprecated int FLAG_ACTIVITY_CLEAR_TASK = 32768; // 0x8000
    field public static final deprecated int FLAG_ACTIVITY_TASK_ON_HOME = 16384; // 0x4000
  }

  public class Loader<D> {
    ctor public Loader(android.content.Context);
    method public void abandon();
    method public boolean cancelLoad();
    method public void commitContentChanged();
    method public java.lang.String dataToString(D);
    method public void deliverCancellation();
    method public void deliverResult(D);
    method public void dump(java.lang.String, java.io.FileDescriptor, java.io.PrintWriter, java.lang.String[]);
    method public void forceLoad();
    method public android.content.Context getContext();
    method public int getId();
    method public boolean isAbandoned();
    method public boolean isReset();
    method public boolean isStarted();
    method protected void onAbandon();
    method protected boolean onCancelLoad();
    method public void onContentChanged();
    method protected void onForceLoad();
    method protected void onReset();
    method protected void onStartLoading();
    method protected void onStopLoading();
    method public void registerListener(int, android.support.v4.content.Loader.OnLoadCompleteListener<D>);
    method public void registerOnLoadCanceledListener(android.support.v4.content.Loader.OnLoadCanceledListener<D>);
    method public void reset();
    method public void rollbackContentChanged();
    method public final void startLoading();
    method public void stopLoading();
    method public boolean takeContentChanged();
    method public void unregisterListener(android.support.v4.content.Loader.OnLoadCompleteListener<D>);
    method public void unregisterOnLoadCanceledListener(android.support.v4.content.Loader.OnLoadCanceledListener<D>);
  }

  public final class Loader.ForceLoadContentObserver extends android.database.ContentObserver {
    ctor public Loader.ForceLoadContentObserver();
  }

  public static abstract interface Loader.OnLoadCanceledListener<D> {
    method public abstract void onLoadCanceled(android.support.v4.content.Loader<D>);
  }

  public static abstract interface Loader.OnLoadCompleteListener<D> {
    method public abstract void onLoadComplete(android.support.v4.content.Loader<D>, D);
  }

  public final class LocalBroadcastManager {
    method public static android.support.v4.content.LocalBroadcastManager getInstance(android.content.Context);
    method public void registerReceiver(android.content.BroadcastReceiver, android.content.IntentFilter);
    method public boolean sendBroadcast(android.content.Intent);
    method public void sendBroadcastSync(android.content.Intent);
    method public void unregisterReceiver(android.content.BroadcastReceiver);
  }

  public final class MimeTypeFilter {
    method public static boolean matches(java.lang.String, java.lang.String);
    method public static java.lang.String matches(java.lang.String, java.lang.String[]);
    method public static java.lang.String matches(java.lang.String[], java.lang.String);
    method public static java.lang.String[] matchesMany(java.lang.String[], java.lang.String);
  }

  public final deprecated class ParallelExecutorCompat {
    method public static deprecated java.util.concurrent.Executor getParallelExecutor();
  }

  public final class PermissionChecker {
    method public static int checkCallingOrSelfPermission(android.content.Context, java.lang.String);
    method public static int checkCallingPermission(android.content.Context, java.lang.String, java.lang.String);
    method public static int checkPermission(android.content.Context, java.lang.String, int, int, java.lang.String);
    method public static int checkSelfPermission(android.content.Context, java.lang.String);
    field public static final int PERMISSION_DENIED = -1; // 0xffffffff
    field public static final int PERMISSION_DENIED_APP_OP = -2; // 0xfffffffe
    field public static final int PERMISSION_GRANTED = 0; // 0x0
  }

  public final class SharedPreferencesCompat {
  }

  public static final class SharedPreferencesCompat.EditorCompat {
    method public void apply(android.content.SharedPreferences.Editor);
    method public static android.support.v4.content.SharedPreferencesCompat.EditorCompat getInstance();
  }

  public abstract deprecated class WakefulBroadcastReceiver extends android.content.BroadcastReceiver {
    ctor public WakefulBroadcastReceiver();
    method public static boolean completeWakefulIntent(android.content.Intent);
    method public static android.content.ComponentName startWakefulService(android.content.Context, android.content.Intent);
  }

}

package android.support.v4.content.pm {

  public final class ActivityInfoCompat {
    field public static final int CONFIG_UI_MODE = 512; // 0x200
  }

  public class ShortcutInfoCompat {
    method public android.content.ComponentName getActivity();
    method public java.lang.CharSequence getDisabledMessage();
    method public java.lang.String getId();
    method public android.content.Intent getIntent();
    method public android.content.Intent[] getIntents();
    method public java.lang.CharSequence getLongLabel();
    method public java.lang.CharSequence getShortLabel();
  }

  public static class ShortcutInfoCompat.Builder {
    ctor public ShortcutInfoCompat.Builder(android.content.Context, java.lang.String);
    method public android.support.v4.content.pm.ShortcutInfoCompat build();
    method public android.support.v4.content.pm.ShortcutInfoCompat.Builder setActivity(android.content.ComponentName);
    method public android.support.v4.content.pm.ShortcutInfoCompat.Builder setDisabledMessage(java.lang.CharSequence);
    method public deprecated android.support.v4.content.pm.ShortcutInfoCompat.Builder setIcon(android.graphics.Bitmap);
    method public deprecated android.support.v4.content.pm.ShortcutInfoCompat.Builder setIcon(int);
    method public android.support.v4.content.pm.ShortcutInfoCompat.Builder setIcon(android.support.v4.graphics.drawable.IconCompat);
    method public android.support.v4.content.pm.ShortcutInfoCompat.Builder setIntent(android.content.Intent);
    method public android.support.v4.content.pm.ShortcutInfoCompat.Builder setIntents(android.content.Intent[]);
    method public android.support.v4.content.pm.ShortcutInfoCompat.Builder setLongLabel(java.lang.CharSequence);
    method public android.support.v4.content.pm.ShortcutInfoCompat.Builder setShortLabel(java.lang.CharSequence);
  }

  public class ShortcutManagerCompat {
    method public static android.content.Intent createShortcutResultIntent(android.content.Context, android.support.v4.content.pm.ShortcutInfoCompat);
    method public static boolean isRequestPinShortcutSupported(android.content.Context);
    method public static boolean requestPinShortcut(android.content.Context, android.support.v4.content.pm.ShortcutInfoCompat, android.content.IntentSender);
  }

}

package android.support.v4.content.res {

  public final class ConfigurationHelper {
    method public static int getDensityDpi(android.content.res.Resources);
    method public static deprecated int getScreenHeightDp(android.content.res.Resources);
    method public static deprecated int getScreenWidthDp(android.content.res.Resources);
    method public static deprecated int getSmallestScreenWidthDp(android.content.res.Resources);
  }

  public final class ResourcesCompat {
    method public static int getColor(android.content.res.Resources, int, android.content.res.Resources.Theme) throws android.content.res.Resources.NotFoundException;
    method public static android.content.res.ColorStateList getColorStateList(android.content.res.Resources, int, android.content.res.Resources.Theme) throws android.content.res.Resources.NotFoundException;
    method public static android.graphics.drawable.Drawable getDrawable(android.content.res.Resources, int, android.content.res.Resources.Theme) throws android.content.res.Resources.NotFoundException;
    method public static android.graphics.drawable.Drawable getDrawableForDensity(android.content.res.Resources, int, int, android.content.res.Resources.Theme) throws android.content.res.Resources.NotFoundException;
    method public static android.graphics.Typeface getFont(android.content.Context, int) throws android.content.res.Resources.NotFoundException;
  }

}

package android.support.v4.database {

  public final class DatabaseUtilsCompat {
    method public static java.lang.String[] appendSelectionArgs(java.lang.String[], java.lang.String[]);
    method public static java.lang.String concatenateWhere(java.lang.String, java.lang.String);
  }

}

package android.support.v4.graphics {

  public final class BitmapCompat {
    method public static int getAllocationByteCount(android.graphics.Bitmap);
    method public static boolean hasMipMap(android.graphics.Bitmap);
    method public static void setHasMipMap(android.graphics.Bitmap, boolean);
  }

  public final class ColorUtils {
    method public static int HSLToColor(float[]);
    method public static int LABToColor(double, double, double);
    method public static void LABToXYZ(double, double, double, double[]);
    method public static void RGBToHSL(int, int, int, float[]);
    method public static void RGBToLAB(int, int, int, double[]);
    method public static void RGBToXYZ(int, int, int, double[]);
    method public static int XYZToColor(double, double, double);
    method public static void XYZToLAB(double, double, double, double[]);
    method public static int blendARGB(int, int, float);
    method public static void blendHSL(float[], float[], float, float[]);
    method public static void blendLAB(double[], double[], double, double[]);
    method public static double calculateContrast(int, int);
    method public static double calculateLuminance(int);
    method public static int calculateMinimumAlpha(int, int, float);
    method public static void colorToHSL(int, float[]);
    method public static void colorToLAB(int, double[]);
    method public static void colorToXYZ(int, double[]);
    method public static int compositeColors(int, int);
    method public static double distanceEuclidean(double[], double[]);
    method public static int setAlphaComponent(int, int);
  }

  public final class PaintCompat {
    method public static boolean hasGlyph(android.graphics.Paint, java.lang.String);
  }

}

package android.support.v4.graphics.drawable {

  public final class DrawableCompat {
    method public static void applyTheme(android.graphics.drawable.Drawable, android.content.res.Resources.Theme);
    method public static boolean canApplyTheme(android.graphics.drawable.Drawable);
    method public static void clearColorFilter(android.graphics.drawable.Drawable);
    method public static int getAlpha(android.graphics.drawable.Drawable);
    method public static android.graphics.ColorFilter getColorFilter(android.graphics.drawable.Drawable);
    method public static int getLayoutDirection(android.graphics.drawable.Drawable);
    method public static void inflate(android.graphics.drawable.Drawable, android.content.res.Resources, org.xmlpull.v1.XmlPullParser, android.util.AttributeSet, android.content.res.Resources.Theme) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
    method public static boolean isAutoMirrored(android.graphics.drawable.Drawable);
    method public static void jumpToCurrentState(android.graphics.drawable.Drawable);
    method public static void setAutoMirrored(android.graphics.drawable.Drawable, boolean);
    method public static void setHotspot(android.graphics.drawable.Drawable, float, float);
    method public static void setHotspotBounds(android.graphics.drawable.Drawable, int, int, int, int);
    method public static boolean setLayoutDirection(android.graphics.drawable.Drawable, int);
    method public static void setTint(android.graphics.drawable.Drawable, int);
    method public static void setTintList(android.graphics.drawable.Drawable, android.content.res.ColorStateList);
    method public static void setTintMode(android.graphics.drawable.Drawable, android.graphics.PorterDuff.Mode);
    method public static <T extends android.graphics.drawable.Drawable> T unwrap(android.graphics.drawable.Drawable);
    method public static android.graphics.drawable.Drawable wrap(android.graphics.drawable.Drawable);
  }

  public class IconCompat {
    method public static android.support.v4.graphics.drawable.IconCompat createWithAdaptiveBitmap(android.graphics.Bitmap);
    method public static android.support.v4.graphics.drawable.IconCompat createWithBitmap(android.graphics.Bitmap);
    method public static android.support.v4.graphics.drawable.IconCompat createWithContentUri(java.lang.String);
    method public static android.support.v4.graphics.drawable.IconCompat createWithContentUri(android.net.Uri);
    method public static android.support.v4.graphics.drawable.IconCompat createWithData(byte[], int, int);
    method public static android.support.v4.graphics.drawable.IconCompat createWithResource(android.content.Context, int);
  }

  public abstract class RoundedBitmapDrawable extends android.graphics.drawable.Drawable {
    method public void draw(android.graphics.Canvas);
    method public final android.graphics.Bitmap getBitmap();
    method public float getCornerRadius();
    method public int getGravity();
    method public int getOpacity();
    method public final android.graphics.Paint getPaint();
    method public boolean hasAntiAlias();
    method public boolean hasMipMap();
    method public boolean isCircular();
    method public void setAlpha(int);
    method public void setAntiAlias(boolean);
    method public void setCircular(boolean);
    method public void setColorFilter(android.graphics.ColorFilter);
    method public void setCornerRadius(float);
    method public void setDither(boolean);
    method public void setGravity(int);
    method public void setMipMap(boolean);
    method public void setTargetDensity(android.graphics.Canvas);
    method public void setTargetDensity(android.util.DisplayMetrics);
    method public void setTargetDensity(int);
  }

  public final class RoundedBitmapDrawableFactory {
    method public static android.support.v4.graphics.drawable.RoundedBitmapDrawable create(android.content.res.Resources, android.graphics.Bitmap);
    method public static android.support.v4.graphics.drawable.RoundedBitmapDrawable create(android.content.res.Resources, java.lang.String);
    method public static android.support.v4.graphics.drawable.RoundedBitmapDrawable create(android.content.res.Resources, java.io.InputStream);
  }

}

package android.support.v4.hardware.display {

  public abstract class DisplayManagerCompat {
    method public abstract android.view.Display getDisplay(int);
    method public abstract android.view.Display[] getDisplays();
    method public abstract android.view.Display[] getDisplays(java.lang.String);
    method public static android.support.v4.hardware.display.DisplayManagerCompat getInstance(android.content.Context);
    field public static final java.lang.String DISPLAY_CATEGORY_PRESENTATION = "android.hardware.display.category.PRESENTATION";
  }

}

package android.support.v4.hardware.fingerprint {

  public final class FingerprintManagerCompat {
    method public void authenticate(android.support.v4.hardware.fingerprint.FingerprintManagerCompat.CryptoObject, int, android.support.v4.os.CancellationSignal, android.support.v4.hardware.fingerprint.FingerprintManagerCompat.AuthenticationCallback, android.os.Handler);
    method public static android.support.v4.hardware.fingerprint.FingerprintManagerCompat from(android.content.Context);
    method public boolean hasEnrolledFingerprints();
    method public boolean isHardwareDetected();
  }

  public static abstract class FingerprintManagerCompat.AuthenticationCallback {
    ctor public FingerprintManagerCompat.AuthenticationCallback();
    method public void onAuthenticationError(int, java.lang.CharSequence);
    method public void onAuthenticationFailed();
    method public void onAuthenticationHelp(int, java.lang.CharSequence);
    method public void onAuthenticationSucceeded(android.support.v4.hardware.fingerprint.FingerprintManagerCompat.AuthenticationResult);
  }

  public static final class FingerprintManagerCompat.AuthenticationResult {
    ctor public FingerprintManagerCompat.AuthenticationResult(android.support.v4.hardware.fingerprint.FingerprintManagerCompat.CryptoObject);
    method public android.support.v4.hardware.fingerprint.FingerprintManagerCompat.CryptoObject getCryptoObject();
  }

  public static class FingerprintManagerCompat.CryptoObject {
    ctor public FingerprintManagerCompat.CryptoObject(java.security.Signature);
    ctor public FingerprintManagerCompat.CryptoObject(javax.crypto.Cipher);
    ctor public FingerprintManagerCompat.CryptoObject(javax.crypto.Mac);
    method public javax.crypto.Cipher getCipher();
    method public javax.crypto.Mac getMac();
    method public java.security.Signature getSignature();
  }

}

package android.support.v4.math {

  public class MathUtils {
    method public static float clamp(float, float, float);
    method public static double clamp(double, double, double);
    method public static int clamp(int, int, int);
  }

}

package android.support.v4.media {

  public class AudioAttributesCompat {
    method public int getContentType();
    method public int getFlags();
    method public int getLegacyStreamType();
    method public int getUsage();
    method public int getVolumeControlStream();
    method public java.lang.Object unwrap();
    method public static android.support.v4.media.AudioAttributesCompat wrap(java.lang.Object);
    field public static final int CONTENT_TYPE_MOVIE = 3; // 0x3
    field public static final int CONTENT_TYPE_MUSIC = 2; // 0x2
    field public static final int CONTENT_TYPE_SONIFICATION = 4; // 0x4
    field public static final int CONTENT_TYPE_SPEECH = 1; // 0x1
    field public static final int CONTENT_TYPE_UNKNOWN = 0; // 0x0
    field public static final int FLAG_AUDIBILITY_ENFORCED = 1; // 0x1
    field public static final int FLAG_HW_AV_SYNC = 16; // 0x10
    field public static final int USAGE_ALARM = 4; // 0x4
    field public static final int USAGE_ASSISTANCE_ACCESSIBILITY = 11; // 0xb
    field public static final int USAGE_ASSISTANCE_NAVIGATION_GUIDANCE = 12; // 0xc
    field public static final int USAGE_ASSISTANCE_SONIFICATION = 13; // 0xd
    field public static final int USAGE_ASSISTANT = 16; // 0x10
    field public static final int USAGE_GAME = 14; // 0xe
    field public static final int USAGE_MEDIA = 1; // 0x1
    field public static final int USAGE_NOTIFICATION = 5; // 0x5
    field public static final int USAGE_NOTIFICATION_COMMUNICATION_DELAYED = 9; // 0x9
    field public static final int USAGE_NOTIFICATION_COMMUNICATION_INSTANT = 8; // 0x8
    field public static final int USAGE_NOTIFICATION_COMMUNICATION_REQUEST = 7; // 0x7
    field public static final int USAGE_NOTIFICATION_EVENT = 10; // 0xa
    field public static final int USAGE_NOTIFICATION_RINGTONE = 6; // 0x6
    field public static final int USAGE_UNKNOWN = 0; // 0x0
    field public static final int USAGE_VOICE_COMMUNICATION = 2; // 0x2
    field public static final int USAGE_VOICE_COMMUNICATION_SIGNALLING = 3; // 0x3
  }

  public static class AudioAttributesCompat.Builder {
    ctor public AudioAttributesCompat.Builder();
    ctor public AudioAttributesCompat.Builder(android.support.v4.media.AudioAttributesCompat);
    method public android.support.v4.media.AudioAttributesCompat build();
    method public android.support.v4.media.AudioAttributesCompat.Builder setContentType(int);
    method public android.support.v4.media.AudioAttributesCompat.Builder setFlags(int);
    method public android.support.v4.media.AudioAttributesCompat.Builder setLegacyStreamType(int);
    method public android.support.v4.media.AudioAttributesCompat.Builder setUsage(int);
  }

  public final class MediaBrowserCompat {
    ctor public MediaBrowserCompat(android.content.Context, android.content.ComponentName, android.support.v4.media.MediaBrowserCompat.ConnectionCallback, android.os.Bundle);
    method public void connect();
    method public void disconnect();
    method public android.os.Bundle getExtras();
    method public void getItem(java.lang.String, android.support.v4.media.MediaBrowserCompat.ItemCallback);
    method public java.lang.String getRoot();
    method public android.content.ComponentName getServiceComponent();
    method public android.support.v4.media.session.MediaSessionCompat.Token getSessionToken();
    method public boolean isConnected();
    method public void search(java.lang.String, android.os.Bundle, android.support.v4.media.MediaBrowserCompat.SearchCallback);
    method public void sendCustomAction(java.lang.String, android.os.Bundle, android.support.v4.media.MediaBrowserCompat.CustomActionCallback);
    method public void subscribe(java.lang.String, android.support.v4.media.MediaBrowserCompat.SubscriptionCallback);
    method public void subscribe(java.lang.String, android.os.Bundle, android.support.v4.media.MediaBrowserCompat.SubscriptionCallback);
    method public void unsubscribe(java.lang.String);
    method public void unsubscribe(java.lang.String, android.support.v4.media.MediaBrowserCompat.SubscriptionCallback);
    field public static final java.lang.String CUSTOM_ACTION_DOWNLOAD = "android.support.v4.media.action.DOWNLOAD";
    field public static final java.lang.String CUSTOM_ACTION_REMOVE_DOWNLOADED_FILE = "android.support.v4.media.action.REMOVE_DOWNLOADED_FILE";
    field public static final java.lang.String EXTRA_DOWNLOAD_PROGRESS = "android.media.browse.extra.DOWNLOAD_PROGRESS";
    field public static final java.lang.String EXTRA_MEDIA_ID = "android.media.browse.extra.MEDIA_ID";
    field public static final java.lang.String EXTRA_PAGE = "android.media.browse.extra.PAGE";
    field public static final java.lang.String EXTRA_PAGE_SIZE = "android.media.browse.extra.PAGE_SIZE";
  }

  public static class MediaBrowserCompat.ConnectionCallback {
    ctor public MediaBrowserCompat.ConnectionCallback();
    method public void onConnected();
    method public void onConnectionFailed();
    method public void onConnectionSuspended();
  }

  public static abstract class MediaBrowserCompat.CustomActionCallback {
    ctor public MediaBrowserCompat.CustomActionCallback();
    method public void onError(java.lang.String, android.os.Bundle, android.os.Bundle);
    method public void onProgressUpdate(java.lang.String, android.os.Bundle, android.os.Bundle);
    method public void onResult(java.lang.String, android.os.Bundle, android.os.Bundle);
  }

  public static abstract class MediaBrowserCompat.ItemCallback {
    ctor public MediaBrowserCompat.ItemCallback();
    method public void onError(java.lang.String);
    method public void onItemLoaded(android.support.v4.media.MediaBrowserCompat.MediaItem);
  }

  public static class MediaBrowserCompat.MediaItem implements android.os.Parcelable {
    ctor public MediaBrowserCompat.MediaItem(android.support.v4.media.MediaDescriptionCompat, int);
    method public int describeContents();
    method public static android.support.v4.media.MediaBrowserCompat.MediaItem fromMediaItem(java.lang.Object);
    method public static java.util.List<android.support.v4.media.MediaBrowserCompat.MediaItem> fromMediaItemList(java.util.List<?>);
    method public android.support.v4.media.MediaDescriptionCompat getDescription();
    method public int getFlags();
    method public java.lang.String getMediaId();
    method public boolean isBrowsable();
    method public boolean isPlayable();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.support.v4.media.MediaBrowserCompat.MediaItem> CREATOR;
    field public static final int FLAG_BROWSABLE = 1; // 0x1
    field public static final int FLAG_PLAYABLE = 2; // 0x2
  }

  public static abstract class MediaBrowserCompat.SearchCallback {
    ctor public MediaBrowserCompat.SearchCallback();
    method public void onError(java.lang.String, android.os.Bundle);
    method public void onSearchResult(java.lang.String, android.os.Bundle, java.util.List<android.support.v4.media.MediaBrowserCompat.MediaItem>);
  }

  public static abstract class MediaBrowserCompat.SubscriptionCallback {
    ctor public MediaBrowserCompat.SubscriptionCallback();
    method public void onChildrenLoaded(java.lang.String, java.util.List<android.support.v4.media.MediaBrowserCompat.MediaItem>);
    method public void onChildrenLoaded(java.lang.String, java.util.List<android.support.v4.media.MediaBrowserCompat.MediaItem>, android.os.Bundle);
    method public void onError(java.lang.String);
    method public void onError(java.lang.String, android.os.Bundle);
  }

  public abstract class MediaBrowserServiceCompat extends android.app.Service {
    ctor public MediaBrowserServiceCompat();
    method public void dump(java.io.FileDescriptor, java.io.PrintWriter, java.lang.String[]);
    method public final android.os.Bundle getBrowserRootHints();
    method public android.support.v4.media.session.MediaSessionCompat.Token getSessionToken();
    method public void notifyChildrenChanged(java.lang.String);
    method public void notifyChildrenChanged(java.lang.String, android.os.Bundle);
    method public android.os.IBinder onBind(android.content.Intent);
    method public void onCustomAction(java.lang.String, android.os.Bundle, android.support.v4.media.MediaBrowserServiceCompat.Result<android.os.Bundle>);
    method public abstract android.support.v4.media.MediaBrowserServiceCompat.BrowserRoot onGetRoot(java.lang.String, int, android.os.Bundle);
    method public abstract void onLoadChildren(java.lang.String, android.support.v4.media.MediaBrowserServiceCompat.Result<java.util.List<android.support.v4.media.MediaBrowserCompat.MediaItem>>);
    method public void onLoadChildren(java.lang.String, android.support.v4.media.MediaBrowserServiceCompat.Result<java.util.List<android.support.v4.media.MediaBrowserCompat.MediaItem>>, android.os.Bundle);
    method public void onLoadItem(java.lang.String, android.support.v4.media.MediaBrowserServiceCompat.Result<android.support.v4.media.MediaBrowserCompat.MediaItem>);
    method public void onSearch(java.lang.String, android.os.Bundle, android.support.v4.media.MediaBrowserServiceCompat.Result<java.util.List<android.support.v4.media.MediaBrowserCompat.MediaItem>>);
    method public void setSessionToken(android.support.v4.media.session.MediaSessionCompat.Token);
    field public static final java.lang.String SERVICE_INTERFACE = "android.media.browse.MediaBrowserService";
  }

  public static final class MediaBrowserServiceCompat.BrowserRoot {
    ctor public MediaBrowserServiceCompat.BrowserRoot(java.lang.String, android.os.Bundle);
    method public android.os.Bundle getExtras();
    method public java.lang.String getRootId();
    field public static final java.lang.String EXTRA_OFFLINE = "android.service.media.extra.OFFLINE";
    field public static final java.lang.String EXTRA_RECENT = "android.service.media.extra.RECENT";
    field public static final java.lang.String EXTRA_SUGGESTED = "android.service.media.extra.SUGGESTED";
    field public static final deprecated java.lang.String EXTRA_SUGGESTION_KEYWORDS = "android.service.media.extra.SUGGESTION_KEYWORDS";
  }

  public static class MediaBrowserServiceCompat.Result<T> {
    method public void detach();
    method public void sendError(android.os.Bundle);
    method public void sendProgressUpdate(android.os.Bundle);
    method public void sendResult(T);
  }

  public final class MediaDescriptionCompat implements android.os.Parcelable {
    method public int describeContents();
    method public static android.support.v4.media.MediaDescriptionCompat fromMediaDescription(java.lang.Object);
    method public java.lang.CharSequence getDescription();
    method public android.os.Bundle getExtras();
    method public android.graphics.Bitmap getIconBitmap();
    method public android.net.Uri getIconUri();
    method public java.lang.Object getMediaDescription();
    method public java.lang.String getMediaId();
    method public android.net.Uri getMediaUri();
    method public java.lang.CharSequence getSubtitle();
    method public java.lang.CharSequence getTitle();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final long BT_FOLDER_TYPE_ALBUMS = 2L; // 0x2L
    field public static final long BT_FOLDER_TYPE_ARTISTS = 3L; // 0x3L
    field public static final long BT_FOLDER_TYPE_GENRES = 4L; // 0x4L
    field public static final long BT_FOLDER_TYPE_MIXED = 0L; // 0x0L
    field public static final long BT_FOLDER_TYPE_PLAYLISTS = 5L; // 0x5L
    field public static final long BT_FOLDER_TYPE_TITLES = 1L; // 0x1L
    field public static final long BT_FOLDER_TYPE_YEARS = 6L; // 0x6L
    field public static final android.os.Parcelable.Creator<android.support.v4.media.MediaDescriptionCompat> CREATOR;
    field public static final java.lang.String EXTRA_BT_FOLDER_TYPE = "android.media.extra.BT_FOLDER_TYPE";
    field public static final java.lang.String EXTRA_DOWNLOAD_STATUS = "android.media.extra.DOWNLOAD_STATUS";
    field public static final long STATUS_DOWNLOADED = 2L; // 0x2L
    field public static final long STATUS_DOWNLOADING = 1L; // 0x1L
    field public static final long STATUS_NOT_DOWNLOADED = 0L; // 0x0L
  }

  public static final class MediaDescriptionCompat.Builder {
    ctor public MediaDescriptionCompat.Builder();
    method public android.support.v4.media.MediaDescriptionCompat build();
    method public android.support.v4.media.MediaDescriptionCompat.Builder setDescription(java.lang.CharSequence);
    method public android.support.v4.media.MediaDescriptionCompat.Builder setExtras(android.os.Bundle);
    method public android.support.v4.media.MediaDescriptionCompat.Builder setIconBitmap(android.graphics.Bitmap);
    method public android.support.v4.media.MediaDescriptionCompat.Builder setIconUri(android.net.Uri);
    method public android.support.v4.media.MediaDescriptionCompat.Builder setMediaId(java.lang.String);
    method public android.support.v4.media.MediaDescriptionCompat.Builder setMediaUri(android.net.Uri);
    method public android.support.v4.media.MediaDescriptionCompat.Builder setSubtitle(java.lang.CharSequence);
    method public android.support.v4.media.MediaDescriptionCompat.Builder setTitle(java.lang.CharSequence);
  }

  public final class MediaMetadataCompat implements android.os.Parcelable {
    method public boolean containsKey(java.lang.String);
    method public int describeContents();
    method public static android.support.v4.media.MediaMetadataCompat fromMediaMetadata(java.lang.Object);
    method public android.graphics.Bitmap getBitmap(java.lang.String);
    method public android.os.Bundle getBundle();
    method public android.support.v4.media.MediaDescriptionCompat getDescription();
    method public long getLong(java.lang.String);
    method public java.lang.Object getMediaMetadata();
    method public android.support.v4.media.RatingCompat getRating(java.lang.String);
    method public java.lang.String getString(java.lang.String);
    method public java.lang.CharSequence getText(java.lang.String);
    method public java.util.Set<java.lang.String> keySet();
    method public int size();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.support.v4.media.MediaMetadataCompat> CREATOR;
    field public static final java.lang.String METADATA_KEY_ADVERTISEMENT = "android.media.metadata.ADVERTISEMENT";
    field public static final java.lang.String METADATA_KEY_ALBUM = "android.media.metadata.ALBUM";
    field public static final java.lang.String METADATA_KEY_ALBUM_ART = "android.media.metadata.ALBUM_ART";
    field public static final java.lang.String METADATA_KEY_ALBUM_ARTIST = "android.media.metadata.ALBUM_ARTIST";
    field public static final java.lang.String METADATA_KEY_ALBUM_ART_URI = "android.media.metadata.ALBUM_ART_URI";
    field public static final java.lang.String METADATA_KEY_ART = "android.media.metadata.ART";
    field public static final java.lang.String METADATA_KEY_ARTIST = "android.media.metadata.ARTIST";
    field public static final java.lang.String METADATA_KEY_ART_URI = "android.media.metadata.ART_URI";
    field public static final java.lang.String METADATA_KEY_AUTHOR = "android.media.metadata.AUTHOR";
    field public static final java.lang.String METADATA_KEY_BT_FOLDER_TYPE = "android.media.metadata.BT_FOLDER_TYPE";
    field public static final java.lang.String METADATA_KEY_COMPILATION = "android.media.metadata.COMPILATION";
    field public static final java.lang.String METADATA_KEY_COMPOSER = "android.media.metadata.COMPOSER";
    field public static final java.lang.String METADATA_KEY_DATE = "android.media.metadata.DATE";
    field public static final java.lang.String METADATA_KEY_DISC_NUMBER = "android.media.metadata.DISC_NUMBER";
    field public static final java.lang.String METADATA_KEY_DISPLAY_DESCRIPTION = "android.media.metadata.DISPLAY_DESCRIPTION";
    field public static final java.lang.String METADATA_KEY_DISPLAY_ICON = "android.media.metadata.DISPLAY_ICON";
    field public static final java.lang.String METADATA_KEY_DISPLAY_ICON_URI = "android.media.metadata.DISPLAY_ICON_URI";
    field public static final java.lang.String METADATA_KEY_DISPLAY_SUBTITLE = "android.media.metadata.DISPLAY_SUBTITLE";
    field public static final java.lang.String METADATA_KEY_DISPLAY_TITLE = "android.media.metadata.DISPLAY_TITLE";
    field public static final java.lang.String METADATA_KEY_DOWNLOAD_STATUS = "android.media.metadata.DOWNLOAD_STATUS";
    field public static final java.lang.String METADATA_KEY_DURATION = "android.media.metadata.DURATION";
    field public static final java.lang.String METADATA_KEY_GENRE = "android.media.metadata.GENRE";
    field public static final java.lang.String METADATA_KEY_MEDIA_ID = "android.media.metadata.MEDIA_ID";
    field public static final java.lang.String METADATA_KEY_MEDIA_URI = "android.media.metadata.MEDIA_URI";
    field public static final java.lang.String METADATA_KEY_NUM_TRACKS = "android.media.metadata.NUM_TRACKS";
    field public static final java.lang.String METADATA_KEY_RATING = "android.media.metadata.RATING";
    field public static final java.lang.String METADATA_KEY_TITLE = "android.media.metadata.TITLE";
    field public static final java.lang.String METADATA_KEY_TRACK_NUMBER = "android.media.metadata.TRACK_NUMBER";
    field public static final java.lang.String METADATA_KEY_USER_RATING = "android.media.metadata.USER_RATING";
    field public static final java.lang.String METADATA_KEY_WRITER = "android.media.metadata.WRITER";
    field public static final java.lang.String METADATA_KEY_YEAR = "android.media.metadata.YEAR";
  }

  public static final class MediaMetadataCompat.Builder {
    ctor public MediaMetadataCompat.Builder();
    ctor public MediaMetadataCompat.Builder(android.support.v4.media.MediaMetadataCompat);
    method public android.support.v4.media.MediaMetadataCompat build();
    method public android.support.v4.media.MediaMetadataCompat.Builder putBitmap(java.lang.String, android.graphics.Bitmap);
    method public android.support.v4.media.MediaMetadataCompat.Builder putLong(java.lang.String, long);
    method public android.support.v4.media.MediaMetadataCompat.Builder putRating(java.lang.String, android.support.v4.media.RatingCompat);
    method public android.support.v4.media.MediaMetadataCompat.Builder putString(java.lang.String, java.lang.String);
    method public android.support.v4.media.MediaMetadataCompat.Builder putText(java.lang.String, java.lang.CharSequence);
  }

  public final class RatingCompat implements android.os.Parcelable {
    method public int describeContents();
    method public static android.support.v4.media.RatingCompat fromRating(java.lang.Object);
    method public float getPercentRating();
    method public java.lang.Object getRating();
    method public int getRatingStyle();
    method public float getStarRating();
    method public boolean hasHeart();
    method public boolean isRated();
    method public boolean isThumbUp();
    method public static android.support.v4.media.RatingCompat newHeartRating(boolean);
    method public static android.support.v4.media.RatingCompat newPercentageRating(float);
    method public static android.support.v4.media.RatingCompat newStarRating(int, float);
    method public static android.support.v4.media.RatingCompat newThumbRating(boolean);
    method public static android.support.v4.media.RatingCompat newUnratedRating(int);
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.support.v4.media.RatingCompat> CREATOR;
    field public static final int RATING_3_STARS = 3; // 0x3
    field public static final int RATING_4_STARS = 4; // 0x4
    field public static final int RATING_5_STARS = 5; // 0x5
    field public static final int RATING_HEART = 1; // 0x1
    field public static final int RATING_NONE = 0; // 0x0
    field public static final int RATING_PERCENTAGE = 6; // 0x6
    field public static final int RATING_THUMB_UP_DOWN = 2; // 0x2
  }

  public abstract class VolumeProviderCompat {
    ctor public VolumeProviderCompat(int, int, int);
    method public final int getCurrentVolume();
    method public final int getMaxVolume();
    method public final int getVolumeControl();
    method public java.lang.Object getVolumeProvider();
    method public void onAdjustVolume(int);
    method public void onSetVolumeTo(int);
    method public void setCallback(android.support.v4.media.VolumeProviderCompat.Callback);
    method public final void setCurrentVolume(int);
    field public static final int VOLUME_CONTROL_ABSOLUTE = 2; // 0x2
    field public static final int VOLUME_CONTROL_FIXED = 0; // 0x0
    field public static final int VOLUME_CONTROL_RELATIVE = 1; // 0x1
  }

  public static abstract class VolumeProviderCompat.Callback {
    ctor public VolumeProviderCompat.Callback();
    method public abstract void onVolumeChanged(android.support.v4.media.VolumeProviderCompat);
  }

}

package android.support.v4.media.app {

  public class NotificationCompat {
  }

  public static class NotificationCompat.DecoratedMediaCustomViewStyle extends android.support.v4.media.app.NotificationCompat.MediaStyle {
    ctor public NotificationCompat.DecoratedMediaCustomViewStyle();
  }

  public static class NotificationCompat.MediaStyle extends android.support.v4.app.NotificationCompat.Style {
    ctor public NotificationCompat.MediaStyle();
    ctor public NotificationCompat.MediaStyle(android.support.v4.app.NotificationCompat.Builder);
    method public static android.support.v4.media.session.MediaSessionCompat.Token getMediaSession(android.app.Notification);
    method public android.support.v4.media.app.NotificationCompat.MediaStyle setCancelButtonIntent(android.app.PendingIntent);
    method public android.support.v4.media.app.NotificationCompat.MediaStyle setMediaSession(android.support.v4.media.session.MediaSessionCompat.Token);
    method public android.support.v4.media.app.NotificationCompat.MediaStyle setShowActionsInCompactView(int...);
    method public android.support.v4.media.app.NotificationCompat.MediaStyle setShowCancelButton(boolean);
  }

}

package android.support.v4.media.session {

  public class MediaButtonReceiver extends android.content.BroadcastReceiver {
    ctor public MediaButtonReceiver();
    method public static android.app.PendingIntent buildMediaButtonPendingIntent(android.content.Context, long);
    method public static android.app.PendingIntent buildMediaButtonPendingIntent(android.content.Context, android.content.ComponentName, long);
    method public static android.view.KeyEvent handleIntent(android.support.v4.media.session.MediaSessionCompat, android.content.Intent);
    method public void onReceive(android.content.Context, android.content.Intent);
  }

  public final class MediaControllerCompat {
    ctor public MediaControllerCompat(android.content.Context, android.support.v4.media.session.MediaSessionCompat);
    ctor public MediaControllerCompat(android.content.Context, android.support.v4.media.session.MediaSessionCompat.Token) throws android.os.RemoteException;
    method public void addQueueItem(android.support.v4.media.MediaDescriptionCompat);
    method public void addQueueItem(android.support.v4.media.MediaDescriptionCompat, int);
    method public void adjustVolume(int, int);
    method public boolean dispatchMediaButtonEvent(android.view.KeyEvent);
    method public android.os.Bundle getExtras();
    method public long getFlags();
    method public static android.support.v4.media.session.MediaControllerCompat getMediaController(android.app.Activity);
    method public java.lang.Object getMediaController();
    method public android.support.v4.media.MediaMetadataCompat getMetadata();
    method public java.lang.String getPackageName();
    method public android.support.v4.media.session.MediaControllerCompat.PlaybackInfo getPlaybackInfo();
    method public android.support.v4.media.session.PlaybackStateCompat getPlaybackState();
    method public java.util.List<android.support.v4.media.session.MediaSessionCompat.QueueItem> getQueue();
    method public java.lang.CharSequence getQueueTitle();
    method public int getRatingType();
    method public int getRepeatMode();
    method public android.app.PendingIntent getSessionActivity();
    method public android.support.v4.media.session.MediaSessionCompat.Token getSessionToken();
    method public int getShuffleMode();
    method public android.support.v4.media.session.MediaControllerCompat.TransportControls getTransportControls();
    method public boolean isCaptioningEnabled();
    method public deprecated boolean isShuffleModeEnabled();
    method public void registerCallback(android.support.v4.media.session.MediaControllerCompat.Callback);
    method public void registerCallback(android.support.v4.media.session.MediaControllerCompat.Callback, android.os.Handler);
    method public void removeQueueItem(android.support.v4.media.MediaDescriptionCompat);
    method public deprecated void removeQueueItemAt(int);
    method public void sendCommand(java.lang.String, android.os.Bundle, android.os.ResultReceiver);
    method public static void setMediaController(android.app.Activity, android.support.v4.media.session.MediaControllerCompat);
    method public void setVolumeTo(int, int);
    method public void unregisterCallback(android.support.v4.media.session.MediaControllerCompat.Callback);
  }

  public static abstract class MediaControllerCompat.Callback implements android.os.IBinder.DeathRecipient {
    ctor public MediaControllerCompat.Callback();
    method public void binderDied();
    method public void onAudioInfoChanged(android.support.v4.media.session.MediaControllerCompat.PlaybackInfo);
    method public void onCaptioningEnabledChanged(boolean);
    method public void onExtrasChanged(android.os.Bundle);
    method public void onMetadataChanged(android.support.v4.media.MediaMetadataCompat);
    method public void onPlaybackStateChanged(android.support.v4.media.session.PlaybackStateCompat);
    method public void onQueueChanged(java.util.List<android.support.v4.media.session.MediaSessionCompat.QueueItem>);
    method public void onQueueTitleChanged(java.lang.CharSequence);
    method public void onRepeatModeChanged(int);
    method public void onSessionDestroyed();
    method public void onSessionEvent(java.lang.String, android.os.Bundle);
    method public deprecated void onShuffleModeChanged(boolean);
    method public void onShuffleModeChanged(int);
  }

  public static final class MediaControllerCompat.PlaybackInfo {
    method public int getAudioStream();
    method public int getCurrentVolume();
    method public int getMaxVolume();
    method public int getPlaybackType();
    method public int getVolumeControl();
    field public static final int PLAYBACK_TYPE_LOCAL = 1; // 0x1
    field public static final int PLAYBACK_TYPE_REMOTE = 2; // 0x2
  }

  public static abstract class MediaControllerCompat.TransportControls {
    method public abstract void fastForward();
    method public abstract void pause();
    method public abstract void play();
    method public abstract void playFromMediaId(java.lang.String, android.os.Bundle);
    method public abstract void playFromSearch(java.lang.String, android.os.Bundle);
    method public abstract void playFromUri(android.net.Uri, android.os.Bundle);
    method public abstract void prepare();
    method public abstract void prepareFromMediaId(java.lang.String, android.os.Bundle);
    method public abstract void prepareFromSearch(java.lang.String, android.os.Bundle);
    method public abstract void prepareFromUri(android.net.Uri, android.os.Bundle);
    method public abstract void rewind();
    method public abstract void seekTo(long);
    method public abstract void sendCustomAction(android.support.v4.media.session.PlaybackStateCompat.CustomAction, android.os.Bundle);
    method public abstract void sendCustomAction(java.lang.String, android.os.Bundle);
    method public abstract void setCaptioningEnabled(boolean);
    method public abstract void setRating(android.support.v4.media.RatingCompat);
    method public abstract void setRating(android.support.v4.media.RatingCompat, android.os.Bundle);
    method public abstract void setRepeatMode(int);
    method public abstract void setShuffleMode(int);
    method public abstract deprecated void setShuffleModeEnabled(boolean);
    method public abstract void skipToNext();
    method public abstract void skipToPrevious();
    method public abstract void skipToQueueItem(long);
    method public abstract void stop();
    field public static final java.lang.String EXTRA_LEGACY_STREAM_TYPE = "android.media.session.extra.LEGACY_STREAM_TYPE";
  }

  public class MediaSessionCompat {
    ctor public MediaSessionCompat(android.content.Context, java.lang.String);
    ctor public MediaSessionCompat(android.content.Context, java.lang.String, android.content.ComponentName, android.app.PendingIntent);
    method public void addOnActiveChangeListener(android.support.v4.media.session.MediaSessionCompat.OnActiveChangeListener);
    method public static android.support.v4.media.session.MediaSessionCompat fromMediaSession(android.content.Context, java.lang.Object);
    method public android.support.v4.media.session.MediaControllerCompat getController();
    method public java.lang.Object getMediaSession();
    method public java.lang.Object getRemoteControlClient();
    method public android.support.v4.media.session.MediaSessionCompat.Token getSessionToken();
    method public boolean isActive();
    method public void release();
    method public void removeOnActiveChangeListener(android.support.v4.media.session.MediaSessionCompat.OnActiveChangeListener);
    method public void sendSessionEvent(java.lang.String, android.os.Bundle);
    method public void setActive(boolean);
    method public void setCallback(android.support.v4.media.session.MediaSessionCompat.Callback);
    method public void setCallback(android.support.v4.media.session.MediaSessionCompat.Callback, android.os.Handler);
    method public void setCaptioningEnabled(boolean);
    method public void setExtras(android.os.Bundle);
    method public void setFlags(int);
    method public void setMediaButtonReceiver(android.app.PendingIntent);
    method public void setMetadata(android.support.v4.media.MediaMetadataCompat);
    method public void setPlaybackState(android.support.v4.media.session.PlaybackStateCompat);
    method public void setPlaybackToLocal(int);
    method public void setPlaybackToRemote(android.support.v4.media.VolumeProviderCompat);
    method public void setQueue(java.util.List<android.support.v4.media.session.MediaSessionCompat.QueueItem>);
    method public void setQueueTitle(java.lang.CharSequence);
    method public void setRatingType(int);
    method public void setRepeatMode(int);
    method public void setSessionActivity(android.app.PendingIntent);
    method public void setShuffleMode(int);
    method public deprecated void setShuffleModeEnabled(boolean);
    field public static final java.lang.String ACTION_FLAG_AS_INAPPROPRIATE = "android.support.v4.media.session.action.FLAG_AS_INAPPROPRIATE";
    field public static final java.lang.String ACTION_FOLLOW = "android.support.v4.media.session.action.FOLLOW";
    field public static final java.lang.String ACTION_SKIP_AD = "android.support.v4.media.session.action.SKIP_AD";
    field public static final java.lang.String ACTION_UNFOLLOW = "android.support.v4.media.session.action.UNFOLLOW";
    field public static final java.lang.String ARGUMENT_MEDIA_ATTRIBUTE = "android.support.v4.media.session.ARGUMENT_MEDIA_ATTRIBUTE";
    field public static final java.lang.String ARGUMENT_MEDIA_ATTRIBUTE_VALUE = "android.support.v4.media.session.ARGUMENT_MEDIA_ATTRIBUTE_VALUE";
    field public static final int FLAG_HANDLES_MEDIA_BUTTONS = 1; // 0x1
    field public static final int FLAG_HANDLES_QUEUE_COMMANDS = 4; // 0x4
    field public static final int FLAG_HANDLES_TRANSPORT_CONTROLS = 2; // 0x2
    field public static final int MEDIA_ATTRIBUTE_ALBUM = 1; // 0x1
    field public static final int MEDIA_ATTRIBUTE_ARTIST = 0; // 0x0
    field public static final int MEDIA_ATTRIBUTE_PLAYLIST = 2; // 0x2
  }

  public static abstract class MediaSessionCompat.Callback {
    ctor public MediaSessionCompat.Callback();
    method public void onAddQueueItem(android.support.v4.media.MediaDescriptionCompat);
    method public void onAddQueueItem(android.support.v4.media.MediaDescriptionCompat, int);
    method public void onCommand(java.lang.String, android.os.Bundle, android.os.ResultReceiver);
    method public void onCustomAction(java.lang.String, android.os.Bundle);
    method public void onFastForward();
    method public boolean onMediaButtonEvent(android.content.Intent);
    method public void onPause();
    method public void onPlay();
    method public void onPlayFromMediaId(java.lang.String, android.os.Bundle);
    method public void onPlayFromSearch(java.lang.String, android.os.Bundle);
    method public void onPlayFromUri(android.net.Uri, android.os.Bundle);
    method public void onPrepare();
    method public void onPrepareFromMediaId(java.lang.String, android.os.Bundle);
    method public void onPrepareFromSearch(java.lang.String, android.os.Bundle);
    method public void onPrepareFromUri(android.net.Uri, android.os.Bundle);
    method public void onRemoveQueueItem(android.support.v4.media.MediaDescriptionCompat);
    method public deprecated void onRemoveQueueItemAt(int);
    method public void onRewind();
    method public void onSeekTo(long);
    method public void onSetCaptioningEnabled(boolean);
    method public void onSetRating(android.support.v4.media.RatingCompat);
    method public void onSetRating(android.support.v4.media.RatingCompat, android.os.Bundle);
    method public void onSetRepeatMode(int);
    method public void onSetShuffleMode(int);
    method public deprecated void onSetShuffleModeEnabled(boolean);
    method public void onSkipToNext();
    method public void onSkipToPrevious();
    method public void onSkipToQueueItem(long);
    method public void onStop();
  }

  public static abstract interface MediaSessionCompat.OnActiveChangeListener {
    method public abstract void onActiveChanged();
  }

  public static final class MediaSessionCompat.QueueItem implements android.os.Parcelable {
    ctor public MediaSessionCompat.QueueItem(android.support.v4.media.MediaDescriptionCompat, long);
    method public int describeContents();
    method public static android.support.v4.media.session.MediaSessionCompat.QueueItem fromQueueItem(java.lang.Object);
    method public static java.util.List<android.support.v4.media.session.MediaSessionCompat.QueueItem> fromQueueItemList(java.util.List<?>);
    method public android.support.v4.media.MediaDescriptionCompat getDescription();
    method public long getQueueId();
    method public java.lang.Object getQueueItem();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.support.v4.media.session.MediaSessionCompat.QueueItem> CREATOR;
    field public static final int UNKNOWN_ID = -1; // 0xffffffff
  }

  public static final class MediaSessionCompat.Token implements android.os.Parcelable {
    method public int describeContents();
    method public static android.support.v4.media.session.MediaSessionCompat.Token fromToken(java.lang.Object);
    method public java.lang.Object getToken();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.support.v4.media.session.MediaSessionCompat.Token> CREATOR;
  }

  public class ParcelableVolumeInfo implements android.os.Parcelable {
    ctor public ParcelableVolumeInfo(int, int, int, int, int);
    ctor public ParcelableVolumeInfo(android.os.Parcel);
    method public int describeContents();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.support.v4.media.session.ParcelableVolumeInfo> CREATOR;
    field public int audioStream;
    field public int controlType;
    field public int currentVolume;
    field public int maxVolume;
    field public int volumeType;
  }

  public final class PlaybackStateCompat implements android.os.Parcelable {
    method public int describeContents();
    method public static android.support.v4.media.session.PlaybackStateCompat fromPlaybackState(java.lang.Object);
    method public long getActions();
    method public long getActiveQueueItemId();
    method public long getBufferedPosition();
    method public java.util.List<android.support.v4.media.session.PlaybackStateCompat.CustomAction> getCustomActions();
    method public int getErrorCode();
    method public java.lang.CharSequence getErrorMessage();
    method public android.os.Bundle getExtras();
    method public long getLastPositionUpdateTime();
    method public float getPlaybackSpeed();
    method public java.lang.Object getPlaybackState();
    method public long getPosition();
    method public int getState();
    method public static int toKeyCode(long);
    method public void writeToParcel(android.os.Parcel, int);
    field public static final long ACTION_FAST_FORWARD = 64L; // 0x40L
    field public static final long ACTION_PAUSE = 2L; // 0x2L
    field public static final long ACTION_PLAY = 4L; // 0x4L
    field public static final long ACTION_PLAY_FROM_MEDIA_ID = 1024L; // 0x400L
    field public static final long ACTION_PLAY_FROM_SEARCH = 2048L; // 0x800L
    field public static final long ACTION_PLAY_FROM_URI = 8192L; // 0x2000L
    field public static final long ACTION_PLAY_PAUSE = 512L; // 0x200L
    field public static final long ACTION_PREPARE = 16384L; // 0x4000L
    field public static final long ACTION_PREPARE_FROM_MEDIA_ID = 32768L; // 0x8000L
    field public static final long ACTION_PREPARE_FROM_SEARCH = 65536L; // 0x10000L
    field public static final long ACTION_PREPARE_FROM_URI = 131072L; // 0x20000L
    field public static final long ACTION_REWIND = 8L; // 0x8L
    field public static final long ACTION_SEEK_TO = 256L; // 0x100L
    field public static final long ACTION_SET_CAPTIONING_ENABLED = 1048576L; // 0x100000L
    field public static final long ACTION_SET_RATING = 128L; // 0x80L
    field public static final long ACTION_SET_REPEAT_MODE = 262144L; // 0x40000L
    field public static final long ACTION_SET_SHUFFLE_MODE_ENABLED = 524288L; // 0x80000L
    field public static final long ACTION_SKIP_TO_NEXT = 32L; // 0x20L
    field public static final long ACTION_SKIP_TO_PREVIOUS = 16L; // 0x10L
    field public static final long ACTION_SKIP_TO_QUEUE_ITEM = 4096L; // 0x1000L
    field public static final long ACTION_STOP = 1L; // 0x1L
    field public static final android.os.Parcelable.Creator<android.support.v4.media.session.PlaybackStateCompat> CREATOR;
    field public static final int ERROR_CODE_ACTION_ABORTED = 10; // 0xa
    field public static final int ERROR_CODE_APP_ERROR = 1; // 0x1
    field public static final int ERROR_CODE_AUTHENTICATION_EXPIRED = 3; // 0x3
    field public static final int ERROR_CODE_CONCURRENT_STREAM_LIMIT = 5; // 0x5
    field public static final int ERROR_CODE_CONTENT_ALREADY_PLAYING = 8; // 0x8
    field public static final int ERROR_CODE_END_OF_QUEUE = 11; // 0xb
    field public static final int ERROR_CODE_NOT_AVAILABLE_IN_REGION = 7; // 0x7
    field public static final int ERROR_CODE_NOT_SUPPORTED = 2; // 0x2
    field public static final int ERROR_CODE_PARENTAL_CONTROL_RESTRICTED = 6; // 0x6
    field public static final int ERROR_CODE_PREMIUM_ACCOUNT_REQUIRED = 4; // 0x4
    field public static final int ERROR_CODE_SKIP_LIMIT_REACHED = 9; // 0x9
    field public static final int ERROR_CODE_UNKNOWN_ERROR = 0; // 0x0
    field public static final long PLAYBACK_POSITION_UNKNOWN = -1L; // 0xffffffffffffffffL
    field public static final int REPEAT_MODE_ALL = 2; // 0x2
    field public static final int REPEAT_MODE_GROUP = 3; // 0x3
    field public static final int REPEAT_MODE_NONE = 0; // 0x0
    field public static final int REPEAT_MODE_ONE = 1; // 0x1
    field public static final int SHUFFLE_MODE_ALL = 1; // 0x1
    field public static final int SHUFFLE_MODE_GROUP = 2; // 0x2
    field public static final int SHUFFLE_MODE_NONE = 0; // 0x0
    field public static final int STATE_BUFFERING = 6; // 0x6
    field public static final int STATE_CONNECTING = 8; // 0x8
    field public static final int STATE_ERROR = 7; // 0x7
    field public static final int STATE_FAST_FORWARDING = 4; // 0x4
    field public static final int STATE_NONE = 0; // 0x0
    field public static final int STATE_PAUSED = 2; // 0x2
    field public static final int STATE_PLAYING = 3; // 0x3
    field public static final int STATE_REWINDING = 5; // 0x5
    field public static final int STATE_SKIPPING_TO_NEXT = 10; // 0xa
    field public static final int STATE_SKIPPING_TO_PREVIOUS = 9; // 0x9
    field public static final int STATE_SKIPPING_TO_QUEUE_ITEM = 11; // 0xb
    field public static final int STATE_STOPPED = 1; // 0x1
  }

  public static final class PlaybackStateCompat.Builder {
    ctor public PlaybackStateCompat.Builder();
    ctor public PlaybackStateCompat.Builder(android.support.v4.media.session.PlaybackStateCompat);
    method public android.support.v4.media.session.PlaybackStateCompat.Builder addCustomAction(java.lang.String, java.lang.String, int);
    method public android.support.v4.media.session.PlaybackStateCompat.Builder addCustomAction(android.support.v4.media.session.PlaybackStateCompat.CustomAction);
    method public android.support.v4.media.session.PlaybackStateCompat build();
    method public android.support.v4.media.session.PlaybackStateCompat.Builder setActions(long);
    method public android.support.v4.media.session.PlaybackStateCompat.Builder setActiveQueueItemId(long);
    method public android.support.v4.media.session.PlaybackStateCompat.Builder setBufferedPosition(long);
    method public deprecated android.support.v4.media.session.PlaybackStateCompat.Builder setErrorMessage(java.lang.CharSequence);
    method public android.support.v4.media.session.PlaybackStateCompat.Builder setErrorMessage(int, java.lang.CharSequence);
    method public android.support.v4.media.session.PlaybackStateCompat.Builder setExtras(android.os.Bundle);
    method public android.support.v4.media.session.PlaybackStateCompat.Builder setState(int, long, float);
    method public android.support.v4.media.session.PlaybackStateCompat.Builder setState(int, long, float, long);
  }

  public static final class PlaybackStateCompat.CustomAction implements android.os.Parcelable {
    method public int describeContents();
    method public static android.support.v4.media.session.PlaybackStateCompat.CustomAction fromCustomAction(java.lang.Object);
    method public java.lang.String getAction();
    method public java.lang.Object getCustomAction();
    method public android.os.Bundle getExtras();
    method public int getIcon();
    method public java.lang.CharSequence getName();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.support.v4.media.session.PlaybackStateCompat.CustomAction> CREATOR;
  }

  public static final class PlaybackStateCompat.CustomAction.Builder {
    ctor public PlaybackStateCompat.CustomAction.Builder(java.lang.String, java.lang.CharSequence, int);
    method public android.support.v4.media.session.PlaybackStateCompat.CustomAction build();
    method public android.support.v4.media.session.PlaybackStateCompat.CustomAction.Builder setExtras(android.os.Bundle);
  }

}

package android.support.v4.net {

  public final class ConnectivityManagerCompat {
    method public static android.net.NetworkInfo getNetworkInfoFromBroadcast(android.net.ConnectivityManager, android.content.Intent);
    method public static int getRestrictBackgroundStatus(android.net.ConnectivityManager);
    method public static boolean isActiveNetworkMetered(android.net.ConnectivityManager);
    field public static final int RESTRICT_BACKGROUND_STATUS_DISABLED = 1; // 0x1
    field public static final int RESTRICT_BACKGROUND_STATUS_ENABLED = 3; // 0x3
    field public static final int RESTRICT_BACKGROUND_STATUS_WHITELISTED = 2; // 0x2
  }

  public final class TrafficStatsCompat {
    method public static deprecated void clearThreadStatsTag();
    method public static deprecated int getThreadStatsTag();
    method public static deprecated void incrementOperationCount(int);
    method public static deprecated void incrementOperationCount(int, int);
    method public static deprecated void setThreadStatsTag(int);
    method public static void tagDatagramSocket(java.net.DatagramSocket) throws java.net.SocketException;
    method public static deprecated void tagSocket(java.net.Socket) throws java.net.SocketException;
    method public static void untagDatagramSocket(java.net.DatagramSocket) throws java.net.SocketException;
    method public static deprecated void untagSocket(java.net.Socket) throws java.net.SocketException;
  }

}

package android.support.v4.os {

  public final deprecated class AsyncTaskCompat {
    method public static deprecated <Params, Progress, Result> android.os.AsyncTask<Params, Progress, Result> executeParallel(android.os.AsyncTask<Params, Progress, Result>, Params...);
  }

  public class BuildCompat {
    method public static deprecated boolean isAtLeastN();
    method public static deprecated boolean isAtLeastNMR1();
    method public static deprecated boolean isAtLeastO();
    method public static boolean isAtLeastOMR1();
    method public static boolean isAtLeastP();
  }

  public final class CancellationSignal {
    ctor public CancellationSignal();
    method public void cancel();
    method public java.lang.Object getCancellationSignalObject();
    method public boolean isCanceled();
    method public void setOnCancelListener(android.support.v4.os.CancellationSignal.OnCancelListener);
    method public void throwIfCanceled();
  }

  public static abstract interface CancellationSignal.OnCancelListener {
    method public abstract void onCancel();
  }

  public final class ConfigurationCompat {
    method public static android.support.v4.os.LocaleListCompat getLocales(android.content.res.Configuration);
  }

  public final class EnvironmentCompat {
    method public static java.lang.String getStorageState(java.io.File);
    field public static final java.lang.String MEDIA_UNKNOWN = "unknown";
  }

  public final class LocaleListCompat {
    method public static android.support.v4.os.LocaleListCompat create(java.util.Locale...);
    method public static android.support.v4.os.LocaleListCompat forLanguageTags(java.lang.String);
    method public java.util.Locale get(int);
    method public static android.support.v4.os.LocaleListCompat getAdjustedDefault();
    method public static android.support.v4.os.LocaleListCompat getDefault();
    method public static android.support.v4.os.LocaleListCompat getEmptyLocaleList();
    method public java.util.Locale getFirstMatch(java.lang.String[]);
    method public int indexOf(java.util.Locale);
    method public boolean isEmpty();
    method public int size();
    method public java.lang.String toLanguageTags();
    method public java.lang.Object unwrap();
    method public static android.support.v4.os.LocaleListCompat wrap(java.lang.Object);
  }

  public class OperationCanceledException extends java.lang.RuntimeException {
    ctor public OperationCanceledException();
    ctor public OperationCanceledException(java.lang.String);
  }

  public final deprecated class ParcelableCompat {
    method public static deprecated <T> android.os.Parcelable.Creator<T> newCreator(android.support.v4.os.ParcelableCompatCreatorCallbacks<T>);
  }

  public abstract deprecated interface ParcelableCompatCreatorCallbacks<T> {
    method public abstract T createFromParcel(android.os.Parcel, java.lang.ClassLoader);
    method public abstract T[] newArray(int);
  }

  public final class TraceCompat {
    method public static void beginSection(java.lang.String);
    method public static void endSection();
  }

  public class UserManagerCompat {
    method public static boolean isUserUnlocked(android.content.Context);
  }

}

package android.support.v4.print {

  public final class PrintHelper {
    ctor public PrintHelper(android.content.Context);
    method public int getColorMode();
    method public int getOrientation();
    method public int getScaleMode();
    method public void printBitmap(java.lang.String, android.graphics.Bitmap);
    method public void printBitmap(java.lang.String, android.graphics.Bitmap, android.support.v4.print.PrintHelper.OnPrintFinishCallback);
    method public void printBitmap(java.lang.String, android.net.Uri) throws java.io.FileNotFoundException;
    method public void printBitmap(java.lang.String, android.net.Uri, android.support.v4.print.PrintHelper.OnPrintFinishCallback) throws java.io.FileNotFoundException;
    method public void setColorMode(int);
    method public void setOrientation(int);
    method public void setScaleMode(int);
    method public static boolean systemSupportsPrint();
    field public static final int COLOR_MODE_COLOR = 2; // 0x2
    field public static final int COLOR_MODE_MONOCHROME = 1; // 0x1
    field public static final int ORIENTATION_LANDSCAPE = 1; // 0x1
    field public static final int ORIENTATION_PORTRAIT = 2; // 0x2
    field public static final int SCALE_MODE_FILL = 2; // 0x2
    field public static final int SCALE_MODE_FIT = 1; // 0x1
  }

  public static abstract interface PrintHelper.OnPrintFinishCallback {
    method public abstract void onFinish();
  }

}

package android.support.v4.provider {

  public abstract class DocumentFile {
    method public abstract boolean canRead();
    method public abstract boolean canWrite();
    method public abstract android.support.v4.provider.DocumentFile createDirectory(java.lang.String);
    method public abstract android.support.v4.provider.DocumentFile createFile(java.lang.String, java.lang.String);
    method public abstract boolean delete();
    method public abstract boolean exists();
    method public android.support.v4.provider.DocumentFile findFile(java.lang.String);
    method public static android.support.v4.provider.DocumentFile fromFile(java.io.File);
    method public static android.support.v4.provider.DocumentFile fromSingleUri(android.content.Context, android.net.Uri);
    method public static android.support.v4.provider.DocumentFile fromTreeUri(android.content.Context, android.net.Uri);
    method public abstract java.lang.String getName();
    method public android.support.v4.provider.DocumentFile getParentFile();
    method public abstract java.lang.String getType();
    method public abstract android.net.Uri getUri();
    method public abstract boolean isDirectory();
    method public static boolean isDocumentUri(android.content.Context, android.net.Uri);
    method public abstract boolean isFile();
    method public abstract boolean isVirtual();
    method public abstract long lastModified();
    method public abstract long length();
    method public abstract android.support.v4.provider.DocumentFile[] listFiles();
    method public abstract boolean renameTo(java.lang.String);
  }

  public final class FontRequest {
    ctor public FontRequest(java.lang.String, java.lang.String, java.lang.String, java.util.List<java.util.List<byte[]>>);
    ctor public FontRequest(java.lang.String, java.lang.String, java.lang.String, int);
    method public java.util.List<java.util.List<byte[]>> getCertificates();
    method public int getCertificatesArrayResId();
    method public java.lang.String getProviderAuthority();
    method public java.lang.String getProviderPackage();
    method public java.lang.String getQuery();
  }

  public class FontsContractCompat {
    method public static android.graphics.Typeface buildTypeface(android.content.Context, android.os.CancellationSignal, android.support.v4.provider.FontsContractCompat.FontInfo[]);
    method public static android.support.v4.provider.FontsContractCompat.FontFamilyResult fetchFonts(android.content.Context, android.os.CancellationSignal, android.support.v4.provider.FontRequest) throws android.content.pm.PackageManager.NameNotFoundException;
    method public static void requestFont(android.content.Context, android.support.v4.provider.FontRequest, android.support.v4.provider.FontsContractCompat.FontRequestCallback, android.os.Handler);
  }

  public static final class FontsContractCompat.Columns {
    ctor public FontsContractCompat.Columns();
    field public static final java.lang.String FILE_ID = "file_id";
    field public static final java.lang.String ITALIC = "font_italic";
    field public static final java.lang.String RESULT_CODE = "result_code";
    field public static final int RESULT_CODE_FONT_NOT_FOUND = 1; // 0x1
    field public static final int RESULT_CODE_FONT_UNAVAILABLE = 2; // 0x2
    field public static final int RESULT_CODE_MALFORMED_QUERY = 3; // 0x3
    field public static final int RESULT_CODE_OK = 0; // 0x0
    field public static final java.lang.String TTC_INDEX = "font_ttc_index";
    field public static final java.lang.String VARIATION_SETTINGS = "font_variation_settings";
    field public static final java.lang.String WEIGHT = "font_weight";
  }

  public static class FontsContractCompat.FontFamilyResult {
    method public android.support.v4.provider.FontsContractCompat.FontInfo[] getFonts();
    method public int getStatusCode();
    field public static final int STATUS_OK = 0; // 0x0
    field public static final int STATUS_UNEXPECTED_DATA_PROVIDED = 2; // 0x2
    field public static final int STATUS_WRONG_CERTIFICATES = 1; // 0x1
  }

  public static class FontsContractCompat.FontInfo {
    method public int getResultCode();
    method public int getTtcIndex();
    method public android.net.Uri getUri();
    method public int getWeight();
    method public boolean isItalic();
  }

  public static class FontsContractCompat.FontRequestCallback {
    ctor public FontsContractCompat.FontRequestCallback();
    method public void onTypefaceRequestFailed(int);
    method public void onTypefaceRetrieved(android.graphics.Typeface);
    field public static final int FAIL_REASON_FONT_LOAD_ERROR = -3; // 0xfffffffd
    field public static final int FAIL_REASON_FONT_NOT_FOUND = 1; // 0x1
    field public static final int FAIL_REASON_FONT_UNAVAILABLE = 2; // 0x2
    field public static final int FAIL_REASON_MALFORMED_QUERY = 3; // 0x3
    field public static final int FAIL_REASON_PROVIDER_NOT_FOUND = -1; // 0xffffffff
    field public static final int FAIL_REASON_WRONG_CERTIFICATES = -2; // 0xfffffffe
  }

}

package android.support.v4.text {

  public final class BidiFormatter {
    method public static android.support.v4.text.BidiFormatter getInstance();
    method public static android.support.v4.text.BidiFormatter getInstance(boolean);
    method public static android.support.v4.text.BidiFormatter getInstance(java.util.Locale);
    method public boolean getStereoReset();
    method public boolean isRtl(java.lang.String);
    method public boolean isRtl(java.lang.CharSequence);
    method public boolean isRtlContext();
    method public java.lang.String unicodeWrap(java.lang.String, android.support.v4.text.TextDirectionHeuristicCompat, boolean);
    method public java.lang.CharSequence unicodeWrap(java.lang.CharSequence, android.support.v4.text.TextDirectionHeuristicCompat, boolean);
    method public java.lang.String unicodeWrap(java.lang.String, android.support.v4.text.TextDirectionHeuristicCompat);
    method public java.lang.CharSequence unicodeWrap(java.lang.CharSequence, android.support.v4.text.TextDirectionHeuristicCompat);
    method public java.lang.String unicodeWrap(java.lang.String, boolean);
    method public java.lang.CharSequence unicodeWrap(java.lang.CharSequence, boolean);
    method public java.lang.String unicodeWrap(java.lang.String);
    method public java.lang.CharSequence unicodeWrap(java.lang.CharSequence);
  }

  public static final class BidiFormatter.Builder {
    ctor public BidiFormatter.Builder();
    ctor public BidiFormatter.Builder(boolean);
    ctor public BidiFormatter.Builder(java.util.Locale);
    method public android.support.v4.text.BidiFormatter build();
    method public android.support.v4.text.BidiFormatter.Builder setTextDirectionHeuristic(android.support.v4.text.TextDirectionHeuristicCompat);
    method public android.support.v4.text.BidiFormatter.Builder stereoReset(boolean);
  }

  public final class ICUCompat {
    method public static java.lang.String maximizeAndGetScript(java.util.Locale);
  }

  public abstract interface TextDirectionHeuristicCompat {
    method public abstract boolean isRtl(char[], int, int);
    method public abstract boolean isRtl(java.lang.CharSequence, int, int);
  }

  public final class TextDirectionHeuristicsCompat {
    field public static final android.support.v4.text.TextDirectionHeuristicCompat ANYRTL_LTR;
    field public static final android.support.v4.text.TextDirectionHeuristicCompat FIRSTSTRONG_LTR;
    field public static final android.support.v4.text.TextDirectionHeuristicCompat FIRSTSTRONG_RTL;
    field public static final android.support.v4.text.TextDirectionHeuristicCompat LOCALE;
    field public static final android.support.v4.text.TextDirectionHeuristicCompat LTR;
    field public static final android.support.v4.text.TextDirectionHeuristicCompat RTL;
  }

  public final class TextUtilsCompat {
    method public static int getLayoutDirectionFromLocale(java.util.Locale);
    method public static java.lang.String htmlEncode(java.lang.String);
    field public static final deprecated java.util.Locale ROOT;
  }

}

package android.support.v4.text.util {

  public final class LinkifyCompat {
    method public static final boolean addLinks(android.text.Spannable, int);
    method public static final boolean addLinks(android.widget.TextView, int);
    method public static final void addLinks(android.widget.TextView, java.util.regex.Pattern, java.lang.String);
    method public static final void addLinks(android.widget.TextView, java.util.regex.Pattern, java.lang.String, android.text.util.Linkify.MatchFilter, android.text.util.Linkify.TransformFilter);
    method public static final void addLinks(android.widget.TextView, java.util.regex.Pattern, java.lang.String, java.lang.String[], android.text.util.Linkify.MatchFilter, android.text.util.Linkify.TransformFilter);
    method public static final boolean addLinks(android.text.Spannable, java.util.regex.Pattern, java.lang.String);
    method public static final boolean addLinks(android.text.Spannable, java.util.regex.Pattern, java.lang.String, android.text.util.Linkify.MatchFilter, android.text.util.Linkify.TransformFilter);
    method public static final boolean addLinks(android.text.Spannable, java.util.regex.Pattern, java.lang.String, java.lang.String[], android.text.util.Linkify.MatchFilter, android.text.util.Linkify.TransformFilter);
  }

}

package android.support.v4.util {

  public class ArrayMap<K, V> extends android.support.v4.util.SimpleArrayMap implements java.util.Map {
    ctor public ArrayMap();
    ctor public ArrayMap(int);
    ctor public ArrayMap(android.support.v4.util.SimpleArrayMap);
    method public boolean containsAll(java.util.Collection<?>);
    method public java.util.Set<java.util.Map.Entry<K, V>> entrySet();
    method public java.util.Set<K> keySet();
    method public void putAll(java.util.Map<? extends K, ? extends V>);
    method public boolean removeAll(java.util.Collection<?>);
    method public boolean retainAll(java.util.Collection<?>);
    method public java.util.Collection<V> values();
  }

  public final class ArraySet<E> implements java.util.Collection java.util.Set {
    ctor public ArraySet();
    ctor public ArraySet(int);
    ctor public ArraySet(android.support.v4.util.ArraySet<E>);
    method public boolean add(E);
    method public void addAll(android.support.v4.util.ArraySet<? extends E>);
    method public boolean addAll(java.util.Collection<? extends E>);
    method public void clear();
    method public boolean contains(java.lang.Object);
    method public boolean containsAll(java.util.Collection<?>);
    method public void ensureCapacity(int);
    method public int indexOf(java.lang.Object);
    method public boolean isEmpty();
    method public java.util.Iterator<E> iterator();
    method public boolean remove(java.lang.Object);
    method public boolean removeAll(android.support.v4.util.ArraySet<? extends E>);
    method public boolean removeAll(java.util.Collection<?>);
    method public E removeAt(int);
    method public boolean retainAll(java.util.Collection<?>);
    method public int size();
    method public java.lang.Object[] toArray();
    method public <T> T[] toArray(T[]);
    method public E valueAt(int);
  }

  public class AtomicFile {
    ctor public AtomicFile(java.io.File);
    method public void delete();
    method public void failWrite(java.io.FileOutputStream);
    method public void finishWrite(java.io.FileOutputStream);
    method public java.io.File getBaseFile();
    method public java.io.FileInputStream openRead() throws java.io.FileNotFoundException;
    method public byte[] readFully() throws java.io.IOException;
    method public java.io.FileOutputStream startWrite() throws java.io.IOException;
  }

  public final class CircularArray<E> {
    ctor public CircularArray();
    ctor public CircularArray(int);
    method public void addFirst(E);
    method public void addLast(E);
    method public void clear();
    method public E get(int);
    method public E getFirst();
    method public E getLast();
    method public boolean isEmpty();
    method public E popFirst();
    method public E popLast();
    method public void removeFromEnd(int);
    method public void removeFromStart(int);
    method public int size();
  }

  public final class CircularIntArray {
    ctor public CircularIntArray();
    ctor public CircularIntArray(int);
    method public void addFirst(int);
    method public void addLast(int);
    method public void clear();
    method public int get(int);
    method public int getFirst();
    method public int getLast();
    method public boolean isEmpty();
    method public int popFirst();
    method public int popLast();
    method public void removeFromEnd(int);
    method public void removeFromStart(int);
    method public int size();
  }

  public class LongSparseArray<E> {
    ctor public LongSparseArray();
    ctor public LongSparseArray(int);
    method public void append(long, E);
    method public void clear();
    method public android.support.v4.util.LongSparseArray<E> clone();
    method public void delete(long);
    method public E get(long);
    method public E get(long, E);
    method public int indexOfKey(long);
    method public int indexOfValue(E);
    method public long keyAt(int);
    method public void put(long, E);
    method public void remove(long);
    method public void removeAt(int);
    method public void setValueAt(int, E);
    method public int size();
    method public E valueAt(int);
  }

  public class LruCache<K, V> {
    ctor public LruCache(int);
    method protected V create(K);
    method public final synchronized int createCount();
    method protected void entryRemoved(boolean, K, V, V);
    method public final void evictAll();
    method public final synchronized int evictionCount();
    method public final V get(K);
    method public final synchronized int hitCount();
    method public final synchronized int maxSize();
    method public final synchronized int missCount();
    method public final V put(K, V);
    method public final synchronized int putCount();
    method public final V remove(K);
    method public void resize(int);
    method public final synchronized int size();
    method protected int sizeOf(K, V);
    method public final synchronized java.util.Map<K, V> snapshot();
    method public final synchronized java.lang.String toString();
    method public void trimToSize(int);
  }

  public class ObjectsCompat {
    method public static boolean equals(java.lang.Object, java.lang.Object);
  }

  public class Pair<F, S> {
    ctor public Pair(F, S);
    method public static <A, B> android.support.v4.util.Pair<A, B> create(A, B);
    field public final F first;
    field public final S second;
  }

  public final class PatternsCompat {
    field public static final java.util.regex.Pattern DOMAIN_NAME;
    field public static final java.util.regex.Pattern EMAIL_ADDRESS;
    field public static final java.util.regex.Pattern IP_ADDRESS;
    field public static final java.util.regex.Pattern WEB_URL;
  }

  public final class Pools {
  }

  public static abstract interface Pools.Pool<T> {
    method public abstract T acquire();
    method public abstract boolean release(T);
  }

  public static class Pools.SimplePool<T> implements android.support.v4.util.Pools.Pool {
    ctor public Pools.SimplePool(int);
    method public T acquire();
    method public boolean release(T);
  }

  public static class Pools.SynchronizedPool<T> extends android.support.v4.util.Pools.SimplePool {
    ctor public Pools.SynchronizedPool(int);
  }

  public class SimpleArrayMap<K, V> {
    ctor public SimpleArrayMap();
    ctor public SimpleArrayMap(int);
    ctor public SimpleArrayMap(android.support.v4.util.SimpleArrayMap<K, V>);
    method public void clear();
    method public boolean containsKey(java.lang.Object);
    method public boolean containsValue(java.lang.Object);
    method public void ensureCapacity(int);
    method public V get(java.lang.Object);
    method public int indexOfKey(java.lang.Object);
    method public boolean isEmpty();
    method public K keyAt(int);
    method public V put(K, V);
    method public void putAll(android.support.v4.util.SimpleArrayMap<? extends K, ? extends V>);
    method public V remove(java.lang.Object);
    method public V removeAt(int);
    method public V setValueAt(int, V);
    method public int size();
    method public V valueAt(int);
  }

  public class SparseArrayCompat<E> {
    ctor public SparseArrayCompat();
    ctor public SparseArrayCompat(int);
    method public void append(int, E);
    method public void clear();
    method public android.support.v4.util.SparseArrayCompat<E> clone();
    method public void delete(int);
    method public E get(int);
    method public E get(int, E);
    method public int indexOfKey(int);
    method public int indexOfValue(E);
    method public int keyAt(int);
    method public void put(int, E);
    method public void remove(int);
    method public void removeAt(int);
    method public void removeAtRange(int, int);
    method public void setValueAt(int, E);
    method public int size();
    method public E valueAt(int);
  }

}

package android.support.v4.view {

  public abstract class AbsSavedState implements android.os.Parcelable {
    ctor protected AbsSavedState(android.os.Parcelable);
    ctor protected AbsSavedState(android.os.Parcel);
    ctor protected AbsSavedState(android.os.Parcel, java.lang.ClassLoader);
    method public int describeContents();
    method public final android.os.Parcelable getSuperState();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.support.v4.view.AbsSavedState> CREATOR;
    field public static final android.support.v4.view.AbsSavedState EMPTY_STATE;
  }

  public class AccessibilityDelegateCompat {
    ctor public AccessibilityDelegateCompat();
    method public boolean dispatchPopulateAccessibilityEvent(android.view.View, android.view.accessibility.AccessibilityEvent);
    method public android.support.v4.view.accessibility.AccessibilityNodeProviderCompat getAccessibilityNodeProvider(android.view.View);
    method public void onInitializeAccessibilityEvent(android.view.View, android.view.accessibility.AccessibilityEvent);
    method public void onInitializeAccessibilityNodeInfo(android.view.View, android.support.v4.view.accessibility.AccessibilityNodeInfoCompat);
    method public void onPopulateAccessibilityEvent(android.view.View, android.view.accessibility.AccessibilityEvent);
    method public boolean onRequestSendAccessibilityEvent(android.view.ViewGroup, android.view.View, android.view.accessibility.AccessibilityEvent);
    method public boolean performAccessibilityAction(android.view.View, int, android.os.Bundle);
    method public void sendAccessibilityEvent(android.view.View, int);
    method public void sendAccessibilityEventUnchecked(android.view.View, android.view.accessibility.AccessibilityEvent);
  }

  public abstract class ActionProvider {
    ctor public ActionProvider(android.content.Context);
    method public android.content.Context getContext();
    method public boolean hasSubMenu();
    method public boolean isVisible();
    method public abstract android.view.View onCreateActionView();
    method public android.view.View onCreateActionView(android.view.MenuItem);
    method public boolean onPerformDefaultAction();
    method public void onPrepareSubMenu(android.view.SubMenu);
    method public boolean overridesItemVisibility();
    method public void refreshVisibility();
    method public void setVisibilityListener(android.support.v4.view.ActionProvider.VisibilityListener);
  }

  public static abstract interface ActionProvider.VisibilityListener {
    method public abstract void onActionProviderVisibilityChanged(boolean);
  }

  public final class AsyncLayoutInflater {
    ctor public AsyncLayoutInflater(android.content.Context);
    method public void inflate(int, android.view.ViewGroup, android.support.v4.view.AsyncLayoutInflater.OnInflateFinishedListener);
  }

  public static abstract interface AsyncLayoutInflater.OnInflateFinishedListener {
    method public abstract void onInflateFinished(android.view.View, int, android.view.ViewGroup);
  }

  public final class GestureDetectorCompat {
    ctor public GestureDetectorCompat(android.content.Context, android.view.GestureDetector.OnGestureListener);
    ctor public GestureDetectorCompat(android.content.Context, android.view.GestureDetector.OnGestureListener, android.os.Handler);
    method public boolean isLongpressEnabled();
    method public boolean onTouchEvent(android.view.MotionEvent);
    method public void setIsLongpressEnabled(boolean);
    method public void setOnDoubleTapListener(android.view.GestureDetector.OnDoubleTapListener);
  }

  public final class GravityCompat {
    method public static void apply(int, int, int, android.graphics.Rect, android.graphics.Rect, int);
    method public static void apply(int, int, int, android.graphics.Rect, int, int, android.graphics.Rect, int);
    method public static void applyDisplay(int, android.graphics.Rect, android.graphics.Rect, int);
    method public static int getAbsoluteGravity(int, int);
    field public static final int END = 8388613; // 0x800005
    field public static final int RELATIVE_HORIZONTAL_GRAVITY_MASK = 8388615; // 0x800007
    field public static final int RELATIVE_LAYOUT_DIRECTION = 8388608; // 0x800000
    field public static final int START = 8388611; // 0x800003
  }

  public final class InputDeviceCompat {
    field public static final int SOURCE_ANY = -256; // 0xffffff00
    field public static final int SOURCE_CLASS_BUTTON = 1; // 0x1
    field public static final int SOURCE_CLASS_JOYSTICK = 16; // 0x10
    field public static final int SOURCE_CLASS_MASK = 255; // 0xff
    field public static final int SOURCE_CLASS_NONE = 0; // 0x0
    field public static final int SOURCE_CLASS_POINTER = 2; // 0x2
    field public static final int SOURCE_CLASS_POSITION = 8; // 0x8
    field public static final int SOURCE_CLASS_TRACKBALL = 4; // 0x4
    field public static final int SOURCE_DPAD = 513; // 0x201
    field public static final int SOURCE_GAMEPAD = 1025; // 0x401
    field public static final int SOURCE_HDMI = 33554433; // 0x2000001
    field public static final int SOURCE_JOYSTICK = 16777232; // 0x1000010
    field public static final int SOURCE_KEYBOARD = 257; // 0x101
    field public static final int SOURCE_MOUSE = 8194; // 0x2002
    field public static final int SOURCE_ROTARY_ENCODER = 4194304; // 0x400000
    field public static final int SOURCE_STYLUS = 16386; // 0x4002
    field public static final int SOURCE_TOUCHPAD = 1048584; // 0x100008
    field public static final int SOURCE_TOUCHSCREEN = 4098; // 0x1002
    field public static final int SOURCE_TOUCH_NAVIGATION = 2097152; // 0x200000
    field public static final int SOURCE_TRACKBALL = 65540; // 0x10004
    field public static final int SOURCE_UNKNOWN = 0; // 0x0
  }

  public final deprecated class KeyEventCompat {
    method public static deprecated boolean dispatch(android.view.KeyEvent, android.view.KeyEvent.Callback, java.lang.Object, java.lang.Object);
    method public static deprecated java.lang.Object getKeyDispatcherState(android.view.View);
    method public static deprecated boolean hasModifiers(android.view.KeyEvent, int);
    method public static deprecated boolean hasNoModifiers(android.view.KeyEvent);
    method public static deprecated boolean isCtrlPressed(android.view.KeyEvent);
    method public static deprecated boolean isTracking(android.view.KeyEvent);
    method public static deprecated boolean metaStateHasModifiers(int, int);
    method public static deprecated boolean metaStateHasNoModifiers(int);
    method public static deprecated int normalizeMetaState(int);
    method public static deprecated void startTracking(android.view.KeyEvent);
  }

  public final class LayoutInflaterCompat {
    method public static deprecated android.support.v4.view.LayoutInflaterFactory getFactory(android.view.LayoutInflater);
    method public static deprecated void setFactory(android.view.LayoutInflater, android.support.v4.view.LayoutInflaterFactory);
    method public static void setFactory2(android.view.LayoutInflater, android.view.LayoutInflater.Factory2);
  }

  public abstract deprecated interface LayoutInflaterFactory {
    method public abstract android.view.View onCreateView(android.view.View, java.lang.String, android.content.Context, android.util.AttributeSet);
  }

  public final class MarginLayoutParamsCompat {
    method public static int getLayoutDirection(android.view.ViewGroup.MarginLayoutParams);
    method public static int getMarginEnd(android.view.ViewGroup.MarginLayoutParams);
    method public static int getMarginStart(android.view.ViewGroup.MarginLayoutParams);
    method public static boolean isMarginRelative(android.view.ViewGroup.MarginLayoutParams);
    method public static void resolveLayoutDirection(android.view.ViewGroup.MarginLayoutParams, int);
    method public static void setLayoutDirection(android.view.ViewGroup.MarginLayoutParams, int);
    method public static void setMarginEnd(android.view.ViewGroup.MarginLayoutParams, int);
    method public static void setMarginStart(android.view.ViewGroup.MarginLayoutParams, int);
  }

  public final class MenuCompat {
    method public static deprecated void setShowAsAction(android.view.MenuItem, int);
  }

  public final class MenuItemCompat {
    method public static deprecated boolean collapseActionView(android.view.MenuItem);
    method public static deprecated boolean expandActionView(android.view.MenuItem);
    method public static android.support.v4.view.ActionProvider getActionProvider(android.view.MenuItem);
    method public static deprecated android.view.View getActionView(android.view.MenuItem);
    method public static int getAlphabeticModifiers(android.view.MenuItem);
    method public static java.lang.CharSequence getContentDescription(android.view.MenuItem);
    method public static android.content.res.ColorStateList getIconTintList(android.view.MenuItem);
    method public static android.graphics.PorterDuff.Mode getIconTintMode(android.view.MenuItem);
    method public static int getNumericModifiers(android.view.MenuItem);
    method public static java.lang.CharSequence getTooltipText(android.view.MenuItem);
    method public static deprecated boolean isActionViewExpanded(android.view.MenuItem);
    method public static android.view.MenuItem setActionProvider(android.view.MenuItem, android.support.v4.view.ActionProvider);
    method public static deprecated android.view.MenuItem setActionView(android.view.MenuItem, android.view.View);
    method public static deprecated android.view.MenuItem setActionView(android.view.MenuItem, int);
    method public static void setAlphabeticShortcut(android.view.MenuItem, char, int);
    method public static void setContentDescription(android.view.MenuItem, java.lang.CharSequence);
    method public static void setIconTintList(android.view.MenuItem, android.content.res.ColorStateList);
    method public static void setIconTintMode(android.view.MenuItem, android.graphics.PorterDuff.Mode);
    method public static void setNumericShortcut(android.view.MenuItem, char, int);
    method public static deprecated android.view.MenuItem setOnActionExpandListener(android.view.MenuItem, android.support.v4.view.MenuItemCompat.OnActionExpandListener);
    method public static void setShortcut(android.view.MenuItem, char, char, int, int);
    method public static deprecated void setShowAsAction(android.view.MenuItem, int);
    method public static void setTooltipText(android.view.MenuItem, java.lang.CharSequence);
    field public static final deprecated int SHOW_AS_ACTION_ALWAYS = 2; // 0x2
    field public static final deprecated int SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW = 8; // 0x8
    field public static final deprecated int SHOW_AS_ACTION_IF_ROOM = 1; // 0x1
    field public static final deprecated int SHOW_AS_ACTION_NEVER = 0; // 0x0
    field public static final deprecated int SHOW_AS_ACTION_WITH_TEXT = 4; // 0x4
  }

  public static abstract deprecated interface MenuItemCompat.OnActionExpandListener {
    method public abstract boolean onMenuItemActionCollapse(android.view.MenuItem);
    method public abstract boolean onMenuItemActionExpand(android.view.MenuItem);
  }

  public final class MotionEventCompat {
    method public static deprecated int findPointerIndex(android.view.MotionEvent, int);
    method public static deprecated int getActionIndex(android.view.MotionEvent);
    method public static deprecated int getActionMasked(android.view.MotionEvent);
    method public static deprecated float getAxisValue(android.view.MotionEvent, int);
    method public static deprecated float getAxisValue(android.view.MotionEvent, int, int);
    method public static deprecated int getButtonState(android.view.MotionEvent);
    method public static deprecated int getPointerCount(android.view.MotionEvent);
    method public static deprecated int getPointerId(android.view.MotionEvent, int);
    method public static deprecated int getSource(android.view.MotionEvent);
    method public static deprecated float getX(android.view.MotionEvent, int);
    method public static deprecated float getY(android.view.MotionEvent, int);
    method public static boolean isFromSource(android.view.MotionEvent, int);
    field public static final deprecated int ACTION_HOVER_ENTER = 9; // 0x9
    field public static final deprecated int ACTION_HOVER_EXIT = 10; // 0xa
    field public static final deprecated int ACTION_HOVER_MOVE = 7; // 0x7
    field public static final deprecated int ACTION_MASK = 255; // 0xff
    field public static final deprecated int ACTION_POINTER_DOWN = 5; // 0x5
    field public static final deprecated int ACTION_POINTER_INDEX_MASK = 65280; // 0xff00
    field public static final deprecated int ACTION_POINTER_INDEX_SHIFT = 8; // 0x8
    field public static final deprecated int ACTION_POINTER_UP = 6; // 0x6
    field public static final deprecated int ACTION_SCROLL = 8; // 0x8
    field public static final deprecated int AXIS_BRAKE = 23; // 0x17
    field public static final deprecated int AXIS_DISTANCE = 24; // 0x18
    field public static final deprecated int AXIS_GAS = 22; // 0x16
    field public static final deprecated int AXIS_GENERIC_1 = 32; // 0x20
    field public static final deprecated int AXIS_GENERIC_10 = 41; // 0x29
    field public static final deprecated int AXIS_GENERIC_11 = 42; // 0x2a
    field public static final deprecated int AXIS_GENERIC_12 = 43; // 0x2b
    field public static final deprecated int AXIS_GENERIC_13 = 44; // 0x2c
    field public static final deprecated int AXIS_GENERIC_14 = 45; // 0x2d
    field public static final deprecated int AXIS_GENERIC_15 = 46; // 0x2e
    field public static final deprecated int AXIS_GENERIC_16 = 47; // 0x2f
    field public static final deprecated int AXIS_GENERIC_2 = 33; // 0x21
    field public static final deprecated int AXIS_GENERIC_3 = 34; // 0x22
    field public static final deprecated int AXIS_GENERIC_4 = 35; // 0x23
    field public static final deprecated int AXIS_GENERIC_5 = 36; // 0x24
    field public static final deprecated int AXIS_GENERIC_6 = 37; // 0x25
    field public static final deprecated int AXIS_GENERIC_7 = 38; // 0x26
    field public static final deprecated int AXIS_GENERIC_8 = 39; // 0x27
    field public static final deprecated int AXIS_GENERIC_9 = 40; // 0x28
    field public static final deprecated int AXIS_HAT_X = 15; // 0xf
    field public static final deprecated int AXIS_HAT_Y = 16; // 0x10
    field public static final deprecated int AXIS_HSCROLL = 10; // 0xa
    field public static final deprecated int AXIS_LTRIGGER = 17; // 0x11
    field public static final deprecated int AXIS_ORIENTATION = 8; // 0x8
    field public static final deprecated int AXIS_PRESSURE = 2; // 0x2
    field public static final int AXIS_RELATIVE_X = 27; // 0x1b
    field public static final int AXIS_RELATIVE_Y = 28; // 0x1c
    field public static final deprecated int AXIS_RTRIGGER = 18; // 0x12
    field public static final deprecated int AXIS_RUDDER = 20; // 0x14
    field public static final deprecated int AXIS_RX = 12; // 0xc
    field public static final deprecated int AXIS_RY = 13; // 0xd
    field public static final deprecated int AXIS_RZ = 14; // 0xe
    field public static final int AXIS_SCROLL = 26; // 0x1a
    field public static final deprecated int AXIS_SIZE = 3; // 0x3
    field public static final deprecated int AXIS_THROTTLE = 19; // 0x13
    field public static final deprecated int AXIS_TILT = 25; // 0x19
    field public static final deprecated int AXIS_TOOL_MAJOR = 6; // 0x6
    field public static final deprecated int AXIS_TOOL_MINOR = 7; // 0x7
    field public static final deprecated int AXIS_TOUCH_MAJOR = 4; // 0x4
    field public static final deprecated int AXIS_TOUCH_MINOR = 5; // 0x5
    field public static final deprecated int AXIS_VSCROLL = 9; // 0x9
    field public static final deprecated int AXIS_WHEEL = 21; // 0x15
    field public static final deprecated int AXIS_X = 0; // 0x0
    field public static final deprecated int AXIS_Y = 1; // 0x1
    field public static final deprecated int AXIS_Z = 11; // 0xb
    field public static final deprecated int BUTTON_PRIMARY = 1; // 0x1
  }

  public abstract interface NestedScrollingChild {
    method public abstract boolean dispatchNestedFling(float, float, boolean);
    method public abstract boolean dispatchNestedPreFling(float, float);
    method public abstract boolean dispatchNestedPreScroll(int, int, int[], int[]);
    method public abstract boolean dispatchNestedScroll(int, int, int, int, int[]);
    method public abstract boolean hasNestedScrollingParent();
    method public abstract boolean isNestedScrollingEnabled();
    method public abstract void setNestedScrollingEnabled(boolean);
    method public abstract boolean startNestedScroll(int);
    method public abstract void stopNestedScroll();
  }

  public abstract interface NestedScrollingChild2 implements android.support.v4.view.NestedScrollingChild {
    method public abstract boolean dispatchNestedPreScroll(int, int, int[], int[], int);
    method public abstract boolean dispatchNestedScroll(int, int, int, int, int[], int);
    method public abstract boolean hasNestedScrollingParent(int);
    method public abstract boolean startNestedScroll(int, int);
    method public abstract void stopNestedScroll(int);
  }

  public class NestedScrollingChildHelper {
    ctor public NestedScrollingChildHelper(android.view.View);
    method public boolean dispatchNestedFling(float, float, boolean);
    method public boolean dispatchNestedPreFling(float, float);
    method public boolean dispatchNestedPreScroll(int, int, int[], int[]);
    method public boolean dispatchNestedPreScroll(int, int, int[], int[], int);
    method public boolean dispatchNestedScroll(int, int, int, int, int[]);
    method public boolean dispatchNestedScroll(int, int, int, int, int[], int);
    method public boolean hasNestedScrollingParent();
    method public boolean hasNestedScrollingParent(int);
    method public boolean isNestedScrollingEnabled();
    method public void onDetachedFromWindow();
    method public void onStopNestedScroll(android.view.View);
    method public void setNestedScrollingEnabled(boolean);
    method public boolean startNestedScroll(int);
    method public boolean startNestedScroll(int, int);
    method public void stopNestedScroll();
    method public void stopNestedScroll(int);
  }

  public abstract interface NestedScrollingParent {
    method public abstract int getNestedScrollAxes();
    method public abstract boolean onNestedFling(android.view.View, float, float, boolean);
    method public abstract boolean onNestedPreFling(android.view.View, float, float);
    method public abstract void onNestedPreScroll(android.view.View, int, int, int[]);
    method public abstract void onNestedScroll(android.view.View, int, int, int, int);
    method public abstract void onNestedScrollAccepted(android.view.View, android.view.View, int);
    method public abstract boolean onStartNestedScroll(android.view.View, android.view.View, int);
    method public abstract void onStopNestedScroll(android.view.View);
  }

  public abstract interface NestedScrollingParent2 implements android.support.v4.view.NestedScrollingParent {
    method public abstract void onNestedPreScroll(android.view.View, int, int, int[], int);
    method public abstract void onNestedScroll(android.view.View, int, int, int, int, int);
    method public abstract void onNestedScrollAccepted(android.view.View, android.view.View, int, int);
    method public abstract boolean onStartNestedScroll(android.view.View, android.view.View, int, int);
    method public abstract void onStopNestedScroll(android.view.View, int);
  }

  public class NestedScrollingParentHelper {
    ctor public NestedScrollingParentHelper(android.view.ViewGroup);
    method public int getNestedScrollAxes();
    method public void onNestedScrollAccepted(android.view.View, android.view.View, int);
    method public void onNestedScrollAccepted(android.view.View, android.view.View, int, int);
    method public void onStopNestedScroll(android.view.View);
    method public void onStopNestedScroll(android.view.View, int);
  }

  public abstract interface OnApplyWindowInsetsListener {
    method public abstract android.support.v4.view.WindowInsetsCompat onApplyWindowInsets(android.view.View, android.support.v4.view.WindowInsetsCompat);
  }

  public abstract class PagerAdapter {
    ctor public PagerAdapter();
    method public void destroyItem(android.view.ViewGroup, int, java.lang.Object);
    method public deprecated void destroyItem(android.view.View, int, java.lang.Object);
    method public void finishUpdate(android.view.ViewGroup);
    method public deprecated void finishUpdate(android.view.View);
    method public abstract int getCount();
    method public int getItemPosition(java.lang.Object);
    method public java.lang.CharSequence getPageTitle(int);
    method public float getPageWidth(int);
    method public java.lang.Object instantiateItem(android.view.ViewGroup, int);
    method public deprecated java.lang.Object instantiateItem(android.view.View, int);
    method public abstract boolean isViewFromObject(android.view.View, java.lang.Object);
    method public void notifyDataSetChanged();
    method public void registerDataSetObserver(android.database.DataSetObserver);
    method public void restoreState(android.os.Parcelable, java.lang.ClassLoader);
    method public android.os.Parcelable saveState();
    method public void setPrimaryItem(android.view.ViewGroup, int, java.lang.Object);
    method public deprecated void setPrimaryItem(android.view.View, int, java.lang.Object);
    method public void startUpdate(android.view.ViewGroup);
    method public deprecated void startUpdate(android.view.View);
    method public void unregisterDataSetObserver(android.database.DataSetObserver);
    field public static final int POSITION_NONE = -2; // 0xfffffffe
    field public static final int POSITION_UNCHANGED = -1; // 0xffffffff
  }

  public class PagerTabStrip extends android.support.v4.view.PagerTitleStrip {
    ctor public PagerTabStrip(android.content.Context);
    ctor public PagerTabStrip(android.content.Context, android.util.AttributeSet);
    method public boolean getDrawFullUnderline();
    method public int getTabIndicatorColor();
    method public void setBackgroundDrawable(android.graphics.drawable.Drawable);
    method public void setDrawFullUnderline(boolean);
    method public void setTabIndicatorColor(int);
    method public void setTabIndicatorColorResource(int);
  }

  public class PagerTitleStrip extends android.view.ViewGroup {
    ctor public PagerTitleStrip(android.content.Context);
    ctor public PagerTitleStrip(android.content.Context, android.util.AttributeSet);
    method public int getTextSpacing();
    method protected void onLayout(boolean, int, int, int, int);
    method public void setGravity(int);
    method public void setNonPrimaryAlpha(float);
    method public void setTextColor(int);
    method public void setTextSize(int, float);
    method public void setTextSpacing(int);
  }

  public final class PointerIconCompat {
    method public static android.support.v4.view.PointerIconCompat create(android.graphics.Bitmap, float, float);
    method public static android.support.v4.view.PointerIconCompat getSystemIcon(android.content.Context, int);
    method public static android.support.v4.view.PointerIconCompat load(android.content.res.Resources, int);
    field public static final int TYPE_ALIAS = 1010; // 0x3f2
    field public static final int TYPE_ALL_SCROLL = 1013; // 0x3f5
    field public static final int TYPE_ARROW = 1000; // 0x3e8
    field public static final int TYPE_CELL = 1006; // 0x3ee
    field public static final int TYPE_CONTEXT_MENU = 1001; // 0x3e9
    field public static final int TYPE_COPY = 1011; // 0x3f3
    field public static final int TYPE_CROSSHAIR = 1007; // 0x3ef
    field public static final int TYPE_DEFAULT = 1000; // 0x3e8
    field public static final int TYPE_GRAB = 1020; // 0x3fc
    field public static final int TYPE_GRABBING = 1021; // 0x3fd
    field public static final int TYPE_HAND = 1002; // 0x3ea
    field public static final int TYPE_HELP = 1003; // 0x3eb
    field public static final int TYPE_HORIZONTAL_DOUBLE_ARROW = 1014; // 0x3f6
    field public static final int TYPE_NO_DROP = 1012; // 0x3f4
    field public static final int TYPE_NULL = 0; // 0x0
    field public static final int TYPE_TEXT = 1008; // 0x3f0
    field public static final int TYPE_TOP_LEFT_DIAGONAL_DOUBLE_ARROW = 1017; // 0x3f9
    field public static final int TYPE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROW = 1016; // 0x3f8
    field public static final int TYPE_VERTICAL_DOUBLE_ARROW = 1015; // 0x3f7
    field public static final int TYPE_VERTICAL_TEXT = 1009; // 0x3f1
    field public static final int TYPE_WAIT = 1004; // 0x3ec
    field public static final int TYPE_ZOOM_IN = 1018; // 0x3fa
    field public static final int TYPE_ZOOM_OUT = 1019; // 0x3fb
  }

  public final class ScaleGestureDetectorCompat {
    method public static deprecated boolean isQuickScaleEnabled(java.lang.Object);
    method public static boolean isQuickScaleEnabled(android.view.ScaleGestureDetector);
    method public static deprecated void setQuickScaleEnabled(java.lang.Object, boolean);
    method public static void setQuickScaleEnabled(android.view.ScaleGestureDetector, boolean);
  }

  public abstract interface ScrollingView {
    method public abstract int computeHorizontalScrollExtent();
    method public abstract int computeHorizontalScrollOffset();
    method public abstract int computeHorizontalScrollRange();
    method public abstract int computeVerticalScrollExtent();
    method public abstract int computeVerticalScrollOffset();
    method public abstract int computeVerticalScrollRange();
  }

  public abstract interface TintableBackgroundView {
    method public abstract android.content.res.ColorStateList getSupportBackgroundTintList();
    method public abstract android.graphics.PorterDuff.Mode getSupportBackgroundTintMode();
    method public abstract void setSupportBackgroundTintList(android.content.res.ColorStateList);
    method public abstract void setSupportBackgroundTintMode(android.graphics.PorterDuff.Mode);
  }

  public final deprecated class VelocityTrackerCompat {
    method public static deprecated float getXVelocity(android.view.VelocityTracker, int);
    method public static deprecated float getYVelocity(android.view.VelocityTracker, int);
  }

  public class ViewCompat {
    ctor protected ViewCompat();
    method public static void addKeyboardNavigationClusters(android.view.View, java.util.Collection<android.view.View>, int);
    method public static android.support.v4.view.ViewPropertyAnimatorCompat animate(android.view.View);
    method public static deprecated boolean canScrollHorizontally(android.view.View, int);
    method public static deprecated boolean canScrollVertically(android.view.View, int);
    method public static void cancelDragAndDrop(android.view.View);
    method public static deprecated int combineMeasuredStates(int, int);
    method public static android.support.v4.view.WindowInsetsCompat dispatchApplyWindowInsets(android.view.View, android.support.v4.view.WindowInsetsCompat);
    method public static void dispatchFinishTemporaryDetach(android.view.View);
    method public static boolean dispatchNestedFling(android.view.View, float, float, boolean);
    method public static boolean dispatchNestedPreFling(android.view.View, float, float);
    method public static boolean dispatchNestedPreScroll(android.view.View, int, int, int[], int[]);
    method public static boolean dispatchNestedPreScroll(android.view.View, int, int, int[], int[], int);
    method public static boolean dispatchNestedScroll(android.view.View, int, int, int, int, int[]);
    method public static boolean dispatchNestedScroll(android.view.View, int, int, int, int, int[], int);
    method public static void dispatchStartTemporaryDetach(android.view.View);
    method public static int getAccessibilityLiveRegion(android.view.View);
    method public static android.support.v4.view.accessibility.AccessibilityNodeProviderCompat getAccessibilityNodeProvider(android.view.View);
    method public static deprecated float getAlpha(android.view.View);
    method public static android.content.res.ColorStateList getBackgroundTintList(android.view.View);
    method public static android.graphics.PorterDuff.Mode getBackgroundTintMode(android.view.View);
    method public static android.graphics.Rect getClipBounds(android.view.View);
    method public static android.view.Display getDisplay(android.view.View);
    method public static float getElevation(android.view.View);
    method public static boolean getFitsSystemWindows(android.view.View);
    method public static int getImportantForAccessibility(android.view.View);
    method public static int getLabelFor(android.view.View);
    method public static deprecated int getLayerType(android.view.View);
    method public static int getLayoutDirection(android.view.View);
    method public static deprecated android.graphics.Matrix getMatrix(android.view.View);
    method public static deprecated int getMeasuredHeightAndState(android.view.View);
    method public static deprecated int getMeasuredState(android.view.View);
    method public static deprecated int getMeasuredWidthAndState(android.view.View);
    method public static int getMinimumHeight(android.view.View);
    method public static int getMinimumWidth(android.view.View);
    method public static int getNextClusterForwardId(android.view.View);
    method public static deprecated int getOverScrollMode(android.view.View);
    method public static int getPaddingEnd(android.view.View);
    method public static int getPaddingStart(android.view.View);
    method public static android.view.ViewParent getParentForAccessibility(android.view.View);
    method public static deprecated float getPivotX(android.view.View);
    method public static deprecated float getPivotY(android.view.View);
    method public static deprecated float getRotation(android.view.View);
    method public static deprecated float getRotationX(android.view.View);
    method public static deprecated float getRotationY(android.view.View);
    method public static deprecated float getScaleX(android.view.View);
    method public static deprecated float getScaleY(android.view.View);
    method public static int getScrollIndicators(android.view.View);
    method public static java.lang.String getTransitionName(android.view.View);
    method public static deprecated float getTranslationX(android.view.View);
    method public static deprecated float getTranslationY(android.view.View);
    method public static float getTranslationZ(android.view.View);
    method public static int getWindowSystemUiVisibility(android.view.View);
    method public static deprecated float getX(android.view.View);
    method public static deprecated float getY(android.view.View);
    method public static float getZ(android.view.View);
    method public static boolean hasAccessibilityDelegate(android.view.View);
    method public static boolean hasExplicitFocusable(android.view.View);
    method public static boolean hasNestedScrollingParent(android.view.View);
    method public static boolean hasNestedScrollingParent(android.view.View, int);
    method public static boolean hasOnClickListeners(android.view.View);
    method public static boolean hasOverlappingRendering(android.view.View);
    method public static boolean hasTransientState(android.view.View);
    method public static boolean isAttachedToWindow(android.view.View);
    method public static boolean isFocusedByDefault(android.view.View);
    method public static boolean isImportantForAccessibility(android.view.View);
    method public static boolean isInLayout(android.view.View);
    method public static boolean isKeyboardNavigationCluster(android.view.View);
    method public static boolean isLaidOut(android.view.View);
    method public static boolean isLayoutDirectionResolved(android.view.View);
    method public static boolean isNestedScrollingEnabled(android.view.View);
    method public static deprecated boolean isOpaque(android.view.View);
    method public static boolean isPaddingRelative(android.view.View);
    method public static deprecated void jumpDrawablesToCurrentState(android.view.View);
    method public static android.view.View keyboardNavigationClusterSearch(android.view.View, android.view.View, int);
    method public static void offsetLeftAndRight(android.view.View, int);
    method public static void offsetTopAndBottom(android.view.View, int);
    method public static android.support.v4.view.WindowInsetsCompat onApplyWindowInsets(android.view.View, android.support.v4.view.WindowInsetsCompat);
    method public static deprecated void onInitializeAccessibilityEvent(android.view.View, android.view.accessibility.AccessibilityEvent);
    method public static void onInitializeAccessibilityNodeInfo(android.view.View, android.support.v4.view.accessibility.AccessibilityNodeInfoCompat);
    method public static deprecated void onPopulateAccessibilityEvent(android.view.View, android.view.accessibility.AccessibilityEvent);
    method public static boolean performAccessibilityAction(android.view.View, int, android.os.Bundle);
    method public static void postInvalidateOnAnimation(android.view.View);
    method public static void postInvalidateOnAnimation(android.view.View, int, int, int, int);
    method public static void postOnAnimation(android.view.View, java.lang.Runnable);
    method public static void postOnAnimationDelayed(android.view.View, java.lang.Runnable, long);
    method public static void requestApplyInsets(android.view.View);
    method public static deprecated int resolveSizeAndState(int, int, int);
    method public static boolean restoreDefaultFocus(android.view.View);
    method public static void setAccessibilityDelegate(android.view.View, android.support.v4.view.AccessibilityDelegateCompat);
    method public static void setAccessibilityLiveRegion(android.view.View, int);
    method public static deprecated void setActivated(android.view.View, boolean);
    method public static deprecated void setAlpha(android.view.View, float);
    method public static void setBackground(android.view.View, android.graphics.drawable.Drawable);
    method public static void setBackgroundTintList(android.view.View, android.content.res.ColorStateList);
    method public static void setBackgroundTintMode(android.view.View, android.graphics.PorterDuff.Mode);
    method public static void setChildrenDrawingOrderEnabled(android.view.ViewGroup, boolean);
    method public static void setClipBounds(android.view.View, android.graphics.Rect);
    method public static void setElevation(android.view.View, float);
    method public static deprecated void setFitsSystemWindows(android.view.View, boolean);
    method public static void setFocusedByDefault(android.view.View, boolean);
    method public static void setHasTransientState(android.view.View, boolean);
    method public static void setImportantForAccessibility(android.view.View, int);
    method public static void setKeyboardNavigationCluster(android.view.View, boolean);
    method public static void setLabelFor(android.view.View, int);
    method public static void setLayerPaint(android.view.View, android.graphics.Paint);
    method public static deprecated void setLayerType(android.view.View, int, android.graphics.Paint);
    method public static void setLayoutDirection(android.view.View, int);
    method public static void setNestedScrollingEnabled(android.view.View, boolean);
    method public static void setNextClusterForwardId(android.view.View, int);
    method public static void setOnApplyWindowInsetsListener(android.view.View, android.support.v4.view.OnApplyWindowInsetsListener);
    method public static deprecated void setOverScrollMode(android.view.View, int);
    method public static void setPaddingRelative(android.view.View, int, int, int, int);
    method public static deprecated void setPivotX(android.view.View, float);
    method public static deprecated void setPivotY(android.view.View, float);
    method public static void setPointerIcon(android.view.View, android.support.v4.view.PointerIconCompat);
    method public static deprecated void setRotation(android.view.View, float);
    method public static deprecated void setRotationX(android.view.View, float);
    method public static deprecated void setRotationY(android.view.View, float);
    method public static deprecated void setSaveFromParentEnabled(android.view.View, boolean);
    method public static deprecated void setScaleX(android.view.View, float);
    method public static deprecated void setScaleY(android.view.View, float);
    method public static void setScrollIndicators(android.view.View, int);
    method public static void setScrollIndicators(android.view.View, int, int);
    method public static void setTooltipText(android.view.View, java.lang.CharSequence);
    method public static void setTransitionName(android.view.View, java.lang.String);
    method public static deprecated void setTranslationX(android.view.View, float);
    method public static deprecated void setTranslationY(android.view.View, float);
    method public static void setTranslationZ(android.view.View, float);
    method public static deprecated void setX(android.view.View, float);
    method public static deprecated void setY(android.view.View, float);
    method public static void setZ(android.view.View, float);
    method public static boolean startDragAndDrop(android.view.View, android.content.ClipData, android.view.View.DragShadowBuilder, java.lang.Object, int);
    method public static boolean startNestedScroll(android.view.View, int);
    method public static boolean startNestedScroll(android.view.View, int, int);
    method public static void stopNestedScroll(android.view.View);
    method public static void stopNestedScroll(android.view.View, int);
    method public static void updateDragShadow(android.view.View, android.view.View.DragShadowBuilder);
    field public static final int ACCESSIBILITY_LIVE_REGION_ASSERTIVE = 2; // 0x2
    field public static final int ACCESSIBILITY_LIVE_REGION_NONE = 0; // 0x0
    field public static final int ACCESSIBILITY_LIVE_REGION_POLITE = 1; // 0x1
    field public static final int IMPORTANT_FOR_ACCESSIBILITY_AUTO = 0; // 0x0
    field public static final int IMPORTANT_FOR_ACCESSIBILITY_NO = 2; // 0x2
    field public static final int IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS = 4; // 0x4
    field public static final int IMPORTANT_FOR_ACCESSIBILITY_YES = 1; // 0x1
    field public static final deprecated int LAYER_TYPE_HARDWARE = 2; // 0x2
    field public static final deprecated int LAYER_TYPE_NONE = 0; // 0x0
    field public static final deprecated int LAYER_TYPE_SOFTWARE = 1; // 0x1
    field public static final int LAYOUT_DIRECTION_INHERIT = 2; // 0x2
    field public static final int LAYOUT_DIRECTION_LOCALE = 3; // 0x3
    field public static final int LAYOUT_DIRECTION_LTR = 0; // 0x0
    field public static final int LAYOUT_DIRECTION_RTL = 1; // 0x1
    field public static final deprecated int MEASURED_HEIGHT_STATE_SHIFT = 16; // 0x10
    field public static final deprecated int MEASURED_SIZE_MASK = 16777215; // 0xffffff
    field public static final deprecated int MEASURED_STATE_MASK = -16777216; // 0xff000000
    field public static final deprecated int MEASURED_STATE_TOO_SMALL = 16777216; // 0x1000000
    field public static final deprecated int OVER_SCROLL_ALWAYS = 0; // 0x0
    field public static final deprecated int OVER_SCROLL_IF_CONTENT_SCROLLS = 1; // 0x1
    field public static final deprecated int OVER_SCROLL_NEVER = 2; // 0x2
    field public static final int SCROLL_AXIS_HORIZONTAL = 1; // 0x1
    field public static final int SCROLL_AXIS_NONE = 0; // 0x0
    field public static final int SCROLL_AXIS_VERTICAL = 2; // 0x2
    field public static final int SCROLL_INDICATOR_BOTTOM = 2; // 0x2
    field public static final int SCROLL_INDICATOR_END = 32; // 0x20
    field public static final int SCROLL_INDICATOR_LEFT = 4; // 0x4
    field public static final int SCROLL_INDICATOR_RIGHT = 8; // 0x8
    field public static final int SCROLL_INDICATOR_START = 16; // 0x10
    field public static final int SCROLL_INDICATOR_TOP = 1; // 0x1
    field public static final int TYPE_NON_TOUCH = 1; // 0x1
    field public static final int TYPE_TOUCH = 0; // 0x0
  }

  public final deprecated class ViewConfigurationCompat {
    method public static float getScaledHorizontalScrollFactor(android.view.ViewConfiguration, android.content.Context);
    method public static deprecated int getScaledPagingTouchSlop(android.view.ViewConfiguration);
    method public static float getScaledVerticalScrollFactor(android.view.ViewConfiguration, android.content.Context);
    method public static deprecated boolean hasPermanentMenuKey(android.view.ViewConfiguration);
  }

  public final class ViewGroupCompat {
    method public static int getLayoutMode(android.view.ViewGroup);
    method public static int getNestedScrollAxes(android.view.ViewGroup);
    method public static boolean isTransitionGroup(android.view.ViewGroup);
    method public static deprecated boolean onRequestSendAccessibilityEvent(android.view.ViewGroup, android.view.View, android.view.accessibility.AccessibilityEvent);
    method public static void setLayoutMode(android.view.ViewGroup, int);
    method public static deprecated void setMotionEventSplittingEnabled(android.view.ViewGroup, boolean);
    method public static void setTransitionGroup(android.view.ViewGroup, boolean);
    field public static final int LAYOUT_MODE_CLIP_BOUNDS = 0; // 0x0
    field public static final int LAYOUT_MODE_OPTICAL_BOUNDS = 1; // 0x1
  }

  public class ViewPager extends android.view.ViewGroup {
    ctor public ViewPager(android.content.Context);
    ctor public ViewPager(android.content.Context, android.util.AttributeSet);
    method public void addOnAdapterChangeListener(android.support.v4.view.ViewPager.OnAdapterChangeListener);
    method public void addOnPageChangeListener(android.support.v4.view.ViewPager.OnPageChangeListener);
    method public boolean arrowScroll(int);
    method public boolean beginFakeDrag();
    method protected boolean canScroll(android.view.View, boolean, int, int, int);
    method public void clearOnPageChangeListeners();
    method public void endFakeDrag();
    method public boolean executeKeyEvent(android.view.KeyEvent);
    method public void fakeDragBy(float);
    method public android.support.v4.view.PagerAdapter getAdapter();
    method public int getCurrentItem();
    method public int getOffscreenPageLimit();
    method public int getPageMargin();
    method public boolean isFakeDragging();
    method protected void onLayout(boolean, int, int, int, int);
    method protected void onPageScrolled(int, float, int);
    method public void onRestoreInstanceState(android.os.Parcelable);
    method public android.os.Parcelable onSaveInstanceState();
    method public void removeOnAdapterChangeListener(android.support.v4.view.ViewPager.OnAdapterChangeListener);
    method public void removeOnPageChangeListener(android.support.v4.view.ViewPager.OnPageChangeListener);
    method public void setAdapter(android.support.v4.view.PagerAdapter);
    method public void setCurrentItem(int);
    method public void setCurrentItem(int, boolean);
    method public void setOffscreenPageLimit(int);
    method public deprecated void setOnPageChangeListener(android.support.v4.view.ViewPager.OnPageChangeListener);
    method public void setPageMargin(int);
    method public void setPageMarginDrawable(android.graphics.drawable.Drawable);
    method public void setPageMarginDrawable(int);
    method public void setPageTransformer(boolean, android.support.v4.view.ViewPager.PageTransformer);
    method public void setPageTransformer(boolean, android.support.v4.view.ViewPager.PageTransformer, int);
    field public static final int SCROLL_STATE_DRAGGING = 1; // 0x1
    field public static final int SCROLL_STATE_IDLE = 0; // 0x0
    field public static final int SCROLL_STATE_SETTLING = 2; // 0x2
  }

  public static abstract class ViewPager.DecorView implements java.lang.annotation.Annotation {
  }

  public static class ViewPager.LayoutParams extends android.view.ViewGroup.LayoutParams {
    ctor public ViewPager.LayoutParams();
    ctor public ViewPager.LayoutParams(android.content.Context, android.util.AttributeSet);
    field public int gravity;
    field public boolean isDecor;
  }

  public static abstract interface ViewPager.OnAdapterChangeListener {
    method public abstract void onAdapterChanged(android.support.v4.view.ViewPager, android.support.v4.view.PagerAdapter, android.support.v4.view.PagerAdapter);
  }

  public static abstract interface ViewPager.OnPageChangeListener {
    method public abstract void onPageScrollStateChanged(int);
    method public abstract void onPageScrolled(int, float, int);
    method public abstract void onPageSelected(int);
  }

  public static abstract interface ViewPager.PageTransformer {
    method public abstract void transformPage(android.view.View, float);
  }

  public static class ViewPager.SavedState extends android.support.v4.view.AbsSavedState {
    ctor public ViewPager.SavedState(android.os.Parcelable);
    field public static final android.os.Parcelable.Creator<android.support.v4.view.ViewPager.SavedState> CREATOR;
  }

  public static class ViewPager.SimpleOnPageChangeListener implements android.support.v4.view.ViewPager.OnPageChangeListener {
    ctor public ViewPager.SimpleOnPageChangeListener();
    method public void onPageScrollStateChanged(int);
    method public void onPageScrolled(int, float, int);
    method public void onPageSelected(int);
  }

  public final class ViewParentCompat {
    method public static void notifySubtreeAccessibilityStateChanged(android.view.ViewParent, android.view.View, android.view.View, int);
    method public static boolean onNestedFling(android.view.ViewParent, android.view.View, float, float, boolean);
    method public static boolean onNestedPreFling(android.view.ViewParent, android.view.View, float, float);
    method public static void onNestedPreScroll(android.view.ViewParent, android.view.View, int, int, int[]);
    method public static void onNestedPreScroll(android.view.ViewParent, android.view.View, int, int, int[], int);
    method public static void onNestedScroll(android.view.ViewParent, android.view.View, int, int, int, int);
    method public static void onNestedScroll(android.view.ViewParent, android.view.View, int, int, int, int, int);
    method public static void onNestedScrollAccepted(android.view.ViewParent, android.view.View, android.view.View, int);
    method public static void onNestedScrollAccepted(android.view.ViewParent, android.view.View, android.view.View, int, int);
    method public static boolean onStartNestedScroll(android.view.ViewParent, android.view.View, android.view.View, int);
    method public static boolean onStartNestedScroll(android.view.ViewParent, android.view.View, android.view.View, int, int);
    method public static void onStopNestedScroll(android.view.ViewParent, android.view.View);
    method public static void onStopNestedScroll(android.view.ViewParent, android.view.View, int);
    method public static deprecated boolean requestSendAccessibilityEvent(android.view.ViewParent, android.view.View, android.view.accessibility.AccessibilityEvent);
  }

  public final class ViewPropertyAnimatorCompat {
    method public android.support.v4.view.ViewPropertyAnimatorCompat alpha(float);
    method public android.support.v4.view.ViewPropertyAnimatorCompat alphaBy(float);
    method public void cancel();
    method public long getDuration();
    method public android.view.animation.Interpolator getInterpolator();
    method public long getStartDelay();
    method public android.support.v4.view.ViewPropertyAnimatorCompat rotation(float);
    method public android.support.v4.view.ViewPropertyAnimatorCompat rotationBy(float);
    method public android.support.v4.view.ViewPropertyAnimatorCompat rotationX(float);
    method public android.support.v4.view.ViewPropertyAnimatorCompat rotationXBy(float);
    method public android.support.v4.view.ViewPropertyAnimatorCompat rotationY(float);
    method public android.support.v4.view.ViewPropertyAnimatorCompat rotationYBy(float);
    method public android.support.v4.view.ViewPropertyAnimatorCompat scaleX(float);
    method public android.support.v4.view.ViewPropertyAnimatorCompat scaleXBy(float);
    method public android.support.v4.view.ViewPropertyAnimatorCompat scaleY(float);
    method public android.support.v4.view.ViewPropertyAnimatorCompat scaleYBy(float);
    method public android.support.v4.view.ViewPropertyAnimatorCompat setDuration(long);
    method public android.support.v4.view.ViewPropertyAnimatorCompat setInterpolator(android.view.animation.Interpolator);
    method public android.support.v4.view.ViewPropertyAnimatorCompat setListener(android.support.v4.view.ViewPropertyAnimatorListener);
    method public android.support.v4.view.ViewPropertyAnimatorCompat setStartDelay(long);
    method public android.support.v4.view.ViewPropertyAnimatorCompat setUpdateListener(android.support.v4.view.ViewPropertyAnimatorUpdateListener);
    method public void start();
    method public android.support.v4.view.ViewPropertyAnimatorCompat translationX(float);
    method public android.support.v4.view.ViewPropertyAnimatorCompat translationXBy(float);
    method public android.support.v4.view.ViewPropertyAnimatorCompat translationY(float);
    method public android.support.v4.view.ViewPropertyAnimatorCompat translationYBy(float);
    method public android.support.v4.view.ViewPropertyAnimatorCompat translationZ(float);
    method public android.support.v4.view.ViewPropertyAnimatorCompat translationZBy(float);
    method public android.support.v4.view.ViewPropertyAnimatorCompat withEndAction(java.lang.Runnable);
    method public android.support.v4.view.ViewPropertyAnimatorCompat withLayer();
    method public android.support.v4.view.ViewPropertyAnimatorCompat withStartAction(java.lang.Runnable);
    method public android.support.v4.view.ViewPropertyAnimatorCompat x(float);
    method public android.support.v4.view.ViewPropertyAnimatorCompat xBy(float);
    method public android.support.v4.view.ViewPropertyAnimatorCompat y(float);
    method public android.support.v4.view.ViewPropertyAnimatorCompat yBy(float);
    method public android.support.v4.view.ViewPropertyAnimatorCompat z(float);
    method public android.support.v4.view.ViewPropertyAnimatorCompat zBy(float);
  }

  public abstract interface ViewPropertyAnimatorListener {
    method public abstract void onAnimationCancel(android.view.View);
    method public abstract void onAnimationEnd(android.view.View);
    method public abstract void onAnimationStart(android.view.View);
  }

  public class ViewPropertyAnimatorListenerAdapter implements android.support.v4.view.ViewPropertyAnimatorListener {
    ctor public ViewPropertyAnimatorListenerAdapter();
    method public void onAnimationCancel(android.view.View);
    method public void onAnimationEnd(android.view.View);
    method public void onAnimationStart(android.view.View);
  }

  public abstract interface ViewPropertyAnimatorUpdateListener {
    method public abstract void onAnimationUpdate(android.view.View);
  }

  public final class WindowCompat {
    field public static final int FEATURE_ACTION_BAR = 8; // 0x8
    field public static final int FEATURE_ACTION_BAR_OVERLAY = 9; // 0x9
    field public static final int FEATURE_ACTION_MODE_OVERLAY = 10; // 0xa
  }

  public class WindowInsetsCompat {
    ctor public WindowInsetsCompat(android.support.v4.view.WindowInsetsCompat);
    method public android.support.v4.view.WindowInsetsCompat consumeStableInsets();
    method public android.support.v4.view.WindowInsetsCompat consumeSystemWindowInsets();
    method public int getStableInsetBottom();
    method public int getStableInsetLeft();
    method public int getStableInsetRight();
    method public int getStableInsetTop();
    method public int getSystemWindowInsetBottom();
    method public int getSystemWindowInsetLeft();
    method public int getSystemWindowInsetRight();
    method public int getSystemWindowInsetTop();
    method public boolean hasInsets();
    method public boolean hasStableInsets();
    method public boolean hasSystemWindowInsets();
    method public boolean isConsumed();
    method public boolean isRound();
    method public android.support.v4.view.WindowInsetsCompat replaceSystemWindowInsets(int, int, int, int);
    method public android.support.v4.view.WindowInsetsCompat replaceSystemWindowInsets(android.graphics.Rect);
  }

}

package android.support.v4.view.accessibility {

  public final class AccessibilityEventCompat {
    method public static deprecated void appendRecord(android.view.accessibility.AccessibilityEvent, android.support.v4.view.accessibility.AccessibilityRecordCompat);
    method public static deprecated android.support.v4.view.accessibility.AccessibilityRecordCompat asRecord(android.view.accessibility.AccessibilityEvent);
    method public int getAction(android.view.accessibility.AccessibilityEvent);
    method public static int getContentChangeTypes(android.view.accessibility.AccessibilityEvent);
    method public int getMovementGranularity(android.view.accessibility.AccessibilityEvent);
    method public static deprecated android.support.v4.view.accessibility.AccessibilityRecordCompat getRecord(android.view.accessibility.AccessibilityEvent, int);
    method public static deprecated int getRecordCount(android.view.accessibility.AccessibilityEvent);
    method public void setAction(android.view.accessibility.AccessibilityEvent, int);
    method public static void setContentChangeTypes(android.view.accessibility.AccessibilityEvent, int);
    method public void setMovementGranularity(android.view.accessibility.AccessibilityEvent, int);
    field public static final int CONTENT_CHANGE_TYPE_CONTENT_DESCRIPTION = 4; // 0x4
    field public static final int CONTENT_CHANGE_TYPE_SUBTREE = 1; // 0x1
    field public static final int CONTENT_CHANGE_TYPE_TEXT = 2; // 0x2
    field public static final int CONTENT_CHANGE_TYPE_UNDEFINED = 0; // 0x0
    field public static final int TYPES_ALL_MASK = -1; // 0xffffffff
    field public static final int TYPE_ANNOUNCEMENT = 16384; // 0x4000
    field public static final int TYPE_ASSIST_READING_CONTEXT = 16777216; // 0x1000000
    field public static final int TYPE_GESTURE_DETECTION_END = 524288; // 0x80000
    field public static final int TYPE_GESTURE_DETECTION_START = 262144; // 0x40000
    field public static final deprecated int TYPE_TOUCH_EXPLORATION_GESTURE_END = 1024; // 0x400
    field public static final deprecated int TYPE_TOUCH_EXPLORATION_GESTURE_START = 512; // 0x200
    field public static final int TYPE_TOUCH_INTERACTION_END = 2097152; // 0x200000
    field public static final int TYPE_TOUCH_INTERACTION_START = 1048576; // 0x100000
    field public static final int TYPE_VIEW_ACCESSIBILITY_FOCUSED = 32768; // 0x8000
    field public static final int TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED = 65536; // 0x10000
    field public static final int TYPE_VIEW_CONTEXT_CLICKED = 8388608; // 0x800000
    field public static final deprecated int TYPE_VIEW_HOVER_ENTER = 128; // 0x80
    field public static final deprecated int TYPE_VIEW_HOVER_EXIT = 256; // 0x100
    field public static final deprecated int TYPE_VIEW_SCROLLED = 4096; // 0x1000
    field public static final deprecated int TYPE_VIEW_TEXT_SELECTION_CHANGED = 8192; // 0x2000
    field public static final int TYPE_VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY = 131072; // 0x20000
    field public static final int TYPE_WINDOWS_CHANGED = 4194304; // 0x400000
    field public static final deprecated int TYPE_WINDOW_CONTENT_CHANGED = 2048; // 0x800
  }

  public final class AccessibilityManagerCompat {
    method public static deprecated boolean addAccessibilityStateChangeListener(android.view.accessibility.AccessibilityManager, android.support.v4.view.accessibility.AccessibilityManagerCompat.AccessibilityStateChangeListener);
    method public static boolean addTouchExplorationStateChangeListener(android.view.accessibility.AccessibilityManager, android.support.v4.view.accessibility.AccessibilityManagerCompat.TouchExplorationStateChangeListener);
    method public static deprecated java.util.List<android.accessibilityservice.AccessibilityServiceInfo> getEnabledAccessibilityServiceList(android.view.accessibility.AccessibilityManager, int);
    method public static deprecated java.util.List<android.accessibilityservice.AccessibilityServiceInfo> getInstalledAccessibilityServiceList(android.view.accessibility.AccessibilityManager);
    method public static deprecated boolean isTouchExplorationEnabled(android.view.accessibility.AccessibilityManager);
    method public static deprecated boolean removeAccessibilityStateChangeListener(android.view.accessibility.AccessibilityManager, android.support.v4.view.accessibility.AccessibilityManagerCompat.AccessibilityStateChangeListener);
    method public static boolean removeTouchExplorationStateChangeListener(android.view.accessibility.AccessibilityManager, android.support.v4.view.accessibility.AccessibilityManagerCompat.TouchExplorationStateChangeListener);
  }

  public static abstract deprecated interface AccessibilityManagerCompat.AccessibilityStateChangeListener {
    method public abstract deprecated void onAccessibilityStateChanged(boolean);
  }

  public static abstract deprecated class AccessibilityManagerCompat.AccessibilityStateChangeListenerCompat implements android.support.v4.view.accessibility.AccessibilityManagerCompat.AccessibilityStateChangeListener {
    ctor public AccessibilityManagerCompat.AccessibilityStateChangeListenerCompat();
  }

  public static abstract interface AccessibilityManagerCompat.TouchExplorationStateChangeListener {
    method public abstract void onTouchExplorationStateChanged(boolean);
  }

  public class AccessibilityNodeInfoCompat {
    ctor public deprecated AccessibilityNodeInfoCompat(java.lang.Object);
    method public void addAction(int);
    method public void addAction(android.support.v4.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat);
    method public void addChild(android.view.View);
    method public void addChild(android.view.View, int);
    method public boolean canOpenPopup();
    method public java.util.List<android.support.v4.view.accessibility.AccessibilityNodeInfoCompat> findAccessibilityNodeInfosByText(java.lang.String);
    method public java.util.List<android.support.v4.view.accessibility.AccessibilityNodeInfoCompat> findAccessibilityNodeInfosByViewId(java.lang.String);
    method public android.support.v4.view.accessibility.AccessibilityNodeInfoCompat findFocus(int);
    method public android.support.v4.view.accessibility.AccessibilityNodeInfoCompat focusSearch(int);
    method public java.util.List<android.support.v4.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat> getActionList();
    method public int getActions();
    method public void getBoundsInParent(android.graphics.Rect);
    method public void getBoundsInScreen(android.graphics.Rect);
    method public android.support.v4.view.accessibility.AccessibilityNodeInfoCompat getChild(int);
    method public int getChildCount();
    method public java.lang.CharSequence getClassName();
    method public android.support.v4.view.accessibility.AccessibilityNodeInfoCompat.CollectionInfoCompat getCollectionInfo();
    method public android.support.v4.view.accessibility.AccessibilityNodeInfoCompat.CollectionItemInfoCompat getCollectionItemInfo();
    method public java.lang.CharSequence getContentDescription();
    method public int getDrawingOrder();
    method public java.lang.CharSequence getError();
    method public android.os.Bundle getExtras();
    method public deprecated java.lang.Object getInfo();
    method public int getInputType();
    method public android.support.v4.view.accessibility.AccessibilityNodeInfoCompat getLabelFor();
    method public android.support.v4.view.accessibility.AccessibilityNodeInfoCompat getLabeledBy();
    method public int getLiveRegion();
    method public int getMaxTextLength();
    method public int getMovementGranularities();
    method public java.lang.CharSequence getPackageName();
    method public android.support.v4.view.accessibility.AccessibilityNodeInfoCompat getParent();
    method public android.support.v4.view.accessibility.AccessibilityNodeInfoCompat.RangeInfoCompat getRangeInfo();
    method public java.lang.CharSequence getRoleDescription();
    method public java.lang.CharSequence getText();
    method public int getTextSelectionEnd();
    method public int getTextSelectionStart();
    method public android.support.v4.view.accessibility.AccessibilityNodeInfoCompat getTraversalAfter();
    method public android.support.v4.view.accessibility.AccessibilityNodeInfoCompat getTraversalBefore();
    method public java.lang.String getViewIdResourceName();
    method public android.support.v4.view.accessibility.AccessibilityWindowInfoCompat getWindow();
    method public int getWindowId();
    method public boolean isAccessibilityFocused();
    method public boolean isCheckable();
    method public boolean isChecked();
    method public boolean isClickable();
    method public boolean isContentInvalid();
    method public boolean isContextClickable();
    method public boolean isDismissable();
    method public boolean isEditable();
    method public boolean isEnabled();
    method public boolean isFocusable();
    method public boolean isFocused();
    method public boolean isImportantForAccessibility();
    method public boolean isLongClickable();
    method public boolean isMultiLine();
    method public boolean isPassword();
    method public boolean isScrollable();
    method public boolean isSelected();
    method public boolean isVisibleToUser();
    method public static android.support.v4.view.accessibility.AccessibilityNodeInfoCompat obtain(android.view.View);
    method public static android.support.v4.view.accessibility.AccessibilityNodeInfoCompat obtain(android.view.View, int);
    method public static android.support.v4.view.accessibility.AccessibilityNodeInfoCompat obtain();
    method public static android.support.v4.view.accessibility.AccessibilityNodeInfoCompat obtain(android.support.v4.view.accessibility.AccessibilityNodeInfoCompat);
    method public boolean performAction(int);
    method public boolean performAction(int, android.os.Bundle);
    method public void recycle();
    method public boolean refresh();
    method public boolean removeAction(android.support.v4.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat);
    method public boolean removeChild(android.view.View);
    method public boolean removeChild(android.view.View, int);
    method public void setAccessibilityFocused(boolean);
    method public void setBoundsInParent(android.graphics.Rect);
    method public void setBoundsInScreen(android.graphics.Rect);
    method public void setCanOpenPopup(boolean);
    method public void setCheckable(boolean);
    method public void setChecked(boolean);
    method public void setClassName(java.lang.CharSequence);
    method public void setClickable(boolean);
    method public void setCollectionInfo(java.lang.Object);
    method public void setCollectionItemInfo(java.lang.Object);
    method public void setContentDescription(java.lang.CharSequence);
    method public void setContentInvalid(boolean);
    method public void setContextClickable(boolean);
    method public void setDismissable(boolean);
    method public void setDrawingOrder(int);
    method public void setEditable(boolean);
    method public void setEnabled(boolean);
    method public void setError(java.lang.CharSequence);
    method public void setFocusable(boolean);
    method public void setFocused(boolean);
    method public void setImportantForAccessibility(boolean);
    method public void setInputType(int);
    method public void setLabelFor(android.view.View);
    method public void setLabelFor(android.view.View, int);
    method public void setLabeledBy(android.view.View);
    method public void setLabeledBy(android.view.View, int);
    method public void setLiveRegion(int);
    method public void setLongClickable(boolean);
    method public void setMaxTextLength(int);
    method public void setMovementGranularities(int);
    method public void setMultiLine(boolean);
    method public void setPackageName(java.lang.CharSequence);
    method public void setParent(android.view.View);
    method public void setParent(android.view.View, int);
    method public void setPassword(boolean);
    method public void setRangeInfo(android.support.v4.view.accessibility.AccessibilityNodeInfoCompat.RangeInfoCompat);
    method public void setRoleDescription(java.lang.CharSequence);
    method public void setScrollable(boolean);
    method public void setSelected(boolean);
    method public void setSource(android.view.View);
    method public void setSource(android.view.View, int);
    method public void setText(java.lang.CharSequence);
    method public void setTextSelection(int, int);
    method public void setTraversalAfter(android.view.View);
    method public void setTraversalAfter(android.view.View, int);
    method public void setTraversalBefore(android.view.View);
    method public void setTraversalBefore(android.view.View, int);
    method public void setViewIdResourceName(java.lang.String);
    method public void setVisibleToUser(boolean);
    method public android.view.accessibility.AccessibilityNodeInfo unwrap();
    method public static android.support.v4.view.accessibility.AccessibilityNodeInfoCompat wrap(android.view.accessibility.AccessibilityNodeInfo);
    field public static final int ACTION_ACCESSIBILITY_FOCUS = 64; // 0x40
    field public static final java.lang.String ACTION_ARGUMENT_COLUMN_INT = "android.view.accessibility.action.ARGUMENT_COLUMN_INT";
    field public static final java.lang.String ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN = "ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN";
    field public static final java.lang.String ACTION_ARGUMENT_HTML_ELEMENT_STRING = "ACTION_ARGUMENT_HTML_ELEMENT_STRING";
    field public static final java.lang.String ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT = "ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT";
    field public static final java.lang.String ACTION_ARGUMENT_PROGRESS_VALUE = "android.view.accessibility.action.ARGUMENT_PROGRESS_VALUE";
    field public static final java.lang.String ACTION_ARGUMENT_ROW_INT = "android.view.accessibility.action.ARGUMENT_ROW_INT";
    field public static final java.lang.String ACTION_ARGUMENT_SELECTION_END_INT = "ACTION_ARGUMENT_SELECTION_END_INT";
    field public static final java.lang.String ACTION_ARGUMENT_SELECTION_START_INT = "ACTION_ARGUMENT_SELECTION_START_INT";
    field public static final java.lang.String ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE = "ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE";
    field public static final int ACTION_CLEAR_ACCESSIBILITY_FOCUS = 128; // 0x80
    field public static final int ACTION_CLEAR_FOCUS = 2; // 0x2
    field public static final int ACTION_CLEAR_SELECTION = 8; // 0x8
    field public static final int ACTION_CLICK = 16; // 0x10
    field public static final int ACTION_COLLAPSE = 524288; // 0x80000
    field public static final int ACTION_COPY = 16384; // 0x4000
    field public static final int ACTION_CUT = 65536; // 0x10000
    field public static final int ACTION_DISMISS = 1048576; // 0x100000
    field public static final int ACTION_EXPAND = 262144; // 0x40000
    field public static final int ACTION_FOCUS = 1; // 0x1
    field public static final int ACTION_LONG_CLICK = 32; // 0x20
    field public static final int ACTION_NEXT_AT_MOVEMENT_GRANULARITY = 256; // 0x100
    field public static final int ACTION_NEXT_HTML_ELEMENT = 1024; // 0x400
    field public static final int ACTION_PASTE = 32768; // 0x8000
    field public static final int ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY = 512; // 0x200
    field public static final int ACTION_PREVIOUS_HTML_ELEMENT = 2048; // 0x800
    field public static final int ACTION_SCROLL_BACKWARD = 8192; // 0x2000
    field public static final int ACTION_SCROLL_FORWARD = 4096; // 0x1000
    field public static final int ACTION_SELECT = 4; // 0x4
    field public static final int ACTION_SET_SELECTION = 131072; // 0x20000
    field public static final int ACTION_SET_TEXT = 2097152; // 0x200000
    field public static final int FOCUS_ACCESSIBILITY = 2; // 0x2
    field public static final int FOCUS_INPUT = 1; // 0x1
    field public static final int MOVEMENT_GRANULARITY_CHARACTER = 1; // 0x1
    field public static final int MOVEMENT_GRANULARITY_LINE = 4; // 0x4
    field public static final int MOVEMENT_GRANULARITY_PAGE = 16; // 0x10
    field public static final int MOVEMENT_GRANULARITY_PARAGRAPH = 8; // 0x8
    field public static final int MOVEMENT_GRANULARITY_WORD = 2; // 0x2
  }

  public static class AccessibilityNodeInfoCompat.AccessibilityActionCompat {
    ctor public AccessibilityNodeInfoCompat.AccessibilityActionCompat(int, java.lang.CharSequence);
    method public int getId();
    method public java.lang.CharSequence getLabel();
    field public static final android.support.v4.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_ACCESSIBILITY_FOCUS;
    field public static final android.support.v4.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_CLEAR_ACCESSIBILITY_FOCUS;
    field public static final android.support.v4.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_CLEAR_FOCUS;
    field public static final android.support.v4.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_CLEAR_SELECTION;
    field public static final android.support.v4.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_CLICK;
    field public static final android.support.v4.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_COLLAPSE;
    field public static final android.support.v4.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_CONTEXT_CLICK;
    field public static final android.support.v4.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_COPY;
    field public static final android.support.v4.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_CUT;
    field public static final android.support.v4.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_DISMISS;
    field public static final android.support.v4.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_EXPAND;
    field public static final android.support.v4.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_FOCUS;
    field public static final android.support.v4.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_LONG_CLICK;
    field public static final android.support.v4.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_NEXT_AT_MOVEMENT_GRANULARITY;
    field public static final android.support.v4.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_NEXT_HTML_ELEMENT;
    field public static final android.support.v4.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_PASTE;
    field public static final android.support.v4.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY;
    field public static final android.support.v4.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_PREVIOUS_HTML_ELEMENT;
    field public static final android.support.v4.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_SCROLL_BACKWARD;
    field public static final android.support.v4.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_SCROLL_DOWN;
    field public static final android.support.v4.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_SCROLL_FORWARD;
    field public static final android.support.v4.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_SCROLL_LEFT;
    field public static final android.support.v4.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_SCROLL_RIGHT;
    field public static final android.support.v4.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_SCROLL_TO_POSITION;
    field public static final android.support.v4.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_SCROLL_UP;
    field public static final android.support.v4.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_SELECT;
    field public static final android.support.v4.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_SET_PROGRESS;
    field public static final android.support.v4.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_SET_SELECTION;
    field public static final android.support.v4.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_SET_TEXT;
    field public static final android.support.v4.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat ACTION_SHOW_ON_SCREEN;
  }

  public static class AccessibilityNodeInfoCompat.CollectionInfoCompat {
    method public int getColumnCount();
    method public int getRowCount();
    method public int getSelectionMode();
    method public boolean isHierarchical();
    method public static android.support.v4.view.accessibility.AccessibilityNodeInfoCompat.CollectionInfoCompat obtain(int, int, boolean, int);
    method public static android.support.v4.view.accessibility.AccessibilityNodeInfoCompat.CollectionInfoCompat obtain(int, int, boolean);
    field public static final int SELECTION_MODE_MULTIPLE = 2; // 0x2
    field public static final int SELECTION_MODE_NONE = 0; // 0x0
    field public static final int SELECTION_MODE_SINGLE = 1; // 0x1
  }

  public static class AccessibilityNodeInfoCompat.CollectionItemInfoCompat {
    method public int getColumnIndex();
    method public int getColumnSpan();
    method public int getRowIndex();
    method public int getRowSpan();
    method public boolean isHeading();
    method public boolean isSelected();
    method public static android.support.v4.view.accessibility.AccessibilityNodeInfoCompat.CollectionItemInfoCompat obtain(int, int, int, int, boolean, boolean);
    method public static android.support.v4.view.accessibility.AccessibilityNodeInfoCompat.CollectionItemInfoCompat obtain(int, int, int, int, boolean);
  }

  public static class AccessibilityNodeInfoCompat.RangeInfoCompat {
    method public float getCurrent();
    method public float getMax();
    method public float getMin();
    method public int getType();
    method public static android.support.v4.view.accessibility.AccessibilityNodeInfoCompat.RangeInfoCompat obtain(int, float, float, float);
    field public static final int RANGE_TYPE_FLOAT = 1; // 0x1
    field public static final int RANGE_TYPE_INT = 0; // 0x0
    field public static final int RANGE_TYPE_PERCENT = 2; // 0x2
  }

  public class AccessibilityNodeProviderCompat {
    ctor public AccessibilityNodeProviderCompat();
    ctor public AccessibilityNodeProviderCompat(java.lang.Object);
    method public android.support.v4.view.accessibility.AccessibilityNodeInfoCompat createAccessibilityNodeInfo(int);
    method public java.util.List<android.support.v4.view.accessibility.AccessibilityNodeInfoCompat> findAccessibilityNodeInfosByText(java.lang.String, int);
    method public android.support.v4.view.accessibility.AccessibilityNodeInfoCompat findFocus(int);
    method public java.lang.Object getProvider();
    method public boolean performAction(int, int, android.os.Bundle);
    field public static final int HOST_VIEW_ID = -1; // 0xffffffff
  }

  public class AccessibilityRecordCompat {
    ctor public deprecated AccessibilityRecordCompat(java.lang.Object);
    method public deprecated boolean equals(java.lang.Object);
    method public deprecated int getAddedCount();
    method public deprecated java.lang.CharSequence getBeforeText();
    method public deprecated java.lang.CharSequence getClassName();
    method public deprecated java.lang.CharSequence getContentDescription();
    method public deprecated int getCurrentItemIndex();
    method public deprecated int getFromIndex();
    method public deprecated java.lang.Object getImpl();
    method public deprecated int getItemCount();
    method public deprecated int getMaxScrollX();
    method public static int getMaxScrollX(android.view.accessibility.AccessibilityRecord);
    method public deprecated int getMaxScrollY();
    method public static int getMaxScrollY(android.view.accessibility.AccessibilityRecord);
    method public deprecated android.os.Parcelable getParcelableData();
    method public deprecated int getRemovedCount();
    method public deprecated int getScrollX();
    method public deprecated int getScrollY();
    method public deprecated android.support.v4.view.accessibility.AccessibilityNodeInfoCompat getSource();
    method public deprecated java.util.List<java.lang.CharSequence> getText();
    method public deprecated int getToIndex();
    method public deprecated int getWindowId();
    method public deprecated int hashCode();
    method public deprecated boolean isChecked();
    method public deprecated boolean isEnabled();
    method public deprecated boolean isFullScreen();
    method public deprecated boolean isPassword();
    method public deprecated boolean isScrollable();
    method public static deprecated android.support.v4.view.accessibility.AccessibilityRecordCompat obtain(android.support.v4.view.accessibility.AccessibilityRecordCompat);
    method public static deprecated android.support.v4.view.accessibility.AccessibilityRecordCompat obtain();
    method public deprecated void recycle();
    method public deprecated void setAddedCount(int);
    method public deprecated void setBeforeText(java.lang.CharSequence);
    method public deprecated void setChecked(boolean);
    method public deprecated void setClassName(java.lang.CharSequence);
    method public deprecated void setContentDescription(java.lang.CharSequence);
    method public deprecated void setCurrentItemIndex(int);
    method public deprecated void setEnabled(boolean);
    method public deprecated void setFromIndex(int);
    method public deprecated void setFullScreen(boolean);
    method public deprecated void setItemCount(int);
    method public deprecated void setMaxScrollX(int);
    method public static void setMaxScrollX(android.view.accessibility.AccessibilityRecord, int);
    method public deprecated void setMaxScrollY(int);
    method public static void setMaxScrollY(android.view.accessibility.AccessibilityRecord, int);
    method public deprecated void setParcelableData(android.os.Parcelable);
    method public deprecated void setPassword(boolean);
    method public deprecated void setRemovedCount(int);
    method public deprecated void setScrollX(int);
    method public deprecated void setScrollY(int);
    method public deprecated void setScrollable(boolean);
    method public deprecated void setSource(android.view.View);
    method public deprecated void setSource(android.view.View, int);
    method public static void setSource(android.view.accessibility.AccessibilityRecord, android.view.View, int);
    method public deprecated void setToIndex(int);
  }

  public class AccessibilityWindowInfoCompat {
    method public android.support.v4.view.accessibility.AccessibilityNodeInfoCompat getAnchor();
    method public void getBoundsInScreen(android.graphics.Rect);
    method public android.support.v4.view.accessibility.AccessibilityWindowInfoCompat getChild(int);
    method public int getChildCount();
    method public int getId();
    method public int getLayer();
    method public android.support.v4.view.accessibility.AccessibilityWindowInfoCompat getParent();
    method public android.support.v4.view.accessibility.AccessibilityNodeInfoCompat getRoot();
    method public java.lang.CharSequence getTitle();
    method public int getType();
    method public boolean isAccessibilityFocused();
    method public boolean isActive();
    method public boolean isFocused();
    method public static android.support.v4.view.accessibility.AccessibilityWindowInfoCompat obtain();
    method public static android.support.v4.view.accessibility.AccessibilityWindowInfoCompat obtain(android.support.v4.view.accessibility.AccessibilityWindowInfoCompat);
    method public void recycle();
    field public static final int TYPE_ACCESSIBILITY_OVERLAY = 4; // 0x4
    field public static final int TYPE_APPLICATION = 1; // 0x1
    field public static final int TYPE_INPUT_METHOD = 2; // 0x2
    field public static final int TYPE_SPLIT_SCREEN_DIVIDER = 5; // 0x5
    field public static final int TYPE_SYSTEM = 3; // 0x3
  }

}

package android.support.v4.view.animation {

  public class FastOutLinearInInterpolator extends android.support.v4.view.animation.LookupTableInterpolator {
    ctor public FastOutLinearInInterpolator();
  }

  public class FastOutSlowInInterpolator extends android.support.v4.view.animation.LookupTableInterpolator {
    ctor public FastOutSlowInInterpolator();
  }

  public class LinearOutSlowInInterpolator extends android.support.v4.view.animation.LookupTableInterpolator {
    ctor public LinearOutSlowInInterpolator();
  }

   abstract class LookupTableInterpolator implements android.view.animation.Interpolator {
    ctor public LookupTableInterpolator(float[]);
    method public float getInterpolation(float);
  }

  public final class PathInterpolatorCompat {
    method public static android.view.animation.Interpolator create(android.graphics.Path);
    method public static android.view.animation.Interpolator create(float, float);
    method public static android.view.animation.Interpolator create(float, float, float, float);
  }

}

package android.support.v4.widget {

  public abstract class AutoScrollHelper implements android.view.View.OnTouchListener {
    ctor public AutoScrollHelper(android.view.View);
    method public abstract boolean canTargetScrollHorizontally(int);
    method public abstract boolean canTargetScrollVertically(int);
    method public boolean isEnabled();
    method public boolean isExclusive();
    method public boolean onTouch(android.view.View, android.view.MotionEvent);
    method public abstract void scrollTargetBy(int, int);
    method public android.support.v4.widget.AutoScrollHelper setActivationDelay(int);
    method public android.support.v4.widget.AutoScrollHelper setEdgeType(int);
    method public android.support.v4.widget.AutoScrollHelper setEnabled(boolean);
    method public android.support.v4.widget.AutoScrollHelper setExclusive(boolean);
    method public android.support.v4.widget.AutoScrollHelper setMaximumEdges(float, float);
    method public android.support.v4.widget.AutoScrollHelper setMaximumVelocity(float, float);
    method public android.support.v4.widget.AutoScrollHelper setMinimumVelocity(float, float);
    method public android.support.v4.widget.AutoScrollHelper setRampDownDuration(int);
    method public android.support.v4.widget.AutoScrollHelper setRampUpDuration(int);
    method public android.support.v4.widget.AutoScrollHelper setRelativeEdges(float, float);
    method public android.support.v4.widget.AutoScrollHelper setRelativeVelocity(float, float);
    field public static final int EDGE_TYPE_INSIDE = 0; // 0x0
    field public static final int EDGE_TYPE_INSIDE_EXTEND = 1; // 0x1
    field public static final int EDGE_TYPE_OUTSIDE = 2; // 0x2
    field public static final float NO_MAX = 3.4028235E38f;
    field public static final float NO_MIN = 0.0f;
    field public static final float RELATIVE_UNSPECIFIED = 0.0f;
  }

  public class CircularProgressDrawable extends android.graphics.drawable.Drawable {
    ctor public CircularProgressDrawable(android.content.Context);
    method public void draw(android.graphics.Canvas);
    method public boolean getArrowEnabled();
    method public float getArrowHeight();
    method public float getArrowScale();
    method public float getArrowWidth();
    method public int getBackgroundColor();
    method public float getCenterRadius();
    method public int[] getColorSchemeColors();
    method public float getEndTrim();
    method public int getOpacity();
    method public float getProgressRotation();
    method public float getStartTrim();
    method public android.graphics.Paint.Cap getStrokeCap();
    method public float getStrokeWidth();
    method public boolean isRunning();
    method public void setAlpha(int);
    method public void setArrowDimensions(float, float);
    method public void setArrowEnabled(boolean);
    method public void setArrowScale(float);
    method public void setBackgroundColor(int);
    method public void setCenterRadius(float);
    method public void setColorFilter(android.graphics.ColorFilter);
    method public void setColorSchemeColors(int...);
    method public void setProgressRotation(float);
    method public void setStartEndTrim(float, float);
    method public void setStrokeCap(android.graphics.Paint.Cap);
    method public void setStrokeWidth(float);
    method public void setStyle(int);
    method public void start();
    method public void stop();
    field public static final int DEFAULT = 1; // 0x1
    field public static final int LARGE = 0; // 0x0
  }

  public final class CompoundButtonCompat {
    method public static android.graphics.drawable.Drawable getButtonDrawable(android.widget.CompoundButton);
    method public static android.content.res.ColorStateList getButtonTintList(android.widget.CompoundButton);
    method public static android.graphics.PorterDuff.Mode getButtonTintMode(android.widget.CompoundButton);
    method public static void setButtonTintList(android.widget.CompoundButton, android.content.res.ColorStateList);
    method public static void setButtonTintMode(android.widget.CompoundButton, android.graphics.PorterDuff.Mode);
  }

  public class ContentLoadingProgressBar extends android.widget.ProgressBar {
    ctor public ContentLoadingProgressBar(android.content.Context);
    ctor public ContentLoadingProgressBar(android.content.Context, android.util.AttributeSet);
    method public void hide();
    method public void onAttachedToWindow();
    method public void onDetachedFromWindow();
    method public void show();
  }

  public abstract class CursorAdapter extends android.widget.BaseAdapter {
    ctor public deprecated CursorAdapter(android.content.Context, android.database.Cursor);
    ctor public CursorAdapter(android.content.Context, android.database.Cursor, boolean);
    ctor public CursorAdapter(android.content.Context, android.database.Cursor, int);
    method public abstract void bindView(android.view.View, android.content.Context, android.database.Cursor);
    method public void changeCursor(android.database.Cursor);
    method public java.lang.CharSequence convertToString(android.database.Cursor);
    method public int getCount();
    method public android.database.Cursor getCursor();
    method public android.widget.Filter getFilter();
    method public android.widget.FilterQueryProvider getFilterQueryProvider();
    method public java.lang.Object getItem(int);
    method public long getItemId(int);
    method public android.view.View getView(int, android.view.View, android.view.ViewGroup);
    method protected deprecated void init(android.content.Context, android.database.Cursor, boolean);
    method public android.view.View newDropDownView(android.content.Context, android.database.Cursor, android.view.ViewGroup);
    method public abstract android.view.View newView(android.content.Context, android.database.Cursor, android.view.ViewGroup);
    method protected void onContentChanged();
    method public android.database.Cursor runQueryOnBackgroundThread(java.lang.CharSequence);
    method public void setFilterQueryProvider(android.widget.FilterQueryProvider);
    method public android.database.Cursor swapCursor(android.database.Cursor);
    field public static final deprecated int FLAG_AUTO_REQUERY = 1; // 0x1
    field public static final int FLAG_REGISTER_CONTENT_OBSERVER = 2; // 0x2
  }

  public class DrawerLayout extends android.view.ViewGroup {
    ctor public DrawerLayout(android.content.Context);
    ctor public DrawerLayout(android.content.Context, android.util.AttributeSet);
    ctor public DrawerLayout(android.content.Context, android.util.AttributeSet, int);
    method public void addDrawerListener(android.support.v4.widget.DrawerLayout.DrawerListener);
    method public void closeDrawer(android.view.View);
    method public void closeDrawer(android.view.View, boolean);
    method public void closeDrawer(int);
    method public void closeDrawer(int, boolean);
    method public void closeDrawers();
    method public float getDrawerElevation();
    method public int getDrawerLockMode(int);
    method public int getDrawerLockMode(android.view.View);
    method public java.lang.CharSequence getDrawerTitle(int);
    method public android.graphics.drawable.Drawable getStatusBarBackgroundDrawable();
    method public boolean isDrawerOpen(android.view.View);
    method public boolean isDrawerOpen(int);
    method public boolean isDrawerVisible(android.view.View);
    method public boolean isDrawerVisible(int);
    method public void onDraw(android.graphics.Canvas);
    method protected void onLayout(boolean, int, int, int, int);
    method public void openDrawer(android.view.View);
    method public void openDrawer(android.view.View, boolean);
    method public void openDrawer(int);
    method public void openDrawer(int, boolean);
    method public void removeDrawerListener(android.support.v4.widget.DrawerLayout.DrawerListener);
    method public void setDrawerElevation(float);
    method public deprecated void setDrawerListener(android.support.v4.widget.DrawerLayout.DrawerListener);
    method public void setDrawerLockMode(int);
    method public void setDrawerLockMode(int, int);
    method public void setDrawerLockMode(int, android.view.View);
    method public void setDrawerShadow(android.graphics.drawable.Drawable, int);
    method public void setDrawerShadow(int, int);
    method public void setDrawerTitle(int, java.lang.CharSequence);
    method public void setScrimColor(int);
    method public void setStatusBarBackground(android.graphics.drawable.Drawable);
    method public void setStatusBarBackground(int);
    method public void setStatusBarBackgroundColor(int);
    field public static final int LOCK_MODE_LOCKED_CLOSED = 1; // 0x1
    field public static final int LOCK_MODE_LOCKED_OPEN = 2; // 0x2
    field public static final int LOCK_MODE_UNDEFINED = 3; // 0x3
    field public static final int LOCK_MODE_UNLOCKED = 0; // 0x0
    field public static final int STATE_DRAGGING = 1; // 0x1
    field public static final int STATE_IDLE = 0; // 0x0
    field public static final int STATE_SETTLING = 2; // 0x2
  }

  public static abstract interface DrawerLayout.DrawerListener {
    method public abstract void onDrawerClosed(android.view.View);
    method public abstract void onDrawerOpened(android.view.View);
    method public abstract void onDrawerSlide(android.view.View, float);
    method public abstract void onDrawerStateChanged(int);
  }

  public static class DrawerLayout.LayoutParams extends android.view.ViewGroup.MarginLayoutParams {
    ctor public DrawerLayout.LayoutParams(android.content.Context, android.util.AttributeSet);
    ctor public DrawerLayout.LayoutParams(int, int);
    ctor public DrawerLayout.LayoutParams(int, int, int);
    ctor public DrawerLayout.LayoutParams(android.support.v4.widget.DrawerLayout.LayoutParams);
    ctor public DrawerLayout.LayoutParams(android.view.ViewGroup.LayoutParams);
    ctor public DrawerLayout.LayoutParams(android.view.ViewGroup.MarginLayoutParams);
    field public int gravity;
  }

  protected static class DrawerLayout.SavedState extends android.support.v4.view.AbsSavedState {
    ctor public DrawerLayout.SavedState(android.os.Parcel, java.lang.ClassLoader);
    ctor public DrawerLayout.SavedState(android.os.Parcelable);
    field public static final android.os.Parcelable.Creator<android.support.v4.widget.DrawerLayout.SavedState> CREATOR;
  }

  public static abstract class DrawerLayout.SimpleDrawerListener implements android.support.v4.widget.DrawerLayout.DrawerListener {
    ctor public DrawerLayout.SimpleDrawerListener();
    method public void onDrawerClosed(android.view.View);
    method public void onDrawerOpened(android.view.View);
    method public void onDrawerSlide(android.view.View, float);
    method public void onDrawerStateChanged(int);
  }

  public final class EdgeEffectCompat {
    ctor public deprecated EdgeEffectCompat(android.content.Context);
    method public deprecated boolean draw(android.graphics.Canvas);
    method public deprecated void finish();
    method public deprecated boolean isFinished();
    method public deprecated boolean onAbsorb(int);
    method public deprecated boolean onPull(float);
    method public deprecated boolean onPull(float, float);
    method public static void onPull(android.widget.EdgeEffect, float, float);
    method public deprecated boolean onRelease();
    method public deprecated void setSize(int, int);
  }

  public abstract class ExploreByTouchHelper extends android.support.v4.view.AccessibilityDelegateCompat {
    ctor public ExploreByTouchHelper(android.view.View);
    method public final boolean clearKeyboardFocusForVirtualView(int);
    method public final boolean dispatchHoverEvent(android.view.MotionEvent);
    method public final boolean dispatchKeyEvent(android.view.KeyEvent);
    method public final int getAccessibilityFocusedVirtualViewId();
    method public deprecated int getFocusedVirtualView();
    method public final int getKeyboardFocusedVirtualViewId();
    method protected abstract int getVirtualViewAt(float, float);
    method protected abstract void getVisibleVirtualViews(java.util.List<java.lang.Integer>);
    method public final void invalidateRoot();
    method public final void invalidateVirtualView(int);
    method public final void invalidateVirtualView(int, int);
    method public final void onFocusChanged(boolean, int, android.graphics.Rect);
    method protected abstract boolean onPerformActionForVirtualView(int, int, android.os.Bundle);
    method protected void onPopulateEventForHost(android.view.accessibility.AccessibilityEvent);
    method protected void onPopulateEventForVirtualView(int, android.view.accessibility.AccessibilityEvent);
    method protected void onPopulateNodeForHost(android.support.v4.view.accessibility.AccessibilityNodeInfoCompat);
    method protected abstract void onPopulateNodeForVirtualView(int, android.support.v4.view.accessibility.AccessibilityNodeInfoCompat);
    method protected void onVirtualViewKeyboardFocusChanged(int, boolean);
    method public final boolean requestKeyboardFocusForVirtualView(int);
    method public final boolean sendEventForVirtualView(int, int);
    field public static final int HOST_ID = -1; // 0xffffffff
    field public static final int INVALID_ID = -2147483648; // 0x80000000
  }

  public class ImageViewCompat {
    method public static android.content.res.ColorStateList getImageTintList(android.widget.ImageView);
    method public static android.graphics.PorterDuff.Mode getImageTintMode(android.widget.ImageView);
    method public static void setImageTintList(android.widget.ImageView, android.content.res.ColorStateList);
    method public static void setImageTintMode(android.widget.ImageView, android.graphics.PorterDuff.Mode);
  }

  public final class ListPopupWindowCompat {
    method public static deprecated android.view.View.OnTouchListener createDragToOpenListener(java.lang.Object, android.view.View);
    method public static android.view.View.OnTouchListener createDragToOpenListener(android.widget.ListPopupWindow, android.view.View);
  }

  public class ListViewAutoScrollHelper extends android.support.v4.widget.AutoScrollHelper {
    ctor public ListViewAutoScrollHelper(android.widget.ListView);
    method public boolean canTargetScrollHorizontally(int);
    method public boolean canTargetScrollVertically(int);
    method public void scrollTargetBy(int, int);
  }

  public final class ListViewCompat {
    method public static boolean canScrollList(android.widget.ListView, int);
    method public static void scrollListBy(android.widget.ListView, int);
  }

  public class NestedScrollView extends android.widget.FrameLayout implements android.support.v4.view.NestedScrollingChild2 android.support.v4.view.NestedScrollingParent android.support.v4.view.ScrollingView {
    ctor public NestedScrollView(android.content.Context);
    ctor public NestedScrollView(android.content.Context, android.util.AttributeSet);
    ctor public NestedScrollView(android.content.Context, android.util.AttributeSet, int);
    method public boolean arrowScroll(int);
    method protected int computeScrollDeltaToGetChildRectOnScreen(android.graphics.Rect);
    method public boolean dispatchNestedPreScroll(int, int, int[], int[], int);
    method public boolean dispatchNestedScroll(int, int, int, int, int[], int);
    method public boolean executeKeyEvent(android.view.KeyEvent);
    method public void fling(int);
    method public boolean fullScroll(int);
    method public int getMaxScrollAmount();
    method public boolean hasNestedScrollingParent(int);
    method public boolean isFillViewport();
    method public boolean isSmoothScrollingEnabled();
    method public void onAttachedToWindow();
    method public boolean pageScroll(int);
    method public void setFillViewport(boolean);
    method public void setOnScrollChangeListener(android.support.v4.widget.NestedScrollView.OnScrollChangeListener);
    method public void setSmoothScrollingEnabled(boolean);
    method public final void smoothScrollBy(int, int);
    method public final void smoothScrollTo(int, int);
    method public boolean startNestedScroll(int, int);
    method public void stopNestedScroll(int);
  }

  public static abstract interface NestedScrollView.OnScrollChangeListener {
    method public abstract void onScrollChange(android.support.v4.widget.NestedScrollView, int, int, int, int);
  }

  public final class PopupMenuCompat {
    method public static android.view.View.OnTouchListener getDragToOpenListener(java.lang.Object);
  }

  public final class PopupWindowCompat {
    method public static boolean getOverlapAnchor(android.widget.PopupWindow);
    method public static int getWindowLayoutType(android.widget.PopupWindow);
    method public static void setOverlapAnchor(android.widget.PopupWindow, boolean);
    method public static void setWindowLayoutType(android.widget.PopupWindow, int);
    method public static void showAsDropDown(android.widget.PopupWindow, android.view.View, int, int, int);
  }

  public abstract class ResourceCursorAdapter extends android.support.v4.widget.CursorAdapter {
    ctor public deprecated ResourceCursorAdapter(android.content.Context, int, android.database.Cursor);
    ctor public deprecated ResourceCursorAdapter(android.content.Context, int, android.database.Cursor, boolean);
    ctor public ResourceCursorAdapter(android.content.Context, int, android.database.Cursor, int);
    method public android.view.View newView(android.content.Context, android.database.Cursor, android.view.ViewGroup);
    method public void setDropDownViewResource(int);
    method public void setViewResource(int);
  }

  public final deprecated class ScrollerCompat {
    method public deprecated void abortAnimation();
    method public deprecated boolean computeScrollOffset();
    method public static deprecated android.support.v4.widget.ScrollerCompat create(android.content.Context);
    method public static deprecated android.support.v4.widget.ScrollerCompat create(android.content.Context, android.view.animation.Interpolator);
    method public deprecated void fling(int, int, int, int, int, int, int, int);
    method public deprecated void fling(int, int, int, int, int, int, int, int, int, int);
    method public deprecated float getCurrVelocity();
    method public deprecated int getCurrX();
    method public deprecated int getCurrY();
    method public deprecated int getFinalX();
    method public deprecated int getFinalY();
    method public deprecated boolean isFinished();
    method public deprecated boolean isOverScrolled();
    method public deprecated void notifyHorizontalEdgeReached(int, int, int);
    method public deprecated void notifyVerticalEdgeReached(int, int, int);
    method public deprecated boolean springBack(int, int, int, int, int, int);
    method public deprecated void startScroll(int, int, int, int);
    method public deprecated void startScroll(int, int, int, int, int);
  }

  public final deprecated class SearchViewCompat {
    method public static deprecated java.lang.CharSequence getQuery(android.view.View);
    method public static deprecated boolean isIconified(android.view.View);
    method public static deprecated boolean isQueryRefinementEnabled(android.view.View);
    method public static deprecated boolean isSubmitButtonEnabled(android.view.View);
    method public static deprecated android.view.View newSearchView(android.content.Context);
    method public static deprecated void setIconified(android.view.View, boolean);
    method public static deprecated void setImeOptions(android.view.View, int);
    method public static deprecated void setInputType(android.view.View, int);
    method public static deprecated void setMaxWidth(android.view.View, int);
    method public static deprecated void setOnCloseListener(android.view.View, android.support.v4.widget.SearchViewCompat.OnCloseListener);
    method public static deprecated void setOnQueryTextListener(android.view.View, android.support.v4.widget.SearchViewCompat.OnQueryTextListener);
    method public static deprecated void setQuery(android.view.View, java.lang.CharSequence, boolean);
    method public static deprecated void setQueryHint(android.view.View, java.lang.CharSequence);
    method public static deprecated void setQueryRefinementEnabled(android.view.View, boolean);
    method public static deprecated void setSearchableInfo(android.view.View, android.content.ComponentName);
    method public static deprecated void setSubmitButtonEnabled(android.view.View, boolean);
  }

  public static abstract deprecated interface SearchViewCompat.OnCloseListener {
    method public abstract boolean onClose();
  }

  public static abstract deprecated class SearchViewCompat.OnCloseListenerCompat implements android.support.v4.widget.SearchViewCompat.OnCloseListener {
    ctor public SearchViewCompat.OnCloseListenerCompat();
    method public boolean onClose();
  }

  public static abstract deprecated interface SearchViewCompat.OnQueryTextListener {
    method public abstract boolean onQueryTextChange(java.lang.String);
    method public abstract boolean onQueryTextSubmit(java.lang.String);
  }

  public static abstract deprecated class SearchViewCompat.OnQueryTextListenerCompat implements android.support.v4.widget.SearchViewCompat.OnQueryTextListener {
    ctor public SearchViewCompat.OnQueryTextListenerCompat();
    method public boolean onQueryTextChange(java.lang.String);
    method public boolean onQueryTextSubmit(java.lang.String);
  }

  public class SimpleCursorAdapter extends android.support.v4.widget.ResourceCursorAdapter {
    ctor public deprecated SimpleCursorAdapter(android.content.Context, int, android.database.Cursor, java.lang.String[], int[]);
    ctor public SimpleCursorAdapter(android.content.Context, int, android.database.Cursor, java.lang.String[], int[], int);
    method public void bindView(android.view.View, android.content.Context, android.database.Cursor);
    method public void changeCursorAndColumns(android.database.Cursor, java.lang.String[], int[]);
    method public android.support.v4.widget.SimpleCursorAdapter.CursorToStringConverter getCursorToStringConverter();
    method public int getStringConversionColumn();
    method public android.support.v4.widget.SimpleCursorAdapter.ViewBinder getViewBinder();
    method public void setCursorToStringConverter(android.support.v4.widget.SimpleCursorAdapter.CursorToStringConverter);
    method public void setStringConversionColumn(int);
    method public void setViewBinder(android.support.v4.widget.SimpleCursorAdapter.ViewBinder);
    method public void setViewImage(android.widget.ImageView, java.lang.String);
    method public void setViewText(android.widget.TextView, java.lang.String);
  }

  public static abstract interface SimpleCursorAdapter.CursorToStringConverter {
    method public abstract java.lang.CharSequence convertToString(android.database.Cursor);
  }

  public static abstract interface SimpleCursorAdapter.ViewBinder {
    method public abstract boolean setViewValue(android.view.View, android.database.Cursor, int);
  }

  public class SlidingPaneLayout extends android.view.ViewGroup {
    ctor public SlidingPaneLayout(android.content.Context);
    ctor public SlidingPaneLayout(android.content.Context, android.util.AttributeSet);
    ctor public SlidingPaneLayout(android.content.Context, android.util.AttributeSet, int);
    method protected boolean canScroll(android.view.View, boolean, int, int, int);
    method public deprecated boolean canSlide();
    method public boolean closePane();
    method public int getCoveredFadeColor();
    method public int getParallaxDistance();
    method public int getSliderFadeColor();
    method public boolean isOpen();
    method public boolean isSlideable();
    method protected void onLayout(boolean, int, int, int, int);
    method public boolean openPane();
    method public void setCoveredFadeColor(int);
    method public void setPanelSlideListener(android.support.v4.widget.SlidingPaneLayout.PanelSlideListener);
    method public void setParallaxDistance(int);
    method public deprecated void setShadowDrawable(android.graphics.drawable.Drawable);
    method public void setShadowDrawableLeft(android.graphics.drawable.Drawable);
    method public void setShadowDrawableRight(android.graphics.drawable.Drawable);
    method public deprecated void setShadowResource(int);
    method public void setShadowResourceLeft(int);
    method public void setShadowResourceRight(int);
    method public void setSliderFadeColor(int);
    method public deprecated void smoothSlideClosed();
    method public deprecated void smoothSlideOpen();
  }

  public static class SlidingPaneLayout.LayoutParams extends android.view.ViewGroup.MarginLayoutParams {
    ctor public SlidingPaneLayout.LayoutParams();
    ctor public SlidingPaneLayout.LayoutParams(int, int);
    ctor public SlidingPaneLayout.LayoutParams(android.view.ViewGroup.LayoutParams);
    ctor public SlidingPaneLayout.LayoutParams(android.view.ViewGroup.MarginLayoutParams);
    ctor public SlidingPaneLayout.LayoutParams(android.support.v4.widget.SlidingPaneLayout.LayoutParams);
    ctor public SlidingPaneLayout.LayoutParams(android.content.Context, android.util.AttributeSet);
    field public float weight;
  }

  public static abstract interface SlidingPaneLayout.PanelSlideListener {
    method public abstract void onPanelClosed(android.view.View);
    method public abstract void onPanelOpened(android.view.View);
    method public abstract void onPanelSlide(android.view.View, float);
  }

  public static class SlidingPaneLayout.SimplePanelSlideListener implements android.support.v4.widget.SlidingPaneLayout.PanelSlideListener {
    ctor public SlidingPaneLayout.SimplePanelSlideListener();
    method public void onPanelClosed(android.view.View);
    method public void onPanelOpened(android.view.View);
    method public void onPanelSlide(android.view.View, float);
  }

  public class Space extends android.view.View {
    ctor public Space(android.content.Context, android.util.AttributeSet, int);
    ctor public Space(android.content.Context, android.util.AttributeSet);
    ctor public Space(android.content.Context);
  }

  public class SwipeRefreshLayout extends android.view.ViewGroup implements android.support.v4.view.NestedScrollingChild android.support.v4.view.NestedScrollingParent {
    ctor public SwipeRefreshLayout(android.content.Context);
    ctor public SwipeRefreshLayout(android.content.Context, android.util.AttributeSet);
    method public boolean canChildScrollUp();
    method public int getProgressCircleDiameter();
    method public int getProgressViewEndOffset();
    method public int getProgressViewStartOffset();
    method public boolean isRefreshing();
    method protected void onLayout(boolean, int, int, int, int);
    method public void onMeasure(int, int);
    method public deprecated void setColorScheme(int...);
    method public void setColorSchemeColors(int...);
    method public void setColorSchemeResources(int...);
    method public void setDistanceToTriggerSync(int);
    method public void setOnChildScrollUpCallback(android.support.v4.widget.SwipeRefreshLayout.OnChildScrollUpCallback);
    method public void setOnRefreshListener(android.support.v4.widget.SwipeRefreshLayout.OnRefreshListener);
    method public deprecated void setProgressBackgroundColor(int);
    method public void setProgressBackgroundColorSchemeColor(int);
    method public void setProgressBackgroundColorSchemeResource(int);
    method public void setProgressViewEndTarget(boolean, int);
    method public void setProgressViewOffset(boolean, int, int);
    method public void setRefreshing(boolean);
    method public void setSize(int);
    field public static final int DEFAULT = 1; // 0x1
    field public static final int LARGE = 0; // 0x0
    field protected int mFrom;
    field protected int mOriginalOffsetTop;
  }

  public static abstract interface SwipeRefreshLayout.OnChildScrollUpCallback {
    method public abstract boolean canChildScrollUp(android.support.v4.widget.SwipeRefreshLayout, android.view.View);
  }

  public static abstract interface SwipeRefreshLayout.OnRefreshListener {
    method public abstract void onRefresh();
  }

  public final class TextViewCompat {
    method public static int getAutoSizeMaxTextSize(android.widget.TextView);
    method public static int getAutoSizeMinTextSize(android.widget.TextView);
    method public static int getAutoSizeStepGranularity(android.widget.TextView);
    method public static int[] getAutoSizeTextAvailableSizes(android.widget.TextView);
    method public static int getAutoSizeTextType(android.widget.TextView);
    method public static android.graphics.drawable.Drawable[] getCompoundDrawablesRelative(android.widget.TextView);
    method public static int getMaxLines(android.widget.TextView);
    method public static int getMinLines(android.widget.TextView);
    method public static void setAutoSizeTextTypeUniformWithConfiguration(android.widget.TextView, int, int, int, int) throws java.lang.IllegalArgumentException;
    method public static void setAutoSizeTextTypeUniformWithPresetSizes(android.widget.TextView, int[], int) throws java.lang.IllegalArgumentException;
    method public static void setAutoSizeTextTypeWithDefaults(android.widget.TextView, int);
    method public static void setCompoundDrawablesRelative(android.widget.TextView, android.graphics.drawable.Drawable, android.graphics.drawable.Drawable, android.graphics.drawable.Drawable, android.graphics.drawable.Drawable);
    method public static void setCompoundDrawablesRelativeWithIntrinsicBounds(android.widget.TextView, android.graphics.drawable.Drawable, android.graphics.drawable.Drawable, android.graphics.drawable.Drawable, android.graphics.drawable.Drawable);
    method public static void setCompoundDrawablesRelativeWithIntrinsicBounds(android.widget.TextView, int, int, int, int);
    method public static void setTextAppearance(android.widget.TextView, int);
    field public static final int AUTO_SIZE_TEXT_TYPE_NONE = 0; // 0x0
    field public static final int AUTO_SIZE_TEXT_TYPE_UNIFORM = 1; // 0x1
  }

  public abstract interface TintableCompoundButton {
    method public abstract android.content.res.ColorStateList getSupportButtonTintList();
    method public abstract android.graphics.PorterDuff.Mode getSupportButtonTintMode();
    method public abstract void setSupportButtonTintList(android.content.res.ColorStateList);
    method public abstract void setSupportButtonTintMode(android.graphics.PorterDuff.Mode);
  }

  public class ViewDragHelper {
    method public void abort();
    method protected boolean canScroll(android.view.View, boolean, int, int, int, int);
    method public void cancel();
    method public void captureChildView(android.view.View, int);
    method public boolean checkTouchSlop(int);
    method public boolean checkTouchSlop(int, int);
    method public boolean continueSettling(boolean);
    method public static android.support.v4.widget.ViewDragHelper create(android.view.ViewGroup, android.support.v4.widget.ViewDragHelper.Callback);
    method public static android.support.v4.widget.ViewDragHelper create(android.view.ViewGroup, float, android.support.v4.widget.ViewDragHelper.Callback);
    method public android.view.View findTopChildUnder(int, int);
    method public void flingCapturedView(int, int, int, int);
    method public int getActivePointerId();
    method public android.view.View getCapturedView();
    method public int getEdgeSize();
    method public float getMinVelocity();
    method public int getTouchSlop();
    method public int getViewDragState();
    method public boolean isCapturedViewUnder(int, int);
    method public boolean isEdgeTouched(int);
    method public boolean isEdgeTouched(int, int);
    method public boolean isPointerDown(int);
    method public boolean isViewUnder(android.view.View, int, int);
    method public void processTouchEvent(android.view.MotionEvent);
    method public void setEdgeTrackingEnabled(int);
    method public void setMinVelocity(float);
    method public boolean settleCapturedViewAt(int, int);
    method public boolean shouldInterceptTouchEvent(android.view.MotionEvent);
    method public boolean smoothSlideViewTo(android.view.View, int, int);
    field public static final int DIRECTION_ALL = 3; // 0x3
    field public static final int DIRECTION_HORIZONTAL = 1; // 0x1
    field public static final int DIRECTION_VERTICAL = 2; // 0x2
    field public static final int EDGE_ALL = 15; // 0xf
    field public static final int EDGE_BOTTOM = 8; // 0x8
    field public static final int EDGE_LEFT = 1; // 0x1
    field public static final int EDGE_RIGHT = 2; // 0x2
    field public static final int EDGE_TOP = 4; // 0x4
    field public static final int INVALID_POINTER = -1; // 0xffffffff
    field public static final int STATE_DRAGGING = 1; // 0x1
    field public static final int STATE_IDLE = 0; // 0x0
    field public static final int STATE_SETTLING = 2; // 0x2
  }

  public static abstract class ViewDragHelper.Callback {
    ctor public ViewDragHelper.Callback();
    method public int clampViewPositionHorizontal(android.view.View, int, int);
    method public int clampViewPositionVertical(android.view.View, int, int);
    method public int getOrderedChildIndex(int);
    method public int getViewHorizontalDragRange(android.view.View);
    method public int getViewVerticalDragRange(android.view.View);
    method public void onEdgeDragStarted(int, int);
    method public boolean onEdgeLock(int);
    method public void onEdgeTouched(int, int);
    method public void onViewCaptured(android.view.View, int);
    method public void onViewDragStateChanged(int);
    method public void onViewPositionChanged(android.view.View, int, int, int, int);
    method public void onViewReleased(android.view.View, float, float);
    method public abstract boolean tryCaptureView(android.view.View, int);
  }

}

package android.support.v7.app {

  public abstract class ActionBar {
    ctor public ActionBar();
    method public abstract void addOnMenuVisibilityListener(android.support.v7.app.ActionBar.OnMenuVisibilityListener);
    method public abstract deprecated void addTab(android.support.v7.app.ActionBar.Tab);
    method public abstract deprecated void addTab(android.support.v7.app.ActionBar.Tab, boolean);
    method public abstract deprecated void addTab(android.support.v7.app.ActionBar.Tab, int);
    method public abstract deprecated void addTab(android.support.v7.app.ActionBar.Tab, int, boolean);
    method public abstract android.view.View getCustomView();
    method public abstract int getDisplayOptions();
    method public float getElevation();
    method public abstract int getHeight();
    method public int getHideOffset();
    method public abstract deprecated int getNavigationItemCount();
    method public abstract deprecated int getNavigationMode();
    method public abstract deprecated int getSelectedNavigationIndex();
    method public abstract deprecated android.support.v7.app.ActionBar.Tab getSelectedTab();
    method public abstract java.lang.CharSequence getSubtitle();
    method public abstract deprecated android.support.v7.app.ActionBar.Tab getTabAt(int);
    method public abstract deprecated int getTabCount();
    method public android.content.Context getThemedContext();
    method public abstract java.lang.CharSequence getTitle();
    method public abstract void hide();
    method public boolean isHideOnContentScrollEnabled();
    method public abstract boolean isShowing();
    method public abstract deprecated android.support.v7.app.ActionBar.Tab newTab();
    method public abstract deprecated void removeAllTabs();
    method public abstract void removeOnMenuVisibilityListener(android.support.v7.app.ActionBar.OnMenuVisibilityListener);
    method public abstract deprecated void removeTab(android.support.v7.app.ActionBar.Tab);
    method public abstract deprecated void removeTabAt(int);
    method public abstract deprecated void selectTab(android.support.v7.app.ActionBar.Tab);
    method public abstract void setBackgroundDrawable(android.graphics.drawable.Drawable);
    method public abstract void setCustomView(android.view.View);
    method public abstract void setCustomView(android.view.View, android.support.v7.app.ActionBar.LayoutParams);
    method public abstract void setCustomView(int);
    method public abstract void setDisplayHomeAsUpEnabled(boolean);
    method public abstract void setDisplayOptions(int);
    method public abstract void setDisplayOptions(int, int);
    method public abstract void setDisplayShowCustomEnabled(boolean);
    method public abstract void setDisplayShowHomeEnabled(boolean);
    method public abstract void setDisplayShowTitleEnabled(boolean);
    method public abstract void setDisplayUseLogoEnabled(boolean);
    method public void setElevation(float);
    method public void setHideOffset(int);
    method public void setHideOnContentScrollEnabled(boolean);
    method public void setHomeActionContentDescription(java.lang.CharSequence);
    method public void setHomeActionContentDescription(int);
    method public void setHomeAsUpIndicator(android.graphics.drawable.Drawable);
    method public void setHomeAsUpIndicator(int);
    method public void setHomeButtonEnabled(boolean);
    method public abstract void setIcon(int);
    method public abstract void setIcon(android.graphics.drawable.Drawable);
    method public abstract deprecated void setListNavigationCallbacks(android.widget.SpinnerAdapter, android.support.v7.app.ActionBar.OnNavigationListener);
    method public abstract void setLogo(int);
    method public abstract void setLogo(android.graphics.drawable.Drawable);
    method public abstract deprecated void setNavigationMode(int);
    method public abstract deprecated void setSelectedNavigationItem(int);
    method public void setSplitBackgroundDrawable(android.graphics.drawable.Drawable);
    method public void setStackedBackgroundDrawable(android.graphics.drawable.Drawable);
    method public abstract void setSubtitle(java.lang.CharSequence);
    method public abstract void setSubtitle(int);
    method public abstract void setTitle(java.lang.CharSequence);
    method public abstract void setTitle(int);
    method public abstract void show();
    field public static final int DISPLAY_HOME_AS_UP = 4; // 0x4
    field public static final int DISPLAY_SHOW_CUSTOM = 16; // 0x10
    field public static final int DISPLAY_SHOW_HOME = 2; // 0x2
    field public static final int DISPLAY_SHOW_TITLE = 8; // 0x8
    field public static final int DISPLAY_USE_LOGO = 1; // 0x1
    field public static final deprecated int NAVIGATION_MODE_LIST = 1; // 0x1
    field public static final deprecated int NAVIGATION_MODE_STANDARD = 0; // 0x0
    field public static final deprecated int NAVIGATION_MODE_TABS = 2; // 0x2
  }

  public static class ActionBar.LayoutParams extends android.view.ViewGroup.MarginLayoutParams {
    ctor public ActionBar.LayoutParams(android.content.Context, android.util.AttributeSet);
    ctor public ActionBar.LayoutParams(int, int);
    ctor public ActionBar.LayoutParams(int, int, int);
    ctor public ActionBar.LayoutParams(int);
    ctor public ActionBar.LayoutParams(android.support.v7.app.ActionBar.LayoutParams);
    ctor public ActionBar.LayoutParams(android.view.ViewGroup.LayoutParams);
    field public int gravity;
  }

  public static abstract interface ActionBar.OnMenuVisibilityListener {
    method public abstract void onMenuVisibilityChanged(boolean);
  }

  public static abstract deprecated interface ActionBar.OnNavigationListener {
    method public abstract boolean onNavigationItemSelected(int, long);
  }

  public static abstract deprecated class ActionBar.Tab {
    ctor public ActionBar.Tab();
    method public abstract java.lang.CharSequence getContentDescription();
    method public abstract android.view.View getCustomView();
    method public abstract android.graphics.drawable.Drawable getIcon();
    method public abstract int getPosition();
    method public abstract java.lang.Object getTag();
    method public abstract java.lang.CharSequence getText();
    method public abstract void select();
    method public abstract android.support.v7.app.ActionBar.Tab setContentDescription(int);
    method public abstract android.support.v7.app.ActionBar.Tab setContentDescription(java.lang.CharSequence);
    method public abstract android.support.v7.app.ActionBar.Tab setCustomView(android.view.View);
    method public abstract android.support.v7.app.ActionBar.Tab setCustomView(int);
    method public abstract android.support.v7.app.ActionBar.Tab setIcon(android.graphics.drawable.Drawable);
    method public abstract android.support.v7.app.ActionBar.Tab setIcon(int);
    method public abstract android.support.v7.app.ActionBar.Tab setTabListener(android.support.v7.app.ActionBar.TabListener);
    method public abstract android.support.v7.app.ActionBar.Tab setTag(java.lang.Object);
    method public abstract android.support.v7.app.ActionBar.Tab setText(java.lang.CharSequence);
    method public abstract android.support.v7.app.ActionBar.Tab setText(int);
    field public static final int INVALID_POSITION = -1; // 0xffffffff
  }

  public static abstract deprecated interface ActionBar.TabListener {
    method public abstract void onTabReselected(android.support.v7.app.ActionBar.Tab, android.support.v4.app.FragmentTransaction);
    method public abstract void onTabSelected(android.support.v7.app.ActionBar.Tab, android.support.v4.app.FragmentTransaction);
    method public abstract void onTabUnselected(android.support.v7.app.ActionBar.Tab, android.support.v4.app.FragmentTransaction);
  }

  public class ActionBarDrawerToggle implements android.support.v4.widget.DrawerLayout.DrawerListener {
    ctor public ActionBarDrawerToggle(android.app.Activity, android.support.v4.widget.DrawerLayout, int, int);
    ctor public ActionBarDrawerToggle(android.app.Activity, android.support.v4.widget.DrawerLayout, android.support.v7.widget.Toolbar, int, int);
    method public android.support.v7.graphics.drawable.DrawerArrowDrawable getDrawerArrowDrawable();
    method public android.view.View.OnClickListener getToolbarNavigationClickListener();
    method public boolean isDrawerIndicatorEnabled();
    method public boolean isDrawerSlideAnimationEnabled();
    method public void onConfigurationChanged(android.content.res.Configuration);
    method public void onDrawerClosed(android.view.View);
    method public void onDrawerOpened(android.view.View);
    method public void onDrawerSlide(android.view.View, float);
    method public void onDrawerStateChanged(int);
    method public boolean onOptionsItemSelected(android.view.MenuItem);
    method public void setDrawerArrowDrawable(android.support.v7.graphics.drawable.DrawerArrowDrawable);
    method public void setDrawerIndicatorEnabled(boolean);
    method public void setDrawerSlideAnimationEnabled(boolean);
    method public void setHomeAsUpIndicator(android.graphics.drawable.Drawable);
    method public void setHomeAsUpIndicator(int);
    method public void setToolbarNavigationClickListener(android.view.View.OnClickListener);
    method public void syncState();
  }

  public static abstract interface ActionBarDrawerToggle.Delegate {
    method public abstract android.content.Context getActionBarThemedContext();
    method public abstract android.graphics.drawable.Drawable getThemeUpIndicator();
    method public abstract boolean isNavigationVisible();
    method public abstract void setActionBarDescription(int);
    method public abstract void setActionBarUpIndicator(android.graphics.drawable.Drawable, int);
  }

  public static abstract interface ActionBarDrawerToggle.DelegateProvider {
    method public abstract android.support.v7.app.ActionBarDrawerToggle.Delegate getDrawerToggleDelegate();
  }

  public class AlertDialog extends android.support.v7.app.AppCompatDialog implements android.content.DialogInterface {
    ctor protected AlertDialog(android.content.Context);
    ctor protected AlertDialog(android.content.Context, int);
    ctor protected AlertDialog(android.content.Context, boolean, android.content.DialogInterface.OnCancelListener);
    method public android.widget.Button getButton(int);
    method public android.widget.ListView getListView();
    method public void setButton(int, java.lang.CharSequence, android.os.Message);
    method public void setButton(int, java.lang.CharSequence, android.content.DialogInterface.OnClickListener);
    method public void setCustomTitle(android.view.View);
    method public void setIcon(int);
    method public void setIcon(android.graphics.drawable.Drawable);
    method public void setIconAttribute(int);
    method public void setMessage(java.lang.CharSequence);
    method public void setView(android.view.View);
    method public void setView(android.view.View, int, int, int, int);
  }

  public static class AlertDialog.Builder {
    ctor public AlertDialog.Builder(android.content.Context);
    ctor public AlertDialog.Builder(android.content.Context, int);
    method public android.support.v7.app.AlertDialog create();
    method public android.content.Context getContext();
    method public android.support.v7.app.AlertDialog.Builder setAdapter(android.widget.ListAdapter, android.content.DialogInterface.OnClickListener);
    method public android.support.v7.app.AlertDialog.Builder setCancelable(boolean);
    method public android.support.v7.app.AlertDialog.Builder setCursor(android.database.Cursor, android.content.DialogInterface.OnClickListener, java.lang.String);
    method public android.support.v7.app.AlertDialog.Builder setCustomTitle(android.view.View);
    method public android.support.v7.app.AlertDialog.Builder setIcon(int);
    method public android.support.v7.app.AlertDialog.Builder setIcon(android.graphics.drawable.Drawable);
    method public android.support.v7.app.AlertDialog.Builder setIconAttribute(int);
    method public deprecated android.support.v7.app.AlertDialog.Builder setInverseBackgroundForced(boolean);
    method public android.support.v7.app.AlertDialog.Builder setItems(int, android.content.DialogInterface.OnClickListener);
    method public android.support.v7.app.AlertDialog.Builder setItems(java.lang.CharSequence[], android.content.DialogInterface.OnClickListener);
    method public android.support.v7.app.AlertDialog.Builder setMessage(int);
    method public android.support.v7.app.AlertDialog.Builder setMessage(java.lang.CharSequence);
    method public android.support.v7.app.AlertDialog.Builder setMultiChoiceItems(int, boolean[], android.content.DialogInterface.OnMultiChoiceClickListener);
    method public android.support.v7.app.AlertDialog.Builder setMultiChoiceItems(java.lang.CharSequence[], boolean[], android.content.DialogInterface.OnMultiChoiceClickListener);
    method public android.support.v7.app.AlertDialog.Builder setMultiChoiceItems(android.database.Cursor, java.lang.String, java.lang.String, android.content.DialogInterface.OnMultiChoiceClickListener);
    method public android.support.v7.app.AlertDialog.Builder setNegativeButton(int, android.content.DialogInterface.OnClickListener);
    method public android.support.v7.app.AlertDialog.Builder setNegativeButton(java.lang.CharSequence, android.content.DialogInterface.OnClickListener);
    method public android.support.v7.app.AlertDialog.Builder setNeutralButton(int, android.content.DialogInterface.OnClickListener);
    method public android.support.v7.app.AlertDialog.Builder setNeutralButton(java.lang.CharSequence, android.content.DialogInterface.OnClickListener);
    method public android.support.v7.app.AlertDialog.Builder setOnCancelListener(android.content.DialogInterface.OnCancelListener);
    method public android.support.v7.app.AlertDialog.Builder setOnDismissListener(android.content.DialogInterface.OnDismissListener);
    method public android.support.v7.app.AlertDialog.Builder setOnItemSelectedListener(android.widget.AdapterView.OnItemSelectedListener);
    method public android.support.v7.app.AlertDialog.Builder setOnKeyListener(android.content.DialogInterface.OnKeyListener);
    method public android.support.v7.app.AlertDialog.Builder setPositiveButton(int, android.content.DialogInterface.OnClickListener);
    method public android.support.v7.app.AlertDialog.Builder setPositiveButton(java.lang.CharSequence, android.content.DialogInterface.OnClickListener);
    method public android.support.v7.app.AlertDialog.Builder setSingleChoiceItems(int, int, android.content.DialogInterface.OnClickListener);
    method public android.support.v7.app.AlertDialog.Builder setSingleChoiceItems(android.database.Cursor, int, java.lang.String, android.content.DialogInterface.OnClickListener);
    method public android.support.v7.app.AlertDialog.Builder setSingleChoiceItems(java.lang.CharSequence[], int, android.content.DialogInterface.OnClickListener);
    method public android.support.v7.app.AlertDialog.Builder setSingleChoiceItems(android.widget.ListAdapter, int, android.content.DialogInterface.OnClickListener);
    method public android.support.v7.app.AlertDialog.Builder setTitle(int);
    method public android.support.v7.app.AlertDialog.Builder setTitle(java.lang.CharSequence);
    method public android.support.v7.app.AlertDialog.Builder setView(int);
    method public android.support.v7.app.AlertDialog.Builder setView(android.view.View);
    method public android.support.v7.app.AlertDialog show();
  }

  public class AppCompatActivity extends android.support.v4.app.FragmentActivity implements android.support.v7.app.ActionBarDrawerToggle.DelegateProvider android.support.v7.app.AppCompatCallback android.support.v4.app.TaskStackBuilder.SupportParentable {
    ctor public AppCompatActivity();
    method public android.support.v7.app.AppCompatDelegate getDelegate();
    method public android.support.v7.app.ActionBarDrawerToggle.Delegate getDrawerToggleDelegate();
    method public android.support.v7.app.ActionBar getSupportActionBar();
    method public android.content.Intent getSupportParentActivityIntent();
    method public void onCreateSupportNavigateUpTaskStack(android.support.v4.app.TaskStackBuilder);
    method public final boolean onMenuItemSelected(int, android.view.MenuItem);
    method public void onPrepareSupportNavigateUpTaskStack(android.support.v4.app.TaskStackBuilder);
    method public void onSupportActionModeFinished(android.support.v7.view.ActionMode);
    method public void onSupportActionModeStarted(android.support.v7.view.ActionMode);
    method public deprecated void onSupportContentChanged();
    method public boolean onSupportNavigateUp();
    method public android.support.v7.view.ActionMode onWindowStartingSupportActionMode(android.support.v7.view.ActionMode.Callback);
    method public void setSupportActionBar(android.support.v7.widget.Toolbar);
    method public deprecated void setSupportProgress(int);
    method public deprecated void setSupportProgressBarIndeterminate(boolean);
    method public deprecated void setSupportProgressBarIndeterminateVisibility(boolean);
    method public deprecated void setSupportProgressBarVisibility(boolean);
    method public android.support.v7.view.ActionMode startSupportActionMode(android.support.v7.view.ActionMode.Callback);
    method public void supportInvalidateOptionsMenu();
    method public void supportNavigateUpTo(android.content.Intent);
    method public boolean supportRequestWindowFeature(int);
    method public boolean supportShouldUpRecreateTask(android.content.Intent);
  }

  public abstract interface AppCompatCallback {
    method public abstract void onSupportActionModeFinished(android.support.v7.view.ActionMode);
    method public abstract void onSupportActionModeStarted(android.support.v7.view.ActionMode);
    method public abstract android.support.v7.view.ActionMode onWindowStartingSupportActionMode(android.support.v7.view.ActionMode.Callback);
  }

  public abstract class AppCompatDelegate {
    method public abstract void addContentView(android.view.View, android.view.ViewGroup.LayoutParams);
    method public abstract boolean applyDayNight();
    method public static android.support.v7.app.AppCompatDelegate create(android.app.Activity, android.support.v7.app.AppCompatCallback);
    method public static android.support.v7.app.AppCompatDelegate create(android.app.Dialog, android.support.v7.app.AppCompatCallback);
    method public abstract android.view.View createView(android.view.View, java.lang.String, android.content.Context, android.util.AttributeSet);
    method public abstract <T extends android.view.View> T findViewById(int);
    method public static int getDefaultNightMode();
    method public abstract android.support.v7.app.ActionBarDrawerToggle.Delegate getDrawerToggleDelegate();
    method public abstract android.view.MenuInflater getMenuInflater();
    method public abstract android.support.v7.app.ActionBar getSupportActionBar();
    method public abstract boolean hasWindowFeature(int);
    method public abstract void installViewFactory();
    method public abstract void invalidateOptionsMenu();
    method public static boolean isCompatVectorFromResourcesEnabled();
    method public abstract boolean isHandleNativeActionModesEnabled();
    method public abstract void onConfigurationChanged(android.content.res.Configuration);
    method public abstract void onCreate(android.os.Bundle);
    method public abstract void onDestroy();
    method public abstract void onPostCreate(android.os.Bundle);
    method public abstract void onPostResume();
    method public abstract void onSaveInstanceState(android.os.Bundle);
    method public abstract void onStart();
    method public abstract void onStop();
    method public abstract boolean requestWindowFeature(int);
    method public static void setCompatVectorFromResourcesEnabled(boolean);
    method public abstract void setContentView(android.view.View);
    method public abstract void setContentView(int);
    method public abstract void setContentView(android.view.View, android.view.ViewGroup.LayoutParams);
    method public static void setDefaultNightMode(int);
    method public abstract void setHandleNativeActionModesEnabled(boolean);
    method public abstract void setLocalNightMode(int);
    method public abstract void setSupportActionBar(android.support.v7.widget.Toolbar);
    method public abstract void setTitle(java.lang.CharSequence);
    method public abstract android.support.v7.view.ActionMode startSupportActionMode(android.support.v7.view.ActionMode.Callback);
    field public static final int FEATURE_ACTION_MODE_OVERLAY = 10; // 0xa
    field public static final int FEATURE_SUPPORT_ACTION_BAR = 108; // 0x6c
    field public static final int FEATURE_SUPPORT_ACTION_BAR_OVERLAY = 109; // 0x6d
    field public static final int MODE_NIGHT_AUTO = 0; // 0x0
    field public static final int MODE_NIGHT_FOLLOW_SYSTEM = -1; // 0xffffffff
    field public static final int MODE_NIGHT_NO = 1; // 0x1
    field public static final int MODE_NIGHT_YES = 2; // 0x2
  }

  public class AppCompatDialog extends android.app.Dialog implements android.support.v7.app.AppCompatCallback {
    ctor public AppCompatDialog(android.content.Context);
    ctor public AppCompatDialog(android.content.Context, int);
    ctor protected AppCompatDialog(android.content.Context, boolean, android.content.DialogInterface.OnCancelListener);
    method public android.support.v7.app.AppCompatDelegate getDelegate();
    method public android.support.v7.app.ActionBar getSupportActionBar();
    method public void onSupportActionModeFinished(android.support.v7.view.ActionMode);
    method public void onSupportActionModeStarted(android.support.v7.view.ActionMode);
    method public android.support.v7.view.ActionMode onWindowStartingSupportActionMode(android.support.v7.view.ActionMode.Callback);
    method public boolean supportRequestWindowFeature(int);
  }

  public class AppCompatDialogFragment extends android.support.v4.app.DialogFragment {
    ctor public AppCompatDialogFragment();
  }

  public class MediaRouteActionProvider extends android.support.v4.view.ActionProvider {
    ctor public MediaRouteActionProvider(android.content.Context);
    method public android.support.v7.app.MediaRouteDialogFactory getDialogFactory();
    method public android.support.v7.app.MediaRouteButton getMediaRouteButton();
    method public android.support.v7.media.MediaRouteSelector getRouteSelector();
    method public android.view.View onCreateActionView();
    method public android.support.v7.app.MediaRouteButton onCreateMediaRouteButton();
    method public void setDialogFactory(android.support.v7.app.MediaRouteDialogFactory);
    method public void setRouteSelector(android.support.v7.media.MediaRouteSelector);
  }

  public class MediaRouteButton extends android.view.View {
    ctor public MediaRouteButton(android.content.Context);
    ctor public MediaRouteButton(android.content.Context, android.util.AttributeSet);
    ctor public MediaRouteButton(android.content.Context, android.util.AttributeSet, int);
    method public android.support.v7.app.MediaRouteDialogFactory getDialogFactory();
    method public android.support.v7.media.MediaRouteSelector getRouteSelector();
    method public void onAttachedToWindow();
    method public void onDetachedFromWindow();
    method public void setDialogFactory(android.support.v7.app.MediaRouteDialogFactory);
    method public void setRemoteIndicatorDrawable(android.graphics.drawable.Drawable);
    method public void setRouteSelector(android.support.v7.media.MediaRouteSelector);
    method public boolean showDialog();
  }

  public class MediaRouteChooserDialog extends android.support.v7.app.AppCompatDialog {
    ctor public MediaRouteChooserDialog(android.content.Context);
    ctor public MediaRouteChooserDialog(android.content.Context, int);
    method public android.support.v7.media.MediaRouteSelector getRouteSelector();
    method public boolean onFilterRoute(android.support.v7.media.MediaRouter.RouteInfo);
    method public void onFilterRoutes(java.util.List<android.support.v7.media.MediaRouter.RouteInfo>);
    method public void refreshRoutes();
    method public void setRouteSelector(android.support.v7.media.MediaRouteSelector);
  }

  public class MediaRouteChooserDialogFragment extends android.support.v4.app.DialogFragment {
    ctor public MediaRouteChooserDialogFragment();
    method public android.support.v7.media.MediaRouteSelector getRouteSelector();
    method public android.support.v7.app.MediaRouteChooserDialog onCreateChooserDialog(android.content.Context, android.os.Bundle);
    method public void setRouteSelector(android.support.v7.media.MediaRouteSelector);
  }

  public class MediaRouteControllerDialog extends android.support.v7.app.AlertDialog {
    ctor public MediaRouteControllerDialog(android.content.Context);
    ctor public MediaRouteControllerDialog(android.content.Context, int);
    method public android.view.View getMediaControlView();
    method public android.support.v4.media.session.MediaSessionCompat.Token getMediaSession();
    method public android.support.v7.media.MediaRouter.RouteInfo getRoute();
    method public boolean isVolumeControlEnabled();
    method public android.view.View onCreateMediaControlView(android.os.Bundle);
    method public void setVolumeControlEnabled(boolean);
  }

  public class MediaRouteControllerDialogFragment extends android.support.v4.app.DialogFragment {
    ctor public MediaRouteControllerDialogFragment();
    method public android.support.v7.app.MediaRouteControllerDialog onCreateControllerDialog(android.content.Context, android.os.Bundle);
  }

  public class MediaRouteDialogFactory {
    ctor public MediaRouteDialogFactory();
    method public static android.support.v7.app.MediaRouteDialogFactory getDefault();
    method public android.support.v7.app.MediaRouteChooserDialogFragment onCreateChooserDialogFragment();
    method public android.support.v7.app.MediaRouteControllerDialogFragment onCreateControllerDialogFragment();
  }

  public class MediaRouteDiscoveryFragment extends android.support.v4.app.Fragment {
    ctor public MediaRouteDiscoveryFragment();
    method public android.support.v7.media.MediaRouter getMediaRouter();
    method public android.support.v7.media.MediaRouteSelector getRouteSelector();
    method public android.support.v7.media.MediaRouter.Callback onCreateCallback();
    method public int onPrepareCallbackFlags();
    method public void setRouteSelector(android.support.v7.media.MediaRouteSelector);
  }

  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.DecoratedCustomViewStyle extends android.support.v4.app.NotificationCompat.DecoratedCustomViewStyle {
    ctor public deprecated NotificationCompat.DecoratedCustomViewStyle();
  }

  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 {

  public final class AppCompatResources {
    method public static android.content.res.ColorStateList getColorStateList(android.content.Context, int);
    method public static android.graphics.drawable.Drawable getDrawable(android.content.Context, int);
  }

}

package android.support.v7.graphics {

  public final class Palette {
    method public static android.support.v7.graphics.Palette.Builder from(android.graphics.Bitmap);
    method public static android.support.v7.graphics.Palette from(java.util.List<android.support.v7.graphics.Palette.Swatch>);
    method public static deprecated android.support.v7.graphics.Palette generate(android.graphics.Bitmap);
    method public static deprecated android.support.v7.graphics.Palette generate(android.graphics.Bitmap, int);
    method public static deprecated android.os.AsyncTask<android.graphics.Bitmap, java.lang.Void, android.support.v7.graphics.Palette> generateAsync(android.graphics.Bitmap, android.support.v7.graphics.Palette.PaletteAsyncListener);
    method public static deprecated android.os.AsyncTask<android.graphics.Bitmap, java.lang.Void, android.support.v7.graphics.Palette> generateAsync(android.graphics.Bitmap, int, android.support.v7.graphics.Palette.PaletteAsyncListener);
    method public int getColorForTarget(android.support.v7.graphics.Target, int);
    method public int getDarkMutedColor(int);
    method public android.support.v7.graphics.Palette.Swatch getDarkMutedSwatch();
    method public int getDarkVibrantColor(int);
    method public android.support.v7.graphics.Palette.Swatch getDarkVibrantSwatch();
    method public int getDominantColor(int);
    method public android.support.v7.graphics.Palette.Swatch getDominantSwatch();
    method public int getLightMutedColor(int);
    method public android.support.v7.graphics.Palette.Swatch getLightMutedSwatch();
    method public int getLightVibrantColor(int);
    method public android.support.v7.graphics.Palette.Swatch getLightVibrantSwatch();
    method public int getMutedColor(int);
    method public android.support.v7.graphics.Palette.Swatch getMutedSwatch();
    method public android.support.v7.graphics.Palette.Swatch getSwatchForTarget(android.support.v7.graphics.Target);
    method public java.util.List<android.support.v7.graphics.Palette.Swatch> getSwatches();
    method public java.util.List<android.support.v7.graphics.Target> getTargets();
    method public int getVibrantColor(int);
    method public android.support.v7.graphics.Palette.Swatch getVibrantSwatch();
  }

  public static final class Palette.Builder {
    ctor public Palette.Builder(android.graphics.Bitmap);
    ctor public Palette.Builder(java.util.List<android.support.v7.graphics.Palette.Swatch>);
    method public android.support.v7.graphics.Palette.Builder addFilter(android.support.v7.graphics.Palette.Filter);
    method public android.support.v7.graphics.Palette.Builder addTarget(android.support.v7.graphics.Target);
    method public android.support.v7.graphics.Palette.Builder clearFilters();
    method public android.support.v7.graphics.Palette.Builder clearRegion();
    method public android.support.v7.graphics.Palette.Builder clearTargets();
    method public android.support.v7.graphics.Palette generate();
    method public android.os.AsyncTask<android.graphics.Bitmap, java.lang.Void, android.support.v7.graphics.Palette> generate(android.support.v7.graphics.Palette.PaletteAsyncListener);
    method public android.support.v7.graphics.Palette.Builder maximumColorCount(int);
    method public android.support.v7.graphics.Palette.Builder resizeBitmapArea(int);
    method public deprecated android.support.v7.graphics.Palette.Builder resizeBitmapSize(int);
    method public android.support.v7.graphics.Palette.Builder setRegion(int, int, int, int);
  }

  public static abstract interface Palette.Filter {
    method public abstract boolean isAllowed(int, float[]);
  }

  public static abstract interface Palette.PaletteAsyncListener {
    method public abstract void onGenerated(android.support.v7.graphics.Palette);
  }

  public static final class Palette.Swatch {
    ctor public Palette.Swatch(int, int);
    method public int getBodyTextColor();
    method public float[] getHsl();
    method public int getPopulation();
    method public int getRgb();
    method public int getTitleTextColor();
  }

  public final class Target {
    method public float getLightnessWeight();
    method public float getMaximumLightness();
    method public float getMaximumSaturation();
    method public float getMinimumLightness();
    method public float getMinimumSaturation();
    method public float getPopulationWeight();
    method public float getSaturationWeight();
    method public float getTargetLightness();
    method public float getTargetSaturation();
    method public boolean isExclusive();
    field public static final android.support.v7.graphics.Target DARK_MUTED;
    field public static final android.support.v7.graphics.Target DARK_VIBRANT;
    field public static final android.support.v7.graphics.Target LIGHT_MUTED;
    field public static final android.support.v7.graphics.Target LIGHT_VIBRANT;
    field public static final android.support.v7.graphics.Target MUTED;
    field public static final android.support.v7.graphics.Target VIBRANT;
  }

  public static final class Target.Builder {
    ctor public Target.Builder();
    ctor public Target.Builder(android.support.v7.graphics.Target);
    method public android.support.v7.graphics.Target build();
    method public android.support.v7.graphics.Target.Builder setExclusive(boolean);
    method public android.support.v7.graphics.Target.Builder setLightnessWeight(float);
    method public android.support.v7.graphics.Target.Builder setMaximumLightness(float);
    method public android.support.v7.graphics.Target.Builder setMaximumSaturation(float);
    method public android.support.v7.graphics.Target.Builder setMinimumLightness(float);
    method public android.support.v7.graphics.Target.Builder setMinimumSaturation(float);
    method public android.support.v7.graphics.Target.Builder setPopulationWeight(float);
    method public android.support.v7.graphics.Target.Builder setSaturationWeight(float);
    method public android.support.v7.graphics.Target.Builder setTargetLightness(float);
    method public android.support.v7.graphics.Target.Builder setTargetSaturation(float);
  }

}

package android.support.v7.graphics.drawable {

  public class DrawerArrowDrawable extends android.graphics.drawable.Drawable {
    ctor public DrawerArrowDrawable(android.content.Context);
    method public void draw(android.graphics.Canvas);
    method public float getArrowHeadLength();
    method public float getArrowShaftLength();
    method public float getBarLength();
    method public float getBarThickness();
    method public int getColor();
    method public int getDirection();
    method public float getGapSize();
    method public int getOpacity();
    method public final android.graphics.Paint getPaint();
    method public float getProgress();
    method public boolean isSpinEnabled();
    method public void setAlpha(int);
    method public void setArrowHeadLength(float);
    method public void setArrowShaftLength(float);
    method public void setBarLength(float);
    method public void setBarThickness(float);
    method public void setColor(int);
    method public void setColorFilter(android.graphics.ColorFilter);
    method public void setDirection(int);
    method public void setGapSize(float);
    method public void setProgress(float);
    method public void setSpinEnabled(boolean);
    method public void setVerticalMirror(boolean);
    field public static final int ARROW_DIRECTION_END = 3; // 0x3
    field public static final int ARROW_DIRECTION_LEFT = 0; // 0x0
    field public static final int ARROW_DIRECTION_RIGHT = 1; // 0x1
    field public static final int ARROW_DIRECTION_START = 2; // 0x2
  }

}

package android.support.v7.media {

  public final class MediaControlIntent {
    field public static final java.lang.String ACTION_END_SESSION = "android.media.intent.action.END_SESSION";
    field public static final java.lang.String ACTION_ENQUEUE = "android.media.intent.action.ENQUEUE";
    field public static final java.lang.String ACTION_GET_SESSION_STATUS = "android.media.intent.action.GET_SESSION_STATUS";
    field public static final java.lang.String ACTION_GET_STATUS = "android.media.intent.action.GET_STATUS";
    field public static final java.lang.String ACTION_PAUSE = "android.media.intent.action.PAUSE";
    field public static final java.lang.String ACTION_PLAY = "android.media.intent.action.PLAY";
    field public static final java.lang.String ACTION_REMOVE = "android.media.intent.action.REMOVE";
    field public static final java.lang.String ACTION_RESUME = "android.media.intent.action.RESUME";
    field public static final java.lang.String ACTION_SEEK = "android.media.intent.action.SEEK";
    field public static final java.lang.String ACTION_SEND_MESSAGE = "android.media.intent.action.SEND_MESSAGE";
    field public static final java.lang.String ACTION_START_SESSION = "android.media.intent.action.START_SESSION";
    field public static final java.lang.String ACTION_STOP = "android.media.intent.action.STOP";
    field public static final java.lang.String CATEGORY_LIVE_AUDIO = "android.media.intent.category.LIVE_AUDIO";
    field public static final java.lang.String CATEGORY_LIVE_VIDEO = "android.media.intent.category.LIVE_VIDEO";
    field public static final java.lang.String CATEGORY_REMOTE_PLAYBACK = "android.media.intent.category.REMOTE_PLAYBACK";
    field public static final int ERROR_INVALID_ITEM_ID = 3; // 0x3
    field public static final int ERROR_INVALID_SESSION_ID = 2; // 0x2
    field public static final int ERROR_UNKNOWN = 0; // 0x0
    field public static final int ERROR_UNSUPPORTED_OPERATION = 1; // 0x1
    field public static final java.lang.String EXTRA_ERROR_CODE = "android.media.intent.extra.ERROR_CODE";
    field public static final java.lang.String EXTRA_ITEM_CONTENT_POSITION = "android.media.intent.extra.ITEM_POSITION";
    field public static final java.lang.String EXTRA_ITEM_HTTP_HEADERS = "android.media.intent.extra.HTTP_HEADERS";
    field public static final java.lang.String EXTRA_ITEM_ID = "android.media.intent.extra.ITEM_ID";
    field public static final java.lang.String EXTRA_ITEM_METADATA = "android.media.intent.extra.ITEM_METADATA";
    field public static final java.lang.String EXTRA_ITEM_STATUS = "android.media.intent.extra.ITEM_STATUS";
    field public static final java.lang.String EXTRA_ITEM_STATUS_UPDATE_RECEIVER = "android.media.intent.extra.ITEM_STATUS_UPDATE_RECEIVER";
    field public static final java.lang.String EXTRA_MESSAGE = "android.media.intent.extra.MESSAGE";
    field public static final java.lang.String EXTRA_MESSAGE_RECEIVER = "android.media.intent.extra.MESSAGE_RECEIVER";
    field public static final java.lang.String EXTRA_SESSION_ID = "android.media.intent.extra.SESSION_ID";
    field public static final java.lang.String EXTRA_SESSION_STATUS = "android.media.intent.extra.SESSION_STATUS";
    field public static final java.lang.String EXTRA_SESSION_STATUS_UPDATE_RECEIVER = "android.media.intent.extra.SESSION_STATUS_UPDATE_RECEIVER";
  }

  public final class MediaItemMetadata {
    field public static final java.lang.String KEY_ALBUM_ARTIST = "android.media.metadata.ALBUM_ARTIST";
    field public static final java.lang.String KEY_ALBUM_TITLE = "android.media.metadata.ALBUM_TITLE";
    field public static final java.lang.String KEY_ARTIST = "android.media.metadata.ARTIST";
    field public static final java.lang.String KEY_ARTWORK_URI = "android.media.metadata.ARTWORK_URI";
    field public static final java.lang.String KEY_AUTHOR = "android.media.metadata.AUTHOR";
    field public static final java.lang.String KEY_COMPOSER = "android.media.metadata.COMPOSER";
    field public static final java.lang.String KEY_DISC_NUMBER = "android.media.metadata.DISC_NUMBER";
    field public static final java.lang.String KEY_DURATION = "android.media.metadata.DURATION";
    field public static final java.lang.String KEY_TITLE = "android.media.metadata.TITLE";
    field public static final java.lang.String KEY_TRACK_NUMBER = "android.media.metadata.TRACK_NUMBER";
    field public static final java.lang.String KEY_YEAR = "android.media.metadata.YEAR";
  }

  public final class MediaItemStatus {
    method public android.os.Bundle asBundle();
    method public static android.support.v7.media.MediaItemStatus fromBundle(android.os.Bundle);
    method public long getContentDuration();
    method public long getContentPosition();
    method public android.os.Bundle getExtras();
    method public int getPlaybackState();
    method public long getTimestamp();
    field public static final java.lang.String EXTRA_HTTP_RESPONSE_HEADERS = "android.media.status.extra.HTTP_RESPONSE_HEADERS";
    field public static final java.lang.String EXTRA_HTTP_STATUS_CODE = "android.media.status.extra.HTTP_STATUS_CODE";
    field public static final int PLAYBACK_STATE_BUFFERING = 3; // 0x3
    field public static final int PLAYBACK_STATE_CANCELED = 5; // 0x5
    field public static final int PLAYBACK_STATE_ERROR = 7; // 0x7
    field public static final int PLAYBACK_STATE_FINISHED = 4; // 0x4
    field public static final int PLAYBACK_STATE_INVALIDATED = 6; // 0x6
    field public static final int PLAYBACK_STATE_PAUSED = 2; // 0x2
    field public static final int PLAYBACK_STATE_PENDING = 0; // 0x0
    field public static final int PLAYBACK_STATE_PLAYING = 1; // 0x1
  }

  public static final class MediaItemStatus.Builder {
    ctor public MediaItemStatus.Builder(int);
    ctor public MediaItemStatus.Builder(android.support.v7.media.MediaItemStatus);
    method public android.support.v7.media.MediaItemStatus build();
    method public android.support.v7.media.MediaItemStatus.Builder setContentDuration(long);
    method public android.support.v7.media.MediaItemStatus.Builder setContentPosition(long);
    method public android.support.v7.media.MediaItemStatus.Builder setExtras(android.os.Bundle);
    method public android.support.v7.media.MediaItemStatus.Builder setPlaybackState(int);
    method public android.support.v7.media.MediaItemStatus.Builder setTimestamp(long);
  }

  public final class MediaRouteDescriptor {
    method public android.os.Bundle asBundle();
    method public boolean canDisconnectAndKeepPlaying();
    method public static android.support.v7.media.MediaRouteDescriptor fromBundle(android.os.Bundle);
    method public int getConnectionState();
    method public java.util.List<android.content.IntentFilter> getControlFilters();
    method public java.lang.String getDescription();
    method public int getDeviceType();
    method public android.os.Bundle getExtras();
    method public android.net.Uri getIconUri();
    method public java.lang.String getId();
    method public java.lang.String getName();
    method public int getPlaybackStream();
    method public int getPlaybackType();
    method public int getPresentationDisplayId();
    method public android.content.IntentSender getSettingsActivity();
    method public int getVolume();
    method public int getVolumeHandling();
    method public int getVolumeMax();
    method public deprecated boolean isConnecting();
    method public boolean isEnabled();
    method public boolean isValid();
  }

  public static final class MediaRouteDescriptor.Builder {
    ctor public MediaRouteDescriptor.Builder(java.lang.String, java.lang.String);
    ctor public MediaRouteDescriptor.Builder(android.support.v7.media.MediaRouteDescriptor);
    method public android.support.v7.media.MediaRouteDescriptor.Builder addControlFilter(android.content.IntentFilter);
    method public android.support.v7.media.MediaRouteDescriptor.Builder addControlFilters(java.util.Collection<android.content.IntentFilter>);
    method public android.support.v7.media.MediaRouteDescriptor build();
    method public android.support.v7.media.MediaRouteDescriptor.Builder setCanDisconnect(boolean);
    method public deprecated android.support.v7.media.MediaRouteDescriptor.Builder setConnecting(boolean);
    method public android.support.v7.media.MediaRouteDescriptor.Builder setConnectionState(int);
    method public android.support.v7.media.MediaRouteDescriptor.Builder setDescription(java.lang.String);
    method public android.support.v7.media.MediaRouteDescriptor.Builder setDeviceType(int);
    method public android.support.v7.media.MediaRouteDescriptor.Builder setEnabled(boolean);
    method public android.support.v7.media.MediaRouteDescriptor.Builder setExtras(android.os.Bundle);
    method public android.support.v7.media.MediaRouteDescriptor.Builder setIconUri(android.net.Uri);
    method public android.support.v7.media.MediaRouteDescriptor.Builder setId(java.lang.String);
    method public android.support.v7.media.MediaRouteDescriptor.Builder setName(java.lang.String);
    method public android.support.v7.media.MediaRouteDescriptor.Builder setPlaybackStream(int);
    method public android.support.v7.media.MediaRouteDescriptor.Builder setPlaybackType(int);
    method public android.support.v7.media.MediaRouteDescriptor.Builder setPresentationDisplayId(int);
    method public android.support.v7.media.MediaRouteDescriptor.Builder setSettingsActivity(android.content.IntentSender);
    method public android.support.v7.media.MediaRouteDescriptor.Builder setVolume(int);
    method public android.support.v7.media.MediaRouteDescriptor.Builder setVolumeHandling(int);
    method public android.support.v7.media.MediaRouteDescriptor.Builder setVolumeMax(int);
  }

  public final class MediaRouteDiscoveryRequest {
    ctor public MediaRouteDiscoveryRequest(android.support.v7.media.MediaRouteSelector, boolean);
    method public android.os.Bundle asBundle();
    method public static android.support.v7.media.MediaRouteDiscoveryRequest fromBundle(android.os.Bundle);
    method public android.support.v7.media.MediaRouteSelector getSelector();
    method public boolean isActiveScan();
    method public boolean isValid();
  }

  public abstract class MediaRouteProvider {
    ctor public MediaRouteProvider(android.content.Context);
    method public final android.content.Context getContext();
    method public final android.support.v7.media.MediaRouteProviderDescriptor getDescriptor();
    method public final android.support.v7.media.MediaRouteDiscoveryRequest getDiscoveryRequest();
    method public final android.os.Handler getHandler();
    method public final android.support.v7.media.MediaRouteProvider.ProviderMetadata getMetadata();
    method public android.support.v7.media.MediaRouteProvider.RouteController onCreateRouteController(java.lang.String);
    method public void onDiscoveryRequestChanged(android.support.v7.media.MediaRouteDiscoveryRequest);
    method public final void setCallback(android.support.v7.media.MediaRouteProvider.Callback);
    method public final void setDescriptor(android.support.v7.media.MediaRouteProviderDescriptor);
    method public final void setDiscoveryRequest(android.support.v7.media.MediaRouteDiscoveryRequest);
  }

  public static abstract class MediaRouteProvider.Callback {
    ctor public MediaRouteProvider.Callback();
    method public void onDescriptorChanged(android.support.v7.media.MediaRouteProvider, android.support.v7.media.MediaRouteProviderDescriptor);
  }

  public static final class MediaRouteProvider.ProviderMetadata {
    method public android.content.ComponentName getComponentName();
    method public java.lang.String getPackageName();
  }

  public static abstract class MediaRouteProvider.RouteController {
    ctor public MediaRouteProvider.RouteController();
    method public boolean onControlRequest(android.content.Intent, android.support.v7.media.MediaRouter.ControlRequestCallback);
    method public void onRelease();
    method public void onSelect();
    method public void onSetVolume(int);
    method public void onUnselect();
    method public void onUnselect(int);
    method public void onUpdateVolume(int);
  }

  public final class MediaRouteProviderDescriptor {
    method public android.os.Bundle asBundle();
    method public static android.support.v7.media.MediaRouteProviderDescriptor fromBundle(android.os.Bundle);
    method public java.util.List<android.support.v7.media.MediaRouteDescriptor> getRoutes();
    method public boolean isValid();
  }

  public static final class MediaRouteProviderDescriptor.Builder {
    ctor public MediaRouteProviderDescriptor.Builder();
    ctor public MediaRouteProviderDescriptor.Builder(android.support.v7.media.MediaRouteProviderDescriptor);
    method public android.support.v7.media.MediaRouteProviderDescriptor.Builder addRoute(android.support.v7.media.MediaRouteDescriptor);
    method public android.support.v7.media.MediaRouteProviderDescriptor.Builder addRoutes(java.util.Collection<android.support.v7.media.MediaRouteDescriptor>);
    method public android.support.v7.media.MediaRouteProviderDescriptor build();
  }

  public abstract class MediaRouteProviderService extends android.app.Service {
    ctor public MediaRouteProviderService();
    method public android.support.v7.media.MediaRouteProvider getMediaRouteProvider();
    method public android.os.IBinder onBind(android.content.Intent);
    method public abstract android.support.v7.media.MediaRouteProvider onCreateMediaRouteProvider();
    field public static final java.lang.String SERVICE_INTERFACE = "android.media.MediaRouteProviderService";
  }

  public final class MediaRouteSelector {
    method public android.os.Bundle asBundle();
    method public boolean contains(android.support.v7.media.MediaRouteSelector);
    method public static android.support.v7.media.MediaRouteSelector fromBundle(android.os.Bundle);
    method public java.util.List<java.lang.String> getControlCategories();
    method public boolean hasControlCategory(java.lang.String);
    method public boolean isEmpty();
    method public boolean isValid();
    method public boolean matchesControlFilters(java.util.List<android.content.IntentFilter>);
    field public static final android.support.v7.media.MediaRouteSelector EMPTY;
  }

  public static final class MediaRouteSelector.Builder {
    ctor public MediaRouteSelector.Builder();
    ctor public MediaRouteSelector.Builder(android.support.v7.media.MediaRouteSelector);
    method public android.support.v7.media.MediaRouteSelector.Builder addControlCategories(java.util.Collection<java.lang.String>);
    method public android.support.v7.media.MediaRouteSelector.Builder addControlCategory(java.lang.String);
    method public android.support.v7.media.MediaRouteSelector.Builder addSelector(android.support.v7.media.MediaRouteSelector);
    method public android.support.v7.media.MediaRouteSelector build();
  }

  public final class MediaRouter {
    method public void addCallback(android.support.v7.media.MediaRouteSelector, android.support.v7.media.MediaRouter.Callback);
    method public void addCallback(android.support.v7.media.MediaRouteSelector, android.support.v7.media.MediaRouter.Callback, int);
    method public void addProvider(android.support.v7.media.MediaRouteProvider);
    method public void addRemoteControlClient(java.lang.Object);
    method public android.support.v7.media.MediaRouter.RouteInfo getBluetoothRoute();
    method public android.support.v7.media.MediaRouter.RouteInfo getDefaultRoute();
    method public static android.support.v7.media.MediaRouter getInstance(android.content.Context);
    method public android.support.v4.media.session.MediaSessionCompat.Token getMediaSessionToken();
    method public java.util.List<android.support.v7.media.MediaRouter.ProviderInfo> getProviders();
    method public java.util.List<android.support.v7.media.MediaRouter.RouteInfo> getRoutes();
    method public android.support.v7.media.MediaRouter.RouteInfo getSelectedRoute();
    method public boolean isRouteAvailable(android.support.v7.media.MediaRouteSelector, int);
    method public void removeCallback(android.support.v7.media.MediaRouter.Callback);
    method public void removeProvider(android.support.v7.media.MediaRouteProvider);
    method public void removeRemoteControlClient(java.lang.Object);
    method public void selectRoute(android.support.v7.media.MediaRouter.RouteInfo);
    method public void setMediaSession(java.lang.Object);
    method public void setMediaSessionCompat(android.support.v4.media.session.MediaSessionCompat);
    method public void unselect(int);
    method public android.support.v7.media.MediaRouter.RouteInfo updateSelectedRoute(android.support.v7.media.MediaRouteSelector);
    field public static final int AVAILABILITY_FLAG_IGNORE_DEFAULT_ROUTE = 1; // 0x1
    field public static final int AVAILABILITY_FLAG_REQUIRE_MATCH = 2; // 0x2
    field public static final int CALLBACK_FLAG_FORCE_DISCOVERY = 8; // 0x8
    field public static final int CALLBACK_FLAG_PERFORM_ACTIVE_SCAN = 1; // 0x1
    field public static final int CALLBACK_FLAG_REQUEST_DISCOVERY = 4; // 0x4
    field public static final int CALLBACK_FLAG_UNFILTERED_EVENTS = 2; // 0x2
    field public static final int UNSELECT_REASON_DISCONNECTED = 1; // 0x1
    field public static final int UNSELECT_REASON_ROUTE_CHANGED = 3; // 0x3
    field public static final int UNSELECT_REASON_STOPPED = 2; // 0x2
    field public static final int UNSELECT_REASON_UNKNOWN = 0; // 0x0
  }

  public static abstract class MediaRouter.Callback {
    ctor public MediaRouter.Callback();
    method public void onProviderAdded(android.support.v7.media.MediaRouter, android.support.v7.media.MediaRouter.ProviderInfo);
    method public void onProviderChanged(android.support.v7.media.MediaRouter, android.support.v7.media.MediaRouter.ProviderInfo);
    method public void onProviderRemoved(android.support.v7.media.MediaRouter, android.support.v7.media.MediaRouter.ProviderInfo);
    method public void onRouteAdded(android.support.v7.media.MediaRouter, android.support.v7.media.MediaRouter.RouteInfo);
    method public void onRouteChanged(android.support.v7.media.MediaRouter, android.support.v7.media.MediaRouter.RouteInfo);
    method public void onRoutePresentationDisplayChanged(android.support.v7.media.MediaRouter, android.support.v7.media.MediaRouter.RouteInfo);
    method public void onRouteRemoved(android.support.v7.media.MediaRouter, android.support.v7.media.MediaRouter.RouteInfo);
    method public void onRouteSelected(android.support.v7.media.MediaRouter, android.support.v7.media.MediaRouter.RouteInfo);
    method public void onRouteUnselected(android.support.v7.media.MediaRouter, android.support.v7.media.MediaRouter.RouteInfo);
    method public void onRouteUnselected(android.support.v7.media.MediaRouter, android.support.v7.media.MediaRouter.RouteInfo, int);
    method public void onRouteVolumeChanged(android.support.v7.media.MediaRouter, android.support.v7.media.MediaRouter.RouteInfo);
  }

  public static abstract class MediaRouter.ControlRequestCallback {
    ctor public MediaRouter.ControlRequestCallback();
    method public void onError(java.lang.String, android.os.Bundle);
    method public void onResult(android.os.Bundle);
  }

  public static final class MediaRouter.ProviderInfo {
    method public android.content.ComponentName getComponentName();
    method public java.lang.String getPackageName();
    method public android.support.v7.media.MediaRouteProvider getProviderInstance();
    method public java.util.List<android.support.v7.media.MediaRouter.RouteInfo> getRoutes();
  }

  public static class MediaRouter.RouteInfo {
    method public boolean canDisconnect();
    method public int getConnectionState();
    method public java.util.List<android.content.IntentFilter> getControlFilters();
    method public java.lang.String getDescription();
    method public int getDeviceType();
    method public android.os.Bundle getExtras();
    method public android.net.Uri getIconUri();
    method public java.lang.String getId();
    method public java.lang.String getName();
    method public int getPlaybackStream();
    method public int getPlaybackType();
    method public android.view.Display getPresentationDisplay();
    method public android.support.v7.media.MediaRouter.ProviderInfo getProvider();
    method public android.content.IntentSender getSettingsIntent();
    method public int getVolume();
    method public int getVolumeHandling();
    method public int getVolumeMax();
    method public boolean isBluetooth();
    method public boolean isConnecting();
    method public boolean isDefault();
    method public boolean isDeviceSpeaker();
    method public boolean isEnabled();
    method public boolean isSelected();
    method public boolean matchesSelector(android.support.v7.media.MediaRouteSelector);
    method public void requestSetVolume(int);
    method public void requestUpdateVolume(int);
    method public void select();
    method public void sendControlRequest(android.content.Intent, android.support.v7.media.MediaRouter.ControlRequestCallback);
    method public boolean supportsControlAction(java.lang.String, java.lang.String);
    method public boolean supportsControlCategory(java.lang.String);
    method public boolean supportsControlRequest(android.content.Intent);
    field public static final int CONNECTION_STATE_CONNECTED = 2; // 0x2
    field public static final int CONNECTION_STATE_CONNECTING = 1; // 0x1
    field public static final int CONNECTION_STATE_DISCONNECTED = 0; // 0x0
    field public static final int DEVICE_TYPE_SPEAKER = 2; // 0x2
    field public static final int DEVICE_TYPE_TV = 1; // 0x1
    field public static final int PLAYBACK_TYPE_LOCAL = 0; // 0x0
    field public static final int PLAYBACK_TYPE_REMOTE = 1; // 0x1
    field public static final int PLAYBACK_VOLUME_FIXED = 0; // 0x0
    field public static final int PLAYBACK_VOLUME_VARIABLE = 1; // 0x1
  }

  public final class MediaSessionStatus {
    method public android.os.Bundle asBundle();
    method public static android.support.v7.media.MediaSessionStatus fromBundle(android.os.Bundle);
    method public android.os.Bundle getExtras();
    method public int getSessionState();
    method public long getTimestamp();
    method public boolean isQueuePaused();
    field public static final int SESSION_STATE_ACTIVE = 0; // 0x0
    field public static final int SESSION_STATE_ENDED = 1; // 0x1
    field public static final int SESSION_STATE_INVALIDATED = 2; // 0x2
  }

  public static final class MediaSessionStatus.Builder {
    ctor public MediaSessionStatus.Builder(int);
    ctor public MediaSessionStatus.Builder(android.support.v7.media.MediaSessionStatus);
    method public android.support.v7.media.MediaSessionStatus build();
    method public android.support.v7.media.MediaSessionStatus.Builder setExtras(android.os.Bundle);
    method public android.support.v7.media.MediaSessionStatus.Builder setQueuePaused(boolean);
    method public android.support.v7.media.MediaSessionStatus.Builder setSessionState(int);
    method public android.support.v7.media.MediaSessionStatus.Builder setTimestamp(long);
  }

  public class RemotePlaybackClient {
    ctor public RemotePlaybackClient(android.content.Context, android.support.v7.media.MediaRouter.RouteInfo);
    method public void endSession(android.os.Bundle, android.support.v7.media.RemotePlaybackClient.SessionActionCallback);
    method public void enqueue(android.net.Uri, java.lang.String, android.os.Bundle, long, android.os.Bundle, android.support.v7.media.RemotePlaybackClient.ItemActionCallback);
    method public java.lang.String getSessionId();
    method public void getSessionStatus(android.os.Bundle, android.support.v7.media.RemotePlaybackClient.SessionActionCallback);
    method public void getStatus(java.lang.String, android.os.Bundle, android.support.v7.media.RemotePlaybackClient.ItemActionCallback);
    method public boolean hasSession();
    method public boolean isMessagingSupported();
    method public boolean isQueuingSupported();
    method public boolean isRemotePlaybackSupported();
    method public boolean isSessionManagementSupported();
    method public void pause(android.os.Bundle, android.support.v7.media.RemotePlaybackClient.SessionActionCallback);
    method public void play(android.net.Uri, java.lang.String, android.os.Bundle, long, android.os.Bundle, android.support.v7.media.RemotePlaybackClient.ItemActionCallback);
    method public void release();
    method public void remove(java.lang.String, android.os.Bundle, android.support.v7.media.RemotePlaybackClient.ItemActionCallback);
    method public void resume(android.os.Bundle, android.support.v7.media.RemotePlaybackClient.SessionActionCallback);
    method public void seek(java.lang.String, long, android.os.Bundle, android.support.v7.media.RemotePlaybackClient.ItemActionCallback);
    method public void sendMessage(android.os.Bundle, android.support.v7.media.RemotePlaybackClient.SessionActionCallback);
    method public void setOnMessageReceivedListener(android.support.v7.media.RemotePlaybackClient.OnMessageReceivedListener);
    method public void setSessionId(java.lang.String);
    method public void setStatusCallback(android.support.v7.media.RemotePlaybackClient.StatusCallback);
    method public void startSession(android.os.Bundle, android.support.v7.media.RemotePlaybackClient.SessionActionCallback);
    method public void stop(android.os.Bundle, android.support.v7.media.RemotePlaybackClient.SessionActionCallback);
  }

  public static abstract class RemotePlaybackClient.ActionCallback {
    ctor public RemotePlaybackClient.ActionCallback();
    method public void onError(java.lang.String, int, android.os.Bundle);
  }

  public static abstract class RemotePlaybackClient.ItemActionCallback extends android.support.v7.media.RemotePlaybackClient.ActionCallback {
    ctor public RemotePlaybackClient.ItemActionCallback();
    method public void onResult(android.os.Bundle, java.lang.String, android.support.v7.media.MediaSessionStatus, java.lang.String, android.support.v7.media.MediaItemStatus);
  }

  public static abstract interface RemotePlaybackClient.OnMessageReceivedListener {
    method public abstract void onMessageReceived(java.lang.String, android.os.Bundle);
  }

  public static abstract class RemotePlaybackClient.SessionActionCallback extends android.support.v7.media.RemotePlaybackClient.ActionCallback {
    ctor public RemotePlaybackClient.SessionActionCallback();
    method public void onResult(android.os.Bundle, java.lang.String, android.support.v7.media.MediaSessionStatus);
  }

  public static abstract class RemotePlaybackClient.StatusCallback {
    ctor public RemotePlaybackClient.StatusCallback();
    method public void onItemStatusChanged(android.os.Bundle, java.lang.String, android.support.v7.media.MediaSessionStatus, java.lang.String, android.support.v7.media.MediaItemStatus);
    method public void onSessionChanged(java.lang.String);
    method public void onSessionStatusChanged(android.os.Bundle, java.lang.String, android.support.v7.media.MediaSessionStatus);
  }

}

package android.support.v7.preference {

  public class CheckBoxPreference extends android.support.v7.preference.TwoStatePreference {
    ctor public CheckBoxPreference(android.content.Context, android.util.AttributeSet, int);
    ctor public CheckBoxPreference(android.content.Context, android.util.AttributeSet, int, int);
    ctor public CheckBoxPreference(android.content.Context, android.util.AttributeSet);
    ctor public CheckBoxPreference(android.content.Context);
  }

  public abstract class DialogPreference extends android.support.v7.preference.Preference {
    ctor public DialogPreference(android.content.Context, android.util.AttributeSet, int, int);
    ctor public DialogPreference(android.content.Context, android.util.AttributeSet, int);
    ctor public DialogPreference(android.content.Context, android.util.AttributeSet);
    ctor public DialogPreference(android.content.Context);
    method public android.graphics.drawable.Drawable getDialogIcon();
    method public int getDialogLayoutResource();
    method public java.lang.CharSequence getDialogMessage();
    method public java.lang.CharSequence getDialogTitle();
    method public java.lang.CharSequence getNegativeButtonText();
    method public java.lang.CharSequence getPositiveButtonText();
    method public void setDialogIcon(android.graphics.drawable.Drawable);
    method public void setDialogIcon(int);
    method public void setDialogLayoutResource(int);
    method public void setDialogMessage(java.lang.CharSequence);
    method public void setDialogMessage(int);
    method public void setDialogTitle(java.lang.CharSequence);
    method public void setDialogTitle(int);
    method public void setNegativeButtonText(java.lang.CharSequence);
    method public void setNegativeButtonText(int);
    method public void setPositiveButtonText(java.lang.CharSequence);
    method public void setPositiveButtonText(int);
  }

  public static abstract interface DialogPreference.TargetFragment {
    method public abstract android.support.v7.preference.Preference findPreference(java.lang.CharSequence);
  }

  public class DropDownPreference extends android.support.v7.preference.ListPreference {
    ctor public DropDownPreference(android.content.Context);
    ctor public DropDownPreference(android.content.Context, android.util.AttributeSet);
    ctor public DropDownPreference(android.content.Context, android.util.AttributeSet, int);
    ctor public DropDownPreference(android.content.Context, android.util.AttributeSet, int, int);
    method protected android.widget.ArrayAdapter createAdapter();
  }

  public class EditTextPreference extends android.support.v7.preference.DialogPreference {
    ctor public EditTextPreference(android.content.Context, android.util.AttributeSet, int, int);
    ctor public EditTextPreference(android.content.Context, android.util.AttributeSet, int);
    ctor public EditTextPreference(android.content.Context, android.util.AttributeSet);
    ctor public EditTextPreference(android.content.Context);
    method public java.lang.String getText();
    method public void setText(java.lang.String);
  }

  public class EditTextPreferenceDialogFragmentCompat extends android.support.v7.preference.PreferenceDialogFragmentCompat {
    ctor public EditTextPreferenceDialogFragmentCompat();
    method public static android.support.v7.preference.EditTextPreferenceDialogFragmentCompat newInstance(java.lang.String);
    method public void onDialogClosed(boolean);
  }

  public class ListPreference extends android.support.v7.preference.DialogPreference {
    ctor public ListPreference(android.content.Context, android.util.AttributeSet, int, int);
    ctor public ListPreference(android.content.Context, android.util.AttributeSet, int);
    ctor public ListPreference(android.content.Context, android.util.AttributeSet);
    ctor public ListPreference(android.content.Context);
    method public int findIndexOfValue(java.lang.String);
    method public java.lang.CharSequence[] getEntries();
    method public java.lang.CharSequence getEntry();
    method public java.lang.CharSequence[] getEntryValues();
    method public java.lang.String getValue();
    method public void setEntries(java.lang.CharSequence[]);
    method public void setEntries(int);
    method public void setEntryValues(java.lang.CharSequence[]);
    method public void setEntryValues(int);
    method public void setValue(java.lang.String);
    method public void setValueIndex(int);
  }

  public class ListPreferenceDialogFragmentCompat extends android.support.v7.preference.PreferenceDialogFragmentCompat {
    ctor public ListPreferenceDialogFragmentCompat();
    method public static android.support.v7.preference.ListPreferenceDialogFragmentCompat newInstance(java.lang.String);
    method public void onDialogClosed(boolean);
  }

  public class MultiSelectListPreferenceDialogFragmentCompat extends android.support.v7.preference.PreferenceDialogFragmentCompat {
    ctor public MultiSelectListPreferenceDialogFragmentCompat();
    method public static android.support.v7.preference.MultiSelectListPreferenceDialogFragmentCompat newInstance(java.lang.String);
    method public void onDialogClosed(boolean);
  }

  public class Preference implements java.lang.Comparable {
    ctor public Preference(android.content.Context, android.util.AttributeSet, int, int);
    ctor public Preference(android.content.Context, android.util.AttributeSet, int);
    ctor public Preference(android.content.Context, android.util.AttributeSet);
    ctor public Preference(android.content.Context);
    method public boolean callChangeListener(java.lang.Object);
    method public int compareTo(android.support.v7.preference.Preference);
    method protected android.support.v7.preference.Preference findPreferenceInHierarchy(java.lang.String);
    method public android.content.Context getContext();
    method public java.lang.String getDependency();
    method public android.os.Bundle getExtras();
    method public java.lang.String getFragment();
    method public android.graphics.drawable.Drawable getIcon();
    method public android.content.Intent getIntent();
    method public java.lang.String getKey();
    method public final int getLayoutResource();
    method public android.support.v7.preference.Preference.OnPreferenceChangeListener getOnPreferenceChangeListener();
    method public android.support.v7.preference.Preference.OnPreferenceClickListener getOnPreferenceClickListener();
    method public int getOrder();
    method public android.support.v7.preference.PreferenceGroup getParent();
    method protected boolean getPersistedBoolean(boolean);
    method protected float getPersistedFloat(float);
    method protected int getPersistedInt(int);
    method protected long getPersistedLong(long);
    method protected java.lang.String getPersistedString(java.lang.String);
    method public java.util.Set<java.lang.String> getPersistedStringSet(java.util.Set<java.lang.String>);
    method public android.support.v7.preference.PreferenceDataStore getPreferenceDataStore();
    method public android.support.v7.preference.PreferenceManager getPreferenceManager();
    method public android.content.SharedPreferences getSharedPreferences();
    method public boolean getShouldDisableView();
    method public java.lang.CharSequence getSummary();
    method public java.lang.CharSequence getTitle();
    method public final int getWidgetLayoutResource();
    method public boolean hasKey();
    method public boolean isEnabled();
    method public boolean isIconSpaceReserved();
    method public boolean isPersistent();
    method public boolean isSelectable();
    method public boolean isSingleLineTitle();
    method public final boolean isVisible();
    method protected void notifyChanged();
    method public void notifyDependencyChange(boolean);
    method protected void notifyHierarchyChanged();
    method public void onAttached();
    method protected void onAttachedToHierarchy(android.support.v7.preference.PreferenceManager);
    method public void onBindViewHolder(android.support.v7.preference.PreferenceViewHolder);
    method protected void onClick();
    method public void onDependencyChanged(android.support.v7.preference.Preference, boolean);
    method public void onDetached();
    method protected java.lang.Object onGetDefaultValue(android.content.res.TypedArray, int);
    method public void onInitializeAccessibilityNodeInfo(android.support.v4.view.accessibility.AccessibilityNodeInfoCompat);
    method public void onParentChanged(android.support.v7.preference.Preference, boolean);
    method protected void onPrepareForRemoval();
    method protected void onRestoreInstanceState(android.os.Parcelable);
    method protected android.os.Parcelable onSaveInstanceState();
    method protected void onSetInitialValue(boolean, java.lang.Object);
    method public android.os.Bundle peekExtras();
    method protected boolean persistBoolean(boolean);
    method protected boolean persistFloat(float);
    method protected boolean persistInt(int);
    method protected boolean persistLong(long);
    method protected boolean persistString(java.lang.String);
    method public boolean persistStringSet(java.util.Set<java.lang.String>);
    method public void restoreHierarchyState(android.os.Bundle);
    method public void saveHierarchyState(android.os.Bundle);
    method public void setDefaultValue(java.lang.Object);
    method public void setDependency(java.lang.String);
    method public void setEnabled(boolean);
    method public void setFragment(java.lang.String);
    method public void setIcon(android.graphics.drawable.Drawable);
    method public void setIcon(int);
    method public void setIconSpaceReserved(boolean);
    method public void setIntent(android.content.Intent);
    method public void setKey(java.lang.String);
    method public void setLayoutResource(int);
    method public void setOnPreferenceChangeListener(android.support.v7.preference.Preference.OnPreferenceChangeListener);
    method public void setOnPreferenceClickListener(android.support.v7.preference.Preference.OnPreferenceClickListener);
    method public void setOrder(int);
    method public void setPersistent(boolean);
    method public void setPreferenceDataStore(android.support.v7.preference.PreferenceDataStore);
    method public void setSelectable(boolean);
    method public void setShouldDisableView(boolean);
    method public void setSingleLineTitle(boolean);
    method public void setSummary(java.lang.CharSequence);
    method public void setSummary(int);
    method public void setTitle(java.lang.CharSequence);
    method public void setTitle(int);
    method public void setViewId(int);
    method public final void setVisible(boolean);
    method public void setWidgetLayoutResource(int);
    method public boolean shouldDisableDependents();
    method protected boolean shouldPersist();
    field public static final int DEFAULT_ORDER = 2147483647; // 0x7fffffff
  }

  public static class Preference.BaseSavedState extends android.view.AbsSavedState {
    ctor public Preference.BaseSavedState(android.os.Parcel);
    ctor public Preference.BaseSavedState(android.os.Parcelable);
    field public static final android.os.Parcelable.Creator<android.support.v7.preference.Preference.BaseSavedState> CREATOR;
  }

  public static abstract interface Preference.OnPreferenceChangeListener {
    method public abstract boolean onPreferenceChange(android.support.v7.preference.Preference, java.lang.Object);
  }

  public static abstract interface Preference.OnPreferenceClickListener {
    method public abstract boolean onPreferenceClick(android.support.v7.preference.Preference);
  }

  public class PreferenceCategory extends android.support.v7.preference.PreferenceGroup {
    ctor public PreferenceCategory(android.content.Context, android.util.AttributeSet, int, int);
    ctor public PreferenceCategory(android.content.Context, android.util.AttributeSet, int);
    ctor public PreferenceCategory(android.content.Context, android.util.AttributeSet);
    ctor public PreferenceCategory(android.content.Context);
  }

  public abstract class PreferenceDataStore {
    ctor public PreferenceDataStore();
    method public boolean getBoolean(java.lang.String, boolean);
    method public float getFloat(java.lang.String, float);
    method public int getInt(java.lang.String, int);
    method public long getLong(java.lang.String, long);
    method public java.lang.String getString(java.lang.String, java.lang.String);
    method public java.util.Set<java.lang.String> getStringSet(java.lang.String, java.util.Set<java.lang.String>);
    method public void putBoolean(java.lang.String, boolean);
    method public void putFloat(java.lang.String, float);
    method public void putInt(java.lang.String, int);
    method public void putLong(java.lang.String, long);
    method public void putString(java.lang.String, java.lang.String);
    method public void putStringSet(java.lang.String, java.util.Set<java.lang.String>);
  }

  public abstract class PreferenceDialogFragmentCompat extends android.support.v4.app.DialogFragment implements android.content.DialogInterface.OnClickListener {
    ctor public PreferenceDialogFragmentCompat();
    method public android.support.v7.preference.DialogPreference getPreference();
    method protected void onBindDialogView(android.view.View);
    method public void onClick(android.content.DialogInterface, int);
    method protected android.view.View onCreateDialogView(android.content.Context);
    method public abstract void onDialogClosed(boolean);
    method protected void onPrepareDialogBuilder(android.support.v7.app.AlertDialog.Builder);
    field protected static final java.lang.String ARG_KEY = "key";
  }

  public abstract class PreferenceFragmentCompat extends android.support.v4.app.Fragment implements android.support.v7.preference.DialogPreference.TargetFragment android.support.v7.preference.PreferenceManager.OnDisplayPreferenceDialogListener android.support.v7.preference.PreferenceManager.OnNavigateToScreenListener android.support.v7.preference.PreferenceManager.OnPreferenceTreeClickListener {
    ctor public PreferenceFragmentCompat();
    method public void addPreferencesFromResource(int);
    method public android.support.v7.preference.Preference findPreference(java.lang.CharSequence);
    method public final android.support.v7.widget.RecyclerView getListView();
    method public android.support.v7.preference.PreferenceManager getPreferenceManager();
    method public android.support.v7.preference.PreferenceScreen getPreferenceScreen();
    method protected android.support.v7.widget.RecyclerView.Adapter onCreateAdapter(android.support.v7.preference.PreferenceScreen);
    method public android.support.v7.widget.RecyclerView.LayoutManager onCreateLayoutManager();
    method public abstract void onCreatePreferences(android.os.Bundle, java.lang.String);
    method public android.support.v7.widget.RecyclerView onCreateRecyclerView(android.view.LayoutInflater, android.view.ViewGroup, android.os.Bundle);
    method public void onDisplayPreferenceDialog(android.support.v7.preference.Preference);
    method public void onNavigateToScreen(android.support.v7.preference.PreferenceScreen);
    method public boolean onPreferenceTreeClick(android.support.v7.preference.Preference);
    method public void scrollToPreference(java.lang.String);
    method public void scrollToPreference(android.support.v7.preference.Preference);
    method public void setDivider(android.graphics.drawable.Drawable);
    method public void setDividerHeight(int);
    method public void setPreferenceScreen(android.support.v7.preference.PreferenceScreen);
    method public void setPreferencesFromResource(int, java.lang.String);
    field public static final java.lang.String ARG_PREFERENCE_ROOT = "android.support.v7.preference.PreferenceFragmentCompat.PREFERENCE_ROOT";
  }

  public static abstract interface PreferenceFragmentCompat.OnPreferenceDisplayDialogCallback {
    method public abstract boolean onPreferenceDisplayDialog(android.support.v7.preference.PreferenceFragmentCompat, android.support.v7.preference.Preference);
  }

  public static abstract interface PreferenceFragmentCompat.OnPreferenceStartFragmentCallback {
    method public abstract boolean onPreferenceStartFragment(android.support.v7.preference.PreferenceFragmentCompat, android.support.v7.preference.Preference);
  }

  public static abstract interface PreferenceFragmentCompat.OnPreferenceStartScreenCallback {
    method public abstract boolean onPreferenceStartScreen(android.support.v7.preference.PreferenceFragmentCompat, android.support.v7.preference.PreferenceScreen);
  }

  public abstract class PreferenceGroup extends android.support.v7.preference.Preference {
    ctor public PreferenceGroup(android.content.Context, android.util.AttributeSet, int, int);
    ctor public PreferenceGroup(android.content.Context, android.util.AttributeSet, int);
    ctor public PreferenceGroup(android.content.Context, android.util.AttributeSet);
    method public void addItemFromInflater(android.support.v7.preference.Preference);
    method public boolean addPreference(android.support.v7.preference.Preference);
    method protected void dispatchRestoreInstanceState(android.os.Bundle);
    method protected void dispatchSaveInstanceState(android.os.Bundle);
    method public android.support.v7.preference.Preference findPreference(java.lang.CharSequence);
    method public android.support.v7.preference.Preference getPreference(int);
    method public int getPreferenceCount();
    method protected boolean isOnSameScreenAsChildren();
    method public boolean isOrderingAsAdded();
    method protected boolean onPrepareAddPreference(android.support.v7.preference.Preference);
    method public void removeAll();
    method public boolean removePreference(android.support.v7.preference.Preference);
    method public void setOrderingAsAdded(boolean);
  }

  public static abstract interface PreferenceGroup.PreferencePositionCallback {
    method public abstract int getPreferenceAdapterPosition(java.lang.String);
    method public abstract int getPreferenceAdapterPosition(android.support.v7.preference.Preference);
  }

  public class PreferenceManager {
    method public android.support.v7.preference.PreferenceScreen createPreferenceScreen(android.content.Context);
    method public android.support.v7.preference.Preference findPreference(java.lang.CharSequence);
    method public android.content.Context getContext();
    method public static android.content.SharedPreferences getDefaultSharedPreferences(android.content.Context);
    method public android.support.v7.preference.PreferenceManager.OnDisplayPreferenceDialogListener getOnDisplayPreferenceDialogListener();
    method public android.support.v7.preference.PreferenceManager.OnNavigateToScreenListener getOnNavigateToScreenListener();
    method public android.support.v7.preference.PreferenceManager.OnPreferenceTreeClickListener getOnPreferenceTreeClickListener();
    method public android.support.v7.preference.PreferenceManager.PreferenceComparisonCallback getPreferenceComparisonCallback();
    method public android.support.v7.preference.PreferenceDataStore getPreferenceDataStore();
    method public android.support.v7.preference.PreferenceScreen getPreferenceScreen();
    method public android.content.SharedPreferences getSharedPreferences();
    method public int getSharedPreferencesMode();
    method public java.lang.String getSharedPreferencesName();
    method public boolean isStorageDefault();
    method public boolean isStorageDeviceProtected();
    method public static void setDefaultValues(android.content.Context, int, boolean);
    method public static void setDefaultValues(android.content.Context, java.lang.String, int, int, boolean);
    method public void setOnDisplayPreferenceDialogListener(android.support.v7.preference.PreferenceManager.OnDisplayPreferenceDialogListener);
    method public void setOnNavigateToScreenListener(android.support.v7.preference.PreferenceManager.OnNavigateToScreenListener);
    method public void setOnPreferenceTreeClickListener(android.support.v7.preference.PreferenceManager.OnPreferenceTreeClickListener);
    method public void setPreferenceComparisonCallback(android.support.v7.preference.PreferenceManager.PreferenceComparisonCallback);
    method public void setPreferenceDataStore(android.support.v7.preference.PreferenceDataStore);
    method public boolean setPreferences(android.support.v7.preference.PreferenceScreen);
    method public void setSharedPreferencesMode(int);
    method public void setSharedPreferencesName(java.lang.String);
    method public void setStorageDefault();
    method public void setStorageDeviceProtected();
    method public void showDialog(android.support.v7.preference.Preference);
    field public static final java.lang.String KEY_HAS_SET_DEFAULT_VALUES = "_has_set_default_values";
  }

  public static abstract interface PreferenceManager.OnDisplayPreferenceDialogListener {
    method public abstract void onDisplayPreferenceDialog(android.support.v7.preference.Preference);
  }

  public static abstract interface PreferenceManager.OnNavigateToScreenListener {
    method public abstract void onNavigateToScreen(android.support.v7.preference.PreferenceScreen);
  }

  public static abstract interface PreferenceManager.OnPreferenceTreeClickListener {
    method public abstract boolean onPreferenceTreeClick(android.support.v7.preference.Preference);
  }

  public static abstract class PreferenceManager.PreferenceComparisonCallback {
    ctor public PreferenceManager.PreferenceComparisonCallback();
    method public abstract boolean arePreferenceContentsTheSame(android.support.v7.preference.Preference, android.support.v7.preference.Preference);
    method public abstract boolean arePreferenceItemsTheSame(android.support.v7.preference.Preference, android.support.v7.preference.Preference);
  }

  public static class PreferenceManager.SimplePreferenceComparisonCallback extends android.support.v7.preference.PreferenceManager.PreferenceComparisonCallback {
    ctor public PreferenceManager.SimplePreferenceComparisonCallback();
    method public boolean arePreferenceContentsTheSame(android.support.v7.preference.Preference, android.support.v7.preference.Preference);
    method public boolean arePreferenceItemsTheSame(android.support.v7.preference.Preference, android.support.v7.preference.Preference);
  }

  public final class PreferenceScreen extends android.support.v7.preference.PreferenceGroup {
    method public void setShouldUseGeneratedIds(boolean);
    method public boolean shouldUseGeneratedIds();
  }

  public class PreferenceViewHolder extends android.support.v7.widget.RecyclerView.ViewHolder {
    method public android.view.View findViewById(int);
    method public boolean isDividerAllowedAbove();
    method public boolean isDividerAllowedBelow();
    method public void setDividerAllowedAbove(boolean);
    method public void setDividerAllowedBelow(boolean);
  }

  public class SeekBarPreference extends android.support.v7.preference.Preference {
    ctor public SeekBarPreference(android.content.Context, android.util.AttributeSet, int, int);
    ctor public SeekBarPreference(android.content.Context, android.util.AttributeSet, int);
    ctor public SeekBarPreference(android.content.Context, android.util.AttributeSet);
    ctor public SeekBarPreference(android.content.Context);
    method public int getMax();
    method public int getMin();
    method public final int getSeekBarIncrement();
    method public int getValue();
    method public boolean isAdjustable();
    method public void setAdjustable(boolean);
    method public final void setMax(int);
    method public void setMin(int);
    method public final void setSeekBarIncrement(int);
    method public void setValue(int);
  }

  public class SwitchPreferenceCompat extends android.support.v7.preference.TwoStatePreference {
    ctor public SwitchPreferenceCompat(android.content.Context, android.util.AttributeSet, int, int);
    ctor public SwitchPreferenceCompat(android.content.Context, android.util.AttributeSet, int);
    ctor public SwitchPreferenceCompat(android.content.Context, android.util.AttributeSet);
    ctor public SwitchPreferenceCompat(android.content.Context);
    method public java.lang.CharSequence getSwitchTextOff();
    method public java.lang.CharSequence getSwitchTextOn();
    method public void setSwitchTextOff(java.lang.CharSequence);
    method public void setSwitchTextOff(int);
    method public void setSwitchTextOn(java.lang.CharSequence);
    method public void setSwitchTextOn(int);
  }

  public abstract class TwoStatePreference extends android.support.v7.preference.Preference {
    ctor public TwoStatePreference(android.content.Context, android.util.AttributeSet, int, int);
    ctor public TwoStatePreference(android.content.Context, android.util.AttributeSet, int);
    ctor public TwoStatePreference(android.content.Context, android.util.AttributeSet);
    ctor public TwoStatePreference(android.content.Context);
    method public boolean getDisableDependentsState();
    method public java.lang.CharSequence getSummaryOff();
    method public java.lang.CharSequence getSummaryOn();
    method public boolean isChecked();
    method public void setChecked(boolean);
    method public void setDisableDependentsState(boolean);
    method public void setSummaryOff(java.lang.CharSequence);
    method public void setSummaryOff(int);
    method public void setSummaryOn(java.lang.CharSequence);
    method public void setSummaryOn(int);
    method protected void syncSummaryView(android.support.v7.preference.PreferenceViewHolder);
    field protected boolean mChecked;
  }

}

package android.support.v7.util {

  public class AsyncListUtil<T> {
    ctor public AsyncListUtil(java.lang.Class<T>, int, android.support.v7.util.AsyncListUtil.DataCallback<T>, android.support.v7.util.AsyncListUtil.ViewCallback);
    method public T getItem(int);
    method public int getItemCount();
    method public void onRangeChanged();
    method public void refresh();
  }

  public static abstract class AsyncListUtil.DataCallback<T> {
    ctor public AsyncListUtil.DataCallback();
    method public abstract void fillData(T[], int, int);
    method public int getMaxCachedTiles();
    method public void recycleData(T[], int);
    method public abstract int refreshData();
  }

  public static abstract class AsyncListUtil.ViewCallback {
    ctor public AsyncListUtil.ViewCallback();
    method public void extendRangeInto(int[], int[], int);
    method public abstract void getItemRangeInto(int[]);
    method public abstract void onDataRefresh();
    method public abstract void onItemLoaded(int);
    field public static final int HINT_SCROLL_ASC = 2; // 0x2
    field public static final int HINT_SCROLL_DESC = 1; // 0x1
    field public static final int HINT_SCROLL_NONE = 0; // 0x0
  }

  public class BatchingListUpdateCallback implements android.support.v7.util.ListUpdateCallback {
    ctor public BatchingListUpdateCallback(android.support.v7.util.ListUpdateCallback);
    method public void dispatchLastEvent();
    method public void onChanged(int, int, java.lang.Object);
    method public void onInserted(int, int);
    method public void onMoved(int, int);
    method public void onRemoved(int, int);
  }

  public class DiffUtil {
    method public static android.support.v7.util.DiffUtil.DiffResult calculateDiff(android.support.v7.util.DiffUtil.Callback);
    method public static android.support.v7.util.DiffUtil.DiffResult calculateDiff(android.support.v7.util.DiffUtil.Callback, boolean);
  }

  public static abstract class DiffUtil.Callback {
    ctor public DiffUtil.Callback();
    method public abstract boolean areContentsTheSame(int, int);
    method public abstract boolean areItemsTheSame(int, int);
    method public java.lang.Object getChangePayload(int, int);
    method public abstract int getNewListSize();
    method public abstract int getOldListSize();
  }

  public static class DiffUtil.DiffResult {
    method public void dispatchUpdatesTo(android.support.v7.widget.RecyclerView.Adapter);
    method public void dispatchUpdatesTo(android.support.v7.util.ListUpdateCallback);
  }

  public abstract interface ListUpdateCallback {
    method public abstract void onChanged(int, int, java.lang.Object);
    method public abstract void onInserted(int, int);
    method public abstract void onMoved(int, int);
    method public abstract void onRemoved(int, int);
  }

  public class SortedList<T> {
    ctor public SortedList(java.lang.Class<T>, android.support.v7.util.SortedList.Callback<T>);
    ctor public SortedList(java.lang.Class<T>, android.support.v7.util.SortedList.Callback<T>, int);
    method public int add(T);
    method public void addAll(T[], boolean);
    method public void addAll(T...);
    method public void addAll(java.util.Collection<T>);
    method public void beginBatchedUpdates();
    method public void clear();
    method public void endBatchedUpdates();
    method public T get(int) throws java.lang.IndexOutOfBoundsException;
    method public int indexOf(T);
    method public void recalculatePositionOfItemAt(int);
    method public boolean remove(T);
    method public T removeItemAt(int);
    method public int size();
    method public void updateItemAt(int, T);
    field public static final int INVALID_POSITION = -1; // 0xffffffff
  }

  public static class SortedList.BatchedCallback<T2> extends android.support.v7.util.SortedList.Callback {
    ctor public SortedList.BatchedCallback(android.support.v7.util.SortedList.Callback<T2>);
    method public boolean areContentsTheSame(T2, T2);
    method public boolean areItemsTheSame(T2, T2);
    method public int compare(T2, T2);
    method public void dispatchLastEvent();
    method public void onChanged(int, int);
    method public void onInserted(int, int);
    method public void onMoved(int, int);
    method public void onRemoved(int, int);
  }

  public static abstract class SortedList.Callback<T2> implements java.util.Comparator android.support.v7.util.ListUpdateCallback {
    ctor public SortedList.Callback();
    method public abstract boolean areContentsTheSame(T2, T2);
    method public abstract boolean areItemsTheSame(T2, T2);
    method public abstract int compare(T2, T2);
    method public abstract void onChanged(int, int);
    method public void onChanged(int, int, java.lang.Object);
  }

}

package android.support.v7.view {

  public abstract class ActionMode {
    ctor public ActionMode();
    method public abstract void finish();
    method public abstract android.view.View getCustomView();
    method public abstract android.view.Menu getMenu();
    method public abstract android.view.MenuInflater getMenuInflater();
    method public abstract java.lang.CharSequence getSubtitle();
    method public java.lang.Object getTag();
    method public abstract java.lang.CharSequence getTitle();
    method public boolean getTitleOptionalHint();
    method public abstract void invalidate();
    method public boolean isTitleOptional();
    method public abstract void setCustomView(android.view.View);
    method public abstract void setSubtitle(java.lang.CharSequence);
    method public abstract void setSubtitle(int);
    method public void setTag(java.lang.Object);
    method public abstract void setTitle(java.lang.CharSequence);
    method public abstract void setTitle(int);
    method public void setTitleOptionalHint(boolean);
  }

  public static abstract interface ActionMode.Callback {
    method public abstract boolean onActionItemClicked(android.support.v7.view.ActionMode, android.view.MenuItem);
    method public abstract boolean onCreateActionMode(android.support.v7.view.ActionMode, android.view.Menu);
    method public abstract void onDestroyActionMode(android.support.v7.view.ActionMode);
    method public abstract boolean onPrepareActionMode(android.support.v7.view.ActionMode, android.view.Menu);
  }

  public abstract interface CollapsibleActionView {
    method public abstract void onActionViewCollapsed();
    method public abstract void onActionViewExpanded();
  }

}

package android.support.v7.widget {

  public class ActionMenuView extends android.support.v7.widget.LinearLayoutCompat {
    ctor public ActionMenuView(android.content.Context);
    ctor public ActionMenuView(android.content.Context, android.util.AttributeSet);
    method public void dismissPopupMenus();
    method protected android.support.v7.widget.ActionMenuView.LayoutParams generateDefaultLayoutParams();
    method public android.support.v7.widget.ActionMenuView.LayoutParams generateLayoutParams(android.util.AttributeSet);
    method protected android.support.v7.widget.ActionMenuView.LayoutParams generateLayoutParams(android.view.ViewGroup.LayoutParams);
    method public android.view.Menu getMenu();
    method public android.graphics.drawable.Drawable getOverflowIcon();
    method public int getPopupTheme();
    method public boolean hideOverflowMenu();
    method public boolean isOverflowMenuShowing();
    method public void onConfigurationChanged(android.content.res.Configuration);
    method public void onDetachedFromWindow();
    method public void setOnMenuItemClickListener(android.support.v7.widget.ActionMenuView.OnMenuItemClickListener);
    method public void setOverflowIcon(android.graphics.drawable.Drawable);
    method public void setPopupTheme(int);
    method public boolean showOverflowMenu();
  }

  public static class ActionMenuView.LayoutParams extends android.support.v7.widget.LinearLayoutCompat.LayoutParams {
    ctor public ActionMenuView.LayoutParams(android.content.Context, android.util.AttributeSet);
    ctor public ActionMenuView.LayoutParams(android.view.ViewGroup.LayoutParams);
    ctor public ActionMenuView.LayoutParams(android.support.v7.widget.ActionMenuView.LayoutParams);
    ctor public ActionMenuView.LayoutParams(int, int);
    field public int cellsUsed;
    field public boolean expandable;
    field public int extraPixels;
    field public boolean isOverflowButton;
    field public boolean preventEdgeOffset;
  }

  public static abstract interface ActionMenuView.OnMenuItemClickListener {
    method public abstract boolean onMenuItemClick(android.view.MenuItem);
  }

  public class AppCompatAutoCompleteTextView extends android.widget.AutoCompleteTextView implements android.support.v4.view.TintableBackgroundView {
    ctor public AppCompatAutoCompleteTextView(android.content.Context);
    ctor public AppCompatAutoCompleteTextView(android.content.Context, android.util.AttributeSet);
    ctor public AppCompatAutoCompleteTextView(android.content.Context, android.util.AttributeSet, int);
    method public void setBackgroundDrawable(android.graphics.drawable.Drawable);
    method public void setTextAppearance(android.content.Context, int);
  }

  public class AppCompatButton extends android.widget.Button implements android.support.v4.view.TintableBackgroundView {
    ctor public AppCompatButton(android.content.Context);
    ctor public AppCompatButton(android.content.Context, android.util.AttributeSet);
    ctor public AppCompatButton(android.content.Context, android.util.AttributeSet, int);
    method public void setBackgroundDrawable(android.graphics.drawable.Drawable);
    method public void setSupportAllCaps(boolean);
    method public void setTextAppearance(android.content.Context, int);
  }

  public class AppCompatCheckBox extends android.widget.CheckBox implements android.support.v4.widget.TintableCompoundButton {
    ctor public AppCompatCheckBox(android.content.Context);
    ctor public AppCompatCheckBox(android.content.Context, android.util.AttributeSet);
    ctor public AppCompatCheckBox(android.content.Context, android.util.AttributeSet, int);
  }

  public class AppCompatCheckedTextView extends android.widget.CheckedTextView {
    ctor public AppCompatCheckedTextView(android.content.Context);
    ctor public AppCompatCheckedTextView(android.content.Context, android.util.AttributeSet);
    ctor public AppCompatCheckedTextView(android.content.Context, android.util.AttributeSet, int);
    method public void setTextAppearance(android.content.Context, int);
  }

  public class AppCompatEditText extends android.widget.EditText implements android.support.v4.view.TintableBackgroundView {
    ctor public AppCompatEditText(android.content.Context);
    ctor public AppCompatEditText(android.content.Context, android.util.AttributeSet);
    ctor public AppCompatEditText(android.content.Context, android.util.AttributeSet, int);
    method public void setBackgroundDrawable(android.graphics.drawable.Drawable);
    method public void setTextAppearance(android.content.Context, int);
  }

  public class AppCompatImageButton extends android.widget.ImageButton implements android.support.v4.view.TintableBackgroundView {
    ctor public AppCompatImageButton(android.content.Context);
    ctor public AppCompatImageButton(android.content.Context, android.util.AttributeSet);
    ctor public AppCompatImageButton(android.content.Context, android.util.AttributeSet, int);
    method public void setBackgroundDrawable(android.graphics.drawable.Drawable);
  }

  public class AppCompatImageView extends android.widget.ImageView implements android.support.v4.view.TintableBackgroundView {
    ctor public AppCompatImageView(android.content.Context);
    ctor public AppCompatImageView(android.content.Context, android.util.AttributeSet);
    ctor public AppCompatImageView(android.content.Context, android.util.AttributeSet, int);
    method public void setBackgroundDrawable(android.graphics.drawable.Drawable);
  }

  public class AppCompatMultiAutoCompleteTextView extends android.widget.MultiAutoCompleteTextView implements android.support.v4.view.TintableBackgroundView {
    ctor public AppCompatMultiAutoCompleteTextView(android.content.Context);
    ctor public AppCompatMultiAutoCompleteTextView(android.content.Context, android.util.AttributeSet);
    ctor public AppCompatMultiAutoCompleteTextView(android.content.Context, android.util.AttributeSet, int);
    method public void setBackgroundDrawable(android.graphics.drawable.Drawable);
    method public void setTextAppearance(android.content.Context, int);
  }

  public class AppCompatRadioButton extends android.widget.RadioButton implements android.support.v4.widget.TintableCompoundButton {
    ctor public AppCompatRadioButton(android.content.Context);
    ctor public AppCompatRadioButton(android.content.Context, android.util.AttributeSet);
    ctor public AppCompatRadioButton(android.content.Context, android.util.AttributeSet, int);
  }

  public class AppCompatRatingBar extends android.widget.RatingBar {
    ctor public AppCompatRatingBar(android.content.Context);
    ctor public AppCompatRatingBar(android.content.Context, android.util.AttributeSet);
    ctor public AppCompatRatingBar(android.content.Context, android.util.AttributeSet, int);
  }

  public class AppCompatSeekBar extends android.widget.SeekBar {
    ctor public AppCompatSeekBar(android.content.Context);
    ctor public AppCompatSeekBar(android.content.Context, android.util.AttributeSet);
    ctor public AppCompatSeekBar(android.content.Context, android.util.AttributeSet, int);
  }

  public class AppCompatSpinner extends android.widget.Spinner implements android.support.v4.view.TintableBackgroundView {
    ctor public AppCompatSpinner(android.content.Context);
    ctor public AppCompatSpinner(android.content.Context, int);
    ctor public AppCompatSpinner(android.content.Context, android.util.AttributeSet);
    ctor public AppCompatSpinner(android.content.Context, android.util.AttributeSet, int);
    ctor public AppCompatSpinner(android.content.Context, android.util.AttributeSet, int, int);
    ctor public AppCompatSpinner(android.content.Context, android.util.AttributeSet, int, int, android.content.res.Resources.Theme);
    method public void setBackgroundDrawable(android.graphics.drawable.Drawable);
  }

  public class AppCompatTextView extends android.widget.TextView implements android.support.v4.view.TintableBackgroundView {
    ctor public AppCompatTextView(android.content.Context);
    ctor public AppCompatTextView(android.content.Context, android.util.AttributeSet);
    ctor public AppCompatTextView(android.content.Context, android.util.AttributeSet, int);
    method public void setBackgroundDrawable(android.graphics.drawable.Drawable);
    method public void setTextAppearance(android.content.Context, int);
  }

  public class CardView extends android.widget.FrameLayout {
    ctor public CardView(android.content.Context);
    ctor public CardView(android.content.Context, android.util.AttributeSet);
    ctor public CardView(android.content.Context, android.util.AttributeSet, int);
    method public android.content.res.ColorStateList getCardBackgroundColor();
    method public float getCardElevation();
    method public int getContentPaddingBottom();
    method public int getContentPaddingLeft();
    method public int getContentPaddingRight();
    method public int getContentPaddingTop();
    method public float getMaxCardElevation();
    method public boolean getPreventCornerOverlap();
    method public float getRadius();
    method public boolean getUseCompatPadding();
    method public void setCardBackgroundColor(int);
    method public void setCardBackgroundColor(android.content.res.ColorStateList);
    method public void setCardElevation(float);
    method public void setContentPadding(int, int, int, int);
    method public void setMaxCardElevation(float);
    method public void setPreventCornerOverlap(boolean);
    method public void setRadius(float);
    method public void setUseCompatPadding(boolean);
  }

  public class DefaultItemAnimator extends android.support.v7.widget.SimpleItemAnimator {
    ctor public DefaultItemAnimator();
    method public boolean animateAdd(android.support.v7.widget.RecyclerView.ViewHolder);
    method public boolean animateChange(android.support.v7.widget.RecyclerView.ViewHolder, android.support.v7.widget.RecyclerView.ViewHolder, int, int, int, int);
    method public boolean animateMove(android.support.v7.widget.RecyclerView.ViewHolder, int, int, int, int);
    method public boolean animateRemove(android.support.v7.widget.RecyclerView.ViewHolder);
    method public void endAnimation(android.support.v7.widget.RecyclerView.ViewHolder);
    method public void endAnimations();
    method public boolean isRunning();
    method public void runPendingAnimations();
  }

  public class DividerItemDecoration extends android.support.v7.widget.RecyclerView.ItemDecoration {
    ctor public DividerItemDecoration(android.content.Context, int);
    method public void setDrawable(android.graphics.drawable.Drawable);
    method public void setOrientation(int);
    field public static final int HORIZONTAL = 0; // 0x0
    field public static final int VERTICAL = 1; // 0x1
  }

  public class GridLayout extends android.view.ViewGroup {
    ctor public GridLayout(android.content.Context, android.util.AttributeSet, int);
    ctor public GridLayout(android.content.Context, android.util.AttributeSet);
    ctor public GridLayout(android.content.Context);
    method protected android.support.v7.widget.GridLayout.LayoutParams generateDefaultLayoutParams();
    method public android.support.v7.widget.GridLayout.LayoutParams generateLayoutParams(android.util.AttributeSet);
    method protected android.support.v7.widget.GridLayout.LayoutParams generateLayoutParams(android.view.ViewGroup.LayoutParams);
    method public int getAlignmentMode();
    method public int getColumnCount();
    method public int getOrientation();
    method public android.util.Printer getPrinter();
    method public int getRowCount();
    method public boolean getUseDefaultMargins();
    method public boolean isColumnOrderPreserved();
    method public boolean isRowOrderPreserved();
    method protected void onLayout(boolean, int, int, int, int);
    method public void setAlignmentMode(int);
    method public void setColumnCount(int);
    method public void setColumnOrderPreserved(boolean);
    method public void setOrientation(int);
    method public void setPrinter(android.util.Printer);
    method public void setRowCount(int);
    method public void setRowOrderPreserved(boolean);
    method public void setUseDefaultMargins(boolean);
    method public static android.support.v7.widget.GridLayout.Spec spec(int, int, android.support.v7.widget.GridLayout.Alignment, float);
    method public static android.support.v7.widget.GridLayout.Spec spec(int, android.support.v7.widget.GridLayout.Alignment, float);
    method public static android.support.v7.widget.GridLayout.Spec spec(int, int, float);
    method public static android.support.v7.widget.GridLayout.Spec spec(int, float);
    method public static android.support.v7.widget.GridLayout.Spec spec(int, int, android.support.v7.widget.GridLayout.Alignment);
    method public static android.support.v7.widget.GridLayout.Spec spec(int, android.support.v7.widget.GridLayout.Alignment);
    method public static android.support.v7.widget.GridLayout.Spec spec(int, int);
    method public static android.support.v7.widget.GridLayout.Spec spec(int);
    field public static final int ALIGN_BOUNDS = 0; // 0x0
    field public static final int ALIGN_MARGINS = 1; // 0x1
    field public static final android.support.v7.widget.GridLayout.Alignment BASELINE;
    field public static final android.support.v7.widget.GridLayout.Alignment BOTTOM;
    field public static final android.support.v7.widget.GridLayout.Alignment CENTER;
    field public static final android.support.v7.widget.GridLayout.Alignment END;
    field public static final android.support.v7.widget.GridLayout.Alignment FILL;
    field public static final int HORIZONTAL = 0; // 0x0
    field public static final android.support.v7.widget.GridLayout.Alignment LEFT;
    field public static final android.support.v7.widget.GridLayout.Alignment RIGHT;
    field public static final android.support.v7.widget.GridLayout.Alignment START;
    field public static final android.support.v7.widget.GridLayout.Alignment TOP;
    field public static final int UNDEFINED = -2147483648; // 0x80000000
    field public static final int VERTICAL = 1; // 0x1
  }

  public static abstract class GridLayout.Alignment {
  }

  public static class GridLayout.LayoutParams extends android.view.ViewGroup.MarginLayoutParams {
    ctor public GridLayout.LayoutParams(android.support.v7.widget.GridLayout.Spec, android.support.v7.widget.GridLayout.Spec);
    ctor public GridLayout.LayoutParams();
    ctor public GridLayout.LayoutParams(android.view.ViewGroup.LayoutParams);
    ctor public GridLayout.LayoutParams(android.view.ViewGroup.MarginLayoutParams);
    ctor public GridLayout.LayoutParams(android.support.v7.widget.GridLayout.LayoutParams);
    ctor public GridLayout.LayoutParams(android.content.Context, android.util.AttributeSet);
    method public void setGravity(int);
    field public android.support.v7.widget.GridLayout.Spec columnSpec;
    field public android.support.v7.widget.GridLayout.Spec rowSpec;
  }

  public static class GridLayout.Spec {
    method public android.support.v7.widget.GridLayout.Alignment getAbsoluteAlignment(boolean);
  }

  public class GridLayoutManager extends android.support.v7.widget.LinearLayoutManager {
    ctor public GridLayoutManager(android.content.Context, android.util.AttributeSet, int, int);
    ctor public GridLayoutManager(android.content.Context, int);
    ctor public GridLayoutManager(android.content.Context, int, int, boolean);
    method public int getSpanCount();
    method public android.support.v7.widget.GridLayoutManager.SpanSizeLookup getSpanSizeLookup();
    method public void setSpanCount(int);
    method public void setSpanSizeLookup(android.support.v7.widget.GridLayoutManager.SpanSizeLookup);
    field public static final int DEFAULT_SPAN_COUNT = -1; // 0xffffffff
  }

  public static final class GridLayoutManager.DefaultSpanSizeLookup extends android.support.v7.widget.GridLayoutManager.SpanSizeLookup {
    ctor public GridLayoutManager.DefaultSpanSizeLookup();
    method public int getSpanSize(int);
  }

  public static class GridLayoutManager.LayoutParams extends android.support.v7.widget.RecyclerView.LayoutParams {
    ctor public GridLayoutManager.LayoutParams(android.content.Context, android.util.AttributeSet);
    ctor public GridLayoutManager.LayoutParams(int, int);
    ctor public GridLayoutManager.LayoutParams(android.view.ViewGroup.MarginLayoutParams);
    ctor public GridLayoutManager.LayoutParams(android.view.ViewGroup.LayoutParams);
    ctor public GridLayoutManager.LayoutParams(android.support.v7.widget.RecyclerView.LayoutParams);
    method public int getSpanIndex();
    method public int getSpanSize();
    field public static final int INVALID_SPAN_ID = -1; // 0xffffffff
  }

  public static abstract class GridLayoutManager.SpanSizeLookup {
    ctor public GridLayoutManager.SpanSizeLookup();
    method public int getSpanGroupIndex(int, int);
    method public int getSpanIndex(int, int);
    method public abstract int getSpanSize(int);
    method public void invalidateSpanIndexCache();
    method public boolean isSpanIndexCacheEnabled();
    method public void setSpanIndexCacheEnabled(boolean);
  }

  public class LinearLayoutCompat extends android.view.ViewGroup {
    ctor public LinearLayoutCompat(android.content.Context);
    ctor public LinearLayoutCompat(android.content.Context, android.util.AttributeSet);
    ctor public LinearLayoutCompat(android.content.Context, android.util.AttributeSet, int);
    method protected android.support.v7.widget.LinearLayoutCompat.LayoutParams generateDefaultLayoutParams();
    method public android.support.v7.widget.LinearLayoutCompat.LayoutParams generateLayoutParams(android.util.AttributeSet);
    method protected android.support.v7.widget.LinearLayoutCompat.LayoutParams generateLayoutParams(android.view.ViewGroup.LayoutParams);
    method public int getBaselineAlignedChildIndex();
    method public android.graphics.drawable.Drawable getDividerDrawable();
    method public int getDividerPadding();
    method public int getGravity();
    method public int getOrientation();
    method public int getShowDividers();
    method public float getWeightSum();
    method public boolean isBaselineAligned();
    method public boolean isMeasureWithLargestChildEnabled();
    method protected void onLayout(boolean, int, int, int, int);
    method public void setBaselineAligned(boolean);
    method public void setBaselineAlignedChildIndex(int);
    method public void setDividerDrawable(android.graphics.drawable.Drawable);
    method public void setDividerPadding(int);
    method public void setGravity(int);
    method public void setHorizontalGravity(int);
    method public void setMeasureWithLargestChildEnabled(boolean);
    method public void setOrientation(int);
    method public void setShowDividers(int);
    method public void setVerticalGravity(int);
    method public void setWeightSum(float);
    field public static final int HORIZONTAL = 0; // 0x0
    field public static final int SHOW_DIVIDER_BEGINNING = 1; // 0x1
    field public static final int SHOW_DIVIDER_END = 4; // 0x4
    field public static final int SHOW_DIVIDER_MIDDLE = 2; // 0x2
    field public static final int SHOW_DIVIDER_NONE = 0; // 0x0
    field public static final int VERTICAL = 1; // 0x1
  }

  public static class LinearLayoutCompat.LayoutParams extends android.view.ViewGroup.MarginLayoutParams {
    ctor public LinearLayoutCompat.LayoutParams(android.content.Context, android.util.AttributeSet);
    ctor public LinearLayoutCompat.LayoutParams(int, int);
    ctor public LinearLayoutCompat.LayoutParams(int, int, float);
    ctor public LinearLayoutCompat.LayoutParams(android.view.ViewGroup.LayoutParams);
    ctor public LinearLayoutCompat.LayoutParams(android.view.ViewGroup.MarginLayoutParams);
    ctor public LinearLayoutCompat.LayoutParams(android.support.v7.widget.LinearLayoutCompat.LayoutParams);
    field public int gravity;
    field public float weight;
  }

  public class LinearLayoutManager extends android.support.v7.widget.RecyclerView.LayoutManager implements android.support.v7.widget.helper.ItemTouchHelper.ViewDropHandler android.support.v7.widget.RecyclerView.SmoothScroller.ScrollVectorProvider {
    ctor public LinearLayoutManager(android.content.Context);
    ctor public LinearLayoutManager(android.content.Context, int, boolean);
    ctor public LinearLayoutManager(android.content.Context, android.util.AttributeSet, int, int);
    method public android.graphics.PointF computeScrollVectorForPosition(int);
    method public int findFirstCompletelyVisibleItemPosition();
    method public int findFirstVisibleItemPosition();
    method public int findLastCompletelyVisibleItemPosition();
    method public int findLastVisibleItemPosition();
    method public android.support.v7.widget.RecyclerView.LayoutParams generateDefaultLayoutParams();
    method protected int getExtraLayoutSpace(android.support.v7.widget.RecyclerView.State);
    method public int getInitialPrefetchItemCount();
    method public int getOrientation();
    method public boolean getRecycleChildrenOnDetach();
    method public boolean getReverseLayout();
    method public boolean getStackFromEnd();
    method protected boolean isLayoutRTL();
    method public boolean isSmoothScrollbarEnabled();
    method public void scrollToPositionWithOffset(int, int);
    method public void setInitialPrefetchItemCount(int);
    method public void setOrientation(int);
    method public void setRecycleChildrenOnDetach(boolean);
    method public void setReverseLayout(boolean);
    method public void setSmoothScrollbarEnabled(boolean);
    method public void setStackFromEnd(boolean);
    field public static final int HORIZONTAL = 0; // 0x0
    field public static final int INVALID_OFFSET = -2147483648; // 0x80000000
    field public static final int VERTICAL = 1; // 0x1
  }

  protected static class LinearLayoutManager.LayoutChunkResult {
    ctor protected LinearLayoutManager.LayoutChunkResult();
    field public int mConsumed;
    field public boolean mFinished;
    field public boolean mFocusable;
    field public boolean mIgnoreConsumed;
  }

  public class LinearSmoothScroller extends android.support.v7.widget.RecyclerView.SmoothScroller {
    ctor public LinearSmoothScroller(android.content.Context);
    method public int calculateDtToFit(int, int, int, int, int);
    method public int calculateDxToMakeVisible(android.view.View, int);
    method public int calculateDyToMakeVisible(android.view.View, int);
    method protected float calculateSpeedPerPixel(android.util.DisplayMetrics);
    method protected int calculateTimeForDeceleration(int);
    method protected int calculateTimeForScrolling(int);
    method public android.graphics.PointF computeScrollVectorForPosition(int);
    method protected int getHorizontalSnapPreference();
    method protected int getVerticalSnapPreference();
    method protected void onSeekTargetStep(int, int, android.support.v7.widget.RecyclerView.State, android.support.v7.widget.RecyclerView.SmoothScroller.Action);
    method protected void onStart();
    method protected void onStop();
    method protected void onTargetFound(android.view.View, android.support.v7.widget.RecyclerView.State, android.support.v7.widget.RecyclerView.SmoothScroller.Action);
    method protected void updateActionForInterimTarget(android.support.v7.widget.RecyclerView.SmoothScroller.Action);
    field public static final int SNAP_TO_ANY = 0; // 0x0
    field public static final int SNAP_TO_END = 1; // 0x1
    field public static final int SNAP_TO_START = -1; // 0xffffffff
    field protected final android.view.animation.DecelerateInterpolator mDecelerateInterpolator;
    field protected int mInterimTargetDx;
    field protected int mInterimTargetDy;
    field protected final android.view.animation.LinearInterpolator mLinearInterpolator;
    field protected android.graphics.PointF mTargetVector;
  }

  public class LinearSnapHelper extends android.support.v7.widget.SnapHelper {
    ctor public LinearSnapHelper();
    method public int[] calculateDistanceToFinalSnap(android.support.v7.widget.RecyclerView.LayoutManager, android.view.View);
    method public android.view.View findSnapView(android.support.v7.widget.RecyclerView.LayoutManager);
    method public int findTargetSnapPosition(android.support.v7.widget.RecyclerView.LayoutManager, int, int);
  }

  public class ListPopupWindow {
    ctor public ListPopupWindow(android.content.Context);
    ctor public ListPopupWindow(android.content.Context, android.util.AttributeSet);
    ctor public ListPopupWindow(android.content.Context, android.util.AttributeSet, int);
    ctor public ListPopupWindow(android.content.Context, android.util.AttributeSet, int, int);
    method public void clearListSelection();
    method public android.view.View.OnTouchListener createDragToOpenListener(android.view.View);
    method public void dismiss();
    method public android.view.View getAnchorView();
    method public int getAnimationStyle();
    method public android.graphics.drawable.Drawable getBackground();
    method public int getHeight();
    method public int getHorizontalOffset();
    method public int getInputMethodMode();
    method public android.widget.ListView getListView();
    method public int getPromptPosition();
    method public java.lang.Object getSelectedItem();
    method public long getSelectedItemId();
    method public int getSelectedItemPosition();
    method public android.view.View getSelectedView();
    method public int getSoftInputMode();
    method public int getVerticalOffset();
    method public int getWidth();
    method public boolean isInputMethodNotNeeded();
    method public boolean isModal();
    method public boolean isShowing();
    method public boolean onKeyDown(int, android.view.KeyEvent);
    method public boolean onKeyPreIme(int, android.view.KeyEvent);
    method public boolean onKeyUp(int, android.view.KeyEvent);
    method public boolean performItemClick(int);
    method public void postShow();
    method public void setAdapter(android.widget.ListAdapter);
    method public void setAnchorView(android.view.View);
    method public void setAnimationStyle(int);
    method public void setBackgroundDrawable(android.graphics.drawable.Drawable);
    method public void setContentWidth(int);
    method public void setDropDownGravity(int);
    method public void setHeight(int);
    method public void setHorizontalOffset(int);
    method public void setInputMethodMode(int);
    method public void setListSelector(android.graphics.drawable.Drawable);
    method public void setModal(boolean);
    method public void setOnDismissListener(android.widget.PopupWindow.OnDismissListener);
    method public void setOnItemClickListener(android.widget.AdapterView.OnItemClickListener);
    method public void setOnItemSelectedListener(android.widget.AdapterView.OnItemSelectedListener);
    method public void setPromptPosition(int);
    method public void setPromptView(android.view.View);
    method public void setSelection(int);
    method public void setSoftInputMode(int);
    method public void setVerticalOffset(int);
    method public void setWidth(int);
    method public void setWindowLayoutType(int);
    method public void show();
    field public static final int INPUT_METHOD_FROM_FOCUSABLE = 0; // 0x0
    field public static final int INPUT_METHOD_NEEDED = 1; // 0x1
    field public static final int INPUT_METHOD_NOT_NEEDED = 2; // 0x2
    field public static final int MATCH_PARENT = -1; // 0xffffffff
    field public static final int POSITION_PROMPT_ABOVE = 0; // 0x0
    field public static final int POSITION_PROMPT_BELOW = 1; // 0x1
    field public static final int WRAP_CONTENT = -2; // 0xfffffffe
  }

  public abstract class OrientationHelper {
    method public static android.support.v7.widget.OrientationHelper createHorizontalHelper(android.support.v7.widget.RecyclerView.LayoutManager);
    method public static android.support.v7.widget.OrientationHelper createOrientationHelper(android.support.v7.widget.RecyclerView.LayoutManager, int);
    method public static android.support.v7.widget.OrientationHelper createVerticalHelper(android.support.v7.widget.RecyclerView.LayoutManager);
    method public abstract int getDecoratedEnd(android.view.View);
    method public abstract int getDecoratedMeasurement(android.view.View);
    method public abstract int getDecoratedMeasurementInOther(android.view.View);
    method public abstract int getDecoratedStart(android.view.View);
    method public abstract int getEnd();
    method public abstract int getEndAfterPadding();
    method public abstract int getEndPadding();
    method public abstract int getMode();
    method public abstract int getModeInOther();
    method public abstract int getStartAfterPadding();
    method public abstract int getTotalSpace();
    method public int getTotalSpaceChange();
    method public abstract int getTransformedEndWithDecoration(android.view.View);
    method public abstract int getTransformedStartWithDecoration(android.view.View);
    method public abstract void offsetChild(android.view.View, int);
    method public abstract void offsetChildren(int);
    method public void onLayoutComplete();
    field public static final int HORIZONTAL = 0; // 0x0
    field public static final int VERTICAL = 1; // 0x1
    field protected final android.support.v7.widget.RecyclerView.LayoutManager mLayoutManager;
  }

  public class PagerSnapHelper extends android.support.v7.widget.SnapHelper {
    ctor public PagerSnapHelper();
    method public int[] calculateDistanceToFinalSnap(android.support.v7.widget.RecyclerView.LayoutManager, android.view.View);
    method protected android.support.v7.widget.LinearSmoothScroller createSnapScroller(android.support.v7.widget.RecyclerView.LayoutManager);
    method public android.view.View findSnapView(android.support.v7.widget.RecyclerView.LayoutManager);
    method public int findTargetSnapPosition(android.support.v7.widget.RecyclerView.LayoutManager, int, int);
  }

  public class PopupMenu {
    ctor public PopupMenu(android.content.Context, android.view.View);
    ctor public PopupMenu(android.content.Context, android.view.View, int);
    ctor public PopupMenu(android.content.Context, android.view.View, int, int, int);
    method public void dismiss();
    method public android.view.View.OnTouchListener getDragToOpenListener();
    method public int getGravity();
    method public android.view.Menu getMenu();
    method public android.view.MenuInflater getMenuInflater();
    method public void inflate(int);
    method public void setGravity(int);
    method public void setOnDismissListener(android.support.v7.widget.PopupMenu.OnDismissListener);
    method public void setOnMenuItemClickListener(android.support.v7.widget.PopupMenu.OnMenuItemClickListener);
    method public void show();
  }

  public static abstract interface PopupMenu.OnDismissListener {
    method public abstract void onDismiss(android.support.v7.widget.PopupMenu);
  }

  public static abstract interface PopupMenu.OnMenuItemClickListener {
    method public abstract boolean onMenuItemClick(android.view.MenuItem);
  }

  public class RecyclerView extends android.view.ViewGroup implements android.support.v4.view.NestedScrollingChild2 android.support.v4.view.ScrollingView {
    ctor public RecyclerView(android.content.Context);
    ctor public RecyclerView(android.content.Context, android.util.AttributeSet);
    ctor public RecyclerView(android.content.Context, android.util.AttributeSet, int);
    method public void addItemDecoration(android.support.v7.widget.RecyclerView.ItemDecoration, int);
    method public void addItemDecoration(android.support.v7.widget.RecyclerView.ItemDecoration);
    method public void addOnChildAttachStateChangeListener(android.support.v7.widget.RecyclerView.OnChildAttachStateChangeListener);
    method public void addOnItemTouchListener(android.support.v7.widget.RecyclerView.OnItemTouchListener);
    method public void addOnScrollListener(android.support.v7.widget.RecyclerView.OnScrollListener);
    method public void clearOnChildAttachStateChangeListeners();
    method public void clearOnScrollListeners();
    method public int computeHorizontalScrollExtent();
    method public int computeHorizontalScrollOffset();
    method public int computeHorizontalScrollRange();
    method public int computeVerticalScrollExtent();
    method public int computeVerticalScrollOffset();
    method public int computeVerticalScrollRange();
    method public boolean dispatchNestedPreScroll(int, int, int[], int[], int);
    method public boolean dispatchNestedScroll(int, int, int, int, int[], int);
    method public boolean drawChild(android.graphics.Canvas, android.view.View, long);
    method public android.view.View findChildViewUnder(float, float);
    method public android.view.View findContainingItemView(android.view.View);
    method public android.support.v7.widget.RecyclerView.ViewHolder findContainingViewHolder(android.view.View);
    method public android.support.v7.widget.RecyclerView.ViewHolder findViewHolderForAdapterPosition(int);
    method public android.support.v7.widget.RecyclerView.ViewHolder findViewHolderForItemId(long);
    method public android.support.v7.widget.RecyclerView.ViewHolder findViewHolderForLayoutPosition(int);
    method public deprecated android.support.v7.widget.RecyclerView.ViewHolder findViewHolderForPosition(int);
    method public boolean fling(int, int);
    method public android.support.v7.widget.RecyclerView.Adapter getAdapter();
    method public int getChildAdapterPosition(android.view.View);
    method public long getChildItemId(android.view.View);
    method public int getChildLayoutPosition(android.view.View);
    method public deprecated int getChildPosition(android.view.View);
    method public android.support.v7.widget.RecyclerView.ViewHolder getChildViewHolder(android.view.View);
    method public android.support.v7.widget.RecyclerViewAccessibilityDelegate getCompatAccessibilityDelegate();
    method public void getDecoratedBoundsWithMargins(android.view.View, android.graphics.Rect);
    method public android.support.v7.widget.RecyclerView.ItemAnimator getItemAnimator();
    method public android.support.v7.widget.RecyclerView.ItemDecoration getItemDecorationAt(int);
    method public int getItemDecorationCount();
    method public android.support.v7.widget.RecyclerView.LayoutManager getLayoutManager();
    method public int getMaxFlingVelocity();
    method public int getMinFlingVelocity();
    method public android.support.v7.widget.RecyclerView.OnFlingListener getOnFlingListener();
    method public boolean getPreserveFocusAfterLayout();
    method public android.support.v7.widget.RecyclerView.RecycledViewPool getRecycledViewPool();
    method public int getScrollState();
    method public boolean hasFixedSize();
    method public boolean hasNestedScrollingParent(int);
    method public boolean hasPendingAdapterUpdates();
    method public void invalidateItemDecorations();
    method public boolean isAnimating();
    method public boolean isComputingLayout();
    method public boolean isLayoutFrozen();
    method public void offsetChildrenHorizontal(int);
    method public void offsetChildrenVertical(int);
    method public void onChildAttachedToWindow(android.view.View);
    method public void onChildDetachedFromWindow(android.view.View);
    method public void onDraw(android.graphics.Canvas);
    method protected void onLayout(boolean, int, int, int, int);
    method public void onScrollStateChanged(int);
    method public void onScrolled(int, int);
    method public void removeItemDecoration(android.support.v7.widget.RecyclerView.ItemDecoration);
    method public void removeItemDecorationAt(int);
    method public void removeOnChildAttachStateChangeListener(android.support.v7.widget.RecyclerView.OnChildAttachStateChangeListener);
    method public void removeOnItemTouchListener(android.support.v7.widget.RecyclerView.OnItemTouchListener);
    method public void removeOnScrollListener(android.support.v7.widget.RecyclerView.OnScrollListener);
    method public void scrollToPosition(int);
    method public void setAccessibilityDelegateCompat(android.support.v7.widget.RecyclerViewAccessibilityDelegate);
    method public void setAdapter(android.support.v7.widget.RecyclerView.Adapter);
    method public void setChildDrawingOrderCallback(android.support.v7.widget.RecyclerView.ChildDrawingOrderCallback);
    method public void setHasFixedSize(boolean);
    method public void setItemAnimator(android.support.v7.widget.RecyclerView.ItemAnimator);
    method public void setItemViewCacheSize(int);
    method public void setLayoutFrozen(boolean);
    method public void setLayoutManager(android.support.v7.widget.RecyclerView.LayoutManager);
    method public void setOnFlingListener(android.support.v7.widget.RecyclerView.OnFlingListener);
    method public deprecated void setOnScrollListener(android.support.v7.widget.RecyclerView.OnScrollListener);
    method public void setPreserveFocusAfterLayout(boolean);
    method public void setRecycledViewPool(android.support.v7.widget.RecyclerView.RecycledViewPool);
    method public void setRecyclerListener(android.support.v7.widget.RecyclerView.RecyclerListener);
    method public void setScrollingTouchSlop(int);
    method public void setViewCacheExtension(android.support.v7.widget.RecyclerView.ViewCacheExtension);
    method public void smoothScrollBy(int, int);
    method public void smoothScrollBy(int, int, android.view.animation.Interpolator);
    method public void smoothScrollToPosition(int);
    method public boolean startNestedScroll(int, int);
    method public void stopNestedScroll(int);
    method public void stopScroll();
    method public void swapAdapter(android.support.v7.widget.RecyclerView.Adapter, boolean);
    field public static final int HORIZONTAL = 0; // 0x0
    field public static final int INVALID_TYPE = -1; // 0xffffffff
    field public static final long NO_ID = -1L; // 0xffffffffffffffffL
    field public static final int NO_POSITION = -1; // 0xffffffff
    field public static final int SCROLL_STATE_DRAGGING = 1; // 0x1
    field public static final int SCROLL_STATE_IDLE = 0; // 0x0
    field public static final int SCROLL_STATE_SETTLING = 2; // 0x2
    field public static final int TOUCH_SLOP_DEFAULT = 0; // 0x0
    field public static final int TOUCH_SLOP_PAGING = 1; // 0x1
    field public static final int VERTICAL = 1; // 0x1
  }

  public static abstract class RecyclerView.Adapter<VH extends android.support.v7.widget.RecyclerView.ViewHolder> {
    ctor public RecyclerView.Adapter();
    method public final void bindViewHolder(VH, int);
    method public final VH createViewHolder(android.view.ViewGroup, int);
    method public abstract int getItemCount();
    method public long getItemId(int);
    method public int getItemViewType(int);
    method public final boolean hasObservers();
    method public final boolean hasStableIds();
    method public final void notifyDataSetChanged();
    method public final void notifyItemChanged(int);
    method public final void notifyItemChanged(int, java.lang.Object);
    method public final void notifyItemInserted(int);
    method public final void notifyItemMoved(int, int);
    method public final void notifyItemRangeChanged(int, int);
    method public final void notifyItemRangeChanged(int, int, java.lang.Object);
    method public final void notifyItemRangeInserted(int, int);
    method public final void notifyItemRangeRemoved(int, int);
    method public final void notifyItemRemoved(int);
    method public void onAttachedToRecyclerView(android.support.v7.widget.RecyclerView);
    method public abstract void onBindViewHolder(VH, int);
    method public void onBindViewHolder(VH, int, java.util.List<java.lang.Object>);
    method public abstract VH onCreateViewHolder(android.view.ViewGroup, int);
    method public void onDetachedFromRecyclerView(android.support.v7.widget.RecyclerView);
    method public boolean onFailedToRecycleView(VH);
    method public void onViewAttachedToWindow(VH);
    method public void onViewDetachedFromWindow(VH);
    method public void onViewRecycled(VH);
    method public void registerAdapterDataObserver(android.support.v7.widget.RecyclerView.AdapterDataObserver);
    method public void setHasStableIds(boolean);
    method public void unregisterAdapterDataObserver(android.support.v7.widget.RecyclerView.AdapterDataObserver);
  }

  public static abstract class RecyclerView.AdapterDataObserver {
    ctor public RecyclerView.AdapterDataObserver();
    method public void onChanged();
    method public void onItemRangeChanged(int, int);
    method public void onItemRangeChanged(int, int, java.lang.Object);
    method public void onItemRangeInserted(int, int);
    method public void onItemRangeMoved(int, int, int);
    method public void onItemRangeRemoved(int, int);
  }

  public static abstract interface RecyclerView.ChildDrawingOrderCallback {
    method public abstract int onGetChildDrawingOrder(int, int);
  }

  public static abstract class RecyclerView.ItemAnimator {
    ctor public RecyclerView.ItemAnimator();
    method public abstract boolean animateAppearance(android.support.v7.widget.RecyclerView.ViewHolder, android.support.v7.widget.RecyclerView.ItemAnimator.ItemHolderInfo, android.support.v7.widget.RecyclerView.ItemAnimator.ItemHolderInfo);
    method public abstract boolean animateChange(android.support.v7.widget.RecyclerView.ViewHolder, android.support.v7.widget.RecyclerView.ViewHolder, android.support.v7.widget.RecyclerView.ItemAnimator.ItemHolderInfo, android.support.v7.widget.RecyclerView.ItemAnimator.ItemHolderInfo);
    method public abstract boolean animateDisappearance(android.support.v7.widget.RecyclerView.ViewHolder, android.support.v7.widget.RecyclerView.ItemAnimator.ItemHolderInfo, android.support.v7.widget.RecyclerView.ItemAnimator.ItemHolderInfo);
    method public abstract boolean animatePersistence(android.support.v7.widget.RecyclerView.ViewHolder, android.support.v7.widget.RecyclerView.ItemAnimator.ItemHolderInfo, android.support.v7.widget.RecyclerView.ItemAnimator.ItemHolderInfo);
    method public boolean canReuseUpdatedViewHolder(android.support.v7.widget.RecyclerView.ViewHolder);
    method public boolean canReuseUpdatedViewHolder(android.support.v7.widget.RecyclerView.ViewHolder, java.util.List<java.lang.Object>);
    method public final void dispatchAnimationFinished(android.support.v7.widget.RecyclerView.ViewHolder);
    method public final void dispatchAnimationStarted(android.support.v7.widget.RecyclerView.ViewHolder);
    method public final void dispatchAnimationsFinished();
    method public abstract void endAnimation(android.support.v7.widget.RecyclerView.ViewHolder);
    method public abstract void endAnimations();
    method public long getAddDuration();
    method public long getChangeDuration();
    method public long getMoveDuration();
    method public long getRemoveDuration();
    method public abstract boolean isRunning();
    method public final boolean isRunning(android.support.v7.widget.RecyclerView.ItemAnimator.ItemAnimatorFinishedListener);
    method public android.support.v7.widget.RecyclerView.ItemAnimator.ItemHolderInfo obtainHolderInfo();
    method public void onAnimationFinished(android.support.v7.widget.RecyclerView.ViewHolder);
    method public void onAnimationStarted(android.support.v7.widget.RecyclerView.ViewHolder);
    method public android.support.v7.widget.RecyclerView.ItemAnimator.ItemHolderInfo recordPostLayoutInformation(android.support.v7.widget.RecyclerView.State, android.support.v7.widget.RecyclerView.ViewHolder);
    method public android.support.v7.widget.RecyclerView.ItemAnimator.ItemHolderInfo recordPreLayoutInformation(android.support.v7.widget.RecyclerView.State, android.support.v7.widget.RecyclerView.ViewHolder, int, java.util.List<java.lang.Object>);
    method public abstract void runPendingAnimations();
    method public void setAddDuration(long);
    method public void setChangeDuration(long);
    method public void setMoveDuration(long);
    method public void setRemoveDuration(long);
    field public static final int FLAG_APPEARED_IN_PRE_LAYOUT = 4096; // 0x1000
    field public static final int FLAG_CHANGED = 2; // 0x2
    field public static final int FLAG_INVALIDATED = 4; // 0x4
    field public static final int FLAG_MOVED = 2048; // 0x800
    field public static final int FLAG_REMOVED = 8; // 0x8
  }

  public static abstract class RecyclerView.ItemAnimator.AdapterChanges implements java.lang.annotation.Annotation {
  }

  public static abstract interface RecyclerView.ItemAnimator.ItemAnimatorFinishedListener {
    method public abstract void onAnimationsFinished();
  }

  public static class RecyclerView.ItemAnimator.ItemHolderInfo {
    ctor public RecyclerView.ItemAnimator.ItemHolderInfo();
    method public android.support.v7.widget.RecyclerView.ItemAnimator.ItemHolderInfo setFrom(android.support.v7.widget.RecyclerView.ViewHolder);
    method public android.support.v7.widget.RecyclerView.ItemAnimator.ItemHolderInfo setFrom(android.support.v7.widget.RecyclerView.ViewHolder, int);
    field public int bottom;
    field public int changeFlags;
    field public int left;
    field public int right;
    field public int top;
  }

  public static abstract class RecyclerView.ItemDecoration {
    ctor public RecyclerView.ItemDecoration();
    method public deprecated void getItemOffsets(android.graphics.Rect, int, android.support.v7.widget.RecyclerView);
    method public void getItemOffsets(android.graphics.Rect, android.view.View, android.support.v7.widget.RecyclerView, android.support.v7.widget.RecyclerView.State);
    method public void onDraw(android.graphics.Canvas, android.support.v7.widget.RecyclerView, android.support.v7.widget.RecyclerView.State);
    method public deprecated void onDraw(android.graphics.Canvas, android.support.v7.widget.RecyclerView);
    method public void onDrawOver(android.graphics.Canvas, android.support.v7.widget.RecyclerView, android.support.v7.widget.RecyclerView.State);
    method public deprecated void onDrawOver(android.graphics.Canvas, android.support.v7.widget.RecyclerView);
  }

  public static abstract class RecyclerView.LayoutManager {
    ctor public RecyclerView.LayoutManager();
    method public void addDisappearingView(android.view.View);
    method public void addDisappearingView(android.view.View, int);
    method public void addView(android.view.View);
    method public void addView(android.view.View, int);
    method public void assertInLayoutOrScroll(java.lang.String);
    method public void assertNotInLayoutOrScroll(java.lang.String);
    method public void attachView(android.view.View, int, android.support.v7.widget.RecyclerView.LayoutParams);
    method public void attachView(android.view.View, int);
    method public void attachView(android.view.View);
    method public void calculateItemDecorationsForChild(android.view.View, android.graphics.Rect);
    method public boolean canScrollHorizontally();
    method public boolean canScrollVertically();
    method public boolean checkLayoutParams(android.support.v7.widget.RecyclerView.LayoutParams);
    method public static int chooseSize(int, int, int);
    method public void collectAdjacentPrefetchPositions(int, int, android.support.v7.widget.RecyclerView.State, android.support.v7.widget.RecyclerView.LayoutManager.LayoutPrefetchRegistry);
    method public void collectInitialPrefetchPositions(int, android.support.v7.widget.RecyclerView.LayoutManager.LayoutPrefetchRegistry);
    method public int computeHorizontalScrollExtent(android.support.v7.widget.RecyclerView.State);
    method public int computeHorizontalScrollOffset(android.support.v7.widget.RecyclerView.State);
    method public int computeHorizontalScrollRange(android.support.v7.widget.RecyclerView.State);
    method public int computeVerticalScrollExtent(android.support.v7.widget.RecyclerView.State);
    method public int computeVerticalScrollOffset(android.support.v7.widget.RecyclerView.State);
    method public int computeVerticalScrollRange(android.support.v7.widget.RecyclerView.State);
    method public void detachAndScrapAttachedViews(android.support.v7.widget.RecyclerView.Recycler);
    method public void detachAndScrapView(android.view.View, android.support.v7.widget.RecyclerView.Recycler);
    method public void detachAndScrapViewAt(int, android.support.v7.widget.RecyclerView.Recycler);
    method public void detachView(android.view.View);
    method public void detachViewAt(int);
    method public void endAnimation(android.view.View);
    method public android.view.View findContainingItemView(android.view.View);
    method public android.view.View findViewByPosition(int);
    method public abstract android.support.v7.widget.RecyclerView.LayoutParams generateDefaultLayoutParams();
    method public android.support.v7.widget.RecyclerView.LayoutParams generateLayoutParams(android.view.ViewGroup.LayoutParams);
    method public android.support.v7.widget.RecyclerView.LayoutParams generateLayoutParams(android.content.Context, android.util.AttributeSet);
    method public int getBaseline();
    method public int getBottomDecorationHeight(android.view.View);
    method public android.view.View getChildAt(int);
    method public int getChildCount();
    method public static deprecated int getChildMeasureSpec(int, int, int, boolean);
    method public static int getChildMeasureSpec(int, int, int, int, boolean);
    method public boolean getClipToPadding();
    method public int getColumnCountForAccessibility(android.support.v7.widget.RecyclerView.Recycler, android.support.v7.widget.RecyclerView.State);
    method public int getDecoratedBottom(android.view.View);
    method public void getDecoratedBoundsWithMargins(android.view.View, android.graphics.Rect);
    method public int getDecoratedLeft(android.view.View);
    method public int getDecoratedMeasuredHeight(android.view.View);
    method public int getDecoratedMeasuredWidth(android.view.View);
    method public int getDecoratedRight(android.view.View);
    method public int getDecoratedTop(android.view.View);
    method public android.view.View getFocusedChild();
    method public int getHeight();
    method public int getHeightMode();
    method public int getItemCount();
    method public int getItemViewType(android.view.View);
    method public int getLayoutDirection();
    method public int getLeftDecorationWidth(android.view.View);
    method public int getMinimumHeight();
    method public int getMinimumWidth();
    method public int getPaddingBottom();
    method public int getPaddingEnd();
    method public int getPaddingLeft();
    method public int getPaddingRight();
    method public int getPaddingStart();
    method public int getPaddingTop();
    method public int getPosition(android.view.View);
    method public static android.support.v7.widget.RecyclerView.LayoutManager.Properties getProperties(android.content.Context, android.util.AttributeSet, int, int);
    method public int getRightDecorationWidth(android.view.View);
    method public int getRowCountForAccessibility(android.support.v7.widget.RecyclerView.Recycler, android.support.v7.widget.RecyclerView.State);
    method public int getSelectionModeForAccessibility(android.support.v7.widget.RecyclerView.Recycler, android.support.v7.widget.RecyclerView.State);
    method public int getTopDecorationHeight(android.view.View);
    method public void getTransformedBoundingBox(android.view.View, boolean, android.graphics.Rect);
    method public int getWidth();
    method public int getWidthMode();
    method public boolean hasFocus();
    method public void ignoreView(android.view.View);
    method public boolean isAttachedToWindow();
    method public boolean isAutoMeasureEnabled();
    method public boolean isFocused();
    method public final boolean isItemPrefetchEnabled();
    method public boolean isLayoutHierarchical(android.support.v7.widget.RecyclerView.Recycler, android.support.v7.widget.RecyclerView.State);
    method public boolean isMeasurementCacheEnabled();
    method public boolean isSmoothScrolling();
    method public boolean isViewPartiallyVisible(android.view.View, boolean, boolean);
    method public void layoutDecorated(android.view.View, int, int, int, int);
    method public void layoutDecoratedWithMargins(android.view.View, int, int, int, int);
    method public void measureChild(android.view.View, int, int);
    method public void measureChildWithMargins(android.view.View, int, int);
    method public void moveView(int, int);
    method public void offsetChildrenHorizontal(int);
    method public void offsetChildrenVertical(int);
    method public void onAdapterChanged(android.support.v7.widget.RecyclerView.Adapter, android.support.v7.widget.RecyclerView.Adapter);
    method public boolean onAddFocusables(android.support.v7.widget.RecyclerView, java.util.ArrayList<android.view.View>, int, int);
    method public void onAttachedToWindow(android.support.v7.widget.RecyclerView);
    method public deprecated void onDetachedFromWindow(android.support.v7.widget.RecyclerView);
    method public void onDetachedFromWindow(android.support.v7.widget.RecyclerView, android.support.v7.widget.RecyclerView.Recycler);
    method public android.view.View onFocusSearchFailed(android.view.View, int, android.support.v7.widget.RecyclerView.Recycler, android.support.v7.widget.RecyclerView.State);
    method public void onInitializeAccessibilityEvent(android.view.accessibility.AccessibilityEvent);
    method public void onInitializeAccessibilityEvent(android.support.v7.widget.RecyclerView.Recycler, android.support.v7.widget.RecyclerView.State, android.view.accessibility.AccessibilityEvent);
    method public void onInitializeAccessibilityNodeInfo(android.support.v7.widget.RecyclerView.Recycler, android.support.v7.widget.RecyclerView.State, android.support.v4.view.accessibility.AccessibilityNodeInfoCompat);
    method public void onInitializeAccessibilityNodeInfoForItem(android.support.v7.widget.RecyclerView.Recycler, android.support.v7.widget.RecyclerView.State, android.view.View, android.support.v4.view.accessibility.AccessibilityNodeInfoCompat);
    method public android.view.View onInterceptFocusSearch(android.view.View, int);
    method public void onItemsAdded(android.support.v7.widget.RecyclerView, int, int);
    method public void onItemsChanged(android.support.v7.widget.RecyclerView);
    method public void onItemsMoved(android.support.v7.widget.RecyclerView, int, int, int);
    method public void onItemsRemoved(android.support.v7.widget.RecyclerView, int, int);
    method public void onItemsUpdated(android.support.v7.widget.RecyclerView, int, int);
    method public void onItemsUpdated(android.support.v7.widget.RecyclerView, int, int, java.lang.Object);
    method public void onLayoutChildren(android.support.v7.widget.RecyclerView.Recycler, android.support.v7.widget.RecyclerView.State);
    method public void onLayoutCompleted(android.support.v7.widget.RecyclerView.State);
    method public void onMeasure(android.support.v7.widget.RecyclerView.Recycler, android.support.v7.widget.RecyclerView.State, int, int);
    method public deprecated boolean onRequestChildFocus(android.support.v7.widget.RecyclerView, android.view.View, android.view.View);
    method public boolean onRequestChildFocus(android.support.v7.widget.RecyclerView, android.support.v7.widget.RecyclerView.State, android.view.View, android.view.View);
    method public void onRestoreInstanceState(android.os.Parcelable);
    method public android.os.Parcelable onSaveInstanceState();
    method public void onScrollStateChanged(int);
    method public boolean performAccessibilityAction(android.support.v7.widget.RecyclerView.Recycler, android.support.v7.widget.RecyclerView.State, int, android.os.Bundle);
    method public boolean performAccessibilityActionForItem(android.support.v7.widget.RecyclerView.Recycler, android.support.v7.widget.RecyclerView.State, android.view.View, int, android.os.Bundle);
    method public void postOnAnimation(java.lang.Runnable);
    method public void removeAllViews();
    method public void removeAndRecycleAllViews(android.support.v7.widget.RecyclerView.Recycler);
    method public void removeAndRecycleView(android.view.View, android.support.v7.widget.RecyclerView.Recycler);
    method public void removeAndRecycleViewAt(int, android.support.v7.widget.RecyclerView.Recycler);
    method public boolean removeCallbacks(java.lang.Runnable);
    method public void removeDetachedView(android.view.View);
    method public void removeView(android.view.View);
    method public void removeViewAt(int);
    method public boolean requestChildRectangleOnScreen(android.support.v7.widget.RecyclerView, android.view.View, android.graphics.Rect, boolean);
    method public boolean requestChildRectangleOnScreen(android.support.v7.widget.RecyclerView, android.view.View, android.graphics.Rect, boolean, boolean);
    method public void requestLayout();
    method public void requestSimpleAnimationsInNextLayout();
    method public int scrollHorizontallyBy(int, android.support.v7.widget.RecyclerView.Recycler, android.support.v7.widget.RecyclerView.State);
    method public void scrollToPosition(int);
    method public int scrollVerticallyBy(int, android.support.v7.widget.RecyclerView.Recycler, android.support.v7.widget.RecyclerView.State);
    method public void setAutoMeasureEnabled(boolean);
    method public final void setItemPrefetchEnabled(boolean);
    method public void setMeasuredDimension(android.graphics.Rect, int, int);
    method public void setMeasuredDimension(int, int);
    method public void setMeasurementCacheEnabled(boolean);
    method public void smoothScrollToPosition(android.support.v7.widget.RecyclerView, android.support.v7.widget.RecyclerView.State, int);
    method public void startSmoothScroll(android.support.v7.widget.RecyclerView.SmoothScroller);
    method public void stopIgnoringView(android.view.View);
    method public boolean supportsPredictiveItemAnimations();
  }

  public static abstract interface RecyclerView.LayoutManager.LayoutPrefetchRegistry {
    method public abstract void addPosition(int, int);
  }

  public static class RecyclerView.LayoutManager.Properties {
    ctor public RecyclerView.LayoutManager.Properties();
    field public int orientation;
    field public boolean reverseLayout;
    field public int spanCount;
    field public boolean stackFromEnd;
  }

  public static class RecyclerView.LayoutParams extends android.view.ViewGroup.MarginLayoutParams {
    ctor public RecyclerView.LayoutParams(android.content.Context, android.util.AttributeSet);
    ctor public RecyclerView.LayoutParams(int, int);
    ctor public RecyclerView.LayoutParams(android.view.ViewGroup.MarginLayoutParams);
    ctor public RecyclerView.LayoutParams(android.view.ViewGroup.LayoutParams);
    ctor public RecyclerView.LayoutParams(android.support.v7.widget.RecyclerView.LayoutParams);
    method public int getViewAdapterPosition();
    method public int getViewLayoutPosition();
    method public deprecated int getViewPosition();
    method public boolean isItemChanged();
    method public boolean isItemRemoved();
    method public boolean isViewInvalid();
    method public boolean viewNeedsUpdate();
  }

  public static abstract interface RecyclerView.OnChildAttachStateChangeListener {
    method public abstract void onChildViewAttachedToWindow(android.view.View);
    method public abstract void onChildViewDetachedFromWindow(android.view.View);
  }

  public static abstract class RecyclerView.OnFlingListener {
    ctor public RecyclerView.OnFlingListener();
    method public abstract boolean onFling(int, int);
  }

  public static abstract interface RecyclerView.OnItemTouchListener {
    method public abstract boolean onInterceptTouchEvent(android.support.v7.widget.RecyclerView, android.view.MotionEvent);
    method public abstract void onRequestDisallowInterceptTouchEvent(boolean);
    method public abstract void onTouchEvent(android.support.v7.widget.RecyclerView, android.view.MotionEvent);
  }

  public static abstract class RecyclerView.OnScrollListener {
    ctor public RecyclerView.OnScrollListener();
    method public void onScrollStateChanged(android.support.v7.widget.RecyclerView, int);
    method public void onScrolled(android.support.v7.widget.RecyclerView, int, int);
  }

  public static class RecyclerView.RecycledViewPool {
    ctor public RecyclerView.RecycledViewPool();
    method public void clear();
    method public android.support.v7.widget.RecyclerView.ViewHolder getRecycledView(int);
    method public int getRecycledViewCount(int);
    method public void putRecycledView(android.support.v7.widget.RecyclerView.ViewHolder);
    method public void setMaxRecycledViews(int, int);
  }

  public final class RecyclerView.Recycler {
    ctor public RecyclerView.Recycler();
    method public void bindViewToPosition(android.view.View, int);
    method public void clear();
    method public int convertPreLayoutPositionToPostLayout(int);
    method public java.util.List<android.support.v7.widget.RecyclerView.ViewHolder> getScrapList();
    method public android.view.View getViewForPosition(int);
    method public void recycleView(android.view.View);
    method public void setViewCacheSize(int);
  }

  public static abstract interface RecyclerView.RecyclerListener {
    method public abstract void onViewRecycled(android.support.v7.widget.RecyclerView.ViewHolder);
  }

  public static class RecyclerView.SimpleOnItemTouchListener implements android.support.v7.widget.RecyclerView.OnItemTouchListener {
    ctor public RecyclerView.SimpleOnItemTouchListener();
    method public boolean onInterceptTouchEvent(android.support.v7.widget.RecyclerView, android.view.MotionEvent);
    method public void onRequestDisallowInterceptTouchEvent(boolean);
    method public void onTouchEvent(android.support.v7.widget.RecyclerView, android.view.MotionEvent);
  }

  public static abstract class RecyclerView.SmoothScroller {
    ctor public RecyclerView.SmoothScroller();
    method public android.view.View findViewByPosition(int);
    method public int getChildCount();
    method public int getChildPosition(android.view.View);
    method public android.support.v7.widget.RecyclerView.LayoutManager getLayoutManager();
    method public int getTargetPosition();
    method public deprecated void instantScrollToPosition(int);
    method public boolean isPendingInitialRun();
    method public boolean isRunning();
    method protected void normalize(android.graphics.PointF);
    method protected void onChildAttachedToWindow(android.view.View);
    method protected abstract void onSeekTargetStep(int, int, android.support.v7.widget.RecyclerView.State, android.support.v7.widget.RecyclerView.SmoothScroller.Action);
    method protected abstract void onStart();
    method protected abstract void onStop();
    method protected abstract void onTargetFound(android.view.View, android.support.v7.widget.RecyclerView.State, android.support.v7.widget.RecyclerView.SmoothScroller.Action);
    method public void setTargetPosition(int);
    method protected final void stop();
  }

  public static class RecyclerView.SmoothScroller.Action {
    ctor public RecyclerView.SmoothScroller.Action(int, int);
    ctor public RecyclerView.SmoothScroller.Action(int, int, int);
    ctor public RecyclerView.SmoothScroller.Action(int, int, int, android.view.animation.Interpolator);
    method public int getDuration();
    method public int getDx();
    method public int getDy();
    method public android.view.animation.Interpolator getInterpolator();
    method public void jumpTo(int);
    method public void setDuration(int);
    method public void setDx(int);
    method public void setDy(int);
    method public void setInterpolator(android.view.animation.Interpolator);
    method public void update(int, int, int, android.view.animation.Interpolator);
    field public static final int UNDEFINED_DURATION = -2147483648; // 0x80000000
  }

  public static abstract interface RecyclerView.SmoothScroller.ScrollVectorProvider {
    method public abstract android.graphics.PointF computeScrollVectorForPosition(int);
  }

  public static class RecyclerView.State {
    ctor public RecyclerView.State();
    method public boolean didStructureChange();
    method public <T> T get(int);
    method public int getItemCount();
    method public int getRemainingScrollHorizontal();
    method public int getRemainingScrollVertical();
    method public int getTargetScrollPosition();
    method public boolean hasTargetScrollPosition();
    method public boolean isMeasuring();
    method public boolean isPreLayout();
    method public void put(int, java.lang.Object);
    method public void remove(int);
    method public boolean willRunPredictiveAnimations();
    method public boolean willRunSimpleAnimations();
  }

  public static abstract class RecyclerView.ViewCacheExtension {
    ctor public RecyclerView.ViewCacheExtension();
    method public abstract android.view.View getViewForPositionAndType(android.support.v7.widget.RecyclerView.Recycler, int, int);
  }

  public static abstract class RecyclerView.ViewHolder {
    ctor public RecyclerView.ViewHolder(android.view.View);
    method public final int getAdapterPosition();
    method public final long getItemId();
    method public final int getItemViewType();
    method public final int getLayoutPosition();
    method public final int getOldPosition();
    method public final deprecated int getPosition();
    method public final boolean isRecyclable();
    method public final void setIsRecyclable(boolean);
    field public final android.view.View itemView;
  }

  public class RecyclerViewAccessibilityDelegate extends android.support.v4.view.AccessibilityDelegateCompat {
    ctor public RecyclerViewAccessibilityDelegate(android.support.v7.widget.RecyclerView);
    method public android.support.v4.view.AccessibilityDelegateCompat getItemDelegate();
  }

  public static class RecyclerViewAccessibilityDelegate.ItemDelegate extends android.support.v4.view.AccessibilityDelegateCompat {
    ctor public RecyclerViewAccessibilityDelegate.ItemDelegate(android.support.v7.widget.RecyclerViewAccessibilityDelegate);
  }

  public class SearchView extends android.support.v7.widget.LinearLayoutCompat implements android.support.v7.view.CollapsibleActionView {
    ctor public SearchView(android.content.Context);
    ctor public SearchView(android.content.Context, android.util.AttributeSet);
    ctor public SearchView(android.content.Context, android.util.AttributeSet, int);
    method public int getImeOptions();
    method public int getInputType();
    method public int getMaxWidth();
    method public java.lang.CharSequence getQuery();
    method public java.lang.CharSequence getQueryHint();
    method public android.support.v4.widget.CursorAdapter getSuggestionsAdapter();
    method public boolean isIconfiedByDefault();
    method public boolean isIconified();
    method public boolean isQueryRefinementEnabled();
    method public boolean isSubmitButtonEnabled();
    method public void onActionViewCollapsed();
    method public void onActionViewExpanded();
    method public void setIconified(boolean);
    method public void setIconifiedByDefault(boolean);
    method public void setImeOptions(int);
    method public void setInputType(int);
    method public void setMaxWidth(int);
    method public void setOnCloseListener(android.support.v7.widget.SearchView.OnCloseListener);
    method public void setOnQueryTextFocusChangeListener(android.view.View.OnFocusChangeListener);
    method public void setOnQueryTextListener(android.support.v7.widget.SearchView.OnQueryTextListener);
    method public void setOnSearchClickListener(android.view.View.OnClickListener);
    method public void setOnSuggestionListener(android.support.v7.widget.SearchView.OnSuggestionListener);
    method public void setQuery(java.lang.CharSequence, boolean);
    method public void setQueryHint(java.lang.CharSequence);
    method public void setQueryRefinementEnabled(boolean);
    method public void setSearchableInfo(android.app.SearchableInfo);
    method public void setSubmitButtonEnabled(boolean);
    method public void setSuggestionsAdapter(android.support.v4.widget.CursorAdapter);
  }

  public static abstract interface SearchView.OnCloseListener {
    method public abstract boolean onClose();
  }

  public static abstract interface SearchView.OnQueryTextListener {
    method public abstract boolean onQueryTextChange(java.lang.String);
    method public abstract boolean onQueryTextSubmit(java.lang.String);
  }

  public static abstract interface SearchView.OnSuggestionListener {
    method public abstract boolean onSuggestionClick(int);
    method public abstract boolean onSuggestionSelect(int);
  }

  public class ShareActionProvider extends android.support.v4.view.ActionProvider {
    ctor public ShareActionProvider(android.content.Context);
    method public android.view.View onCreateActionView();
    method public void setOnShareTargetSelectedListener(android.support.v7.widget.ShareActionProvider.OnShareTargetSelectedListener);
    method public void setShareHistoryFileName(java.lang.String);
    method public void setShareIntent(android.content.Intent);
    field public static final java.lang.String DEFAULT_SHARE_HISTORY_FILE_NAME = "share_history.xml";
  }

  public static abstract interface ShareActionProvider.OnShareTargetSelectedListener {
    method public abstract boolean onShareTargetSelected(android.support.v7.widget.ShareActionProvider, android.content.Intent);
  }

  public abstract class SimpleItemAnimator extends android.support.v7.widget.RecyclerView.ItemAnimator {
    ctor public SimpleItemAnimator();
    method public abstract boolean animateAdd(android.support.v7.widget.RecyclerView.ViewHolder);
    method public boolean animateAppearance(android.support.v7.widget.RecyclerView.ViewHolder, android.support.v7.widget.RecyclerView.ItemAnimator.ItemHolderInfo, android.support.v7.widget.RecyclerView.ItemAnimator.ItemHolderInfo);
    method public boolean animateChange(android.support.v7.widget.RecyclerView.ViewHolder, android.support.v7.widget.RecyclerView.ViewHolder, android.support.v7.widget.RecyclerView.ItemAnimator.ItemHolderInfo, android.support.v7.widget.RecyclerView.ItemAnimator.ItemHolderInfo);
    method public abstract boolean animateChange(android.support.v7.widget.RecyclerView.ViewHolder, android.support.v7.widget.RecyclerView.ViewHolder, int, int, int, int);
    method public boolean animateDisappearance(android.support.v7.widget.RecyclerView.ViewHolder, android.support.v7.widget.RecyclerView.ItemAnimator.ItemHolderInfo, android.support.v7.widget.RecyclerView.ItemAnimator.ItemHolderInfo);
    method public abstract boolean animateMove(android.support.v7.widget.RecyclerView.ViewHolder, int, int, int, int);
    method public boolean animatePersistence(android.support.v7.widget.RecyclerView.ViewHolder, android.support.v7.widget.RecyclerView.ItemAnimator.ItemHolderInfo, android.support.v7.widget.RecyclerView.ItemAnimator.ItemHolderInfo);
    method public abstract boolean animateRemove(android.support.v7.widget.RecyclerView.ViewHolder);
    method public final void dispatchAddFinished(android.support.v7.widget.RecyclerView.ViewHolder);
    method public final void dispatchAddStarting(android.support.v7.widget.RecyclerView.ViewHolder);
    method public final void dispatchChangeFinished(android.support.v7.widget.RecyclerView.ViewHolder, boolean);
    method public final void dispatchChangeStarting(android.support.v7.widget.RecyclerView.ViewHolder, boolean);
    method public final void dispatchMoveFinished(android.support.v7.widget.RecyclerView.ViewHolder);
    method public final void dispatchMoveStarting(android.support.v7.widget.RecyclerView.ViewHolder);
    method public final void dispatchRemoveFinished(android.support.v7.widget.RecyclerView.ViewHolder);
    method public final void dispatchRemoveStarting(android.support.v7.widget.RecyclerView.ViewHolder);
    method public boolean getSupportsChangeAnimations();
    method public void onAddFinished(android.support.v7.widget.RecyclerView.ViewHolder);
    method public void onAddStarting(android.support.v7.widget.RecyclerView.ViewHolder);
    method public void onChangeFinished(android.support.v7.widget.RecyclerView.ViewHolder, boolean);
    method public void onChangeStarting(android.support.v7.widget.RecyclerView.ViewHolder, boolean);
    method public void onMoveFinished(android.support.v7.widget.RecyclerView.ViewHolder);
    method public void onMoveStarting(android.support.v7.widget.RecyclerView.ViewHolder);
    method public void onRemoveFinished(android.support.v7.widget.RecyclerView.ViewHolder);
    method public void onRemoveStarting(android.support.v7.widget.RecyclerView.ViewHolder);
    method public void setSupportsChangeAnimations(boolean);
  }

  public abstract class SnapHelper extends android.support.v7.widget.RecyclerView.OnFlingListener {
    ctor public SnapHelper();
    method public void attachToRecyclerView(android.support.v7.widget.RecyclerView) throws java.lang.IllegalStateException;
    method public abstract int[] calculateDistanceToFinalSnap(android.support.v7.widget.RecyclerView.LayoutManager, android.view.View);
    method public int[] calculateScrollDistance(int, int);
    method protected android.support.v7.widget.RecyclerView.SmoothScroller createScroller(android.support.v7.widget.RecyclerView.LayoutManager);
    method protected deprecated android.support.v7.widget.LinearSmoothScroller createSnapScroller(android.support.v7.widget.RecyclerView.LayoutManager);
    method public abstract android.view.View findSnapView(android.support.v7.widget.RecyclerView.LayoutManager);
    method public abstract int findTargetSnapPosition(android.support.v7.widget.RecyclerView.LayoutManager, int, int);
    method public boolean onFling(int, int);
  }

  public class StaggeredGridLayoutManager extends android.support.v7.widget.RecyclerView.LayoutManager implements android.support.v7.widget.RecyclerView.SmoothScroller.ScrollVectorProvider {
    ctor public StaggeredGridLayoutManager(android.content.Context, android.util.AttributeSet, int, int);
    ctor public StaggeredGridLayoutManager(int, int);
    method public android.graphics.PointF computeScrollVectorForPosition(int);
    method public int[] findFirstCompletelyVisibleItemPositions(int[]);
    method public int[] findFirstVisibleItemPositions(int[]);
    method public int[] findLastCompletelyVisibleItemPositions(int[]);
    method public int[] findLastVisibleItemPositions(int[]);
    method public android.support.v7.widget.RecyclerView.LayoutParams generateDefaultLayoutParams();
    method public int getGapStrategy();
    method public int getOrientation();
    method public boolean getReverseLayout();
    method public int getSpanCount();
    method public void invalidateSpanAssignments();
    method public void scrollToPositionWithOffset(int, int);
    method public void setGapStrategy(int);
    method public void setOrientation(int);
    method public void setReverseLayout(boolean);
    method public void setSpanCount(int);
    field public static final deprecated int GAP_HANDLING_LAZY = 1; // 0x1
    field public static final int GAP_HANDLING_MOVE_ITEMS_BETWEEN_SPANS = 2; // 0x2
    field public static final int GAP_HANDLING_NONE = 0; // 0x0
    field public static final int HORIZONTAL = 0; // 0x0
    field public static final int VERTICAL = 1; // 0x1
  }

  public static class StaggeredGridLayoutManager.LayoutParams extends android.support.v7.widget.RecyclerView.LayoutParams {
    ctor public StaggeredGridLayoutManager.LayoutParams(android.content.Context, android.util.AttributeSet);
    ctor public StaggeredGridLayoutManager.LayoutParams(int, int);
    ctor public StaggeredGridLayoutManager.LayoutParams(android.view.ViewGroup.MarginLayoutParams);
    ctor public StaggeredGridLayoutManager.LayoutParams(android.view.ViewGroup.LayoutParams);
    ctor public StaggeredGridLayoutManager.LayoutParams(android.support.v7.widget.RecyclerView.LayoutParams);
    method public final int getSpanIndex();
    method public boolean isFullSpan();
    method public void setFullSpan(boolean);
    field public static final int INVALID_SPAN_ID = -1; // 0xffffffff
  }

  public class SwitchCompat extends android.widget.CompoundButton {
    ctor public SwitchCompat(android.content.Context);
    ctor public SwitchCompat(android.content.Context, android.util.AttributeSet);
    ctor public SwitchCompat(android.content.Context, android.util.AttributeSet, int);
    method public boolean getShowText();
    method public boolean getSplitTrack();
    method public int getSwitchMinWidth();
    method public int getSwitchPadding();
    method public java.lang.CharSequence getTextOff();
    method public java.lang.CharSequence getTextOn();
    method public android.graphics.drawable.Drawable getThumbDrawable();
    method public int getThumbTextPadding();
    method public android.content.res.ColorStateList getThumbTintList();
    method public android.graphics.PorterDuff.Mode getThumbTintMode();
    method public android.graphics.drawable.Drawable getTrackDrawable();
    method public android.content.res.ColorStateList getTrackTintList();
    method public android.graphics.PorterDuff.Mode getTrackTintMode();
    method public void onMeasure(int, int);
    method public void setShowText(boolean);
    method public void setSplitTrack(boolean);
    method public void setSwitchMinWidth(int);
    method public void setSwitchPadding(int);
    method public void setSwitchTextAppearance(android.content.Context, int);
    method public void setSwitchTypeface(android.graphics.Typeface, int);
    method public void setSwitchTypeface(android.graphics.Typeface);
    method public void setTextOff(java.lang.CharSequence);
    method public void setTextOn(java.lang.CharSequence);
    method public void setThumbDrawable(android.graphics.drawable.Drawable);
    method public void setThumbResource(int);
    method public void setThumbTextPadding(int);
    method public void setThumbTintList(android.content.res.ColorStateList);
    method public void setThumbTintMode(android.graphics.PorterDuff.Mode);
    method public void setTrackDrawable(android.graphics.drawable.Drawable);
    method public void setTrackResource(int);
    method public void setTrackTintList(android.content.res.ColorStateList);
    method public void setTrackTintMode(android.graphics.PorterDuff.Mode);
  }

  public abstract interface ThemedSpinnerAdapter implements android.widget.SpinnerAdapter {
    method public abstract android.content.res.Resources.Theme getDropDownViewTheme();
    method public abstract void setDropDownViewTheme(android.content.res.Resources.Theme);
  }

  public static final class ThemedSpinnerAdapter.Helper {
    ctor public ThemedSpinnerAdapter.Helper(android.content.Context);
    method public android.view.LayoutInflater getDropDownViewInflater();
    method public android.content.res.Resources.Theme getDropDownViewTheme();
    method public void setDropDownViewTheme(android.content.res.Resources.Theme);
  }

  public class Toolbar extends android.view.ViewGroup {
    ctor public Toolbar(android.content.Context);
    ctor public Toolbar(android.content.Context, android.util.AttributeSet);
    ctor public Toolbar(android.content.Context, android.util.AttributeSet, int);
    method public void collapseActionView();
    method public void dismissPopupMenus();
    method protected android.support.v7.widget.Toolbar.LayoutParams generateDefaultLayoutParams();
    method public android.support.v7.widget.Toolbar.LayoutParams generateLayoutParams(android.util.AttributeSet);
    method protected android.support.v7.widget.Toolbar.LayoutParams generateLayoutParams(android.view.ViewGroup.LayoutParams);
    method public int getContentInsetEnd();
    method public int getContentInsetEndWithActions();
    method public int getContentInsetLeft();
    method public int getContentInsetRight();
    method public int getContentInsetStart();
    method public int getContentInsetStartWithNavigation();
    method public int getCurrentContentInsetEnd();
    method public int getCurrentContentInsetLeft();
    method public int getCurrentContentInsetRight();
    method public int getCurrentContentInsetStart();
    method public android.graphics.drawable.Drawable getLogo();
    method public java.lang.CharSequence getLogoDescription();
    method public android.view.Menu getMenu();
    method public java.lang.CharSequence getNavigationContentDescription();
    method public android.graphics.drawable.Drawable getNavigationIcon();
    method public android.graphics.drawable.Drawable getOverflowIcon();
    method public int getPopupTheme();
    method public java.lang.CharSequence getSubtitle();
    method public java.lang.CharSequence getTitle();
    method public int getTitleMarginBottom();
    method public int getTitleMarginEnd();
    method public int getTitleMarginStart();
    method public int getTitleMarginTop();
    method public boolean hasExpandedActionView();
    method public boolean hideOverflowMenu();
    method public void inflateMenu(int);
    method public boolean isOverflowMenuShowing();
    method protected void onLayout(boolean, int, int, int, int);
    method public void setContentInsetEndWithActions(int);
    method public void setContentInsetStartWithNavigation(int);
    method public void setContentInsetsAbsolute(int, int);
    method public void setContentInsetsRelative(int, int);
    method public void setLogo(int);
    method public void setLogo(android.graphics.drawable.Drawable);
    method public void setLogoDescription(int);
    method public void setLogoDescription(java.lang.CharSequence);
    method public void setNavigationContentDescription(int);
    method public void setNavigationContentDescription(java.lang.CharSequence);
    method public void setNavigationIcon(int);
    method public void setNavigationIcon(android.graphics.drawable.Drawable);
    method public void setNavigationOnClickListener(android.view.View.OnClickListener);
    method public void setOnMenuItemClickListener(android.support.v7.widget.Toolbar.OnMenuItemClickListener);
    method public void setOverflowIcon(android.graphics.drawable.Drawable);
    method public void setPopupTheme(int);
    method public void setSubtitle(int);
    method public void setSubtitle(java.lang.CharSequence);
    method public void setSubtitleTextAppearance(android.content.Context, int);
    method public void setSubtitleTextColor(int);
    method public void setTitle(int);
    method public void setTitle(java.lang.CharSequence);
    method public void setTitleMargin(int, int, int, int);
    method public void setTitleMarginBottom(int);
    method public void setTitleMarginEnd(int);
    method public void setTitleMarginStart(int);
    method public void setTitleMarginTop(int);
    method public void setTitleTextAppearance(android.content.Context, int);
    method public void setTitleTextColor(int);
    method public boolean showOverflowMenu();
  }

  public static class Toolbar.LayoutParams extends android.support.v7.app.ActionBar.LayoutParams {
    ctor public Toolbar.LayoutParams(android.content.Context, android.util.AttributeSet);
    ctor public Toolbar.LayoutParams(int, int);
    ctor public Toolbar.LayoutParams(int, int, int);
    ctor public Toolbar.LayoutParams(int);
    ctor public Toolbar.LayoutParams(android.support.v7.widget.Toolbar.LayoutParams);
    ctor public Toolbar.LayoutParams(android.support.v7.app.ActionBar.LayoutParams);
    ctor public Toolbar.LayoutParams(android.view.ViewGroup.MarginLayoutParams);
    ctor public Toolbar.LayoutParams(android.view.ViewGroup.LayoutParams);
  }

  public static abstract interface Toolbar.OnMenuItemClickListener {
    method public abstract boolean onMenuItemClick(android.view.MenuItem);
  }

  public static class Toolbar.SavedState extends android.support.v4.view.AbsSavedState {
    ctor public Toolbar.SavedState(android.os.Parcel);
    ctor public Toolbar.SavedState(android.os.Parcel, java.lang.ClassLoader);
    ctor public Toolbar.SavedState(android.os.Parcelable);
    field public static final android.os.Parcelable.Creator<android.support.v7.widget.Toolbar.SavedState> CREATOR;
  }

  public class TooltipCompat {
    method public static void setTooltipText(android.view.View, java.lang.CharSequence);
  }

}

package android.support.v7.widget.helper {

  public class ItemTouchHelper extends android.support.v7.widget.RecyclerView.ItemDecoration implements android.support.v7.widget.RecyclerView.OnChildAttachStateChangeListener {
    ctor public ItemTouchHelper(android.support.v7.widget.helper.ItemTouchHelper.Callback);
    method public void attachToRecyclerView(android.support.v7.widget.RecyclerView);
    method public void onChildViewAttachedToWindow(android.view.View);
    method public void onChildViewDetachedFromWindow(android.view.View);
    method public void startDrag(android.support.v7.widget.RecyclerView.ViewHolder);
    method public void startSwipe(android.support.v7.widget.RecyclerView.ViewHolder);
    field public static final int ACTION_STATE_DRAG = 2; // 0x2
    field public static final int ACTION_STATE_IDLE = 0; // 0x0
    field public static final int ACTION_STATE_SWIPE = 1; // 0x1
    field public static final int ANIMATION_TYPE_DRAG = 8; // 0x8
    field public static final int ANIMATION_TYPE_SWIPE_CANCEL = 4; // 0x4
    field public static final int ANIMATION_TYPE_SWIPE_SUCCESS = 2; // 0x2
    field public static final int DOWN = 2; // 0x2
    field public static final int END = 32; // 0x20
    field public static final int LEFT = 4; // 0x4
    field public static final int RIGHT = 8; // 0x8
    field public static final int START = 16; // 0x10
    field public static final int UP = 1; // 0x1
  }

  public static abstract class ItemTouchHelper.Callback {
    ctor public ItemTouchHelper.Callback();
    method public boolean canDropOver(android.support.v7.widget.RecyclerView, android.support.v7.widget.RecyclerView.ViewHolder, android.support.v7.widget.RecyclerView.ViewHolder);
    method public android.support.v7.widget.RecyclerView.ViewHolder chooseDropTarget(android.support.v7.widget.RecyclerView.ViewHolder, java.util.List<android.support.v7.widget.RecyclerView.ViewHolder>, int, int);
    method public void clearView(android.support.v7.widget.RecyclerView, android.support.v7.widget.RecyclerView.ViewHolder);
    method public int convertToAbsoluteDirection(int, int);
    method public static int convertToRelativeDirection(int, int);
    method public long getAnimationDuration(android.support.v7.widget.RecyclerView, int, float, float);
    method public int getBoundingBoxMargin();
    method public static android.support.v7.widget.helper.ItemTouchUIUtil getDefaultUIUtil();
    method public float getMoveThreshold(android.support.v7.widget.RecyclerView.ViewHolder);
    method public abstract int getMovementFlags(android.support.v7.widget.RecyclerView, android.support.v7.widget.RecyclerView.ViewHolder);
    method public float getSwipeEscapeVelocity(float);
    method public float getSwipeThreshold(android.support.v7.widget.RecyclerView.ViewHolder);
    method public float getSwipeVelocityThreshold(float);
    method public int interpolateOutOfBoundsScroll(android.support.v7.widget.RecyclerView, int, int, int, long);
    method public boolean isItemViewSwipeEnabled();
    method public boolean isLongPressDragEnabled();
    method public static int makeFlag(int, int);
    method public static int makeMovementFlags(int, int);
    method public void onChildDraw(android.graphics.Canvas, android.support.v7.widget.RecyclerView, android.support.v7.widget.RecyclerView.ViewHolder, float, float, int, boolean);
    method public void onChildDrawOver(android.graphics.Canvas, android.support.v7.widget.RecyclerView, android.support.v7.widget.RecyclerView.ViewHolder, float, float, int, boolean);
    method public abstract boolean onMove(android.support.v7.widget.RecyclerView, android.support.v7.widget.RecyclerView.ViewHolder, android.support.v7.widget.RecyclerView.ViewHolder);
    method public void onMoved(android.support.v7.widget.RecyclerView, android.support.v7.widget.RecyclerView.ViewHolder, int, android.support.v7.widget.RecyclerView.ViewHolder, int, int, int);
    method public void onSelectedChanged(android.support.v7.widget.RecyclerView.ViewHolder, int);
    method public abstract void onSwiped(android.support.v7.widget.RecyclerView.ViewHolder, int);
    field public static final int DEFAULT_DRAG_ANIMATION_DURATION = 200; // 0xc8
    field public static final int DEFAULT_SWIPE_ANIMATION_DURATION = 250; // 0xfa
  }

  public static abstract class ItemTouchHelper.SimpleCallback extends android.support.v7.widget.helper.ItemTouchHelper.Callback {
    ctor public ItemTouchHelper.SimpleCallback(int, int);
    method public int getDragDirs(android.support.v7.widget.RecyclerView, android.support.v7.widget.RecyclerView.ViewHolder);
    method public int getMovementFlags(android.support.v7.widget.RecyclerView, android.support.v7.widget.RecyclerView.ViewHolder);
    method public int getSwipeDirs(android.support.v7.widget.RecyclerView, android.support.v7.widget.RecyclerView.ViewHolder);
    method public void setDefaultDragDirs(int);
    method public void setDefaultSwipeDirs(int);
  }

  public static abstract interface ItemTouchHelper.ViewDropHandler {
    method public abstract void prepareForDrop(android.view.View, android.view.View, int, int);
  }

  public abstract interface ItemTouchUIUtil {
    method public abstract void clearView(android.view.View);
    method public abstract void onDraw(android.graphics.Canvas, android.support.v7.widget.RecyclerView, android.view.View, float, float, int, boolean);
    method public abstract void onDrawOver(android.graphics.Canvas, android.support.v7.widget.RecyclerView, android.view.View, float, float, int, boolean);
    method public abstract void onSelected(android.view.View);
  }

}

package android.support.v7.widget.util {

  public abstract class SortedListAdapterCallback<T2> extends android.support.v7.util.SortedList.Callback {
    ctor public SortedListAdapterCallback(android.support.v7.widget.RecyclerView.Adapter);
    method public void onChanged(int, int);
    method public void onInserted(int, int);
    method public void onMoved(int, int);
    method public void onRemoved(int, int);
  }

}

package android.support.wear.widget {

  public class BoxInsetLayout extends android.view.ViewGroup {
    ctor public BoxInsetLayout(android.content.Context);
    ctor public BoxInsetLayout(android.content.Context, android.util.AttributeSet);
    ctor public BoxInsetLayout(android.content.Context, android.util.AttributeSet, int);
    method public android.support.wear.widget.BoxInsetLayout.LayoutParams generateLayoutParams(android.util.AttributeSet);
    method protected void onLayout(boolean, int, int, int, int);
  }

  public static class BoxInsetLayout.LayoutParams extends android.widget.FrameLayout.LayoutParams {
    ctor public BoxInsetLayout.LayoutParams(android.content.Context, android.util.AttributeSet);
    ctor public BoxInsetLayout.LayoutParams(int, int);
    ctor public BoxInsetLayout.LayoutParams(int, int, int);
    ctor public BoxInsetLayout.LayoutParams(int, int, int, int);
    ctor public BoxInsetLayout.LayoutParams(android.view.ViewGroup.LayoutParams);
    ctor public BoxInsetLayout.LayoutParams(android.view.ViewGroup.MarginLayoutParams);
    ctor public BoxInsetLayout.LayoutParams(android.widget.FrameLayout.LayoutParams);
    ctor public BoxInsetLayout.LayoutParams(android.support.wear.widget.BoxInsetLayout.LayoutParams);
    field public static final int BOX_ALL = 15; // 0xf
    field public static final int BOX_BOTTOM = 8; // 0x8
    field public static final int BOX_LEFT = 1; // 0x1
    field public static final int BOX_NONE = 0; // 0x0
    field public static final int BOX_RIGHT = 4; // 0x4
    field public static final int BOX_TOP = 2; // 0x2
    field public int boxedEdges;
  }

  public class CircularProgressLayout extends android.widget.FrameLayout {
    ctor public CircularProgressLayout(android.content.Context);
    ctor public CircularProgressLayout(android.content.Context, android.util.AttributeSet);
    ctor public CircularProgressLayout(android.content.Context, android.util.AttributeSet, int);
    ctor public CircularProgressLayout(android.content.Context, android.util.AttributeSet, int, int);
    method public int getBackgroundColor();
    method public int[] getColorSchemeColors();
    method public android.support.wear.widget.CircularProgressLayout.OnTimerFinishedListener getOnTimerFinishedListener();
    method public android.support.v4.widget.CircularProgressDrawable getProgressDrawable();
    method public float getStartingRotation();
    method public float getStrokeWidth();
    method public long getTotalTime();
    method public boolean isIndeterminate();
    method public boolean isTimerRunning();
    method public void setColorSchemeColors(int...);
    method public void setIndeterminate(boolean);
    method public void setOnTimerFinishedListener(android.support.wear.widget.CircularProgressLayout.OnTimerFinishedListener);
    method public void setStartingRotation(float);
    method public void setStrokeWidth(float);
    method public void setTotalTime(long);
    method public void startTimer();
    method public void stopTimer();
  }

  public static abstract interface CircularProgressLayout.OnTimerFinishedListener {
    method public abstract void onTimerFinished(android.support.wear.widget.CircularProgressLayout);
  }

  public class CurvingLayoutCallback extends android.support.wear.widget.WearableLinearLayoutManager.LayoutCallback {
    ctor public CurvingLayoutCallback(android.content.Context);
    method public void adjustAnchorOffsetXY(android.view.View, float[]);
    method public void onLayoutFinished(android.view.View, android.support.v7.widget.RecyclerView);
  }

  public class RoundedDrawable extends android.graphics.drawable.Drawable {
    ctor public RoundedDrawable();
    method public void draw(android.graphics.Canvas);
    method public int getBackgroundColor();
    method public android.graphics.drawable.Drawable getDrawable();
    method public int getOpacity();
    method public int getRadius();
    method public boolean isClipEnabled();
    method public void setAlpha(int);
    method public void setBackgroundColor(int);
    method public void setClipEnabled(boolean);
    method public void setColorFilter(android.graphics.ColorFilter);
    method public void setDrawable(android.graphics.drawable.Drawable);
    method public void setRadius(int);
  }

  public class SwipeDismissFrameLayout extends android.widget.FrameLayout {
    ctor public SwipeDismissFrameLayout(android.content.Context);
    ctor public SwipeDismissFrameLayout(android.content.Context, android.util.AttributeSet);
    ctor public SwipeDismissFrameLayout(android.content.Context, android.util.AttributeSet, int);
    ctor public SwipeDismissFrameLayout(android.content.Context, android.util.AttributeSet, int, int);
    method public void addCallback(android.support.wear.widget.SwipeDismissFrameLayout.Callback);
    method public void removeCallback(android.support.wear.widget.SwipeDismissFrameLayout.Callback);
  }

  public static abstract class SwipeDismissFrameLayout.Callback {
    ctor public SwipeDismissFrameLayout.Callback();
    method public void onDismissed(android.support.wear.widget.SwipeDismissFrameLayout);
    method public void onSwipeCanceled(android.support.wear.widget.SwipeDismissFrameLayout);
    method public void onSwipeStarted(android.support.wear.widget.SwipeDismissFrameLayout);
  }

  public class WearableLinearLayoutManager extends android.support.v7.widget.LinearLayoutManager {
    ctor public WearableLinearLayoutManager(android.content.Context, android.support.wear.widget.WearableLinearLayoutManager.LayoutCallback);
    ctor public WearableLinearLayoutManager(android.content.Context);
    method public android.support.wear.widget.WearableLinearLayoutManager.LayoutCallback getLayoutCallback();
    method public void setLayoutCallback(android.support.wear.widget.WearableLinearLayoutManager.LayoutCallback);
  }

  public static abstract class WearableLinearLayoutManager.LayoutCallback {
    ctor public WearableLinearLayoutManager.LayoutCallback();
    method public abstract void onLayoutFinished(android.view.View, android.support.v7.widget.RecyclerView);
  }

  public class WearableRecyclerView extends android.support.v7.widget.RecyclerView {
    ctor public WearableRecyclerView(android.content.Context);
    ctor public WearableRecyclerView(android.content.Context, android.util.AttributeSet);
    ctor public WearableRecyclerView(android.content.Context, android.util.AttributeSet, int);
    ctor public WearableRecyclerView(android.content.Context, android.util.AttributeSet, int, int);
    method public float getBezelFraction();
    method public float getScrollDegreesPerScreen();
    method public boolean isCircularScrollingGestureEnabled();
    method public boolean isEdgeItemsCenteringEnabled();
    method public void setBezelFraction(float);
    method public void setCircularScrollingGestureEnabled(boolean);
    method public void setEdgeItemsCenteringEnabled(boolean);
    method public void setScrollDegreesPerScreen(float);
  }

}

package android.support.wear.widget.drawer {

  public class WearableActionDrawerView extends android.support.wear.widget.drawer.WearableDrawerView {
    ctor public WearableActionDrawerView(android.content.Context);
    ctor public WearableActionDrawerView(android.content.Context, android.util.AttributeSet);
    ctor public WearableActionDrawerView(android.content.Context, android.util.AttributeSet, int);
    ctor public WearableActionDrawerView(android.content.Context, android.util.AttributeSet, int, int);
    method public android.view.Menu getMenu();
    method public void setOnMenuItemClickListener(android.view.MenuItem.OnMenuItemClickListener);
    method public void setTitle(java.lang.CharSequence);
  }

  public class WearableDrawerController {
    method public void closeDrawer();
    method public void openDrawer();
    method public void peekDrawer();
  }

  public class WearableDrawerLayout extends android.widget.FrameLayout implements android.support.v4.view.NestedScrollingParent android.view.View.OnLayoutChangeListener {
    ctor public WearableDrawerLayout(android.content.Context);
    ctor public WearableDrawerLayout(android.content.Context, android.util.AttributeSet);
    ctor public WearableDrawerLayout(android.content.Context, android.util.AttributeSet, int);
    ctor public WearableDrawerLayout(android.content.Context, android.util.AttributeSet, int, int);
    method public void onFlingComplete(android.view.View);
    method public void onLayoutChange(android.view.View, int, int, int, int, int, int, int, int);
    method public void setDrawerStateCallback(android.support.wear.widget.drawer.WearableDrawerLayout.DrawerStateCallback);
  }

  public static class WearableDrawerLayout.DrawerStateCallback {
    ctor public WearableDrawerLayout.DrawerStateCallback();
    method public void onDrawerClosed(android.support.wear.widget.drawer.WearableDrawerLayout, android.support.wear.widget.drawer.WearableDrawerView);
    method public void onDrawerOpened(android.support.wear.widget.drawer.WearableDrawerLayout, android.support.wear.widget.drawer.WearableDrawerView);
    method public void onDrawerStateChanged(android.support.wear.widget.drawer.WearableDrawerLayout, int);
  }

  public class WearableDrawerView extends android.widget.FrameLayout {
    ctor public WearableDrawerView(android.content.Context);
    ctor public WearableDrawerView(android.content.Context, android.util.AttributeSet);
    ctor public WearableDrawerView(android.content.Context, android.util.AttributeSet, int);
    ctor public WearableDrawerView(android.content.Context, android.util.AttributeSet, int, int);
    method public android.support.wear.widget.drawer.WearableDrawerController getController();
    method public android.view.View getDrawerContent();
    method public int getDrawerState();
    method public boolean isAutoPeekEnabled();
    method public boolean isClosed();
    method public boolean isLocked();
    method public boolean isLockedWhenClosed();
    method public boolean isOpenOnlyAtTopEnabled();
    method public boolean isOpened();
    method public boolean isPeekOnScrollDownEnabled();
    method public boolean isPeeking();
    method public void onDrawerClosed();
    method public void onDrawerOpened();
    method public void onDrawerStateChanged(int);
    method public void onPeekContainerClicked(android.view.View);
    method public void setDrawerContent(android.view.View);
    method public void setIsAutoPeekEnabled(boolean);
    method public void setIsLocked(boolean);
    method public void setLockedWhenClosed(boolean);
    method public void setOpenOnlyAtTopEnabled(boolean);
    method public void setPeekContent(android.view.View);
    method public void setPeekOnScrollDownEnabled(boolean);
    field public static final int STATE_DRAGGING = 1; // 0x1
    field public static final int STATE_IDLE = 0; // 0x0
    field public static final int STATE_SETTLING = 2; // 0x2
  }

  public class WearableNavigationDrawerView extends android.support.wear.widget.drawer.WearableDrawerView {
    ctor public WearableNavigationDrawerView(android.content.Context);
    ctor public WearableNavigationDrawerView(android.content.Context, android.util.AttributeSet);
    ctor public WearableNavigationDrawerView(android.content.Context, android.util.AttributeSet, int);
    ctor public WearableNavigationDrawerView(android.content.Context, android.util.AttributeSet, int, int);
    method public void addOnItemSelectedListener(android.support.wear.widget.drawer.WearableNavigationDrawerView.OnItemSelectedListener);
    method public int getNavigationStyle();
    method public void removeOnItemSelectedListener(android.support.wear.widget.drawer.WearableNavigationDrawerView.OnItemSelectedListener);
    method public void setAdapter(android.support.wear.widget.drawer.WearableNavigationDrawerView.WearableNavigationDrawerAdapter);
    method public void setCurrentItem(int, boolean);
    field public static final int MULTI_PAGE = 1; // 0x1
    field public static final int SINGLE_PAGE = 0; // 0x0
  }

  public static abstract interface WearableNavigationDrawerView.OnItemSelectedListener {
    method public abstract void onItemSelected(int);
  }

  public static abstract class WearableNavigationDrawerView.WearableNavigationDrawerAdapter {
    ctor public WearableNavigationDrawerView.WearableNavigationDrawerAdapter();
    method public abstract int getCount();
    method public abstract android.graphics.drawable.Drawable getItemDrawable(int);
    method public abstract java.lang.CharSequence getItemText(int);
    method public void notifyDataSetChanged();
  }

}

