Merge "camera2: Api change (#getFrameNumber -> long; @hide REQUEST_FRAME_COUNT)" into lmp-dev
diff --git a/api/current.txt b/api/current.txt
index 7dc9ca2..995b63e 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -326,9 +326,8 @@
field public static final int alphabeticShortcut = 16843235; // 0x10101e3
field public static final int alwaysDrawnWithCache = 16842991; // 0x10100ef
field public static final int alwaysRetainTaskState = 16843267; // 0x1010203
- field public static final int amPmSelectedBackgroundColor = 16843947; // 0x10104ab
- field public static final int amPmTextColor = 16843945; // 0x10104a9
- field public static final int amPmUnselectedBackgroundColor = 16843946; // 0x10104aa
+ field public static final int amPmBackgroundColor = 16843944; // 0x10104a8
+ field public static final int amPmTextColor = 16843943; // 0x10104a7
field public static final int angle = 16843168; // 0x10101a0
field public static final int animateFirstView = 16843477; // 0x10102d5
field public static final int animateLayoutChanges = 16843506; // 0x10102f2
@@ -389,7 +388,7 @@
field public static final int buttonTint = 16843889; // 0x1010471
field public static final int buttonTintMode = 16843890; // 0x1010472
field public static final int cacheColorHint = 16843009; // 0x1010101
- field public static final int calendarTextColor = 16843934; // 0x101049e
+ field public static final int calendarTextColor = 16843933; // 0x101049d
field public static final int calendarViewShown = 16843596; // 0x101034c
field public static final int calendarViewStyle = 16843613; // 0x101035d
field public static final int canRequestEnhancedWebAccessibility = 16843736; // 0x10103d8
@@ -407,8 +406,8 @@
field public static final int centerY = 16843171; // 0x10101a3
field public static final int checkBoxPreferenceStyle = 16842895; // 0x101008f
field public static final int checkMark = 16843016; // 0x1010108
- field public static final int checkMarkTint = 16843949; // 0x10104ad
- field public static final int checkMarkTintMode = 16843950; // 0x10104ae
+ field public static final int checkMarkTint = 16843946; // 0x10104aa
+ field public static final int checkMarkTintMode = 16843947; // 0x10104ab
field public static final int checkable = 16843237; // 0x10101e5
field public static final int checkableBehavior = 16843232; // 0x10101e0
field public static final int checkboxStyle = 16842860; // 0x101006c
@@ -479,16 +478,11 @@
field public static final int dashGap = 16843175; // 0x10101a7
field public static final int dashWidth = 16843174; // 0x10101a6
field public static final int data = 16842798; // 0x101002e
+ field public static final int datePickerDialogTheme = 16843951; // 0x10104af
field public static final int datePickerStyle = 16843612; // 0x101035c
- field public static final int dateSelectorBackgroundColor = 16843928; // 0x1010498
- field public static final int dateSelectorDayOfMonthTextAppearance = 16843930; // 0x101049a
- field public static final int dateSelectorDayOfWeekBackgroundColor = 16843926; // 0x1010496
- field public static final int dateSelectorDayOfWeekTextAppearance = 16843927; // 0x1010497
- field public static final int dateSelectorMonthTextAppearance = 16843929; // 0x1010499
- field public static final int dateSelectorYearListItemTextAppearance = 16843932; // 0x101049c
- field public static final int dateSelectorYearListSelectedCircleColor = 16843933; // 0x101049d
- field public static final int dateSelectorYearTextAppearance = 16843931; // 0x101049b
field public static final int dateTextAppearance = 16843593; // 0x1010349
+ field public static final int dayOfWeekBackgroundColor = 16843926; // 0x1010496
+ field public static final int dayOfWeekTextAppearance = 16843927; // 0x1010497
field public static final int debuggable = 16842767; // 0x101000f
field public static final int defaultValue = 16843245; // 0x10101ed
field public static final int delay = 16843212; // 0x10101cc
@@ -658,12 +652,14 @@
field public static final int hapticFeedbackEnabled = 16843358; // 0x101025e
field public static final int hardwareAccelerated = 16843475; // 0x10102d3
field public static final int hasCode = 16842764; // 0x101000c
- field public static final int headerAmPmTextAppearance = 16843939; // 0x10104a3
+ field public static final int headerAmPmTextAppearance = 16843938; // 0x10104a2
field public static final int headerBackground = 16843055; // 0x101012f
- field public static final int headerBackgroundColor = 16843941; // 0x10104a5
+ field public static final int headerBackgroundColor = 16843939; // 0x10104a3
+ field public static final int headerDayOfMonthTextAppearance = 16843929; // 0x1010499
field public static final int headerDividersEnabled = 16843310; // 0x101022e
- field public static final int headerSelectedTextColor = 16843940; // 0x10104a4
- field public static final int headerTimeTextAppearance = 16843938; // 0x10104a2
+ field public static final int headerMonthTextAppearance = 16843928; // 0x1010498
+ field public static final int headerTimeTextAppearance = 16843937; // 0x10104a1
+ field public static final int headerYearTextAppearance = 16843930; // 0x101049a
field public static final int height = 16843093; // 0x1010155
field public static final int hideOnContentScroll = 16843845; // 0x1010445
field public static final int hint = 16843088; // 0x1010150
@@ -919,9 +915,9 @@
field public static final int notificationTimeout = 16843651; // 0x1010383
field public static final int numColumns = 16843032; // 0x1010118
field public static final int numStars = 16843076; // 0x1010144
- field public static final int numbersBackgroundColor = 16843943; // 0x10104a7
- field public static final int numbersSelectorColor = 16843944; // 0x10104a8
- field public static final int numbersTextColor = 16843942; // 0x10104a6
+ field public static final int numbersBackgroundColor = 16843941; // 0x10104a5
+ field public static final int numbersSelectorColor = 16843942; // 0x10104a6
+ field public static final int numbersTextColor = 16843940; // 0x10104a4
field public static final deprecated int numeric = 16843109; // 0x1010165
field public static final int numericShortcut = 16843236; // 0x10101e4
field public static final int onClick = 16843375; // 0x101026f
@@ -975,7 +971,7 @@
field public static final int popupKeyboard = 16843331; // 0x1010243
field public static final int popupLayout = 16843323; // 0x101023b
field public static final int popupMenuStyle = 16843520; // 0x1010300
- field public static final int popupTheme = 16843951; // 0x10104af
+ field public static final int popupTheme = 16843948; // 0x10104ac
field public static final int popupWindowStyle = 16842870; // 0x1010076
field public static final int port = 16842793; // 0x1010029
field public static final int positiveButtonText = 16843253; // 0x10101f5
@@ -1027,7 +1023,7 @@
field public static final int ratingBarStyleIndicator = 16843280; // 0x1010210
field public static final int ratingBarStyleSmall = 16842877; // 0x101007d
field public static final int readPermission = 16842759; // 0x1010007
- field public static final int recognitionService = 16843935; // 0x101049f
+ field public static final int recognitionService = 16843934; // 0x101049e
field public static final int relinquishTaskIdentity = 16843896; // 0x1010478
field public static final int repeatCount = 16843199; // 0x10101bf
field public static final int repeatMode = 16843200; // 0x10101c0
@@ -1314,8 +1310,8 @@
field public static final int tileMode = 16843265; // 0x1010201
field public static final int tileModeX = 16843897; // 0x1010479
field public static final int tileModeY = 16843898; // 0x101047a
- field public static final int timePickerDialogTheme = 16843937; // 0x10104a1
- field public static final int timePickerStyle = 16843936; // 0x10104a0
+ field public static final int timePickerDialogTheme = 16843936; // 0x10104a0
+ field public static final int timePickerStyle = 16843935; // 0x101049f
field public static final int timeZone = 16843724; // 0x10103cc
field public static final int tint = 16843041; // 0x1010121
field public static final int tintMode = 16843797; // 0x1010415
@@ -1331,7 +1327,7 @@
field public static final int toXScale = 16843203; // 0x10101c3
field public static final int toYDelta = 16843209; // 0x10101c9
field public static final int toYScale = 16843205; // 0x10101c5
- field public static final int toolbarStyle = 16843952; // 0x10104b0
+ field public static final int toolbarStyle = 16843949; // 0x10104ad
field public static final int top = 16843182; // 0x10101ae
field public static final int topBright = 16842955; // 0x10100cb
field public static final int topDark = 16842951; // 0x10100c7
@@ -1415,7 +1411,7 @@
field public static final int windowAllowExitTransitionOverlap = 16843837; // 0x101043d
field public static final int windowAnimationStyle = 16842926; // 0x10100ae
field public static final int windowBackground = 16842836; // 0x1010054
- field public static final int windowClipToOutline = 16843953; // 0x10104b1
+ field public static final int windowClipToOutline = 16843950; // 0x10104ae
field public static final int windowCloseOnTouchOutside = 16843611; // 0x101035b
field public static final int windowContentOverlay = 16842841; // 0x1010059
field public static final int windowContentTransitionManager = 16843795; // 0x1010413
@@ -1454,6 +1450,8 @@
field public static final int x = 16842924; // 0x10100ac
field public static final int xlargeScreens = 16843455; // 0x10102bf
field public static final int y = 16842925; // 0x10100ad
+ field public static final int yearListItemTextAppearance = 16843931; // 0x101049b
+ field public static final int yearListSelectorColor = 16843932; // 0x101049c
field public static final int yesNoPreferenceStyle = 16842896; // 0x1010090
field public static final int zAdjustment = 16843201; // 0x10101c1
}
@@ -28997,11 +28995,20 @@
field public static final int QUALITY_HIGH = 1; // 0x1
field public static final int QUALITY_LOW = 3; // 0x3
field public static final int QUALITY_MEDIUM = 2; // 0x2
- field public static final int VIDEO_STATE_AUDIO_ONLY = 0; // 0x0
- field public static final int VIDEO_STATE_BIDIRECTIONAL = 3; // 0x3
- field public static final int VIDEO_STATE_PAUSED = 4; // 0x4
- field public static final int VIDEO_STATE_RX_ENABLED = 2; // 0x2
- field public static final int VIDEO_STATE_TX_ENABLED = 1; // 0x1
+ }
+
+ public static class VideoCallProfile.VideoState {
+ ctor public VideoCallProfile.VideoState();
+ method public static boolean isAudioOnly(int);
+ method public static boolean isPaused(int);
+ method public static boolean isReceptionEnabled(int);
+ method public static boolean isBidirectional(int);
+ method public static boolean isTransmissionEnabled(int);
+ field public static final int AUDIO_ONLY = 0; // 0x0
+ field public static final int BIDIRECTIONAL = 3; // 0x3
+ field public static final int PAUSED = 4; // 0x4
+ field public static final int RX_ENABLED = 2; // 0x2
+ field public static final int TX_ENABLED = 1; // 0x1
}
}
@@ -38016,16 +38023,8 @@
ctor public DatePicker(android.content.Context, android.util.AttributeSet);
ctor public DatePicker(android.content.Context, android.util.AttributeSet, int);
ctor public DatePicker(android.content.Context, android.util.AttributeSet, int, int);
- method public android.content.res.ColorStateList getCalendarTextColor();
method public android.widget.CalendarView getCalendarView();
method public boolean getCalendarViewShown();
- method public int getDateSelectorBackgroundColor();
- method public int getDateSelectorDayOfMonthTextAppearance();
- method public int getDateSelectorDayOfWeekBackgroundColor();
- method public int getDateSelectorDayOfWeekTextAppearance();
- method public int getDateSelectorMonthTextAppearance();
- method public int getDateSelectorYearListItemTextAppearance();
- method public int getDateSelectorYearTextAppearance();
method public int getDayOfMonth();
method public long getMaxDate();
method public long getMinDate();
@@ -38033,15 +38032,7 @@
method public boolean getSpinnersShown();
method public int getYear();
method public void init(int, int, int, android.widget.DatePicker.OnDateChangedListener);
- method public void setCalendarTextColor(android.content.res.ColorStateList);
method public void setCalendarViewShown(boolean);
- method public void setDateSelectorBackgroundColor(int);
- method public void setDateSelectorDayOfMonthTextAppearance(int);
- method public void setDateSelectorDayOfWeekBackgroundColor(int);
- method public void setDateSelectorDayOfWeekTextAppearance(int);
- method public void setDateSelectorMonthTextAppearance(int);
- method public void setDateSelectorYearListItemTextAppearance(int);
- method public void setDateSelectorYearTextAppearance(int);
method public void setMaxDate(long);
method public void setMinDate(long);
method public void setSpinnersShown(boolean);
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java
index 394175a..fcfeddd 100644
--- a/core/java/android/app/Activity.java
+++ b/core/java/android/app/Activity.java
@@ -6077,9 +6077,9 @@
*
* If {@link DevicePolicyManager#isLockTaskPermitted(String)} returns false
* then the system will prompt the user with a dialog requesting permission to enter
- * this mode. When entered through this method the user can exit at any time by
- * swiping down twice from the top of the screen. Calling stopLockTask will also
- * exit the mode.
+ * this mode. When entered through this method the user can exit at any time through
+ * an action described by the request dialog. Calling stopLockTask will also exit the
+ * mode.
*/
public void startLockTask() {
try {
diff --git a/core/java/android/app/DatePickerDialog.java b/core/java/android/app/DatePickerDialog.java
index d7fb707..a78b137 100644
--- a/core/java/android/app/DatePickerDialog.java
+++ b/core/java/android/app/DatePickerDialog.java
@@ -112,15 +112,14 @@
Context themeContext = getContext();
- LayoutInflater inflater =
- (LayoutInflater) themeContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
- View view = inflater.inflate(R.layout.date_picker_dialog, null);
+ final LayoutInflater inflater = (LayoutInflater) themeContext.getSystemService(
+ Context.LAYOUT_INFLATER_SERVICE);
+ final View view = inflater.inflate(R.layout.date_picker_dialog, null);
setView(view);
setButtonPanelLayoutHint(LAYOUT_HINT_SIDE);
- mDatePicker = (DatePicker) view.findViewById(R.id.datePicker);
// Initialize state
- mDatePicker.setLegacyMode(false, null);
+ mDatePicker = (DatePicker) view.findViewById(R.id.datePicker);
mDatePicker.setShowDoneButton(true);
mDatePicker.setDismissCallback(new DatePicker.DatePickerDismissCallback() {
@Override
diff --git a/core/java/android/app/ExitTransitionCoordinator.java b/core/java/android/app/ExitTransitionCoordinator.java
index f4eb558..2ce6018 100644
--- a/core/java/android/app/ExitTransitionCoordinator.java
+++ b/core/java/android/app/ExitTransitionCoordinator.java
@@ -117,7 +117,7 @@
setTransitionAlpha(mTransitioningViews, 1);
setTransitionAlpha(mSharedElements, 1);
mIsHidden = true;
- if (getDecor() != null) {
+ if (!mIsReturning && getDecor() != null) {
getDecor().suppressLayout(false);
}
clearState();
@@ -357,7 +357,7 @@
mExitNotified = true;
mResultReceiver.send(MSG_EXIT_TRANSITION_COMPLETE, null);
mResultReceiver = null; // done talking
- if (getDecor() != null) {
+ if (!mIsReturning && getDecor() != null) {
getDecor().suppressLayout(false);
}
finishIfNecessary();
diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java
index b84eca2..0e6f86e 100644
--- a/core/java/android/app/admin/DevicePolicyManager.java
+++ b/core/java/android/app/admin/DevicePolicyManager.java
@@ -2328,7 +2328,7 @@
}
/**
- * Sets a list of features to enable for a TrustAgentService component. This is meant to be
+ * Sets a list of features to enable for a TrustAgent component. This is meant to be
* used in conjunction with {@link #KEYGUARD_DISABLE_TRUST_AGENTS}, which will disable all
* trust agents but those with features enabled by this function call.
*
@@ -2353,7 +2353,7 @@
}
/**
- * Gets list of enabled features for the given {@link TrustAgentService} agent. If admin is
+ * Gets list of enabled features for the given TrustAgent component. If admin is
* null, this will return the intersection of all features enabled for the given agent by all
* admins.
*
diff --git a/core/java/android/app/job/JobInfo.java b/core/java/android/app/job/JobInfo.java
index 70f6966..936e205 100644
--- a/core/java/android/app/job/JobInfo.java
+++ b/core/java/android/app/job/JobInfo.java
@@ -266,6 +266,11 @@
}
};
+ @Override
+ public String toString() {
+ return "(job:" + jobId + "/" + service.flattenToShortString() + ")";
+ }
+
/** Builder class for constructing {@link JobInfo} objects. */
public static final class Builder {
private int mJobId;
diff --git a/core/java/android/bluetooth/le/BluetoothLeAdvertiser.java b/core/java/android/bluetooth/le/BluetoothLeAdvertiser.java
index 93d4349..4d128e7 100644
--- a/core/java/android/bluetooth/le/BluetoothLeAdvertiser.java
+++ b/core/java/android/bluetooth/le/BluetoothLeAdvertiser.java
@@ -107,6 +107,7 @@
public void startAdvertising(AdvertiseSettings settings,
AdvertiseData advertiseData, AdvertiseData scanResponse,
final AdvertiseCallback callback) {
+ checkAdapterState();
if (callback == null) {
throw new IllegalArgumentException("callback cannot be null");
}
@@ -153,13 +154,13 @@
* @param callback {@link AdvertiseCallback} identifies the advertising instance to stop.
*/
public void stopAdvertising(final AdvertiseCallback callback) {
+ checkAdapterState();
if (callback == null) {
throw new IllegalArgumentException("callback cannot be null");
}
AdvertiseCallbackWrapper wrapper = mLeAdvertisers.get(callback);
if (wrapper == null)
return;
-
try {
IBluetoothGatt gatt = mBluetoothManager.getBluetoothGatt();
if (gatt != null)
@@ -459,6 +460,13 @@
}
}
+ //TODO: move this api to a common util class.
+ private void checkAdapterState() {
+ if (mBluetoothAdapter.getState() != mBluetoothAdapter.STATE_ON) {
+ throw new IllegalStateException("BT Adapter is not turned ON");
+ }
+ }
+
private void postCallbackFailure(final AdvertiseCallback callback, final int error) {
mHandler.post(new Runnable() {
@Override
diff --git a/core/java/android/bluetooth/le/BluetoothLeScanner.java b/core/java/android/bluetooth/le/BluetoothLeScanner.java
index 8e7d400..f100ddc 100644
--- a/core/java/android/bluetooth/le/BluetoothLeScanner.java
+++ b/core/java/android/bluetooth/le/BluetoothLeScanner.java
@@ -80,6 +80,7 @@
* @throws IllegalArgumentException If {@code callback} is null.
*/
public void startScan(final ScanCallback callback) {
+ checkAdapterState();
if (callback == null) {
throw new IllegalArgumentException("callback is null");
}
@@ -98,6 +99,7 @@
*/
public void startScan(List<ScanFilter> filters, ScanSettings settings,
final ScanCallback callback) {
+ checkAdapterState();
if (settings == null || callback == null) {
throw new IllegalArgumentException("settings or callback is null");
}
@@ -148,6 +150,7 @@
* @param callback
*/
public void stopScan(ScanCallback callback) {
+ checkAdapterState();
synchronized (mLeScanClients) {
BleScanCallbackWrapper wrapper = mLeScanClients.remove(callback);
if (wrapper == null) {
@@ -167,6 +170,7 @@
* used to start scan.
*/
public void flushPendingScanResults(ScanCallback callback) {
+ checkAdapterState();
if (callback == null) {
throw new IllegalArgumentException("callback cannot be null!");
}
@@ -445,6 +449,13 @@
}
}
+ //TODO: move this api to a common util class.
+ private void checkAdapterState() {
+ if (mBluetoothAdapter.getState() != mBluetoothAdapter.STATE_ON) {
+ throw new IllegalStateException("BT Adapter is not turned ON");
+ }
+ }
+
private void postCallbackError(final ScanCallback callback, final int errorCode) {
mHandler.post(new Runnable() {
@Override
diff --git a/core/java/android/content/res/ColorStateList.java b/core/java/android/content/res/ColorStateList.java
index 3f01dd2..900b41d 100644
--- a/core/java/android/content/res/ColorStateList.java
+++ b/core/java/android/content/res/ColorStateList.java
@@ -331,6 +331,46 @@
return mColors;
}
+ /**
+ * If the color state list does not already have an entry matching the
+ * specified state, prepends a state set and color pair to a color state
+ * list.
+ * <p>
+ * This is a workaround used in TimePicker and DatePicker until we can
+ * add support for theme attributes in ColorStateList.
+ *
+ * @param colorStateList the source color state list
+ * @param state the state to prepend
+ * @param color the color to use for the given state
+ * @return a new color state list, or the source color state list if there
+ * was already a matching state set
+ *
+ * @hide Remove when we can support theme attributes.
+ */
+ public static ColorStateList addFirstIfMissing(
+ ColorStateList colorStateList, int state, int color) {
+ final int[][] inputStates = colorStateList.getStates();
+ for (int i = 0; i < inputStates.length; i++) {
+ final int[] inputState = inputStates[i];
+ for (int j = 0; j < inputState.length; j++) {
+ if (inputState[i] == state) {
+ return colorStateList;
+ }
+ }
+ }
+
+ final int[][] outputStates = new int[inputStates.length + 1][];
+ System.arraycopy(inputStates, 0, outputStates, 1, inputStates.length);
+ outputStates[0] = new int[] { state };
+
+ final int[] inputColors = colorStateList.getColors();
+ final int[] outputColors = new int[inputColors.length + 1];
+ System.arraycopy(inputColors, 0, outputColors, 1, inputColors.length);
+ outputColors[0] = color;
+
+ return new ColorStateList(outputStates, outputColors);
+ }
+
@Override
public String toString() {
return "ColorStateList{" +
diff --git a/core/java/android/content/res/TypedArray.java b/core/java/android/content/res/TypedArray.java
index 645f7df..8607bbc 100644
--- a/core/java/android/content/res/TypedArray.java
+++ b/core/java/android/content/res/TypedArray.java
@@ -400,6 +400,8 @@
return csl.getDefaultColor();
}
return defValue;
+ } else if (type == TypedValue.TYPE_ATTRIBUTE) {
+ throw new RuntimeException("Failed to resolve attribute at index " + index);
}
throw new UnsupportedOperationException("Can't convert to color: type=0x"
@@ -422,6 +424,9 @@
final TypedValue value = mValue;
if (getValueAt(index*AssetManager.STYLE_NUM_ENTRIES, value)) {
+ if (value.type == TypedValue.TYPE_ATTRIBUTE) {
+ throw new RuntimeException("Failed to resolve attribute at index " + index);
+ }
return mResources.loadColorStateList(value, value.resourceId);
}
return null;
@@ -449,6 +454,8 @@
} else if (type >= TypedValue.TYPE_FIRST_INT
&& type <= TypedValue.TYPE_LAST_INT) {
return data[index+AssetManager.STYLE_DATA];
+ } else if (type == TypedValue.TYPE_ATTRIBUTE) {
+ throw new RuntimeException("Failed to resolve attribute at index " + index);
}
throw new UnsupportedOperationException("Can't convert to integer: type=0x"
@@ -484,6 +491,8 @@
} else if (type == TypedValue.TYPE_DIMENSION) {
return TypedValue.complexToDimension(
data[index+AssetManager.STYLE_DATA], mMetrics);
+ } else if (type == TypedValue.TYPE_ATTRIBUTE) {
+ throw new RuntimeException("Failed to resolve attribute at index " + index);
}
throw new UnsupportedOperationException("Can't convert to dimension: type=0x"
@@ -520,6 +529,8 @@
} else if (type == TypedValue.TYPE_DIMENSION) {
return TypedValue.complexToDimensionPixelOffset(
data[index+AssetManager.STYLE_DATA], mMetrics);
+ } else if (type == TypedValue.TYPE_ATTRIBUTE) {
+ throw new RuntimeException("Failed to resolve attribute at index " + index);
}
throw new UnsupportedOperationException("Can't convert to dimension: type=0x"
@@ -557,6 +568,8 @@
} else if (type == TypedValue.TYPE_DIMENSION) {
return TypedValue.complexToDimensionPixelSize(
data[index+AssetManager.STYLE_DATA], mMetrics);
+ } else if (type == TypedValue.TYPE_ATTRIBUTE) {
+ throw new RuntimeException("Failed to resolve attribute at index " + index);
}
throw new UnsupportedOperationException("Can't convert to dimension: type=0x"
@@ -589,6 +602,8 @@
} else if (type == TypedValue.TYPE_DIMENSION) {
return TypedValue.complexToDimensionPixelSize(
data[index+AssetManager.STYLE_DATA], mMetrics);
+ } else if (type == TypedValue.TYPE_ATTRIBUTE) {
+ throw new RuntimeException("Failed to resolve attribute at index " + index);
}
throw new RuntimeException(getPositionDescription()
@@ -655,6 +670,8 @@
} else if (type == TypedValue.TYPE_FRACTION) {
return TypedValue.complexToFraction(
data[index+AssetManager.STYLE_DATA], base, pbase);
+ } else if (type == TypedValue.TYPE_ATTRIBUTE) {
+ throw new RuntimeException("Failed to resolve attribute at index " + index);
}
throw new UnsupportedOperationException("Can't convert to fraction: type=0x"
@@ -731,14 +748,8 @@
final TypedValue value = mValue;
if (getValueAt(index*AssetManager.STYLE_NUM_ENTRIES, value)) {
- if (false) {
- System.out.println("******************************************************************");
- System.out.println("Got drawable resource: type="
- + value.type
- + " str=" + value.string
- + " int=0x" + Integer.toHexString(value.data)
- + " cookie=" + value.assetCookie);
- System.out.println("******************************************************************");
+ if (value.type == TypedValue.TYPE_ATTRIBUTE) {
+ throw new RuntimeException("Failed to resolve attribute at index " + index);
}
return mResources.loadDrawable(value, value.resourceId, mTheme);
}
@@ -762,15 +773,6 @@
final TypedValue value = mValue;
if (getValueAt(index*AssetManager.STYLE_NUM_ENTRIES, value)) {
- if (false) {
- System.out.println("******************************************************************");
- System.out.println("Got drawable resource: type="
- + value.type
- + " str=" + value.string
- + " int=0x" + Integer.toHexString(value.data)
- + " cookie=" + value.assetCookie);
- System.out.println("******************************************************************");
- }
return mResources.getTextArray(value.resourceId);
}
return null;
diff --git a/core/java/android/hardware/display/DisplayManager.java b/core/java/android/hardware/display/DisplayManager.java
index 5397d49..d4e6df5 100644
--- a/core/java/android/hardware/display/DisplayManager.java
+++ b/core/java/android/hardware/display/DisplayManager.java
@@ -198,10 +198,14 @@
* VIRTUAL_DISPLAY_FLAG_PRIVATE. Other flags are not allowed (especially
* not VIRTUAL_DISPLAY_FLAG_PUBLIC or PRESENTATION).
*
+ * <p>
* Requires screen share permission for use.
+ * </p>
*
+ * <p>
* While a display of this type exists, the system will show some sort of
* notification to the user indicating that the screen is being shared.
+ * </p>
*
* @see #createVirtualDisplay
*/
diff --git a/core/java/android/hardware/soundtrigger/IRecognitionStatusCallback.aidl b/core/java/android/hardware/soundtrigger/IRecognitionStatusCallback.aidl
index 0bf4f25..b1a02c1 100644
--- a/core/java/android/hardware/soundtrigger/IRecognitionStatusCallback.aidl
+++ b/core/java/android/hardware/soundtrigger/IRecognitionStatusCallback.aidl
@@ -26,10 +26,8 @@
* Called when the keyphrase is spoken.
*
* @param data Optional trigger audio data, if it was requested and is available.
- * TODO: See if the data being passed in works well, if not use shared memory.
- * This *MUST* not exceed 100K.
*/
- void onDetected(in SoundTrigger.RecognitionEvent recognitionEvent);
+ void onDetected(in SoundTrigger.KeyphraseRecognitionEvent recognitionEvent);
/**
* Called when the detection for the associated keyphrase stops.
*/
diff --git a/core/java/android/hardware/soundtrigger/SoundTrigger.aidl b/core/java/android/hardware/soundtrigger/SoundTrigger.aidl
index 9adc6bc..e16ea71 100644
--- a/core/java/android/hardware/soundtrigger/SoundTrigger.aidl
+++ b/core/java/android/hardware/soundtrigger/SoundTrigger.aidl
@@ -18,8 +18,8 @@
parcelable SoundTrigger.ConfidenceLevel;
parcelable SoundTrigger.Keyphrase;
+parcelable SoundTrigger.KeyphraseRecognitionEvent;
parcelable SoundTrigger.KeyphraseRecognitionExtra;
parcelable SoundTrigger.KeyphraseSoundModel;
parcelable SoundTrigger.ModuleProperties;
parcelable SoundTrigger.RecognitionConfig;
-parcelable SoundTrigger.RecognitionEvent;
\ No newline at end of file
diff --git a/core/java/android/hardware/soundtrigger/SoundTrigger.java b/core/java/android/hardware/soundtrigger/SoundTrigger.java
index 3e84368..4498789 100644
--- a/core/java/android/hardware/soundtrigger/SoundTrigger.java
+++ b/core/java/android/hardware/soundtrigger/SoundTrigger.java
@@ -361,13 +361,13 @@
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(uuid.toString());
dest.writeBlob(data);
- dest.writeTypedArray(keyphrases, 0);
+ dest.writeTypedArray(keyphrases, flags);
}
@Override
public String toString() {
return "KeyphraseSoundModel [keyphrases=" + Arrays.toString(keyphrases) + ", uuid="
- + uuid + ", type=" + type + ", data? " + (data != null) + "]";
+ + uuid + ", type=" + type + ", data=" + (data == null ? 0 : data.length) + "]";
}
}
@@ -504,6 +504,15 @@
return false;
return true;
}
+
+ @Override
+ public String toString() {
+ return "RecognitionEvent [status=" + status + ", soundModelHandle=" + soundModelHandle
+ + ", captureAvailable=" + captureAvailable + ", captureSession="
+ + captureSession + ", captureDelayMs=" + captureDelayMs
+ + ", capturePreambleMs=" + capturePreambleMs
+ + ", data=" + (data == null ? 0 : data.length) + "]";
+ }
}
/**
@@ -551,7 +560,7 @@
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeByte((byte) (captureRequested ? 1 : 0));
- dest.writeTypedArray(keyphrases, 0);
+ dest.writeTypedArray(keyphrases, flags);
dest.writeBlob(data);
}
@@ -563,7 +572,8 @@
@Override
public String toString() {
return "RecognitionConfig [captureRequested=" + captureRequested + ", keyphrases="
- + Arrays.toString(keyphrases) + ", data? " + (data != null) + "]";
+ + Arrays.toString(keyphrases)
+ + ", data=" + (data == null ? 0 : data.length) + "]";
}
}
@@ -611,6 +621,37 @@
public int describeContents() {
return 0;
}
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + confidenceLevel;
+ result = prime * result + userId;
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ ConfidenceLevel other = (ConfidenceLevel) obj;
+ if (confidenceLevel != other.confidenceLevel)
+ return false;
+ if (userId != other.userId)
+ return false;
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "ConfidenceLevel [userId=" + userId
+ + ", confidenceLevel=" + confidenceLevel + "]";
+ }
}
/**
@@ -657,13 +698,47 @@
public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(id);
dest.writeInt(recognitionModes);
- dest.writeTypedArray(confidenceLevels, 0);
+ dest.writeTypedArray(confidenceLevels, flags);
}
@Override
public int describeContents() {
return 0;
}
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + Arrays.hashCode(confidenceLevels);
+ result = prime * result + id;
+ result = prime * result + recognitionModes;
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ KeyphraseRecognitionExtra other = (KeyphraseRecognitionExtra) obj;
+ if (!Arrays.equals(confidenceLevels, other.confidenceLevels))
+ return false;
+ if (id != other.id)
+ return false;
+ if (recognitionModes != other.recognitionModes)
+ return false;
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "KeyphraseRecognitionExtra [id=" + id + ", recognitionModes=" + recognitionModes
+ + ", confidenceLevels=" + Arrays.toString(confidenceLevels) + "]";
+ }
}
/**
@@ -676,7 +751,7 @@
/** Additional data available for each recognized key phrases in the model */
public final boolean keyphraseInCapture;
- KeyphraseRecognitionEvent(int status, int soundModelHandle, boolean captureAvailable,
+ public KeyphraseRecognitionEvent(int status, int soundModelHandle, boolean captureAvailable,
int captureSession, int captureDelayMs, int capturePreambleMs, byte[] data,
boolean keyphraseInCapture, KeyphraseRecognitionExtra[] keyphraseExtras) {
super(status, soundModelHandle, captureAvailable, captureSession, captureDelayMs,
@@ -684,6 +759,86 @@
this.keyphraseInCapture = keyphraseInCapture;
this.keyphraseExtras = keyphraseExtras;
}
+
+ public static final Parcelable.Creator<KeyphraseRecognitionEvent> CREATOR
+ = new Parcelable.Creator<KeyphraseRecognitionEvent>() {
+ public KeyphraseRecognitionEvent createFromParcel(Parcel in) {
+ return KeyphraseRecognitionEvent.fromParcel(in);
+ }
+
+ public KeyphraseRecognitionEvent[] newArray(int size) {
+ return new KeyphraseRecognitionEvent[size];
+ }
+ };
+
+ private static KeyphraseRecognitionEvent fromParcel(Parcel in) {
+ int status = in.readInt();
+ int soundModelHandle = in.readInt();
+ boolean captureAvailable = in.readByte() == 1;
+ int captureSession = in.readInt();
+ int captureDelayMs = in.readInt();
+ int capturePreambleMs = in.readInt();
+ byte[] data = in.readBlob();
+ boolean keyphraseInCapture = in.readByte() == 1;
+ KeyphraseRecognitionExtra[] keyphraseExtras =
+ in.createTypedArray(KeyphraseRecognitionExtra.CREATOR);
+ return new KeyphraseRecognitionEvent(status, soundModelHandle, captureAvailable,
+ captureSession, captureDelayMs, capturePreambleMs, data, keyphraseInCapture,
+ keyphraseExtras);
+ }
+
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+ dest.writeInt(status);
+ dest.writeInt(soundModelHandle);
+ dest.writeByte((byte) (captureAvailable ? 1 : 0));
+ dest.writeInt(captureSession);
+ dest.writeInt(captureDelayMs);
+ dest.writeInt(capturePreambleMs);
+ dest.writeBlob(data);
+ dest.writeByte((byte) (keyphraseInCapture ? 1 : 0));
+ dest.writeTypedArray(keyphraseExtras, flags);
+ }
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + Arrays.hashCode(keyphraseExtras);
+ result = prime * result + (keyphraseInCapture ? 1231 : 1237);
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (!super.equals(obj))
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ KeyphraseRecognitionEvent other = (KeyphraseRecognitionEvent) obj;
+ if (!Arrays.equals(keyphraseExtras, other.keyphraseExtras))
+ return false;
+ if (keyphraseInCapture != other.keyphraseInCapture)
+ return false;
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "KeyphraseRecognitionEvent [keyphraseExtras=" + Arrays.toString(keyphraseExtras)
+ + ", keyphraseInCapture=" + keyphraseInCapture + ", status=" + status
+ + ", soundModelHandle=" + soundModelHandle + ", captureAvailable="
+ + captureAvailable + ", captureSession=" + captureSession + ", captureDelayMs="
+ + captureDelayMs + ", capturePreambleMs=" + capturePreambleMs
+ + ", data=" + (data == null ? 0 : data.length) + "]";
+ }
}
/**
diff --git a/core/java/android/service/voice/AlwaysOnHotwordDetector.java b/core/java/android/service/voice/AlwaysOnHotwordDetector.java
index a8c08d55..e40ece3 100644
--- a/core/java/android/service/voice/AlwaysOnHotwordDetector.java
+++ b/core/java/android/service/voice/AlwaysOnHotwordDetector.java
@@ -23,6 +23,7 @@
import android.hardware.soundtrigger.SoundTrigger;
import android.hardware.soundtrigger.SoundTrigger.ConfidenceLevel;
import android.hardware.soundtrigger.SoundTrigger.Keyphrase;
+import android.hardware.soundtrigger.SoundTrigger.KeyphraseRecognitionEvent;
import android.hardware.soundtrigger.SoundTrigger.KeyphraseRecognitionExtra;
import android.hardware.soundtrigger.SoundTrigger.KeyphraseSoundModel;
import android.hardware.soundtrigger.SoundTrigger.ModuleProperties;
@@ -133,11 +134,6 @@
private final Object mLock = new Object();
private final Handler mHandler;
- /**
- * Indicates if there is a sound model enrolled for the keyphrase,
- * derived from the model management service (IVoiceInteractionManagerService).
- */
- private boolean mIsEnrolledForDetection;
private int mAvailability = STATE_NOT_READY;
/**
@@ -381,10 +377,10 @@
}
@Override
- public void onDetected(RecognitionEvent recognitionEvent) {
+ public void onDetected(KeyphraseRecognitionEvent event) {
Slog.i(TAG, "onDetected");
Message message = Message.obtain(mHandler, MSG_HOTWORD_DETECTED);
- message.obj = recognitionEvent.data;
+ message.obj = event.data;
message.sendToTarget();
}
@@ -436,7 +432,6 @@
Slog.d(TAG, "Hotword availability changed from " + mAvailability
+ " -> " + availability);
}
- mIsEnrolledForDetection = enrolled;
mAvailability = availability;
notifyStateChangedLocked();
}
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 81b5c20..16a161b 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -2904,7 +2904,7 @@
@ViewDebug.FlagToString(mask = PFLAG_DRAWN, equals = PFLAG_DRAWN, name = "NOT_DRAWN", outputIf = false),
@ViewDebug.FlagToString(mask = PFLAG_DIRTY_MASK, equals = PFLAG_DIRTY_OPAQUE, name = "DIRTY_OPAQUE"),
@ViewDebug.FlagToString(mask = PFLAG_DIRTY_MASK, equals = PFLAG_DIRTY, name = "DIRTY")
- })
+ }, formatToHexString = true)
int mPrivateFlags;
int mPrivateFlags2;
int mPrivateFlags3;
@@ -2923,7 +2923,7 @@
@ViewDebug.FlagToString(mask = PUBLIC_STATUS_BAR_VISIBILITY_MASK,
equals = SYSTEM_UI_FLAG_VISIBLE,
name = "SYSTEM_UI_FLAG_VISIBLE", outputIf = true)
- })
+ }, formatToHexString = true)
int mSystemUiVisibility;
/**
@@ -2949,7 +2949,7 @@
* The view flags hold various views states.
* {@hide}
*/
- @ViewDebug.ExportedProperty
+ @ViewDebug.ExportedProperty(formatToHexString = true)
int mViewFlags;
static class TransformationInfo {
@@ -16458,6 +16458,19 @@
}
/**
+ * @hide
+ */
+ @ViewDebug.ExportedProperty(category = "layout", indexMapping = {
+ @ViewDebug.IntToString(from = 0, to = "x"),
+ @ViewDebug.IntToString(from = 1, to = "y")
+ })
+ public int[] getLocationOnScreen() {
+ int[] location = new int[2];
+ getLocationOnScreen(location);
+ return location;
+ }
+
+ /**
* <p>Computes the coordinates of this view on the screen. The argument
* must be an array of two integers. After the method returns, the array
* contains the x and y location in that order.</p>
diff --git a/core/java/android/view/ViewDebug.java b/core/java/android/view/ViewDebug.java
index 92e5e96..0b15ba7 100644
--- a/core/java/android/view/ViewDebug.java
+++ b/core/java/android/view/ViewDebug.java
@@ -180,6 +180,13 @@
* @return the category as String
*/
String category() default "";
+
+ /**
+ * Indicates whether or not to format an {@code int} or {@code byte} value as a hex string.
+ *
+ * @return true if the supported values should be formatted as a hex string.
+ */
+ boolean formatToHexString() default false;
}
/**
@@ -507,76 +514,76 @@
long durationMeasure =
(root || (view.mPrivateFlags & View.PFLAG_MEASURED_DIMENSION_SET) != 0)
- ? profileViewOperation(view, new ViewOperation<Void>() {
- public Void[] pre() {
- forceLayout(view);
- return null;
- }
+ ? profileViewOperation(view, new ViewOperation<Void>() {
+ public Void[] pre() {
+ forceLayout(view);
+ return null;
+ }
- private void forceLayout(View view) {
- view.forceLayout();
- if (view instanceof ViewGroup) {
- ViewGroup group = (ViewGroup) view;
- final int count = group.getChildCount();
- for (int i = 0; i < count; i++) {
- forceLayout(group.getChildAt(i));
- }
- }
+ private void forceLayout(View view) {
+ view.forceLayout();
+ if (view instanceof ViewGroup) {
+ ViewGroup group = (ViewGroup) view;
+ final int count = group.getChildCount();
+ for (int i = 0; i < count; i++) {
+ forceLayout(group.getChildAt(i));
}
+ }
+ }
- public void run(Void... data) {
- view.measure(view.mOldWidthMeasureSpec, view.mOldHeightMeasureSpec);
- }
+ public void run(Void... data) {
+ view.measure(view.mOldWidthMeasureSpec, view.mOldHeightMeasureSpec);
+ }
- public void post(Void... data) {
- }
- })
+ public void post(Void... data) {
+ }
+ })
: 0;
long durationLayout =
(root || (view.mPrivateFlags & View.PFLAG_LAYOUT_REQUIRED) != 0)
- ? profileViewOperation(view, new ViewOperation<Void>() {
- public Void[] pre() {
- return null;
- }
+ ? profileViewOperation(view, new ViewOperation<Void>() {
+ public Void[] pre() {
+ return null;
+ }
- public void run(Void... data) {
- view.layout(view.mLeft, view.mTop, view.mRight, view.mBottom);
- }
+ public void run(Void... data) {
+ view.layout(view.mLeft, view.mTop, view.mRight, view.mBottom);
+ }
- public void post(Void... data) {
- }
- }) : 0;
+ public void post(Void... data) {
+ }
+ }) : 0;
long durationDraw =
(root || !view.willNotDraw() || (view.mPrivateFlags & View.PFLAG_DRAWN) != 0)
- ? profileViewOperation(view, new ViewOperation<Object>() {
- public Object[] pre() {
- final DisplayMetrics metrics =
- (view != null && view.getResources() != null) ?
- view.getResources().getDisplayMetrics() : null;
- final Bitmap bitmap = metrics != null ?
- Bitmap.createBitmap(metrics, metrics.widthPixels,
- metrics.heightPixels, Bitmap.Config.RGB_565) : null;
- final Canvas canvas = bitmap != null ? new Canvas(bitmap) : null;
- return new Object[] {
- bitmap, canvas
- };
- }
+ ? profileViewOperation(view, new ViewOperation<Object>() {
+ public Object[] pre() {
+ final DisplayMetrics metrics =
+ (view != null && view.getResources() != null) ?
+ view.getResources().getDisplayMetrics() : null;
+ final Bitmap bitmap = metrics != null ?
+ Bitmap.createBitmap(metrics, metrics.widthPixels,
+ metrics.heightPixels, Bitmap.Config.RGB_565) : null;
+ final Canvas canvas = bitmap != null ? new Canvas(bitmap) : null;
+ return new Object[] {
+ bitmap, canvas
+ };
+ }
- public void run(Object... data) {
- if (data[1] != null) {
- view.draw((Canvas) data[1]);
- }
- }
+ public void run(Object... data) {
+ if (data[1] != null) {
+ view.draw((Canvas) data[1]);
+ }
+ }
- public void post(Object... data) {
- if (data[1] != null) {
- ((Canvas) data[1]).setBitmap(null);
- }
- if (data[0] != null) {
- ((Bitmap) data[0]).recycle();
- }
- }
- }) : 0;
+ public void post(Object... data) {
+ if (data[1] != null) {
+ ((Canvas) data[1]).setBitmap(null);
+ }
+ if (data[0] != null) {
+ ((Bitmap) data[0]).recycle();
+ }
+ }
+ }) : 0;
out.write(String.valueOf(durationMeasure));
out.write(' ');
out.write(String.valueOf(durationLayout));
@@ -643,12 +650,12 @@
} catch (RemoteException e) {
// Ignore
}
-
+
clientStream.writeInt(outRect.width());
clientStream.writeInt(outRect.height());
-
+
captureViewLayer(root, clientStream, true);
-
+
clientStream.write(2);
} finally {
clientStream.close();
@@ -666,19 +673,19 @@
if (id != View.NO_ID) {
name = resolveId(view.getContext(), id).toString();
}
-
+
clientStream.write(1);
clientStream.writeUTF(name);
clientStream.writeByte(localVisible ? 1 : 0);
-
+
int[] position = new int[2];
// XXX: Should happen on the UI thread
view.getLocationInWindow(position);
-
+
clientStream.writeInt(position[0]);
clientStream.writeInt(position[1]);
clientStream.flush();
-
+
Bitmap b = performViewCapture(view, true);
if (b != null) {
ByteArrayOutputStream arrayOut = new ByteArrayOutputStream(b.getWidth() *
@@ -774,7 +781,7 @@
Thread.currentThread().interrupt();
}
}
-
+
return null;
}
@@ -1008,10 +1015,10 @@
final View view = (View) object;
Callable<Object> callable = new Callable<Object>() {
- @Override
- public Object call() throws IllegalAccessException, InvocationTargetException {
- return method.invoke(view, (Object[]) null);
- }
+ @Override
+ public Object call() throws IllegalAccessException, InvocationTargetException {
+ return method.invoke(view, (Object[]) null);
+ }
};
FutureTask<Object> future = new FutureTask<Object>(callable);
// Try to use the handler provided by the view
@@ -1041,6 +1048,10 @@
}
}
+ private static String formatIntToHexString(int value) {
+ return "0x" + Integer.toHexString(value).toUpperCase();
+ }
+
private static void exportMethods(Context context, Object view, BufferedWriter out,
Class<?> klass, String prefix) throws IOException {
@@ -1058,7 +1069,6 @@
property.category().length() != 0 ? property.category() + ":" : "";
if (returnType == int.class) {
-
if (property.resolveId() && context != null) {
final int id = (Integer) methodValue;
methodValue = resolveId(context, id);
@@ -1160,6 +1170,15 @@
fieldValue = intValue;
}
}
+
+ if (property.formatToHexString()) {
+ fieldValue = field.get(view);
+ if (type == int.class) {
+ fieldValue = formatIntToHexString((Integer) fieldValue);
+ } else if (type == byte.class) {
+ fieldValue = "0x" + Byte.toHexString((Byte) fieldValue, true);
+ }
+ }
}
} else if (type == int[].class) {
final int[] array = (int[]) field.get(view);
@@ -1210,7 +1229,7 @@
final boolean test = maskResult == flagMapping.equals();
if ((test && ifTrue) || (!test && !ifTrue)) {
final String name = flagMapping.name();
- final String value = "0x" + Integer.toHexString(maskResult);
+ final String value = formatIntToHexString(maskResult);
writeEntry(out, prefix, name, "", value);
}
}
@@ -1276,7 +1295,7 @@
fieldValue = resources.getResourceTypeName(id) + '/' +
resources.getResourceEntryName(id);
} catch (Resources.NotFoundException e) {
- fieldValue = "id/0x" + Integer.toHexString(id);
+ fieldValue = "id/" + formatIntToHexString(id);
}
} else {
fieldValue = "NO_ID";
@@ -1393,13 +1412,13 @@
}
sb.append("; ");
}
- } catch (IllegalAccessException e) {
- //Exception IllegalAccess, it is OK here
- //we simply ignore this method
- } catch (InvocationTargetException e) {
- //Exception InvocationTarget, it is OK here
- //we simply ignore this method
- }
+ } catch (IllegalAccessException e) {
+ //Exception IllegalAccess, it is OK here
+ //we simply ignore this method
+ } catch (InvocationTargetException e) {
+ //Exception InvocationTarget, it is OK here
+ //we simply ignore this method
+ }
}
return sb.toString();
}
@@ -1503,7 +1522,7 @@
final Field f = p.getClass().getField(param);
if (f.getType() != int.class) {
throw new RuntimeException("Only integer layout parameters can be set. Field "
- + param + " is of type " + f.getType().getSimpleName());
+ + param + " is of type " + f.getType().getSimpleName());
}
f.set(p, Integer.valueOf(value));
@@ -1515,4 +1534,4 @@
}
});
}
-}
+}
\ No newline at end of file
diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java
index 27f493a..c09440b 100644
--- a/core/java/android/view/ViewGroup.java
+++ b/core/java/android/view/ViewGroup.java
@@ -203,7 +203,7 @@
name = "CLIP_TO_PADDING"),
@ViewDebug.FlagToString(mask = FLAG_PADDING_NOT_NULL, equals = FLAG_PADDING_NOT_NULL,
name = "PADDING_NOT_NULL")
- })
+ }, formatToHexString = true)
protected int mGroupFlags;
/**
@@ -6430,7 +6430,7 @@
equals = RTL_COMPATIBILITY_MODE_MASK, name = "RTL_COMPATIBILITY_MODE_MASK"),
@ViewDebug.FlagToString(mask = NEED_RESOLUTION_MASK,
equals = NEED_RESOLUTION_MASK, name = "NEED_RESOLUTION_MASK")
- })
+ }, formatToHexString = true)
byte mMarginFlags;
private static final int LAYOUT_DIRECTION_MASK = 0x00000003;
diff --git a/core/java/android/view/WindowManager.java b/core/java/android/view/WindowManager.java
index 597d2dd..46b9e03 100644
--- a/core/java/android/view/WindowManager.java
+++ b/core/java/android/view/WindowManager.java
@@ -1020,7 +1020,7 @@
name = "FLAG_TRANSLUCENT_NAVIGATION"),
@ViewDebug.FlagToString(mask = FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS, equals = FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS,
name = "FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS")
- })
+ }, formatToHexString = true)
public int flags;
/**
diff --git a/core/java/android/widget/DatePicker.java b/core/java/android/widget/DatePicker.java
index 8f49fb8..74c66c8 100644
--- a/core/java/android/widget/DatePicker.java
+++ b/core/java/android/widget/DatePicker.java
@@ -17,9 +17,7 @@
package android.widget;
import android.annotation.Widget;
-import android.app.UiModeManager;
import android.content.Context;
-import android.content.res.ColorStateList;
import android.content.res.Configuration;
import android.content.res.TypedArray;
import android.os.Parcel;
@@ -51,8 +49,6 @@
import libcore.icu.ICU;
-import static android.os.Build.VERSION_CODES.L;
-
/**
* This class is a widget for selecting a date. The date can be selected by a
* year, month, and day spinners or a {@link CalendarView}. The set of spinners
@@ -74,26 +70,21 @@
* @attr ref android.R.styleable#DatePicker_minDate
* @attr ref android.R.styleable#DatePicker_spinnersShown
* @attr ref android.R.styleable#DatePicker_calendarViewShown
- * @attr ref android.R.styleable#DatePicker_dateSelectorDayOfWeekBackgroundColor
- * @attr ref android.R.styleable#DatePicker_dateSelectorDayOfWeekTextAppearance
- * @attr ref android.R.styleable#DatePicker_dateSelectorBackgroundColor
- * @attr ref android.R.styleable#DatePicker_dateSelectorMonthTextAppearance
- * @attr ref android.R.styleable#DatePicker_dateSelectorDayOfMonthTextAppearance
- * @attr ref android.R.styleable#DatePicker_dateSelectorYearTextAppearance
- * @attr ref android.R.styleable#DatePicker_dateSelectorYearListItemTextAppearance
- * @attr ref android.R.styleable#DatePicker_dateSelectorYearListSelectedCircleColor
+ * @attr ref android.R.styleable#DatePicker_dayOfWeekBackgroundColor
+ * @attr ref android.R.styleable#DatePicker_dayOfWeekTextAppearance
+ * @attr ref android.R.styleable#DatePicker_headerBackgroundColor
+ * @attr ref android.R.styleable#DatePicker_headerMonthTextAppearance
+ * @attr ref android.R.styleable#DatePicker_headerDayOfMonthTextAppearance
+ * @attr ref android.R.styleable#DatePicker_headerYearTextAppearance
+ * @attr ref android.R.styleable#DatePicker_yearListItemTextAppearance
+ * @attr ref android.R.styleable#DatePicker_yearListSelectorColor
* @attr ref android.R.styleable#DatePicker_calendarTextColor
*/
@Widget
public class DatePicker extends FrameLayout {
-
private static final String LOG_TAG = DatePicker.class.getSimpleName();
- private DatePickerDelegate mDelegate;
-
- private int mDefStyleAttr;
- private int mDefStyleRes;
- private Context mContext;
+ private final DatePickerDelegate mDelegate;
/**
* The callback used to indicate the user changes\d the date.
@@ -127,30 +118,16 @@
public DatePicker(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
- mContext = context;
- mDefStyleAttr = defStyleAttr;
- mDefStyleRes = defStyleRes;
-
- TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.DatePicker,
- mDefStyleAttr, mDefStyleRes);
-
- // Create the correct UI delegate. Default is the legacy one.
- final boolean isLegacyMode = a.getBoolean(R.styleable.DatePicker_legacyMode,
- isLegacyMode());
-
+ final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.DatePicker,
+ defStyleAttr, defStyleRes);
+ final boolean legacyMode = a.getBoolean(R.styleable.DatePicker_legacyMode, true);
a.recycle();
- setLegacyMode(isLegacyMode, attrs);
- }
-
- private boolean isLegacyMode() {
- UiModeManager uiModeManager =
- (UiModeManager) mContext.getSystemService(Context.UI_MODE_SERVICE);
- if (uiModeManager.getCurrentModeType() == Configuration.UI_MODE_TYPE_TELEVISION) {
- return true;
+ if (legacyMode) {
+ mDelegate = createLegacyUIDelegate(context, attrs, defStyleAttr, defStyleRes);
+ } else {
+ mDelegate = createNewUIDelegate(context, attrs, defStyleAttr, defStyleRes);
}
- final int targetSdkVersion = getContext().getApplicationInfo().targetSdkVersion;
- return targetSdkVersion < L;
}
private DatePickerDelegate createLegacyUIDelegate(Context context, AttributeSet attrs,
@@ -167,16 +144,6 @@
/**
* @hide
*/
- public void setLegacyMode(boolean isLegacyMode, AttributeSet attrs) {
- removeAllViewsInLayout();
- mDelegate = isLegacyMode ?
- createLegacyUIDelegate(mContext, attrs, mDefStyleAttr, mDefStyleRes) :
- createNewUIDelegate(mContext, attrs, mDefStyleAttr, mDefStyleRes);
- }
-
- /**
- * @hide
- */
public void setShowDoneButton(boolean showDoneButton) {
mDelegate.setShowDoneButton(showDoneButton);
}
@@ -375,182 +342,6 @@
mDelegate.setSpinnersShown(shown);
}
- /**
- * Sets the background color for the date selector's day of week.
- *
- * @param color The background color.
- *
- * @attr ref android.R.styleable#DatePicker_dateSelectorDayOfWeekBackgroundColor
- */
- public void setDateSelectorDayOfWeekBackgroundColor(int color) {
- mDelegate.setDateSelectorDayOfWeekBackgroundColor(color);
- }
-
- /**
- * Gets the background color for the date selector's day of week.
- *
- * @return The text appearance resource id.
- *
- * @attr ref android.R.styleable#DatePicker_dateSelectorDayOfWeekBackgroundColor
- */
- public int getDateSelectorDayOfWeekBackgroundColor() {
- return mDelegate.getDateSelectorDayOfWeekBackgroundColor();
- }
-
- /**
- * Sets the text appearance for the date selector's day of week.
- *
- * @param resId The text appearance resource id.
- *
- * @attr ref android.R.styleable#DatePicker_dateSelectorDayOfWeekTextAppearance
- */
- public void setDateSelectorDayOfWeekTextAppearance(int resId) {
- mDelegate.setDateSelectorDayOfWeekTextAppearance(resId);
- }
-
- /**
- * Gets the text appearance for the date selector's day of week.
- *
- * @return The text appearance resource id.
- *
- * @attr ref android.R.styleable#DatePicker_dateSelectorDayOfWeekTextAppearance
- */
- public int getDateSelectorDayOfWeekTextAppearance() {
- return mDelegate.getDateSelectorDayOfWeekTextAppearance();
- }
-
- /**
- * Sets the background color for the date selector's.
- *
- * @param color The background color.
- *
- * @attr ref android.R.styleable#DatePicker_dateSelectorBackgroundColor
- */
- public void setDateSelectorBackgroundColor(int color) {
- mDelegate.setDateSelectorBackgroundColor(color);
- }
-
- /**
- * Gets the background color for the date selector's.
- *
- * @return The text appearance resource id.
- *
- * @attr ref android.R.styleable#DatePicker_dateSelectorBackgroundColor
- */
- public int getDateSelectorBackgroundColor() {
- return mDelegate.getDateSelectorBackgroundColor();
- }
-
- /**
- * Sets the text appearance for the date selector's month.
- *
- * @param resId The text appearance resource id.
- *
- * @attr ref android.R.styleable#DatePicker_dateSelectorMonthTextAppearance
- */
- public void setDateSelectorMonthTextAppearance(int resId) {
- mDelegate.setDateSelectorMonthTextAppearance(resId);
- }
-
- /**
- * Gets the text appearance for the date selector's month.
- *
- * @return The text appearance resource id.
- *
- * @attr ref android.R.styleable#DatePicker_dateSelectorMonthTextAppearance
- */
- public int getDateSelectorMonthTextAppearance() {
- return mDelegate.getDateSelectorMonthTextAppearance();
- }
-
- /**
- * Sets the text appearance for the date selector's day of month.
- *
- * @param resId The text appearance resource id.
- *
- * @attr ref android.R.styleable#DatePicker_dateSelectorDayOfMonthTextAppearance
- */
- public void setDateSelectorDayOfMonthTextAppearance(int resId) {
- mDelegate.setDateSelectorDayOfMonthTextAppearance(resId);
- }
-
- /**
- * Gets the text appearance for the date selector's day of month.
- *
- * @return The text appearance resource id.
- *
- * @attr ref android.R.styleable#DatePicker_dateSelectorDayOfMonthTextAppearance
- */
- public int getDateSelectorDayOfMonthTextAppearance() {
- return mDelegate.getDateSelectorDayOfMonthTextAppearance();
- }
-
- /**
- * Sets the text appearance for the date selector's year.
- *
- * @param resId The text appearance resource id.
- *
- * @attr ref android.R.styleable#DatePicker_dateSelectorYearTextAppearance
- */
- public void setDateSelectorYearTextAppearance(int resId) {
- mDelegate.setDateSelectorYearTextAppearance(resId);
- }
-
- /**
- * Gets the text appearance for the date selector's year.
- *
- * @return The text appearance resource id.
- *
- * @attr ref android.R.styleable#DatePicker_dateSelectorYearTextAppearance
- */
- public int getDateSelectorYearTextAppearance() {
- return mDelegate.getDateSelectorYearTextAppearance();
- }
-
- /**
- * Sets the text appearance for the year list item.
- *
- * @param resId The text appearance resource id.
- *
- * @attr ref android.R.styleable#DatePicker_dateSelectorYearListItemTextAppearance
- */
- public void setDateSelectorYearListItemTextAppearance(int resId) {
- mDelegate.setDateSelectorYearListItemTextAppearance(resId);
- }
-
- /**
- * Gets the text appearance for the year list item.
- *
- * @return The text appearance resource id.
- *
- * @attr ref android.R.styleable#DatePicker_dateSelectorYearListItemTextAppearance
- */
- public int getDateSelectorYearListItemTextAppearance() {
- return mDelegate.getDateSelectorYearListItemTextAppearance();
- }
-
- /**
- * Sets the text color state list for the calendar.
- *
- * @param colors The text color state list.
- *
- * @attr ref android.R.styleable#DatePicker_calendarTextColor
- */
- public void setCalendarTextColor(ColorStateList colors) {
- mDelegate.setCalendarTextColor(colors);
- }
-
- /**
- * Gets the text color state list for the calendar.
- *
- * @return The text color state list for the calendar.
- *
- * @attr ref android.R.styleable#DatePicker_calendarTextColor
- */
- public ColorStateList getCalendarTextColor() {
- return mDelegate.getCalendarTextColors();
- }
-
// Override so we are in complete control of save / restore for this widget.
@Override
protected void dispatchRestoreInstanceState(SparseArray<Parcelable> container) {
@@ -596,33 +387,6 @@
void setEnabled(boolean enabled);
boolean isEnabled();
- void setDateSelectorDayOfWeekBackgroundColor(int color);
- int getDateSelectorDayOfWeekBackgroundColor();
-
- void setDateSelectorDayOfWeekTextAppearance(int resId);
- int getDateSelectorDayOfWeekTextAppearance();
-
- void setDateSelectorBackgroundColor(int color);
- int getDateSelectorBackgroundColor();
-
- void setDateSelectorMonthTextAppearance(int resId);
- int getDateSelectorMonthTextAppearance();
-
- void setDateSelectorDayOfMonthTextAppearance(int resId);
- int getDateSelectorDayOfMonthTextAppearance();
-
- void setDateSelectorYearTextAppearance(int resId);
- int getDateSelectorYearTextAppearance();
-
- void setDateSelectorYearListItemTextAppearance(int resId);
- int getDateSelectorYearListItemTextAppearance();
-
- void setDateSelectorYearListSelectedCircleColor(int color);
- int getDateSelectorYearListSelectedCircleColor();
-
- void setCalendarTextColor(ColorStateList colors);
- ColorStateList getCalendarTextColors();
-
CalendarView getCalendarView();
void setCalendarViewShown(boolean shown);
@@ -979,87 +743,6 @@
}
@Override
- public void setDateSelectorDayOfWeekBackgroundColor(int color) {
- }
-
- @Override
- public int getDateSelectorDayOfWeekBackgroundColor() {
- return 0;
- }
-
- @Override
- public void setDateSelectorDayOfWeekTextAppearance(int resId) {
- }
-
- @Override
- public int getDateSelectorDayOfWeekTextAppearance() {
- return 0;
- }
-
- @Override
- public void setDateSelectorBackgroundColor(int color) {
- }
-
- @Override
- public int getDateSelectorBackgroundColor() {
- return 0;
- }
-
- @Override
- public void setDateSelectorMonthTextAppearance(int resId) {
- }
-
- @Override
- public int getDateSelectorMonthTextAppearance() {
- return 0;
- }
-
- @Override
- public void setDateSelectorDayOfMonthTextAppearance(int resId) {
- }
-
- @Override
- public int getDateSelectorDayOfMonthTextAppearance() {
- return 0;
- }
-
- @Override
- public void setDateSelectorYearTextAppearance(int resId) {
- }
-
- @Override
- public int getDateSelectorYearTextAppearance() {
- return 0;
- }
-
- @Override
- public void setDateSelectorYearListItemTextAppearance(int resId) {
- }
-
- @Override
- public int getDateSelectorYearListItemTextAppearance() {
- return 0;
- }
-
- @Override
- public void setDateSelectorYearListSelectedCircleColor(int color) {
- }
-
- @Override
- public int getDateSelectorYearListSelectedCircleColor() {
- return 0;
- }
-
- @Override
- public void setCalendarTextColor(ColorStateList colors) {
- }
-
- @Override
- public ColorStateList getCalendarTextColors() {
- return ColorStateList.valueOf(0);
- }
-
- @Override
public CalendarView getCalendarView() {
return mCalendarView;
}
diff --git a/core/java/android/widget/DatePickerDelegate.java b/core/java/android/widget/DatePickerDelegate.java
index 31044d4..ddc565d 100644
--- a/core/java/android/widget/DatePickerDelegate.java
+++ b/core/java/android/widget/DatePickerDelegate.java
@@ -24,12 +24,14 @@
import android.content.res.Configuration;
import android.content.res.Resources;
import android.content.res.TypedArray;
+import android.graphics.Color;
import android.os.Parcel;
import android.os.Parcelable;
import android.text.format.DateFormat;
import android.text.format.DateUtils;
import android.util.AttributeSet;
import android.util.SparseArray;
+import android.util.StateSet;
import android.view.HapticFeedbackConstants;
import android.view.LayoutInflater;
import android.view.View;
@@ -45,7 +47,6 @@
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.Locale;
/**
@@ -76,9 +77,9 @@
private TextView mDayOfWeekView;
private LinearLayout mDateLayout;
private LinearLayout mMonthAndDayLayout;
- private TextView mSelectedMonthTextView;
- private TextView mSelectedDayTextView;
- private TextView mSelectedYearView;
+ private TextView mHeaderMonthTextView;
+ private TextView mHeaderDayOfMonthTextView;
+ private TextView mHeaderYearTextView;
private DayPickerView mDayPickerView;
private YearPickerView mYearPickerView;
@@ -112,21 +113,8 @@
private HashSet<OnDateChangedListener> mListeners = new HashSet<OnDateChangedListener>();
- private int mDayOfWeekTextAppearanceResId;
- private int mMonthTextAppearanceResId;
- private int mDayOfMonthTextAppearanceResId;
- private int mYearTextAppearanceResId;
-
- private int mYearListItemTextAppearanceResId;
-
- private int mDayOfWeekBackgroundColor;
- private int mMonthAndDayBackgroundColor;
-
- private ColorStateList mCalendarTextColors;
-
public DatePickerDelegate(DatePicker delegator, Context context, AttributeSet attrs,
int defStyleAttr, int defStyleRes) {
-
super(delegator, context);
final Locale locale = Locale.getDefault();
@@ -139,17 +127,14 @@
mMinDate.set(DEFAULT_START_YEAR, 1, 1);
mMaxDate.set(DEFAULT_END_YEAR, 12, 31);
- // process style attributes
+ final Resources res = mDelegator.getResources();
final TypedArray a = mContext.obtainStyledAttributes(attrs,
R.styleable.DatePicker, defStyleAttr, defStyleRes);
-
final LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(
Context.LAYOUT_INFLATER_SERVICE);
-
final int layoutResourceId = a.getResourceId(
R.styleable.DatePicker_internalLayout, R.layout.date_picker_holo);
-
- View mainView = inflater.inflate(layoutResourceId, null);
+ final View mainView = inflater.inflate(layoutResourceId, null);
mDelegator.addView(mainView);
mDayOfWeekView = (TextView) mainView.findViewById(R.id.date_picker_header);
@@ -157,54 +142,68 @@
mMonthAndDayLayout = (LinearLayout) mainView.findViewById(
R.id.date_picker_month_and_day_layout);
mMonthAndDayLayout.setOnClickListener(this);
- mSelectedMonthTextView = (TextView) mainView.findViewById(R.id.date_picker_month);
- mSelectedDayTextView = (TextView) mainView.findViewById(R.id.date_picker_day);
- mSelectedYearView = (TextView) mainView.findViewById(R.id.date_picker_year);
- mSelectedYearView.setOnClickListener(this);
+ mHeaderMonthTextView = (TextView) mainView.findViewById(R.id.date_picker_month);
+ mHeaderDayOfMonthTextView = (TextView) mainView.findViewById(R.id.date_picker_day);
+ mHeaderYearTextView = (TextView) mainView.findViewById(R.id.date_picker_year);
+ mHeaderYearTextView.setOnClickListener(this);
+
+ // Obtain default highlight color from the theme.
+ final int defaultHighlightColor = mHeaderYearTextView.getHighlightColor();
// Use Theme attributes if possible
- mDayOfWeekTextAppearanceResId = a.getResourceId(
- R.styleable.DatePicker_dateSelectorDayOfWeekTextAppearance, -1);
- if (mDayOfWeekTextAppearanceResId != -1) {
- mDayOfWeekView.setTextAppearance(context, mDayOfWeekTextAppearanceResId);
+ final int dayOfWeekTextAppearanceResId = a.getResourceId(
+ R.styleable.DatePicker_dayOfWeekTextAppearance, -1);
+ if (dayOfWeekTextAppearanceResId != -1) {
+ mDayOfWeekView.setTextAppearance(context, dayOfWeekTextAppearanceResId);
}
- mMonthTextAppearanceResId = a.getResourceId(
- R.styleable.DatePicker_dateSelectorMonthTextAppearance, -1);
- if (mMonthTextAppearanceResId != -1) {
- mSelectedMonthTextView.setTextAppearance(context, mMonthTextAppearanceResId);
+ final int dayOfWeekBackgroundColor = a.getColor(
+ R.styleable.DatePicker_dayOfWeekBackgroundColor, Color.TRANSPARENT);
+ mDayOfWeekView.setBackgroundColor(dayOfWeekBackgroundColor);
+
+ final int headerSelectedTextColor = a.getColor(
+ R.styleable.DatePicker_headerSelectedTextColor, defaultHighlightColor);
+ final int headerBackgroundColor = a.getColor(R.styleable.DatePicker_headerBackgroundColor,
+ Color.TRANSPARENT);
+ mMonthAndDayLayout.setBackgroundColor(headerBackgroundColor);
+
+ final int monthTextAppearanceResId = a.getResourceId(
+ R.styleable.DatePicker_headerMonthTextAppearance, -1);
+ if (monthTextAppearanceResId != -1) {
+ mHeaderMonthTextView.setTextAppearance(context, monthTextAppearanceResId);
}
+ mHeaderMonthTextView.setTextColor(ColorStateList.addFirstIfMissing(
+ mHeaderMonthTextView.getTextColors(), R.attr.state_selected,
+ headerSelectedTextColor));
- mDayOfMonthTextAppearanceResId = a.getResourceId(
- R.styleable.DatePicker_dateSelectorDayOfMonthTextAppearance, -1);
- if (mDayOfMonthTextAppearanceResId != -1) {
- mSelectedDayTextView.setTextAppearance(context, mDayOfMonthTextAppearanceResId);
+ final int dayOfMonthTextAppearanceResId = a.getResourceId(
+ R.styleable.DatePicker_headerDayOfMonthTextAppearance, -1);
+ if (dayOfMonthTextAppearanceResId != -1) {
+ mHeaderDayOfMonthTextView.setTextAppearance(context, dayOfMonthTextAppearanceResId);
}
+ mHeaderDayOfMonthTextView.setTextColor(ColorStateList.addFirstIfMissing(
+ mHeaderDayOfMonthTextView.getTextColors(), R.attr.state_selected,
+ headerSelectedTextColor));
- mYearTextAppearanceResId = a.getResourceId(
- R.styleable.DatePicker_dateSelectorYearTextAppearance, -1);
- if (mYearTextAppearanceResId != -1) {
- mSelectedYearView.setTextAppearance(context, mYearTextAppearanceResId);
+ final int yearTextAppearanceResId = a.getResourceId(
+ R.styleable.DatePicker_headerYearTextAppearance, -1);
+ if (yearTextAppearanceResId != -1) {
+ mHeaderYearTextView.setTextAppearance(context, yearTextAppearanceResId);
}
-
- Resources res = mDelegator.getResources();
-
- mDayOfWeekBackgroundColor = a.getColor(
- R.styleable.DatePicker_dateSelectorDayOfWeekBackgroundColor,
- res.getColor(
- R.color.datepicker_default_header_dayofweek_background_color_holo_light));
- mDayOfWeekView.setBackgroundColor(mDayOfWeekBackgroundColor);
-
- mMonthAndDayBackgroundColor = a.getColor(R.styleable.DatePicker_dateSelectorBackgroundColor,
- res.getColor(R.color.datepicker_default_header_selector_background_holo_light));
- mMonthAndDayLayout.setBackgroundColor(mMonthAndDayBackgroundColor);
+ mHeaderYearTextView.setTextColor(ColorStateList.addFirstIfMissing(
+ mHeaderYearTextView.getTextColors(), R.attr.state_selected,
+ headerSelectedTextColor));
mDayPickerView = new DayPickerView(mContext, this);
mYearPickerView = new YearPickerView(mContext);
mYearPickerView.init(this);
- ColorStateList colors = a.getColorStateList(R.styleable.DatePicker_calendarTextColor);
- setCalendarTextColor(colors);
+ final ColorStateList calendarTextColor = a.getColorStateList(
+ R.styleable.DatePicker_calendarTextColor);
+ final int calendarSelectedTextColor = a.getColor(
+ R.styleable.DatePicker_calendarSelectedTextColor, defaultHighlightColor);
+ mDayPickerView.setCalendarTextColor(ColorStateList.addFirstIfMissing(
+ calendarTextColor, R.attr.state_selected, calendarSelectedTextColor));
mDayPickerDescription = res.getString(R.string.day_picker_description);
mSelectDay = res.getString(R.string.select_day);
@@ -308,30 +307,30 @@
// Restart from a clean state
mMonthAndDayLayout.removeAllViews();
- mDateLayout.removeView(mSelectedYearView);
+ mDateLayout.removeView(mHeaderYearTextView);
// Position the Year View at the correct location
if (viewIndices[YEAR_INDEX] == 0) {
- mDateLayout.addView(mSelectedYearView, 0);
+ mDateLayout.addView(mHeaderYearTextView, 0);
} else {
- mDateLayout.addView(mSelectedYearView, 1);
+ mDateLayout.addView(mHeaderYearTextView, 1);
}
// Position Day and Month Views
if (viewIndices[MONTH_INDEX] > viewIndices[DAY_INDEX]) {
// Day View is first
- mMonthAndDayLayout.addView(mSelectedDayTextView);
- mMonthAndDayLayout.addView(mSelectedMonthTextView);
+ mMonthAndDayLayout.addView(mHeaderDayOfMonthTextView);
+ mMonthAndDayLayout.addView(mHeaderMonthTextView);
} else {
// Month View is first
- mMonthAndDayLayout.addView(mSelectedMonthTextView);
- mMonthAndDayLayout.addView(mSelectedDayTextView);
+ mMonthAndDayLayout.addView(mHeaderMonthTextView);
+ mMonthAndDayLayout.addView(mHeaderDayOfMonthTextView);
}
- mSelectedMonthTextView.setText(mCurrentDate.getDisplayName(Calendar.MONTH, Calendar.SHORT,
+ mHeaderMonthTextView.setText(mCurrentDate.getDisplayName(Calendar.MONTH, Calendar.SHORT,
Locale.getDefault()).toUpperCase(Locale.getDefault()));
- mSelectedDayTextView.setText(mDayFormat.format(mCurrentDate.getTime()));
- mSelectedYearView.setText(mYearFormat.format(mCurrentDate.getTime()));
+ mHeaderDayOfMonthTextView.setText(mDayFormat.format(mCurrentDate.getTime()));
+ mHeaderYearTextView.setText(mYearFormat.format(mCurrentDate.getTime()));
// Accessibility.
long millis = mCurrentDate.getTimeInMillis();
@@ -362,7 +361,7 @@
mDayPickerView.onDateChanged();
if (mCurrentView != viewIndex) {
mMonthAndDayLayout.setSelected(true);
- mSelectedYearView.setSelected(false);
+ mHeaderYearTextView.setSelected(false);
mAnimator.setDisplayedChild(MONTH_AND_DAY_VIEW);
mCurrentView = viewIndex;
}
@@ -374,7 +373,7 @@
mAnimator.announceForAccessibility(mSelectDay);
break;
case YEAR_VIEW:
- pulseAnimator = getPulseAnimator(mSelectedYearView, 0.85f, 1.1f);
+ pulseAnimator = getPulseAnimator(mHeaderYearTextView, 0.85f, 1.1f);
if (mDelayAnimation) {
pulseAnimator.setStartDelay(ANIMATION_DELAY);
mDelayAnimation = false;
@@ -382,7 +381,7 @@
mYearPickerView.onDateChanged();
if (mCurrentView != viewIndex) {
mMonthAndDayLayout.setSelected(false);
- mSelectedYearView.setSelected(true);
+ mHeaderYearTextView.setSelected(true);
mAnimator.setDisplayedChild(YEAR_VIEW);
mCurrentView = viewIndex;
}
@@ -509,7 +508,7 @@
@Override
public void setEnabled(boolean enabled) {
mMonthAndDayLayout.setEnabled(enabled);
- mSelectedYearView.setEnabled(enabled);
+ mHeaderYearTextView.setEnabled(enabled);
mAnimator.setEnabled(enabled);
mIsEnabled = enabled;
}
@@ -520,123 +519,6 @@
}
@Override
- public void setDateSelectorDayOfWeekBackgroundColor(int color) {
- if (mDayOfWeekBackgroundColor != color) {
- mDayOfWeekBackgroundColor = color;
- mDayOfWeekView.setBackgroundColor(color);
- }
- }
-
- @Override
- public int getDateSelectorDayOfWeekBackgroundColor() {
- return mDayOfWeekBackgroundColor;
- }
-
- @Override
- public void setDateSelectorDayOfWeekTextAppearance(int resId) {
- if (mDayOfWeekTextAppearanceResId != resId && resId > 0) {
- mDayOfWeekTextAppearanceResId = resId;
- mDayOfWeekView.setTextAppearance(mContext, resId);
- }
- }
-
- @Override
- public int getDateSelectorDayOfWeekTextAppearance() {
- return mDayOfWeekTextAppearanceResId;
- }
-
- @Override
- public void setDateSelectorBackgroundColor(int color) {
- if (mMonthAndDayBackgroundColor != color) {
- mMonthAndDayBackgroundColor = color;
- mMonthAndDayLayout.setBackgroundColor(color);
- }
- }
-
- @Override
- public int getDateSelectorBackgroundColor() {
- return mMonthAndDayBackgroundColor;
- }
-
- @Override
- public void setDateSelectorMonthTextAppearance(int resId) {
- if (mMonthTextAppearanceResId != resId && resId > 0) {
- mMonthTextAppearanceResId = resId;
- mSelectedMonthTextView.setTextAppearance(mContext, resId);
- }
- }
-
- @Override
- public int getDateSelectorMonthTextAppearance() {
- return mMonthTextAppearanceResId;
- }
-
- @Override
- public void setDateSelectorDayOfMonthTextAppearance(int resId) {
- if (mDayOfMonthTextAppearanceResId != resId && resId > 0) {
- mDayOfMonthTextAppearanceResId = resId;
- mSelectedDayTextView.setTextAppearance(mContext, resId);
- }
- }
-
- @Override
- public int getDateSelectorDayOfMonthTextAppearance() {
- return mDayOfMonthTextAppearanceResId;
- }
-
- @Override
- public void setDateSelectorYearTextAppearance(int resId) {
- if (mYearTextAppearanceResId != resId && resId > 0) {
- mYearTextAppearanceResId = resId;
- mSelectedYearView.setTextAppearance(mContext, resId);
- }
- }
-
- @Override
- public int getDateSelectorYearTextAppearance() {
- return mYearTextAppearanceResId;
- }
-
- @Override
- public void setDateSelectorYearListItemTextAppearance(int resId) {
- if (mYearListItemTextAppearanceResId != resId) {
- mYearListItemTextAppearanceResId = resId;
- mYearPickerView.setItemTextAppearance(resId);
- }
- }
-
- @Override
- public int getDateSelectorYearListItemTextAppearance() {
- return mYearListItemTextAppearanceResId;
- }
-
- @Override
- public void setDateSelectorYearListSelectedCircleColor(int color) {
- mYearPickerView.setYearSelectedCircleColor(color);
- }
-
- @Override
- public int getDateSelectorYearListSelectedCircleColor() {
- return mYearPickerView.getYearSelectedCircleColor();
- }
-
- @Override
- public void setCalendarTextColor(ColorStateList colors) {
- if (colors == null) {
- return;
- }
- if (mCalendarTextColors == null || !mCalendarTextColors.equals(colors)) {
- mCalendarTextColors = colors;
- mDayPickerView.setCalendarTextColor(colors);
- }
- }
-
- @Override
- public ColorStateList getCalendarTextColors() {
- return mCalendarTextColors;
- }
-
- @Override
public CalendarView getCalendarView() {
throw new UnsupportedOperationException(
"CalendarView does not exists for the new DatePicker");
@@ -815,9 +697,8 @@
}
private void updatePickers() {
- Iterator<OnDateChangedListener> iterator = mListeners.iterator();
- while (iterator.hasNext()) {
- iterator.next().onDateChanged();
+ for (OnDateChangedListener listener : mListeners) {
+ listener.onDateChanged();
}
}
diff --git a/core/java/android/widget/LinearLayout.java b/core/java/android/widget/LinearLayout.java
index 82e624d..6476cdc 100644
--- a/core/java/android/widget/LinearLayout.java
+++ b/core/java/android/widget/LinearLayout.java
@@ -156,7 +156,7 @@
equals = Gravity.FILL, name = "FILL"),
@ViewDebug.FlagToString(mask = Gravity.RELATIVE_LAYOUT_DIRECTION,
equals = Gravity.RELATIVE_LAYOUT_DIRECTION, name = "RELATIVE")
- })
+ }, formatToHexString = true)
private int mGravity = Gravity.START | Gravity.TOP;
@ViewDebug.ExportedProperty(category = "measurement")
diff --git a/core/java/android/widget/RadialTimePickerView.java b/core/java/android/widget/RadialTimePickerView.java
index 1e30bfa..3d2f67f 100644
--- a/core/java/android/widget/RadialTimePickerView.java
+++ b/core/java/android/widget/RadialTimePickerView.java
@@ -24,6 +24,7 @@
import android.animation.ValueAnimator;
import android.annotation.SuppressLint;
import android.content.Context;
+import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Canvas;
@@ -104,6 +105,8 @@
private static final int CENTER_RADIUS = 2;
+ private static final int[] STATE_SET_SELECTED = new int[] { R.attr.state_selected };
+
private static int[] sSnapPrefer30sMap = new int[361];
private final String[] mHours12Texts = new String[12];
@@ -323,10 +326,20 @@
final TypedArray a = mContext.obtainStyledAttributes(attrs, R.styleable.TimePicker,
defStyle, 0);
- mAmPmUnselectedColor = a.getColor(R.styleable.TimePicker_amPmUnselectedBackgroundColor,
- res.getColor(R.color.timepicker_default_ampm_unselected_background_color_material));
- mAmPmSelectedColor = a.getColor(R.styleable.TimePicker_amPmSelectedBackgroundColor,
+ ColorStateList amPmBackgroundColor = a.getColorStateList(
+ R.styleable.TimePicker_amPmBackgroundColor);
+ if (amPmBackgroundColor == null) {
+ amPmBackgroundColor = res.getColorStateList(
+ R.color.timepicker_default_ampm_unselected_background_color_material);
+ }
+
+ // Obtain the backup selected color. If the background color state
+ // list doesn't have a state for selected, we'll use this color.
+ final int amPmSelectedColor = a.getColor(R.styleable.TimePicker_amPmSelectedBackgroundColor,
res.getColor(R.color.timepicker_default_ampm_selected_background_color_material));
+ mAmPmSelectedColor = amPmBackgroundColor.getColorForState(
+ STATE_SET_SELECTED, amPmSelectedColor);
+ mAmPmUnselectedColor = amPmBackgroundColor.getDefaultColor();
mAmPmTextColor = a.getColor(R.styleable.TimePicker_amPmTextColor,
res.getColor(R.color.timepicker_default_text_color_material));
diff --git a/core/java/android/widget/TextViewWithCircularIndicator.java b/core/java/android/widget/TextViewWithCircularIndicator.java
index 22d770c..43c0843 100644
--- a/core/java/android/widget/TextViewWithCircularIndicator.java
+++ b/core/java/android/widget/TextViewWithCircularIndicator.java
@@ -50,20 +50,18 @@
public TextViewWithCircularIndicator(Context context, AttributeSet attrs,
int defStyleAttr, int defStyleRes) {
-
super(context, attrs);
- Resources res = context.getResources();
+
// Use Theme attributes if possible
final TypedArray a = mContext.obtainStyledAttributes(attrs,
R.styleable.DatePicker, defStyleAttr, defStyleRes);
-
- final int resId = a.getResourceId(
- R.styleable.DatePicker_dateSelectorYearListItemTextAppearance, -1);
+ final int resId = a.getResourceId(R.styleable.DatePicker_yearListItemTextAppearance, -1);
if (resId != -1) {
setTextAppearance(context, resId);
}
+ final Resources res = context.getResources();
mItemIsSelectedText = res.getString(R.string.item_is_selected);
a.recycle();
diff --git a/core/java/android/widget/TimePickerDelegate.java b/core/java/android/widget/TimePickerDelegate.java
index 45be637..c68619c 100644
--- a/core/java/android/widget/TimePickerDelegate.java
+++ b/core/java/android/widget/TimePickerDelegate.java
@@ -20,6 +20,7 @@
import android.animation.ObjectAnimator;
import android.animation.PropertyValuesHolder;
import android.content.Context;
+import android.content.res.ColorStateList;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.content.res.TypedArray;
@@ -79,7 +80,6 @@
// Duration in ms of the pulse animation
private static final int PULSE_ANIMATOR_DURATION = 544;
- private final View mMainView;
private TextView mHourView;
private TextView mMinuteView;
private TextView mAmPmTextView;
@@ -88,8 +88,6 @@
private ViewGroup mLayoutButtons;
- private int mHeaderSelectedColor;
- private int mHeaderUnselectedColor;
private String mAmText;
private String mPmText;
@@ -128,7 +126,8 @@
// process style attributes
final TypedArray a = mContext.obtainStyledAttributes(attrs,
R.styleable.TimePicker, defStyleAttr, defStyleRes);
-
+ final LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(
+ Context.LAYOUT_INFLATER_SERVICE);
final Resources res = mContext.getResources();
mHourPickerDescription = res.getString(R.string.hour_picker_description);
@@ -136,53 +135,52 @@
mMinutePickerDescription = res.getString(R.string.minute_picker_description);
mSelectMinutes = res.getString(R.string.select_minutes);
- mHeaderSelectedColor = a.getColor(R.styleable.TimePicker_headerSelectedTextColor,
- res.getColor(R.color.timepicker_default_selector_color_material));
+ final int layoutResourceId = a.getResourceId(R.styleable.TimePicker_internalLayout,
+ R.layout.time_picker_holo);
+ final View mainView = inflater.inflate(layoutResourceId, null);
+ mDelegator.addView(mainView);
- final int headerTimeTextAppearance = a.getResourceId(
- R.styleable.TimePicker_headerTimeTextAppearance, 0);
- final int headerAmPmTextAppearance = a.getResourceId(
- R.styleable.TimePicker_headerAmPmTextAppearance, 0);
- final int headerBackgroundColor = a.getColor(
- R.styleable.TimePicker_headerBackgroundColor, Color.TRANSPARENT);
- final int layoutResourceId = a.getResourceId(
- R.styleable.TimePicker_internalLayout, R.layout.time_picker_holo);
-
- a.recycle();
-
- final LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(
- Context.LAYOUT_INFLATER_SERVICE);
-
- mMainView = inflater.inflate(layoutResourceId, null);
- mDelegator.addView(mMainView);
-
- mHourView = (TextView) mMainView.findViewById(R.id.hours);
- mSeparatorView = (TextView) mMainView.findViewById(R.id.separator);
- mMinuteView = (TextView) mMainView.findViewById(R.id.minutes);
- mAmPmTextView = (TextView) mMainView.findViewById(R.id.ampm_label);
- mLayoutButtons = (ViewGroup) mMainView.findViewById(R.id.layout_buttons);
+ mHourView = (TextView) mainView.findViewById(R.id.hours);
+ mSeparatorView = (TextView) mainView.findViewById(R.id.separator);
+ mMinuteView = (TextView) mainView.findViewById(R.id.minutes);
+ mAmPmTextView = (TextView) mainView.findViewById(R.id.ampm_label);
+ mLayoutButtons = (ViewGroup) mainView.findViewById(R.id.layout_buttons);
// Set up text appearances from style.
+ final int headerTimeTextAppearance = a.getResourceId(
+ R.styleable.TimePicker_headerTimeTextAppearance, 0);
if (headerTimeTextAppearance != 0) {
mHourView.setTextAppearance(context, headerTimeTextAppearance);
mSeparatorView.setTextAppearance(context, headerTimeTextAppearance);
mMinuteView.setTextAppearance(context, headerTimeTextAppearance);
}
+ final int headerSelectedTextColor = a.getColor(
+ R.styleable.TimePicker_headerSelectedTextColor,
+ res.getColor(R.color.timepicker_default_selector_color_material));
+ mHourView.setTextColor(ColorStateList.addFirstIfMissing(mHourView.getTextColors(),
+ R.attr.state_selected, headerSelectedTextColor));
+ mMinuteView.setTextColor(ColorStateList.addFirstIfMissing(mMinuteView.getTextColors(),
+ R.attr.state_selected, headerSelectedTextColor));
+
+ final int headerAmPmTextAppearance = a.getResourceId(
+ R.styleable.TimePicker_headerAmPmTextAppearance, 0);
if (headerAmPmTextAppearance != 0) {
mAmPmTextView.setTextAppearance(context, headerAmPmTextAppearance);
}
+ final int headerBackgroundColor = a.getColor(
+ R.styleable.TimePicker_headerBackgroundColor, Color.TRANSPARENT);
if (headerBackgroundColor != Color.TRANSPARENT) {
mLayoutButtons.setBackgroundColor(headerBackgroundColor);
- mMainView.findViewById(R.id.time_header).setBackgroundColor(headerBackgroundColor);
+ mainView.findViewById(R.id.time_header).setBackgroundColor(headerBackgroundColor);
}
- // Load unselected header color from current state.
- mHeaderUnselectedColor = mHourView.getCurrentTextColor();
+ a.recycle();
- mRadialTimePickerView = (RadialTimePickerView) mMainView.findViewById(R.id.radial_picker);
- mDoneButton = (Button) mMainView.findViewById(R.id.done_button);
+ mRadialTimePickerView = (RadialTimePickerView) mainView.findViewById(
+ R.id.radial_picker);
+ mDoneButton = (Button) mainView.findViewById(R.id.done_button);
String[] amPmTexts = new DateFormatSymbols().getAmPmStrings();
mAmText = amPmTexts[0];
@@ -785,7 +783,6 @@
separatorText = Character.toString(bestDateTimePattern.charAt(hIndex + 1));
}
mSeparatorView.setText(separatorText);
- mSeparatorView.setTextColor(mHeaderUnselectedColor);
}
static private int lastIndexOfAny(String str, char[] any) {
@@ -839,10 +836,8 @@
labelToAnimate = mMinuteView;
}
- int hourColor = (index == HOUR_INDEX) ? mHeaderSelectedColor : mHeaderUnselectedColor;
- int minuteColor = (index == MINUTE_INDEX) ? mHeaderSelectedColor : mHeaderUnselectedColor;
- mHourView.setTextColor(hourColor);
- mMinuteView.setTextColor(minuteColor);
+ mHourView.setSelected(index == HOUR_INDEX);
+ mMinuteView.setSelected(index == MINUTE_INDEX);
ObjectAnimator pulseAnimator = getPulseAnimator(labelToAnimate, 0.85f, 1.1f);
if (delayLabelAnimate) {
@@ -1064,9 +1059,9 @@
String minuteStr = (values[1] == -1) ? mDoublePlaceholderText :
String.format(minuteFormat, values[1]).replace(' ', mPlaceholderText);
mHourView.setText(hourStr);
- mHourView.setTextColor(mHeaderUnselectedColor);
+ mHourView.setSelected(false);
mMinuteView.setText(minuteStr);
- mMinuteView.setTextColor(mHeaderUnselectedColor);
+ mMinuteView.setSelected(false);
if (!mIs24HourView) {
updateAmPmDisplay(values[2]);
}
@@ -1143,8 +1138,7 @@
}
}
- int[] ret = {hour, minute, amOrPm};
- return ret;
+ return new int[] { hour, minute, amOrPm };
}
/**
diff --git a/core/java/android/widget/YearPickerView.java b/core/java/android/widget/YearPickerView.java
index bac9320..b67fa55 100644
--- a/core/java/android/widget/YearPickerView.java
+++ b/core/java/android/widget/YearPickerView.java
@@ -33,8 +33,6 @@
*/
class YearPickerView extends ListView implements AdapterView.OnItemClickListener,
OnDateChangedListener {
- private static final String TAG = "YearPickerView";
-
private DatePickerController mController;
private YearAdapter mAdapter;
private int mViewSize;
@@ -57,11 +55,11 @@
public YearPickerView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
- ViewGroup.LayoutParams frame = new ViewGroup.LayoutParams(LayoutParams.MATCH_PARENT,
- LayoutParams.WRAP_CONTENT);
+ final LayoutParams frame = new LayoutParams(
+ LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
setLayoutParams(frame);
- Resources res = context.getResources();
+ final Resources res = context.getResources();
mViewSize = res.getDimensionPixelOffset(R.dimen.datepicker_view_animator_height);
mChildSize = res.getDimensionPixelOffset(R.dimen.datepicker_year_label_height);
@@ -73,11 +71,9 @@
setPadding(0, paddingTop, 0, 0);
// Use Theme attributes if possible
- final TypedArray a = context.obtainStyledAttributes(attrs,
- R.styleable.DatePicker, defStyleAttr, defStyleRes);
-
- final int colorResId = a.getResourceId(
- R.styleable.DatePicker_dateSelectorYearListSelectedCircleColor,
+ final TypedArray a = context.obtainStyledAttributes(
+ attrs, R.styleable.DatePicker, defStyleAttr, defStyleRes);
+ final int colorResId = a.getResourceId(R.styleable.DatePicker_yearListSelectorColor,
R.color.datepicker_default_circle_background_color_holo_light);
mYearSelectedCircleColor = res.getColor(colorResId);
diff --git a/core/jni/android/graphics/MinikinUtils.cpp b/core/jni/android/graphics/MinikinUtils.cpp
index 2ad8330..b3ed6f0 100644
--- a/core/jni/android/graphics/MinikinUtils.cpp
+++ b/core/jni/android/graphics/MinikinUtils.cpp
@@ -44,25 +44,25 @@
const uint16_t* buf, size_t start, size_t count, size_t bufSize) {
TypefaceImpl* resolvedFace = TypefaceImpl_resolveDefault(typeface);
layout->setFontCollection(resolvedFace->fFontCollection);
- FontStyle style = resolvedFace->fStyle;
- char css[512];
- int off = snprintfcat(css, 0, sizeof(css),
- "font-size: %d; font-scale-x: %f; font-skew-x: %f; -paint-flags: %d;"
- " font-weight: %d; font-style: %s; -minikin-bidi: %d; letter-spacing: %f;",
- (int)paint->getTextSize(),
- paint->getTextScaleX(),
- paint->getTextSkewX(),
- MinikinFontSkia::packPaintFlags(paint),
- style.getWeight() * 100,
- style.getItalic() ? "italic" : "normal",
- bidiFlags,
- paint->getLetterSpacing());
- SkString langString = paint->getPaintOptionsAndroid().getLanguage().getTag();
- off = snprintfcat(css, off, sizeof(css), " lang: %s;", langString.c_str());
+ FontStyle resolved = resolvedFace->fStyle;
+
+ /* Prepare minikin FontStyle */
+ SkString langStr = paint->getPaintOptionsAndroid().getLanguage().getTag();
+ FontLanguage minikinLang(langStr.c_str(), langStr.size());
SkPaintOptionsAndroid::FontVariant var = paint->getPaintOptionsAndroid().getFontVariant();
- const char* varstr = var == SkPaintOptionsAndroid::kElegant_Variant ? "elegant" : "compact";
- off = snprintfcat(css, off, sizeof(css), " -minikin-variant: %s;", varstr);
- layout->doLayout(buf, start, count, bufSize, std::string(css));
+ FontVariant minikinVariant = var == SkPaintOptionsAndroid::kElegant_Variant ? VARIANT_ELEGANT
+ : VARIANT_COMPACT;
+ FontStyle minikinStyle(minikinLang, minikinVariant, resolved.getWeight(), resolved.getItalic());
+
+ /* Prepare minikin Paint */
+ MinikinPaint minikinPaint;
+ minikinPaint.size = (int)/*WHY?!*/paint->getTextSize();
+ minikinPaint.scaleX = paint->getTextScaleX();
+ minikinPaint.skewX = paint->getTextSkewX();
+ minikinPaint.letterSpacing = paint->getLetterSpacing();
+ minikinPaint.paintFlags = MinikinFontSkia::packPaintFlags(paint);
+
+ layout->doLayout(buf, start, count, bufSize, bidiFlags, minikinStyle, minikinPaint);
}
float MinikinUtils::xOffsetForTextAlign(Paint* paint, const Layout& layout) {
diff --git a/core/res/res/color/date_picker_calendar_material_dark.xml b/core/res/res/color/date_picker_calendar_material_dark.xml
deleted file mode 100644
index 86a0673..0000000
--- a/core/res/res/color/date_picker_calendar_material_dark.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 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.
--->
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
-
- <item android:state_enabled="true" android:state_selected="false"
- android:color="@color/datepicker_default_normal_text_color_material_dark"/>
- <item android:state_enabled="true" android:state_selected="true"
- android:color="@color/holo_blue_light"/>
- <item android:state_enabled="false"
- android:color="@color/datepicker_default_disabled_text_color_material_dark"/>
-
-</selector>
\ No newline at end of file
diff --git a/core/res/res/color/date_picker_calendar_material_light.xml b/core/res/res/color/date_picker_calendar_material_light.xml
deleted file mode 100644
index 015eed7..0000000
--- a/core/res/res/color/date_picker_calendar_material_light.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 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.
--->
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
-
- <item android:state_enabled="true" android:state_selected="false"
- android:color="@color/datepicker_default_normal_text_color_material_light"/>
- <item android:state_enabled="true" android:state_selected="true"
- android:color="@color/holo_blue_light"/>
- <item android:state_enabled="false"
- android:color="@color/datepicker_default_disabled_text_color_material_light"/>
-
-</selector>
\ No newline at end of file
diff --git a/core/res/res/color/date_picker_selector_material_dark.xml b/core/res/res/color/date_picker_selector_material_dark.xml
deleted file mode 100644
index e407387..0000000
--- a/core/res/res/color/date_picker_selector_material_dark.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 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.
--->
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
-
- <item android:state_pressed="true"
- android:color="@color/datepicker_default_pressed_text_color_material_dark"/>
- <item android:state_pressed="false" android:state_selected="true"
- android:color="@color/datepicker_default_selected_text_color_material_dark"/>
- <item android:state_pressed="false" android:state_selected="false"
- android:color="@color/datepicker_default_normal_text_color_material_dark"/>
-
-</selector>
\ No newline at end of file
diff --git a/core/res/res/color/date_picker_selector_material_light.xml b/core/res/res/color/date_picker_selector_material_light.xml
deleted file mode 100644
index b4c6a47..0000000
--- a/core/res/res/color/date_picker_selector_material_light.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 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.
--->
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
-
- <item android:state_pressed="true"
- android:color="@color/datepicker_default_pressed_text_color_material_light"/>
- <item android:state_pressed="false" android:state_selected="true"
- android:color="@color/datepicker_default_selected_text_color_material_light"/>
- <item android:state_pressed="false" android:state_selected="false"
- android:color="@color/datepicker_default_normal_text_color_material_light"/>
-
-</selector>
\ No newline at end of file
diff --git a/core/res/res/color/date_picker_year_selector_material_dark.xml b/core/res/res/color/date_picker_year_selector_material_dark.xml
deleted file mode 100644
index b5ff09a..0000000
--- a/core/res/res/color/date_picker_year_selector_material_dark.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 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.
--->
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
-
- <item android:state_pressed="true"
- android:color="@color/datepicker_default_pressed_text_color_material_dark"/>
- <item android:state_pressed="false" android:state_selected="false"
- android:color="@color/datepicker_default_normal_text_color_material_dark"/>
-
-</selector>
\ No newline at end of file
diff --git a/core/res/res/color/date_picker_year_selector_material_light.xml b/core/res/res/color/date_picker_year_selector_material_light.xml
deleted file mode 100644
index 5e329b3..0000000
--- a/core/res/res/color/date_picker_year_selector_material_light.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 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.
--->
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
-
- <item android:state_pressed="true"
- android:color="@color/datepicker_default_pressed_text_color_material_light"/>
- <item android:state_pressed="false" android:state_selected="false"
- android:color="@color/datepicker_default_normal_text_color_material_light"/>
-
-</selector>
\ No newline at end of file
diff --git a/core/res/res/layout-land/date_picker_holo.xml b/core/res/res/layout-land/date_picker_holo.xml
index 98e26ca..af8f598 100644
--- a/core/res/res/layout-land/date_picker_holo.xml
+++ b/core/res/res/layout-land/date_picker_holo.xml
@@ -24,7 +24,6 @@
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center"
- android:background="?android:attr/datePickerHeaderSelectorBackgroundColor"
android:orientation="vertical" >
<LinearLayout
diff --git a/core/res/res/layout/date_picker_header_view.xml b/core/res/res/layout/date_picker_header_view.xml
index eccdd3e..66d5e1b 100644
--- a/core/res/res/layout/date_picker_header_view.xml
+++ b/core/res/res/layout/date_picker_header_view.xml
@@ -18,9 +18,6 @@
android:id="@+id/date_picker_header"
android:layout_width="@dimen/datepicker_component_width"
android:layout_height="@dimen/datepicker_header_height"
- android:background="?android:attr/datePickerHeaderDayOfWeekLabelBackgroundColor"
android:gravity="center"
- android:textAppearance="?android:attr/datePickerHeaderDayOfWeekLabelTextAppearance"
android:importantForAccessibility="no"
- android:textAllCaps="true"
- />
+ android:textAllCaps="true" />
diff --git a/core/res/res/layout/date_picker_holo.xml b/core/res/res/layout/date_picker_holo.xml
index 389c2b5..1199a72 100644
--- a/core/res/res/layout/date_picker_holo.xml
+++ b/core/res/res/layout/date_picker_holo.xml
@@ -18,12 +18,12 @@
android:layout_width="@dimen/datepicker_component_width"
android:layout_height="match_parent"
android:gravity="center"
- android:orientation="vertical" >
+ android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:orientation="vertical" >
+ android:orientation="vertical">
<include layout="@layout/date_picker_header_view" />
@@ -34,4 +34,4 @@
<include layout="@layout/date_picker_done_button" />
-</LinearLayout>
\ No newline at end of file
+</LinearLayout>
diff --git a/core/res/res/layout/date_picker_selected_date.xml b/core/res/res/layout/date_picker_selected_date.xml
index 426deed..c5afddc 100644
--- a/core/res/res/layout/date_picker_selected_date.xml
+++ b/core/res/res/layout/date_picker_selected_date.xml
@@ -22,9 +22,8 @@
android:layout_weight="1"
android:paddingTop="8dip"
android:paddingBottom="8dip"
- android:background="?android:attr/datePickerHeaderSelectorBackgroundColor"
android:gravity="center"
- android:orientation="vertical" >
+ android:orientation="vertical">
<LinearLayout
android:id="@+id/date_picker_month_and_day_layout"
@@ -32,15 +31,14 @@
android:layout_height="wrap_content"
android:layout_gravity="center"
android:clickable="true"
- android:orientation="vertical" >
+ android:orientation="vertical">
<TextView
android:id="@+id/date_picker_month"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:duplicateParentState="true"
- android:gravity="center_horizontal|bottom"
- android:textAppearance="?android:attr/datePickerHeaderSelectorMonthLabelTextAppearance" />
+ android:gravity="center_horizontal|bottom" />
<TextView
android:id="@+id/date_picker_day"
@@ -50,8 +48,7 @@
android:layout_marginBottom="-10dip"
android:layout_marginTop="-10dip"
android:duplicateParentState="true"
- android:gravity="center"
- android:textAppearance="?android:attr/datePickerHeaderSelectorDayOfMonthLabelTextAppearance" />
+ android:gravity="center" />
</LinearLayout>
<TextView
@@ -59,7 +56,6 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
- android:gravity="center_horizontal|top"
- android:textAppearance="?android:attr/datePickerHeaderSelectorYearLabelTextAppearance" />
+ android:gravity="center_horizontal|top" />
-</LinearLayout>
\ No newline at end of file
+</LinearLayout>
diff --git a/core/res/res/layout/year_label_text_view.xml b/core/res/res/layout/year_label_text_view.xml
index 4e39831..e5bd068 100644
--- a/core/res/res/layout/year_label_text_view.xml
+++ b/core/res/res/layout/year_label_text_view.xml
@@ -19,5 +19,4 @@
android:layout_width="match_parent"
android:layout_height="@dimen/datepicker_year_label_height"
android:layout_gravity="center"
- android:gravity="center"
- android:textAppearance="?android:attr/datePickerHeaderListYearLabelTextAppearance" />
+ android:gravity="center" />
diff --git a/core/res/res/values-television/themes.xml b/core/res/res/values-television/themes.xml
index 3333f1b..f92ff40 100644
--- a/core/res/res/values-television/themes.xml
+++ b/core/res/res/values-television/themes.xml
@@ -16,13 +16,8 @@
<resources>
<style name="Theme.Dialog.Alert" parent="Theme.Leanback.Light.Dialog.Alert" />
<style name="Theme.Dialog.AppError" parent="Theme.Leanback.Dialog.AppError" />
- <style name="Theme.Dialog.TimePicker" parent="Theme.Leanback.Dialog.TimePicker" />
<style name="Theme.Holo.Dialog.Alert" parent="Theme.Leanback.Dialog.Alert" />
- <style name="Theme.Holo.Dialog.TimePicker" parent="Theme.Leanback.Dialog.TimePicker" />
<style name="Theme.Holo.Light.Dialog.Alert" parent="Theme.Leanback.Light.Dialog.Alert" />
- <style name="Theme.Holo.Light.Dialog.TimePicker" parent="Theme.Leanback.Light.Dialog.TimePicker" />
<style name="Theme.Material.Dialog.Alert" parent="Theme.Leanback.Dialog.Alert" />
- <style name="Theme.Material.Dialog.TimePicker" parent="Theme.Leanback.Dialog.TimePicker" />
<style name="Theme.Material.Light.Dialog.Alert" parent="Theme.Leanback.Light.Dialog.Alert" />
- <style name="Theme.Material.Light.Dialog.TimePicker" parent="Theme.Leanback.Light.Dialog.TimePicker" />
</resources>
diff --git a/core/res/res/values-television/themes_device_defaults.xml b/core/res/res/values-television/themes_device_defaults.xml
index 1938675..e01caa3 100644
--- a/core/res/res/values-television/themes_device_defaults.xml
+++ b/core/res/res/values-television/themes_device_defaults.xml
@@ -16,6 +16,4 @@
<resources>
<style name="Theme.DeviceDefault.Dialog.Alert" parent="Theme.Leanback.Dialog.Alert" />
<style name="Theme.DeviceDefault.Light.Dialog.Alert" parent="Theme.Leanback.Light.Dialog.Alert" />
- <style name="Theme.DeviceDefault.Dialog.TimePicker" parent="Theme.Leanback.Dialog.TimePicker" />
- <style name="Theme.DeviceDefault.Light.Dialog.TimePicker" parent="Theme.Leanback.Light.Dialog.TimePicker" />
</resources>
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index 82a75b53..870f7ec 100644
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -682,30 +682,6 @@
<!-- The DatePicker style. -->
<attr name="datePickerStyle" format="reference" />
- <!-- The DatePicker Header day of week label background color . -->
- <attr name="datePickerHeaderDayOfWeekLabelBackgroundColor" format="reference" />
-
- <!-- The DatePicker Header day of week label text appearance -->
- <attr name="datePickerHeaderDayOfWeekLabelTextAppearance" format="reference" />
-
- <!-- The DatePicker Header selector background color . -->
- <attr name="datePickerHeaderSelectorBackgroundColor" format="reference" />
-
- <!-- The DatePicker Header selector month label text appearance -->
- <attr name="datePickerHeaderSelectorMonthLabelTextAppearance" format="reference" />
-
- <!-- The DatePicker Header selector day of month label text appearance -->
- <attr name="datePickerHeaderSelectorDayOfMonthLabelTextAppearance" format="reference" />
-
- <!-- The DatePicker Header selector year label text appearance -->
- <attr name="datePickerHeaderSelectorYearLabelTextAppearance" format="reference" />
-
- <!-- The DatePicker Header list year label text appearance -->
- <attr name="datePickerHeaderListYearLabelTextAppearance" format="reference" />
-
- <!-- DatePicker list year label circle background color -->
- <attr name="datePickerHeaderListYearLabelCircleBackgroundColor" format="reference" />
-
<!-- The DatePicker dialog theme. -->
<attr name="datePickerDialogTheme" format="reference" />
@@ -4215,12 +4191,10 @@
<declare-styleable name="DatePicker">
<!-- The first year (inclusive), for example "1940".
- {@deprecated Use minDate instead.}
- -->
+ {@deprecated Use minDate instead.} -->
<attr name="startYear" format="integer" />
<!-- The last year (inclusive), for example "2010".
- {@deprecated Use maxDate instead.}
- -->
+ {@deprecated Use maxDate instead.} -->
<attr name="endYear" format="integer" />
<!-- Whether the spinners are shown. -->
<attr name="spinnersShown" format="boolean" />
@@ -4236,24 +4210,32 @@
<attr name="legacyLayout" />
<!-- @hide Enables or disable the use of the legacy layout for the DatePicker. -->
<attr name="legacyMode" />
- <!-- The background color for the date selector 's day of week of the non legacy DatePicker. -->
- <attr name="dateSelectorDayOfWeekBackgroundColor" format="color|reference" />
- <!-- The text color for the date selector's day of week of the non legacy DatePicker. -->
- <attr name="dateSelectorDayOfWeekTextAppearance" format="reference" />
- <!-- The background color for the date selector of the non legacy DatePicker. -->
- <attr name="dateSelectorBackgroundColor" format="color|reference" />
- <!-- The month's text appearance in the date selector of the non legacy DatePicker. -->
- <attr name="dateSelectorMonthTextAppearance" format="reference" />
- <!-- The day of month's text appearance in the date selector of the non legacy DatePicker. -->
- <attr name="dateSelectorDayOfMonthTextAppearance" format="reference" />
- <!-- The year's text appearance in the date selector of the non legacy DatePicker. -->
- <attr name="dateSelectorYearTextAppearance" format="reference" />
- <!-- The list year's text appearance in the list of the non legacy DatePicker. -->
- <attr name="dateSelectorYearListItemTextAppearance" format="reference" />
- <!-- The list year's selected circle color in the list of the non legacy DatePicker. -->
- <attr name="dateSelectorYearListSelectedCircleColor" format="color|reference" />
- <!-- The text color list of the calendar of the non legacy DatePicker. -->
- <attr name="calendarTextColor" format="color|reference" />
+ <!-- The background color for the date selector 's day of week. -->
+ <attr name="dayOfWeekBackgroundColor" format="color" />
+ <!-- The text color for the date selector's day of week. -->
+ <attr name="dayOfWeekTextAppearance" format="reference" />
+ <!-- The month's text appearance in the date selector. -->
+ <attr name="headerMonthTextAppearance" format="reference" />
+ <!-- The day of month's text appearance in the date selector. -->
+ <attr name="headerDayOfMonthTextAppearance" format="reference" />
+ <!-- The year's text appearance in the date selector. -->
+ <attr name="headerYearTextAppearance" format="reference" />
+ <!-- The background color for the date selector. -->
+ <attr name="headerBackgroundColor" />
+ <!-- @hide The selected text color for the date selector. Used as a
+ backup if the text appearance does not explicitly have a color
+ set for the selected state. -->
+ <attr name="headerSelectedTextColor" />
+ <!-- The list year's text appearance in the list. -->
+ <attr name="yearListItemTextAppearance" format="reference" />
+ <!-- The list year's selected circle color in the list. -->
+ <attr name="yearListSelectorColor" format="color" />
+ <!-- The text color list of the calendar. -->
+ <attr name="calendarTextColor" format="color" />
+ <!-- @hide The selected text color for the calendar. Used as a backup
+ if the text color does not explicitly have a color set for the
+ selected state. -->
+ <attr name="calendarSelectedTextColor" format="color" />
</declare-styleable>
<declare-styleable name="TwoLineListItem">
@@ -4533,8 +4515,9 @@
<attr name="headerAmPmTextAppearance" format="reference" />
<!-- The text appearance for the time header of the TimePicker. -->
<attr name="headerTimeTextAppearance" format="reference" />
- <!-- The text color for selected time header of the TimePicker. This
- will override the value from the text appearance. -->
+ <!-- @hide The text color for selected time header of the TimePicker.
+ This will override the value from the text appearance if it does
+ not explicitly have a color set for the selected state. -->
<attr name="headerSelectedTextColor" format="color" />
<!-- The background color for the header of the TimePicker. -->
<attr name="headerBackgroundColor" format="color" />
@@ -4544,9 +4527,11 @@
<attr name="numbersBackgroundColor" format="color" />
<!-- The color for the AM/PM selectors of the TimePicker. -->
<attr name="amPmTextColor" format="color" />
- <!-- The background color for the AM/PM selectors of the TimePicker when unselected. -->
- <attr name="amPmUnselectedBackgroundColor" format="color" />
- <!-- The background color for the AM/PM selectors of the TimePicker when selected. -->
+ <!-- The background color state list for the AM/PM selectors of the TimePicker. -->
+ <attr name="amPmBackgroundColor" format="color" />
+ <!-- @hide The background color for the AM/PM selectors of the
+ TimePicker when selected. Used if the background color does not
+ explicitly have a color set for the selected state. -->
<attr name="amPmSelectedBackgroundColor" format="color" />
<!-- The color for the hours/minutes selector of the TimePicker. -->
<attr name="numbersSelectorColor" format="color" />
diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml
index c71036e..88cf7c8 100644
--- a/core/res/res/values/public.xml
+++ b/core/res/res/values/public.xml
@@ -2237,38 +2237,33 @@
<public type="attr" name="windowElevation" />
<public type="attr" name="launchTaskBehindBackgroundAnimation" />
<public type="attr" name="launchTaskBehindSourceAnimation" />
- <!-- Attribute specified in a restriction entry to denote the type of restriction. -->
<public type="attr" name="restrictionType" />
- <!-- For the DatePicker -->
- <public type="attr" name="dateSelectorDayOfWeekBackgroundColor" />
- <public type="attr" name="dateSelectorDayOfWeekTextAppearance" />
- <public type="attr" name="dateSelectorBackgroundColor" />
- <public type="attr" name="dateSelectorMonthTextAppearance" />
- <public type="attr" name="dateSelectorDayOfMonthTextAppearance" />
- <public type="attr" name="dateSelectorYearTextAppearance" />
- <public type="attr" name="dateSelectorYearListItemTextAppearance" />
- <public type="attr" name="dateSelectorYearListSelectedCircleColor" />
+ <public type="attr" name="dayOfWeekBackgroundColor" />
+ <public type="attr" name="dayOfWeekTextAppearance" />
+ <public type="attr" name="headerMonthTextAppearance" />
+ <public type="attr" name="headerDayOfMonthTextAppearance" />
+ <public type="attr" name="headerYearTextAppearance" />
+ <public type="attr" name="yearListItemTextAppearance" />
+ <public type="attr" name="yearListSelectorColor" />
<public type="attr" name="calendarTextColor" />
<public type="attr" name="recognitionService" />
- <!-- For the TimePicker -->
<public type="attr" name="timePickerStyle" />
<public type="attr" name="timePickerDialogTheme" />
<public type="attr" name="headerTimeTextAppearance" />
<public type="attr" name="headerAmPmTextAppearance" />
- <public type="attr" name="headerSelectedTextColor" />
<public type="attr" name="headerBackgroundColor" />
<public type="attr" name="numbersTextColor" />
<public type="attr" name="numbersBackgroundColor" />
<public type="attr" name="numbersSelectorColor" />
<public type="attr" name="amPmTextColor" />
- <public type="attr" name="amPmUnselectedBackgroundColor" />
- <public type="attr" name="amPmSelectedBackgroundColor" />
+ <public type="attr" name="amPmBackgroundColor" />
<public type="attr" name="searchKeyphraseRecognitionFlags" />
<public type="attr" name="checkMarkTint" />
<public type="attr" name="checkMarkTintMode" />
<public type="attr" name="popupTheme" />
<public type="attr" name="toolbarStyle" />
<public type="attr" name="windowClipToOutline" />
+ <public type="attr" name="datePickerDialogTheme" />
<public-padding type="dimen" name="l_resource_pad" end="0x01050010" />
diff --git a/core/res/res/values/styles.xml b/core/res/res/values/styles.xml
index 2dccaf2..4a70952 100644
--- a/core/res/res/values/styles.xml
+++ b/core/res/res/values/styles.xml
@@ -573,7 +573,8 @@
</style>
<style name="Widget.DatePicker">
- <item name="legacyLayout">@android:layout/date_picker_legacy</item>
+ <item name="legacyMode">true</item>
+ <item name="legacyLayout">@layout/date_picker_legacy</item>
<item name="calendarViewShown">false</item>
</style>
@@ -947,9 +948,9 @@
</style>
<style name="PreferenceFragment">
- <item name="android:layout">@android:layout/preference_list_fragment</item>
- <item name="android:paddingStart">0dp</item>
- <item name="android:paddingEnd">0dp</item>
+ <item name="layout">@layout/preference_list_fragment</item>
+ <item name="paddingStart">0dp</item>
+ <item name="paddingEnd">0dp</item>
</style>
<style name="Preference.Information">
@@ -1333,9 +1334,6 @@
<item name="orientation">vertical</item>
</style>
- <style name="TextAppearance.TimePicker.TimeLabel" parent="TextAppearance" />
- <style name="TextAppearance.TimePicker.AmPmLabel" parent="TextAppearance" />
-
<style name="Widget.FastScroll">
<item name="thumbDrawable">?attr/fastScrollThumbDrawable</item>
<item name="trackDrawable">?attr/fastScrollTrackDrawable</item>
@@ -1359,22 +1357,4 @@
<item name="spotShadowAlpha">0.1765</item>
</style>
- <style name="TextAppearance.DatePicker.DayOfWeekLabel" parent="TextAppearance">
- </style>
-
- <style name="TextAppearance.DatePicker.Selector" parent="TextAppearance">
- </style>
-
- <style name="TextAppearance.DatePicker.Selector.MonthLabel" parent="TextAppearance.DatePicker.Selector">
- </style>
-
- <style name="TextAppearance.DatePicker.Selector.DayOfMonthLabel" parent="TextAppearance.DatePicker.Selector">
- </style>
-
- <style name="TextAppearance.DatePicker.Selector.YearLabel" parent="TextAppearance.DatePicker.Selector">
- </style>
-
- <style name="TextAppearance.DatePicker.List.YearLabel" parent="TextAppearance">
- </style>
-
</resources>
diff --git a/core/res/res/values/styles_device_defaults.xml b/core/res/res/values/styles_device_defaults.xml
index fb8d9f5..223578d 100644
--- a/core/res/res/values/styles_device_defaults.xml
+++ b/core/res/res/values/styles_device_defaults.xml
@@ -240,6 +240,10 @@
<!-- @deprecated Action bars are now themed using the inheritable android:theme attribute. -->
<style name="TextAppearance.DeviceDefault.Widget.ActionMode.Subtitle.Inverse" parent="TextAppearance.Material.Widget.ActionMode.Subtitle.Inverse"/>
<style name="TextAppearance.DeviceDefault.Widget.ActionBar.Menu" parent="TextAppearance.Material.Widget.ActionBar.Menu"/>
+ <style name="TextAppearance.DeviceDefault.DatePicker.DayOfWeekLabel" parent="TextAppearance.Material.DatePicker.DayOfWeekLabel"/>
+ <style name="TextAppearance.DeviceDefault.DatePicker.MonthLabel" parent="TextAppearance.Material.DatePicker.MonthLabel"/>
+ <style name="TextAppearance.DeviceDefault.DatePicker.DayOfMonthLabel" parent="TextAppearance.Material.DatePicker.DayOfMonthLabel"/>
+ <style name="TextAppearance.DeviceDefault.DatePicker.YearLabel" parent="TextAppearance.Material.DatePicker.YearLabel"/>
<!-- Preference Styles -->
<style name="Preference.DeviceDefault" parent="Preference.Material"/>
@@ -279,25 +283,4 @@
<style name="DeviceDefault.Light.ButtonBar.AlertDialog" parent="Widget.Material.Light.ButtonBar.AlertDialog"/>
<style name="DeviceDefault.Light.SegmentedButton" parent="Widget.Material.Light.SegmentedButton"/>
- <style name="Theme.DeviceDefault.Dialog.TimePicker" parent="Theme.Material.Dialog.TimePicker"/>
- <style name="Theme.DeviceDefault.Light.Dialog.TimePicker" parent="Theme.Material.Light.Dialog.TimePicker"/>
-
- <style name="TextAppearance.DeviceDefault.DatePicker.DayOfWeekLabel" parent="TextAppearance.Material.DatePicker.DayOfWeekLabel"/>
- <style name="TextAppearance.DeviceDefault.Light.DatePicker.DayOfWeekLabel" parent="TextAppearance.Material.Light.DatePicker.DayOfWeekLabel"/>
-
- <style name="TextAppearance.DeviceDefault.DatePicker.Selector" parent="TextAppearance.Material.DatePicker.Selector"/>
- <style name="TextAppearance.DeviceDefault.Light.DatePicker.Selector" parent="TextAppearance.Material.Light.DatePicker.Selector"/>
-
- <style name="TextAppearance.DeviceDefault.DatePicker.Selector.MonthLabel" parent="TextAppearance.Material.DatePicker.Selector.MonthLabel"/>
- <style name="TextAppearance.DeviceDefault.Light.DatePicker.Selector.MonthLabel" parent="TextAppearance.Material.Light.DatePicker.Selector.MonthLabel"/>
-
- <style name="TextAppearance.DeviceDefault.DatePicker.Selector.DayOfMonthLabel" parent="TextAppearance.Material.DatePicker.Selector.DayOfMonthLabel"/>
- <style name="TextAppearance.DeviceDefault.Light.DatePicker.Selector.DayOfMonthLabel" parent="TextAppearance.Material.Light.DatePicker.Selector.DayOfMonthLabel"/>
-
- <style name="TextAppearance.DeviceDefault.DatePicker.Selector.YearLabel" parent="TextAppearance.Material.DatePicker.Selector.YearLabel"/>
- <style name="TextAppearance.DeviceDefault.Light.DatePicker.Selector.YearLabel" parent="TextAppearance.Material.Light.DatePicker.Selector.YearLabel"/>
-
- <style name="Theme.DeviceDefault.Dialog.DatePicker" parent="Theme.Material.Dialog.DatePicker"/>
- <style name="Theme.DeviceDefault.Light.Dialog.DatePicker" parent="Theme.Material.Light.Dialog.DatePicker"/>
-
</resources>
diff --git a/core/res/res/values/styles_holo.xml b/core/res/res/values/styles_holo.xml
index bf5fd29..d79e46d 100644
--- a/core/res/res/values/styles_holo.xml
+++ b/core/res/res/values/styles_holo.xml
@@ -473,24 +473,28 @@
<item name="numbersTextColor">@color/timepicker_default_text_color_holo_dark</item>
<item name="numbersBackgroundColor">@color/timepicker_default_background_holo_dark</item>
<item name="amPmTextColor">@color/timepicker_default_text_color_holo_dark</item>
- <item name="amPmUnselectedBackgroundColor">@color/timepicker_default_background_holo_dark</item>
+ <item name="amPmBackgroundColor">@color/timepicker_default_background_holo_dark</item>
<item name="amPmSelectedBackgroundColor">@color/holo_blue_light</item>
<item name="numbersSelectorColor">@color/holo_blue_light</item>
</style>
<style name="Widget.Holo.DatePicker" parent="Widget.DatePicker">
+ <item name="legacyMode">true</item>
<item name="legacyLayout">@layout/date_picker_legacy_holo</item>
<item name="internalLayout">@layout/date_picker_holo</item>
<item name="calendarViewShown">true</item>
- <item name="dateSelectorDayOfWeekBackgroundColor">?attr/datePickerHeaderDayOfWeekLabelBackgroundColor</item>
- <item name="dateSelectorDayOfWeekTextAppearance">?attr/datePickerHeaderDayOfWeekLabelTextAppearance</item>
- <item name="dateSelectorBackgroundColor">?attr/datePickerHeaderSelectorBackgroundColor</item>
- <item name="dateSelectorMonthTextAppearance">?attr/datePickerHeaderSelectorMonthLabelTextAppearance</item>
- <item name="dateSelectorDayOfMonthTextAppearance">?attr/datePickerHeaderSelectorDayOfMonthLabelTextAppearance</item>
- <item name="dateSelectorYearTextAppearance">?attr/datePickerHeaderSelectorYearLabelTextAppearance</item>
- <item name="dateSelectorYearListItemTextAppearance">?attr/datePickerHeaderListYearLabelTextAppearance</item>
- <item name="dateSelectorYearListSelectedCircleColor">?attr/datePickerHeaderListYearLabelCircleBackgroundColor</item>
+ <!-- New-style date picker attributes. -->
+ <item name="dayOfWeekBackgroundColor">@color/datepicker_default_header_dayofweek_background_color_holo_dark</item>
+ <item name="dayOfWeekTextAppearance">@style/TextAppearance.Holo.DatePicker.DayOfWeekLabel</item>
+ <item name="headerBackgroundColor">@color/datepicker_default_header_selector_background_holo_dark</item>
+ <item name="headerMonthTextAppearance">@style/TextAppearance.Holo.DatePicker.Selector.MonthLabel</item>
+ <item name="headerDayOfMonthTextAppearance">@style/TextAppearance.Holo.DatePicker.Selector.DayOfMonthLabel</item>
+ <item name="headerYearTextAppearance">@style/TextAppearance.Holo.DatePicker.Selector.YearLabel</item>
+ <item name="headerSelectedTextColor">@color/holo_blue_light</item>
+ <item name="yearListItemTextAppearance">@style/TextAppearance.Holo.DatePicker.List.YearLabel</item>
+ <item name="yearListSelectorColor">@color/datepicker_default_circle_background_color_holo_dark</item>
<item name="calendarTextColor">@color/date_picker_calendar_holo_dark</item>
+ <item name="calendarSelectedTextColor">@color/holo_blue_light</item>
</style>
<style name="Widget.Holo.ActivityChooserView" parent="Widget.ActivityChooserView" />
@@ -893,24 +897,28 @@
<item name="numbersTextColor">@color/timepicker_default_text_color_holo_light</item>
<item name="numbersBackgroundColor">@color/timepicker_default_background_holo_light</item>
<item name="amPmTextColor">@color/timepicker_default_text_color_holo_light</item>
- <item name="amPmUnselectedBackgroundColor">@color/timepicker_default_background_holo_light</item>
+ <item name="amPmBackgroundColor">@color/timepicker_default_background_holo_light</item>
<item name="amPmSelectedBackgroundColor">@color/holo_blue_light</item>
<item name="numbersSelectorColor">@color/holo_blue_light</item>
</style>
<style name="Widget.Holo.Light.DatePicker" parent="Widget.DatePicker">
+ <item name="legacyMode">true</item>
<item name="legacyLayout">@layout/date_picker_legacy_holo</item>
<item name="internalLayout">@layout/date_picker_holo</item>
<item name="calendarViewShown">true</item>
- <item name="dateSelectorDayOfWeekBackgroundColor">?attr/datePickerHeaderDayOfWeekLabelBackgroundColor</item>
- <item name="dateSelectorDayOfWeekTextAppearance">?attr/datePickerHeaderDayOfWeekLabelTextAppearance</item>
- <item name="dateSelectorBackgroundColor">?attr/datePickerHeaderSelectorBackgroundColor</item>
- <item name="dateSelectorMonthTextAppearance">?attr/datePickerHeaderSelectorMonthLabelTextAppearance</item>
- <item name="dateSelectorDayOfMonthTextAppearance">?attr/datePickerHeaderSelectorDayOfMonthLabelTextAppearance</item>
- <item name="dateSelectorYearTextAppearance">?attr/datePickerHeaderSelectorYearLabelTextAppearance</item>
- <item name="dateSelectorYearListItemTextAppearance">?attr/datePickerHeaderListYearLabelTextAppearance</item>
- <item name="dateSelectorYearListSelectedCircleColor">?attr/datePickerHeaderListYearLabelCircleBackgroundColor</item>
+ <!-- New-style date picker attributes. -->
+ <item name="dayOfWeekBackgroundColor">@color/datepicker_default_header_dayofweek_background_color_holo_light</item>
+ <item name="dayOfWeekTextAppearance">@style/TextAppearance.Holo.Light.DatePicker.DayOfWeekLabel</item>
+ <item name="headerMonthTextAppearance">@style/TextAppearance.Holo.Light.DatePicker.Selector.MonthLabel</item>
+ <item name="headerDayOfMonthTextAppearance">@style/TextAppearance.Holo.Light.DatePicker.Selector.DayOfMonthLabel</item>
+ <item name="headerYearTextAppearance">@style/TextAppearance.Holo.Light.DatePicker.Selector.YearLabel</item>
+ <item name="headerBackgroundColor">@color/datepicker_default_header_selector_background_holo_light</item>
+ <item name="headerSelectedTextColor">@color/holo_blue_light</item>
+ <item name="yearListItemTextAppearance">@style/TextAppearance.Holo.Light.DatePicker.List.YearLabel</item>
+ <item name="yearListSelectorColor">@color/datepicker_default_circle_background_color_holo_light</item>
<item name="calendarTextColor">@color/date_picker_calendar_holo_light</item>
+ <item name="calendarSelectedTextColor">@color/holo_blue_light</item>
</style>
<style name="Widget.Holo.Light.ActivityChooserView" parent="Widget.Holo.ActivityChooserView">
diff --git a/core/res/res/values/styles_leanback.xml b/core/res/res/values/styles_leanback.xml
index b0f5864..a899c4d 100644
--- a/core/res/res/values/styles_leanback.xml
+++ b/core/res/res/values/styles_leanback.xml
@@ -27,6 +27,10 @@
<item name="legacyLayout">@layout/time_picker_legacy_leanback</item>
</style>
+ <style name="Widget.Leanback.DatePicker" parent="Widget.Material.DatePicker">
+ <item name="legacyMode">true</item>
+ </style>
+
<style name="Widget.Leanback.NumberPicker" parent="Widget.Material.NumberPicker">
<item name="hideWheelUntilFocused">true</item>
</style>
diff --git a/core/res/res/values/styles_material.xml b/core/res/res/values/styles_material.xml
index a8974c6..61dff1b 100644
--- a/core/res/res/values/styles_material.xml
+++ b/core/res/res/values/styles_material.xml
@@ -355,57 +355,30 @@
<style name="TextAppearance.Material.DatePicker.DayOfWeekLabel" parent="TextAppearance.Material">
<item name="includeFontPadding">false</item>
- <item name="textColor">@color/black</item>
+ <item name="textColor">?attr/textColorPrimary</item>
<item name="textSize">@dimen/datepicker_header_text_size</item>
</style>
- <style name="TextAppearance.Material.DatePicker.Selector" parent="TextAppearance.Material">
+ <style name="TextAppearance.Material.DatePicker.MonthLabel" parent="TextAppearance.Material">
<item name="includeFontPadding">false</item>
- <item name="textColor">@color/date_picker_selector_material_dark</item>
- </style>
-
- <style name="TextAppearance.Material.DatePicker.Selector.MonthLabel" parent="TextAppearance.Material.DatePicker.Selector">
+ <item name="textColor">?attr/textColorPrimary</item> <!-- selected should be accent -->
<item name="textSize">@dimen/datepicker_selected_date_month_size</item>
</style>
- <style name="TextAppearance.Material.DatePicker.Selector.DayOfMonthLabel" parent="TextAppearance.Material.DatePicker.Selector">
+ <style name="TextAppearance.Material.DatePicker.DayOfMonthLabel" parent="TextAppearance.Material">
+ <item name="includeFontPadding">false</item>
+ <item name="textColor">?attr/textColorPrimary</item> <!-- selected should be accent -->
<item name="textSize">@dimen/datepicker_selected_date_day_size</item>
</style>
- <style name="TextAppearance.Material.DatePicker.Selector.YearLabel" parent="TextAppearance.Material.DatePicker.Selector">
+ <style name="TextAppearance.Material.DatePicker.YearLabel" parent="TextAppearance.Material">
+ <item name="includeFontPadding">false</item>
+ <item name="textColor">?attr/textColorPrimary</item> <!-- selected should be accent -->
<item name="textSize">@dimen/datepicker_selected_date_year_size</item>
</style>
<style name="TextAppearance.Material.DatePicker.List.YearLabel" parent="TextAppearance.Material">
- <item name="textColor">@color/date_picker_year_selector_material_dark</item>
- <item name="textSize">@dimen/datepicker_year_label_text_size</item>
- </style>
-
- <style name="TextAppearance.Material.Light.DatePicker.DayOfWeekLabel" parent="TextAppearance.Material">
- <item name="includeFontPadding">false</item>
- <item name="textColor">@color/white</item>
- <item name="textSize">@dimen/datepicker_header_text_size</item>
- </style>
-
- <style name="TextAppearance.Material.Light.DatePicker.Selector" parent="TextAppearance.Material">
- <item name="includeFontPadding">false</item>
- <item name="textColor">@color/date_picker_selector_material_light</item>
- </style>
-
- <style name="TextAppearance.Material.Light.DatePicker.Selector.MonthLabel" parent="TextAppearance.Material.Light.DatePicker.Selector">
- <item name="textSize">@dimen/datepicker_selected_date_month_size</item>
- </style>
-
- <style name="TextAppearance.Material.Light.DatePicker.Selector.DayOfMonthLabel" parent="TextAppearance.Material.Light.DatePicker.Selector">
- <item name="textSize">@dimen/datepicker_selected_date_day_size</item>
- </style>
-
- <style name="TextAppearance.Material.Light.DatePicker.Selector.YearLabel" parent="TextAppearance.Material.Light.DatePicker.Selector">
- <item name="textSize">@dimen/datepicker_selected_date_year_size</item>
- </style>
-
- <style name="TextAppearance.Material.Light.DatePicker.List.YearLabel" parent="TextAppearance.Material">
- <item name="textColor">@color/date_picker_year_selector_material_light</item>
+ <item name="textColor">?attr/textColorSecondary</item> <!-- selected should be accent -->
<item name="textSize">@dimen/datepicker_year_label_text_size</item>
</style>
@@ -618,6 +591,8 @@
<style name="Widget.Material.TimePicker" parent="Widget.TimePicker">
<item name="legacyMode">false</item>
+ <item name="legacyLayout">@layout/time_picker_legacy_holo</item>
+ <!-- Attributes for new-style TimePicker. -->
<item name="internalLayout">@layout/time_picker_holo</item>
<item name="headerTimeTextAppearance">@style/TextAppearance.Material.TimePicker.TimeLabel</item>
<item name="headerAmPmTextAppearance">@style/TextAppearance.Material.TimePicker.AmPmLabel</item>
@@ -626,24 +601,28 @@
<item name="numbersTextColor">?attr/textColorSecondary</item>
<item name="numbersBackgroundColor">@color/transparent</item>
<item name="amPmTextColor">?attr/textColorSecondary</item>
- <item name="amPmUnselectedBackgroundColor">@color/transparent</item>
+ <item name="amPmBackgroundColor">@color/transparent</item>
<item name="amPmSelectedBackgroundColor">?attr/colorControlActivated</item>
<item name="numbersSelectorColor">?attr/colorControlActivated</item>
</style>
<style name="Widget.Material.DatePicker" parent="Widget.DatePicker">
+ <item name="legacyMode">false</item>
<item name="legacyLayout">@layout/date_picker_legacy_holo</item>
+ <!-- Attributes for new-style DatePicker. -->
<item name="internalLayout">@layout/date_picker_holo</item>
<item name="calendarViewShown">true</item>
- <item name="dateSelectorDayOfWeekBackgroundColor">?attr/datePickerHeaderDayOfWeekLabelBackgroundColor</item>
- <item name="dateSelectorDayOfWeekTextAppearance">?attr/datePickerHeaderDayOfWeekLabelTextAppearance</item>
- <item name="dateSelectorBackgroundColor">?attr/datePickerHeaderSelectorBackgroundColor</item>
- <item name="dateSelectorMonthTextAppearance">?attr/datePickerHeaderSelectorMonthLabelTextAppearance</item>
- <item name="dateSelectorDayOfMonthTextAppearance">?attr/datePickerHeaderSelectorDayOfMonthLabelTextAppearance</item>
- <item name="dateSelectorYearTextAppearance">?attr/datePickerHeaderSelectorYearLabelTextAppearance</item>
- <item name="dateSelectorYearListItemTextAppearance">?attr/datePickerHeaderListYearLabelTextAppearance</item>
- <item name="dateSelectorYearListSelectedCircleColor">?attr/datePickerHeaderListYearLabelCircleBackgroundColor</item>
- <item name="calendarTextColor">@color/date_picker_calendar_holo_dark</item>
+ <item name="dayOfWeekBackgroundColor">@color/transparent</item>
+ <item name="dayOfWeekTextAppearance">@style/TextAppearance.Material.DatePicker.DayOfWeekLabel</item>
+ <item name="headerMonthTextAppearance">@style/TextAppearance.Material.DatePicker.MonthLabel</item>
+ <item name="headerDayOfMonthTextAppearance">@style/TextAppearance.Material.DatePicker.DayOfMonthLabel</item>
+ <item name="headerYearTextAppearance">@style/TextAppearance.Material.DatePicker.YearLabel</item>
+ <item name="headerSelectedTextColor">?attr/colorControlActivated</item>
+ <item name="headerBackgroundColor">@color/transparent</item>
+ <item name="yearListItemTextAppearance">@style/TextAppearance.Material.DatePicker.List.YearLabel</item>
+ <item name="yearListSelectorColor">?attr/colorControlActivated</item>
+ <item name="calendarTextColor">?attr/textColorSecondary</item>
+ <item name="calendarSelectedTextColor">?attr/colorControlActivated</item>
</style>
<style name="Widget.Material.ActivityChooserView" parent="Widget.ActivityChooserView">
@@ -961,22 +940,7 @@
<style name="Widget.Material.Light.NumberPicker" parent="Widget.Material.NumberPicker"/>
<style name="Widget.Material.Light.TimePicker" parent="Widget.Material.TimePicker" />
-
- <style name="Widget.Material.Light.DatePicker" parent="Widget.DatePicker">
- <item name="legacyLayout">@layout/date_picker_legacy_holo</item>
- <item name="internalLayout">@layout/date_picker_holo</item>
- <item name="calendarViewShown">true</item>
- <item name="dateSelectorDayOfWeekBackgroundColor">?attr/datePickerHeaderDayOfWeekLabelBackgroundColor</item>
- <item name="dateSelectorDayOfWeekTextAppearance">?attr/datePickerHeaderDayOfWeekLabelTextAppearance</item>
- <item name="dateSelectorBackgroundColor">?attr/datePickerHeaderSelectorBackgroundColor</item>
- <item name="dateSelectorMonthTextAppearance">?attr/datePickerHeaderSelectorMonthLabelTextAppearance</item>
- <item name="dateSelectorDayOfMonthTextAppearance">?attr/datePickerHeaderSelectorDayOfMonthLabelTextAppearance</item>
- <item name="dateSelectorYearTextAppearance">?attr/datePickerHeaderSelectorYearLabelTextAppearance</item>
- <item name="dateSelectorYearListItemTextAppearance">?attr/datePickerHeaderListYearLabelTextAppearance</item>
- <item name="dateSelectorYearListSelectedCircleColor">?attr/datePickerHeaderListYearLabelCircleBackgroundColor</item>
- <item name="calendarTextColor">@color/date_picker_calendar_holo_light</item>
- </style>
-
+ <style name="Widget.Material.Light.DatePicker" parent="Widget.Material.DatePicker" />
<style name="Widget.Material.Light.ActivityChooserView" parent="Widget.Material.ActivityChooserView" />
<style name="Widget.Material.Light.ImageWell" parent="Widget.Material.ImageWell"/>
<style name="Widget.Material.Light.ListView" parent="Widget.Material.ListView"/>
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 37dc046..723da4c 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -1844,20 +1844,7 @@
<java-symbol type="dimen" name="subtitle_shadow_offset" />
<java-symbol type="dimen" name="subtitle_outline_width" />
- <!-- From the new TimePicker and DatePicker -->
- <java-symbol type="attr" name="timePickerDialogTheme" />
- <java-symbol type="attr" name="headerSelectedTextColor" />
- <java-symbol type="attr" name="numbersTextColor" />
- <java-symbol type="attr" name="numbersBackgroundColor" />
- <java-symbol type="attr" name="amPmTextColor" />
- <java-symbol type="attr" name="amPmUnselectedBackgroundColor" />
- <java-symbol type="attr" name="amPmSelectedBackgroundColor" />
- <java-symbol type="attr" name="numbersSelectorColor" />
<java-symbol type="attr" name="nestedScrollingEnabled" />
- <java-symbol type="attr" name="datePickerDialogTheme" />
- <java-symbol type="attr" name="datePickerHeaderSelectorBackgroundColor" />
- <java-symbol type="attr" name="datePickerHeaderListYearLabelCircleBackgroundColor" />
- <java-symbol type="attr" name="calendarTextColor" />
<java-symbol type="style" name="TextAppearance.Holo.TimePicker.TimeLabel" />
@@ -1941,7 +1928,6 @@
<java-symbol type="array" name="config_calendarDateVibePattern" />
<!-- From various Material changes -->
- <java-symbol type="attr" name="toolbarStyle" />
<java-symbol type="attr" name="titleTextAppearance" />
<java-symbol type="attr" name="subtitleTextAppearance" />
<java-symbol type="attr" name="windowActionBarFullscreenDecorLayout" />
@@ -1975,6 +1961,7 @@
<java-symbol type="attr" name="lightRadius" />
<java-symbol type="attr" name="ambientShadowAlpha" />
<java-symbol type="attr" name="spotShadowAlpha" />
-
<java-symbol type="array" name="config_cdma_home_system" />
+ <java-symbol type="attr" name="headerSelectedTextColor" />
+ <java-symbol type="attr" name="amPmSelectedBackgroundColor" />
</resources>
diff --git a/core/res/res/values/themes.xml b/core/res/res/values/themes.xml
index aea72c1..b36cdb9 100644
--- a/core/res/res/values/themes.xml
+++ b/core/res/res/values/themes.xml
@@ -396,39 +396,15 @@
<item name="timePickerStyle">@style/Widget.TimePicker</item>
<!-- TimePicker dialog theme -->
- <item name="timePickerDialogTheme">@style/Theme.Dialog.TimePicker</item>
+ <item name="timePickerDialogTheme">?attr/alertDialogTheme</item>
<!-- DatePicker style -->
<item name="datePickerStyle">@style/Widget.DatePicker</item>
- <!-- DatePicker Header day of week label background color -->
- <item name="datePickerHeaderDayOfWeekLabelBackgroundColor">@android:color/darker_gray</item>
-
- <!-- DatePicker Header day of week label text appearance -->
- <item name="datePickerHeaderDayOfWeekLabelTextAppearance">@style/TextAppearance.DatePicker.DayOfWeekLabel</item>
-
- <!-- DatePicker Header selector background color -->
- <item name="datePickerHeaderSelectorBackgroundColor">@android:color/darker_gray</item>
-
- <!-- DatePicker Header selector month label text appearance -->
- <item name="datePickerHeaderSelectorMonthLabelTextAppearance">@style/TextAppearance.DatePicker.Selector.MonthLabel</item>
-
- <!-- DatePicker Header selector day of month label text appearance -->
- <item name="datePickerHeaderSelectorDayOfMonthLabelTextAppearance">@style/TextAppearance.DatePicker.Selector.DayOfMonthLabel</item>
-
- <!-- DatePicker Header selector year label text appearance -->
- <item name="datePickerHeaderSelectorYearLabelTextAppearance">@style/TextAppearance.DatePicker.Selector.YearLabel</item>
-
- <!-- DatePicker list year label text appearance -->
- <item name="datePickerHeaderListYearLabelTextAppearance">@style/TextAppearance.DatePicker.List.YearLabel</item>
-
- <!-- DatePicker list year label circle background color -->
- <item name="datePickerHeaderListYearLabelCircleBackgroundColor">@android:color/darker_gray</item>
-
<!-- DatePicker dialog theme -->
- <item name="datePickerDialogTheme">@android:style/Theme.Dialog.DatePicker</item>
+ <item name="datePickerDialogTheme">?attr/alertDialogTheme</item>
- <item name="fastScrollThumbDrawable">@android:drawable/scrollbar_handle_accelerated_anim2</item>
+ <item name="fastScrollThumbDrawable">@drawable/scrollbar_handle_accelerated_anim2</item>
<item name="fastScrollTrackDrawable">@null</item>
<item name="fastScrollPreviewBackgroundRight">@drawable/menu_submenu_background</item>
<item name="fastScrollPreviewBackgroundLeft">@drawable/menu_submenu_background</item>
@@ -744,22 +720,6 @@
<item name="textAppearanceListItemSecondary">@style/TextAppearance.Small.Inverse</item>
</style>
- <!-- Default heme for the TimePicker dialog windows, which is used by the
- {@link android.app.TimePickerDialog} class. -->
- <style name="Theme.Dialog.TimePicker">
- <item name="windowBackground">@color/transparent</item>
- <item name="windowTitleStyle">@style/DialogWindowTitle</item>
- <item name="windowContentOverlay">@null</item>
- </style>
-
- <!-- Default heme for the DatePicker dialog windows, which is used by the
- {@link android.app.DatePickerDialog} class. -->
- <style name="Theme.Dialog.DatePicker">
- <item name="windowBackground">@android:color/transparent</item>
- <item name="windowTitleStyle">@android:style/DialogWindowTitle</item>
- <item name="windowContentOverlay">@null</item>
- </style>
-
<!-- Default dark theme for panel windows (on API level 10 and lower). This removes all
extraneous window decorations, so you basically have an empty rectangle in which
to place your content. It makes the window floating, with a transparent
diff --git a/core/res/res/values/themes_device_defaults.xml b/core/res/res/values/themes_device_defaults.xml
index 43381d6..36d7116 100644
--- a/core/res/res/values/themes_device_defaults.xml
+++ b/core/res/res/values/themes_device_defaults.xml
@@ -195,27 +195,9 @@
<!-- TimePicker style -->
<item name="timePickerStyle">@style/Widget.DeviceDefault.TimePicker</item>
- <!-- TimePicker dialog theme -->
- <item name="timePickerDialogTheme">@style/Theme.DeviceDefault.Dialog.TimePicker</item>
-
<!-- DatePicker style -->
<item name="datePickerStyle">@style/Widget.DeviceDefault.DatePicker</item>
- <!-- The DatePicker Header day of week label text appearance -->
- <item name="datePickerHeaderDayOfWeekLabelTextAppearance">@style/TextAppearance.DeviceDefault.DatePicker.DayOfWeekLabel</item>
-
- <!-- The DatePicker Header selector month label text appearance -->
- <item name="datePickerHeaderSelectorMonthLabelTextAppearance">@style/TextAppearance.DeviceDefault.DatePicker.Selector.MonthLabel</item>
-
- <!-- The DatePicker Header selector day of month label text appearance -->
- <item name="datePickerHeaderSelectorDayOfMonthLabelTextAppearance">@style/TextAppearance.DeviceDefault.DatePicker.Selector.DayOfMonthLabel</item>
-
- <!-- The DatePicker Header selector year label text appearance -->
- <item name="datePickerHeaderSelectorYearLabelTextAppearance">@style/TextAppearance.DeviceDefault.DatePicker.Selector.YearLabel</item>
-
- <!-- DatePicker dialog theme -->
- <item name="datePickerDialogTheme">@android:style/Theme.DeviceDefault.Dialog.DatePicker</item>
-
<item name="mediaRouteButtonStyle">@style/Widget.DeviceDefault.MediaRouteButton</item>
</style>
@@ -291,8 +273,6 @@
<!-- DeviceDefault theme for a presentation window on a secondary display. -->
<style name="Theme.DeviceDefault.Dialog.Presentation" parent="Theme.Material.Dialog.Presentation" />
- <style name="Theme.DeviceDefault.Dialog.TimePicker" parent="Theme.Material.Dialog.TimePicker"/>
-
<!-- DeviceDefault theme for panel windows. This removes all extraneous window
decorations, so you basically have an empty rectangle in which to place your content. It makes
the window floating, with a transparent background, and turns off dimming behind the window. -->
@@ -464,27 +444,9 @@
<!-- TimePicker style -->
<item name="timePickerStyle">@style/Widget.DeviceDefault.Light.TimePicker</item>
- <!-- TimePicker dialog theme -->
- <item name="timePickerDialogTheme">@style/Theme.DeviceDefault.Light.Dialog.TimePicker</item>
-
<!-- DatePicker style -->
<item name="datePickerStyle">@style/Widget.DeviceDefault.Light.DatePicker</item>
- <!-- The DatePicker Header day of week label text appearance -->
- <item name="datePickerHeaderDayOfWeekLabelTextAppearance">@style/TextAppearance.DeviceDefault.Light.DatePicker.DayOfWeekLabel</item>
-
- <!-- The DatePicker Header selector month label text appearance -->
- <item name="datePickerHeaderSelectorMonthLabelTextAppearance">@style/TextAppearance.DeviceDefault.Light.DatePicker.Selector.MonthLabel</item>
-
- <!-- The DatePicker Header selector day of month label text appearance -->
- <item name="datePickerHeaderSelectorDayOfMonthLabelTextAppearance">@style/TextAppearance.DeviceDefault.Light.DatePicker.Selector.DayOfMonthLabel</item>
-
- <!-- The DatePicker Header selector year label text appearance -->
- <item name="datePickerHeaderSelectorYearLabelTextAppearance">@style/TextAppearance.DeviceDefault.Light.DatePicker.Selector.YearLabel</item>
-
- <!-- DatePicker dialog theme -->
- <item name="datePickerDialogTheme">@android:style/Theme.DeviceDefault.Light.Dialog.DatePicker</item>
-
<item name="mediaRouteButtonStyle">@style/Widget.DeviceDefault.Light.MediaRouteButton</item>
</style>
@@ -564,8 +526,6 @@
<!-- DeviceDefault light theme for a presentation window on a secondary display. -->
<style name="Theme.DeviceDefault.Light.Dialog.Presentation" parent="Theme.Material.Light.Dialog.Presentation" />
- <style name="Theme.DeviceDefault.Light.Dialog.TimePicker" parent="Theme.Material.Light.Dialog.TimePicker"/>
-
<!-- DeviceDefault light theme for panel windows. This removes all extraneous window
decorations, so you basically have an empty rectangle in which to place your content. It makes
the window floating, with a transparent background, and turns off dimming behind the window. -->
diff --git a/core/res/res/values/themes_holo.xml b/core/res/res/values/themes_holo.xml
index f6c6b4c..14853b8 100644
--- a/core/res/res/values/themes_holo.xml
+++ b/core/res/res/values/themes_holo.xml
@@ -375,37 +375,13 @@
<item name="timePickerStyle">@style/Widget.Holo.TimePicker</item>
<!-- TimePicker dialog theme -->
- <item name="timePickerDialogTheme">@style/Theme.Holo.Dialog.TimePicker</item>
+ <item name="timePickerDialogTheme">?attr/alertDialogTheme</item>
<!-- DatePicker style -->
<item name="datePickerStyle">@style/Widget.Holo.DatePicker</item>
- <!-- DatePicker Header day of week label background color -->
- <item name="datePickerHeaderDayOfWeekLabelBackgroundColor">@android:color/datepicker_default_header_dayofweek_background_color_holo_dark</item>
-
- <!-- DatePicker Header day of week label text appearance -->
- <item name="datePickerHeaderDayOfWeekLabelTextAppearance">@style/TextAppearance.Holo.DatePicker.DayOfWeekLabel</item>
-
- <!-- DatePicker Header selector background color -->
- <item name="datePickerHeaderSelectorBackgroundColor">@android:color/datepicker_default_header_selector_background_holo_dark</item>
-
- <!-- DatePicker Header selector month label text appearance -->
- <item name="datePickerHeaderSelectorMonthLabelTextAppearance">@style/TextAppearance.Holo.DatePicker.Selector.MonthLabel</item>
-
- <!-- DatePicker Header selector day of month label text appearance -->
- <item name="datePickerHeaderSelectorDayOfMonthLabelTextAppearance">@style/TextAppearance.Holo.DatePicker.Selector.DayOfMonthLabel</item>
-
- <!-- DatePicker Header selector year label text appearance -->
- <item name="datePickerHeaderSelectorYearLabelTextAppearance">@style/TextAppearance.Holo.DatePicker.Selector.YearLabel</item>
-
- <!-- DatePicker list year label text appearance -->
- <item name="datePickerHeaderListYearLabelTextAppearance">@style/TextAppearance.Holo.DatePicker.List.YearLabel</item>
-
- <!-- DatePicker list year label circle background color -->
- <item name="datePickerHeaderListYearLabelCircleBackgroundColor">@android:color/datepicker_default_circle_background_color_holo_dark</item>
-
<!-- DatePicker dialog theme -->
- <item name="datePickerDialogTheme">@android:style/Theme.Holo.Dialog.DatePicker</item>
+ <item name="datePickerDialogTheme">?attr/alertDialogTheme</item>
<item name="fastScrollThumbDrawable">@drawable/fastscroll_thumb_holo</item>
<item name="fastScrollPreviewBackgroundLeft">@drawable/fastscroll_label_left_holo_dark</item>
@@ -732,37 +708,13 @@
<item name="timePickerStyle">@style/Widget.Holo.Light.TimePicker</item>
<!-- TimePicker dialog theme -->
- <item name="timePickerDialogTheme">@style/Theme.Holo.Light.Dialog.TimePicker</item>
+ <item name="timePickerDialogTheme">?attr/alertDialogTheme</item>
<!-- DatePicker style -->
<item name="datePickerStyle">@style/Widget.Holo.Light.DatePicker</item>
- <!-- DatePicker Header day of week label background color -->
- <item name="datePickerHeaderDayOfWeekLabelBackgroundColor">@android:color/datepicker_default_header_dayofweek_background_color_holo_light</item>
-
- <!-- DatePicker Header day of week label text appearance -->
- <item name="datePickerHeaderDayOfWeekLabelTextAppearance">@style/TextAppearance.Holo.Light.DatePicker.DayOfWeekLabel</item>
-
- <!-- DatePicker Header selector background color -->
- <item name="datePickerHeaderSelectorBackgroundColor">@android:color/datepicker_default_header_selector_background_holo_light</item>
-
- <!-- DatePicker Header selector month label text appearance -->
- <item name="datePickerHeaderSelectorMonthLabelTextAppearance">@style/TextAppearance.Holo.Light.DatePicker.Selector.MonthLabel</item>
-
- <!-- DatePicker Header selector day of month label text appearance -->
- <item name="datePickerHeaderSelectorDayOfMonthLabelTextAppearance">@style/TextAppearance.Holo.Light.DatePicker.Selector.DayOfMonthLabel</item>
-
- <!-- DatePicker Header selector year label text appearance -->
- <item name="datePickerHeaderSelectorYearLabelTextAppearance">@style/TextAppearance.Holo.Light.DatePicker.Selector.YearLabel</item>
-
- <!-- DatePicker list year label text appearance -->
- <item name="datePickerHeaderListYearLabelTextAppearance">@style/TextAppearance.Holo.Light.DatePicker.List.YearLabel</item>
-
- <!-- DatePicker list year label circle background color -->
- <item name="datePickerHeaderListYearLabelCircleBackgroundColor">@android:color/datepicker_default_circle_background_color_holo_light</item>
-
<!-- DatePicker dialog theme -->
- <item name="datePickerDialogTheme">@android:style/Theme.Holo.Light.Dialog.DatePicker</item>
+ <item name="datePickerDialogTheme">?attr/alertDialogTheme</item>
<item name="fastScrollThumbDrawable">@drawable/fastscroll_thumb_holo</item>
<item name="fastScrollPreviewBackgroundLeft">@drawable/fastscroll_label_left_holo_light</item>
@@ -976,18 +928,6 @@
AlertDialog theme. -->
<style name="Theme.Holo.Dialog.Alert" parent="Theme.Holo.Dialog.BaseAlert" />
- <!-- Holo theme for the TimePicker dialog windows, which is used by the
- {@link android.app.TimePickerDialog} class. -->
- <style name="Theme.Holo.Dialog.TimePicker" parent="Theme.Holo.Dialog.Alert" />
-
- <!-- Holo theme for the DatePicker dialog windows, which is used by the
- {@link android.app.DatePickerDialog} class. -->
- <style name="Theme.Holo.Dialog.DatePicker">
- <item name="windowBackground">@color/transparent</item>
- <item name="windowTitleStyle">@style/DialogWindowTitle.Holo</item>
- <item name="windowContentOverlay">@null</item>
- </style>
-
<!-- Theme for a window that will be displayed either full-screen on
smaller screens (small, normal) or as a dialog on larger screens
(large, xlarge). -->
@@ -1099,18 +1039,6 @@
AlertDialog theme. -->
<style name="Theme.Holo.Light.Dialog.Alert" parent="Theme.Holo.Light.Dialog.BaseAlert" />
- <!-- Holo Light theme for the TimePicker dialog windows, which is used by the
- {@link android.app.TimePickerDialog} class. -->
- <style name="Theme.Holo.Light.Dialog.TimePicker" parent="Theme.Holo.Light.Dialog.Alert" />
-
- <!-- Holo Light theme for the DatePicker dialog windows, which is used by the
- {@link android.app.DatePickerDialog} class. -->
- <style name="Theme.Holo.Light.Dialog.DatePicker">
- <item name="windowBackground">@android:color/transparent</item>
- <item name="windowTitleStyle">@android:style/DialogWindowTitle.Holo.Light</item>
- <item name="windowContentOverlay">@null</item>
- </style>
-
<!-- Theme for a presentation window on a secondary display. -->
<style name="Theme.Holo.Light.Dialog.Presentation" parent="Theme.Holo.Light.NoActionBar.Fullscreen" />
diff --git a/core/res/res/values/themes_leanback.xml b/core/res/res/values/themes_leanback.xml
index 534e323..321b827 100644
--- a/core/res/res/values/themes_leanback.xml
+++ b/core/res/res/values/themes_leanback.xml
@@ -19,27 +19,11 @@
<item name="textColorPrimary">@color/primary_text_leanback_dark</item>
<item name="textColorSecondary">@color/secondary_text_leanback_dark</item>
<item name="alertDialogStyle">@style/AlertDialog.Leanback</item>
- <item name="numberPickerStyle">@style/Widget.Leanback.NumberPicker</item>
- </style>
-
- <style name="Theme.Leanback.Light.Dialog.Alert" parent="Theme.Material.Light.Dialog.BaseAlert">
- <item name="colorBackground">@color/background_leanback_light</item>
- <item name="textColorPrimary">@color/primary_text_leanback_light</item>
- <item name="textColorSecondary">@color/secondary_text_leanback_light</item>
- <item name="alertDialogStyle">@style/AlertDialog.Leanback.Light</item>
- <item name="numberPickerStyle">@style/Widget.Leanback.NumberPicker</item>
- </style>
-
- <style name="Theme.Leanback.Dialog.TimePicker" parent="Theme.Material.Dialog.BaseTimePicker">
- <item name="colorBackground">@color/background_leanback_dark</item>
- <item name="textColorPrimary">@color/primary_text_leanback_dark</item>
- <item name="textColorSecondary">@color/secondary_text_leanback_dark</item>
- <item name="alertDialogStyle">@style/AlertDialog.Leanback</item>
<item name="timePickerStyle">@style/Widget.Leanback.TimePicker</item>
<item name="numberPickerStyle">@style/Widget.Leanback.NumberPicker</item>
</style>
- <style name="Theme.Leanback.Light.Dialog.TimePicker" parent="Theme.Material.Light.Dialog.BaseTimePicker">
+ <style name="Theme.Leanback.Light.Dialog.Alert" parent="Theme.Material.Light.Dialog.BaseAlert">
<item name="colorBackground">@color/background_leanback_light</item>
<item name="textColorPrimary">@color/primary_text_leanback_light</item>
<item name="textColorSecondary">@color/secondary_text_leanback_light</item>
diff --git a/core/res/res/values/themes_material.xml b/core/res/res/values/themes_material.xml
index f2233e0..42ebb82 100644
--- a/core/res/res/values/themes_material.xml
+++ b/core/res/res/values/themes_material.xml
@@ -354,37 +354,13 @@
<item name="timePickerStyle">@style/Widget.Material.TimePicker</item>
<!-- TimePicker dialog theme -->
- <item name="timePickerDialogTheme">@style/Theme.Material.Dialog.TimePicker</item>
+ <item name="timePickerDialogTheme">?attr/alertDialogTheme</item>
<!-- DatePicker style -->
- <item name="datePickerStyle">@style/Widget.Material.DatePicker</item>
-
- <!-- DatePicker Header day of week label background color -->
- <item name="datePickerHeaderDayOfWeekLabelBackgroundColor">@android:color/datepicker_default_header_dayofweek_background_color_material_dark</item>
-
- <!-- DatePicker Header day of week label text appearance -->
- <item name="datePickerHeaderDayOfWeekLabelTextAppearance">@style/TextAppearance.Material.DatePicker.DayOfWeekLabel</item>
-
- <!-- DatePicker Header selector background color -->
- <item name="datePickerHeaderSelectorBackgroundColor">@android:color/datepicker_default_header_selector_background_material_dark</item>
-
- <!-- DatePicker Header selector month label text appearance -->
- <item name="datePickerHeaderSelectorMonthLabelTextAppearance">@style/TextAppearance.Material.DatePicker.Selector.MonthLabel</item>
-
- <!-- DatePicker Header selector day of month label text appearance -->
- <item name="datePickerHeaderSelectorDayOfMonthLabelTextAppearance">@style/TextAppearance.Material.DatePicker.Selector.DayOfMonthLabel</item>
-
- <!-- DatePicker Header selector year label text appearance -->
- <item name="datePickerHeaderSelectorYearLabelTextAppearance">@style/TextAppearance.Material.DatePicker.Selector.YearLabel</item>
-
- <!-- DatePicker list year label text appearance -->
- <item name="datePickerHeaderListYearLabelTextAppearance">@style/TextAppearance.Material.DatePicker.List.YearLabel</item>
-
- <!-- DatePicker list year label circle background color -->
- <item name="datePickerHeaderListYearLabelCircleBackgroundColor">@android:color/datepicker_default_circle_background_color_material_dark</item>
+ <item name="datePickerStyle">?attr/alertDialogTheme</item>
<!-- DatePicker dialog theme -->
- <item name="datePickerDialogTheme">@android:style/Theme.Material.Dialog.DatePicker</item>
+ <item name="datePickerDialogTheme">@style/Theme.Material.Dialog.Alert</item>
<!-- TODO: This belongs in a FastScroll style -->
<item name="fastScrollThumbDrawable">@drawable/fastscroll_thumb_material</item>
@@ -721,37 +697,13 @@
<item name="timePickerStyle">@style/Widget.Material.Light.TimePicker</item>
<!-- TimePicker dialog theme -->
- <item name="timePickerDialogTheme">@style/Theme.Material.Light.Dialog.TimePicker</item>
+ <item name="timePickerDialogTheme">?attr/alertDialogTheme</item>
<!-- DatePicker style -->
<item name="datePickerStyle">@style/Widget.Material.Light.DatePicker</item>
- <!-- DatePicker Header day of week label background color -->
- <item name="datePickerHeaderDayOfWeekLabelBackgroundColor">@android:color/datepicker_default_header_dayofweek_background_color_material_light</item>
-
- <!-- DatePicker Header day of week label text appearance -->
- <item name="datePickerHeaderDayOfWeekLabelTextAppearance">@style/TextAppearance.Material.Light.DatePicker.DayOfWeekLabel</item>
-
- <!-- DatePicker Header selector background color -->
- <item name="datePickerHeaderSelectorBackgroundColor">@android:color/datepicker_default_header_selector_background_material_light</item>
-
- <!-- DatePicker Header selector month label text appearance -->
- <item name="datePickerHeaderSelectorMonthLabelTextAppearance">@style/TextAppearance.Material.Light.DatePicker.Selector.MonthLabel</item>
-
- <!-- DatePicker Header selector day of month label text appearance -->
- <item name="datePickerHeaderSelectorDayOfMonthLabelTextAppearance">@style/TextAppearance.Material.Light.DatePicker.Selector.DayOfMonthLabel</item>
-
- <!-- DatePicker Header selector year label text appearance -->
- <item name="datePickerHeaderSelectorYearLabelTextAppearance">@style/TextAppearance.Material.Light.DatePicker.Selector.YearLabel</item>
-
- <!-- DatePicker list year label text appearance -->
- <item name="datePickerHeaderListYearLabelTextAppearance">@style/TextAppearance.Material.Light.DatePicker.List.YearLabel</item>
-
- <!-- DatePicker list year label circle background color -->
- <item name="datePickerHeaderListYearLabelCircleBackgroundColor">@android:color/datepicker_default_circle_background_color_material_light</item>
-
<!-- DatePicker dialog theme -->
- <item name="datePickerDialogTheme">@android:style/Theme.Material.Light.Dialog.DatePicker</item>
+ <item name="datePickerDialogTheme">?attr/alertDialogTheme</item>
<item name="fastScrollThumbDrawable">@drawable/fastscroll_thumb_material</item>
<item name="fastScrollPreviewBackgroundLeft">@drawable/fastscroll_label_left_holo_light</item>
@@ -1125,7 +1077,6 @@
</style>
<style name="Theme.Material.Dialog.BaseAlert">
- <item name="windowTitleStyle">@style/DialogWindowTitle.Material</item>
<item name="windowMinWidthMajor">@dimen/dialog_min_width_major</item>
<item name="windowMinWidthMinor">@dimen/dialog_min_width_minor</item>
</style>
@@ -1137,23 +1088,6 @@
AlertDialog theme. -->
<style name="Theme.Material.Dialog.Alert" parent="Theme.Material.Dialog.BaseAlert"/>
- <!-- Base theme used to prevent circular references in Leanback overrides. -->
- <style name="Theme.Material.Dialog.BaseTimePicker" />
-
- <!-- Material theme for the TimePicker dialog windows, which is used by the
- {@link android.app.TimePickerDialog} class. -->
- <style name="Theme.Material.Dialog.TimePicker" parent="Theme.Material.Dialog.BaseTimePicker"/>
-
- <style name="Theme.Material.Dialog.BaseDatePicker">
- <item name="windowBackground">@color/transparent</item>
- <item name="windowTitleStyle">@style/DialogWindowTitle.Material</item>
- <item name="windowContentOverlay">@null</item>
- </style>
-
- <!-- Material theme for the DatePicker dialog windows, which is used by the
- {@link android.app.DatePickerDialog} class. -->
- <style name="Theme.Material.Dialog.DatePicker" parent="Theme.Material.Dialog.BaseDatePicker"/>
-
<!-- Theme for a window that will be displayed either full-screen on
smaller screens (small, normal) or as a dialog on larger screens
(large, xlarge). -->
@@ -1250,7 +1184,6 @@
<style name="Theme.Material.Light.DialogWhenLarge.NoActionBar" parent="@style/Theme.Material.Light.NoActionBar" />
<style name="Theme.Material.Light.Dialog.BaseAlert">
- <item name="windowTitleStyle">@style/DialogWindowTitle.Material.Light</item>
<item name="windowMinWidthMajor">@dimen/dialog_min_width_major</item>
<item name="windowMinWidthMinor">@dimen/dialog_min_width_minor</item>
</style>
@@ -1269,11 +1202,7 @@
{@link android.app.TimePickerDialog} class. -->
<style name="Theme.Material.Light.Dialog.TimePicker" parent="Theme.Material.Light.Dialog.BaseTimePicker" />
- <style name="Theme.Material.Light.Dialog.BaseDatePicker">
- <item name="windowBackground">@color/transparent</item>
- <item name="windowTitleStyle">@style/DialogWindowTitle.Material.Light</item>
- <item name="windowContentOverlay">@null</item>
- </style>
+ <style name="Theme.Material.Light.Dialog.BaseDatePicker" />
<!-- Material Light theme for the DatePicker dialog windows, which is used by the
{@link android.app.DatePickerDialog} class. -->
diff --git a/graphics/java/android/graphics/drawable/RippleDrawable.java b/graphics/java/android/graphics/drawable/RippleDrawable.java
index 0c9c558..eb7291c 100644
--- a/graphics/java/android/graphics/drawable/RippleDrawable.java
+++ b/graphics/java/android/graphics/drawable/RippleDrawable.java
@@ -525,16 +525,6 @@
}
private void clearHotspots() {
- if (mRipple != null) {
- mRipple.cancel();
- mRipple = null;
- }
-
- if (mBackground != null) {
- mBackground.cancel();
- mBackground = null;
- }
-
final int count = mAnimatingRipplesCount;
final Ripple[] ripples = mAnimatingRipples;
for (int i = 0; i < count; i++) {
@@ -543,6 +533,21 @@
final Ripple ripple = ripples[i];
ripples[i] = null;
ripple.cancel();
+
+ // The active ripple may also be animating. Don't cancel it twice.
+ if (mRipple == ripple) {
+ mRipple = null;
+ }
+ }
+
+ if (mRipple != null) {
+ mRipple.cancel();
+ mRipple = null;
+ }
+
+ if (mBackground != null) {
+ mBackground.cancel();
+ mBackground = null;
}
mAnimatingRipplesCount = 0;
diff --git a/libs/androidfw/ResourceTypes.cpp b/libs/androidfw/ResourceTypes.cpp
index 2889ea3..d765b25 100644
--- a/libs/androidfw/ResourceTypes.cpp
+++ b/libs/androidfw/ResourceTypes.cpp
@@ -504,19 +504,22 @@
charSize = sizeof(char16_t);
}
- mStrings = (const void*)
- (((const uint8_t*)data)+mHeader->stringsStart);
- if (mHeader->stringsStart >= (mHeader->header.size-sizeof(uint16_t))) {
+ // There should be at least space for the smallest string
+ // (2 bytes length, null terminator).
+ if (mHeader->stringsStart >= (mSize - sizeof(uint16_t))) {
ALOGW("Bad string block: string pool starts at %d, after total size %d\n",
(int)mHeader->stringsStart, (int)mHeader->header.size);
return (mError=BAD_TYPE);
}
+
+ mStrings = (const void*)
+ (((const uint8_t*)data) + mHeader->stringsStart);
+
if (mHeader->styleCount == 0) {
- mStringPoolSize =
- (mHeader->header.size-mHeader->stringsStart)/charSize;
+ mStringPoolSize = (mSize - mHeader->stringsStart) / charSize;
} else {
// check invariant: styles starts before end of data
- if (mHeader->stylesStart >= (mHeader->header.size-sizeof(uint16_t))) {
+ if (mHeader->stylesStart >= (mSize - sizeof(uint16_t))) {
ALOGW("Bad style block: style block starts at %d past data size of %d\n",
(int)mHeader->stylesStart, (int)mHeader->header.size);
return (mError=BAD_TYPE);
@@ -3368,6 +3371,12 @@
return NO_ERROR;
}
+ if (dataSize < sizeof(ResTable_header)) {
+ ALOGE("Invalid data. Size(%d) is smaller than a ResTable_header(%d).",
+ (int) dataSize, (int) sizeof(ResTable_header));
+ return UNKNOWN_ERROR;
+ }
+
Header* header = new Header(this);
header->index = mHeaders.size();
header->cookie = cookie;
diff --git a/libs/hwui/Debug.h b/libs/hwui/Debug.h
index d6dc6ad..5808aac 100644
--- a/libs/hwui/Debug.h
+++ b/libs/hwui/Debug.h
@@ -82,6 +82,9 @@
// Turn on to insert an event marker for each display list op
#define DEBUG_DISPLAY_LIST_OPS_AS_EVENTS 0
+// Turn on to insert detailed event markers
+#define DEBUG_DETAILED_EVENTS 0
+
// Turn on to highlight drawing batches and merged batches with different colors
#define DEBUG_MERGE_BEHAVIOR 0
diff --git a/libs/hwui/Layer.cpp b/libs/hwui/Layer.cpp
index 73a4da5..d05cabc 100644
--- a/libs/hwui/Layer.cpp
+++ b/libs/hwui/Layer.cpp
@@ -88,6 +88,8 @@
return true;
}
+ ATRACE_NAME("resizeLayer");
+
const uint32_t maxTextureSize = caches.maxTextureSize;
if (desiredWidth > maxTextureSize || desiredHeight > maxTextureSize) {
ALOGW("Layer exceeds max. dimensions supported by the GPU (%dx%d, max=%dx%d)",
diff --git a/libs/hwui/LayerRenderer.cpp b/libs/hwui/LayerRenderer.cpp
index a92ef94..e3b0daf 100644
--- a/libs/hwui/LayerRenderer.cpp
+++ b/libs/hwui/LayerRenderer.cpp
@@ -15,6 +15,7 @@
*/
#define LOG_TAG "OpenGLRenderer"
+#define ATRACE_TAG ATRACE_TAG_VIEW
#include <ui/Rect.h>
@@ -184,6 +185,7 @@
///////////////////////////////////////////////////////////////////////////////
Layer* LayerRenderer::createRenderLayer(RenderState& renderState, uint32_t width, uint32_t height) {
+ ATRACE_CALL();
LAYER_RENDERER_LOGD("Requesting new render layer %dx%d", width, height);
Caches& caches = Caches::getInstance();
@@ -309,6 +311,7 @@
void LayerRenderer::destroyLayer(Layer* layer) {
if (layer) {
+ ATRACE_CALL();
LAYER_RENDERER_LOGD("Recycling layer, %dx%d fbo = %d",
layer->getWidth(), layer->getHeight(), layer->getFbo());
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp
index 41f89c2..de777f0 100755
--- a/libs/hwui/OpenGLRenderer.cpp
+++ b/libs/hwui/OpenGLRenderer.cpp
@@ -45,6 +45,12 @@
#include "Vector.h"
#include "VertexBuffer.h"
+#if DEBUG_DETAILED_EVENTS
+ #define EVENT_LOGD(...) eventMarkDEBUG(__VA_ARGS__)
+#else
+ #define EVENT_LOGD(...)
+#endif
+
namespace android {
namespace uirenderer {
@@ -389,6 +395,21 @@
// Debug
///////////////////////////////////////////////////////////////////////////////
+void OpenGLRenderer::eventMarkDEBUG(const char* fmt, ...) const {
+#if DEBUG_DETAILED_EVENTS
+ const int BUFFER_SIZE = 256;
+ va_list ap;
+ char buf[BUFFER_SIZE];
+
+ va_start(ap, fmt);
+ vsnprintf(buf, BUFFER_SIZE, fmt, ap);
+ va_end(ap);
+
+ eventMark(buf);
+#endif
+}
+
+
void OpenGLRenderer::eventMark(const char* name) const {
mCaches.eventMark(0, name);
}
@@ -977,7 +998,13 @@
}
void OpenGLRenderer::composeLayerRect(Layer* layer, const Rect& rect, bool swap) {
- if (!layer->isTextureLayer()) {
+ if (layer->isTextureLayer()) {
+ EVENT_LOGD("composeTextureLayerRect");
+ resetDrawTextureTexCoords(0.0f, 1.0f, 1.0f, 0.0f);
+ drawTextureLayer(layer, rect);
+ resetDrawTextureTexCoords(0.0f, 0.0f, 1.0f, 1.0f);
+ } else {
+ EVENT_LOGD("composeHardwareLayerRect");
const Rect& texCoords = layer->texCoords;
resetDrawTextureTexCoords(texCoords.left, texCoords.top,
texCoords.right, texCoords.bottom);
@@ -1012,10 +1039,6 @@
GL_TRIANGLE_STRIP, gMeshCount, swap, swap || simpleTransform);
resetDrawTextureTexCoords(0.0f, 0.0f, 1.0f, 1.0f);
- } else {
- resetDrawTextureTexCoords(0.0f, 1.0f, 1.0f, 0.0f);
- drawTextureLayer(layer, rect);
- resetDrawTextureTexCoords(0.0f, 0.0f, 1.0f, 1.0f);
}
}
@@ -1115,6 +1138,7 @@
return;
}
+ EVENT_LOGD("composeLayerRegion");
// standard Region based draw
size_t count;
const android::Rect* rects;
@@ -1288,6 +1312,7 @@
if (count == 0) return;
if (!currentSnapshot()->isIgnored()) {
+ EVENT_LOGD("clearLayerRegions");
// Doing several glScissor/glClear here can negatively impact
// GPUs with a tiler architecture, instead we draw quads with
// the Clear blending mode
@@ -1465,6 +1490,8 @@
void OpenGLRenderer::setStencilFromClip() {
if (!mCaches.debugOverdraw) {
if (!currentSnapshot()->clipRegion->isEmpty()) {
+ EVENT_LOGD("setStencilFromClip - enabling");
+
// NOTE: The order here is important, we must set dirtyClip to false
// before any draw call to avoid calling back into this method
mDirtyClip = false;
@@ -1510,6 +1537,7 @@
drawRegionRects(*(currentSnapshot()->clipRegion), paint);
}
} else {
+ EVENT_LOGD("setStencilFromClip - disabling");
mCaches.stencil.disable();
}
}
@@ -1561,17 +1589,24 @@
// Drawing commands
///////////////////////////////////////////////////////////////////////////////
-void OpenGLRenderer::setupDraw(bool clear) {
+void OpenGLRenderer::setupDraw(bool clearLayer) {
// TODO: It would be best if we could do this before quickRejectSetupScissor()
// changes the scissor test state
- if (clear) clearLayerRegions();
+ if (clearLayer) clearLayerRegions();
// Make sure setScissor & setStencil happen at the beginning of
// this method
if (mDirtyClip) {
if (mCaches.scissorEnabled) {
setScissorFromClip();
}
- setStencilFromClip();
+
+ if (clearLayer) {
+ setStencilFromClip();
+ } else {
+ // While clearing layer, force disable stencil buffer, since
+ // it's invalid to stencil-clip *during* the layer clear
+ mCaches.stencil.disable();
+ }
}
mDescription.reset();
@@ -2964,6 +2999,9 @@
return DrawGlInfo::kStatusDone;
}
+ EVENT_LOGD("drawLayer," RECT_STRING ", clipRequired %d", x, y,
+ x + layer->layer.getWidth(), y + layer->layer.getHeight(), clipRequired);
+
updateLayer(layer, true);
mCaches.setScissorEnabled(mScissorOptimizationDisabled || clipRequired);
diff --git a/libs/hwui/OpenGLRenderer.h b/libs/hwui/OpenGLRenderer.h
index f698b45..3bc591f 100755
--- a/libs/hwui/OpenGLRenderer.h
+++ b/libs/hwui/OpenGLRenderer.h
@@ -256,6 +256,11 @@
void eventMark(const char* name) const;
/**
+ * Inserts a formatted event marker in the stream of GL commands.
+ */
+ void eventMarkDEBUG(const char *fmt, ...) const;
+
+ /**
* Inserts a named group marker in the stream of GL commands. This marker
* can be used by tools to group commands into logical groups. A call to
* this method must always be followed later on by a call to endMark().
diff --git a/libs/hwui/Rect.h b/libs/hwui/Rect.h
index 9311f99..13265a9 100644
--- a/libs/hwui/Rect.h
+++ b/libs/hwui/Rect.h
@@ -27,7 +27,7 @@
namespace android {
namespace uirenderer {
-#define RECT_STRING "%7.2f %7.2f %7.2f %7.2f"
+#define RECT_STRING "%5.2f %5.2f %5.2f %5.2f"
#define RECT_ARGS(r) \
(r).left, (r).top, (r).right, (r).bottom
#define SK_RECT_ARGS(r) \
diff --git a/libs/hwui/StatefulBaseRenderer.cpp b/libs/hwui/StatefulBaseRenderer.cpp
index 140c6e8..473005c 100644
--- a/libs/hwui/StatefulBaseRenderer.cpp
+++ b/libs/hwui/StatefulBaseRenderer.cpp
@@ -178,6 +178,7 @@
SkRegion region;
region.setPath(transformed, clip);
+ // region is the transformed input path, masked by the previous clip
mDirtyClip |= mSnapshot->clipRegionTransformed(region, op);
return !mSnapshot->clipRect->isEmpty();
}
diff --git a/libs/hwui/TextureCache.cpp b/libs/hwui/TextureCache.cpp
index ec9e30a..3b8a9a4 100644
--- a/libs/hwui/TextureCache.cpp
+++ b/libs/hwui/TextureCache.cpp
@@ -15,6 +15,7 @@
*/
#define LOG_TAG "OpenGLRenderer"
+#define ATRACE_TAG ATRACE_TAG_VIEW
#include <GLES2/gl2.h>
@@ -265,6 +266,8 @@
return;
}
+ ATRACE_CALL();
+
// We could also enable mipmapping if both bitmap dimensions are powers
// of 2 but we'd have to deal with size changes. Let's keep this simple
const bool canMipMap = Extensions::getInstance().hasNPot();
diff --git a/media/java/android/media/AudioAttributes.java b/media/java/android/media/AudioAttributes.java
index b2d8ffe..099cd3f 100644
--- a/media/java/android/media/AudioAttributes.java
+++ b/media/java/android/media/AudioAttributes.java
@@ -413,6 +413,7 @@
default:
Log.e(TAG, "Invalid stream type " + streamType + " for AudioAttributes");
}
+ mUsage = usageForLegacyStreamType(streamType);
return this;
}
diff --git a/media/java/android/media/AudioManager.java b/media/java/android/media/AudioManager.java
index 1116127..ac63ea6 100644
--- a/media/java/android/media/AudioManager.java
+++ b/media/java/android/media/AudioManager.java
@@ -3146,18 +3146,18 @@
* Callback method called upon audio port list update.
* @param portList the updated list of audio ports
*/
- public void OnAudioPortListUpdate(AudioPort[] portList);
+ public void onAudioPortListUpdate(AudioPort[] portList);
/**
* Callback method called upon audio patch list update.
* @param patchList the updated list of audio patches
*/
- public void OnAudioPatchListUpdate(AudioPatch[] patchList);
+ public void onAudioPatchListUpdate(AudioPatch[] patchList);
/**
* Callback method called when the mediaserver dies
*/
- public void OnServiceDied();
+ public void onServiceDied();
}
/**
diff --git a/media/java/android/media/AudioPortEventHandler.java b/media/java/android/media/AudioPortEventHandler.java
index d5fea07..8d2c172 100644
--- a/media/java/android/media/AudioPortEventHandler.java
+++ b/media/java/android/media/AudioPortEventHandler.java
@@ -91,7 +91,7 @@
case AUDIOPORT_EVENT_PORT_LIST_UPDATED:
AudioPort[] portList = ports.toArray(new AudioPort[0]);
for (int i = 0; i < listeners.size(); i++) {
- listeners.get(i).OnAudioPortListUpdate(portList);
+ listeners.get(i).onAudioPortListUpdate(portList);
}
if (msg.what == AUDIOPORT_EVENT_PORT_LIST_UPDATED) {
break;
@@ -101,13 +101,13 @@
case AUDIOPORT_EVENT_PATCH_LIST_UPDATED:
AudioPatch[] patchList = patches.toArray(new AudioPatch[0]);
for (int i = 0; i < listeners.size(); i++) {
- listeners.get(i).OnAudioPatchListUpdate(patchList);
+ listeners.get(i).onAudioPatchListUpdate(patchList);
}
break;
case AUDIOPORT_EVENT_SERVICE_DIED:
for (int i = 0; i < listeners.size(); i++) {
- listeners.get(i).OnServiceDied();
+ listeners.get(i).onServiceDied();
}
break;
diff --git a/media/java/android/media/AudioService.java b/media/java/android/media/AudioService.java
index ae7c501..e1c6e75 100644
--- a/media/java/android/media/AudioService.java
+++ b/media/java/android/media/AudioService.java
@@ -113,8 +113,8 @@
private static final String TAG = "AudioService";
- /** Debug remote control client/display feature */
- protected static final boolean DEBUG_RC = Log.isLoggable(TAG + ".RC", Log.DEBUG);
+ /** Debug audio mode */
+ protected static final boolean DEBUG_MODE = Log.isLoggable(TAG + ".MOD", Log.DEBUG);
/** Debug volumes */
protected static final boolean DEBUG_VOL = Log.isLoggable(TAG + ".VOL", Log.DEBUG);
@@ -1788,6 +1788,7 @@
/** @see AudioManager#setMode(int) */
public void setMode(int mode, IBinder cb) {
+ if (DEBUG_MODE) { Log.v(TAG, "setMode(mode=" + mode + ")"); }
if (!checkAudioSettingsPermission("setMode()")) {
return;
}
@@ -1814,6 +1815,7 @@
// setModeInt() returns a valid PID if the audio mode was successfully set to
// any mode other than NORMAL.
int setModeInt(int mode, IBinder cb, int pid) {
+ if (DEBUG_MODE) { Log.v(TAG, "setModeInt(mode=" + mode + ", pid=" + pid + ")"); }
int newModeOwnerPid = 0;
if (cb == null) {
Log.e(TAG, "setModeInt() called with null binder");
@@ -1840,6 +1842,10 @@
hdlr = mSetModeDeathHandlers.get(0);
cb = hdlr.getBinder();
mode = hdlr.getMode();
+ if (DEBUG_MODE) {
+ Log.w(TAG, " using mode=" + mode + " instead due to death hdlr at pid="
+ + hdlr.mPid);
+ }
}
} else {
if (hdlr == null) {
@@ -1862,6 +1868,7 @@
if (mode != mMode) {
status = AudioSystem.setPhoneState(mode);
if (status == AudioSystem.AUDIO_STATUS_OK) {
+ if (DEBUG_MODE) { Log.v(TAG, " mode successfully set to " + mode); }
mMode = mode;
} else {
if (hdlr != null) {
@@ -1869,6 +1876,7 @@
cb.unlinkToDeath(hdlr, 0);
}
// force reading new top of mSetModeDeathHandlers stack
+ if (DEBUG_MODE) { Log.w(TAG, " mode set to MODE_NORMAL after phoneState pb"); }
mode = AudioSystem.MODE_NORMAL;
}
} else {
diff --git a/media/java/android/media/MediaFormat.java b/media/java/android/media/MediaFormat.java
index a1ccf60..c6586c0 100644
--- a/media/java/android/media/MediaFormat.java
+++ b/media/java/android/media/MediaFormat.java
@@ -483,6 +483,9 @@
*/
public static final String KEY_IS_FORCED_SUBTITLE = "is-forced-subtitle";
+ /** @hide */
+ public static final String KEY_IS_TIMED_TEXT = "is-timed-text";
+
/* package private */ MediaFormat(Map<String, Object> map) {
mMap = map;
}
diff --git a/media/java/android/media/MediaPlayer.java b/media/java/android/media/MediaPlayer.java
index d9217a0..2962460 100644
--- a/media/java/android/media/MediaPlayer.java
+++ b/media/java/android/media/MediaPlayer.java
@@ -18,6 +18,7 @@
import android.app.ActivityThread;
import android.app.AppOpsManager;
+import android.app.Application;
import android.content.BroadcastReceiver;
import android.content.ContentResolver;
import android.content.Context;
@@ -36,6 +37,8 @@
import android.os.PowerManager;
import android.os.RemoteException;
import android.os.ServiceManager;
+import android.system.ErrnoException;
+import android.system.OsConstants;
import android.util.Log;
import android.view.Surface;
import android.view.SurfaceHolder;
@@ -44,15 +47,22 @@
import android.media.MediaFormat;
import android.media.MediaTimeProvider;
import android.media.SubtitleController;
+import android.media.SubtitleController.Anchor;
import android.media.SubtitleData;
+import android.media.SubtitleTrack.RenderingWidget;
import com.android.internal.app.IAppOpsService;
+import libcore.io.IoBridge;
+import libcore.io.Libcore;
+
+import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileDescriptor;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.io.OutputStream;
import java.lang.Runnable;
import java.net.InetSocketAddress;
import java.util.Map;
@@ -1108,7 +1118,12 @@
*
* @throws IllegalStateException if it is called in an invalid state
*/
- public native void prepare() throws IOException, IllegalStateException;
+ public void prepare() throws IOException, IllegalStateException {
+ _prepare();
+ scanInternalSubtitleTracks();
+ }
+
+ private native void _prepare() throws IOException, IllegalStateException;
/**
* Prepares the player for playback, asynchronously.
@@ -1846,7 +1861,10 @@
System.arraycopy(trackInfo, 0, allTrackInfo, 0, trackInfo.length);
int i = trackInfo.length;
for (SubtitleTrack track: mOutOfBandSubtitleTracks) {
- allTrackInfo[i] = new TrackInfo(TrackInfo.MEDIA_TRACK_TYPE_SUBTITLE, track.getFormat());
+ int type = track.isTimedText()
+ ? TrackInfo.MEDIA_TRACK_TYPE_TIMEDTEXT
+ : TrackInfo.MEDIA_TRACK_TYPE_SUBTITLE;
+ allTrackInfo[i] = new TrackInfo(type, track.getFormat());
++i;
}
return allTrackInfo;
@@ -1891,7 +1909,7 @@
* A helper function to check if the mime type is supported by media framework.
*/
private static boolean availableMimeTypeForExternalSource(String mimeType) {
- if (mimeType == MEDIA_MIMETYPE_TEXT_SUBRIP) {
+ if (MEDIA_MIMETYPE_TEXT_SUBRIP.equals(mimeType)) {
return true;
}
return false;
@@ -2147,27 +2165,97 @@
* @throws IllegalArgumentException if the mimeType is not supported.
* @throws IllegalStateException if called in an invalid state.
*/
- public void addTimedTextSource(FileDescriptor fd, long offset, long length, String mimeType)
+ public void addTimedTextSource(FileDescriptor fd, long offset, long length, String mime)
throws IllegalArgumentException, IllegalStateException {
- if (!availableMimeTypeForExternalSource(mimeType)) {
- throw new IllegalArgumentException("Illegal mimeType for timed text source: " + mimeType);
-
+ if (!availableMimeTypeForExternalSource(mime)) {
+ throw new IllegalArgumentException("Illegal mimeType for timed text source: " + mime);
}
- Parcel request = Parcel.obtain();
- Parcel reply = Parcel.obtain();
+ FileDescriptor fd2;
try {
- request.writeInterfaceToken(IMEDIA_PLAYER);
- request.writeInt(INVOKE_ID_ADD_EXTERNAL_SOURCE_FD);
- request.writeFileDescriptor(fd);
- request.writeLong(offset);
- request.writeLong(length);
- request.writeString(mimeType);
- invoke(request, reply);
- } finally {
- request.recycle();
- reply.recycle();
+ fd2 = Libcore.os.dup(fd);
+ } catch (ErrnoException ex) {
+ Log.e(TAG, ex.getMessage(), ex);
+ throw new RuntimeException(ex);
}
+
+ final MediaFormat fFormat = new MediaFormat();
+ fFormat.setString(MediaFormat.KEY_MIME, mime);
+ fFormat.setInteger(MediaFormat.KEY_IS_TIMED_TEXT, 1);
+
+ Context context = ActivityThread.currentApplication();
+ // A MediaPlayer created by a VideoView should already have its mSubtitleController set.
+ if (mSubtitleController == null) {
+ mSubtitleController = new SubtitleController(context, mTimeProvider, this);
+ mSubtitleController.setAnchor(new Anchor() {
+ @Override
+ public void setSubtitleWidget(RenderingWidget subtitleWidget) {
+ }
+
+ @Override
+ public Looper getSubtitleLooper() {
+ return Looper.getMainLooper();
+ }
+ });
+ }
+
+ if (!mSubtitleController.hasRendererFor(fFormat)) {
+ // test and add not atomic
+ mSubtitleController.registerRenderer(new SRTRenderer(context, mEventHandler));
+ }
+ final SubtitleTrack track = mSubtitleController.addTrack(fFormat);
+ mOutOfBandSubtitleTracks.add(track);
+
+ final FileDescriptor fd3 = fd2;
+ final long offset2 = offset;
+ final long length2 = length;
+ final HandlerThread thread = new HandlerThread(
+ "TimedTextReadThread",
+ Process.THREAD_PRIORITY_BACKGROUND + Process.THREAD_PRIORITY_MORE_FAVORABLE);
+ thread.start();
+ Handler handler = new Handler(thread.getLooper());
+ handler.post(new Runnable() {
+ private int addTrack() {
+ InputStream is = null;
+ final ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ try {
+ Libcore.os.lseek(fd3, offset2, OsConstants.SEEK_SET);
+ byte[] buffer = new byte[4096];
+ for (int total = 0; total < length2;) {
+ int remain = (int)length2 - total;
+ int bytes = IoBridge.read(fd3, buffer, 0, Math.min(buffer.length, remain));
+ if (bytes < 0) {
+ break;
+ } else {
+ bos.write(buffer, 0, bytes);
+ total += bytes;
+ }
+ }
+ track.onData(bos.toByteArray(), true /* eos */, ~0 /* runID: keep forever */);
+ return MEDIA_INFO_EXTERNAL_METADATA_UPDATE;
+ } catch (Exception e) {
+ Log.e(TAG, e.getMessage(), e);
+ return MEDIA_INFO_TIMED_TEXT_ERROR;
+ } finally {
+ if (is != null) {
+ try {
+ is.close();
+ } catch (IOException e) {
+ Log.e(TAG, e.getMessage(), e);
+ }
+ }
+ }
+ }
+
+ public void run() {
+ int res = addTrack();
+ if (mEventHandler != null) {
+ Message m = mEventHandler.obtainMessage(MEDIA_INFO, res, 0, null);
+ mEventHandler.sendMessage(m);
+ }
+ thread.getLooper().quitSafely();
+ }
+ });
}
/**
@@ -2275,6 +2363,13 @@
if (mSubtitleController != null && track != null) {
if (select) {
+ if (track.isTimedText()) {
+ int ttIndex = getSelectedTrack(TrackInfo.MEDIA_TRACK_TYPE_TIMEDTEXT);
+ if (ttIndex >= 0 && ttIndex < mInbandSubtitleTracks.length) {
+ // deselect inband counterpart
+ selectOrDeselectInbandTrack(ttIndex, false);
+ }
+ }
mSubtitleController.selectTrack(track);
} else if (mSubtitleController.getSelectedTrack() == track) {
mSubtitleController.selectTrack(null);
diff --git a/media/java/android/media/SRTRenderer.java b/media/java/android/media/SRTRenderer.java
new file mode 100644
index 0000000..ee4edee
--- /dev/null
+++ b/media/java/android/media/SRTRenderer.java
@@ -0,0 +1,202 @@
+package android.media;
+
+import android.content.Context;
+import android.media.SubtitleController.Renderer;
+import android.os.Handler;
+import android.os.Message;
+import android.os.Parcel;
+import android.util.Log;
+
+import java.io.BufferedReader;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.io.UnsupportedEncodingException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Vector;
+
+/** @hide */
+public class SRTRenderer extends Renderer {
+ private final Context mContext;
+ private final boolean mRender;
+ private final Handler mEventHandler;
+
+ private WebVttRenderingWidget mRenderingWidget;
+
+ public SRTRenderer(Context context) {
+ this(context, null);
+ }
+
+ SRTRenderer(Context mContext, Handler mEventHandler) {
+ this.mContext = mContext;
+ this.mRender = (mEventHandler == null);
+ this.mEventHandler = mEventHandler;
+ }
+
+ @Override
+ public boolean supports(MediaFormat format) {
+ if (format.containsKey(MediaFormat.KEY_MIME)) {
+ if (!format.getString(MediaFormat.KEY_MIME)
+ .equals(MediaPlayer.MEDIA_MIMETYPE_TEXT_SUBRIP)) {
+ return false;
+ };
+ return mRender == (format.getInteger(MediaFormat.KEY_IS_TIMED_TEXT, 0) == 0);
+ }
+ return false;
+ }
+
+ @Override
+ public SubtitleTrack createTrack(MediaFormat format) {
+ if (mRender && mRenderingWidget == null) {
+ mRenderingWidget = new WebVttRenderingWidget(mContext);
+ }
+
+ if (mRender) {
+ return new SRTTrack(mRenderingWidget, format);
+ } else {
+ return new SRTTrack(mEventHandler, format);
+ }
+ }
+}
+
+class SRTTrack extends WebVttTrack {
+ private static final int MEDIA_TIMED_TEXT = 99; // MediaPlayer.MEDIA_TIMED_TEXT
+ private static final int KEY_STRUCT_TEXT = 16; // TimedText.KEY_STRUCT_TEXT
+ private static final int KEY_START_TIME = 7; // TimedText.KEY_START_TIME
+ private static final int KEY_LOCAL_SETTING = 102; // TimedText.KEY_START_TIME
+
+ private static final String TAG = "SRTTrack";
+ private final Handler mEventHandler;
+
+ SRTTrack(WebVttRenderingWidget renderingWidget, MediaFormat format) {
+ super(renderingWidget, format);
+ mEventHandler = null;
+ }
+
+ SRTTrack(Handler eventHandler, MediaFormat format) {
+ super(null, format);
+ mEventHandler = eventHandler;
+ }
+
+ @Override
+ protected void onData(SubtitleData data) {
+ try {
+ TextTrackCue cue = new TextTrackCue();
+ cue.mStartTimeMs = data.getStartTimeUs() / 1000;
+ cue.mEndTimeMs = (data.getStartTimeUs() + data.getDurationUs()) / 1000;
+
+ String paragraph;
+ paragraph = new String(data.getData(), "UTF-8");
+ String[] lines = paragraph.split("\\r?\\n");
+ cue.mLines = new TextTrackCueSpan[lines.length][];
+
+ int i = 0;
+ for (String line : lines) {
+ TextTrackCueSpan[] span = new TextTrackCueSpan[] {
+ new TextTrackCueSpan(line, -1)
+ };
+ cue.mLines[i++] = span;
+ }
+
+ addCue(cue);
+ } catch (UnsupportedEncodingException e) {
+ Log.w(TAG, "subtitle data is not UTF-8 encoded: " + e);
+ }
+ }
+
+ @Override
+ public void onData(byte[] data, boolean eos, long runID) {
+ // TODO make reentrant
+ try {
+ Reader r = new InputStreamReader(new ByteArrayInputStream(data), "UTF-8");
+ BufferedReader br = new BufferedReader(r);
+
+ String header;
+ while ((header = br.readLine()) != null) {
+ // discard subtitle number
+ header = br.readLine();
+ if (header == null) {
+ break;
+ }
+
+ TextTrackCue cue = new TextTrackCue();
+ String[] startEnd = header.split("-->");
+ cue.mStartTimeMs = parseMs(startEnd[0]);
+ cue.mEndTimeMs = parseMs(startEnd[1]);
+
+ String s;
+ List<String> paragraph = new ArrayList<String>();
+ while (!((s = br.readLine()) == null || s.trim().equals(""))) {
+ paragraph.add(s);
+ }
+
+ int i = 0;
+ cue.mLines = new TextTrackCueSpan[paragraph.size()][];
+ cue.mStrings = paragraph.toArray(new String[0]);
+ for (String line : paragraph) {
+ TextTrackCueSpan[] span = new TextTrackCueSpan[] {
+ new TextTrackCueSpan(line, -1)
+ };
+ cue.mStrings[i] = line;
+ cue.mLines[i++] = span;
+ }
+
+ addCue(cue);
+ }
+
+ } catch (UnsupportedEncodingException e) {
+ Log.w(TAG, "subtitle data is not UTF-8 encoded: " + e);
+ } catch (IOException ioe) {
+ // shouldn't happen
+ Log.e(TAG, ioe.getMessage(), ioe);
+ }
+ }
+
+ @Override
+ public void updateView(Vector<Cue> activeCues) {
+ if (getRenderingWidget() != null) {
+ super.updateView(activeCues);
+ return;
+ }
+
+ if (mEventHandler == null) {
+ return;
+ }
+
+ final int _ = 0;
+ for (Cue cue : activeCues) {
+ TextTrackCue ttc = (TextTrackCue) cue;
+
+ Parcel parcel = Parcel.obtain();
+ parcel.writeInt(KEY_LOCAL_SETTING);
+ parcel.writeInt(KEY_START_TIME);
+ parcel.writeInt((int) cue.mStartTimeMs);
+
+ parcel.writeInt(KEY_STRUCT_TEXT);
+ StringBuilder sb = new StringBuilder();
+ for (String line : ttc.mStrings) {
+ sb.append(line).append('\n');
+ }
+
+ byte[] buf = sb.toString().getBytes();
+ parcel.writeInt(buf.length);
+ parcel.writeByteArray(buf);
+
+ Message msg = mEventHandler.obtainMessage(MEDIA_TIMED_TEXT, _, _, parcel);
+ mEventHandler.sendMessage(msg);
+ }
+ activeCues.clear();
+ }
+
+ private static long parseMs(String in) {
+ long hours = Long.parseLong(in.split(":")[0].trim());
+ long minutes = Long.parseLong(in.split(":")[1].trim());
+ long seconds = Long.parseLong(in.split(":")[2].split(",")[0].trim());
+ long millies = Long.parseLong(in.split(":")[2].split(",")[1].trim());
+
+ return hours * 60 * 60 * 1000 + minutes * 60 * 1000 + seconds * 1000 + millies;
+
+ }
+}
diff --git a/media/java/android/media/SubtitleController.java b/media/java/android/media/SubtitleController.java
index 13205bc..37adb8c 100644
--- a/media/java/android/media/SubtitleController.java
+++ b/media/java/android/media/SubtitleController.java
@@ -420,6 +420,19 @@
}
}
+ /** @hide */
+ public boolean hasRendererFor(MediaFormat format) {
+ synchronized(mRenderers) {
+ // TODO how to get available renderers in the system
+ for (Renderer renderer: mRenderers) {
+ if (renderer.supports(format)) {
+ return true;
+ }
+ }
+ return false;
+ }
+ }
+
/**
* Subtitle anchor, an object that is able to display a subtitle renderer,
* e.g. a VideoView.
diff --git a/media/java/android/media/SubtitleTrack.java b/media/java/android/media/SubtitleTrack.java
index 9fedf63..c760810 100644
--- a/media/java/android/media/SubtitleTrack.java
+++ b/media/java/android/media/SubtitleTrack.java
@@ -274,7 +274,10 @@
}
mVisible = true;
- getRenderingWidget().setVisible(true);
+ RenderingWidget renderingWidget = getRenderingWidget();
+ if (renderingWidget != null) {
+ renderingWidget.setVisible(true);
+ }
if (mTimeProvider != null) {
mTimeProvider.scheduleUpdate(this);
}
@@ -289,7 +292,10 @@
if (mTimeProvider != null) {
mTimeProvider.cancelNotifications(this);
}
- getRenderingWidget().setVisible(false);
+ RenderingWidget renderingWidget = getRenderingWidget();
+ if (renderingWidget != null) {
+ renderingWidget.setVisible(false);
+ }
mVisible = false;
}
@@ -602,6 +608,12 @@
}
}
+ /** @hide whether this is a text track who fires events instead getting rendered */
+ public boolean isTimedText() {
+ return getRenderingWidget() == null;
+ }
+
+
/** @hide */
private static class Run {
public Cue mFirstCue;
diff --git a/media/java/android/media/WebVttRenderer.java b/media/java/android/media/WebVttRenderer.java
index a9374d5..69e0ea6 100644
--- a/media/java/android/media/WebVttRenderer.java
+++ b/media/java/android/media/WebVttRenderer.java
@@ -1098,7 +1098,9 @@
}
}
- mRenderingWidget.setActiveCues(activeCues);
+ if (mRenderingWidget != null) {
+ mRenderingWidget.setActiveCues(activeCues);
+ }
}
}
diff --git a/media/java/android/media/projection/MediaProjection.java b/media/java/android/media/projection/MediaProjection.java
index 348a577..7c03171 100644
--- a/media/java/android/media/projection/MediaProjection.java
+++ b/media/java/android/media/projection/MediaProjection.java
@@ -160,9 +160,10 @@
public static abstract class Callback {
/**
* Called when the MediaProjection session is no longer valid.
- *
+ * <p>
* Once a MediaProjection has been stopped, it's up to the application to release any
* resources it may be holding (e.g. {@link android.hardware.display.VirtualDisplay}s).
+ * </p>
*/
public void onStop() { }
}
diff --git a/media/jni/android_media_MediaPlayer.cpp b/media/jni/android_media_MediaPlayer.cpp
index 4587cf56..73a924d 100644
--- a/media/jni/android_media_MediaPlayer.cpp
+++ b/media/jni/android_media_MediaPlayer.cpp
@@ -861,7 +861,7 @@
{"_setDataSource", "(Ljava/io/FileDescriptor;JJ)V", (void *)android_media_MediaPlayer_setDataSourceFD},
{"_setVideoSurface", "(Landroid/view/Surface;)V", (void *)android_media_MediaPlayer_setVideoSurface},
- {"prepare", "()V", (void *)android_media_MediaPlayer_prepare},
+ {"_prepare", "()V", (void *)android_media_MediaPlayer_prepare},
{"prepareAsync", "()V", (void *)android_media_MediaPlayer_prepareAsync},
{"_start", "()V", (void *)android_media_MediaPlayer_start},
{"_stop", "()V", (void *)android_media_MediaPlayer_stop},
diff --git a/packages/SystemUI/src/com/android/systemui/ExpandHelper.java b/packages/SystemUI/src/com/android/systemui/ExpandHelper.java
index a26c534..0f8fe1c 100644
--- a/packages/SystemUI/src/com/android/systemui/ExpandHelper.java
+++ b/packages/SystemUI/src/com/android/systemui/ExpandHelper.java
@@ -359,8 +359,8 @@
}
private void maybeRecycleVelocityTracker(MotionEvent event) {
- if (event.getActionMasked() == MotionEvent.ACTION_CANCEL
- || event.getActionMasked() == MotionEvent.ACTION_UP) {
+ if (mVelocityTracker != null && (event.getActionMasked() == MotionEvent.ACTION_CANCEL
+ || event.getActionMasked() == MotionEvent.ACTION_UP)) {
mVelocityTracker.recycle();
mVelocityTracker = null;
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
index b80a33b..1932843 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
@@ -937,12 +937,16 @@
}
private void updateNotificationTranslucency() {
float alpha = (getNotificationsTopY() + mNotificationStackScroller.getItemHeight())
- / (mQsMinExpansionHeight + mNotificationStackScroller.getItemHeight() / 2);
+ / (mQsMinExpansionHeight + mNotificationStackScroller.getBottomStackPeekSize()
+ + mNotificationStackScroller.getCollapseSecondCardPadding());
alpha = Math.max(0, Math.min(alpha, 1));
alpha = (float) Math.pow(alpha, 0.75);
-
- // TODO: Draw a rect with DST_OUT over the notifications to achieve the same effect -
- // this would be much more efficient.
+ if (alpha != 1f && mNotificationStackScroller.getLayerType() != LAYER_TYPE_HARDWARE) {
+ mNotificationStackScroller.setLayerType(LAYER_TYPE_HARDWARE, null);
+ } else if (alpha == 1f
+ && mNotificationStackScroller.getLayerType() == LAYER_TYPE_HARDWARE) {
+ mNotificationStackScroller.setLayerType(LAYER_TYPE_NONE, null);
+ }
mNotificationStackScroller.setAlpha(alpha);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java
index 9b819f2b..e0167e9 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java
@@ -470,6 +470,10 @@
return mBottomStackPeekSize;
}
+ public int getCollapseSecondCardPadding() {
+ return mCollapseSecondCardPadding;
+ }
+
public void setLongPressListener(SwipeHelper.LongPressListener listener) {
mSwipeHelper.setLongPressListener(listener);
mLongPressListener = listener;
@@ -1955,8 +1959,10 @@
}
public void setScrimAlpha(float progress) {
- mAmbientState.setScrimAmount(progress);
- requestChildrenUpdate();
+ if (progress != mAmbientState.getScrimAmount()) {
+ mAmbientState.setScrimAmount(progress);
+ requestChildrenUpdate();
+ }
}
/**
diff --git a/services/backup/java/com/android/server/backup/BackupManagerService.java b/services/backup/java/com/android/server/backup/BackupManagerService.java
index 9659b79..d434d7a 100644
--- a/services/backup/java/com/android/server/backup/BackupManagerService.java
+++ b/services/backup/java/com/android/server/backup/BackupManagerService.java
@@ -3151,6 +3151,13 @@
FileOutputStream outstream = new FileOutputStream(manifestFile);
outstream.write(builder.toString().getBytes());
outstream.close();
+
+ // We want the manifest block in the archive stream to be idempotent:
+ // each time we generate a backup stream for the app, we want the manifest
+ // block to be identical. The underlying tar mechanism sees it as a file,
+ // though, and will propagate its mtime, causing the tar header to vary.
+ // Avoid this problem by pinning the mtime to zero.
+ manifestFile.setLastModified(0);
}
// Widget metadata format. All header entries are strings ending in LF:
@@ -3188,6 +3195,10 @@
}
bout.flush();
out.close();
+
+ // As with the manifest file, guarantee idempotence of the archive metadata
+ // for the widget block by using a fixed mtime on the transient file.
+ destination.setLastModified(0);
}
private void tearDown(PackageInfo pkg) {
diff --git a/services/core/java/com/android/server/job/JobSchedulerService.java b/services/core/java/com/android/server/job/JobSchedulerService.java
index 587f596..9ac90dc 100644
--- a/services/core/java/com/android/server/job/JobSchedulerService.java
+++ b/services/core/java/com/android/server/job/JobSchedulerService.java
@@ -224,6 +224,9 @@
}
private void cancelJobLocked(JobStatus cancelled) {
+ if (DEBUG) {
+ Slog.d(TAG, "Cancelling: " + cancelled);
+ }
// Remove from store.
stopTrackingJob(cancelled);
// Remove from pending queue.
@@ -447,8 +450,7 @@
}
if (!stopTrackingJob(jobStatus)) {
if (DEBUG) {
- Slog.e(TAG, "Error removing job: could not find job to remove. Was job " +
- "removed while executing?");
+ Slog.d(TAG, "Could not find job to remove. Was job removed while executing?");
}
return;
}
@@ -611,7 +613,7 @@
final JobStatus running = jsc.getRunningJob();
if (running != null && running.matches(nextPending.getUid(),
nextPending.getJobId())) {
- // Already running this tId for this uId, skip.
+ // Already running this job for this uId, skip.
availableContext = null;
break;
}
@@ -691,7 +693,7 @@
@Override
public int schedule(JobInfo job) throws RemoteException {
if (DEBUG) {
- Slog.d(TAG, "Scheduling job: " + job);
+ Slog.d(TAG, "Scheduling job: " + job.toString());
}
final int pid = Binder.getCallingPid();
final int uid = Binder.getCallingUid();
diff --git a/services/core/java/com/android/server/job/JobServiceContext.java b/services/core/java/com/android/server/job/JobServiceContext.java
index ee45833..5297911 100644
--- a/services/core/java/com/android/server/job/JobServiceContext.java
+++ b/services/core/java/com/android/server/job/JobServiceContext.java
@@ -34,7 +34,6 @@
import android.os.SystemClock;
import android.os.UserHandle;
import android.os.WorkSource;
-import android.util.Log;
import android.util.Slog;
import com.android.internal.annotations.GuardedBy;
@@ -45,8 +44,22 @@
import java.util.concurrent.atomic.AtomicBoolean;
/**
- * Handles client binding and lifecycle of a job. A job will only execute one at a time on an
- * instance of this class.
+ * Handles client binding and lifecycle of a job. Jobs execute one at a time on an instance of this
+ * class.
+ *
+ * There are two important interactions into this class from the
+ * {@link com.android.server.job.JobSchedulerService}. To execute a job and to cancel a job.
+ * - Execution of a new job is handled by the {@link #mAvailable}. This bit is flipped once when a
+ * job lands, and again when it is complete.
+ * - Cancelling is trickier, because there are also interactions from the client. It's possible
+ * the {@link com.android.server.job.JobServiceContext.JobServiceHandler} tries to process a
+ * {@link #MSG_CANCEL} after the client has already finished. This is handled by having
+ * {@link com.android.server.job.JobServiceContext.JobServiceHandler#handleCancelH} check whether
+ * the context is still valid.
+ * To mitigate this, tearing down the context removes all messages from the handler, including any
+ * tardy {@link #MSG_CANCEL}s. Additionally, we avoid sending duplicate onStopJob()
+ * calls to the client after they've specified jobFinished().
+ *
*/
public class JobServiceContext extends IJobCallback.Stub implements ServiceConnection {
private static final boolean DEBUG = true;
@@ -60,7 +73,7 @@
private static final long OP_TIMEOUT_MILLIS = 8 * 1000;
private static final String[] VERB_STRINGS = {
- "VERB_STARTING", "VERB_EXECUTING", "VERB_STOPPING", "VERB_PENDING"
+ "VERB_BINDING", "VERB_STARTING", "VERB_EXECUTING", "VERB_STOPPING"
};
// States that a job occupies while interacting with the client.
@@ -101,7 +114,10 @@
IJobService service;
private final Object mLock = new Object();
- /** Whether this context is free. */
+ /**
+ * Whether this context is free. This is set to false at the start of execution, and reset to
+ * true when execution is complete.
+ */
@GuardedBy("mLock")
private boolean mAvailable;
/** Track start time. */
@@ -164,9 +180,15 @@
}
}
- /** Used externally to query the running job. Will return null if there is no job running. */
+ /**
+ * Used externally to query the running job. Will return null if there is no job running.
+ * Be careful when using this function, at any moment it's possible that the job returned may
+ * stop executing.
+ */
JobStatus getRunningJob() {
- return mRunningJob;
+ synchronized (mLock) {
+ return mRunningJob;
+ }
}
/** Called externally when a job that was scheduled for execution should be cancelled. */
@@ -242,10 +264,7 @@
mCallbackHandler.obtainMessage(MSG_SERVICE_BOUND).sendToTarget();
}
- /**
- * If the client service crashes we reschedule this job and clean up.
- * @param name The concrete component name of the service whose
- */
+ /** If the client service crashes we reschedule this job and clean up. */
@Override
public void onServiceDisconnected(ComponentName name) {
mCallbackHandler.obtainMessage(MSG_SHUTDOWN_EXECUTION).sendToTarget();
@@ -312,7 +331,7 @@
closeAndCleanupJobH(true /* needsReschedule */);
break;
default:
- Log.e(TAG, "Unrecognised message: " + message);
+ Slog.e(TAG, "Unrecognised message: " + message);
}
}
@@ -337,7 +356,7 @@
scheduleOpTimeOut();
service.startJob(mParams);
} catch (RemoteException e) {
- Log.e(TAG, "Error sending onStart message to '" +
+ Slog.e(TAG, "Error sending onStart message to '" +
mRunningJob.getServiceComponent().getShortClassName() + "' ", e);
}
}
@@ -359,6 +378,9 @@
return;
}
if (mCancelled.get()) {
+ if (DEBUG) {
+ Slog.d(TAG, "Job cancelled while waiting for onStartJob to complete.");
+ }
// Cancelled *while* waiting for acknowledgeStartMessage from client.
handleCancelH();
return;
@@ -366,7 +388,7 @@
scheduleOpTimeOut();
break;
default:
- Log.e(TAG, "Handling started job but job wasn't starting! Was "
+ Slog.e(TAG, "Handling started job but job wasn't starting! Was "
+ VERB_STRINGS[mVerb] + ".");
return;
}
@@ -396,16 +418,31 @@
* {@link #onServiceConnected(android.content.ComponentName, android.os.IBinder)}
* _STARTING -> Mark as cancelled and wait for
* {@link JobServiceContext#acknowledgeStartMessage(int, boolean)}
- * _EXECUTING -> call {@link #sendStopMessageH}}.
+ * _EXECUTING -> call {@link #sendStopMessageH}}, but only if there are no callbacks
+ * in the message queue.
* _ENDING -> No point in doing anything here, so we ignore.
*/
private void handleCancelH() {
+ if (mRunningJob == null) {
+ if (DEBUG) {
+ Slog.d(TAG, "Trying to process cancel for torn-down context, ignoring.");
+ }
+ return;
+ }
+ if (JobSchedulerService.DEBUG) {
+ Slog.d(TAG, "Handling cancel for: " + mRunningJob.getJobId() + " "
+ + VERB_STRINGS[mVerb]);
+ }
switch (mVerb) {
case VERB_BINDING:
case VERB_STARTING:
mCancelled.set(true);
break;
case VERB_EXECUTING:
+ if (hasMessages(MSG_CALLBACK)) {
+ // If the client has called jobFinished, ignore this cancel.
+ return;
+ }
sendStopMessageH();
break;
case VERB_STOPPING:
@@ -419,8 +456,8 @@
/** Process MSG_TIMEOUT here. */
private void handleOpTimeoutH() {
- if (Log.isLoggable(JobSchedulerService.TAG, Log.DEBUG)) {
- Log.d(TAG, "MSG_TIMEOUT of " +
+ if (JobSchedulerService.DEBUG) {
+ Slog.d(TAG, "MSG_TIMEOUT of " +
mRunningJob.getServiceComponent().getShortClassName() + " : "
+ mParams.getJobId());
}
@@ -431,28 +468,28 @@
// Client unresponsive - wedged or failed to respond in time. We don't really
// know what happened so let's log it and notify the JobScheduler
// FINISHED/NO-RETRY.
- Log.e(TAG, "No response from client for onStartJob '" +
- mRunningJob.getServiceComponent().getShortClassName() + "' tId: "
+ Slog.e(TAG, "No response from client for onStartJob '" +
+ mRunningJob.getServiceComponent().getShortClassName() + "' jId: "
+ jobId);
closeAndCleanupJobH(false /* needsReschedule */);
break;
case VERB_STOPPING:
// At least we got somewhere, so fail but ask the JobScheduler to reschedule.
- Log.e(TAG, "No response from client for onStopJob, '" +
- mRunningJob.getServiceComponent().getShortClassName() + "' tId: "
+ Slog.e(TAG, "No response from client for onStopJob, '" +
+ mRunningJob.getServiceComponent().getShortClassName() + "' jId: "
+ jobId);
closeAndCleanupJobH(true /* needsReschedule */);
break;
case VERB_EXECUTING:
// Not an error - client ran out of time.
- Log.i(TAG, "Client timed out while executing (no jobFinished received)." +
+ Slog.i(TAG, "Client timed out while executing (no jobFinished received)." +
" sending onStop. " +
- mRunningJob.getServiceComponent().getShortClassName() + "' tId: "
+ mRunningJob.getServiceComponent().getShortClassName() + "' jId: "
+ jobId);
sendStopMessageH();
break;
default:
- Log.e(TAG, "Handling timeout for an unknown active job state: "
+ Slog.e(TAG, "Handling timeout for an unknown active job state: "
+ mRunningJob);
return;
}
@@ -465,7 +502,7 @@
private void sendStopMessageH() {
mCallbackHandler.removeMessages(MSG_TIMEOUT);
if (mVerb != VERB_EXECUTING) {
- Log.e(TAG, "Sending onStopJob for a job that isn't started. " + mRunningJob);
+ Slog.e(TAG, "Sending onStopJob for a job that isn't started. " + mRunningJob);
closeAndCleanupJobH(false /* reschedule */);
return;
}
@@ -474,7 +511,7 @@
scheduleOpTimeOut();
service.stopJob(mParams);
} catch (RemoteException e) {
- Log.e(TAG, "Error sending onStopJob to client.", e);
+ Slog.e(TAG, "Error sending onStopJob to client.", e);
closeAndCleanupJobH(false /* reschedule */);
}
}
@@ -486,8 +523,7 @@
* we want to clean up internally.
*/
private void closeAndCleanupJobH(boolean reschedule) {
- removeMessages(MSG_TIMEOUT);
- mCompletedListener.onJobCompleted(mRunningJob, reschedule);
+ final JobStatus completedJob = mRunningJob;
synchronized (mLock) {
try {
mBatteryStats.noteJobFinish(mRunningJob.getName(), mRunningJob.getUid());
@@ -504,12 +540,18 @@
service = null;
mAvailable = true;
}
+ removeMessages(MSG_TIMEOUT);
+ removeMessages(MSG_CALLBACK);
+ removeMessages(MSG_SERVICE_BOUND);
+ removeMessages(MSG_CANCEL);
+ removeMessages(MSG_SHUTDOWN_EXECUTION);
+ mCompletedListener.onJobCompleted(completedJob, reschedule);
}
/**
- * Called when sending a message to the client, over whose execution we have no control. If we
- * haven't received a response in a certain amount of time, we want to give up and carry on
- * with life.
+ * Called when sending a message to the client, over whose execution we have no control. If
+ * we haven't received a response in a certain amount of time, we want to give up and carry
+ * on with life.
*/
private void scheduleOpTimeOut() {
mCallbackHandler.removeMessages(MSG_TIMEOUT);
diff --git a/services/voiceinteraction/java/com/android/server/voiceinteraction/SoundTriggerHelper.java b/services/voiceinteraction/java/com/android/server/voiceinteraction/SoundTriggerHelper.java
index 1e4a518..fe1b92a 100644
--- a/services/voiceinteraction/java/com/android/server/voiceinteraction/SoundTriggerHelper.java
+++ b/services/voiceinteraction/java/com/android/server/voiceinteraction/SoundTriggerHelper.java
@@ -19,6 +19,8 @@
import android.hardware.soundtrigger.IRecognitionStatusCallback;
import android.hardware.soundtrigger.SoundTrigger;
import android.hardware.soundtrigger.SoundTrigger.Keyphrase;
+import android.hardware.soundtrigger.SoundTrigger.KeyphraseRecognitionEvent;
+import android.hardware.soundtrigger.SoundTrigger.KeyphraseRecognitionExtra;
import android.hardware.soundtrigger.SoundTrigger.KeyphraseSoundModel;
import android.hardware.soundtrigger.SoundTrigger.ModuleProperties;
import android.hardware.soundtrigger.SoundTrigger.RecognitionConfig;
@@ -40,8 +42,6 @@
static final String TAG = "SoundTriggerHelper";
// TODO: Set to false.
static final boolean DBG = true;
- // TODO: Remove this.
- static final int TEMP_KEYPHRASE_ID = 100;
/**
* Return codes for {@link #startRecognition(int, KeyphraseSoundModel,
@@ -117,7 +117,7 @@
}
if (mCurrentSoundModelHandle != INVALID_SOUND_MODEL_HANDLE) {
- Slog.w(TAG, "Canceling previous recognition");
+ Slog.w(TAG, "Unloading previous sound model");
// TODO: Inspect the return codes here.
mModule.unloadSoundModel(mCurrentSoundModelHandle);
mCurrentSoundModelHandle = INVALID_SOUND_MODEL_HANDLE;
@@ -127,6 +127,7 @@
// Notify them that it was stopped.
IRecognitionStatusCallback oldListener = mActiveListeners.get(keyphraseId);
if (oldListener != null && oldListener.asBinder() != listener.asBinder()) {
+ Slog.w(TAG, "Canceling previous recognition");
try {
oldListener.onDetectionStopped();
} catch (RemoteException e) {
@@ -221,33 +222,51 @@
//---- SoundTrigger.StatusListener methods
@Override
public void onRecognition(RecognitionEvent event) {
- // Check which keyphrase triggered, and fire the appropriate event.
- // TODO: Get the keyphrase out of the event and fire events on it.
- // For now, as a nasty workaround, we fire all events to the listener for
- // keyphrase with TEMP_KEYPHRASE_ID.
- IRecognitionStatusCallback listener = null;
- synchronized(this) {
- // TODO: The keyphrase should come from the recognition event
- // as it may be for a different keyphrase than the current one.
- listener = mActiveListeners.get(TEMP_KEYPHRASE_ID);
- }
- if (listener == null) {
- Slog.w(TAG, "received onRecognition event without any listener for it");
+ if (event == null) {
+ Slog.w(TAG, "Invalid recognition event!");
return;
}
+ if (DBG) Slog.d(TAG, "onRecognition: " + event);
switch (event.status) {
- case SoundTrigger.RECOGNITION_STATUS_SUCCESS:
- try {
- listener.onDetected(event);
- } catch (RemoteException e) {
- Slog.w(TAG, "RemoteException in onDetected");
- }
- break;
+ // Fire aborts/failures to all listeners since it's not tied to a keyphrase.
case SoundTrigger.RECOGNITION_STATUS_ABORT: // fall-through
case SoundTrigger.RECOGNITION_STATUS_FAILURE:
try {
- listener.onDetectionStopped();
+ synchronized (this) {
+ for (int i = 0; i < mActiveListeners.size(); i++) {
+ mActiveListeners.valueAt(i).onDetectionStopped();
+ }
+ }
+ } catch (RemoteException e) {
+ Slog.w(TAG, "RemoteException in onDetectionStopped");
+ }
+ break;
+ case SoundTrigger.RECOGNITION_STATUS_SUCCESS:
+ if (!(event instanceof KeyphraseRecognitionEvent)) {
+ Slog.w(TAG, "Invalid recognition event!");
+ return;
+ }
+
+ KeyphraseRecognitionExtra[] keyphraseExtras =
+ ((KeyphraseRecognitionEvent) event).keyphraseExtras;
+ if (keyphraseExtras == null || keyphraseExtras.length == 0) {
+ Slog.w(TAG, "Invalid keyphrase recognition event!");
+ return;
+ }
+ // TODO: Handle more than one keyphrase extras.
+ int keyphraseId = keyphraseExtras[0].id;
+ try {
+ synchronized(this) {
+ // Check which keyphrase triggered, and fire the appropriate event.
+ IRecognitionStatusCallback listener = mActiveListeners.get(keyphraseId);
+ if (listener != null) {
+ listener.onDetected((KeyphraseRecognitionEvent) event);
+ } else {
+ Slog.w(TAG, "received onRecognition event without any listener for it");
+ return;
+ }
+ }
} catch (RemoteException e) {
Slog.w(TAG, "RemoteException in onDetectionStopped");
}
@@ -257,6 +276,17 @@
@Override
public void onServiceDied() {
- // TODO: Figure out how to restart the recognition here.
+ synchronized (this) {
+ try {
+ for (int i = 0; i < mActiveListeners.size(); i++) {
+ mActiveListeners.valueAt(i).onDetectionStopped();
+ }
+ } catch (RemoteException e) {
+ Slog.w(TAG, "RemoteException in onDetectionStopped");
+ }
+ mCurrentSoundModelHandle = INVALID_SOUND_MODEL_HANDLE;
+ // Remove all listeners.
+ mActiveListeners.clear();
+ }
}
}
diff --git a/telecomm/java/android/telecomm/Connection.java b/telecomm/java/android/telecomm/Connection.java
index 7123e09..8845821 100644
--- a/telecomm/java/android/telecomm/Connection.java
+++ b/telecomm/java/android/telecomm/Connection.java
@@ -130,10 +130,10 @@
/**
* Returns the video state of the call.
- * Valid values: {@link android.telecomm.VideoCallProfile#VIDEO_STATE_AUDIO_ONLY},
- * {@link android.telecomm.VideoCallProfile#VIDEO_STATE_BIDIRECTIONAL},
- * {@link android.telecomm.VideoCallProfile#VIDEO_STATE_TX_ENABLED},
- * {@link android.telecomm.VideoCallProfile#VIDEO_STATE_RX_ENABLED}.
+ * Valid values: {@link android.telecomm.VideoCallProfile.VideoState#AUDIO_ONLY},
+ * {@link android.telecomm.VideoCallProfile.VideoState#BIDIRECTIONAL},
+ * {@link android.telecomm.VideoCallProfile.VideoState#TX_ENABLED},
+ * {@link android.telecomm.VideoCallProfile.VideoState#RX_ENABLED}.
*
* @return The video state of the call.
*/
@@ -357,10 +357,10 @@
/**
* Set the video state for the connection.
- * Valid values: {@link android.telecomm.VideoCallProfile#VIDEO_STATE_AUDIO_ONLY},
- * {@link android.telecomm.VideoCallProfile#VIDEO_STATE_BIDIRECTIONAL},
- * {@link android.telecomm.VideoCallProfile#VIDEO_STATE_TX_ENABLED},
- * {@link android.telecomm.VideoCallProfile#VIDEO_STATE_RX_ENABLED}.
+ * Valid values: {@link android.telecomm.VideoCallProfile.VideoState#AUDIO_ONLY},
+ * {@link android.telecomm.VideoCallProfile.VideoState#BIDIRECTIONAL},
+ * {@link android.telecomm.VideoCallProfile.VideoState#TX_ENABLED},
+ * {@link android.telecomm.VideoCallProfile.VideoState#RX_ENABLED}.
*
* @param videoState The new video state.
*/
diff --git a/telecomm/java/android/telecomm/ConnectionRequest.java b/telecomm/java/android/telecomm/ConnectionRequest.java
index 020b692..1016091 100644
--- a/telecomm/java/android/telecomm/ConnectionRequest.java
+++ b/telecomm/java/android/telecomm/ConnectionRequest.java
@@ -101,10 +101,10 @@
/**
* Determines the video state for the connection.
- * Valid values: {@link VideoCallProfile#VIDEO_STATE_AUDIO_ONLY},
- * {@link VideoCallProfile#VIDEO_STATE_BIDIRECTIONAL},
- * {@link VideoCallProfile#VIDEO_STATE_TX_ENABLED},
- * {@link VideoCallProfile#VIDEO_STATE_RX_ENABLED}.
+ * Valid values: {@link VideoCallProfile.VideoState#AUDIO_ONLY},
+ * {@link VideoCallProfile.VideoState#BIDIRECTIONAL},
+ * {@link VideoCallProfile.VideoState#TX_ENABLED},
+ * {@link VideoCallProfile.VideoState#RX_ENABLED}.
*
* @return The video state for the connection.
*/
diff --git a/telecomm/java/android/telecomm/TelecommManager.java b/telecomm/java/android/telecomm/TelecommManager.java
index 49f95a6..0f31c52 100644
--- a/telecomm/java/android/telecomm/TelecommManager.java
+++ b/telecomm/java/android/telecomm/TelecommManager.java
@@ -72,10 +72,10 @@
* Optional extra for {@link android.content.Intent#ACTION_CALL} containing an integer that
* determines the desired video state for an outgoing call.
* Valid options:
- * {@link android.telecomm.VideoCallProfile#VIDEO_STATE_AUDIO_ONLY},
- * {@link android.telecomm.VideoCallProfile#VIDEO_STATE_BIDIRECTIONAL},
- * {@link android.telecomm.VideoCallProfile#VIDEO_STATE_RX_ENABLED},
- * {@link android.telecomm.VideoCallProfile#VIDEO_STATE_TX_ENABLED}.
+ * {@link android.telecomm.VideoCallProfile.VideoState#AUDIO_ONLY},
+ * {@link android.telecomm.VideoCallProfile.VideoState#BIDIRECTIONAL},
+ * {@link android.telecomm.VideoCallProfile.VideoState#RX_ENABLED},
+ * {@link android.telecomm.VideoCallProfile.VideoState#TX_ENABLED}.
*/
public static final String EXTRA_START_CALL_WITH_VIDEO_STATE =
"android.intent.extra.START_CALL_WITH_VIDEO_STATE";
diff --git a/telecomm/java/android/telecomm/VideoCallProfile.java b/telecomm/java/android/telecomm/VideoCallProfile.java
index 5b15e4a..24c6996 100644
--- a/telecomm/java/android/telecomm/VideoCallProfile.java
+++ b/telecomm/java/android/telecomm/VideoCallProfile.java
@@ -24,32 +24,6 @@
*/
public class VideoCallProfile implements Parcelable {
/**
- * Call is currently in an audio-only mode with no video transmission or receipt.
- */
- public static final int VIDEO_STATE_AUDIO_ONLY = 0x0;
-
- /**
- * Video transmission is enabled.
- */
- public static final int VIDEO_STATE_TX_ENABLED = 0x1;
-
- /**
- * Video reception is enabled.
- */
- public static final int VIDEO_STATE_RX_ENABLED = 0x2;
-
- /**
- * Video signal is bi-directional.
- */
- public static final int VIDEO_STATE_BIDIRECTIONAL =
- VIDEO_STATE_TX_ENABLED | VIDEO_STATE_RX_ENABLED;
-
- /**
- * Video is paused.
- */
- public static final int VIDEO_STATE_PAUSED = 0x4;
-
- /**
* "High" video quality.
*/
public static final int QUALITY_HIGH = 1;
@@ -94,13 +68,12 @@
}
/**
- * The video state of the call. Stored as a bit-field describing whether video transmission and
- * receipt it enabled, as well as whether the video is currently muted.
- * Valid values: {@link VideoCallProfile#VIDEO_STATE_AUDIO_ONLY},
- * {@link VideoCallProfile#VIDEO_STATE_BIDIRECTIONAL},
- * {@link VideoCallProfile#VIDEO_STATE_TX_ENABLED},
- * {@link VideoCallProfile#VIDEO_STATE_RX_ENABLED},
- * {@link VideoCallProfile#VIDEO_STATE_PAUSED}.
+ * The video state of the call.
+ * Valid values: {@link VideoCallProfile.VideoState#AUDIO_ONLY},
+ * {@link VideoCallProfile.VideoState#BIDIRECTIONAL},
+ * {@link VideoCallProfile.VideoState#TX_ENABLED},
+ * {@link VideoCallProfile.VideoState#RX_ENABLED},
+ * {@link VideoCallProfile.VideoState#PAUSED}.
*/
public int getVideoState() {
return mVideoState;
@@ -165,4 +138,92 @@
dest.writeInt(mVideoState);
dest.writeInt(mQuality);
}
+
+ /**
+ * The video state of the call, stored as a bit-field describing whether video transmission and
+ * receipt it enabled, as well as whether the video is currently muted.
+ */
+ public static class VideoState {
+ /**
+ * Call is currently in an audio-only mode with no video transmission or receipt.
+ */
+ public static final int AUDIO_ONLY = 0x0;
+
+ /**
+ * Video transmission is enabled.
+ */
+ public static final int TX_ENABLED = 0x1;
+
+ /**
+ * Video reception is enabled.
+ */
+ public static final int RX_ENABLED = 0x2;
+
+ /**
+ * Video signal is bi-directional.
+ */
+ public static final int BIDIRECTIONAL = TX_ENABLED | RX_ENABLED;
+
+ /**
+ * Video is paused.
+ */
+ public static final int PAUSED = 0x4;
+
+ /**
+ * Whether the video state is audio only.
+ * @param videoState The video state.
+ * @return Returns true if the video state is audio only.
+ */
+ public static boolean isAudioOnly(int videoState) {
+ return !hasState(videoState, TX_ENABLED) && !hasState(videoState, RX_ENABLED);
+ }
+
+ /**
+ * Whether the video transmission is enabled.
+ * @param videoState The video state.
+ * @return Returns true if the video transmission is enabled.
+ */
+ public static boolean isTransmissionEnabled(int videoState) {
+ return hasState(videoState, TX_ENABLED);
+ }
+
+ /**
+ * Whether the video reception is enabled.
+ * @param videoState The video state.
+ * @return Returns true if the video transmission is enabled.
+ */
+ public static boolean isReceptionEnabled(int videoState) {
+ return hasState(videoState, RX_ENABLED);
+ }
+
+ /**
+ * Whether the video signal is bi-directional.
+ * @param videoState
+ * @return Returns true if the video signal is bi-directional.
+ */
+ public static boolean isBidirectional(int videoState) {
+ return hasState(videoState, BIDIRECTIONAL);
+ }
+
+ /**
+ * Whether the video is paused.
+ * @param videoState The video state.
+ * @return Returns true if the video is paused.
+ */
+ public static boolean isPaused(int videoState) {
+ return hasState(videoState, PAUSED);
+ }
+
+ /**
+ * Determines if a specified state is set in a videoState bit-mask.
+ *
+ * @param videoState The video state bit-mask.
+ * @param state The state to check.
+ * @return {@code True} if the state is set.
+ * {@hide}
+ */
+ private static boolean hasState(int videoState, int state) {
+ return (videoState & state) == state;
+ }
+ }
}
diff --git a/telephony/java/com/android/ims/ImsCallProfile.java b/telephony/java/com/android/ims/ImsCallProfile.java
index 6896f4d..adcb435 100644
--- a/telephony/java/com/android/ims/ImsCallProfile.java
+++ b/telephony/java/com/android/ims/ImsCallProfile.java
@@ -298,18 +298,18 @@
public static int getVideoStateFromCallType(int callType) {
switch (callType) {
case CALL_TYPE_VT_NODIR:
- return VideoCallProfile.VIDEO_STATE_PAUSED |
- VideoCallProfile.VIDEO_STATE_BIDIRECTIONAL;
+ return VideoCallProfile.VideoState.PAUSED |
+ VideoCallProfile.VideoState.BIDIRECTIONAL;
case CALL_TYPE_VT_TX:
- return VideoCallProfile.VIDEO_STATE_TX_ENABLED;
+ return VideoCallProfile.VideoState.TX_ENABLED;
case CALL_TYPE_VT_RX:
- return VideoCallProfile.VIDEO_STATE_RX_ENABLED;
+ return VideoCallProfile.VideoState.RX_ENABLED;
case CALL_TYPE_VT:
- return VideoCallProfile.VIDEO_STATE_BIDIRECTIONAL;
+ return VideoCallProfile.VideoState.BIDIRECTIONAL;
case CALL_TYPE_VOICE:
- return VideoCallProfile.VIDEO_STATE_AUDIO_ONLY;
+ return VideoCallProfile.VideoState.AUDIO_ONLY;
default:
- return VideoCallProfile.VIDEO_STATE_AUDIO_ONLY;
+ return VideoCallProfile.VideoState.AUDIO_ONLY;
}
}
@@ -321,9 +321,9 @@
* @return The call type.
*/
public static int getCallTypeFromVideoState(int videoState) {
- boolean videoTx = isVideoStateSet(videoState, VideoCallProfile.VIDEO_STATE_TX_ENABLED);
- boolean videoRx = isVideoStateSet(videoState, VideoCallProfile.VIDEO_STATE_RX_ENABLED);
- boolean isPaused = isVideoStateSet(videoState, VideoCallProfile.VIDEO_STATE_PAUSED);
+ boolean videoTx = isVideoStateSet(videoState, VideoCallProfile.VideoState.TX_ENABLED);
+ boolean videoRx = isVideoStateSet(videoState, VideoCallProfile.VideoState.RX_ENABLED);
+ boolean isPaused = isVideoStateSet(videoState, VideoCallProfile.VideoState.PAUSED);
if (isPaused) {
return ImsCallProfile.CALL_TYPE_VT_NODIR;
} else if (videoTx && !videoRx) {
diff --git a/tests/JobSchedulerTestApp/src/com/android/demo/jobSchedulerApp/service/TestJobService.java b/tests/JobSchedulerTestApp/src/com/android/demo/jobSchedulerApp/service/TestJobService.java
index bf8e887..e2c3be0 100644
--- a/tests/JobSchedulerTestApp/src/com/android/demo/jobSchedulerApp/service/TestJobService.java
+++ b/tests/JobSchedulerTestApp/src/com/android/demo/jobSchedulerApp/service/TestJobService.java
@@ -20,16 +20,21 @@
import android.app.job.JobScheduler;
import android.app.job.JobParameters;
import android.app.job.JobService;
+import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
+import android.os.AsyncTask;
import android.os.Message;
import android.os.Messenger;
import android.os.RemoteException;
import android.util.Log;
+import android.util.SparseArray;
import com.android.demo.jobSchedulerApp.MainActivity;
+import java.util.HashMap;
import java.util.LinkedList;
+import java.util.Random;
/**
@@ -75,39 +80,76 @@
@Override
public boolean onStartJob(JobParameters params) {
- jobParamsMap.add(params);
+ Log.i(TAG, "on start job: " + params.getJobId());
+ currentId++;
+ jobParamsMap.put(currentId, params);
+ final int currId = this.currentId;
+ Log.d(TAG, "putting :" + currId + " for " + params.toString());
+ Log.d(TAG, " pulled: " + jobParamsMap.get(currId));
if (mActivity != null) {
mActivity.onReceivedStartJob(params);
}
- Log.i(TAG, "on start job: " + params.getJobId());
+
+ // Spin off a new task on a separate thread for a couple seconds.
+ new AsyncTask<Void, Void, Void>() {
+ @Override
+ protected Void doInBackground(Void... voids) {
+ try {
+ Log.d(TAG, "Sleeping for 3 seconds.");
+ Thread.sleep(3000L);
+ } catch (InterruptedException e) {}
+ final JobParameters params = jobParamsMap.get(currId);
+ Log.d(TAG, "Pulled :" + currId + " " + params);
+ jobFinished(params, false);
+
+ Log.d(TAG, "Rescheduling new job: " + params.getJobId());
+ scheduleJob(
+ new JobInfo.Builder(params.getJobId(),
+ new ComponentName(getBaseContext(), TestJobService.class))
+ .setMinimumLatency(2000L)
+ .setOverrideDeadline(3000L)
+ .setRequiresCharging(true)
+ .build()
+ );
+
+ return null;
+ }
+ }.execute();
return true;
}
+
@Override
public boolean onStopJob(JobParameters params) {
- jobParamsMap.remove(params);
- mActivity.onReceivedStopJob();
Log.i(TAG, "on stop job: " + params.getJobId());
+ int ind = jobParamsMap.indexOfValue(params);
+ jobParamsMap.remove(ind);
+ mActivity.onReceivedStopJob();
return true;
}
+ static int currentId = 0;
MainActivity mActivity;
- private final LinkedList<JobParameters> jobParamsMap = new LinkedList<JobParameters>();
+ private final SparseArray<JobParameters> jobParamsMap = new SparseArray<JobParameters>();
+
public void setUiCallback(MainActivity activity) {
mActivity = activity;
}
/** Send job to the JobScheduler. */
- public void scheduleJob(JobInfo t) {
- Log.d(TAG, "Scheduling job");
+ public void scheduleJob(JobInfo job) {
+ Log.d(TAG, "Scheduling job " + job);
JobScheduler tm =
(JobScheduler) getSystemService(Context.JOB_SCHEDULER_SERVICE);
- tm.schedule(t);
+ tm.schedule(job);
}
public boolean callJobFinished() {
- JobParameters params = jobParamsMap.poll();
+ if (jobParamsMap.size() == 0) {
+ return false;
+ }
+ JobParameters params = jobParamsMap.valueAt(0);
if (params == null) {
return false;
} else {
diff --git a/tests/SoundTriggerTests/src/android/hardware/soundtrigger/SoundTriggerTest.java b/tests/SoundTriggerTests/src/android/hardware/soundtrigger/SoundTriggerTest.java
index 5d32c66e..4372ff9 100644
--- a/tests/SoundTriggerTests/src/android/hardware/soundtrigger/SoundTriggerTest.java
+++ b/tests/SoundTriggerTests/src/android/hardware/soundtrigger/SoundTriggerTest.java
@@ -17,7 +17,10 @@
package android.hardware.soundtrigger;
import android.hardware.soundtrigger.SoundTrigger;
+import android.hardware.soundtrigger.SoundTrigger.ConfidenceLevel;
import android.hardware.soundtrigger.SoundTrigger.Keyphrase;
+import android.hardware.soundtrigger.SoundTrigger.KeyphraseRecognitionEvent;
+import android.hardware.soundtrigger.SoundTrigger.KeyphraseRecognitionExtra;
import android.hardware.soundtrigger.SoundTrigger.KeyphraseSoundModel;
import android.hardware.soundtrigger.SoundTrigger.RecognitionEvent;
import android.os.Parcel;
@@ -253,4 +256,78 @@
// Verify that they are the same
assertEquals(re, unparceled);
}
+
+ @SmallTest
+ public void testKeyphraseRecognitionEventParcelUnparcel_noKeyphrases() throws Exception {
+ KeyphraseRecognitionEvent re = new KeyphraseRecognitionEvent(
+ SoundTrigger.RECOGNITION_STATUS_SUCCESS, 1, true, 2, 3, 4, null, false, null);
+
+ // Write to a parcel
+ Parcel parcel = Parcel.obtain();
+ re.writeToParcel(parcel, 0);
+
+ // Read from it
+ parcel.setDataPosition(0);
+ KeyphraseRecognitionEvent unparceled =
+ KeyphraseRecognitionEvent.CREATOR.createFromParcel(parcel);
+
+ // Verify that they are the same
+ assertEquals(re, unparceled);
+ }
+
+ @SmallTest
+ public void testKeyphraseRecognitionEventParcelUnparcel_zeroData() throws Exception {
+ KeyphraseRecognitionExtra[] kpExtra = new KeyphraseRecognitionExtra[0];
+ KeyphraseRecognitionEvent re = new KeyphraseRecognitionEvent(
+ SoundTrigger.RECOGNITION_STATUS_FAILURE, 2, true, 2, 3, 4, new byte[1],
+ true, kpExtra);
+
+ // Write to a parcel
+ Parcel parcel = Parcel.obtain();
+ re.writeToParcel(parcel, 0);
+
+ // Read from it
+ parcel.setDataPosition(0);
+ KeyphraseRecognitionEvent unparceled =
+ KeyphraseRecognitionEvent.CREATOR.createFromParcel(parcel);
+
+ // Verify that they are the same
+ assertEquals(re, unparceled);
+ }
+
+ @LargeTest
+ public void testKeyphraseRecognitionEventParcelUnparcel_largeData() throws Exception {
+ byte[] data = new byte[200 * 1024];
+ mRandom.nextBytes(data);
+ KeyphraseRecognitionExtra[] kpExtra = new KeyphraseRecognitionExtra[4];
+ ConfidenceLevel cl1 = new ConfidenceLevel(1, 90);
+ ConfidenceLevel cl2 = new ConfidenceLevel(2, 30);
+ kpExtra[0] = new KeyphraseRecognitionExtra(1,
+ SoundTrigger.RECOGNITION_MODE_USER_IDENTIFICATION,
+ new ConfidenceLevel[] {cl1, cl2});
+ kpExtra[1] = new KeyphraseRecognitionExtra(1,
+ SoundTrigger.RECOGNITION_MODE_VOICE_TRIGGER,
+ new ConfidenceLevel[] {cl2});
+ kpExtra[2] = new KeyphraseRecognitionExtra(1,
+ SoundTrigger.RECOGNITION_MODE_VOICE_TRIGGER, null);
+ kpExtra[3] = new KeyphraseRecognitionExtra(1,
+ SoundTrigger.RECOGNITION_MODE_VOICE_TRIGGER,
+ new ConfidenceLevel[0]);
+
+ KeyphraseRecognitionEvent re = new KeyphraseRecognitionEvent(
+ SoundTrigger.RECOGNITION_STATUS_FAILURE, 1, true, 2, 3, 4, data,
+ false, kpExtra);
+
+ // Write to a parcel
+ Parcel parcel = Parcel.obtain();
+ re.writeToParcel(parcel, 0);
+
+ // Read from it
+ parcel.setDataPosition(0);
+ KeyphraseRecognitionEvent unparceled =
+ KeyphraseRecognitionEvent.CREATOR.createFromParcel(parcel);
+
+ // Verify that they are the same
+ assertEquals(re, unparceled);
+ }
}
diff --git a/tests/UsesFeature2Test/AndroidManifest.xml b/tests/UsesFeature2Test/AndroidManifest.xml
index 724d186..6b6c4da 100644
--- a/tests/UsesFeature2Test/AndroidManifest.xml
+++ b/tests/UsesFeature2Test/AndroidManifest.xml
@@ -30,6 +30,7 @@
</feature-group>
<feature-group android:label="@string/gamepad">
<uses-feature android:name="android.hardware.gamepad" />
+ <uses-feature android:name="android.hardware.opengles.aep" />
</feature-group>
<application android:label="@string/app_title">
diff --git a/tools/aapt/Command.cpp b/tools/aapt/Command.cpp
index ac1ae70..afeb546 100644
--- a/tools/aapt/Command.cpp
+++ b/tools/aapt/Command.cpp
@@ -611,6 +611,8 @@
* Represents a <feature-group> tag in the AndroidManifest.xml
*/
struct FeatureGroup {
+ FeatureGroup() : openGLESVersion(-1) {}
+
/**
* Human readable label
*/
@@ -620,6 +622,11 @@
* Explicit features defined in the group
*/
KeyedVector<String8, bool> features;
+
+ /**
+ * OpenGL ES version required
+ */
+ int openGLESVersion;
};
static void addImpliedFeature(KeyedVector<String8, ImpliedFeature>* impliedFeatures,
@@ -637,6 +644,10 @@
const KeyedVector<String8, ImpliedFeature>* impliedFeatures = NULL) {
printf("feature-group: label='%s'\n", grp.label.string());
+ if (grp.openGLESVersion > 0) {
+ printf(" uses-gl-es: '0x%x'\n", grp.openGLESVersion);
+ }
+
const size_t numFeatures = grp.features.size();
for (size_t i = 0; i < numFeatures; i++) {
if (!grp.features[i]) {
@@ -688,6 +699,11 @@
} else if (name == "android.hardware.touchscreen.multitouch.distinct") {
grp->features.add(String8("android.hardware.touchscreen.multitouch"), true);
grp->features.add(String8("android.hardware.touchscreen"), true);
+ } else if (name == "android.hardware.opengles.aep") {
+ const int openGLESVersion31 = 0x00030001;
+ if (openGLESVersion31 > grp->openGLESVersion) {
+ grp->openGLESVersion = openGLESVersion31;
+ }
}
}
@@ -1316,14 +1332,16 @@
int vers = getIntegerAttribute(tree,
GL_ES_VERSION_ATTR, &error);
if (error == "") {
- printf("uses-gl-es:'0x%x'\n", vers);
+ if (vers > commonFeatures.openGLESVersion) {
+ commonFeatures.openGLESVersion = vers;
+ }
}
}
} else if (tag == "uses-permission") {
String8 name = getAttribute(tree, NAME_ATTR, &error);
if (name != "" && error == "") {
if (name == "android.permission.CAMERA") {
- addImpliedFeature(&impliedFeatures, "android.hardware.feature",
+ addImpliedFeature(&impliedFeatures, "android.hardware.camera",
String8::format("requested %s permission", name.string())
.string());
} else if (name == "android.permission.ACCESS_FINE_LOCATION") {
@@ -1639,18 +1657,23 @@
}
}
} else if (withinFeatureGroup && tag == "uses-feature") {
- String8 name = getResolvedAttribute(&res, tree, NAME_ATTR, &error);
- if (error != "") {
- fprintf(stderr, "ERROR getting 'android:name' attribute: %s\n",
- error.string());
- goto bail;
- }
-
- int required = getIntegerAttribute(tree, REQUIRED_ATTR, NULL, 1);
FeatureGroup& top = featureGroups.editTop();
- top.features.add(name, required);
- if (required) {
- addParentFeatures(&top, name);
+
+ String8 name = getResolvedAttribute(&res, tree, NAME_ATTR, &error);
+ if (name != "" && error == "") {
+ int required = getIntegerAttribute(tree, REQUIRED_ATTR, NULL, 1);
+ top.features.add(name, required);
+ if (required) {
+ addParentFeatures(&top, name);
+ }
+
+ } else {
+ int vers = getIntegerAttribute(tree, GL_ES_VERSION_ATTR, &error);
+ if (error == "") {
+ if (vers > top.openGLESVersion) {
+ top.openGLESVersion = vers;
+ }
+ }
}
}
} else if (depth == 4) {
@@ -1839,12 +1862,17 @@
for (size_t i = 0; i < numFeatureGroups; i++) {
FeatureGroup& grp = featureGroups.editItemAt(i);
+ if (commonFeatures.openGLESVersion > grp.openGLESVersion) {
+ grp.openGLESVersion = commonFeatures.openGLESVersion;
+ }
+
// Merge the features defined in the top level (not inside a <feature-group>)
// with this feature group.
const size_t numCommonFeatures = commonFeatures.features.size();
for (size_t j = 0; j < numCommonFeatures; j++) {
if (grp.features.indexOfKey(commonFeatures.features.keyAt(j)) < 0) {
- grp.features.add(commonFeatures.features.keyAt(j), commonFeatures.features[j]);
+ grp.features.add(commonFeatures.features.keyAt(j),
+ commonFeatures.features[j]);
}
}
diff --git a/wifi/java/android/net/wifi/WifiConnectionStatistics.java b/wifi/java/android/net/wifi/WifiConnectionStatistics.java
index 8e79a17..0046aa5 100644
--- a/wifi/java/android/net/wifi/WifiConnectionStatistics.java
+++ b/wifi/java/android/net/wifi/WifiConnectionStatistics.java
@@ -47,6 +47,15 @@
// Number of time we polled the chip and were on 2.4GHz
public int num24GhzConnected;
+ // Number autojoin attempts
+ public int numAutoJoinAttempt;
+
+ // Number auto-roam attempts
+ public int numAutoRoamAttempt;
+
+ // Number wifimanager join attempts
+ public int numWifiManagerJoinAttempt;
+
public WifiConnectionStatistics() {
untrustedNetworkHistory = new HashMap<String, WifiNetworkConnectionStatistics>();
}
@@ -74,6 +83,9 @@
StringBuilder sbuf = new StringBuilder();
sbuf.append("Connected on: 2.4Ghz=").append(num24GhzConnected);
sbuf.append(" 5Ghz=").append(num5GhzConnected).append("\n");
+ sbuf.append(" join=").append(numWifiManagerJoinAttempt);
+ sbuf.append("\\").append(numAutoJoinAttempt).append("\n");
+ sbuf.append(" roam=").append(numAutoRoamAttempt).append("\n");
for (String Key : untrustedNetworkHistory.keySet()) {
WifiNetworkConnectionStatistics stats = untrustedNetworkHistory.get(Key);
@@ -102,6 +114,10 @@
public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(num24GhzConnected);
dest.writeInt(num5GhzConnected);
+ dest.writeInt(numAutoJoinAttempt);
+ dest.writeInt(numAutoRoamAttempt);
+ dest.writeInt(numWifiManagerJoinAttempt);
+
dest.writeInt(untrustedNetworkHistory.size());
for (String Key : untrustedNetworkHistory.keySet()) {
WifiNetworkConnectionStatistics num = untrustedNetworkHistory.get(Key);
@@ -119,6 +135,9 @@
WifiConnectionStatistics stats = new WifiConnectionStatistics();
stats.num24GhzConnected = in.readInt();
stats.num5GhzConnected = in.readInt();
+ stats.numAutoJoinAttempt = in.readInt();
+ stats.numAutoRoamAttempt = in.readInt();
+ stats.numWifiManagerJoinAttempt = in.readInt();
int n = in.readInt();
while (n-- > 0) {
String Key = in.readString();