Merge "Import revised translations. DO NOT MERGE" into ics-mr1
diff --git a/api/current.txt b/api/current.txt
index c62d82b..ddf5baf 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -5334,6 +5334,7 @@
method public java.util.ArrayList<T> getParcelableArrayListExtra(java.lang.String);
method public T getParcelableExtra(java.lang.String);
method public java.lang.String getScheme();
+ method public android.content.Intent getSelector();
method public java.io.Serializable getSerializableExtra(java.lang.String);
method public short[] getShortArrayExtra(java.lang.String);
method public short getShortExtra(java.lang.String, short);
@@ -5346,6 +5347,7 @@
method public boolean hasExtra(java.lang.String);
method public boolean hasFileDescriptors();
method public static android.content.Intent makeMainActivity(android.content.ComponentName);
+ method public static android.content.Intent makeMainSelectorActivity(java.lang.String, java.lang.String);
method public static android.content.Intent makeRestartActivityTask(android.content.ComponentName);
method public static android.content.Intent parseIntent(android.content.res.Resources, org.xmlpull.v1.XmlPullParser, android.util.AttributeSet) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
method public static android.content.Intent parseUri(java.lang.String, int) throws java.net.URISyntaxException;
@@ -5399,6 +5401,7 @@
method public void setExtrasClassLoader(java.lang.ClassLoader);
method public android.content.Intent setFlags(int);
method public android.content.Intent setPackage(java.lang.String);
+ method public void setSelector(android.content.Intent);
method public void setSourceBounds(android.graphics.Rect);
method public android.content.Intent setType(java.lang.String);
method public deprecated java.lang.String toURI();
@@ -5577,6 +5580,7 @@
field public static final int FILL_IN_COMPONENT = 8; // 0x8
field public static final int FILL_IN_DATA = 2; // 0x2
field public static final int FILL_IN_PACKAGE = 16; // 0x10
+ field public static final int FILL_IN_SELECTOR = 64; // 0x40
field public static final int FILL_IN_SOURCE_BOUNDS = 32; // 0x20
field public static final int FLAG_ACTIVITY_BROUGHT_TO_FRONT = 4194304; // 0x400000
field public static final int FLAG_ACTIVITY_CLEAR_TASK = 32768; // 0x8000
@@ -17429,6 +17433,7 @@
method public static boolean putString(android.content.ContentResolver, java.lang.String, java.lang.String);
method public static final void setLocationProviderEnabled(android.content.ContentResolver, java.lang.String, boolean);
field public static final java.lang.String ACCESSIBILITY_ENABLED = "accessibility_enabled";
+ field public static final java.lang.String ACCESSIBILITY_SPEAK_PASSWORD = "speak_password";
field public static final java.lang.String ADB_ENABLED = "adb_enabled";
field public static final java.lang.String ALLOWED_GEOLOCATION_ORIGINS = "allowed_geolocation_origins";
field public static final java.lang.String ALLOW_MOCK_LOCATION = "mock_location";
diff --git a/cmds/am/src/com/android/commands/am/Am.java b/cmds/am/src/com/android/commands/am/Am.java
index 140222e..fddb429 100644
--- a/cmds/am/src/com/android/commands/am/Am.java
+++ b/cmds/am/src/com/android/commands/am/Am.java
@@ -131,6 +131,10 @@
runScreenCompat();
} else if (op.equals("display-size")) {
runDisplaySize();
+ } else if (op.equals("to-uri")) {
+ runToUri(false);
+ } else if (op.equals("to-intent-uri")) {
+ runToUri(true);
} else {
throw new IllegalArgumentException("Unknown command: " + op);
}
@@ -138,6 +142,7 @@
private Intent makeIntent() throws URISyntaxException {
Intent intent = new Intent();
+ Intent baseIntent = intent;
boolean hasIntentInfo = false;
mDebugOption = false;
@@ -152,35 +157,39 @@
while ((opt=nextOption()) != null) {
if (opt.equals("-a")) {
intent.setAction(nextArgRequired());
- hasIntentInfo = true;
+ if (intent == baseIntent) {
+ hasIntentInfo = true;
+ }
} else if (opt.equals("-d")) {
data = Uri.parse(nextArgRequired());
- hasIntentInfo = true;
+ if (intent == baseIntent) {
+ hasIntentInfo = true;
+ }
} else if (opt.equals("-t")) {
type = nextArgRequired();
- hasIntentInfo = true;
+ if (intent == baseIntent) {
+ hasIntentInfo = true;
+ }
} else if (opt.equals("-c")) {
intent.addCategory(nextArgRequired());
- hasIntentInfo = true;
+ if (intent == baseIntent) {
+ hasIntentInfo = true;
+ }
} else if (opt.equals("-e") || opt.equals("--es")) {
String key = nextArgRequired();
String value = nextArgRequired();
intent.putExtra(key, value);
- hasIntentInfo = true;
} else if (opt.equals("--esn")) {
String key = nextArgRequired();
intent.putExtra(key, (String) null);
- hasIntentInfo = true;
} else if (opt.equals("--ei")) {
String key = nextArgRequired();
String value = nextArgRequired();
intent.putExtra(key, Integer.valueOf(value));
- hasIntentInfo = true;
} else if (opt.equals("--eu")) {
String key = nextArgRequired();
String value = nextArgRequired();
intent.putExtra(key, Uri.parse(value));
- hasIntentInfo = true;
} else if (opt.equals("--eia")) {
String key = nextArgRequired();
String value = nextArgRequired();
@@ -190,12 +199,10 @@
list[i] = Integer.valueOf(strings[i]);
}
intent.putExtra(key, list);
- hasIntentInfo = true;
} else if (opt.equals("--el")) {
String key = nextArgRequired();
String value = nextArgRequired();
intent.putExtra(key, Long.valueOf(value));
- hasIntentInfo = true;
} else if (opt.equals("--ela")) {
String key = nextArgRequired();
String value = nextArgRequired();
@@ -205,18 +212,18 @@
list[i] = Long.valueOf(strings[i]);
}
intent.putExtra(key, list);
- hasIntentInfo = true;
} else if (opt.equals("--ez")) {
String key = nextArgRequired();
String value = nextArgRequired();
intent.putExtra(key, Boolean.valueOf(value));
- hasIntentInfo = true;
} else if (opt.equals("-n")) {
String str = nextArgRequired();
ComponentName cn = ComponentName.unflattenFromString(str);
if (cn == null) throw new IllegalArgumentException("Bad component name: " + str);
intent.setComponent(cn);
- hasIntentInfo = true;
+ if (intent == baseIntent) {
+ hasIntentInfo = true;
+ }
} else if (opt.equals("-f")) {
String str = nextArgRequired();
intent.setFlags(Integer.decode(str).intValue());
@@ -264,6 +271,9 @@
intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY);
} else if (opt.equals("--receiver-replace-pending")) {
intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING);
+ } else if (opt.equals("--selector")) {
+ intent.setDataAndType(data, type);
+ intent = new Intent();
} else if (opt.equals("-D")) {
mDebugOption = true;
} else if (opt.equals("-W")) {
@@ -286,25 +296,42 @@
}
intent.setDataAndType(data, type);
+ final boolean hasSelector = intent != baseIntent;
+ if (hasSelector) {
+ // A selector was specified; fix up.
+ baseIntent.setSelector(intent);
+ intent = baseIntent;
+ }
+
String arg = nextArg();
- if (arg != null) {
- Intent baseIntent;
- if (arg.indexOf(':') >= 0) {
- // The argument is a URI. Fully parse it, and use that result
- // to fill in any data not specified so far.
- baseIntent = Intent.parseUri(arg, Intent.URI_INTENT_SCHEME);
- } else if (arg.indexOf('/') >= 0) {
- // The argument is a component name. Build an Intent to launch
- // it.
+ baseIntent = null;
+ if (arg == null) {
+ if (hasSelector) {
+ // If a selector has been specified, and no arguments
+ // have been supplied for the main Intent, then we can
+ // assume it is ACTION_MAIN CATEGORY_LAUNCHER; we don't
+ // need to have a component name specified yet, the
+ // selector will take care of that.
baseIntent = new Intent(Intent.ACTION_MAIN);
baseIntent.addCategory(Intent.CATEGORY_LAUNCHER);
- baseIntent.setComponent(ComponentName.unflattenFromString(arg));
- } else {
- // Assume the argument is a package name.
- baseIntent = new Intent(Intent.ACTION_MAIN);
- baseIntent.addCategory(Intent.CATEGORY_LAUNCHER);
- baseIntent.setPackage(arg);
}
+ } else if (arg.indexOf(':') >= 0) {
+ // The argument is a URI. Fully parse it, and use that result
+ // to fill in any data not specified so far.
+ baseIntent = Intent.parseUri(arg, Intent.URI_INTENT_SCHEME);
+ } else if (arg.indexOf('/') >= 0) {
+ // The argument is a component name. Build an Intent to launch
+ // it.
+ baseIntent = new Intent(Intent.ACTION_MAIN);
+ baseIntent.addCategory(Intent.CATEGORY_LAUNCHER);
+ baseIntent.setComponent(ComponentName.unflattenFromString(arg));
+ } else {
+ // Assume the argument is a package name.
+ baseIntent = new Intent(Intent.ACTION_MAIN);
+ baseIntent.addCategory(Intent.CATEGORY_LAUNCHER);
+ baseIntent.setPackage(arg);
+ }
+ if (baseIntent != null) {
Bundle extras = intent.getExtras();
intent.replaceExtras((Bundle)null);
Bundle uriExtras = baseIntent.getExtras();
@@ -315,7 +342,7 @@
baseIntent.removeCategory(c);
}
}
- intent.fillIn(baseIntent, Intent.FILL_IN_COMPONENT);
+ intent.fillIn(baseIntent, Intent.FILL_IN_COMPONENT | Intent.FILL_IN_SELECTOR);
if (extras == null) {
extras = uriExtras;
} else if (uriExtras != null) {
@@ -1064,6 +1091,11 @@
}
}
+ private void runToUri(boolean intentScheme) throws Exception {
+ Intent intent = makeIntent();
+ System.out.println(intent.toUri(intentScheme ? Intent.URI_INTENT_SCHEME : 0));
+ }
+
private class IntentReceiver extends IIntentReceiver.Stub {
private boolean mFinished = false;
@@ -1233,6 +1265,8 @@
" am monitor [--gdb <port>]\n" +
" am screen-compat [on|off] <PACKAGE>\n" +
" am display-size [reset|MxN]\n" +
+ " am to-uri [INTENT]\n" +
+ " am to-intent-uri [INTENT]\n" +
"\n" +
"am start: start an Activity. Options are:\n" +
" -D: enable debugging\n" +
@@ -1284,6 +1318,10 @@
"\n" +
"am display-size: override display size.\n" +
"\n" +
+ "am to-uri: print the given Intent specification as a URI.\n" +
+ "\n" +
+ "am to-intent-uri: print the given Intent specification as an intent: URI.\n" +
+ "\n" +
"<INTENT> specifications include these flags and arguments:\n" +
" [-a <ACTION>] [-d <DATA_URI>] [-t <MIME_TYPE>]\n" +
" [-c <CATEGORY> [-c <CATEGORY>] ...]\n" +
@@ -1308,6 +1346,7 @@
" [--activity-single-top] [--activity-clear-task]\n" +
" [--activity-task-on-home]\n" +
" [--receiver-registered-only] [--receiver-replace-pending]\n" +
+ " [--selector]\n" +
" [<URI> | <PACKAGE> | <COMPONENT>]\n"
);
}
diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java
index 9948985..4e5598b 100644
--- a/core/java/android/content/Intent.java
+++ b/core/java/android/content/Intent.java
@@ -2315,6 +2315,11 @@
/**
* Used with {@link #ACTION_MAIN} to launch the browser application.
* The activity should be able to browse the Internet.
+ * <p>NOTE: This should not be used as the primary key of an Intent,
+ * since it will not result in the app launching with the correct
+ * action and category. Instead, use this with
+ * {@link #makeMainSelectorActivity(String, String) to generate a main
+ * Intent with this category in the selector.</p>
*/
@SdkConstant(SdkConstantType.INTENT_CATEGORY)
public static final String CATEGORY_APP_BROWSER = "android.intent.category.APP_BROWSER";
@@ -2322,6 +2327,11 @@
/**
* Used with {@link #ACTION_MAIN} to launch the calculator application.
* The activity should be able to perform standard arithmetic operations.
+ * <p>NOTE: This should not be used as the primary key of an Intent,
+ * since it will not result in the app launching with the correct
+ * action and category. Instead, use this with
+ * {@link #makeMainSelectorActivity(String, String) to generate a main
+ * Intent with this category in the selector.</p>
*/
@SdkConstant(SdkConstantType.INTENT_CATEGORY)
public static final String CATEGORY_APP_CALCULATOR = "android.intent.category.APP_CALCULATOR";
@@ -2329,6 +2339,11 @@
/**
* Used with {@link #ACTION_MAIN} to launch the calendar application.
* The activity should be able to view and manipulate calendar entries.
+ * <p>NOTE: This should not be used as the primary key of an Intent,
+ * since it will not result in the app launching with the correct
+ * action and category. Instead, use this with
+ * {@link #makeMainSelectorActivity(String, String) to generate a main
+ * Intent with this category in the selector.</p>
*/
@SdkConstant(SdkConstantType.INTENT_CATEGORY)
public static final String CATEGORY_APP_CALENDAR = "android.intent.category.APP_CALENDAR";
@@ -2336,6 +2351,11 @@
/**
* Used with {@link #ACTION_MAIN} to launch the contacts application.
* The activity should be able to view and manipulate address book entries.
+ * <p>NOTE: This should not be used as the primary key of an Intent,
+ * since it will not result in the app launching with the correct
+ * action and category. Instead, use this with
+ * {@link #makeMainSelectorActivity(String, String) to generate a main
+ * Intent with this category in the selector.</p>
*/
@SdkConstant(SdkConstantType.INTENT_CATEGORY)
public static final String CATEGORY_APP_CONTACTS = "android.intent.category.APP_CONTACTS";
@@ -2343,6 +2363,11 @@
/**
* Used with {@link #ACTION_MAIN} to launch the email application.
* The activity should be able to send and receive email.
+ * <p>NOTE: This should not be used as the primary key of an Intent,
+ * since it will not result in the app launching with the correct
+ * action and category. Instead, use this with
+ * {@link #makeMainSelectorActivity(String, String) to generate a main
+ * Intent with this category in the selector.</p>
*/
@SdkConstant(SdkConstantType.INTENT_CATEGORY)
public static final String CATEGORY_APP_EMAIL = "android.intent.category.APP_EMAIL";
@@ -2351,6 +2376,11 @@
* Used with {@link #ACTION_MAIN} to launch the gallery application.
* The activity should be able to view and manipulate image and video files
* stored on the device.
+ * <p>NOTE: This should not be used as the primary key of an Intent,
+ * since it will not result in the app launching with the correct
+ * action and category. Instead, use this with
+ * {@link #makeMainSelectorActivity(String, String) to generate a main
+ * Intent with this category in the selector.</p>
*/
@SdkConstant(SdkConstantType.INTENT_CATEGORY)
public static final String CATEGORY_APP_GALLERY = "android.intent.category.APP_GALLERY";
@@ -2358,6 +2388,11 @@
/**
* Used with {@link #ACTION_MAIN} to launch the maps application.
* The activity should be able to show the user's current location and surroundings.
+ * <p>NOTE: This should not be used as the primary key of an Intent,
+ * since it will not result in the app launching with the correct
+ * action and category. Instead, use this with
+ * {@link #makeMainSelectorActivity(String, String) to generate a main
+ * Intent with this category in the selector.</p>
*/
@SdkConstant(SdkConstantType.INTENT_CATEGORY)
public static final String CATEGORY_APP_MAPS = "android.intent.category.APP_MAPS";
@@ -2365,13 +2400,24 @@
/**
* Used with {@link #ACTION_MAIN} to launch the messaging application.
* The activity should be able to send and receive text messages.
+ * <p>NOTE: This should not be used as the primary key of an Intent,
+ * since it will not result in the app launching with the correct
+ * action and category. Instead, use this with
+ * {@link #makeMainSelectorActivity(String, String) to generate a main
+ * Intent with this category in the selector.</p>
*/
@SdkConstant(SdkConstantType.INTENT_CATEGORY)
public static final String CATEGORY_APP_MESSAGING = "android.intent.category.APP_MESSAGING";
/**
* Used with {@link #ACTION_MAIN} to launch the music application.
- * The activity should be able to play, browse, or manipulate music files stored on the device.
+ * The activity should be able to play, browse, or manipulate music files
+ * stored on the device.
+ * <p>NOTE: This should not be used as the primary key of an Intent,
+ * since it will not result in the app launching with the correct
+ * action and category. Instead, use this with
+ * {@link #makeMainSelectorActivity(String, String) to generate a main
+ * Intent with this category in the selector.</p>
*/
@SdkConstant(SdkConstantType.INTENT_CATEGORY)
public static final String CATEGORY_APP_MUSIC = "android.intent.category.APP_MUSIC";
@@ -2963,6 +3009,7 @@
private HashSet<String> mCategories;
private Bundle mExtras;
private Rect mSourceBounds;
+ private Intent mSelector;
// ---------------------------------------------------------------------
@@ -2991,6 +3038,9 @@
if (o.mSourceBounds != null) {
this.mSourceBounds = new Rect(o.mSourceBounds);
}
+ if (o.mSelector != null) {
+ this.mSelector = new Intent(o.mSelector);
+ }
}
@Override
@@ -3131,6 +3181,39 @@
}
/**
+ * Make an Intent for the main activity of an application, without
+ * specifying a specific activity to run but giving a selector to find
+ * the activity. This results in a final Intent that is structured
+ * the same as when the application is launched from
+ * Home. For anything else that wants to launch an application in the
+ * same way, it is important that they use an Intent structured the same
+ * way, and can use this function to ensure this is the case.
+ *
+ * <p>The returned Intent has {@link #ACTION_MAIN} as its action, and includes the
+ * category {@link #CATEGORY_LAUNCHER}. This does <em>not</em> have
+ * {@link #FLAG_ACTIVITY_NEW_TASK} set, though typically you will want
+ * to do that through {@link #addFlags(int)} on the returned Intent.
+ *
+ * @param selectorAction The action name of the Intent's selector.
+ * @param selectorCategory The name of a category to add to the Intent's
+ * selector.
+ * @return Returns a newly created Intent that can be used to launch the
+ * activity as a main application entry.
+ *
+ * @see #setSelector(Intent)
+ */
+ public static Intent makeMainSelectorActivity(String selectorAction,
+ String selectorCategory) {
+ Intent intent = new Intent(ACTION_MAIN);
+ intent.addCategory(CATEGORY_LAUNCHER);
+ Intent selector = new Intent();
+ selector.setAction(selectorAction);
+ selector.addCategory(selectorCategory);
+ intent.setSelector(selector);
+ return intent;
+ }
+
+ /**
* Make an Intent that can be used to re-launch an application's task
* in its base state. This is like {@link #makeMainActivity(ComponentName)},
* but also sets the flags {@link #FLAG_ACTIVITY_NEW_TASK} and
@@ -3205,6 +3288,7 @@
// new format
Intent intent = new Intent(ACTION_VIEW);
+ Intent baseIntent = intent;
// fetch data part, if present
String data = i >= 0 ? uri.substring(0, i) : null;
@@ -3214,8 +3298,9 @@
// loop over contents of Intent, all name=value;
while (!uri.startsWith("end", i)) {
int eq = uri.indexOf('=', i);
- int semi = uri.indexOf(';', eq);
- String value = Uri.decode(uri.substring(eq + 1, semi));
+ if (eq < 0) eq = i-1;
+ int semi = uri.indexOf(';', i);
+ String value = eq < semi ? Uri.decode(uri.substring(eq + 1, semi)) : "";
// action
if (uri.startsWith("action=", i)) {
@@ -3257,6 +3342,11 @@
intent.mSourceBounds = Rect.unflattenFromString(value);
}
+ // selector
+ else if (semi == (i+3) && uri.startsWith("SEL", i)) {
+ intent = new Intent();
+ }
+
// extra
else {
String key = Uri.decode(uri.substring(i + 2, eq));
@@ -3280,6 +3370,12 @@
i = semi + 1;
}
+ if (intent != baseIntent) {
+ // The Intent had a selector; fix it up.
+ baseIntent.setSelector(intent);
+ intent = baseIntent;
+ }
+
if (data != null) {
if (data.startsWith("intent:")) {
data = data.substring(7);
@@ -3605,7 +3701,7 @@
* Return the set of all categories in the intent. If there are no categories,
* returns NULL.
*
- * @return Set The set of categories you can examine. Do not modify!
+ * @return The set of categories you can examine. Do not modify!
*
* @see #hasCategory
* @see #addCategory
@@ -3615,6 +3711,16 @@
}
/**
+ * Return the specific selector associated with this Intent. If there is
+ * none, returns null. See {@link #setSelector} for more information.
+ *
+ * @see #setSelector
+ */
+ public Intent getSelector() {
+ return mSelector;
+ }
+
+ /**
* Sets the ClassLoader that will be used when unmarshalling
* any Parcelable values from the extras of this Intent.
*
@@ -4433,6 +4539,49 @@
}
/**
+ * Set a selector for this Intent. This is a modification to the kinds of
+ * things the Intent will match. If the selector is set, it will be used
+ * when trying to find entities that can handle the Intent, instead of the
+ * main contents of the Intent. This allows you build an Intent containing
+ * a generic protocol while targeting it more specifically.
+ *
+ * <p>An example of where this may be used is with things like
+ * {@link #CATEGORY_APP_BROWSER}. This category allows you to build an
+ * Intent that will launch the Browser application. However, the correct
+ * main entry point of an application is actually {@link #ACTION_MAIN}
+ * {@link #CATEGORY_LAUNCHER} with {@link #setComponent(ComponentName)}
+ * used to specify the actual Activity to launch. If you launch the browser
+ * with something different, undesired behavior may happen if the user has
+ * previously or later launches it the normal way, since they do not match.
+ * Instead, you can build an Intent with the MAIN action (but no ComponentName
+ * yet specified) and set a selector with {@link #ACTION_MAIN} and
+ * {@link #CATEGORY_APP_BROWSER} to point it specifically to the browser activity.
+ *
+ * <p>Setting a selector does not impact the behavior of
+ * {@link #filterEquals(Intent)} and {@link #filterHashCode()}. This is part of the
+ * desired behavior of a selector -- it does not impact the base meaning
+ * of the Intent, just what kinds of things will be matched against it
+ * when determining who can handle it.</p>
+ *
+ * <p>You can not use both a selector and {@link #setPackage(String)} on
+ * the same base Intent.</p>
+ *
+ * @param selector The desired selector Intent; set to null to not use
+ * a special selector.
+ */
+ public void setSelector(Intent selector) {
+ if (selector == this) {
+ throw new IllegalArgumentException(
+ "Intent being set as a selector of itself");
+ }
+ if (selector != null && mPackage != null) {
+ throw new IllegalArgumentException(
+ "Can't set selector when package name is already set");
+ }
+ mSelector = selector;
+ }
+
+ /**
* Add extended data to the intent. The name must include a package
* prefix, for example the app com.android.contacts would use names
* like "com.android.contacts.ShowAll".
@@ -5259,6 +5408,10 @@
* @see #resolveActivity
*/
public Intent setPackage(String packageName) {
+ if (packageName != null && mSelector != null) {
+ throw new IllegalArgumentException(
+ "Can't set package name when selector is already set");
+ }
mPackage = packageName;
return this;
}
@@ -5394,12 +5547,18 @@
public static final int FILL_IN_PACKAGE = 1<<4;
/**
- * Use with {@link #fillIn} to allow the current package value to be
+ * Use with {@link #fillIn} to allow the current bounds rectangle to be
* overwritten, even if it is already set.
*/
public static final int FILL_IN_SOURCE_BOUNDS = 1<<5;
/**
+ * Use with {@link #fillIn} to allow the current selector to be
+ * overwritten, even if it is already set.
+ */
+ public static final int FILL_IN_SELECTOR = 1<<6;
+
+ /**
* Copy the contents of <var>other</var> in to this object, but only
* where fields are not defined by this object. For purposes of a field
* being defined, the following pieces of data in the Intent are
@@ -5419,11 +5578,13 @@
*
* <p>In addition, you can use the {@link #FILL_IN_ACTION},
* {@link #FILL_IN_DATA}, {@link #FILL_IN_CATEGORIES}, {@link #FILL_IN_PACKAGE},
- * and {@link #FILL_IN_COMPONENT} to override the restriction where the
+ * {@link #FILL_IN_COMPONENT}, {@link #FILL_IN_SOURCE_BOUNDS}, and
+ * {@link #FILL_IN_SELECTOR} to override the restriction where the
* corresponding field will not be replaced if it is already set.
*
* <p>Note: The component field will only be copied if {@link #FILL_IN_COMPONENT} is explicitly
- * specified.
+ * specified. The selector will only be copied if {@link #FILL_IN_SELECTOR} is
+ * explicitly specified.
*
* <p>For example, consider Intent A with {data="foo", categories="bar"}
* and Intent B with {action="gotit", data-type="some/thing",
@@ -5439,7 +5600,8 @@
*
* @return Returns a bit mask of {@link #FILL_IN_ACTION},
* {@link #FILL_IN_DATA}, {@link #FILL_IN_CATEGORIES}, {@link #FILL_IN_PACKAGE},
- * and {@link #FILL_IN_COMPONENT} indicating which fields were changed.
+ * {@link #FILL_IN_COMPONENT}, {@link #FILL_IN_SOURCE_BOUNDS}, and
+ * {@link #FILL_IN_SELECTOR} indicating which fields were changed.
*/
public int fillIn(Intent other, int flags) {
int changes = 0;
@@ -5464,8 +5626,20 @@
}
if (other.mPackage != null
&& (mPackage == null || (flags&FILL_IN_PACKAGE) != 0)) {
- mPackage = other.mPackage;
- changes |= FILL_IN_PACKAGE;
+ // Only do this if mSelector is not set.
+ if (mSelector == null) {
+ mPackage = other.mPackage;
+ changes |= FILL_IN_PACKAGE;
+ }
+ }
+ // Selector is special: it can only be set if explicitly allowed,
+ // for the same reason as the component name.
+ if (other.mSelector != null && (flags&FILL_IN_SELECTOR) != 0) {
+ if (mPackage == null) {
+ mSelector = new Intent(other.mSelector);
+ mPackage = null;
+ changes |= FILL_IN_SELECTOR;
+ }
}
// Component is special: it can -only- be set if explicitly allowed,
// since otherwise the sender could force the intent somewhere the
@@ -5763,6 +5937,11 @@
first = false;
b.append("(has extras)");
}
+ if (mSelector != null) {
+ b.append(" sel={");
+ mSelector.toShortString(b, secure, comp, extras);
+ b.append("}");
+ }
}
/**
@@ -5823,6 +6002,21 @@
uri.append("#Intent;");
+ toUriInner(uri, scheme, flags);
+ if (mSelector != null) {
+ uri.append("SEL;");
+ // Note that for now we are not going to try to handle the
+ // data part; not clear how to represent this as a URI, and
+ // not much utility in it.
+ mSelector.toUriInner(uri, null, flags);
+ }
+
+ uri.append("end");
+
+ return uri.toString();
+ }
+
+ private void toUriInner(StringBuilder uri, String scheme, int flags) {
if (scheme != null) {
uri.append("scheme=").append(scheme).append(';');
}
@@ -5877,10 +6071,6 @@
}
}
}
-
- uri.append("end");
-
- return uri.toString();
}
public int describeContents() {
@@ -5911,6 +6101,13 @@
out.writeInt(0);
}
+ if (mSelector != null) {
+ out.writeInt(1);
+ mSelector.writeToParcel(out, flags);
+ } else {
+ out.writeInt(0);
+ }
+
out.writeBundle(mExtras);
}
@@ -5952,6 +6149,10 @@
mCategories = null;
}
+ if (in.readInt() != 0) {
+ mSelector = new Intent(in);
+ }
+
mExtras = in.readBundle();
}
diff --git a/core/java/android/content/SyncManager.java b/core/java/android/content/SyncManager.java
index b2909b3..3c4e545 100644
--- a/core/java/android/content/SyncManager.java
+++ b/core/java/android/content/SyncManager.java
@@ -24,6 +24,7 @@
import android.accounts.Account;
import android.accounts.AccountManager;
import android.accounts.OnAccountsUpdateListener;
+import android.app.ActivityManager;
import android.app.AlarmManager;
import android.app.Notification;
import android.app.NotificationManager;
@@ -86,8 +87,13 @@
private static final long MAX_TIME_PER_SYNC;
static {
- MAX_SIMULTANEOUS_INITIALIZATION_SYNCS = SystemProperties.getInt("sync.max_init_syncs", 5);
- MAX_SIMULTANEOUS_REGULAR_SYNCS = SystemProperties.getInt("sync.max_regular_syncs", 2);
+ final boolean isLargeRAM = ActivityManager.isLargeRAM();
+ int defaultMaxInitSyncs = isLargeRAM ? 5 : 2;
+ int defaultMaxRegularSyncs = isLargeRAM ? 2 : 1;
+ MAX_SIMULTANEOUS_INITIALIZATION_SYNCS =
+ SystemProperties.getInt("sync.max_init_syncs", defaultMaxInitSyncs);
+ MAX_SIMULTANEOUS_REGULAR_SYNCS =
+ SystemProperties.getInt("sync.max_regular_syncs", defaultMaxRegularSyncs);
LOCAL_SYNC_DELAY =
SystemProperties.getLong("sync.local_sync_delay", 30 * 1000 /* 30 seconds */);
MAX_TIME_PER_SYNC =
diff --git a/core/java/android/inputmethodservice/KeyboardView.java b/core/java/android/inputmethodservice/KeyboardView.java
index 5143f7f..7257521 100644
--- a/core/java/android/inputmethodservice/KeyboardView.java
+++ b/core/java/android/inputmethodservice/KeyboardView.java
@@ -31,6 +31,7 @@
import android.media.AudioManager;
import android.os.Handler;
import android.os.Message;
+import android.provider.Settings;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.view.GestureDetector;
@@ -967,8 +968,13 @@
AccessibilityEvent event = AccessibilityEvent.obtain(eventType);
onInitializeAccessibilityEvent(event);
String text = null;
- // Add text only if headset is used to avoid leaking passwords.
- if (mAudioManager.isBluetoothA2dpOn() || mAudioManager.isWiredHeadsetOn()) {
+ // This is very efficient since the properties are cached.
+ final boolean speakPassword = Settings.Secure.getInt(mContext.getContentResolver(),
+ Settings.Secure.ACCESSIBILITY_SPEAK_PASSWORD, 0) != 0;
+ // Add text only if password announcement is enabled or if headset is
+ // used to avoid leaking passwords.
+ if (speakPassword || mAudioManager.isBluetoothA2dpOn()
+ || mAudioManager.isWiredHeadsetOn()) {
switch (code) {
case Keyboard.KEYCODE_ALT:
text = mContext.getString(R.string.keyboardview_keycode_alt);
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index 15e4438..74bcc9b 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -2754,6 +2754,11 @@
"enabled_accessibility_services";
/**
+ * Whether to speak passwords while in accessibility mode.
+ */
+ public static final String ACCESSIBILITY_SPEAK_PASSWORD = "speak_password";
+
+ /**
* If injection of accessibility enhancing JavaScript scripts
* is enabled.
* <p>
@@ -4079,6 +4084,7 @@
ENABLED_ACCESSIBILITY_SERVICES,
TOUCH_EXPLORATION_ENABLED,
ACCESSIBILITY_ENABLED,
+ ACCESSIBILITY_SPEAK_PASSWORD,
TTS_USE_DEFAULTS,
TTS_DEFAULT_RATE,
TTS_DEFAULT_PITCH,
diff --git a/core/java/android/server/BluetoothAdapterStateMachine.java b/core/java/android/server/BluetoothAdapterStateMachine.java
index da7c489..f3f4174 100644
--- a/core/java/android/server/BluetoothAdapterStateMachine.java
+++ b/core/java/android/server/BluetoothAdapterStateMachine.java
@@ -175,8 +175,8 @@
switch(message.what) {
case USER_TURN_ON:
// starts turning on BT module, broadcast this out
- transitionTo(mWarmUp);
broadcastState(BluetoothAdapter.STATE_TURNING_ON);
+ transitionTo(mWarmUp);
if (prepareBluetooth()) {
// this is user request, save the setting
if ((Boolean) message.obj) {
@@ -198,8 +198,8 @@
case AIRPLANE_MODE_OFF:
if (getBluetoothPersistedSetting()) {
// starts turning on BT module, broadcast this out
- transitionTo(mWarmUp);
broadcastState(BluetoothAdapter.STATE_TURNING_ON);
+ transitionTo(mWarmUp);
if (prepareBluetooth()) {
// We will continue turn the BT on all the way to the BluetoothOn state
deferMessage(obtainMessage(TURN_ON_CONTINUE));
@@ -355,9 +355,9 @@
// let it fall to TURN_ON_CONTINUE:
//$FALL-THROUGH$
case TURN_ON_CONTINUE:
+ broadcastState(BluetoothAdapter.STATE_TURNING_ON);
mBluetoothService.switchConnectable(true);
transitionTo(mSwitching);
- broadcastState(BluetoothAdapter.STATE_TURNING_ON);
break;
case AIRPLANE_MODE_ON:
case TURN_COLD:
@@ -367,9 +367,9 @@
break;
case AIRPLANE_MODE_OFF:
if (getBluetoothPersistedSetting()) {
+ broadcastState(BluetoothAdapter.STATE_TURNING_ON);
transitionTo(mSwitching);
mBluetoothService.switchConnectable(true);
- broadcastState(BluetoothAdapter.STATE_TURNING_ON);
}
break;
case PER_PROCESS_TURN_ON:
@@ -515,8 +515,8 @@
}
//$FALL-THROUGH$ to AIRPLANE_MODE_ON
case AIRPLANE_MODE_ON:
- transitionTo(mSwitching);
broadcastState(BluetoothAdapter.STATE_TURNING_OFF);
+ transitionTo(mSwitching);
if (mBluetoothService.getAdapterConnectionState() !=
BluetoothAdapter.STATE_DISCONNECTED) {
mBluetoothService.disconnectDevices();
diff --git a/core/java/android/webkit/WebTextView.java b/core/java/android/webkit/WebTextView.java
index f18a396..3574a0d 100644
--- a/core/java/android/webkit/WebTextView.java
+++ b/core/java/android/webkit/WebTextView.java
@@ -237,7 +237,6 @@
private void growOrShrink(boolean grow) {
AbsoluteLayout.LayoutParams lp = (AbsoluteLayout.LayoutParams) getLayoutParams();
if (grow) {
- Log.i("webtextview", "grow");
lp.x -= mRingInset;
lp.y -= mRingInset;
lp.width += 2 * mRingInset;
@@ -245,7 +244,6 @@
setPadding(getPaddingLeft() + mRingInset, getPaddingTop() + mRingInset,
getPaddingRight() + mRingInset, getPaddingBottom() + mRingInset);
} else {
- Log.i("webtextview", "shrink");
lp.x += mRingInset;
lp.y += mRingInset;
lp.width -= 2 * mRingInset;
diff --git a/core/jni/android/graphics/TextLayoutCache.cpp b/core/jni/android/graphics/TextLayoutCache.cpp
index 7076e2a..510e541 100644
--- a/core/jni/android/graphics/TextLayoutCache.cpp
+++ b/core/jni/android/graphics/TextLayoutCache.cpp
@@ -368,9 +368,6 @@
// padding and fallback if we find that we are wrong.
createGlyphArrays(shaperItem, (contextCount + 2) * 2);
- // Create log clusters array
- shaperItem.log_clusters = new unsigned short[contextCount];
-
// Set the string properties
shaperItem.string = chars;
shaperItem.stringLength = contextCount;
@@ -378,7 +375,6 @@
void TextLayoutCacheValue::freeShaperItem(HB_ShaperItem& shaperItem) {
deleteGlyphArrays(shaperItem);
- delete[] shaperItem.log_clusters;
HB_FreeFace(shaperItem.face);
}
@@ -392,6 +388,7 @@
shaperItem.item.script = isRTL ? HB_Script_Arabic : HB_Script_Common;
// Shape
+ assert(shaperItem.item.length > 0); // Harfbuzz will overwrite other memory if length is 0.
while (!HB_ShapeItem(&shaperItem)) {
// We overflowed our arrays. Resize and retry.
// HB_ShapeItem fills in shaperItem.num_glyphs with the needed size.
@@ -404,6 +401,10 @@
size_t start, size_t count, size_t contextCount, int dirFlags,
Vector<jfloat>* const outAdvances, jfloat* outTotalAdvance,
Vector<jchar>* const outGlyphs) {
+ if (!count) {
+ *outTotalAdvance = 0;
+ return;
+ }
UBiDiLevel bidiReq = 0;
bool forceLTR = false;
@@ -544,6 +545,10 @@
size_t start, size_t count, bool isRTL,
Vector<jfloat>* const outAdvances, jfloat* outTotalAdvance,
Vector<jchar>* const outGlyphs) {
+ if (!count) {
+ *outTotalAdvance = 0;
+ return;
+ }
shapeRun(shaperItem, start, count, isRTL);
@@ -607,14 +612,22 @@
delete[] shaperItem.attributes;
delete[] shaperItem.advances;
delete[] shaperItem.offsets;
+ delete[] shaperItem.log_clusters;
}
void TextLayoutCacheValue::createGlyphArrays(HB_ShaperItem& shaperItem, int size) {
+ shaperItem.num_glyphs = size;
+
+ // These arrays are all indexed by glyph
shaperItem.glyphs = new HB_Glyph[size];
shaperItem.attributes = new HB_GlyphAttributes[size];
shaperItem.advances = new HB_Fixed[size];
shaperItem.offsets = new HB_FixedPoint[size];
- shaperItem.num_glyphs = size;
+
+ // Although the log_clusters array is indexed by character, Harfbuzz expects that
+ // it is big enough to hold one element per glyph. So we allocate log_clusters along
+ // with the other glyph arrays above.
+ shaperItem.log_clusters = new unsigned short[size];
}
} // namespace android
diff --git a/core/res/res/layout-sw600dp/keyguard_screen_password_landscape.xml b/core/res/res/layout-sw600dp/keyguard_screen_password_landscape.xml
index f972843..7a5bb6a 100644
--- a/core/res/res/layout-sw600dp/keyguard_screen_password_landscape.xml
+++ b/core/res/res/layout-sw600dp/keyguard_screen_password_landscape.xml
@@ -134,6 +134,7 @@
android:layout_marginTop="5dip"
android:keyBackground="@drawable/btn_keyboard_key_ics"
android:visibility="gone"
+ android:clickable="true"
/>
<!-- Emergency call button. Generally not used on tablet devices. -->
diff --git a/core/res/res/layout-sw600dp/keyguard_screen_password_portrait.xml b/core/res/res/layout-sw600dp/keyguard_screen_password_portrait.xml
index 8b65b22..6df22ca 100644
--- a/core/res/res/layout-sw600dp/keyguard_screen_password_portrait.xml
+++ b/core/res/res/layout-sw600dp/keyguard_screen_password_portrait.xml
@@ -133,6 +133,7 @@
android:background="#40000000"
android:keyBackground="@drawable/btn_keyboard_key_ics"
android:layout_marginBottom="80dip"
+ android:clickable="true"
/>
<!-- emergency call button -->
diff --git a/core/res/res/layout/keyguard_screen_password_landscape.xml b/core/res/res/layout/keyguard_screen_password_landscape.xml
index ba0c22f..e95553f 100644
--- a/core/res/res/layout/keyguard_screen_password_landscape.xml
+++ b/core/res/res/layout/keyguard_screen_password_landscape.xml
@@ -193,6 +193,7 @@
android:keyBackground="@*android:drawable/btn_keyboard_key_ics"
android:visibility="gone"
android:layout_rowSpan="7"
+ android:clickable="true"
/>
<!-- Music transport control -->
diff --git a/core/res/res/layout/keyguard_screen_password_portrait.xml b/core/res/res/layout/keyguard_screen_password_portrait.xml
index f6933c3..053acb2 100644
--- a/core/res/res/layout/keyguard_screen_password_portrait.xml
+++ b/core/res/res/layout/keyguard_screen_password_portrait.xml
@@ -157,6 +157,7 @@
android:background="#40000000"
android:keyBackground="@*android:drawable/btn_keyboard_key_ics"
android:visibility="gone"
+ android:clickable="true"
/>
<TextView
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index c8ba26a..50ea365 100755
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -2721,6 +2721,12 @@
<item quantity="other">Open Wi-Fi networks available</item>
</plurals>
+ <!-- A notification is shown when a captive portal network is detected. This is the notification's title. -->
+ <string name="wifi_available_sign_in">Sign in to Wi-Fi network</string>
+
+ <!-- A notification is shown when a captive portal network is detected. This is the notification's message. -->
+ <string name="wifi_available_sign_in_detailed"><xliff:g id="wifi_network_ssid">%1$s</xliff:g></string>
+
<!-- A notification is shown when a user's selected SSID is later disabled due to connectivity problems. This is the notification's title / ticker. -->
<string name="wifi_watchdog_network_disabled">Couldn\'t connect to Wi-Fi</string>
<!-- A notification is shown when a user's selected SSID is later disabled due to connectivity problems. The complete alert msg is: <hotspot name> + this string, i.e. "Linksys has a poor internet connection" -->
diff --git a/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/stress/WifiStressTest.java b/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/stress/WifiStressTest.java
index 0b32fde..2069789 100644
--- a/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/stress/WifiStressTest.java
+++ b/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/stress/WifiStressTest.java
@@ -63,10 +63,12 @@
private final static long WIFI_IDLE_MS = 60 * 1000;
/**
- * The delay for Wi-Fi to get into idle, after screen off + WIFI_IDEL_MS + WIFI_IDLE_DELAY
- * the Wi-Fi should be in idle mode and device should be in cellular mode.
+ * Delay after issuing wifi shutdown.
+ * The framework keep driver up for at leat 2 minutes to avoid problems
+ * that a quick shutdown could cause on wext driver and protentially
+ * on cfg based driver
*/
- private final static long WIFI_IDLE_DELAY = 3 * 1000;
+ private final static long WIFI_SHUTDOWN_DELAY = 2 * 60 * 1000;
private final static String OUTPUT_FILE = "WifiStressTestOutput.txt";
private ConnectivityManagerTestActivity mAct;
@@ -265,7 +267,7 @@
PowerManager pm =
(PowerManager)mRunner.getContext().getSystemService(Context.POWER_SERVICE);
assertFalse(pm.isScreenOn());
- sleep(WIFI_IDLE_MS, "Interruped while wait for wifi to be idle");
+ sleep(WIFI_IDLE_MS + WIFI_SHUTDOWN_DELAY, "Interruped while wait for wifi to be idle");
assertTrue("Wait for Wi-Fi to idle timeout",
mAct.waitForNetworkState(ConnectivityManager.TYPE_WIFI, State.DISCONNECTED,
6 * ConnectivityManagerTestActivity.SHORT_TIMEOUT));
@@ -273,9 +275,9 @@
// use long timeout as the pppd startup may take several retries.
assertTrue("Wait for cellular connection timeout",
mAct.waitForNetworkState(ConnectivityManager.TYPE_MOBILE, State.CONNECTED,
- ConnectivityManagerTestActivity.LONG_TIMEOUT));
+ 2 * ConnectivityManagerTestActivity.LONG_TIMEOUT));
}
- sleep(mWifiSleepTime + WIFI_IDLE_DELAY, "Interrupted while device is in sleep mode");
+ sleep(mWifiSleepTime, "Interrupted while device is in sleep mode");
// Verify the wi-fi is still off and data connection is on
assertEquals("Wi-Fi is reconnected", State.DISCONNECTED,
mAct.mCM.getNetworkInfo(ConnectivityManager.TYPE_WIFI).getState());
diff --git a/packages/SettingsProvider/res/values/defaults.xml b/packages/SettingsProvider/res/values/defaults.xml
index 7a98615..1ebed1f 100644
--- a/packages/SettingsProvider/res/values/defaults.xml
+++ b/packages/SettingsProvider/res/values/defaults.xml
@@ -80,6 +80,9 @@
<!-- Default for Settings.Secure.ACCESSIBILITY_SCRIPT_INJECTION -->
<bool name="def_accessibility_script_injection">false</bool>
+ <!-- Default for Settings.Secure.ACCESSIBILITY_SPEAK_PASSWORD -->
+ <bool name="def_accessibility_speak_password">false</bool>
+
<!-- Default for Settings.Secure.ACCESSIBILITY_WEB_CONTENT_KEY_BINDINGS -->
<string name="def_accessibility_web_content_key_bindings" translatable="false">
<!-- DPAD/Trackball UP - traverse previous on current axis and send an event. -->
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
index 080d345..6258652 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
@@ -63,7 +63,7 @@
// database gets upgraded properly. At a minimum, please confirm that 'upgradeVersion'
// is properly propagated through your change. Not doing so will result in a loss of user
// settings.
- private static final int DATABASE_VERSION = 71;
+ private static final int DATABASE_VERSION = 72;
private Context mContext;
@@ -952,6 +952,22 @@
upgradeVersion = 71;
}
+ if (upgradeVersion == 71) {
+ // New setting to specify whether to speak passwords in accessibility mode.
+ db.beginTransaction();
+ SQLiteStatement stmt = null;
+ try {
+ stmt = db.compileStatement("INSERT INTO secure(name,value)"
+ + " VALUES(?,?);");
+ loadBooleanSetting(stmt, Settings.Secure.ACCESSIBILITY_SPEAK_PASSWORD,
+ R.bool.def_accessibility_speak_password);
+ } finally {
+ db.endTransaction();
+ if (stmt != null) stmt.close();
+ }
+ upgradeVersion = 72;
+ }
+
// *** Remember to update DATABASE_VERSION above!
if (upgradeVersion != currentVersion) {
@@ -1151,8 +1167,7 @@
intent.setComponent(cn);
title = info.loadLabel(packageManager).toString();
} else if (category != null) {
- intent = new Intent(Intent.ACTION_MAIN, null);
- intent.addCategory(category);
+ intent = Intent.makeMainSelectorActivity(Intent.ACTION_MAIN, category);
title = "";
} else {
Log.w(TAG, "Unable to add bookmark for shortcut " + shortcutStr
@@ -1490,6 +1505,9 @@
loadBooleanSetting(stmt, Settings.Secure.TOUCH_EXPLORATION_ENABLED,
R.bool.def_touch_exploration_enabled);
+
+ loadBooleanSetting(stmt, Settings.Secure.ACCESSIBILITY_SPEAK_PASSWORD,
+ R.bool.def_accessibility_speak_password);
} finally {
if (stmt != null) stmt.close();
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
index c69a145..3c9d12c 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -136,7 +136,7 @@
BatteryController mBatteryController;
LocationController mLocationController;
NetworkController mNetworkController;
-
+
int mNaturalBarHeight = -1;
int mIconSize = -1;
int mIconHPadding = -1;
@@ -168,7 +168,7 @@
// drag bar
CloseDragHandle mCloseView;
-
+
// all notifications
NotificationData mNotificationData = new NotificationData();
NotificationRowLayout mPile;
@@ -298,7 +298,7 @@
try {
boolean showNav = mWindowManager.hasNavigationBar();
if (showNav) {
- mNavigationBarView =
+ mNavigationBarView =
(NavigationBarView) View.inflate(context, R.layout.navigation_bar, null);
mNavigationBarView.setDisabledFlags(mDisabled);
@@ -352,11 +352,11 @@
mBatteryController = new BatteryController(mContext);
mBatteryController.addIconView((ImageView)sb.findViewById(R.id.battery));
mNetworkController = new NetworkController(mContext);
- final SignalClusterView signalCluster =
+ final SignalClusterView signalCluster =
(SignalClusterView)sb.findViewById(R.id.signal_cluster);
mNetworkController.addSignalCluster(signalCluster);
signalCluster.setNetworkController(mNetworkController);
-// final ImageView wimaxRSSI =
+// final ImageView wimaxRSSI =
// (ImageView)sb.findViewById(R.id.wimax_signal);
// if (wimaxRSSI != null) {
// mNetworkController.addWimaxIconView(wimaxRSSI);
@@ -973,7 +973,7 @@
} catch (NameNotFoundException ex) {
Slog.e(TAG, "Failed looking up ApplicationInfo for " + sbn.pkg, ex);
}
- if (version > 0 && version < Build.VERSION_CODES.HONEYCOMB) {
+ if (version > 0 && version < Build.VERSION_CODES.GINGERBREAD) {
content.setBackgroundResource(R.drawable.notification_row_legacy_bg);
} else {
content.setBackgroundResource(R.drawable.notification_row_bg);
@@ -1085,8 +1085,8 @@
}
}
- if ((diff & (StatusBarManager.DISABLE_HOME
- | StatusBarManager.DISABLE_RECENT
+ if ((diff & (StatusBarManager.DISABLE_HOME
+ | StatusBarManager.DISABLE_RECENT
| StatusBarManager.DISABLE_BACK)) != 0) {
// the nav bar will take care of these
if (mNavigationBarView != null) mNavigationBarView.setDisabledFlags(state);
@@ -1204,7 +1204,7 @@
public void animateCollapse(boolean excludeRecents) {
animateCollapse(excludeRecents, 1.0f);
}
-
+
public void animateCollapse(boolean excludeRecents, float velocityMultiplier) {
if (SPEW) {
Slog.d(TAG, "animateCollapse(): mExpanded=" + mExpanded
@@ -1516,8 +1516,8 @@
}
if (CHATTY) {
- Slog.d(TAG, String.format("gesture: vraw=(%f,%f) vnorm=(%f,%f) vlinear=%f",
- mVelocityTracker.getXVelocity(),
+ Slog.d(TAG, String.format("gesture: vraw=(%f,%f) vnorm=(%f,%f) vlinear=%f",
+ mVelocityTracker.getXVelocity(),
mVelocityTracker.getYVelocity(),
xVel, yVel,
vel));
@@ -1795,7 +1795,7 @@
StatusBarIconView ic = (StatusBarIconView) mStatusIcons.getChildAt(i);
pw.println(" [" + i + "] icon=" + ic);
}
-
+
if (false) {
pw.println("see the logcat for a dump of the views we have created.");
// must happen on ui thread
@@ -1970,10 +1970,10 @@
- (mTrackingParams.height-closePos) - contentsBottom;
if (SPEW) {
- Slog.d(PhoneStatusBar.TAG,
+ Slog.d(PhoneStatusBar.TAG,
"pos=" + pos +
" trackingHeight=" + mTrackingView.getHeight() +
- " (trackingParams.height - closePos)=" +
+ " (trackingParams.height - closePos)=" +
(mTrackingParams.height - closePos) +
" contentsBottom=" + contentsBottom);
}
@@ -2048,7 +2048,7 @@
mExpandedDialog.getWindow().setAttributes(mExpandedParams);
}
if (DEBUG) {
- Slog.d(TAG, "updateExpandedSize: height=" + mExpandedParams.height + " " +
+ Slog.d(TAG, "updateExpandedSize: height=" + mExpandedParams.height + " " +
(mExpandedVisible ? "VISIBLE":"INVISIBLE"));
}
}
@@ -2188,6 +2188,11 @@
private View.OnClickListener mSettingsButtonListener = new View.OnClickListener() {
public void onClick(View v) {
+ try {
+ // Dismiss the lock screen when Settings starts.
+ ActivityManagerNative.getDefault().dismissKeyguardOnNextActivity();
+ } catch (RemoteException e) {
+ }
v.getContext().startActivity(new Intent(Settings.ACTION_SETTINGS)
.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
animateCollapse();
@@ -2237,7 +2242,7 @@
loadDimens();
}
-
+
protected void loadDimens() {
final Resources res = mContext.getResources();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/BluetoothController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/BluetoothController.java
index 903a300..603808e 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/BluetoothController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/BluetoothController.java
@@ -36,7 +36,7 @@
private int mIconId = R.drawable.stat_sys_data_bluetooth;
private int mContentDescriptionId = 0;
- private boolean mEnabled;
+ private boolean mEnabled = false;
public BluetoothController(Context context) {
mContext = context;
@@ -47,8 +47,10 @@
context.registerReceiver(this, filter);
final BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
- handleAdapterStateChange(adapter.getState());
- handleConnectionStateChange(adapter.getConnectionState());
+ if (adapter != null) {
+ handleAdapterStateChange(adapter.getState());
+ handleConnectionStateChange(adapter.getConnectionState());
+ }
refreshViews();
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java
index 757ce0c..b919aec 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java
@@ -168,7 +168,6 @@
NetworkController mNetworkController;
ViewGroup mBarContents;
- LayoutTransition mBarContentsLayoutTransition;
// hide system chrome ("lights out") support
View mShadow;
@@ -461,19 +460,6 @@
}
mBarContents = (ViewGroup) sb.findViewById(R.id.bar_contents);
- // layout transitions for the status bar's contents
- mBarContentsLayoutTransition = new LayoutTransition();
- // add/removal will fade as normal
- mBarContentsLayoutTransition.setAnimator(LayoutTransition.APPEARING,
- ObjectAnimator.ofFloat(null, "alpha", 0f, 1f));
- mBarContentsLayoutTransition.setAnimator(LayoutTransition.DISAPPEARING,
- ObjectAnimator.ofFloat(null, "alpha", 1f, 0f));
- // no animations for siblings on change: just jump into place please
- mBarContentsLayoutTransition.setAnimator(LayoutTransition.CHANGE_APPEARING, null);
- mBarContentsLayoutTransition.setAnimator(LayoutTransition.CHANGE_DISAPPEARING, null);
- // quick like bunny
- mBarContentsLayoutTransition.setDuration(250 * (DEBUG?10:1));
- mBarContents.setLayoutTransition(mBarContentsLayoutTransition);
// the whole right-hand side of the bar
mNotificationArea = sb.findViewById(R.id.notificationArea);
@@ -522,7 +508,13 @@
mMenuButton = mNavigationArea.findViewById(R.id.menu);
mRecentButton = mNavigationArea.findViewById(R.id.recent_apps);
mRecentButton.setOnClickListener(mOnClickListener);
- mNavigationArea.setLayoutTransition(mBarContentsLayoutTransition);
+
+ LayoutTransition lt = new LayoutTransition();
+ lt.setDuration(250);
+ // don't wait for these transitions; we just want icons to fade in/out, not move around
+ lt.setDuration(LayoutTransition.CHANGE_APPEARING, 0);
+ lt.setDuration(LayoutTransition.CHANGE_DISAPPEARING, 0);
+ mNavigationArea.setLayoutTransition(lt);
// no multi-touch on the nav buttons
mNavigationArea.setMotionEventSplittingEnabled(false);
@@ -1836,7 +1828,7 @@
} catch (NameNotFoundException ex) {
Slog.e(TAG, "Failed looking up ApplicationInfo for " + sbn.pkg, ex);
}
- if (version > 0 && version < Build.VERSION_CODES.HONEYCOMB) {
+ if (version > 0 && version < Build.VERSION_CODES.GINGERBREAD) {
content.setBackgroundResource(R.drawable.notification_row_legacy_bg);
} else {
content.setBackgroundResource(R.drawable.notification_row_bg);
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
index f6bf213..46463ab 100755
--- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
@@ -1638,8 +1638,7 @@
if (down && repeatCount == 0) {
String category = sApplicationLaunchKeyCategories.get(keyCode);
if (category != null) {
- Intent intent = new Intent(Intent.ACTION_MAIN);
- intent.addCategory(category);
+ Intent intent = Intent.makeMainSelectorActivity(Intent.ACTION_MAIN, category);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
try {
mContext.startActivity(intent);
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index aea31a8..e9ac3f9 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -1816,6 +1816,18 @@
return &mOutput->stream->common;
}
+uint32_t AudioFlinger::PlaybackThread::activeSleepTimeUs()
+{
+ // A2DP output latency is not due only to buffering capacity. It also reflects encoding,
+ // decoding and transfer time. So sleeping for half of the latency would likely cause
+ // underruns
+ if (audio_is_a2dp_device((audio_devices_t)mDevice)) {
+ return (uint32_t)((uint32_t)((mFrameCount * 1000) / mSampleRate) * 1000);
+ } else {
+ return (uint32_t)(mOutput->stream->get_latency(mOutput->stream) * 1000) / 2;
+ }
+}
+
// ----------------------------------------------------------------------------
AudioFlinger::MixerThread::MixerThread(const sp<AudioFlinger>& audioFlinger, AudioStreamOut* output, int id, uint32_t device)
@@ -2422,11 +2434,6 @@
return NO_ERROR;
}
-uint32_t AudioFlinger::MixerThread::activeSleepTimeUs()
-{
- return (uint32_t)(mOutput->stream->get_latency(mOutput->stream) * 1000) / 2;
-}
-
uint32_t AudioFlinger::MixerThread::idleSleepTimeUs()
{
return (uint32_t)(((mFrameCount * 1000) / mSampleRate) * 1000) / 2;
@@ -2893,7 +2900,7 @@
{
uint32_t time;
if (audio_is_linear_pcm(mFormat)) {
- time = (uint32_t)(mOutput->stream->get_latency(mOutput->stream) * 1000) / 2;
+ time = PlaybackThread::activeSleepTimeUs();
} else {
time = 10000;
}
diff --git a/services/audioflinger/AudioFlinger.h b/services/audioflinger/AudioFlinger.h
index 897bc78..6cafa7e 100644
--- a/services/audioflinger/AudioFlinger.h
+++ b/services/audioflinger/AudioFlinger.h
@@ -776,7 +776,7 @@
virtual int getTrackName_l() = 0;
virtual void deleteTrackName_l(int name) = 0;
- virtual uint32_t activeSleepTimeUs() = 0;
+ virtual uint32_t activeSleepTimeUs();
virtual uint32_t idleSleepTimeUs() = 0;
virtual uint32_t suspendSleepTimeUs() = 0;
@@ -833,7 +833,6 @@
Vector< sp<Track> > *tracksToRemove);
virtual int getTrackName_l();
virtual void deleteTrackName_l(int name);
- virtual uint32_t activeSleepTimeUs();
virtual uint32_t idleSleepTimeUs();
virtual uint32_t suspendSleepTimeUs();
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index a4d321d..df58e83 100644
--- a/services/java/com/android/server/am/ActivityManagerService.java
+++ b/services/java/com/android/server/am/ActivityManagerService.java
@@ -14419,10 +14419,16 @@
app.thread.scheduleTrimMemory(curLevel);
} catch (RemoteException e) {
}
- if (curLevel >= ComponentCallbacks2.TRIM_MEMORY_COMPLETE) {
- // For these apps we will also finish their activities
- // to help them free memory.
- mMainStack.destroyActivitiesLocked(app, false, "trim");
+ if (false) {
+ // For now we won't do this; our memory trimming seems
+ // to be good enough at this point that destroying
+ // activities causes more harm than good.
+ if (curLevel >= ComponentCallbacks2.TRIM_MEMORY_COMPLETE
+ && app != mHomeProcess && app != mPreviousProcess) {
+ // For these apps we will also finish their activities
+ // to help them free memory.
+ mMainStack.destroyActivitiesLocked(app, false, "trim");
+ }
}
}
app.trimMemoryLevel = curLevel;
diff --git a/services/java/com/android/server/am/TaskRecord.java b/services/java/com/android/server/am/TaskRecord.java
index a860763..de3129b 100644
--- a/services/java/com/android/server/am/TaskRecord.java
+++ b/services/java/com/android/server/am/TaskRecord.java
@@ -54,8 +54,17 @@
void setIntent(Intent _intent, ActivityInfo info) {
stringName = null;
-
+
if (info.targetActivity == null) {
+ if (_intent != null) {
+ // If this Intent has a selector, we want to clear it for the
+ // recent task since it is not relevant if the user later wants
+ // to re-launch the app.
+ if (_intent.getSelector() != null) {
+ _intent = new Intent(_intent);
+ _intent.setSelector(null);
+ }
+ }
intent = _intent;
realActivity = _intent != null ? _intent.getComponent() : null;
origActivity = null;
@@ -65,6 +74,7 @@
if (_intent != null) {
Intent targetIntent = new Intent(_intent);
targetIntent.setComponent(targetComponent);
+ targetIntent.setSelector(null);
intent = targetIntent;
realActivity = targetComponent;
origActivity = _intent.getComponent();
diff --git a/services/java/com/android/server/pm/PackageManagerService.java b/services/java/com/android/server/pm/PackageManagerService.java
index 7005541..6b61c47 100644
--- a/services/java/com/android/server/pm/PackageManagerService.java
+++ b/services/java/com/android/server/pm/PackageManagerService.java
@@ -2162,6 +2162,9 @@
int flags, List<ResolveInfo> query, int priority) {
// writer
synchronized (mPackages) {
+ if (intent.getSelector() != null) {
+ intent = intent.getSelector();
+ }
if (DEBUG_PREFERRED) intent.addFlags(Intent.FLAG_DEBUG_LOG_RESOLUTION);
List<PreferredActivity> prefs =
mSettings.mPreferredActivities.queryIntent(intent, resolvedType,
@@ -2242,7 +2245,13 @@
public List<ResolveInfo> queryIntentActivities(Intent intent,
String resolvedType, int flags) {
- final ComponentName comp = intent.getComponent();
+ ComponentName comp = intent.getComponent();
+ if (comp == null) {
+ if (intent.getSelector() != null) {
+ intent = intent.getSelector();
+ comp = intent.getComponent();
+ }
+ }
if (comp != null) {
final List<ResolveInfo> list = new ArrayList<ResolveInfo>(1);
final ActivityInfo ai = getActivityInfo(comp, flags);
@@ -2440,6 +2449,12 @@
public List<ResolveInfo> queryIntentReceivers(Intent intent, String resolvedType, int flags) {
ComponentName comp = intent.getComponent();
+ if (comp == null) {
+ if (intent.getSelector() != null) {
+ intent = intent.getSelector();
+ comp = intent.getComponent();
+ }
+ }
if (comp != null) {
List<ResolveInfo> list = new ArrayList<ResolveInfo>(1);
ActivityInfo ai = getReceiverInfo(comp, flags);
@@ -2478,7 +2493,13 @@
}
public List<ResolveInfo> queryIntentServices(Intent intent, String resolvedType, int flags) {
- final ComponentName comp = intent.getComponent();
+ ComponentName comp = intent.getComponent();
+ if (comp == null) {
+ if (intent.getSelector() != null) {
+ intent = intent.getSelector();
+ comp = intent.getComponent();
+ }
+ }
if (comp != null) {
final List<ResolveInfo> list = new ArrayList<ResolveInfo>(1);
final ServiceInfo si = getServiceInfo(comp, flags);
diff --git a/wifi/java/android/net/wifi/WifiWatchdogStateMachine.java b/wifi/java/android/net/wifi/WifiWatchdogStateMachine.java
index b4cbd01..f330c32 100644
--- a/wifi/java/android/net/wifi/WifiWatchdogStateMachine.java
+++ b/wifi/java/android/net/wifi/WifiWatchdogStateMachine.java
@@ -37,6 +37,7 @@
import android.provider.Settings.Secure;
import android.util.Log;
+import com.android.internal.R;
import com.android.internal.util.Protocol;
import com.android.internal.util.State;
import com.android.internal.util.StateMachine;
@@ -68,7 +69,8 @@
private static final boolean DBG = false;
private static final String TAG = "WifiWatchdogStateMachine";
- private static final String WATCHDOG_NOTIFICATION_ID = "Android.System.WifiWatchdog";
+ private static final String DISABLED_NETWORK_NOTIFICATION_ID = "WifiWatchdog.networkdisabled";
+ private static final String WALLED_GARDEN_NOTIFICATION_ID = "WifiWatchdog.walledgarden";
private static final int WIFI_SIGNAL_LEVELS = 4;
/**
@@ -185,7 +187,8 @@
*/
public boolean mDisableAPNextFailure = false;
private static boolean sWifiOnly = false;
- private boolean mNotificationShown;
+ private boolean mDisabledNotificationShown;
+ private boolean mWalledGardenNotificationShown;
public boolean mHasConnectedWifiManager = false;
/**
@@ -477,51 +480,76 @@
mLastWalledGardenCheckTime = null;
mNumCheckFailures = 0;
mBssids.clear();
- cancelNetworkNotification();
+ setDisabledNetworkNotificationVisible(false);
+ setWalledGardenNotificationVisible(false);
}
- private void popUpBrowser() {
- Uri uri = Uri.parse("http://www.google.com");
- Intent intent = new Intent(Intent.ACTION_VIEW, uri);
- intent.setFlags(Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT |
- Intent.FLAG_ACTIVITY_NEW_TASK);
- mContext.startActivity(intent);
- }
-
- private void displayDisabledNetworkNotification(String ssid) {
- Resources r = Resources.getSystem();
- CharSequence title =
- r.getText(com.android.internal.R.string.wifi_watchdog_network_disabled);
- String msg = ssid +
- r.getText(com.android.internal.R.string.wifi_watchdog_network_disabled_detailed);
-
- Notification wifiDisabledWarning = new Notification.Builder(mContext)
- .setSmallIcon(com.android.internal.R.drawable.stat_sys_warning)
- .setDefaults(Notification.DEFAULT_ALL)
- .setTicker(title)
- .setContentTitle(title)
- .setContentText(msg)
- .setContentIntent(PendingIntent.getActivity(mContext, 0,
- new Intent(WifiManager.ACTION_PICK_WIFI_NETWORK)
- .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK), 0))
- .setWhen(System.currentTimeMillis())
- .setAutoCancel(true)
- .getNotification();
-
- NotificationManager notificationManager = (NotificationManager) mContext
- .getSystemService(Context.NOTIFICATION_SERVICE);
-
- notificationManager.notify(WATCHDOG_NOTIFICATION_ID, 1, wifiDisabledWarning);
- mNotificationShown = true;
- }
-
- public void cancelNetworkNotification() {
- if (mNotificationShown) {
- NotificationManager notificationManager = (NotificationManager) mContext
- .getSystemService(Context.NOTIFICATION_SERVICE);
- notificationManager.cancel(WATCHDOG_NOTIFICATION_ID, 1);
- mNotificationShown = false;
+ private void setWalledGardenNotificationVisible(boolean visible) {
+ // If it should be hidden and it is already hidden, then noop
+ if (!visible && !mWalledGardenNotificationShown) {
+ return;
}
+
+ Resources r = Resources.getSystem();
+ NotificationManager notificationManager = (NotificationManager) mContext
+ .getSystemService(Context.NOTIFICATION_SERVICE);
+
+ if (visible) {
+ Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(mWalledGardenUrl));
+ intent.setFlags(Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT | Intent.FLAG_ACTIVITY_NEW_TASK);
+
+ CharSequence title = r.getString(R.string.wifi_available_sign_in, 0);
+ CharSequence details = r.getString(R.string.wifi_available_sign_in_detailed,
+ mConnectionInfo.getSSID());
+
+ Notification notification = new Notification();
+ notification.when = 0;
+ notification.icon = com.android.internal.R.drawable.stat_notify_wifi_in_range;
+ notification.flags = Notification.FLAG_AUTO_CANCEL;
+ notification.contentIntent = PendingIntent.getActivity(mContext, 0, intent, 0);
+ notification.tickerText = title;
+ notification.setLatestEventInfo(mContext, title, details, notification.contentIntent);
+
+ notificationManager.notify(WALLED_GARDEN_NOTIFICATION_ID, 1, notification);
+ } else {
+ notificationManager.cancel(WALLED_GARDEN_NOTIFICATION_ID, 1);
+ }
+ mWalledGardenNotificationShown = visible;
+ }
+
+ private void setDisabledNetworkNotificationVisible(boolean visible) {
+ // If it should be hidden and it is already hidden, then noop
+ if (!visible && !mDisabledNotificationShown) {
+ return;
+ }
+
+ Resources r = Resources.getSystem();
+ NotificationManager notificationManager = (NotificationManager) mContext
+ .getSystemService(Context.NOTIFICATION_SERVICE);
+
+ if (visible) {
+ CharSequence title = r.getText(R.string.wifi_watchdog_network_disabled);
+ String msg = mConnectionInfo.getSSID() +
+ r.getText(R.string.wifi_watchdog_network_disabled_detailed);
+
+ Notification wifiDisabledWarning = new Notification.Builder(mContext)
+ .setSmallIcon(R.drawable.stat_sys_warning)
+ .setDefaults(Notification.DEFAULT_ALL)
+ .setTicker(title)
+ .setContentTitle(title)
+ .setContentText(msg)
+ .setContentIntent(PendingIntent.getActivity(mContext, 0,
+ new Intent(WifiManager.ACTION_PICK_WIFI_NETWORK)
+ .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK), 0))
+ .setWhen(System.currentTimeMillis())
+ .setAutoCancel(true)
+ .getNotification();
+
+ notificationManager.notify(DISABLED_NETWORK_NOTIFICATION_ID, 1, wifiDisabledWarning);
+ } else {
+ notificationManager.cancel(DISABLED_NETWORK_NOTIFICATION_ID, 1);
+ }
+ mDisabledNotificationShown = visible;
}
class DefaultState extends State {
@@ -576,9 +604,10 @@
NetworkInfo networkInfo = (NetworkInfo)
stateChangeIntent.getParcelableExtra(WifiManager.EXTRA_NETWORK_INFO);
+ setDisabledNetworkNotificationVisible(false);
+ setWalledGardenNotificationVisible(false);
switch (networkInfo.getState()) {
case CONNECTED:
- cancelNetworkNotification();
WifiInfo wifiInfo = (WifiInfo)
stateChangeIntent.getParcelableExtra(WifiManager.EXTRA_WIFI_INFO);
if (wifiInfo == null) {
@@ -974,7 +1003,7 @@
}
mWifiManager.disableNetwork(networkId, WifiConfiguration.DISABLED_DNS_FAILURE);
if (mShowDisabledNotification && mConnectionInfo.isExplicitConnect()) {
- displayDisabledNetworkNotification(mConnectionInfo.getSSID());
+ setDisabledNetworkNotificationVisible(true);
}
transitionTo(mNotConnectedState);
} else {
@@ -1007,7 +1036,7 @@
}
return HANDLED;
}
- popUpBrowser();
+ setWalledGardenNotificationVisible(true);
transitionTo(mOnlineWatchState);
return HANDLED;
}