summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--api/current.txt10
-rw-r--r--api/system-current.txt10
-rw-r--r--api/test-current.txt10
-rw-r--r--core/java/android/view/Window.java65
-rw-r--r--core/java/com/android/internal/policy/BackdropFrameRenderer.java19
-rw-r--r--core/java/com/android/internal/policy/DecorView.java107
-rw-r--r--core/java/com/android/internal/policy/PhoneWindow.java22
-rw-r--r--core/java/com/android/internal/widget/DecorCaptionView.java4
-rw-r--r--core/res/res/drawable/ic_decor_close_button_dark_focused.xml2
-rw-r--r--core/res/res/drawable/ic_decor_close_button_dark_unfocused.xml2
-rw-r--r--core/res/res/drawable/ic_decor_close_button_light_focused.xml2
-rw-r--r--core/res/res/drawable/ic_decor_close_button_light_unfocused.xml2
-rw-r--r--core/res/res/drawable/ic_decor_maximize_button_dark_focused.xml4
-rw-r--r--core/res/res/drawable/ic_decor_maximize_button_dark_unfocused.xml4
-rw-r--r--core/res/res/drawable/ic_decor_maximize_button_light_focused.xml4
-rw-r--r--core/res/res/drawable/ic_decor_maximize_button_light_unfocused.xml4
-rw-r--r--core/res/res/layout/decor_caption.xml52
-rw-r--r--core/res/res/layout/decor_caption_dark.xml52
-rw-r--r--core/res/res/layout/decor_caption_light.xml52
-rw-r--r--core/res/res/values/symbols.xml7
20 files changed, 285 insertions, 149 deletions
diff --git a/api/current.txt b/api/current.txt
index dd22a402d362..1e99d56e44d2 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -41832,6 +41832,7 @@ package android.view {
method public abstract void setContentView(int);
method public abstract void setContentView(android.view.View);
method public abstract void setContentView(android.view.View, android.view.ViewGroup.LayoutParams);
+ method public abstract void setDecorCaptionShade(int);
method protected void setDefaultWindowFormat(int);
method public void setDimAmount(float);
method public void setElevation(float);
@@ -41852,6 +41853,8 @@ package android.view {
method public void setMediaController(android.media.session.MediaController);
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 void setReturnTransition(android.transition.Transition);
method public void setSharedElementEnterTransition(android.transition.Transition);
method public void setSharedElementExitTransition(android.transition.Transition);
@@ -41880,6 +41883,9 @@ package android.view {
method public abstract void takeKeyEvents(boolean);
method public abstract void takeSurface(android.view.SurfaceHolder.Callback2);
method public abstract void togglePanel(int, android.view.KeyEvent);
+ field public static final int DECOR_CAPTION_SHADE_AUTO = 0; // 0x0
+ field public static final int DECOR_CAPTION_SHADE_DARK = 2; // 0x2
+ field public static final int DECOR_CAPTION_SHADE_LIGHT = 1; // 0x1
field protected static final deprecated int DEFAULT_FEATURES = 65; // 0x41
field public static final int FEATURE_ACTION_BAR = 8; // 0x8
field public static final int FEATURE_ACTION_BAR_OVERLAY = 9; // 0x9
@@ -41934,6 +41940,10 @@ package android.view {
method public abstract android.view.ActionMode onWindowStartingActionMode(android.view.ActionMode.Callback, int);
}
+ public static abstract interface Window.RestrictedCaptionAreaListener {
+ method public abstract void onRestrictedCaptionAreaChanged(android.graphics.Rect);
+ }
+
public final class WindowAnimationFrameStats extends android.view.FrameStats implements android.os.Parcelable {
method public int describeContents();
method public void writeToParcel(android.os.Parcel, int);
diff --git a/api/system-current.txt b/api/system-current.txt
index ee20e5bca9fb..8be751cd383b 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -44170,6 +44170,7 @@ package android.view {
method public abstract void setContentView(int);
method public abstract void setContentView(android.view.View);
method public abstract void setContentView(android.view.View, android.view.ViewGroup.LayoutParams);
+ method public abstract void setDecorCaptionShade(int);
method protected void setDefaultWindowFormat(int);
method public void setDimAmount(float);
method public void setDisableWallpaperTouchEvents(boolean);
@@ -44191,6 +44192,8 @@ package android.view {
method public void setMediaController(android.media.session.MediaController);
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 void setReturnTransition(android.transition.Transition);
method public void setSharedElementEnterTransition(android.transition.Transition);
method public void setSharedElementExitTransition(android.transition.Transition);
@@ -44219,6 +44222,9 @@ package android.view {
method public abstract void takeKeyEvents(boolean);
method public abstract void takeSurface(android.view.SurfaceHolder.Callback2);
method public abstract void togglePanel(int, android.view.KeyEvent);
+ field public static final int DECOR_CAPTION_SHADE_AUTO = 0; // 0x0
+ field public static final int DECOR_CAPTION_SHADE_DARK = 2; // 0x2
+ field public static final int DECOR_CAPTION_SHADE_LIGHT = 1; // 0x1
field protected static final deprecated int DEFAULT_FEATURES = 65; // 0x41
field public static final int FEATURE_ACTION_BAR = 8; // 0x8
field public static final int FEATURE_ACTION_BAR_OVERLAY = 9; // 0x9
@@ -44273,6 +44279,10 @@ package android.view {
method public abstract android.view.ActionMode onWindowStartingActionMode(android.view.ActionMode.Callback, int);
}
+ public static abstract interface Window.RestrictedCaptionAreaListener {
+ method public abstract void onRestrictedCaptionAreaChanged(android.graphics.Rect);
+ }
+
public final class WindowAnimationFrameStats extends android.view.FrameStats implements android.os.Parcelable {
method public int describeContents();
method public void writeToParcel(android.os.Parcel, int);
diff --git a/api/test-current.txt b/api/test-current.txt
index 032507b122ac..3e455102a05e 100644
--- a/api/test-current.txt
+++ b/api/test-current.txt
@@ -41834,6 +41834,7 @@ package android.view {
method public abstract void setContentView(int);
method public abstract void setContentView(android.view.View);
method public abstract void setContentView(android.view.View, android.view.ViewGroup.LayoutParams);
+ method public abstract void setDecorCaptionShade(int);
method protected void setDefaultWindowFormat(int);
method public void setDimAmount(float);
method public void setElevation(float);
@@ -41854,6 +41855,8 @@ package android.view {
method public void setMediaController(android.media.session.MediaController);
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 void setReturnTransition(android.transition.Transition);
method public void setSharedElementEnterTransition(android.transition.Transition);
method public void setSharedElementExitTransition(android.transition.Transition);
@@ -41882,6 +41885,9 @@ package android.view {
method public abstract void takeKeyEvents(boolean);
method public abstract void takeSurface(android.view.SurfaceHolder.Callback2);
method public abstract void togglePanel(int, android.view.KeyEvent);
+ field public static final int DECOR_CAPTION_SHADE_AUTO = 0; // 0x0
+ field public static final int DECOR_CAPTION_SHADE_DARK = 2; // 0x2
+ field public static final int DECOR_CAPTION_SHADE_LIGHT = 1; // 0x1
field protected static final deprecated int DEFAULT_FEATURES = 65; // 0x41
field public static final int FEATURE_ACTION_BAR = 8; // 0x8
field public static final int FEATURE_ACTION_BAR_OVERLAY = 9; // 0x9
@@ -41936,6 +41942,10 @@ package android.view {
method public abstract android.view.ActionMode onWindowStartingActionMode(android.view.ActionMode.Callback, int);
}
+ public static abstract interface Window.RestrictedCaptionAreaListener {
+ method public abstract void onRestrictedCaptionAreaChanged(android.graphics.Rect);
+ }
+
public final class WindowAnimationFrameStats extends android.view.FrameStats implements android.os.Parcelable {
method public int describeContents();
method public void writeToParcel(android.os.Parcel, int);
diff --git a/core/java/android/view/Window.java b/core/java/android/view/Window.java
index 7a359e79d4c5..53490b4e15e3 100644
--- a/core/java/android/view/Window.java
+++ b/core/java/android/view/Window.java
@@ -29,6 +29,7 @@ import android.content.res.Configuration;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.PixelFormat;
+import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.media.session.MediaController;
import android.net.Uri;
@@ -247,12 +248,30 @@ public abstract class Window {
private static final String PROPERTY_HARDWARE_UI = "persist.sys.ui.hw";
+ /**
+ * Flag for letting the theme drive the color of the window caption controls. Use with
+ * {@link #setDecorCaptionShade(int)}. This is the default value.
+ */
+ public static final int DECOR_CAPTION_SHADE_AUTO = 0;
+ /**
+ * Flag for setting light-color controls on the window caption. Use with
+ * {@link #setDecorCaptionShade(int)}.
+ */
+ public static final int DECOR_CAPTION_SHADE_LIGHT = 1;
+ /**
+ * Flag for setting dark-color controls on the window caption. Use with
+ * {@link #setDecorCaptionShade(int)}.
+ */
+ public static final int DECOR_CAPTION_SHADE_DARK = 2;
+
private final Context mContext;
private TypedArray mWindowStyle;
private Callback mCallback;
private OnWindowDismissedCallback mOnWindowDismissedCallback;
private WindowControllerCallback mWindowControllerCallback;
+ private RestrictedCaptionAreaListener mRestrictedCaptionAreaListener;
+ private Rect mRestrictedCaptionAreaRect;
private WindowManager mWindowManager;
private IBinder mAppToken;
private String mAppName;
@@ -565,6 +584,18 @@ public abstract class Window {
int getWindowStackId() throws RemoteException;
}
+ /**
+ * Callback for clients that want to be aware of where caption draws content.
+ */
+ public interface RestrictedCaptionAreaListener {
+ /**
+ * Called when the area where caption draws content changes.
+ *
+ * @param rect The area where caption content is positioned, relative to the top view.
+ */
+ void onRestrictedCaptionAreaChanged(Rect rect);
+ }
+
public Window(Context context) {
mContext = context;
mFeatures = mLocalFeatures = getDefaultFeatures(context);
@@ -778,6 +809,16 @@ public abstract class Window {
}
/**
+ * Set a callback for changes of area where caption will draw its content.
+ *
+ * @param listener Callback that will be called when the area changes.
+ */
+ public final void setRestrictedCaptionAreaListener(RestrictedCaptionAreaListener listener) {
+ mRestrictedCaptionAreaListener = listener;
+ mRestrictedCaptionAreaRect = listener != null ? new Rect() : null;
+ }
+
+ /**
* Take ownership of this window's surface. The window's view hierarchy
* will no longer draw into the surface, though it will otherwise continue
* to operate (such as for receiving input events). The given SurfaceHolder
@@ -2040,5 +2081,29 @@ public abstract class Window {
return mOverlayWithDecorCaption;
}
+ /** @hide */
+ public void notifyRestrictedCaptionAreaCallback(int left, int top, int right, int bottom) {
+ if (mRestrictedCaptionAreaListener != null) {
+ mRestrictedCaptionAreaRect.set(left, top, right, bottom);
+ mRestrictedCaptionAreaListener.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}.
+ */
+ public abstract void setDecorCaptionShade(int decorCaptionShade);
+ /**
+ * Set the drawable that is drawn underneath the caption during the resizing.
+ *
+ * During the resizing the caption might not be drawn fast enough to match the new dimensions.
+ * There is a second caption drawn underneath it that will be fast enough. By default the
+ * caption is constructed from the theme. You can provide a drawable, that will be drawn instead
+ * to better match your application.
+ */
+ public abstract void setResizingCaptionDrawable(Drawable drawable);
}
diff --git a/core/java/com/android/internal/policy/BackdropFrameRenderer.java b/core/java/com/android/internal/policy/BackdropFrameRenderer.java
index 75ca639a2317..1b44ff3ec3fb 100644
--- a/core/java/com/android/internal/policy/BackdropFrameRenderer.java
+++ b/core/java/com/android/internal/policy/BackdropFrameRenderer.java
@@ -63,17 +63,18 @@ public class BackdropFrameRenderer extends Thread implements Choreographer.Frame
private boolean mReportNextDraw;
private Drawable mCaptionBackgroundDrawable;
+ private Drawable mUserCaptionBackgroundDrawable;
private Drawable mResizingBackgroundDrawable;
private ColorDrawable mStatusBarColor;
public BackdropFrameRenderer(DecorView decorView, ThreadedRenderer renderer, Rect initialBounds,
Drawable resizingBackgroundDrawable, Drawable captionBackgroundDrawable,
- int statusBarColor) {
+ Drawable userCaptionBackgroundDrawable, int statusBarColor) {
setName("ResizeFrame");
mRenderer = renderer;
onResourcesLoaded(decorView, resizingBackgroundDrawable, captionBackgroundDrawable,
- statusBarColor);
+ userCaptionBackgroundDrawable, statusBarColor);
// Create a render node for the content and frame backdrop
// which can be resized independently from the content.
@@ -92,10 +93,12 @@ public class BackdropFrameRenderer extends Thread implements Choreographer.Frame
}
void onResourcesLoaded(DecorView decorView, Drawable resizingBackgroundDrawable,
- Drawable captionBackgroundDrawableDrawable, int statusBarColor) {
+ Drawable captionBackgroundDrawableDrawable, Drawable userCaptionBackgroundDrawable,
+ int statusBarColor) {
mDecorView = decorView;
mResizingBackgroundDrawable = resizingBackgroundDrawable;
mCaptionBackgroundDrawable = captionBackgroundDrawableDrawable;
+ mUserCaptionBackgroundDrawable = userCaptionBackgroundDrawable;
if (statusBarColor != 0) {
mStatusBarColor = new ColorDrawable(statusBarColor);
addSystemBarNodeIfNeeded();
@@ -281,8 +284,10 @@ public class BackdropFrameRenderer extends Thread implements Choreographer.Frame
// Draw the caption and content backdrops in to our render node.
DisplayListCanvas canvas = mFrameAndBackdropNode.start(width, height);
- mCaptionBackgroundDrawable.setBounds(0, 0, left + width, top + mLastCaptionHeight);
- mCaptionBackgroundDrawable.draw(canvas);
+ final Drawable drawable = mUserCaptionBackgroundDrawable != null
+ ? mUserCaptionBackgroundDrawable : mCaptionBackgroundDrawable;
+ drawable.setBounds(0, 0, left + width, top + mLastCaptionHeight);
+ drawable.draw(canvas);
// The backdrop: clear everything with the background. Clipping is done elsewhere.
mResizingBackgroundDrawable.setBounds(0, mLastCaptionHeight, left + width, top + height);
@@ -324,4 +329,8 @@ public class BackdropFrameRenderer extends Thread implements Choreographer.Frame
mChoreographer.postFrameCallback(this);
}
}
+
+ void setUserCaptionBackgroundDrawable(Drawable userCaptionBackgroundDrawable) {
+ mUserCaptionBackgroundDrawable = userCaptionBackgroundDrawable;
+ }
}
diff --git a/core/java/com/android/internal/policy/DecorView.java b/core/java/com/android/internal/policy/DecorView.java
index 531ba2f97671..e40556446a39 100644
--- a/core/java/com/android/internal/policy/DecorView.java
+++ b/core/java/com/android/internal/policy/DecorView.java
@@ -74,6 +74,8 @@ import static android.view.View.MeasureSpec.EXACTLY;
import static android.view.View.MeasureSpec.getMode;
import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT;
+import static android.view.Window.DECOR_CAPTION_SHADE_DARK;
+import static android.view.Window.DECOR_CAPTION_SHADE_LIGHT;
import static android.view.WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS;
import static android.view.WindowManager.LayoutParams.FLAG_FULLSCREEN;
import static android.view.WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION;
@@ -184,9 +186,10 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind
private boolean mWindowResizeCallbacksAdded = false;
- BackdropFrameRenderer mBackdropFrameRenderer = null;
+ private BackdropFrameRenderer mBackdropFrameRenderer = null;
private Drawable mResizingBackgroundDrawable;
private Drawable mCaptionBackgroundDrawable;
+ private Drawable mUserCaptionBackgroundDrawable;
DecorView(Context context, int featureId, PhoneWindow window) {
super(context);
@@ -1580,18 +1583,20 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind
initializeElevation();
}
- View onResourcesLoaded(LayoutInflater inflater, int layoutResource) {
+ void onResourcesLoaded(LayoutInflater inflater, int layoutResource) {
mStackId = getStackId();
mResizingBackgroundDrawable = getResizingBackgroundDrawable(
mWindow.mBackgroundResource, mWindow.mBackgroundFallbackResource);
- mCaptionBackgroundDrawable =
- getContext().getDrawable(R.drawable.decor_caption_title_focused);
+ if (mCaptionBackgroundDrawable == null) {
+ mCaptionBackgroundDrawable = getContext().getDrawable(
+ R.drawable.decor_caption_title_focused);
+ }
if (mBackdropFrameRenderer != null) {
mBackdropFrameRenderer.onResourcesLoaded(
this, mResizingBackgroundDrawable, mCaptionBackgroundDrawable,
- getCurrentColor(mStatusColorViewState));
+ mUserCaptionBackgroundDrawable, getCurrentColor(mStatusColorViewState));
}
mDecorCaptionView = createDecorCaptionView(inflater);
@@ -1608,17 +1613,16 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind
}
mContentRoot = (ViewGroup) root;
initializeElevation();
- return root;
}
// Free floating overlapping windows require a caption.
private DecorCaptionView createDecorCaptionView(LayoutInflater inflater) {
- DecorCaptionView DecorCaptionView = null;
- for (int i = getChildCount() - 1; i >= 0 && DecorCaptionView == null; i--) {
+ DecorCaptionView decorCaptionView = null;
+ for (int i = getChildCount() - 1; i >= 0 && decorCaptionView == null; i--) {
View view = getChildAt(i);
if (view instanceof DecorCaptionView) {
// The decor was most likely saved from a relaunch - so reuse it.
- DecorCaptionView = (DecorCaptionView) view;
+ decorCaptionView = (DecorCaptionView) view;
removeViewAt(i);
}
}
@@ -1630,27 +1634,72 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind
&& ActivityManager.StackId.hasWindowDecor(mStackId)) {
// Dependent on the brightness of the used title we either use the
// dark or the light button frame.
- if (DecorCaptionView == null) {
- Context context = getContext();
+ if (decorCaptionView == null) {
+ decorCaptionView = inflateDecorCaptionView(inflater);
+ }
+ decorCaptionView.setPhoneWindow(mWindow, true /*showDecor*/);
+ } else {
+ decorCaptionView = null;
+ }
+
+ // Tell the decor if it has a visible caption.
+ enableCaption(decorCaptionView != null);
+ return decorCaptionView;
+ }
+
+ private DecorCaptionView inflateDecorCaptionView(LayoutInflater inflater) {
+ final Context context = getContext();
+ // We make a copy of the inflater, so it has the right context associated with it.
+ inflater = inflater.from(context);
+ final DecorCaptionView view = (DecorCaptionView) inflater.inflate(R.layout.decor_caption,
+ null);
+ setDecorCaptionShade(context, view);
+ return view;
+ }
+
+ private void setDecorCaptionShade(Context context, DecorCaptionView view) {
+ final int shade = mWindow.getDecorCaptionShade();
+ switch (shade) {
+ case DECOR_CAPTION_SHADE_LIGHT:
+ setLightDecorCaptionShade(view);
+ break;
+ case DECOR_CAPTION_SHADE_DARK:
+ setDarkDecorCaptionShade(view);
+ break;
+ default: {
TypedValue value = new TypedValue();
context.getTheme().resolveAttribute(R.attr.colorPrimary, value, true);
- inflater = inflater.from(context);
+ // We invert the shade depending on brightness of the theme. Dark shade for light
+ // theme and vice versa. Thanks to this the buttons should be visible on the
+ // background.
if (Color.luminance(value.data) < 0.5) {
- DecorCaptionView = (DecorCaptionView) inflater.inflate(
- R.layout.decor_caption_dark, null);
+ setLightDecorCaptionShade(view);
} else {
- DecorCaptionView = (DecorCaptionView) inflater.inflate(
- R.layout.decor_caption_light, null);
+ setDarkDecorCaptionShade(view);
}
+ break;
}
- DecorCaptionView.setPhoneWindow(mWindow, true /*showDecor*/);
- } else {
- DecorCaptionView = null;
}
+ }
- // Tell the decor if it has a visible caption.
- enableCaption(DecorCaptionView != null);
- return DecorCaptionView;
+ void updateDecorCaptionShade() {
+ if (mDecorCaptionView != null) {
+ setDecorCaptionShade(getContext(), mDecorCaptionView);
+ }
+ }
+
+ private void setLightDecorCaptionShade(DecorCaptionView view) {
+ view.findViewById(R.id.maximize_window).setBackgroundResource(
+ R.drawable.decor_maximize_button_light);
+ view.findViewById(R.id.close_window).setBackgroundResource(
+ R.drawable.decor_close_button_light);
+ }
+
+ private void setDarkDecorCaptionShade(DecorCaptionView view) {
+ view.findViewById(R.id.maximize_window).setBackgroundResource(
+ R.drawable.decor_maximize_button_dark);
+ view.findViewById(R.id.close_window).setBackgroundResource(
+ R.drawable.decor_close_button_dark);
}
/**
@@ -1735,11 +1784,11 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind
if (mBackdropFrameRenderer != null) {
return;
}
- final ThreadedRenderer renderer = (ThreadedRenderer) getHardwareRenderer();
+ final ThreadedRenderer renderer = getHardwareRenderer();
if (renderer != null) {
mBackdropFrameRenderer = new BackdropFrameRenderer(this, renderer,
initialBounds, mResizingBackgroundDrawable, mCaptionBackgroundDrawable,
- getCurrentColor(mStatusColorViewState));
+ mUserCaptionBackgroundDrawable, getCurrentColor(mStatusColorViewState));
// Get rid of the shadow while we are resizing. Shadow drawing takes considerable time.
// If we want to get the shadow shown while resizing, we would need to elevate a new
@@ -1849,6 +1898,16 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind
getResources().getDisplayMetrics());
}
+ /**
+ * Provide an override of the caption background drawable.
+ */
+ void setUserCaptionBackgroundDrawable(Drawable drawable) {
+ mUserCaptionBackgroundDrawable = drawable;
+ if (mBackdropFrameRenderer != null) {
+ mBackdropFrameRenderer.setUserCaptionBackgroundDrawable(drawable);
+ }
+ }
+
private static class ColorViewState {
View view = null;
int targetVisibility = View.INVISIBLE;
diff --git a/core/java/com/android/internal/policy/PhoneWindow.java b/core/java/com/android/internal/policy/PhoneWindow.java
index 337bb693561e..86bd7824fc4d 100644
--- a/core/java/com/android/internal/policy/PhoneWindow.java
+++ b/core/java/com/android/internal/policy/PhoneWindow.java
@@ -94,7 +94,6 @@ import android.view.accessibility.AccessibilityNodeProvider;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.FrameLayout;
-import android.widget.LinearLayout;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;
@@ -273,6 +272,8 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
private boolean mIsStartingWindow;
private int mTheme = -1;
+ private int mDecorCaptionShade = DECOR_CAPTION_SHADE_AUTO;
+
static class WindowManagerHolder {
static final IWindowManager sWindowManager = IWindowManager.Stub.asInterface(
ServiceManager.getService("window"));
@@ -2527,7 +2528,7 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
}
mDecor.startChanging();
- final View in = mDecor.onResourcesLoaded(mLayoutInflater, layoutResource);
+ mDecor.onResourcesLoaded(mLayoutInflater, layoutResource);
ViewGroup contentParent = (ViewGroup)findViewById(ID_ANDROID_CONTENT);
if (contentParent == null) {
@@ -3720,4 +3721,21 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
}
}
}
+
+ @Override
+ public void setResizingCaptionDrawable(Drawable drawable) {
+ mDecor.setUserCaptionBackgroundDrawable(drawable);
+ }
+
+ @Override
+ public void setDecorCaptionShade(int decorCaptionShade) {
+ mDecorCaptionShade = decorCaptionShade;
+ if (mDecor != null) {
+ mDecor.updateDecorCaptionShade();
+ }
+ }
+
+ int getDecorCaptionShade() {
+ return mDecorCaptionShade;
+ }
}
diff --git a/core/java/com/android/internal/widget/DecorCaptionView.java b/core/java/com/android/internal/widget/DecorCaptionView.java
index d747686ca762..c3fe9e77e877 100644
--- a/core/java/com/android/internal/widget/DecorCaptionView.java
+++ b/core/java/com/android/internal/widget/DecorCaptionView.java
@@ -319,6 +319,10 @@ public class DecorCaptionView extends ViewGroup implements View.OnTouchListener,
captionHeight + mContent.getMeasuredHeight());
}
}
+
+ // This assumes that the caption bar is at the top.
+ mOwner.notifyRestrictedCaptionAreaCallback(mMaximize.getLeft(), mMaximize.getTop(),
+ mClose.getRight(), mClose.getBottom());
}
/**
* Determine if the workspace is entirely covered by the window.
diff --git a/core/res/res/drawable/ic_decor_close_button_dark_focused.xml b/core/res/res/drawable/ic_decor_close_button_dark_focused.xml
index d7b167ddab6e..0794ed376b12 100644
--- a/core/res/res/drawable/ic_decor_close_button_dark_focused.xml
+++ b/core/res/res/drawable/ic_decor_close_button_dark_focused.xml
@@ -23,7 +23,7 @@ Copyright (C) 2015 The Android Open Source Project
android:translateX="8.0"
android:translateY="8.0" >
<path
- android:fillColor="#FFFFFFFF"
+ android:fillColor="#ff000000"
android:pathData="M6.9,4.0l-2.9,2.9 9.1,9.1 -9.1,9.200001 2.9,2.799999 9.1,-9.1 9.1,9.1 2.9,-2.799999 -9.1,-9.200001 9.1,-9.1 -2.9,-2.9 -9.1,9.2z"/>
</group>
</vector>
diff --git a/core/res/res/drawable/ic_decor_close_button_dark_unfocused.xml b/core/res/res/drawable/ic_decor_close_button_dark_unfocused.xml
index e2e81b91abf3..bd1db5164c3f 100644
--- a/core/res/res/drawable/ic_decor_close_button_dark_unfocused.xml
+++ b/core/res/res/drawable/ic_decor_close_button_dark_unfocused.xml
@@ -23,7 +23,7 @@ Copyright (C) 2015 The Android Open Source Project
android:translateX="8.0"
android:translateY="8.0" >
<path
- android:fillColor="#33FFFFFF"
+ android:fillColor="#33000000"
android:pathData="M6.9,4.0l-2.9,2.9 9.1,9.1 -9.1,9.200001 2.9,2.799999 9.1,-9.1 9.1,9.1 2.9,-2.799999 -9.1,-9.200001 9.1,-9.1 -2.9,-2.9 -9.1,9.2z"/>
</group>
</vector>
diff --git a/core/res/res/drawable/ic_decor_close_button_light_focused.xml b/core/res/res/drawable/ic_decor_close_button_light_focused.xml
index 0794ed376b12..d7b167ddab6e 100644
--- a/core/res/res/drawable/ic_decor_close_button_light_focused.xml
+++ b/core/res/res/drawable/ic_decor_close_button_light_focused.xml
@@ -23,7 +23,7 @@ Copyright (C) 2015 The Android Open Source Project
android:translateX="8.0"
android:translateY="8.0" >
<path
- android:fillColor="#ff000000"
+ android:fillColor="#FFFFFFFF"
android:pathData="M6.9,4.0l-2.9,2.9 9.1,9.1 -9.1,9.200001 2.9,2.799999 9.1,-9.1 9.1,9.1 2.9,-2.799999 -9.1,-9.200001 9.1,-9.1 -2.9,-2.9 -9.1,9.2z"/>
</group>
</vector>
diff --git a/core/res/res/drawable/ic_decor_close_button_light_unfocused.xml b/core/res/res/drawable/ic_decor_close_button_light_unfocused.xml
index bd1db5164c3f..e2e81b91abf3 100644
--- a/core/res/res/drawable/ic_decor_close_button_light_unfocused.xml
+++ b/core/res/res/drawable/ic_decor_close_button_light_unfocused.xml
@@ -23,7 +23,7 @@ Copyright (C) 2015 The Android Open Source Project
android:translateX="8.0"
android:translateY="8.0" >
<path
- android:fillColor="#33000000"
+ android:fillColor="#33FFFFFF"
android:pathData="M6.9,4.0l-2.9,2.9 9.1,9.1 -9.1,9.200001 2.9,2.799999 9.1,-9.1 9.1,9.1 2.9,-2.799999 -9.1,-9.200001 9.1,-9.1 -2.9,-2.9 -9.1,9.2z"/>
</group>
</vector>
diff --git a/core/res/res/drawable/ic_decor_maximize_button_dark_focused.xml b/core/res/res/drawable/ic_decor_maximize_button_dark_focused.xml
index 73d808be9821..c23390e4bde9 100644
--- a/core/res/res/drawable/ic_decor_maximize_button_dark_focused.xml
+++ b/core/res/res/drawable/ic_decor_maximize_button_dark_focused.xml
@@ -23,10 +23,10 @@ Copyright (C) 2015 The Android Open Source Project
android:translateX="8.0"
android:translateY="8.0" >
<path
- android:fillColor="#FFFFFFFF"
+ android:fillColor="#FF000000"
android:pathData="M2.0,4.0l0.0,16.0l28.0,0.0L30.0,4.0L2.0,4.0zM26.0,16.0L6.0,16.0L6.0,8.0l20.0,0.0L26.0,16.0z"/>
<path
- android:fillColor="#B2FFFFFF"
+ android:fillColor="#B2000000"
android:pathData="M2.0,24.0l28.0,0.0l0.0,4.0l-28.0,0.0z"/>
</group>
</vector>
diff --git a/core/res/res/drawable/ic_decor_maximize_button_dark_unfocused.xml b/core/res/res/drawable/ic_decor_maximize_button_dark_unfocused.xml
index dc79e10015f8..a194a3912b21 100644
--- a/core/res/res/drawable/ic_decor_maximize_button_dark_unfocused.xml
+++ b/core/res/res/drawable/ic_decor_maximize_button_dark_unfocused.xml
@@ -23,10 +23,10 @@ Copyright (C) 2015 The Android Open Source Project
android:translateX="8.0"
android:translateY="8.0" >
<path
- android:fillColor="#33FFFFFF"
+ android:fillColor="#33000000"
android:pathData="M2.0,4.0l0.0,16.0l28.0,0.0L30.0,4.0L2.0,4.0zM26.0,16.0L6.0,16.0L6.0,8.0l20.0,0.0L26.0,16.0z"/>
<path
- android:fillColor="#33FFFFFF"
+ android:fillColor="#33000000"
android:pathData="M2.0,24.0l28.0,0.0l0.0,4.0l-28.0,0.0z"/>
</group>
</vector>
diff --git a/core/res/res/drawable/ic_decor_maximize_button_light_focused.xml b/core/res/res/drawable/ic_decor_maximize_button_light_focused.xml
index c23390e4bde9..73d808be9821 100644
--- a/core/res/res/drawable/ic_decor_maximize_button_light_focused.xml
+++ b/core/res/res/drawable/ic_decor_maximize_button_light_focused.xml
@@ -23,10 +23,10 @@ Copyright (C) 2015 The Android Open Source Project
android:translateX="8.0"
android:translateY="8.0" >
<path
- android:fillColor="#FF000000"
+ android:fillColor="#FFFFFFFF"
android:pathData="M2.0,4.0l0.0,16.0l28.0,0.0L30.0,4.0L2.0,4.0zM26.0,16.0L6.0,16.0L6.0,8.0l20.0,0.0L26.0,16.0z"/>
<path
- android:fillColor="#B2000000"
+ android:fillColor="#B2FFFFFF"
android:pathData="M2.0,24.0l28.0,0.0l0.0,4.0l-28.0,0.0z"/>
</group>
</vector>
diff --git a/core/res/res/drawable/ic_decor_maximize_button_light_unfocused.xml b/core/res/res/drawable/ic_decor_maximize_button_light_unfocused.xml
index a194a3912b21..dc79e10015f8 100644
--- a/core/res/res/drawable/ic_decor_maximize_button_light_unfocused.xml
+++ b/core/res/res/drawable/ic_decor_maximize_button_light_unfocused.xml
@@ -23,10 +23,10 @@ Copyright (C) 2015 The Android Open Source Project
android:translateX="8.0"
android:translateY="8.0" >
<path
- android:fillColor="#33000000"
+ android:fillColor="#33FFFFFF"
android:pathData="M2.0,4.0l0.0,16.0l28.0,0.0L30.0,4.0L2.0,4.0zM26.0,16.0L6.0,16.0L6.0,8.0l20.0,0.0L26.0,16.0z"/>
<path
- android:fillColor="#33000000"
+ android:fillColor="#33FFFFFF"
android:pathData="M2.0,24.0l28.0,0.0l0.0,4.0l-28.0,0.0z"/>
</group>
</vector>
diff --git a/core/res/res/layout/decor_caption.xml b/core/res/res/layout/decor_caption.xml
new file mode 100644
index 000000000000..02467369825d
--- /dev/null
+++ b/core/res/res/layout/decor_caption.xml
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+**
+** Copyright 2015, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+** http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+-->
+
+<com.android.internal.widget.DecorCaptionView xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:descendantFocusability="beforeDescendants" >
+ <LinearLayout
+ android:id="@+id/caption"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="end"
+ android:background="@drawable/decor_caption_title"
+ android:focusable="false"
+ android:descendantFocusability="blocksDescendants" >
+ <Button
+ android:id="@+id/maximize_window"
+ android:layout_width="32dp"
+ android:layout_height="32dp"
+ android:layout_margin="5dp"
+ android:padding="4dp"
+ android:layout_gravity="center_vertical|end"
+ android:contentDescription="@string/maximize_button_text"
+ android:background="@drawable/decor_maximize_button_dark" />
+ <Button
+ android:id="@+id/close_window"
+ android:layout_width="32dp"
+ android:layout_height="32dp"
+ android:layout_margin="5dp"
+ android:padding="4dp"
+ android:layout_gravity="center_vertical|end"
+ android:contentDescription="@string/close_button_text"
+ android:background="@drawable/decor_close_button_dark" />
+ </LinearLayout>
+</com.android.internal.widget.DecorCaptionView>
diff --git a/core/res/res/layout/decor_caption_dark.xml b/core/res/res/layout/decor_caption_dark.xml
deleted file mode 100644
index 95d228971a06..000000000000
--- a/core/res/res/layout/decor_caption_dark.xml
+++ /dev/null
@@ -1,52 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-**
-** Copyright 2015, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-
-<com.android.internal.widget.DecorCaptionView xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:descendantFocusability="beforeDescendants" >
- <LinearLayout
- android:id="@+id/caption"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:gravity="end"
- android:background="@drawable/decor_caption_title"
- android:focusable="false"
- android:descendantFocusability="blocksDescendants" >
- <Button
- android:id="@+id/maximize_window"
- android:layout_width="32dp"
- android:layout_height="32dp"
- android:layout_margin="5dp"
- android:padding="4dp"
- android:layout_gravity="center_vertical|end"
- android:contentDescription="@string/maximize_button_text"
- android:background="@drawable/decor_maximize_button_dark" />
- <Button
- android:id="@+id/close_window"
- android:layout_width="32dp"
- android:layout_height="32dp"
- android:layout_margin="5dp"
- android:padding="4dp"
- android:layout_gravity="center_vertical|end"
- android:contentDescription="@string/close_button_text"
- android:background="@drawable/decor_close_button_dark" />
- </LinearLayout>
-</com.android.internal.widget.DecorCaptionView>
diff --git a/core/res/res/layout/decor_caption_light.xml b/core/res/res/layout/decor_caption_light.xml
deleted file mode 100644
index f0f661e0fef0..000000000000
--- a/core/res/res/layout/decor_caption_light.xml
+++ /dev/null
@@ -1,52 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-**
-** Copyright 2015, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-
-<com.android.internal.widget.DecorCaptionView xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:descendantFocusability="beforeDescendants" >
- <LinearLayout
- android:id="@+id/caption"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:gravity="end"
- android:background="@drawable/decor_caption_title"
- android:focusable="false"
- android:descendantFocusability="blocksDescendants" >
- <Button
- android:id="@+id/maximize_window"
- android:layout_width="32dp"
- android:layout_height="32dp"
- android:layout_margin="5dp"
- android:padding="4dp"
- android:layout_gravity="center_vertical|end"
- android:contentDescription="@string/maximize_button_text"
- android:background="@drawable/decor_maximize_button_light" />
- <Button
- android:id="@+id/close_window"
- android:layout_width="32dp"
- android:layout_height="32dp"
- android:layout_margin="5dp"
- android:padding="4dp"
- android:layout_gravity="center_vertical|end"
- android:contentDescription="@string/close_button_text"
- android:background="@drawable/decor_close_button_light" />
- </LinearLayout>
-</com.android.internal.widget.DecorCaptionView>
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index eadcae0fb322..177ca604b28a 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -1958,9 +1958,12 @@
<java-symbol type="bool" name="config_built_in_sip_phone" />
<java-symbol type="id" name="maximize_window" />
<java-symbol type="id" name="close_window" />
- <java-symbol type="layout" name="decor_caption_light" />
- <java-symbol type="layout" name="decor_caption_dark" />
+ <java-symbol type="layout" name="decor_caption" />
<java-symbol type="drawable" name="decor_caption_title_focused" />
+ <java-symbol type="drawable" name="decor_close_button_dark" />
+ <java-symbol type="drawable" name="decor_close_button_light" />
+ <java-symbol type="drawable" name="decor_maximize_button_dark" />
+ <java-symbol type="drawable" name="decor_maximize_button_light" />
<!-- From TelephonyProvider -->
<java-symbol type="xml" name="apns" />