Merge "Invalidate SignalDrawable on level change." into qt-dev
diff --git a/config/dirty-image-objects b/config/dirty-image-objects
index 9e2230b..ec2568d 100644
--- a/config/dirty-image-objects
+++ b/config/dirty-image-objects
@@ -28,147 +28,359 @@
 # Then, grep for lines containing "Private dirty object" from the output.
 # This particular file was generated by dumping systemserver and systemui.
 #
+android.accounts.Account
+android.accounts.OnAccountsUpdateListener
+android.animation.LayoutTransition
+android.app.ActivityManager
+android.app.ActivityManager$OnUidImportanceListener
+android.app.ActivityTaskManager
+android.app.ActivityThread
+android.app.admin.DevicePolicyManager
+android.app.AlarmManager
+android.app.Application
+android.app.AppOpsManager
+android.app.backup.BackupManager
+android.app.ContextImpl
+android.app.INotificationManager
+android.app.Notification$BigPictureStyle
+android.app.Notification$BigTextStyle
+android.app.Notification$InboxStyle
+android.app.NotificationChannel
+android.app.NotificationChannelGroup
+android.app.NotificationManager
+android.app.PendingIntent
+android.app.PendingIntent$OnFinished
+android.app.QueuedWork
+android.app.ResourcesManager
+android.app.WallpaperManager
+android.app.WindowConfiguration
+android.bluetooth.BluetoothAdapter
+android.bluetooth.BluetoothDevice
+android.bluetooth.BluetoothProfile
+android.bluetooth.IBluetoothA2dp
+android.bluetooth.IBluetoothHeadsetPhone
+android.bluetooth.IBluetoothHidDevice
+android.bluetooth.IBluetoothHidHost
+android.bluetooth.IBluetoothMap
+android.bluetooth.IBluetoothPan
+android.bluetooth.IBluetoothPbap
+android.bluetooth.IBluetoothSap
+android.content.ClipboardManager$OnPrimaryClipChangedListener
+android.content.ComponentName
+android.content.ContentProvider$PipeDataWriter
+android.content.ContentResolver
+android.content.Context
+android.content.Intent
+android.content.pm.PackageManager$OnPermissionsChangedListener
+android.content.pm.VersionedPackage
+android.content.res.Configuration
+android.content.SharedPreferences$OnSharedPreferenceChangeListener
+android.database.CursorWindow
+android.database.sqlite.SQLiteCompatibilityWalFlags
+android.database.sqlite.SQLiteDatabase$CursorFactory
+android.database.sqlite.SQLiteGlobal
+android.database.sqlite.SQLiteTransactionListener
+android.ddm.DdmHandleAppName
+android.graphics.Bitmap
+android.graphics.Canvas
+android.graphics.drawable.AdaptiveIconDrawable
+android.graphics.drawable.ColorDrawable
+android.graphics.drawable.GradientDrawable
+android.graphics.drawable.Icon
+android.graphics.drawable.InsetDrawable
+android.graphics.drawable.RippleDrawable
+android.graphics.drawable.VectorDrawable$VGroup
+android.graphics.ImageDecoder
+android.graphics.Rect
+android.graphics.TemporaryBuffer
+android.hardware.biometrics.BiometricSourceType
+android.hardware.display.ColorDisplayManager$ColorDisplayManagerInternal
+android.hardware.display.DisplayManagerGlobal
+android.hardware.display.NightDisplayListener$Callback
+android.hardware.input.InputManager
+android.hardware.input.InputManager$InputDeviceListener
+android.hardware.SensorPrivacyManager
+android.hardware.SystemSensorManager
+android.icu.impl.OlsonTimeZone
+android.icu.text.BreakIterator
+android.icu.text.Collator
+android.icu.text.DateFormat$BooleanAttribute
+android.icu.text.DateTimePatternGenerator$DTPGflags
+android.icu.text.PluralRules$Operand
+android.icu.util.TimeZone
+android.location.GpsStatus$Listener
+android.location.LocationListener
+android.media.AudioManager
+android.media.MediaRouter
+android.media.PlayerBase
+android.media.session.MediaSessionManager
+android.net.apf.ApfCapabilities
+android.net.ConnectivityManager
+android.net.ConnectivityManager$OnNetworkActiveListener
+android.net.ConnectivityThread$Singleton
+android.net.IpConfiguration$IpAssignment
+android.net.IpConfiguration$ProxySettings
+android.net.IpPrefix
+android.net.LinkAddress
+android.net.LinkProperties
+android.net.Network
+android.net.NetworkCapabilities
+android.net.NetworkInfo
+android.net.NetworkInfo$State
+android.net.NetworkRequest
+android.net.NetworkRequest$Type
+android.net.RouteInfo
+android.net.StringNetworkSpecifier
+android.net.TrafficStats
+android.net.UidRange
+android.net.Uri$HierarchicalUri
+android.net.Uri$StringUri
+android.net.wifi.WifiManager
+android.net.wifi.WifiManager$SoftApCallback
+android.os.AsyncResult
+android.os.AsyncTask
+android.os.BinderProxy
+android.os.Bundle
+android.os.DeadObjectException
+android.os.Environment
+android.os.FileObserver
+android.os.Handler
+android.os.IDeviceIdleController
+android.os.LocaleList
+android.os.Looper
+android.os.Message
+android.os.ParcelUuid
+android.os.Process
+android.os.RecoverySystem
+android.os.ServiceManager
+android.os.storage.StorageManager
+android.os.StrictMode
+android.os.Trace
+android.os.WorkSource
+android.os.WorkSource$WorkChain
+android.permission.PermissionManager
+android.provider.FontsContract
+android.provider.Settings$SettingNotFoundException
+android.renderscript.RenderScriptCacheDir
+android.security.IKeyChainService
+android.security.keystore.AndroidKeyStoreProvider
+android.security.net.config.ApplicationConfig
+android.security.net.config.SystemCertificateSource$NoPreloadHolder
+android.telecom.PhoneAccountHandle
+android.telephony.AnomalyReporter
+android.telephony.CellSignalStrengthCdma
+android.telephony.CellSignalStrengthGsm
+android.telephony.CellSignalStrengthLte
+android.telephony.CellSignalStrengthNr
+android.telephony.CellSignalStrengthTdscdma
+android.telephony.CellSignalStrengthWcdma
+android.telephony.DataSpecificRegistrationInfo
+android.telephony.emergency.EmergencyNumber
+android.telephony.ims.ImsMmTelManager$CapabilityCallback$CapabilityBinder
+android.telephony.ims.ImsMmTelManager$RegistrationCallback$RegistrationBinder
+android.telephony.ims.ImsReasonInfo
+android.telephony.ims.ProvisioningManager$Callback$CallbackBinder
+android.telephony.ModemActivityInfo
+android.telephony.ModemInfo
+android.telephony.NetworkRegistrationInfo
+android.telephony.NetworkService
+android.telephony.TelephonyManager
+android.telephony.VoiceSpecificRegistrationInfo
+android.text.format.DateFormat
+android.text.method.SingleLineTransformationMethod
+android.text.Selection$MemoryTextWatcher
+android.text.SpanWatcher
+android.text.style.AlignmentSpan
+android.text.style.CharacterStyle
+android.text.style.LeadingMarginSpan
+android.text.style.LineBackgroundSpan
+android.text.style.LineHeightSpan
+android.text.style.MetricAffectingSpan
+android.text.style.ReplacementSpan
+android.text.style.SuggestionSpan
+android.text.style.TabStopSpan
+android.text.TextUtils
+android.text.TextWatcher
+android.transition.ChangeClipBounds
+android.transition.ChangeImageTransform
+android.transition.ChangeTransform
+android.util.ArrayMap
+android.util.ArraySet
+android.util.DisplayMetrics
+android.util.EventLog
+android.util.Log
+android.util.Patterns
+android.view.AbsSavedState$1
+android.view.accessibility.AccessibilityManager
+android.view.accessibility.AccessibilityManager$AccessibilityServicesStateChangeListener
+android.view.accessibility.AccessibilityManager$TouchExplorationStateChangeListener
+android.view.accessibility.AccessibilityNodeIdManager
+android.view.autofill.AutofillManager
+android.view.autofill.Helper
+android.view.Choreographer
+android.view.inputmethod.InputMethodManager
+android.view.IWindowManager
+android.view.PointerIcon
+android.view.RemoteAnimationAdapter
+android.view.ThreadedRenderer
+android.view.View
+android.view.View$OnHoverListener
+android.view.ViewRootImpl
+android.view.ViewStub
+android.view.ViewStub$OnInflateListener
+android.view.ViewTreeObserver
+android.view.WindowManager$LayoutParams
+android.view.WindowManagerGlobal
+android.widget.ActionMenuPresenter$OverflowMenuButton
+android.widget.ActionMenuView
+android.widget.Button
+android.widget.CheckBox
+android.widget.FrameLayout
+android.widget.ImageButton
+android.widget.ImageView
+android.widget.LinearLayout
+android.widget.RelativeLayout
+android.widget.SeekBar
+android.widget.Space
+android.widget.TextView
+android.widget.Toolbar
+byte[]
+com.android.ims.ImsManager
+com.android.internal.logging.MetricsLogger
+com.android.internal.os.BackgroundThread
+com.android.internal.os.BinderInternal
+com.android.internal.os.BinderInternal$BinderProxyLimitListener
+com.android.internal.os.RuntimeInit
+com.android.internal.os.SomeArgs
+com.android.internal.policy.DecorView
+com.android.internal.statusbar.IStatusBarService
+com.android.internal.telephony.AppSmsManager
+com.android.internal.telephony.CallerInfoAsyncQuery$OnQueryCompleteListener
+com.android.internal.telephony.CarrierActionAgent
+com.android.internal.telephony.cat.CatService
+com.android.internal.telephony.cat.IconLoader
+com.android.internal.telephony.cat.RilMessageDecoder
+com.android.internal.telephony.cdma.CdmaSubscriptionSourceManager
+com.android.internal.telephony.cdma.EriManager
+com.android.internal.telephony.CellularNetworkValidator
+com.android.internal.telephony.CommandException
+com.android.internal.telephony.dataconnection.DataConnection$DcActivatingState
+com.android.internal.telephony.dataconnection.DataConnection$DcActiveState
+com.android.internal.telephony.dataconnection.DataConnection$DcInactiveState
+com.android.internal.telephony.dataconnection.DataEnabledSettings
+com.android.internal.telephony.dataconnection.DcTracker
+com.android.internal.telephony.euicc.EuiccCardController
+com.android.internal.telephony.euicc.EuiccController
+com.android.internal.telephony.GsmAlphabet
+com.android.internal.telephony.GsmCdmaCallTracker
+com.android.internal.telephony.GsmCdmaPhone
+com.android.internal.telephony.IccPhoneBookInterfaceManager
+com.android.internal.telephony.IccSmsInterfaceManager
+com.android.internal.telephony.ims.ImsResolver
+com.android.internal.telephony.imsphone.ImsExternalCallTracker
+com.android.internal.telephony.imsphone.ImsPhone
+com.android.internal.telephony.imsphone.ImsPhoneCallTracker
+com.android.internal.telephony.ims.RcsMessageStoreController
+com.android.internal.telephony.IntentBroadcaster
+com.android.internal.telephony.ITelephonyRegistry$Stub$Proxy
+com.android.internal.telephony.metrics.TelephonyMetrics
+com.android.internal.telephony.MultiSimSettingController
+com.android.internal.telephony.nano.CarrierIdProto$CarrierAttribute
+com.android.internal.telephony.nano.CarrierIdProto$CarrierId
+com.android.internal.telephony.nano.TelephonyProto$RilDataCall
+com.android.internal.telephony.nano.TelephonyProto$SmsSession$Event
+com.android.internal.telephony.nano.TelephonyProto$TelephonyCallSession$Event$RilCall
+com.android.internal.telephony.NitzStateMachine
+com.android.internal.telephony.PhoneConfigurationManager
+com.android.internal.telephony.PhoneFactory
+com.android.internal.telephony.PhoneSwitcher
+com.android.internal.telephony.ProxyController
+com.android.internal.telephony.RadioConfig
+com.android.internal.telephony.RIL
+com.android.internal.telephony.RILRequest
+com.android.internal.telephony.RilWakelockInfo
+com.android.internal.telephony.ServiceStateTracker
+com.android.internal.telephony.SimActivationTracker
+com.android.internal.telephony.SmsApplication
+com.android.internal.telephony.SmsBroadcastUndelivered
+com.android.internal.telephony.SmsStorageMonitor
+com.android.internal.telephony.SmsUsageMonitor
+com.android.internal.telephony.SubscriptionController
+com.android.internal.telephony.SubscriptionInfoUpdater
+com.android.internal.telephony.TelephonyComponentFactory
+com.android.internal.telephony.TelephonyDevController
+com.android.internal.telephony.TelephonyTester
+com.android.internal.telephony.uicc.AdnRecordCache
+com.android.internal.telephony.uicc.UiccCardApplication
+com.android.internal.telephony.uicc.UiccController
+com.android.internal.telephony.uicc.UiccProfile
+com.android.internal.telephony.uicc.UiccStateChangedLauncher
+com.android.internal.telephony.uicc.UsimFileHandler
+com.android.internal.telephony.uicc.VoiceMailConstants
+com.android.internal.util.LatencyTracker
+com.android.internal.util.StateMachine$SmHandler
+com.android.okhttp.OkHttpClient
+com.android.okhttp.okio.AsyncTimeout
+com.android.okhttp.okio.SegmentPool
+com.android.phone.ecc.nano.ProtobufEccData$CountryInfo
+com.android.phone.ecc.nano.ProtobufEccData$EccInfo
+com.android.server.sip.SipWakeupTimer
+com.android.server.SystemConfig
+dalvik.system.BaseDexClassLoader
+dalvik.system.BlockGuard
+dalvik.system.CloseGuard
+dalvik.system.RuntimeHooks
+dalvik.system.SocketTagger
+java.io.BufferedReader
+java.lang.AssertionError
+java.lang.Boolean
+java.lang.Byte
+java.lang.Character
+java.lang.CharSequence
+java.lang.Class
+java.lang.IllegalAccessException
+java.lang.IllegalStateException
+java.lang.NoSuchMethodException
+java.lang.NullPointerException
+java.lang.Object
+java.lang.Object[]
+java.lang.ref.FinalizerReference
+java.lang.Runnable
+java.lang.SecurityException
+java.lang.Short
+java.lang.String[]
 java.lang.System
-java.net.Inet4Address
 java.lang.Thread
 java.lang.Throwable
-java.util.Collections
-javax.net.ssl.SSLContext
+java.lang.UnsatisfiedLinkError
+java.net.Inet6Address
+java.net.Socket
+java.net.SocketException
+java.nio.Bits
 java.nio.charset.Charset
+java.security.interfaces.RSAPrivateKey
 java.security.Provider
-javax.net.ssl.HttpsURLConnection
-javax.net.ssl.SSLSocketFactory
-java.util.TimeZone
+java.util.Collections
+java.util.concurrent.Executor
+java.util.GregorianCalendar
 java.util.Locale
-java.util.function.ToIntFunction
-sun.misc.FormattedFloatingDecimal
-java.util.stream.IntStream
-android.icu.util.TimeZone
-org.apache.harmony.luni.internal.util.TimezoneGetter
-dalvik.system.SocketTagger
-dalvik.system.CloseGuard
-java.lang.ref.FinalizerReference
-com.android.org.conscrypt.ct.CTLogStoreImpl
-com.android.org.conscrypt.SSLParametersImpl
-com.android.org.conscrypt.OpenSSLContextImpl
-com.android.org.conscrypt.SSLParametersImpl$AliasChooser
-com.android.org.conscrypt.SSLParametersImpl$PSKCallbacks
-com.android.org.conscrypt.NativeCrypto$SSLHandshakeCallbacks
-com.android.okhttp.OkHttpClient
-com.android.okhttp.okio.SegmentPool
-com.android.okhttp.okio.AsyncTimeout
-com.android.okhttp.HttpUrl
-android.os.StrictMode
-com.android.internal.os.BinderInternal
-android.os.storage.StorageManager
-android.os.Trace
-android.app.ActivityManager
-android.media.MediaRouter
-android.os.Environment
-android.view.ThreadedRenderer
-android.media.AudioManager
-android.app.AlarmManager
-android.telephony.TelephonyManager
-android.bluetooth.BluetoothAdapter
-com.android.internal.os.SomeArgs
-android.os.LocaleList
-android.view.WindowManagerGlobal
-android.media.AudioSystem
-android.ddm.DdmHandleAppName
-android.provider.Settings
-android.view.ViewRootImpl
-android.net.ConnectivityManager
-android.app.ActivityThread
-android.os.BaseBundle
-android.util.ArraySet
-android.view.View
-android.os.ServiceManager
-android.view.ViewTreeObserver
-android.hardware.input.InputManager
-android.os.UEventObserver
-android.app.NotificationManager
-android.hardware.display.DisplayManagerGlobal
-android.os.Binder
-android.app.AppOpsManager
-android.content.ContentResolver
-android.app.backup.BackupManager
-android.util.ArrayMap
-android.os.Looper
-android.graphics.Bitmap
-android.view.textservice.TextServicesManager
-com.android.internal.inputmethod.InputMethodUtils
-android.app.QueuedWork
-android.graphics.TemporaryBuffer
-android.widget.ImageView
-android.database.sqlite.SQLiteGlobal
-android.view.autofill.Helper
-android.text.method.SingleLineTransformationMethod
-com.android.internal.os.RuntimeInit
-android.view.inputmethod.InputMethodManager
-android.hardware.SystemSensorManager
-android.database.CursorWindow
-android.text.TextUtils
-android.media.PlayerBase
-android.app.ResourcesManager
-android.os.Message
-android.view.accessibility.AccessibilityManager
-android.app.Notification
-android.provider.ContactsContract$ContactNameColumns
-android.provider.CalendarContract$EventsColumns
-android.provider.CalendarContract$CalendarColumns
-android.provider.CalendarContract$SyncColumns
-android.provider.ContactsContract$ContactsColumns
-android.content.pm.PackageManager$OnPermissionsChangedListener
-android.net.IpConfiguration$ProxySettings
-android.provider.ContactsContract$ContactOptionsColumns
-android.net.wifi.SupplicantState
-android.provider.ContactsContract$ContactStatusColumns
-android.view.accessibility.AccessibilityManager$TouchExplorationStateChangeListener
-android.provider.CalendarContract$CalendarSyncColumns
-android.bluetooth.BluetoothProfile$ServiceListener
-android.provider.ContactsContract$ContactCounts
-android.net.IpConfiguration$IpAssignment
-android.text.TextWatcher
-android.graphics.Bitmap$CompressFormat
-android.location.LocationListener
-sun.security.jca.Providers
-java.lang.CharSequence
-android.icu.util.ULocale
-dalvik.system.BaseDexClassLoader
-android.icu.text.BreakIterator
+java.util.Locale$NoImagePreloadHolder
+java.util.Scanner
+java.util.Set
+java.util.TimeZone
+javax.net.SocketFactory
+javax.net.ssl.HttpsURLConnection
+javax.net.ssl.HttpsURLConnection$NoPreloadHolder
+javax.net.ssl.SSLContext
+javax.net.ssl.SSLSessionContext
+javax.net.ssl.SSLSocketFactory
+libcore.io.Libcore
+libcore.io.Memory
 libcore.net.NetworkSecurityPolicy
-android.icu.text.UnicodeSet
-com.android.org.conscrypt.TrustedCertificateStore$PreloadHolder
-android.app.SearchManager
-android.os.Build
-android.app.ContextImpl
-android.app.WallpaperManager
-android.security.net.config.ApplicationConfig
-android.animation.LayoutTransition
-android.widget.TextView
-com.android.internal.logging.MetricsLogger
-android.renderscript.RenderScriptCacheDir
-android.os.Process
-android.os.Handler
-android.content.Context
-android.graphics.drawable.AdaptiveIconDrawable
-android.provider.FontsContract
-android.text.style.SuggestionSpan
-android.graphics.drawable.VectorDrawable$VGroup
-android.view.ViewStub
-android.text.style.MetricAffectingSpan
-android.content.SharedPreferences$OnSharedPreferenceChangeListener
-android.app.PendingIntent
-android.text.SpanWatcher
-android.widget.FrameLayout
-android.net.NetworkRequest$Type
-android.net.NetworkInfo$State
-android.graphics.drawable.GradientDrawable
-android.text.style.AlignmentSpan
-android.widget.LinearLayout
-android.text.style.CharacterStyle
-android.view.View$OnApplyWindowInsetsListener
-android.view.MenuItem
-android.text.style.ReplacementSpan
-android.graphics.drawable.Icon
-android.widget.Button
+libcore.timezone.TimeZoneFinder
+org.apache.http.params.HttpParams
+sun.misc.Cleaner
+sun.nio.ch.FileChannelImpl
+sun.nio.ch.FileChannelImpl$Unmapper
+sun.nio.fs.UnixChannelFactory
+sun.security.jca.Providers
diff --git a/core/java/android/content/pm/PackageManagerInternal.java b/core/java/android/content/pm/PackageManagerInternal.java
index 666508a..672994e 100644
--- a/core/java/android/content/pm/PackageManagerInternal.java
+++ b/core/java/android/content/pm/PackageManagerInternal.java
@@ -994,4 +994,9 @@
      */
     public abstract void setRuntimePermissionsFingerPrint(@NonNull String fingerPrint,
             @UserIdInt int userId);
+
+    /**
+     * Migrates legacy obb data to its new location.
+     */
+    public abstract void migrateLegacyObbData();
 }
diff --git a/core/java/android/os/Process.java b/core/java/android/os/Process.java
index e50ab6c..74c89d6 100644
--- a/core/java/android/os/Process.java
+++ b/core/java/android/os/Process.java
@@ -511,7 +511,6 @@
      * @param appDataDir null-ok the data directory of the app.
      * @param invokeWith null-ok the command to invoke with.
      * @param packageName null-ok the name of the package this process belongs to.
-     * @param useSystemGraphicsDriver whether the process uses system graphics driver.
      *
      * @param zygoteArgs Additional arguments to supply to the zygote process.
      * @return An object that describes the result of the attempt to start the process.
@@ -531,13 +530,11 @@
                                            @Nullable String appDataDir,
                                            @Nullable String invokeWith,
                                            @Nullable String packageName,
-                                           boolean useSystemGraphicsDriver,
                                            @Nullable String[] zygoteArgs) {
         return ZYGOTE_PROCESS.start(processClass, niceName, uid, gid, gids,
                     runtimeFlags, mountExternal, targetSdkVersion, seInfo,
                     abi, instructionSet, appDataDir, invokeWith, packageName,
-                    /*useUsapPool=*/ true,
-                    useSystemGraphicsDriver, zygoteArgs);
+                    /*useUsapPool=*/ true, zygoteArgs);
     }
 
     /** @hide */
@@ -553,13 +550,11 @@
                                                   @Nullable String appDataDir,
                                                   @Nullable String invokeWith,
                                                   @Nullable String packageName,
-                                                  boolean useSystemGraphicsDriver,
                                                   @Nullable String[] zygoteArgs) {
         return WebViewZygote.getProcess().start(processClass, niceName, uid, gid, gids,
                     runtimeFlags, mountExternal, targetSdkVersion, seInfo,
                     abi, instructionSet, appDataDir, invokeWith, packageName,
-                    /*useUsapPool=*/ false,
-                    useSystemGraphicsDriver, zygoteArgs);
+                    /*useUsapPool=*/ false, zygoteArgs);
     }
 
     /**
diff --git a/core/java/android/os/ZygoteProcess.java b/core/java/android/os/ZygoteProcess.java
index d42478e5..9bcdcee 100644
--- a/core/java/android/os/ZygoteProcess.java
+++ b/core/java/android/os/ZygoteProcess.java
@@ -307,7 +307,6 @@
      * @param invokeWith null-ok the command to invoke with.
      * @param packageName null-ok the name of the package this process belongs to.
      * @param zygoteArgs Additional arguments to supply to the zygote process.
-     * @param useSystemGraphicsDriver whether the process uses system graphics driver.
      *
      * @return An object that describes the result of the attempt to start the process.
      * @throws RuntimeException on fatal start failure
@@ -324,7 +323,6 @@
                                                   @Nullable String invokeWith,
                                                   @Nullable String packageName,
                                                   boolean useUsapPool,
-                                                  boolean useSystemGraphicsDriver,
                                                   @Nullable String[] zygoteArgs) {
         // TODO (chriswailes): Is there a better place to check this value?
         if (fetchUsapPoolEnabledPropWithMinInterval()) {
@@ -335,7 +333,7 @@
             return startViaZygote(processClass, niceName, uid, gid, gids,
                     runtimeFlags, mountExternal, targetSdkVersion, seInfo,
                     abi, instructionSet, appDataDir, invokeWith, /*startChildZygote=*/ false,
-                    packageName, useUsapPool, useSystemGraphicsDriver, zygoteArgs);
+                    packageName, useUsapPool, zygoteArgs);
         } catch (ZygoteStartFailedEx ex) {
             Log.e(LOG_TAG,
                     "Starting VM process through Zygote failed");
@@ -554,7 +552,6 @@
                                                       boolean startChildZygote,
                                                       @Nullable String packageName,
                                                       boolean useUsapPool,
-                                                      boolean useSystemGraphicsDriver,
                                                       @Nullable String[] extraArgs)
                                                       throws ZygoteStartFailedEx {
         ArrayList<String> argsForZygote = new ArrayList<>();
@@ -636,7 +633,7 @@
             // The USAP pool can not be used if the application will not use the systems graphics
             // driver.  If that driver is requested use the Zygote application start path.
             return zygoteSendArgsAndGetResult(openZygoteSocketIfNeeded(abi),
-                                              useUsapPool && useSystemGraphicsDriver,
+                                              useUsapPool,
                                               argsForZygote);
         }
     }
@@ -1147,8 +1144,7 @@
                     gids, runtimeFlags, 0 /* mountExternal */, 0 /* targetSdkVersion */, seInfo,
                     abi, instructionSet, null /* appDataDir */, null /* invokeWith */,
                     true /* startChildZygote */, null /* packageName */,
-                    false /* useUsapPool */, false /*useSystemGraphicsDriver*/,
-                    extraArgs);
+                    false /* useUsapPool */, extraArgs);
         } catch (ZygoteStartFailedEx ex) {
             throw new RuntimeException("Starting child-zygote through Zygote failed", ex);
         }
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index 5432e33..383d8db 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -12665,6 +12665,14 @@
         public static final String GAME_DRIVER_OPT_IN_APPS = "game_driver_opt_in_apps";
 
         /**
+         * List of Apps selected to use prerelease Game Driver.
+         * i.e. <pkg1>,<pkg2>,...,<pkgN>
+         * @hide
+         */
+        public static final String GAME_DRIVER_PRERELEASE_OPT_IN_APPS =
+                "game_driver_prerelease_opt_in_apps";
+
+        /**
          * List of Apps selected not to use Game Driver.
          * i.e. <pkg1>,<pkg2>,...,<pkgN>
          * @hide
@@ -13569,39 +13577,6 @@
                 "location_global_kill_switch";
 
         /**
-         * If set to 1, the device identifier check will be relaxed to the previous READ_PHONE_STATE
-         * permission check for 3P apps.
-         *
-         * STOPSHIP: Remove this once we ship with the new device identifier check enabled.
-         *
-         * @hide
-         */
-        public static final String PRIVILEGED_DEVICE_IDENTIFIER_3P_CHECK_RELAXED =
-                "privileged_device_identifier_3p_check_relaxed";
-
-        /**
-         * If set to 1, the device identifier check will be relaxed to the previous READ_PHONE_STATE
-         * permission check for preloaded non-privileged apps.
-         *
-         * STOPSHIP: Remove this once we ship with the new device identifier check enabled.
-         *
-         * @hide
-         */
-        public static final String PRIVILEGED_DEVICE_IDENTIFIER_NON_PRIV_CHECK_RELAXED =
-                "privileged_device_identifier_non_priv_check_relaxed";
-
-        /**
-         * If set to 1, the device identifier check will be relaxed to the previous READ_PHONE_STATE
-         * permission check for preloaded privileged apps.
-         *
-         * STOPSHIP: Remove this once we ship with the new device identifier check enabled.
-         *
-         * @hide
-         */
-        public static final String PRIVILEGED_DEVICE_IDENTIFIER_PRIV_CHECK_RELAXED =
-                "privileged_device_identifier_priv_check_relaxed";
-
-        /**
          * If set to 1, SettingsProvider's restoreAnyVersion="true" attribute will be ignored
          * and restoring to lower version of platform API will be skipped.
          *
diff --git a/core/java/android/service/notification/NotificationListenerService.java b/core/java/android/service/notification/NotificationListenerService.java
index e02fd9f..b44c9d5 100644
--- a/core/java/android/service/notification/NotificationListenerService.java
+++ b/core/java/android/service/notification/NotificationListenerService.java
@@ -1199,20 +1199,25 @@
         }
     }
 
-    /** Convert new-style Icons to legacy representations for pre-M clients. */
-    private void createLegacyIconExtras(Notification n) {
-        Icon smallIcon = n.getSmallIcon();
-        Icon largeIcon = n.getLargeIcon();
-        if (smallIcon != null && smallIcon.getType() == Icon.TYPE_RESOURCE) {
-            n.extras.putInt(Notification.EXTRA_SMALL_ICON, smallIcon.getResId());
-            n.icon = smallIcon.getResId();
-        }
-        if (largeIcon != null) {
-            Drawable d = largeIcon.loadDrawable(getContext());
-            if (d != null && d instanceof BitmapDrawable) {
-                final Bitmap largeIconBits = ((BitmapDrawable) d).getBitmap();
-                n.extras.putParcelable(Notification.EXTRA_LARGE_ICON, largeIconBits);
-                n.largeIcon = largeIconBits;
+    /**
+     * Convert new-style Icons to legacy representations for pre-M clients.
+     * @hide
+     */
+    public final void createLegacyIconExtras(Notification n) {
+        if (getContext().getApplicationInfo().targetSdkVersion < Build.VERSION_CODES.M) {
+            Icon smallIcon = n.getSmallIcon();
+            Icon largeIcon = n.getLargeIcon();
+            if (smallIcon != null && smallIcon.getType() == Icon.TYPE_RESOURCE) {
+                n.extras.putInt(Notification.EXTRA_SMALL_ICON, smallIcon.getResId());
+                n.icon = smallIcon.getResId();
+            }
+            if (largeIcon != null) {
+                Drawable d = largeIcon.loadDrawable(getContext());
+                if (d != null && d instanceof BitmapDrawable) {
+                    final Bitmap largeIconBits = ((BitmapDrawable) d).getBitmap();
+                    n.extras.putParcelable(Notification.EXTRA_LARGE_ICON, largeIconBits);
+                    n.largeIcon = largeIconBits;
+                }
             }
         }
     }
diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java
index 4cb552d..85e9e49 100644
--- a/core/java/android/widget/AbsListView.java
+++ b/core/java/android/widget/AbsListView.java
@@ -2553,34 +2553,42 @@
         final boolean isItemEnabled;
         final ViewGroup.LayoutParams lp = view.getLayoutParams();
         if (lp instanceof AbsListView.LayoutParams) {
-            isItemEnabled = ((AbsListView.LayoutParams) lp).isEnabled;
+            isItemEnabled = ((AbsListView.LayoutParams) lp).isEnabled && isEnabled();
         } else {
             isItemEnabled = false;
         }
 
-        if (!isEnabled() || !isItemEnabled) {
-            info.setEnabled(false);
-            return;
-        }
+        info.setEnabled(isItemEnabled);
 
         if (position == getSelectedItemPosition()) {
             info.setSelected(true);
-            info.addAction(AccessibilityAction.ACTION_CLEAR_SELECTION);
-        } else {
-            info.addAction(AccessibilityAction.ACTION_SELECT);
+            addAccessibilityActionIfEnabled(info, isItemEnabled,
+                    AccessibilityAction.ACTION_CLEAR_SELECTION);
+        } else  {
+            addAccessibilityActionIfEnabled(info, isItemEnabled,
+                    AccessibilityAction.ACTION_SELECT);
         }
 
         if (isItemClickable(view)) {
-            info.addAction(AccessibilityAction.ACTION_CLICK);
+            addAccessibilityActionIfEnabled(info, isItemEnabled, AccessibilityAction.ACTION_CLICK);
             info.setClickable(true);
         }
 
         if (isLongClickable()) {
-            info.addAction(AccessibilityAction.ACTION_LONG_CLICK);
+            addAccessibilityActionIfEnabled(info, isItemEnabled,
+                    AccessibilityAction.ACTION_LONG_CLICK);
             info.setLongClickable(true);
         }
     }
 
+
+    private void addAccessibilityActionIfEnabled(AccessibilityNodeInfo info, boolean enabled,
+            AccessibilityAction action) {
+        if (enabled) {
+            info.addAction(action);
+        }
+    }
+
     private boolean isItemClickable(View view) {
         return !view.hasExplicitFocusable();
     }
diff --git a/core/java/com/android/internal/os/Zygote.java b/core/java/com/android/internal/os/Zygote.java
index ee81868..2ba9cf1 100644
--- a/core/java/com/android/internal/os/Zygote.java
+++ b/core/java/com/android/internal/os/Zygote.java
@@ -512,9 +512,6 @@
         Credentials peerCredentials = null;
         ZygoteArguments args = null;
 
-        // Load resources
-        ZygoteInit.nativePreloadGraphicsDriver();
-
         while (true) {
             try {
                 sessionSocket = usapPoolSocket.accept();
diff --git a/core/java/com/android/internal/policy/DecorView.java b/core/java/com/android/internal/policy/DecorView.java
index 2941a81..723f161 100644
--- a/core/java/com/android/internal/policy/DecorView.java
+++ b/core/java/com/android/internal/policy/DecorView.java
@@ -262,8 +262,10 @@
     private final int mResizeShadowSize;
     private final Paint mVerticalResizeShadowPaint = new Paint();
     private final Paint mHorizontalResizeShadowPaint = new Paint();
+    private final Paint mLegacyNavigationBarBackgroundPaint = new Paint();
     private Insets mBackgroundInsets = Insets.NONE;
     private Insets mLastBackgroundInsets = Insets.NONE;
+    private boolean mDrawLegacyNavigationBarBackground;
 
     DecorView(Context context, int featureId, PhoneWindow window,
             WindowManager.LayoutParams params) {
@@ -292,6 +294,8 @@
         mResizeShadowSize = context.getResources().getDimensionPixelSize(
                 R.dimen.resize_shadow_size);
         initResizingPaints();
+
+        mLegacyNavigationBarBackgroundPaint.setColor(Color.BLACK);
     }
 
     void setBackgroundFallback(@Nullable Drawable fallbackDrawable) {
@@ -1143,6 +1147,8 @@
                     navBarToRightEdge || navBarToLeftEdge, navBarToLeftEdge,
                     0 /* sideInset */, animate && !disallowAnimate,
                     mForceWindowDrawsBarBackgrounds);
+            mDrawLegacyNavigationBarBackground = mNavigationColorViewState.visible
+                    && (mWindow.getAttributes().flags & FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) == 0;
 
             boolean statusBarNeedsRightInset = navBarToRightEdge
                     && mNavigationColorViewState.present;
@@ -2310,6 +2316,7 @@
     @Override
     public void onPostDraw(RecordingCanvas canvas) {
         drawResizingShadowIfNeeded(canvas);
+        drawLegacyNavigationBarBackground(canvas);
     }
 
     private void initResizingPaints() {
@@ -2342,6 +2349,18 @@
         canvas.restore();
     }
 
+    private void drawLegacyNavigationBarBackground(RecordingCanvas canvas) {
+        if (!mDrawLegacyNavigationBarBackground) {
+            return;
+        }
+        View v = mNavigationColorViewState.view;
+        if (v == null) {
+            return;
+        }
+        canvas.drawRect(v.getLeft(), v.getTop(), v.getRight(), v.getBottom(),
+                mLegacyNavigationBarBackgroundPaint);
+    }
+
     /** Release the renderer thread which is usually done when the user stops resizing. */
     private void releaseThreadedRenderer() {
         if (mResizingBackgroundDrawable != null && mLastBackgroundDrawableCb != null) {
diff --git a/core/java/com/android/internal/widget/LockPatternUtils.java b/core/java/com/android/internal/widget/LockPatternUtils.java
index 07f8ee0..dc45f78 100644
--- a/core/java/com/android/internal/widget/LockPatternUtils.java
+++ b/core/java/com/android/internal/widget/LockPatternUtils.java
@@ -886,13 +886,13 @@
             return;
         }
 
+        // TODO(b/120484642): This is a location where we still use a String for vold
+        String passwordString = password != null ? new String(password) : null;
         new AsyncTask<Void, Void, Void>() {
             @Override
             protected Void doInBackground(Void... dummy) {
                 IStorageManager storageManager = IStorageManager.Stub.asInterface(service);
                 try {
-                    // TODO(b/120484642): This is a location where we still use a String for vold
-                    String passwordString = password != null ? new String(password) : null;
                     storageManager.changeEncryptionPassword(type, passwordString);
                 } catch (RemoteException e) {
                     Log.e(TAG, "Error changing encryption password", e);
diff --git a/core/proto/android/providers/settings/global.proto b/core/proto/android/providers/settings/global.proto
index 8f16b41..0070694 100644
--- a/core/proto/android/providers/settings/global.proto
+++ b/core/proto/android/providers/settings/global.proto
@@ -457,6 +457,9 @@
         optional SettingProto game_driver_sphal_libraries = 16;
         // ANGLE - External package containing ANGLE libraries
         optional SettingProto angle_debug_package = 17;
+        // Game Driver - List of Apps selected to use prerelease Game Driver
+        // i.e. <pkg1>,<pkg2>,...,<pkgN>
+        optional SettingProto game_driver_prerelease_opt_in_apps = 18;
     }
     optional Gpu gpu = 59;
 
diff --git a/core/tests/coretests/src/android/content/ContextTest.java b/core/tests/coretests/src/android/content/ContextTest.java
index 2f442c3..b1a54dc 100644
--- a/core/tests/coretests/src/android/content/ContextTest.java
+++ b/core/tests/coretests/src/android/content/ContextTest.java
@@ -19,6 +19,7 @@
 import static org.junit.Assert.assertEquals;
 
 import android.app.ActivityThread;
+import android.os.UserHandle;
 import android.view.WindowManager;
 
 import androidx.test.InstrumentationRegistry;
@@ -58,4 +59,32 @@
         assertEquals(defaultDisplayContext.getDisplay().getDisplayId(),
                 defaultDisplayContext.getDisplayId());
     }
+
+    @Test(expected = NullPointerException.class)
+    public void testStartActivityAsUserNullIntentNullUser() {
+        final Context testContext =
+                InstrumentationRegistry.getInstrumentation().getTargetContext();
+        testContext.startActivityAsUser(null, null);
+    }
+
+    @Test(expected = NullPointerException.class)
+    public void testStartActivityAsUserNullIntentNonNullUser() {
+        final Context testContext =
+                InstrumentationRegistry.getInstrumentation().getTargetContext();
+        testContext.startActivityAsUser(null, new UserHandle(UserHandle.USER_ALL));
+    }
+
+    @Test(expected = NullPointerException.class)
+    public void testStartActivityAsUserNonNullIntentNullUser() {
+        final Context testContext =
+                InstrumentationRegistry.getInstrumentation().getTargetContext();
+        testContext.startActivityAsUser(new Intent(), null);
+    }
+
+    @Test(expected = RuntimeException.class)
+    public void testStartActivityAsUserNonNullIntentNonNullUser() {
+        final Context testContext =
+                InstrumentationRegistry.getInstrumentation().getTargetContext();
+        testContext.startActivityAsUser(new Intent(), new UserHandle(UserHandle.USER_ALL));
+    }
 }
diff --git a/core/tests/coretests/src/android/provider/SettingsBackupTest.java b/core/tests/coretests/src/android/provider/SettingsBackupTest.java
index 9d58464..cd36ba7 100644
--- a/core/tests/coretests/src/android/provider/SettingsBackupTest.java
+++ b/core/tests/coretests/src/android/provider/SettingsBackupTest.java
@@ -397,9 +397,6 @@
                     Settings.Global.POWER_MANAGER_CONSTANTS,
                     Settings.Global.PREFERRED_NETWORK_MODE,
                     Settings.Global.PRIVATE_DNS_DEFAULT_MODE,
-                    Settings.Global.PRIVILEGED_DEVICE_IDENTIFIER_NON_PRIV_CHECK_RELAXED,
-                    Settings.Global.PRIVILEGED_DEVICE_IDENTIFIER_PRIV_CHECK_RELAXED,
-                    Settings.Global.PRIVILEGED_DEVICE_IDENTIFIER_3P_CHECK_RELAXED,
                     Settings.Global.PROVISIONING_APN_ALARM_DELAY_IN_MS,
                     Settings.Global.RADIO_BLUETOOTH,
                     Settings.Global.RADIO_CELL,
@@ -495,6 +492,7 @@
                     Settings.Global.GLOBAL_SETTINGS_ANGLE_WHITELIST,
                     Settings.Global.GAME_DRIVER_ALL_APPS,
                     Settings.Global.GAME_DRIVER_OPT_IN_APPS,
+                    Settings.Global.GAME_DRIVER_PRERELEASE_OPT_IN_APPS,
                     Settings.Global.GAME_DRIVER_OPT_OUT_APPS,
                     Settings.Global.GAME_DRIVER_BLACKLISTS,
                     Settings.Global.GAME_DRIVER_BLACKLIST,
diff --git a/libs/hwui/RenderNode.cpp b/libs/hwui/RenderNode.cpp
index e0ed3e4..b73347b 100644
--- a/libs/hwui/RenderNode.cpp
+++ b/libs/hwui/RenderNode.cpp
@@ -264,6 +264,12 @@
 }
 
 void RenderNode::pushStagingPropertiesChanges(TreeInfo& info) {
+    if (mPositionListenerDirty) {
+        mPositionListener = std::move(mStagingPositionListener);
+        mStagingPositionListener = nullptr;
+        mPositionListenerDirty = false;
+    }
+
     // Push the animators first so that setupStartValueIfNecessary() is called
     // before properties() is trampled by stagingProperties(), as they are
     // required by some animators.
diff --git a/libs/hwui/RenderNode.h b/libs/hwui/RenderNode.h
index 23e7a0e..c6db7f1 100644
--- a/libs/hwui/RenderNode.h
+++ b/libs/hwui/RenderNode.h
@@ -188,11 +188,9 @@
         virtual void onPositionLost(RenderNode& node, const TreeInfo* info) = 0;
     };
 
-    // Note this is not thread safe, this needs to be called
-    // before the RenderNode is used for drawing.
-    // RenderNode takes ownership of the pointer
     ANDROID_API void setPositionListener(PositionListener* listener) {
-        mPositionListener = listener;
+        mStagingPositionListener = listener;
+        mPositionListenerDirty = true;
     }
 
     // This is only modified in MODE_FULL, so it can be safely accessed
@@ -275,6 +273,8 @@
     // mDisplayList, not mStagingDisplayList.
     uint32_t mParentCount;
 
+    bool mPositionListenerDirty = false;
+    sp<PositionListener> mStagingPositionListener;
     sp<PositionListener> mPositionListener;
 
     UsageHint mUsageHint = UsageHint::Unknown;
diff --git a/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java b/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java
index 8373761..16b0125 100644
--- a/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java
+++ b/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java
@@ -63,6 +63,7 @@
 import com.android.systemui.classifier.FalsingLog;
 import com.android.systemui.classifier.FalsingManagerFactory;
 import com.android.systemui.fragments.FragmentHostManager;
+import com.android.systemui.keyguard.ScreenLifecycle;
 import com.android.systemui.plugins.qs.QS;
 import com.android.systemui.qs.car.CarQSFragment;
 import com.android.systemui.shared.system.ActivityManagerWrapper;
@@ -127,6 +128,7 @@
     private SwitchToGuestTimer mSwitchToGuestTimer;
     private NotificationDataManager mNotificationDataManager;
     private NotificationClickHandlerFactory mNotificationClickHandlerFactory;
+    private ScreenLifecycle mScreenLifecycle;
 
     // The container for the notifications.
     private CarNotificationView mNotificationView;
@@ -230,6 +232,9 @@
         mPowerManagerHelper.connectToCarService();
 
         mSwitchToGuestTimer = new SwitchToGuestTimer(mContext);
+
+        mScreenLifecycle = Dependency.get(ScreenLifecycle.class);
+        mScreenLifecycle.addObserver(mScreenObserver);
     }
 
     /**
@@ -315,7 +320,6 @@
     public void showKeyguard() {
         super.showKeyguard();
         updateNavBarForKeyguardContent();
-        dismissKeyguardWhenUserSwitcherNotDisplayed();
     }
 
     /**
@@ -978,6 +982,13 @@
         }
     }
 
+    final ScreenLifecycle.Observer mScreenObserver = new ScreenLifecycle.Observer() {
+        @Override
+        public void onScreenTurnedOn() {
+            dismissKeyguardWhenUserSwitcherNotDisplayed();
+        }
+    };
+
     // We automatically dismiss keyguard unless user switcher is being shown on the keyguard.
     private void dismissKeyguardWhenUserSwitcherNotDisplayed() {
         if (mFullscreenUserSwitcher == null) {
@@ -1000,6 +1011,10 @@
      * Dismisses the keyguard and shows bouncer if authentication is necessary.
      */
     public void dismissKeyguard() {
+        // Don't dismiss keyguard when the screen is off.
+        if (mScreenLifecycle.getScreenState() == ScreenLifecycle.SCREEN_OFF) {
+            return;
+        }
         executeRunnableDismissingKeyguard(null/* runnable */, null /* cancelAction */,
                 true /* dismissShade */, true /* afterKeyguardGone */, true /* deferred */);
     }
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java
index 636808e..3cd82df 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java
@@ -716,6 +716,9 @@
                 Settings.Global.GAME_DRIVER_OPT_IN_APPS,
                 GlobalSettingsProto.Gpu.GAME_DRIVER_OPT_IN_APPS);
         dumpSetting(s, p,
+                Settings.Global.GAME_DRIVER_PRERELEASE_OPT_IN_APPS,
+                GlobalSettingsProto.Gpu.GAME_DRIVER_PRERELEASE_OPT_IN_APPS);
+        dumpSetting(s, p,
                 Settings.Global.GAME_DRIVER_OPT_OUT_APPS,
                 GlobalSettingsProto.Gpu.GAME_DRIVER_OPT_OUT_APPS);
         dumpSetting(s, p,
diff --git a/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java b/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java
index 7d36469..eff7054 100644
--- a/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java
+++ b/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java
@@ -64,6 +64,7 @@
 import android.view.ViewGroup.LayoutParams;
 import android.view.ViewTreeObserver;
 import android.view.WindowManager;
+import android.view.animation.AccelerateInterpolator;
 import android.view.animation.Interpolator;
 import android.view.animation.PathInterpolator;
 import android.widget.FrameLayout;
@@ -231,7 +232,10 @@
             anim.start();
         } else {
             view.animate().cancel();
-            view.animate().setDuration(400).alpha(0f);
+            view.animate()
+                    .setInterpolator(new AccelerateInterpolator(1.5f))
+                    .setDuration(250)
+                    .alpha(0f);
         }
 
     }
diff --git a/packages/SystemUI/src/com/android/systemui/doze/DozeSensors.java b/packages/SystemUI/src/com/android/systemui/doze/DozeSensors.java
index 831d074..5f52486 100644
--- a/packages/SystemUI/src/com/android/systemui/doze/DozeSensors.java
+++ b/packages/SystemUI/src/com/android/systemui/doze/DozeSensors.java
@@ -70,11 +70,12 @@
     private final Consumer<Boolean> mProxCallback;
     private final Callback mCallback;
     @VisibleForTesting
-    protected final TriggerSensor[] mSensors;
+    protected TriggerSensor[] mSensors;
 
     private final Handler mHandler = new Handler();
     private final ProxSensor mProxSensor;
     private long mDebounceFrom;
+    private boolean mSettingRegistered;
 
     public DozeSensors(Context context, AlarmManager alarmManager, SensorManager sensorManager,
             DozeParameters dozeParameters, AmbientDisplayConfiguration config, WakeLock wakeLock,
@@ -172,13 +173,8 @@
     public void setListening(boolean listen) {
         for (TriggerSensor s : mSensors) {
             s.setListening(listen);
-            if (listen) {
-                s.registerSettingsObserver(mSettingsObserver);
-            }
         }
-        if (!listen) {
-            mResolver.unregisterContentObserver(mSettingsObserver);
-        }
+        registerSettingsObserverIfNeeded(listen);
     }
 
     /** Set the listening state of only the sensors that require the touchscreen. */
@@ -240,6 +236,17 @@
         return mProxSensor.mCurrentlyFar;
     }
 
+    private void registerSettingsObserverIfNeeded(boolean register) {
+        if (!register) {
+            mResolver.unregisterContentObserver(mSettingsObserver);
+        } else if (!mSettingRegistered) {
+            for (TriggerSensor s : mSensors) {
+                s.registerSettingsObserver(mSettingsObserver);
+            }
+        }
+        mSettingRegistered = register;
+    }
+
     private class ProxSensor implements SensorEventListener {
 
         boolean mRequested;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java
index 95eaf4f..c214431 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java
@@ -20,7 +20,7 @@
 import static com.android.systemui.statusbar.notification.ActivityLaunchAnimator.ExpandAnimationParameters;
 import static com.android.systemui.statusbar.notification.stack.StackScrollAlgorithm.ANCHOR_SCROLLING;
 import static com.android.systemui.statusbar.notification.stack.StackStateAnimator.ANIMATION_DURATION_SWIPE;
-import static com.android.systemui.statusbar.phone.NotificationIconAreaController.LOW_PRIORITY;
+import static com.android.systemui.statusbar.phone.NotificationIconAreaController.HIGH_PRIORITY;
 import static com.android.systemui.util.InjectionInflationController.VIEW_CONTEXT;
 
 import static java.lang.annotation.RetentionPolicy.SOURCE;
@@ -187,7 +187,7 @@
     private int mCurrentStackHeight = Integer.MAX_VALUE;
     private final Paint mBackgroundPaint = new Paint();
     private final boolean mShouldDrawNotificationBackground;
-    private boolean mLowPriorityBeforeSpeedBump;
+    private boolean mHighPriorityBeforeSpeedBump;
     private final boolean mAllowLongPress;
     private boolean mDismissRtl;
 
@@ -584,12 +584,12 @@
 
         TunerService tunerService = Dependency.get(TunerService.class);
         tunerService.addTunable((key, newValue) -> {
-            if (key.equals(LOW_PRIORITY)) {
-                mLowPriorityBeforeSpeedBump = "1".equals(newValue);
+            if (key.equals(HIGH_PRIORITY)) {
+                mHighPriorityBeforeSpeedBump = "1".equals(newValue);
             } else if (key.equals(Settings.Secure.NOTIFICATION_DISMISS_RTL)) {
                 updateDismissRtlSetting("1".equals(newValue));
             }
-        }, LOW_PRIORITY, Settings.Secure.NOTIFICATION_DISMISS_RTL);
+        }, HIGH_PRIORITY, Settings.Secure.NOTIFICATION_DISMISS_RTL);
 
         mEntryManager.addNotificationEntryListener(new NotificationEntryListener() {
             @Override
@@ -5757,10 +5757,10 @@
             ExpandableNotificationRow row = (ExpandableNotificationRow) view;
             currentIndex++;
             boolean beforeSpeedBump;
-            if (mLowPriorityBeforeSpeedBump) {
-                beforeSpeedBump = !row.getEntry().ambient;
-            } else {
+            if (mHighPriorityBeforeSpeedBump) {
                 beforeSpeedBump = row.getEntry().isHighPriority();
+            } else {
+                beforeSpeedBump = !row.getEntry().ambient;
             }
             if (beforeSpeedBump) {
                 speedBumpIndex = currentIndex;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java
index 501e597..98505cf 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java
@@ -41,7 +41,7 @@
 public class NotificationIconAreaController implements DarkReceiver,
         StatusBarStateController.StateListener {
 
-    public static final String LOW_PRIORITY = "low_priority";
+    public static final String HIGH_PRIORITY = "high_priority";
 
     private final ContrastColorUtil mContrastColorUtil;
     private final NotificationEntryManager mEntryManager;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/doze/DozeSensorsTest.java b/packages/SystemUI/tests/src/com/android/systemui/doze/DozeSensorsTest.java
index 4467faf..3304291 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/doze/DozeSensorsTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/doze/DozeSensorsTest.java
@@ -27,10 +27,12 @@
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.never;
 import static org.mockito.Mockito.reset;
+import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
 import android.app.AlarmManager;
+import android.database.ContentObserver;
 import android.hardware.display.AmbientDisplayConfiguration;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper;
@@ -39,6 +41,7 @@
 import androidx.test.filters.SmallTest;
 
 import com.android.systemui.SysuiTestCase;
+import com.android.systemui.doze.DozeSensors.TriggerSensor;
 import com.android.systemui.plugins.SensorManagerPlugin;
 import com.android.systemui.statusbar.phone.DozeParameters;
 import com.android.systemui.util.AsyncSensorManager;
@@ -73,6 +76,8 @@
     private Consumer<Boolean> mProxCallback;
     @Mock
     private AlwaysOnDisplayPolicy mAlwaysOnDisplayPolicy;
+    @Mock
+    private TriggerSensor mMockTriggerSensor;
     private SensorManagerPlugin.SensorEventListener mWakeLockScreenListener;
     private TestableLooper mTestableLooper;
     private DozeSensors mDozeSensors;
@@ -107,6 +112,25 @@
                 anyBoolean(), anyFloat(), anyFloat(), eq(null));
     }
 
+    @Test
+    public void testSetListening_firstTrue_registerSettingsObserver() {
+        mDozeSensors.mSensors = new TriggerSensor[] {mMockTriggerSensor};
+
+        mDozeSensors.setListening(true);
+
+        verify(mMockTriggerSensor).registerSettingsObserver(any(ContentObserver.class));
+    }
+
+    @Test
+    public void testSetListening_twiceTrue_onlyRegisterSettingsObserverOnce() {
+        mDozeSensors.mSensors = new TriggerSensor[] {mMockTriggerSensor};
+        mDozeSensors.setListening(true);
+
+        mDozeSensors.setListening(true);
+
+        verify(mMockTriggerSensor, times(1)).registerSettingsObserver(any(ContentObserver.class));
+    }
+
     private class TestableDozeSensors extends DozeSensors {
 
         TestableDozeSensors() {
diff --git a/packages/overlays/NavigationBarModeGesturalOverlay/res/values/dimens.xml b/packages/overlays/NavigationBarModeGesturalOverlay/res/values/dimens.xml
index 1232201..ac1f022 100644
--- a/packages/overlays/NavigationBarModeGesturalOverlay/res/values/dimens.xml
+++ b/packages/overlays/NavigationBarModeGesturalOverlay/res/values/dimens.xml
@@ -25,6 +25,6 @@
     <dimen name="navigation_bar_width">16dp</dimen>
     <!-- Height of the bottom navigation / system bar. -->
     <dimen name="navigation_bar_frame_height">48dp</dimen>
-        <!-- The height of the bottom navigation gesture area. -->
+    <!-- The height of the bottom navigation gesture area. -->
     <dimen name="navigation_bar_gesture_height">32dp</dimen>
 </resources>
\ No newline at end of file
diff --git a/packages/overlays/NavigationBarModeGesturalOverlayExtraWideBack/res/values/config.xml b/packages/overlays/NavigationBarModeGesturalOverlayExtraWideBack/res/values/config.xml
index c8f994c..d5991f3 100644
--- a/packages/overlays/NavigationBarModeGesturalOverlayExtraWideBack/res/values/config.xml
+++ b/packages/overlays/NavigationBarModeGesturalOverlayExtraWideBack/res/values/config.xml
@@ -37,6 +37,15 @@
      {@link Window#setEnsuringNavigationBarContrastWhenTransparent}. -->
     <bool name="config_navBarNeedsScrim">false</bool>
 
+    <!-- Controls the opacity of the navigation bar depending on the visibility of the
+     various workspace stacks.
+     0 - Nav bar is always opaque when either the freeform stack or docked stack is visible.
+     1 - Nav bar is always translucent when the freeform stack is visible, otherwise always
+         opaque.
+     2 - Nav bar is never forced opaque.
+     -->
+    <integer name="config_navBarOpacityMode">2</integer>
+
     <!-- Controls whether seamless rotation should be allowed even though the navbar can move
          (which normally prevents seamless rotation). -->
     <bool name="config_allowSeamlessRotationDespiteNavBarMoving">true</bool>
diff --git a/packages/overlays/NavigationBarModeGesturalOverlayExtraWideBack/res/values/dimens.xml b/packages/overlays/NavigationBarModeGesturalOverlayExtraWideBack/res/values/dimens.xml
index 987d203..ac1f022 100644
--- a/packages/overlays/NavigationBarModeGesturalOverlayExtraWideBack/res/values/dimens.xml
+++ b/packages/overlays/NavigationBarModeGesturalOverlayExtraWideBack/res/values/dimens.xml
@@ -25,4 +25,6 @@
     <dimen name="navigation_bar_width">16dp</dimen>
     <!-- Height of the bottom navigation / system bar. -->
     <dimen name="navigation_bar_frame_height">48dp</dimen>
+    <!-- The height of the bottom navigation gesture area. -->
+    <dimen name="navigation_bar_gesture_height">32dp</dimen>
 </resources>
\ No newline at end of file
diff --git a/packages/overlays/NavigationBarModeGesturalOverlayNarrowBack/res/values/config.xml b/packages/overlays/NavigationBarModeGesturalOverlayNarrowBack/res/values/config.xml
index 693110a..ff507ee 100644
--- a/packages/overlays/NavigationBarModeGesturalOverlayNarrowBack/res/values/config.xml
+++ b/packages/overlays/NavigationBarModeGesturalOverlayNarrowBack/res/values/config.xml
@@ -37,6 +37,15 @@
      {@link Window#setEnsuringNavigationBarContrastWhenTransparent}. -->
     <bool name="config_navBarNeedsScrim">false</bool>
 
+    <!-- Controls the opacity of the navigation bar depending on the visibility of the
+     various workspace stacks.
+     0 - Nav bar is always opaque when either the freeform stack or docked stack is visible.
+     1 - Nav bar is always translucent when the freeform stack is visible, otherwise always
+         opaque.
+     2 - Nav bar is never forced opaque.
+     -->
+    <integer name="config_navBarOpacityMode">2</integer>
+
     <!-- Controls whether seamless rotation should be allowed even though the navbar can move
          (which normally prevents seamless rotation). -->
     <bool name="config_allowSeamlessRotationDespiteNavBarMoving">true</bool>
diff --git a/packages/overlays/NavigationBarModeGesturalOverlayNarrowBack/res/values/dimens.xml b/packages/overlays/NavigationBarModeGesturalOverlayNarrowBack/res/values/dimens.xml
index 987d203..ac1f022 100644
--- a/packages/overlays/NavigationBarModeGesturalOverlayNarrowBack/res/values/dimens.xml
+++ b/packages/overlays/NavigationBarModeGesturalOverlayNarrowBack/res/values/dimens.xml
@@ -25,4 +25,6 @@
     <dimen name="navigation_bar_width">16dp</dimen>
     <!-- Height of the bottom navigation / system bar. -->
     <dimen name="navigation_bar_frame_height">48dp</dimen>
+    <!-- The height of the bottom navigation gesture area. -->
+    <dimen name="navigation_bar_gesture_height">32dp</dimen>
 </resources>
\ No newline at end of file
diff --git a/packages/overlays/NavigationBarModeGesturalOverlayWideBack/res/values/config.xml b/packages/overlays/NavigationBarModeGesturalOverlayWideBack/res/values/config.xml
index 5cd6ce3..378756a 100644
--- a/packages/overlays/NavigationBarModeGesturalOverlayWideBack/res/values/config.xml
+++ b/packages/overlays/NavigationBarModeGesturalOverlayWideBack/res/values/config.xml
@@ -37,6 +37,15 @@
      {@link Window#setEnsuringNavigationBarContrastWhenTransparent}. -->
     <bool name="config_navBarNeedsScrim">false</bool>
 
+    <!-- Controls the opacity of the navigation bar depending on the visibility of the
+     various workspace stacks.
+     0 - Nav bar is always opaque when either the freeform stack or docked stack is visible.
+     1 - Nav bar is always translucent when the freeform stack is visible, otherwise always
+         opaque.
+     2 - Nav bar is never forced opaque.
+     -->
+    <integer name="config_navBarOpacityMode">2</integer>
+
     <!-- Controls whether seamless rotation should be allowed even though the navbar can move
          (which normally prevents seamless rotation). -->
     <bool name="config_allowSeamlessRotationDespiteNavBarMoving">true</bool>
diff --git a/packages/overlays/NavigationBarModeGesturalOverlayWideBack/res/values/dimens.xml b/packages/overlays/NavigationBarModeGesturalOverlayWideBack/res/values/dimens.xml
index 987d203..ac1f022 100644
--- a/packages/overlays/NavigationBarModeGesturalOverlayWideBack/res/values/dimens.xml
+++ b/packages/overlays/NavigationBarModeGesturalOverlayWideBack/res/values/dimens.xml
@@ -25,4 +25,6 @@
     <dimen name="navigation_bar_width">16dp</dimen>
     <!-- Height of the bottom navigation / system bar. -->
     <dimen name="navigation_bar_frame_height">48dp</dimen>
+    <!-- The height of the bottom navigation gesture area. -->
+    <dimen name="navigation_bar_gesture_height">32dp</dimen>
 </resources>
\ No newline at end of file
diff --git a/services/core/java/com/android/server/StorageManagerService.java b/services/core/java/com/android/server/StorageManagerService.java
index d2b992b..deff7ef 100644
--- a/services/core/java/com/android/server/StorageManagerService.java
+++ b/services/core/java/com/android/server/StorageManagerService.java
@@ -580,6 +580,7 @@
     private static final int H_RUN_IDLE_MAINT = 11;
     private static final int H_ABORT_IDLE_MAINT = 12;
     private static final int H_BOOT_COMPLETED = 13;
+    private static final int H_COMPLETE_UNLOCK_USER = 14;
 
     class StorageManagerServiceHandler extends Handler {
         public StorageManagerServiceHandler(Looper looper) {
@@ -698,7 +699,10 @@
                     abortIdleMaint((Runnable)msg.obj);
                     break;
                 }
-
+                case H_COMPLETE_UNLOCK_USER: {
+                    completeUnlockUser((int) msg.obj);
+                    break;
+                }
             }
         }
     }
@@ -978,6 +982,17 @@
             Slog.wtf(TAG, e);
         }
 
+        mHandler.obtainMessage(H_COMPLETE_UNLOCK_USER, userId).sendToTarget();
+    }
+
+    private void completeUnlockUser(int userId) {
+        // If user 0 has completed unlock, perform a one-time migration of legacy obb data
+        // to its new location. This may take time depending on the size of the data to be copied
+        // so it's done on the StorageManager handler thread.
+        if (userId == 0) {
+            mPmInternal.migrateLegacyObbData();
+        }
+
         // Record user as started so newly mounted volumes kick off events
         // correctly, then synthesize events for any already-mounted volumes.
         synchronized (mLock) {
@@ -2820,6 +2835,12 @@
         }
     }
 
+    private boolean isSystemUnlocked(int userId) {
+        synchronized (mLock) {
+            return ArrayUtils.contains(mSystemUnlockedUsers, userId);
+        }
+    }
+
     @Override
     public void prepareUserStorage(String volumeUuid, int userId, int serialNumber, int flags) {
         enforcePermission(android.Manifest.permission.STORAGE_INTERNAL);
@@ -2996,6 +3017,11 @@
         final boolean realState = (flags & StorageManager.FLAG_REAL_STATE) != 0;
         final boolean includeInvisible = (flags & StorageManager.FLAG_INCLUDE_INVISIBLE) != 0;
 
+        // Report all volumes as unmounted until we've recorded that user 0 has unlocked. There
+        // are no guarantees that callers will see a consistent view of the volume before that
+        // point
+        final boolean systemUserUnlocked = isSystemUnlocked(UserHandle.USER_SYSTEM);
+
         final boolean userKeyUnlocked;
         final boolean storagePermission;
         final long token = Binder.clearCallingIdentity();
@@ -3031,7 +3057,9 @@
                 if (!match) continue;
 
                 boolean reportUnmounted = false;
-                if ((vol.getType() == VolumeInfo.TYPE_EMULATED) && !userKeyUnlocked) {
+                if (!systemUserUnlocked) {
+                    reportUnmounted = true;
+                } else if ((vol.getType() == VolumeInfo.TYPE_EMULATED) && !userKeyUnlocked) {
                     reportUnmounted = true;
                 } else if (!storagePermission && !realState) {
                     reportUnmounted = true;
diff --git a/services/core/java/com/android/server/am/CoreSettingsObserver.java b/services/core/java/com/android/server/am/CoreSettingsObserver.java
index b053d84..aa8bc04 100644
--- a/services/core/java/com/android/server/am/CoreSettingsObserver.java
+++ b/services/core/java/com/android/server/am/CoreSettingsObserver.java
@@ -76,6 +76,8 @@
         sGlobalSettingToTypeMap.put(Settings.Global.GPU_DEBUG_LAYER_APP, String.class);
         sGlobalSettingToTypeMap.put(Settings.Global.GAME_DRIVER_ALL_APPS, int.class);
         sGlobalSettingToTypeMap.put(Settings.Global.GAME_DRIVER_OPT_IN_APPS, String.class);
+        sGlobalSettingToTypeMap.put(
+                Settings.Global.GAME_DRIVER_PRERELEASE_OPT_IN_APPS, String.class);
         sGlobalSettingToTypeMap.put(Settings.Global.GAME_DRIVER_OPT_OUT_APPS, String.class);
         sGlobalSettingToTypeMap.put(Settings.Global.GAME_DRIVER_BLACKLIST, String.class);
         sGlobalSettingToTypeMap.put(Settings.Global.GAME_DRIVER_WHITELIST, String.class);
diff --git a/services/core/java/com/android/server/am/ProcessList.java b/services/core/java/com/android/server/am/ProcessList.java
index 943fe75..d64a2c2 100644
--- a/services/core/java/com/android/server/am/ProcessList.java
+++ b/services/core/java/com/android/server/am/ProcessList.java
@@ -63,7 +63,6 @@
 import android.os.Binder;
 import android.os.Build;
 import android.os.Bundle;
-import android.os.GraphicsEnvironment;
 import android.os.Handler;
 import android.os.IBinder;
 import android.os.Looper;
@@ -705,16 +704,6 @@
         return prefix + "+" + Integer.toString(diff);
     }
 
-    private static boolean shouldUseSystemGraphicsDriver(Context context, Bundle coreSettings,
-            ApplicationInfo applicationInfo) {
-        final boolean shouldUseGameDriver =
-                GraphicsEnvironment.shouldUseGameDriver(context, coreSettings, applicationInfo);
-        final boolean shouldUseAngle =
-                GraphicsEnvironment.shouldUseAngle(context, coreSettings,
-                    applicationInfo.packageName);
-        return !shouldUseGameDriver && !shouldUseAngle;
-    }
-
     public static String makeOomAdjString(int setAdj, boolean compact) {
         if (setAdj >= ProcessList.CACHED_APP_MIN_ADJ) {
             return buildOomTag("cch", "cch", "   ", setAdj,
@@ -1811,8 +1800,6 @@
             String seInfo, String requiredAbi, String instructionSet, String invokeWith,
             long startTime) {
         try {
-            final boolean useSystemGraphicsDriver = shouldUseSystemGraphicsDriver(mService.mContext,
-                    mService.mCoreSettingsObserver.getCoreSettingsLocked(), app.info);
             Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "Start proc: " +
                     app.processName);
             checkSlow(startTime, "startProcess: asking zygote to start proc");
@@ -1822,7 +1809,6 @@
                         app.processName, uid, uid, gids, runtimeFlags, mountExternal,
                         app.info.targetSdkVersion, seInfo, requiredAbi, instructionSet,
                         app.info.dataDir, null, app.info.packageName,
-                        useSystemGraphicsDriver,
                         new String[] {PROC_START_SEQ_IDENT + app.startSeq});
             } else if (hostingRecord.usesAppZygote()) {
                 final AppZygote appZygote = createAppZygoteForProcessIfNeeded(app);
@@ -1831,14 +1817,13 @@
                         app.processName, uid, uid, gids, runtimeFlags, mountExternal,
                         app.info.targetSdkVersion, seInfo, requiredAbi, instructionSet,
                         app.info.dataDir, null, app.info.packageName,
-                        /*useUsapPool=*/ false, useSystemGraphicsDriver,
+                        /*useUsapPool=*/ false,
                         new String[] {PROC_START_SEQ_IDENT + app.startSeq});
             } else {
                 startResult = Process.start(entryPoint,
                         app.processName, uid, uid, gids, runtimeFlags, mountExternal,
                         app.info.targetSdkVersion, seInfo, requiredAbi, instructionSet,
                         app.info.dataDir, invokeWith, app.info.packageName,
-                        useSystemGraphicsDriver,
                         new String[] {PROC_START_SEQ_IDENT + app.startSeq});
             }
             checkSlow(startTime, "startProcess: returned from zygote!");
diff --git a/services/core/java/com/android/server/job/JobServiceContext.java b/services/core/java/com/android/server/job/JobServiceContext.java
index 7689bd2..65dac8b 100644
--- a/services/core/java/com/android/server/job/JobServiceContext.java
+++ b/services/core/java/com/android/server/job/JobServiceContext.java
@@ -247,10 +247,20 @@
             mVerb = VERB_BINDING;
             scheduleOpTimeOutLocked();
             final Intent intent = new Intent().setComponent(job.getServiceComponent());
-            boolean binding = mContext.bindServiceAsUser(intent, this,
-                    Context.BIND_AUTO_CREATE | Context.BIND_NOT_FOREGROUND
-                    | Context.BIND_NOT_VISIBLE | Context.BIND_ADJUST_BELOW_PERCEPTIBLE,
-                    new UserHandle(job.getUserId()));
+            boolean binding = false;
+            try {
+                binding = mContext.bindServiceAsUser(intent, this,
+                        Context.BIND_AUTO_CREATE | Context.BIND_NOT_FOREGROUND
+                        | Context.BIND_NOT_VISIBLE | Context.BIND_ADJUST_BELOW_PERCEPTIBLE,
+                        new UserHandle(job.getUserId()));
+            } catch (SecurityException e) {
+                // Some permission policy, for example INTERACT_ACROSS_USERS and
+                // android:singleUser, can result in a SecurityException being thrown from
+                // bindServiceAsUser().  If this happens, catch it and fail gracefully.
+                Slog.w(TAG, "Job service " + job.getServiceComponent().getShortClassName()
+                        + " cannot be executed: " + e.getMessage());
+                binding = false;
+            }
             if (!binding) {
                 if (DEBUG) {
                     Slog.d(TAG, job.getServiceComponent().getShortClassName() + " unavailable.");
diff --git a/services/core/java/com/android/server/location/GnssLocationProvider.java b/services/core/java/com/android/server/location/GnssLocationProvider.java
index f28bce5..e7636ae 100644
--- a/services/core/java/com/android/server/location/GnssLocationProvider.java
+++ b/services/core/java/com/android/server/location/GnssLocationProvider.java
@@ -937,7 +937,7 @@
             mGnssNavigationMessageProvider.onGpsEnabledChanged();
             mGnssBatchingProvider.enable();
             if (mGnssVisibilityControl != null) {
-                mGnssVisibilityControl.onGpsEnabledChanged(/* isEnabled= */true);
+                mGnssVisibilityControl.onGpsEnabledChanged(/* isEnabled= */ true);
             }
         } else {
             setGpsEnabled(false);
diff --git a/services/core/java/com/android/server/location/GnssVisibilityControl.java b/services/core/java/com/android/server/location/GnssVisibilityControl.java
index 3ee9419..ea4f9c4 100644
--- a/services/core/java/com/android/server/location/GnssVisibilityControl.java
+++ b/services/core/java/com/android/server/location/GnssVisibilityControl.java
@@ -151,7 +151,6 @@
     }
 
     private void handleInitialize() {
-        disableNfwLocationAccess(); // Disable until config properties are loaded.
         listenForProxyAppsPackageUpdates();
     }
 
@@ -261,25 +260,21 @@
         return false;
     }
 
-    private void handleGpsEnabledChanged(boolean isEnabled) {
-        if (DEBUG) Log.d(TAG, "handleGpsEnabledChanged, isEnabled: " + isEnabled);
-
-        if (mIsGpsEnabled == isEnabled) {
-            return;
+    private void handleGpsEnabledChanged(boolean isGpsEnabled) {
+        if (DEBUG) {
+            Log.d(TAG, "handleGpsEnabledChanged, mIsGpsEnabled: " + mIsGpsEnabled
+                    + ", isGpsEnabled: " + isGpsEnabled);
         }
 
-        mIsGpsEnabled = isEnabled;
+        // The proxy app list in the GNSS HAL needs to be configured if it restarts after
+        // a crash. So, update HAL irrespective of the previous GPS enabled state.
+        mIsGpsEnabled = isGpsEnabled;
         if (!mIsGpsEnabled) {
             disableNfwLocationAccess();
             return;
         }
 
-        // When GNSS was disabled, we already set the proxy app list to empty in GNSS HAL.
-        // Update only if the proxy app list is not empty.
-        String[] locationPermissionEnabledProxyApps = getLocationPermissionEnabledProxyApps();
-        if (locationPermissionEnabledProxyApps.length != 0) {
-            setNfwLocationAccessProxyAppsInGnssHal(locationPermissionEnabledProxyApps);
-        }
+        setNfwLocationAccessProxyAppsInGnssHal(getLocationPermissionEnabledProxyApps());
     }
 
     private void disableNfwLocationAccess() {
diff --git a/services/core/java/com/android/server/om/IdmapManager.java b/services/core/java/com/android/server/om/IdmapManager.java
index 4b435de..b604aa8 100644
--- a/services/core/java/com/android/server/om/IdmapManager.java
+++ b/services/core/java/com/android/server/om/IdmapManager.java
@@ -58,9 +58,16 @@
 
     private static final boolean VENDOR_IS_Q_OR_LATER;
     static {
-        // STOPSHIP(b/119390857): Check api version once Q sdk version is finalized
-        final String value = SystemProperties.get("ro.vndk.version", "Q");
-        VENDOR_IS_Q_OR_LATER = value.equals("Q") || value.equals("q");
+        final String value = SystemProperties.get("ro.vndk.version", "29");
+        boolean isQOrLater;
+        try {
+            isQOrLater = Integer.parseInt(value) >= 29;
+        } catch (NumberFormatException e) {
+            // The version is not a number, therefore it is a development codename.
+            isQOrLater = true;
+        }
+
+        VENDOR_IS_Q_OR_LATER = isQOrLater;
     }
 
     IdmapManager(final Installer installer, final PackageManagerHelper packageManager) {
diff --git a/services/core/java/com/android/server/pm/Installer.java b/services/core/java/com/android/server/pm/Installer.java
index c2d5b2f8..adcd19e 100644
--- a/services/core/java/com/android/server/pm/Installer.java
+++ b/services/core/java/com/android/server/pm/Installer.java
@@ -121,24 +121,6 @@
         }
     }
 
-    @Override
-    public void onUnlockUser(int userId) {
-        if (userId == 0) {
-            if (!checkBeforeRemote()) return;
-
-            if (mInstalld == null) {
-                Slog.wtf(TAG, "Call to onUnlockUser prior to onStart.");
-                return;
-            }
-
-            try {
-                mInstalld.migrateLegacyObbData();
-            } catch (RemoteException re) {
-                Slog.wtf(TAG, "Error migrating legacy OBB data.", re);
-            }
-        }
-    }
-
     private void connect() {
         IBinder binder = ServiceManager.getService("installd");
         if (binder != null) {
@@ -708,6 +690,24 @@
         }
     }
 
+    /**
+     * Migrates obb data from its legacy location {@code /data/media/obb} to
+     * {@code /data/media/0/Android/obb}. This call is idempotent and a fast no-op if data has
+     * already been migrated.
+     *
+     * @throws InstallerException if an error occurs.
+     */
+    public boolean migrateLegacyObbData() throws InstallerException {
+        if (!checkBeforeRemote()) return false;
+
+        try {
+            mInstalld.migrateLegacyObbData();
+            return true;
+        } catch (Exception e) {
+            throw InstallerException.from(e);
+        }
+    }
+
     private static void assertValidInstructionSet(String instructionSet)
             throws InstallerException {
         for (String abi : Build.SUPPORTED_ABIS) {
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java
index 7d5393d..4d84048 100644
--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -5643,27 +5643,6 @@
             for (int i = 0; pkg == null && i < N; i++) {
                 pkg = mPackages.get(packageNames[i]);
             }
-            // Additional logs for b/111075456; ignore system UIDs
-            if (pkg == null && UserHandle.getAppId(uid) >= Process.FIRST_APPLICATION_UID) {
-                if (packageNames == null || packageNames.length < 2) {
-                    // unclear if this is shared user or just a missing application
-                    Log.e(TAG, "Failed to find package"
-                            + "; permName: " + permName
-                            + ", uid: " + uid
-                            + ", caller: " + Binder.getCallingUid(),
-                            new Throwable());
-                } else {
-                    // definitely shared user
-                    Log.e(TAG, "Failed to find package"
-                            + "; permName: " + permName
-                            + ", uid: " + uid
-                            + ", caller: " + Binder.getCallingUid()
-                            + ", packages: " + Arrays.toString(packageNames),
-                            new Throwable());
-                }
-                // run again just to try to get debug output
-                getPackagesForUid_debug(uid, true);
-            }
             return mPermissionManager.checkUidPermission(permName, pkg, uid, getCallingUid());
         }
     }
@@ -6391,25 +6370,15 @@
      */
     @Override
     public String[] getPackagesForUid(int uid) {
-        return getPackagesForUid_debug(uid, false);
-    }
-    // Debug output for b/111075456
-    private String[] getPackagesForUid_debug(int uid, boolean debug) {
         final int callingUid = Binder.getCallingUid();
         final boolean isCallerInstantApp = getInstantAppPackageName(callingUid) != null;
         final int userId = UserHandle.getUserId(uid);
         final int appId = UserHandle.getAppId(uid);
-        if (debug) Slog.e(TAG, "Finding packages for UID"
-                + "; uid: " + uid
-                + ", userId: " + userId
-                + ", appId: " + appId
-                + ", caller: " + callingUid);
         // reader
         synchronized (mPackages) {
             final Object obj = mSettings.getSettingLPr(appId);
             if (obj instanceof SharedUserSetting) {
                 if (isCallerInstantApp) {
-                    if (debug) Slog.e(TAG, "Caller is instant and package has shared users");
                     return null;
                 }
                 final SharedUserSetting sus = (SharedUserSetting) obj;
@@ -6417,13 +6386,8 @@
                 String[] res = new String[N];
                 final Iterator<PackageSetting> it = sus.packages.iterator();
                 int i = 0;
-                if (debug && !it.hasNext()) Slog.e(TAG, "Shared user, but, no packages");
                 while (it.hasNext()) {
                     PackageSetting ps = it.next();
-                    if (debug) Slog.e(TAG, "Check shared package"
-                            + "; installed? " + ps.getInstalled(userId)
-                            + ", shared setting: " + ps
-                            + ", package setting: " + mSettings.mPackages.get(ps.name));
                     if (ps.getInstalled(userId)) {
                         res[i++] = ps.name;
                     } else {
@@ -6436,12 +6400,6 @@
                 if (ps.getInstalled(userId) && !filterAppAccessLPr(ps, callingUid, userId)) {
                     return new String[]{ps.name};
                 }
-                if (debug) Slog.e(TAG, "Removing normal package"
-                        + "; installed? " + ps.getInstalled(userId)
-                        + ", filtered? " + filterAppAccessLPr(ps, callingUid, userId));
-            } else if (debug) {
-                if (debug) Slog.e(TAG, "No setting found"
-                        + "; obj: " + (obj == null ? "<<NULL>>" : obj.toString()));
             }
         }
         return null;
@@ -24963,6 +24921,15 @@
                 mSettings.setRuntimePermissionsFingerPrintLPr(fingerPrint, userId);
             }
         }
+
+        @Override
+        public void migrateLegacyObbData() {
+            try {
+                mInstaller.migrateLegacyObbData();
+            } catch (Exception e) {
+                Slog.wtf(TAG, e);
+            }
+        }
     }
 
     @GuardedBy("mPackages")
diff --git a/services/core/java/com/android/server/policy/PermissionPolicyService.java b/services/core/java/com/android/server/policy/PermissionPolicyService.java
index 1d01a84..6882afb 100644
--- a/services/core/java/com/android/server/policy/PermissionPolicyService.java
+++ b/services/core/java/com/android/server/policy/PermissionPolicyService.java
@@ -19,6 +19,7 @@
 import static android.app.AppOpsManager.MODE_ALLOWED;
 import static android.app.AppOpsManager.MODE_DEFAULT;
 import static android.app.AppOpsManager.MODE_ERRORED;
+import static android.app.AppOpsManager.MODE_FOREGROUND;
 import static android.app.AppOpsManager.MODE_IGNORED;
 import static android.app.AppOpsManager.OP_NONE;
 import static android.content.pm.PackageManager.FLAG_PERMISSION_APPLY_RESTRICTION;
@@ -290,7 +291,7 @@
          *
          * Currently, only used by the restricted permissions logic.
          *
-         * @see #syncRestrictedOps
+         * @see #syncPackages
          */
         private final @NonNull ArrayList<OpToRestrict> mOpsToDefault = new ArrayList<>();
 
@@ -299,16 +300,14 @@
          *
          * Currently, only used by the restricted permissions logic.
          *
-         * @see #syncRestrictedOps
+         * @see #syncPackages
          */
         private final @NonNull ArrayList<OpToUnrestrict> mOpsToAllowIfDefault = new ArrayList<>();
 
         /**
          * All ops that need to be flipped to allow.
          *
-         * Currently, only used by the restricted permissions logic.
-         *
-         * @see #syncRestrictedOps
+         * @see #syncPackages
          */
         private final @NonNull ArrayList<OpToUnrestrict> mOpsToAllow = new ArrayList<>();
 
@@ -317,16 +316,25 @@
          *
          * Currently, only used by the restricted permissions logic.
          *
-         * @see #syncRestrictedOps
+         * @see #syncPackages
          */
         private final @NonNull ArrayList<OpToUnrestrict> mOpsToIgnoreIfDefault = new ArrayList<>();
 
         /**
-         * All foreground permissions
+         * All ops that need to be flipped to ignore.
          *
-         * @see #syncOpsOfFgPermissions()
+         * @see #syncPackages
          */
-        private final @NonNull ArrayList<FgPermission> mFgPermOps = new ArrayList<>();
+        private final @NonNull ArrayList<OpToUnrestrict> mOpsToIgnore = new ArrayList<>();
+
+        /**
+         * All ops that need to be flipped to foreground.
+         *
+         * Currently, only used by the foreground/background permissions logic.
+         *
+         * @see #syncPackages
+         */
+        private final @NonNull ArrayList<OpToUnrestrict> mOpsToForeground = new ArrayList<>();
 
         PermissionToOpSynchroniser(@NonNull Context context) {
             mContext = context;
@@ -335,11 +343,11 @@
         }
 
         /**
-         * Set app ops that belong to restricted permissions.
+         * Set app ops that were added in {@link #addPackage}.
          *
          * <p>This processes ops previously added by {@link #addOpIfRestricted}
          */
-        private void syncRestrictedOps() {
+        private void syncPackages() {
             final int allowCount = mOpsToAllow.size();
             for (int i = 0; i < allowCount; i++) {
                 final OpToUnrestrict op = mOpsToAllow.get(i);
@@ -350,6 +358,16 @@
                 final OpToUnrestrict op = mOpsToAllowIfDefault.get(i);
                 setUidModeAllowedIfDefault(op.code, op.uid, op.packageName);
             }
+            final int foregroundCount = mOpsToForeground.size();
+            for (int i = 0; i < foregroundCount; i++) {
+                final OpToUnrestrict op = mOpsToForeground.get(i);
+                setUidModeForeground(op.code, op.uid);
+            }
+            final int ignoreCount = mOpsToIgnore.size();
+            for (int i = 0; i < ignoreCount; i++) {
+                final OpToUnrestrict op = mOpsToIgnore.get(i);
+                setUidModeIgnored(op.code, op.uid);
+            }
             final int ignoreIfDefaultCount = mOpsToIgnoreIfDefault.size();
             for (int i = 0; i < ignoreIfDefaultCount; i++) {
                 final OpToUnrestrict op = mOpsToIgnoreIfDefault.get(i);
@@ -363,46 +381,8 @@
         }
 
         /**
-         * Set app ops that belong to restricted permissions.
-         *
-         * <p>This processed ops previously added by {@link #addOpIfRestricted}
-         */
-        private void syncOpsOfFgPermissions() {
-            int numFgPermOps = mFgPermOps.size();
-            for (int i = 0; i < numFgPermOps; i++) {
-                FgPermission perm = mFgPermOps.get(i);
-
-                if (mPackageManager.checkPermission(perm.fgPermissionName, perm.packageName)
-                        == PackageManager.PERMISSION_GRANTED) {
-                    if (mPackageManager.checkPermission(perm.bgPermissionName, perm.packageName)
-                            == PackageManager.PERMISSION_GRANTED) {
-                        mAppOpsManager.setUidMode(
-                                AppOpsManager.permissionToOpCode(perm.fgPermissionName), perm.uid,
-                                AppOpsManager.MODE_ALLOWED);
-                    } else {
-                        mAppOpsManager.setUidMode(
-                                AppOpsManager.permissionToOpCode(perm.fgPermissionName), perm.uid,
-                                AppOpsManager.MODE_FOREGROUND);
-                    }
-                } else {
-                    mAppOpsManager.setUidMode(
-                            AppOpsManager.permissionToOpCode(perm.fgPermissionName), perm.uid,
-                            AppOpsManager.MODE_IGNORED);
-                }
-            }
-        }
-
-        /**
-         * Synchronize all previously {@link #addPackage added} packages.
-         */
-        void syncPackages() {
-            syncRestrictedOps();
-            syncOpsOfFgPermissions();
-        }
-
-        /**
          * Add op that belong to a restricted permission for later processing in
-         * {@link #syncRestrictedOps}.
+         * {@link #syncPackages()}.
          *
          * <p>Note: Called with the package lock held. Do <u>not</u> call into app-op manager.
          *
@@ -424,19 +404,29 @@
                     mContext.getUser()) & FLAG_PERMISSION_APPLY_RESTRICTION) != 0;
 
             if (permissionInfo.isHardRestricted()) {
-                if (applyRestriction) {
-                    mOpsToDefault.add(new OpToRestrict(uid, opCode));
-                } else {
-                    mOpsToAllowIfDefault.add(new OpToUnrestrict(uid, pkg.packageName, opCode));
+                if (opCode != OP_NONE) {
+                    if (applyRestriction) {
+                        mOpsToDefault.add(new OpToRestrict(uid, opCode));
+                    } else {
+                        mOpsToAllowIfDefault.add(new OpToUnrestrict(uid, pkg.packageName, opCode));
+                    }
                 }
             } else if (permissionInfo.isSoftRestricted()) {
                 final SoftRestrictedPermissionPolicy policy =
                         SoftRestrictedPermissionPolicy.forPermission(mContext, pkg.applicationInfo,
                                 permission);
 
-                final int op = policy.getAppOp();
+                if (opCode != OP_NONE) {
+                    if (policy.canBeGranted()) {
+                        mOpsToAllowIfDefault.add(new OpToUnrestrict(uid, pkg.packageName, opCode));
+                    } else {
+                        mOpsToDefault.add(new OpToRestrict(uid, opCode));
+                    }
+                }
+
+                final int op = policy.resolveAppOp();
                 if (op != OP_NONE) {
-                    switch (policy.getAppOpMode()) {
+                    switch (policy.getDesiredOpMode()) {
                         case MODE_DEFAULT:
                             mOpsToDefault.add(new OpToRestrict(uid, op));
                             break;
@@ -444,16 +434,22 @@
                             if (policy.shouldSetAppOpIfNotDefault()) {
                                 mOpsToAllow.add(new OpToUnrestrict(uid, pkg.packageName, op));
                             } else {
-                                mOpsToAllowIfDefault.add(new OpToUnrestrict(uid, pkg.packageName,
-                                        op));
+                                mOpsToAllowIfDefault.add(
+                                        new OpToUnrestrict(uid, pkg.packageName,
+                                                op));
                             }
                             break;
+                        case MODE_FOREGROUND:
+                            Slog.wtf(LOG_TAG,
+                                    "Setting appop to foreground is not implemented");
+                            break;
                         case MODE_IGNORED:
                             if (policy.shouldSetAppOpIfNotDefault()) {
-                                Slog.wtf(LOG_TAG, "Always ignoring appops is not implemented");
+                                mOpsToIgnore.add(new OpToUnrestrict(uid, pkg.packageName, op));
                             } else {
-                                mOpsToIgnoreIfDefault.add(new OpToUnrestrict(uid, pkg.packageName,
-                                        op));
+                                mOpsToIgnoreIfDefault.add(
+                                        new OpToUnrestrict(uid, pkg.packageName,
+                                                op));
                             }
                             break;
                         case MODE_ERRORED:
@@ -463,19 +459,59 @@
             }
         }
 
+        /**
+         * Add op that belong to a foreground permission for later processing in
+         * {@link #syncPackages()}.
+         *
+         * <p>Note: Called with the package lock held. Do <u>not</u> call into app-op manager.
+         *
+         * @param permissionInfo The permission that is currently looked at
+         * @param pkg The package looked at
+         */
         private void addOpIfFgPermissions(@NonNull PermissionInfo permissionInfo,
                 @NonNull PackageInfo pkg) {
-            if (pkg.applicationInfo.targetSdkVersion < Build.VERSION_CODES.M) {
-                // Pre-M apps do not store their fg/bg state in the permissions
+            final String bgPermissionName = permissionInfo.backgroundPermission;
+
+            if (bgPermissionName == null) {
                 return;
             }
 
-            if (permissionInfo.backgroundPermission == null) {
-                return;
-            }
+            final String permission = permissionInfo.name;
+            final int opCode = AppOpsManager.permissionToOpCode(permission);
+            final String pkgName = pkg.packageName;
+            final int uid = pkg.applicationInfo.uid;
 
-            mFgPermOps.add(new FgPermission(pkg.applicationInfo.uid, pkg.packageName,
-                    permissionInfo.name, permissionInfo.backgroundPermission));
+            if (mPackageManager.checkPermission(permission, pkgName)
+                    == PackageManager.PERMISSION_GRANTED) {
+                boolean isBgHardRestricted = false;
+                try {
+                    final PermissionInfo bgPermInfo = mPackageManager.getPermissionInfo(
+                            bgPermissionName, 0);
+
+                    if (bgPermInfo.isSoftRestricted()) {
+                        Slog.wtf(LOG_TAG, "Support for soft restricted background permissions not "
+                                + "implemented");
+                    }
+
+                    isBgHardRestricted =
+                            bgPermInfo.isHardRestricted() && (mPackageManager.getPermissionFlags(
+                                    bgPermissionName, pkgName, UserHandle.getUserHandleForUid(uid))
+                                    & FLAG_PERMISSION_APPLY_RESTRICTION) != 0;
+                } catch (NameNotFoundException e) {
+                    Slog.w(LOG_TAG, "Cannot read permission state of " + bgPermissionName, e);
+                }
+
+                final boolean isBgPermGranted = mPackageManager.checkPermission(bgPermissionName,
+                        pkgName) == PackageManager.PERMISSION_GRANTED;
+
+                if (!isBgHardRestricted && isBgPermGranted) {
+                    mOpsToAllow.add(new OpToUnrestrict(uid, pkgName, opCode));
+                } else {
+                    mOpsToForeground.add(new OpToUnrestrict(uid, pkgName, opCode));
+                }
+            } else {
+                mOpsToIgnore.add(new OpToUnrestrict(uid, pkgName, opCode));
+            }
         }
 
         /**
@@ -525,14 +561,33 @@
             mAppOpsManager.setUidMode(opCode, uid, AppOpsManager.MODE_ALLOWED);
         }
 
+        private void setUidModeForeground(int opCode, int uid) {
+            mAppOpsManager.setUidMode(opCode, uid, AppOpsManager.MODE_FOREGROUND);
+        }
+
         private void setUidModeIgnoredIfDefault(int opCode, int uid, @NonNull String packageName) {
             setUidModeIfDefault(opCode, uid, AppOpsManager.MODE_IGNORED, packageName);
         }
 
+        private void setUidModeIgnored(int opCode, int uid) {
+            mAppOpsManager.setUidMode(opCode, uid, MODE_IGNORED);
+        }
+
         private void setUidModeIfDefault(int opCode, int uid, int mode,
                 @NonNull String packageName) {
-            final int currentMode = mAppOpsManager.unsafeCheckOpRaw(AppOpsManager
-                    .opToPublicName(opCode), uid, packageName);
+            final int currentMode;
+            try {
+                currentMode = mAppOpsManager.unsafeCheckOpRaw(AppOpsManager
+                        .opToPublicName(opCode), uid, packageName);
+            } catch (SecurityException e) {
+                // This might happen if the app was uninstalled in between the add and sync step.
+                // In this case the package name cannot be resolved inside appops service and hence
+                // the uid does not match.
+                Slog.w(LOG_TAG, "Cannot set mode of uid=" + uid + " op=" + opCode + " to " + mode,
+                        e);
+                return;
+            }
+
             if (currentMode == MODE_DEFAULT) {
                 mAppOpsManager.setUidMode(opCode, uid, mode);
             }
@@ -563,21 +618,6 @@
                 this.code = code;
             }
         }
-
-        private class FgPermission {
-            final int uid;
-            final @NonNull String packageName;
-            final @NonNull String fgPermissionName;
-            final @NonNull String bgPermissionName;
-
-            private FgPermission(int uid, @NonNull String packageName,
-                    @NonNull String fgPermissionName, @NonNull String bgPermissionName) {
-                this.uid = uid;
-                this.packageName = packageName;
-                this.fgPermissionName = fgPermissionName;
-                this.bgPermissionName = bgPermissionName;
-            }
-        }
     }
 
     private class Internal extends PermissionPolicyInternal {
diff --git a/services/core/java/com/android/server/policy/SoftRestrictedPermissionPolicy.java b/services/core/java/com/android/server/policy/SoftRestrictedPermissionPolicy.java
index e19b708..d447617 100644
--- a/services/core/java/com/android/server/policy/SoftRestrictedPermissionPolicy.java
+++ b/services/core/java/com/android/server/policy/SoftRestrictedPermissionPolicy.java
@@ -33,7 +33,6 @@
 import android.content.Context;
 import android.content.pm.ApplicationInfo;
 import android.os.Build;
-import android.util.Log;
 
 /**
  * The behavior of soft restricted permissions is different for each permission. This class collects
@@ -43,8 +42,6 @@
  * {@link com.android.packageinstaller.permission.utils.SoftRestrictedPermissionPolicy}
  */
 public abstract class SoftRestrictedPermissionPolicy {
-    private static final String LOG_TAG = SoftRestrictedPermissionPolicy.class.getSimpleName();
-
     private static final int FLAGS_PERMISSION_RESTRICTION_ANY_EXEMPT =
             FLAG_PERMISSION_RESTRICTION_SYSTEM_EXEMPT
                     | FLAG_PERMISSION_RESTRICTION_UPGRADE_EXEMPT
@@ -53,12 +50,12 @@
     private static final SoftRestrictedPermissionPolicy DUMMY_POLICY =
             new SoftRestrictedPermissionPolicy() {
                 @Override
-                public int getAppOp() {
+                public int resolveAppOp() {
                     return OP_NONE;
                 }
 
                 @Override
-                public int getAppOpMode() {
+                public int getDesiredOpMode() {
                     return MODE_DEFAULT;
                 }
 
@@ -100,12 +97,12 @@
 
                 return new SoftRestrictedPermissionPolicy() {
                     @Override
-                    public int getAppOp() {
+                    public int resolveAppOp() {
                         return OP_LEGACY_STORAGE;
                     }
 
                     @Override
-                    public int getAppOpMode() {
+                    public int getDesiredOpMode() {
                         if (applyRestriction) {
                             return MODE_DEFAULT;
                         } else if (hasRequestedLegacyExternalStorage) {
@@ -119,7 +116,7 @@
                     public boolean shouldSetAppOpIfNotDefault() {
                         // Do not switch from allowed -> ignored as this would mean to retroactively
                         // turn on isolated storage. This will make the app loose all its files.
-                        return getAppOpMode() != MODE_IGNORED;
+                        return getDesiredOpMode() != MODE_IGNORED;
                     }
 
                     @Override
@@ -127,10 +124,6 @@
                         if (isWhiteListed || targetSDK >= Build.VERSION_CODES.Q) {
                             return true;
                         } else {
-                            Log.w(LOG_TAG, permission + " for " + appInfo.packageName
-                                    + " is not whitelisted and targetSDK " + targetSDK + "<"
-                                    + Build.VERSION_CODES.Q);
-
                             return false;
                         }
                     }
@@ -145,16 +138,16 @@
      * @return An app op to be changed based on the state of the permission or
      * {@link AppOpsManager#OP_NONE} if not app-op should be set.
      */
-    public abstract int getAppOp();
+    public abstract int resolveAppOp();
 
     /**
-     * @return The mode the {@link #getAppOp() app op} should be in.
+     * @return The mode the {@link #resolveAppOp() app op} should be in.
      */
-    public abstract @AppOpsManager.Mode int getAppOpMode();
+    public abstract @AppOpsManager.Mode int getDesiredOpMode();
 
     /**
-     * @return If the {@link #getAppOp() app op} should be set even if the app-op is currently not
-     * {@link AppOpsManager#MODE_DEFAULT}.
+     * @return If the {@link #resolveAppOp() app op} should be set even if the app-op is currently
+     * not {@link AppOpsManager#MODE_DEFAULT}.
      */
     public abstract boolean shouldSetAppOpIfNotDefault();
 
diff --git a/services/core/java/com/android/server/policy/TEST_MAPPING b/services/core/java/com/android/server/policy/TEST_MAPPING
index 02b0e21..c7f8c07 100644
--- a/services/core/java/com/android/server/policy/TEST_MAPPING
+++ b/services/core/java/com/android/server/policy/TEST_MAPPING
@@ -35,6 +35,14 @@
           "include-filter": "android.permission2.cts.RestrictedPermissionsTest"
         }
       ]
+    },
+    {
+      "name": "CtsPermissionTestCases",
+      "options": [
+        {
+          "include-filter": "android.permission.cts.SplitPermissionTest"
+        }
+      ]
     }
   ],
   "postsubmit": [
diff --git a/services/core/java/com/android/server/wm/AppWindowToken.java b/services/core/java/com/android/server/wm/AppWindowToken.java
index 60cfe14..4a9a3f7 100644
--- a/services/core/java/com/android/server/wm/AppWindowToken.java
+++ b/services/core/java/com/android/server/wm/AppWindowToken.java
@@ -540,14 +540,6 @@
                 // If the app was already visible, don't reset the waitingToShow state.
                 if (isHidden()) {
                     waitingToShow = true;
-
-                    // Let's reset the draw state in order to prevent the starting window to be
-                    // immediately dismissed when the app still has the surface.
-                    forAllWindows(w -> {
-                            if (w.mAttrs.type != TYPE_APPLICATION_STARTING) {
-                                w.mWinAnimator.resetDrawState();
-                            }
-                        },  true /* traverseTopToBottom */);
                 }
             }
 
diff --git a/services/tests/uiservicestests/src/com/android/server/notification/NotificationListenerServiceTest.java b/services/tests/uiservicestests/src/com/android/server/notification/NotificationListenerServiceTest.java
index bee3b2b..397d215 100644
--- a/services/tests/uiservicestests/src/com/android/server/notification/NotificationListenerServiceTest.java
+++ b/services/tests/uiservicestests/src/com/android/server/notification/NotificationListenerServiceTest.java
@@ -16,6 +16,7 @@
 
 package com.android.server.notification;
 
+import static android.app.Notification.EXTRA_SMALL_ICON;
 import static android.service.notification.NotificationListenerService.Ranking.USER_SENTIMENT_NEGATIVE;
 import static android.service.notification.NotificationListenerService.Ranking.USER_SENTIMENT_NEUTRAL;
 import static android.service.notification.NotificationListenerService.Ranking.USER_SENTIMENT_POSITIVE;
@@ -24,6 +25,7 @@
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotEquals;
 import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.ArgumentMatchers.anyInt;
 import static org.mockito.Mockito.mock;
@@ -33,8 +35,13 @@
 import android.app.Notification;
 import android.app.NotificationChannel;
 import android.app.PendingIntent;
+import android.content.Context;
 import android.content.Intent;
+import android.content.pm.ApplicationInfo;
+import android.graphics.Bitmap;
+import android.graphics.drawable.Icon;
 import android.os.Binder;
+import android.os.Build;
 import android.os.IBinder;
 import android.os.Parcel;
 import android.service.notification.NotificationListenerService;
@@ -44,20 +51,34 @@
 import android.service.notification.SnoozeCriterion;
 import android.test.suitebuilder.annotation.SmallTest;
 
-import androidx.test.runner.AndroidJUnit4;
-
 import com.android.server.UiServiceTestCase;
 
+import org.junit.After;
+import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
 import java.util.ArrayList;
 import java.util.List;
 
+import androidx.test.runner.AndroidJUnit4;
+
 @SmallTest
 @RunWith(AndroidJUnit4.class)
 public class NotificationListenerServiceTest extends UiServiceTestCase {
 
+    int targetSdk = 0;
+
+    @Before
+    public void setUp() {
+        targetSdk = mContext.getApplicationInfo().targetSdkVersion;
+    }
+
+    @After
+    public void tearDown() {
+        mContext.getApplicationInfo().targetSdkVersion = targetSdk;
+    }
+
     @Test
     public void testGetActiveNotifications_notNull() throws Exception {
         TestListenerService service = new TestListenerService();
@@ -109,17 +130,6 @@
         assertEquals(nru, nru1);
     }
 
-    private void detailedAssertEquals(RankingMap a, RankingMap b) {
-        Ranking arank = new Ranking();
-        Ranking brank = new Ranking();
-        assertArrayEquals(a.getOrderedKeys(), b.getOrderedKeys());
-        for (String key : a.getOrderedKeys()) {
-            a.getRanking(key, arank);
-            b.getRanking(key, brank);
-            detailedAssertEquals("ranking for key <" + key + ">", arank, brank);
-        }
-    }
-
     // Tests parceling of RankingMap and RankingMap.equals
     @Test
     public void testRankingMap_parcel() {
@@ -133,28 +143,6 @@
         assertEquals(rmap, rmap1);
     }
 
-    private void detailedAssertEquals(String comment, Ranking a, Ranking b) {
-        assertEquals(comment, a.getKey(), b.getKey());
-        assertEquals(comment, a.getRank(), b.getRank());
-        assertEquals(comment, a.matchesInterruptionFilter(), b.matchesInterruptionFilter());
-        assertEquals(comment, a.getVisibilityOverride(), b.getVisibilityOverride());
-        assertEquals(comment, a.getSuppressedVisualEffects(), b.getSuppressedVisualEffects());
-        assertEquals(comment, a.getImportance(), b.getImportance());
-        assertEquals(comment, a.getImportanceExplanation(), b.getImportanceExplanation());
-        assertEquals(comment, a.getOverrideGroupKey(), b.getOverrideGroupKey());
-        assertEquals(comment, a.getChannel(), b.getChannel());
-        assertEquals(comment, a.getAdditionalPeople(), b.getAdditionalPeople());
-        assertEquals(comment, a.getSnoozeCriteria(), b.getSnoozeCriteria());
-        assertEquals(comment, a.canShowBadge(), b.canShowBadge());
-        assertEquals(comment, a.getUserSentiment(), b.getUserSentiment());
-        assertEquals(comment, a.isSuspended(), b.isSuspended());
-        assertEquals(comment, a.getLastAudiblyAlertedMillis(), b.getLastAudiblyAlertedMillis());
-        assertEquals(comment, a.isNoisy(), b.isNoisy());
-        assertEquals(comment, a.getSmartReplies(), b.getSmartReplies());
-        assertEquals(comment, a.canBubble(), b.canBubble());
-        assertActionsEqual(a.getSmartActions(), b.getSmartActions());
-    }
-
     // Tests parceling of Ranking and Ranking.equals
     @Test
     public void testRanking_parcel() {
@@ -167,10 +155,6 @@
         assertEquals(ranking, ranking1);
     }
 
-    private void detailedAssertEquals(NotificationRankingUpdate a, NotificationRankingUpdate b) {
-        assertEquals(a.getRankingMap(), b.getRankingMap());
-    }
-
     // Tests NotificationRankingUpdate.equals(), and by extension, RankingMap and Ranking.
     @Test
     public void testRankingUpdate_equals() {
@@ -203,6 +187,49 @@
         assertNotEquals(nru, nru2);
     }
 
+    @Test
+    public void testLegacyIcons_preM() {
+        TestListenerService service = new TestListenerService();
+        service.attachBaseContext(mContext);
+        service.targetSdk = Build.VERSION_CODES.LOLLIPOP_MR1;
+
+        Bitmap largeIcon = Bitmap.createBitmap(100, 200, Bitmap.Config.RGB_565);
+
+        Notification n = new Notification.Builder(mContext, "channel")
+                .setSmallIcon(android.R.drawable.star_on)
+                .setLargeIcon(Icon.createWithBitmap(largeIcon))
+                .setContentTitle("test")
+                .build();
+
+        service.createLegacyIconExtras(n);
+
+        assertEquals(android.R.drawable.star_on, n.extras.getInt(EXTRA_SMALL_ICON));
+        assertEquals(android.R.drawable.star_on, n.icon);
+        assertNotNull(n.largeIcon);
+        assertNotNull(n.extras.getParcelable(Notification.EXTRA_LARGE_ICON));
+    }
+
+    @Test
+    public void testLegacyIcons_mPlus() {
+        TestListenerService service = new TestListenerService();
+        service.attachBaseContext(mContext);
+        service.targetSdk = Build.VERSION_CODES.M;
+
+        Bitmap largeIcon = Bitmap.createBitmap(100, 200, Bitmap.Config.RGB_565);
+
+        Notification n = new Notification.Builder(mContext, "channel")
+                .setSmallIcon(android.R.drawable.star_on)
+                .setLargeIcon(Icon.createWithBitmap(largeIcon))
+                .setContentTitle("test")
+                .build();
+
+        service.createLegacyIconExtras(n);
+
+        assertEquals(0, n.extras.getInt(EXTRA_SMALL_ICON));
+        assertNull(n.largeIcon);
+    }
+
+
     // Test data
 
     private String[] mKeys = new String[] { "key", "key1", "key2", "key3", "key4"};
@@ -346,8 +373,46 @@
         }
     }
 
+    private void detailedAssertEquals(NotificationRankingUpdate a, NotificationRankingUpdate b) {
+        assertEquals(a.getRankingMap(), b.getRankingMap());
+    }
+
+    private void detailedAssertEquals(String comment, Ranking a, Ranking b) {
+        assertEquals(comment, a.getKey(), b.getKey());
+        assertEquals(comment, a.getRank(), b.getRank());
+        assertEquals(comment, a.matchesInterruptionFilter(), b.matchesInterruptionFilter());
+        assertEquals(comment, a.getVisibilityOverride(), b.getVisibilityOverride());
+        assertEquals(comment, a.getSuppressedVisualEffects(), b.getSuppressedVisualEffects());
+        assertEquals(comment, a.getImportance(), b.getImportance());
+        assertEquals(comment, a.getImportanceExplanation(), b.getImportanceExplanation());
+        assertEquals(comment, a.getOverrideGroupKey(), b.getOverrideGroupKey());
+        assertEquals(comment, a.getChannel(), b.getChannel());
+        assertEquals(comment, a.getAdditionalPeople(), b.getAdditionalPeople());
+        assertEquals(comment, a.getSnoozeCriteria(), b.getSnoozeCriteria());
+        assertEquals(comment, a.canShowBadge(), b.canShowBadge());
+        assertEquals(comment, a.getUserSentiment(), b.getUserSentiment());
+        assertEquals(comment, a.isSuspended(), b.isSuspended());
+        assertEquals(comment, a.getLastAudiblyAlertedMillis(), b.getLastAudiblyAlertedMillis());
+        assertEquals(comment, a.isNoisy(), b.isNoisy());
+        assertEquals(comment, a.getSmartReplies(), b.getSmartReplies());
+        assertEquals(comment, a.canBubble(), b.canBubble());
+        assertActionsEqual(a.getSmartActions(), b.getSmartActions());
+    }
+
+    private void detailedAssertEquals(RankingMap a, RankingMap b) {
+        Ranking arank = new Ranking();
+        Ranking brank = new Ranking();
+        assertArrayEquals(a.getOrderedKeys(), b.getOrderedKeys());
+        for (String key : a.getOrderedKeys()) {
+            a.getRanking(key, arank);
+            b.getRanking(key, brank);
+            detailedAssertEquals("ranking for key <" + key + ">", arank, brank);
+        }
+    }
+
     public static class TestListenerService extends NotificationListenerService {
         private final IBinder binder = new LocalBinder();
+        public int targetSdk = 0;
 
         public TestListenerService() {
             mWrapper = mock(NotificationListenerWrapper.class);
@@ -369,5 +434,19 @@
                 return TestListenerService.this;
             }
         }
+
+        @Override
+        protected void attachBaseContext(Context base) {
+            super.attachBaseContext(base);
+        }
+
+        @Override
+        public ApplicationInfo getApplicationInfo() {
+            ApplicationInfo info = super.getApplicationInfo();
+            if (targetSdk != 0) {
+                info.targetSdkVersion = targetSdk;
+            }
+            return info;
+        }
     }
 }
diff --git a/telephony/java/com/android/internal/telephony/TelephonyPermissions.java b/telephony/java/com/android/internal/telephony/TelephonyPermissions.java
index e8e2a3d..7a0ab9c 100644
--- a/telephony/java/com/android/internal/telephony/TelephonyPermissions.java
+++ b/telephony/java/com/android/internal/telephony/TelephonyPermissions.java
@@ -29,8 +29,6 @@
 import android.os.RemoteException;
 import android.os.ServiceManager;
 import android.os.UserHandle;
-import android.provider.DeviceConfig;
-import android.provider.Settings;
 import android.telephony.Rlog;
 import android.telephony.SubscriptionManager;
 import android.telephony.TelephonyManager;
@@ -364,23 +362,8 @@
      */
     private static boolean reportAccessDeniedToReadIdentifiers(Context context, int subId, int pid,
             int uid, String callingPackage, String message) {
-        // Check if the application is not preinstalled; if not then a separate setting is required
-        // to relax the check to begin flagging problems with non-preinstalled apps early.
-        boolean relax3PDeviceIdentifierCheck = Settings.Global.getInt(context.getContentResolver(),
-                Settings.Global.PRIVILEGED_DEVICE_IDENTIFIER_3P_CHECK_RELAXED, 0) == 1;
         boolean isPreinstalled = false;
-        // Also check if the application is a preloaded non-privileged app; if so there is a
-        // separate setting to relax the check for these apps to ensure users can relax the check
-        // for non-preinstalled or non-priv apps as needed while continuing to test the other.
-        boolean relaxNonPrivDeviceIdentifierCheck = Settings.Global.getInt(
-                context.getContentResolver(),
-                Settings.Global.PRIVILEGED_DEVICE_IDENTIFIER_NON_PRIV_CHECK_RELAXED, 0) == 1;
         boolean isPrivApp = false;
-        // Similar to above support relaxing the check for privileged apps while still enforcing it
-        // for non-privileged and non-preinstalled apps.
-        boolean relaxPrivDeviceIdentifierCheck = Settings.Global.getInt(
-                context.getContentResolver(),
-                Settings.Global.PRIVILEGED_DEVICE_IDENTIFIER_PRIV_CHECK_RELAXED, 0) == 1;
         ApplicationInfo callingPackageInfo = null;
         try {
             callingPackageInfo = context.getPackageManager().getApplicationInfoAsUser(
@@ -399,58 +382,40 @@
             Log.e(LOG_TAG, "Exception caught obtaining package info for package " + callingPackage,
                     e);
         }
-        // The new Q restrictions for device identifier access will be enforced for all apps with
-        // settings to individually disable the new restrictions for privileged, preloaded
-        // non-privileged, and non-preinstalled apps.
-        if (!isIdentifierCheckDisabled() && (
-                (isPrivApp && !relaxPrivDeviceIdentifierCheck)
-                        || (!isPreinstalled && !relax3PDeviceIdentifierCheck)
-                        || (isPreinstalled && !isPrivApp && !relaxNonPrivDeviceIdentifierCheck))) {
-            // The current package should only be reported in StatsLog if it has not previously been
-            // reported for the currently invoked device identifier method.
-            boolean packageReported = sReportedDeviceIDPackages.containsKey(callingPackage);
-            if (!packageReported || !sReportedDeviceIDPackages.get(callingPackage).contains(
-                    message)) {
-                Set invokedMethods;
-                if (!packageReported) {
-                    invokedMethods = new HashSet<String>();
-                    sReportedDeviceIDPackages.put(callingPackage, invokedMethods);
-                } else {
-                    invokedMethods = sReportedDeviceIDPackages.get(callingPackage);
-                }
-                invokedMethods.add(message);
-                StatsLog.write(StatsLog.DEVICE_IDENTIFIER_ACCESS_DENIED, callingPackage, message,
-                        isPreinstalled, isPrivApp);
+        // The current package should only be reported in StatsLog if it has not previously been
+        // reported for the currently invoked device identifier method.
+        boolean packageReported = sReportedDeviceIDPackages.containsKey(callingPackage);
+        if (!packageReported || !sReportedDeviceIDPackages.get(callingPackage).contains(
+                message)) {
+            Set invokedMethods;
+            if (!packageReported) {
+                invokedMethods = new HashSet<String>();
+                sReportedDeviceIDPackages.put(callingPackage, invokedMethods);
+            } else {
+                invokedMethods = sReportedDeviceIDPackages.get(callingPackage);
             }
-            Log.w(LOG_TAG, "reportAccessDeniedToReadIdentifiers:" + callingPackage + ":" + message
-                    + ":isPreinstalled=" + isPreinstalled + ":isPrivApp=" + isPrivApp);
-            // if the target SDK is pre-Q then check if the calling package would have previously
-            // had access to device identifiers.
-            if (callingPackageInfo != null && (
-                    callingPackageInfo.targetSdkVersion < Build.VERSION_CODES.Q)) {
-                if (context.checkPermission(
-                        android.Manifest.permission.READ_PHONE_STATE,
-                        pid,
-                        uid) == PackageManager.PERMISSION_GRANTED) {
-                    return false;
-                }
-                if (checkCarrierPrivilegeForSubId(subId)) {
-                    return false;
-                }
-            }
-            throw new SecurityException(message + ": The user " + uid
-                    + " does not meet the requirements to access device identifiers.");
-        } else {
-            return checkReadPhoneState(context, subId, pid, uid, callingPackage, message);
+            invokedMethods.add(message);
+            StatsLog.write(StatsLog.DEVICE_IDENTIFIER_ACCESS_DENIED, callingPackage, message,
+                    isPreinstalled, isPrivApp);
         }
-    }
-
-    /**
-     * Returns true if the new device identifier access restrictions are disabled.
-     */
-    private static boolean isIdentifierCheckDisabled() {
-        return DeviceConfig.getInt(DeviceConfig.NAMESPACE_PRIVACY,
-                PROPERTY_DEVICE_IDENTIFIER_ACCESS_RESTRICTIONS_DISABLED, 0) == 1;
+        Log.w(LOG_TAG, "reportAccessDeniedToReadIdentifiers:" + callingPackage + ":" + message
+                + ":isPreinstalled=" + isPreinstalled + ":isPrivApp=" + isPrivApp);
+        // if the target SDK is pre-Q then check if the calling package would have previously
+        // had access to device identifiers.
+        if (callingPackageInfo != null && (
+                callingPackageInfo.targetSdkVersion < Build.VERSION_CODES.Q)) {
+            if (context.checkPermission(
+                    android.Manifest.permission.READ_PHONE_STATE,
+                    pid,
+                    uid) == PackageManager.PERMISSION_GRANTED) {
+                return false;
+            }
+            if (checkCarrierPrivilegeForSubId(subId)) {
+                return false;
+            }
+        }
+        throw new SecurityException(message + ": The user " + uid
+                + " does not meet the requirements to access device identifiers.");
     }
 
     /**