Merge change 8134
* changes:
Adding contact group NOTES and SYSTEM_ID
diff --git a/api/current.xml b/api/current.xml
index 9f79118..33fd7f1 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -2297,6 +2297,17 @@
visibility="public"
>
</field>
+<field name="anyDensity"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="16843372"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
<field name="apiKey"
type="int"
transient="false"
@@ -3155,17 +3166,6 @@
visibility="public"
>
</field>
-<field name="density"
- type="int"
- transient="false"
- volatile="false"
- value="16843372"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
<field name="dependency"
type="int"
transient="false"
@@ -39175,6 +39175,17 @@
visibility="public"
>
</field>
+<field name="FLAG_SUPPORTS_SCREEN_DENSITIES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="8192"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
<field name="FLAG_SUPPORTS_SMALL_SCREENS"
type="int"
transient="false"
@@ -39330,17 +39341,6 @@
visibility="public"
>
</field>
-<field name="supportsDensities"
- type="int[]"
- transient="false"
- volatile="false"
- value="null"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
<field name="targetSdkVersion"
type="int"
transient="false"
@@ -41252,17 +41252,6 @@
visibility="public"
>
</field>
-<field name="GET_SUPPORTS_DENSITIES"
- type="int"
- transient="false"
- volatile="false"
- value="32768"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
<field name="GET_UNINSTALLED_PACKAGES"
type="int"
transient="false"
@@ -95472,6 +95461,56 @@
</parameter>
</method>
</class>
+<class name="Version"
+ extends="java.lang.Object"
+ abstract="false"
+ static="false"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<constructor name="Version"
+ type="android.opengl.Version"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</constructor>
+<method name="getOpenGLESVersion"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<field name="OPENGLES_11"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="11"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="OPENGLES_20"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="20"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+</class>
<class name="Visibility"
extends="java.lang.Object"
abstract="false"
diff --git a/core/java/android/app/SearchDialog.java b/core/java/android/app/SearchDialog.java
index 27c6376..0380c90 100644
--- a/core/java/android/app/SearchDialog.java
+++ b/core/java/android/app/SearchDialog.java
@@ -34,7 +34,10 @@
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Bundle;
+import android.os.IBinder;
+import android.os.RemoteException;
import android.os.SystemClock;
+import android.provider.Browser;
import android.server.search.SearchableInfo;
import android.speech.RecognizerIntent;
import android.text.Editable;
@@ -42,6 +45,7 @@
import android.text.TextUtils;
import android.text.TextWatcher;
import android.text.util.Regex;
+import android.util.AndroidRuntimeException;
import android.util.AttributeSet;
import android.util.Log;
import android.view.ContextThemeWrapper;
@@ -1093,7 +1097,8 @@
*/
protected void launchQuerySearch(int actionKey, String actionMsg) {
String query = mSearchAutoComplete.getText().toString();
- Intent intent = createIntent(Intent.ACTION_SEARCH, null, null, query, null,
+ String action = mGlobalSearchMode ? Intent.ACTION_WEB_SEARCH : Intent.ACTION_SEARCH;
+ Intent intent = createIntent(action, null, null, query, null,
actionKey, actionMsg);
launchIntent(intent);
}
@@ -1245,16 +1250,127 @@
return;
}
Log.d(LOG_TAG, "launching " + intent);
- getContext().startActivity(intent);
-
- // in global search mode, SearchDialogWrapper#performActivityResuming will handle hiding
- // the dialog when the next activity starts, but for in-app search, we still need to
- // dismiss the dialog.
- if (!mGlobalSearchMode) {
- dismiss();
+ try {
+ // in global search mode, we send the activity straight to the original suggestion
+ // source. this is because GlobalSearch may not have permission to launch the
+ // intent, and to avoid the extra step of going through GlobalSearch.
+ if (mGlobalSearchMode) {
+ launchGlobalSearchIntent(intent);
+ } else {
+ getContext().startActivity(intent);
+ // in global search mode, SearchDialogWrapper#performActivityResuming
+ // will handle hiding the dialog when the next activity starts, but for
+ // in-app search, we still need to dismiss the dialog.
+ dismiss();
+ }
+ } catch (RuntimeException ex) {
+ Log.e(LOG_TAG, "Failed launch activity: " + intent, ex);
}
}
-
+
+ private void launchGlobalSearchIntent(Intent intent) {
+ final String packageName;
+ // GlobalSearch puts the original source of the suggestion in the
+ // 'component name' column. If set, we send the intent to that activity.
+ // We trust GlobalSearch to always set this to the suggestion source.
+ String intentComponent = intent.getStringExtra(SearchManager.COMPONENT_NAME_KEY);
+ if (intentComponent != null) {
+ ComponentName componentName = ComponentName.unflattenFromString(intentComponent);
+ intent.setComponent(componentName);
+ intent.removeExtra(SearchManager.COMPONENT_NAME_KEY);
+ // Launch the intent as the suggestion source.
+ // This prevents sources from using the search dialog to launch
+ // intents that they don't have permission for themselves.
+ packageName = componentName.getPackageName();
+ } else {
+ // If there is no component in the suggestion, it must be a built-in suggestion
+ // from GlobalSearch (e.g. "Search the web for") or the intent
+ // launched when pressing the search/go button in the search dialog.
+ // Launch the intent with the permissions of GlobalSearch.
+ packageName = mSearchable.getSearchActivity().getPackageName();
+ }
+
+ // Launch all global search suggestions as new tasks, since they don't relate
+ // to the current task.
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ setBrowserApplicationId(intent);
+
+ if (DBG) Log.d(LOG_TAG, "Launching intent " + intent.toURI() + " as " + packageName);
+ startActivityInPackage(intent, packageName);
+ }
+
+ /**
+ * If the intent is to open an HTTP or HTTPS URL, we set
+ * {@link Browser#EXTRA_APPLICATION_ID} so that any existing browser window that
+ * has been opened by us for the same URL will be reused.
+ */
+ private void setBrowserApplicationId(Intent intent) {
+ Uri data = intent.getData();
+ if (Intent.ACTION_VIEW.equals(intent.getAction()) && data != null) {
+ String scheme = data.getScheme();
+ if (scheme != null && scheme.startsWith("http")) {
+ intent.putExtra(Browser.EXTRA_APPLICATION_ID, data.toString());
+ }
+ }
+ }
+
+ /**
+ * Starts an activity as if it had been started by the given package.
+ *
+ * @param intent The description of the activity to start.
+ * @param packageName
+ * @throws ActivityNotFoundException If the intent could not be resolved to
+ * and existing activity.
+ * @throws SecurityException If the package does not have permission to start
+ * start the activity.
+ * @throws AndroidRuntimeException If some other error occurs.
+ */
+ private void startActivityInPackage(Intent intent, String packageName) {
+ try {
+ int uid = ActivityThread.getPackageManager().getPackageUid(packageName);
+ if (uid < 0) {
+ throw new AndroidRuntimeException("Package UID not found " + packageName);
+ }
+ String resolvedType = intent.resolveTypeIfNeeded(getContext().getContentResolver());
+ IBinder resultTo = null;
+ String resultWho = null;
+ int requestCode = -1;
+ boolean onlyIfNeeded = false;
+ int result = ActivityManagerNative.getDefault().startActivityInPackage(
+ uid, intent, resolvedType, resultTo, resultWho, requestCode, onlyIfNeeded);
+ checkStartActivityResult(result, intent);
+ } catch (RemoteException ex) {
+ throw new AndroidRuntimeException(ex);
+ }
+ }
+
+ // Stolen from Instrumentation.checkStartActivityResult()
+ private static void checkStartActivityResult(int res, Intent intent) {
+ if (res >= IActivityManager.START_SUCCESS) {
+ return;
+ }
+ switch (res) {
+ case IActivityManager.START_INTENT_NOT_RESOLVED:
+ case IActivityManager.START_CLASS_NOT_FOUND:
+ if (intent.getComponent() != null)
+ throw new ActivityNotFoundException(
+ "Unable to find explicit activity class "
+ + intent.getComponent().toShortString()
+ + "; have you declared this activity in your AndroidManifest.xml?");
+ throw new ActivityNotFoundException(
+ "No Activity found to handle " + intent);
+ case IActivityManager.START_PERMISSION_DENIED:
+ throw new SecurityException("Not allowed to start activity "
+ + intent);
+ case IActivityManager.START_FORWARD_AND_REQUEST_CONFLICT:
+ throw new AndroidRuntimeException(
+ "FORWARD_RESULT_FLAG used while also requesting a result");
+ default:
+ throw new AndroidRuntimeException("Unknown error code "
+ + res + " when starting " + intent);
+ }
+ }
+
/**
* Handles the special intent actions declared in {@link SearchManager}.
*
@@ -1460,8 +1576,10 @@
intent.putExtra(SearchManager.ACTION_KEY, actionKey);
intent.putExtra(SearchManager.ACTION_MSG, actionMsg);
}
- // attempt to enforce security requirement (no 3rd-party intents)
- intent.setComponent(mSearchable.getSearchActivity());
+ // Only allow 3rd-party intents from GlobalSearch
+ if (!mGlobalSearchMode) {
+ intent.setComponent(mSearchable.getSearchActivity());
+ }
return intent;
}
diff --git a/core/java/android/app/SuggestionsAdapter.java b/core/java/android/app/SuggestionsAdapter.java
index 593b7b7..54061ae 100644
--- a/core/java/android/app/SuggestionsAdapter.java
+++ b/core/java/android/app/SuggestionsAdapter.java
@@ -27,6 +27,7 @@
import android.database.Cursor;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
+import android.graphics.drawable.DrawableContainer;
import android.graphics.drawable.StateListDrawable;
import android.net.Uri;
import android.os.Bundle;
diff --git a/core/java/android/content/pm/ApplicationInfo.java b/core/java/android/content/pm/ApplicationInfo.java
index 4a3137f..9ca11cd 100644
--- a/core/java/android/content/pm/ApplicationInfo.java
+++ b/core/java/android/content/pm/ApplicationInfo.java
@@ -169,21 +169,22 @@
public static final int FLAG_RESIZEABLE_FOR_SCREENS = 1<<12;
/**
+ * Value for {@link #flags}: true when the application knows how to
+ * accomodate different screen densities. Corresponds to
+ * {@link android.R.styleable#AndroidManifestSupportsScreens_anyDensity
+ * android:anyDensity}.
+ */
+ public static final int FLAG_SUPPORTS_SCREEN_DENSITIES = 1<<13;
+
+ /**
* Value for {@link #flags}: this is false if the application has set
* its android:allowBackup to false, true otherwise.
*
* {@hide}
*/
- public static final int FLAG_ALLOW_BACKUP = 1<<13;
+ public static final int FLAG_ALLOW_BACKUP = 1<<14;
/**
- * Indicates that the application supports any densities;
- * {@hide}
- */
- public static final int ANY_DENSITY = -1;
- static final int[] ANY_DENSITIES_ARRAY = { ANY_DENSITY };
-
- /**
* Flags associated with the application. Any combination of
* {@link #FLAG_SYSTEM}, {@link #FLAG_DEBUGGABLE}, {@link #FLAG_HAS_CODE},
* {@link #FLAG_PERSISTENT}, {@link #FLAG_FACTORY_TEST}, and
@@ -228,13 +229,6 @@
public int uid;
/**
- * The list of densities in DPI that application supprots. This
- * field is only set if the {@link PackageManager#GET_SUPPORTS_DENSITIES} flag was
- * used when retrieving the structure.
- */
- public int[] supportsDensities;
-
- /**
* The minimum SDK version this application targets. It may run on earilier
* versions, but it knows how to work with any new behavior added at this
* version. Will be {@link android.os.Build.VERSION_CODES#CUR_DEVELOPMENT}
@@ -267,7 +261,6 @@
pw.println(prefix + "enabled=" + enabled);
pw.println(prefix + "manageSpaceActivityName="+manageSpaceActivityName);
pw.println(prefix + "description=0x"+Integer.toHexString(descriptionRes));
- pw.println(prefix + "supportsDensities=" + supportsDensities);
super.dumpBack(pw, prefix);
}
@@ -314,7 +307,6 @@
enabled = orig.enabled;
manageSpaceActivityName = orig.manageSpaceActivityName;
descriptionRes = orig.descriptionRes;
- supportsDensities = orig.supportsDensities;
}
@@ -346,7 +338,6 @@
dest.writeString(manageSpaceActivityName);
dest.writeString(backupAgentName);
dest.writeInt(descriptionRes);
- dest.writeIntArray(supportsDensities);
}
public static final Parcelable.Creator<ApplicationInfo> CREATOR
@@ -377,7 +368,6 @@
manageSpaceActivityName = source.readString();
backupAgentName = source.readString();
descriptionRes = source.readInt();
- supportsDensities = source.createIntArray();
}
/**
@@ -408,7 +398,7 @@
*/
public void disableCompatibilityMode() {
flags |= (FLAG_SUPPORTS_LARGE_SCREENS | FLAG_SUPPORTS_NORMAL_SCREENS |
- FLAG_SUPPORTS_SMALL_SCREENS | FLAG_RESIZEABLE_FOR_SCREENS);
- supportsDensities = ANY_DENSITIES_ARRAY;
+ FLAG_SUPPORTS_SMALL_SCREENS | FLAG_RESIZEABLE_FOR_SCREENS |
+ FLAG_SUPPORTS_SCREEN_DENSITIES);
}
}
diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java
index 3250a87..bca1715 100644
--- a/core/java/android/content/pm/PackageManager.java
+++ b/core/java/android/content/pm/PackageManager.java
@@ -165,12 +165,6 @@
public static final int GET_CONFIGURATIONS = 0x00004000;
/**
- * {@link ApplicationInfo} flag: return the
- * {@link ApplicationInfo#supportsDensities} that the package supports.
- */
- public static final int GET_SUPPORTS_DENSITIES = 0x00008000;
-
- /**
* Resolution and querying flag: if set, only filters that support the
* {@link android.content.Intent#CATEGORY_DEFAULT} will be considered for
* matching. This is a synonym for including the CATEGORY_DEFAULT in your
diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java
index 93ba959..33f4b52 100644
--- a/core/java/android/content/pm/PackageParser.java
+++ b/core/java/android/content/pm/PackageParser.java
@@ -675,6 +675,7 @@
int supportsNormalScreens = 1;
int supportsLargeScreens = 1;
int resizeable = 1;
+ int anyDensity = 1;
int outerDepth = parser.getDepth();
while ((type=parser.next()) != parser.END_DOCUMENT
@@ -854,21 +855,6 @@
XmlUtils.skipCurrentTag(parser);
- } else if (tagName.equals("supports-density")) {
- sa = res.obtainAttributes(attrs,
- com.android.internal.R.styleable.AndroidManifestSupportsDensity);
-
- int density = sa.getInteger(
- com.android.internal.R.styleable.AndroidManifestSupportsDensity_density, -1);
-
- sa.recycle();
-
- if (density != -1 && !pkg.supportsDensityList.contains(density)) {
- pkg.supportsDensityList.add(density);
- }
-
- XmlUtils.skipCurrentTag(parser);
-
} else if (tagName.equals("supports-screens")) {
sa = res.obtainAttributes(attrs,
com.android.internal.R.styleable.AndroidManifestSupportsScreens);
@@ -887,6 +873,9 @@
resizeable = sa.getInteger(
com.android.internal.R.styleable.AndroidManifestSupportsScreens_resizeable,
supportsLargeScreens);
+ anyDensity = sa.getInteger(
+ com.android.internal.R.styleable.AndroidManifestSupportsScreens_anyDensity,
+ anyDensity);
sa.recycle();
@@ -962,7 +951,7 @@
if (supportsSmallScreens < 0 || (supportsSmallScreens > 0
&& pkg.applicationInfo.targetSdkVersion
- >= android.os.Build.VERSION_CODES.CUR_DEVELOPMENT)) {
+ >= android.os.Build.VERSION_CODES.DONUT)) {
pkg.applicationInfo.flags |= ApplicationInfo.FLAG_SUPPORTS_SMALL_SCREENS;
}
if (supportsNormalScreens != 0) {
@@ -970,32 +959,19 @@
}
if (supportsLargeScreens < 0 || (supportsLargeScreens > 0
&& pkg.applicationInfo.targetSdkVersion
- >= android.os.Build.VERSION_CODES.CUR_DEVELOPMENT)) {
+ >= android.os.Build.VERSION_CODES.DONUT)) {
pkg.applicationInfo.flags |= ApplicationInfo.FLAG_SUPPORTS_LARGE_SCREENS;
}
if (resizeable < 0 || (resizeable > 0
&& pkg.applicationInfo.targetSdkVersion
- >= android.os.Build.VERSION_CODES.CUR_DEVELOPMENT)) {
+ >= android.os.Build.VERSION_CODES.DONUT)) {
pkg.applicationInfo.flags |= ApplicationInfo.FLAG_RESIZEABLE_FOR_SCREENS;
}
- int densities[] = null;
- int size = pkg.supportsDensityList.size();
- if (size > 0) {
- densities = pkg.supportsDensities = new int[size];
- List<Integer> densityList = pkg.supportsDensityList;
- for (int i = 0; i < size; i++) {
- densities[i] = densityList.get(i);
- }
+ if (anyDensity < 0 || (anyDensity > 0
+ && pkg.applicationInfo.targetSdkVersion
+ >= android.os.Build.VERSION_CODES.DONUT)) {
+ pkg.applicationInfo.flags |= ApplicationInfo.FLAG_SUPPORTS_SCREEN_DENSITIES;
}
- /**
- * TODO: enable this before code freeze. b/1967935
- * *
- if ((densities == null || densities.length == 0)
- && (pkg.applicationInfo.targetSdkVersion
- >= android.os.Build.VERSION_CODES.CUR_DEVELOPMENT)) {
- pkg.supportsDensities = ApplicationInfo.ANY_DENSITIES_ARRAY;
- }
- */
return pkg;
}
@@ -2446,9 +2422,6 @@
// We store the application meta-data independently to avoid multiple unwanted references
public Bundle mAppMetaData = null;
- public final ArrayList<Integer> supportsDensityList = new ArrayList<Integer>();
- public int[] supportsDensities = null;
-
// If this is a 3rd party app, this is the path of the zip file.
public String mPath;
@@ -2630,10 +2603,6 @@
&& p.usesLibraryFiles != null) {
return true;
}
- if ((flags & PackageManager.GET_SUPPORTS_DENSITIES) != 0
- && p.supportsDensities != null) {
- return true;
- }
return false;
}
@@ -2656,9 +2625,6 @@
if ((flags & PackageManager.GET_SHARED_LIBRARY_FILES) != 0) {
ai.sharedLibraryFiles = p.usesLibraryFiles;
}
- if ((flags & PackageManager.GET_SUPPORTS_DENSITIES) != 0) {
- ai.supportsDensities = p.supportsDensities;
- }
if (!sCompatibilityModeEnabled) {
ai.disableCompatibilityMode();
}
diff --git a/core/java/android/content/res/CompatibilityInfo.java b/core/java/android/content/res/CompatibilityInfo.java
index 517551e..e2abfd1 100644
--- a/core/java/android/content/res/CompatibilityInfo.java
+++ b/core/java/android/content/res/CompatibilityInfo.java
@@ -131,41 +131,15 @@
mCompatibilityFlags |= EXPANDABLE | CONFIGURED_EXPANDABLE;
}
- float packageDensityScale = -1.0f;
- int packageDensity = 0;
- if (appInfo.supportsDensities != null) {
- int minDiff = Integer.MAX_VALUE;
- for (int density : appInfo.supportsDensities) {
- if (density == ApplicationInfo.ANY_DENSITY) {
- packageDensity = DisplayMetrics.DENSITY_DEVICE;
- packageDensityScale = 1.0f;
- break;
- }
- int tmpDiff = Math.abs(DisplayMetrics.DENSITY_DEVICE - density);
- if (tmpDiff == 0) {
- packageDensity = DisplayMetrics.DENSITY_DEVICE;
- packageDensityScale = 1.0f;
- break;
- }
- // prefer higher density (appScale>1.0), unless that's only option.
- if (tmpDiff < minDiff && packageDensityScale < 1.0f) {
- packageDensity = density;
- packageDensityScale = DisplayMetrics.DENSITY_DEVICE / (float) density;
- minDiff = tmpDiff;
- }
- }
- }
- if (packageDensityScale > 0.0f) {
- applicationDensity = packageDensity;
- applicationScale = packageDensityScale;
+ if ((appInfo.flags & ApplicationInfo.FLAG_SUPPORTS_SCREEN_DENSITIES) != 0) {
+ applicationDensity = DisplayMetrics.DENSITY_DEVICE;
+ applicationScale = 1.0f;
+ applicationInvertedScale = 1.0f;
} else {
applicationDensity = DisplayMetrics.DENSITY_DEFAULT;
- applicationScale =
- DisplayMetrics.DENSITY_DEVICE / (float) DisplayMetrics.DENSITY_DEFAULT;
- }
-
- applicationInvertedScale = 1.0f / applicationScale;
- if (applicationScale != 1.0f) {
+ applicationScale = DisplayMetrics.DENSITY_DEVICE
+ / (float) DisplayMetrics.DENSITY_DEFAULT;
+ applicationInvertedScale = 1.0f / applicationScale;
mCompatibilityFlags |= SCALING_REQUIRED;
}
}
diff --git a/core/java/android/database/MatrixCursor.java b/core/java/android/database/MatrixCursor.java
index cf5a573..d5c3a32 100644
--- a/core/java/android/database/MatrixCursor.java
+++ b/core/java/android/database/MatrixCursor.java
@@ -214,53 +214,64 @@
// AbstractCursor implementation.
+ @Override
public int getCount() {
return rowCount;
}
+ @Override
public String[] getColumnNames() {
return columnNames;
}
+ @Override
public String getString(int column) {
- return String.valueOf(get(column));
+ Object value = get(column);
+ if (value == null) return null;
+ return value.toString();
}
+ @Override
public short getShort(int column) {
Object value = get(column);
- return (value instanceof String)
- ? Short.valueOf((String) value)
- : ((Number) value).shortValue();
+ if (value == null) return 0;
+ if (value instanceof Number) return ((Number) value).shortValue();
+ return Short.parseShort(value.toString());
}
+ @Override
public int getInt(int column) {
Object value = get(column);
- return (value instanceof String)
- ? Integer.valueOf((String) value)
- : ((Number) value).intValue();
+ if (value == null) return 0;
+ if (value instanceof Number) return ((Number) value).intValue();
+ return Integer.parseInt(value.toString());
}
+ @Override
public long getLong(int column) {
Object value = get(column);
- return (value instanceof String)
- ? Long.valueOf((String) value)
- : ((Number) value).longValue();
+ if (value == null) return 0;
+ if (value instanceof Number) return ((Number) value).longValue();
+ return Long.parseLong(value.toString());
}
+ @Override
public float getFloat(int column) {
Object value = get(column);
- return (value instanceof String)
- ? Float.valueOf((String) value)
- : ((Number) value).floatValue();
+ if (value == null) return 0.0f;
+ if (value instanceof Number) return ((Number) value).floatValue();
+ return Float.parseFloat(value.toString());
}
+ @Override
public double getDouble(int column) {
Object value = get(column);
- return (value instanceof String)
- ? Double.valueOf((String) value)
- : ((Number) value).doubleValue();
+ if (value == null) return 0.0d;
+ if (value instanceof Number) return ((Number) value).doubleValue();
+ return Double.parseDouble(value.toString());
}
+ @Override
public boolean isNull(int column) {
return get(column) == null;
}
diff --git a/core/java/android/database/sqlite/SQLiteDatabase.java b/core/java/android/database/sqlite/SQLiteDatabase.java
index 7d331dc..184d6dc 100644
--- a/core/java/android/database/sqlite/SQLiteDatabase.java
+++ b/core/java/android/database/sqlite/SQLiteDatabase.java
@@ -1412,8 +1412,9 @@
StringBuilder sql = new StringBuilder(120);
sql.append("UPDATE ");
if (algorithm != null) {
- sql.append(" OR ");
+ sql.append("OR ");
sql.append(algorithm.value());
+ sql.append(" ");
}
sql.append(table);
diff --git a/core/java/android/server/search/SearchDialogWrapper.java b/core/java/android/server/search/SearchDialogWrapper.java
index d3ef5de..b8a9875 100644
--- a/core/java/android/server/search/SearchDialogWrapper.java
+++ b/core/java/android/server/search/SearchDialogWrapper.java
@@ -190,6 +190,9 @@
msgData.putBundle(KEY_APP_SEARCH_DATA, appSearchData);
msgData.putInt(KEY_IDENT, ident);
mSearchUiThread.sendMessage(msg);
+ // be a little more eager in setting this so isVisible will return the correct value if
+ // called immediately after startSearch
+ mVisible = true;
}
/**
@@ -199,6 +202,9 @@
public void stopSearch() {
if (DBG) debug("stopSearch()");
mSearchUiThread.sendEmptyMessage(MSG_STOP_SEARCH);
+ // be a little more eager in setting this so isVisible will return the correct value if
+ // called immediately after stopSearch
+ mVisible = false;
}
/**
diff --git a/core/java/android/speech/tts/TextToSpeech.java b/core/java/android/speech/tts/TextToSpeech.java
index bb6b4b0..8f8d976 100755
--- a/core/java/android/speech/tts/TextToSpeech.java
+++ b/core/java/android/speech/tts/TextToSpeech.java
@@ -921,8 +921,10 @@
mCachedParams[Engine.TTS_PARAM_POSITION_LANGUAGE + 1] = loc.getISO3Language();
mCachedParams[Engine.TTS_PARAM_POSITION_COUNTRY + 1] = loc.getISO3Country();
mCachedParams[Engine.TTS_PARAM_POSITION_VARIANT + 1] = loc.getVariant();
-
- result = mITts.setLanguage(mPackageName,
+ // the language is not set here, instead it is cached so it will be associated
+ // with all upcoming utterances. But we still need to report the language support,
+ // which is achieved by calling isLanguageAvailable()
+ result = mITts.isLanguageAvailable(
mCachedParams[Engine.TTS_PARAM_POSITION_LANGUAGE + 1],
mCachedParams[Engine.TTS_PARAM_POSITION_COUNTRY + 1],
mCachedParams[Engine.TTS_PARAM_POSITION_VARIANT + 1] );
diff --git a/core/java/android/view/SurfaceView.java b/core/java/android/view/SurfaceView.java
index 277b347..a854535 100644
--- a/core/java/android/view/SurfaceView.java
+++ b/core/java/android/view/SurfaceView.java
@@ -141,7 +141,14 @@
int mType = -1;
final Rect mSurfaceFrame = new Rect();
private Translator mTranslator;
-
+
+ // A flag to indicate that the Canvas has to be scaled
+ private boolean mScaleCanvas = false;
+ // A flag to indicate that the Canvas is in use and being scaled.
+ // This may remain to be false even if mScaleCanvas is true if the applicatio
+ // does not use the canvas (such as GLSurfaceView, VideoView).
+ private boolean mCanvasScaled = false;
+
public SurfaceView(Context context) {
super(context);
setWillNotDraw(true);
@@ -255,18 +262,21 @@
@Override
public boolean dispatchTouchEvent(MotionEvent event) {
- // SurfaceView uses pre-scaled size unless fixed size is requested. This hook
- // scales the event back to the pre-scaled coordinates for such surface.
- if (mScaled) {
+ if (mTranslator == null || mCanvasScaled) {
+ // Use the event as is if no scaling is required, or the surface's canvas
+ // is scaled too.
+ return super.dispatchTouchEvent(event);
+ } else {
+ // The surface is in native size, so we need to scale the event
+ // back to native location.
MotionEvent scaledBack = MotionEvent.obtain(event);
- mTranslator.translateEventInScreenToAppWindow(event);
+ // scale back to original
+ scaledBack.scale(mTranslator.applicationScale);
try {
return super.dispatchTouchEvent(scaledBack);
} finally {
scaledBack.recycle();
}
- } else {
- return super.dispatchTouchEvent(event);
}
}
@@ -292,8 +302,6 @@
mWindowType = type;
}
- boolean mScaled = false;
-
private void updateWindow(boolean force) {
if (!mHaveFrame) {
return;
@@ -302,7 +310,7 @@
mTranslator = viewRoot.mTranslator;
float appScale = mTranslator == null ? 1.0f : mTranslator.applicationScale;
-
+
Resources res = getContext().getResources();
if (mTranslator != null || !res.getCompatibilityInfo().supportsScreen()) {
mSurface.setCompatibleDisplayMetrics(res.getDisplayMetrics());
@@ -313,14 +321,15 @@
int myHeight = mRequestedHeight;
if (myHeight <= 0) myHeight = getHeight();
- // Use original size if the app specified the size of the view,
- // and let the flinger to scale up.
+ // Use requested size if the app specified the size of the view
+ // and let the flinger to scale up. Otherwise, use the native size
+ // (* appScale) and assume the application can handle it.
if (mRequestedWidth <= 0 && mTranslator != null) {
myWidth = (int) (myWidth * appScale + 0.5f);
myHeight = (int) (myHeight * appScale + 0.5f);
- mScaled = true;
+ mScaleCanvas = true;
} else {
- mScaled = false;
+ mScaleCanvas = false;
}
getLocationInWindow(mLocation);
@@ -642,7 +651,9 @@
if (localLOGV) Log.i(TAG, "Returned canvas: " + c);
if (c != null) {
mLastLockTime = SystemClock.uptimeMillis();
- if (mScaled) {
+ if (mScaleCanvas) {
+ // When the canvas is scaled, don't scale back the event's location.
+ mCanvasScaled = true;
mSaveCount = c.save();
mTranslator.translateCanvas(c);
}
@@ -668,7 +679,7 @@
}
public void unlockCanvasAndPost(Canvas canvas) {
- if (mScaled) {
+ if (mCanvasScaled) {
canvas.restoreToCount(mSaveCount);
}
mSurface.unlockCanvasAndPost(canvas);
diff --git a/core/java/android/webkit/WebStorage.java b/core/java/android/webkit/WebStorage.java
index 7522b5a5..1a60dba 100644
--- a/core/java/android/webkit/WebStorage.java
+++ b/core/java/android/webkit/WebStorage.java
@@ -51,8 +51,9 @@
// Global instance of a WebStorage
private static WebStorage sWebStorage;
- // We keep a copy of the origins, quotas and usages
- // that we protect via a lock and update in syncValues()
+ // We keep the origins, quotas and usages as member values
+ // that we protect via a lock and update in syncValues().
+ // This is needed to transfer this data across threads.
private static Lock mLock = new ReentrantLock();
private static Condition mCacheUpdated = mLock.newCondition();
@@ -104,18 +105,15 @@
Origin website = (Origin) msg.obj;
nativeSetQuotaForOrigin(website.getOrigin(),
website.getQuota());
- syncValues();
} break;
case DELETE_ORIGIN: {
Origin website = (Origin) msg.obj;
nativeDeleteOrigin(website.getOrigin());
- syncValues();
} break;
case DELETE_ALL:
nativeDeleteAllData();
- syncValues();
break;
case UPDATE:
@@ -204,7 +202,6 @@
if (origin != null) {
if (WebViewCore.THREAD_NAME.equals(Thread.currentThread().getName())) {
nativeSetQuotaForOrigin(origin, quota);
- syncValues();
} else {
postMessage(Message.obtain(null, SET_QUOTA_ORIGIN,
new Origin(origin, quota)));
@@ -220,7 +217,6 @@
if (origin != null) {
if (WebViewCore.THREAD_NAME.equals(Thread.currentThread().getName())) {
nativeDeleteOrigin(origin);
- syncValues();
} else {
postMessage(Message.obtain(null, DELETE_ORIGIN,
new Origin(origin)));
@@ -235,7 +231,6 @@
public void deleteAllData() {
if (WebViewCore.THREAD_NAME.equals(Thread.currentThread().getName())) {
nativeDeleteAllData();
- syncValues();
} else {
postMessage(Message.obtain(null, DELETE_ALL));
}
@@ -276,7 +271,7 @@
/**
* Run on the webcore thread
- * sync the local cached values with the real ones
+ * set the local values with the current ones
*/
private void syncValues() {
mLock.lock();
diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java
index 777beed..eea97dc 100644
--- a/core/java/android/widget/AbsListView.java
+++ b/core/java/android/widget/AbsListView.java
@@ -1535,6 +1535,9 @@
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
+ // Dismiss the popup in case onSaveInstanceState() was not invoked
+ dismissPopup();
+
final ViewTreeObserver treeObserver = getViewTreeObserver();
if (treeObserver != null) {
treeObserver.removeOnTouchModeChangeListener(this);
diff --git a/core/java/android/widget/AutoCompleteTextView.java b/core/java/android/widget/AutoCompleteTextView.java
index 09a547f..b00a4759 100644
--- a/core/java/android/widget/AutoCompleteTextView.java
+++ b/core/java/android/widget/AutoCompleteTextView.java
@@ -205,11 +205,10 @@
* Private hook into the on click event, dispatched from {@link PassThroughClickListener}
*/
private void onClickImpl() {
- // if drop down should always visible, bring it back in front of the soft
- // keyboard when the user touches the text field
- if (mDropDownAlwaysVisible
- && mPopup.isShowing()
- && mPopup.getInputMethodMode() == PopupWindow.INPUT_METHOD_NOT_NEEDED) {
+ // If the dropdown is showing, bring it back in front of the soft
+ // keyboard when the user touches the text field.
+ if (mPopup.isShowing() &&
+ mPopup.getInputMethodMode() == PopupWindow.INPUT_METHOD_NOT_NEEDED) {
ensureImeVisible();
}
}
diff --git a/core/res/res/values/attrs_manifest.xml b/core/res/res/values/attrs_manifest.xml
index 75568e1..48b565f 100644
--- a/core/res/res/values/attrs_manifest.xml
+++ b/core/res/res/values/attrs_manifest.xml
@@ -827,28 +827,6 @@
<attr name="name" />
</declare-styleable>
- <!-- The <code>supports-density</code> specifies a screen density that this
- package supports. Application can specify multiple densities it supports.
- <p>This appears as a child tag of the
- {@link #AndroidManifest manifest} tag. -->
- <declare-styleable name="AndroidManifestSupportsDensity" parent="AndroidManifest">
- <!-- Required value of the density in dip (device independent pixel).
- You should use one of the pre-defined constants for the standard
- screen densities defined here.
- -->
- <attr name="density" format="integer">
- <!-- A low density screen, such as a QVGA or WQVGA screen in a
- typical hand-held phone. The constant for this is 120. -->
- <enum name="low" value="120" />
- <!-- A medium density screen, such as an HVGA screen in a
- typical hand-held phone. The constant for this is 160. -->
- <enum name="medium" value="160" />
- <!-- A high density screen, such as a VGA or WVGA screen in a
- typical hand-held phone. The constant for this is 240. -->
- <enum name="high" value="240" />
- </attr>
- </declare-styleable>
-
<!-- The <code>supports-screens</code> specifies the screen dimensions an
application supports. By default a modern application supports all
screen sizes and must explicitly disable certain screen sizes here;
@@ -892,6 +870,11 @@
set for you automatically based on whether you are targeting
a newer platform that supports more screens. -->
<attr name="resizeable" format="boolean" />
+ <!-- Indicates whether the application can accommodate any screen
+ density. Older applications are assumed to not be able to,
+ new ones able to. You can explicitly supply your abilities
+ here. -->
+ <attr name="anyDensity" format="boolean" />
</declare-styleable>
<!-- Private tag to declare system protected broadcast actions.
diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml
index e99f8be..f8dd4c1 100644
--- a/core/res/res/values/public.xml
+++ b/core/res/res/values/public.xml
@@ -1093,7 +1093,7 @@
<public type="attr" name="tension" id="0x0101026a" />
<public type="attr" name="extraTension" />
- <public type="attr" name="density" />
+ <public type="attr" name="anyDensity" />
<public type="attr" name="searchSuggestThreshold" />
<public type="attr" name="includeInGlobalSearch" />
<public type="attr" name="onClick" />
diff --git a/docs/html/guide/topics/resources/resources-i18n.jd b/docs/html/guide/topics/resources/resources-i18n.jd
index c26cb63..85b89d1 100755
--- a/docs/html/guide/topics/resources/resources-i18n.jd
+++ b/docs/html/guide/topics/resources/resources-i18n.jd
@@ -465,37 +465,37 @@
</tr>
<tr>
<td>MCC and MNC</td>
- <td>The mobile country code optionally followed by mobile network code
+ <td><p>The mobile country code optionally followed by mobile network code
from the SIM in the device. For example
<code>mcc310</code> (U.S. on any carrier);
<code>mcc310-mnc004</code> (U.S., Verizon brand);
<code>mcc208-mnc00</code> (France, Orange brand);
<code>mcc234-mnc00</code> (U.K., BT brand).
- <p>
+ </p><p>
If the device uses a radio connection (GSM phone), the MCC will come
from the SIM, and the MNC will come from the network to which the
device is attached. You might sometimes use the MCC alone, for example
to include country-specific legal resources in your application. If
your application specifies resources for a MCC/MNC combination, those
- resources can only be used if both the MCC and the MNC match. </td>
+ resources can only be used if both the MCC and the MNC match. </p></td>
</tr>
<tr>
<td>Language and region</td>
- <td>The two letter <a href="http://www.loc.gov/standards/iso639-2/php/code_list.php">ISO
+ <td><p>The two letter <a href="http://www.loc.gov/standards/iso639-2/php/code_list.php">ISO
639-1</a> language code optionally followed by a two letter
<a href="http://www.iso.org/iso/en/prods-services/iso3166ma/02iso-3166-code-lists/list-en1.html">ISO
3166-1-alpha-2</a> region code (preceded by lowercase "r"). For example
<code>fr</code>, <code>en-rUS</code>, <code>fr-rFR</code>, <code>es-rES</code>.
- <p>
+ </p><p>
The codes are <em>not</em> case-sensitive; the r prefix is used to
distinguish the region portion.
You cannot specify a region alone, but you can specify a language alone,
- for example <code>en</code>, <code>fr</code>, <code>es</code>. </td>
+ for example <code>en</code>, <code>fr</code>, <code>es</code>.</p> </td>
</tr>
<tr>
<td>Screen dimensions</td>
- <td><code>small</code>, <code>normal</code>, <code>large</code>
- <p>
+ <td><p><code>small</code>, <code>normal</code>, <code>large</code>
+ </p><p>
Specify that the resource is for a particular class of screen.
The meanings of these are:</p>
<ul>
@@ -517,27 +517,27 @@
</tr>
<tr>
<td>Wider/taller screens</td>
- <td><code>long</code>, <code>notlong</code>
- <p>
+ <td><p><code>long</code>, <code>notlong</code>
+ </p><p>
Specify that the resource is for a taller/wider than traditional
screen. This is based purely on the aspect ration of the screen:
QVGA, HVGA, and VGA are notlong; WQVGA, WVGA, FWVGA are long. Note
that long may mean either wide or tall, depending on the current
- orientation.
+ orientation.</p>
</td>
</tr>
<tr>
<td>Screen orientation</td>
- <td><code>port</code>, <code>land</code>, <code>square</code>
- <p>
+ <td><p><code>port</code>, <code>land</code>, <code>square</code>
+ </p><p>
Specifies that the resource is for a screen that is tall (port)
- or wide (land); square is not currently used.
+ or wide (land); square is not currently used.</p>
</td>
</tr>
<tr>
<td>Screen pixel density</td>
- <td><code>ldpi</code>, <code>mdpi</code>, <code>hdpi</code>, <code>nodpi</code>
- <p>
+ <td><p><code>ldpi</code>, <code>mdpi</code>, <code>hdpi</code>, <code>nodpi</code>
+ </p><p>
Specifies the screen density the resource is defined for. The medium
density of traditional HVGA screens (mdpi) is defined to be approximately
160dpi; low density (ldpi) is 120, and high density (hdpi) is 240. There
@@ -545,7 +545,7 @@
in ldpi would be 12x12 is mdpi and 16x16 in hdpi. The special
<code>nodpi</code> density can be used with bitmap resources to prevent
them from being scaled at load time to match the device density.
- <p>
+ </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="#best-match">How Android finds the best
@@ -553,10 +553,11 @@
be a match. In step 4, if the qualifier being considered is screen
density, Android will select the best final match at that point,
without any need to move on to step 5.
- <p>
+ </p><p>
You can also specify explicit densities like <code>92dpi</code>
or <code>108dpi</code>, but these are not fully supported by the
system so should not be used.
+ </p>
</td>
</tr>
<tr>
@@ -565,9 +566,9 @@
</tr>
<tr>
<td>Whether the keyboard is available to the user</td>
- <td><code>keysexposed</code>, <code>keyshidden</code>, <code>keyssoft</code>
- <p>
- If your application has specific resources that should only be used with a soft keyboard, use the <code>keyssoft</code> value. If no <code>keyssoft</code> resources are available (only <code>keysexposed</code> and <code>keyshidden</code>) and the device shows a soft keyboard, the system will use <code>keysexposed</code> resources. </td>
+ <td><p><code>keysexposed</code>, <code>keyshidden</code>, <code>keyssoft</code>
+ </p><p>
+ If your application has specific resources that should only be used with a soft keyboard, use the <code>keyssoft</code> value. If no <code>keyssoft</code> resources are available (only <code>keysexposed</code> and <code>keyshidden</code>) and the device shows a soft keyboard, the system will use <code>keysexposed</code> resources.</p> </td>
</tr>
<tr>
<td>Primary text input method</td>
diff --git a/graphics/java/android/graphics/drawable/DrawableContainer.java b/graphics/java/android/graphics/drawable/DrawableContainer.java
index 376b1df..dc80cf5 100644
--- a/graphics/java/android/graphics/drawable/DrawableContainer.java
+++ b/graphics/java/android/graphics/drawable/DrawableContainer.java
@@ -272,6 +272,8 @@
boolean mCheckedConstantState;
boolean mCanConstantState;
+ boolean mPaddingChecked = false;
+
DrawableContainerState(DrawableContainerState orig, DrawableContainer owner) {
mOwner = owner;
@@ -334,6 +336,7 @@
mHaveStateful = false;
mConstantPadding = null;
+ mPaddingChecked = false;
mComputedConstantSize = false;
return pos;
@@ -359,23 +362,25 @@
if (mVariablePadding) {
return null;
}
- if (mConstantPadding != null) {
+ if (mConstantPadding != null || mPaddingChecked) {
return mConstantPadding;
}
- final Rect r = new Rect(0, 0, 0, 0);
+ Rect r = null;
final Rect t = new Rect();
final int N = getChildCount();
final Drawable[] drawables = mDrawables;
for (int i = 0; i < N; i++) {
if (drawables[i].getPadding(t)) {
+ if (r == null) r = new Rect(0, 0, 0, 0);
if (t.left > r.left) r.left = t.left;
if (t.top > r.top) r.top = t.top;
if (t.right > r.right) r.right = t.right;
if (t.bottom > r.bottom) r.bottom = t.bottom;
}
}
- return (mConstantPadding=r);
+ mPaddingChecked = true;
+ return (mConstantPadding = r);
}
public final void setConstantSize(boolean constant) {
diff --git a/include/binder/MemoryDealer.h b/include/binder/MemoryDealer.h
index 6628f75..03ac70a 100644
--- a/include/binder/MemoryDealer.h
+++ b/include/binder/MemoryDealer.h
@@ -218,8 +218,6 @@
const sp<HeapInterface>& heap,
const sp<AllocatorInterface>& allocator);
- virtual ~MemoryDealer();
-
virtual sp<IMemory> allocate(size_t size, uint32_t flags = 0);
virtual void deallocate(size_t offset);
virtual void dump(const char* what, uint32_t flags = 0) const;
@@ -228,6 +226,9 @@
sp<IMemoryHeap> getMemoryHeap() const { return heap(); }
sp<AllocatorInterface> getAllocator() const { return allocator(); }
+protected:
+ virtual ~MemoryDealer();
+
private:
const sp<HeapInterface>& heap() const;
const sp<AllocatorInterface>& allocator() const;
diff --git a/include/media/MediaPlayerInterface.h b/include/media/MediaPlayerInterface.h
index 97d55aa..f723cfd 100644
--- a/include/media/MediaPlayerInterface.h
+++ b/include/media/MediaPlayerInterface.h
@@ -26,11 +26,10 @@
#include <media/mediaplayer.h>
#include <media/AudioSystem.h>
+#include <media/Metadata.h>
namespace android {
-typedef int32_t MetadataType;
-
class Parcel;
template<typename T> class SortedVector;
@@ -129,8 +128,10 @@
// the known metadata should be returned.
// @param[inout] records Parcel where the player appends its metadata.
// @return OK if the call was successful.
- virtual status_t getMetadata(const SortedVector<MetadataType>& ids,
- Parcel *records) = 0;
+ virtual status_t getMetadata(const media::Metadata::Filter& ids,
+ Parcel *records) {
+ return INVALID_OPERATION;
+ };
protected:
virtual void sendEvent(int msg, int ext1=0, int ext2=0) { if (mNotify) mNotify(mCookie, msg, ext1, ext2); }
diff --git a/include/media/Metadata.h b/include/media/Metadata.h
new file mode 100644
index 0000000..241868a
--- /dev/null
+++ b/include/media/Metadata.h
@@ -0,0 +1,133 @@
+/*
+ * Copyright (C) 2009 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.
+ */
+
+#ifndef ANDROID_MEDIA_METADATA_H__
+#define ANDROID_MEDIA_METADATA_H__
+
+#include <sys/types.h>
+#include <utils/Errors.h>
+#include <utils/RefBase.h>
+#include <utils/SortedVector.h>
+
+namespace android {
+class Parcel;
+
+namespace media {
+
+// Metadata is a class to build/serialize a set of metadata in a Parcel.
+//
+// This class should be kept in sync with android/media/Metadata.java.
+// It provides all the metadata ids available and methods to build the
+// header, add records and adjust the set size header field.
+//
+// Typical Usage:
+// ==============
+// Parcel p;
+// media::Metadata data(&p);
+//
+// data.appendHeader();
+// data.appendBool(Metadata::kPauseAvailable, true);
+// ... more append ...
+// data.updateLength();
+//
+
+class Metadata {
+ public:
+ typedef int32_t Type;
+ typedef SortedVector<Type> Filter;
+
+ static const Type kAny = 0;
+
+ // Keep in sync with android/media/Metadata.java
+ static const Type kTitle = 1; // String
+ static const Type kComment = 2; // String
+ static const Type kCopyright = 3; // String
+ static const Type kAlbum = 4; // String
+ static const Type kArtist = 5; // String
+ static const Type kAuthor = 6; // String
+ static const Type kComposer = 7; // String
+ static const Type kGenre = 8; // String
+ static const Type kDate = 9; // Date
+ static const Type kDuration = 10; // Integer(millisec)
+ static const Type kCdTrackNum = 11; // Integer 1-based
+ static const Type kCdTrackMax = 12; // Integer
+ static const Type kRating = 13; // String
+ static const Type kAlbumArt = 14; // byte[]
+ static const Type kVideoFrame = 15; // Bitmap
+ static const Type kCaption = 16; // TimedText
+
+ static const Type kBitRate = 17; // Integer, Aggregate rate of
+ // all the streams in bps.
+
+ static const Type kAudioBitRate = 18; // Integer, bps
+ static const Type kVideoBitRate = 19; // Integer, bps
+ static const Type kAudioSampleRate = 20; // Integer, Hz
+ static const Type kVideoframeRate = 21; // Integer, Hz
+
+ // See RFC2046 and RFC4281.
+ static const Type kMimeType = 22; // String
+ static const Type kAudioCodec = 23; // String
+ static const Type kVideoCodec = 24; // String
+
+ static const Type kVideoHeight = 25; // Integer
+ static const Type kVideoWidth = 26; // Integer
+ static const Type kNumTracks = 27; // Integer
+ static const Type kDrmCrippled = 28; // Boolean
+
+ // Playback capabilities.
+ static const Type kPauseAvailable = 29; // Boolean
+ static const Type kSeekBackwardAvailable = 30; // Boolean
+ static const Type kSeekForwardAvailable = 31; // Boolean
+
+ // @param p[inout] The parcel to append the metadata records
+ // to. The global metadata header should have been set already.
+ explicit Metadata(Parcel *p);
+ ~Metadata();
+
+ // Rewind the underlying parcel, undoing all the changes.
+ void resetParcel();
+
+ // Append the size and 'META' marker.
+ bool appendHeader();
+
+ // Once all the records have been added, call this to update the
+ // lenght field in the header.
+ void updateLength();
+
+ // append* are methods to append metadata.
+ // @param key Is the metadata Id.
+ // @param val Is the value of the metadata.
+ // @return true if successful, false otherwise.
+ // TODO: add more as needed to handle other types.
+ bool appendBool(Type key, bool val);
+ bool appendInt32(Type key, int32_t val);
+
+ private:
+ Metadata(const Metadata&);
+ Metadata& operator=(const Metadata&);
+
+
+ // Checks the key is valid and not already present.
+ bool checkKey(Type key);
+
+ Parcel *mData;
+ size_t mBegin;
+};
+
+} // namespace android::media
+} // namespace android
+
+#endif // ANDROID_MEDIA_METADATA_H__
diff --git a/include/media/PVPlayer.h b/include/media/PVPlayer.h
index 40ccc14b..8a66152 100644
--- a/include/media/PVPlayer.h
+++ b/include/media/PVPlayer.h
@@ -19,6 +19,7 @@
#include <utils/Errors.h>
#include <media/MediaPlayerInterface.h>
+#include <media/Metadata.h>
#define MAX_OPENCORE_INSTANCES 25
@@ -53,8 +54,9 @@
virtual status_t setLooping(int loop);
virtual player_type playerType() { return PV_PLAYER; }
virtual status_t invoke(const Parcel& request, Parcel *reply);
- virtual status_t getMetadata(const SortedVector<MetadataType>& ids,
- Parcel *records);
+ virtual status_t getMetadata(
+ const SortedVector<media::Metadata::Type>& ids,
+ Parcel *records);
// make available to PlayerDriver
void sendEvent(int msg, int ext1=0, int ext2=0) { MediaPlayerBase::sendEvent(msg, ext1, ext2); }
diff --git a/keystore/java/android/security/Keystore.java b/keystore/java/android/security/Keystore.java
index 1f14da7..a6cfbca 100644
--- a/keystore/java/android/security/Keystore.java
+++ b/keystore/java/android/security/Keystore.java
@@ -48,49 +48,6 @@
public abstract int remove(String namespace, String keyname);
public abstract int reset();
- // TODO: for migrating to the mini-keystore, clean up from here
- /**
- */
- public abstract String getCaCertificate(String key);
-
- /**
- */
- public abstract String getUserCertificate(String key);
-
- /**
- */
- public abstract String getUserPrivateKey(String key);
-
- /**
- * Returns the array of the certificate keynames in keystore if successful.
- * Or return an empty array if error.
- *
- * @return array of the certificate keynames
- */
- public abstract String[] getAllUserCertificateKeys();
-
- /**
- */
- public abstract String[] getAllCaCertificateKeys();
-
- /**
- */
- public abstract String[] getSupportedKeyStrenghs();
-
- /**
- * Generates a key pair and returns the certificate request.
- * @param keyStrengthIndex index to the array of supported key strengths
- * @param challenge the challenge message in the keygen tag
- * @param organizations the organization string, e.g.,
- * "/C=US/ST={state}/L={city}/O={company}/OU={app}/CN={hostname}"
- * @return the certificate request
- */
- public abstract String generateKeyPair(
- int keyStrengthIndex, String challenge, String organizations);
-
- public abstract void addCertificate(byte[] cert);
- // to here
-
private static class FileKeystore extends Keystore {
private static final String SERVICE_NAME = "keystore";
private static final String CA_CERTIFICATE = "CaCertificate";
@@ -100,69 +57,6 @@
private static final ServiceCommand mServiceCommand =
new ServiceCommand(SERVICE_NAME);
- // TODO: for migrating to the mini-keystore, start from here
- @Override
- public String getUserPrivateKey(String key) {
- return "";
- }
-
- @Override
- public String getUserCertificate(String key) {
- return "";
- }
-
- @Override
- public String getCaCertificate(String key) {
- return "";
- }
-
- @Override
- public String[] getAllUserCertificateKeys() {
- return new String[0];
- }
-
- @Override
- public String[] getAllCaCertificateKeys() {
- return new String[0];
- }
-
- @Override
- public String[] getSupportedKeyStrenghs() {
- // TODO: real implementation
- return new String[] {"High Grade", "Medium Grade"};
- }
-
- @Override
- public String generateKeyPair(int keyStrengthIndex, String challenge,
- String organizations) {
- // TODO: real implementation
- return "-----BEGIN CERTIFICATE REQUEST-----"
- + "\nMIICzjCCAbYCAQAwgYgxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlh"
- + "\nMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRMwEQYDVQQKEwpHb29nbGUgSW5jMRYw"
- + "\nFAYDVQQLEw1SZW1vdGUgQWNjZXNzMRAwDgYDVQQLEwdHbGFwdG9wMQ0wCwYDVQQD"
- + "\nEwR0ZXN0MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAznwy7a16O35u"
- + "\nODLQOw6yHAxozrrX1J+c0reiIh8GYohwKrBedFnQ/FnTls6bxY4fNHD+SZvFFgvU"
- + "\nECBFOfRmRm7AFo51qT0t2a8qgvDLM6L1qGkmy94W28Q3OlcpF2QianHYdjyGT+Ac"
- + "\nYDek1Zi/E/mdPzuVM/K8tkB7n8ktC0PTm1ZtdMRauE5R0WrEhWuF6In/2gy1Q/Zh"
- + "\noy7/zQqpbPl2ouulvkx1Y3OXHM6XPNFLoHS1gH0HyAuBUokO0QmetRn6ngJSvz7e"
- + "\nVD7QYRppGp+g4BxqaV9XSxhaaKrMs4PAld9enV51X9qjvjCRBve2QxtuJgMfGJdU"
- + "\njGr/JweZoQIDAQABoAAwDQYJKoZIhvcNAQEFBQADggEBADtxOtEseoLOVYh6sh4b"
- + "\nWCdngK87uHn2bdGipFwKdNTxQDdxNQLAKdoGYIfbVsC1cDgFiufeNwVukxxymdnm"
- + "\nk0GGK+0O0tZKENv8ysgfbgEsHpJH9FoR5Y5XEq1etejkcgCp59dyhrSk0DLyVm0D"
- + "\nIfTC/nsK95H7AAGOkbbDFo2otyLNNrthYncQ9diAG0UzzLacA+86JXZmD3HyC48u"
- + "\nI9hsivVnTTfl9afcfVAhfxbQ6HgkhZZjbjFjfABSd4v8wKlAAqK58VxCajNVOVcV"
- + "\ncCzOWf6NpE7xEHCf32i8bWDP6hi0WgQcdpQwnZNKhhTLGNb23Uty6HYlJhbxexC7"
- + "\nUoM="
- + "\n-----END CERTIFICATE REQUEST-----";
- }
-
- @Override
- public void addCertificate(byte[] cert) {
- // TODO: real implementation
- }
-
- // to here
-
@Override
public int lock() {
Reply result = mServiceCommand.execute(ServiceCommand.LOCK, null);
diff --git a/media/java/android/media/Metadata.java b/media/java/android/media/Metadata.java
index 70e89a2..bd25da2 100644
--- a/media/java/android/media/Metadata.java
+++ b/media/java/android/media/Metadata.java
@@ -104,7 +104,7 @@
public static final int SEEK_FORWARD_AVAILABLE = 31; // Boolean
private static final int LAST_SYSTEM = 31;
- private static final int FIRST_CUSTOM = 8092;
+ private static final int FIRST_CUSTOM = 8192;
// Shorthands to set the MediaPlayer's metadata filter.
public static final Set<Integer> MATCH_NONE = Collections.EMPTY_SET;
diff --git a/media/jni/soundpool/SoundPool.cpp b/media/jni/soundpool/SoundPool.cpp
index ce80f92..1fdecdd 100644
--- a/media/jni/soundpool/SoundPool.cpp
+++ b/media/jni/soundpool/SoundPool.cpp
@@ -18,8 +18,7 @@
#define LOG_TAG "SoundPool"
#include <utils/Log.h>
-//
-#define USE_SHARED_MEM_BUFFER
+//#define USE_SHARED_MEM_BUFFER
// XXX needed for timing latency
#include <utils/Timers.h>
diff --git a/media/libmedia/Android.mk b/media/libmedia/Android.mk
index cdaab04..07c81f7 100644
--- a/media/libmedia/Android.mk
+++ b/media/libmedia/Android.mk
@@ -2,24 +2,25 @@
include $(CLEAR_VARS)
LOCAL_SRC_FILES:= \
- AudioTrack.cpp \
- IAudioFlinger.cpp \
- IAudioFlingerClient.cpp \
- IAudioTrack.cpp \
- IAudioRecord.cpp \
- AudioRecord.cpp \
- AudioSystem.cpp \
- mediaplayer.cpp \
- IMediaPlayerService.cpp \
- IMediaPlayerClient.cpp \
- IMediaPlayer.cpp \
- IMediaRecorder.cpp \
- mediarecorder.cpp \
- IMediaMetadataRetriever.cpp \
- mediametadataretriever.cpp \
- ToneGenerator.cpp \
- JetPlayer.cpp \
- IOMX.cpp
+ AudioTrack.cpp \
+ IAudioFlinger.cpp \
+ IAudioFlingerClient.cpp \
+ IAudioTrack.cpp \
+ IAudioRecord.cpp \
+ AudioRecord.cpp \
+ AudioSystem.cpp \
+ mediaplayer.cpp \
+ IMediaPlayerService.cpp \
+ IMediaPlayerClient.cpp \
+ IMediaPlayer.cpp \
+ IMediaRecorder.cpp \
+ Metadata.cpp \
+ mediarecorder.cpp \
+ IMediaMetadataRetriever.cpp \
+ mediametadataretriever.cpp \
+ ToneGenerator.cpp \
+ JetPlayer.cpp \
+ IOMX.cpp
LOCAL_SHARED_LIBRARIES := \
libui libcutils libutils libbinder libsonivox
diff --git a/media/libmedia/Metadata.cpp b/media/libmedia/Metadata.cpp
new file mode 100644
index 0000000..35ec6b3
--- /dev/null
+++ b/media/libmedia/Metadata.cpp
@@ -0,0 +1,168 @@
+/*
+ * Copyright (C) 2009 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.
+ */
+
+//#define LOG_NDEBUG 0
+#define LOG_TAG "Metadata"
+#include <utils/Log.h>
+
+#include <sys/types.h>
+#include <media/Metadata.h>
+#include <binder/Parcel.h>
+#include <utils/Errors.h>
+#include <utils/RefBase.h>
+
+// This file contains code to serialize Metadata triples (key, type,
+// value) into a parcel. The Parcel is destinated to be decoded by the
+// Metadata.java class.
+
+namespace {
+// All these constants below must be kept in sync with Metadata.java.
+enum MetadataId {
+ FIRST_SYSTEM_ID = 1,
+ LAST_SYSTEM_ID = 31,
+ FIRST_CUSTOM_ID = 8192
+};
+
+// Types
+enum Types {
+ STRING_VAL = 1,
+ INTEGER_VAL,
+ BOOLEAN_VAL,
+ LONG_VAL,
+ DOUBLE_VAL,
+ TIMED_TEXT_VAL,
+ DATE_VAL,
+ BYTE_ARRAY_VAL,
+};
+
+const size_t kRecordHeaderSize = 3 * sizeof(int32_t);
+const int32_t kMetaMarker = 0x4d455441; // 'M' 'E' 'T' 'A'
+
+} // anonymous namespace
+
+namespace android {
+namespace media {
+
+Metadata::Metadata(Parcel *p)
+ :mData(p),
+ mBegin(p->dataPosition()) { }
+
+Metadata::~Metadata() { }
+
+void Metadata::resetParcel()
+{
+ mData->setDataPosition(mBegin);
+}
+
+// Update the 4 bytes int at the beginning of the parcel which holds
+// the number of bytes written so far.
+void Metadata::updateLength()
+{
+ const size_t end = mData->dataPosition();
+
+ mData->setDataPosition(mBegin);
+ mData->writeInt32(end - mBegin);
+ mData->setDataPosition(end);
+}
+
+// Write the header. The java layer will look for the marker.
+bool Metadata::appendHeader()
+{
+ bool ok = true;
+
+ // Placeholder for the length of the metadata
+ ok = ok && mData->writeInt32(-1) == OK;
+ ok = ok && mData->writeInt32(kMetaMarker) == OK;
+ return ok;
+}
+
+bool Metadata::appendBool(int key, bool val)
+{
+ if (!checkKey(key)) {
+ return false;
+ }
+
+ const size_t begin = mData->dataPosition();
+ bool ok = true;
+
+ // 4 int32s: size, key, type, value.
+ ok = ok && mData->writeInt32(4 * sizeof(int32_t)) == OK;
+ ok = ok && mData->writeInt32(key) == OK;
+ ok = ok && mData->writeInt32(BOOLEAN_VAL) == OK;
+ ok = ok && mData->writeInt32(val ? 1 : 0) == OK;
+ if (!ok) {
+ mData->setDataPosition(begin);
+ }
+ return ok;
+}
+
+bool Metadata::appendInt32(int key, int32_t val)
+{
+ if (!checkKey(key)) {
+ return false;
+ }
+
+ const size_t begin = mData->dataPosition();
+ bool ok = true;
+
+ // 4 int32s: size, key, type, value.
+ ok = ok && mData->writeInt32(4 * sizeof(int32_t)) == OK;
+ ok = ok && mData->writeInt32(key) == OK;
+ ok = ok && mData->writeInt32(INTEGER_VAL) == OK;
+ ok = ok && mData->writeInt32(val) == OK;
+ if (!ok) {
+ mData->setDataPosition(begin);
+ }
+ return ok;
+}
+
+// Check the key (i.e metadata id) is valid if it is a system one.
+// Loop over all the exiting ones in the Parcel to check for duplicate
+// (not allowed).
+bool Metadata::checkKey(int key)
+{
+ if (key < FIRST_SYSTEM_ID ||
+ (LAST_SYSTEM_ID < key && key < FIRST_CUSTOM_ID)) {
+ LOGE("Bad key %d", key);
+ return false;
+ }
+ size_t curr = mData->dataPosition();
+ // Loop over the keys to check if it has been used already.
+ mData->setDataPosition(mBegin);
+
+ bool error = false;
+ size_t left = curr - mBegin;
+ while (left > 0) {
+ size_t pos = mData->dataPosition();
+ size_t size = mData->readInt32();
+ if (size < kRecordHeaderSize || size > left) {
+ error = true;
+ break;
+ }
+ if (mData->readInt32() == key) {
+ LOGE("Key exists already %d", key);
+ error = true;
+ break;
+ }
+ mData->setDataPosition(pos + size);
+ left -= size;
+ }
+ mData->setDataPosition(curr);
+ return !error;
+}
+
+} // namespace android::media
+} // namespace android
diff --git a/media/libmediaplayerservice/MediaPlayerService.cpp b/media/libmediaplayerservice/MediaPlayerService.cpp
index 5e62f9d..77f7434 100644
--- a/media/libmediaplayerservice/MediaPlayerService.cpp
+++ b/media/libmediaplayerservice/MediaPlayerService.cpp
@@ -47,10 +47,9 @@
#include <media/MediaPlayerInterface.h>
#include <media/mediarecorder.h>
#include <media/MediaMetadataRetrieverInterface.h>
+#include <media/Metadata.h>
#include <media/AudioTrack.h>
-#include <utils/SortedVector.h>
-
#include "MediaRecorderClient.h"
#include "MediaPlayerService.h"
#include "MetadataRetrieverClient.h"
@@ -85,21 +84,17 @@
#endif
namespace {
+using android::media::Metadata;
using android::status_t;
using android::OK;
using android::BAD_VALUE;
using android::NOT_ENOUGH_DATA;
-using android::MetadataType;
using android::Parcel;
-using android::SortedVector;
// Max number of entries in the filter.
const int kMaxFilterSize = 64; // I pulled that out of thin air.
-// Keep in sync with ANY in Metadata.java
-const int32_t kAny = 0;
-
-const int32_t kMetaMarker = 0x4d455441; // 'M' 'E' 'T' 'A'
+// FIXME: Move all the metadata related function in the Metadata.cpp
// Unmarshall a filter from a Parcel.
@@ -124,7 +119,7 @@
// @param[out] status On exit contains the status code to be returned.
// @return true if the parcel starts with a valid filter.
bool unmarshallFilter(const Parcel& p,
- SortedVector<MetadataType> *filter,
+ Metadata::Filter *filter,
status_t *status)
{
int32_t val;
@@ -147,7 +142,7 @@
filter->clear();
filter->setCapacity(num);
- size_t size = num * sizeof(MetadataType);
+ size_t size = num * sizeof(Metadata::Type);
if (p.dataAvail() < size)
@@ -157,7 +152,8 @@
return false;
}
- const MetadataType *data = static_cast<const MetadataType*>(p.readInplace(size));
+ const Metadata::Type *data =
+ static_cast<const Metadata::Type*>(p.readInplace(size));
if (NULL == data)
{
@@ -181,11 +177,11 @@
// @param filter Of metadata type.
// @param val To be searched.
// @return true if a match was found.
-bool findMetadata(const SortedVector<MetadataType>& filter, const int32_t val)
+bool findMetadata(const Metadata::Filter& filter, const int32_t val)
{
// Deal with empty and ANY right away
if (filter.isEmpty()) return false;
- if (filter[0] == kAny) return true;
+ if (filter[0] == Metadata::kAny) return true;
return filter.indexOf(val) >= 0;
}
@@ -857,7 +853,7 @@
status_t MediaPlayerService::Client::setMetadataFilter(const Parcel& filter)
{
status_t status;
- SortedVector<MetadataType> allow, drop;
+ media::Metadata::Filter allow, drop;
if (unmarshallFilter(filter, &allow, &status) &&
unmarshallFilter(filter, &drop, &status)) {
@@ -872,14 +868,14 @@
status_t MediaPlayerService::Client::getMetadata(
bool update_only, bool apply_filter, Parcel *reply)
{
- sp<MediaPlayerBase> p = getPlayer();
- if (p == 0) return UNKNOWN_ERROR;
+ sp<MediaPlayerBase> player = getPlayer();
+ if (player == 0) return UNKNOWN_ERROR;
status_t status;
// Placeholder for the return code, updated by the caller.
reply->writeInt32(-1);
- SortedVector<MetadataType> ids;
+ media::Metadata::Filter ids;
// We don't block notifications while we fetch the data. We clear
// mMetadataUpdated first so we don't lose notifications happening
@@ -892,14 +888,13 @@
mMetadataUpdated.clear();
}
- const size_t begin = reply->dataPosition();
- reply->writeInt32(-1); // Placeholder for the length of the metadata
- reply->writeInt32(kMetaMarker);
+ media::Metadata metadata(reply);
- status = p->getMetadata(ids, reply);
+ metadata.appendHeader();
+ status = player->getMetadata(ids, reply);
if (status != OK) {
- reply->setDataPosition(begin);
+ metadata.resetParcel();
LOGE("getMetadata failed %d", status);
return status;
}
@@ -908,12 +903,8 @@
// filtering takes place on the update notifications already. This
// would be when all the metadata are fetch and a filter is set.
- const size_t end = reply->dataPosition();
-
// Everything is fine, update the metadata length.
- reply->setDataPosition(begin);
- reply->writeInt32(end - begin);
- reply->setDataPosition(end);
+ metadata.updateLength();
return OK;
}
@@ -1043,7 +1034,7 @@
if (MEDIA_INFO == msg &&
MEDIA_INFO_METADATA_UPDATE == ext1) {
- const MetadataType metadata_type = ext2;
+ const media::Metadata::Type metadata_type = ext2;
if(client->shouldDropMetadata(metadata_type)) {
return;
@@ -1058,7 +1049,7 @@
}
-bool MediaPlayerService::Client::shouldDropMetadata(MetadataType code) const
+bool MediaPlayerService::Client::shouldDropMetadata(media::Metadata::Type code) const
{
Mutex::Autolock lock(mLock);
@@ -1074,7 +1065,7 @@
}
-void MediaPlayerService::Client::addNewMetadataUpdate(MetadataType metadata_type) {
+void MediaPlayerService::Client::addNewMetadataUpdate(media::Metadata::Type metadata_type) {
Mutex::Autolock lock(mLock);
if (mMetadataUpdated.indexOf(metadata_type) < 0) {
mMetadataUpdated.add(metadata_type);
@@ -1499,4 +1490,4 @@
p->mSignal.signal();
}
-}; // namespace android
+} // namespace android
diff --git a/media/libmediaplayerservice/MediaPlayerService.h b/media/libmediaplayerservice/MediaPlayerService.h
index 94cb917..a4be414 100644
--- a/media/libmediaplayerservice/MediaPlayerService.h
+++ b/media/libmediaplayerservice/MediaPlayerService.h
@@ -23,15 +23,14 @@
#include <utils/List.h>
#include <utils/Errors.h>
#include <utils/KeyedVector.h>
-#include <utils/SortedVector.h>
#include <utils/Vector.h>
#include <ui/SurfaceComposerClient.h>
#include <media/IMediaPlayerService.h>
#include <media/MediaPlayerInterface.h>
+#include <media/Metadata.h>
namespace android {
-typedef int32_t MetadataType;
class IMediaRecorder;
class IMediaMetadataRetriever;
@@ -239,12 +238,12 @@
// @param type Of the metadata to be tested.
// @return true if the metadata should be dropped according to
// the filters.
- bool shouldDropMetadata(MetadataType type) const;
+ bool shouldDropMetadata(media::Metadata::Type type) const;
// Add a new element to the set of metadata updated. Noop if
// the element exists already.
// @param type Of the metadata to be recorded.
- void addNewMetadataUpdate(MetadataType type);
+ void addNewMetadataUpdate(media::Metadata::Type type);
mutable Mutex mLock;
sp<MediaPlayerBase> mPlayer;
@@ -257,14 +256,14 @@
int32_t mConnId;
// Metadata filters.
- SortedVector<int32_t> mMetadataAllow; // protected by mLock
- SortedVector<int32_t> mMetadataDrop; // protected by mLock
+ media::Metadata::Filter mMetadataAllow; // protected by mLock
+ media::Metadata::Filter mMetadataDrop; // protected by mLock
// Metadata updated. For each MEDIA_INFO_METADATA_UPDATE
// notification we try to update mMetadataUpdated which is a
// set: no duplicate.
// getMetadata clears this set.
- SortedVector<int32_t> mMetadataUpdated; // protected by mLock
+ media::Metadata::Filter mMetadataUpdated; // protected by mLock
#if CALLBACK_ANTAGONIZER
Antagonizer* mAntagonizer;
diff --git a/media/libmediaplayerservice/MidiFile.h b/media/libmediaplayerservice/MidiFile.h
index 30b6a2e..25d4a1b 100644
--- a/media/libmediaplayerservice/MidiFile.h
+++ b/media/libmediaplayerservice/MidiFile.h
@@ -49,10 +49,6 @@
virtual status_t invoke(const Parcel& request, Parcel *reply) {
return INVALID_OPERATION;
}
- virtual status_t getMetadata(const SortedVector<MetadataType>& ids,
- Parcel *records) {
- return INVALID_OPERATION;
- }
private:
status_t createOutputTrack();
diff --git a/media/libmediaplayerservice/StagefrightPlayer.cpp b/media/libmediaplayerservice/StagefrightPlayer.cpp
index 8597275..9a06d13 100644
--- a/media/libmediaplayerservice/StagefrightPlayer.cpp
+++ b/media/libmediaplayerservice/StagefrightPlayer.cpp
@@ -144,7 +144,7 @@
if (mPlayer == NULL) {
return NO_INIT;
}
-
+
status_t err = mPlayer->seekTo((int64_t)msec * 1000);
sendEvent(MEDIA_SEEK_COMPLETE);
@@ -205,9 +205,4 @@
}
}
-status_t StagefrightPlayer::getMetadata(
- const SortedVector<MetadataType> &ids, Parcel *records) {
- return INVALID_OPERATION;
-}
-
} // namespace android
diff --git a/media/libmediaplayerservice/StagefrightPlayer.h b/media/libmediaplayerservice/StagefrightPlayer.h
index f93c1f8..f214872c 100644
--- a/media/libmediaplayerservice/StagefrightPlayer.h
+++ b/media/libmediaplayerservice/StagefrightPlayer.h
@@ -48,9 +48,6 @@
virtual status_t invoke(const Parcel &request, Parcel *reply);
virtual void setAudioSink(const sp<AudioSink> &audioSink);
- virtual status_t getMetadata(
- const SortedVector<MetadataType> &ids, Parcel *records);
-
private:
MediaPlayerImpl *mPlayer;
diff --git a/media/libmediaplayerservice/TestPlayerStub.h b/media/libmediaplayerservice/TestPlayerStub.h
index 339b108..80d53a8 100644
--- a/media/libmediaplayerservice/TestPlayerStub.h
+++ b/media/libmediaplayerservice/TestPlayerStub.h
@@ -94,10 +94,6 @@
virtual status_t invoke(const android::Parcel& in, android::Parcel *out) {
return mPlayer->invoke(in, out);
}
- virtual status_t getMetadata(const SortedVector<MetadataType>& ids,
- Parcel *records) {
- return INVALID_OPERATION;
- }
// @return true if the current build is 'eng' or 'test' and the
diff --git a/media/libmediaplayerservice/VorbisPlayer.h b/media/libmediaplayerservice/VorbisPlayer.h
index 040eb36..4024654 100644
--- a/media/libmediaplayerservice/VorbisPlayer.h
+++ b/media/libmediaplayerservice/VorbisPlayer.h
@@ -54,10 +54,6 @@
virtual status_t setLooping(int loop);
virtual player_type playerType() { return VORBIS_PLAYER; }
virtual status_t invoke(const Parcel& request, Parcel *reply) {return INVALID_OPERATION;}
- virtual status_t getMetadata(const SortedVector<MetadataType>& ids,
- Parcel *records) {
- return INVALID_OPERATION;
- }
private:
status_t setdatasource(const char *path, int fd, int64_t offset, int64_t length);
diff --git a/media/tests/players/invoke_mock_media_player.cpp b/media/tests/players/invoke_mock_media_player.cpp
index 8d575a3..77bb5b2 100644
--- a/media/tests/players/invoke_mock_media_player.cpp
+++ b/media/tests/players/invoke_mock_media_player.cpp
@@ -27,7 +27,6 @@
using android::INVALID_OPERATION;
using android::ISurface;
using android::MediaPlayerBase;
-using android::MetadataType;
using android::OK;
using android::Parcel;
using android::SortedVector;
@@ -78,8 +77,6 @@
virtual status_t setLooping(int loop) {return OK;}
virtual player_type playerType() {return TEST_PLAYER;}
virtual status_t invoke(const Parcel& request, Parcel *reply);
- virtual status_t getMetadata(const SortedVector<MetadataType>& ids,
- Parcel *records) {return INVALID_OPERATION;}
private:
// Take a request, copy it to the reply.
diff --git a/opengl/java/android/opengl/Version.java b/opengl/java/android/opengl/Version.java
new file mode 100644
index 0000000..6e89d7e
--- /dev/null
+++ b/opengl/java/android/opengl/Version.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2009 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.
+ */
+
+package android.opengl;
+
+import android.os.SystemProperties;
+
+public final class Version {
+ /**
+ * Return the highest OpenGL ES API level supported by the current device.
+ * <p>
+ * A device that supports a given API level must also support
+ * numerically smaller API levels.
+ * <p>
+ * A device that supports a given API level may not necessarily
+ * support every feature of that API level. API-specific techniques may
+ * be used to determine whether specific features are supported.
+ *
+ * @return the highest OpenGL ES API level supported by the current device.
+ */
+ public static int getOpenGLESVersion() {
+ return SystemProperties.getInt("ro.opengles.version", OPENGLES_11);
+ }
+
+ /**
+ * The version number for OpenGL ES 1.1.
+ */
+ public final static int OPENGLES_11 = 11;
+
+ /**
+ * The version number for OpenGL ES 2.0.
+ */
+ public final static int OPENGLES_20 = 20;
+}
diff --git a/services/java/com/android/server/PackageManagerService.java b/services/java/com/android/server/PackageManagerService.java
index 9c60157..d6cd4ef 100644
--- a/services/java/com/android/server/PackageManagerService.java
+++ b/services/java/com/android/server/PackageManagerService.java
@@ -4905,26 +4905,40 @@
if (ps.pkg != null) {
pw.print(" dataDir="); pw.println(ps.pkg.applicationInfo.dataDir);
pw.print(" targetSdk="); pw.println(ps.pkg.applicationInfo.targetSdkVersion);
- pw.print(" densities="); pw.println(ps.pkg.supportsDensityList);
- ArrayList<String> screens = new ArrayList<String>();
+ pw.print(" supportsScreens=[");
+ boolean first = true;
if ((ps.pkg.applicationInfo.flags &
ApplicationInfo.FLAG_SUPPORTS_NORMAL_SCREENS) != 0) {
- screens.add("medium");
+ if (!first) pw.print(", ");
+ first = false;
+ pw.print("medium");
}
if ((ps.pkg.applicationInfo.flags &
ApplicationInfo.FLAG_SUPPORTS_LARGE_SCREENS) != 0) {
- screens.add("large");
+ if (!first) pw.print(", ");
+ first = false;
+ pw.print("large");
}
if ((ps.pkg.applicationInfo.flags &
ApplicationInfo.FLAG_SUPPORTS_SMALL_SCREENS) != 0) {
- screens.add("small,");
+ if (!first) pw.print(", ");
+ first = false;
+ pw.print("small");
}
if ((ps.pkg.applicationInfo.flags &
ApplicationInfo.FLAG_RESIZEABLE_FOR_SCREENS) != 0) {
- screens.add("resizeable,");
+ if (!first) pw.print(", ");
+ first = false;
+ pw.print("resizeable");
}
- pw.print(" supportsScreens="); pw.println(screens);
+ if ((ps.pkg.applicationInfo.flags &
+ ApplicationInfo.FLAG_SUPPORTS_SCREEN_DENSITIES) != 0) {
+ if (!first) pw.print(", ");
+ first = false;
+ pw.print("anyDensity");
+ }
}
+ pw.println("]");
pw.print(" timeStamp="); pw.println(ps.getTimeStampStr());
pw.print(" signatures="); pw.println(ps.signatures);
pw.print(" permissionsFixed="); pw.print(ps.permissionsFixed);
diff --git a/services/java/com/android/server/WifiService.java b/services/java/com/android/server/WifiService.java
index 67e8cf3..f25c221 100644
--- a/services/java/com/android/server/WifiService.java
+++ b/services/java/com/android/server/WifiService.java
@@ -888,6 +888,17 @@
break setVariables;
}
+ if ((config.phase2 != null) && !WifiNative.setNetworkVariableCommand(
+ netId,
+ WifiConfiguration.phase2VarName,
+ config.phase2)) {
+ if (DBG) {
+ Log.d(TAG, config.SSID + ": failed to set phase2: "+
+ config.phase2);
+ }
+ break setVariables;
+ }
+
if ((config.identity != null) && !WifiNative.setNetworkVariableCommand(
netId,
WifiConfiguration.identityVarName,
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index e1ca201..7d4a2c2 100644
--- a/services/java/com/android/server/am/ActivityManagerService.java
+++ b/services/java/com/android/server/am/ActivityManagerService.java
@@ -184,8 +184,7 @@
static final int LOG_BOOT_PROGRESS_ENABLE_SCREEN = 3050;
// The flags that are set for all calls we make to the package manager.
- static final int STOCK_PM_FLAGS = PackageManager.GET_SHARED_LIBRARY_FILES
- | PackageManager.GET_SUPPORTS_DENSITIES;
+ static final int STOCK_PM_FLAGS = PackageManager.GET_SHARED_LIBRARY_FILES;
private static final String SYSTEM_SECURE = "ro.secure";
diff --git a/tests/CoreTests/android/AndroidManifest.xml b/tests/CoreTests/android/AndroidManifest.xml
index 4809f844..98cc9e5 100644
--- a/tests/CoreTests/android/AndroidManifest.xml
+++ b/tests/CoreTests/android/AndroidManifest.xml
@@ -30,6 +30,7 @@
<uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION"/>
<uses-permission android:name="android.permission.WRITE_SETTINGS"/>
<uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS"/>
+ <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<application>
<uses-library android:name="android.test.runner" />
diff --git a/tests/CoreTests/android/database/MatrixCursorTest.java b/tests/CoreTests/android/database/MatrixCursorTest.java
index fb8a12f..cddc6c4 100644
--- a/tests/CoreTests/android/database/MatrixCursorTest.java
+++ b/tests/CoreTests/android/database/MatrixCursorTest.java
@@ -32,6 +32,12 @@
cursor.newRow().add(null);
cursor.moveToNext();
assertTrue(cursor.isNull(0));
+ assertNull(cursor.getString(0));
+ assertEquals(0, cursor.getShort(0));
+ assertEquals(0, cursor.getInt(0));
+ assertEquals(0L, cursor.getLong(0));
+ assertEquals(0.0f, cursor.getFloat(0));
+ assertEquals(0.0d, cursor.getDouble(0));
}
public void testMatrixCursor() {
diff --git a/tests/DpiTest/src/com/google/android/test/dpi/DpiTestActivity.java b/tests/DpiTest/src/com/google/android/test/dpi/DpiTestActivity.java
index 49fff57..dd4fae3 100644
--- a/tests/DpiTest/src/com/google/android/test/dpi/DpiTestActivity.java
+++ b/tests/DpiTest/src/com/google/android/test/dpi/DpiTestActivity.java
@@ -52,14 +52,13 @@
// be doing it.
Application app = ActivityThread.currentActivityThread().getApplication();
ApplicationInfo ai = app.getPackageManager().getApplicationInfo(
- "com.google.android.test.dpi",
- PackageManager.GET_SUPPORTS_DENSITIES);
+ "com.google.android.test.dpi", 0);
if (noCompat) {
ai.flags |= ApplicationInfo.FLAG_SUPPORTS_LARGE_SCREENS
| ApplicationInfo.FLAG_SUPPORTS_NORMAL_SCREENS
| ApplicationInfo.FLAG_SUPPORTS_SMALL_SCREENS
- | ApplicationInfo.FLAG_RESIZEABLE_FOR_SCREENS;
- ai.supportsDensities = new int[] { ApplicationInfo.ANY_DENSITY };
+ | ApplicationInfo.FLAG_RESIZEABLE_FOR_SCREENS
+ | ApplicationInfo.FLAG_SUPPORTS_SCREEN_DENSITIES;
app.getResources().setCompatibilityInfo(new CompatibilityInfo(ai));
}
} catch (PackageManager.NameNotFoundException e) {
diff --git a/wifi/java/android/net/wifi/WifiConfiguration.java b/wifi/java/android/net/wifi/WifiConfiguration.java
index eda2f2d..f85aadd 100644
--- a/wifi/java/android/net/wifi/WifiConfiguration.java
+++ b/wifi/java/android/net/wifi/WifiConfiguration.java
@@ -45,6 +45,8 @@
/** {@hide} */
public static final String eapVarName = "eap";
/** {@hide} */
+ public static final String phase2VarName = "phase2";
+ /** {@hide} */
public static final String identityVarName = "identity";
/** {@hide} */
public static final String anonymousIdentityVarName = "anonymous_identity";
@@ -273,6 +275,11 @@
*/
public String eap;
/**
+ * The phase2 authenication could be PAP, MSCHAP, MSCHAP2, GTC.
+ * {@hide}
+ */
+ public String phase2;
+ /**
* The identity of the user in string,
* which is used for the authentication.
* {@hide}
@@ -314,6 +321,7 @@
for (int i = 0; i < wepKeys.length; i++)
wepKeys[i] = null;
eap = null;
+ phase2 = null;
identity = null;
anonymousIdentity = null;
password = null;
@@ -399,6 +407,10 @@
if (this.eap != null) {
sbuf.append(eap);
}
+ sbuf.append('\n').append(" phase2: ");
+ if (this.phase2 != null) {
+ sbuf.append(phase2);
+ }
sbuf.append('\n').append(" Identity: ");
if (this.identity != null) {
sbuf.append(identity);
@@ -486,6 +498,7 @@
writeBitSet(dest, allowedPairwiseCiphers);
writeBitSet(dest, allowedGroupCiphers);
dest.writeString(eap);
+ dest.writeString(phase2);
dest.writeString(identity);
dest.writeString(anonymousIdentity);
dest.writeString(password);
@@ -516,6 +529,7 @@
config.allowedPairwiseCiphers = readBitSet(in);
config.allowedGroupCiphers = readBitSet(in);
config.eap = in.readString();
+ config.phase2 = in.readString();
config.identity = in.readString();
config.anonymousIdentity = in.readString();
config.password = in.readString();