Merge "Adding Face Setting Stats." into qt-dev
diff --git a/api/current.txt b/api/current.txt
index 7878eb6..2184302 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -23776,27 +23776,6 @@
     field public static final int QUALITY_MEDIUM = 1; // 0x1
   }
 
-  public class DataSourceDesc {
-    method public long getEndPosition();
-    method @Nullable public String getMediaId();
-    method public long getStartPosition();
-    field public static final long LONG_MAX_TIME_MS = 576460752303423L; // 0x20c49ba5e353fL
-    field public static final long POSITION_UNKNOWN = 576460752303423L; // 0x20c49ba5e353fL
-  }
-
-  public static final class DataSourceDesc.Builder {
-    ctor public DataSourceDesc.Builder();
-    ctor public DataSourceDesc.Builder(@Nullable android.media.DataSourceDesc);
-    method @NonNull public android.media.DataSourceDesc build();
-    method @NonNull public android.media.DataSourceDesc.Builder setDataSource(@NonNull android.net.Uri);
-    method @NonNull public android.media.DataSourceDesc.Builder setDataSource(@NonNull android.net.Uri, @Nullable java.util.Map<java.lang.String,java.lang.String>, @Nullable java.util.List<java.net.HttpCookie>);
-    method @NonNull public android.media.DataSourceDesc.Builder setDataSource(@NonNull android.os.ParcelFileDescriptor);
-    method @NonNull public android.media.DataSourceDesc.Builder setDataSource(@NonNull android.os.ParcelFileDescriptor, long, long);
-    method @NonNull public android.media.DataSourceDesc.Builder setEndPosition(long);
-    method @NonNull public android.media.DataSourceDesc.Builder setMediaId(@Nullable String);
-    method @NonNull public android.media.DataSourceDesc.Builder setStartPosition(long);
-  }
-
   public final class DeniedByServerException extends android.media.MediaDrmException {
     ctor public DeniedByServerException(String);
   }
@@ -25555,225 +25534,6 @@
     field public static final int MEDIA_TRACK_TYPE_VIDEO = 1; // 0x1
   }
 
-  public class MediaPlayer2 implements android.media.AudioRouting java.lang.AutoCloseable {
-    ctor public MediaPlayer2(@NonNull android.content.Context);
-    method public void addOnRoutingChangedListener(@NonNull android.media.AudioRouting.OnRoutingChangedListener, @Nullable android.os.Handler);
-    method @NonNull public Object attachAuxEffect(int);
-    method public boolean cancelCommand(@NonNull Object);
-    method public void clearDrmEventCallback();
-    method @NonNull public Object clearNextDataSources();
-    method public void clearPendingCommands();
-    method public void close();
-    method @NonNull public Object deselectTrack(@NonNull android.media.MediaPlayer2.TrackInfo);
-    method @NonNull public Object deselectTrack(@NonNull android.media.DataSourceDesc, @NonNull android.media.MediaPlayer2.TrackInfo);
-    method @NonNull public android.media.AudioAttributes getAudioAttributes();
-    method public int getAudioSessionId();
-    method public long getBufferedPosition();
-    method public long getBufferedPosition(@NonNull android.media.DataSourceDesc);
-    method @Nullable public android.media.DataSourceDesc getCurrentDataSource();
-    method public long getCurrentPosition();
-    method public long getDuration();
-    method public long getDuration(@NonNull android.media.DataSourceDesc);
-    method public float getMaxPlayerVolume();
-    method @Nullable public android.os.PersistableBundle getMetrics();
-    method @NonNull public android.media.PlaybackParams getPlaybackParams();
-    method public float getPlayerVolume();
-    method @Nullable public android.media.AudioDeviceInfo getPreferredDevice();
-    method @Nullable public android.media.AudioDeviceInfo getRoutedDevice();
-    method @Nullable public android.media.MediaPlayer2.TrackInfo getSelectedTrack(int);
-    method @Nullable public android.media.MediaPlayer2.TrackInfo getSelectedTrack(@NonNull android.media.DataSourceDesc, int);
-    method public int getState();
-    method @NonNull public android.media.SyncParams getSyncParams();
-    method @Nullable public android.media.MediaTimestamp getTimestamp();
-    method @NonNull public java.util.List<android.media.MediaPlayer2.TrackInfo> getTrackInfo();
-    method @NonNull public java.util.List<android.media.MediaPlayer2.TrackInfo> getTrackInfo(@NonNull android.media.DataSourceDesc);
-    method @NonNull public android.util.Size getVideoSize();
-    method public boolean isLooping();
-    method @NonNull public Object loopCurrent(boolean);
-    method @NonNull public Object notifyWhenCommandLabelReached(@NonNull Object);
-    method @NonNull public Object pause();
-    method @NonNull public Object play();
-    method @NonNull public Object prepare();
-    method public void registerEventCallback(@NonNull java.util.concurrent.Executor, @NonNull android.media.MediaPlayer2.EventCallback);
-    method public void removeOnRoutingChangedListener(@NonNull android.media.AudioRouting.OnRoutingChangedListener);
-    method public void reset();
-    method @NonNull public Object seekTo(long);
-    method @NonNull public Object seekTo(long, int);
-    method @NonNull public Object selectTrack(@NonNull android.media.MediaPlayer2.TrackInfo);
-    method @NonNull public Object selectTrack(@NonNull android.media.DataSourceDesc, @NonNull android.media.MediaPlayer2.TrackInfo);
-    method @NonNull public Object setAudioAttributes(@NonNull android.media.AudioAttributes);
-    method @NonNull public Object setAudioSessionId(int);
-    method @NonNull public Object setAuxEffectSendLevel(float);
-    method @NonNull public Object setDataSource(@NonNull android.media.DataSourceDesc);
-    method @NonNull public Object setDisplay(@Nullable android.view.SurfaceHolder);
-    method public void setDrmEventCallback(@NonNull java.util.concurrent.Executor, @NonNull android.media.MediaPlayer2.DrmEventCallback);
-    method @NonNull public Object setNextDataSource(@NonNull android.media.DataSourceDesc);
-    method @NonNull public Object setNextDataSources(@NonNull java.util.List<android.media.DataSourceDesc>);
-    method @NonNull public Object setPlaybackParams(@NonNull android.media.PlaybackParams);
-    method @NonNull public Object setPlayerVolume(float);
-    method public boolean setPreferredDevice(@Nullable android.media.AudioDeviceInfo);
-    method @NonNull public Object setScreenOnWhilePlaying(boolean);
-    method @NonNull public Object setSurface(@Nullable android.view.Surface);
-    method @NonNull public Object setSyncParams(@NonNull android.media.SyncParams);
-    method @NonNull public Object setWakeLock(@NonNull android.os.PowerManager.WakeLock);
-    method @NonNull public Object skipToNext();
-    method public void unregisterEventCallback(@NonNull android.media.MediaPlayer2.EventCallback);
-    field public static final int CALL_COMPLETED_ATTACH_AUX_EFFECT = 1; // 0x1
-    field public static final int CALL_COMPLETED_CLEAR_NEXT_DATA_SOURCES = 30; // 0x1e
-    field public static final int CALL_COMPLETED_DESELECT_TRACK = 2; // 0x2
-    field public static final int CALL_COMPLETED_LOOP_CURRENT = 3; // 0x3
-    field public static final int CALL_COMPLETED_PAUSE = 4; // 0x4
-    field public static final int CALL_COMPLETED_PLAY = 5; // 0x5
-    field public static final int CALL_COMPLETED_PREPARE = 6; // 0x6
-    field public static final int CALL_COMPLETED_SEEK_TO = 14; // 0xe
-    field public static final int CALL_COMPLETED_SELECT_TRACK = 15; // 0xf
-    field public static final int CALL_COMPLETED_SET_AUDIO_ATTRIBUTES = 16; // 0x10
-    field public static final int CALL_COMPLETED_SET_AUDIO_SESSION_ID = 17; // 0x11
-    field public static final int CALL_COMPLETED_SET_AUX_EFFECT_SEND_LEVEL = 18; // 0x12
-    field public static final int CALL_COMPLETED_SET_DATA_SOURCE = 19; // 0x13
-    field public static final int CALL_COMPLETED_SET_DISPLAY = 33; // 0x21
-    field public static final int CALL_COMPLETED_SET_NEXT_DATA_SOURCE = 22; // 0x16
-    field public static final int CALL_COMPLETED_SET_NEXT_DATA_SOURCES = 23; // 0x17
-    field public static final int CALL_COMPLETED_SET_PLAYBACK_PARAMS = 24; // 0x18
-    field public static final int CALL_COMPLETED_SET_PLAYER_VOLUME = 26; // 0x1a
-    field public static final int CALL_COMPLETED_SET_SCREEN_ON_WHILE_PLAYING = 35; // 0x23
-    field public static final int CALL_COMPLETED_SET_SURFACE = 27; // 0x1b
-    field public static final int CALL_COMPLETED_SET_SYNC_PARAMS = 28; // 0x1c
-    field public static final int CALL_COMPLETED_SET_WAKE_LOCK = 34; // 0x22
-    field public static final int CALL_COMPLETED_SKIP_TO_NEXT = 29; // 0x1d
-    field public static final int CALL_STATUS_BAD_VALUE = 2; // 0x2
-    field public static final int CALL_STATUS_ERROR_IO = 4; // 0x4
-    field public static final int CALL_STATUS_ERROR_UNKNOWN = -2147483648; // 0x80000000
-    field public static final int CALL_STATUS_INVALID_OPERATION = 1; // 0x1
-    field public static final int CALL_STATUS_NO_DRM_SCHEME = 6; // 0x6
-    field public static final int CALL_STATUS_NO_ERROR = 0; // 0x0
-    field public static final int CALL_STATUS_PERMISSION_DENIED = 3; // 0x3
-    field public static final int CALL_STATUS_SKIPPED = 5; // 0x5
-    field public static final int MEDIA_ERROR_IO = -1004; // 0xfffffc14
-    field public static final int MEDIA_ERROR_MALFORMED = -1007; // 0xfffffc11
-    field public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK = 200; // 0xc8
-    field public static final int MEDIA_ERROR_TIMED_OUT = -110; // 0xffffff92
-    field public static final int MEDIA_ERROR_UNKNOWN = 1; // 0x1
-    field public static final int MEDIA_ERROR_UNSUPPORTED = -1010; // 0xfffffc0e
-    field public static final int MEDIA_INFO_AUDIO_NOT_PLAYING = 804; // 0x324
-    field public static final int MEDIA_INFO_AUDIO_RENDERING_START = 4; // 0x4
-    field public static final int MEDIA_INFO_BAD_INTERLEAVING = 800; // 0x320
-    field public static final int MEDIA_INFO_BUFFERING_END = 702; // 0x2be
-    field public static final int MEDIA_INFO_BUFFERING_START = 701; // 0x2bd
-    field public static final int MEDIA_INFO_BUFFERING_UPDATE = 704; // 0x2c0
-    field public static final int MEDIA_INFO_DATA_SOURCE_END = 5; // 0x5
-    field public static final int MEDIA_INFO_DATA_SOURCE_LIST_END = 6; // 0x6
-    field public static final int MEDIA_INFO_DATA_SOURCE_REPEAT = 7; // 0x7
-    field public static final int MEDIA_INFO_DATA_SOURCE_START = 2; // 0x2
-    field public static final int MEDIA_INFO_METADATA_UPDATE = 802; // 0x322
-    field public static final int MEDIA_INFO_NOT_SEEKABLE = 801; // 0x321
-    field public static final int MEDIA_INFO_PREPARED = 100; // 0x64
-    field public static final int MEDIA_INFO_SUBTITLE_TIMED_OUT = 902; // 0x386
-    field public static final int MEDIA_INFO_UNKNOWN = 1; // 0x1
-    field public static final int MEDIA_INFO_UNSUPPORTED_SUBTITLE = 901; // 0x385
-    field public static final int MEDIA_INFO_VIDEO_NOT_PLAYING = 805; // 0x325
-    field public static final int MEDIA_INFO_VIDEO_RENDERING_START = 3; // 0x3
-    field public static final int MEDIA_INFO_VIDEO_TRACK_LAGGING = 700; // 0x2bc
-    field public static final int PLAYER_STATE_ERROR = 1005; // 0x3ed
-    field public static final int PLAYER_STATE_IDLE = 1001; // 0x3e9
-    field public static final int PLAYER_STATE_PAUSED = 1003; // 0x3eb
-    field public static final int PLAYER_STATE_PLAYING = 1004; // 0x3ec
-    field public static final int PLAYER_STATE_PREPARED = 1002; // 0x3ea
-    field public static final int PREPARE_DRM_STATUS_KEY_EXCHANGE_ERROR = 7; // 0x7
-    field public static final int PREPARE_DRM_STATUS_PREPARATION_ERROR = 3; // 0x3
-    field public static final int PREPARE_DRM_STATUS_PROVISIONING_NETWORK_ERROR = 1; // 0x1
-    field public static final int PREPARE_DRM_STATUS_PROVISIONING_SERVER_ERROR = 2; // 0x2
-    field public static final int PREPARE_DRM_STATUS_RESOURCE_BUSY = 5; // 0x5
-    field public static final int PREPARE_DRM_STATUS_RESTORE_ERROR = 6; // 0x6
-    field public static final int PREPARE_DRM_STATUS_SUCCESS = 0; // 0x0
-    field public static final int PREPARE_DRM_STATUS_UNSUPPORTED_SCHEME = 4; // 0x4
-    field public static final int SEEK_CLOSEST = 3; // 0x3
-    field public static final int SEEK_CLOSEST_SYNC = 2; // 0x2
-    field public static final int SEEK_NEXT_SYNC = 1; // 0x1
-    field public static final int SEEK_PREVIOUS_SYNC = 0; // 0x0
-  }
-
-  public abstract static class MediaPlayer2.DrmEventCallback {
-    ctor public MediaPlayer2.DrmEventCallback();
-    method public void onDrmConfig(@NonNull android.media.MediaPlayer2, @NonNull android.media.DataSourceDesc, @NonNull android.media.MediaDrm);
-    method @Nullable public abstract android.media.MediaPlayer2.DrmPreparationInfo onDrmInfo(@NonNull android.media.MediaPlayer2, @NonNull android.media.DataSourceDesc, @NonNull android.media.MediaPlayer2.DrmInfo);
-    method @NonNull public abstract byte[] onDrmKeyRequest(@NonNull android.media.MediaPlayer2, @NonNull android.media.DataSourceDesc, @NonNull android.media.MediaDrm.KeyRequest);
-    method public void onDrmPrepared(@NonNull android.media.MediaPlayer2, @NonNull android.media.DataSourceDesc, int, @Nullable byte[]);
-  }
-
-  public static final class MediaPlayer2.DrmInfo {
-    method @NonNull public java.util.Map<java.util.UUID,byte[]> getPssh();
-    method @NonNull public java.util.List<java.util.UUID> getSupportedSchemes();
-  }
-
-  public static final class MediaPlayer2.DrmPreparationInfo {
-    method @Nullable public byte[] getInitData();
-    method @Nullable public byte[] getKeySetId();
-    method public int getKeyType();
-    method @Nullable public String getMimeType();
-    method @Nullable public java.util.Map<java.lang.String,java.lang.String> getOptionalParameters();
-    method @NonNull public java.util.UUID getUuid();
-  }
-
-  public static final class MediaPlayer2.DrmPreparationInfo.Builder {
-    ctor public MediaPlayer2.DrmPreparationInfo.Builder(@NonNull java.util.UUID);
-    method @NonNull public android.media.MediaPlayer2.DrmPreparationInfo build();
-    method @NonNull public android.media.MediaPlayer2.DrmPreparationInfo.Builder setInitData(@Nullable byte[]);
-    method @NonNull public android.media.MediaPlayer2.DrmPreparationInfo.Builder setKeySetId(@Nullable byte[]);
-    method @NonNull public android.media.MediaPlayer2.DrmPreparationInfo.Builder setKeyType(int);
-    method @NonNull public android.media.MediaPlayer2.DrmPreparationInfo.Builder setMimeType(@Nullable String);
-    method @NonNull public android.media.MediaPlayer2.DrmPreparationInfo.Builder setOptionalParameters(@Nullable java.util.Map<java.lang.String,java.lang.String>);
-  }
-
-  public static class MediaPlayer2.EventCallback {
-    ctor public MediaPlayer2.EventCallback();
-    method public void onCallCompleted(@NonNull android.media.MediaPlayer2, @NonNull android.media.DataSourceDesc, int, int);
-    method public void onCommandLabelReached(@NonNull android.media.MediaPlayer2, @NonNull Object);
-    method public void onError(@NonNull android.media.MediaPlayer2, @NonNull android.media.DataSourceDesc, int, int);
-    method public void onInfo(@NonNull android.media.MediaPlayer2, @NonNull android.media.DataSourceDesc, int, int);
-    method public void onMediaTimeDiscontinuity(@NonNull android.media.MediaPlayer2, @NonNull android.media.DataSourceDesc, @NonNull android.media.MediaTimestamp);
-    method public void onSubtitleData(@NonNull android.media.MediaPlayer2, @NonNull android.media.DataSourceDesc, @NonNull android.media.MediaPlayer2.SubtitleData);
-    method public void onTimedMetaDataAvailable(@NonNull android.media.MediaPlayer2, @NonNull android.media.DataSourceDesc, @NonNull android.media.TimedMetaData);
-    method public void onVideoSizeChanged(@NonNull android.media.MediaPlayer2, @NonNull android.media.DataSourceDesc, @NonNull android.util.Size);
-  }
-
-  public static final class MediaPlayer2.MetricsConstants {
-    field public static final String CODEC_AUDIO = "android.media.mediaplayer.audio.codec";
-    field public static final String CODEC_VIDEO = "android.media.mediaplayer.video.codec";
-    field public static final String DURATION = "android.media.mediaplayer.durationMs";
-    field public static final String ERRORS = "android.media.mediaplayer.err";
-    field public static final String ERROR_CODE = "android.media.mediaplayer.errcode";
-    field public static final String FRAMES = "android.media.mediaplayer.frames";
-    field public static final String FRAMES_DROPPED = "android.media.mediaplayer.dropped";
-    field public static final String HEIGHT = "android.media.mediaplayer.height";
-    field public static final String MIME_TYPE_AUDIO = "android.media.mediaplayer.audio.mime";
-    field public static final String MIME_TYPE_VIDEO = "android.media.mediaplayer.video.mime";
-    field public static final String PLAYING = "android.media.mediaplayer.playingMs";
-    field public static final String WIDTH = "android.media.mediaplayer.width";
-  }
-
-  public static final class MediaPlayer2.NoDrmSchemeException extends android.media.MediaDrmException {
-    ctor public MediaPlayer2.NoDrmSchemeException(@Nullable String);
-  }
-
-  public static final class MediaPlayer2.SubtitleData {
-    method @NonNull public byte[] getData();
-    method public long getDurationUs();
-    method public long getStartTimeUs();
-    method @NonNull public android.media.MediaPlayer2.TrackInfo getTrackInfo();
-  }
-
-  public static class MediaPlayer2.TrackInfo {
-    method @Nullable public android.media.MediaFormat getFormat();
-    method @NonNull public String getLanguage();
-    method public int getTrackType();
-    field public static final int MEDIA_TRACK_TYPE_AUDIO = 2; // 0x2
-    field public static final int MEDIA_TRACK_TYPE_METADATA = 5; // 0x5
-    field public static final int MEDIA_TRACK_TYPE_SUBTITLE = 4; // 0x4
-    field public static final int MEDIA_TRACK_TYPE_UNKNOWN = 0; // 0x0
-    field public static final int MEDIA_TRACK_TYPE_VIDEO = 1; // 0x1
-  }
-
   public class MediaRecorder implements android.media.AudioRecordingMonitor android.media.AudioRouting android.media.MicrophoneDirection {
     ctor public MediaRecorder();
     method public void addOnRoutingChangedListener(android.media.AudioRouting.OnRoutingChangedListener, android.os.Handler);
@@ -38582,7 +38342,6 @@
     field public static final String ARTIST_KEY = "artist_key";
     field public static final String BOOKMARK = "bookmark";
     field public static final String COMPOSER = "composer";
-    field public static final String DURATION = "duration";
     field public static final String IS_ALARM = "is_alarm";
     field public static final String IS_AUDIOBOOK = "is_audiobook";
     field public static final String IS_MUSIC = "is_music";
@@ -38700,16 +38459,11 @@
   }
 
   public static interface MediaStore.Images.ImageColumns extends android.provider.MediaStore.MediaColumns {
-    field public static final String BUCKET_DISPLAY_NAME = "bucket_display_name";
-    field public static final String BUCKET_ID = "bucket_id";
-    field public static final String DATE_TAKEN = "datetaken";
     field public static final String DESCRIPTION = "description";
-    field public static final String GROUP_ID = "group_id";
     field public static final String IS_PRIVATE = "isprivate";
     field @Deprecated public static final String LATITUDE = "latitude";
     field @Deprecated public static final String LONGITUDE = "longitude";
     field @Deprecated public static final String MINI_THUMB_MAGIC = "mini_thumb_magic";
-    field public static final String ORIENTATION = "orientation";
     field @Deprecated public static final String PICASA_ID = "picasa_id";
   }
 
@@ -38753,16 +38507,22 @@
   }
 
   public static interface MediaStore.MediaColumns extends android.provider.BaseColumns {
+    field public static final String BUCKET_DISPLAY_NAME = "bucket_display_name";
+    field public static final String BUCKET_ID = "bucket_id";
     field @Deprecated public static final String DATA = "_data";
     field public static final String DATE_ADDED = "date_added";
     field public static final String DATE_EXPIRES = "date_expires";
     field public static final String DATE_MODIFIED = "date_modified";
+    field public static final String DATE_TAKEN = "datetaken";
     field public static final String DISPLAY_NAME = "_display_name";
     field public static final String DOCUMENT_ID = "document_id";
+    field public static final String DURATION = "duration";
+    field public static final String GROUP_ID = "group_id";
     field public static final String HEIGHT = "height";
     field public static final String INSTANCE_ID = "instance_id";
     field public static final String IS_PENDING = "is_pending";
     field public static final String MIME_TYPE = "mime_type";
+    field public static final String ORIENTATION = "orientation";
     field public static final String ORIGINAL_DOCUMENT_ID = "original_document_id";
     field public static final String OWNER_PACKAGE_NAME = "owner_package_name";
     field public static final String RELATIVE_PATH = "relative_path";
@@ -38811,13 +38571,8 @@
     field public static final String ALBUM = "album";
     field public static final String ARTIST = "artist";
     field public static final String BOOKMARK = "bookmark";
-    field public static final String BUCKET_DISPLAY_NAME = "bucket_display_name";
-    field public static final String BUCKET_ID = "bucket_id";
     field public static final String CATEGORY = "category";
-    field public static final String DATE_TAKEN = "datetaken";
     field public static final String DESCRIPTION = "description";
-    field public static final String DURATION = "duration";
-    field public static final String GROUP_ID = "group_id";
     field public static final String IS_PRIVATE = "isprivate";
     field public static final String LANGUAGE = "language";
     field @Deprecated public static final String LATITUDE = "latitude";
diff --git a/api/removed.txt b/api/removed.txt
index 70ff50e..20304a0 100644
--- a/api/removed.txt
+++ b/api/removed.txt
@@ -522,6 +522,18 @@
     method @Deprecated public static void untrash(@NonNull android.content.Context, @NonNull android.net.Uri);
   }
 
+  public static interface MediaStore.Audio.AudioColumns extends android.provider.MediaStore.MediaColumns {
+    field public static final String DURATION = "duration";
+  }
+
+  public static interface MediaStore.Images.ImageColumns extends android.provider.MediaStore.MediaColumns {
+    field public static final String BUCKET_DISPLAY_NAME = "bucket_display_name";
+    field public static final String BUCKET_ID = "bucket_id";
+    field public static final String DATE_TAKEN = "datetaken";
+    field public static final String GROUP_ID = "group_id";
+    field public static final String ORIENTATION = "orientation";
+  }
+
   public static interface MediaStore.MediaColumns extends android.provider.BaseColumns {
     field @Deprecated public static final String HASH = "_hash";
     field @Deprecated public static final String IS_TRASHED = "is_trashed";
@@ -546,6 +558,14 @@
     method @NonNull public android.net.Uri publish();
   }
 
+  public static interface MediaStore.Video.VideoColumns extends android.provider.MediaStore.MediaColumns {
+    field public static final String BUCKET_DISPLAY_NAME = "bucket_display_name";
+    field public static final String BUCKET_ID = "bucket_id";
+    field public static final String DATE_TAKEN = "datetaken";
+    field public static final String DURATION = "duration";
+    field public static final String GROUP_ID = "group_id";
+  }
+
   public static final class Settings.Global extends android.provider.Settings.NameValueTable {
     field @Deprecated public static final String CONTACT_METADATA_SYNC = "contact_metadata_sync";
   }
diff --git a/api/system-current.txt b/api/system-current.txt
index 4da9236..2d8b092 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -254,8 +254,6 @@
     field public static final int config_defaultAssistant = 17039393; // 0x1040021
     field public static final int config_defaultBrowser = 17039394; // 0x1040022
     field public static final int config_defaultDialer = 17039395; // 0x1040023
-    field public static final int config_defaultGallery = 17039398; // 0x1040026
-    field public static final int config_defaultMusic = 17039397; // 0x1040025
     field public static final int config_defaultSms = 17039396; // 0x1040024
     field public static final int config_feedbackIntentExtraKey = 17039391; // 0x104001f
     field public static final int config_feedbackIntentNameKey = 17039392; // 0x1040020
@@ -564,6 +562,7 @@
     method @Deprecated @RequiresPermission(allOf={android.Manifest.permission.DUMP, android.Manifest.permission.PACKAGE_USAGE_STATS}) public boolean addConfiguration(long, byte[]);
     method @Deprecated @Nullable @RequiresPermission(allOf={android.Manifest.permission.DUMP, android.Manifest.permission.PACKAGE_USAGE_STATS}) public byte[] getData(long);
     method @Deprecated @Nullable @RequiresPermission(allOf={android.Manifest.permission.DUMP, android.Manifest.permission.PACKAGE_USAGE_STATS}) public byte[] getMetadata();
+    method @RequiresPermission(allOf={android.Manifest.permission.DUMP, android.Manifest.permission.PACKAGE_USAGE_STATS}) public long[] getRegisteredExperimentIds() throws android.app.StatsManager.StatsUnavailableException;
     method @RequiresPermission(allOf={android.Manifest.permission.DUMP, android.Manifest.permission.PACKAGE_USAGE_STATS}) public byte[] getReports(long) throws android.app.StatsManager.StatsUnavailableException;
     method @RequiresPermission(allOf={android.Manifest.permission.DUMP, android.Manifest.permission.PACKAGE_USAGE_STATS}) public byte[] getStatsMetadata() throws android.app.StatsManager.StatsUnavailableException;
     method @RequiresPermission(allOf={android.Manifest.permission.DUMP, android.Manifest.permission.PACKAGE_USAGE_STATS}) public void removeConfig(long) throws android.app.StatsManager.StatsUnavailableException;
@@ -7206,6 +7205,7 @@
   }
 
   public static final class CarrierRestrictionRules.Builder {
+    ctor public CarrierRestrictionRules.Builder();
     method @NonNull public android.telephony.CarrierRestrictionRules build();
     method @NonNull public android.telephony.CarrierRestrictionRules.Builder setAllCarriersAllowed();
     method @NonNull public android.telephony.CarrierRestrictionRules.Builder setAllowedCarriers(@NonNull java.util.List<android.service.carrier.CarrierIdentifier>);
diff --git a/api/test-current.txt b/api/test-current.txt
index ac44dca..6fb4a92 100644
--- a/api/test-current.txt
+++ b/api/test-current.txt
@@ -1124,13 +1124,6 @@
     method public android.media.BufferingParams.Builder setResumePlaybackMarkMs(int);
   }
 
-  public class FileDataSourceDesc extends android.media.DataSourceDesc {
-    method public long getLength();
-    method public long getOffset();
-    method @NonNull public android.os.ParcelFileDescriptor getParcelFileDescriptor();
-    field public static final long FD_LENGTH_UNKNOWN = 576460752303423487L; // 0x7ffffffffffffffL
-  }
-
   public static final class MediaCodecInfo.VideoCapabilities.PerformancePoint {
     ctor public MediaCodecInfo.VideoCapabilities.PerformancePoint(int, int, int, int, @NonNull android.util.Size);
     ctor public MediaCodecInfo.VideoCapabilities.PerformancePoint(@NonNull android.media.MediaCodecInfo.VideoCapabilities.PerformancePoint, @NonNull android.util.Size);
@@ -1139,28 +1132,11 @@
     method public int getMaxMacroBlocks();
   }
 
-  public class MediaPlayer2 implements android.media.AudioRouting java.lang.AutoCloseable {
-    method public android.media.MediaPlayer2.DrmInfo getDrmInfo(@NonNull android.media.DataSourceDesc);
-    method public android.media.MediaDrm.KeyRequest getDrmKeyRequest(@NonNull android.media.DataSourceDesc, @Nullable byte[], @Nullable byte[], @Nullable String, int, @Nullable java.util.Map<java.lang.String,java.lang.String>) throws android.media.MediaPlayer2.NoDrmSchemeException;
-    method public String getDrmPropertyString(@NonNull android.media.DataSourceDesc, @NonNull String) throws android.media.MediaPlayer2.NoDrmSchemeException;
-    method @NonNull public Object prepareDrm(@NonNull android.media.DataSourceDesc, @NonNull java.util.UUID);
-    method public byte[] provideDrmKeyResponse(@NonNull android.media.DataSourceDesc, @Nullable byte[], @NonNull byte[]) throws android.media.DeniedByServerException, android.media.MediaPlayer2.NoDrmSchemeException;
-    method public void releaseDrm(@NonNull android.media.DataSourceDesc) throws android.media.MediaPlayer2.NoDrmSchemeException;
-    method public void restoreDrmKeys(@NonNull android.media.DataSourceDesc, @NonNull byte[]) throws android.media.MediaPlayer2.NoDrmSchemeException;
-    method public void setDrmPropertyString(@NonNull android.media.DataSourceDesc, @NonNull String, @NonNull String) throws android.media.MediaPlayer2.NoDrmSchemeException;
-  }
-
   public final class PlaybackParams implements android.os.Parcelable {
     method public int getAudioStretchMode();
     method public android.media.PlaybackParams setAudioStretchMode(int);
   }
 
-  public class UriDataSourceDesc extends android.media.DataSourceDesc {
-    method @Nullable public java.util.List<java.net.HttpCookie> getCookies();
-    method @Nullable public java.util.Map<java.lang.String,java.lang.String> getHeaders();
-    method @NonNull public android.net.Uri getUri();
-  }
-
   public static final class VolumeShaper.Configuration.Builder {
     method @NonNull public android.media.VolumeShaper.Configuration.Builder setOptionFlags(int);
   }
diff --git a/cmds/statsd/src/atoms.proto b/cmds/statsd/src/atoms.proto
index d3aa56a..55d3fba 100644
--- a/cmds/statsd/src/atoms.proto
+++ b/cmds/statsd/src/atoms.proto
@@ -5585,6 +5585,7 @@
         SWIPE_LEFT = 13;
         SWIPE_RIGHT = 14;
         STACK_EXPANDED = 15;
+        FLYOUT = 16;
     }
     optional Action action = 6;
 
diff --git a/core/java/android/app/AppOpsManager.java b/core/java/android/app/AppOpsManager.java
index 15982a7..6f92244 100644
--- a/core/java/android/app/AppOpsManager.java
+++ b/core/java/android/app/AppOpsManager.java
@@ -38,7 +38,6 @@
 import android.os.Process;
 import android.os.RemoteCallback;
 import android.os.RemoteException;
-import android.os.SystemProperties;
 import android.os.UserManager;
 import android.util.ArrayMap;
 import android.util.LongSparseArray;
@@ -5209,7 +5208,6 @@
      * @hide
      */
     public int noteProxyOpNoThrow(int op, String proxiedPackageName, int proxiedUid) {
-        logOperationIfNeeded(op, mContext.getOpPackageName(), proxiedPackageName);
         try {
             return mService.noteProxyOperation(op, Process.myUid(), mContext.getOpPackageName(),
                     proxiedUid, proxiedPackageName);
@@ -5238,7 +5236,6 @@
      */
     @UnsupportedAppUsage
     public int noteOpNoThrow(int op, int uid, String packageName) {
-        logOperationIfNeeded(op, packageName, null);
         try {
             return mService.noteOperation(op, uid, packageName);
         } catch (RemoteException e) {
@@ -5346,7 +5343,6 @@
      * @hide
      */
     public int startOpNoThrow(int op, int uid, String packageName, boolean startIfModeDefault) {
-        logOperationIfNeeded(op, packageName, null);
         try {
             return mService.startOperation(getToken(mService), op, uid, packageName,
                     startIfModeDefault);
@@ -5363,7 +5359,6 @@
      * @hide
      */
     public void finishOp(int op, int uid, String packageName) {
-        logOperationIfNeeded(op, packageName, null);
         try {
             mService.finishOperation(getToken(mService), op, uid, packageName);
         } catch (RemoteException e) {
@@ -5703,45 +5698,4 @@
 
         return AppOpsManager.MODE_DEFAULT;
     }
-
-    private static void logOperationIfNeeded(int op, String callingPackage, String proxiedPackage) {
-        // Check if debug logging propety is enabled.
-        if (!SystemProperties.getBoolean(DEBUG_LOGGING_ENABLE_PROP, false)) {
-            return;
-        }
-        // Check if this package should be logged.
-        String packages = SystemProperties.get(DEBUG_LOGGING_PACKAGES_PROP, "");
-        if (!"".equals(packages) && callingPackage != null) {
-            boolean found = false;
-            for (String pkg : packages.split(",")) {
-                if (callingPackage.equals(pkg)) {
-                    found = true;
-                    break;
-                }
-            }
-            if (!found) {
-                return;
-            }
-        }
-        String opStr = opToName(op);
-        // Check if this app op should be logged
-        String logOps = SystemProperties.get(DEBUG_LOGGING_OPS_PROP, "");
-        if (!"".equals(logOps)) {
-            boolean found = false;
-            for (String logOp : logOps.split(",")) {
-                if (opStr.equals(logOp)) {
-                    found = true;
-                    break;
-                }
-            }
-            if (!found) {
-                return;
-            }
-        }
-
-        // Log a stack trace
-        Exception here = new Exception("HERE!");
-        android.util.Log.i(DEBUG_LOGGING_TAG, "Note operation package= " + callingPackage
-                + " proxied= " + proxiedPackage + " op= " + opStr, here);
-    }
 }
diff --git a/core/java/android/app/StatsManager.java b/core/java/android/app/StatsManager.java
index 2e14d03..e6682d6 100644
--- a/core/java/android/app/StatsManager.java
+++ b/core/java/android/app/StatsManager.java
@@ -414,7 +414,6 @@
      * Returns the experiments IDs registered with statsd, or an empty array if there aren't any.
      *
      * @throws StatsUnavailableException if unsuccessful due to failing to connect to stats service
-     * @hide
      */
     @RequiresPermission(allOf = {DUMP, PACKAGE_USAGE_STATS})
     public long[] getRegisteredExperimentIds()
diff --git a/core/java/android/content/pm/PackageInstaller.java b/core/java/android/content/pm/PackageInstaller.java
index 6c72a9a..6ce6828 100644
--- a/core/java/android/content/pm/PackageInstaller.java
+++ b/core/java/android/content/pm/PackageInstaller.java
@@ -841,13 +841,12 @@
      * installation (for example, the same split name), the APK in this session
      * will replace the existing APK.
      * <p>
-     * In such a case that multiple packages need to be commited simultaneously,
+     * In such a case that multiple packages need to be committed simultaneously,
      * multiple sessions can be referenced by a single multi-package session.
      * This session is created with no package name and calling
-     * {@link SessionParams#setMultiPackage()} with {@code true}. The
-     * individual session IDs can be added with {@link #addChildSessionId(int)}
-     * and commit of the multi-package session will result in all child sessions
-     * being committed atomically.
+     * {@link SessionParams#setMultiPackage()}. The individual session IDs can be
+     * added with {@link #addChildSessionId(int)} and commit of the multi-package
+     * session will result in all child sessions being committed atomically.
      */
     public static class Session implements Closeable {
         /** {@hide} */
diff --git a/core/java/android/hardware/face/FaceManager.java b/core/java/android/hardware/face/FaceManager.java
index 6035f40..7349f0c 100644
--- a/core/java/android/hardware/face/FaceManager.java
+++ b/core/java/android/hardware/face/FaceManager.java
@@ -93,8 +93,8 @@
         }
 
         @Override // binder call
-        public void onAuthenticationSucceeded(long deviceId, Face face) {
-            mHandler.obtainMessage(MSG_AUTHENTICATION_SUCCEEDED, face).sendToTarget();
+        public void onAuthenticationSucceeded(long deviceId, Face face, int userId) {
+            mHandler.obtainMessage(MSG_AUTHENTICATION_SUCCEEDED, userId, 0, face).sendToTarget();
         }
 
         @Override // binder call
@@ -168,6 +168,44 @@
     @RequiresPermission(USE_BIOMETRIC_INTERNAL)
     public void authenticate(@Nullable CryptoObject crypto, @Nullable CancellationSignal cancel,
             int flags, @NonNull AuthenticationCallback callback, @Nullable Handler handler) {
+        authenticate(crypto, cancel, flags, callback, handler, mContext.getUserId());
+    }
+
+    /**
+     * Use the provided handler thread for events.
+     */
+    private void useHandler(Handler handler) {
+        if (handler != null) {
+            mHandler = new MyHandler(handler.getLooper());
+        } else if (mHandler.getLooper() != mContext.getMainLooper()) {
+            mHandler = new MyHandler(mContext.getMainLooper());
+        }
+    }
+
+    /**
+     * Request authentication of a crypto object. This call operates the face recognition hardware
+     * and starts capturing images. It terminates when
+     * {@link AuthenticationCallback#onAuthenticationError(int, CharSequence)} or
+     * {@link AuthenticationCallback#onAuthenticationSucceeded(AuthenticationResult)} is called, at
+     * which point the object is no longer valid. The operation can be canceled by using the
+     * provided cancel object.
+     *
+     * @param crypto   object associated with the call or null if none required.
+     * @param cancel   an object that can be used to cancel authentication
+     * @param flags    optional flags; should be 0
+     * @param callback an object to receive authentication events
+     * @param handler  an optional handler to handle callback events
+     * @param userId   userId to authenticate for
+     * @throws IllegalArgumentException if the crypto operation is not supported or is not backed
+     *                                  by
+     *                                  <a href="{@docRoot}training/articles/keystore.html">Android
+     *                                  Keystore facility</a>.
+     * @throws IllegalStateException    if the crypto primitive is not initialized.
+     * @hide
+     */
+    public void authenticate(@Nullable CryptoObject crypto, @Nullable CancellationSignal cancel,
+            int flags, @NonNull AuthenticationCallback callback, @Nullable Handler handler,
+            int userId) {
         if (callback == null) {
             throw new IllegalArgumentException("Must supply an authentication callback");
         }
@@ -187,7 +225,7 @@
                 mAuthenticationCallback = callback;
                 mCryptoObject = crypto;
                 long sessionId = crypto != null ? crypto.getOpId() : 0;
-                mService.authenticate(mToken, sessionId, mContext.getUserId(), mServiceReceiver,
+                mService.authenticate(mToken, sessionId, userId, mServiceReceiver,
                         flags, mContext.getOpPackageName());
             } catch (RemoteException e) {
                 Log.w(TAG, "Remote exception while authenticating: ", e);
@@ -196,24 +234,13 @@
                     // try again later.
                     callback.onAuthenticationError(FACE_ERROR_HW_UNAVAILABLE,
                             getErrorString(mContext, FACE_ERROR_HW_UNAVAILABLE,
-                                0 /* vendorCode */));
+                                    0 /* vendorCode */));
                 }
             }
         }
     }
 
     /**
-     * Use the provided handler thread for events.
-     */
-    private void useHandler(Handler handler) {
-        if (handler != null) {
-            mHandler = new MyHandler(handler.getLooper());
-        } else if (mHandler.getLooper() != mContext.getMainLooper()) {
-            mHandler = new MyHandler(mContext.getMainLooper());
-        }
-    }
-
-    /**
      * Request face authentication enrollment. This call operates the face authentication hardware
      * and starts capturing images. Progress will be indicated by callbacks to the
      * {@link EnrollmentCallback} object. It terminates when
diff --git a/core/java/android/hardware/face/IFaceServiceReceiver.aidl b/core/java/android/hardware/face/IFaceServiceReceiver.aidl
index 2176902..10f9c43 100644
--- a/core/java/android/hardware/face/IFaceServiceReceiver.aidl
+++ b/core/java/android/hardware/face/IFaceServiceReceiver.aidl
@@ -24,7 +24,7 @@
 oneway interface IFaceServiceReceiver {
     void onEnrollResult(long deviceId, int faceId, int remaining);
     void onAcquired(long deviceId, int acquiredInfo, int vendorCode);
-    void onAuthenticationSucceeded(long deviceId, in Face face);
+    void onAuthenticationSucceeded(long deviceId, in Face face, int userId);
     void onAuthenticationFailed(long deviceId);
     void onError(long deviceId, int error, int vendorCode);
     void onRemoved(long deviceId, int faceId, int remaining);
diff --git a/core/java/android/provider/MediaStore.java b/core/java/android/provider/MediaStore.java
index da19d59..7ed8e24 100644
--- a/core/java/android/provider/MediaStore.java
+++ b/core/java/android/provider/MediaStore.java
@@ -968,6 +968,13 @@
         public static final String DATE_MODIFIED = "date_modified";
 
         /**
+         * The time the media item was taken.
+         */
+        @CurrentTimeMillisLong
+        @Column(value = Cursor.FIELD_TYPE_INTEGER, readOnly = true)
+        public static final String DATE_TAKEN = "datetaken";
+
+        /**
          * The MIME type of the media item.
          * <p>
          * This is typically defined based on the file extension of the media
@@ -1117,6 +1124,38 @@
         public static final String SECONDARY_DIRECTORY = "secondary_directory";
 
         /**
+         * The primary bucket ID of this media item. This can be useful to
+         * present the user a first-level clustering of related media items.
+         * This is a read-only column that is automatically computed.
+         */
+        @Column(value = Cursor.FIELD_TYPE_INTEGER, readOnly = true)
+        public static final String BUCKET_ID = "bucket_id";
+
+        /**
+         * The primary bucket display name of this media item. This can be
+         * useful to present the user a first-level clustering of related
+         * media items. This is a read-only column that is automatically
+         * computed.
+         */
+        @Column(value = Cursor.FIELD_TYPE_STRING, readOnly = true)
+        public static final String BUCKET_DISPLAY_NAME = "bucket_display_name";
+
+        /**
+         * The group ID of this media item. This can be useful to present
+         * the user a grouping of related media items, such a burst of
+         * images, or a {@code JPG} and {@code DNG} version of the same
+         * image.
+         * <p>
+         * This is a read-only column that is automatically computed based
+         * on the first portion of the filename. For example,
+         * {@code IMG1024.BURST001.JPG} and {@code IMG1024.BURST002.JPG}
+         * will have the same {@link #GROUP_ID} because the first portion of
+         * their filenames is identical.
+         */
+        @Column(value = Cursor.FIELD_TYPE_INTEGER, readOnly = true)
+        public static final String GROUP_ID = "group_id";
+
+        /**
          * The "document ID" GUID as defined by the <em>XMP Media
          * Management</em> standard, extracted from any XMP metadata contained
          * within this media item. The value is {@code null} when no metadata
@@ -1152,6 +1191,20 @@
          */
         @Column(value = Cursor.FIELD_TYPE_STRING, readOnly = true)
         public static final String ORIGINAL_DOCUMENT_ID = "original_document_id";
+
+        /**
+         * The duration of the media item.
+         */
+        @DurationMillisLong
+        @Column(value = Cursor.FIELD_TYPE_INTEGER, readOnly = true)
+        public static final String DURATION = "duration";
+
+        /**
+         * The orientation for the media item, expressed in degrees. For
+         * example, 0, 90, 180, or 270 degrees.
+         */
+        @Column(value = Cursor.FIELD_TYPE_INTEGER, readOnly = true)
+        public static final String ORIENTATION = "orientation";
     }
 
     /**
@@ -1573,18 +1626,9 @@
             @Column(value = Cursor.FIELD_TYPE_FLOAT, readOnly = true)
             public static final String LONGITUDE = "longitude";
 
-            /**
-             * The time the media item was taken.
-             */
-            @CurrentTimeMillisLong
-            @Column(value = Cursor.FIELD_TYPE_INTEGER, readOnly = true)
+            /** @removed promoted to parent interface */
             public static final String DATE_TAKEN = "datetaken";
-
-            /**
-             * The orientation for the image expressed as degrees.
-             * Only degrees 0, 90, 180, 270 will work.
-             */
-            @Column(value = Cursor.FIELD_TYPE_INTEGER, readOnly = true)
+            /** @removed promoted to parent interface */
             public static final String ORIENTATION = "orientation";
 
             /**
@@ -1598,36 +1642,11 @@
             @Column(Cursor.FIELD_TYPE_INTEGER)
             public static final String MINI_THUMB_MAGIC = "mini_thumb_magic";
 
-            /**
-             * The primary bucket ID of this media item. This can be useful to
-             * present the user a first-level clustering of related media items.
-             * This is a read-only column that is automatically computed.
-             */
-            @Column(value = Cursor.FIELD_TYPE_INTEGER, readOnly = true)
+            /** @removed promoted to parent interface */
             public static final String BUCKET_ID = "bucket_id";
-
-            /**
-             * The primary bucket display name of this media item. This can be
-             * useful to present the user a first-level clustering of related
-             * media items. This is a read-only column that is automatically
-             * computed.
-             */
-            @Column(value = Cursor.FIELD_TYPE_STRING, readOnly = true)
+            /** @removed promoted to parent interface */
             public static final String BUCKET_DISPLAY_NAME = "bucket_display_name";
-
-            /**
-             * The group ID of this media item. This can be useful to present
-             * the user a grouping of related media items, such a burst of
-             * images, or a {@code JPG} and {@code DNG} version of the same
-             * image.
-             * <p>
-             * This is a read-only column that is automatically computed based
-             * on the first portion of the filename. For example,
-             * {@code IMG1024.BURST001.JPG} and {@code IMG1024.BURST002.JPG}
-             * will have the same {@link #GROUP_ID} because the first portion of
-             * their filenames is identical.
-             */
-            @Column(value = Cursor.FIELD_TYPE_INTEGER, readOnly = true)
+            /** @removed promoted to parent interface */
             public static final String GROUP_ID = "group_id";
         }
 
@@ -2048,11 +2067,7 @@
             @Column(value = Cursor.FIELD_TYPE_STRING, readOnly = true)
             public static final String TITLE_KEY = "title_key";
 
-            /**
-             * The duration of the audio item.
-             */
-            @DurationMillisLong
-            @Column(value = Cursor.FIELD_TYPE_INTEGER, readOnly = true)
+            /** @removed promoted to parent interface */
             public static final String DURATION = "duration";
 
             /**
@@ -2885,12 +2900,7 @@
          * Video metadata columns.
          */
         public interface VideoColumns extends MediaColumns {
-
-            /**
-             * The duration of the video item.
-             */
-            @DurationMillisLong
-            @Column(value = Cursor.FIELD_TYPE_INTEGER, readOnly = true)
+            /** @removed promoted to parent interface */
             public static final String DURATION = "duration";
 
             /**
@@ -2965,11 +2975,7 @@
             @Column(value = Cursor.FIELD_TYPE_FLOAT, readOnly = true)
             public static final String LONGITUDE = "longitude";
 
-            /**
-             * The time the media item was taken.
-             */
-            @CurrentTimeMillisLong
-            @Column(value = Cursor.FIELD_TYPE_INTEGER, readOnly = true)
+            /** @removed promoted to parent interface */
             public static final String DATE_TAKEN = "datetaken";
 
             /**
@@ -2983,36 +2989,11 @@
             @Column(Cursor.FIELD_TYPE_INTEGER)
             public static final String MINI_THUMB_MAGIC = "mini_thumb_magic";
 
-            /**
-             * The primary bucket ID of this media item. This can be useful to
-             * present the user a first-level clustering of related media items.
-             * This is a read-only column that is automatically computed.
-             */
-            @Column(value = Cursor.FIELD_TYPE_INTEGER, readOnly = true)
+            /** @removed promoted to parent interface */
             public static final String BUCKET_ID = "bucket_id";
-
-            /**
-             * The primary bucket display name of this media item. This can be
-             * useful to present the user a first-level clustering of related
-             * media items. This is a read-only column that is automatically
-             * computed.
-             */
-            @Column(value = Cursor.FIELD_TYPE_STRING, readOnly = true)
+            /** @removed promoted to parent interface */
             public static final String BUCKET_DISPLAY_NAME = "bucket_display_name";
-
-            /**
-             * The group ID of this media item. This can be useful to present
-             * the user a grouping of related media items, such a burst of
-             * images, or a {@code JPG} and {@code DNG} version of the same
-             * image.
-             * <p>
-             * This is a read-only column that is automatically computed based
-             * on the first portion of the filename. For example,
-             * {@code IMG1024.BURST001.JPG} and {@code IMG1024.BURST002.JPG}
-             * will have the same {@link #GROUP_ID} because the first portion of
-             * their filenames is identical.
-             */
-            @Column(value = Cursor.FIELD_TYPE_INTEGER, readOnly = true)
+            /** @removed promoted to parent interface */
             public static final String GROUP_ID = "group_id";
 
             /**
diff --git a/core/java/android/view/InputMonitor.java b/core/java/android/view/InputMonitor.java
index 693f287..bbd27dc 100644
--- a/core/java/android/view/InputMonitor.java
+++ b/core/java/android/view/InputMonitor.java
@@ -22,6 +22,13 @@
 import android.os.RemoteException;
 
 /**
+ * An {@code InputMonitor} allows privileged applications and components to monitor streams of
+ * {@link InputEvent}s without having to be the designated recipient for the event.
+ *
+ * For example, focus dispatched events would normally only go to the focused window on the
+ * targeted display, but an {@code InputMonitor} will also receive a copy of that event if they're
+ * registered to monitor that type of event on the targeted display.
+ *
  * @hide
  */
 public final class InputMonitor implements Parcelable {
diff --git a/core/java/com/android/internal/app/ChooserActivity.java b/core/java/com/android/internal/app/ChooserActivity.java
index bfdbf4c..4d4fe03 100644
--- a/core/java/com/android/internal/app/ChooserActivity.java
+++ b/core/java/com/android/internal/app/ChooserActivity.java
@@ -1427,11 +1427,9 @@
     }
 
     private void updateAlphabeticalList() {
-        if (getDisplayList().size() > MAX_RANKED_TARGETS) {
-            mSortedList.clear();
-            mSortedList.addAll(getDisplayList());
-            Collections.sort(mSortedList, new AzInfoComparator(ChooserActivity.this));
-        }
+        mSortedList.clear();
+        mSortedList.addAll(getDisplayList());
+        Collections.sort(mSortedList, new AzInfoComparator(ChooserActivity.this));
     }
 
     /**
@@ -2047,12 +2045,13 @@
         @Override
         public int getUnfilteredCount() {
             int appTargets = super.getUnfilteredCount();
-            if (appTargets > MAX_RANKED_TARGETS) {
-                appTargets = appTargets + MAX_RANKED_TARGETS;
+            if (appTargets > getMaxRankedTargets()) {
+                appTargets = appTargets + getMaxRankedTargets();
             }
             return appTargets + getSelectableServiceTargetCount() + getCallerTargetCount();
         }
 
+
         public int getCallerTargetCount() {
             return Math.min(mCallerTargets.size(), MAX_SUGGESTED_APP_TARGETS);
         }
@@ -2080,14 +2079,17 @@
 
         int getAlphaTargetCount() {
             int standardCount = super.getCount();
-            return standardCount > MAX_RANKED_TARGETS ? standardCount : 0;
+            return standardCount > getMaxRankedTargets() ? standardCount : 0;
         }
 
         int getRankedTargetCount() {
-            int spacesAvailable = MAX_RANKED_TARGETS - getCallerTargetCount();
+            int spacesAvailable = getMaxRankedTargets() - getCallerTargetCount();
             return Math.min(spacesAvailable, super.getCount());
         }
 
+        private int getMaxRankedTargets() {
+            return mChooserRowAdapter == null ? 4 : mChooserRowAdapter.getMaxTargetsPerRow();
+        }
 
         public int getPositionTargetType(int position) {
             int offset = 0;
diff --git a/core/java/com/android/internal/app/SimpleIconFactory.java b/core/java/com/android/internal/app/SimpleIconFactory.java
index a85485d..2484109 100644
--- a/core/java/com/android/internal/app/SimpleIconFactory.java
+++ b/core/java/com/android/internal/app/SimpleIconFactory.java
@@ -34,6 +34,8 @@
 import android.graphics.Color;
 import android.graphics.Paint;
 import android.graphics.PaintFlagsDrawFilter;
+import android.graphics.PorterDuff;
+import android.graphics.PorterDuffXfermode;
 import android.graphics.Rect;
 import android.graphics.RectF;
 import android.graphics.drawable.AdaptiveIconDrawable;
@@ -56,7 +58,7 @@
 /**
  * @deprecated Use the Launcher3 Iconloaderlib at packages/apps/Launcher3/iconloaderlib. This class
  * is a temporary fork of Iconloader. It combines all necessary methods to render app icons that are
- * possibly badged. It is intended to be used only by Sharesheet for the Q release.
+ * possibly badged. It is intended to be used only by Sharesheet for the Q release with custom code.
  */
 @Deprecated
 public class SimpleIconFactory {
@@ -202,6 +204,7 @@
     /**
      * Creates bitmap using the source drawable and flattened pre-rendered app icon.
      * The bitmap is visually normalized with other icons and has enough spacing to add shadow.
+     * This is custom functionality added to Iconloaderlib that will need to be ported.
      *
      * @param icon                      source of the icon associated with a user that has no badge
      * @param renderedAppIcon           pre-rendered app icon to use as a badge, likely the output
@@ -212,34 +215,70 @@
      */
     @Deprecated
     Bitmap createAppBadgedIconBitmap(@Nullable Drawable icon, Bitmap renderedAppIcon) {
-        // Flatten the passed in icon
-        float [] scale = new float[1];
-
         // If no icon is provided use the system default
         if (icon == null) {
             icon = getFullResDefaultActivityIcon(mFillResIconDpi);
         }
-        icon = normalizeAndWrapToAdaptiveIcon(icon, null, scale);
-        Bitmap bitmap = createIconBitmap(icon, scale[0]);
-        if (icon instanceof AdaptiveIconDrawable) {
-            mCanvas.setBitmap(bitmap);
-            recreateIcon(Bitmap.createBitmap(bitmap), mCanvas);
-            mCanvas.setBitmap(null);
+
+        // Direct share icons cannot be adaptive, most will arrive as bitmaps. To get reliable
+        // presentation, force all DS icons to be circular. Scale DS image so it completely fills.
+        int w = icon.getIntrinsicWidth();
+        int h = icon.getIntrinsicHeight();
+        float scale = 1;
+        if (h > w && w > 0) {
+            scale = (float) h / w;
+        } else if (w > h && h > 0) {
+            scale = (float) w / h;
+        }
+        Bitmap bitmap = createIconBitmap(icon, scale);
+        bitmap = maskBitmapToCircle(bitmap);
+        icon = new BitmapDrawable(mContext.getResources(), bitmap);
+
+        // We now have a circular masked and scaled icon, inset and apply shadow
+        scale = getScale(icon, null);
+        bitmap = createIconBitmap(icon, scale);
+
+        mCanvas.setBitmap(bitmap);
+        recreateIcon(Bitmap.createBitmap(bitmap), mCanvas);
+
+        if (renderedAppIcon != null) {
+            // Now scale down and apply the badge to the bottom right corner of the flattened icon
+            renderedAppIcon = Bitmap.createScaledBitmap(renderedAppIcon, mBadgeBitmapSize,
+                    mBadgeBitmapSize, false);
+
+            // Paint the provided badge on top of the flattened icon
+            mCanvas.drawBitmap(renderedAppIcon, mIconBitmapSize - mBadgeBitmapSize,
+                    mIconBitmapSize - mBadgeBitmapSize, null);
         }
 
-        // Now scale down and apply the badge to the bottom right corner of the flattened icon
-        renderedAppIcon = Bitmap.createScaledBitmap(renderedAppIcon, mBadgeBitmapSize,
-                mBadgeBitmapSize, false);
-
-        // Paint the provided badge on top of the flattened icon
-        mCanvas.setBitmap(bitmap);
-        mCanvas.drawBitmap(renderedAppIcon, mIconBitmapSize - mBadgeBitmapSize,
-                mIconBitmapSize - mBadgeBitmapSize, null);
         mCanvas.setBitmap(null);
 
         return bitmap;
     }
 
+    private Bitmap maskBitmapToCircle(Bitmap bitmap) {
+        final Bitmap output = Bitmap.createBitmap(bitmap.getWidth(),
+                bitmap.getHeight(), Bitmap.Config.ARGB_8888);
+        final Canvas canvas = new Canvas(output);
+        final Paint paint = new Paint();
+        paint.setAntiAlias(true);
+
+        // Draw mask
+        paint.setColor(0xffffffff);
+        canvas.drawARGB(0, 0, 0, 0);
+        canvas.drawCircle(bitmap.getWidth() / 2f,
+                bitmap.getHeight() / 2f,
+                bitmap.getWidth() / 2f - 1 /* -1 to avoid circles with flat sides */,
+                paint);
+
+        // Draw masked bitmap
+        paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
+        final Rect rect = new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight());
+        canvas.drawBitmap(bitmap, rect, rect, paint);
+
+        return output;
+    }
+
     private static Drawable getFullResDefaultActivityIcon(int iconDpi) {
         return Resources.getSystem().getDrawableForDensity(android.R.mipmap.sym_def_app_icon,
                 iconDpi);
diff --git a/core/java/com/android/internal/os/Zygote.java b/core/java/com/android/internal/os/Zygote.java
index afdeb1b..a295bd2 100644
--- a/core/java/com/android/internal/os/Zygote.java
+++ b/core/java/com/android/internal/os/Zygote.java
@@ -566,7 +566,18 @@
             System.exit(-1);
         } finally {
             IoUtils.closeQuietly(sessionSocket);
-            IoUtils.closeQuietly(usapPoolSocket);
+
+            try {
+                // This socket is closed using Os.close due to an issue with the implementation of
+                // LocalSocketImp.close.  Because the raw FD is created by init and then loaded from
+                // an environment variable (as opposed to being created by the LocalSocketImpl
+                // itself) the current implementation will not actually close the underlying FD.
+                //
+                // See b/130309968 for discussion of this issue.
+                Os.close(usapPoolSocket.getFileDescriptor());
+            } catch (ErrnoException ex) {
+                Log.e("USAP", "Failed to close USAP pool socket: " + ex.getMessage());
+            }
         }
 
         try {
diff --git a/core/res/res/layout/chooser_grid_preview_text.xml b/core/res/res/layout/chooser_grid_preview_text.xml
index 4528700..3c9ffdb 100644
--- a/core/res/res/layout/chooser_grid_preview_text.xml
+++ b/core/res/res/layout/chooser_grid_preview_text.xml
@@ -54,6 +54,7 @@
         android:layout_gravity="center_vertical"
         android:src="@drawable/ic_content_copy_gm2"
         android:clickable="true"
+        android:contentDescription="@string/copy"
         android:background="?attr/selectableItemBackgroundBorderless"/>
   </LinearLayout>
 
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index f27f34a..edcc057 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -745,6 +745,10 @@
 
     <!-- XXXXXX END OF RESOURCES USING WRONG NAMING CONVENTION -->
 
+    <!-- If this is true, notification effects will be played by the notification server.
+         When false, car notification effects will be handled elsewhere. -->
+    <bool name="config_enableServerNotificationEffectsForAutomotive">false</bool>
+
     <!-- If this is true, the screen will come on when you unplug usb/power/whatever. -->
     <bool name="config_unplugTurnsOnScreen">false</bool>
 
@@ -1971,10 +1975,6 @@
     <bool name="config_showDefaultEmergency">false</bool>
     <!-- Whether the default home settings should be shown. -->
     <bool name="config_showDefaultHome">true</bool>
-    <!-- The name of the package that will hold the music role by default. -->
-    <string name="config_defaultMusic" translatable="false">com.android.music</string>
-    <!-- The name of the package that will hold the gallery role by default. -->
-    <string name="config_defaultGallery" translatable="false">com.android.gallery3d</string>
 
     <!-- Enable/disable default bluetooth profiles:
         HSP_AG, ObexObjectPush, Audio, NAP -->
diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml
index 626518c..0bcd39f 100644
--- a/core/res/res/values/public.xml
+++ b/core/res/res/values/public.xml
@@ -2987,10 +2987,6 @@
       <public name="config_defaultDialer" />
       <!-- @hide @SystemApi -->
       <public name="config_defaultSms" />
-      <!-- @hide @SystemApi -->
-      <public name="config_defaultMusic" />
-      <!-- @hide @SystemApi -->
-      <public name="config_defaultGallery" />
     </public-group>
 
     <public-group type="bool" first-id="0x01110000">
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 94b5da6..da2f890 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -1910,6 +1910,7 @@
   <java-symbol type="array" name="config_testLocationProviders" />
   <java-symbol type="array" name="config_defaultNotificationVibePattern" />
   <java-symbol type="array" name="config_notificationFallbackVibePattern" />
+  <java-symbol type="bool" name="config_enableServerNotificationEffectsForAutomotive" />
   <java-symbol type="bool" name="config_useAttentionLight" />
   <java-symbol type="bool" name="config_adaptive_sleep_available" />
   <java-symbol type="bool" name="config_animateScreenLights" />
diff --git a/core/tests/overlaytests/host/src/com/android/server/om/hosttest/InstallOverlayTests.java b/core/tests/overlaytests/host/src/com/android/server/om/hosttest/InstallOverlayTests.java
index 99b6421..267cb36 100644
--- a/core/tests/overlaytests/host/src/com/android/server/om/hosttest/InstallOverlayTests.java
+++ b/core/tests/overlaytests/host/src/com/android/server/om/hosttest/InstallOverlayTests.java
@@ -163,6 +163,20 @@
         assertTrue(overlayManagerContainsPackage(APP_OVERLAY_PACKAGE_NAME));
     }
 
+    @Test
+    public void changesPersistedWhenUninstallingDisabledOverlay() throws Exception {
+        getDevice().enableAdbRoot();
+        assertFalse(getDevice().executeShellCommand("cat /data/system/overlays.xml")
+                .contains(APP_OVERLAY_PACKAGE_NAME));
+        installPackage("OverlayHostTests_AppOverlayV1.apk");
+        assertTrue(getDevice().executeShellCommand("cat /data/system/overlays.xml")
+                .contains(APP_OVERLAY_PACKAGE_NAME));
+        uninstallPackage(APP_OVERLAY_PACKAGE_NAME);
+        delay();
+        assertFalse(getDevice().executeShellCommand("cat /data/system/overlays.xml")
+                .contains(APP_OVERLAY_PACKAGE_NAME));
+    }
+
     private void delay() {
         try {
             Thread.sleep(1000);
diff --git a/location/java/android/location/GnssStatus.java b/location/java/android/location/GnssStatus.java
index ce464b7..211a0cb 100644
--- a/location/java/android/location/GnssStatus.java
+++ b/location/java/android/location/GnssStatus.java
@@ -17,6 +17,7 @@
 package android.location;
 
 import android.annotation.IntDef;
+import android.annotation.NonNull;
 
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
@@ -44,6 +45,8 @@
     public static final int CONSTELLATION_GALILEO = 6;
     /** Constellation type constant for IRNSS. */
     public static final int CONSTELLATION_IRNSS = 7;
+    /** @hide */
+    public static final int CONSTELLATION_COUNT = 8;
 
     /** @hide */
     public static final int GNSS_SV_FLAGS_NONE = 0;
@@ -251,4 +254,36 @@
     public float getCarrierFrequencyHz(int satIndex) {
         return mCarrierFrequencies[satIndex];
     }
+
+    /**
+     * Returns the string representation of a constellation type. For example,
+     * {@link #CONSTELLATION_GPS} is represented by the string GPS.
+     *
+     * @param constellationType the constellation type.
+     * @return the string representation.
+     * @hide
+     */
+    @NonNull
+    public static String constellationTypeToString(@ConstellationType int constellationType) {
+        switch (constellationType) {
+            case CONSTELLATION_UNKNOWN:
+                return "UNKNOWN";
+            case CONSTELLATION_GPS:
+                return "GPS";
+            case CONSTELLATION_SBAS:
+                return "SBAS";
+            case CONSTELLATION_GLONASS:
+                return "GLONASS";
+            case CONSTELLATION_QZSS:
+                return "QZSS";
+            case CONSTELLATION_BEIDOU:
+                return "BEIDOU";
+            case CONSTELLATION_GALILEO:
+                return "GALILEO";
+            case CONSTELLATION_IRNSS:
+                return "IRNSS";
+            default:
+                return Integer.toString(constellationType);
+        }
+    }
 }
diff --git a/location/java/com/android/internal/location/gnssmetrics/GnssMetrics.java b/location/java/com/android/internal/location/gnssmetrics/GnssMetrics.java
index 057a4ae..7823971 100644
--- a/location/java/com/android/internal/location/gnssmetrics/GnssMetrics.java
+++ b/location/java/com/android/internal/location/gnssmetrics/GnssMetrics.java
@@ -16,26 +16,26 @@
 
 package com.android.internal.location.gnssmetrics;
 
+import android.location.GnssStatus;
 import android.os.SystemClock;
-import android.os.connectivity.GpsBatteryStats;
 import android.os.SystemProperties;
-
+import android.os.connectivity.GpsBatteryStats;
 import android.server.location.ServerLocationProtoEnums;
-
 import android.text.format.DateUtils;
 import android.util.Base64;
 import android.util.Log;
 import android.util.StatsLog;
 import android.util.TimeUtils;
 
-import java.util.Arrays;
-
 import com.android.internal.app.IBatteryStats;
 import com.android.internal.location.nano.GnssLogsProto.GnssLog;
 import com.android.internal.location.nano.GnssLogsProto.PowerMetrics;
 
+import java.util.Arrays;
+
 /**
  * GnssMetrics: Is used for logging GNSS metrics
+ *
  * @hide
  */
 public class GnssMetrics {
@@ -66,6 +66,11 @@
   /* GNSS power metrics */
   private GnssPowerMetrics mGnssPowerMetrics;
 
+    /**
+     * A boolean array indicating whether the constellation types have been used in fix.
+     */
+    private boolean[] mConstellationTypes;
+
   /** Constructor */
   public GnssMetrics(IBatteryStats stats) {
     mGnssPowerMetrics = new GnssPowerMetrics(stats);
@@ -156,6 +161,18 @@
     return;
   }
 
+
+    /**
+     * Logs that a constellation type has been observed.
+     */
+    public void logConstellationType(int constellationType) {
+        if (constellationType >= mConstellationTypes.length) {
+            Log.e(TAG, "Constellation type " + constellationType + " is not valid.");
+            return;
+        }
+        mConstellationTypes[constellationType] = true;
+    }
+
   /**
    * Dumps GNSS metrics as a proto string
    * @return
@@ -232,6 +249,13 @@
       s.append("  Top 4 Avg CN0 standard deviation (dB-Hz): ").append(
           topFourAverageCn0Statistics.getStandardDeviation()).append("\n");
     }
+        s.append("  Used-in-fix constellation types: ");
+        for (int i = 0; i < mConstellationTypes.length; i++) {
+            if (mConstellationTypes[i]) {
+                s.append(GnssStatus.constellationTypeToString(i)).append(" ");
+            }
+        }
+        s.append("\n");
     s.append("GNSS_KPI_END").append("\n");
     GpsBatteryStats stats = mGnssPowerMetrics.getGpsBatteryStats();
     if (stats != null) {
@@ -320,9 +344,15 @@
     timeToFirstFixSecStatistics.reset();
     positionAccuracyMeterStatistics.reset();
     topFourAverageCn0Statistics.reset();
+        resetConstellationTypes();
     return;
   }
 
+    /** Resets {@link #mConstellationTypes} as an all-false boolean array. */
+    public void resetConstellationTypes() {
+        mConstellationTypes = new boolean[GnssStatus.CONSTELLATION_COUNT];
+    }
+
   /* Class for handling GNSS power related metrics */
   private class GnssPowerMetrics {
 
diff --git a/media/apex/java/android/media/DataSourceDesc.java b/media/apex/java/android/media/DataSourceDesc.java
index d00ff2a..9a9c74a 100644
--- a/media/apex/java/android/media/DataSourceDesc.java
+++ b/media/apex/java/android/media/DataSourceDesc.java
@@ -34,6 +34,8 @@
  *
  * Used by {@link MediaPlayer2#setDataSource}, {@link MediaPlayer2#setNextDataSource} and
  * {@link MediaPlayer2#setNextDataSources} to set data source for playback.
+ *
+ * @hide
  */
 public class DataSourceDesc {
     // intentionally less than long.MAX_VALUE
diff --git a/media/apex/java/android/media/FileDataSourceDesc.java b/media/apex/java/android/media/FileDataSourceDesc.java
index feb67e1..2aa2cb7 100644
--- a/media/apex/java/android/media/FileDataSourceDesc.java
+++ b/media/apex/java/android/media/FileDataSourceDesc.java
@@ -17,7 +17,6 @@
 package android.media;
 
 import android.annotation.NonNull;
-import android.annotation.TestApi;
 import android.os.ParcelFileDescriptor;
 import android.util.Log;
 
@@ -32,7 +31,6 @@
  * <p>Users should use {@link Builder} to create {@link FileDataSourceDesc}.
  * @hide
  */
-@TestApi
 public class FileDataSourceDesc extends DataSourceDesc {
     private static final String TAG = "FileDataSourceDesc";
 
diff --git a/media/apex/java/android/media/MediaPlayer2.java b/media/apex/java/android/media/MediaPlayer2.java
index 72c18f6..614d737 100644
--- a/media/apex/java/android/media/MediaPlayer2.java
+++ b/media/apex/java/android/media/MediaPlayer2.java
@@ -273,6 +273,8 @@
  * Then check the <code>status</code> parameter. The value {@link #CALL_STATUS_NO_ERROR} indicates a
  * successful transition. Any other value will be an error. Call {@link #getState()} to
  * determine the current state. </p>
+ *
+ * @hide
  */
 public class MediaPlayer2 implements AutoCloseable, AudioRouting {
     static {
diff --git a/media/apex/java/android/media/UriDataSourceDesc.java b/media/apex/java/android/media/UriDataSourceDesc.java
index eaedf1e..adf7a7d 100644
--- a/media/apex/java/android/media/UriDataSourceDesc.java
+++ b/media/apex/java/android/media/UriDataSourceDesc.java
@@ -18,7 +18,6 @@
 
 import android.annotation.NonNull;
 import android.annotation.Nullable;
-import android.annotation.TestApi;
 import android.net.Uri;
 
 import java.net.HttpCookie;
@@ -36,7 +35,6 @@
  * <p>Users should use {@link Builder} to change {@link UriDataSourceDesc}.
  * @hide
  */
-@TestApi
 public class UriDataSourceDesc extends DataSourceDesc {
     private Uri mUri;
     private Map<String, String> mHeader;
diff --git a/packages/PackageInstaller/TEST_MAPPING b/packages/PackageInstaller/TEST_MAPPING
new file mode 100644
index 0000000..42aa47c
--- /dev/null
+++ b/packages/PackageInstaller/TEST_MAPPING
@@ -0,0 +1,24 @@
+{
+  "presubmit": [
+    {
+      "name": "CtsPackageInstallTestCases",
+      "options": [
+        {
+          "exclude-annotation": "android.platform.test.annotations.AppModeInstant"
+        }
+      ]
+    },
+    {
+      "name": "CtsNoPermissionTestCases"
+    },
+    {
+      "name": "CtsNoPermissionTestCases25"
+    },
+    {
+      "name": "CtsPackageInstallerTapjackingTestCases"
+    },
+    {
+      "name": "CtsPackageUninstallTestCases"
+    }
+  ]
+}
\ No newline at end of file
diff --git a/packages/PackageInstaller/src/com/android/packageinstaller/InstallStart.java b/packages/PackageInstaller/src/com/android/packageinstaller/InstallStart.java
index f2de9ec..881f4b1 100644
--- a/packages/PackageInstaller/src/com/android/packageinstaller/InstallStart.java
+++ b/packages/PackageInstaller/src/com/android/packageinstaller/InstallStart.java
@@ -109,8 +109,8 @@
         } else {
             Uri packageUri = intent.getData();
 
-            if (packageUri != null && (packageUri.getScheme().equals(ContentResolver.SCHEME_FILE)
-                    || packageUri.getScheme().equals(ContentResolver.SCHEME_CONTENT))) {
+            if (packageUri != null && packageUri.getScheme().equals(
+                    ContentResolver.SCHEME_CONTENT)) {
                 // [IMPORTANT] This path is deprecated, but should still work. Only necessary
                 // features should be added.
 
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
index fa39ccd..fd55708 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
@@ -1665,7 +1665,7 @@
             }
             mFaceCancelSignal = new CancellationSignal();
             mFaceManager.authenticate(null, mFaceCancelSignal, 0,
-                    mFaceAuthenticationCallback, null);
+                    mFaceAuthenticationCallback, null, userId);
             setFaceRunningState(BIOMETRIC_STATE_RUNNING);
         }
     }
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java
index 686edad..424cd55 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java
@@ -926,6 +926,7 @@
                 mFlyout.removeCallbacks(mHideFlyout);
                 mFlyout.postDelayed(mHideFlyout, FLYOUT_HIDE_AFTER);
             });
+            logBubbleEvent(bubble, StatsLog.BUBBLE_UICHANGED__ACTION__FLYOUT);
         }
     }
 
@@ -1097,7 +1098,8 @@
      * @param action the user interaction enum.
      */
     private void logBubbleEvent(@Nullable Bubble bubble, int action) {
-        if (bubble == null) {
+        if (bubble == null || bubble.entry == null
+                || bubble.entry.notification == null) {
             StatsLog.write(StatsLog.BUBBLE_UI_CHANGED,
                     null /* package name */,
                     null /* notification channel */,
diff --git a/packages/SystemUI/src/com/android/systemui/glwallpaper/ImageGLWallpaper.java b/packages/SystemUI/src/com/android/systemui/glwallpaper/ImageGLWallpaper.java
index 21406e5..d935466 100644
--- a/packages/SystemUI/src/com/android/systemui/glwallpaper/ImageGLWallpaper.java
+++ b/packages/SystemUI/src/com/android/systemui/glwallpaper/ImageGLWallpaper.java
@@ -34,7 +34,6 @@
 
 import android.graphics.Bitmap;
 import android.opengl.GLUtils;
-import android.os.Build;
 import android.util.Log;
 
 import java.nio.ByteBuffer;
@@ -196,58 +195,76 @@
         glUniform1i(mUniTexture, 0);
     }
 
+    /**
+     * This method adjust s(x-axis), t(y-axis) texture coordinates
+     * to prevent the wallpaper from being stretched.
+     * The adjustment happens if either the width or height of the bitmap is larger than
+     * corresponding size of the surface.
+     * If both width and height are larger than corresponding size of the surface,
+     * the adjustment will happen at both s, t side.
+     *
+     * @param bitmapWidth The width of the bitmap.
+     * @param bitmapHeight The height of the bitmap.
+     * @param surfaceWidth The width of the surface.
+     * @param surfaceHeight The height of the surface.
+     * @param xOffset The offset amount along s axis.
+     * @param yOffset The offset amount along t axis.
+     */
     void adjustTextureCoordinates(int bitmapWidth, int bitmapHeight,
             int surfaceWidth, int surfaceHeight, float xOffset, float yOffset) {
-        float ratioW = 1f;
-        float ratioH = 1f;
-        float rX = 0f;
-        float rY = 0f;
-        float[] coordinates = null;
+        float[] coordinates = TEXTURES.clone();
 
-        final boolean adjustWidth = bitmapWidth > surfaceWidth;
-        final boolean adjustHeight = bitmapHeight > surfaceHeight;
-
-        if (adjustWidth || adjustHeight) {
-            coordinates = TEXTURES.clone();
-        }
-
-        if (adjustWidth) {
-            float x = (float) Math.round((bitmapWidth - surfaceWidth) * xOffset) / bitmapWidth;
-            ratioW = (float) surfaceWidth / bitmapWidth;
-            float referenceX = x + ratioW > 1f ? 1f - ratioW : x;
+        if (bitmapWidth > surfaceWidth) {
+            // Calculate the new s pos in pixels.
+            float pixelS = (float) Math.round((bitmapWidth - surfaceWidth) * xOffset);
+            // Calculate the s pos in texture coordinate.
+            float coordinateS = pixelS / bitmapWidth;
+            // Calculate the percentage occupied by the surface width in bitmap width.
+            float surfacePercentageW = (float) surfaceWidth / bitmapWidth;
+            // Need also consider the case if bitmap height is smaller than surface height.
+            if (bitmapHeight < surfaceHeight) {
+                // We will narrow the surface percentage to keep aspect ratio.
+                surfacePercentageW *= (float) bitmapHeight / surfaceHeight;
+            }
+            // Determine the final s pos, also limit the legal s pos to prevent from out of range.
+            float s = coordinateS + surfacePercentageW > 1f ? 1f - surfacePercentageW : coordinateS;
+            // Traverse the s pos in texture coordinates array and adjust the s pos accordingly.
             for (int i = 0; i < coordinates.length; i += 2) {
+                // indices 2, 4 and 6 are the end of s coordinates.
                 if (i == 2 || i == 4 || i == 6) {
-                    coordinates[i] = Math.min(1f, referenceX + ratioW);
+                    coordinates[i] = Math.min(1f, s + surfacePercentageW);
                 } else {
-                    coordinates[i] = referenceX;
+                    coordinates[i] = s;
                 }
             }
-            rX = referenceX;
         }
 
-
-        if (adjustHeight) {
-            float y = (float) Math.round((bitmapHeight - surfaceHeight) * yOffset) / bitmapHeight;
-            ratioH = (float) surfaceHeight / bitmapHeight;
-            float referenceY = y + ratioH > 1f ? 1f - ratioH : y;
+        if (bitmapHeight > surfaceHeight) {
+            // Calculate the new t pos in pixels.
+            float pixelT = (float) Math.round((bitmapHeight - surfaceHeight) * yOffset);
+            // Calculate the t pos in texture coordinate.
+            float coordinateT = pixelT / bitmapHeight;
+            // Calculate the percentage occupied by the surface height in bitmap height.
+            float surfacePercentageH = (float) surfaceHeight / bitmapHeight;
+            // Need also consider the case if bitmap width is smaller than surface width.
+            if (bitmapWidth < surfaceWidth) {
+                // We will narrow the surface percentage to keep aspect ratio.
+                surfacePercentageH *= (float) bitmapWidth / surfaceWidth;
+            }
+            // Determine the final t pos, also limit the legal t pos to prevent from out of range.
+            float t = coordinateT + surfacePercentageH > 1f ? 1f - surfacePercentageH : coordinateT;
+            // Traverse the t pos in texture coordinates array and adjust the t pos accordingly.
             for (int i = 1; i < coordinates.length; i += 2) {
+                // indices 1, 3 and 11 are the end of t coordinates.
                 if (i == 1 || i == 3 || i == 11) {
-                    coordinates[i] = Math.min(1f, referenceY + ratioH);
+                    coordinates[i] = Math.min(1f, t + surfacePercentageH);
                 } else {
-                    coordinates[i] = referenceY;
+                    coordinates[i] = t;
                 }
             }
-            rY = referenceY;
         }
 
-        if (adjustWidth || adjustHeight) {
-            if (Build.IS_DEBUGGABLE) {
-                Log.d(TAG, "adjustTextureCoordinates: sW=" + surfaceWidth + ", sH=" + surfaceHeight
-                        + ", bW=" + bitmapWidth + ", bH=" + bitmapHeight
-                        + ", rW=" + ratioW + ", rH=" + ratioH + ", rX=" + rX + ", rY=" + rY);
-            }
-            mTextureBuffer.put(coordinates);
-            mTextureBuffer.position(0);
-        }
+        mTextureBuffer.put(coordinates);
+        mTextureBuffer.position(0);
     }
 }
diff --git a/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java b/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java
index 00aef9a..72559f5 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java
@@ -498,7 +498,7 @@
         mSysUiStateFlags = 0;
         mSysUiStateFlags |= ActivityManagerWrapper.getInstance().isScreenPinningActive()
                 ? SYSUI_STATE_SCREEN_PINNING : 0;
-        mSysUiStateFlags |= (navBarFragment == null || !navBarFragment.isNavBarWindowVisible())
+        mSysUiStateFlags |= (navBarFragment != null && !navBarFragment.isNavBarWindowVisible())
                 ? SYSUI_STATE_NAV_BAR_HIDDEN : 0;
         mSysUiStateFlags |= panelExpanded
                 ? SYSUI_STATE_NOTIFICATION_PANEL_EXPANDED : 0;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationMediaTemplateViewWrapper.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationMediaTemplateViewWrapper.java
index 99f5874..b54de5a 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationMediaTemplateViewWrapper.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationMediaTemplateViewWrapper.java
@@ -90,6 +90,8 @@
         @Override
         public void onPlaybackStateChanged(PlaybackState state) {
             if (state.getState() != PlaybackState.STATE_PLAYING) {
+                // Update the UI once, in case playback info changed while we were paused
+                mUpdatePlaybackUi.run();
                 clearTimer();
             } else if (mSeekBarTimer == null) {
                 startTimer();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
index 0e9264b..dd957b4 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
@@ -1709,7 +1709,8 @@
             min = Math.max(min, minHeight);
         }
         int maxHeight;
-        if (mQsExpandImmediate || mQsExpanded || mIsExpanding && mQsExpandedWhenExpandingStarted) {
+        if (mQsExpandImmediate || mQsExpanded || mIsExpanding && mQsExpandedWhenExpandingStarted
+                || mPulsing) {
             maxHeight = calculatePanelHeightQsExpanded();
         } else {
             maxHeight = calculatePanelHeightShade();
diff --git a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java
index ffe3ece..6bed43e 100644
--- a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java
+++ b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java
@@ -288,7 +288,7 @@
         mKeyguardUpdateMonitor.sendKeyguardBouncerChanged(true);
         mTestableLooper.processAllMessages();
 
-        verify(mFaceManager).authenticate(any(), any(), anyInt(), any(), any());
+        verify(mFaceManager).authenticate(any(), any(), anyInt(), any(), any(), anyInt());
         verify(mFaceManager).isHardwareDetected();
         verify(mFaceManager).hasEnrolledTemplates(anyInt());
     }
@@ -298,7 +298,7 @@
         mKeyguardUpdateMonitor.dispatchStartedWakingUp();
         mTestableLooper.processAllMessages();
         mKeyguardUpdateMonitor.onKeyguardVisibilityChanged(true);
-        verify(mFaceManager).authenticate(any(), any(), anyInt(), any(), any());
+        verify(mFaceManager).authenticate(any(), any(), anyInt(), any(), any(), anyInt());
     }
 
     @Test
@@ -317,7 +317,7 @@
         mKeyguardUpdateMonitor.setKeyguardOccluded(true);
         mKeyguardUpdateMonitor.setAssistantVisible(true);
 
-        verify(mFaceManager).authenticate(any(), any(), anyInt(), any(), any());
+        verify(mFaceManager).authenticate(any(), any(), anyInt(), any(), any(), anyInt());
     }
 
     @Test
diff --git a/services/core/java/com/android/server/DeviceIdleController.java b/services/core/java/com/android/server/DeviceIdleController.java
index 833faa6..52a4218 100644
--- a/services/core/java/com/android/server/DeviceIdleController.java
+++ b/services/core/java/com/android/server/DeviceIdleController.java
@@ -1399,8 +1399,8 @@
                 } break;
                 case MSG_TEMP_APP_WHITELIST_TIMEOUT: {
                     // TODO: What is keeping the device awake at this point? Does it need to be?
-                    int uid = msg.arg1;
-                    checkTempAppWhitelistTimeout(uid);
+                    int appId = msg.arg1;
+                    checkTempAppWhitelistTimeout(appId);
                 } break;
                 case MSG_REPORT_MAINTENANCE_ACTIVITY: {
                     // TODO: What is keeping the device awake at this point? Does it need to be?
@@ -1656,9 +1656,9 @@
         }
 
         // duration in milliseconds
-        public void addPowerSaveTempWhitelistAppDirect(int appId, long duration, boolean sync,
+        public void addPowerSaveTempWhitelistAppDirect(int uid, long duration, boolean sync,
                 String reason) {
-            addPowerSaveTempWhitelistAppDirectInternal(0, appId, duration, sync, reason);
+            addPowerSaveTempWhitelistAppDirectInternal(0, uid, duration, sync, reason);
         }
 
         // duration in milliseconds
@@ -2357,8 +2357,7 @@
             long duration, int userId, boolean sync, String reason) {
         try {
             int uid = getContext().getPackageManager().getPackageUidAsUser(packageName, userId);
-            int appId = UserHandle.getAppId(uid);
-            addPowerSaveTempWhitelistAppDirectInternal(callingUid, appId, duration, sync, reason);
+            addPowerSaveTempWhitelistAppDirectInternal(callingUid, uid, duration, sync, reason);
         } catch (NameNotFoundException e) {
         }
     }
@@ -2367,10 +2366,11 @@
      * Adds an app to the temporary whitelist and resets the endTime for granting the
      * app an exemption to access network and acquire wakelocks.
      */
-    void addPowerSaveTempWhitelistAppDirectInternal(int callingUid, int appId,
+    void addPowerSaveTempWhitelistAppDirectInternal(int callingUid, int uid,
             long duration, boolean sync, String reason) {
         final long timeNow = SystemClock.elapsedRealtime();
         boolean informWhitelistChanged = false;
+        int appId = UserHandle.getAppId(uid);
         synchronized (this) {
             int callingAppId = UserHandle.getAppId(callingUid);
             if (callingAppId >= Process.FIRST_APPLICATION_UID) {
@@ -2395,7 +2395,7 @@
                 // No pending timeout for the app id, post a delayed message
                 try {
                     mBatteryStats.noteEvent(BatteryStats.HistoryItem.EVENT_TEMP_WHITELIST_START,
-                            reason, appId);
+                            reason, uid);
                 } catch (RemoteException e) {
                 }
                 postTempActiveTimeoutMessage(appId, duration);
@@ -2440,34 +2440,34 @@
         }
     }
 
-    private void postTempActiveTimeoutMessage(int uid, long delay) {
+    private void postTempActiveTimeoutMessage(int appId, long delay) {
         if (DEBUG) {
-            Slog.d(TAG, "postTempActiveTimeoutMessage: uid=" + uid + ", delay=" + delay);
+            Slog.d(TAG, "postTempActiveTimeoutMessage: appId=" + appId + ", delay=" + delay);
         }
-        mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_TEMP_APP_WHITELIST_TIMEOUT, uid, 0),
-                delay);
+        mHandler.sendMessageDelayed(
+                mHandler.obtainMessage(MSG_TEMP_APP_WHITELIST_TIMEOUT, appId, 0), delay);
     }
 
-    void checkTempAppWhitelistTimeout(int uid) {
+    void checkTempAppWhitelistTimeout(int appId) {
         final long timeNow = SystemClock.elapsedRealtime();
         if (DEBUG) {
-            Slog.d(TAG, "checkTempAppWhitelistTimeout: uid=" + uid + ", timeNow=" + timeNow);
+            Slog.d(TAG, "checkTempAppWhitelistTimeout: appId=" + appId + ", timeNow=" + timeNow);
         }
         synchronized (this) {
-            Pair<MutableLong, String> entry = mTempWhitelistAppIdEndTimes.get(uid);
+            Pair<MutableLong, String> entry = mTempWhitelistAppIdEndTimes.get(appId);
             if (entry == null) {
                 // Nothing to do
                 return;
             }
             if (timeNow >= entry.first.value) {
-                mTempWhitelistAppIdEndTimes.delete(uid);
-                onAppRemovedFromTempWhitelistLocked(uid, entry.second);
+                mTempWhitelistAppIdEndTimes.delete(appId);
+                onAppRemovedFromTempWhitelistLocked(appId, entry.second);
             } else {
                 // Need more time
                 if (DEBUG) {
-                    Slog.d(TAG, "Time to remove UID " + uid + ": " + entry.first.value);
+                    Slog.d(TAG, "Time to remove AppId " + appId + ": " + entry.first.value);
                 }
-                postTempActiveTimeoutMessage(uid, entry.first.value - timeNow);
+                postTempActiveTimeoutMessage(appId, entry.first.value - timeNow);
             }
         }
     }
diff --git a/services/core/java/com/android/server/appop/AppOpsService.java b/services/core/java/com/android/server/appop/AppOpsService.java
index 4c3bb8c..873cadb 100644
--- a/services/core/java/com/android/server/appop/AppOpsService.java
+++ b/services/core/java/com/android/server/appop/AppOpsService.java
@@ -220,7 +220,8 @@
      * global Settings. Any access to this class or its fields should be done while
      * holding the AppOpsService lock.
      */
-    private final class Constants extends ContentObserver {
+    @VisibleForTesting
+    final class Constants extends ContentObserver {
         // Key names stored in the settings value.
         private static final String KEY_TOP_STATE_SETTLE_TIME = "top_state_settle_time";
         private static final String KEY_FG_SERVICE_STATE_SETTLE_TIME
@@ -305,7 +306,8 @@
         }
     }
 
-    private final Constants mConstants;
+    @VisibleForTesting
+    final Constants mConstants;
 
     @VisibleForTesting
     static final class UidState {
diff --git a/services/core/java/com/android/server/biometrics/AuthenticationClient.java b/services/core/java/com/android/server/biometrics/AuthenticationClient.java
index b2c5c05..91da7af 100644
--- a/services/core/java/com/android/server/biometrics/AuthenticationClient.java
+++ b/services/core/java/com/android/server/biometrics/AuthenticationClient.java
@@ -134,7 +134,8 @@
                     + ", Owner: " + getOwnerString()
                     + ", isBP: " + isBiometricPrompt()
                     + ", listener: " + listener
-                    + ", requireConfirmation: " + mRequireConfirmation);
+                    + ", requireConfirmation: " + mRequireConfirmation
+                    + ", user: " + getTargetUserId());
 
             if (authenticated) {
                 mAlreadyDone = true;
diff --git a/services/core/java/com/android/server/biometrics/face/FaceService.java b/services/core/java/com/android/server/biometrics/face/FaceService.java
index fe0fc91..e218c6b 100644
--- a/services/core/java/com/android/server/biometrics/face/FaceService.java
+++ b/services/core/java/com/android/server/biometrics/face/FaceService.java
@@ -548,7 +548,8 @@
                 throws RemoteException {
             if (mFaceServiceReceiver != null) {
                 if (biometric == null || biometric instanceof Face) {
-                    mFaceServiceReceiver.onAuthenticationSucceeded(deviceId, (Face)biometric);
+                    mFaceServiceReceiver.onAuthenticationSucceeded(deviceId, (Face) biometric,
+                            userId);
                 } else {
                     Slog.e(TAG, "onAuthenticationSucceeded received non-face biometric");
                 }
diff --git a/services/core/java/com/android/server/input/InputManagerService.java b/services/core/java/com/android/server/input/InputManagerService.java
index cec4d69..75b9705 100644
--- a/services/core/java/com/android/server/input/InputManagerService.java
+++ b/services/core/java/com/android/server/input/InputManagerService.java
@@ -523,11 +523,17 @@
         }
 
 
-        InputChannel[] inputChannels = InputChannel.openInputChannelPair(inputChannelName);
-        InputMonitorHost host = new InputMonitorHost(inputChannels[0]);
-        inputChannels[0].setToken(host.asBinder());
-        nativeRegisterInputMonitor(mPtr, inputChannels[0], displayId, true /*isGestureMonitor*/);
-        return new InputMonitor(inputChannelName, inputChannels[1], host);
+        final long ident = Binder.clearCallingIdentity();
+        try {
+            InputChannel[] inputChannels = InputChannel.openInputChannelPair(inputChannelName);
+            InputMonitorHost host = new InputMonitorHost(inputChannels[0]);
+            inputChannels[0].setToken(host.asBinder());
+            nativeRegisterInputMonitor(mPtr, inputChannels[0], displayId,
+                    true /*isGestureMonitor*/);
+            return new InputMonitor(inputChannelName, inputChannels[1], host);
+        } finally {
+            Binder.restoreCallingIdentity(ident);
+        }
     }
 
     /**
diff --git a/services/core/java/com/android/server/location/GnssLocationProvider.java b/services/core/java/com/android/server/location/GnssLocationProvider.java
index e28f89c..96fc6ec 100644
--- a/services/core/java/com/android/server/location/GnssLocationProvider.java
+++ b/services/core/java/com/android/server/location/GnssLocationProvider.java
@@ -495,6 +495,7 @@
     @Override
     public void onUpdateSatelliteBlacklist(int[] constellations, int[] svids) {
         mHandler.post(() -> mGnssConfiguration.setSatelliteBlacklist(constellations, svids));
+        mGnssMetrics.resetConstellationTypes();
     }
 
     private void subscriptionOrCarrierConfigChanged(Context context) {
@@ -1443,6 +1444,13 @@
                                 GnssStatus.GNSS_SV_FLAGS_HAS_CARRIER_FREQUENCY) == 0
                                 ? "" : "F"));
             }
+
+            if ((info.mSvidWithFlags[i] & GnssStatus.GNSS_SV_FLAGS_USED_IN_FIX) != 0) {
+                int constellationType =
+                        (info.mSvidWithFlags[i] >> GnssStatus.CONSTELLATION_TYPE_SHIFT_WIDTH)
+                                & GnssStatus.CONSTELLATION_TYPE_MASK;
+                mGnssMetrics.logConstellationType(constellationType);
+            }
         }
         if (usedInFixCount > 0) {
             meanCn0 /= usedInFixCount;
diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java
index 7f1b25ca..ee2e4f5 100644
--- a/services/core/java/com/android/server/notification/NotificationManagerService.java
+++ b/services/core/java/com/android/server/notification/NotificationManagerService.java
@@ -455,6 +455,7 @@
     private int mAutoGroupAtCount;
     private boolean mIsTelevision;
     private boolean mIsAutomotive;
+    private boolean mNotificationEffectsEnabledForAutomotive;
 
     private MetricsLogger mMetricsLogger;
     private TriPredicate<String, Integer, String> mAllowedManagedServicePackages;
@@ -1686,6 +1687,8 @@
 
         mIsAutomotive =
                 mPackageManagerClient.hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE, 0);
+        mNotificationEffectsEnabledForAutomotive =
+                resources.getBoolean(R.bool.config_enableServerNotificationEffectsForAutomotive);
 
         mPreferencesHelper.lockChannelsForOEM(getContext().getResources().getStringArray(
                 com.android.internal.R.array.config_nonBlockableNotificationPackages));
@@ -5560,6 +5563,9 @@
     @VisibleForTesting
     @GuardedBy("mNotificationLock")
     void buzzBeepBlinkLocked(NotificationRecord record) {
+        if (mIsAutomotive && !mNotificationEffectsEnabledForAutomotive) {
+            return;
+        }
         boolean buzz = false;
         boolean beep = false;
         boolean blink = false;
diff --git a/services/core/java/com/android/server/om/OverlayManagerServiceImpl.java b/services/core/java/com/android/server/om/OverlayManagerServiceImpl.java
index ec53e98..3a84b1e 100644
--- a/services/core/java/com/android/server/om/OverlayManagerServiceImpl.java
+++ b/services/core/java/com/android/server/om/OverlayManagerServiceImpl.java
@@ -452,10 +452,7 @@
             final OverlayInfo overlayInfo = mSettings.getOverlayInfo(packageName, userId);
             if (mSettings.remove(packageName, userId)) {
                 removeIdmapIfPossible(overlayInfo);
-                if (overlayInfo.isEnabled()) {
-                    // Only trigger updates if the overlay was enabled.
-                    mListener.onOverlaysChanged(overlayInfo.targetPackageName, userId);
-                }
+                mListener.onOverlaysChanged(overlayInfo.targetPackageName, userId);
             }
         } catch (OverlayManagerSettings.BadKeyException e) {
             Slog.e(TAG, "failed to remove overlay", e);
diff --git a/services/core/jni/com_android_server_location_GnssLocationProvider.cpp b/services/core/jni/com_android_server_location_GnssLocationProvider.cpp
index 73e9bf0..b470ec7 100644
--- a/services/core/jni/com_android_server_location_GnssLocationProvider.cpp
+++ b/services/core/jni/com_android_server_location_GnssLocationProvider.cpp
@@ -1693,7 +1693,7 @@
     // 1.1@IGnss can be paired {1.0, 1.1}@IGnssMeasurement
     // 1.0@IGnss is paired with 1.0@IGnssMeasurement
     gnssMeasurementIface = nullptr;
-    if (gnssHal_V2_0 != nullptr && gnssMeasurementIface == nullptr) {
+    if (gnssHal_V2_0 != nullptr) {
         auto gnssMeasurement = gnssHal_V2_0->getExtensionGnssMeasurement_2_0();
         if (!gnssMeasurement.isOk()) {
             ALOGD("Unable to get a handle to GnssMeasurement_V2_0");
@@ -1730,6 +1730,10 @@
         }
     }
 
+    // Allow all causal combinations between IGnss.hal and IGnssDebug.hal. That means,
+    // 2.0@IGnss can be paired with {1.0, 2.0}@IGnssDebug
+    // 1.0@IGnss is paired with 1.0@IGnssDebug
+    gnssDebugIface = nullptr;
     if (gnssHal_V2_0 != nullptr) {
         auto gnssDebug = gnssHal_V2_0->getExtensionGnssDebug_2_0();
         if (!gnssDebug.isOk()) {
@@ -1738,7 +1742,8 @@
             gnssDebugIface_V2_0 = gnssDebug;
             gnssDebugIface = gnssDebugIface_V2_0;
         }
-    } else {
+    }
+    if (gnssDebugIface == nullptr) {
         auto gnssDebug = gnssHal->getExtensionGnssDebug();
         if (!gnssDebug.isOk()) {
             ALOGD("Unable to get a handle to GnssDebug");
diff --git a/services/tests/servicestests/src/com/android/server/appop/AppOpsServiceTest.java b/services/tests/servicestests/src/com/android/server/appop/AppOpsServiceTest.java
index 36f84d0..c42a718 100644
--- a/services/tests/servicestests/src/com/android/server/appop/AppOpsServiceTest.java
+++ b/services/tests/servicestests/src/com/android/server/appop/AppOpsServiceTest.java
@@ -15,8 +15,11 @@
  */
 package com.android.server.appop;
 
+import static android.app.ActivityManager.PROCESS_STATE_FOREGROUND_SERVICE;
+import static android.app.ActivityManager.PROCESS_STATE_FOREGROUND_SERVICE_LOCATION;
 import static android.app.AppOpsManager.MODE_ALLOWED;
 import static android.app.AppOpsManager.MODE_ERRORED;
+import static android.app.AppOpsManager.MODE_FOREGROUND;
 import static android.app.AppOpsManager.OP_COARSE_LOCATION;
 import static android.app.AppOpsManager.OP_READ_SMS;
 import static android.app.AppOpsManager.OP_WIFI_SCAN;
@@ -25,6 +28,7 @@
 import static com.google.common.truth.Truth.assertThat;
 import static com.google.common.truth.Truth.assertWithMessage;
 
+import android.app.ActivityManager;
 import android.app.AppOpsManager.OpEntry;
 import android.app.AppOpsManager.PackageOps;
 import android.content.Context;
@@ -37,6 +41,7 @@
 import androidx.test.runner.AndroidJUnit4;
 
 import com.android.server.appop.AppOpsService;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -222,6 +227,108 @@
         assertThat(getLoggedOps()).isNull();
     }
 
+    private void setupProcStateTests() {
+        // For the location proc state tests
+        mAppOpsService.setMode(OP_COARSE_LOCATION, mMyUid, mMyPackageName, MODE_FOREGROUND);
+        mAppOpsService.mConstants.FG_SERVICE_STATE_SETTLE_TIME = 0;
+        mAppOpsService.mConstants.TOP_STATE_SETTLE_TIME = 0;
+        mAppOpsService.mConstants.BG_STATE_SETTLE_TIME = 0;
+    }
+
+    @Test
+    public void testUidProcStateChange_cachedToTopToCached() throws Exception {
+        setupProcStateTests();
+
+        mAppOpsService.updateUidProcState(mMyUid, ActivityManager.PROCESS_STATE_CACHED_EMPTY);
+        assertThat(mAppOpsService.noteOperation(OP_COARSE_LOCATION, mMyUid, mMyPackageName))
+                .isNotEqualTo(MODE_ALLOWED);
+
+        mAppOpsService.updateUidProcState(mMyUid, ActivityManager.PROCESS_STATE_TOP);
+        assertThat(mAppOpsService.noteOperation(OP_COARSE_LOCATION, mMyUid, mMyPackageName))
+                .isEqualTo(MODE_ALLOWED);
+
+        mAppOpsService.updateUidProcState(mMyUid, ActivityManager.PROCESS_STATE_CACHED_EMPTY);
+        // Second time to make sure that settle time is overcome
+        Thread.sleep(50);
+        mAppOpsService.updateUidProcState(mMyUid, ActivityManager.PROCESS_STATE_CACHED_EMPTY);
+        assertThat(mAppOpsService.noteOperation(OP_COARSE_LOCATION, mMyUid, mMyPackageName))
+                .isNotEqualTo(MODE_ALLOWED);
+    }
+
+    @Test
+    public void testUidProcStateChange_cachedToFgs() throws Exception {
+        setupProcStateTests();
+
+        mAppOpsService.updateUidProcState(mMyUid, ActivityManager.PROCESS_STATE_CACHED_EMPTY);
+        assertThat(mAppOpsService.noteOperation(OP_COARSE_LOCATION, mMyUid, mMyPackageName))
+                .isNotEqualTo(MODE_ALLOWED);
+
+        mAppOpsService.updateUidProcState(mMyUid, PROCESS_STATE_FOREGROUND_SERVICE);
+        assertThat(mAppOpsService.noteOperation(OP_COARSE_LOCATION, mMyUid, mMyPackageName))
+                .isNotEqualTo(MODE_ALLOWED);
+    }
+
+    @Test
+    public void testUidProcStateChange_cachedToFgsLocation() throws Exception {
+        setupProcStateTests();
+
+        mAppOpsService.updateUidProcState(mMyUid, ActivityManager.PROCESS_STATE_CACHED_EMPTY);
+        assertThat(mAppOpsService.noteOperation(OP_COARSE_LOCATION, mMyUid, mMyPackageName))
+                .isNotEqualTo(MODE_ALLOWED);
+
+        mAppOpsService.updateUidProcState(mMyUid,
+                PROCESS_STATE_FOREGROUND_SERVICE_LOCATION);
+        assertThat(mAppOpsService.noteOperation(OP_COARSE_LOCATION, mMyUid, mMyPackageName))
+                .isEqualTo(MODE_ALLOWED);
+    }
+
+    @Test
+    public void testUidProcStateChange_topToFgs() throws Exception {
+        setupProcStateTests();
+
+        mAppOpsService.updateUidProcState(mMyUid, ActivityManager.PROCESS_STATE_CACHED_EMPTY);
+        assertThat(mAppOpsService.noteOperation(OP_COARSE_LOCATION, mMyUid, mMyPackageName))
+                .isNotEqualTo(MODE_ALLOWED);
+
+        mAppOpsService.updateUidProcState(mMyUid, ActivityManager.PROCESS_STATE_TOP);
+        assertThat(mAppOpsService.noteOperation(OP_COARSE_LOCATION, mMyUid, mMyPackageName))
+                .isEqualTo(MODE_ALLOWED);
+
+        mAppOpsService.updateUidProcState(mMyUid, PROCESS_STATE_FOREGROUND_SERVICE);
+        // Second time to make sure that settle time is overcome
+        Thread.sleep(50);
+        mAppOpsService.updateUidProcState(mMyUid, PROCESS_STATE_FOREGROUND_SERVICE);
+        assertThat(mAppOpsService.noteOperation(OP_COARSE_LOCATION, mMyUid, mMyPackageName))
+                .isNotEqualTo(MODE_ALLOWED);
+    }
+
+    @Test
+    public void testUidProcStateChange_topToFgsLocationToFgs() throws Exception {
+        setupProcStateTests();
+
+        mAppOpsService.updateUidProcState(mMyUid, ActivityManager.PROCESS_STATE_CACHED_EMPTY);
+        assertThat(mAppOpsService.noteOperation(OP_COARSE_LOCATION, mMyUid, mMyPackageName))
+                .isNotEqualTo(MODE_ALLOWED);
+
+        mAppOpsService.updateUidProcState(mMyUid, ActivityManager.PROCESS_STATE_TOP);
+        assertThat(mAppOpsService.noteOperation(OP_COARSE_LOCATION, mMyUid, mMyPackageName))
+                .isEqualTo(MODE_ALLOWED);
+
+        mAppOpsService.updateUidProcState(mMyUid, PROCESS_STATE_FOREGROUND_SERVICE_LOCATION);
+        // Second time to make sure that settle time is overcome
+        Thread.sleep(50);
+        mAppOpsService.updateUidProcState(mMyUid, PROCESS_STATE_FOREGROUND_SERVICE_LOCATION);
+        assertThat(mAppOpsService.noteOperation(OP_COARSE_LOCATION, mMyUid, mMyPackageName))
+                .isEqualTo(MODE_ALLOWED);
+
+        mAppOpsService.updateUidProcState(mMyUid, PROCESS_STATE_FOREGROUND_SERVICE);
+        // Second time to make sure that settle time is overcome
+        Thread.sleep(50);
+        mAppOpsService.updateUidProcState(mMyUid, PROCESS_STATE_FOREGROUND_SERVICE);
+        assertThat(mAppOpsService.noteOperation(OP_COARSE_LOCATION, mMyUid, mMyPackageName))
+                .isNotEqualTo(MODE_ALLOWED);
+    }
+
     private List<PackageOps> getLoggedOps() {
         return mAppOpsService.getOpsForPackage(mMyUid, mMyPackageName, null /* all ops */);
     }
diff --git a/services/tests/uiservicestests/src/com/android/server/notification/BuzzBeepBlinkTest.java b/services/tests/uiservicestests/src/com/android/server/notification/BuzzBeepBlinkTest.java
index 6be2c2e..49ee8b3 100644
--- a/services/tests/uiservicestests/src/com/android/server/notification/BuzzBeepBlinkTest.java
+++ b/services/tests/uiservicestests/src/com/android/server/notification/BuzzBeepBlinkTest.java
@@ -48,8 +48,8 @@
 import android.app.Notification.Builder;
 import android.app.NotificationChannel;
 import android.app.NotificationManager;
-import android.content.Context;
 import android.content.pm.PackageManager;
+import android.content.res.Resources;
 import android.graphics.Color;
 import android.media.AudioAttributes;
 import android.media.AudioManager;
@@ -63,6 +63,7 @@
 import android.service.notification.NotificationListenerService;
 import android.service.notification.StatusBarNotification;
 import android.test.suitebuilder.annotation.SmallTest;
+import android.testing.TestableContext;
 import android.view.accessibility.AccessibilityEvent;
 import android.view.accessibility.AccessibilityManager;
 import android.view.accessibility.IAccessibilityManager;
@@ -70,6 +71,7 @@
 
 import androidx.test.runner.AndroidJUnit4;
 
+import com.android.internal.R;
 import com.android.internal.util.IntPair;
 import com.android.server.UiServiceTestCase;
 import com.android.server.lights.Light;
@@ -86,6 +88,7 @@
 @RunWith(AndroidJUnit4.class)
 public class BuzzBeepBlinkTest extends UiServiceTestCase {
 
+    private TestableContext mContext = spy(getContext());
     @Mock AudioManager mAudioManager;
     @Mock Vibrator mVibrator;
     @Mock android.media.IRingtonePlayer mRingtonePlayer;
@@ -96,6 +99,8 @@
     NotificationUsageStats mUsageStats;
     @Mock
     IAccessibilityManager mAccessibilityService;
+    @Mock
+    Resources mResources;
 
     private NotificationManagerService mService;
     private String mPkg = "com.android.server.notification";
@@ -145,7 +150,7 @@
         verify(mAccessibilityService).addClient(any(IAccessibilityManagerClient.class), anyInt());
         assertTrue(accessibilityManager.isEnabled());
 
-        mService = spy(new NotificationManagerService(getContext()));
+        mService = spy(new NotificationManagerService(mContext));
         mService.setAudioManager(mAudioManager);
         mService.setVibrator(mVibrator);
         mService.setSystemReady(true);
@@ -275,7 +280,7 @@
             boolean isLeanback) {
         NotificationChannel channel =
                 new NotificationChannel("test", "test", IMPORTANCE_HIGH);
-        final Builder builder = new Builder(getContext())
+        final Builder builder = new Builder(mContext)
                 .setContentTitle("foo")
                 .setSmallIcon(android.R.drawable.sym_def_app_icon)
                 .setPriority(Notification.PRIORITY_HIGH)
@@ -321,15 +326,14 @@
             n.flags |= Notification.FLAG_INSISTENT;
         }
 
-        Context context = spy(getContext());
-        PackageManager packageManager = spy(context.getPackageManager());
-        when(context.getPackageManager()).thenReturn(packageManager);
+        PackageManager packageManager = spy(mContext.getPackageManager());
+        when(mContext.getPackageManager()).thenReturn(packageManager);
         when(packageManager.hasSystemFeature(PackageManager.FEATURE_LEANBACK))
                 .thenReturn(isLeanback);
 
         StatusBarNotification sbn = new StatusBarNotification(mPkg, mPkg, id, mTag, mUid,
                 mPid, n, mUser, null, System.currentTimeMillis());
-        NotificationRecord r = new NotificationRecord(context, sbn, channel);
+        NotificationRecord r = new NotificationRecord(mContext, sbn, channel);
         mService.addNotification(r);
         return r;
     }
@@ -455,7 +459,25 @@
     }
 
     @Test
-    public void testNoBeepForImportanceDefaultInAutomotive() throws Exception {
+    public void testNoBeepForAutomotiveIfEffectsDisabled() throws Exception {
+        when(mContext.getResources()).thenReturn(mResources);
+        when(mResources.getBoolean(R.bool.config_enableServerNotificationEffectsForAutomotive))
+                .thenReturn(false);
+        mService.setIsAutomotive(true);
+
+        NotificationRecord r = getBeepyNotification();
+
+        mService.buzzBeepBlinkLocked(r);
+
+        verifyNeverBeep();
+        assertFalse(r.isInterruptive());
+    }
+
+    @Test
+    public void testNoBeepForImportanceDefaultInAutomotiveIfEffectsEnabled() throws Exception {
+        when(mContext.getResources()).thenReturn(mResources);
+        when(mResources.getBoolean(R.bool.config_enableServerNotificationEffectsForAutomotive))
+                .thenReturn(true);
         mService.setIsAutomotive(true);
 
         NotificationRecord r = getBeepyNotification();
@@ -468,7 +490,10 @@
     }
 
     @Test
-    public void testBeepForImportanceHighInAutomotive() throws Exception {
+    public void testBeepForImportanceHighInAutomotiveIfEffectsEnabled() throws Exception {
+        when(mContext.getResources()).thenReturn(mResources);
+        when(mResources.getBoolean(R.bool.config_enableServerNotificationEffectsForAutomotive))
+                .thenReturn(true);
         mService.setIsAutomotive(true);
 
         NotificationRecord r = getBeepyNotification();
@@ -1015,12 +1040,12 @@
     public void testEmptyUriSoundTreatedAsNoSound() throws Exception {
         NotificationChannel channel = new NotificationChannel("test", "test", IMPORTANCE_HIGH);
         channel.setSound(Uri.EMPTY, null);
-        final Notification n = new Builder(getContext(), "test")
+        final Notification n = new Builder(mContext, "test")
                 .setSmallIcon(android.R.drawable.sym_def_app_icon).build();
 
         StatusBarNotification sbn = new StatusBarNotification(mPkg, mPkg, 0, mTag, mUid,
                 mPid, n, mUser, null, System.currentTimeMillis());
-        NotificationRecord r = new NotificationRecord(getContext(), sbn, channel);
+        NotificationRecord r = new NotificationRecord(mContext, sbn, channel);
         mService.addNotification(r);
 
         mService.buzzBeepBlinkLocked(r);
@@ -1069,13 +1094,13 @@
 
     @Test
     public void testCrossUserSoundMuted() throws Exception {
-        final Notification n = new Builder(getContext(), "test")
+        final Notification n = new Builder(mContext, "test")
                 .setSmallIcon(android.R.drawable.sym_def_app_icon).build();
 
         int userId = mUser.getIdentifier() + 1;
         StatusBarNotification sbn = new StatusBarNotification(mPkg, mPkg, 0, mTag, mUid,
                 mPid, n, UserHandle.of(userId), null, System.currentTimeMillis());
-        NotificationRecord r = new NotificationRecord(getContext(), sbn,
+        NotificationRecord r = new NotificationRecord(mContext, sbn,
                 new NotificationChannel("test", "test", IMPORTANCE_HIGH));
 
         mService.buzzBeepBlinkLocked(r);
diff --git a/telephony/java/android/telephony/CarrierRestrictionRules.java b/telephony/java/android/telephony/CarrierRestrictionRules.java
index 78623e7..950ae6c 100644
--- a/telephony/java/android/telephony/CarrierRestrictionRules.java
+++ b/telephony/java/android/telephony/CarrierRestrictionRules.java
@@ -336,7 +336,6 @@
     public static final class Builder {
         private final CarrierRestrictionRules mRules;
 
-        /** {@hide} */
         public Builder() {
             mRules = new CarrierRestrictionRules();
         }