Merge "Add NetworkAgent event for ExplicitlySelected" into lmp-dev
diff --git a/core/java/android/view/WindowInsets.java b/core/java/android/view/WindowInsets.java
index 2bfe3b4..9e0719d 100644
--- a/core/java/android/view/WindowInsets.java
+++ b/core/java/android/view/WindowInsets.java
@@ -316,7 +316,6 @@
top ? 0 : mSystemWindowInsets.top,
right ? 0 : mSystemWindowInsets.right,
bottom ? 0 : mSystemWindowInsets.bottom);
- result.mSystemWindowInsetsConsumed = !hasSystemWindowInsets();
return result;
}
return this;
@@ -336,7 +335,6 @@
int right, int bottom) {
final WindowInsets result = new WindowInsets(this);
result.mSystemWindowInsets = new Rect(left, top, right, bottom);
- result.mSystemWindowInsetsConsumed = !hasSystemWindowInsets();
return result;
}
@@ -351,7 +349,6 @@
public WindowInsets replaceSystemWindowInsets(Rect systemWindowInsets) {
final WindowInsets result = new WindowInsets(this);
result.mSystemWindowInsets = new Rect(systemWindowInsets);
- result.mSystemWindowInsetsConsumed = !hasSystemWindowInsets();
return result;
}
@@ -376,7 +373,6 @@
top ? 0 : mWindowDecorInsets.top,
right ? 0 : mWindowDecorInsets.right,
bottom ? 0 : mWindowDecorInsets.bottom);
- result.mWindowDecorInsetsConsumed = !hasWindowDecorInsets();
return result;
}
return this;
@@ -388,7 +384,6 @@
public WindowInsets replaceWindowDecorInsets(int left, int top, int right, int bottom) {
final WindowInsets result = new WindowInsets(this);
result.mWindowDecorInsets = new Rect(left, top, right, bottom);
- result.mWindowDecorInsetsConsumed = !hasWindowDecorInsets();
return result;
}
diff --git a/core/java/android/view/accessibility/CaptioningManager.java b/core/java/android/view/accessibility/CaptioningManager.java
index 334ff43..382a266 100644
--- a/core/java/android/view/accessibility/CaptioningManager.java
+++ b/core/java/android/view/accessibility/CaptioningManager.java
@@ -330,15 +330,30 @@
*/
public final String mRawTypeface;
+ private final boolean mHasForegroundColor;
+ private final boolean mHasBackgroundColor;
+ private final boolean mHasEdgeType;
+ private final boolean mHasEdgeColor;
+ private final boolean mHasWindowColor;
+
+ /** Lazily-created typeface based on the raw typeface string. */
private Typeface mParsedTypeface;
private CaptionStyle(int foregroundColor, int backgroundColor, int edgeType, int edgeColor,
int windowColor, String rawTypeface) {
- this.foregroundColor = foregroundColor;
- this.backgroundColor = backgroundColor;
- this.edgeType = edgeType;
- this.edgeColor = edgeColor;
- this.windowColor = windowColor;
+ mHasForegroundColor = foregroundColor != COLOR_UNSPECIFIED;
+ mHasBackgroundColor = backgroundColor != COLOR_UNSPECIFIED;
+ mHasEdgeType = edgeType != EDGE_TYPE_UNSPECIFIED;
+ mHasEdgeColor = edgeColor != COLOR_UNSPECIFIED;
+ mHasWindowColor = windowColor != COLOR_UNSPECIFIED;
+
+ // Always use valid colors, even when no override is specified, to
+ // ensure backwards compatibility with apps targeting KitKat MR2.
+ this.foregroundColor = mHasForegroundColor ? foregroundColor : Color.WHITE;
+ this.backgroundColor = mHasBackgroundColor ? backgroundColor : Color.BLACK;
+ this.edgeType = mHasEdgeType ? edgeType : EDGE_TYPE_NONE;
+ this.edgeColor = mHasEdgeColor ? edgeColor : Color.BLACK;
+ this.windowColor = mHasWindowColor ? windowColor : COLOR_NONE_OPAQUE;
mRawTypeface = rawTypeface;
}
@@ -375,7 +390,7 @@
* otherwise
*/
public boolean hasBackgroundColor() {
- return backgroundColor != COLOR_UNSPECIFIED;
+ return mHasBackgroundColor;
}
/**
@@ -384,7 +399,7 @@
* otherwise
*/
public boolean hasForegroundColor() {
- return foregroundColor != COLOR_UNSPECIFIED;
+ return mHasForegroundColor;
}
/**
@@ -393,7 +408,7 @@
* otherwise
*/
public boolean hasEdgeType() {
- return edgeType != EDGE_TYPE_UNSPECIFIED;
+ return mHasEdgeType;
}
/**
@@ -402,7 +417,7 @@
* otherwise
*/
public boolean hasEdgeColor() {
- return edgeColor != COLOR_UNSPECIFIED;
+ return mHasEdgeColor;
}
/**
@@ -411,7 +426,7 @@
* otherwise
*/
public boolean hasWindowColor() {
- return windowColor != COLOR_UNSPECIFIED;
+ return mHasWindowColor;
}
/**
diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java
index 3859e48..af53ec8 100644
--- a/core/java/android/widget/AbsListView.java
+++ b/core/java/android/widget/AbsListView.java
@@ -3323,7 +3323,8 @@
if (mLastY == Integer.MIN_VALUE) {
rawDeltaY -= mMotionCorrection;
}
- if (dispatchNestedPreScroll(0, -rawDeltaY, mScrollConsumed, mScrollOffset)) {
+ if (dispatchNestedPreScroll(0, mLastY != Integer.MIN_VALUE ? mLastY - y : -rawDeltaY,
+ mScrollConsumed, mScrollOffset)) {
rawDeltaY += mScrollConsumed[1];
scrollOffsetCorrection = -mScrollOffset[1];
scrollConsumedCorrection = mScrollConsumed[1];
diff --git a/core/java/android/widget/RadialTimePickerView.java b/core/java/android/widget/RadialTimePickerView.java
index d2f68d0..0460282 100644
--- a/core/java/android/widget/RadialTimePickerView.java
+++ b/core/java/android/widget/RadialTimePickerView.java
@@ -137,6 +137,11 @@
private boolean mIs24HourMode;
private boolean mShowHours;
+
+ /**
+ * When in 24-hour mode, indicates that the current hour is between
+ * 1 and 12 (inclusive).
+ */
private boolean mIsOnInnerCircle;
private int mXCenter;
@@ -513,49 +518,53 @@
mListener = listener;
}
+ /**
+ * Sets the current hour in 24-hour time.
+ *
+ * @param hour the current hour between 0 and 23 (inclusive)
+ */
public void setCurrentHour(int hour) {
final int degrees = (hour % 12) * DEGREES_FOR_ONE_HOUR;
mSelectionDegrees[HOURS] = degrees;
mSelectionDegrees[HOURS_INNER] = degrees;
- mAmOrPm = ((hour % 24) < 12) ? AM : PM;
+
+ // 0 is 12 AM (midnight) and 12 is 12 PM (noon).
+ mAmOrPm = (hour == 0 || (hour % 24) < 12) ? AM : PM;
+
if (mIs24HourMode) {
- mIsOnInnerCircle = (mAmOrPm == AM);
+ // Inner circle is 1 through 12.
+ mIsOnInnerCircle = hour >= 1 && hour <= 12;
} else {
mIsOnInnerCircle = false;
}
+
initData();
updateLayoutData();
invalidate();
}
- // Return hours in 0-23 range
+ /**
+ * Returns the current hour in 24-hour time.
+ *
+ * @return the current hour between 0 and 23 (inclusive)
+ */
public int getCurrentHour() {
- int hours =
- mSelectionDegrees[mIsOnInnerCircle ? HOURS_INNER : HOURS] / DEGREES_FOR_ONE_HOUR;
+ int hour = (mSelectionDegrees[mIsOnInnerCircle ?
+ HOURS_INNER : HOURS] / DEGREES_FOR_ONE_HOUR) % 12;
if (mIs24HourMode) {
- if (mIsOnInnerCircle) {
- hours = hours % 12;
- if (hours == 0) {
- hours = 12;
- }
- } else {
- if (hours != 0) {
- hours += 12;
- }
+ // Convert the 12-hour value into 24-hour time based on where the
+ // selector is positioned.
+ if (mIsOnInnerCircle && hour == 0) {
+ // Inner circle is 1 through 12.
+ hour = 12;
+ } else if (hour != 0) {
+ // Outer circle is 13 through 23 and 0.
+ hour += 12;
}
- } else {
- hours = hours % 12;
- if (hours == 0) {
- if (mAmOrPm == PM) {
- hours = 12;
- }
- } else {
- if (mAmOrPm == PM) {
- hours += 12;
- }
- }
+ } else if (mAmOrPm == PM) {
+ hour += 12;
}
- return hours;
+ return hour;
}
public void setCurrentMinute(int minute) {
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index 1509e80..a80d70a 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -8182,6 +8182,11 @@
* @removed
*/
public static ColorStateList getTextColors(Context context, TypedArray attrs) {
+ if (attrs == null) {
+ // Preserve behavior prior to removal of this API.
+ throw new NullPointerException();
+ }
+
// It's not safe to use this method from apps. The parameter 'attrs'
// must have been obtained using the TextView filter array which is not
// available to the SDK. As such, we grab a default TypedArray with the
diff --git a/core/res/res/drawable/vector_drawable_progress_bar_large.xml b/core/res/res/drawable/vector_drawable_progress_bar_large.xml
index 3bf3cd7..023f5cc 100644
--- a/core/res/res/drawable/vector_drawable_progress_bar_large.xml
+++ b/core/res/res/drawable/vector_drawable_progress_bar_large.xml
@@ -28,7 +28,7 @@
android:fillColor="#00000000"
android:pathData="M0, 0 m 0, -19 a 19,19 0 1,1 0,38 a 19,19 0 1,1 0,-38"
android:strokeColor="?attr/colorControlActivated"
- android:strokeLineCap="round"
+ android:strokeLineCap="square"
android:strokeLineJoin="miter"
android:strokeWidth="4"
android:trimPathEnd="0"
diff --git a/core/res/res/drawable/vector_drawable_progress_bar_medium.xml b/core/res/res/drawable/vector_drawable_progress_bar_medium.xml
index 62f9225..e72097e 100644
--- a/core/res/res/drawable/vector_drawable_progress_bar_medium.xml
+++ b/core/res/res/drawable/vector_drawable_progress_bar_medium.xml
@@ -28,7 +28,7 @@
android:fillColor="#00000000"
android:pathData="M0, 0 m 0, -19 a 19,19 0 1,1 0,38 a 19,19 0 1,1 0,-38"
android:strokeColor="?attr/colorControlActivated"
- android:strokeLineCap="round"
+ android:strokeLineCap="square"
android:strokeLineJoin="miter"
android:strokeWidth="4"
android:trimPathEnd="0"
diff --git a/core/res/res/drawable/vector_drawable_progress_bar_small.xml b/core/res/res/drawable/vector_drawable_progress_bar_small.xml
index 1352cfc..875e7a3 100644
--- a/core/res/res/drawable/vector_drawable_progress_bar_small.xml
+++ b/core/res/res/drawable/vector_drawable_progress_bar_small.xml
@@ -28,7 +28,7 @@
android:fillColor="#00000000"
android:pathData="M0, 0 m 0, -19 a 19,19 0 1,1 0,38 a 19,19 0 1,1 0,-38"
android:strokeColor="?attr/colorControlActivated"
- android:strokeLineCap="round"
+ android:strokeLineCap="square"
android:strokeLineJoin="miter"
android:strokeWidth="4"
android:trimPathEnd="0"