summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/java/android/app/ActivityManagerNative.java10
-rw-r--r--core/java/android/app/ActivityThread.java16
-rw-r--r--core/java/android/app/AssistContent.java44
-rw-r--r--core/java/android/app/AssistStructure.java40
-rw-r--r--core/java/android/app/IActivityManager.java3
-rw-r--r--core/java/android/inputmethodservice/InputMethodService.java35
-rw-r--r--core/java/android/os/Build.java12
-rw-r--r--core/java/android/os/RecoverySystem.java14
-rw-r--r--core/java/android/service/notification/ZenModeConfig.java21
-rw-r--r--core/java/android/service/voice/IVoiceInteractionSession.aidl4
-rw-r--r--core/java/android/service/voice/VoiceInteractionSession.java38
-rw-r--r--core/java/android/text/Layout.java1
-rw-r--r--core/java/android/text/TextLine.java10
-rw-r--r--core/java/android/view/ViewGroup.java17
-rw-r--r--core/java/android/view/ViewStructure.java9
-rw-r--r--core/java/android/webkit/ViewAssistStructure.java7
-rw-r--r--core/java/android/widget/Switch.java4
-rw-r--r--core/java/android/widget/TextView.java29
-rw-r--r--core/jni/Android.mk3
-rw-r--r--core/res/res/values/attrs.xml5
-rw-r--r--core/res/res/values/strings.xml4
-rwxr-xr-xcore/res/res/values/symbols.xml2
-rw-r--r--core/res/res/values/themes_material.xml22
23 files changed, 241 insertions, 109 deletions
diff --git a/core/java/android/app/ActivityManagerNative.java b/core/java/android/app/ActivityManagerNative.java
index 02e0d5b..e4def1e 100644
--- a/core/java/android/app/ActivityManagerNative.java
+++ b/core/java/android/app/ActivityManagerNative.java
@@ -2193,7 +2193,9 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM
data.enforceInterface(IActivityManager.descriptor);
IBinder token = data.readStrongBinder();
Bundle extras = data.readBundle();
- reportAssistContextExtras(token, extras);
+ AssistStructure structure = AssistStructure.CREATOR.createFromParcel(data);
+ AssistContent content = AssistContent.CREATOR.createFromParcel(data);
+ reportAssistContextExtras(token, extras, structure, content);
reply.writeNoException();
return true;
}
@@ -5359,13 +5361,15 @@ class ActivityManagerProxy implements IActivityManager
reply.recycle();
}
- public void reportAssistContextExtras(IBinder token, Bundle extras)
- throws RemoteException {
+ public void reportAssistContextExtras(IBinder token, Bundle extras, AssistStructure structure,
+ AssistContent content) throws RemoteException {
Parcel data = Parcel.obtain();
Parcel reply = Parcel.obtain();
data.writeInterfaceToken(IActivityManager.descriptor);
data.writeStrongBinder(token);
data.writeBundle(extras);
+ structure.writeToParcel(data, 0);
+ content.writeToParcel(data, 0);
mRemote.transact(REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
reply.readException();
data.recycle();
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index cb436b5..2a98b6c 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -2562,15 +2562,18 @@ public final class ActivityThread {
public void handleRequestAssistContextExtras(RequestAssistContextExtras cmd) {
Bundle data = new Bundle();
+ AssistStructure structure = null;
+ AssistContent content = new AssistContent();
ActivityClientRecord r = mActivities.get(cmd.activityToken);
if (r != null) {
r.activity.getApplication().dispatchOnProvideAssistData(r.activity, data);
r.activity.onProvideAssistData(data);
if (cmd.requestType == ActivityManager.ASSIST_CONTEXT_FULL) {
- data.putParcelable(AssistStructure.ASSIST_KEY, new AssistStructure(r.activity));
- AssistContent content = new AssistContent();
+ structure = new AssistStructure(r.activity);
Intent activityIntent = r.activity.getIntent();
- if (activityIntent != null) {
+ if (activityIntent != null && (r.window == null ||
+ (r.window.getAttributes().flags
+ & WindowManager.LayoutParams.FLAG_SECURE) == 0)) {
Intent intent = new Intent(activityIntent);
intent.setFlags(intent.getFlags() & ~(Intent.FLAG_GRANT_WRITE_URI_PERMISSION
| Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION));
@@ -2580,15 +2583,14 @@ public final class ActivityThread {
content.setIntent(new Intent());
}
r.activity.onProvideAssistContent(content);
- data.putParcelable(AssistContent.ASSIST_KEY, content);
}
}
- if (data.isEmpty()) {
- data = null;
+ if (structure == null) {
+ structure = new AssistStructure();
}
IActivityManager mgr = ActivityManagerNative.getDefault();
try {
- mgr.reportAssistContextExtras(cmd.requestToken, data);
+ mgr.reportAssistContextExtras(cmd.requestToken, data, structure, content);
} catch (RemoteException e) {
}
}
diff --git a/core/java/android/app/AssistContent.java b/core/java/android/app/AssistContent.java
index cb1a3f5..f271af1 100644
--- a/core/java/android/app/AssistContent.java
+++ b/core/java/android/app/AssistContent.java
@@ -18,6 +18,7 @@ package android.app;
import android.content.ClipData;
import android.content.Intent;
+import android.net.Uri;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
@@ -30,14 +31,17 @@ import android.os.Parcelable;
public class AssistContent implements Parcelable {
private Intent mIntent;
private ClipData mClipData;
+ private Uri mUri;
/**
+ * @hide
* Key name this data structure is stored in the Bundle generated by
* {@link Activity#onProvideAssistData}.
*/
public static final String ASSIST_KEY = "android:assist_content";
/**
+ * @hide
* Retrieve the framework-generated AssistContent that is stored within
* the Bundle filled in by {@link Activity#onProvideAssistContent}.
*/
@@ -56,6 +60,13 @@ public class AssistContent implements Parcelable {
*/
public void setIntent(Intent intent) {
mIntent = intent;
+ setWebUri(null);
+ if (intent != null && Intent.ACTION_VIEW.equals(intent.getAction())) {
+ Uri uri = intent.getData();
+ if ("http".equals(uri.getScheme()) || "https".equals(uri.getScheme())) {
+ setWebUri(uri);
+ }
+ }
}
/**
@@ -81,6 +92,30 @@ public class AssistContent implements Parcelable {
return mClipData;
}
+ /**
+ * Set a web URI associated with the current data being shown to the user.
+ * This URI could be opened in a web browser, or in the app as an
+ * {@link Intent#ACTION_VIEW} Intent, to show the same data that is currently
+ * being displayed by it. The URI here should be something that is transportable
+ * off the device into other environments to acesss the same data as is currently
+ * being shown in the app; if the app does not have such a representation, it should
+ * leave the null and only report the local intent and clip data.
+ *
+ * <p>This will be automatically populated for you from {@link #setIntent} if that Intent
+ * is an {@link Intent#ACTION_VIEW} of a web (http or https scheme) URI.</p>
+ */
+ public void setWebUri(Uri uri) {
+ mUri = uri;
+ }
+
+ /**
+ * Return the content's web URI as per {@link #setWebUri(android.net.Uri)}, or null if
+ * there is none.
+ */
+ public Uri getWebUri() {
+ return mUri;
+ }
+
AssistContent(Parcel in) {
if (in.readInt() != 0) {
mIntent = Intent.CREATOR.createFromParcel(in);
@@ -88,6 +123,9 @@ public class AssistContent implements Parcelable {
if (in.readInt() != 0) {
mClipData = ClipData.CREATOR.createFromParcel(in);
}
+ if (in.readInt() != 0) {
+ mUri = Uri.CREATOR.createFromParcel(in);
+ }
}
@Override
@@ -109,6 +147,12 @@ public class AssistContent implements Parcelable {
} else {
dest.writeInt(0);
}
+ if (mUri != null) {
+ dest.writeInt(1);
+ mUri.writeToParcel(dest, flags);
+ } else {
+ dest.writeInt(0);
+ }
}
public static final Parcelable.Creator<AssistContent> CREATOR
diff --git a/core/java/android/app/AssistStructure.java b/core/java/android/app/AssistStructure.java
index b703b0e..ca47a5e 100644
--- a/core/java/android/app/AssistStructure.java
+++ b/core/java/android/app/AssistStructure.java
@@ -42,13 +42,13 @@ import java.util.ArrayList;
/**
* Assist data automatically created by the platform's implementation
- * of {@link Activity#onProvideAssistData}. Retrieve it from the assist
- * data with {@link #getAssistStructure(android.os.Bundle)}.
+ * of {@link Activity#onProvideAssistData}.
*/
final public class AssistStructure implements Parcelable {
static final String TAG = "AssistStructure";
/**
+ * @hide
* Key name this data structure is stored in the Bundle generated by
* {@link Activity#onProvideAssistData}.
*/
@@ -607,35 +607,7 @@ final public class AssistStructure implements Parcelable {
}
@Override
- public void setTextPaint(TextPaint paint) {
- ViewNodeText t = getNodeText();
- t.mTextColor = paint.getColor();
- t.mTextBackgroundColor = paint.bgColor;
- t.mTextSize = paint.getTextSize();
- t.mTextStyle = 0;
- Typeface tf = paint.getTypeface();
- if (tf != null) {
- if (tf.isBold()) {
- t.mTextStyle |= ViewNode.TEXT_STYLE_BOLD;
- }
- if (tf.isItalic()) {
- t.mTextStyle |= ViewNode.TEXT_STYLE_ITALIC;
- }
- }
- int pflags = paint.getFlags();
- if ((pflags& Paint.FAKE_BOLD_TEXT_FLAG) != 0) {
- t.mTextStyle |= ViewNode.TEXT_STYLE_BOLD;
- }
- if ((pflags& Paint.UNDERLINE_TEXT_FLAG) != 0) {
- t.mTextStyle |= ViewNode.TEXT_STYLE_UNDERLINE;
- }
- if ((pflags& Paint.STRIKE_THRU_TEXT_FLAG) != 0) {
- t.mTextStyle |= ViewNode.TEXT_STYLE_STRIKE_THRU;
- }
- }
-
- @Override
- public void setTextStyle(int size, int fgColor, int bgColor, int style) {
+ public void setTextStyle(float size, int fgColor, int bgColor, int style) {
ViewNodeText t = getNodeText();
t.mTextColor = fgColor;
t.mTextBackgroundColor = bgColor;
@@ -741,6 +713,11 @@ final public class AssistStructure implements Parcelable {
}
}
+ AssistStructure() {
+ mHaveData = true;
+ mActivityComponent = null;
+ }
+
AssistStructure(Parcel in) {
mReceiveChannel = in.readStrongBinder();
}
@@ -811,6 +788,7 @@ final public class AssistStructure implements Parcelable {
}
/**
+ * @hide
* Retrieve the framework-generated AssistStructure that is stored within
* the Bundle filled in by {@link Activity#onProvideAssistData}.
*/
diff --git a/core/java/android/app/IActivityManager.java b/core/java/android/app/IActivityManager.java
index c42719b..0a425ae 100644
--- a/core/java/android/app/IActivityManager.java
+++ b/core/java/android/app/IActivityManager.java
@@ -433,7 +433,8 @@ public interface IActivityManager extends IInterface {
public void requestAssistContextExtras(int requestType, IResultReceiver receiver)
throws RemoteException;
- public void reportAssistContextExtras(IBinder token, Bundle extras) throws RemoteException;
+ public void reportAssistContextExtras(IBinder token, Bundle extras,
+ AssistStructure structure, AssistContent content) throws RemoteException;
public boolean launchAssistIntent(Intent intent, int requestType, String hint, int userHandle)
throws RemoteException;
diff --git a/core/java/android/inputmethodservice/InputMethodService.java b/core/java/android/inputmethodservice/InputMethodService.java
index 1b57055..81a65f8 100644
--- a/core/java/android/inputmethodservice/InputMethodService.java
+++ b/core/java/android/inputmethodservice/InputMethodService.java
@@ -306,6 +306,14 @@ public class InputMethodService extends AbstractInputMethodService {
int mStatusIcon;
int mBackDisposition;
+ /**
+ * {@code true} when the previous IME had non-empty inset at the bottom of the screen and we
+ * have not shown our own window yet. In this situation, the previous inset continues to be
+ * shown as an empty region until it is explicitly updated. Basically we can trigger the update
+ * by calling 1) {@code mWindow.show()} or 2) {@link #clearInsetOfPreviousIme()}.
+ */
+ boolean mShouldClearInsetOfPreviousIme;
+
final Insets mTmpInsets = new Insets();
final int[] mTmpLocation = new int[2];
@@ -408,6 +416,7 @@ public class InputMethodService extends AbstractInputMethodService {
mShowInputRequested = false;
mShowInputForced = false;
doHideWindow();
+ clearInsetOfPreviousIme();
if (resultReceiver != null) {
resultReceiver.send(wasVis != isInputViewShown()
? InputMethodManager.RESULT_HIDDEN
@@ -432,6 +441,7 @@ public class InputMethodService extends AbstractInputMethodService {
mWindowAdded = false;
}
}
+ clearInsetOfPreviousIme();
// If user uses hard keyboard, IME button should always be shown.
boolean showing = isInputViewShown();
mImm.setImeWindowStatus(mToken, IME_ACTIVE | (showing ? IME_VISIBLE : 0),
@@ -669,6 +679,9 @@ public class InputMethodService extends AbstractInputMethodService {
super.setTheme(mTheme);
super.onCreate();
mImm = (InputMethodManager)getSystemService(INPUT_METHOD_SERVICE);
+ // If the previous IME has occupied non-empty inset in the screen, we need to decide whether
+ // we continue to use the same size of the inset or update it
+ mShouldClearInsetOfPreviousIme = (mImm.getInputMethodWindowVisibleHeight() > 0);
mInflater = (LayoutInflater)getSystemService(
Context.LAYOUT_INFLATER_SERVICE);
mWindow = new SoftInputWindow(this, "InputMethod", mTheme, null, null, mDispatcherState,
@@ -1494,6 +1507,9 @@ public class InputMethodService extends AbstractInputMethodService {
if (DEBUG) Log.v(TAG, "showWindow: showing!");
onWindowShown();
mWindow.show();
+ // Put here rather than in onWindowShown() in case people forget to call
+ // super.onWindowShown().
+ mShouldClearInsetOfPreviousIme = false;
}
}
@@ -1540,7 +1556,23 @@ public class InputMethodService extends AbstractInputMethodService {
public void onWindowHidden() {
// Intentionally empty
}
-
+
+ /**
+ * Reset the inset occupied the previous IME when and only when
+ * {@link #mShouldClearInsetOfPreviousIme} is {@code true}.
+ */
+ private void clearInsetOfPreviousIme() {
+ if (DEBUG) Log.v(TAG, "clearInsetOfPreviousIme() "
+ + " mShouldClearInsetOfPreviousIme=" + mShouldClearInsetOfPreviousIme);
+ if (!mShouldClearInsetOfPreviousIme || mWindow == null) return;
+ // We do not call onWindowShown() and onWindowHidden() so as not to make the IME author
+ // confused.
+ // TODO: Find out a better way which has less side-effect.
+ mWindow.show();
+ mWindow.hide();
+ mShouldClearInsetOfPreviousIme = false;
+ }
+
/**
* Called when a new client has bound to the input method. This
* may be followed by a series of {@link #onStartInput(EditorInfo, boolean)}
@@ -2428,5 +2460,6 @@ public class InputMethodService extends AbstractInputMethodService {
+ " visibleTopInsets=" + mTmpInsets.visibleTopInsets
+ " touchableInsets=" + mTmpInsets.touchableInsets
+ " touchableRegion=" + mTmpInsets.touchableRegion);
+ p.println(" mShouldClearInsetOfPreviousIme=" + mShouldClearInsetOfPreviousIme);
}
}
diff --git a/core/java/android/os/Build.java b/core/java/android/os/Build.java
index 50eed3e..dfd523a 100644
--- a/core/java/android/os/Build.java
+++ b/core/java/android/os/Build.java
@@ -685,6 +685,8 @@ public class Build {
final String bootimage = SystemProperties.get("ro.bootimage.build.fingerprint");
final String requiredBootloader = SystemProperties.get("ro.build.expect.bootloader");
final String currentBootloader = SystemProperties.get("ro.bootloader");
+ final String requiredRecovery = SystemProperties.get("ro.expect.recovery_id");
+ final String currentRecovery = SystemProperties.get("ro.recovery_id");
final String requiredRadio = SystemProperties.get("ro.build.expect.baseband");
final String currentRadio = SystemProperties.get("gsm.version.baseband");
@@ -701,7 +703,6 @@ public class Build {
}
}
- /* TODO: Figure out issue with checks failing
if (!TextUtils.isEmpty(bootimage)) {
if (!Objects.equals(system, bootimage)) {
Slog.e(TAG, "Mismatched fingerprints; system reported " + system
@@ -718,6 +719,15 @@ public class Build {
}
}
+ if (!TextUtils.isEmpty(requiredRecovery)) {
+ if (!Objects.equals(currentRecovery, requiredRecovery)) {
+ Slog.e(TAG, "Mismatched recovery version: build requires " + requiredRecovery
+ + " but runtime reports " + currentRecovery);
+ return false;
+ }
+ }
+
+ /* TODO: uncomment when new bootloader lands b/20860620
if (!TextUtils.isEmpty(requiredRadio)) {
if (!Objects.equals(currentRadio, requiredRadio)) {
Slog.e(TAG, "Mismatched radio version: build requires " + requiredRadio
diff --git a/core/java/android/os/RecoverySystem.java b/core/java/android/os/RecoverySystem.java
index 4aeab49..0c79094 100644
--- a/core/java/android/os/RecoverySystem.java
+++ b/core/java/android/os/RecoverySystem.java
@@ -71,6 +71,7 @@ public class RecoverySystem {
/** Used to communicate with recovery. See bootable/recovery/recovery.c. */
private static File RECOVERY_DIR = new File("/cache/recovery");
private static File COMMAND_FILE = new File(RECOVERY_DIR, "command");
+ private static File UNCRYPT_FILE = new File(RECOVERY_DIR, "uncrypt_file");
private static File LOG_FILE = new File(RECOVERY_DIR, "log");
private static String LAST_PREFIX = "last_";
@@ -333,8 +334,21 @@ public class RecoverySystem {
public static void installPackage(Context context, File packageFile)
throws IOException {
String filename = packageFile.getCanonicalPath();
+
+ FileWriter uncryptFile = new FileWriter(UNCRYPT_FILE);
+ try {
+ uncryptFile.write(filename + "\n");
+ } finally {
+ uncryptFile.close();
+ }
Log.w(TAG, "!!! REBOOTING TO INSTALL " + filename + " !!!");
+ // If the package is on the /data partition, write the block map file
+ // into COMMAND_FILE instead.
+ if (filename.startsWith("/data/")) {
+ filename = "@/cache/recovery/block.map";
+ }
+
final String filenameArg = "--update_package=" + filename;
final String localeArg = "--locale=" + Locale.getDefault().toString();
bootCommand(context, filenameArg, localeArg);
diff --git a/core/java/android/service/notification/ZenModeConfig.java b/core/java/android/service/notification/ZenModeConfig.java
index 1da46d0..db19f7a 100644
--- a/core/java/android/service/notification/ZenModeConfig.java
+++ b/core/java/android/service/notification/ZenModeConfig.java
@@ -410,10 +410,10 @@ public class ZenModeConfig implements Parcelable {
rt.allowMessagesFrom = DEFAULT_SOURCE;
}
} else if (MANUAL_TAG.equals(tag)) {
- rt.manualRule = readRuleXml(parser, false /*conditionRequired*/);
+ rt.manualRule = readRuleXml(parser);
} else if (AUTOMATIC_TAG.equals(tag)) {
final String id = parser.getAttributeValue(null, RULE_ATT_ID);
- final ZenRule automaticRule = readRuleXml(parser, true /*conditionRequired*/);
+ final ZenRule automaticRule = readRuleXml(parser);
if (id != null && automaticRule != null) {
rt.automaticRules.put(id, automaticRule);
}
@@ -455,7 +455,7 @@ public class ZenModeConfig implements Parcelable {
out.endTag(null, ZEN_TAG);
}
- public static ZenRule readRuleXml(XmlPullParser parser, boolean conditionRequired) {
+ public static ZenRule readRuleXml(XmlPullParser parser) {
final ZenRule rt = new ZenRule();
rt.enabled = safeBoolean(parser, RULE_ATT_ENABLED, true);
rt.snoozing = safeBoolean(parser, RULE_ATT_SNOOZING, false);
@@ -801,7 +801,7 @@ public class ZenModeConfig implements Parcelable {
.authority(SYSTEM_AUTHORITY)
.appendPath(EVENT_PATH)
.appendQueryParameter("userId", Long.toString(event.userId))
- .appendQueryParameter("calendar", Long.toString(event.calendar))
+ .appendQueryParameter("calendar", event.calendar != null ? event.calendar : "")
.appendQueryParameter("reply", Integer.toString(event.reply))
.build();
}
@@ -819,21 +819,21 @@ public class ZenModeConfig implements Parcelable {
if (!isEvent) return null;
final EventInfo rt = new EventInfo();
rt.userId = tryParseInt(conditionId.getQueryParameter("userId"), UserHandle.USER_NULL);
- rt.calendar = tryParseLong(conditionId.getQueryParameter("calendar"),
- EventInfo.ANY_CALENDAR);
+ rt.calendar = conditionId.getQueryParameter("calendar");
+ if (TextUtils.isEmpty(rt.calendar) || tryParseLong(rt.calendar, -1L) != -1L) {
+ rt.calendar = null;
+ }
rt.reply = tryParseInt(conditionId.getQueryParameter("reply"), 0);
return rt;
}
public static class EventInfo {
- public static final long ANY_CALENDAR = 0;
-
public static final int REPLY_ANY_EXCEPT_NO = 0;
public static final int REPLY_YES_OR_MAYBE = 1;
public static final int REPLY_YES = 2;
public int userId = UserHandle.USER_NULL; // USER_NULL = unspecified - use current user
- public long calendar = ANY_CALENDAR; // CalendarContract.Calendars._ID, or ANY_CALENDAR
+ public String calendar; // CalendarContract.Calendars.OWNER_ACCOUNT, or null for any
public int reply;
@Override
@@ -846,7 +846,7 @@ public class ZenModeConfig implements Parcelable {
if (!(o instanceof EventInfo)) return false;
final EventInfo other = (EventInfo) o;
return userId == other.userId
- && calendar == other.calendar
+ && Objects.equals(calendar, other.calendar)
&& reply == other.reply;
}
@@ -860,7 +860,6 @@ public class ZenModeConfig implements Parcelable {
public static int resolveUserId(int userId) {
return userId == UserHandle.USER_NULL ? ActivityManager.getCurrentUser() : userId;
-
}
}
diff --git a/core/java/android/service/voice/IVoiceInteractionSession.aidl b/core/java/android/service/voice/IVoiceInteractionSession.aidl
index 7c90261..894edac 100644
--- a/core/java/android/service/voice/IVoiceInteractionSession.aidl
+++ b/core/java/android/service/voice/IVoiceInteractionSession.aidl
@@ -16,6 +16,8 @@
package android.service.voice;
+import android.app.AssistContent;
+import android.app.AssistStructure;
import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Bundle;
@@ -28,7 +30,7 @@ import com.android.internal.app.IVoiceInteractionSessionShowCallback;
oneway interface IVoiceInteractionSession {
void show(in Bundle sessionArgs, int flags, IVoiceInteractionSessionShowCallback showCallback);
void hide();
- void handleAssist(in Bundle assistData);
+ void handleAssist(in Bundle assistData, in AssistStructure structure, in AssistContent content);
void handleScreenshot(in Bitmap screenshot);
void taskStarted(in Intent intent, int taskId);
void taskFinished(in Intent intent, int taskId);
diff --git a/core/java/android/service/voice/VoiceInteractionSession.java b/core/java/android/service/voice/VoiceInteractionSession.java
index f122d10..f09b6a2 100644
--- a/core/java/android/service/voice/VoiceInteractionSession.java
+++ b/core/java/android/service/voice/VoiceInteractionSession.java
@@ -16,6 +16,7 @@
package android.service.voice;
+import android.app.AssistContent;
import android.app.AssistStructure;
import android.app.Dialog;
import android.app.Instrumentation;
@@ -180,21 +181,16 @@ public abstract class VoiceInteractionSession implements KeyEvent.Callback,
}
@Override
- public void handleAssist(Bundle assistBundle) {
+ public void handleAssist(Bundle data, AssistStructure structure,
+ AssistContent content) {
// We want to pre-warm the AssistStructure before handing it off to the main
// thread. There is a strong argument to be made that it should be handed
// through as a separate param rather than part of the assistBundle.
- if (assistBundle != null) {
- Bundle assistContext = assistBundle.getBundle(Intent.EXTRA_ASSIST_CONTEXT);
- if (assistContext != null) {
- AssistStructure as = AssistStructure.getAssistStructure(assistContext);
- if (as != null) {
- as.ensureData();
- }
- }
+ if (structure != null) {
+ structure.ensureData();
}
- mHandlerCaller.sendMessage(mHandlerCaller.obtainMessageO(MSG_HANDLE_ASSIST,
- assistBundle));
+ mHandlerCaller.sendMessage(mHandlerCaller.obtainMessageOOO(MSG_HANDLE_ASSIST,
+ data, structure, content));
}
@Override
@@ -422,8 +418,11 @@ public abstract class VoiceInteractionSession implements KeyEvent.Callback,
doDestroy();
break;
case MSG_HANDLE_ASSIST:
- if (DEBUG) Log.d(TAG, "onHandleAssist: " + msg.obj);
- onHandleAssist((Bundle) msg.obj);
+ args = (SomeArgs)msg.obj;
+ if (DEBUG) Log.d(TAG, "onHandleAssist: data=" + args.arg1
+ + " structure=" + args.arg2 + " content=" + args.arg3);
+ onHandleAssist((Bundle) args.arg1, (AssistStructure) args.arg2,
+ (AssistContent) args.arg3);
break;
case MSG_HANDLE_SCREENSHOT:
if (DEBUG) Log.d(TAG, "onHandleScreenshot: " + msg.obj);
@@ -817,9 +816,22 @@ public abstract class VoiceInteractionSession implements KeyEvent.Callback,
}
+ /** @hide */
public void onHandleAssist(Bundle assistBundle) {
}
+ public void onHandleAssist(Bundle data, AssistStructure structure, AssistContent content) {
+ if (data != null) {
+ Bundle assistContext = data.getBundle(Intent.EXTRA_ASSIST_CONTEXT);
+ if (assistContext != null) {
+ assistContext.putParcelable(AssistStructure.ASSIST_KEY, structure);
+ assistContext.putParcelable(AssistContent.ASSIST_KEY, content);
+ data.putBundle(Intent.EXTRA_ASSIST_CONTEXT, assistContext);
+ }
+ }
+ onHandleAssist(data);
+ }
+
/** @hide */
public void onHandleScreenshot(Bitmap screenshot) {
}
diff --git a/core/java/android/text/Layout.java b/core/java/android/text/Layout.java
index f176240..f7027f9 100644
--- a/core/java/android/text/Layout.java
+++ b/core/java/android/text/Layout.java
@@ -1121,6 +1121,7 @@ public abstract class Layout {
* closest to the specified horizontal position.
*/
public int getOffsetForHorizontal(int line, float horiz) {
+ // TODO: use Paint.getOffsetForAdvance to avoid binary search
int max = getLineEnd(line) - 1;
int min = getLineStart(line);
Directions dirs = getLineDirections(line);
diff --git a/core/java/android/text/TextLine.java b/core/java/android/text/TextLine.java
index 479242c..605b91d 100644
--- a/core/java/android/text/TextLine.java
+++ b/core/java/android/text/TextLine.java
@@ -739,16 +739,14 @@ class TextLine {
float ret = 0;
- int contextLen = contextEnd - contextStart;
if (needWidth || (c != null && (wp.bgColor != 0 || wp.underlineColor != 0 || runIsRtl))) {
if (mCharsValid) {
- ret = wp.getTextRunAdvances(mChars, start, runLen,
- contextStart, contextLen, runIsRtl, null, 0);
+ ret = wp.getRunAdvance(mChars, start, contextEnd, contextStart, contextEnd,
+ runIsRtl, end);
} else {
int delta = mStart;
- ret = wp.getTextRunAdvances(mText, delta + start,
- delta + end, delta + contextStart, delta + contextEnd,
- runIsRtl, null, 0);
+ ret = wp.getRunAdvance(mText, delta + start, delta + contextEnd,
+ delta + contextStart, delta + contextEnd, runIsRtl, delta + end);
}
}
diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java
index a7e739d..59f6d9d 100644
--- a/core/java/android/view/ViewGroup.java
+++ b/core/java/android/view/ViewGroup.java
@@ -3602,14 +3602,14 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
}
/**
- * Sets whether this ViewGroup will clip its children to its padding, if
- * padding is present.
+ * Sets whether this ViewGroup will clip its children to its padding and resize (but not
+ * clip) any EdgeEffect to the padded region, if padding is present.
* <p>
* By default, children are clipped to the padding of their parent
- * Viewgroup. This clipping behavior is only enabled if padding is non-zero.
+ * ViewGroup. This clipping behavior is only enabled if padding is non-zero.
*
- * @param clipToPadding true to clip children to the padding of the
- * group, false otherwise
+ * @param clipToPadding true to clip children to the padding of the group, and resize (but
+ * not clip) any EdgeEffect to the padded region. False otherwise.
* @attr ref android.R.styleable#ViewGroup_clipToPadding
*/
public void setClipToPadding(boolean clipToPadding) {
@@ -3620,13 +3620,14 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
}
/**
- * Returns whether this ViewGroup will clip its children to its padding, if
- * padding is present.
+ * Returns whether this ViewGroup will clip its children to its padding, and resize (but
+ * not clip) any EdgeEffect to the padded region, if padding is present.
* <p>
* By default, children are clipped to the padding of their parent
* Viewgroup. This clipping behavior is only enabled if padding is non-zero.
*
- * @return true if this ViewGroup clips children to its padding, false otherwise
+ * @return true if this ViewGroup clips children to its padding and resizes (but doesn't
+ * clip) any EdgeEffect to the padded region, false otherwise.
*
* @attr ref android.R.styleable#ViewGroup_clipToPadding
*/
diff --git a/core/java/android/view/ViewStructure.java b/core/java/android/view/ViewStructure.java
index 5c8b023..886547a 100644
--- a/core/java/android/view/ViewStructure.java
+++ b/core/java/android/view/ViewStructure.java
@@ -145,13 +145,6 @@ public abstract class ViewStructure {
public abstract void setText(CharSequence text, int selectionStart, int selectionEnd);
/**
- * Set default global style of the text previously set with
- * {@link #setText}, derived from the given TextPaint object. Size, foreground color,
- * background color, and style information will be extracted from the paint.
- */
- public abstract void setTextPaint(TextPaint paint);
-
- /**
* Explicitly set default global style information for text that was previously set with
* {@link #setText}.
*
@@ -160,7 +153,7 @@ public abstract class ViewStructure {
* @param bgColor The background color, packed as 0xAARRGGBB.
* @param style Style flags, as defined by {@link android.app.AssistStructure.ViewNode}.
*/
- public abstract void setTextStyle(int size, int fgColor, int bgColor, int style);
+ public abstract void setTextStyle(float size, int fgColor, int bgColor, int style);
/**
* Set optional hint text associated with this view; this is for example the text that is
diff --git a/core/java/android/webkit/ViewAssistStructure.java b/core/java/android/webkit/ViewAssistStructure.java
index bbaceee..afa5ab8 100644
--- a/core/java/android/webkit/ViewAssistStructure.java
+++ b/core/java/android/webkit/ViewAssistStructure.java
@@ -132,12 +132,7 @@ public class ViewAssistStructure extends android.view.ViewAssistStructure {
}
@Override
- public void setTextPaint(TextPaint paint) {
- mV.setTextPaint(paint);
- }
-
- @Override
- public void setTextStyle(int size, int fgColor, int bgColor, int style) {
+ public void setTextStyle(float size, int fgColor, int bgColor, int style) {
mV.setTextStyle(size, fgColor, bgColor, style);
}
diff --git a/core/java/android/widget/Switch.java b/core/java/android/widget/Switch.java
index f42959f..49226cd 100644
--- a/core/java/android/widget/Switch.java
+++ b/core/java/android/widget/Switch.java
@@ -1374,7 +1374,9 @@ public class Switch extends CompoundButton {
newText.append(oldText).append(' ').append(switchText);
structure.setText(newText);
}
- structure.setTextPaint(mTextPaint);
+ // The style of the label text is provided via the base TextView class. This is more
+ // relevant than the style of the (optional) on/off text on the switch button itself,
+ // so ignore the size/color/style stored this.mTextPaint.
}
}
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index 9de7778..15d796c 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -25,6 +25,7 @@ import android.annotation.StringRes;
import android.annotation.StyleRes;
import android.annotation.XmlRes;
import android.app.Activity;
+import android.app.AssistStructure;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
@@ -8785,7 +8786,33 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
final boolean isPassword = hasPasswordTransformationMethod();
if (!isPassword) {
structure.setText(getText(), getSelectionStart(), getSelectionEnd());
- structure.setTextPaint(mTextPaint);
+
+ // Extract style information that applies to the TextView as a whole.
+ int style = 0;
+ int typefaceStyle = getTypefaceStyle();
+ if ((typefaceStyle & Typeface.BOLD) != 0) {
+ style |= AssistStructure.ViewNode.TEXT_STYLE_BOLD;
+ }
+ if ((typefaceStyle & Typeface.ITALIC) != 0) {
+ style |= AssistStructure.ViewNode.TEXT_STYLE_ITALIC;
+ }
+
+ // Global styles can also be set via TextView.setPaintFlags().
+ int paintFlags = mTextPaint.getFlags();
+ if ((paintFlags & Paint.FAKE_BOLD_TEXT_FLAG) != 0) {
+ style |= AssistStructure.ViewNode.TEXT_STYLE_BOLD;
+ }
+ if ((paintFlags & Paint.UNDERLINE_TEXT_FLAG) != 0) {
+ style |= AssistStructure.ViewNode.TEXT_STYLE_UNDERLINE;
+ }
+ if ((paintFlags & Paint.STRIKE_THRU_TEXT_FLAG) != 0) {
+ style |= AssistStructure.ViewNode.TEXT_STYLE_STRIKE_THRU;
+ }
+
+ // TextView does not have its own text background color. A background is either part
+ // of the View (and can be any drawable) or a BackgroundColorSpan inside the text.
+ structure.setTextStyle(getTextSize(), getCurrentTextColor(),
+ AssistStructure.ViewNode.TEXT_COLOR_UNDEFINED /* bgColor */, style);
}
structure.setHint(getHint());
}
diff --git a/core/jni/Android.mk b/core/jni/Android.mk
index 5448214..40fee2c 100644
--- a/core/jni/Android.mk
+++ b/core/jni/Android.mk
@@ -257,7 +257,8 @@ LOCAL_MODULE:= libandroid_runtime
# -Wno-unknown-pragmas: necessary for Clang as the GL bindings need to turn
# off a GCC warning that Clang doesn't know.
-LOCAL_CFLAGS += -Wall -Werror -Wunused -Wunreachable-code -Wno-unknown-pragmas
+LOCAL_CFLAGS += -Wall -Werror -Wno-error=deprecated-declarations -Wunused -Wunreachable-code \
+ -Wno-unknown-pragmas
# -Wno-c++11-extensions: Clang warns about Skia using the C++11 override keyword, but this project
# is not being compiled with that level. Remove once this has changed.
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index 312ec04..a65c5c1 100644
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -2771,8 +2771,9 @@
to allow the children to draw outside of their bounds. The default value of
this property is true. -->
<attr name="clipChildren" format="boolean" />
- <!-- Defines whether the ViewGroup will clip its children to its padding, if
- padding is not zero. This property is set to true by default. -->
+ <!-- Defines whether the ViewGroup will clip its children and resize (but not clip) any
+ EdgeEffect to its padding, if padding is not zero. This property is set to true by
+ default. -->
<attr name="clipToPadding" format="boolean" />
<!-- Defines the layout animation to use the first time the ViewGroup is laid out.
Layout animations can also be started manually after the first layout. -->
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index 1a76264..d9801ef 100644
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -413,6 +413,10 @@
<!-- Spoken description for ringer normal option. [CHAR LIMIT=NONE] -->
<string name="silent_mode_ring">Ringer on</string>
+ <!-- Reboot to Recovery Progress Dialog. This is shown before it reboots to recovery. -->
+ <string name="reboot_to_recovery_title">Prepare for update</string>
+ <string name="reboot_to_recovery_progress">Processing the update package\u2026</string>
+
<!-- Shutdown Progress Dialog. This is shown if the user chooses to power off the phone. -->
<string name="shutdown_progress">Shutting down\u2026</string>
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index e3033e7..ff3801f 100755
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -815,6 +815,8 @@
<java-symbol type="string" name="mobile_provisioning_url" />
<java-symbol type="string" name="mobile_redirected_provisioning_url" />
<java-symbol type="string" name="quick_contacts_not_available" />
+ <java-symbol type="string" name="reboot_to_recovery_progress" />
+ <java-symbol type="string" name="reboot_to_recovery_title" />
<java-symbol type="string" name="reboot_safemode_confirm" />
<java-symbol type="string" name="reboot_safemode_title" />
<java-symbol type="string" name="relationTypeAssistant" />
diff --git a/core/res/res/values/themes_material.xml b/core/res/res/values/themes_material.xml
index f01e3f8..9f3668d 100644
--- a/core/res/res/values/themes_material.xml
+++ b/core/res/res/values/themes_material.xml
@@ -141,6 +141,7 @@ please see themes_device_defaults.xml.
<item name="expandableListPreferredItemIndicatorRight">0dip</item>
<item name="expandableListPreferredChildIndicatorLeft">?attr/expandableListPreferredItemIndicatorLeft</item>
<item name="expandableListPreferredChildIndicatorRight">?attr/expandableListPreferredItemIndicatorRight</item>
+
<item name="findOnPageNextDrawable">@drawable/ic_find_next_material</item>
<item name="findOnPagePreviousDrawable">@drawable/ic_find_previous_material</item>
@@ -160,8 +161,6 @@ please see themes_device_defaults.xml.
<item name="windowTitleStyle">@style/WindowTitle.Material</item>
<item name="windowTitleSize">@dimen/action_bar_default_height_material</item>
<item name="windowTitleBackgroundStyle">@style/WindowTitleBackground.Material</item>
- <item name="windowContentTransitions">false</item>
- <item name="windowActivityTransitions">true</item>
<item name="windowAnimationStyle">@style/Animation.Material.Activity</item>
<item name="windowSoftInputMode">stateUnspecified|adjustUnspecified</item>
<item name="windowActionBar">true</item>
@@ -173,6 +172,8 @@ please see themes_device_defaults.xml.
<item name="windowEnterTransition">@transition/fade</item>
<item name="windowSharedElementEnterTransition">@transition/move</item>
<item name="windowSharedElementExitTransition">@transition/move</item>
+ <item name="windowContentTransitions">false</item>
+ <item name="windowActivityTransitions">true</item>
<!-- Dialog attributes -->
<item name="dialogTheme">@style/ThemeOverlay.Material.Dialog</item>
@@ -305,6 +306,9 @@ please see themes_device_defaults.xml.
<item name="detailsElementBackground">?attr/colorBackground</item>
<item name="fingerprintDrawable">@drawable/ic_fingerprint_dark</item>
+ <!-- PreferenceFrameLayout attributes -->
+ <item name="preferenceFrameLayoutStyle">@style/Widget.Material.PreferenceFrameLayout</item>
+
<!-- Search widget styles -->
<item name="searchWidgetCorpusItemBackground">@color/search_widget_corpus_item_background</item>
@@ -351,9 +355,6 @@ please see themes_device_defaults.xml.
<item name="searchViewStyle">@style/Widget.Material.SearchView</item>
<item name="searchDialogTheme">@style/Theme.Material.SearchBar</item>
- <!-- PreferenceFrameLayout attributes -->
- <item name="preferenceFrameLayoutStyle">@style/Widget.Material.PreferenceFrameLayout</item>
-
<!-- NumberPicker style-->
<item name="numberPickerStyle">@style/Widget.Material.NumberPicker</item>
@@ -453,8 +454,8 @@ please see themes_device_defaults.xml.
<item name="buttonStyleSmall">@style/Widget.Material.Light.Button.Small</item>
<item name="buttonStyleInset">@style/Widget.Material.Light.Button.Inset</item>
-
<item name="buttonStyleToggle">@style/Widget.Material.Light.Button.Toggle</item>
+
<item name="switchStyle">@style/Widget.Material.Light.CompoundButton.Switch</item>
<item name="mediaRouteButtonStyle">@style/Widget.Material.Light.MediaRouteButton</item>
@@ -487,6 +488,8 @@ please see themes_device_defaults.xml.
<item name="listChoiceBackgroundIndicator">@drawable/list_choice_background_material</item>
<item name="activatedBackgroundIndicator">@drawable/activated_background_material</item>
+ <item name="listDividerAlertDialog">@null</item>
+
<item name="expandableListPreferredItemPaddingLeft">40dip</item>
<item name="expandableListPreferredChildPaddingLeft">?attr/expandableListPreferredItemPaddingLeft</item>
@@ -495,7 +498,6 @@ please see themes_device_defaults.xml.
<item name="expandableListPreferredChildIndicatorLeft">?attr/expandableListPreferredItemIndicatorLeft</item>
<item name="expandableListPreferredChildIndicatorRight">?attr/expandableListPreferredItemIndicatorRight</item>
- <item name="listDividerAlertDialog">@null</item>
<item name="findOnPageNextDrawable">@drawable/ic_find_next_material</item>
<item name="findOnPagePreviousDrawable">@drawable/ic_find_previous_material</item>
@@ -632,6 +634,7 @@ please see themes_device_defaults.xml.
<item name="quickContactBadgeStyleSmallWindowLarge">@style/Widget.Material.QuickContactBadgeSmall.WindowLarge</item>
<item name="listPopupWindowStyle">@style/Widget.Material.Light.ListPopupWindow</item>
<item name="popupMenuStyle">@style/Widget.Material.Light.PopupMenu</item>
+ <item name="popupTheme">@null</item>
<item name="stackViewStyle">@style/Widget.Material.Light.StackView</item>
<item name="activityChooserViewStyle">@style/Widget.Material.Light.ActivityChooserView</item>
<item name="fragmentBreadCrumbsStyle">@style/Widget.Material.FragmentBreadCrumbs</item>
@@ -681,7 +684,10 @@ please see themes_device_defaults.xml.
<item name="actionBarStyle">@style/Widget.Material.Light.ActionBar.Solid</item>
<item name="actionBarSize">@dimen/action_bar_default_height_material</item>
<item name="actionModePopupWindowStyle">@style/Widget.Material.Light.PopupWindow.ActionMode</item>
+ <item name="actionMenuTextAppearance">@style/TextAppearance.Material.Widget.ActionBar.Menu</item>
+ <item name="actionMenuTextColor">?attr/textColorPrimary</item>
<item name="actionBarWidgetTheme">@null</item>
+ <item name="actionBarPopupTheme">?attr/popupTheme</item>
<item name="actionBarTheme">@style/ThemeOverlay.Material.ActionBar</item>
<item name="actionBarItemBackground">@drawable/action_bar_item_background_material</item>
@@ -723,6 +729,7 @@ please see themes_device_defaults.xml.
<!-- DatePicker dialog theme -->
<item name="datePickerDialogTheme">?attr/dialogTheme</item>
+ <!-- TODO: This belongs in a FastScroll style -->
<item name="fastScrollThumbDrawable">@drawable/fastscroll_thumb_material</item>
<item name="fastScrollPreviewBackgroundLeft">@drawable/fastscroll_label_left_material</item>
<item name="fastScrollPreviewBackgroundRight">@drawable/fastscroll_label_right_material</item>
@@ -733,6 +740,7 @@ please see themes_device_defaults.xml.
<item name="colorPrimaryDark">@color/primary_dark_material_light</item>
<item name="colorPrimary">@color/primary_material_light</item>
<item name="colorAccent">@color/accent_material_light</item>
+ <item name="colorEdgeEffect">?attr/colorPrimary</item>
<item name="colorControlNormal">?attr/textColorSecondary</item>
<item name="colorControlActivated">?attr/colorAccent</item>