Made some changes to window caption APIs
As recommended by API council.
Bug: 26509365
Change-Id: I4efca89e2e14ffcf66ab8372f694e8bbf58d6fef
diff --git a/api/current.txt b/api/current.txt
index 3260d4c..d7ccf68 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -43225,7 +43225,7 @@
method public abstract void setNavigationBarColor(int);
method public void setReenterTransition(android.transition.Transition);
method public abstract void setResizingCaptionDrawable(android.graphics.drawable.Drawable);
- method public final void setRestrictedCaptionAreaListener(android.view.Window.RestrictedCaptionAreaListener);
+ method public final void setRestrictedCaptionAreaListener(android.view.Window.OnRestrictedCaptionAreaChangedListener);
method public void setReturnTransition(android.transition.Transition);
method public void setSharedElementEnterTransition(android.transition.Transition);
method public void setSharedElementExitTransition(android.transition.Transition);
@@ -43312,7 +43312,7 @@
method public abstract android.view.ActionMode onWindowStartingActionMode(android.view.ActionMode.Callback, int);
}
- public static abstract interface Window.RestrictedCaptionAreaListener {
+ public static abstract interface Window.OnRestrictedCaptionAreaChangedListener {
method public abstract void onRestrictedCaptionAreaChanged(android.graphics.Rect);
}
diff --git a/api/system-current.txt b/api/system-current.txt
index ef6506d..834a302 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -45643,7 +45643,7 @@
method public abstract void setNavigationBarColor(int);
method public void setReenterTransition(android.transition.Transition);
method public abstract void setResizingCaptionDrawable(android.graphics.drawable.Drawable);
- method public final void setRestrictedCaptionAreaListener(android.view.Window.RestrictedCaptionAreaListener);
+ method public final void setRestrictedCaptionAreaListener(android.view.Window.OnRestrictedCaptionAreaChangedListener);
method public void setReturnTransition(android.transition.Transition);
method public void setSharedElementEnterTransition(android.transition.Transition);
method public void setSharedElementExitTransition(android.transition.Transition);
@@ -45730,7 +45730,7 @@
method public abstract android.view.ActionMode onWindowStartingActionMode(android.view.ActionMode.Callback, int);
}
- public static abstract interface Window.RestrictedCaptionAreaListener {
+ public static abstract interface Window.OnRestrictedCaptionAreaChangedListener {
method public abstract void onRestrictedCaptionAreaChanged(android.graphics.Rect);
}
diff --git a/api/test-current.txt b/api/test-current.txt
index db1ca19..aa7703c 100644
--- a/api/test-current.txt
+++ b/api/test-current.txt
@@ -43242,7 +43242,7 @@
method public abstract void setNavigationBarColor(int);
method public void setReenterTransition(android.transition.Transition);
method public abstract void setResizingCaptionDrawable(android.graphics.drawable.Drawable);
- method public final void setRestrictedCaptionAreaListener(android.view.Window.RestrictedCaptionAreaListener);
+ method public final void setRestrictedCaptionAreaListener(android.view.Window.OnRestrictedCaptionAreaChangedListener);
method public void setReturnTransition(android.transition.Transition);
method public void setSharedElementEnterTransition(android.transition.Transition);
method public void setSharedElementExitTransition(android.transition.Transition);
@@ -43329,7 +43329,7 @@
method public abstract android.view.ActionMode onWindowStartingActionMode(android.view.ActionMode.Callback, int);
}
- public static abstract interface Window.RestrictedCaptionAreaListener {
+ public static abstract interface Window.OnRestrictedCaptionAreaChangedListener {
method public abstract void onRestrictedCaptionAreaChanged(android.graphics.Rect);
}
diff --git a/core/java/android/view/Window.java b/core/java/android/view/Window.java
index ee70891..f653daf 100644
--- a/core/java/android/view/Window.java
+++ b/core/java/android/view/Window.java
@@ -34,7 +34,6 @@
import android.media.session.MediaController;
import android.net.Uri;
import android.os.Bundle;
-import android.os.Handler;
import android.os.IBinder;
import android.os.RemoteException;
import android.os.SystemProperties;
@@ -273,7 +272,7 @@
private Callback mCallback;
private OnWindowDismissedCallback mOnWindowDismissedCallback;
private WindowControllerCallback mWindowControllerCallback;
- private RestrictedCaptionAreaListener mRestrictedCaptionAreaListener;
+ private OnRestrictedCaptionAreaChangedListener mOnRestrictedCaptionAreaChangedListener;
private Rect mRestrictedCaptionAreaRect;
private WindowManager mWindowManager;
private IBinder mAppToken;
@@ -596,7 +595,7 @@
/**
* Callback for clients that want to be aware of where caption draws content.
*/
- public interface RestrictedCaptionAreaListener {
+ public interface OnRestrictedCaptionAreaChangedListener {
/**
* Called when the area where caption draws content changes.
*
@@ -856,8 +855,8 @@
*
* @param listener Callback that will be called when the area changes.
*/
- public final void setRestrictedCaptionAreaListener(RestrictedCaptionAreaListener listener) {
- mRestrictedCaptionAreaListener = listener;
+ public final void setRestrictedCaptionAreaListener(OnRestrictedCaptionAreaChangedListener listener) {
+ mOnRestrictedCaptionAreaChangedListener = listener;
mRestrictedCaptionAreaRect = listener != null ? new Rect() : null;
}
@@ -2126,17 +2125,20 @@
/** @hide */
public void notifyRestrictedCaptionAreaCallback(int left, int top, int right, int bottom) {
- if (mRestrictedCaptionAreaListener != null) {
+ if (mOnRestrictedCaptionAreaChangedListener != null) {
mRestrictedCaptionAreaRect.set(left, top, right, bottom);
- mRestrictedCaptionAreaListener.onRestrictedCaptionAreaChanged(
+ mOnRestrictedCaptionAreaChangedListener.onRestrictedCaptionAreaChanged(
mRestrictedCaptionAreaRect);
}
}
/**
* Set what color should the caption controls be. By default the system will try to determine
- * the color from the theme. You can overwrite this by using {@link #DECOR_CAPTION_SHADE_DARK}
- * or {@link #DECOR_CAPTION_SHADE_DARK}.
+ * the color from the theme. You can overwrite this by using {@link #DECOR_CAPTION_SHADE_DARK},
+ * {@link #DECOR_CAPTION_SHADE_LIGHT}, or {@link #DECOR_CAPTION_SHADE_AUTO}.
+ * @see #DECOR_CAPTION_SHADE_DARK
+ * @see #DECOR_CAPTION_SHADE_LIGHT
+ * @see #DECOR_CAPTION_SHADE_AUTO
*/
public abstract void setDecorCaptionShade(int decorCaptionShade);