Merge "Update toggle switch asset to include content area" into lmp-dev
diff --git a/api/current.txt b/api/current.txt
index ab134f3..368dcef 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -2047,6 +2047,8 @@
field public static final int TextAppearance_Material_Widget_TextView = 16974381; // 0x103022d
field public static final int TextAppearance_Material_Widget_TextView_PopupMenu = 16974382; // 0x103022e
field public static final int TextAppearance_Material_Widget_TextView_SpinnerItem = 16974383; // 0x103022f
+ field public static final int TextAppearance_Material_Widget_Toolbar_Subtitle = 16974569; // 0x10302e9
+ field public static final int TextAppearance_Material_Widget_Toolbar_Title = 16974568; // 0x10302e8
field public static final int TextAppearance_Material_WindowTitle = 16974361; // 0x1030219
field public static final int TextAppearance_Medium = 16973892; // 0x1030044
field public static final int TextAppearance_Medium_Inverse = 16973893; // 0x1030045
@@ -17106,8 +17108,6 @@
method public void setStreamVolume(float);
method public void setTvInputListener(android.media.tv.TvView.TvInputListener);
method public void tune(java.lang.String, android.net.Uri);
- field public static final int ERROR_INPUT_DISCONNECTED = 1; // 0x1
- field public static final int ERROR_INPUT_NOT_CONNECTED = 0; // 0x0
}
public static abstract interface TvView.OnUnhandledInputEventListener {
@@ -17117,9 +17117,10 @@
public static abstract class TvView.TvInputListener {
ctor public TvView.TvInputListener();
method public void onChannelRetuned(java.lang.String, android.net.Uri);
+ method public void onConnectionFailed(java.lang.String);
method public void onContentAllowed(java.lang.String);
method public void onContentBlocked(java.lang.String, android.media.tv.TvContentRating);
- method public void onError(java.lang.String, int);
+ method public void onDisconnected(java.lang.String);
method public void onTrackSelected(java.lang.String, int, java.lang.String);
method public void onTracksChanged(java.lang.String, java.util.List<android.media.tv.TvTrackInfo>);
method public void onVideoAvailable(java.lang.String);
diff --git a/core/java/android/hardware/Camera.java b/core/java/android/hardware/Camera.java
index eadfa73..310ab76 100644
--- a/core/java/android/hardware/Camera.java
+++ b/core/java/android/hardware/Camera.java
@@ -1558,6 +1558,26 @@
return _enableShutterSound(enabled);
}
+ /**
+ * Disable the shutter sound unconditionally.
+ *
+ * <p>
+ * This is only guaranteed to work for legacy cameras
+ * (i.e. initialized with {@link #cameraInitUnspecified}). Trying to call this on
+ * a regular camera will force a conditional check in the camera service.
+ * </p>
+ *
+ * @return {@code true} if the shutter sound state was successfully
+ * changed. {@code false} if the shutter sound state could not be
+ * changed. {@code true} is also returned if shutter sound playback
+ * is already set to the requested state.
+ *
+ * @hide
+ */
+ public final boolean disableShutterSound() {
+ return _enableShutterSound(/*enabled*/false);
+ }
+
private native final boolean _enableShutterSound(boolean enabled);
/**
diff --git a/core/java/android/hardware/camera2/legacy/CameraDeviceUserShim.java b/core/java/android/hardware/camera2/legacy/CameraDeviceUserShim.java
index c68d8c3..5cbf109 100644
--- a/core/java/android/hardware/camera2/legacy/CameraDeviceUserShim.java
+++ b/core/java/android/hardware/camera2/legacy/CameraDeviceUserShim.java
@@ -56,6 +56,7 @@
* Keep up to date with ICameraDeviceUser.aidl.
* </p>
*/
+@SuppressWarnings("deprecation")
public class CameraDeviceUserShim implements ICameraDeviceUser {
private static final String TAG = "CameraDeviceUserShim";
@@ -259,6 +260,7 @@
super(l);
}
+ @Override
public void handleMessage(Message msg) {
try {
switch (msg.what) {
@@ -320,6 +322,9 @@
// Check errors old HAL initialization
CameraBinderDecorator.throwOnError(initErrors);
+ // Disable shutter sounds (this will work unconditionally) for api2 clients
+ legacyCamera.disableShutterSound();
+
CameraInfo info = new CameraInfo();
Camera.getCameraInfo(cameraId, info);
diff --git a/core/java/android/transition/ChangeBounds.java b/core/java/android/transition/ChangeBounds.java
index efcbdb3..6246cbe 100644
--- a/core/java/android/transition/ChangeBounds.java
+++ b/core/java/android/transition/ChangeBounds.java
@@ -16,13 +16,11 @@
package android.transition;
-import android.animation.TypeConverter;
import android.content.Context;
import android.graphics.PointF;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
-import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.animation.PropertyValuesHolder;
import android.animation.RectEvaluator;
@@ -119,9 +117,11 @@
values.values.put(PROPNAME_BOUNDS, new Rect(view.getLeft(), view.getTop(),
view.getRight(), view.getBottom()));
values.values.put(PROPNAME_PARENT, values.view.getParent());
- values.view.getLocationInWindow(tempLocation);
- values.values.put(PROPNAME_WINDOW_X, tempLocation[0]);
- values.values.put(PROPNAME_WINDOW_Y, tempLocation[1]);
+ if (mReparent) {
+ values.view.getLocationInWindow(tempLocation);
+ values.values.put(PROPNAME_WINDOW_X, tempLocation[0]);
+ values.values.put(PROPNAME_WINDOW_Y, tempLocation[1]);
+ }
}
@Override
@@ -134,6 +134,19 @@
captureValues(transitionValues);
}
+ private boolean parentMatches(View startParent, View endParent) {
+ boolean parentMatches = true;
+ if (mReparent) {
+ TransitionValues endValues = getMatchedTransitionValues(startParent, true);
+ if (endValues == null) {
+ parentMatches = startParent == endParent;
+ } else {
+ parentMatches = endParent == endValues.view;
+ }
+ }
+ return parentMatches;
+ }
+
@Override
public Animator createAnimator(final ViewGroup sceneRoot, TransitionValues startValues,
TransitionValues endValues) {
@@ -148,13 +161,7 @@
return null;
}
final View view = endValues.view;
- boolean parentsEqual = (startParent == endParent) ||
- (startParent.getId() == endParent.getId());
- // TODO: Might want reparenting to be separate/subclass transition, or at least
- // triggered by a property on ChangeBounds. Otherwise, we're forcing the requirement that
- // all parents in layouts have IDs to avoid layout-inflation resulting in a side-effect
- // of reparenting the views.
- if (!mReparent || parentsEqual) {
+ if (parentMatches(startParent, endParent)) {
Rect startBounds = (Rect) startValues.values.get(PROPNAME_BOUNDS);
Rect endBounds = (Rect) endValues.values.get(PROPNAME_BOUNDS);
int startLeft = startBounds.left;
diff --git a/core/java/android/transition/Transition.java b/core/java/android/transition/Transition.java
index 2fa8d2a..0d32d40 100644
--- a/core/java/android/transition/Transition.java
+++ b/core/java/android/transition/Transition.java
@@ -192,6 +192,8 @@
private TransitionValuesMaps mEndValues = new TransitionValuesMaps();
TransitionSet mParent = null;
private int[] mMatchOrder = DEFAULT_MATCH_ORDER;
+ ArrayList<TransitionValues> mStartValuesList; // only valid after playTransition starts
+ ArrayList<TransitionValues> mEndValuesList; // only valid after playTransitions starts
// Per-animator information used for later canceling when future transitions overlap
private static ThreadLocal<ArrayMap<Animator, AnimationInfo>> sRunningAnimators =
@@ -518,32 +520,28 @@
}
/**
- * Match start/end values by View instance. Adds matched values to startValuesList
- * and endValuesList and removes them from unmatchedStart and unmatchedEnd.
+ * Match start/end values by View instance. Adds matched values to mStartValuesList
+ * and mEndValuesList and removes them from unmatchedStart and unmatchedEnd.
*/
- private void matchInstances(ArrayList<TransitionValues> startValuesList,
- ArrayList<TransitionValues> endValuesList,
- ArrayMap<View, TransitionValues> unmatchedStart,
+ private void matchInstances(ArrayMap<View, TransitionValues> unmatchedStart,
ArrayMap<View, TransitionValues> unmatchedEnd) {
for (int i = unmatchedStart.size() - 1; i >= 0; i--) {
View view = unmatchedStart.keyAt(i);
TransitionValues end = unmatchedEnd.remove(view);
if (end != null) {
TransitionValues start = unmatchedStart.removeAt(i);
- startValuesList.add(start);
- endValuesList.add(end);
+ mStartValuesList.add(start);
+ mEndValuesList.add(end);
}
}
}
/**
- * Match start/end values by Adapter item ID. Adds matched values to startValuesList
- * and endValuesList and removes them from unmatchedStart and unmatchedEnd, using
+ * Match start/end values by Adapter item ID. Adds matched values to mStartValuesList
+ * and mEndValuesList and removes them from unmatchedStart and unmatchedEnd, using
* startItemIds and endItemIds as a guide for which Views have unique item IDs.
*/
- private void matchItemIds(ArrayList<TransitionValues> startValuesList,
- ArrayList<TransitionValues> endValuesList,
- ArrayMap<View, TransitionValues> unmatchedStart,
+ private void matchItemIds(ArrayMap<View, TransitionValues> unmatchedStart,
ArrayMap<View, TransitionValues> unmatchedEnd,
LongSparseArray<View> startItemIds, LongSparseArray<View> endItemIds) {
int numStartIds = startItemIds.size();
@@ -555,8 +553,8 @@
TransitionValues startValues = unmatchedStart.get(startView);
TransitionValues endValues = unmatchedEnd.get(endView);
if (startValues != null && endValues != null) {
- startValuesList.add(startValues);
- endValuesList.add(endValues);
+ mStartValuesList.add(startValues);
+ mEndValuesList.add(endValues);
unmatchedStart.remove(startView);
unmatchedEnd.remove(endView);
}
@@ -566,13 +564,11 @@
}
/**
- * Match start/end values by Adapter view ID. Adds matched values to startValuesList
- * and endValuesList and removes them from unmatchedStart and unmatchedEnd, using
+ * Match start/end values by Adapter view ID. Adds matched values to mStartValuesList
+ * and mEndValuesList and removes them from unmatchedStart and unmatchedEnd, using
* startIds and endIds as a guide for which Views have unique IDs.
*/
- private void matchIds(ArrayList<TransitionValues> startValuesList,
- ArrayList<TransitionValues> endValuesList,
- ArrayMap<View, TransitionValues> unmatchedStart,
+ private void matchIds(ArrayMap<View, TransitionValues> unmatchedStart,
ArrayMap<View, TransitionValues> unmatchedEnd,
SparseArray<View> startIds, SparseArray<View> endIds) {
int numStartIds = startIds.size();
@@ -584,8 +580,8 @@
TransitionValues startValues = unmatchedStart.get(startView);
TransitionValues endValues = unmatchedEnd.get(endView);
if (startValues != null && endValues != null) {
- startValuesList.add(startValues);
- endValuesList.add(endValues);
+ mStartValuesList.add(startValues);
+ mEndValuesList.add(endValues);
unmatchedStart.remove(startView);
unmatchedEnd.remove(endView);
}
@@ -595,13 +591,11 @@
}
/**
- * Match start/end values by Adapter transitionName. Adds matched values to startValuesList
- * and endValuesList and removes them from unmatchedStart and unmatchedEnd, using
+ * Match start/end values by Adapter transitionName. Adds matched values to mStartValuesList
+ * and mEndValuesList and removes them from unmatchedStart and unmatchedEnd, using
* startNames and endNames as a guide for which Views have unique transitionNames.
*/
- private void matchNames(ArrayList<TransitionValues> startValuesList,
- ArrayList<TransitionValues> endValuesList,
- ArrayMap<View, TransitionValues> unmatchedStart,
+ private void matchNames(ArrayMap<View, TransitionValues> unmatchedStart,
ArrayMap<View, TransitionValues> unmatchedEnd,
ArrayMap<String, View> startNames, ArrayMap<String, View> endNames) {
int numStartNames = startNames.size();
@@ -613,8 +607,8 @@
TransitionValues startValues = unmatchedStart.get(startView);
TransitionValues endValues = unmatchedEnd.get(endView);
if (startValues != null && endValues != null) {
- startValuesList.add(startValues);
- endValuesList.add(endValues);
+ mStartValuesList.add(startValues);
+ mEndValuesList.add(endValues);
unmatchedStart.remove(startView);
unmatchedEnd.remove(endView);
}
@@ -624,30 +618,26 @@
}
/**
- * Adds all values from unmatchedStart and unmatchedEnd to startValuesList and endValuesList,
+ * Adds all values from unmatchedStart and unmatchedEnd to mStartValuesList and mEndValuesList,
* assuming that there is no match between values in the list.
*/
- private void addUnmatched(ArrayList<TransitionValues> startValuesList,
- ArrayList<TransitionValues> endValuesList,
- ArrayMap<View, TransitionValues> unmatchedStart,
+ private void addUnmatched(ArrayMap<View, TransitionValues> unmatchedStart,
ArrayMap<View, TransitionValues> unmatchedEnd) {
// Views that only exist in the start Scene
for (int i = 0; i < unmatchedStart.size(); i++) {
- startValuesList.add(unmatchedStart.valueAt(i));
- endValuesList.add(null);
+ mStartValuesList.add(unmatchedStart.valueAt(i));
+ mEndValuesList.add(null);
}
// Views that only exist in the end Scene
for (int i = 0; i < unmatchedEnd.size(); i++) {
- endValuesList.add(unmatchedEnd.valueAt(i));
- startValuesList.add(null);
+ mEndValuesList.add(unmatchedEnd.valueAt(i));
+ mStartValuesList.add(null);
}
}
private void matchStartAndEnd(TransitionValuesMaps startValues,
- TransitionValuesMaps endValues,
- ArrayList<TransitionValues> startValuesList,
- ArrayList<TransitionValues> endValuesList) {
+ TransitionValuesMaps endValues) {
ArrayMap<View, TransitionValues> unmatchedStart =
new ArrayMap<View, TransitionValues>(startValues.viewValues);
ArrayMap<View, TransitionValues> unmatchedEnd =
@@ -656,23 +646,23 @@
for (int i = 0; i < mMatchOrder.length; i++) {
switch (mMatchOrder[i]) {
case MATCH_INSTANCE:
- matchInstances(startValuesList, endValuesList, unmatchedStart, unmatchedEnd);
+ matchInstances(unmatchedStart, unmatchedEnd);
break;
case MATCH_NAME:
- matchNames(startValuesList, endValuesList, unmatchedStart, unmatchedEnd,
+ matchNames(unmatchedStart, unmatchedEnd,
startValues.nameValues, endValues.nameValues);
break;
case MATCH_ID:
- matchIds(startValuesList, endValuesList, unmatchedStart, unmatchedEnd,
+ matchIds(unmatchedStart, unmatchedEnd,
startValues.idValues, endValues.idValues);
break;
case MATCH_ITEM_ID:
- matchItemIds(startValuesList, endValuesList, unmatchedStart, unmatchedEnd,
+ matchItemIds(unmatchedStart, unmatchedEnd,
startValues.itemIdValues, endValues.itemIdValues);
break;
}
}
- addUnmatched(startValuesList, endValuesList, unmatchedStart, unmatchedEnd);
+ addUnmatched(unmatchedStart, unmatchedEnd);
}
/**
@@ -687,19 +677,17 @@
* @hide
*/
protected void createAnimators(ViewGroup sceneRoot, TransitionValuesMaps startValues,
- TransitionValuesMaps endValues) {
+ TransitionValuesMaps endValues, ArrayList<TransitionValues> startValuesList,
+ ArrayList<TransitionValues> endValuesList) {
if (DBG) {
Log.d(LOG_TAG, "createAnimators() for " + this);
}
- ArrayList<TransitionValues> startValuesList = new ArrayList<TransitionValues>();
- ArrayList<TransitionValues> endValuesList = new ArrayList<TransitionValues>();
- matchStartAndEnd(startValues, endValues, startValuesList, endValuesList);
-
ArrayMap<Animator, AnimationInfo> runningAnimators = getRunningAnimators();
long minStartDelay = Long.MAX_VALUE;
int minAnimator = mAnimators.size();
SparseLongArray startDelays = new SparseLongArray();
- for (int i = 0; i < startValuesList.size(); ++i) {
+ int startValuesListCount = startValuesList.size();
+ for (int i = 0; i < startValuesListCount; ++i) {
TransitionValues start = startValuesList.get(i);
TransitionValues end = endValuesList.get(i);
// Only bother trying to animate with valid values that differ between start/end
@@ -1523,11 +1511,13 @@
mStartValues.idValues.clear();
mStartValues.itemIdValues.clear();
mStartValues.nameValues.clear();
+ mStartValuesList = null;
} else {
mEndValues.viewValues.clear();
mEndValues.idValues.clear();
mEndValues.itemIdValues.clear();
mEndValues.nameValues.clear();
+ mEndValuesList = null;
}
}
@@ -1613,6 +1603,45 @@
}
/**
+ * Find the matched start or end value for a given View. This is only valid
+ * after playTransition starts. For example, it will be valid in
+ * {@link #createAnimator(android.view.ViewGroup, TransitionValues, TransitionValues)}, but not
+ * in {@link #captureStartValues(TransitionValues)}.
+ *
+ * @param view The view to find the match for.
+ * @param viewInStart Is View from the start values or end values.
+ * @return The matching TransitionValues for view in either start or end values, depending
+ * on viewInStart or null if there is no match for the given view.
+ */
+ TransitionValues getMatchedTransitionValues(View view, boolean viewInStart) {
+ if (mParent != null) {
+ return mParent.getMatchedTransitionValues(view, viewInStart);
+ }
+ ArrayList<TransitionValues> lookIn = viewInStart ? mStartValuesList : mEndValuesList;
+ if (lookIn == null) {
+ return null;
+ }
+ int count = lookIn.size();
+ int index = -1;
+ for (int i = 0; i < count; i++) {
+ TransitionValues values = lookIn.get(i);
+ if (values == null) {
+ return null;
+ }
+ if (values.view == view) {
+ index = i;
+ break;
+ }
+ }
+ TransitionValues values = null;
+ if (index >= 0) {
+ ArrayList<TransitionValues> matchIn = viewInStart ? mEndValuesList : mStartValuesList;
+ values = matchIn.get(index);
+ }
+ return values;
+ }
+
+ /**
* Pauses this transition, sending out calls to {@link
* TransitionListener#onTransitionPause(Transition)} to all listeners
* and pausing all running animators started by this transition.
@@ -1684,6 +1713,10 @@
* runAnimations() to actually start the animations.
*/
void playTransition(ViewGroup sceneRoot) {
+ mStartValuesList = new ArrayList<TransitionValues>();
+ mEndValuesList = new ArrayList<TransitionValues>();
+ matchStartAndEnd(mStartValues, mEndValues);
+
ArrayMap<Animator, AnimationInfo> runningAnimators = getRunningAnimators();
int numOldAnims = runningAnimators.size();
WindowId windowId = sceneRoot.getWindowId();
@@ -1694,7 +1727,7 @@
if (oldInfo != null && oldInfo.view != null && oldInfo.windowId == windowId) {
TransitionValues oldValues = oldInfo.values;
View oldView = oldInfo.view;
- TransitionValues newValues = mEndValues.viewValues.get(oldView);
+ TransitionValues newValues = getMatchedTransitionValues(oldView, true);
boolean cancel = oldInfo.transition.areValuesChanged(oldValues, newValues);
if (cancel) {
if (anim.isRunning() || anim.isStarted()) {
@@ -1713,7 +1746,7 @@
}
}
- createAnimators(sceneRoot, mStartValues, mEndValues);
+ createAnimators(sceneRoot, mStartValues, mEndValues, mStartValuesList, mEndValuesList);
runAnimators();
}
@@ -2055,6 +2088,8 @@
clone.mAnimators = new ArrayList<Animator>();
clone.mStartValues = new TransitionValuesMaps();
clone.mEndValues = new TransitionValuesMaps();
+ clone.mStartValuesList = null;
+ clone.mEndValuesList = null;
} catch (CloneNotSupportedException e) {}
return clone;
diff --git a/core/java/android/transition/TransitionSet.java b/core/java/android/transition/TransitionSet.java
index 68af2d1..f6499ae 100644
--- a/core/java/android/transition/TransitionSet.java
+++ b/core/java/android/transition/TransitionSet.java
@@ -386,11 +386,13 @@
*/
@Override
protected void createAnimators(ViewGroup sceneRoot, TransitionValuesMaps startValues,
- TransitionValuesMaps endValues) {
+ TransitionValuesMaps endValues, ArrayList<TransitionValues> startValuesList,
+ ArrayList<TransitionValues> endValuesList) {
startValues = removeExcludes(startValues);
endValues = removeExcludes(endValues);
for (Transition childTransition : mTransitions) {
- childTransition.createAnimators(sceneRoot, startValues, endValues);
+ childTransition.createAnimators(sceneRoot, startValues, endValues, startValuesList,
+ endValuesList);
}
}
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index cec7e63..3adc41a 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -13831,6 +13831,7 @@
} else {
draw(canvas);
}
+ drawAccessibilityFocus(canvas);
}
} finally {
renderNode.end(canvas);
@@ -14125,6 +14126,7 @@
} else {
draw(canvas);
}
+ drawAccessibilityFocus(canvas);
canvas.restoreToCount(restoreCount);
canvas.setBitmap(null);
@@ -14199,6 +14201,7 @@
} else {
draw(canvas);
}
+ drawAccessibilityFocus(canvas);
mPrivateFlags = flags;
@@ -14792,9 +14795,13 @@
if ((mPrivateFlags & PFLAG_SKIP_DRAW) == PFLAG_SKIP_DRAW) {
mPrivateFlags &= ~PFLAG_DIRTY_MASK;
dispatchDraw(canvas);
+ if (mOverlay != null && !mOverlay.isEmpty()) {
+ mOverlay.getOverlayView().draw(canvas);
+ }
} else {
draw(canvas);
}
+ drawAccessibilityFocus(canvas);
} else {
mPrivateFlags &= ~PFLAG_DIRTY_MASK;
((HardwareCanvas) canvas).drawRenderNode(renderNode, null, flags);
@@ -15046,6 +15053,45 @@
}
/**
+ * Draws the accessibility focus rect onto the specified canvas.
+ *
+ * @param canvas Canvas on which to draw the focus rect
+ */
+ private void drawAccessibilityFocus(Canvas canvas) {
+ if (mAttachInfo == null) {
+ return;
+ }
+
+ final Rect bounds = mAttachInfo.mTmpInvalRect;
+ final ViewRootImpl viewRoot = getViewRootImpl();
+ if (viewRoot == null || viewRoot.getAccessibilityFocusedHost() != this) {
+ return;
+ }
+
+ final AccessibilityManager manager = AccessibilityManager.getInstance(mContext);
+ if (!manager.isEnabled() || !manager.isTouchExplorationEnabled()) {
+ return;
+ }
+
+ final Drawable drawable = viewRoot.getAccessibilityFocusedDrawable();
+ if (drawable == null) {
+ return;
+ }
+
+ final AccessibilityNodeInfo virtualView = viewRoot.getAccessibilityFocusedVirtualView();
+ if (virtualView != null) {
+ virtualView.getBoundsInParent(bounds);
+ } else {
+ bounds.set(0, 0, mRight - mLeft, mBottom - mTop);
+ }
+
+ canvas.translate(mScrollX, mScrollY);
+ drawable.setBounds(bounds);
+ drawable.draw(canvas);
+ canvas.translate(-mScrollX, -mScrollY);
+ }
+
+ /**
* Draws the background onto the specified canvas.
*
* @param canvas Canvas on which to draw the background
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index 92e0245..bb469a3 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -2244,7 +2244,6 @@
canvas.drawHardwareLayer(mResizeBuffer, mHardwareXOffset, mHardwareYOffset,
mResizePaint);
}
- drawAccessibilityFocusedDrawableIfNeeded(canvas);
}
/**
@@ -2462,25 +2461,9 @@
if (mHardwareYOffset != yOffset || mHardwareXOffset != xOffset) {
mHardwareYOffset = yOffset;
mHardwareXOffset = xOffset;
- invalidateRoot = true;
- }
- mResizeAlpha = resizeAlpha;
-
- if (!invalidateRoot) {
- // If accessibility focus moved, invalidate the root.
- final Drawable drawable = mAttachInfo.mAccessibilityFocusDrawable;
- if (drawable != null) {
- final Rect bounds = mAttachInfo.mTmpInvalRect;
- if (getAccessibilityFocusedRect(bounds)
- && !bounds.equals(drawable.getBounds())) {
- invalidateRoot = true;
- }
- }
- }
-
- if (invalidateRoot) {
mAttachInfo.mHardwareRenderer.invalidateRoot();
}
+ mResizeAlpha = resizeAlpha;
dirty.setEmpty();
@@ -2600,8 +2583,6 @@
attachInfo.mSetIgnoreDirtyState = false;
mView.draw(canvas);
-
- drawAccessibilityFocusedDrawableIfNeeded(canvas);
} finally {
if (!attachInfo.mSetIgnoreDirtyState) {
// Only clear the flag if it was not set during the mView.draw() call
@@ -2625,54 +2606,7 @@
return true;
}
- /**
- * We want to draw a highlight around the current accessibility focused.
- * Since adding a style for all possible view is not a viable option we
- * have this specialized drawing method.
- *
- * Note: We are doing this here to be able to draw the highlight for
- * virtual views in addition to real ones.
- *
- * @param canvas The canvas on which to draw.
- */
- private void drawAccessibilityFocusedDrawableIfNeeded(Canvas canvas) {
- final Rect bounds = mAttachInfo.mTmpInvalRect;
- if (getAccessibilityFocusedRect(bounds)) {
- final Drawable drawable = getAccessibilityFocusedDrawable();
- if (drawable != null) {
- drawable.setBounds(bounds);
- drawable.draw(canvas);
- }
- }
- }
-
- private boolean getAccessibilityFocusedRect(Rect bounds) {
- final AccessibilityManager manager = AccessibilityManager.getInstance(mView.mContext);
- if (!manager.isEnabled() || !manager.isTouchExplorationEnabled()) {
- return false;
- }
-
- final View host = mAccessibilityFocusedHost;
- if (host == null || host.mAttachInfo == null) {
- return false;
- }
-
- final AccessibilityNodeProvider provider = host.getAccessibilityNodeProvider();
- if (provider == null) {
- host.getBoundsOnScreen(bounds);
- } else if (mAccessibilityFocusedVirtualView != null) {
- mAccessibilityFocusedVirtualView.getBoundsInScreen(bounds);
- } else {
- return false;
- }
-
- final AttachInfo attachInfo = mAttachInfo;
- bounds.offset(-attachInfo.mWindowLeft, -attachInfo.mWindowTop);
- bounds.intersect(0, 0, attachInfo.mViewRootImpl.mWidth, attachInfo.mViewRootImpl.mHeight);
- return true;
- }
-
- private Drawable getAccessibilityFocusedDrawable() {
+ Drawable getAccessibilityFocusedDrawable() {
// Lazily load the accessibility focus drawable.
if (mAttachInfo.mAccessibilityFocusDrawable == null) {
final TypedValue value = new TypedValue();
diff --git a/core/java/android/widget/RelativeLayout.java b/core/java/android/widget/RelativeLayout.java
index 4dd7e07..23f911c 100644
--- a/core/java/android/widget/RelativeLayout.java
+++ b/core/java/android/widget/RelativeLayout.java
@@ -1501,7 +1501,7 @@
mRules[ALIGN_PARENT_START] = 0;
}
- if (mRules[ALIGN_PARENT_RIGHT] == 0) {
+ if (mRules[ALIGN_PARENT_END] != 0) {
if (mRules[ALIGN_PARENT_RIGHT] == 0) {
// "right" rule is not defined but "end" rule is: use the "end" rule as the
// "right" rule
diff --git a/core/res/res/layout/alert_dialog_material.xml b/core/res/res/layout/alert_dialog_material.xml
index c3f9c76..5f9066a 100644
--- a/core/res/res/layout/alert_dialog_material.xml
+++ b/core/res/res/layout/alert_dialog_material.xml
@@ -31,9 +31,9 @@
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_vertical|start"
- android:paddingStart="16dip"
- android:paddingEnd="16dip"
- android:paddingTop="16dip"
+ android:paddingStart="@dimen/alert_dialog_padding_material"
+ android:paddingEnd="@dimen/alert_dialog_padding_material"
+ android:paddingTop="@dimen/alert_dialog_padding_material"
android:paddingBottom="8dip">
<ImageView android:id="@+id/icon"
android:layout_width="32dip"
@@ -66,10 +66,10 @@
style="?attr/textAppearanceMedium"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:paddingStart="16dip"
- android:paddingEnd="16dip"
- android:paddingTop="16dip"
- android:paddingBottom="16dip" />
+ android:paddingStart="@dimen/alert_dialog_padding_material"
+ android:paddingEnd="@dimen/alert_dialog_padding_material"
+ android:paddingTop="@dimen/alert_dialog_padding_material"
+ android:paddingBottom="@dimen/alert_dialog_padding_material" />
</ScrollView>
</LinearLayout>
@@ -87,35 +87,33 @@
style="?attr/buttonBarStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:orientation="vertical"
- android:gravity="end">
- <LinearLayout
- android:layout_width="match_parent"
+ android:layoutDirection="locale"
+ android:orientation="horizontal"
+ android:paddingStart="6dp"
+ android:paddingEnd="6dp"
+ android:paddingBottom="6dp">
+ <Button android:id="@+id/button3"
+ style="?attr/buttonBarNeutralButtonStyle"
+ android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layoutDirection="locale">
- <Button android:id="@+id/button3"
- style="?attr/buttonBarNeutralButtonStyle"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:maxLines="2"
- android:minHeight="@dimen/alert_dialog_button_bar_height" />
- <Space
- android:layout_width="0dp"
- android:layout_height="0dp"
- android:layout_weight="1"
- android:visibility="invisible" />
- <Button android:id="@+id/button2"
- style="?attr/buttonBarNegativeButtonStyle"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:maxLines="2"
- android:minHeight="@dimen/alert_dialog_button_bar_height" />
- <Button android:id="@+id/button1"
- style="?attr/buttonBarPositiveButtonStyle"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:maxLines="2"
- android:minHeight="@dimen/alert_dialog_button_bar_height" />
- </LinearLayout>
- </LinearLayout>
+ android:maxLines="2"
+ android:minHeight="@dimen/alert_dialog_button_bar_height" />
+ <Space
+ android:layout_width="0dp"
+ android:layout_height="0dp"
+ android:layout_weight="1"
+ android:visibility="invisible" />
+ <Button android:id="@+id/button2"
+ style="?attr/buttonBarNegativeButtonStyle"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:maxLines="2"
+ android:minHeight="@dimen/alert_dialog_button_bar_height" />
+ <Button android:id="@+id/button1"
+ style="?attr/buttonBarPositiveButtonStyle"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:maxLines="2"
+ android:minHeight="@dimen/alert_dialog_button_bar_height" />
+ </LinearLayout>
</LinearLayout>
diff --git a/core/res/res/values/dimens_material.xml b/core/res/res/values/dimens_material.xml
index e5a3c17..972ae5e 100644
--- a/core/res/res/values/dimens_material.xml
+++ b/core/res/res/values/dimens_material.xml
@@ -42,6 +42,8 @@
<dimen name="text_size_headline_material">24sp</dimen>
<dimen name="text_size_title_material">20sp</dimen>
<dimen name="text_size_subhead_material">16sp</dimen>
+ <dimen name="text_size_title_material_toolbar">20dp</dimen>
+ <dimen name="text_size_subtitle_material_toolbar">16dp</dimen>
<dimen name="text_size_menu_material">16sp</dimen>
<dimen name="text_size_body_2_material">14sp</dimen>
<dimen name="text_size_body_1_material">14sp</dimen>
@@ -71,4 +73,6 @@
<!-- Default alpha value for disabled elements. -->
<item name="disabled_alpha_material" format="float" type="dimen">0.26</item>
+
+ <dimen name="alert_dialog_padding_material">12dp</dimen>
</resources>
diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml
index 27c8207..7ade51d 100644
--- a/core/res/res/values/public.xml
+++ b/core/res/res/values/public.xml
@@ -2530,6 +2530,9 @@
<public type="style" name="Widget.Material.Spinner.Form" />
<public type="style" name="Widget.Material.Light.Spinner.Form" />
+ <public type="style" name="TextAppearance.Material.Widget.Toolbar.Title" />
+ <public type="style" name="TextAppearance.Material.Widget.Toolbar.Subtitle" />
+
<public-padding type="string" name="l_resource_pad" end="0x01040030" />
<public type="string" name="config_webSettingsDefaultTextEncoding" />
diff --git a/core/res/res/values/styles_material.xml b/core/res/res/values/styles_material.xml
index 298fea3..c8ea699 100644
--- a/core/res/res/values/styles_material.xml
+++ b/core/res/res/values/styles_material.xml
@@ -313,15 +313,38 @@
</style>
<style name="TextAppearance.Material.Widget.ActionMode"/>
- <style name="TextAppearance.Material.Widget.ActionMode.Title" parent="TextAppearance.Material.Title" />
- <style name="TextAppearance.Material.Widget.ActionMode.Title.Inverse" parent="TextAppearance.Material.Title.Inverse" />
- <style name="TextAppearance.Material.Widget.ActionMode.Subtitle" parent="TextAppearance.Material.Subhead" />
- <style name="TextAppearance.Material.Widget.ActionMode.Subtitle.Inverse" parent="TextAppearance.Material.Subhead.Inverse" />
-
- <style name="TextAppearance.Material.Widget.ActionBar.Title" parent="TextAppearance.Material.Title" />
- <style name="TextAppearance.Material.Widget.ActionBar.Title.Inverse" parent="TextAppearance.Material.Title.Inverse" />
- <style name="TextAppearance.Material.Widget.ActionBar.Subtitle" parent="TextAppearance.Material.Subhead" />
- <style name="TextAppearance.Material.Widget.ActionBar.Subtitle.Inverse" parent="TextAppearance.Material.Subhead.Inverse" />
+ <style name="TextAppearance.Material.Widget.ActionMode.Title"
+ parent="TextAppearance.Material.Title">
+ <item name="textSize">@dimen/text_size_title_material_toolbar</item>
+ </style>
+ <style name="TextAppearance.Material.Widget.ActionMode.Title.Inverse"
+ parent="TextAppearance.Material.Title.Inverse">
+ <item name="textSize">@dimen/text_size_title_material_toolbar</item>
+ </style>
+ <style name="TextAppearance.Material.Widget.ActionMode.Subtitle"
+ parent="TextAppearance.Material.Subhead">
+ <item name="textSize">@dimen/text_size_subtitle_material_toolbar</item>
+ </style>
+ <style name="TextAppearance.Material.Widget.ActionMode.Subtitle.Inverse"
+ parent="TextAppearance.Material.Subhead.Inverse">
+ <item name="textSize">@dimen/text_size_subtitle_material_toolbar</item>
+ </style>
+ <style name="TextAppearance.Material.Widget.ActionBar.Title"
+ parent="TextAppearance.Material.Title">
+ <item name="textSize">@dimen/text_size_title_material_toolbar</item>
+ </style>
+ <style name="TextAppearance.Material.Widget.ActionBar.Title.Inverse"
+ parent="TextAppearance.Material.Title.Inverse">
+ <item name="textSize">@dimen/text_size_title_material_toolbar</item>
+ </style>
+ <style name="TextAppearance.Material.Widget.ActionBar.Subtitle"
+ parent="TextAppearance.Material.Subhead">
+ <item name="textSize">@dimen/text_size_subtitle_material_toolbar</item>
+ </style>
+ <style name="TextAppearance.Material.Widget.ActionBar.Subtitle.Inverse"
+ parent="TextAppearance.Material.Subhead.Inverse">
+ <item name="textSize">@dimen/text_size_subtitle_material_toolbar</item>
+ </style>
<style name="TextAppearance.Material.Widget.ActionBar.Menu" parent="TextAppearance.Material.Menu">
<item name="textColor">?attr/actionMenuTextColor</item>
@@ -333,6 +356,11 @@
<item name="textAllCaps">@bool/config_actionMenuItemAllCaps</item>
</style>
+ <style name="TextAppearance.Material.Widget.Toolbar.Title"
+ parent="TextAppearance.Material.Widget.ActionBar.Title" />
+ <style name="TextAppearance.Material.Widget.Toolbar.Subtitle"
+ parent="TextAppearance.Material.Widget.ActionBar.Subtitle" />
+
<style name="TextAppearance.Material.WindowTitle" parent="TextAppearance.Material.Title" />
<style name="TextAppearance.Material.DialogWindowTitle" parent="TextAppearance.Material.Title" />
@@ -423,12 +451,15 @@
<style name="Widget.Material" parent="Widget" />
<!-- Bordered ink button -->
- <style name="Widget.Material.Button" parent="Widget.Button">
+ <style name="Widget.Material.Button">
<item name="background">@drawable/btn_default_material</item>
<item name="textAppearance">?attr/textAppearanceButton</item>
<item name="minHeight">48dip</item>
<item name="minWidth">88dip</item>
<item name="stateListAnimator">@anim/button_state_list_anim_material</item>
+ <item name="focusable">true</item>
+ <item name="clickable">true</item>
+ <item name="gravity">center_vertical|center_horizontal</item>
</style>
<!-- Small bordered ink button -->
@@ -471,9 +502,6 @@
<style name="Widget.Material.ButtonBar.AlertDialog">
<item name="background">@null</item>
- <item name="paddingStart">16dp</item>
- <item name="paddingEnd">16dp</item>
- <item name="paddingBottom">16dp</item>
<item name="minHeight">@dimen/alert_dialog_button_bar_height</item>
</style>
@@ -759,6 +787,8 @@
<style name="Widget.Material.Toolbar" parent="Widget.Toolbar">
<item name="navigationButtonStyle">@style/Widget.Material.Toolbar.Button.Navigation</item>
+ <item name="titleTextAppearance">@style/TextAppearance.Material.Widget.Toolbar.Title</item>
+ <item name="subtitleTextAppearance">@style/TextAppearance.Material.Widget.Toolbar.Subtitle</item>
</style>
<style name="Widget.Material.Toolbar.Button.Navigation" parent="Widget.Toolbar.Button.Navigation">
diff --git a/graphics/java/android/graphics/Paint.java b/graphics/java/android/graphics/Paint.java
index 1c76d9c..652fe64 100644
--- a/graphics/java/android/graphics/Paint.java
+++ b/graphics/java/android/graphics/Paint.java
@@ -1109,9 +1109,16 @@
* This draws a shadow layer below the main layer, with the specified
* offset and color, and blur radius. If radius is 0, then the shadow
* layer is removed.
+ * <p>
+ * Can be used to create a blurred shadow underneath text. Support for use
+ * with other drawing operations is constrained to the software rendering
+ * pipeline.
+ * <p>
+ * The alpha of the shadow will be the paint's alpha if the shadow color is
+ * opaque, or the alpha from the shadow color if not.
*/
- public void setShadowLayer(float radius, float dx, float dy, int color) {
- native_setShadowLayer(mNativePaint, radius, dx, dy, color);
+ public void setShadowLayer(float radius, float dx, float dy, int shadowColor) {
+ native_setShadowLayer(mNativePaint, radius, dx, dy, shadowColor);
}
/**
diff --git a/libs/hwui/DisplayListOp.h b/libs/hwui/DisplayListOp.h
index 1032a75..5f533a7 100644
--- a/libs/hwui/DisplayListOp.h
+++ b/libs/hwui/DisplayListOp.h
@@ -1001,6 +1001,8 @@
public:
DrawStrokableOp(float left, float top, float right, float bottom, const SkPaint* paint)
: DrawBoundedOp(left, top, right, bottom, paint) {};
+ DrawStrokableOp(const Rect& localBounds, const SkPaint* paint)
+ : DrawBoundedOp(localBounds, paint) {};
virtual bool getLocalBounds(Rect& localBounds) {
localBounds.set(mLocalBounds);
@@ -1339,11 +1341,11 @@
const float* mPositions;
};
-class DrawTextOp : public DrawBoundedOp {
+class DrawTextOp : public DrawStrokableOp {
public:
DrawTextOp(const char* text, int bytesCount, int count, float x, float y,
const float* positions, const SkPaint* paint, float totalAdvance, const Rect& bounds)
- : DrawBoundedOp(bounds, paint), mText(text), mBytesCount(bytesCount), mCount(count),
+ : DrawStrokableOp(bounds, paint), mText(text), mBytesCount(bytesCount), mCount(count),
mX(x), mY(y), mPositions(positions), mTotalAdvance(totalAdvance) {
mPrecacheTransform = SkMatrix::InvalidMatrix();
}
diff --git a/libs/hwui/DisplayListRenderer.cpp b/libs/hwui/DisplayListRenderer.cpp
index 94162fc..9a9c544 100644
--- a/libs/hwui/DisplayListRenderer.cpp
+++ b/libs/hwui/DisplayListRenderer.cpp
@@ -376,7 +376,7 @@
float x, float y, const float* positions, const SkPaint* paint,
float totalAdvance, const Rect& bounds, DrawOpMode drawOpMode) {
- if (!text || count <= 0) return DrawGlInfo::kStatusDone;
+ if (!text || count <= 0 || paintWillNotDrawText(*paint)) return DrawGlInfo::kStatusDone;
text = refText(text, bytesCount);
positions = refBuffer<float>(positions, count * 2);
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp
index 721ab3d..bbf0551 100755
--- a/libs/hwui/OpenGLRenderer.cpp
+++ b/libs/hwui/OpenGLRenderer.cpp
@@ -2518,8 +2518,9 @@
status_t OpenGLRenderer::drawRoundRect(float left, float top, float right, float bottom,
float rx, float ry, const SkPaint* p) {
- if (currentSnapshot()->isIgnored() || quickRejectSetupScissor(left, top, right, bottom, p) ||
- (p->getAlpha() == 0 && getXfermode(p->getXfermode()) != SkXfermode::kClear_Mode)) {
+ if (currentSnapshot()->isIgnored()
+ || quickRejectSetupScissor(left, top, right, bottom, p)
+ || paintWillNotDraw(*p)) {
return DrawGlInfo::kStatusDone;
}
@@ -2536,9 +2537,9 @@
}
status_t OpenGLRenderer::drawCircle(float x, float y, float radius, const SkPaint* p) {
- if (currentSnapshot()->isIgnored() || quickRejectSetupScissor(x - radius, y - radius,
- x + radius, y + radius, p) ||
- (p->getAlpha() == 0 && getXfermode(p->getXfermode()) != SkXfermode::kClear_Mode)) {
+ if (currentSnapshot()->isIgnored()
+ || quickRejectSetupScissor(x - radius, y - radius, x + radius, y + radius, p)
+ || paintWillNotDraw(*p)) {
return DrawGlInfo::kStatusDone;
}
if (p->getPathEffect() != 0) {
@@ -2558,8 +2559,9 @@
status_t OpenGLRenderer::drawOval(float left, float top, float right, float bottom,
const SkPaint* p) {
- if (currentSnapshot()->isIgnored() || quickRejectSetupScissor(left, top, right, bottom, p) ||
- (p->getAlpha() == 0 && getXfermode(p->getXfermode()) != SkXfermode::kClear_Mode)) {
+ if (currentSnapshot()->isIgnored()
+ || quickRejectSetupScissor(left, top, right, bottom, p)
+ || paintWillNotDraw(*p)) {
return DrawGlInfo::kStatusDone;
}
@@ -2580,8 +2582,9 @@
status_t OpenGLRenderer::drawArc(float left, float top, float right, float bottom,
float startAngle, float sweepAngle, bool useCenter, const SkPaint* p) {
- if (currentSnapshot()->isIgnored() || quickRejectSetupScissor(left, top, right, bottom, p) ||
- (p->getAlpha() == 0 && getXfermode(p->getXfermode()) != SkXfermode::kClear_Mode)) {
+ if (currentSnapshot()->isIgnored()
+ || quickRejectSetupScissor(left, top, right, bottom, p)
+ || paintWillNotDraw(*p)) {
return DrawGlInfo::kStatusDone;
}
@@ -2614,8 +2617,9 @@
status_t OpenGLRenderer::drawRect(float left, float top, float right, float bottom,
const SkPaint* p) {
- if (currentSnapshot()->isIgnored() || quickRejectSetupScissor(left, top, right, bottom, p) ||
- (p->getAlpha() == 0 && getXfermode(p->getXfermode()) != SkXfermode::kClear_Mode)) {
+ if (currentSnapshot()->isIgnored()
+ || quickRejectSetupScissor(left, top, right, bottom, p)
+ || paintWillNotDraw(*p)) {
return DrawGlInfo::kStatusDone;
}
diff --git a/libs/hwui/Renderer.h b/libs/hwui/Renderer.h
index f5cd266..6d4bb4a 100644
--- a/libs/hwui/Renderer.h
+++ b/libs/hwui/Renderer.h
@@ -67,6 +67,18 @@
return resultMode;
}
+ // TODO: move to a method on android:Paint
+ static inline bool paintWillNotDraw(const SkPaint& paint) {
+ return paint.getAlpha() == 0
+ && getXfermode(paint.getXfermode()) != SkXfermode::kClear_Mode;
+ }
+
+ // TODO: move to a method on android:Paint
+ static inline bool paintWillNotDrawText(const SkPaint& paint) {
+ return paint.getAlpha() == 0
+ && paint.getLooper() == NULL
+ && getXfermode(paint.getXfermode()) == SkXfermode::kSrcOver_Mode;
+ }
// ----------------------------------------------------------------------------
// Frame state operations
// ----------------------------------------------------------------------------
diff --git a/media/java/android/media/tv/TvView.java b/media/java/android/media/tv/TvView.java
index 445194e..f348b9b 100644
--- a/media/java/android/media/tv/TvView.java
+++ b/media/java/android/media/tv/TvView.java
@@ -59,19 +59,6 @@
// STOPSHIP: Turn debugging off.
private static final boolean DEBUG = true;
- /**
- * Passed with {@link TvInputListener#onError(String, int)}. Indicates that the connection to
- * the requested TV input was not established thus the view is unable to handle the further
- * operations.
- */
- public static final int ERROR_INPUT_NOT_CONNECTED = 0;
-
- /**
- * Passed with {@link TvInputListener#onError(String, int)}. Indicates that the underlying TV
- * input has been disconnected.
- */
- public static final int ERROR_INPUT_DISCONNECTED = 1;
-
private static final int VIDEO_SIZE_VALUE_UNKNOWN = 0;
private static final int ZORDER_MEDIA = 0;
@@ -686,13 +673,20 @@
public abstract static class TvInputListener {
/**
- * This is invoked when an error occurred while handling requested operation.
+ * This is invoked when an error occurred while establishing a connection to the underlying
+ * TV input.
*
* @param inputId The ID of the TV input bound to this view.
- * @param errorCode The error code. For the details of error code, please see
- * {@link TvView}.
*/
- public void onError(String inputId, int errorCode) {
+ public void onConnectionFailed(String inputId) {
+ }
+
+ /**
+ * This is invoked when the existing connection to the underlying TV input is lost.
+ *
+ * @param inputId The ID of the TV input bound to this view.
+ */
+ public void onDisconnected(String inputId) {
}
/**
@@ -857,7 +851,7 @@
}
} else {
if (mListener != null) {
- mListener.onError(mInputId, ERROR_INPUT_NOT_CONNECTED);
+ mListener.onConnectionFailed(mInputId);
}
}
}
@@ -870,7 +864,7 @@
mSessionCallback = null;
mSession = null;
if (mListener != null) {
- mListener.onError(mInputId, ERROR_INPUT_DISCONNECTED);
+ mListener.onDisconnected(mInputId);
}
}
diff --git a/packages/PrintSpooler/res/values/themes.xml b/packages/PrintSpooler/res/values/themes.xml
index db319e9..08702291 100644
--- a/packages/PrintSpooler/res/values/themes.xml
+++ b/packages/PrintSpooler/res/values/themes.xml
@@ -16,7 +16,10 @@
<resources>
- <style name="PrintActivity" parent="@android:style/Theme.Material.Settings">
+ <style name="PrintActivity" parent="@android:style/Theme.Material">
+ <item name="android:colorPrimary">@*android:color/material_blue_grey_900</item>
+ <item name="android:colorPrimaryDark">@*android:color/material_blue_grey_950</item>
+ <item name="android:colorAccent">@*android:color/material_deep_teal_A500</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowContentOverlay">@null</item>
diff --git a/services/core/java/com/android/server/am/ActivityRecord.java b/services/core/java/com/android/server/am/ActivityRecord.java
index e528d57..abacb2d 100755
--- a/services/core/java/com/android/server/am/ActivityRecord.java
+++ b/services/core/java/com/android/server/am/ActivityRecord.java
@@ -575,6 +575,10 @@
void makeFinishing() {
if (!finishing) {
+ if (this == task.stack.getVisibleBehindActivity()) {
+ // A finishing activity should not remain as visible in the background
+ mStackSupervisor.requestVisibleBehindLocked(this, false);
+ }
finishing = true;
if (stopped) {
clearOptionsLocked();
diff --git a/services/core/java/com/android/server/am/ActivityStackSupervisor.java b/services/core/java/com/android/server/am/ActivityStackSupervisor.java
index 1107139..931f448 100644
--- a/services/core/java/com/android/server/am/ActivityStackSupervisor.java
+++ b/services/core/java/com/android/server/am/ActivityStackSupervisor.java
@@ -2659,13 +2659,20 @@
}
// A non-top activity is reporting a visibility change.
- if (top.fullscreen || top.state != ActivityState.RESUMED || top.app == null ||
- top.app.thread == null) {
+ if ((visible && (top.fullscreen || top.state != ActivityState.RESUMED)) ||
+ top.app == null || top.app.thread == null) {
// Can't carry out this request.
if (DEBUG_VISIBLE_BEHIND) Slog.d(TAG, "requestVisibleBehind: returning top.fullscreen="
- + top.fullscreen+ " top.state=" + top.state + " top.app=" + top.app +
+ + top.fullscreen + " top.state=" + top.state + " top.app=" + top.app +
" top.app.thread=" + top.app.thread);
return false;
+ } else if (!visible && stack.getVisibleBehindActivity() != r) {
+ // Only the activity set as currently visible behind should actively reset its
+ // visible behind state.
+ if (DEBUG_VISIBLE_BEHIND) Slog.d(TAG, "requestVisibleBehind: returning visible="
+ + visible + " stack.getVisibleBehindActivity()=" +
+ stack.getVisibleBehindActivity() + " r=" + r);
+ return false;
}
stack.setVisibleBehindActivity(visible ? r : null);
diff --git a/tools/aapt/ResourceTable.cpp b/tools/aapt/ResourceTable.cpp
index cf1d4fd..c98808f 100644
--- a/tools/aapt/ResourceTable.cpp
+++ b/tools/aapt/ResourceTable.cpp
@@ -484,15 +484,6 @@
attr.hasErrors = true;
}
- // Make sure an id is defined for this enum/flag identifier...
- if (!attr.hasErrors && !outTable->hasBagOrEntry(itemIdent, &id16, &myPackage)) {
- err = outTable->startBag(SourcePos(in->getPrintableSource(), block.getLineNumber()),
- myPackage, id16, itemIdent, String16(), NULL);
- if (err != NO_ERROR) {
- attr.hasErrors = true;
- }
- }
-
if (!attr.hasErrors) {
if (enumOrFlagsComment.size() == 0) {
enumOrFlagsComment.append(mayOrMust(attr.type,
@@ -2508,11 +2499,13 @@
sp<Type> attr = p->getType(String16("attr"), unknown);
// Assign indices...
- for (ti=0; ti<N; ti++) {
+ const size_t typeCount = p->getOrderedTypes().size();
+ for (size_t ti = 0; ti < typeCount; ti++) {
sp<Type> t = p->getOrderedTypes().itemAt(ti);
if (t == NULL) {
continue;
}
+
err = t->applyPublicEntryOrder();
if (err != NO_ERROR && firstError == NO_ERROR) {
firstError = err;
@@ -2534,7 +2527,7 @@
}
// Assign resource IDs to keys in bags...
- for (ti=0; ti<N; ti++) {
+ for (size_t ti = 0; ti < typeCount; ti++) {
sp<Type> t = p->getOrderedTypes().itemAt(ti);
if (t == NULL) {
continue;
@@ -3296,11 +3289,16 @@
Item item(sourcePos, false, value, style);
if (mType == TYPE_BAG) {
- const Item& item(mBag.valueAt(0));
- sourcePos.error("Resource entry %s is already defined as a bag.\n"
- "%s:%d: Originally defined here.\n",
- String8(mName).string(),
- item.sourcePos.file.string(), item.sourcePos.line);
+ if (mBag.size() == 0) {
+ sourcePos.error("Resource entry %s is already defined as a bag.",
+ String8(mName).string());
+ } else {
+ const Item& item(mBag.valueAt(0));
+ sourcePos.error("Resource entry %s is already defined as a bag.\n"
+ "%s:%d: Originally defined here.\n",
+ String8(mName).string(),
+ item.sourcePos.file.string(), item.sourcePos.line);
+ }
return UNKNOWN_ERROR;
}
if ( (mType != TYPE_UNKNOWN) && (overwrite == false) ) {
@@ -3374,6 +3372,9 @@
if (it.isId) {
if (!table->hasBagOrEntry(key, &id16, &package)) {
String16 value("false");
+ NOISY(fprintf(stderr, "Generating %s:id/%s\n",
+ String8(package).string(),
+ String8(key).string()));
status_t err = table->addEntry(SourcePos(String8("<generated>"), 0), package,
id16, key, value);
if (err != NO_ERROR) {
diff --git a/tools/layoutlib/bridge/resources/bars/status_bar.xml b/tools/layoutlib/bridge/resources/bars/status_bar.xml
index 75bfb6e..04571e1 100644
--- a/tools/layoutlib/bridge/resources/bars/status_bar.xml
+++ b/tools/layoutlib/bridge/resources/bars/status_bar.xml
@@ -1,17 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android">
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_weight="1"/>
- <ImageView
- android:layout_height="wrap_content"
- android:layout_width="wrap_content"
- android:layout_marginTop="1dp"/>
- <ImageView
- android:layout_height="wrap_content"
- android:layout_width="wrap_content"
- android:layout_marginLeft="3dp"
- android:layout_marginRight="5dp"
- android:layout_marginTop="2dp"/>
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"/>
+ <!-- The exact size of the wifi icon is specified in order to scale it properly.
+ Without scaling, it appeared huge. This is currently, 70% of the actual size. -->
+ <ImageView
+ android:layout_height="22.4dp"
+ android:layout_width="20.65dp"
+ android:layout_marginTop="1dp"/>
+ <ImageView
+ android:layout_height="wrap_content"
+ android:layout_width="wrap_content"
+ android:layout_marginLeft="3dp"
+ android:layout_marginRight="5dp"
+ android:layout_marginTop="4dp"/>
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="4dp"
+ android:layout_marginRight="5dp"
+ android:gravity="center_vertical"
+ android:textSize="16dp"
+ android:fontFamily="sans-serif-medium"/>
</merge>
diff --git a/tools/layoutlib/bridge/resources/bars/v21/hdpi/stat_sys_wifi_signal_4_fully.png b/tools/layoutlib/bridge/resources/bars/v21/hdpi/stat_sys_wifi_signal_4_fully.png
deleted file mode 100644
index 931daed..0000000
--- a/tools/layoutlib/bridge/resources/bars/v21/hdpi/stat_sys_wifi_signal_4_fully.png
+++ /dev/null
Binary files differ
diff --git a/tools/layoutlib/bridge/resources/bars/v21/mdpi/stat_sys_wifi_signal_4_fully.png b/tools/layoutlib/bridge/resources/bars/v21/mdpi/stat_sys_wifi_signal_4_fully.png
deleted file mode 100644
index 6e1ac91..0000000
--- a/tools/layoutlib/bridge/resources/bars/v21/mdpi/stat_sys_wifi_signal_4_fully.png
+++ /dev/null
Binary files differ
diff --git a/tools/layoutlib/bridge/resources/bars/v21/xhdpi/stat_sys_wifi_signal_4_fully.png b/tools/layoutlib/bridge/resources/bars/v21/xhdpi/stat_sys_wifi_signal_4_fully.png
deleted file mode 100644
index 625c61d..0000000
--- a/tools/layoutlib/bridge/resources/bars/v21/xhdpi/stat_sys_wifi_signal_4_fully.png
+++ /dev/null
Binary files differ
diff --git a/tools/layoutlib/bridge/resources/bars/v21/xhdpi/stat_sys_wifi_signal_4_fully.xml b/tools/layoutlib/bridge/resources/bars/v21/xhdpi/stat_sys_wifi_signal_4_fully.xml
new file mode 100644
index 0000000..0498b6c
--- /dev/null
+++ b/tools/layoutlib/bridge/resources/bars/v21/xhdpi/stat_sys_wifi_signal_4_fully.xml
@@ -0,0 +1,9 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="32.0dp"
+ android:height="29.5dp"
+ android:viewportWidth="26.0"
+ android:viewportHeight="24.0">
+ <path
+ android:fillColor="#FFFFFFFF"
+ android:pathData="M13.000000,22.000000L25.600000,6.500000C25.100000,6.100000 20.299999,2.100000 13.000000,2.100000S0.900000,6.100000 0.400000,6.500000L13.000000,22.000000L13.000000,22.000000L13.000000,22.000000L13.000000,22.000000L13.000000,22.000000z"/>
+</vector>
diff --git a/tools/layoutlib/bridge/src/android/content/res/BridgeTypedArray.java b/tools/layoutlib/bridge/src/android/content/res/BridgeTypedArray.java
index f939678..5b69681 100644
--- a/tools/layoutlib/bridge/src/android/content/res/BridgeTypedArray.java
+++ b/tools/layoutlib/bridge/src/android/content/res/BridgeTypedArray.java
@@ -91,7 +91,7 @@
// first count the array size
int count = 0;
for (ResourceValue data : mResourceData) {
- if (data != null) {
+ if (data != null && !RenderResources.REFERENCE_NULL.equals(data.getValue())) {
count++;
}
}
@@ -103,7 +103,8 @@
// fill the array with the indices.
int index = 1;
for (int i = 0 ; i < mResourceData.length ; i++) {
- if (mResourceData[i] != null) {
+ if (mResourceData[i] != null
+ && !RenderResources.REFERENCE_NULL.equals(mResourceData[i].getValue())) {
mIndices[index++] = i;
}
}
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/Config.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/Config.java
index 9b814f5..16b54f1 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/Config.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/Config.java
@@ -20,10 +20,7 @@
import java.util.Collections;
import java.util.List;
-import static android.os.Build.VERSION_CODES.GINGERBREAD;
-import static android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH;
-import static android.os.Build.VERSION_CODES.JELLY_BEAN_MR2;
-import static android.os.Build.VERSION_CODES.KITKAT;
+import static android.os.Build.VERSION_CODES.*;
/**
* Various helper methods to simulate older versions of platform.
@@ -39,13 +36,16 @@
private static final List<String> sDefaultResourceDir =
Collections.singletonList(DEFAULT_RESOURCE_DIR);
+ private static final int WHITE = 0xFFFFFFFF;
+ private static final int BLACK = 0xFF000000;
+
public static boolean showOnScreenNavBar(int platformVersion) {
return platformVersion == 0 || platformVersion >= ICE_CREAM_SANDWICH;
}
public static int getStatusBarColor(int platformVersion) {
// return white for froyo and earlier; black otherwise.
- return platformVersion == 0 || platformVersion >= GINGERBREAD ? 0xFF000000 : 0xFFFFFFFF;
+ return platformVersion == 0 || platformVersion >= GINGERBREAD ? BLACK : WHITE;
}
public static List<String> getResourceDirs(int platformVersion) {
@@ -70,4 +70,49 @@
return Collections.unmodifiableList(list);
}
+
+ public static String getTime(int platformVersion) {
+ if (platformVersion == 0) {
+ // TODO: revisit when the version is selected.
+ return "4:57";
+ }
+ if (platformVersion < GINGERBREAD) {
+ return "2:20";
+ }
+ if (platformVersion < ICE_CREAM_SANDWICH) {
+ return "2:30";
+ }
+ if (platformVersion < JELLY_BEAN) {
+ return "4:00";
+ }
+ if (platformVersion < KITKAT) {
+ return "4:30";
+ }
+ if (platformVersion <= KITKAT_WATCH) {
+ return "4:40";
+ }
+ // Should never happen.
+ return "4:04";
+ }
+
+ public static int getTimeColor(int platformVersion) {
+ if (platformVersion == 0 || platformVersion >= KITKAT ||
+ platformVersion > FROYO && platformVersion < HONEYCOMB) {
+ // Gingerbread and KitKat onwards.
+ return WHITE;
+ }
+ // Black for froyo.
+ if (platformVersion < GINGERBREAD) {
+ return BLACK;
+ } else if (platformVersion < KITKAT) {
+ // Honeycomb to JB-mr2: Holo blue light.
+ return 0xff33b5e5;
+ }
+ // Should never happen.
+ return WHITE;
+ }
+
+ public static String getWifiIconType(int platformVersion) {
+ return platformVersion == 0 ? "xml" : "png";
+ }
}
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/CustomBar.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/CustomBar.java
index bed232ab..13ddf07 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/CustomBar.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/CustomBar.java
@@ -127,24 +127,25 @@
}
}
- protected TextView setText(int index, String stringReference) {
+ protected TextView setText(int index, String string, boolean reference) {
View child = getChildAt(index);
if (child instanceof TextView) {
TextView textView = (TextView) child;
- setText(textView, stringReference);
+ setText(textView, string, reference);
return textView;
}
return null;
}
- private void setText(TextView textView, String stringReference) {
- ResourceValue value = getResourceValue(stringReference);
- if (value != null) {
- textView.setText(value.getValue());
- } else {
- textView.setText(stringReference);
+ private void setText(TextView textView, String string, boolean reference) {
+ if (reference) {
+ ResourceValue value = getResourceValue(string);
+ if (value != null) {
+ string = value.getValue();
+ }
}
+ textView.setText(string);
}
protected void setStyle(String themeEntryName) {
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/StatusBar.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/StatusBar.java
index 1795db9..c7c62d6 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/StatusBar.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/StatusBar.java
@@ -16,22 +16,38 @@
package com.android.layoutlib.bridge.bars;
+import com.android.ide.common.rendering.api.LayoutLog;
+import com.android.layoutlib.bridge.Bridge;
+import com.android.layoutlib.bridge.android.BridgeContext;
+import com.android.layoutlib.bridge.android.BridgeXmlBlockParser;
+import com.android.layoutlib.bridge.impl.ParserFactory;
import com.android.resources.Density;
import org.xmlpull.v1.XmlPullParserException;
import android.content.Context;
+import android.graphics.drawable.Drawable;
import android.view.Gravity;
+import android.view.View;
+import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
+import java.io.IOException;
+import java.io.InputStream;
+
public class StatusBar extends CustomBar {
+ private final Context mContext;
+ private final int mSimulatedPlatformVersion;
+
public StatusBar(Context context, Density density, int direction, boolean RtlEnabled,
int simulatedPlatformVersion) throws XmlPullParserException {
// FIXME: if direction is RTL but it's not enabled in application manifest, mirror this bar.
super(context, LinearLayout.HORIZONTAL, "/bars/status_bar.xml", "status_bar.xml",
simulatedPlatformVersion);
+ mContext = context;
+ mSimulatedPlatformVersion = simulatedPlatformVersion;
// FIXME: use FILL_H?
setGravity(Gravity.START | Gravity.TOP | Gravity.RIGHT);
@@ -41,8 +57,44 @@
// created for them.
// We do know the order though.
// 0 is the spacer
- loadIcon(1, "stat_sys_wifi_signal_4_fully.png", density);
+ loadIcon(1, "stat_sys_wifi_signal_4_fully."
+ + Config.getWifiIconType(simulatedPlatformVersion), density);
loadIcon(2, "stat_sys_battery_100.png", density);
+ setText(3, Config.getTime(simulatedPlatformVersion), false)
+ .setTextColor(Config.getTimeColor(simulatedPlatformVersion));
+ }
+
+ @Override
+ protected void loadIcon(int index, String iconName, Density density) {
+ if (!iconName.endsWith(".xml")) {
+ super.loadIcon(index, iconName, density);
+ return;
+ }
+ View child = getChildAt(index);
+ if (child instanceof ImageView) {
+ ImageView imageView = (ImageView) child;
+ // The xml is stored only in xhdpi.
+ IconLoader iconLoader = new IconLoader(iconName, Density.XHIGH,
+ mSimulatedPlatformVersion, null);
+ InputStream stream = iconLoader.getIcon();
+
+ if (stream != null) {
+ try {
+ BridgeXmlBlockParser parser = new BridgeXmlBlockParser(
+ ParserFactory.create(stream, null), (BridgeContext) mContext, true);
+ Drawable drawable = Drawable.createFromXml(mContext.getResources(), parser);
+ if (drawable != null) {
+ imageView.setImageDrawable(drawable);
+ }
+ } catch (XmlPullParserException e) {
+ Bridge.getLog().error(LayoutLog.TAG_BROKEN, "Unable to draw wifi icon", e,
+ null);
+ } catch (IOException e) {
+ Bridge.getLog().error(LayoutLog.TAG_BROKEN, "Unable to draw wifi icon", e,
+ null);
+ }
+ }
+ }
}
@Override
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/TitleBar.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/TitleBar.java
index ff952bd..10f1383 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/TitleBar.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/TitleBar.java
@@ -34,7 +34,7 @@
// Cannot access the inside items through id because no R.id values have been
// created for them.
// We do know the order though.
- mTextView = setText(0, label);
+ mTextView = setText(0, label, true);
setStyle("windowTitleBackgroundStyle");
}