Merge "API fixes for Companion renaming" into oc-dev
diff --git a/api/current.txt b/api/current.txt
index 09ccbd1..206eeff 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -115,12 +115,13 @@
     field public static final java.lang.String RECEIVE_WAP_PUSH = "android.permission.RECEIVE_WAP_PUSH";
     field public static final java.lang.String RECORD_AUDIO = "android.permission.RECORD_AUDIO";
     field public static final java.lang.String REORDER_TASKS = "android.permission.REORDER_TASKS";
+    field public static final java.lang.String REQUEST_COMPANION_RUN_IN_BACKGROUND = "android.permission.REQUEST_COMPANION_RUN_IN_BACKGROUND";
+    field public static final java.lang.String REQUEST_COMPANION_USE_DATA_IN_BACKGROUND = "android.permission.REQUEST_COMPANION_USE_DATA_IN_BACKGROUND";
     field public static final java.lang.String REQUEST_DELETE_PACKAGES = "android.permission.REQUEST_DELETE_PACKAGES";
     field public static final java.lang.String REQUEST_IGNORE_BATTERY_OPTIMIZATIONS = "android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS";
     field public static final java.lang.String REQUEST_INSTALL_PACKAGES = "android.permission.REQUEST_INSTALL_PACKAGES";
     field public static final deprecated java.lang.String RESTART_PACKAGES = "android.permission.RESTART_PACKAGES";
     field public static final java.lang.String RESTRICTED_VR_ACCESS = "android.permission.RESTRICTED_VR_ACCESS";
-    field public static final java.lang.String RUN_IN_BACKGROUND = "android.permission.RUN_IN_BACKGROUND";
     field public static final java.lang.String SEND_RESPOND_VIA_MESSAGE = "android.permission.SEND_RESPOND_VIA_MESSAGE";
     field public static final java.lang.String SEND_SMS = "android.permission.SEND_SMS";
     field public static final java.lang.String SET_ALARM = "com.android.alarm.permission.SET_ALARM";
@@ -139,7 +140,6 @@
     field public static final java.lang.String TRANSMIT_IR = "android.permission.TRANSMIT_IR";
     field public static final java.lang.String UNINSTALL_SHORTCUT = "com.android.launcher.permission.UNINSTALL_SHORTCUT";
     field public static final java.lang.String UPDATE_DEVICE_STATS = "android.permission.UPDATE_DEVICE_STATS";
-    field public static final java.lang.String USE_DATA_IN_BACKGROUND = "android.permission.USE_DATA_IN_BACKGROUND";
     field public static final java.lang.String USE_FINGERPRINT = "android.permission.USE_FINGERPRINT";
     field public static final java.lang.String USE_SIP = "android.permission.USE_SIP";
     field public static final java.lang.String VIBRATE = "android.permission.VIBRATE";
@@ -312,6 +312,7 @@
     field public static final int autoUrlDetect = 16843404; // 0x101028c
     field public static final int autoVerify = 16844014; // 0x10104ee
     field public static final int autofillHints = 16844121; // 0x1010559
+    field public static final int autofilledHighlight = 16844139; // 0x101056b
     field public static final int background = 16842964; // 0x10100d4
     field public static final int backgroundDimAmount = 16842802; // 0x1010032
     field public static final int backgroundDimEnabled = 16843295; // 0x101021f
@@ -356,12 +357,12 @@
     field public static final int calendarTextColor = 16843931; // 0x101049b
     field public static final int calendarViewShown = 16843596; // 0x101034c
     field public static final int calendarViewStyle = 16843613; // 0x101035d
-    field public static final int canCaptureFingerprintGestures = 16844111; // 0x101054f
     field public static final int canControlMagnification = 16844039; // 0x1010507
     field public static final int canPerformGestures = 16844045; // 0x101050d
     field public static final int canRecord = 16844060; // 0x101051c
     field public static final deprecated int canRequestEnhancedWebAccessibility = 16843736; // 0x10103d8
     field public static final int canRequestFilterKeyEvents = 16843737; // 0x10103d9
+    field public static final int canRequestFingerprintGestures = 16844111; // 0x101054f
     field public static final int canRequestTouchExplorationMode = 16843735; // 0x10103d7
     field public static final int canRetrieveWindowContent = 16843653; // 0x1010385
     field public static final int candidatesTextStyleSpans = 16843312; // 0x1010230
@@ -1296,7 +1297,7 @@
     field public static final int targetId = 16843740; // 0x10103dc
     field public static final int targetName = 16843853; // 0x101044d
     field public static final int targetPackage = 16842785; // 0x1010021
-    field public static final int targetProcess = 16844097; // 0x1010541
+    field public static final int targetProcesses = 16844097; // 0x1010541
     field public static final int targetSandboxVersion = 16844110; // 0x101054e
     field public static final int targetSdkVersion = 16843376; // 0x1010270
     field public static final int taskAffinity = 16842770; // 0x1010012
@@ -1611,7 +1612,6 @@
     field public static final int alert_light_frame = 17301505; // 0x1080001
     field public static final int arrow_down_float = 17301506; // 0x1080002
     field public static final int arrow_up_float = 17301507; // 0x1080003
-    field public static final int autofilled_highlight = 17301684; // 0x10800b4
     field public static final int bottom_bar = 17301658; // 0x108009a
     field public static final int btn_default = 17301508; // 0x1080004
     field public static final int btn_default_small = 17301509; // 0x1080005
@@ -2832,11 +2832,11 @@
     method public java.lang.String loadDescription(android.content.pm.PackageManager);
     method public java.lang.String loadSummary(android.content.pm.PackageManager);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final int CAPABILITY_CAN_CAPTURE_FINGERPRINT_GESTURES = 64; // 0x40
     field public static final int CAPABILITY_CAN_CONTROL_MAGNIFICATION = 16; // 0x10
     field public static final int CAPABILITY_CAN_PERFORM_GESTURES = 32; // 0x20
     field public static final deprecated int CAPABILITY_CAN_REQUEST_ENHANCED_WEB_ACCESSIBILITY = 4; // 0x4
     field public static final int CAPABILITY_CAN_REQUEST_FILTER_KEY_EVENTS = 8; // 0x8
+    field public static final int CAPABILITY_CAN_REQUEST_FINGERPRINT_GESTURES = 64; // 0x40
     field public static final int CAPABILITY_CAN_REQUEST_TOUCH_EXPLORATION = 2; // 0x2
     field public static final int CAPABILITY_CAN_RETRIEVE_WINDOW_CONTENT = 1; // 0x1
     field public static final android.os.Parcelable.Creator<android.accessibilityservice.AccessibilityServiceInfo> CREATOR;
@@ -2848,13 +2848,13 @@
     field public static final int FEEDBACK_HAPTIC = 2; // 0x2
     field public static final int FEEDBACK_SPOKEN = 1; // 0x1
     field public static final int FEEDBACK_VISUAL = 8; // 0x8
-    field public static final int FLAG_CAPTURE_FINGERPRINT_GESTURES = 512; // 0x200
     field public static final int FLAG_ENABLE_ACCESSIBILITY_VOLUME = 128; // 0x80
     field public static final int FLAG_INCLUDE_NOT_IMPORTANT_VIEWS = 2; // 0x2
     field public static final int FLAG_REPORT_VIEW_IDS = 16; // 0x10
     field public static final int FLAG_REQUEST_ACCESSIBILITY_BUTTON = 256; // 0x100
     field public static final deprecated int FLAG_REQUEST_ENHANCED_WEB_ACCESSIBILITY = 8; // 0x8
     field public static final int FLAG_REQUEST_FILTER_KEY_EVENTS = 32; // 0x20
+    field public static final int FLAG_REQUEST_FINGERPRINT_GESTURES = 512; // 0x200
     field public static final int FLAG_REQUEST_TOUCH_EXPLORATION_MODE = 4; // 0x4
     field public static final int FLAG_RETRIEVE_INTERACTIVE_WINDOWS = 64; // 0x40
     field public int eventTypes;
@@ -2876,7 +2876,6 @@
 
   public static abstract class FingerprintGestureController.FingerprintGestureCallback {
     ctor public FingerprintGestureController.FingerprintGestureCallback();
-    method public deprecated void onGesture(int);
     method public void onGestureDetected(int);
     method public void onGestureDetectionAvailabilityChanged(boolean);
   }
@@ -2896,14 +2895,12 @@
 
   public static class GestureDescription.StrokeDescription {
     ctor public GestureDescription.StrokeDescription(android.graphics.Path, long, long);
-    ctor public GestureDescription.StrokeDescription(android.graphics.Path, long, long, int, boolean);
-    method public int getContinuedStrokeId();
+    ctor public GestureDescription.StrokeDescription(android.graphics.Path, long, long, boolean);
+    method public android.accessibilityservice.GestureDescription.StrokeDescription continueStroke(android.graphics.Path, long, long, boolean);
     method public long getDuration();
-    method public int getId();
     method public android.graphics.Path getPath();
     method public long getStartTime();
-    method public boolean isContinued();
-    field public static final int INVALID_STROKE_ID = -1; // 0xffffffff
+    method public boolean willContinue();
   }
 
 }
@@ -6531,7 +6528,7 @@
 
   public final class DnsEvent extends android.app.admin.NetworkEvent implements android.os.Parcelable {
     method public java.lang.String getHostname();
-    method public java.net.InetAddress[] getInetAddresses();
+    method public java.util.List<java.net.InetAddress> getInetAddresses();
     method public int getTotalResolvedAddressCount();
     method public void writeToParcel(android.os.Parcel, int);
     field public static final android.os.Parcelable.Creator<android.app.admin.DnsEvent> CREATOR;
@@ -6703,7 +6700,6 @@
   public abstract class BackupAgent extends android.content.ContextWrapper {
     ctor public BackupAgent();
     method public final void fullBackupFile(java.io.File, android.app.backup.FullBackupDataOutput);
-    method public long getBackupQuota();
     method public abstract void onBackup(android.os.ParcelFileDescriptor, android.app.backup.BackupDataOutput, android.os.ParcelFileDescriptor) throws java.io.IOException;
     method public void onCreate();
     method public void onDestroy();
@@ -6738,6 +6734,7 @@
   }
 
   public class BackupDataOutput {
+    method public long getQuota();
     method public int writeEntityData(byte[], int) throws java.io.IOException;
     method public int writeEntityHeader(java.lang.String, int) throws java.io.IOException;
   }
@@ -6766,6 +6763,7 @@
   }
 
   public class FullBackupDataOutput {
+    method public long getQuota();
   }
 
   public abstract class RestoreObserver {
@@ -8025,7 +8023,7 @@
     method public void setAdvertisingData(android.bluetooth.le.AdvertiseData);
     method public void setAdvertisingParameters(android.bluetooth.le.AdvertisingSetParameters);
     method public void setPeriodicAdvertisingData(android.bluetooth.le.AdvertiseData);
-    method public void setPeriodicAdvertisingEnable(boolean);
+    method public void setPeriodicAdvertisingEnabled(boolean);
     method public void setPeriodicAdvertisingParameters(android.bluetooth.le.PeriodicAdvertisingParameters);
     method public void setScanResponseData(android.bluetooth.le.AdvertiseData);
   }
@@ -9496,6 +9494,7 @@
     field public static final java.lang.String EXTRA_CHOOSER_TARGETS = "android.intent.extra.CHOOSER_TARGETS";
     field public static final java.lang.String EXTRA_CHOSEN_COMPONENT = "android.intent.extra.CHOSEN_COMPONENT";
     field public static final java.lang.String EXTRA_CHOSEN_COMPONENT_INTENT_SENDER = "android.intent.extra.CHOSEN_COMPONENT_INTENT_SENDER";
+    field public static final java.lang.String EXTRA_COMPONENT_NAME = "android.intent.extra.COMPONENT_NAME";
     field public static final java.lang.String EXTRA_CONTENT_ANNOTATIONS = "android.intent.extra.CONTENT_ANNOTATIONS";
     field public static final java.lang.String EXTRA_DATA_REMOVED = "android.intent.extra.DATA_REMOVED";
     field public static final java.lang.String EXTRA_DOCK_STATE = "android.intent.extra.DOCK_STATE";
@@ -10319,7 +10318,7 @@
     field public java.lang.String[] splitPublicSourceDirs;
     field public java.lang.String[] splitSourceDirs;
     field public java.lang.String targetPackage;
-    field public java.lang.String targetProcess;
+    field public java.lang.String targetProcesses;
   }
 
   public class LabeledIntent extends android.content.Intent {
@@ -13285,7 +13284,7 @@
     method public void setFilterBitmap(boolean);
     method public void setFlags(int);
     method public void setFontFeatureSettings(java.lang.String);
-    method public boolean setFontVariationSettings(java.lang.String) throws android.graphics.fonts.FontVariationAxis.InvalidFormatException;
+    method public boolean setFontVariationSettings(java.lang.String);
     method public void setHinting(int);
     method public void setLetterSpacing(float);
     method public void setLinearText(boolean);
@@ -13812,7 +13811,7 @@
     ctor public Typeface.Builder(android.content.res.AssetManager, java.lang.String);
     method public android.graphics.Typeface build();
     method public android.graphics.Typeface.Builder setFallback(java.lang.String);
-    method public android.graphics.Typeface.Builder setFontVariationSettings(java.lang.String) throws android.graphics.fonts.FontVariationAxis.InvalidFormatException;
+    method public android.graphics.Typeface.Builder setFontVariationSettings(java.lang.String);
     method public android.graphics.Typeface.Builder setFontVariationSettings(android.graphics.fonts.FontVariationAxis[]);
     method public android.graphics.Typeface.Builder setItalic(boolean);
     method public android.graphics.Typeface.Builder setTtcIndex(int);
@@ -14396,17 +14395,13 @@
 package android.graphics.fonts {
 
   public final class FontVariationAxis {
-    ctor public FontVariationAxis(java.lang.String, float) throws android.graphics.fonts.FontVariationAxis.InvalidFormatException;
-    method public static android.graphics.fonts.FontVariationAxis[] fromFontVariationSettings(java.lang.String) throws android.graphics.fonts.FontVariationAxis.InvalidFormatException;
+    ctor public FontVariationAxis(java.lang.String, float);
+    method public static android.graphics.fonts.FontVariationAxis[] fromFontVariationSettings(java.lang.String);
     method public float getStyleValue();
     method public java.lang.String getTag();
     method public static java.lang.String toFontVariationSettings(android.graphics.fonts.FontVariationAxis[]);
   }
 
-  public static class FontVariationAxis.InvalidFormatException extends java.lang.Exception {
-    ctor public FontVariationAxis.InvalidFormatException(java.lang.String);
-  }
-
 }
 
 package android.graphics.pdf {
@@ -37478,7 +37473,6 @@
     method public final void unlockAndRun(java.lang.Runnable);
     field public static final java.lang.String ACTION_QS_TILE = "android.service.quicksettings.action.QS_TILE";
     field public static final java.lang.String ACTION_QS_TILE_PREFERENCES = "android.service.quicksettings.action.QS_TILE_PREFERENCES";
-    field public static final java.lang.String EXTRA_COMPONENT = "android.service.quicksettings.extra.COMPONENT";
     field public static final java.lang.String META_DATA_ACTIVE_TILE = "android.service.quicksettings.ACTIVE_TILE";
   }
 
@@ -47228,8 +47222,8 @@
     field public static final java.lang.String ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN = "ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN";
     field public static final java.lang.String ACTION_ARGUMENT_HTML_ELEMENT_STRING = "ACTION_ARGUMENT_HTML_ELEMENT_STRING";
     field public static final java.lang.String ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT = "ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT";
-    field public static final java.lang.String ACTION_ARGUMENT_MOVE_WINDOW_X = "android.view.accessibility.action.ARGUMENT_MOVE_WINDOW_X";
-    field public static final java.lang.String ACTION_ARGUMENT_MOVE_WINDOW_Y = "android.view.accessibility.action.ARGUMENT_MOVE_WINDOW_Y";
+    field public static final java.lang.String ACTION_ARGUMENT_MOVE_WINDOW_X = "ACTION_ARGUMENT_MOVE_WINDOW_X";
+    field public static final java.lang.String ACTION_ARGUMENT_MOVE_WINDOW_Y = "ACTION_ARGUMENT_MOVE_WINDOW_Y";
     field public static final java.lang.String ACTION_ARGUMENT_PROGRESS_VALUE = "android.view.accessibility.action.ARGUMENT_PROGRESS_VALUE";
     field public static final java.lang.String ACTION_ARGUMENT_ROW_INT = "android.view.accessibility.action.ARGUMENT_ROW_INT";
     field public static final java.lang.String ACTION_ARGUMENT_SELECTION_END_INT = "ACTION_ARGUMENT_SELECTION_END_INT";
@@ -47411,10 +47405,10 @@
     method public android.view.accessibility.AccessibilityNodeInfo getRoot();
     method public java.lang.CharSequence getTitle();
     method public int getType();
-    method public boolean inPictureInPicture();
     method public boolean isAccessibilityFocused();
     method public boolean isActive();
     method public boolean isFocused();
+    method public boolean isInPictureInPictureMode();
     method public static android.view.accessibility.AccessibilityWindowInfo obtain();
     method public static android.view.accessibility.AccessibilityWindowInfo obtain(android.view.accessibility.AccessibilityWindowInfo);
     method public void recycle();
@@ -47772,7 +47766,7 @@
     method public void unregisterCallback(android.view.autofill.AutofillManager.AutofillCallback);
     field public static final java.lang.String EXTRA_ASSIST_STRUCTURE = "android.view.autofill.extra.ASSIST_STRUCTURE";
     field public static final java.lang.String EXTRA_AUTHENTICATION_RESULT = "android.view.autofill.extra.AUTHENTICATION_RESULT";
-    field public static final java.lang.String EXTRA_DATA_EXTRAS = "android.view.autofill.extra.DATA_EXTRAS";
+    field public static final java.lang.String EXTRA_CLIENT_STATE = "android.view.autofill.extra.EXTRA_CLIENT_STATE";
   }
 
   public static abstract class AutofillManager.AutofillCallback {
@@ -51418,7 +51412,7 @@
     method public void setExtractedText(android.view.inputmethod.ExtractedText);
     method public void setFilters(android.text.InputFilter[]);
     method public void setFontFeatureSettings(java.lang.String);
-    method public boolean setFontVariationSettings(java.lang.String) throws android.graphics.fonts.FontVariationAxis.InvalidFormatException;
+    method public boolean setFontVariationSettings(java.lang.String);
     method protected boolean setFrame(int, int, int, int);
     method public void setFreezesText(boolean);
     method public void setGravity(int);
diff --git a/api/removed.txt b/api/removed.txt
index 8c81ef4..779ff7c 100644
--- a/api/removed.txt
+++ b/api/removed.txt
@@ -452,6 +452,14 @@
 
 }
 
+package android.view.accessibility {
+
+  public final class AccessibilityWindowInfo implements android.os.Parcelable {
+    method public boolean inPictureInPicture();
+  }
+
+}
+
 package android.webkit {
 
   public class WebViewClient {
diff --git a/api/system-current.txt b/api/system-current.txt
index c4c0da4..22c8cd3 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -211,6 +211,8 @@
     field public static final java.lang.String REGISTER_SIM_SUBSCRIPTION = "android.permission.REGISTER_SIM_SUBSCRIPTION";
     field public static final java.lang.String REMOVE_DRM_CERTIFICATES = "android.permission.REMOVE_DRM_CERTIFICATES";
     field public static final java.lang.String REORDER_TASKS = "android.permission.REORDER_TASKS";
+    field public static final java.lang.String REQUEST_COMPANION_RUN_IN_BACKGROUND = "android.permission.REQUEST_COMPANION_RUN_IN_BACKGROUND";
+    field public static final java.lang.String REQUEST_COMPANION_USE_DATA_IN_BACKGROUND = "android.permission.REQUEST_COMPANION_USE_DATA_IN_BACKGROUND";
     field public static final java.lang.String REQUEST_DELETE_PACKAGES = "android.permission.REQUEST_DELETE_PACKAGES";
     field public static final java.lang.String REQUEST_IGNORE_BATTERY_OPTIMIZATIONS = "android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS";
     field public static final java.lang.String REQUEST_INSTALL_PACKAGES = "android.permission.REQUEST_INSTALL_PACKAGES";
@@ -218,7 +220,6 @@
     field public static final java.lang.String RESTRICTED_VR_ACCESS = "android.permission.RESTRICTED_VR_ACCESS";
     field public static final java.lang.String RETRIEVE_WINDOW_CONTENT = "android.permission.RETRIEVE_WINDOW_CONTENT";
     field public static final java.lang.String REVOKE_RUNTIME_PERMISSIONS = "android.permission.REVOKE_RUNTIME_PERMISSIONS";
-    field public static final java.lang.String RUN_IN_BACKGROUND = "android.permission.RUN_IN_BACKGROUND";
     field public static final java.lang.String SCORE_NETWORKS = "android.permission.SCORE_NETWORKS";
     field public static final java.lang.String SEND_RESPOND_VIA_MESSAGE = "android.permission.SEND_RESPOND_VIA_MESSAGE";
     field public static final java.lang.String SEND_SMS = "android.permission.SEND_SMS";
@@ -256,7 +257,6 @@
     field public static final java.lang.String UPDATE_DEVICE_STATS = "android.permission.UPDATE_DEVICE_STATS";
     field public static final java.lang.String UPDATE_LOCK = "android.permission.UPDATE_LOCK";
     field public static final java.lang.String USER_ACTIVITY = "android.permission.USER_ACTIVITY";
-    field public static final java.lang.String USE_DATA_IN_BACKGROUND = "android.permission.USE_DATA_IN_BACKGROUND";
     field public static final java.lang.String USE_FINGERPRINT = "android.permission.USE_FINGERPRINT";
     field public static final java.lang.String USE_SIP = "android.permission.USE_SIP";
     field public static final java.lang.String VIBRATE = "android.permission.VIBRATE";
@@ -432,6 +432,7 @@
     field public static final int autoUrlDetect = 16843404; // 0x101028c
     field public static final int autoVerify = 16844014; // 0x10104ee
     field public static final int autofillHints = 16844121; // 0x1010559
+    field public static final int autofilledHighlight = 16844139; // 0x101056b
     field public static final int background = 16842964; // 0x10100d4
     field public static final int backgroundDimAmount = 16842802; // 0x1010032
     field public static final int backgroundDimEnabled = 16843295; // 0x101021f
@@ -476,12 +477,12 @@
     field public static final int calendarTextColor = 16843931; // 0x101049b
     field public static final int calendarViewShown = 16843596; // 0x101034c
     field public static final int calendarViewStyle = 16843613; // 0x101035d
-    field public static final int canCaptureFingerprintGestures = 16844111; // 0x101054f
     field public static final int canControlMagnification = 16844039; // 0x1010507
     field public static final int canPerformGestures = 16844045; // 0x101050d
     field public static final int canRecord = 16844060; // 0x101051c
     field public static final deprecated int canRequestEnhancedWebAccessibility = 16843736; // 0x10103d8
     field public static final int canRequestFilterKeyEvents = 16843737; // 0x10103d9
+    field public static final int canRequestFingerprintGestures = 16844111; // 0x101054f
     field public static final int canRequestTouchExplorationMode = 16843735; // 0x10103d7
     field public static final int canRetrieveWindowContent = 16843653; // 0x1010385
     field public static final int candidatesTextStyleSpans = 16843312; // 0x1010230
@@ -1422,7 +1423,7 @@
     field public static final int targetId = 16843740; // 0x10103dc
     field public static final int targetName = 16843853; // 0x101044d
     field public static final int targetPackage = 16842785; // 0x1010021
-    field public static final int targetProcess = 16844097; // 0x1010541
+    field public static final int targetProcesses = 16844097; // 0x1010541
     field public static final int targetSandboxVersion = 16844110; // 0x101054e
     field public static final int targetSdkVersion = 16843376; // 0x1010270
     field public static final int taskAffinity = 16842770; // 0x1010012
@@ -1737,7 +1738,6 @@
     field public static final int alert_light_frame = 17301505; // 0x1080001
     field public static final int arrow_down_float = 17301506; // 0x1080002
     field public static final int arrow_up_float = 17301507; // 0x1080003
-    field public static final int autofilled_highlight = 17301684; // 0x10800b4
     field public static final int bottom_bar = 17301658; // 0x108009a
     field public static final int btn_default = 17301508; // 0x1080004
     field public static final int btn_default_small = 17301509; // 0x1080005
@@ -2961,11 +2961,11 @@
     method public java.lang.String loadDescription(android.content.pm.PackageManager);
     method public java.lang.String loadSummary(android.content.pm.PackageManager);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final int CAPABILITY_CAN_CAPTURE_FINGERPRINT_GESTURES = 64; // 0x40
     field public static final int CAPABILITY_CAN_CONTROL_MAGNIFICATION = 16; // 0x10
     field public static final int CAPABILITY_CAN_PERFORM_GESTURES = 32; // 0x20
     field public static final deprecated int CAPABILITY_CAN_REQUEST_ENHANCED_WEB_ACCESSIBILITY = 4; // 0x4
     field public static final int CAPABILITY_CAN_REQUEST_FILTER_KEY_EVENTS = 8; // 0x8
+    field public static final int CAPABILITY_CAN_REQUEST_FINGERPRINT_GESTURES = 64; // 0x40
     field public static final int CAPABILITY_CAN_REQUEST_TOUCH_EXPLORATION = 2; // 0x2
     field public static final int CAPABILITY_CAN_RETRIEVE_WINDOW_CONTENT = 1; // 0x1
     field public static final android.os.Parcelable.Creator<android.accessibilityservice.AccessibilityServiceInfo> CREATOR;
@@ -2977,13 +2977,13 @@
     field public static final int FEEDBACK_HAPTIC = 2; // 0x2
     field public static final int FEEDBACK_SPOKEN = 1; // 0x1
     field public static final int FEEDBACK_VISUAL = 8; // 0x8
-    field public static final int FLAG_CAPTURE_FINGERPRINT_GESTURES = 512; // 0x200
     field public static final int FLAG_ENABLE_ACCESSIBILITY_VOLUME = 128; // 0x80
     field public static final int FLAG_INCLUDE_NOT_IMPORTANT_VIEWS = 2; // 0x2
     field public static final int FLAG_REPORT_VIEW_IDS = 16; // 0x10
     field public static final int FLAG_REQUEST_ACCESSIBILITY_BUTTON = 256; // 0x100
     field public static final deprecated int FLAG_REQUEST_ENHANCED_WEB_ACCESSIBILITY = 8; // 0x8
     field public static final int FLAG_REQUEST_FILTER_KEY_EVENTS = 32; // 0x20
+    field public static final int FLAG_REQUEST_FINGERPRINT_GESTURES = 512; // 0x200
     field public static final int FLAG_REQUEST_TOUCH_EXPLORATION_MODE = 4; // 0x4
     field public static final int FLAG_RETRIEVE_INTERACTIVE_WINDOWS = 64; // 0x40
     field public int eventTypes;
@@ -3005,7 +3005,6 @@
 
   public static abstract class FingerprintGestureController.FingerprintGestureCallback {
     ctor public FingerprintGestureController.FingerprintGestureCallback();
-    method public deprecated void onGesture(int);
     method public void onGestureDetected(int);
     method public void onGestureDetectionAvailabilityChanged(boolean);
   }
@@ -3025,14 +3024,12 @@
 
   public static class GestureDescription.StrokeDescription {
     ctor public GestureDescription.StrokeDescription(android.graphics.Path, long, long);
-    ctor public GestureDescription.StrokeDescription(android.graphics.Path, long, long, int, boolean);
-    method public int getContinuedStrokeId();
+    ctor public GestureDescription.StrokeDescription(android.graphics.Path, long, long, boolean);
+    method public android.accessibilityservice.GestureDescription.StrokeDescription continueStroke(android.graphics.Path, long, long, boolean);
     method public long getDuration();
-    method public int getId();
     method public android.graphics.Path getPath();
     method public long getStartTime();
-    method public boolean isContinued();
-    field public static final int INVALID_STROKE_ID = -1; // 0xffffffff
+    method public boolean willContinue();
   }
 
 }
@@ -6780,7 +6777,7 @@
 
   public final class DnsEvent extends android.app.admin.NetworkEvent implements android.os.Parcelable {
     method public java.lang.String getHostname();
-    method public java.net.InetAddress[] getInetAddresses();
+    method public java.util.List<java.net.InetAddress> getInetAddresses();
     method public int getTotalResolvedAddressCount();
     method public void writeToParcel(android.os.Parcel, int);
     field public static final android.os.Parcelable.Creator<android.app.admin.DnsEvent> CREATOR;
@@ -6952,7 +6949,6 @@
   public abstract class BackupAgent extends android.content.ContextWrapper {
     ctor public BackupAgent();
     method public final void fullBackupFile(java.io.File, android.app.backup.FullBackupDataOutput);
-    method public long getBackupQuota();
     method public abstract void onBackup(android.os.ParcelFileDescriptor, android.app.backup.BackupDataOutput, android.os.ParcelFileDescriptor) throws java.io.IOException;
     method public void onCreate();
     method public void onDestroy();
@@ -6989,6 +6985,8 @@
 
   public class BackupDataOutput {
     ctor public BackupDataOutput(java.io.FileDescriptor);
+    ctor public BackupDataOutput(java.io.FileDescriptor, long);
+    method public long getQuota();
     method public int writeEntityData(byte[], int) throws java.io.IOException;
     method public int writeEntityHeader(java.lang.String, int) throws java.io.IOException;
   }
@@ -7165,6 +7163,7 @@
   }
 
   public class FullBackupDataOutput {
+    method public long getQuota();
   }
 
   public class RestoreDescription implements android.os.Parcelable {
@@ -8503,7 +8502,7 @@
     method public void setAdvertisingData(android.bluetooth.le.AdvertiseData);
     method public void setAdvertisingParameters(android.bluetooth.le.AdvertisingSetParameters);
     method public void setPeriodicAdvertisingData(android.bluetooth.le.AdvertiseData);
-    method public void setPeriodicAdvertisingEnable(boolean);
+    method public void setPeriodicAdvertisingEnabled(boolean);
     method public void setPeriodicAdvertisingParameters(android.bluetooth.le.PeriodicAdvertisingParameters);
     method public void setScanResponseData(android.bluetooth.le.AdvertiseData);
   }
@@ -10046,6 +10045,7 @@
     field public static final java.lang.String EXTRA_CHOOSER_TARGETS = "android.intent.extra.CHOOSER_TARGETS";
     field public static final java.lang.String EXTRA_CHOSEN_COMPONENT = "android.intent.extra.CHOSEN_COMPONENT";
     field public static final java.lang.String EXTRA_CHOSEN_COMPONENT_INTENT_SENDER = "android.intent.extra.CHOSEN_COMPONENT_INTENT_SENDER";
+    field public static final java.lang.String EXTRA_COMPONENT_NAME = "android.intent.extra.COMPONENT_NAME";
     field public static final java.lang.String EXTRA_CONTENT_ANNOTATIONS = "android.intent.extra.CONTENT_ANNOTATIONS";
     field public static final deprecated java.lang.String EXTRA_CSS_INDICATOR = "cssIndicator";
     field public static final deprecated java.lang.String EXTRA_DATA_OPERATOR_ALPHA_LONG = "data-operator-alpha-long";
@@ -10980,7 +10980,7 @@
     field public java.lang.String[] splitPublicSourceDirs;
     field public java.lang.String[] splitSourceDirs;
     field public java.lang.String targetPackage;
-    field public java.lang.String targetProcess;
+    field public java.lang.String targetProcesses;
   }
 
   public final class IntentFilterVerificationInfo implements android.os.Parcelable {
@@ -14064,7 +14064,7 @@
     method public void setFilterBitmap(boolean);
     method public void setFlags(int);
     method public void setFontFeatureSettings(java.lang.String);
-    method public boolean setFontVariationSettings(java.lang.String) throws android.graphics.fonts.FontVariationAxis.InvalidFormatException;
+    method public boolean setFontVariationSettings(java.lang.String);
     method public void setHinting(int);
     method public void setLetterSpacing(float);
     method public void setLinearText(boolean);
@@ -14591,7 +14591,7 @@
     ctor public Typeface.Builder(android.content.res.AssetManager, java.lang.String);
     method public android.graphics.Typeface build();
     method public android.graphics.Typeface.Builder setFallback(java.lang.String);
-    method public android.graphics.Typeface.Builder setFontVariationSettings(java.lang.String) throws android.graphics.fonts.FontVariationAxis.InvalidFormatException;
+    method public android.graphics.Typeface.Builder setFontVariationSettings(java.lang.String);
     method public android.graphics.Typeface.Builder setFontVariationSettings(android.graphics.fonts.FontVariationAxis[]);
     method public android.graphics.Typeface.Builder setItalic(boolean);
     method public android.graphics.Typeface.Builder setTtcIndex(int);
@@ -15175,17 +15175,13 @@
 package android.graphics.fonts {
 
   public final class FontVariationAxis {
-    ctor public FontVariationAxis(java.lang.String, float) throws android.graphics.fonts.FontVariationAxis.InvalidFormatException;
-    method public static android.graphics.fonts.FontVariationAxis[] fromFontVariationSettings(java.lang.String) throws android.graphics.fonts.FontVariationAxis.InvalidFormatException;
+    ctor public FontVariationAxis(java.lang.String, float);
+    method public static android.graphics.fonts.FontVariationAxis[] fromFontVariationSettings(java.lang.String);
     method public float getStyleValue();
     method public java.lang.String getTag();
     method public static java.lang.String toFontVariationSettings(android.graphics.fonts.FontVariationAxis[]);
   }
 
-  public static class FontVariationAxis.InvalidFormatException extends java.lang.Exception {
-    ctor public FontVariationAxis.InvalidFormatException(java.lang.String);
-  }
-
 }
 
 package android.graphics.pdf {
@@ -40680,7 +40676,6 @@
     method public final void unlockAndRun(java.lang.Runnable);
     field public static final java.lang.String ACTION_QS_TILE = "android.service.quicksettings.action.QS_TILE";
     field public static final java.lang.String ACTION_QS_TILE_PREFERENCES = "android.service.quicksettings.action.QS_TILE_PREFERENCES";
-    field public static final java.lang.String EXTRA_COMPONENT = "android.service.quicksettings.extra.COMPONENT";
     field public static final java.lang.String META_DATA_ACTIVE_TILE = "android.service.quicksettings.ACTIVE_TILE";
   }
 
@@ -50823,8 +50818,8 @@
     field public static final java.lang.String ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN = "ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN";
     field public static final java.lang.String ACTION_ARGUMENT_HTML_ELEMENT_STRING = "ACTION_ARGUMENT_HTML_ELEMENT_STRING";
     field public static final java.lang.String ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT = "ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT";
-    field public static final java.lang.String ACTION_ARGUMENT_MOVE_WINDOW_X = "android.view.accessibility.action.ARGUMENT_MOVE_WINDOW_X";
-    field public static final java.lang.String ACTION_ARGUMENT_MOVE_WINDOW_Y = "android.view.accessibility.action.ARGUMENT_MOVE_WINDOW_Y";
+    field public static final java.lang.String ACTION_ARGUMENT_MOVE_WINDOW_X = "ACTION_ARGUMENT_MOVE_WINDOW_X";
+    field public static final java.lang.String ACTION_ARGUMENT_MOVE_WINDOW_Y = "ACTION_ARGUMENT_MOVE_WINDOW_Y";
     field public static final java.lang.String ACTION_ARGUMENT_PROGRESS_VALUE = "android.view.accessibility.action.ARGUMENT_PROGRESS_VALUE";
     field public static final java.lang.String ACTION_ARGUMENT_ROW_INT = "android.view.accessibility.action.ARGUMENT_ROW_INT";
     field public static final java.lang.String ACTION_ARGUMENT_SELECTION_END_INT = "ACTION_ARGUMENT_SELECTION_END_INT";
@@ -51006,10 +51001,10 @@
     method public android.view.accessibility.AccessibilityNodeInfo getRoot();
     method public java.lang.CharSequence getTitle();
     method public int getType();
-    method public boolean inPictureInPicture();
     method public boolean isAccessibilityFocused();
     method public boolean isActive();
     method public boolean isFocused();
+    method public boolean isInPictureInPictureMode();
     method public static android.view.accessibility.AccessibilityWindowInfo obtain();
     method public static android.view.accessibility.AccessibilityWindowInfo obtain(android.view.accessibility.AccessibilityWindowInfo);
     method public void recycle();
@@ -51367,7 +51362,7 @@
     method public void unregisterCallback(android.view.autofill.AutofillManager.AutofillCallback);
     field public static final java.lang.String EXTRA_ASSIST_STRUCTURE = "android.view.autofill.extra.ASSIST_STRUCTURE";
     field public static final java.lang.String EXTRA_AUTHENTICATION_RESULT = "android.view.autofill.extra.AUTHENTICATION_RESULT";
-    field public static final java.lang.String EXTRA_DATA_EXTRAS = "android.view.autofill.extra.DATA_EXTRAS";
+    field public static final java.lang.String EXTRA_CLIENT_STATE = "android.view.autofill.extra.EXTRA_CLIENT_STATE";
   }
 
   public static abstract class AutofillManager.AutofillCallback {
@@ -55378,7 +55373,7 @@
     method public void setExtractedText(android.view.inputmethod.ExtractedText);
     method public void setFilters(android.text.InputFilter[]);
     method public void setFontFeatureSettings(java.lang.String);
-    method public boolean setFontVariationSettings(java.lang.String) throws android.graphics.fonts.FontVariationAxis.InvalidFormatException;
+    method public boolean setFontVariationSettings(java.lang.String);
     method protected boolean setFrame(int, int, int, int);
     method public void setFreezesText(boolean);
     method public void setGravity(int);
diff --git a/api/system-removed.txt b/api/system-removed.txt
index 659236d..fe51248 100644
--- a/api/system-removed.txt
+++ b/api/system-removed.txt
@@ -446,6 +446,14 @@
 
 }
 
+package android.view.accessibility {
+
+  public final class AccessibilityWindowInfo implements android.os.Parcelable {
+    method public boolean inPictureInPicture();
+  }
+
+}
+
 package android.webkit {
 
   public class WebViewClient {
diff --git a/api/test-current.txt b/api/test-current.txt
index 2e74b83..98ee73f 100644
--- a/api/test-current.txt
+++ b/api/test-current.txt
@@ -115,12 +115,13 @@
     field public static final java.lang.String RECEIVE_WAP_PUSH = "android.permission.RECEIVE_WAP_PUSH";
     field public static final java.lang.String RECORD_AUDIO = "android.permission.RECORD_AUDIO";
     field public static final java.lang.String REORDER_TASKS = "android.permission.REORDER_TASKS";
+    field public static final java.lang.String REQUEST_COMPANION_RUN_IN_BACKGROUND = "android.permission.REQUEST_COMPANION_RUN_IN_BACKGROUND";
+    field public static final java.lang.String REQUEST_COMPANION_USE_DATA_IN_BACKGROUND = "android.permission.REQUEST_COMPANION_USE_DATA_IN_BACKGROUND";
     field public static final java.lang.String REQUEST_DELETE_PACKAGES = "android.permission.REQUEST_DELETE_PACKAGES";
     field public static final java.lang.String REQUEST_IGNORE_BATTERY_OPTIMIZATIONS = "android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS";
     field public static final java.lang.String REQUEST_INSTALL_PACKAGES = "android.permission.REQUEST_INSTALL_PACKAGES";
     field public static final deprecated java.lang.String RESTART_PACKAGES = "android.permission.RESTART_PACKAGES";
     field public static final java.lang.String RESTRICTED_VR_ACCESS = "android.permission.RESTRICTED_VR_ACCESS";
-    field public static final java.lang.String RUN_IN_BACKGROUND = "android.permission.RUN_IN_BACKGROUND";
     field public static final java.lang.String SEND_RESPOND_VIA_MESSAGE = "android.permission.SEND_RESPOND_VIA_MESSAGE";
     field public static final java.lang.String SEND_SMS = "android.permission.SEND_SMS";
     field public static final java.lang.String SET_ALARM = "com.android.alarm.permission.SET_ALARM";
@@ -139,7 +140,6 @@
     field public static final java.lang.String TRANSMIT_IR = "android.permission.TRANSMIT_IR";
     field public static final java.lang.String UNINSTALL_SHORTCUT = "com.android.launcher.permission.UNINSTALL_SHORTCUT";
     field public static final java.lang.String UPDATE_DEVICE_STATS = "android.permission.UPDATE_DEVICE_STATS";
-    field public static final java.lang.String USE_DATA_IN_BACKGROUND = "android.permission.USE_DATA_IN_BACKGROUND";
     field public static final java.lang.String USE_FINGERPRINT = "android.permission.USE_FINGERPRINT";
     field public static final java.lang.String USE_SIP = "android.permission.USE_SIP";
     field public static final java.lang.String VIBRATE = "android.permission.VIBRATE";
@@ -312,6 +312,7 @@
     field public static final int autoUrlDetect = 16843404; // 0x101028c
     field public static final int autoVerify = 16844014; // 0x10104ee
     field public static final int autofillHints = 16844121; // 0x1010559
+    field public static final int autofilledHighlight = 16844139; // 0x101056b
     field public static final int background = 16842964; // 0x10100d4
     field public static final int backgroundDimAmount = 16842802; // 0x1010032
     field public static final int backgroundDimEnabled = 16843295; // 0x101021f
@@ -356,12 +357,12 @@
     field public static final int calendarTextColor = 16843931; // 0x101049b
     field public static final int calendarViewShown = 16843596; // 0x101034c
     field public static final int calendarViewStyle = 16843613; // 0x101035d
-    field public static final int canCaptureFingerprintGestures = 16844111; // 0x101054f
     field public static final int canControlMagnification = 16844039; // 0x1010507
     field public static final int canPerformGestures = 16844045; // 0x101050d
     field public static final int canRecord = 16844060; // 0x101051c
     field public static final deprecated int canRequestEnhancedWebAccessibility = 16843736; // 0x10103d8
     field public static final int canRequestFilterKeyEvents = 16843737; // 0x10103d9
+    field public static final int canRequestFingerprintGestures = 16844111; // 0x101054f
     field public static final int canRequestTouchExplorationMode = 16843735; // 0x10103d7
     field public static final int canRetrieveWindowContent = 16843653; // 0x1010385
     field public static final int candidatesTextStyleSpans = 16843312; // 0x1010230
@@ -1296,7 +1297,7 @@
     field public static final int targetId = 16843740; // 0x10103dc
     field public static final int targetName = 16843853; // 0x101044d
     field public static final int targetPackage = 16842785; // 0x1010021
-    field public static final int targetProcess = 16844097; // 0x1010541
+    field public static final int targetProcesses = 16844097; // 0x1010541
     field public static final int targetSandboxVersion = 16844110; // 0x101054e
     field public static final int targetSdkVersion = 16843376; // 0x1010270
     field public static final int taskAffinity = 16842770; // 0x1010012
@@ -1611,7 +1612,6 @@
     field public static final int alert_light_frame = 17301505; // 0x1080001
     field public static final int arrow_down_float = 17301506; // 0x1080002
     field public static final int arrow_up_float = 17301507; // 0x1080003
-    field public static final int autofilled_highlight = 17301684; // 0x10800b4
     field public static final int bottom_bar = 17301658; // 0x108009a
     field public static final int btn_default = 17301508; // 0x1080004
     field public static final int btn_default_small = 17301509; // 0x1080005
@@ -2832,11 +2832,11 @@
     method public java.lang.String loadDescription(android.content.pm.PackageManager);
     method public java.lang.String loadSummary(android.content.pm.PackageManager);
     method public void writeToParcel(android.os.Parcel, int);
-    field public static final int CAPABILITY_CAN_CAPTURE_FINGERPRINT_GESTURES = 64; // 0x40
     field public static final int CAPABILITY_CAN_CONTROL_MAGNIFICATION = 16; // 0x10
     field public static final int CAPABILITY_CAN_PERFORM_GESTURES = 32; // 0x20
     field public static final deprecated int CAPABILITY_CAN_REQUEST_ENHANCED_WEB_ACCESSIBILITY = 4; // 0x4
     field public static final int CAPABILITY_CAN_REQUEST_FILTER_KEY_EVENTS = 8; // 0x8
+    field public static final int CAPABILITY_CAN_REQUEST_FINGERPRINT_GESTURES = 64; // 0x40
     field public static final int CAPABILITY_CAN_REQUEST_TOUCH_EXPLORATION = 2; // 0x2
     field public static final int CAPABILITY_CAN_RETRIEVE_WINDOW_CONTENT = 1; // 0x1
     field public static final android.os.Parcelable.Creator<android.accessibilityservice.AccessibilityServiceInfo> CREATOR;
@@ -2848,13 +2848,13 @@
     field public static final int FEEDBACK_HAPTIC = 2; // 0x2
     field public static final int FEEDBACK_SPOKEN = 1; // 0x1
     field public static final int FEEDBACK_VISUAL = 8; // 0x8
-    field public static final int FLAG_CAPTURE_FINGERPRINT_GESTURES = 512; // 0x200
     field public static final int FLAG_ENABLE_ACCESSIBILITY_VOLUME = 128; // 0x80
     field public static final int FLAG_INCLUDE_NOT_IMPORTANT_VIEWS = 2; // 0x2
     field public static final int FLAG_REPORT_VIEW_IDS = 16; // 0x10
     field public static final int FLAG_REQUEST_ACCESSIBILITY_BUTTON = 256; // 0x100
     field public static final deprecated int FLAG_REQUEST_ENHANCED_WEB_ACCESSIBILITY = 8; // 0x8
     field public static final int FLAG_REQUEST_FILTER_KEY_EVENTS = 32; // 0x20
+    field public static final int FLAG_REQUEST_FINGERPRINT_GESTURES = 512; // 0x200
     field public static final int FLAG_REQUEST_TOUCH_EXPLORATION_MODE = 4; // 0x4
     field public static final int FLAG_RETRIEVE_INTERACTIVE_WINDOWS = 64; // 0x40
     field public int eventTypes;
@@ -2876,7 +2876,6 @@
 
   public static abstract class FingerprintGestureController.FingerprintGestureCallback {
     ctor public FingerprintGestureController.FingerprintGestureCallback();
-    method public deprecated void onGesture(int);
     method public void onGestureDetected(int);
     method public void onGestureDetectionAvailabilityChanged(boolean);
   }
@@ -2896,14 +2895,12 @@
 
   public static class GestureDescription.StrokeDescription {
     ctor public GestureDescription.StrokeDescription(android.graphics.Path, long, long);
-    ctor public GestureDescription.StrokeDescription(android.graphics.Path, long, long, int, boolean);
-    method public int getContinuedStrokeId();
+    ctor public GestureDescription.StrokeDescription(android.graphics.Path, long, long, boolean);
+    method public android.accessibilityservice.GestureDescription.StrokeDescription continueStroke(android.graphics.Path, long, long, boolean);
     method public long getDuration();
-    method public int getId();
     method public android.graphics.Path getPath();
     method public long getStartTime();
-    method public boolean isContinued();
-    field public static final int INVALID_STROKE_ID = -1; // 0xffffffff
+    method public boolean willContinue();
   }
 
 }
@@ -6561,7 +6558,7 @@
 
   public final class DnsEvent extends android.app.admin.NetworkEvent implements android.os.Parcelable {
     method public java.lang.String getHostname();
-    method public java.net.InetAddress[] getInetAddresses();
+    method public java.util.List<java.net.InetAddress> getInetAddresses();
     method public int getTotalResolvedAddressCount();
     method public void writeToParcel(android.os.Parcel, int);
     field public static final android.os.Parcelable.Creator<android.app.admin.DnsEvent> CREATOR;
@@ -6733,7 +6730,6 @@
   public abstract class BackupAgent extends android.content.ContextWrapper {
     ctor public BackupAgent();
     method public final void fullBackupFile(java.io.File, android.app.backup.FullBackupDataOutput);
-    method public long getBackupQuota();
     method public abstract void onBackup(android.os.ParcelFileDescriptor, android.app.backup.BackupDataOutput, android.os.ParcelFileDescriptor) throws java.io.IOException;
     method public void onCreate();
     method public void onDestroy();
@@ -6768,6 +6764,7 @@
   }
 
   public class BackupDataOutput {
+    method public long getQuota();
     method public int writeEntityData(byte[], int) throws java.io.IOException;
     method public int writeEntityHeader(java.lang.String, int) throws java.io.IOException;
   }
@@ -6796,6 +6793,7 @@
   }
 
   public class FullBackupDataOutput {
+    method public long getQuota();
   }
 
   public abstract class RestoreObserver {
@@ -8056,7 +8054,7 @@
     method public void setAdvertisingData(android.bluetooth.le.AdvertiseData);
     method public void setAdvertisingParameters(android.bluetooth.le.AdvertisingSetParameters);
     method public void setPeriodicAdvertisingData(android.bluetooth.le.AdvertiseData);
-    method public void setPeriodicAdvertisingEnable(boolean);
+    method public void setPeriodicAdvertisingEnabled(boolean);
     method public void setPeriodicAdvertisingParameters(android.bluetooth.le.PeriodicAdvertisingParameters);
     method public void setScanResponseData(android.bluetooth.le.AdvertiseData);
   }
@@ -9530,6 +9528,7 @@
     field public static final java.lang.String EXTRA_CHOOSER_TARGETS = "android.intent.extra.CHOOSER_TARGETS";
     field public static final java.lang.String EXTRA_CHOSEN_COMPONENT = "android.intent.extra.CHOSEN_COMPONENT";
     field public static final java.lang.String EXTRA_CHOSEN_COMPONENT_INTENT_SENDER = "android.intent.extra.CHOSEN_COMPONENT_INTENT_SENDER";
+    field public static final java.lang.String EXTRA_COMPONENT_NAME = "android.intent.extra.COMPONENT_NAME";
     field public static final java.lang.String EXTRA_CONTENT_ANNOTATIONS = "android.intent.extra.CONTENT_ANNOTATIONS";
     field public static final java.lang.String EXTRA_DATA_REMOVED = "android.intent.extra.DATA_REMOVED";
     field public static final java.lang.String EXTRA_DOCK_STATE = "android.intent.extra.DOCK_STATE";
@@ -10355,7 +10354,7 @@
     field public java.lang.String[] splitPublicSourceDirs;
     field public java.lang.String[] splitSourceDirs;
     field public java.lang.String targetPackage;
-    field public java.lang.String targetProcess;
+    field public java.lang.String targetProcesses;
   }
 
   public class LabeledIntent extends android.content.Intent {
@@ -13327,7 +13326,7 @@
     method public void setFilterBitmap(boolean);
     method public void setFlags(int);
     method public void setFontFeatureSettings(java.lang.String);
-    method public boolean setFontVariationSettings(java.lang.String) throws android.graphics.fonts.FontVariationAxis.InvalidFormatException;
+    method public boolean setFontVariationSettings(java.lang.String);
     method public void setHinting(int);
     method public void setLetterSpacing(float);
     method public void setLinearText(boolean);
@@ -13854,7 +13853,7 @@
     ctor public Typeface.Builder(android.content.res.AssetManager, java.lang.String);
     method public android.graphics.Typeface build();
     method public android.graphics.Typeface.Builder setFallback(java.lang.String);
-    method public android.graphics.Typeface.Builder setFontVariationSettings(java.lang.String) throws android.graphics.fonts.FontVariationAxis.InvalidFormatException;
+    method public android.graphics.Typeface.Builder setFontVariationSettings(java.lang.String);
     method public android.graphics.Typeface.Builder setFontVariationSettings(android.graphics.fonts.FontVariationAxis[]);
     method public android.graphics.Typeface.Builder setItalic(boolean);
     method public android.graphics.Typeface.Builder setTtcIndex(int);
@@ -14442,17 +14441,13 @@
 package android.graphics.fonts {
 
   public final class FontVariationAxis {
-    ctor public FontVariationAxis(java.lang.String, float) throws android.graphics.fonts.FontVariationAxis.InvalidFormatException;
-    method public static android.graphics.fonts.FontVariationAxis[] fromFontVariationSettings(java.lang.String) throws android.graphics.fonts.FontVariationAxis.InvalidFormatException;
+    ctor public FontVariationAxis(java.lang.String, float);
+    method public static android.graphics.fonts.FontVariationAxis[] fromFontVariationSettings(java.lang.String);
     method public float getStyleValue();
     method public java.lang.String getTag();
     method public static java.lang.String toFontVariationSettings(android.graphics.fonts.FontVariationAxis[]);
   }
 
-  public static class FontVariationAxis.InvalidFormatException extends java.lang.Exception {
-    ctor public FontVariationAxis.InvalidFormatException(java.lang.String);
-  }
-
 }
 
 package android.graphics.pdf {
@@ -37673,7 +37668,6 @@
     method public final void unlockAndRun(java.lang.Runnable);
     field public static final java.lang.String ACTION_QS_TILE = "android.service.quicksettings.action.QS_TILE";
     field public static final java.lang.String ACTION_QS_TILE_PREFERENCES = "android.service.quicksettings.action.QS_TILE_PREFERENCES";
-    field public static final java.lang.String EXTRA_COMPONENT = "android.service.quicksettings.extra.COMPONENT";
     field public static final java.lang.String META_DATA_ACTIVE_TILE = "android.service.quicksettings.ACTIVE_TILE";
   }
 
@@ -47606,8 +47600,8 @@
     field public static final java.lang.String ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN = "ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN";
     field public static final java.lang.String ACTION_ARGUMENT_HTML_ELEMENT_STRING = "ACTION_ARGUMENT_HTML_ELEMENT_STRING";
     field public static final java.lang.String ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT = "ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT";
-    field public static final java.lang.String ACTION_ARGUMENT_MOVE_WINDOW_X = "android.view.accessibility.action.ARGUMENT_MOVE_WINDOW_X";
-    field public static final java.lang.String ACTION_ARGUMENT_MOVE_WINDOW_Y = "android.view.accessibility.action.ARGUMENT_MOVE_WINDOW_Y";
+    field public static final java.lang.String ACTION_ARGUMENT_MOVE_WINDOW_X = "ACTION_ARGUMENT_MOVE_WINDOW_X";
+    field public static final java.lang.String ACTION_ARGUMENT_MOVE_WINDOW_Y = "ACTION_ARGUMENT_MOVE_WINDOW_Y";
     field public static final java.lang.String ACTION_ARGUMENT_PROGRESS_VALUE = "android.view.accessibility.action.ARGUMENT_PROGRESS_VALUE";
     field public static final java.lang.String ACTION_ARGUMENT_ROW_INT = "android.view.accessibility.action.ARGUMENT_ROW_INT";
     field public static final java.lang.String ACTION_ARGUMENT_SELECTION_END_INT = "ACTION_ARGUMENT_SELECTION_END_INT";
@@ -47789,10 +47783,10 @@
     method public android.view.accessibility.AccessibilityNodeInfo getRoot();
     method public java.lang.CharSequence getTitle();
     method public int getType();
-    method public boolean inPictureInPicture();
     method public boolean isAccessibilityFocused();
     method public boolean isActive();
     method public boolean isFocused();
+    method public boolean isInPictureInPictureMode();
     method public static android.view.accessibility.AccessibilityWindowInfo obtain();
     method public static android.view.accessibility.AccessibilityWindowInfo obtain(android.view.accessibility.AccessibilityWindowInfo);
     method public void recycle();
@@ -48151,7 +48145,7 @@
     method public void unregisterCallback(android.view.autofill.AutofillManager.AutofillCallback);
     field public static final java.lang.String EXTRA_ASSIST_STRUCTURE = "android.view.autofill.extra.ASSIST_STRUCTURE";
     field public static final java.lang.String EXTRA_AUTHENTICATION_RESULT = "android.view.autofill.extra.AUTHENTICATION_RESULT";
-    field public static final java.lang.String EXTRA_DATA_EXTRAS = "android.view.autofill.extra.DATA_EXTRAS";
+    field public static final java.lang.String EXTRA_CLIENT_STATE = "android.view.autofill.extra.EXTRA_CLIENT_STATE";
   }
 
   public static abstract class AutofillManager.AutofillCallback {
@@ -51804,7 +51798,7 @@
     method public void setExtractedText(android.view.inputmethod.ExtractedText);
     method public void setFilters(android.text.InputFilter[]);
     method public void setFontFeatureSettings(java.lang.String);
-    method public boolean setFontVariationSettings(java.lang.String) throws android.graphics.fonts.FontVariationAxis.InvalidFormatException;
+    method public boolean setFontVariationSettings(java.lang.String);
     method protected boolean setFrame(int, int, int, int);
     method public void setFreezesText(boolean);
     method public void setGravity(int);
diff --git a/api/test-removed.txt b/api/test-removed.txt
index 8c81ef4..779ff7c 100644
--- a/api/test-removed.txt
+++ b/api/test-removed.txt
@@ -452,6 +452,14 @@
 
 }
 
+package android.view.accessibility {
+
+  public final class AccessibilityWindowInfo implements android.os.Parcelable {
+    method public boolean inPictureInPicture();
+  }
+
+}
+
 package android.webkit {
 
   public class WebViewClient {
diff --git a/core/java/android/accessibilityservice/AccessibilityService.java b/core/java/android/accessibilityservice/AccessibilityService.java
index 64d7d4c..af0a204 100644
--- a/core/java/android/accessibilityservice/AccessibilityService.java
+++ b/core/java/android/accessibilityservice/AccessibilityService.java
@@ -619,20 +619,10 @@
      * @return The controller for fingerprint gestures, or {@code null} if gestures are unavailable.
      */
     @RequiresPermission(android.Manifest.permission.USE_FINGERPRINT)
-    public final @Nullable FingerprintGestureController getFingerprintGestureController() {
-        if ((mFingerprintGestureController == null)
-                && getPackageManager().hasSystemFeature(FEATURE_FINGERPRINT)) {
-            FingerprintManager fingerprintManager = getSystemService(FingerprintManager.class);
-            if ((fingerprintManager != null) && fingerprintManager.isHardwareDetected()) {
-                AccessibilityServiceInfo info = getServiceInfo();
-                int fingerprintCapabilityMask =
-                        AccessibilityServiceInfo.CAPABILITY_CAN_CAPTURE_FINGERPRINT_GESTURES;
-                if ((info.getCapabilities() & fingerprintCapabilityMask) != 0) {
-                    mFingerprintGestureController = new FingerprintGestureController(
-                            AccessibilityInteractionClient.getInstance()
-                                    .getConnection(mConnectionId));
-                }
-            }
+    public final @NonNull FingerprintGestureController getFingerprintGestureController() {
+        if (mFingerprintGestureController == null) {
+            mFingerprintGestureController = new FingerprintGestureController(
+                    AccessibilityInteractionClient.getInstance().getConnection(mConnectionId));
         }
         return mFingerprintGestureController;
     }
diff --git a/core/java/android/accessibilityservice/AccessibilityServiceInfo.java b/core/java/android/accessibilityservice/AccessibilityServiceInfo.java
index 3cda489..70a6ce6 100644
--- a/core/java/android/accessibilityservice/AccessibilityServiceInfo.java
+++ b/core/java/android/accessibilityservice/AccessibilityServiceInfo.java
@@ -119,9 +119,9 @@
 
     /**
      * Capability: This accessibility service can capture gestures from the fingerprint sensor
-     * @see android.R.styleable#AccessibilityService_canCaptureFingerprintGestures
+     * @see android.R.styleable#AccessibilityService_canRequestFingerprintGestures
      */
-    public static final int CAPABILITY_CAN_CAPTURE_FINGERPRINT_GESTURES = 0x00000040;
+    public static final int CAPABILITY_CAN_REQUEST_FINGERPRINT_GESTURES = 0x00000040;
 
     private static SparseArray<CapabilityInfo> sAvailableCapabilityInfos;
 
@@ -301,7 +301,7 @@
      * This flag requests that all fingerprint gestures be sent to the accessibility service.
      * It is handled in {@link FingerprintGestureController}
      */
-    public static final int FLAG_CAPTURE_FINGERPRINT_GESTURES = 0x00000200;
+    public static final int FLAG_REQUEST_FINGERPRINT_GESTURES = 0x00000200;
 
     /** {@hide} */
     public static final int FLAG_FORCE_DIRECT_BOOT_AWARE = 0x00010000;
@@ -521,8 +521,8 @@
                 mCapabilities |= CAPABILITY_CAN_PERFORM_GESTURES;
             }
             if (asAttributes.getBoolean(com.android.internal.R.styleable
-                    .AccessibilityService_canCaptureFingerprintGestures, false)) {
-                mCapabilities |= CAPABILITY_CAN_CAPTURE_FINGERPRINT_GESTURES;
+                    .AccessibilityService_canRequestFingerprintGestures, false)) {
+                mCapabilities |= CAPABILITY_CAN_REQUEST_FINGERPRINT_GESTURES;
             }
             TypedValue peekedValue = asAttributes.peekValue(
                     com.android.internal.R.styleable.AccessibilityService_description);
@@ -971,8 +971,8 @@
                 return "FLAG_ENABLE_ACCESSIBILITY_VOLUME";
             case FLAG_REQUEST_ACCESSIBILITY_BUTTON:
                 return "FLAG_REQUEST_ACCESSIBILITY_BUTTON";
-            case FLAG_CAPTURE_FINGERPRINT_GESTURES:
-                return "FLAG_CAPTURE_FINGERPRINT_GESTURES";
+            case FLAG_REQUEST_FINGERPRINT_GESTURES:
+                return "FLAG_REQUEST_FINGERPRINT_GESTURES";
             default:
                 return null;
         }
@@ -1000,8 +1000,8 @@
                 return "CAPABILITY_CAN_CONTROL_MAGNIFICATION";
             case CAPABILITY_CAN_PERFORM_GESTURES:
                 return "CAPABILITY_CAN_PERFORM_GESTURES";
-            case CAPABILITY_CAN_CAPTURE_FINGERPRINT_GESTURES:
-                return "CAPABILITY_CAN_CAPTURE_FINGERPRINT_GESTURES";
+            case CAPABILITY_CAN_REQUEST_FINGERPRINT_GESTURES:
+                return "CAPABILITY_CAN_REQUEST_FINGERPRINT_GESTURES";
             default:
                 return "UNKNOWN";
         }
@@ -1064,8 +1064,8 @@
                             R.string.capability_title_canPerformGestures,
                             R.string.capability_desc_canPerformGestures));
             if ((context == null) || fingerprintAvailable(context)) {
-                sAvailableCapabilityInfos.put(CAPABILITY_CAN_CAPTURE_FINGERPRINT_GESTURES,
-                        new CapabilityInfo(CAPABILITY_CAN_CAPTURE_FINGERPRINT_GESTURES,
+                sAvailableCapabilityInfos.put(CAPABILITY_CAN_REQUEST_FINGERPRINT_GESTURES,
+                        new CapabilityInfo(CAPABILITY_CAN_REQUEST_FINGERPRINT_GESTURES,
                                 R.string.capability_title_canCaptureFingerprintGestures,
                                 R.string.capability_desc_canCaptureFingerprintGestures));
             }
diff --git a/core/java/android/accessibilityservice/FingerprintGestureController.java b/core/java/android/accessibilityservice/FingerprintGestureController.java
index db00fff..9f04cea 100644
--- a/core/java/android/accessibilityservice/FingerprintGestureController.java
+++ b/core/java/android/accessibilityservice/FingerprintGestureController.java
@@ -181,11 +181,5 @@
          * {@link #FINGERPRINT_GESTURE_SWIPE_RIGHT}.
          */
         public void onGestureDetected(int gesture) {}
-
-        /**
-         * @deprecated Never called. Use onGestureDetected.
-         */
-        @Deprecated
-        public void onGesture(int gesture) {}
     }
 }
diff --git a/core/java/android/accessibilityservice/GestureDescription.java b/core/java/android/accessibilityservice/GestureDescription.java
index c9da152..92567d7 100644
--- a/core/java/android/accessibilityservice/GestureDescription.java
+++ b/core/java/android/accessibilityservice/GestureDescription.java
@@ -24,6 +24,8 @@
 import android.os.Parcel;
 import android.os.Parcelable;
 
+import com.android.internal.util.Preconditions;
+
 import java.util.ArrayList;
 import java.util.List;
 
@@ -130,7 +132,7 @@
                 touchPoints[numPointsFound].mIsStartOfPath =
                         (strokeDescription.getContinuedStrokeId() < 0)
                                 && (time == strokeDescription.mStartTime);
-                touchPoints[numPointsFound].mIsEndOfPath = !strokeDescription.isContinued()
+                touchPoints[numPointsFound].mIsEndOfPath = !strokeDescription.willContinue()
                         && (time == strokeDescription.mEndTime);
                 strokeDescription.getPosForTime(time, mTempPos);
                 touchPoints[numPointsFound].mX = Math.round(mTempPos[0]);
@@ -197,7 +199,7 @@
      * Immutable description of stroke that can be part of a gesture.
      */
     public static class StrokeDescription {
-        public static final int INVALID_STROKE_ID = -1;
+        private static final int INVALID_STROKE_ID = -1;
 
         static int sIdCounter;
 
@@ -210,7 +212,7 @@
         float[] mTapLocation;
         int mId;
         boolean mContinued;
-        int mContinuedStrokeId;
+        int mContinuedStrokeId = INVALID_STROKE_ID;
 
         /**
          * @param path The path to follow. Must have exactly one contour. The bounds of the path
@@ -219,12 +221,12 @@
          * @param startTime The time, in milliseconds, from the time the gesture starts to the
          * time the stroke should start. Must not be negative.
          * @param duration The duration, in milliseconds, the stroke takes to traverse the path.
-         * Must not be negative.
+         * Must be positive.
          */
         public StrokeDescription(@NonNull Path path,
                 @IntRange(from = 0) long startTime,
                 @IntRange(from = 0) long duration) {
-            this(path, startTime, duration, INVALID_STROKE_ID, false);
+            this(path, startTime, duration, false);
         }
 
         /**
@@ -235,36 +237,23 @@
          * time the stroke should start. Must not be negative.
          * @param duration The duration, in milliseconds, the stroke takes to traverse the path.
          * Must be positive.
-         * @param continuedStrokeId The ID of the stroke that this stroke continues, or
-         * {@link #INVALID_STROKE_ID} if it continues no stroke. The stroke it
-         * continues must have its isContinued flag set to {@code true} and must be in the
-         * gesture dispatched immediately before the one containing this stroke.
-         * @param isContinued {@code true} if this stroke will be continued by one in the
+         * @param willContinue {@code true} if this stroke will be continued by one in the
          * next gesture {@code false} otherwise. Continued strokes keep their pointers down when
          * the gesture completes.
          */
         public StrokeDescription(@NonNull Path path,
                 @IntRange(from = 0) long startTime,
                 @IntRange(from = 0) long duration,
-                @IntRange(from = 0) int continuedStrokeId,
-                boolean isContinued) {
-            mContinued = isContinued;
-            mContinuedStrokeId = continuedStrokeId;
-            if (duration <= 0) {
-                throw new IllegalArgumentException("Duration must be positive");
-            }
-            if (startTime < 0) {
-                throw new IllegalArgumentException("Start time must not be negative");
-            }
+                boolean willContinue) {
+            mContinued = willContinue;
+            Preconditions.checkArgument(duration > 0, "Duration must be positive");
+            Preconditions.checkArgument(startTime >= 0, "Start time must not be negative");
+            Preconditions.checkArgument(!path.isEmpty(), "Path is empty");
             RectF bounds = new RectF();
             path.computeBounds(bounds, false /* unused */);
-            if ((bounds.bottom < 0) || (bounds.top < 0) || (bounds.right < 0)
-                    || (bounds.left < 0)) {
-                throw new IllegalArgumentException("Path bounds must not be negative");
-            }
-            if (path.isEmpty()) {
-                throw new IllegalArgumentException("Path is empty");
-            }
+            Preconditions.checkArgument((bounds.bottom >= 0) && (bounds.top >= 0)
+                    && (bounds.right >= 0) && (bounds.left >= 0),
+                    "Path bounds must not be negative");
             mPath = new Path(path);
             mPathMeasure = new PathMeasure(path, false);
             if (mPathMeasure.getLength() == 0) {
@@ -321,17 +310,44 @@
          * stroke in a future gesture.
          *
          * @return the ID of this stroke
+         * @hide
          */
         public int getId() {
             return mId;
         }
 
         /**
+         * Create a new stroke that will continue this one. This is only possible if this stroke
+         * will continue.
+         *
+         * @param path The path for the stroke that continues this one. The starting point of
+         *             this path must match the ending point of the stroke it continues.
+         * @param startTime The time, in milliseconds, from the time the gesture starts to the
+         *                  time this stroke should start. Must not be negative. This time is from
+         *                  the start of the new gesture, not the one being continued.
+         * @param duration The duration for the new stroke. Must not be negative.
+         * @param willContinue {@code true} if this stroke will be continued by one in the
+         *             next gesture {@code false} otherwise.
+         * @return
+         */
+        public StrokeDescription continueStroke(Path path, long startTime, long duration,
+                boolean willContinue) {
+            if (!mContinued) {
+                throw new IllegalStateException(
+                        "Only strokes marked willContinue can be continued");
+            }
+            StrokeDescription strokeDescription =
+                    new StrokeDescription(path, startTime, duration, willContinue);
+            strokeDescription.mContinuedStrokeId = mId;
+            return strokeDescription;
+        }
+
+        /**
          * Check if this stroke is marked to continue in the next gesture.
          *
          * @return {@code true} if the stroke is to be continued.
          */
-        public boolean isContinued() {
+        public boolean willContinue() {
             return mContinued;
         }
 
@@ -339,6 +355,7 @@
          * Get the ID of the stroke that this one will continue.
          *
          * @return The ID of the stroke that this stroke continues, or 0 if no such stroke exists.
+         * @hide
          */
         public int getContinuedStrokeId() {
             return mContinuedStrokeId;
diff --git a/core/java/android/app/admin/DnsEvent.java b/core/java/android/app/admin/DnsEvent.java
index 87f86b5..c21725f 100644
--- a/core/java/android/app/admin/DnsEvent.java
+++ b/core/java/android/app/admin/DnsEvent.java
@@ -21,6 +21,9 @@
 
 import java.net.InetAddress;
 import java.net.UnknownHostException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
 
 /**
  * A class that represents a DNS lookup event.
@@ -62,16 +65,17 @@
     }
 
     /** Returns (possibly a subset of) the IP addresses returned. */
-    public InetAddress[] getInetAddresses() {
-        final int length = ipAddresses != null ? ipAddresses.length : 0;
-        final InetAddress[] inetAddresses = new InetAddress[length];
-        for (int i = 0; i < length; i++) {
+    public List<InetAddress> getInetAddresses() {
+        if (ipAddresses == null || ipAddresses.length == 0) {
+            return Collections.emptyList();
+        }
+        final List<InetAddress> inetAddresses = new ArrayList<>(ipAddresses.length);
+        for (final String ipAddress : ipAddresses) {
             try {
                 // ipAddress is already an address, not a host name, no DNS resolution will happen.
-                inetAddresses[i] = InetAddress.getByName(ipAddresses[i]);
+                inetAddresses.add(InetAddress.getByName(ipAddress));
             } catch (UnknownHostException e) {
                 // Should never happen as we aren't passing a host name.
-                inetAddresses[i] = InetAddress.getLoopbackAddress();
             }
         }
         return inetAddresses;
@@ -79,7 +83,7 @@
 
     /**
      * Returns the number of IP addresses returned from the DNS lookup event. May be different from
-     * the length of the array returned by {@link #getInetAddresses()} if there were too many
+     * the length of the list returned by {@link #getInetAddresses()} if there were too many
      * addresses to log.
      */
     public int getTotalResolvedAddressCount() {
diff --git a/core/java/android/app/backup/BackupAgent.java b/core/java/android/app/backup/BackupAgent.java
index 11636a5..5f92af9 100644
--- a/core/java/android/app/backup/BackupAgent.java
+++ b/core/java/android/app/backup/BackupAgent.java
@@ -133,8 +133,6 @@
 
     Handler mHandler = null;
 
-    private long mBackupQuotaBytes = -1;
-
     Handler getHandler() {
         if (mHandler == null) {
             mHandler = new Handler(Looper.getMainLooper());
@@ -186,21 +184,6 @@
     }
 
     /**
-     * Returns the quota in bytes for the currently requested backup operation. The value can
-     * vary for each operation depending on the type of backup being done.
-     *
-     * <p>Can be called only from {@link BackupAgent#onFullBackup(FullBackupDataOutput)} or
-     * {@link BackupAgent#onBackup(ParcelFileDescriptor, BackupDataOutput, ParcelFileDescriptor)}.
-     */
-    public long getBackupQuota() {
-        if (mBackupQuotaBytes < 0) {
-            throw new IllegalStateException(
-                    "Backup quota is available only during backup operations.");
-        }
-        return mBackupQuotaBytes;
-    }
-
-    /**
      * The application is being asked to write any data changed since the last
      * time it performed a backup operation. The state data recorded during the
      * last backup pass is provided in the <code>oldState</code> file
@@ -918,10 +901,8 @@
             // Ensure that we're running with the app's normal permission level
             long ident = Binder.clearCallingIdentity();
 
-            mBackupQuotaBytes = quotaBytes;
-
             if (DEBUG) Log.v(TAG, "doBackup() invoked");
-            BackupDataOutput output = new BackupDataOutput(data.getFileDescriptor());
+            BackupDataOutput output = new BackupDataOutput(data.getFileDescriptor(), quotaBytes);
 
             try {
                 BackupAgent.this.onBackup(oldState, output, newState);
@@ -937,9 +918,6 @@
                 // guarantee themselves).
                 waitForSharedPrefs();
 
-                // Unset quota after onBackup is done.
-                mBackupQuotaBytes = -1;
-
                 Binder.restoreCallingIdentity(ident);
                 try {
                     callbackBinder.opComplete(token, 0);
@@ -997,8 +975,6 @@
             // Ensure that we're running with the app's normal permission level
             long ident = Binder.clearCallingIdentity();
 
-            mBackupQuotaBytes = quotaBytes;
-
             if (DEBUG) Log.v(TAG, "doFullBackup() invoked");
 
             // Ensure that any SharedPreferences writes have landed *before*
@@ -1006,7 +982,7 @@
             waitForSharedPrefs();
 
             try {
-                BackupAgent.this.onFullBackup(new FullBackupDataOutput(data));
+                BackupAgent.this.onFullBackup(new FullBackupDataOutput(data, quotaBytes));
             } catch (IOException ex) {
                 Log.d(TAG, "onFullBackup (" + BackupAgent.this.getClass().getName() + ") threw", ex);
                 throw new RuntimeException(ex);
@@ -1017,9 +993,6 @@
                 // ... and then again after, as in the doBackup() case
                 waitForSharedPrefs();
 
-                // Unset quota after onFullBackup is done.
-                mBackupQuotaBytes = -1;
-
                 // Send the EOD marker indicating that there is no more data
                 // forthcoming from this agent.
                 try {
@@ -1046,9 +1019,7 @@
         public void doMeasureFullBackup(long quotaBytes, int token, IBackupManager callbackBinder) {
             // Ensure that we're running with the app's normal permission level
             final long ident = Binder.clearCallingIdentity();
-            FullBackupDataOutput measureOutput = new FullBackupDataOutput();
-
-            mBackupQuotaBytes = quotaBytes;
+            FullBackupDataOutput measureOutput = new FullBackupDataOutput(quotaBytes);
 
             waitForSharedPrefs();
             try {
@@ -1060,8 +1031,6 @@
                 Log.d(TAG, "onFullBackup[M] (" + BackupAgent.this.getClass().getName() + ") threw", ex);
                 throw ex;
             } finally {
-                // Unset quota after onFullBackup is done.
-                mBackupQuotaBytes = -1;
                 Binder.restoreCallingIdentity(ident);
                 try {
                     callbackBinder.opComplete(token, measureOutput.getSize());
diff --git a/core/java/android/app/backup/BackupDataOutput.java b/core/java/android/app/backup/BackupDataOutput.java
index 1fe63e7..c7586a2 100644
--- a/core/java/android/app/backup/BackupDataOutput.java
+++ b/core/java/android/app/backup/BackupDataOutput.java
@@ -62,12 +62,23 @@
  * @see BackupAgent
  */
 public class BackupDataOutput {
+    final long mQuota;
     long mBackupWriter;
 
+    /**
+     * Construct a BackupDataOutput purely for data-stream manipulation.  This instance will
+     * not report usable quota information.
+     * @hide */
+    @SystemApi
+    public BackupDataOutput(FileDescriptor fd) {
+        this(fd, -1);
+    }
+
     /** @hide */
     @SystemApi
-    public BackupDataOutput(FileDescriptor fd) {
+    public BackupDataOutput(FileDescriptor fd, long quota) {
         if (fd == null) throw new NullPointerException();
+        mQuota = quota;
         mBackupWriter = ctor(fd);
         if (mBackupWriter == 0) {
             throw new RuntimeException("Native initialization failed with fd=" + fd);
@@ -75,6 +86,16 @@
     }
 
     /**
+     * Returns the quota in bytes for the application's current backup operation.  The
+     * value can vary for each operation.
+     *
+     * @see FullBackupDataOutput#getQuota()
+     */
+    public long getQuota() {
+        return mQuota;
+    }
+
+    /**
      * Mark the beginning of one record in the backup data stream. This must be called before
      * {@link #writeEntityData}.
      * @param key A string key that uniquely identifies the data record within the application.
diff --git a/core/java/android/app/backup/FullBackupDataOutput.java b/core/java/android/app/backup/FullBackupDataOutput.java
index 94704b9..5deedd0 100644
--- a/core/java/android/app/backup/FullBackupDataOutput.java
+++ b/core/java/android/app/backup/FullBackupDataOutput.java
@@ -10,17 +10,35 @@
 public class FullBackupDataOutput {
     // Currently a name-scoping shim around BackupDataOutput
     private final BackupDataOutput mData;
+    private final long mQuota;
     private long mSize;
 
+    /**
+     * Returns the quota in bytes for the application's current backup operation.  The
+     * value can vary for each operation.
+     *
+     * @see BackupDataOutput#getQuota()
+     */
+    public long getQuota() {
+        return mQuota;
+    }
+
     /** @hide - used only in measure operation */
-    public FullBackupDataOutput() {
+    public FullBackupDataOutput(long quota) {
         mData = null;
+        mQuota = quota;
         mSize = 0;
     }
 
     /** @hide */
+    public FullBackupDataOutput(ParcelFileDescriptor fd, long quota) {
+        mData = new BackupDataOutput(fd.getFileDescriptor(), quota);
+        mQuota = quota;
+    }
+
+    /** @hide - used only internally to the backup manager service's stream construction */
     public FullBackupDataOutput(ParcelFileDescriptor fd) {
-        mData = new BackupDataOutput(fd.getFileDescriptor());
+        this(fd, -1);
     }
 
     /** @hide */
diff --git a/core/java/android/bluetooth/le/AdvertisingSet.java b/core/java/android/bluetooth/le/AdvertisingSet.java
index 3021be1..1bc211c 100644
--- a/core/java/android/bluetooth/le/AdvertisingSet.java
+++ b/core/java/android/bluetooth/le/AdvertisingSet.java
@@ -172,7 +172,7 @@
      *
      * @param enable whether the periodic advertising should be enabled (true), or disabled (false).
      */
-    public void setPeriodicAdvertisingEnable(boolean enable) {
+    public void setPeriodicAdvertisingEnabled(boolean enable) {
         try {
             gatt.setPeriodicAdvertisingEnable(this.advertiserId, enable);
         } catch (RemoteException e) {
diff --git a/core/java/android/bluetooth/le/AdvertisingSetCallback.java b/core/java/android/bluetooth/le/AdvertisingSetCallback.java
index 2c46e85..c3c16a4 100644
--- a/core/java/android/bluetooth/le/AdvertisingSetCallback.java
+++ b/core/java/android/bluetooth/le/AdvertisingSetCallback.java
@@ -135,7 +135,7 @@
                                              int status) {}
 
     /**
-     * Callback triggered in response to {@link AdvertisingSet#setPeriodicAdvertisingEnable}
+     * Callback triggered in response to {@link AdvertisingSet#setPeriodicAdvertisingEnabled}
      * indicating result of the operation.
      *
      * @param advertisingSet The advertising set.
diff --git a/core/java/android/bluetooth/le/AdvertisingSetParameters.java b/core/java/android/bluetooth/le/AdvertisingSetParameters.java
index 31d8f48..71c4484 100644
--- a/core/java/android/bluetooth/le/AdvertisingSetParameters.java
+++ b/core/java/android/bluetooth/le/AdvertisingSetParameters.java
@@ -242,7 +242,7 @@
          * non-connectable.
          * Legacy advertisements can be both connectable and scannable. Non-legacy
          * advertisements can be only scannable or only connectable.
-         * @param connectable Controls whether the advertisment type will be
+         * @param connectable Controls whether the advertisement type will be
          * connectable (true) or non-connectable (false).
          */
         public Builder setConnectable(boolean connectable) {
@@ -254,7 +254,7 @@
          * Set whether the advertisement type should be scannable.
          * Legacy advertisements can be both connectable and scannable. Non-legacy
          * advertisements can be only scannable or only connectable.
-         * @param scannable Controls whether the advertisment type will be
+         * @param scannable Controls whether the advertisement type will be
          * scannable (true) or non-scannable (false).
          */
         public Builder setScannable(boolean scannable) {
@@ -386,6 +386,7 @@
 
         /**
          * Build the {@link AdvertisingSetParameters} object.
+         * @throws IllegalStateException if invalid combination of parameters is used.
          */
         public AdvertisingSetParameters build() {
             if (isLegacy) {
@@ -394,22 +395,22 @@
                 }
 
                 if (connectable == true && scannable == false) {
-                    throw new IllegalArgumentException(
+                    throw new IllegalStateException(
                         "Legacy advertisement can't be connectable and non-scannable");
                 }
 
                 if (includeTxPower) {
-                    throw new IllegalArgumentException(
+                    throw new IllegalStateException(
                         "Legacy advertising can't include TX power level in header");
                 }
             } else {
                 if (connectable && scannable) {
-                    throw new IllegalArgumentException(
+                    throw new IllegalStateException(
                         "Advertising can't be both connectable and scannable");
                 }
 
                 if (isAnonymous && connectable) {
-                    throw new IllegalArgumentException(
+                    throw new IllegalStateException(
                         "Advertising can't be both connectable and anonymous");
                 }
             }
diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java
index d746377..e013662 100644
--- a/core/java/android/content/Intent.java
+++ b/core/java/android/content/Intent.java
@@ -1840,6 +1840,14 @@
     public static final String EXTRA_SPLIT_NAME = "android.intent.extra.SPLIT_NAME";
 
     /**
+     * Intent extra: A {@link ComponentName} value.
+     * <p>
+     * Type: String
+     * </p>
+     */
+    public static final String EXTRA_COMPONENT_NAME = "android.intent.extra.COMPONENT_NAME";
+
+    /**
      * Intent extra: An extra for specifying whether a result is needed.
      * <p>
      * Type: boolean
diff --git a/core/java/android/content/pm/InstrumentationInfo.java b/core/java/android/content/pm/InstrumentationInfo.java
index f6f1be6..3faa951 100644
--- a/core/java/android/content/pm/InstrumentationInfo.java
+++ b/core/java/android/content/pm/InstrumentationInfo.java
@@ -19,7 +19,6 @@
 import android.os.Parcel;
 import android.os.Parcelable;
 import android.util.SparseArray;
-import android.util.SparseIntArray;
 
 /**
  * Information you can retrieve about a particular piece of test
@@ -38,7 +37,7 @@
      * runs in the main process of the targetPackage.  Can either be a comma-separated list
      * of process names or '*' for any process that launches to run targetPackage code.
      */
-    public String targetProcess;
+    public String targetProcesses;
 
     /**
      * Full path to the base APK for this application.
@@ -122,7 +121,7 @@
     public InstrumentationInfo(InstrumentationInfo orig) {
         super(orig);
         targetPackage = orig.targetPackage;
-        targetProcess = orig.targetProcess;
+        targetProcesses = orig.targetProcesses;
         sourceDir = orig.sourceDir;
         publicSourceDir = orig.publicSourceDir;
         splitNames = orig.splitNames;
@@ -151,7 +150,7 @@
     public void writeToParcel(Parcel dest, int parcelableFlags) {
         super.writeToParcel(dest, parcelableFlags);
         dest.writeString(targetPackage);
-        dest.writeString(targetProcess);
+        dest.writeString(targetProcesses);
         dest.writeString(sourceDir);
         dest.writeString(publicSourceDir);
         dest.writeStringArray(splitNames);
@@ -181,7 +180,7 @@
     private InstrumentationInfo(Parcel source) {
         super(source);
         targetPackage = source.readString();
-        targetProcess = source.readString();
+        targetProcesses = source.readString();
         sourceDir = source.readString();
         publicSourceDir = source.readString();
         splitNames = source.readStringArray();
diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java
index a05f11b..766eab9 100644
--- a/core/java/android/content/pm/PackageParser.java
+++ b/core/java/android/content/pm/PackageParser.java
@@ -3300,8 +3300,8 @@
         a.info.targetPackage = str != null ? str.intern() : null;
 
         str = sa.getNonResourceString(
-                com.android.internal.R.styleable.AndroidManifestInstrumentation_targetProcess);
-        a.info.targetProcess = str != null ? str.intern() : null;
+                com.android.internal.R.styleable.AndroidManifestInstrumentation_targetProcesses);
+        a.info.targetProcesses = str != null ? str.intern() : null;
 
         a.info.handleProfiling = sa.getBoolean(
                 com.android.internal.R.styleable.AndroidManifestInstrumentation_handleProfiling,
@@ -7237,8 +7237,8 @@
                 info.targetPackage = info.targetPackage.intern();
             }
 
-            if (info.targetProcess != null) {
-                info.targetProcess = info.targetProcess.intern();
+            if (info.targetProcesses != null) {
+                info.targetProcesses = info.targetProcesses.intern();
             }
         }
 
diff --git a/core/java/android/provider/FontsContract.java b/core/java/android/provider/FontsContract.java
index 1013b0f..f909114 100644
--- a/core/java/android/provider/FontsContract.java
+++ b/core/java/android/provider/FontsContract.java
@@ -15,7 +15,6 @@
  */
 package android.provider;
 
-import static android.graphics.fonts.FontVariationAxis.InvalidFormatException;
 import static java.lang.annotation.RetentionPolicy.SOURCE;
 
 import android.annotation.IntDef;
@@ -601,7 +600,7 @@
             FontInfo[] fonts = getFontFromProvider(
                     context, request, providerInfo.authority, cancellationSignal);
             return new FontFamilyResult(FontFamilyResult.STATUS_OK, fonts);
-        } catch (InvalidFormatException e) {
+        } catch (IllegalArgumentException e) {
             return new FontFamilyResult(FontFamilyResult.STATUS_UNEXPECTED_DATA_PROVIDED, null);
         }
     }
@@ -755,7 +754,7 @@
     @VisibleForTesting
     public static @NonNull FontInfo[] getFontFromProvider(
             Context context, FontRequest request, String authority,
-            CancellationSignal cancellationSignal) throws InvalidFormatException {
+            CancellationSignal cancellationSignal) {
         ArrayList<FontInfo> result = new ArrayList<>();
         final Uri uri = new Uri.Builder().scheme(ContentResolver.SCHEME_CONTENT)
                 .authority(authority)
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index 89c0963..95be39b 100755
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -6622,6 +6622,13 @@
         public static final String PAYMENT_SERVICE_SEARCH_URI = "payment_service_search_uri";
 
         /**
+         * This is the query URI for finding a auto fill service to install.
+         *
+         * @hide
+         */
+        public static final String AUTOFILL_SERVICE_SEARCH_URI = "autofill_service_search_uri";
+
+        /**
          * If enabled, apps should try to skip any introductory hints on first launch. This might
          * apply to users that are already familiar with the environment or temporary users.
          * <p>
@@ -7717,6 +7724,14 @@
                 "location_background_throttle_interval_ms";
 
         /**
+         * Most frequent location update interval in milliseconds that proximity alert is allowed
+         * to request.
+         * @hide
+         */
+        public static final String LOCATION_BACKGROUND_THROTTLE_PROXIMITY_ALERT_INTERVAL_MS =
+                "location_background_throttle_proximity_alert_interval_ms";
+
+        /**
          * Packages that are whitelisted for background throttling (throttling will not be applied).
          * @hide
          */
diff --git a/core/java/android/service/quicksettings/TileService.java b/core/java/android/service/quicksettings/TileService.java
index 56b267f..c35423f 100644
--- a/core/java/android/service/quicksettings/TileService.java
+++ b/core/java/android/service/quicksettings/TileService.java
@@ -80,8 +80,13 @@
 public class TileService extends Service {
 
     /**
-     * An activity that provides a user interface for adjusting TileService preferences.
-     * Optional but recommended for apps that implement a TileService.
+     * An activity that provides a user interface for adjusting TileService
+     * preferences. Optional but recommended for apps that implement a
+     * TileService.
+     * <p>
+     * This intent may also define a {@link Intent#EXTRA_COMPONENT_NAME} value
+     * to indicate the {@link ComponentName} that caused the preferences to be
+     * opened.
      */
     @SdkConstant(SdkConstantType.INTENT_CATEGORY)
     public static final String ACTION_QS_TILE_PREFERENCES
@@ -130,13 +135,6 @@
     public static final String EXTRA_TOKEN = "token";
 
     /**
-     * May be included when {@link #ACTION_QS_TILE_PREFERENCES} is launched from a tile.
-     * This extra may contain the {@link ComponentName} of the tile that triggered
-     * the preferences to be opened.
-     */
-    public static final String EXTRA_COMPONENT = "android.service.quicksettings.extra.COMPONENT";
-
-    /**
      * @hide
      */
     public static final String EXTRA_STATE = "state";
@@ -445,7 +443,7 @@
      */
     public static final void requestListeningState(Context context, ComponentName component) {
         Intent intent = new Intent(ACTION_REQUEST_LISTENING);
-        intent.putExtra(EXTRA_COMPONENT, component);
+        intent.putExtra(Intent.EXTRA_COMPONENT_NAME, component);
         intent.setPackage("com.android.systemui");
         context.sendBroadcast(intent, Manifest.permission.BIND_QUICK_SETTINGS_TILE);
     }
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 4029a42..39f1170 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -805,6 +805,14 @@
     public static final int LAST_APP_ACCESSIBILITY_ID = Integer.MAX_VALUE / 2;
 
     /**
+     * Attribute to find the autofilled highlight
+     *
+     * @see #getAutofilledDrawable()
+     */
+    private static final int[] AUTOFILL_HIGHLIGHT_ATTR =
+            new int[]{android.R.attr.autofilledHighlight};
+
+    /**
      * Signals that compatibility booleans have been initialized according to
      * target SDK versions.
      */
@@ -7471,10 +7479,12 @@
      * <p>See {@link #autofill(AutofillValue)} and
      * {@link #onProvideAutofillVirtualStructure(ViewStructure, int)} for more info.
      * <p>To indicate that a virtual view was autofilled
-     * <code>@android:drawable/autofilled_highlight</code> should be drawn over it until the data
+     * <code>?android:attr/autofilledHighlight</code> should be drawn over it until the data
      * changes.
      *
      * @param values map of values to be autofilled, keyed by virtual child id.
+     *
+     * @attr ref android.R.styleable#Theme_autofilledHighlight
      */
     public void autofill(@NonNull @SuppressWarnings("unused") SparseArray<AutofillValue> values) {
     }
@@ -20406,15 +20416,13 @@
      *
      * @throws IllegalStateException if the drawable could not be found.
      */
-    @NonNull private Drawable getAutofilledDrawable() {
+    @Nullable private Drawable getAutofilledDrawable() {
         // Lazily load the isAutofilled drawable.
         if (mAttachInfo.mAutofilledDrawable == null) {
-            mAttachInfo.mAutofilledDrawable = mContext.getDrawable(R.drawable.autofilled_highlight);
-
-            if (mAttachInfo.mAutofilledDrawable == null) {
-                throw new IllegalStateException(
-                        "Could not find android:drawable/autofilled_highlight");
-            }
+            TypedArray a = mContext.getTheme().obtainStyledAttributes(AUTOFILL_HIGHLIGHT_ATTR);
+            int attributeResourceId = a.getResourceId(0, 0);
+            mAttachInfo.mAutofilledDrawable = mContext.getDrawable(attributeResourceId);
+            a.recycle();
         }
 
         return mAttachInfo.mAutofilledDrawable;
@@ -20429,8 +20437,10 @@
         if (isAutofilled()) {
             Drawable autofilledHighlight = getAutofilledDrawable();
 
-            autofilledHighlight.setBounds(0, 0, getWidth(), getHeight());
-            autofilledHighlight.draw(canvas);
+            if (autofilledHighlight != null) {
+                autofilledHighlight.setBounds(0, 0, getWidth(), getHeight());
+                autofilledHighlight.draw(canvas);
+            }
         }
     }
 
diff --git a/core/java/android/view/accessibility/AccessibilityNodeInfo.java b/core/java/android/view/accessibility/AccessibilityNodeInfo.java
index 94a4547..5148d92 100644
--- a/core/java/android/view/accessibility/AccessibilityNodeInfo.java
+++ b/core/java/android/view/accessibility/AccessibilityNodeInfo.java
@@ -487,7 +487,7 @@
      * @see AccessibilityAction#ACTION_MOVE_WINDOW
      */
     public static final String ACTION_ARGUMENT_MOVE_WINDOW_X =
-            "android.view.accessibility.action.ARGUMENT_MOVE_WINDOW_X";
+            "ACTION_ARGUMENT_MOVE_WINDOW_X";
 
     /**
      * Argument for specifying the y coordinate to which to move a window.
@@ -501,7 +501,7 @@
      * @see AccessibilityAction#ACTION_MOVE_WINDOW
      */
     public static final String ACTION_ARGUMENT_MOVE_WINDOW_Y =
-            "android.view.accessibility.action.ARGUMENT_MOVE_WINDOW_Y";
+            "ACTION_ARGUMENT_MOVE_WINDOW_Y";
 
     /**
      * Argument to pass the {@link AccessibilityClickableSpan}.
diff --git a/core/java/android/view/accessibility/AccessibilityWindowInfo.java b/core/java/android/view/accessibility/AccessibilityWindowInfo.java
index 2a7537b..f11767d 100644
--- a/core/java/android/view/accessibility/AccessibilityWindowInfo.java
+++ b/core/java/android/view/accessibility/AccessibilityWindowInfo.java
@@ -231,8 +231,18 @@
      * Check if the window is in picture-in-picture mode.
      *
      * @return {@code true} if the window is in picture-in-picture mode, {@code false} otherwise.
+     * @removed
      */
     public boolean inPictureInPicture() {
+        return isInPictureInPictureMode();
+    }
+
+    /**
+     * Check if the window is in picture-in-picture mode.
+     *
+     * @return {@code true} if the window is in picture-in-picture mode, {@code false} otherwise.
+     */
+    public boolean isInPictureInPictureMode() {
         return mInPictureInPicture;
     }
 
diff --git a/core/java/android/view/autofill/AutofillManager.java b/core/java/android/view/autofill/AutofillManager.java
index ab30a04..94ca562 100644
--- a/core/java/android/view/autofill/AutofillManager.java
+++ b/core/java/android/view/autofill/AutofillManager.java
@@ -94,7 +94,8 @@
      * <p>
      * Type: {@link android.os.Bundle}
      */
-    public static final String EXTRA_DATA_EXTRAS = "android.view.autofill.extra.DATA_EXTRAS";
+    public static final String EXTRA_CLIENT_STATE =
+            "android.view.autofill.extra.EXTRA_CLIENT_STATE";
 
     static final String SESSION_ID_TAG = "android:sessionId";
     static final String LAST_AUTOFILLED_DATA_TAG = "android:lastAutoFilledData";
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index 492010c..eee70e0 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -56,7 +56,6 @@
 import android.graphics.Typeface;
 import android.graphics.drawable.Drawable;
 import android.graphics.fonts.FontVariationAxis;
-import android.graphics.fonts.FontVariationAxis.InvalidFormatException;
 import android.icu.text.DecimalFormatSymbols;
 import android.os.AsyncTask;
 import android.os.Build.VERSION_CODES;
@@ -3925,14 +3924,13 @@
      *         TextView. This function also returns true for empty settings string. Otherwise
      *         returns false.
      *
-     * @throws InvalidFormatException If given string is not a valid font variation settings
-     *                                format.
+     * @throws IllegalArgumentException If given string is not a valid font variation settings
+     *                                  format.
      *
      * @see #getFontVariationSettings()
      * @see FontVariationAxis
      */
-    public boolean setFontVariationSettings(@Nullable String fontVariationSettings)
-            throws InvalidFormatException {
+    public boolean setFontVariationSettings(@Nullable String fontVariationSettings) {
         final String existingSettings = mTextPaint.getFontVariationSettings();
         if (fontVariationSettings == existingSettings
                 || (fontVariationSettings != null
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index 8bf96e3..5b4a454 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -1861,22 +1861,40 @@
         android:description="@string/permdesc_systemAlertWindow"
         android:protectionLevel="signature|preinstalled|appop|pre23|development" />
 
-    <!-- Allows an app to run in the background.
-         <p>Protection level: signature
+    <!-- @deprecated Use {@link android.Manifest.permission#REQUEST_COMPANION_RUN_IN_BACKGROUND}
+         @hide
     -->
     <permission android:name="android.permission.RUN_IN_BACKGROUND"
         android:label="@string/permlab_runInBackground"
         android:description="@string/permdesc_runInBackground"
         android:protectionLevel="signature" />
 
-    <!-- Allows an app to use data in the background.
-         <p>Protection level: signature
+    <!-- @deprecated Use
+        {@link android.Manifest.permission#REQUEST_COMPANION_USE_DATA_IN_BACKGROUND}
+         @hide
     -->
     <permission android:name="android.permission.USE_DATA_IN_BACKGROUND"
         android:label="@string/permlab_useDataInBackground"
         android:description="@string/permdesc_useDataInBackground"
         android:protectionLevel="signature" />
 
+    <!-- Allows a companion app to run in the background.
+         <p>Protection level: signature
+    -->
+    <permission android:name="android.permission.REQUEST_COMPANION_RUN_IN_BACKGROUND"
+                android:label="@string/permlab_runInBackground"
+                android:description="@string/permdesc_runInBackground"
+                android:protectionLevel="signature" />
+
+    <!-- Allows a companion app to use data in the background.
+         <p>Protection level: signature
+    -->
+    <permission android:name="android.permission.REQUEST_COMPANION_USE_DATA_IN_BACKGROUND"
+                android:label="@string/permlab_useDataInBackground"
+                android:description="@string/permdesc_useDataInBackground"
+                android:protectionLevel="signature" />
+
+
     <!-- ================================== -->
     <!-- Permissions affecting the system wallpaper -->
     <!-- ================================== -->
diff --git a/core/res/res/layout/autofill_save.xml b/core/res/res/layout/autofill_save.xml
index 2f7ad3a..60df492 100644
--- a/core/res/res/layout/autofill_save.xml
+++ b/core/res/res/layout/autofill_save.xml
@@ -25,7 +25,7 @@
         android:layout_width="fill_parent"
         android:layout_height="wrap_content"
         android:layout_marginTop="32dp"
-        android:padding="16dp"
+        android:paddingTop="16dp"
         android:elevation="32dp"
         android:background="?android:attr/colorBackground"
         android:orientation="vertical">
@@ -33,43 +33,53 @@
         <LinearLayout
             android:layout_width="fill_parent"
             android:layout_height="wrap_content"
-            android:orientation="horizontal">
+            android:paddingLeft="16dp"
+            android:paddingRight="16dp"
+            android:orientation="vertical">
+
+            <LinearLayout
+                android:layout_width="fill_parent"
+                android:layout_height="wrap_content"
+                android:orientation="horizontal">
+
+                <TextView
+                    android:id="@+id/autofill_save_title"
+                    android:layout_width="0dp"
+                    android:layout_height="wrap_content"
+                    android:text="@string/autofill_save_title"
+                    android:textSize="16sp"
+                    android:textColor="?android:attr/textColorPrimary"
+                    android:layout_weight="1">
+                </TextView>
+
+                <ImageView
+                    android:id="@+id/autofill_save_close"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_marginLeft="16dp"
+                    android:src="@android:drawable/ic_close"
+                    android:alpha="0.54"
+                    android:background="?android:attr/selectableItemBackgroundBorderless">
+                </ImageView>
+
+            </LinearLayout>
 
             <TextView
-                android:id="@+id/autofill_save_title"
-                android:layout_width="0dp"
+                android:id="@+id/autofill_save_subtitle"
+                android:layout_width="fill_parent"
                 android:layout_height="wrap_content"
-                android:text="@string/autofill_save_title"
-                android:textSize="16sp"
-                android:textColor="?android:attr/textColorPrimary"
-                android:layout_weight="1">
+                android:layout_marginTop="4dp"
+                android:visibility="gone">
             </TextView>
 
-            <ImageView
-                android:id="@+id/autofill_save_close"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_marginLeft="16dp"
-                android:src="@android:drawable/ic_close"
-                android:alpha="0.54"
-                android:background="?android:attr/selectableItemBackgroundBorderless">
-            </ImageView>
-
         </LinearLayout>
 
-        <TextView
-            android:id="@+id/autofill_save_subtitle"
-            android:layout_width="fill_parent"
-            android:layout_height="wrap_content"
-            android:layout_marginTop="4dp"
-            android:visibility="gone">
-        </TextView>
-
         <com.android.internal.widget.ButtonBarLayout
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_gravity="end"
-            android:layout_marginTop="16dp"
+            android:padding="16dp"
+            android:clipToPadding="false"
             android:layout_weight="1"
             android:orientation="horizontal">
 
@@ -94,6 +104,7 @@
                 android:layout_height="wrap_content"
                 style="@style/Widget.Material.Button.Colored"
                 android:text="@string/autofill_save_yes">
+                <requestFocus />
             </Button>
 
         </com.android.internal.widget.ButtonBarLayout>
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index 3898cae..c421514 100644
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -60,6 +60,9 @@
              mode. -->
         <attr name="colorMultiSelectHighlight" format="color" />
 
+        <!-- Drawable to be drawn over the view to mark it as autofilled-->
+        <attr name="autofilledHighlight" format="reference" />
+
         <!-- Default disabled alpha for widgets that set enabled/disabled alpha programmatically. -->
         <attr name="disabledAlpha" format="float" />
         <!-- The alpha applied to the foreground color to create the primary text color. -->
@@ -3448,8 +3451,8 @@
             <flag name="flagEnableAccessibilityVolume" value="0x00000080" />
             <!-- Has flag {@link android.accessibilityservice.AccessibilityServiceInfo#FLAG_REQUEST_ACCESSIBILITY_BUTTON}. -->
             <flag name="flagRequestAccessibilityButton" value="0x00000100" />
-            <!-- Has flag {@link android.accessibilityservice.AccessibilityServiceInfo#FLAG_CAPTURE_FINGERPRINT_GESTURES}. -->
-            <flag name="flagCaptureFingerprintGestures" value="0x00000200" />
+            <!-- Has flag {@link android.accessibilityservice.AccessibilityServiceInfo#FLAG_REQUEST_FINGERPRINT_GESTURES}. -->
+            <flag name="flagRequestFingerprintGestures" value="0x00000200" />
         </attr>
         <!-- Component name of an activity that allows the user to modify
              the settings for this service. This setting cannot be changed at runtime. -->
@@ -3489,10 +3492,10 @@
              the fingerprint sensor.
              <p>
              Required to allow setting the {@link android.accessibilityservice
-             #AccessibilityServiceInfo#FLAG_CAN_CAPTURE_FINGERPRINT_GESTURES} flag.
+             #AccessibilityServiceInfo#FLAG_REQUEST_FINGERPRINT_GESTURES} flag to have any effect.
              </p>
          -->
-        <attr name="canCaptureFingerprintGestures" format="boolean" />
+        <attr name="canRequestFingerprintGestures" format="boolean" />
         <!-- Short description of the accessibility service purpose or behavior.-->
         <attr name="description" />
         <!-- Brief summary of the accessibility service purpose or behavior. -->
diff --git a/core/res/res/values/attrs_manifest.xml b/core/res/res/values/attrs_manifest.xml
index 95ba942..c883674 100644
--- a/core/res/res/values/attrs_manifest.xml
+++ b/core/res/res/values/attrs_manifest.xml
@@ -897,7 +897,7 @@
          will run against.  If not specified, only runs in the main process of the targetPackage.
          Can either be a comma-separated list of process names or '*' for any process that
          launches to run targetPackage code. -->
-    <attr name="targetProcess" format="string" />
+    <attr name="targetProcesses" format="string" />
 
     <!-- Flag indicating that an Instrumentation class wants to take care
          of starting/stopping profiling itself, rather than relying on
@@ -2355,7 +2355,7 @@
             is a period then it is appended to your package name. -->
         <attr name="name" />
         <attr name="targetPackage" />
-        <attr name="targetProcess" />
+        <attr name="targetProcesses" />
         <attr name="label" />
         <attr name="icon" />
         <attr name="roundIcon" />
diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml
index e13026b..89ed9cb 100644
--- a/core/res/res/values/public.xml
+++ b/core/res/res/values/public.xml
@@ -2778,7 +2778,7 @@
         <public name="paddingVertical" />
         <public name="fontStyle" />
         <public name="keyboardNavigationCluster" />
-        <public name="targetProcess" />
+        <public name="targetProcesses" />
         <public name="nextClusterForward" />
         <public name="__removed1" />
         <public name="colorError" />
@@ -2792,7 +2792,7 @@
         <public name="colorMode" />
         <public name="isolatedSplits" />
         <public name="targetSandboxVersion" />
-        <public name="canCaptureFingerprintGestures" />
+        <public name="canRequestFingerprintGestures" />
         <public name="alphabeticModifiers" />
         <public name="numericModifiers" />
         <public name="fontProviderAuthority" />
@@ -2822,6 +2822,7 @@
         <!-- @hide @SystemApi -->
         <public name="requiredSystemPropertyValue" />
         <public name="justificationMode" />
+        <public name="autofilledHighlight" />
     </public-group>
 
     <public-group type="style" first-id="0x010302e0">
@@ -2833,8 +2834,8 @@
         <public name="autofill" />
     </public-group>
 
-    <public-group type="drawable" first-id="0x010800b4">
-        <public name="autofilled_highlight" />
+    <public-group type="drawable" first-id="0x010800b5">
+        <!-- 0x010800b4 was removed -->
         <public name="ic_picture_in_picture" />
     </public-group>
 
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 0ea9b39..1e529da7 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -238,6 +238,7 @@
   <java-symbol type="attr" name="windowFixedHeightMinor" />
   <java-symbol type="attr" name="accessibilityFocusedDrawable"/>
   <java-symbol type="attr" name="isLightTheme"/>
+  <java-symbol type="attr" name="autofilledHighlight"/>
 
   <java-symbol type="bool" name="action_bar_embed_tabs" />
   <java-symbol type="bool" name="action_bar_expanded_action_views_exclusive" />
diff --git a/core/res/res/values/themes.xml b/core/res/res/values/themes.xml
index a661b07..e8fbf34 100644
--- a/core/res/res/values/themes.xml
+++ b/core/res/res/values/themes.xml
@@ -435,6 +435,9 @@
         <!-- Accessibility focused drawable -->
         <item name="accessibilityFocusedDrawable">@drawable/view_accessibility_focused</item>
 
+        <!-- Autofilled highlight drawable -->
+        <item name="autofilledHighlight">@drawable/autofilled_highlight</item>
+
         <!-- Lighting and shadow properties -->
         <item name="lightY">@dimen/light_y</item>
         <item name="lightZ">@dimen/light_z</item>
diff --git a/core/res/res/values/themes_device_defaults.xml b/core/res/res/values/themes_device_defaults.xml
index d80ff1d..7517946 100644
--- a/core/res/res/values/themes_device_defaults.xml
+++ b/core/res/res/values/themes_device_defaults.xml
@@ -744,6 +744,7 @@
         <item name="colorPrimaryDark">@color/primary_dark_device_default_settings_light</item>
         <item name="colorSecondary">@color/secondary_device_default_settings_light</item>
         <item name="colorAccent">@color/accent_device_default_light</item>
+        <item name="colorEdgeEffect">@android:color/black</item>
     </style>
 
     <!-- @hide DeviceDefault theme for a window that should use Settings theme colors
diff --git a/core/tests/coretests/src/android/provider/FontsContractTest.java b/core/tests/coretests/src/android/provider/FontsContractTest.java
index 56bfbb0..d42d79e 100644
--- a/core/tests/coretests/src/android/provider/FontsContractTest.java
+++ b/core/tests/coretests/src/android/provider/FontsContractTest.java
@@ -32,7 +32,6 @@
 import android.content.pm.ProviderInfo;
 import android.content.pm.Signature;
 import android.database.MatrixCursor;
-import android.graphics.fonts.FontVariationAxis.InvalidFormatException;
 import android.graphics.fonts.FontVariationAxis;
 import android.provider.FontsContract.FontInfo;
 import android.support.test.filters.SmallTest;
@@ -73,7 +72,7 @@
         mPackageManager = mock(PackageManager.class);
     }
 
-    public void testGetFontFromProvider_resultOK() throws InvalidFormatException {
+    public void testGetFontFromProvider_resultOK() {
         FontInfo[] fonts = FontsContract.getFontFromProvider(
                 getMockContext(), request, TestFontsProvider.AUTHORITY, null);
         assertNotNull(fonts);
@@ -90,8 +89,7 @@
         assertEquals(RESULT_CODE_OK, font.getResultCode());
     }
 
-    public void testGetFontFromProvider_providerDoesntReturnAllFields()
-            throws InvalidFormatException {
+    public void testGetFontFromProvider_providerDoesntReturnAllFields() {
         mProvider.setReturnAllFields(false);
 
         FontInfo[] fonts = FontsContract.getFontFromProvider(
@@ -107,7 +105,7 @@
         assertEquals(RESULT_CODE_OK, font.getResultCode());
     }
 
-    public void testGetFontFromProvider_resultFontNotFound() throws InvalidFormatException {
+    public void testGetFontFromProvider_resultFontNotFound() {
         // Make the provider return unknown
         mProvider.setResultCode(RESULT_CODE_FONT_NOT_FOUND);
         FontInfo[] fonts = FontsContract.getFontFromProvider(
@@ -120,7 +118,7 @@
         assertEquals(RESULT_CODE_FONT_NOT_FOUND, font.getResultCode());
     }
 
-    public void testGetFontFromProvider_resultFontUnavailable() throws InvalidFormatException {
+    public void testGetFontFromProvider_resultFontUnavailable() {
         // Make the provider return font unavailable
         mProvider.setResultCode(RESULT_CODE_FONT_UNAVAILABLE);
         FontInfo[] fonts = FontsContract.getFontFromProvider(
@@ -140,7 +138,7 @@
         assertEquals(RESULT_CODE_FONT_UNAVAILABLE, font.getResultCode());
     }
 
-    public void testGetFontFromProvider_resultMalformedQuery() throws InvalidFormatException {
+    public void testGetFontFromProvider_resultMalformedQuery() {
         // Make the provider return font unavailable
         mProvider.setResultCode(RESULT_CODE_MALFORMED_QUERY);
         FontInfo[] fonts = FontsContract.getFontFromProvider(
@@ -160,8 +158,7 @@
         assertEquals(RESULT_CODE_MALFORMED_QUERY, font.getResultCode());
     }
 
-    public void testGetFontFromProvider_resultFontNotFoundSecondRow()
-            throws InvalidFormatException {
+    public void testGetFontFromProvider_resultFontNotFoundSecondRow() {
         MatrixCursor cursor = new MatrixCursor(new String[] { FontsContract.Columns._ID,
                 FontsContract.Columns.TTC_INDEX, FontsContract.Columns.VARIATION_SETTINGS,
                 FontsContract.Columns.WEIGHT, FontsContract.Columns.ITALIC,
@@ -193,7 +190,7 @@
         assertEquals(RESULT_CODE_FONT_NOT_FOUND, font.getResultCode());
     }
 
-    public void testGetFontFromProvider_resultFontNotFoundOtherRow() throws InvalidFormatException {
+    public void testGetFontFromProvider_resultFontNotFoundOtherRow() {
         MatrixCursor cursor = new MatrixCursor(new String[] { FontsContract.Columns._ID,
                 FontsContract.Columns.TTC_INDEX, FontsContract.Columns.VARIATION_SETTINGS,
                 FontsContract.Columns.WEIGHT, FontsContract.Columns.ITALIC,
diff --git a/core/tests/coretests/src/android/provider/SettingsBackupTest.java b/core/tests/coretests/src/android/provider/SettingsBackupTest.java
index ba24eec..99909ac 100644
--- a/core/tests/coretests/src/android/provider/SettingsBackupTest.java
+++ b/core/tests/coretests/src/android/provider/SettingsBackupTest.java
@@ -37,7 +37,8 @@
 
 /** Tests that ensure appropriate settings are backed up. */
 @RunWith(AndroidJUnit4.class)
-@Presubmit
+// TODO(b/37684646): Can re-enable pre-submit once test is fixed.
+//@Presubmit
 @SmallTest
 public class SettingsBackupTest {
 
@@ -213,6 +214,7 @@
                     Settings.Global.LANG_ID_UPDATE_CONTENT_URL,
                     Settings.Global.LANG_ID_UPDATE_METADATA_URL,
                     Settings.Global.LOCATION_BACKGROUND_THROTTLE_INTERVAL_MS,
+                    Settings.Global.LOCATION_BACKGROUND_THROTTLE_PROXIMITY_ALERT_INTERVAL_MS,
                     Settings.Global.LOCATION_BACKGROUND_THROTTLE_PACKAGE_WHITELIST,
                     Settings.Global.LOCATION_SETTINGS_LINK_TO_PERMISSIONS_ENABLED,
                     Settings.Global.LOCK_SOUND,
diff --git a/core/tests/coretests/src/android/text/VariationParserTest.java b/core/tests/coretests/src/android/text/VariationParserTest.java
index bcc47e1..b0f55d6 100644
--- a/core/tests/coretests/src/android/text/VariationParserTest.java
+++ b/core/tests/coretests/src/android/text/VariationParserTest.java
@@ -33,7 +33,7 @@
             try {
                 FontVariationAxis.fromFontVariationSettings("'wdth' " + invalidStyle);
                 fail();
-            } catch (FontVariationAxis.InvalidFormatException e) {
+            } catch (IllegalArgumentException e) {
                 // pass
             }
         }
@@ -41,14 +41,14 @@
             try {
                 FontVariationAxis.fromFontVariationSettings("'wght' 1, 'wdth' " + invalidStyle);
                 fail();
-            } catch (FontVariationAxis.InvalidFormatException e) {
+            } catch (IllegalArgumentException e) {
                 // pass
             }
         }
     }
 
     @SmallTest
-    public void testOpenTypeTagValue() throws FontVariationAxis.InvalidFormatException {
+    public void testOpenTypeTagValue() {
       assertEquals(0x77647468, (new FontVariationAxis("wdth", 0).getOpenTypeTagValue()));
       assertEquals(0x41582020, (new FontVariationAxis("AX  ", 0).getOpenTypeTagValue()));
       assertEquals(0x20202020, (new FontVariationAxis("    ", 0).getOpenTypeTagValue()));
diff --git a/graphics/java/android/graphics/FontListParser.java b/graphics/java/android/graphics/FontListParser.java
index 1a4f225..7c07a30 100644
--- a/graphics/java/android/graphics/FontListParser.java
+++ b/graphics/java/android/graphics/FontListParser.java
@@ -134,12 +134,7 @@
         String tagStr = parser.getAttributeValue(null, "tag");
         String styleValueStr = parser.getAttributeValue(null, "stylevalue");
         skip(parser);  // axis tag is empty, ignore any contents and consume end tag
-        try {
-            return new FontVariationAxis(tagStr, Float.parseFloat(styleValueStr));
-        } catch (FontVariationAxis.InvalidFormatException e) {
-            // Treat as system failure since system preinstalled font setting has invalid format.
-            throw new RuntimeException(e);
-        }
+        return new FontVariationAxis(tagStr, Float.parseFloat(styleValueStr));
     }
 
     private static FontConfig.Alias readAlias(XmlPullParser parser)
diff --git a/graphics/java/android/graphics/Paint.java b/graphics/java/android/graphics/Paint.java
index 81bd6ad..e62df8f 100644
--- a/graphics/java/android/graphics/Paint.java
+++ b/graphics/java/android/graphics/Paint.java
@@ -21,7 +21,6 @@
 import android.annotation.Size;
 import android.graphics.FontListParser;
 import android.graphics.fonts.FontVariationAxis;
-import android.graphics.fonts.FontVariationAxis.InvalidFormatException;
 import android.os.LocaleList;
 import android.text.FontConfig;
 import android.text.GraphicsOperations;
@@ -1575,13 +1574,13 @@
      *         typeface. This function also returns true for empty settings string. Otherwise
      *         returns false
      *
-     * @throws InvalidFormatException If given string is not a valid font variation settings format.
+     * @throws IllegalArgumentException If given string is not a valid font variation settings
+     *                                  format
      *
      * @see #getFontVariationSettings()
      * @see FontVariationAxis
      */
-    public boolean setFontVariationSettings(String fontVariationSettings)
-            throws InvalidFormatException {
+    public boolean setFontVariationSettings(String fontVariationSettings) {
         final String settings = TextUtils.nullIfEmpty(fontVariationSettings);
         if (settings == mFontVariationSettings
                 || (settings != null && settings.equals(mFontVariationSettings))) {
diff --git a/graphics/java/android/graphics/Typeface.java b/graphics/java/android/graphics/Typeface.java
index ba62a08..ad6ea2b 100644
--- a/graphics/java/android/graphics/Typeface.java
+++ b/graphics/java/android/graphics/Typeface.java
@@ -30,7 +30,6 @@
 import android.content.res.AssetManager;
 import android.graphics.FontListParser;
 import android.graphics.fonts.FontVariationAxis;
-import android.graphics.fonts.FontVariationAxis.InvalidFormatException;
 import android.net.Uri;
 import android.os.Bundle;
 import android.os.Handler;
@@ -432,11 +431,10 @@
          * Sets a font variation settings.
          *
          * @param variationSettings See {@link android.widget.TextView#setFontVariationSettings}.
-         * @throws InvalidFormatException If given string is not a valid font variation settings
-         *                                format.
+         * @throws IllegalArgumentException If given string is not a valid font variation settings
+         *                                  format.
          */
-        public Builder setFontVariationSettings(@Nullable String variationSettings)
-                throws InvalidFormatException {
+        public Builder setFontVariationSettings(@Nullable String variationSettings) {
             if (mFonts != null) {
                 throw new IllegalArgumentException(
                         "Font variation settings can not be specified for FontResult source.");
diff --git a/graphics/java/android/graphics/fonts/FontVariationAxis.java b/graphics/java/android/graphics/fonts/FontVariationAxis.java
index fb2a3a8..99564fa 100644
--- a/graphics/java/android/graphics/fonts/FontVariationAxis.java
+++ b/graphics/java/android/graphics/fonts/FontVariationAxis.java
@@ -37,12 +37,11 @@
      * The axis tag must contain four ASCII characters. Tag string that are longer or shorter than
      * four characters, or contains characters outside of U+0020..U+007E are invalid.
      *
-     * @throws {@link InvalidFormatException} If given tag string is invalid.
+     * @throws IllegalArgumentException If given tag string is invalid.
      */
-    public FontVariationAxis(@NonNull String tagString, float styleValue)
-            throws InvalidFormatException {
+    public FontVariationAxis(@NonNull String tagString, float styleValue) {
         if (!isValidTag(tagString)) {
-            throw new InvalidFormatException("Invalid tag pattern: " + tagString);
+            throw new IllegalArgumentException("Illegal tag pattern: " + tagString);
         }
         mTag = makeTag(tagString);
         mTagString = tagString;
@@ -113,15 +112,6 @@
     }
 
     /**
-     * An exception indicates that the format of font variation settings is invalid.
-     */
-    public static class InvalidFormatException extends Exception {
-        public InvalidFormatException(String message) {
-            super(message);
-        }
-    };
-
-    /**
      * Construct FontVariationAxis array from font variation settings.
      *
      * The settings string is constructed from multiple pairs of axis tag and style values. The axis
@@ -138,10 +128,11 @@
      * @param settings font variation settings.
      * @return FontVariationAxis[] the array of parsed font variation axis. {@code null} if settings
      *                             has no font variation settings.
-     * @throws InvalidFormatException If given string is not a valid font variation settings format.
+     * @throws IllegalArgumentException If given string is not a valid font variation settings
+     *                                  format.
      */
-    public static @Nullable FontVariationAxis[] fromFontVariationSettings(@Nullable String settings)
-            throws InvalidFormatException {
+    public static @Nullable FontVariationAxis[] fromFontVariationSettings(
+            @Nullable String settings) {
         if (settings == null || settings.isEmpty()) {
             return null;
         }
@@ -153,7 +144,7 @@
                 continue;
             }
             if (!(c == '\'' || c == '"') || length < i + 6 || settings.charAt(i + 5) != c) {
-                throw new InvalidFormatException(
+                throw new IllegalArgumentException(
                         "Tag should be wrapped with double or single quote: " + settings);
             }
             final String tagString = settings.substring(i + 1, i + 5);
@@ -168,7 +159,8 @@
                 // Float.parseFloat ignores leading/trailing whitespaces.
                 value = Float.parseFloat(settings.substring(i, endOfValueString));
             } catch (NumberFormatException e) {
-                throw new InvalidFormatException("Failed to parse float string: " + e.getMessage());
+                throw new IllegalArgumentException(
+                        "Failed to parse float string: " + e.getMessage());
             }
             axisList.add(new FontVariationAxis(tagString, value));
             i = endOfValueString;
diff --git a/libs/hwui/Android.mk b/libs/hwui/Android.mk
index fde0e47..5ef49dc 100644
--- a/libs/hwui/Android.mk
+++ b/libs/hwui/Android.mk
@@ -7,7 +7,7 @@
 # Enables fine-grained GLES error checking
 # If set to true, every GLES call is wrapped & error checked
 # Has moderate overhead
-HWUI_ENABLE_OPENGL_VALIDATION := true
+HWUI_ENABLE_OPENGL_VALIDATION := false
 
 hwui_src_files := \
     hwui/Bitmap.cpp \
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
index 48429e8..a6347c6 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
@@ -898,13 +898,14 @@
             Slog.v(LOG_TAG, "getGlobalSetting(" + name + ")");
         }
 
-        // Ensure the caller can access the setting.
-        enforceSettingReadable(name, SETTINGS_TYPE_GLOBAL, UserHandle.getCallingUserId());
-
         // Get the value.
         synchronized (mLock) {
-            return mSettingsRegistry.getSettingLocked(SETTINGS_TYPE_GLOBAL,
+            Setting setting = mSettingsRegistry.getSettingLocked(SETTINGS_TYPE_GLOBAL,
                     UserHandle.USER_SYSTEM, name);
+            // Ensure the caller can access the setting before we return it.
+            enforceSettingReadable(setting, name, SETTINGS_TYPE_GLOBAL,
+                    UserHandle.getCallingUserId());
+            return setting;
         }
     }
 
@@ -1062,9 +1063,6 @@
         // Resolve the userId on whose behalf the call is made.
         final int callingUserId = resolveCallingUserIdEnforcingPermissionsLocked(requestingUserId);
 
-        // Ensure the caller can access the setting.
-        enforceSettingReadable(name, SETTINGS_TYPE_SECURE, UserHandle.getCallingUserId());
-
         // Determine the owning user as some profile settings are cloned from the parent.
         final int owningUserId = resolveOwningUserIdForSecureSettingLocked(callingUserId, name);
 
@@ -1078,6 +1076,7 @@
 
         // As of Android O, the SSAID is read from an app-specific entry in table
         // SETTINGS_FILE_SSAID, unless accessed by a system process.
+        // All apps are allowed to access their SSAID, so we skip the permission check.
         if (isNewSsaidSetting(name)) {
             PackageInfo callingPkg = getCallingPackageInfo(owningUserId);
             synchronized (mLock) {
@@ -1087,8 +1086,12 @@
 
         // Not the SSAID; do a straight lookup
         synchronized (mLock) {
-            return mSettingsRegistry.getSettingLocked(SETTINGS_TYPE_SECURE,
+            Setting setting = mSettingsRegistry.getSettingLocked(SETTINGS_TYPE_SECURE,
                     owningUserId, name);
+            // Ensure the caller can access the setting before we return it.
+            enforceSettingReadable(setting, name, SETTINGS_TYPE_SECURE,
+                    UserHandle.getCallingUserId());
+            return setting;
         }
     }
 
@@ -1289,15 +1292,18 @@
         // Resolve the userId on whose behalf the call is made.
         final int callingUserId = resolveCallingUserIdEnforcingPermissionsLocked(requestingUserId);
 
-        // Ensure the caller can access the setting.
-        enforceSettingReadable(name, SETTINGS_TYPE_SYSTEM, UserHandle.getCallingUserId());
 
         // Determine the owning user as some profile settings are cloned from the parent.
         final int owningUserId = resolveOwningUserIdForSystemSettingLocked(callingUserId, name);
 
         // Get the value.
         synchronized (mLock) {
-            return mSettingsRegistry.getSettingLocked(SETTINGS_TYPE_SYSTEM, owningUserId, name);
+            Setting setting = mSettingsRegistry.getSettingLocked(SETTINGS_TYPE_SYSTEM,
+                    owningUserId, name);
+            // Ensure the caller can access the setting before we return it.
+            enforceSettingReadable(setting, name, SETTINGS_TYPE_SYSTEM,
+                    UserHandle.getCallingUserId());
+            return setting;
         }
     }
 
@@ -1644,14 +1650,22 @@
         }
     }
 
-    private void enforceSettingReadable(String settingName, int settingsType, int userId) {
+    private void enforceSettingReadable(Setting setting, String settingName, int settingsType,
+            int userId) {
         if (UserHandle.getAppId(Binder.getCallingUid()) < Process.FIRST_APPLICATION_UID) {
             return;
         }
         ApplicationInfo ai = getCallingApplicationInfoOrThrow();
+        // Installed apps are allowed to read all settings.
         if (!ai.isInstantApp()) {
             return;
         }
+        // Instant Apps are allowed to read settings defined by applications.
+        // TODO: Replace this with an API that allows the setting application to say if a setting
+        // shoud/shouldn't be accessible.
+        if (!setting.isDefaultFromSystem()) {
+            return;
+        }
         if (!getInstantAppAccessibleSettings(settingsType).contains(settingName)) {
             throw new SecurityException("Setting " + settingName + " is not accessible from"
                     + " ephemeral package " + getCallingPackage());
diff --git a/packages/SystemUI/src/com/android/systemui/qs/external/CustomTile.java b/packages/SystemUI/src/com/android/systemui/qs/external/CustomTile.java
index b5c1bd9..dc9176f 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/external/CustomTile.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/external/CustomTile.java
@@ -240,7 +240,7 @@
         i.setPackage(mComponent.getPackageName());
         i = resolveIntent(i);
         if (i != null) {
-            i.putExtra(TileService.EXTRA_COMPONENT, mComponent);
+            i.putExtra(Intent.EXTRA_COMPONENT_NAME, mComponent);
             i.putExtra(TileService.EXTRA_STATE, mTile.getState());
             return i;
         }
diff --git a/packages/SystemUI/src/com/android/systemui/qs/external/TileServices.java b/packages/SystemUI/src/com/android/systemui/qs/external/TileServices.java
index d9c3cc3..d2f3bb6 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/external/TileServices.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/external/TileServices.java
@@ -313,7 +313,7 @@
         public void onReceive(Context context, Intent intent) {
             if (TileService.ACTION_REQUEST_LISTENING.equals(intent.getAction())) {
                 requestListening(
-                        (ComponentName) intent.getParcelableExtra(TileService.EXTRA_COMPONENT));
+                        (ComponentName) intent.getParcelableExtra(Intent.EXTRA_COMPONENT_NAME));
             }
         }
     };
diff --git a/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java b/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java
index b6dfdd1..fa78f10 100644
--- a/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java
+++ b/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java
@@ -2808,7 +2808,7 @@
             mRetrieveInteractiveWindows = (info.flags
                     & AccessibilityServiceInfo.FLAG_RETRIEVE_INTERACTIVE_WINDOWS) != 0;
             mCaptureFingerprintGestures = (info.flags
-                    & AccessibilityServiceInfo.FLAG_CAPTURE_FINGERPRINT_GESTURES) != 0;
+                    & AccessibilityServiceInfo.FLAG_REQUEST_FINGERPRINT_GESTURES) != 0;
             mRequestAccessibilityButton = (info.flags
                     & AccessibilityServiceInfo.FLAG_REQUEST_ACCESSIBILITY_BUTTON) != 0;
         }
@@ -4721,7 +4721,7 @@
 
         public boolean canCaptureFingerprintGestures(Service service) {
             return (service.mAccessibilityServiceInfo.getCapabilities()
-                    & AccessibilityServiceInfo.CAPABILITY_CAN_CAPTURE_FINGERPRINT_GESTURES) != 0;
+                    & AccessibilityServiceInfo.CAPABILITY_CAN_REQUEST_FINGERPRINT_GESTURES) != 0;
         }
 
         private int resolveProfileParentLocked(int userId) {
diff --git a/services/autofill/java/com/android/server/autofill/AutofillManagerService.java b/services/autofill/java/com/android/server/autofill/AutofillManagerService.java
index 6b84c5f..2358ec5 100644
--- a/services/autofill/java/com/android/server/autofill/AutofillManagerService.java
+++ b/services/autofill/java/com/android/server/autofill/AutofillManagerService.java
@@ -26,6 +26,7 @@
 import android.annotation.NonNull;
 import android.annotation.Nullable;
 import android.app.ActivityManager;
+import android.app.ActivityThread;
 import android.content.BroadcastReceiver;
 import android.content.ComponentName;
 import android.content.ContentResolver;
@@ -125,7 +126,7 @@
     public AutofillManagerService(Context context) {
         super(context);
         mContext = context;
-        mUi = new AutoFillUI(mContext);
+        mUi = new AutoFillUI(ActivityThread.currentActivityThread().getSystemUiContext());
 
         final boolean debug = Build.IS_DEBUGGABLE;
         Slog.i(TAG, "Setting debug to " + debug);
diff --git a/services/autofill/java/com/android/server/autofill/Session.java b/services/autofill/java/com/android/server/autofill/Session.java
index f4fd0be..c85ce43 100644
--- a/services/autofill/java/com/android/server/autofill/Session.java
+++ b/services/autofill/java/com/android/server/autofill/Session.java
@@ -1253,7 +1253,7 @@
         final Intent fillInIntent = new Intent();
         fillInIntent.putExtra(AutofillManager.EXTRA_ASSIST_STRUCTURE, structure);
         if (extras != null) {
-            fillInIntent.putExtra(AutofillManager.EXTRA_DATA_EXTRAS, extras);
+            fillInIntent.putExtra(AutofillManager.EXTRA_CLIENT_STATE, extras);
         }
         return fillInIntent;
     }
diff --git a/services/autofill/java/com/android/server/autofill/ui/SaveUi.java b/services/autofill/java/com/android/server/autofill/ui/SaveUi.java
index 63420fd..bcdb118 100644
--- a/services/autofill/java/com/android/server/autofill/ui/SaveUi.java
+++ b/services/autofill/java/com/android/server/autofill/ui/SaveUi.java
@@ -175,7 +175,7 @@
         closeButton.setOnClickListener((v) -> mListener.onCancel(
                 info.getNegativeActionListener()));
 
-        mDialog = new Dialog(context, R.style.Theme_Material_Panel);
+        mDialog = new Dialog(context, R.style.Theme_DeviceDefault_Light_Panel);
         mDialog.setContentView(view);
 
         final Window window = mDialog.getWindow();
diff --git a/services/companion/java/com/android/server/companion/CompanionDeviceManagerService.java b/services/companion/java/com/android/server/companion/CompanionDeviceManagerService.java
index dc84c45..6093241a 100644
--- a/services/companion/java/com/android/server/companion/CompanionDeviceManagerService.java
+++ b/services/companion/java/com/android/server/companion/CompanionDeviceManagerService.java
@@ -414,8 +414,9 @@
 
         Binder.withCleanCallingIdentity(() -> {
             try {
-                if (ArrayUtils.contains(packageInfo.requestedPermissions,
-                        Manifest.permission.RUN_IN_BACKGROUND)) {
+                if (containsEither(packageInfo.requestedPermissions,
+                        Manifest.permission.RUN_IN_BACKGROUND,
+                        Manifest.permission.REQUEST_COMPANION_RUN_IN_BACKGROUND)) {
                     mIdleController.addPowerSaveWhitelistApp(packageInfo.packageName);
                 } else {
                     mIdleController.removePowerSaveWhitelistApp(packageInfo.packageName);
@@ -425,8 +426,9 @@
             }
 
             NetworkPolicyManager networkPolicyManager = NetworkPolicyManager.from(getContext());
-            if (ArrayUtils.contains(packageInfo.requestedPermissions,
-                    Manifest.permission.USE_DATA_IN_BACKGROUND)) {
+            if (containsEither(packageInfo.requestedPermissions,
+                    Manifest.permission.USE_DATA_IN_BACKGROUND,
+                    Manifest.permission.REQUEST_COMPANION_USE_DATA_IN_BACKGROUND)) {
                 networkPolicyManager.addUidPolicy(
                         packageInfo.applicationInfo.uid,
                         NetworkPolicyManager.POLICY_ALLOW_METERED_BACKGROUND);
@@ -438,6 +440,10 @@
         });
     }
 
+    private static <T> boolean containsEither(T[] array, T a, T b) {
+        return ArrayUtils.contains(array, a) || ArrayUtils.contains(array, b);
+    }
+
     @Nullable
     private PackageInfo getPackageInfo(String packageName, int userId) {
         return Binder.withCleanCallingIdentity(() -> {
diff --git a/services/core/java/com/android/server/am/ActiveServices.java b/services/core/java/com/android/server/am/ActiveServices.java
index c6e44e0..d008c5e 100644
--- a/services/core/java/com/android/server/am/ActiveServices.java
+++ b/services/core/java/com/android/server/am/ActiveServices.java
@@ -1868,7 +1868,8 @@
         final boolean newService = app.services.add(r);
         bumpServiceExecutingLocked(r, execInFg, "create");
         mAm.updateLruProcessLocked(app, false, null);
-        updateServiceForegroundLocked(r.app, true);
+        updateServiceForegroundLocked(r.app, /* oomAdj= */ false);
+        mAm.updateOomAdjLocked();
 
         boolean created = false;
         try {
@@ -2150,7 +2151,10 @@
 
         final ServiceMap smap = getServiceMapLocked(r.userId);
         ServiceRecord found = smap.mServicesByName.remove(r.name);
-        if (found != r) {
+
+        // Note when this method is called by bringUpServiceLocked(), the service is not found
+        // in mServicesByName and found will be null.
+        if (found != null && found != r) {
             // This is not actually the service we think is running...  this should not happen,
             // but if it does, fail hard.
             smap.mServicesByName.put(r.name, found);
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index cabaebd4..71ef230 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -19719,12 +19719,12 @@
             ActiveInstrumentation activeInstr = new ActiveInstrumentation(this);
             activeInstr.mClass = className;
             String defProcess = ai.processName;;
-            if (ii.targetProcess == null) {
+            if (ii.targetProcesses == null) {
                 activeInstr.mTargetProcesses = new String[]{ai.processName};
-            } else if (ii.targetProcess.equals("*")) {
+            } else if (ii.targetProcesses.equals("*")) {
                 activeInstr.mTargetProcesses = new String[0];
             } else {
-                activeInstr.mTargetProcesses = ii.targetProcess.split(",");
+                activeInstr.mTargetProcesses = ii.targetProcesses.split(",");
                 defProcess = activeInstr.mTargetProcesses[0];
             }
             activeInstr.mTargetInfo = ai;
diff --git a/services/core/java/com/android/server/location/GeofenceManager.java b/services/core/java/com/android/server/location/GeofenceManager.java
index e24bf76..2493dfb 100644
--- a/services/core/java/com/android/server/location/GeofenceManager.java
+++ b/services/core/java/com/android/server/location/GeofenceManager.java
@@ -23,8 +23,10 @@
 
 import android.app.AppOpsManager;
 import android.app.PendingIntent;
+import android.content.ContentResolver;
 import android.content.Context;
 import android.content.Intent;
+import android.database.ContentObserver;
 import android.location.Geofence;
 import android.location.Location;
 import android.location.LocationListener;
@@ -35,6 +37,8 @@
 import android.os.Message;
 import android.os.PowerManager;
 import android.os.SystemClock;
+import android.os.UserHandle;
+import android.provider.Settings;
 import android.util.Slog;
 
 import com.android.server.LocationManagerService;
@@ -58,9 +62,9 @@
     private static final long MAX_AGE_NANOS = 5 * 60 * 1000000000L; // five minutes
 
     /**
-     * Most frequent update interval allowed.
+     * The default value of most frequent update interval allowed.
      */
-    private static final long MIN_INTERVAL_MS = 1 * 60 * 1000; // one minute
+    private static final long DEFAULT_MIN_INTERVAL_MS = 30 * 60 * 1000; // 30 minutes
 
     /**
      * Least frequent update interval allowed.
@@ -106,6 +110,12 @@
      */
     private boolean mPendingUpdate;
 
+    /**
+     * The actual value of most frequent update interval allowed.
+     */
+    private long mEffectiveMinIntervalMs;
+    private ContentResolver mResolver;
+
     public GeofenceManager(Context context, LocationBlacklist blacklist) {
         mContext = context;
         mLocationManager = (LocationManager) mContext.getSystemService(Context.LOCATION_SERVICE);
@@ -114,6 +124,28 @@
         mWakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, TAG);
         mHandler = new GeofenceHandler();
         mBlacklist = blacklist;
+        mResolver = mContext.getContentResolver();
+        updateMinInterval();
+        mResolver.registerContentObserver(
+            Settings.Global.getUriFor(
+                    Settings.Global.LOCATION_BACKGROUND_THROTTLE_PROXIMITY_ALERT_INTERVAL_MS),
+            true,
+            new ContentObserver(mHandler) {
+                @Override
+                public void onChange(boolean selfChange) {
+                    synchronized (mLock) {
+                        updateMinInterval();
+                    }
+                }
+            }, UserHandle.USER_ALL);
+    }
+
+    /**
+     * Updates the minimal location request frequency.
+     */
+    private void updateMinInterval() {
+        mEffectiveMinIntervalMs = Settings.Global.getLong(mResolver,
+                Settings.Global.LOCATION_BACKGROUND_THROTTLE_INTERVAL_MS, DEFAULT_MIN_INTERVAL_MS);
     }
 
     public void addFence(LocationRequest request, Geofence geofence, PendingIntent intent,
@@ -301,10 +333,10 @@
                 // Compute a location update interval based on the distance to the nearest fence.
                 long intervalMs;
                 if (location != null && Double.compare(minFenceDistance, Double.MAX_VALUE) != 0) {
-                    intervalMs = (long)Math.min(MAX_INTERVAL_MS, Math.max(MIN_INTERVAL_MS,
+                    intervalMs = (long)Math.min(MAX_INTERVAL_MS, Math.max(mEffectiveMinIntervalMs,
                             minFenceDistance * 1000 / MAX_SPEED_M_S));
                 } else {
-                    intervalMs = MIN_INTERVAL_MS;
+                    intervalMs = mEffectiveMinIntervalMs;
                 }
                 if (!mReceivingLocationUpdates || mLocationUpdateInterval != intervalMs) {
                     mReceivingLocationUpdates = true;
diff --git a/services/core/java/com/android/server/net/NetworkPolicyManagerService.java b/services/core/java/com/android/server/net/NetworkPolicyManagerService.java
index c802179..d9ca00c 100644
--- a/services/core/java/com/android/server/net/NetworkPolicyManagerService.java
+++ b/services/core/java/com/android/server/net/NetworkPolicyManagerService.java
@@ -2879,17 +2879,11 @@
             final List<UserInfo> users = mUserManager.getUsers();
             for (int ui = users.size() - 1; ui >= 0; ui--) {
                 UserInfo user = users.get(ui);
-                for (int i = mPowerSaveTempWhitelistAppIds.size() - 1; i >= 0; i--) {
-                    if (mPowerSaveTempWhitelistAppIds.valueAt(i)) {
-                        int appId = mPowerSaveTempWhitelistAppIds.keyAt(i);
-                        int uid = UserHandle.getUid(user.id, appId);
-                        uidRules.put(uid, FIREWALL_RULE_ALLOW);
-                    }
-                }
-                for (int i = mPowerSaveWhitelistAppIds.size() - 1; i >= 0; i--) {
-                    int appId = mPowerSaveWhitelistAppIds.keyAt(i);
-                    int uid = UserHandle.getUid(user.id, appId);
-                    uidRules.put(uid, FIREWALL_RULE_ALLOW);
+                updateRulesForWhitelistedAppIds(uidRules, mPowerSaveTempWhitelistAppIds, user.id);
+                updateRulesForWhitelistedAppIds(uidRules, mPowerSaveWhitelistAppIds, user.id);
+                if (chain == FIREWALL_CHAIN_POWERSAVE) {
+                    updateRulesForWhitelistedAppIds(uidRules,
+                            mPowerSaveWhitelistExceptIdleAppIds, user.id);
                 }
             }
             for (int i = mUidState.size() - 1; i >= 0; i--) {
@@ -2903,16 +2897,39 @@
         }
     }
 
-    private boolean isWhitelistedBatterySaverUL(int uid) {
+    private void updateRulesForWhitelistedAppIds(final SparseIntArray uidRules,
+            final SparseBooleanArray whitelistedAppIds, int userId) {
+        for (int i = whitelistedAppIds.size() - 1; i >= 0; --i) {
+            if (whitelistedAppIds.valueAt(i)) {
+                final int appId = whitelistedAppIds.keyAt(i);
+                final int uid = UserHandle.getUid(userId, appId);
+                uidRules.put(uid, FIREWALL_RULE_ALLOW);
+            }
+        }
+    }
+
+    /**
+     * @param deviceIdleMode if true then we don't consider
+     *        {@link #mPowerSaveWhitelistExceptIdleAppIds} for checking if the {@param uid} is
+     *        whitelisted.
+     */
+    private boolean isWhitelistedBatterySaverUL(int uid, boolean deviceIdleMode) {
         final int appId = UserHandle.getAppId(uid);
-        return mPowerSaveTempWhitelistAppIds.get(appId) || mPowerSaveWhitelistAppIds.get(appId);
+        boolean isWhitelisted = mPowerSaveTempWhitelistAppIds.get(appId)
+                || mPowerSaveWhitelistAppIds.get(appId);
+        if (!deviceIdleMode) {
+            isWhitelisted = isWhitelisted || mPowerSaveWhitelistExceptIdleAppIds.get(appId);
+        }
+        return isWhitelisted;
     }
 
     // NOTE: since both fw_dozable and fw_powersave uses the same map
     // (mPowerSaveTempWhitelistAppIds) for whitelisting, we can reuse their logic in this method.
     private void updateRulesForWhitelistedPowerSaveUL(int uid, boolean enabled, int chain) {
         if (enabled) {
-            if (isWhitelistedBatterySaverUL(uid) || isUidForegroundOnRestrictPowerUL(uid)) {
+            final boolean isWhitelisted = isWhitelistedBatterySaverUL(uid,
+                    chain == FIREWALL_CHAIN_DOZABLE);
+            if (isWhitelisted || isUidForegroundOnRestrictPowerUL(uid)) {
                 setUidFirewallRule(chain, uid, FIREWALL_RULE_ALLOW);
             } else {
                 setUidFirewallRule(chain, uid, FIREWALL_RULE_DEFAULT);
@@ -3430,7 +3447,7 @@
         final boolean restrictMode = isIdle || mRestrictPower || mDeviceIdleMode;
         final boolean isForeground = isUidForegroundOnRestrictPowerUL(uid);
 
-        final boolean isWhitelisted = isWhitelistedBatterySaverUL(uid);
+        final boolean isWhitelisted = isWhitelistedBatterySaverUL(uid, mDeviceIdleMode);
         final int oldRule = oldUidRules & MASK_ALL_NETWORKS;
         int newRule = RULE_NONE;
 
diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java
index b8ca2bb..8b84205 100644
--- a/services/core/java/com/android/server/notification/NotificationManagerService.java
+++ b/services/core/java/com/android/server/notification/NotificationManagerService.java
@@ -2849,6 +2849,7 @@
                         new Notification.Builder(getContext(), channelId)
                                 .setSmallIcon(adjustedSbn.getNotification().getSmallIcon())
                                 .setGroupSummary(true)
+                                .setGroupAlertBehavior(Notification.GROUP_ALERT_CHILDREN)
                                 .setGroup(GroupHelper.AUTOGROUP_KEY)
                                 .setFlag(Notification.FLAG_AUTOGROUP_SUMMARY, true)
                                 .setFlag(Notification.FLAG_GROUP_SUMMARY, true)
diff --git a/services/core/java/com/android/server/pm/InstantAppRegistry.java b/services/core/java/com/android/server/pm/InstantAppRegistry.java
index fc9e0a3..b165984 100644
--- a/services/core/java/com/android/server/pm/InstantAppRegistry.java
+++ b/services/core/java/com/android/server/pm/InstantAppRegistry.java
@@ -218,6 +218,11 @@
         byte[] randomBytes = new byte[8];
         new SecureRandom().nextBytes(randomBytes);
         String id = ByteStringUtils.toHexString(randomBytes).toLowerCase(Locale.US);
+        File appDir = getInstantApplicationDir(packageName, userId);
+        if (!appDir.exists() && !appDir.mkdirs()) {
+            Slog.e(LOG_TAG, "Cannot create instant app cookie directory");
+            return id;
+        }
         File idFile = new File(getInstantApplicationDir(packageName, userId),
                 INSTANT_APP_ANDROID_ID_FILE);
         try (FileOutputStream fos = new FileOutputStream(idFile)) {
diff --git a/services/core/java/com/android/server/wm/AppWindowToken.java b/services/core/java/com/android/server/wm/AppWindowToken.java
index 3c2dfa5..36418be 100644
--- a/services/core/java/com/android/server/wm/AppWindowToken.java
+++ b/services/core/java/com/android/server/wm/AppWindowToken.java
@@ -893,6 +893,7 @@
         if (mPendingRelaunchCount > 0) {
             mPendingRelaunchCount--;
         }
+        updateAllDrawn();
     }
 
     void clearRelaunching() {
@@ -1301,16 +1302,20 @@
         }
     }
 
-    void updateAllDrawn(DisplayContent dc) {
+    void updateAllDrawn() {
         if (!allDrawn) {
+            // Number of drawn windows can be less when a window is being relaunched, wait for
+            // all windows to be launched and drawn for this token be considered all drawn
             final int numInteresting = mNumInterestingWindows;
-            if (numInteresting > 0 && mNumDrawnWindows >= numInteresting) {
+            if (numInteresting > 0 && mNumDrawnWindows >= numInteresting && !isRelaunching()) {
                 if (DEBUG_VISIBILITY) Slog.v(TAG, "allDrawn: " + this
                         + " interesting=" + numInteresting + " drawn=" + mNumDrawnWindows);
                 allDrawn = true;
                 // Force an additional layout pass where
                 // WindowStateAnimator#commitFinishDrawingLocked() will call performShowLocked().
-                dc.setLayoutNeeded();
+                if (mDisplayContent != null) {
+                    mDisplayContent.setLayoutNeeded();
+                }
                 mService.mH.obtainMessage(NOTIFY_ACTIVITY_DRAWN, token).sendToTarget();
 
                 final TaskStack s = getStack();
@@ -1327,7 +1332,9 @@
                         + " interesting=" + numInteresting
                         + " drawn=" + mNumDrawnWindowsExcludingSaved);
                 allDrawnExcludingSaved = true;
-                dc.setLayoutNeeded();
+                if (mDisplayContent != null) {
+                    mDisplayContent.setLayoutNeeded();
+                }
                 if (isAnimatingInvisibleWithSavedSurface()
                         && !mService.mFinishedEarlyAnim.contains(this)) {
                     mService.mFinishedEarlyAnim.add(this);
diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java
index d85552a..05b95e2 100644
--- a/services/core/java/com/android/server/wm/DisplayContent.java
+++ b/services/core/java/com/android/server/wm/DisplayContent.java
@@ -2730,7 +2730,7 @@
             final AppWindowToken atoken = mTmpUpdateAllDrawn.removeLast();
             // See if any windows have been drawn, so they (and others associated with them)
             // can now be shown.
-            atoken.updateAllDrawn(this);
+            atoken.updateAllDrawn();
         }
 
         return mTmpApplySurfaceChangesTransactionState.focusDisplayed;
diff --git a/services/tests/servicestests/src/com/android/server/accessibility/AccessibilityGestureDetectorTest.java b/services/tests/servicestests/src/com/android/server/accessibility/AccessibilityGestureDetectorTest.java
index d0c2b52..14abb8a1 100644
--- a/services/tests/servicestests/src/com/android/server/accessibility/AccessibilityGestureDetectorTest.java
+++ b/services/tests/servicestests/src/com/android/server/accessibility/AccessibilityGestureDetectorTest.java
@@ -16,7 +16,6 @@
 
 package com.android.server.accessibility;
 
-import static junit.framework.TestCase.assertEquals;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.reset;
 import static org.mockito.Mockito.when;
diff --git a/services/tests/servicestests/src/com/android/server/accessibility/FingerprintGestureControllerTest.java b/services/tests/servicestests/src/com/android/server/accessibility/FingerprintGestureControllerTest.java
index f8dfee4..360ccbf 100644
--- a/services/tests/servicestests/src/com/android/server/accessibility/FingerprintGestureControllerTest.java
+++ b/services/tests/servicestests/src/com/android/server/accessibility/FingerprintGestureControllerTest.java
@@ -131,7 +131,8 @@
         mFingerprintGestureController.registerFingerprintGestureCallback(
                 mMockFingerprintGestureCallback, null);
         mFingerprintGestureController.onGesture(FINGERPRINT_GESTURE_SWIPE_DOWN);
-        verify(mMockFingerprintGestureCallback, times(1)).onGestureDetected(FINGERPRINT_GESTURE_SWIPE_DOWN);
+        verify(mMockFingerprintGestureCallback, times(1))
+                .onGestureDetected(FINGERPRINT_GESTURE_SWIPE_DOWN);
 
         reset(mMockFingerprintGestureCallback);
         mFingerprintGestureController.unregisterFingerprintGestureCallback(
@@ -150,9 +151,11 @@
         mFingerprintGestureController.registerFingerprintGestureCallback(
                 mMockFingerprintGestureCallback, messageCapturingHandler);
         mFingerprintGestureController.onGesture(FINGERPRINT_GESTURE_SWIPE_DOWN);
-        verify(mMockFingerprintGestureCallback, times(0)).onGestureDetected(FINGERPRINT_GESTURE_SWIPE_DOWN);
+        verify(mMockFingerprintGestureCallback, times(0))
+                .onGestureDetected(FINGERPRINT_GESTURE_SWIPE_DOWN);
         messageCapturingHandler.sendLastMessage();
-        verify(mMockFingerprintGestureCallback, times(1)).onGestureDetected(FINGERPRINT_GESTURE_SWIPE_DOWN);
+        verify(mMockFingerprintGestureCallback, times(1))
+                .onGestureDetected(FINGERPRINT_GESTURE_SWIPE_DOWN);
 
         reset(mMockFingerprintGestureCallback);
         mFingerprintGestureController.unregisterFingerprintGestureCallback(
diff --git a/services/tests/servicestests/src/com/android/server/accessibility/GestureDescriptionTest.java b/services/tests/servicestests/src/com/android/server/accessibility/GestureDescriptionTest.java
index b876a5f..8d389a2 100644
--- a/services/tests/servicestests/src/com/android/server/accessibility/GestureDescriptionTest.java
+++ b/services/tests/servicestests/src/com/android/server/accessibility/GestureDescriptionTest.java
@@ -16,7 +16,6 @@
 
 package com.android.server.accessibility;
 
-import static android.accessibilityservice.GestureDescription.StrokeDescription.INVALID_STROKE_ID;
 import static org.hamcrest.CoreMatchers.allOf;
 import static org.hamcrest.CoreMatchers.everyItem;
 import static org.hamcrest.MatcherAssert.assertThat;
@@ -246,7 +245,7 @@
         swipePath.moveTo(10, 20);
         swipePath.lineTo(30, 40);
         StrokeDescription stroke1 =
-                new StrokeDescription(swipePath, 0, 100, 0, true);
+                new StrokeDescription(swipePath, 0, 100, true);
         GestureDescription gesture = new GestureDescription.Builder().addStroke(stroke1).build();
         List<GestureStep> steps = MotionEventGenerator
                 .getGestureStepsFromGestureDescription(gesture, 10);
@@ -260,9 +259,8 @@
         swipePath.moveTo(10, 20);
         swipePath.lineTo(30, 40);
         StrokeDescription stroke1 =
-                new StrokeDescription(swipePath, 0, 100, INVALID_STROKE_ID, true);
-        StrokeDescription stroke2 =
-                new StrokeDescription(swipePath, 0, 100, stroke1.getId(), false);
+                new StrokeDescription(swipePath, 0, 100, true);
+        StrokeDescription stroke2 = stroke1.continueStroke(swipePath, 0, 100, false);
         GestureDescription gesture = new GestureDescription.Builder().addStroke(stroke2).build();
         List<GestureStep> steps = MotionEventGenerator
                 .getGestureStepsFromGestureDescription(gesture, 10);
diff --git a/services/tests/servicestests/src/com/android/server/devicepolicy/NetworkEventTest.java b/services/tests/servicestests/src/com/android/server/devicepolicy/NetworkEventTest.java
index caa26e1..db317a0 100644
--- a/services/tests/servicestests/src/com/android/server/devicepolicy/NetworkEventTest.java
+++ b/services/tests/servicestests/src/com/android/server/devicepolicy/NetworkEventTest.java
@@ -53,9 +53,10 @@
         DnsEvent unparceledEvent = p.readParcelable(NetworkEventTest.class.getClassLoader());
         p.recycle();
         assertEquals(event.getHostname(), unparceledEvent.getHostname());
-        assertEquals(event.getInetAddresses()[0], unparceledEvent.getInetAddresses()[0]);
-        assertEquals(event.getInetAddresses()[1], unparceledEvent.getInetAddresses()[1]);
-        assertEquals(event.getTotalResolvedAddressCount(), unparceledEvent.getTotalResolvedAddressCount());
+        assertEquals(event.getInetAddresses().get(0), unparceledEvent.getInetAddresses().get(0));
+        assertEquals(event.getInetAddresses().get(1), unparceledEvent.getInetAddresses().get(1));
+        assertEquals(event.getTotalResolvedAddressCount(),
+                unparceledEvent.getTotalResolvedAddressCount());
         assertEquals(event.getPackageName(), unparceledEvent.getPackageName());
         assertEquals(event.getTimestamp(), unparceledEvent.getTimestamp());
     }
diff --git a/services/tests/servicestests/src/com/android/server/pm/PackageParserTest.java b/services/tests/servicestests/src/com/android/server/pm/PackageParserTest.java
index d8db331..1284b1b 100644
--- a/services/tests/servicestests/src/com/android/server/pm/PackageParserTest.java
+++ b/services/tests/servicestests/src/com/android/server/pm/PackageParserTest.java
@@ -15,7 +15,6 @@
  */
 package com.android.server.pm;
 
-import android.annotation.TestApi;
 import android.content.pm.ActivityInfo;
 import android.content.pm.ApplicationInfo;
 import android.content.pm.ConfigurationInfo;
@@ -338,7 +337,7 @@
 
         // Sanity check for InstrumentationInfo.
         assertEquals(a.info.targetPackage, b.info.targetPackage);
-        assertEquals(a.info.targetProcess, b.info.targetProcess);
+        assertEquals(a.info.targetProcesses, b.info.targetProcesses);
         assertEquals(a.info.sourceDir, b.info.sourceDir);
         assertEquals(a.info.publicSourceDir, b.info.publicSourceDir);
     }
diff --git a/services/tests/servicestests/src/com/android/server/wm/TaskSnapshotPersisterLoaderTest.java b/services/tests/servicestests/src/com/android/server/wm/TaskSnapshotPersisterLoaderTest.java
index 4121447..8108909 100644
--- a/services/tests/servicestests/src/com/android/server/wm/TaskSnapshotPersisterLoaderTest.java
+++ b/services/tests/servicestests/src/com/android/server/wm/TaskSnapshotPersisterLoaderTest.java
@@ -24,9 +24,7 @@
 
 import android.app.ActivityManager.TaskSnapshot;
 import android.content.res.Configuration;
-import android.graphics.Bitmap;
 import android.graphics.Rect;
-import android.os.Debug;
 import android.os.SystemClock;
 import android.platform.test.annotations.Presubmit;
 import android.support.test.filters.MediumTest;
@@ -55,13 +53,13 @@
 
     @Test
     public void testPersistAndLoadSnapshot() {
-        mPersister.persistSnapshot(1 , sTestUserId, createSnapshot());
+        mPersister.persistSnapshot(1 , mTestUserId, createSnapshot());
         mPersister.waitForQueueEmpty();
         final File[] files = new File[] { new File(sFilesDir.getPath() + "/snapshots/1.proto"),
                 new File(sFilesDir.getPath() + "/snapshots/1.jpg"),
                 new File(sFilesDir.getPath() + "/snapshots/1_reduced.jpg")};
         assertTrueForFiles(files, File::exists, " must exist");
-        final TaskSnapshot snapshot = mLoader.loadTask(1, sTestUserId, false /* reduced */);
+        final TaskSnapshot snapshot = mLoader.loadTask(1, mTestUserId, false /* reduced */);
         assertNotNull(snapshot);
         assertEquals(TEST_INSETS, snapshot.getContentInsets());
         assertNotNull(snapshot.getSnapshot());
@@ -76,8 +74,8 @@
 
     @Test
     public void testTaskRemovedFromRecents() {
-        mPersister.persistSnapshot(1, sTestUserId, createSnapshot());
-        mPersister.onTaskRemovedFromRecents(1, sTestUserId);
+        mPersister.persistSnapshot(1, mTestUserId, createSnapshot());
+        mPersister.onTaskRemovedFromRecents(1, mTestUserId);
         mPersister.waitForQueueEmpty();
         assertFalse(new File(sFilesDir.getPath() + "/snapshots/1.proto").exists());
         assertFalse(new File(sFilesDir.getPath() + "/snapshots/1.jpg").exists());
@@ -90,12 +88,12 @@
     @Test
     public void testThrottling() {
         long ms = SystemClock.elapsedRealtime();
-        mPersister.persistSnapshot(1, sTestUserId, createSnapshot());
-        mPersister.persistSnapshot(2, sTestUserId, createSnapshot());
-        mPersister.persistSnapshot(3, sTestUserId, createSnapshot());
-        mPersister.persistSnapshot(4, sTestUserId, createSnapshot());
-        mPersister.persistSnapshot(5, sTestUserId, createSnapshot());
-        mPersister.persistSnapshot(6, sTestUserId, createSnapshot());
+        mPersister.persistSnapshot(1, mTestUserId, createSnapshot());
+        mPersister.persistSnapshot(2, mTestUserId, createSnapshot());
+        mPersister.persistSnapshot(3, mTestUserId, createSnapshot());
+        mPersister.persistSnapshot(4, mTestUserId, createSnapshot());
+        mPersister.persistSnapshot(5, mTestUserId, createSnapshot());
+        mPersister.persistSnapshot(6, mTestUserId, createSnapshot());
         mPersister.waitForQueueEmpty();
         assertTrue(SystemClock.elapsedRealtime() - ms > 500);
     }
@@ -115,11 +113,11 @@
 
     @Test
     public void testRemoveObsoleteFiles() {
-        mPersister.persistSnapshot(1, sTestUserId, createSnapshot());
-        mPersister.persistSnapshot(2, sTestUserId, createSnapshot());
+        mPersister.persistSnapshot(1, mTestUserId, createSnapshot());
+        mPersister.persistSnapshot(2, mTestUserId, createSnapshot());
         final ArraySet<Integer> taskIds = new ArraySet<>();
         taskIds.add(1);
-        mPersister.removeObsoleteFiles(taskIds, new int[] { sTestUserId });
+        mPersister.removeObsoleteFiles(taskIds, new int[] { mTestUserId });
         mPersister.waitForQueueEmpty();
         final File[] existsFiles = new File[] {
                 new File(sFilesDir.getPath() + "/snapshots/1.proto"),
@@ -135,11 +133,11 @@
 
     @Test
     public void testRemoveObsoleteFiles_addedOneInTheMeantime() {
-        mPersister.persistSnapshot(1, sTestUserId, createSnapshot());
+        mPersister.persistSnapshot(1, mTestUserId, createSnapshot());
         final ArraySet<Integer> taskIds = new ArraySet<>();
         taskIds.add(1);
-        mPersister.removeObsoleteFiles(taskIds, new int[] { sTestUserId });
-        mPersister.persistSnapshot(2, sTestUserId, createSnapshot());
+        mPersister.removeObsoleteFiles(taskIds, new int[] { mTestUserId });
+        mPersister.persistSnapshot(2, mTestUserId, createSnapshot());
         mPersister.waitForQueueEmpty();
         final File[] existsFiles = new File[] {
                 new File(sFilesDir.getPath() + "/snapshots/1.proto"),
diff --git a/services/tests/servicestests/src/com/android/server/wm/TaskSnapshotPersisterTestBase.java b/services/tests/servicestests/src/com/android/server/wm/TaskSnapshotPersisterTestBase.java
index 5e7389d..18d0c32 100644
--- a/services/tests/servicestests/src/com/android/server/wm/TaskSnapshotPersisterTestBase.java
+++ b/services/tests/servicestests/src/com/android/server/wm/TaskSnapshotPersisterTestBase.java
@@ -21,7 +21,6 @@
 import static android.graphics.GraphicBuffer.USAGE_SW_READ_RARELY;
 
 import android.app.ActivityManager.TaskSnapshot;
-import android.content.pm.UserInfo;
 import android.graphics.Canvas;
 import android.graphics.Color;
 import android.graphics.GraphicBuffer;
@@ -31,8 +30,6 @@
 import android.support.test.InstrumentationRegistry;
 
 import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Assert;
 import org.junit.Before;
 import org.junit.BeforeClass;
 
@@ -43,32 +40,24 @@
  */
 class TaskSnapshotPersisterTestBase extends WindowTestsBase {
 
-    private static final String TEST_USER_NAME = "TaskSnapshotPersisterTest User";
     private static final Rect TEST_INSETS = new Rect(10, 20, 30, 40);
 
     TaskSnapshotPersister mPersister;
     TaskSnapshotLoader mLoader;
-    static int sTestUserId;
+    int mTestUserId;
     static File sFilesDir;
-    private static UserManager sUserManager;
 
     @BeforeClass
     public static void setUpUser() {
-        sUserManager = UserManager.get(InstrumentationRegistry.getContext());
-        sTestUserId = createUser(TEST_USER_NAME, 0);
         sFilesDir = InstrumentationRegistry.getContext().getFilesDir();
     }
 
-    @AfterClass
-    public static void tearDownUser() {
-        removeUser(sTestUserId);
-    }
-
     @Before
     public void setUp() throws Exception {
         super.setUp();
-        mPersister = new TaskSnapshotPersister(
-                userId -> sFilesDir);
+        final UserManager um = UserManager.get(InstrumentationRegistry.getContext());
+        mTestUserId = um.getUserHandle();
+        mPersister = new TaskSnapshotPersister(userId -> sFilesDir);
         mLoader = new TaskSnapshotLoader(mPersister);
         mPersister.start();
     }
@@ -78,20 +67,6 @@
         cleanDirectory();
     }
 
-    private static int createUser(String name, int flags) {
-        UserInfo user = sUserManager.createUser(name, flags);
-        if (user == null) {
-            Assert.fail("Error while creating the test user: " + TEST_USER_NAME);
-        }
-        return user.id;
-    }
-
-    private static void removeUser(int userId) {
-        if (!sUserManager.removeUser(userId)) {
-            Assert.fail("Error while removing the test user: " + TEST_USER_NAME);
-        }
-    }
-
     private void cleanDirectory() {
         for (File file : new File(sFilesDir, "snapshots").listFiles()) {
             if (!file.isDirectory()) {
@@ -101,7 +76,7 @@
     }
 
     TaskSnapshot createSnapshot() {
-        GraphicBuffer buffer = GraphicBuffer.create(100, 100, PixelFormat.RGBA_8888,
+        final GraphicBuffer buffer = GraphicBuffer.create(100, 100, PixelFormat.RGBA_8888,
                 USAGE_HW_TEXTURE | USAGE_SW_READ_RARELY | USAGE_SW_READ_RARELY);
         Canvas c = buffer.lockCanvas();
         c.drawColor(Color.RED);
diff --git a/tools/aapt2/Main.cpp b/tools/aapt2/Main.cpp
index 87fda16..1965ad9 100644
--- a/tools/aapt2/Main.cpp
+++ b/tools/aapt2/Main.cpp
@@ -19,6 +19,8 @@
 
 #include "androidfw/StringPiece.h"
 
+#include "Diagnostics.h"
+
 namespace aapt {
 
 // DO NOT UPDATE, this is more of a marketing version.
@@ -33,8 +35,8 @@
   return 0;
 }
 
-extern int Compile(const std::vector<android::StringPiece>& args);
-extern int Link(const std::vector<android::StringPiece>& args);
+extern int Compile(const std::vector<android::StringPiece>& args, IDiagnostics* diagnostics);
+extern int Link(const std::vector<android::StringPiece>& args, IDiagnostics* diagnostics);
 extern int Dump(const std::vector<android::StringPiece>& args);
 extern int Diff(const std::vector<android::StringPiece>& args);
 extern int Optimize(const std::vector<android::StringPiece>& args);
@@ -53,9 +55,11 @@
 
     android::StringPiece command(argv[0]);
     if (command == "compile" || command == "c") {
-      return aapt::Compile(args);
+      aapt::StdErrDiagnostics diagnostics;
+      return aapt::Compile(args, &diagnostics);
     } else if (command == "link" || command == "l") {
-      return aapt::Link(args);
+      aapt::StdErrDiagnostics diagnostics;
+      return aapt::Link(args, &diagnostics);
     } else if (command == "dump" || command == "d") {
       return aapt::Dump(args);
     } else if (command == "diff") {
diff --git a/tools/aapt2/cmd/Compile.cpp b/tools/aapt2/cmd/Compile.cpp
index b93c6ec..5413b33 100644
--- a/tools/aapt2/cmd/Compile.cpp
+++ b/tools/aapt2/cmd/Compile.cpp
@@ -598,6 +598,9 @@
 
 class CompileContext : public IAaptContext {
  public:
+  CompileContext(IDiagnostics* diagnostics) : diagnostics_(diagnostics) {
+  }
+
   PackageType GetPackageType() override {
     // Every compilation unit starts as an app and then gets linked as potentially something else.
     return PackageType::kApp;
@@ -612,7 +615,7 @@
   }
 
   IDiagnostics* GetDiagnostics() override {
-    return &diagnostics_;
+    return diagnostics_;
   }
 
   NameMangler* GetNameMangler() override {
@@ -639,7 +642,7 @@
   }
 
  private:
-  StdErrDiagnostics diagnostics_;
+  IDiagnostics* diagnostics_;
   bool verbose_ = false;
 };
 
@@ -647,8 +650,8 @@
  * Entry point for compilation phase. Parses arguments and dispatches to the
  * correct steps.
  */
-int Compile(const std::vector<StringPiece>& args) {
-  CompileContext context;
+int Compile(const std::vector<StringPiece>& args, IDiagnostics* diagnostics) {
+  CompileContext context(diagnostics);
   CompileOptions options;
 
   bool verbose = false;
diff --git a/tools/aapt2/cmd/Link.cpp b/tools/aapt2/cmd/Link.cpp
index 258516d..93748d3 100644
--- a/tools/aapt2/cmd/Link.cpp
+++ b/tools/aapt2/cmd/Link.cpp
@@ -118,7 +118,8 @@
 
 class LinkContext : public IAaptContext {
  public:
-  LinkContext() : name_mangler_({}), symbols_(&name_mangler_) {
+  LinkContext(IDiagnostics* diagnostics)
+      : diagnostics_(diagnostics), name_mangler_({}), symbols_(&name_mangler_) {
   }
 
   PackageType GetPackageType() override {
@@ -130,7 +131,7 @@
   }
 
   IDiagnostics* GetDiagnostics() override {
-    return &diagnostics_;
+    return diagnostics_;
   }
 
   NameMangler* GetNameMangler() override {
@@ -181,7 +182,7 @@
   DISALLOW_COPY_AND_ASSIGN(LinkContext);
 
   PackageType package_type_ = PackageType::kApp;
-  StdErrDiagnostics diagnostics_;
+  IDiagnostics* diagnostics_;
   NameMangler name_mangler_;
   std::string compilation_package_;
   uint8_t package_id_ = 0x0;
@@ -1736,8 +1737,8 @@
   std::map<size_t, std::string> shared_libs_;
 };
 
-int Link(const std::vector<StringPiece>& args) {
-  LinkContext context;
+int Link(const std::vector<StringPiece>& args, IDiagnostics* diagnostics) {
+  LinkContext context(diagnostics);
   LinkOptions options;
   std::vector<std::string> overlay_arg_list;
   std::vector<std::string> extra_java_packages;
diff --git a/tools/aapt2/jni/aapt2_jni.cpp b/tools/aapt2/jni/aapt2_jni.cpp
index ce3d282..ad5ad4c 100644
--- a/tools/aapt2/jni/aapt2_jni.cpp
+++ b/tools/aapt2/jni/aapt2_jni.cpp
@@ -24,13 +24,14 @@
 #include "android-base/logging.h"
 #include "ScopedUtfChars.h"
 
+#include "Diagnostics.h"
 #include "util/Util.h"
 
 using android::StringPiece;
 
 namespace aapt {
-extern int Compile(const std::vector<StringPiece> &args);
-extern int Link(const std::vector<StringPiece> &args);
+extern int Compile(const std::vector<StringPiece>& args, IDiagnostics* iDiagnostics);
+extern int Link(const std::vector<StringPiece>& args, IDiagnostics* iDiagnostics);
 }
 
 /*
@@ -77,20 +78,66 @@
   return pieces;
 }
 
+class JniDiagnostics : public aapt::IDiagnostics {
+ public:
+  JniDiagnostics(JNIEnv* env, jobject diagnostics_obj)
+      : env_(env), diagnostics_obj_(diagnostics_obj) {
+    mid_ = NULL;
+  }
+
+  void Log(Level level, aapt::DiagMessageActual& actual_msg) override {
+    jint level_value;
+    switch (level) {
+      case Level::Error:
+        level_value = 3;
+        break;
+
+      case Level::Warn:
+        level_value = 2;
+        break;
+
+      case Level::Note:
+        level_value = 1;
+        break;
+    }
+    jstring message = env_->NewStringUTF(actual_msg.message.c_str());
+    jstring path = env_->NewStringUTF(actual_msg.source.path.c_str());
+    jlong line = -1;
+    if (actual_msg.source.line) {
+      line = actual_msg.source.line.value();
+    }
+    if (!mid_) {
+      jclass diagnostics_cls = env_->GetObjectClass(diagnostics_obj_);
+      mid_ = env_->GetMethodID(diagnostics_cls, "log", "(ILjava/lang/String;JLjava/lang/String;)V");
+    }
+    env_->CallVoidMethod(diagnostics_obj_, mid_, level_value, path, line, message);
+  }
+
+ private:
+  JNIEnv* env_;
+  jobject diagnostics_obj_;
+  jmethodID mid_;
+  DISALLOW_COPY_AND_ASSIGN(JniDiagnostics);
+};
+
 JNIEXPORT jint JNICALL Java_com_android_tools_aapt2_Aapt2Jni_nativeCompile(
-    JNIEnv *env, jclass aapt_obj, jobject arguments_obj) {
+    JNIEnv* env, jclass aapt_obj, jobject arguments_obj, jobject diagnostics_obj) {
   std::vector<ScopedUtfChars> compile_args_jni =
       list_to_utfchars(env, arguments_obj);
   std::vector<StringPiece> compile_args = extract_pieces(compile_args_jni);
-  return aapt::Compile(compile_args);
+  JniDiagnostics diagnostics(env, diagnostics_obj);
+  return aapt::Compile(compile_args, &diagnostics);
 }
 
-JNIEXPORT jint JNICALL Java_com_android_tools_aapt2_Aapt2Jni_nativeLink(
-    JNIEnv *env, jclass aapt_obj, jobject arguments_obj) {
+JNIEXPORT jint JNICALL Java_com_android_tools_aapt2_Aapt2Jni_nativeLink(JNIEnv* env,
+                                                                        jclass aapt_obj,
+                                                                        jobject arguments_obj,
+                                                                        jobject diagnostics_obj) {
   std::vector<ScopedUtfChars> link_args_jni =
       list_to_utfchars(env, arguments_obj);
   std::vector<StringPiece> link_args = extract_pieces(link_args_jni);
-  return aapt::Link(link_args);
+  JniDiagnostics diagnostics(env, diagnostics_obj);
+  return aapt::Link(link_args, &diagnostics);
 }
 
 JNIEXPORT void JNICALL Java_com_android_tools_aapt2_Aapt2Jni_ping(
diff --git a/tools/aapt2/jni/com_android_tools_aapt2_Aapt2Jni.h b/tools/aapt2/jni/com_android_tools_aapt2_Aapt2Jni.h
index 90150b4..3cd9865 100644
--- a/tools/aapt2/jni/com_android_tools_aapt2_Aapt2Jni.h
+++ b/tools/aapt2/jni/com_android_tools_aapt2_Aapt2Jni.h
@@ -18,18 +18,18 @@
 /*
  * Class:     com_android_tools_aapt2_Aapt2Jni
  * Method:    nativeCompile
- * Signature: (Ljava/util/List;)I
+ * Signature: (Ljava/util/List;Lcom/android/tools/aapt2/Aapt2JniDiagnostics;)I
  */
-JNIEXPORT jint JNICALL Java_com_android_tools_aapt2_Aapt2Jni_nativeCompile
-  (JNIEnv *, jclass, jobject);
+JNIEXPORT jint JNICALL Java_com_android_tools_aapt2_Aapt2Jni_nativeCompile(JNIEnv*, jclass, jobject,
+                                                                           jobject);
 
 /*
  * Class:     com_android_tools_aapt2_Aapt2Jni
  * Method:    nativeLink
- * Signature: (Ljava/util/List;)I
+ * Signature: (Ljava/util/List;Lcom/android/tools/aapt2/Aapt2JniDiagnostics;)I
  */
-JNIEXPORT jint JNICALL Java_com_android_tools_aapt2_Aapt2Jni_nativeLink
-  (JNIEnv *, jclass, jobject);
+JNIEXPORT jint JNICALL Java_com_android_tools_aapt2_Aapt2Jni_nativeLink(JNIEnv*, jclass, jobject,
+                                                                        jobject);
 
 #ifdef __cplusplus
 }