Merge "DO NOT MERGE" into gingerbread
diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java
index 7951a30..aecdcb3 100644
--- a/core/java/android/content/Context.java
+++ b/core/java/android/content/Context.java
@@ -1206,6 +1206,8 @@
* for management of input methods.
* <dt> {@link #UI_MODE_SERVICE} ("uimode")
* <dd> An {@link android.app.UiModeManager} for controlling UI modes.
+ * <dt> {@link #DOWNLOAD_SERVICE} ("download")
+ * <dd> A {@link android.net.DownloadManager} for requesting HTTP downloads
* </dl>
*
* <p>Note: System services obtained via this API may be closely associated with
@@ -1253,6 +1255,8 @@
* @see android.view.inputmethod.InputMethodManager
* @see #UI_MODE_SERVICE
* @see android.app.UiModeManager
+ * @see #DOWNLOAD_SERVICE
+ * @see android.net.DownloadManager
*/
public abstract Object getSystemService(String name);
diff --git a/core/java/android/widget/BaseExpandableListAdapter.java b/core/java/android/widget/BaseExpandableListAdapter.java
index 396b7ae..b4d6ad7 100644
--- a/core/java/android/widget/BaseExpandableListAdapter.java
+++ b/core/java/android/widget/BaseExpandableListAdapter.java
@@ -43,14 +43,14 @@
}
/**
- * {@see DataSetObservable#notifyInvalidated()}
+ * @see DataSetObservable#notifyInvalidated()
*/
public void notifyDataSetInvalidated() {
mDataSetObservable.notifyInvalidated();
}
/**
- * {@see DataSetObservable#notifyChanged()}
+ * @see DataSetObservable#notifyChanged()
*/
public void notifyDataSetChanged() {
mDataSetObservable.notifyChanged();
diff --git a/core/java/android/widget/HeterogeneousExpandableList.java b/core/java/android/widget/HeterogeneousExpandableList.java
index 1292733..e7e0933 100644
--- a/core/java/android/widget/HeterogeneousExpandableList.java
+++ b/core/java/android/widget/HeterogeneousExpandableList.java
@@ -23,12 +23,13 @@
* Additional methods that when implemented make an
* {@link ExpandableListAdapter} take advantage of the {@link Adapter} view type
* mechanism.
- *
- * An {@link ExpandableListAdapter} declares one view type for its group items
+ * <p>
+ * An {@link ExpandableListAdapter} declares it has one view type for its group items
* and one view type for its child items. Although adapted for most {@link ExpandableListView}s,
- * these values should be tuned heterogeneous {@link ExpandableListView}s. Lists that contain
- * different types of group and/or child item views, should use an adapter that implements this
- * interface. This way, the recycled views that will be provided to
+ * these values should be tuned for heterogeneous {@link ExpandableListView}s.
+ * </p>
+ * Lists that contain different types of group and/or child item views, should use an adapter that
+ * implements this interface. This way, the recycled views that will be provided to
* {@link android.widget.ExpandableListAdapter#getGroupView(int, boolean, View, ViewGroup)}
* and
* {@link android.widget.ExpandableListAdapter#getChildView(int, int, boolean, View, ViewGroup)}
@@ -48,7 +49,7 @@
* . Note: Integers must be in the range 0 to {@link #getGroupTypeCount} - 1.
* {@link android.widget.Adapter#IGNORE_ITEM_VIEW_TYPE} can also be returned.
* @see android.widget.Adapter#IGNORE_ITEM_VIEW_TYPE
- * @see getGroupTypeCount()
+ * @see #getGroupTypeCount()
*/
int getGroupType(int groupPosition);
@@ -65,7 +66,7 @@
* Note: Integers must be in the range 0 to {@link #getChildTypeCount} - 1.
* {@link android.widget.Adapter#IGNORE_ITEM_VIEW_TYPE} can also be returned.
* @see android.widget.Adapter#IGNORE_ITEM_VIEW_TYPE
- * @see getChildTypeCount()
+ * @see #getChildTypeCount()
*/
int getChildType(int groupPosition, int childPosition);
@@ -78,13 +79,11 @@
* . If the adapter always returns the same type of View for all group items, this method should
* return 1.
* </p>
- * <p>
* This method will only be called when the adapter is set on the {@link AdapterView}.
- * </p>
*
* @return The number of types of group Views that will be created by this adapter.
- * @see getChildTypeCount()
- * @see getGroupType()
+ * @see #getChildTypeCount()
+ * @see #getGroupType(int)
*/
int getGroupTypeCount();
@@ -97,13 +96,11 @@
* , for any group. If the adapter always returns the same type of View for
* all child items, this method should return 1.
* </p>
- * <p>
* This method will only be called when the adapter is set on the {@link AdapterView}.
- * </p>
*
* @return The total number of types of child Views that will be created by this adapter.
- * @see getGroupTypeCount()
- * @see getChildType()
+ * @see #getGroupTypeCount()
+ * @see #getChildType(int, int)
*/
int getChildTypeCount();
}
diff --git a/docs/html/guide/topics/resources/providing-resources.jd b/docs/html/guide/topics/resources/providing-resources.jd
index 7e2f8a0..1d6ab25 100644
--- a/docs/html/guide/topics/resources/providing-resources.jd
+++ b/docs/html/guide/topics/resources/providing-resources.jd
@@ -450,8 +450,8 @@
to match the device density.</li>
</ul>
<p><em>Added in API Level 4.</em></p>
- <p>There is thus a 4:3 scaling factor between each density, so a 9x9 bitmap
- in ldpi is 12x12 in mdpi and 16x16 in hdpi.</p>
+ <p>There is thus a 3:4:6 scaling ratio between the three densities, so a 9x9 bitmap
+ in ldpi is 12x12 in mdpi and 18x18 in hdpi.</p>
<p>When Android selects which resource files to use,
it handles screen density differently than the other qualifiers.
In step 1 of <a href="#BestMatch">How Android finds the best
@@ -895,7 +895,7 @@
drawable-port-notouch-12key/
</pre>
<p class="note"><strong>Exception:</strong> Screen pixel density is the one qualifier that is not
-eliminated due to a contradiction. Even though the screen density of the device is mdpi,
+eliminated due to a contradiction. Even though the screen density of the device is hdpi,
<code>drawable-port-ldpi/</code> is not eliminated because every screen density is
considered to be a match at this point. More information is available in the <a
href="{@docRoot}guide/practices/screens_support.html">Supporting Multiple
@@ -922,9 +922,8 @@
<strike>drawable-port-notouch-12key/</strike>
</pre>
<p class="note"><strong>Exception:</strong> If the qualifier in question is screen pixel density,
-Android
-selects the option that most closely matches the device, and the selection process is complete.
-In general, Android prefers scaling down a larger original image to scaling up a smaller
+Android selects the option that most closely matches the device screen density.
+In general, Android prefers scaling down a larger original image to scaling up a smaller
original image. See <a href="{@docRoot}guide/practices/screens_support.html">Supporting Multiple
Screens</a>.</p>
</li>
diff --git a/include/camera/Camera.h b/include/camera/Camera.h
index 9974f2f..964700b 100644
--- a/include/camera/Camera.h
+++ b/include/camera/Camera.h
@@ -1,6 +1,5 @@
/*
* Copyright (C) 2008 The Android Open Source Project
- * Copyright (C) 2008 HTC Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/include/media/IMediaRecorder.h b/include/media/IMediaRecorder.h
index cfc17a5..54adca8 100644
--- a/include/media/IMediaRecorder.h
+++ b/include/media/IMediaRecorder.h
@@ -1,6 +1,6 @@
/*
**
- ** Copyright 2008, HTC Inc.
+ ** Copyright 2008, 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.
diff --git a/include/media/PVMediaRecorder.h b/include/media/PVMediaRecorder.h
index f75d80d..c091c39 100644
--- a/include/media/PVMediaRecorder.h
+++ b/include/media/PVMediaRecorder.h
@@ -1,6 +1,6 @@
/*
**
- ** Copyright 2008, HTC Inc.
+ ** Copyright 2008, 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.
diff --git a/libs/camera/Camera.cpp b/libs/camera/Camera.cpp
index 0037399..7efc6d7 100644
--- a/libs/camera/Camera.cpp
+++ b/libs/camera/Camera.cpp
@@ -1,7 +1,6 @@
/*
**
** Copyright (C) 2008, The Android Open Source Project
-** Copyright (C) 2008 HTC Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/media/java/android/media/Equalizer.java b/media/java/android/media/Equalizer.java
index 21c37bb..b062b64 100644
--- a/media/java/android/media/Equalizer.java
+++ b/media/java/android/media/Equalizer.java
@@ -182,9 +182,9 @@
}
int[] param = new int[1];
param[0] = PARAM_NUM_BANDS;
- short[] value = new short[1];
- checkStatus(getParameter(param, value));
- mNumBands = value[0];
+ short[] result = new short[1];
+ checkStatus(getParameter(param, result));
+ mNumBands = result[0];
return mNumBands;
}
@@ -199,16 +199,8 @@
*/
public short[] getBandLevelRange()
throws IllegalStateException, IllegalArgumentException, UnsupportedOperationException {
- int[] param = new int[1];
- int[] value = new int[2];
- param[0] = PARAM_LEVEL_RANGE;
- checkStatus(getParameter(param, value));
-
short[] result = new short[2];
-
- result[0] = (short)value[0];
- result[1] = (short)value[1];
-
+ checkStatus(getParameter(PARAM_LEVEL_RANGE, result));
return result;
}
@@ -222,14 +214,14 @@
* @throws IllegalArgumentException
* @throws UnsupportedOperationException
*/
- public void setBandLevel(int band, short level)
+ public void setBandLevel(short band, short level)
throws IllegalStateException, IllegalArgumentException, UnsupportedOperationException {
int[] param = new int[2];
- int[] value = new int[1];
+ short[] value = new short[1];
param[0] = PARAM_BAND_LEVEL;
- param[1] = band;
- value[0] = (int)level;
+ param[1] = (int)band;
+ value[0] = level;
checkStatus(setParameter(param, value));
}
@@ -242,16 +234,16 @@
* @throws IllegalArgumentException
* @throws UnsupportedOperationException
*/
- public short getBandLevel(int band)
+ public short getBandLevel(short band)
throws IllegalStateException, IllegalArgumentException, UnsupportedOperationException {
int[] param = new int[2];
- int[] result = new int[1];
+ short[] result = new short[1];
param[0] = PARAM_BAND_LEVEL;
- param[1] = band;
+ param[1] = (int)band;
checkStatus(getParameter(param, result));
- return (short)result[0];
+ return result[0];
}
@@ -264,13 +256,13 @@
* @throws IllegalArgumentException
* @throws UnsupportedOperationException
*/
- public int getCenterFreq(int band)
+ public int getCenterFreq(short band)
throws IllegalStateException, IllegalArgumentException, UnsupportedOperationException {
int[] param = new int[2];
int[] result = new int[1];
param[0] = PARAM_CENTER_FREQ;
- param[1] = band;
+ param[1] = (int)band;
checkStatus(getParameter(param, result));
return result[0];
@@ -286,12 +278,12 @@
* @throws IllegalArgumentException
* @throws UnsupportedOperationException
*/
- public int[] getBandFreqRange(int band)
+ public int[] getBandFreqRange(short band)
throws IllegalStateException, IllegalArgumentException, UnsupportedOperationException {
int[] param = new int[2];
int[] result = new int[2];
param[0] = PARAM_BAND_FREQ_RANGE;
- param[1] = band;
+ param[1] = (int)band;
checkStatus(getParameter(param, result));
return result;
@@ -305,10 +297,10 @@
* @throws IllegalArgumentException
* @throws UnsupportedOperationException
*/
- public int getBand(int frequency)
+ public short getBand(int frequency)
throws IllegalStateException, IllegalArgumentException, UnsupportedOperationException {
int[] param = new int[2];
- int[] result = new int[1];
+ short[] result = new short[1];
param[0] = PARAM_GET_BAND;
param[1] = frequency;
@@ -326,11 +318,9 @@
*/
public short getCurrentPreset()
throws IllegalStateException, IllegalArgumentException, UnsupportedOperationException {
- int[] param = new int[1];
- param[0] = PARAM_CURRENT_PRESET;
- short[] value = new short[1];
- checkStatus(getParameter(param, value));
- return value[0];
+ short[] result = new short[1];
+ checkStatus(getParameter(PARAM_CURRENT_PRESET, result));
+ return result[0];
}
/**
@@ -356,11 +346,9 @@
*/
public short getNumberOfPresets()
throws IllegalStateException, IllegalArgumentException, UnsupportedOperationException {
- int[] param = new int[1];
- param[0] = PARAM_GET_NUM_OF_PRESETS;
- short[] value = new short[1];
- checkStatus(getParameter(param, value));
- return value[0];
+ short[] result = new short[1];
+ checkStatus(getParameter(PARAM_GET_NUM_OF_PRESETS, result));
+ return result[0];
}
/**
diff --git a/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp b/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp
index 4c3ebca..a70bdff 100644
--- a/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp
+++ b/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp
@@ -1848,6 +1848,8 @@
case EQ_PARAM_NUM_BANDS:
case EQ_PARAM_CUR_PRESET:
case EQ_PARAM_GET_NUM_OF_PRESETS:
+ case EQ_PARAM_BAND_LEVEL:
+ case EQ_PARAM_GET_BAND:
if (*pValueSize < sizeof(int16_t)) {
LOGV("\tLVM_ERROR : Equalizer_getParameter() invalid pValueSize 1 %d", *pValueSize);
return -EINVAL;
@@ -1856,6 +1858,13 @@
break;
case EQ_PARAM_LEVEL_RANGE:
+ if (*pValueSize < 2 * sizeof(int16_t)) {
+ LOGV("\tLVM_ERROR : Equalizer_getParameter() invalid pValueSize 2 %d", *pValueSize);
+ return -EINVAL;
+ }
+ *pValueSize = 2 * sizeof(int16_t);
+ break;
+
case EQ_PARAM_BAND_FREQ_RANGE:
if (*pValueSize < 2 * sizeof(int32_t)) {
LOGV("\tLVM_ERROR : Equalizer_getParameter() invalid pValueSize 2 %d", *pValueSize);
@@ -1863,8 +1872,7 @@
}
*pValueSize = 2 * sizeof(int32_t);
break;
- case EQ_PARAM_BAND_LEVEL:
- case EQ_PARAM_GET_BAND:
+
case EQ_PARAM_CENTER_FREQ:
if (*pValueSize < sizeof(int32_t)) {
LOGV("\tLVM_ERROR : Equalizer_getParameter() invalid pValueSize 1 %d", *pValueSize);
@@ -1891,13 +1899,13 @@
switch (param) {
case EQ_PARAM_NUM_BANDS:
- *(int16_t *)pValue = FIVEBAND_NUMBANDS;
+ *(uint16_t *)pValue = (uint16_t)FIVEBAND_NUMBANDS;
//LOGV("\tEqualizer_getParameter() EQ_PARAM_NUM_BANDS %d", *(int16_t *)pValue);
break;
case EQ_PARAM_LEVEL_RANGE:
- *(int32_t *)pValue = -1500;
- *((int32_t *)pValue + 1) = 1500;
+ *(int16_t *)pValue = -1500;
+ *((int16_t *)pValue + 1) = 1500;
//LOGV("\tEqualizer_getParameter() EQ_PARAM_LEVEL_RANGE min %d, max %d",
// *(int32_t *)pValue, *((int32_t *)pValue + 1));
break;
@@ -1908,7 +1916,7 @@
status = -EINVAL;
break;
}
- *(int32_t *)pValue = EqualizerGetBandLevel(pContext, param2);
+ *(int16_t *)pValue = (int16_t)EqualizerGetBandLevel(pContext, param2);
//LOGV("\tEqualizer_getParameter() EQ_PARAM_BAND_LEVEL band %d, level %d",
// param2, *(int32_t *)pValue);
break;
@@ -1937,18 +1945,18 @@
case EQ_PARAM_GET_BAND:
param2 = *pParam;
- *(int32_t *)pValue = EqualizerGetBand(pContext, param2);
+ *(uint16_t *)pValue = (uint16_t)EqualizerGetBand(pContext, param2);
//LOGV("\tEqualizer_getParameter() EQ_PARAM_GET_BAND frequency %d, band %d",
// param2, *(int32_t *)pValue);
break;
case EQ_PARAM_CUR_PRESET:
- *(int16_t *)pValue = EqualizerGetPreset(pContext);
+ *(uint16_t *)pValue = (uint16_t)EqualizerGetPreset(pContext);
//LOGV("\tEqualizer_getParameter() EQ_PARAM_CUR_PRESET %d", *(int32_t *)pValue);
break;
case EQ_PARAM_GET_NUM_OF_PRESETS:
- *(int16_t *)pValue = EqualizerGetNumPresets();
+ *(uint16_t *)pValue = (uint16_t)EqualizerGetNumPresets();
//LOGV("\tEqualizer_getParameter() EQ_PARAM_GET_NUM_OF_PRESETS %d", *(int16_t *)pValue);
break;
@@ -1968,12 +1976,12 @@
break;
case EQ_PARAM_PROPERTIES: {
- uint16_t *p = (uint16_t *)pValue;
+ int16_t *p = (int16_t *)pValue;
LOGV("\tEqualizer_getParameter() EQ_PARAM_PROPERTIES");
- p[0] = EqualizerGetPreset(pContext);
- p[1] = FIVEBAND_NUMBANDS;
+ p[0] = (int16_t)EqualizerGetPreset(pContext);
+ p[1] = (int16_t)FIVEBAND_NUMBANDS;
for (int i = 0; i < FIVEBAND_NUMBANDS; i++) {
- p[2 + i] = EqualizerGetBandLevel(pContext, i);
+ p[2 + i] = (int16_t)EqualizerGetBandLevel(pContext, i);
}
} break;
@@ -2011,7 +2019,7 @@
//LOGV("\tEqualizer_setParameter start");
switch (param) {
case EQ_PARAM_CUR_PRESET:
- preset = *(int16_t *)pValue;
+ preset = (int32_t)(*(uint16_t *)pValue);
//LOGV("\tEqualizer_setParameter() EQ_PARAM_CUR_PRESET %d", preset);
if ((preset >= EqualizerGetNumPresets())||(preset < 0)) {
@@ -2022,7 +2030,7 @@
break;
case EQ_PARAM_BAND_LEVEL:
band = *pParam;
- level = *(int32_t *)pValue;
+ level = (int32_t)(*(int16_t *)pValue);
//LOGV("\tEqualizer_setParameter() EQ_PARAM_BAND_LEVEL band %d, level %d", band, level);
if (band >= FIVEBAND_NUMBANDS) {
status = -EINVAL;
@@ -2030,8 +2038,28 @@
}
EqualizerSetBandLevel(pContext, band, level);
break;
+ case EQ_PARAM_PROPERTIES: {
+ //LOGV("\tEqualizer_setParameter() EQ_PARAM_PROPERTIES");
+ int16_t *p = (int16_t *)pValue;
+ if ((int)p[0] >= EqualizerGetNumPresets()) {
+ status = -EINVAL;
+ break;
+ }
+ if (p[0] >= 0) {
+ EqualizerSetPreset(pContext, (int)p[0]);
+ } else {
+ if ((int)p[1] != FIVEBAND_NUMBANDS) {
+ status = -EINVAL;
+ break;
+ }
+ for (int i = 0; i < FIVEBAND_NUMBANDS; i++) {
+ EqualizerSetBandLevel(pContext, i, (int)p[2 + i]);
+ }
+ }
+ } break;
default:
LOGV("\tLVM_ERROR : setParameter() invalid param %d", param);
+ status = -EINVAL;
break;
}
diff --git a/media/libeffects/testlibs/EffectEqualizer.cpp b/media/libeffects/testlibs/EffectEqualizer.cpp
index a71f236..f8e4357 100644
--- a/media/libeffects/testlibs/EffectEqualizer.cpp
+++ b/media/libeffects/testlibs/EffectEqualizer.cpp
@@ -350,6 +350,8 @@
case EQ_PARAM_NUM_BANDS:
case EQ_PARAM_CUR_PRESET:
case EQ_PARAM_GET_NUM_OF_PRESETS:
+ case EQ_PARAM_BAND_LEVEL:
+ case EQ_PARAM_GET_BAND:
if (*pValueSize < sizeof(int16_t)) {
return -EINVAL;
}
@@ -357,14 +359,19 @@
break;
case EQ_PARAM_LEVEL_RANGE:
+ if (*pValueSize < 2 * sizeof(int16_t)) {
+ return -EINVAL;
+ }
+ *pValueSize = 2 * sizeof(int16_t);
+ break;
+
case EQ_PARAM_BAND_FREQ_RANGE:
if (*pValueSize < 2 * sizeof(int32_t)) {
return -EINVAL;
}
*pValueSize = 2 * sizeof(int32_t);
break;
- case EQ_PARAM_BAND_LEVEL:
- case EQ_PARAM_GET_BAND:
+
case EQ_PARAM_CENTER_FREQ:
if (*pValueSize < sizeof(int32_t)) {
return -EINVAL;
@@ -375,19 +382,26 @@
case EQ_PARAM_GET_PRESET_NAME:
break;
+ case EQ_PARAM_PROPERTIES:
+ if (*pValueSize < (2 + kNumBands) * sizeof(uint16_t)) {
+ return -EINVAL;
+ }
+ *pValueSize = (2 + kNumBands) * sizeof(uint16_t);
+ break;
+
default:
return -EINVAL;
}
switch (param) {
case EQ_PARAM_NUM_BANDS:
- *(int16_t *)pValue = kNumBands;
+ *(uint16_t *)pValue = (uint16_t)kNumBands;
LOGV("Equalizer_getParameter() EQ_PARAM_NUM_BANDS %d", *(int16_t *)pValue);
break;
case EQ_PARAM_LEVEL_RANGE:
- *(int32_t *)pValue = -9600;
- *((int32_t *)pValue + 1) = 4800;
+ *(int16_t *)pValue = -9600;
+ *((int16_t *)pValue + 1) = 4800;
LOGV("Equalizer_getParameter() EQ_PARAM_LEVEL_RANGE min %d, max %d", *(int32_t *)pValue, *((int32_t *)pValue + 1));
break;
@@ -397,7 +411,7 @@
status = -EINVAL;
break;
}
- *(int32_t *)pValue = pEqualizer->getGain(param2);
+ *(int16_t *)pValue = (int16_t)pEqualizer->getGain(param2);
LOGV("Equalizer_getParameter() EQ_PARAM_BAND_LEVEL band %d, level %d", param2, *(int32_t *)pValue);
break;
@@ -423,17 +437,17 @@
case EQ_PARAM_GET_BAND:
param2 = *pParam;
- *(int32_t *)pValue = pEqualizer->getMostRelevantBand(param2);
+ *(uint16_t *)pValue = (uint16_t)pEqualizer->getMostRelevantBand(param2);
LOGV("Equalizer_getParameter() EQ_PARAM_GET_BAND frequency %d, band %d", param2, *(int32_t *)pValue);
break;
case EQ_PARAM_CUR_PRESET:
- *(int16_t *)pValue = pEqualizer->getPreset();
+ *(uint16_t *)pValue = (uint16_t)pEqualizer->getPreset();
LOGV("Equalizer_getParameter() EQ_PARAM_CUR_PRESET %d", *(int32_t *)pValue);
break;
case EQ_PARAM_GET_NUM_OF_PRESETS:
- *(int16_t *)pValue = pEqualizer->getNumPresets();
+ *(uint16_t *)pValue = (uint16_t)pEqualizer->getNumPresets();
LOGV("Equalizer_getParameter() EQ_PARAM_GET_NUM_OF_PRESETS %d", *(int16_t *)pValue);
break;
@@ -450,6 +464,16 @@
LOGV("Equalizer_getParameter() EQ_PARAM_GET_PRESET_NAME preset %d, name %s len %d", param2, gEqualizerPresets[param2].name, *pValueSize);
break;
+ case EQ_PARAM_PROPERTIES: {
+ int16_t *p = (int16_t *)pValue;
+ LOGV("Equalizer_getParameter() EQ_PARAM_PROPERTIES");
+ p[0] = (int16_t)pEqualizer->getPreset();
+ p[1] = (int16_t)kNumBands;
+ for (int i = 0; i < kNumBands; i++) {
+ p[2 + i] = (int16_t)pEqualizer->getGain(i);
+ }
+ } break;
+
default:
LOGV("Equalizer_getParameter() invalid param %d", param);
status = -EINVAL;
@@ -489,10 +513,10 @@
switch (param) {
case EQ_PARAM_CUR_PRESET:
- preset = *(int16_t *)pValue;
+ preset = (int32_t)(*(uint16_t *)pValue);
LOGV("setParameter() EQ_PARAM_CUR_PRESET %d", preset);
- if (preset >= pEqualizer->getNumPresets()) {
+ if (preset < 0 || preset >= pEqualizer->getNumPresets()) {
status = -EINVAL;
break;
}
@@ -501,7 +525,7 @@
break;
case EQ_PARAM_BAND_LEVEL:
band = *pParam;
- level = *(int32_t *)pValue;
+ level = (int32_t)(*(int16_t *)pValue);
LOGV("setParameter() EQ_PARAM_BAND_LEVEL band %d, level %d", band, level);
if (band >= kNumBands) {
status = -EINVAL;
@@ -510,8 +534,29 @@
pEqualizer->setGain(band, level);
pEqualizer->commit(true);
break;
+ case EQ_PARAM_PROPERTIES: {
+ LOGV("setParameter() EQ_PARAM_PROPERTIES");
+ int16_t *p = (int16_t *)pValue;
+ if ((int)p[0] >= pEqualizer->getNumPresets()) {
+ status = -EINVAL;
+ break;
+ }
+ if (p[0] >= 0) {
+ pEqualizer->setPreset((int)p[0]);
+ } else {
+ if ((int)p[1] != kNumBands) {
+ status = -EINVAL;
+ break;
+ }
+ for (int i = 0; i < kNumBands; i++) {
+ pEqualizer->setGain(i, (int32_t)p[2 + i]);
+ }
+ }
+ pEqualizer->commit(true);
+ } break;
default:
LOGV("setParameter() invalid param %d", param);
+ status = -EINVAL;
break;
}
diff --git a/media/libmedia/IMediaRecorder.cpp b/media/libmedia/IMediaRecorder.cpp
index 9fe207c..4eb63e8 100644
--- a/media/libmedia/IMediaRecorder.cpp
+++ b/media/libmedia/IMediaRecorder.cpp
@@ -1,6 +1,6 @@
/*
**
- ** Copyright 2008, HTC Inc.
+ ** Copyright 2008, 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.
diff --git a/media/libmediaplayerservice/MediaRecorderClient.cpp b/media/libmediaplayerservice/MediaRecorderClient.cpp
index fef3e6e..73862c3 100644
--- a/media/libmediaplayerservice/MediaRecorderClient.cpp
+++ b/media/libmediaplayerservice/MediaRecorderClient.cpp
@@ -1,5 +1,5 @@
/*
- ** Copyright 2008, HTC Inc.
+ ** Copyright 2008, 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.
diff --git a/media/libmediaplayerservice/MediaRecorderClient.h b/media/libmediaplayerservice/MediaRecorderClient.h
index d12e558..1d1913d 100644
--- a/media/libmediaplayerservice/MediaRecorderClient.h
+++ b/media/libmediaplayerservice/MediaRecorderClient.h
@@ -1,6 +1,6 @@
/*
**
- ** Copyright 2008, HTC Inc.
+ ** Copyright 2008, 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.
diff --git a/opengl/libs/EGL/egl.cpp b/opengl/libs/EGL/egl.cpp
index 714fd3e..665446a 100644
--- a/opengl/libs/EGL/egl.cpp
+++ b/opengl/libs/EGL/egl.cpp
@@ -42,7 +42,6 @@
#include "egl_impl.h"
#include "Loader.h"
-#define MAKE_CONFIG(_impl, _index) ((EGLConfig)(((_impl)<<24) | (_index)))
#define setError(_e, _r) setErrorEtc(__FUNCTION__, __LINE__, _e, _r)
// ----------------------------------------------------------------------------
@@ -143,6 +142,22 @@
SortedVector<egl_object_t*> egl_object_t::sObjects;
Mutex egl_object_t::sLock;
+
+struct egl_config_t {
+ egl_config_t() {}
+ egl_config_t(int impl, EGLConfig config)
+ : impl(impl), config(config), configId(0), implConfigId(0) { }
+ int impl; // the implementation this config is for
+ EGLConfig config; // the implementation's EGLConfig
+ EGLint configId; // our CONFIG_ID
+ EGLint implConfigId; // the implementation's CONFIG_ID
+ inline bool operator < (const egl_config_t& rhs) const {
+ if (impl < rhs.impl) return true;
+ if (impl > rhs.impl) return false;
+ return config < rhs.config;
+ }
+};
+
struct egl_display_t {
enum { NOT_INITIALIZED, INITIALIZED, TERMINATED };
@@ -163,13 +178,14 @@
strings_t queryString;
};
- uint32_t magic;
- DisplayImpl disp[IMPL_NUM_IMPLEMENTATIONS];
- EGLint numTotalConfigs;
- uint32_t refs;
- Mutex lock;
+ uint32_t magic;
+ DisplayImpl disp[IMPL_NUM_IMPLEMENTATIONS];
+ EGLint numTotalConfigs;
+ egl_config_t* configs;
+ uint32_t refs;
+ Mutex lock;
- egl_display_t() : magic('_dpy'), numTotalConfigs(0) { }
+ egl_display_t() : magic('_dpy'), numTotalConfigs(0), configs(0) { }
~egl_display_t() { magic = 0; }
inline bool isValid() const { return magic == '_dpy'; }
inline bool isAlive() const { return isValid(); }
@@ -179,14 +195,15 @@
{
typedef egl_object_t::LocalRef<egl_surface_t, EGLSurface> Ref;
- egl_surface_t(EGLDisplay dpy, EGLSurface surface,
+ egl_surface_t(EGLDisplay dpy, EGLSurface surface, EGLConfig config,
int impl, egl_connection_t const* cnx)
- : dpy(dpy), surface(surface), impl(impl), cnx(cnx) {
+ : dpy(dpy), surface(surface), config(config), impl(impl), cnx(cnx) {
}
~egl_surface_t() {
}
EGLDisplay dpy;
EGLSurface surface;
+ EGLConfig config;
int impl;
egl_connection_t const* cnx;
};
@@ -195,7 +212,7 @@
{
typedef egl_object_t::LocalRef<egl_context_t, EGLContext> Ref;
- egl_context_t(EGLDisplay dpy, EGLContext context,
+ egl_context_t(EGLDisplay dpy, EGLContext context, EGLConfig config,
int impl, egl_connection_t const* cnx, int version)
: dpy(dpy), context(context), read(0), draw(0), impl(impl), cnx(cnx),
version(version)
@@ -203,6 +220,7 @@
}
EGLDisplay dpy;
EGLContext context;
+ EGLConfig config;
EGLSurface read;
EGLSurface draw;
int impl;
@@ -354,7 +372,7 @@
{
while (first <= last) {
int mid = (first + last) / 2;
- if (key > sortedArray[mid]) {
+ if (sortedArray[mid] < key) {
first = mid + 1;
} else if (key < sortedArray[mid]) {
last = mid - 1;
@@ -365,26 +383,11 @@
return -1;
}
-static EGLint configToUniqueId(egl_display_t const* dp, int i, int index)
-{
- // NOTE: this mapping works only if we have no more than two EGLimpl
- return (i>0 ? dp->disp[0].numConfigs : 0) + index;
-}
-
-static void uniqueIdToConfig(egl_display_t const* dp, EGLint configId,
- int& i, int& index)
-{
- // NOTE: this mapping works only if we have no more than two EGLimpl
- size_t numConfigs = dp->disp[0].numConfigs;
- i = configId / numConfigs;
- index = configId % numConfigs;
-}
-
static int cmp_configs(const void* a, const void *b)
{
- EGLConfig c0 = *(EGLConfig const *)a;
- EGLConfig c1 = *(EGLConfig const *)b;
- return c0<c1 ? -1 : (c0>c1 ? 1 : 0);
+ const egl_config_t& c0 = *(egl_config_t const *)a;
+ const egl_config_t& c1 = *(egl_config_t const *)b;
+ return c0<c1 ? -1 : (c1<c0 ? 1 : 0);
}
struct extention_map_t {
@@ -477,20 +480,15 @@
static egl_connection_t* validate_display_config(
EGLDisplay dpy, EGLConfig config,
- egl_display_t const*& dp, int& impl, int& index)
+ egl_display_t const*& dp)
{
dp = get_display(dpy);
if (!dp) return setError(EGL_BAD_DISPLAY, (egl_connection_t*)NULL);
- impl = uintptr_t(config)>>24;
- if (uint32_t(impl) >= IMPL_NUM_IMPLEMENTATIONS) {
- return setError(EGL_BAD_CONFIG, (egl_connection_t*)NULL);
- }
- index = uintptr_t(config) & 0xFFFFFF;
- if (index >= dp->disp[impl].numConfigs) {
+ if (intptr_t(config) >= dp->numTotalConfigs) {
return setError(EGL_BAD_CONFIG, (egl_connection_t*)NULL);
}
- egl_connection_t* const cnx = &gEGLImpl[impl];
+ egl_connection_t* const cnx = &gEGLImpl[dp->configs[intptr_t(config)].impl];
if (cnx->dso == 0) {
return setError(EGL_BAD_CONFIG, (egl_connection_t*)NULL);
}
@@ -718,11 +716,6 @@
dp->disp[i].dpy, dp->disp[i].config, n,
&dp->disp[i].numConfigs))
{
- // sort the configurations so we can do binary searches
- qsort( dp->disp[i].config,
- dp->disp[i].numConfigs,
- sizeof(EGLConfig), cmp_configs);
-
dp->numTotalConfigs += n;
res = EGL_TRUE;
}
@@ -732,6 +725,30 @@
}
if (res == EGL_TRUE) {
+ dp->configs = new egl_config_t[ dp->numTotalConfigs ];
+ for (int i=0, k=0 ; i<IMPL_NUM_IMPLEMENTATIONS ; i++) {
+ egl_connection_t* const cnx = &gEGLImpl[i];
+ if (cnx->dso && cnx->major>=0 && cnx->minor>=0) {
+ for (int j=0 ; j<dp->disp[i].numConfigs ; j++) {
+ dp->configs[k].impl = i;
+ dp->configs[k].config = dp->disp[i].config[j];
+ dp->configs[k].configId = k + 1; // CONFIG_ID start at 1
+ // store the implementation's CONFIG_ID
+ cnx->egl.eglGetConfigAttrib(
+ dp->disp[i].dpy,
+ dp->disp[i].config[j],
+ EGL_CONFIG_ID,
+ &dp->configs[k].implConfigId);
+ k++;
+ }
+ }
+ }
+
+ // sort our configurations so we can do binary-searches
+ qsort( dp->configs,
+ dp->numTotalConfigs,
+ sizeof(egl_config_t), cmp_configs);
+
dp->refs++;
if (major != NULL) *major = VERSION_MAJOR;
if (minor != NULL) *minor = VERSION_MINOR;
@@ -784,6 +801,7 @@
dp->refs--;
dp->numTotalConfigs = 0;
+ delete [] dp->configs;
clearTLS();
return res;
}
@@ -804,14 +822,13 @@
*num_config = numConfigs;
return EGL_TRUE;
}
+
GLint n = 0;
- for (int j=0 ; j<IMPL_NUM_IMPLEMENTATIONS ; j++) {
- for (int i=0 ; i<dp->disp[j].numConfigs && config_size ; i++) {
- *configs++ = MAKE_CONFIG(j, i);
- config_size--;
- n++;
- }
- }
+ for (intptr_t i=0 ; i<dp->numTotalConfigs && config_size ; i++) {
+ *configs++ = EGLConfig(i);
+ config_size--;
+ n++;
+ }
*num_config = n;
return EGL_TRUE;
@@ -834,7 +851,7 @@
// It is unfortunate, but we need to remap the EGL_CONFIG_IDs,
- // to do this, we have to go through the attrib_list array once
+ // to do this, we have to go through the attrib_list array once
// to figure out both its size and if it contains an EGL_CONFIG_ID
// key. If so, the full array is copied and patched.
// NOTE: we assume that there can be only one occurrence
@@ -858,16 +875,20 @@
memcpy(new_list, attrib_list, size*sizeof(EGLint));
// patch the requested EGL_CONFIG_ID
- int i, index;
+ bool found = false;
+ EGLConfig ourConfig(0);
EGLint& configId(new_list[patch_index+1]);
- uniqueIdToConfig(dp, configId, i, index);
-
- egl_connection_t* const cnx = &gEGLImpl[i];
- if (cnx->dso) {
- cnx->egl.eglGetConfigAttrib(
- dp->disp[i].dpy, dp->disp[i].config[index],
- EGL_CONFIG_ID, &configId);
+ for (intptr_t i=0 ; i<dp->numTotalConfigs ; i++) {
+ if (dp->configs[i].configId == configId) {
+ ourConfig = EGLConfig(i);
+ configId = dp->configs[i].implConfigId;
+ found = true;
+ break;
+ }
+ }
+ egl_connection_t* const cnx = &gEGLImpl[dp->configs[intptr_t(ourConfig)].impl];
+ if (found && cnx->dso) {
// and switch to the new list
attrib_list = const_cast<const EGLint *>(new_list);
@@ -880,12 +901,13 @@
// which one.
res = cnx->egl.eglChooseConfig(
- dp->disp[i].dpy, attrib_list, configs, config_size, &n);
+ dp->disp[ dp->configs[intptr_t(ourConfig)].impl ].dpy,
+ attrib_list, configs, config_size, &n);
if (res && n>0) {
// n has to be 0 or 1, by construction, and we already know
// which config it will return (since there can be only one).
if (configs) {
- configs[0] = MAKE_CONFIG(i, index);
+ configs[0] = ourConfig;
}
*num_config = 1;
}
@@ -895,6 +917,7 @@
return res;
}
+
for (int i=0 ; i<IMPL_NUM_IMPLEMENTATIONS ; i++) {
egl_connection_t* const cnx = &gEGLImpl[i];
if (cnx->dso) {
@@ -902,15 +925,14 @@
dp->disp[i].dpy, attrib_list, configs, config_size, &n)) {
if (configs) {
// now we need to convert these client EGLConfig to our
- // internal EGLConfig format. This is done in O(n log n).
+ // internal EGLConfig format.
+ // This is done in O(n Log(n)) time.
for (int j=0 ; j<n ; j++) {
- int index = binarySearch<EGLConfig>(
- dp->disp[i].config, 0,
- dp->disp[i].numConfigs-1, configs[j]);
+ egl_config_t key(i, configs[j]);
+ intptr_t index = binarySearch<egl_config_t>(
+ dp->configs, 0, dp->numTotalConfigs, key);
if (index >= 0) {
- if (configs) {
- configs[j] = MAKE_CONFIG(i, index);
- }
+ configs[j] = EGLConfig(index);
} else {
return setError(EGL_BAD_CONFIG, EGL_FALSE);
}
@@ -930,18 +952,16 @@
EGLint attribute, EGLint *value)
{
egl_display_t const* dp = 0;
- int i=0, index=0;
- egl_connection_t* cnx = validate_display_config(dpy, config, dp, i, index);
+ egl_connection_t* cnx = validate_display_config(dpy, config, dp);
if (!cnx) return EGL_FALSE;
if (attribute == EGL_CONFIG_ID) {
- // EGL_CONFIG_IDs must be unique, just use the order of the selected
- // EGLConfig.
- *value = configToUniqueId(dp, i, index);
+ *value = dp->configs[intptr_t(config)].configId;
return EGL_TRUE;
}
return cnx->egl.eglGetConfigAttrib(
- dp->disp[i].dpy, dp->disp[i].config[index], attribute, value);
+ dp->disp[ dp->configs[intptr_t(config)].impl ].dpy,
+ dp->configs[intptr_t(config)].config, attribute, value);
}
// ----------------------------------------------------------------------------
@@ -953,13 +973,14 @@
const EGLint *attrib_list)
{
egl_display_t const* dp = 0;
- int i=0, index=0;
- egl_connection_t* cnx = validate_display_config(dpy, config, dp, i, index);
+ egl_connection_t* cnx = validate_display_config(dpy, config, dp);
if (cnx) {
EGLSurface surface = cnx->egl.eglCreateWindowSurface(
- dp->disp[i].dpy, dp->disp[i].config[index], window, attrib_list);
+ dp->disp[ dp->configs[intptr_t(config)].impl ].dpy,
+ dp->configs[intptr_t(config)].config, window, attrib_list);
if (surface != EGL_NO_SURFACE) {
- egl_surface_t* s = new egl_surface_t(dpy, surface, i, cnx);
+ egl_surface_t* s = new egl_surface_t(dpy, surface, config,
+ dp->configs[intptr_t(config)].impl, cnx);
return s;
}
}
@@ -971,13 +992,14 @@
const EGLint *attrib_list)
{
egl_display_t const* dp = 0;
- int i=0, index=0;
- egl_connection_t* cnx = validate_display_config(dpy, config, dp, i, index);
+ egl_connection_t* cnx = validate_display_config(dpy, config, dp);
if (cnx) {
EGLSurface surface = cnx->egl.eglCreatePixmapSurface(
- dp->disp[i].dpy, dp->disp[i].config[index], pixmap, attrib_list);
+ dp->disp[ dp->configs[intptr_t(config)].impl ].dpy,
+ dp->configs[intptr_t(config)].config, pixmap, attrib_list);
if (surface != EGL_NO_SURFACE) {
- egl_surface_t* s = new egl_surface_t(dpy, surface, i, cnx);
+ egl_surface_t* s = new egl_surface_t(dpy, surface, config,
+ dp->configs[intptr_t(config)].impl, cnx);
return s;
}
}
@@ -988,13 +1010,14 @@
const EGLint *attrib_list)
{
egl_display_t const* dp = 0;
- int i=0, index=0;
- egl_connection_t* cnx = validate_display_config(dpy, config, dp, i, index);
+ egl_connection_t* cnx = validate_display_config(dpy, config, dp);
if (cnx) {
EGLSurface surface = cnx->egl.eglCreatePbufferSurface(
- dp->disp[i].dpy, dp->disp[i].config[index], attrib_list);
+ dp->disp[ dp->configs[intptr_t(config)].impl ].dpy,
+ dp->configs[intptr_t(config)].config, attrib_list);
if (surface != EGL_NO_SURFACE) {
- egl_surface_t* s = new egl_surface_t(dpy, surface, i, cnx);
+ egl_surface_t* s = new egl_surface_t(dpy, surface, config,
+ dp->configs[intptr_t(config)].impl, cnx);
return s;
}
}
@@ -1030,27 +1053,35 @@
egl_display_t const * const dp = get_display(dpy);
egl_surface_t const * const s = get_surface(surface);
- return s->cnx->egl.eglQuerySurface(
- dp->disp[s->impl].dpy, s->surface, attribute, value);
+ EGLBoolean result(EGL_TRUE);
+ if (attribute == EGL_CONFIG_ID) {
+ // We need to remap EGL_CONFIG_IDs
+ *value = dp->configs[intptr_t(s->config)].configId;
+ } else {
+ result = s->cnx->egl.eglQuerySurface(
+ dp->disp[s->impl].dpy, s->surface, attribute, value);
+ }
+
+ return result;
}
// ----------------------------------------------------------------------------
-// contextes
+// Contexts
// ----------------------------------------------------------------------------
EGLContext eglCreateContext(EGLDisplay dpy, EGLConfig config,
EGLContext share_list, const EGLint *attrib_list)
{
egl_display_t const* dp = 0;
- int i=0, index=0;
- egl_connection_t* cnx = validate_display_config(dpy, config, dp, i, index);
+ egl_connection_t* cnx = validate_display_config(dpy, config, dp);
if (cnx) {
if (share_list != EGL_NO_CONTEXT) {
egl_context_t* const c = get_context(share_list);
share_list = c->context;
}
EGLContext context = cnx->egl.eglCreateContext(
- dp->disp[i].dpy, dp->disp[i].config[index],
+ dp->disp[ dp->configs[intptr_t(config)].impl ].dpy,
+ dp->configs[intptr_t(config)].config,
share_list, attrib_list);
if (context != EGL_NO_CONTEXT) {
// figure out if it's a GLESv1 or GLESv2
@@ -1068,7 +1099,8 @@
}
};
}
- egl_context_t* c = new egl_context_t(dpy, context, i, cnx, version);
+ egl_context_t* c = new egl_context_t(dpy, context, config,
+ dp->configs[intptr_t(config)].impl, cnx, version);
return c;
}
}
@@ -1213,8 +1245,16 @@
egl_display_t const * const dp = get_display(dpy);
egl_context_t * const c = get_context(ctx);
- return c->cnx->egl.eglQueryContext(
- dp->disp[c->impl].dpy, c->context, attribute, value);
+ EGLBoolean result(EGL_TRUE);
+ if (attribute == EGL_CONFIG_ID) {
+ *value = dp->configs[intptr_t(c->config)].configId;
+ } else {
+ // We need to remap EGL_CONFIG_IDs
+ result = c->cnx->egl.eglQueryContext(
+ dp->disp[c->impl].dpy, c->context, attribute, value);
+ }
+
+ return result;
}
EGLContext eglGetCurrentContext(void)
@@ -1586,13 +1626,13 @@
EGLConfig config, const EGLint *attrib_list)
{
egl_display_t const* dp = 0;
- int i=0, index=0;
- egl_connection_t* cnx = validate_display_config(dpy, config, dp, i, index);
+ egl_connection_t* cnx = validate_display_config(dpy, config, dp);
if (!cnx) return EGL_FALSE;
if (cnx->egl.eglCreatePbufferFromClientBuffer) {
return cnx->egl.eglCreatePbufferFromClientBuffer(
- dp->disp[i].dpy, buftype, buffer,
- dp->disp[i].config[index], attrib_list);
+ dp->disp[ dp->configs[intptr_t(config)].impl ].dpy,
+ buftype, buffer,
+ dp->configs[intptr_t(config)].config, attrib_list);
}
return setError(EGL_BAD_CONFIG, EGL_NO_SURFACE);
}
diff --git a/services/camera/libcameraservice/CameraService.cpp b/services/camera/libcameraservice/CameraService.cpp
index c786f94..3b3904a 100644
--- a/services/camera/libcameraservice/CameraService.cpp
+++ b/services/camera/libcameraservice/CameraService.cpp
@@ -1,7 +1,6 @@
/*
**
** Copyright (C) 2008, The Android Open Source Project
-** Copyright (C) 2008 HTC Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
diff --git a/services/camera/libcameraservice/CameraService.h b/services/camera/libcameraservice/CameraService.h
index b0b2d7a..77ccf41 100644
--- a/services/camera/libcameraservice/CameraService.h
+++ b/services/camera/libcameraservice/CameraService.h
@@ -1,7 +1,6 @@
/*
**
** Copyright (C) 2008, The Android Open Source Project
-** Copyright (C) 2008 HTC Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.