Merge change 8263 into donut
* changes:
Make the date formats as close as possible to what the translators wanted.
diff --git a/api/current.xml b/api/current.xml
index 0e04f50..46969e0 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -2231,6 +2231,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"
@@ -3078,17 +3089,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"
@@ -35540,6 +35540,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"
@@ -35695,17 +35706,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"
@@ -37604,17 +37604,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"
diff --git a/core/java/android/app/SearchDialog.java b/core/java/android/app/SearchDialog.java
index 27c6376..26b5b7a 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;
@@ -537,6 +541,8 @@
mSearchAutoComplete.setDropDownAlwaysVisible(false);
}
+ mSearchAutoComplete.setForceIgnoreOutsideTouch(true);
+
// attach the suggestions adapter, if suggestions are available
// The existence of a suggestions authority is the proxy for "suggestions available here"
if (mSearchable.getSuggestAuthority() != null) {
@@ -1093,7 +1099,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 +1252,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 +1578,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 941ca9e..67bd1ac 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/provider/Settings.java b/core/java/android/provider/Settings.java
index b5440f2..9a9ddc9 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -2917,6 +2917,13 @@
public static final String VENDING_TOS_URL = "vending_tos_url";
/**
+ * URL to navigate to in browser (not Market) when the terms of service
+ * for Vending Machine could not be accessed due to bad network
+ * connection.
+ */
+ public static final String VENDING_TOS_MISSING_URL = "vending_tos_missing_url";
+
+ /**
* Whether to use sierraqa instead of sierra tokens for the purchase flow in
* Vending Machine.
*
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 95bba97..c73d29e 100644
--- a/core/java/android/view/SurfaceView.java
+++ b/core/java/android/view/SurfaceView.java
@@ -140,7 +140,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);
@@ -254,18 +261,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);
}
}
@@ -291,8 +301,6 @@
mWindowType = type;
}
- boolean mScaled = false;
-
private void updateWindow(boolean force) {
if (!mHaveFrame) {
return;
@@ -301,7 +309,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());
@@ -312,14 +320,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);
@@ -641,7 +650,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);
}
@@ -667,7 +678,7 @@
}
public void unlockCanvasAndPost(Canvas canvas) {
- if (mScaled) {
+ if (mCanvasScaled) {
canvas.restoreToCount(mSaveCount);
}
mSurface.unlockCanvasAndPost(canvas);
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 4bc00de..6848a55 100644
--- a/core/java/android/widget/AutoCompleteTextView.java
+++ b/core/java/android/widget/AutoCompleteTextView.java
@@ -116,6 +116,8 @@
private boolean mDropDownAlwaysVisible = false;
private boolean mDropDownDismissedOnCompletion = true;
+
+ private boolean mForceIgnoreOutsideTouch = false;
private int mLastKeyCode = KeyEvent.KEYCODE_UNKNOWN;
private boolean mOpenBefore;
@@ -205,11 +207,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();
}
}
@@ -1143,6 +1144,8 @@
heightSpec = mDropDownHeight;
}
+ mPopup.setOutsideTouchable(mForceIgnoreOutsideTouch ? false : !mDropDownAlwaysVisible);
+
mPopup.update(getDropDownAnchorView(), mDropDownHorizontalOffset,
mDropDownVerticalOffset, widthSpec, heightSpec);
} else {
@@ -1171,7 +1174,7 @@
// use outside touchable to dismiss drop down when touching outside of it, so
// only set this if the dropdown is not always visible
- mPopup.setOutsideTouchable(!mDropDownAlwaysVisible);
+ mPopup.setOutsideTouchable(mForceIgnoreOutsideTouch ? false : !mDropDownAlwaysVisible);
mPopup.setTouchInterceptor(new PopupTouchIntercepter());
mPopup.showAsDropDown(getDropDownAnchorView(),
mDropDownHorizontalOffset, mDropDownVerticalOffset);
@@ -1180,6 +1183,17 @@
post(mHideSelector);
}
}
+
+ /**
+ * Forces outside touches to be ignored. Normally if {@link #isDropDownAlwaysVisible()} is
+ * false, we allow outside touch to dismiss the dropdown. If this is set to true, then we
+ * ignore outside touch even when the drop down is not set to always visible.
+ *
+ * @hide used only by SearchDialog
+ */
+ public void setForceIgnoreOutsideTouch(boolean forceIgnoreOutsideTouch) {
+ mForceIgnoreOutsideTouch = forceIgnoreOutsideTouch;
+ }
/**
* <p>Builds the popup window's content and returns the height the popup
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 919c3d6..6a6b7fc 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/data/sounds/AudioPackage2.mk b/data/sounds/AudioPackage2.mk
index 649787e..5dacc70 100644
--- a/data/sounds/AudioPackage2.mk
+++ b/data/sounds/AudioPackage2.mk
@@ -23,7 +23,6 @@
$(LOCAL_PATH)/Ring_Digital_02.ogg:system/media/audio/ringtones/Ring_Digital_02.ogg \
$(LOCAL_PATH)/Ring_Synth_04.ogg:system/media/audio/ringtones/Ring_Synth_04.ogg \
$(LOCAL_PATH)/Ring_Synth_02.ogg:system/media/audio/ringtones/Ring_Synth_02.ogg \
- $(LOCAL_PATH)/Silence.ogg:system/media/audio/ringtones/notifications/Silence.ogg \
$(LOCAL_PATH)/newwavelabs/BeatPlucker.ogg:system/media/audio/ringtones/BeatPlucker.ogg \
$(LOCAL_PATH)/newwavelabs/BentleyDubs.ogg:system/media/audio/ringtones/BentleyDubs.ogg \
$(LOCAL_PATH)/newwavelabs/BirdLoop.ogg:system/media/audio/ringtones/BirdLoop.ogg \
diff --git a/data/sounds/OriginalAudio.mk b/data/sounds/OriginalAudio.mk
index fc1e921..291f0b6 100644
--- a/data/sounds/OriginalAudio.mk
+++ b/data/sounds/OriginalAudio.mk
@@ -22,7 +22,6 @@
$(LOCAL_PATH)/Ring_Digital_02.ogg:system/media/audio/ringtones/Ring_Digital_02.ogg \
$(LOCAL_PATH)/Ring_Synth_04.ogg:system/media/audio/ringtones/Ring_Synth_04.ogg \
$(LOCAL_PATH)/Ring_Synth_02.ogg:system/media/audio/ringtones/Ring_Synth_02.ogg \
- $(LOCAL_PATH)/Silence.ogg:system/media/audio/ringtones/notifications/Silence.ogg \
$(LOCAL_PATH)/newwavelabs/BeatPlucker.ogg:system/media/audio/ringtones/BeatPlucker.ogg \
$(LOCAL_PATH)/newwavelabs/BentleyDubs.ogg:system/media/audio/ringtones/BentleyDubs.ogg \
$(LOCAL_PATH)/newwavelabs/BirdLoop.ogg:system/media/audio/ringtones/BirdLoop.ogg \
diff --git a/data/sounds/Silence.ogg b/data/sounds/Silence.ogg
deleted file mode 100644
index 6d78907..0000000
--- a/data/sounds/Silence.ogg
+++ /dev/null
Binary files differ
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/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/services/java/com/android/server/NotificationManagerService.java b/services/java/com/android/server/NotificationManagerService.java
index 38fb7c9..aac7124 100644
--- a/services/java/com/android/server/NotificationManagerService.java
+++ b/services/java/com/android/server/NotificationManagerService.java
@@ -90,7 +90,7 @@
private NotificationRecord mSoundNotification;
private AsyncPlayer mSound;
private boolean mSystemReady;
- private int mDisabledNotifications = StatusBarManager.DISABLE_NOTIFICATION_ALERTS;
+ private int mDisabledNotifications;
private NotificationRecord mVibrateNotification;
private Vibrator mVibrator = new Vibrator();
@@ -368,6 +368,15 @@
mStatusBarService = statusBar;
statusBar.setNotificationCallbacks(mNotificationCallbacks);
+ // Don't start allowing notifications until the setup wizard has run once.
+ // After that, including subsequent boots, init with notifications turned on.
+ // This works on the first boot because the setup wizard will toggle this
+ // flag at least once and we'll go back to 0 after that.
+ if (0 == Settings.Secure.getInt(mContext.getContentResolver(),
+ Settings.Secure.DEVICE_PROVISIONED, 0)) {
+ mDisabledNotifications = StatusBarManager.DISABLE_NOTIFICATION_ALERTS;
+ }
+
// register for battery changed notifications
IntentFilter filter = new IntentFilter();
filter.addAction(Intent.ACTION_BATTERY_CHANGED);
@@ -1049,6 +1058,8 @@
pw.println(" mSoundNotification=" + mSoundNotification);
pw.println(" mSound=" + mSound);
pw.println(" mVibrateNotification=" + mVibrateNotification);
+ pw.println(" mDisabledNotifications=0x" + Integer.toHexString(mDisabledNotifications));
+ pw.println(" mSystemReady=" + mSystemReady);
}
}
}
diff --git a/services/java/com/android/server/PackageManagerService.java b/services/java/com/android/server/PackageManagerService.java
index ee53274..4afa03e 100644
--- a/services/java/com/android/server/PackageManagerService.java
+++ b/services/java/com/android/server/PackageManagerService.java
@@ -4902,26 +4902,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/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index d9c40ec..81a715d 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";
@@ -724,6 +723,11 @@
Configuration mConfiguration = new Configuration();
/**
+ * Hardware-reported OpenGLES version.
+ */
+ final int GL_ES_VERSION;
+
+ /**
* List of initialization arguments to pass to all processes when binding applications to them.
* For example, references to the commonly used services.
*/
@@ -1396,6 +1400,9 @@
mUsageStatsService = new UsageStatsService( new File(
systemDir, "usagestats").toString());
+ GL_ES_VERSION = SystemProperties.getInt("ro.opengles.version",
+ ConfigurationInfo.GL_ES_VERSION_UNDEFINED);
+
mConfiguration.makeDefault();
mProcessStats.init();
@@ -11847,6 +11854,7 @@
&& mConfiguration.keyboard != Configuration.KEYBOARD_NOKEYS) {
config.reqInputFeatures |= ConfigurationInfo.INPUT_FEATURE_HARD_KEYBOARD;
}
+ config.reqGlEsVersion = GL_ES_VERSION;
}
return config;
}
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/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/BridgeTypedArray.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/BridgeTypedArray.java
index 48998db..10421de 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/BridgeTypedArray.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/BridgeTypedArray.java
@@ -39,7 +39,7 @@
* TODO: describe.
*/
public final class BridgeTypedArray extends TypedArray {
-
+
@SuppressWarnings("hiding")
private BridgeResources mResources;
private BridgeContext mContext;
@@ -47,7 +47,7 @@
private IResourceValue[] mData;
private String[] mNames;
private final boolean mPlatformFile;
-
+
public BridgeTypedArray(BridgeResources resources, BridgeContext context, int len,
boolean platformFile) {
super(null, null, null, 0);
@@ -58,12 +58,12 @@
mNames = new String[len];
}
- /** A bridge-specific method that sets a value in the type array */
+ /** A bridge-specific method that sets a value in the type array */
public void bridgeSetValue(int index, String name, IResourceValue value) {
mData[index] = value;
mNames[index] = name;
}
-
+
/**
* Seals the array after all calls to {@link #bridgeSetValue(int, String, IResourceValue)} have
* been done.
@@ -79,11 +79,11 @@
count++;
}
}
-
+
// allocate the table with an extra to store the size
mIndices = new int[count+1];
mIndices[0] = count;
-
+
// fill the array with the indices.
int index = 1;
for (int i = 0 ; i < mData.length ; i++) {
@@ -100,7 +100,7 @@
public int length() {
return mData.length;
}
-
+
/**
* Return the Resources object this array was loaded from.
*/
@@ -108,13 +108,13 @@
public Resources getResources() {
return mResources;
}
-
+
/**
* Retrieve the styled string value for the attribute at <var>index</var>.
- *
+ *
* @param index Index of attribute to retrieve.
- *
- * @return CharSequence holding string data. May be styled. Returns
+ *
+ * @return CharSequence holding string data. May be styled. Returns
* null if the attribute is not defined.
*/
@Override
@@ -129,9 +129,9 @@
/**
* Retrieve the string value for the attribute at <var>index</var>.
- *
+ *
* @param index Index of attribute to retrieve.
- *
+ *
* @return String holding string data. Any styling information is
* removed. Returns null if the attribute is not defined.
*/
@@ -140,16 +140,16 @@
if (mData[index] != null) {
return mData[index].getValue();
}
-
+
return null;
}
/**
* Retrieve the boolean value for the attribute at <var>index</var>.
- *
+ *
* @param index Index of attribute to retrieve.
* @param defValue Value to return if the attribute is not defined.
- *
+ *
* @return Attribute boolean value, or defValue if not defined.
*/
@Override
@@ -162,16 +162,16 @@
if (s != null) {
return XmlUtils.convertValueToBoolean(s, defValue);
}
-
+
return defValue;
}
/**
* Retrieve the integer value for the attribute at <var>index</var>.
- *
+ *
* @param index Index of attribute to retrieve.
* @param defValue Value to return if the attribute is not defined.
- *
+ *
* @return Attribute int value, or defValue if not defined.
*/
@Override
@@ -181,7 +181,7 @@
}
String s = mData[index].getValue();
-
+
try {
return (s == null) ? defValue : XmlUtils.convertValueToInt(s, defValue);
} catch (NumberFormatException e) {
@@ -192,11 +192,11 @@
// Check for possible constants and try to find them.
// Get the map of attribute-constant -> IntegerValue
Map<String, Integer> map = Bridge.getEnumValues(mNames[index]);
-
+
if (map != null) {
// accumulator to store the value of the 1+ constants.
int result = 0;
-
+
// split the value in case this is a mix of several flags.
String[] keywords = s.split("\\|");
for (String keyword : keywords) {
@@ -217,9 +217,9 @@
/**
* Retrieve the float value for the attribute at <var>index</var>.
- *
+ *
* @param index Index of attribute to retrieve.
- *
+ *
* @return Attribute float value, or defValue if not defined..
*/
@Override
@@ -237,23 +237,23 @@
mContext.getLogger().warning(String.format(
"Unable to convert \"%s\" into a float in attribute \"%2$s\"",
s, mNames[index]));
-
+
// we'll return the default value below.
}
}
return defValue;
}
-
+
/**
* Retrieve the color value for the attribute at <var>index</var>. If
* the attribute references a color resource holding a complex
* {@link android.content.res.ColorStateList}, then the default color from
* the set is returned.
- *
+ *
* @param index Index of attribute to retrieve.
* @param defValue Value to return if the attribute is not defined or
* not a resource.
- *
+ *
* @return Attribute color value, or defValue if not defined.
*/
@Override
@@ -261,7 +261,7 @@
if (mData[index] == null) {
return defValue;
}
-
+
String s = mData[index].getValue();
try {
return ResourceHelper.getColor(s);
@@ -280,9 +280,9 @@
* Retrieve the ColorStateList for the attribute at <var>index</var>.
* The value may be either a single solid color or a reference to
* a color or complex {@link android.content.res.ColorStateList} description.
- *
+ *
* @param index Index of attribute to retrieve.
- *
+ *
* @return ColorStateList for the attribute, or null if not defined.
*/
@Override
@@ -296,14 +296,14 @@
if (value == null) {
return null;
}
-
+
try {
int color = ResourceHelper.getColor(value);
return ColorStateList.valueOf(color);
} catch (NumberFormatException e) {
// if it's not a color value, we'll attempt to read the xml based color below.
}
-
+
// let the framework inflate the ColorStateList from the XML file.
try {
File f = new File(value);
@@ -311,7 +311,7 @@
KXmlParser parser = new KXmlParser();
parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true);
parser.setInput(new FileReader(f));
-
+
ColorStateList colorStateList = ColorStateList.createFromXml(
mContext.getResources(),
// FIXME: we need to know if this resource is platform or not
@@ -325,22 +325,22 @@
// return null below.
}
-
+
// looks like were unable to resolve the color value.
mContext.getLogger().warning(String.format(
"Unable to resolve color value \"%1$s\" in attribute \"%2$s\"",
value, mNames[index]));
-
+
return null;
}
-
+
/**
* Retrieve the integer value for the attribute at <var>index</var>.
- *
+ *
* @param index Index of attribute to retrieve.
* @param defValue Value to return if the attribute is not defined or
* not a resource.
- *
+ *
* @return Attribute integer value, or defValue if not defined.
*/
@Override
@@ -362,23 +362,23 @@
// The default value is returned below.
}
}
-
+
return defValue;
}
/**
- * Retrieve a dimensional unit attribute at <var>index</var>. Unit
- * conversions are based on the current {@link DisplayMetrics}
- * associated with the resources this {@link TypedArray} object
- * came from.
- *
+ * Retrieve a dimensional unit attribute at <var>index</var>. Unit
+ * conversions are based on the current {@link DisplayMetrics}
+ * associated with the resources this {@link TypedArray} object
+ * came from.
+ *
* @param index Index of attribute to retrieve.
* @param defValue Value to return if the attribute is not defined or
* not a resource.
- *
- * @return Attribute dimension value multiplied by the appropriate
+ *
+ * @return Attribute dimension value multiplied by the appropriate
* metric, or defValue if not defined.
- *
+ *
* @see #getDimensionPixelOffset
* @see #getDimensionPixelSize
*/
@@ -397,11 +397,11 @@
} else if (s.equals(BridgeConstants.WRAP_CONTENT)) {
return LayoutParams.WRAP_CONTENT;
}
-
+
if (ResourceHelper.stringToFloat(s, mValue)) {
return mValue.getDimension(mResources.mMetrics);
}
-
+
// looks like we were unable to resolve the dimension value
mContext.getLogger().warning(String.format(
"Unable to resolve dimension value \"%1$s\" in attribute \"%2$s\"",
@@ -416,14 +416,14 @@
* {@link #getDimension}, except the returned value is converted to
* integer pixels for you. An offset conversion involves simply
* truncating the base value to an integer.
- *
+ *
* @param index Index of attribute to retrieve.
* @param defValue Value to return if the attribute is not defined or
* not a resource.
- *
- * @return Attribute dimension value multiplied by the appropriate
+ *
+ * @return Attribute dimension value multiplied by the appropriate
* metric and truncated to integer pixels, or defValue if not defined.
- *
+ *
* @see #getDimension
* @see #getDimensionPixelSize
*/
@@ -439,14 +439,14 @@
* integer pixels for use as a size. A size conversion involves
* rounding the base value, and ensuring that a non-zero base value
* is at least one pixel in size.
- *
+ *
* @param index Index of attribute to retrieve.
* @param defValue Value to return if the attribute is not defined or
* not a resource.
- *
- * @return Attribute dimension value multiplied by the appropriate
+ *
+ * @return Attribute dimension value multiplied by the appropriate
* metric and truncated to integer pixels, or defValue if not defined.
- *
+ *
* @see #getDimension
* @see #getDimensionPixelOffset
*/
@@ -465,7 +465,7 @@
} else if (s.equals(BridgeConstants.WRAP_CONTENT)) {
return LayoutParams.WRAP_CONTENT;
}
-
+
// FIXME huh?
float f = getDimension(index, defValue);
@@ -483,11 +483,11 @@
* {@link android.view.ViewGroup}'s layout_width and layout_height
* attributes. This is only here for performance reasons; applications
* should use {@link #getDimensionPixelSize}.
- *
+ *
* @param index Index of the attribute to retrieve.
* @param name Textual name of attribute for error reporting.
- *
- * @return Attribute dimension value multiplied by the appropriate
+ *
+ * @return Attribute dimension value multiplied by the appropriate
* metric and truncated to integer pixels.
*/
@Override
@@ -495,20 +495,25 @@
return getDimensionPixelSize(index, 0);
}
+ @Override
+ public int getLayoutDimension(int index, int defValue) {
+ return getDimensionPixelSize(index, defValue);
+ }
+
/**
* Retrieve a fractional unit attribute at <var>index</var>.
- *
- * @param index Index of attribute to retrieve.
- * @param base The base value of this fraction. In other words, a
+ *
+ * @param index Index of attribute to retrieve.
+ * @param base The base value of this fraction. In other words, a
* standard fraction is multiplied by this value.
- * @param pbase The parent base value of this fraction. In other
+ * @param pbase The parent base value of this fraction. In other
* words, a parent fraction (nn%p) is multiplied by this
* value.
* @param defValue Value to return if the attribute is not defined or
* not a resource.
- *
- * @return Attribute fractional value multiplied by the appropriate
- * base value, or defValue if not defined.
+ *
+ * @return Attribute fractional value multiplied by the appropriate
+ * base value, or defValue if not defined.
*/
@Override
public float getFraction(int index, int base, int pbase, float defValue) {
@@ -520,7 +525,7 @@
if (value == null) {
return defValue;
}
-
+
if (ResourceHelper.stringToFloat(value, mValue)) {
return mValue.getFraction(base, pbase);
}
@@ -529,29 +534,29 @@
mContext.getLogger().warning(String.format(
"Unable to resolve fraction value \"%1$s\" in attribute \"%2$s\"",
value, mNames[index]));
-
+
return defValue;
}
/**
* Retrieve the resource identifier for the attribute at
- * <var>index</var>. Note that attribute resource as resolved when
- * the overall {@link TypedArray} object is retrieved. As a
- * result, this function will return the resource identifier of the
- * final resource value that was found, <em>not</em> necessarily the
- * original resource that was specified by the attribute.
- *
+ * <var>index</var>. Note that attribute resource as resolved when
+ * the overall {@link TypedArray} object is retrieved. As a
+ * result, this function will return the resource identifier of the
+ * final resource value that was found, <em>not</em> necessarily the
+ * original resource that was specified by the attribute.
+ *
* @param index Index of attribute to retrieve.
* @param defValue Value to return if the attribute is not defined or
* not a resource.
- *
+ *
* @return Attribute resource identifier, or defValue if not defined.
*/
@Override
public int getResourceId(int index, int defValue) {
// get the IResource for this index
IResourceValue resValue = mData[index];
-
+
// no data, return the default value.
if (resValue == null) {
return defValue;
@@ -562,7 +567,7 @@
// get the id that will represent this style.
return mContext.getDynamicIdByStyle((IStyleResourceValue)resValue);
}
-
+
// if the attribute was a reference to an id, and not a declaration of an id (@+id), then
// the xml attribute value was "resolved" which leads us to a IResourceValue with
// getType() returning "id" and getName() returning the id name
@@ -583,7 +588,7 @@
if (value == null) {
return defValue;
}
-
+
// if the value is just an integer, return it.
try {
int i = Integer.parseInt(value);
@@ -601,14 +606,14 @@
// fact in the android.R and com.android.internal.R classes.
// The field mPlatformFile will indicate that all IDs are to be looked up in the android R
// classes exclusively.
-
+
// if this is a reference to an id, find it.
if (value.startsWith("@id/") || value.startsWith("@+") ||
value.startsWith("@android:id/")) {
-
+
int pos = value.indexOf('/');
String idName = value.substring(pos + 1);
-
+
// if this is a framework id
if (mPlatformFile || value.startsWith("@android") || value.startsWith("@+android")) {
// look for idName in the android R classes
@@ -621,7 +626,7 @@
// not a direct id valid reference? resolve it
Integer idValue = null;
-
+
if (resValue.isFramework()) {
idValue = Bridge.getResourceValue(resValue.getType(), resValue.getName());
} else {
@@ -632,7 +637,7 @@
if (idValue != null) {
return idValue.intValue();
}
-
+
mContext.getLogger().warning(String.format(
"Unable to resolve id \"%1$s\" for attribute \"%2$s\"", value, mNames[index]));
return defValue;
@@ -643,9 +648,9 @@
* gets the resource ID of the selected attribute, and uses
* {@link Resources#getDrawable Resources.getDrawable} of the owning
* Resources object to retrieve its Drawable.
- *
+ *
* @param index Index of attribute to retrieve.
- *
+ *
* @return Drawable for the attribute, or null if not defined.
*/
@Override
@@ -658,13 +663,13 @@
if (value == null || BridgeConstants.REFERENCE_NULL.equals(value)) {
return null;
}
-
+
Drawable d = ResourceHelper.getDrawable(value, mContext, mData[index].isFramework());
-
+
if (d != null) {
return d;
}
-
+
// looks like we were unable to resolve the drawable
mContext.getLogger().warning(String.format(
"Unable to resolve drawable \"%1$s\" in attribute \"%2$s\"", value, mNames[index]));
@@ -678,9 +683,9 @@
* This gets the resource ID of the selected attribute, and uses
* {@link Resources#getTextArray Resources.getTextArray} of the owning
* Resources object to retrieve its String[].
- *
+ *
* @param index Index of attribute to retrieve.
- *
+ *
* @return CharSequence[] for the attribute, or null if not defined.
*/
@Override
@@ -693,7 +698,7 @@
if (value != null) {
return new CharSequence[] { value };
}
-
+
mContext.getLogger().warning(String.format(
String.format("Unknown value for getTextArray(%d) => %s", //DEBUG
index, mData[index].getName())));
@@ -703,44 +708,44 @@
/**
* Retrieve the raw TypedValue for the attribute at <var>index</var>.
- *
+ *
* @param index Index of attribute to retrieve.
* @param outValue TypedValue object in which to place the attribute's
* data.
- *
- * @return Returns true if the value was retrieved, else false.
+ *
+ * @return Returns true if the value was retrieved, else false.
*/
@Override
public boolean getValue(int index, TypedValue outValue) {
if (mData[index] == null) {
return false;
}
-
+
String s = mData[index].getValue();
-
+
return ResourceHelper.stringToFloat(s, outValue);
}
/**
* Determines whether there is an attribute at <var>index</var>.
- *
+ *
* @param index Index of attribute to retrieve.
- *
+ *
* @return True if the attribute has a value, false otherwise.
*/
@Override
public boolean hasValue(int index) {
return mData[index] != null;
}
-
+
/**
- * Retrieve the raw TypedValue for the attribute at <var>index</var>
- * and return a temporary object holding its data. This object is only
- * valid until the next call on to {@link TypedArray}.
- *
+ * Retrieve the raw TypedValue for the attribute at <var>index</var>
+ * and return a temporary object holding its data. This object is only
+ * valid until the next call on to {@link TypedArray}.
+ *
* @param index Index of attribute to retrieve.
- *
- * @return Returns a TypedValue object if the attribute is defined,
+ *
+ * @return Returns a TypedValue object if the attribute is defined,
* containing its data; otherwise returns null. (You will not
* receive a TypedValue whose type is TYPE_NULL.)
*/
@@ -749,7 +754,7 @@
if (getValue(index, mValue)) {
return mValue;
}
-
+
return null;
}