Merge "Hide MultiUserSwitch when guestEnabled && no_add_users" into qt-dev
diff --git a/api/test-current.txt b/api/test-current.txt
index 1a912a1c..be92106 100644
--- a/api/test-current.txt
+++ b/api/test-current.txt
@@ -646,6 +646,7 @@
method public void setContentCaptureOptions(@Nullable android.content.ContentCaptureOptions);
field public static final String BUGREPORT_SERVICE = "bugreport";
field public static final String CONTENT_CAPTURE_MANAGER_SERVICE = "content_capture";
+ field public static final String PERMISSION_SERVICE = "permission";
field public static final String ROLLBACK_SERVICE = "rollback";
field public static final String STATUS_BAR_SERVICE = "statusbar";
field public static final String TEST_NETWORK_SERVICE = "test_network";
@@ -2214,6 +2215,18 @@
method public abstract void onRevokeRuntimePermissions(@NonNull java.util.Map<java.lang.String,java.util.List<java.lang.String>>);
}
+ public final class PermissionManager {
+ method @IntRange(from=0) @RequiresPermission("android.permission.ADJUST_RUNTIME_PERMISSIONS_POLICY") public int getRuntimePermissionsVersion();
+ method @NonNull public java.util.List<android.permission.PermissionManager.SplitPermissionInfo> getSplitPermissions();
+ method @RequiresPermission("android.permission.ADJUST_RUNTIME_PERMISSIONS_POLICY") public void setRuntimePermissionsVersion(@IntRange(from=0) int);
+ }
+
+ public static final class PermissionManager.SplitPermissionInfo {
+ method @NonNull public java.util.List<java.lang.String> getNewPermissions();
+ method @NonNull public String getSplitPermission();
+ method public int getTargetSdk();
+ }
+
public final class RuntimePermissionPresentationInfo implements android.os.Parcelable {
ctor public RuntimePermissionPresentationInfo(@NonNull CharSequence, boolean, boolean);
method public int describeContents();
diff --git a/cmds/incident_helper/src/main.cpp b/cmds/incident_helper/src/main.cpp
index 809a771..ff5fd86 100644
--- a/cmds/incident_helper/src/main.cpp
+++ b/cmds/incident_helper/src/main.cpp
@@ -72,6 +72,8 @@
return new PsParser();
case 2006:
return new BatteryTypeParser();
+ case 3026: // system_trace is already a serialized protobuf
+ return new NoopParser();
default:
// Return no op parser when no specific ones are implemented.
return new NoopParser();
diff --git a/cmds/incidentd/src/Section.cpp b/cmds/incidentd/src/Section.cpp
index 85c5a20..1572114 100644
--- a/cmds/incidentd/src/Section.cpp
+++ b/cmds/incidentd/src/Section.cpp
@@ -67,6 +67,8 @@
switch (sectionId) {
case 3025: // restricted_images
return true;
+ case 3026: // system_trace
+ return true;
default:
return false;
}
diff --git a/cmds/statsd/src/atoms.proto b/cmds/statsd/src/atoms.proto
index 495a09f..e920843 100644
--- a/cmds/statsd/src/atoms.proto
+++ b/cmds/statsd/src/atoms.proto
@@ -303,6 +303,8 @@
ContentCaptureSessionEvents content_capture_session_events = 208;
ContentCaptureFlushed content_capture_flushed = 209;
LocationManagerApiUsageReported location_manager_api_usage_reported = 210;
+ ReviewPermissionsFragmentResultReported review_permissions_fragment_result_reported
+ = 211 [(log_from_module) = "permissioncontroller"];
}
// Pulled events will start at field 10000.
@@ -6544,3 +6546,24 @@
// Categorized to 3 types that are interesting from location's perspective.
optional android.stats.location.ActivityImportance activiy_importance = 12;
}
+
+/**
+ * Information about a permission grant or denial made by user inside ReviewPermissionsFragment
+ */
+message ReviewPermissionsFragmentResultReported {
+ // unique value identifying a permission group change. A permission group change might result
+ // in multiple of these atoms
+ optional int64 change_id = 1;
+
+ // UID of package the permission belongs to
+ optional int32 uid = 2 [(is_uid) = true];
+
+ // Name of package the permission belongs to
+ optional string package_name = 3;
+
+ // The permission to be granted
+ optional string permission_name = 4;
+
+ // The result of the permission grant
+ optional bool permission_granted = 5;
+}
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/app/Activity.java b/core/java/android/app/Activity.java
index 2eb0902..dc52c52 100644
--- a/core/java/android/app/Activity.java
+++ b/core/java/android/app/Activity.java
@@ -2330,7 +2330,7 @@
* calling {@link VoiceInteractor#notifyDirectActionsChanged()}.
*
* <p>To get the voice interactor you need to call {@link #getVoiceInteractor()}
- * which would return non <code>null<c/ode> only if there is an ongoing voice
+ * which would return non <code>null</code> only if there is an ongoing voice
* interaction session. You an also detect when the voice interactor is no
* longer valid because the voice interaction session that is backing is finished
* by calling {@link VoiceInteractor#registerOnDestroyedCallback(Executor, Runnable)}.
@@ -2339,7 +2339,7 @@
* before {@link #onStop()} is being called.
*
* <p>You should pass to the callback the currently supported direct actions which
- * cannot be <code>null</code> or contain <code>null</null> elements.
+ * cannot be <code>null</code> or contain <code>null</code> elements.
*
* <p>You should return the action list as soon as possible to ensure the consumer,
* for example the assistant, is as responsive as possible which would improve user
diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java
index 507e97e..d082f33 100644
--- a/core/java/android/app/admin/DevicePolicyManager.java
+++ b/core/java/android/app/admin/DevicePolicyManager.java
@@ -16,6 +16,8 @@
package android.app.admin;
+import static com.android.internal.util.function.pooled.PooledLambda.obtainMessage;
+
import android.Manifest.permission;
import android.annotation.CallbackExecutor;
import android.annotation.ColorInt;
@@ -88,6 +90,7 @@
import com.android.internal.R;
import com.android.internal.annotations.VisibleForTesting;
+import com.android.internal.os.BackgroundThread;
import com.android.internal.util.Preconditions;
import com.android.org.conscrypt.TrustedCertificateStore;
@@ -8810,6 +8813,11 @@
mService.setPermissionGrantState(admin, mContext.getPackageName(), packageName,
permission, grantState, new RemoteCallback((b) -> result.complete(b != null)));
+ // Timeout
+ BackgroundThread.getHandler().sendMessageDelayed(
+ obtainMessage(CompletableFuture::complete, result, false),
+ 20_000);
+
return result.get();
} catch (RemoteException re) {
throw re.rethrowFromSystemServer();
diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java
index 941eda8..529677a 100644
--- a/core/java/android/content/Context.java
+++ b/core/java/android/content/Context.java
@@ -4126,6 +4126,7 @@
* @see #getSystemService(String)
* @hide
*/
+ @TestApi
@SystemApi
public static final String PERMISSION_SERVICE = "permission";
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/net/DnsResolver.java b/core/java/android/net/DnsResolver.java
index 7a85dcb..0b1a845 100644
--- a/core/java/android/net/DnsResolver.java
+++ b/core/java/android/net/DnsResolver.java
@@ -34,6 +34,7 @@
import android.annotation.Nullable;
import android.os.CancellationSignal;
import android.os.Looper;
+import android.os.MessageQueue;
import android.system.ErrnoException;
import android.util.Log;
@@ -466,10 +467,20 @@
private void registerFDListener(@NonNull Executor executor,
@NonNull FileDescriptor queryfd, @NonNull Callback<? super byte[]> answerCallback,
@Nullable CancellationSignal cancellationSignal, @NonNull Object lock) {
- Looper.getMainLooper().getQueue().addOnFileDescriptorEventListener(
+ final MessageQueue mainThreadMessageQueue = Looper.getMainLooper().getQueue();
+ mainThreadMessageQueue.addOnFileDescriptorEventListener(
queryfd,
FD_EVENTS,
(fd, events) -> {
+ // b/134310704
+ // Unregister fd event listener before resNetworkResult is called to prevent
+ // race condition caused by fd reused.
+ // For example when querying v4 and v6, it's possible that the first query ends
+ // and the fd is closed before the second request starts, which might return
+ // the same fd for the second request. By that time, the looper must have
+ // unregistered the fd, otherwise another event listener can't be registered.
+ mainThreadMessageQueue.removeOnFileDescriptorEventListener(fd);
+
executor.execute(() -> {
DnsResponse resp = null;
ErrnoException exception = null;
@@ -490,7 +501,11 @@
}
answerCallback.onAnswer(resp.answerbuf, resp.rcode);
});
- // Unregister this fd listener
+
+ // The file descriptor has already been unregistered, so it does not really
+ // matter what is returned here. In spirit 0 (meaning "unregister this FD")
+ // is still the closest to what the looper needs to do. When returning 0,
+ // Looper knows to ignore the fd if it has already been unregistered.
return 0;
});
}
diff --git a/core/java/android/os/ExternalVibration.java b/core/java/android/os/ExternalVibration.java
index b93bef8..37ca868 100644
--- a/core/java/android/os/ExternalVibration.java
+++ b/core/java/android/os/ExternalVibration.java
@@ -114,6 +114,24 @@
return true;
}
+ /**
+ * Links a recipient to death against this external vibration token
+ */
+ public void linkToDeath(IBinder.DeathRecipient recipient) {
+ try {
+ mToken.linkToDeath(recipient, 0);
+ } catch (RemoteException e) {
+ return;
+ }
+ }
+
+ /**
+ * Unlinks a recipient to death against this external vibration token
+ */
+ public void unlinkToDeath(IBinder.DeathRecipient recipient) {
+ mToken.unlinkToDeath(recipient, 0);
+ }
+
@Override
public boolean equals(Object o) {
if (o == null || !(o instanceof ExternalVibration)) {
diff --git a/core/java/android/os/GraphicsEnvironment.java b/core/java/android/os/GraphicsEnvironment.java
index 24a1477..ce1942c 100644
--- a/core/java/android/os/GraphicsEnvironment.java
+++ b/core/java/android/os/GraphicsEnvironment.java
@@ -33,11 +33,13 @@
import dalvik.system.VMRuntime;
+import java.io.BufferedReader;
import java.io.File;
import java.io.FileDescriptor;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
+import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
@@ -62,6 +64,7 @@
private static final String SYSTEM_DRIVER_VERSION_NAME = "";
private static final long SYSTEM_DRIVER_VERSION_CODE = 0;
private static final String PROPERTY_GFX_DRIVER = "ro.gfx.driver.0";
+ private static final String PROPERTY_GFX_DRIVER_PRERELEASE = "ro.gfx.driver.1";
private static final String PROPERTY_GFX_DRIVER_BUILD_TIME = "ro.gfx.driver_build_time";
private static final String METADATA_DRIVER_BUILD_TIME = "com.android.gamedriver.build_time";
private static final String ANGLE_RULES_FILE = "a4a_rules.json";
@@ -71,16 +74,19 @@
"android.app.action.ANGLE_FOR_ANDROID_TOAST_MESSAGE";
private static final String INTENT_KEY_A4A_TOAST_MESSAGE = "A4A Toast Message";
private static final String GAME_DRIVER_WHITELIST_ALL = "*";
+ private static final String GAME_DRIVER_SPHAL_LIBRARIES_FILENAME = "sphal_libraries.txt";
private static final int VULKAN_1_0 = 0x00400000;
private static final int VULKAN_1_1 = 0x00401000;
// GAME_DRIVER_ALL_APPS
// 0: Default (Invalid values fallback to default as well)
// 1: All apps use Game Driver
- // 2: All apps use system graphics driver
+ // 2: All apps use Prerelease Driver
+ // 3: All apps use system graphics driver
private static final int GAME_DRIVER_GLOBAL_OPT_IN_DEFAULT = 0;
- private static final int GAME_DRIVER_GLOBAL_OPT_IN_ALL = 1;
- private static final int GAME_DRIVER_GLOBAL_OPT_IN_NONE = 2;
+ private static final int GAME_DRIVER_GLOBAL_OPT_IN_GAME_DRIVER = 1;
+ private static final int GAME_DRIVER_GLOBAL_OPT_IN_PRERELEASE_DRIVER = 2;
+ private static final int GAME_DRIVER_GLOBAL_OPT_IN_OFF = 3;
private ClassLoader mClassLoader;
private String mLayerPath;
@@ -114,65 +120,6 @@
public static native void hintActivityLaunch();
/**
- * Allow to query whether an application will use Game Driver.
- */
- public static boolean shouldUseGameDriver(Context context, Bundle coreSettings,
- ApplicationInfo applicationInfo) {
- final String driverPackageName = SystemProperties.get(PROPERTY_GFX_DRIVER);
- if (driverPackageName == null || driverPackageName.isEmpty()) {
- return false;
- }
-
- // To minimize risk of driver updates crippling the device beyond user repair, never use an
- // updated driver for privileged or non-updated system apps. Presumably pre-installed apps
- // were tested thoroughly with the pre-installed driver.
- if (applicationInfo.isPrivilegedApp() || (applicationInfo.isSystemApp()
- && !applicationInfo.isUpdatedSystemApp())) {
- if (DEBUG) Log.v(TAG, "ignoring driver package for privileged/non-updated system app");
- return false;
- }
- final ContentResolver contentResolver = context.getContentResolver();
- final String packageName = applicationInfo.packageName;
- final int globalOptIn;
- if (coreSettings != null) {
- globalOptIn = coreSettings.getInt(Settings.Global.GAME_DRIVER_ALL_APPS, 0);
- } else {
- globalOptIn = Settings.Global.getInt(contentResolver,
- Settings.Global.GAME_DRIVER_ALL_APPS, 0);
- }
- if (globalOptIn == GAME_DRIVER_GLOBAL_OPT_IN_ALL) {
- return true;
- }
- if (globalOptIn == GAME_DRIVER_GLOBAL_OPT_IN_NONE) {
- return false;
- }
-
- // GAME_DRIVER_OPT_OUT_APPS has higher priority than GAME_DRIVER_OPT_IN_APPS
- if (getGlobalSettingsString(contentResolver, coreSettings,
- Settings.Global.GAME_DRIVER_OPT_OUT_APPS).contains(packageName)) {
- return false;
- }
- final boolean isOptIn = getGlobalSettingsString(contentResolver, coreSettings,
- Settings.Global.GAME_DRIVER_OPT_IN_APPS).contains(packageName);
- final List<String> whitelist = getGlobalSettingsString(contentResolver, coreSettings,
- Settings.Global.GAME_DRIVER_WHITELIST);
- if (!isOptIn && whitelist.indexOf(GAME_DRIVER_WHITELIST_ALL) != 0
- && !whitelist.contains(packageName)) {
- return false;
- }
-
- // If the application is not opted-in, then check whether it's on the blacklist,
- // terminate early if it's on the blacklist and fallback to system driver.
- if (!isOptIn
- && getGlobalSettingsString(contentResolver, coreSettings,
- Settings.Global.GAME_DRIVER_BLACKLIST)
- .contains(packageName)) {
- return false;
- }
- return true;
- }
-
- /**
* Query to determine if ANGLE should be used
*/
public static boolean shouldUseAngle(Context context, Bundle coreSettings,
@@ -742,12 +689,102 @@
}
/**
+ * Return the driver package name to use. Return null for system driver.
+ */
+ private static String chooseDriverInternal(Context context, Bundle coreSettings) {
+ final String gameDriver = SystemProperties.get(PROPERTY_GFX_DRIVER);
+ final boolean hasGameDriver = gameDriver != null && !gameDriver.isEmpty();
+
+ final String prereleaseDriver = SystemProperties.get(PROPERTY_GFX_DRIVER_PRERELEASE);
+ final boolean hasPrereleaseDriver = prereleaseDriver != null && !prereleaseDriver.isEmpty();
+
+ if (!hasGameDriver && !hasPrereleaseDriver) {
+ if (DEBUG) Log.v(TAG, "Neither Game Driver nor prerelease driver is supported.");
+ return null;
+ }
+
+ // To minimize risk of driver updates crippling the device beyond user repair, never use an
+ // updated driver for privileged or non-updated system apps. Presumably pre-installed apps
+ // were tested thoroughly with the pre-installed driver.
+ final ApplicationInfo ai = context.getApplicationInfo();
+ if (ai.isPrivilegedApp() || (ai.isSystemApp() && !ai.isUpdatedSystemApp())) {
+ if (DEBUG) Log.v(TAG, "Ignoring driver package for privileged/non-updated system app.");
+ return null;
+ }
+
+ // Priority for Game Driver settings global on confliction (Higher priority comes first):
+ // 1. GAME_DRIVER_ALL_APPS
+ // 2. GAME_DRIVER_OPT_OUT_APPS
+ // 3. GAME_DRIVER_PRERELEASE_OPT_IN_APPS
+ // 4. GAME_DRIVER_OPT_IN_APPS
+ // 5. GAME_DRIVER_BLACKLIST
+ // 6. GAME_DRIVER_WHITELIST
+ switch (coreSettings.getInt(Settings.Global.GAME_DRIVER_ALL_APPS, 0)) {
+ case GAME_DRIVER_GLOBAL_OPT_IN_OFF:
+ if (DEBUG) Log.v(TAG, "Game Driver is turned off on this device.");
+ return null;
+ case GAME_DRIVER_GLOBAL_OPT_IN_GAME_DRIVER:
+ if (DEBUG) Log.v(TAG, "All apps opt in to use Game Driver.");
+ return hasGameDriver ? gameDriver : null;
+ case GAME_DRIVER_GLOBAL_OPT_IN_PRERELEASE_DRIVER:
+ if (DEBUG) Log.v(TAG, "All apps opt in to use prerelease driver.");
+ return hasPrereleaseDriver ? prereleaseDriver : null;
+ case GAME_DRIVER_GLOBAL_OPT_IN_DEFAULT:
+ default:
+ break;
+ }
+
+ final String appPackageName = ai.packageName;
+ if (getGlobalSettingsString(null, coreSettings, Settings.Global.GAME_DRIVER_OPT_OUT_APPS)
+ .contains(appPackageName)) {
+ if (DEBUG) Log.v(TAG, "App opts out for Game Driver.");
+ return null;
+ }
+
+ if (getGlobalSettingsString(
+ null, coreSettings, Settings.Global.GAME_DRIVER_PRERELEASE_OPT_IN_APPS)
+ .contains(appPackageName)) {
+ if (DEBUG) Log.v(TAG, "App opts in for prerelease Game Driver.");
+ return hasPrereleaseDriver ? prereleaseDriver : null;
+ }
+
+ // Early return here since the rest logic is only for Game Driver.
+ if (!hasGameDriver) {
+ if (DEBUG) Log.v(TAG, "Game Driver is not supported on the device.");
+ return null;
+ }
+
+ final boolean isOptIn =
+ getGlobalSettingsString(null, coreSettings, Settings.Global.GAME_DRIVER_OPT_IN_APPS)
+ .contains(appPackageName);
+ final List<String> whitelist =
+ getGlobalSettingsString(null, coreSettings, Settings.Global.GAME_DRIVER_WHITELIST);
+ if (!isOptIn && whitelist.indexOf(GAME_DRIVER_WHITELIST_ALL) != 0
+ && !whitelist.contains(appPackageName)) {
+ if (DEBUG) Log.v(TAG, "App is not on the whitelist for Game Driver.");
+ return null;
+ }
+
+ // If the application is not opted-in, then check whether it's on the blacklist,
+ // terminate early if it's on the blacklist and fallback to system driver.
+ if (!isOptIn
+ && getGlobalSettingsString(
+ null, coreSettings, Settings.Global.GAME_DRIVER_BLACKLIST)
+ .contains(appPackageName)) {
+ if (DEBUG) Log.v(TAG, "App is on the blacklist for Game Driver.");
+ return null;
+ }
+
+ return gameDriver;
+ }
+
+ /**
* Choose whether the current process should use the builtin or an updated driver.
*/
private static boolean chooseDriver(
Context context, Bundle coreSettings, PackageManager pm, String packageName) {
- final String driverPackageName = SystemProperties.get(PROPERTY_GFX_DRIVER);
- if (driverPackageName == null || driverPackageName.isEmpty()) {
+ final String driverPackageName = chooseDriverInternal(context, coreSettings);
+ if (driverPackageName == null) {
return false;
}
@@ -770,10 +807,6 @@
return false;
}
- if (!shouldUseGameDriver(context, coreSettings, context.getApplicationInfo())) {
- return false;
- }
-
final String abi = chooseAbi(driverAppInfo);
if (abi == null) {
if (DEBUG) {
@@ -792,10 +825,7 @@
.append("!/lib/")
.append(abi);
final String paths = sb.toString();
-
- final String sphalLibraries =
- coreSettings.getString(Settings.Global.GAME_DRIVER_SPHAL_LIBRARIES);
-
+ final String sphalLibraries = getSphalLibraries(context, driverPackageName);
if (DEBUG) {
Log.v(TAG,
"gfx driver package search path: " + paths
@@ -832,6 +862,29 @@
return null;
}
+ private static String getSphalLibraries(Context context, String driverPackageName) {
+ try {
+ final Context driverContext =
+ context.createPackageContext(driverPackageName, Context.CONTEXT_RESTRICTED);
+ final BufferedReader reader = new BufferedReader(new InputStreamReader(
+ driverContext.getAssets().open(GAME_DRIVER_SPHAL_LIBRARIES_FILENAME)));
+ final ArrayList<String> assetStrings = new ArrayList<>();
+ for (String assetString; (assetString = reader.readLine()) != null;) {
+ assetStrings.add(assetString);
+ }
+ return String.join(":", assetStrings);
+ } catch (PackageManager.NameNotFoundException e) {
+ if (DEBUG) {
+ Log.w(TAG, "Driver package '" + driverPackageName + "' not installed");
+ }
+ } catch (IOException e) {
+ if (DEBUG) {
+ Log.w(TAG, "Failed to load '" + GAME_DRIVER_SPHAL_LIBRARIES_FILENAME + "'");
+ }
+ }
+ return "";
+ }
+
private static native int getCanLoadSystemLibraries();
private static native void setLayerPaths(ClassLoader classLoader, String layerPaths);
private static native void setDebugLayers(String layers);
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/permission/PermissionManager.java b/core/java/android/permission/PermissionManager.java
index e15659d..182a2ff 100644
--- a/core/java/android/permission/PermissionManager.java
+++ b/core/java/android/permission/PermissionManager.java
@@ -39,6 +39,7 @@
*
* @hide
*/
+@TestApi
@SystemApi
@SystemService(Context.PERMISSION_SERVICE)
public final class PermissionManager {
@@ -140,12 +141,13 @@
if (o == null || getClass() != o.getClass()) return false;
SplitPermissionInfo that = (SplitPermissionInfo) o;
return mTargetSdk == that.mTargetSdk
- && Objects.equals(mSplitPerm, that.mSplitPerm);
+ && mSplitPerm.equals(that.mSplitPerm)
+ && mNewPerms.equals(that.mNewPerms);
}
@Override
public int hashCode() {
- return Objects.hash(mSplitPerm, mTargetSdk);
+ return Objects.hash(mSplitPerm, mNewPerms, mTargetSdk);
}
/**
diff --git a/core/java/android/provider/DeviceConfig.java b/core/java/android/provider/DeviceConfig.java
index 9a11104..19dbc6a 100644
--- a/core/java/android/provider/DeviceConfig.java
+++ b/core/java/android/provider/DeviceConfig.java
@@ -48,6 +48,8 @@
/**
* Device level configuration parameters which can be tuned by a separate configuration service.
+ * Namespaces that end in "_native" such as {@link #NAMESPACE_NETD_NATIVE} are intended to be used
+ * by native code and should be pushed to system properties to make them accessible.
*
* @hide
*/
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/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index 7a3609a..3adddc7 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -2002,18 +2002,9 @@
mDisplay.getRealSize(size);
desiredWindowWidth = size.x;
desiredWindowHeight = size.y;
- } else if (lp.width == ViewGroup.LayoutParams.WRAP_CONTENT
- || lp.height == ViewGroup.LayoutParams.WRAP_CONTENT) {
- // For wrap content, we have to remeasure later on anyways. Use size consistent with
- // below so we get best use of the measure cache.
- desiredWindowWidth = dipToPx(config.screenWidthDp);
- desiredWindowHeight = dipToPx(config.screenHeightDp);
} else {
- // After addToDisplay, the frame contains the frameHint from window manager, which
- // for most windows is going to be the same size as the result of relayoutWindow.
- // Using this here allows us to avoid remeasuring after relayoutWindow
- desiredWindowWidth = frame.width();
- desiredWindowHeight = frame.height();
+ desiredWindowWidth = mWinFrame.width();
+ desiredWindowHeight = mWinFrame.height();
}
// We used to use the following condition to choose 32 bits drawing caches:
diff --git a/core/java/android/view/accessibility/AccessibilityNodeIdManager.java b/core/java/android/view/accessibility/AccessibilityNodeIdManager.java
index 0f5e950..d78dadd 100644
--- a/core/java/android/view/accessibility/AccessibilityNodeIdManager.java
+++ b/core/java/android/view/accessibility/AccessibilityNodeIdManager.java
@@ -16,12 +16,11 @@
package android.view.accessibility;
-import android.util.SparseArray;
import android.view.View;
/** @hide */
public final class AccessibilityNodeIdManager {
- private SparseArray<View> mIdsToViews = new SparseArray<>();
+ private WeakSparseArray<View> mIdsToViews = new WeakSparseArray<View>();
private static AccessibilityNodeIdManager sIdManager;
/**
diff --git a/core/java/android/view/accessibility/WeakSparseArray.java b/core/java/android/view/accessibility/WeakSparseArray.java
new file mode 100644
index 0000000..04a4cc7
--- /dev/null
+++ b/core/java/android/view/accessibility/WeakSparseArray.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.view.accessibility;
+
+import android.util.SparseArray;
+
+import java.lang.ref.Reference;
+import java.lang.ref.ReferenceQueue;
+import java.lang.ref.WeakReference;
+
+
+final class WeakSparseArray<E> {
+
+ private final ReferenceQueue<E> mRefQueue = new ReferenceQueue<>();
+ private final SparseArray<WeakReferenceWithId<E>> mSparseArray = new SparseArray<>();
+
+ public void append(int key, E value) {
+ removeUnreachableValues();
+ mSparseArray.append(key, new WeakReferenceWithId(value, mRefQueue, key));
+ }
+
+ public void remove(int key) {
+ removeUnreachableValues();
+ mSparseArray.remove(key);
+ }
+
+ public E get(int key) {
+ removeUnreachableValues();
+ WeakReferenceWithId<E> ref = mSparseArray.get(key);
+ return ref != null ? ref.get() : null;
+ }
+
+ private void removeUnreachableValues() {
+ for (Reference ref = mRefQueue.poll(); ref != null; ref = mRefQueue.poll()) {
+ mSparseArray.remove(((WeakReferenceWithId) ref).mId);
+ }
+ }
+
+ private static class WeakReferenceWithId<E> extends WeakReference<E> {
+
+ final int mId;
+
+ WeakReferenceWithId(E referent, ReferenceQueue<? super E> q, int id) {
+ super(referent, q);
+ mId = id;
+ }
+ }
+}
+
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/android/widget/AbsSeekBar.java b/core/java/android/widget/AbsSeekBar.java
index 18c6abb..50bb688 100644
--- a/core/java/android/widget/AbsSeekBar.java
+++ b/core/java/android/widget/AbsSeekBar.java
@@ -38,6 +38,11 @@
import android.view.inspector.InspectableProperty;
import com.android.internal.R;
+import com.android.internal.util.Preconditions;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
/**
@@ -91,6 +96,10 @@
@UnsupportedAppUsage
private boolean mIsDragging;
+ private List<Rect> mUserGestureExclusionRects = Collections.emptyList();
+ private final List<Rect> mGestureExclusionRects = new ArrayList<>();
+ private final Rect mThumbRect = new Rect();
+
public AbsSeekBar(Context context) {
super(context);
}
@@ -735,6 +744,27 @@
// Canvas will be translated, so 0,0 is where we start drawing
thumb.setBounds(left, top, right, bottom);
+ updateGestureExclusionRects();
+ }
+
+ @Override
+ public void setSystemGestureExclusionRects(@NonNull List<Rect> rects) {
+ Preconditions.checkNotNull(rects, "rects must not be null");
+ mUserGestureExclusionRects = rects;
+ updateGestureExclusionRects();
+ }
+
+ private void updateGestureExclusionRects() {
+ final Drawable thumb = mThumb;
+ if (thumb == null) {
+ super.setSystemGestureExclusionRects(mUserGestureExclusionRects);
+ return;
+ }
+ mGestureExclusionRects.clear();
+ thumb.copyBounds(mThumbRect);
+ mGestureExclusionRects.add(mThumbRect);
+ mGestureExclusionRects.addAll(mUserGestureExclusionRects);
+ super.setSystemGestureExclusionRects(mGestureExclusionRects);
}
/**
diff --git a/core/java/android/widget/Editor.java b/core/java/android/widget/Editor.java
index c9ef038..cac75cfd 100644
--- a/core/java/android/widget/Editor.java
+++ b/core/java/android/widget/Editor.java
@@ -134,6 +134,7 @@
import java.text.BreakIterator;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
@@ -5097,6 +5098,12 @@
void onHandleMoved() {}
public void onDetached() {}
+
+ @Override
+ protected void onSizeChanged(int w, int h, int oldw, int oldh) {
+ super.onSizeChanged(w, h, oldw, oldh);
+ setSystemGestureExclusionRects(Collections.singletonList(new Rect(0, 0, w, h)));
+ }
}
private class InsertionHandleView extends HandleView {
diff --git a/core/java/com/android/internal/app/ChooserActivity.java b/core/java/com/android/internal/app/ChooserActivity.java
index dc3099d..5294714 100644
--- a/core/java/com/android/internal/app/ChooserActivity.java
+++ b/core/java/com/android/internal/app/ChooserActivity.java
@@ -110,6 +110,7 @@
import com.android.internal.R;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.config.sysui.SystemUiDeviceConfigFlags;
+import com.android.internal.content.PackageMonitor;
import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.internal.util.ImageUtils;
@@ -125,8 +126,10 @@
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import java.util.Set;
/**
* The Chooser Activity handles intent resolution specifically for sharing intents -
@@ -185,7 +188,6 @@
private static final int SHARE_TARGET_QUERY_PACKAGE_LIMIT = 20;
private static final int QUERY_TARGET_SERVICE_LIMIT = 5;
- private static final int WATCHDOG_TIMEOUT_MILLIS = 5000;
private static final int DEFAULT_SALT_EXPIRATION_DAYS = 7;
private int mMaxHashSaltDays = DeviceConfig.getInt(DeviceConfig.NAMESPACE_SYSTEMUI,
@@ -211,6 +213,8 @@
private ChooserRowAdapter mChooserRowAdapter;
private int mChooserRowServiceSpacing;
+ private int mCurrAvailableWidth = 0;
+
/** {@link ChooserActivity#getBaseScore} */
private static final float CALLER_TARGET_SCORE_BOOST = 900.f;
/** {@link ChooserActivity#getBaseScore} */
@@ -220,12 +224,7 @@
private static final int MAX_RANKED_TARGETS = 4;
private final List<ChooserTargetServiceConnection> mServiceConnections = new ArrayList<>();
-
- private static final int CHOOSER_TARGET_SERVICE_RESULT = 1;
- private static final int CHOOSER_TARGET_SERVICE_WATCHDOG_TIMEOUT = 2;
- private static final int SHORTCUT_MANAGER_SHARE_TARGET_RESULT = 3;
- private static final int SHORTCUT_MANAGER_SHARE_TARGET_RESULT_COMPLETED = 4;
- private static final int LIST_VIEW_UPDATE_MESSAGE = 5;
+ private final Set<ComponentName> mServicesRequested = new HashSet<>();
private static final int MAX_LOG_RANK_POSITION = 12;
@@ -255,11 +254,13 @@
private ContentPreviewCoordinator mPreviewCoord;
private class ContentPreviewCoordinator {
- private static final int IMAGE_LOAD_TIMEOUT_MILLIS = 300;
private static final int IMAGE_FADE_IN_MILLIS = 150;
private static final int IMAGE_LOAD_TIMEOUT = 1;
private static final int IMAGE_LOAD_INTO_VIEW = 2;
+ private final int mImageLoadTimeoutMillis =
+ getResources().getInteger(R.integer.config_shortAnimTime);
+
private final View mParentView;
private boolean mHideParentOnFail;
private boolean mAtLeastOneLoaded = false;
@@ -328,7 +329,7 @@
private void loadUriIntoView(final int imageResourceId, final Uri uri,
final int extraImages) {
- mHandler.sendEmptyMessageDelayed(IMAGE_LOAD_TIMEOUT, IMAGE_LOAD_TIMEOUT_MILLIS);
+ mHandler.sendEmptyMessageDelayed(IMAGE_LOAD_TIMEOUT, mImageLoadTimeoutMillis);
AsyncTask.THREAD_POOL_EXECUTOR.execute(() -> {
final Bitmap bmp = loadThumbnail(uri, new Size(200, 200));
@@ -347,7 +348,7 @@
private void maybeHideContentPreview() {
if (!mAtLeastOneLoaded && mHideParentOnFail) {
Log.i(TAG, "Hiding image preview area. Timed out waiting for preview to load"
- + " within " + IMAGE_LOAD_TIMEOUT_MILLIS + "ms.");
+ + " within " + mImageLoadTimeoutMillis + "ms.");
collapseParentView();
if (mChooserRowAdapter != null) {
mChooserRowAdapter.hideContentPreview();
@@ -369,7 +370,59 @@
}
}
- private final Handler mChooserHandler = new Handler() {
+ private final ChooserHandler mChooserHandler = new ChooserHandler();
+
+ private class ChooserHandler extends Handler {
+ private static final int CHOOSER_TARGET_SERVICE_RESULT = 1;
+ private static final int CHOOSER_TARGET_SERVICE_WATCHDOG_MIN_TIMEOUT = 2;
+ private static final int CHOOSER_TARGET_SERVICE_WATCHDOG_MAX_TIMEOUT = 3;
+ private static final int SHORTCUT_MANAGER_SHARE_TARGET_RESULT = 4;
+ private static final int SHORTCUT_MANAGER_SHARE_TARGET_RESULT_COMPLETED = 5;
+ private static final int LIST_VIEW_UPDATE_MESSAGE = 6;
+
+ private static final int WATCHDOG_TIMEOUT_MAX_MILLIS = 10000;
+ private static final int WATCHDOG_TIMEOUT_MIN_MILLIS = 3000;
+
+ private boolean mMinTimeoutPassed = false;
+
+ private void removeAllMessages() {
+ removeMessages(LIST_VIEW_UPDATE_MESSAGE);
+ removeMessages(CHOOSER_TARGET_SERVICE_WATCHDOG_MIN_TIMEOUT);
+ removeMessages(CHOOSER_TARGET_SERVICE_WATCHDOG_MAX_TIMEOUT);
+ removeMessages(CHOOSER_TARGET_SERVICE_RESULT);
+ removeMessages(SHORTCUT_MANAGER_SHARE_TARGET_RESULT);
+ removeMessages(SHORTCUT_MANAGER_SHARE_TARGET_RESULT_COMPLETED);
+ }
+
+ private void restartServiceRequestTimer() {
+ mMinTimeoutPassed = false;
+ removeMessages(CHOOSER_TARGET_SERVICE_WATCHDOG_MIN_TIMEOUT);
+ removeMessages(CHOOSER_TARGET_SERVICE_WATCHDOG_MAX_TIMEOUT);
+
+ if (DEBUG) {
+ Log.d(TAG, "queryTargets setting watchdog timer for "
+ + WATCHDOG_TIMEOUT_MIN_MILLIS + "-"
+ + WATCHDOG_TIMEOUT_MAX_MILLIS + "ms");
+ }
+
+ sendEmptyMessageDelayed(CHOOSER_TARGET_SERVICE_WATCHDOG_MIN_TIMEOUT,
+ WATCHDOG_TIMEOUT_MIN_MILLIS);
+ sendEmptyMessageDelayed(CHOOSER_TARGET_SERVICE_WATCHDOG_MAX_TIMEOUT,
+ WATCHDOG_TIMEOUT_MAX_MILLIS);
+ }
+
+ private void maybeStopServiceRequestTimer() {
+ // Set a minimum timeout threshold, to ensure both apis, sharing shortcuts
+ // and older-style direct share services, have had time to load, otherwise
+ // just checking mServiceConnections could force us to end prematurely
+ if (mMinTimeoutPassed && mServiceConnections.isEmpty()) {
+ logDirectShareTargetReceived(
+ MetricsEvent.ACTION_DIRECT_SHARE_TARGETS_LOADED_CHOOSER_SERVICE);
+ sendVoiceChoicesIfNeeded();
+ mChooserListAdapter.completeServiceTargetLoading();
+ }
+ }
+
@Override
public void handleMessage(Message msg) {
if (mChooserListAdapter == null || isDestroyed()) {
@@ -393,23 +446,17 @@
unbindService(sri.connection);
sri.connection.destroy();
mServiceConnections.remove(sri.connection);
- if (mServiceConnections.isEmpty()) {
- logDirectShareTargetReceived(
- MetricsEvent.ACTION_DIRECT_SHARE_TARGETS_LOADED_CHOOSER_SERVICE);
- sendVoiceChoicesIfNeeded();
- }
+ maybeStopServiceRequestTimer();
break;
- case CHOOSER_TARGET_SERVICE_WATCHDOG_TIMEOUT:
- if (DEBUG) {
- Log.d(TAG, "CHOOSER_TARGET_SERVICE_WATCHDOG_TIMEOUT; unbinding services");
- }
+ case CHOOSER_TARGET_SERVICE_WATCHDOG_MIN_TIMEOUT:
+ mMinTimeoutPassed = true;
+ maybeStopServiceRequestTimer();
+ break;
+ case CHOOSER_TARGET_SERVICE_WATCHDOG_MAX_TIMEOUT:
unbindRemainingServices();
- logDirectShareTargetReceived(
- MetricsEvent.ACTION_DIRECT_SHARE_TARGETS_LOADED_CHOOSER_SERVICE);
- sendVoiceChoicesIfNeeded();
- mChooserListAdapter.completeServiceTargetLoading();
+ maybeStopServiceRequestTimer();
break;
case LIST_VIEW_UPDATE_MESSAGE:
@@ -669,6 +716,17 @@
.getUserInfo(UserHandle.myUserId()).isManagedProfile();
}
+ @Override
+ protected PackageMonitor createPackageMonitor() {
+ return new PackageMonitor() {
+ @Override
+ public void onSomePackagesChanged() {
+ mAdapter.handlePackagesChanged();
+ bindProfileView();
+ }
+ };
+ }
+
private void onCopyButtonClicked(View v) {
Intent targetIntent = getTargetIntent();
if (targetIntent == null) {
@@ -1065,11 +1123,7 @@
mRefinementResultReceiver = null;
}
unbindRemainingServices();
- mChooserHandler.removeMessages(LIST_VIEW_UPDATE_MESSAGE);
- mChooserHandler.removeMessages(CHOOSER_TARGET_SERVICE_WATCHDOG_TIMEOUT);
- mChooserHandler.removeMessages(CHOOSER_TARGET_SERVICE_RESULT);
- mChooserHandler.removeMessages(SHORTCUT_MANAGER_SHARE_TARGET_RESULT);
- mChooserHandler.removeMessages(SHORTCUT_MANAGER_SHARE_TARGET_RESULT_COMPLETED);
+ mChooserHandler.removeAllMessages();
if (mPreviewCoord != null) mPreviewCoord.cancelLoads();
@@ -1307,6 +1361,7 @@
final PackageManager pm = getPackageManager();
ShortcutManager sm = (ShortcutManager) getSystemService(ShortcutManager.class);
int targetsToQuery = 0;
+
for (int i = 0, N = adapter.getDisplayResolveInfoCount(); i < N; i++) {
final DisplayResolveInfo dri = adapter.getDisplayResolveInfo(i);
if (adapter.getScore(dri) == 0) {
@@ -1326,6 +1381,12 @@
if (serviceName != null) {
final ComponentName serviceComponent = new ComponentName(
ai.packageName, serviceName);
+
+ if (mServicesRequested.contains(serviceComponent)) {
+ continue;
+ }
+ mServicesRequested.add(serviceComponent);
+
final Intent serviceIntent = new Intent(ChooserTargetService.SERVICE_INTERFACE)
.setComponent(serviceComponent);
@@ -1376,16 +1437,7 @@
}
}
- if (DEBUG) {
- Log.d(TAG, "queryTargets setting watchdog timer for "
- + WATCHDOG_TIMEOUT_MILLIS + "ms");
- }
- mChooserHandler.sendEmptyMessageDelayed(CHOOSER_TARGET_SERVICE_WATCHDOG_TIMEOUT,
- WATCHDOG_TIMEOUT_MILLIS);
-
- if (mServiceConnections.isEmpty()) {
- sendVoiceChoicesIfNeeded();
- }
+ mChooserHandler.restartServiceRequestTimer();
}
private IntentFilter getTargetIntentFilter() {
@@ -1493,7 +1545,7 @@
continue;
}
final Message msg = Message.obtain();
- msg.what = SHORTCUT_MANAGER_SHARE_TARGET_RESULT;
+ msg.what = ChooserHandler.SHORTCUT_MANAGER_SHARE_TARGET_RESULT;
msg.obj = new ServiceResultInfo(driList.get(i), chooserTargets, null);
mChooserHandler.sendMessage(msg);
resultMessageSent = true;
@@ -1506,7 +1558,7 @@
private void sendShortcutManagerShareTargetResultCompleted() {
final Message msg = Message.obtain();
- msg.what = SHORTCUT_MANAGER_SHARE_TARGET_RESULT_COMPLETED;
+ msg.what = ChooserHandler.SHORTCUT_MANAGER_SHARE_TARGET_RESULT_COMPLETED;
mChooserHandler.sendMessage(msg);
}
@@ -1574,6 +1626,7 @@
unbindService(conn);
conn.destroy();
}
+ mServicesRequested.clear();
mServiceConnections.clear();
}
@@ -2198,10 +2251,12 @@
return;
}
- int availableWidth = right - left - v.getPaddingLeft() - v.getPaddingRight();
+ final int availableWidth = right - left - v.getPaddingLeft() - v.getPaddingRight();
if (mChooserRowAdapter.consumeLayoutRequest()
|| mChooserRowAdapter.calculateChooserTargetWidth(availableWidth)
- || mAdapterView.getAdapter() == null) {
+ || mAdapterView.getAdapter() == null
+ || availableWidth != mCurrAvailableWidth) {
+ mCurrAvailableWidth = availableWidth;
mAdapterView.setAdapter(mChooserRowAdapter);
getMainThreadHandler().post(() -> {
@@ -2282,7 +2337,6 @@
private ChooserTargetInfo mPlaceHolderTargetInfo = new PlaceHolderTargetInfo();
private final List<ChooserTargetInfo> mServiceTargets = new ArrayList<>();
private final List<TargetInfo> mCallerTargets = new ArrayList<>();
- private boolean mTargetsNeedPruning = false;
private final BaseChooserTargetComparator mBaseTargetComparator
= new BaseChooserTargetComparator();
@@ -2351,9 +2405,21 @@
}
@Override
+ public void handlePackagesChanged() {
+ if (DEBUG) {
+ Log.d(TAG, "clearing queryTargets on package change");
+ }
+ createPlaceHolders();
+ mServicesRequested.clear();
+ notifyDataSetChanged();
+
+ super.handlePackagesChanged();
+ }
+
+ @Override
public void notifyDataSetChanged() {
if (!mListViewDataChanged) {
- mChooserHandler.sendEmptyMessageDelayed(LIST_VIEW_UPDATE_MESSAGE,
+ mChooserHandler.sendEmptyMessageDelayed(ChooserHandler.LIST_VIEW_UPDATE_MESSAGE,
LIST_VIEW_UPDATE_INTERVAL_IN_MILLIS);
mListViewDataChanged = true;
}
@@ -2368,6 +2434,7 @@
private void createPlaceHolders() {
+ mNumShortcutResults = 0;
mServiceTargets.clear();
for (int i = 0; i < MAX_SERVICE_TARGETS; i++) {
mServiceTargets.add(mPlaceHolderTargetInfo);
@@ -2410,16 +2477,6 @@
return;
}
- if (mServiceTargets != null) {
- if (getDisplayResolveInfoCount() == 0) {
- // b/109676071: When packages change, onListRebuilt() is called before
- // ResolverActivity.mDisplayList is re-populated; pruning now would cause the
- // list to disappear briefly, so instead we detect this case (the
- // set of targets suddenly dropping to zero) and remember to prune later.
- mTargetsNeedPruning = true;
- }
- }
-
if (USE_SHORTCUT_MANAGER_FOR_DIRECT_TARGETS
|| USE_PREDICTION_MANAGER_FOR_DIRECT_TARGETS) {
if (DEBUG) {
@@ -2476,7 +2533,7 @@
}
public int getServiceTargetCount() {
- if (isSendAction(getTargetIntent())) {
+ if (isSendAction(getTargetIntent()) && !ActivityManager.isLowRamDeviceStatic()) {
return Math.min(mServiceTargets.size(), MAX_SERVICE_TARGETS);
}
@@ -2588,19 +2645,6 @@
return;
}
- if (mTargetsNeedPruning) {
- // First proper update since we got an onListRebuilt() with (transient) 0 items.
- // Clear out the target list and rebuild.
- createPlaceHolders();
- mTargetsNeedPruning = false;
-
- // Add back any app-supplied direct share targets that may have been
- // wiped by this clear
- if (mCallerChooserTargets != null) {
- addServiceResults(null, Lists.newArrayList(mCallerChooserTargets), false);
- }
- }
-
final float baseScore = getBaseScore(origTarget, isShortcutResult);
Collections.sort(targets, mBaseTargetComparator);
@@ -3445,7 +3489,7 @@
mChooserActivity.filterServiceTargets(
mOriginalTarget.getResolveInfo().activityInfo.packageName, targets);
final Message msg = Message.obtain();
- msg.what = CHOOSER_TARGET_SERVICE_RESULT;
+ msg.what = ChooserHandler.CHOOSER_TARGET_SERVICE_RESULT;
msg.obj = new ServiceResultInfo(mOriginalTarget, targets,
ChooserTargetServiceConnection.this);
mChooserActivity.mChooserHandler.sendMessage(msg);
diff --git a/core/java/com/android/internal/app/ResolverActivity.java b/core/java/com/android/internal/app/ResolverActivity.java
index 9573ac0..7cc8128 100644
--- a/core/java/com/android/internal/app/ResolverActivity.java
+++ b/core/java/com/android/internal/app/ResolverActivity.java
@@ -146,19 +146,7 @@
/** See {@link #setRetainInOnStop}. */
private boolean mRetainInOnStop;
- private final PackageMonitor mPackageMonitor = new PackageMonitor() {
- @Override public void onSomePackagesChanged() {
- mAdapter.handlePackagesChanged();
- bindProfileView();
- }
-
- @Override
- public boolean onPackageChanged(String packageName, int uid, String[] components) {
- // We care about all package changes, not just the whole package itself which is
- // default behavior.
- return true;
- }
- };
+ private final PackageMonitor mPackageMonitor = createPackageMonitor();
/**
* Get the string resource to be used as a label for the link to the resolver activity for an
@@ -234,6 +222,23 @@
}
}
+ protected PackageMonitor createPackageMonitor() {
+ return new PackageMonitor() {
+ @Override
+ public void onSomePackagesChanged() {
+ mAdapter.handlePackagesChanged();
+ bindProfileView();
+ }
+
+ @Override
+ public boolean onPackageChanged(String packageName, int uid, String[] components) {
+ // We care about all package changes, not just the whole package itself which is
+ // default behavior.
+ return true;
+ }
+ };
+ }
+
private Intent makeMyIntent() {
Intent intent = new Intent(getIntent());
intent.setComponent(null);
diff --git a/core/java/com/android/internal/colorextraction/ColorExtractor.java b/core/java/com/android/internal/colorextraction/ColorExtractor.java
index d9fd3b5..b27c11b 100644
--- a/core/java/com/android/internal/colorextraction/ColorExtractor.java
+++ b/core/java/com/android/internal/colorextraction/ColorExtractor.java
@@ -53,11 +53,13 @@
protected WallpaperColors mLockColors;
public ColorExtractor(Context context) {
- this(context, new Tonal(context), true /* immediately */);
+ this(context, new Tonal(context), true /* immediately */,
+ context.getSystemService(WallpaperManager.class));
}
@VisibleForTesting
- public ColorExtractor(Context context, ExtractionType extractionType, boolean immediately) {
+ public ColorExtractor(Context context, ExtractionType extractionType, boolean immediately,
+ WallpaperManager wallpaperManager) {
mContext = context;
mExtractionType = extractionType;
@@ -72,7 +74,6 @@
mOnColorsChangedListeners = new ArrayList<>();
- WallpaperManager wallpaperManager = mContext.getSystemService(WallpaperManager.class);
if (wallpaperManager == null) {
Log.w(TAG, "Can't listen to color changes!");
} else {
@@ -110,7 +111,7 @@
}
}
- private void extractWallpaperColors() {
+ protected void extractWallpaperColors() {
GradientColors[] systemColors = mGradientColors.get(WallpaperManager.FLAG_SYSTEM);
GradientColors[] lockColors = mGradientColors.get(WallpaperManager.FLAG_LOCK);
extractInto(mSystemColors,
diff --git a/core/java/com/android/internal/os/BatteryStatsImpl.java b/core/java/com/android/internal/os/BatteryStatsImpl.java
index c2e37d5..3a7caa4 100644
--- a/core/java/com/android/internal/os/BatteryStatsImpl.java
+++ b/core/java/com/android/internal/os/BatteryStatsImpl.java
@@ -3609,8 +3609,8 @@
public void createFakeHistoryEvents(long numEvents) {
for(long i = 0; i < numEvents; i++) {
- noteWifiOnLocked();
- noteWifiOffLocked();
+ noteLongPartialWakelockStart("name1", "historyName1", 1000);
+ noteLongPartialWakelockFinish("name1", "historyName1", 1000);
}
}
@@ -3693,9 +3693,10 @@
mHistoryBufferLastPos = -1;
final long elapsedRealtime = mClocks.elapsedRealtime();
final long uptime = mClocks.uptimeMillis();
+ HistoryItem newItem = new HistoryItem();
+ newItem.setTo(cur);
startRecordingHistory(elapsedRealtime, uptime, false);
-
- addHistoryBufferLocked(elapsedRealtimeMs, HistoryItem.CMD_UPDATE, cur);
+ addHistoryBufferLocked(elapsedRealtimeMs, HistoryItem.CMD_UPDATE, newItem);
return;
}
diff --git a/core/java/com/android/internal/os/Zygote.java b/core/java/com/android/internal/os/Zygote.java
index 2736c6a..2ba9cf1 100644
--- a/core/java/com/android/internal/os/Zygote.java
+++ b/core/java/com/android/internal/os/Zygote.java
@@ -512,13 +512,13 @@
Credentials peerCredentials = null;
ZygoteArguments args = null;
- // Load resources
- ZygoteInit.nativePreloadGraphicsDriver();
-
while (true) {
try {
sessionSocket = usapPoolSocket.accept();
+ // Block SIGTERM so we won't be killed if the Zygote flushes the USAP pool.
+ blockSigTerm();
+
BufferedReader usapReader =
new BufferedReader(new InputStreamReader(sessionSocket.getInputStream()));
usapOutputStream =
@@ -537,87 +537,116 @@
} else {
Log.e("USAP", "Truncated command received.");
IoUtils.closeQuietly(sessionSocket);
+
+ // Re-enable SIGTERM so the USAP can be flushed from the pool if necessary.
+ unblockSigTerm();
}
} catch (Exception ex) {
Log.e("USAP", ex.getMessage());
IoUtils.closeQuietly(sessionSocket);
+
+ // Re-enable SIGTERM so the USAP can be flushed from the pool if necessary.
+ unblockSigTerm();
}
}
- applyUidSecurityPolicy(args, peerCredentials);
- applyDebuggerSystemProperty(args);
-
- int[][] rlimits = null;
-
- if (args.mRLimits != null) {
- rlimits = args.mRLimits.toArray(INT_ARRAY_2D);
- }
-
- // This must happen before the SELinux policy for this process is
- // changed when specializing.
try {
- // Used by ZygoteProcess.zygoteSendArgsAndGetResult to fill in a
- // Process.ProcessStartResult object.
- usapOutputStream.writeInt(pid);
- } catch (IOException ioEx) {
- Log.e("USAP", "Failed to write response to session socket: " + ioEx.getMessage());
- System.exit(-1);
- } finally {
- IoUtils.closeQuietly(sessionSocket);
+ // SIGTERM is blocked on loop exit. This prevents a USAP that is specializing from
+ // being killed during a pool flush.
+
+ applyUidSecurityPolicy(args, peerCredentials);
+ applyDebuggerSystemProperty(args);
+
+ int[][] rlimits = null;
+
+ if (args.mRLimits != null) {
+ rlimits = args.mRLimits.toArray(INT_ARRAY_2D);
+ }
+
+ // This must happen before the SELinux policy for this process is
+ // changed when specializing.
+ try {
+ // Used by ZygoteProcess.zygoteSendArgsAndGetResult to fill in a
+ // Process.ProcessStartResult object.
+ usapOutputStream.writeInt(pid);
+ } catch (IOException ioEx) {
+ Log.e("USAP", "Failed to write response to session socket: "
+ + ioEx.getMessage());
+ throw new RuntimeException(ioEx);
+ } finally {
+ IoUtils.closeQuietly(sessionSocket);
+
+ try {
+ // This socket is closed using Os.close due to an issue with the implementation
+ // of LocalSocketImp.close(). Because the raw FD is created by init and then
+ // loaded from an environment variable (as opposed to being created by the
+ // LocalSocketImpl itself) the current implementation will not actually close
+ // the underlying FD.
+ //
+ // See b/130309968 for discussion of this issue.
+ Os.close(usapPoolSocket.getFileDescriptor());
+ } catch (ErrnoException ex) {
+ Log.e("USAP", "Failed to close USAP pool socket");
+ throw new RuntimeException(ex);
+ }
+ }
try {
- // This socket is closed using Os.close due to an issue with the implementation of
- // LocalSocketImp.close. Because the raw FD is created by init and then loaded from
- // an environment variable (as opposed to being created by the LocalSocketImpl
- // itself) the current implementation will not actually close the underlying FD.
- //
- // See b/130309968 for discussion of this issue.
- Os.close(usapPoolSocket.getFileDescriptor());
- } catch (ErrnoException ex) {
- Log.e("USAP", "Failed to close USAP pool socket: " + ex.getMessage());
+ ByteArrayOutputStream buffer =
+ new ByteArrayOutputStream(Zygote.USAP_MANAGEMENT_MESSAGE_BYTES);
+ DataOutputStream outputStream = new DataOutputStream(buffer);
+
+ // This is written as a long so that the USAP reporting pipe and USAP pool event FD
+ // handlers in ZygoteServer.runSelectLoop can be unified. These two cases should
+ // both send/receive 8 bytes.
+ outputStream.writeLong(pid);
+ outputStream.flush();
+
+ Os.write(writePipe, buffer.toByteArray(), 0, buffer.size());
+ } catch (Exception ex) {
+ Log.e("USAP",
+ String.format("Failed to write PID (%d) to pipe (%d): %s",
+ pid, writePipe.getInt$(), ex.getMessage()));
+ throw new RuntimeException(ex);
+ } finally {
+ IoUtils.closeQuietly(writePipe);
}
- }
- try {
- ByteArrayOutputStream buffer =
- new ByteArrayOutputStream(Zygote.USAP_MANAGEMENT_MESSAGE_BYTES);
- DataOutputStream outputStream = new DataOutputStream(buffer);
+ specializeAppProcess(args.mUid, args.mGid, args.mGids,
+ args.mRuntimeFlags, rlimits, args.mMountExternal,
+ args.mSeInfo, args.mNiceName, args.mStartChildZygote,
+ args.mInstructionSet, args.mAppDataDir);
- // This is written as a long so that the USAP reporting pipe and USAP pool event FD
- // handlers in ZygoteServer.runSelectLoop can be unified. These two cases should both
- // send/receive 8 bytes.
- outputStream.writeLong(pid);
- outputStream.flush();
+ disableExecuteOnly(args.mTargetSdkVersion);
- Os.write(writePipe, buffer.toByteArray(), 0, buffer.size());
- } catch (Exception ex) {
- Log.e("USAP",
- String.format("Failed to write PID (%d) to pipe (%d): %s",
- pid, writePipe.getInt$(), ex.getMessage()));
- System.exit(-1);
+ if (args.mNiceName != null) {
+ Process.setArgV0(args.mNiceName);
+ }
+
+ // End of the postFork event.
+ Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER);
+
+ return ZygoteInit.zygoteInit(args.mTargetSdkVersion,
+ args.mRemainingArgs,
+ null /* classLoader */);
} finally {
- IoUtils.closeQuietly(writePipe);
+ // Unblock SIGTERM to restore the process to default behavior.
+ unblockSigTerm();
}
-
- specializeAppProcess(args.mUid, args.mGid, args.mGids,
- args.mRuntimeFlags, rlimits, args.mMountExternal,
- args.mSeInfo, args.mNiceName, args.mStartChildZygote,
- args.mInstructionSet, args.mAppDataDir);
-
- disableExecuteOnly(args.mTargetSdkVersion);
-
- if (args.mNiceName != null) {
- Process.setArgV0(args.mNiceName);
- }
-
- // End of the postFork event.
- Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER);
-
- return ZygoteInit.zygoteInit(args.mTargetSdkVersion,
- args.mRemainingArgs,
- null /* classLoader */);
}
+ private static void blockSigTerm() {
+ nativeBlockSigTerm();
+ }
+
+ private static native void nativeBlockSigTerm();
+
+ private static void unblockSigTerm() {
+ nativeUnblockSigTerm();
+ }
+
+ private static native void nativeUnblockSigTerm();
+
private static final String USAP_ERROR_PREFIX = "Invalid command to USAP: ";
/**
diff --git a/core/java/com/android/internal/os/ZygoteConnection.java b/core/java/com/android/internal/os/ZygoteConnection.java
index 785256e..e556dd4 100644
--- a/core/java/com/android/internal/os/ZygoteConnection.java
+++ b/core/java/com/android/internal/os/ZygoteConnection.java
@@ -338,6 +338,7 @@
Runnable stateChangeCode) {
try {
if (zygoteServer.isUsapPoolEnabled()) {
+ Log.i(TAG, "Emptying USAP Pool due to state change.");
Zygote.emptyUsapPool();
}
@@ -351,6 +352,8 @@
if (fpResult != null) {
zygoteServer.setForkChild();
return fpResult;
+ } else {
+ Log.i(TAG, "Finished refilling USAP Pool after state change.");
}
}
diff --git a/core/java/com/android/internal/policy/DecorView.java b/core/java/com/android/internal/policy/DecorView.java
index 585a279..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) {
@@ -1004,6 +1008,10 @@
public void onWindowSystemUiVisibilityChanged(int visible) {
updateColorViews(null /* insets */, true /* animate */);
updateDecorCaptionStatus(getResources().getConfiguration());
+
+ if (mStatusGuard != null && mStatusGuard.getVisibility() == VISIBLE) {
+ updateStatusGuardColor();
+ }
}
@Override
@@ -1139,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;
@@ -1462,28 +1472,45 @@
}
final Rect rect = mTempRect;
- // If the parent doesn't consume the insets, manually
- // apply the default system window insets.
- mWindow.mContentParent.computeSystemWindowInsets(insets, rect);
- final int newMargin = rect.top == 0 ? insets.getSystemWindowInsetTop() : 0;
- if (mlp.topMargin != newMargin) {
- mlpChanged = true;
- mlp.topMargin = insets.getSystemWindowInsetTop();
+ // Apply the insets that have not been applied by the contentParent yet.
+ WindowInsets innerInsets =
+ mWindow.mContentParent.computeSystemWindowInsets(insets, rect);
+ int newTopMargin = innerInsets.getSystemWindowInsetTop();
+ int newLeftMargin = innerInsets.getSystemWindowInsetLeft();
+ int newRightMargin = innerInsets.getSystemWindowInsetRight();
- if (mStatusGuard == null) {
- mStatusGuard = new View(mContext);
- mStatusGuard.setBackgroundColor(mContext.getColor(
- R.color.decor_view_status_guard));
- addView(mStatusGuard, indexOfChild(mStatusColorViewState.view),
- new LayoutParams(LayoutParams.MATCH_PARENT,
- mlp.topMargin, Gravity.START | Gravity.TOP));
- } else {
- final LayoutParams lp = (LayoutParams)
- mStatusGuard.getLayoutParams();
- if (lp.height != mlp.topMargin) {
- lp.height = mlp.topMargin;
- mStatusGuard.setLayoutParams(lp);
- }
+ // Must use root window insets for the guard, because the color views consume
+ // the navigation bar inset if the window does not request LAYOUT_HIDE_NAV - but
+ // the status guard is attached at the root.
+ WindowInsets rootInsets = getRootWindowInsets();
+ int newGuardLeftMargin = rootInsets.getSystemWindowInsetLeft();
+ int newGuardRightMargin = rootInsets.getSystemWindowInsetRight();
+
+ if (mlp.topMargin != newTopMargin || mlp.leftMargin != newLeftMargin
+ || mlp.rightMargin != newRightMargin) {
+ mlpChanged = true;
+ mlp.topMargin = newTopMargin;
+ mlp.leftMargin = newLeftMargin;
+ mlp.rightMargin = newRightMargin;
+ }
+
+ if (newTopMargin > 0 && mStatusGuard == null) {
+ mStatusGuard = new View(mContext);
+ mStatusGuard.setVisibility(GONE);
+ final LayoutParams lp = new LayoutParams(MATCH_PARENT,
+ mlp.topMargin, Gravity.LEFT | Gravity.TOP);
+ lp.leftMargin = newGuardLeftMargin;
+ lp.rightMargin = newGuardRightMargin;
+ addView(mStatusGuard, indexOfChild(mStatusColorViewState.view), lp);
+ } else if (mStatusGuard != null) {
+ final LayoutParams lp = (LayoutParams)
+ mStatusGuard.getLayoutParams();
+ if (lp.height != mlp.topMargin || lp.leftMargin != newGuardLeftMargin
+ || lp.rightMargin != newGuardRightMargin) {
+ lp.height = mlp.topMargin;
+ lp.leftMargin = newGuardLeftMargin;
+ lp.rightMargin = newGuardRightMargin;
+ mStatusGuard.setLayoutParams(lp);
}
}
@@ -1491,6 +1518,11 @@
// always show the status guard above it if we have one.
showStatusGuard = mStatusGuard != null;
+ if (showStatusGuard && mStatusGuard.getVisibility() != VISIBLE) {
+ // If it wasn't previously shown, the color may be stale
+ updateStatusGuardColor();
+ }
+
// We only need to consume the insets if the action
// mode is overlaid on the app content (e.g. it's
// sitting in a FrameLayout, see
@@ -1502,7 +1534,7 @@
}
} else {
// reset top margin
- if (mlp.topMargin != 0) {
+ if (mlp.topMargin != 0 || mlp.leftMargin != 0 || mlp.rightMargin != 0) {
mlpChanged = true;
mlp.topMargin = 0;
}
@@ -1513,11 +1545,19 @@
}
}
if (mStatusGuard != null) {
- mStatusGuard.setVisibility(showStatusGuard ? View.VISIBLE : View.GONE);
+ mStatusGuard.setVisibility(showStatusGuard ? VISIBLE : GONE);
}
return insets;
}
+ private void updateStatusGuardColor() {
+ boolean lightStatusBar =
+ (getWindowSystemUiVisibility() & SYSTEM_UI_FLAG_LIGHT_STATUS_BAR) != 0;
+ mStatusGuard.setBackgroundColor(lightStatusBar
+ ? mContext.getColor(R.color.decor_view_status_guard_light)
+ : mContext.getColor(R.color.decor_view_status_guard));
+ }
+
/**
* Overrides the view outline when the activity enters picture-in-picture to ensure that it has
* an opaque shadow even if the window background is completely transparent. This only applies
@@ -2276,6 +2316,7 @@
@Override
public void onPostDraw(RecordingCanvas canvas) {
drawResizingShadowIfNeeded(canvas);
+ drawLegacyNavigationBarBackground(canvas);
}
private void initResizingPaints() {
@@ -2308,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) {
@@ -2594,6 +2647,7 @@
}
lastActionModeView.killMode();
mFadeAnim = null;
+ requestApplyInsets();
}
}
diff --git a/core/java/com/android/internal/util/function/pooled/PooledLambdaImpl.java b/core/java/com/android/internal/util/function/pooled/PooledLambdaImpl.java
index 6be626a..1bbd87c 100755
--- a/core/java/com/android/internal/util/function/pooled/PooledLambdaImpl.java
+++ b/core/java/com/android/internal/util/function/pooled/PooledLambdaImpl.java
@@ -24,6 +24,7 @@
import com.android.internal.util.ArrayUtils;
import com.android.internal.util.BitUtils;
+import com.android.internal.util.Preconditions;
import com.android.internal.util.function.HeptConsumer;
import com.android.internal.util.function.HeptFunction;
import com.android.internal.util.function.HeptPredicate;
@@ -47,6 +48,7 @@
import com.android.internal.util.function.TriPredicate;
import java.util.Arrays;
+import java.util.Objects;
import java.util.function.BiConsumer;
import java.util.function.BiFunction;
import java.util.function.BiPredicate;
@@ -432,13 +434,15 @@
if (isConstSupplier()) {
sb.append(getFuncTypeAsString()).append("(").append(doInvoke()).append(")");
} else {
- if (mFunc instanceof PooledLambdaImpl) {
- sb.append(mFunc);
+ Object func = mFunc;
+ if (func instanceof PooledLambdaImpl) {
+ sb.append(func);
} else {
- sb.append(getFuncTypeAsString()).append("@").append(hashCodeHex(mFunc));
+ sb.append(getFuncTypeAsString()).append("@").append(hashCodeHex(func));
}
sb.append("(");
- sb.append(commaSeparateFirstN(mArgs, LambdaType.decodeArgCount(getFlags(MASK_FUNC_TYPE))));
+ sb.append(commaSeparateFirstN(mArgs,
+ LambdaType.decodeArgCount(getFlags(MASK_FUNC_TYPE))));
sb.append(")");
}
return sb.toString();
@@ -450,7 +454,7 @@
}
private static String hashCodeHex(Object o) {
- return Integer.toHexString(o.hashCode());
+ return Integer.toHexString(Objects.hashCode(o));
}
private String getFuncTypeAsString() {
@@ -490,7 +494,7 @@
+ ", i = " + i
+ ")");
}
- r.mFunc = func;
+ r.mFunc = Preconditions.checkNotNull(func);
r.setFlags(MASK_FUNC_TYPE, LambdaType.encode(fNumArgs, fReturnType));
r.setFlags(MASK_EXPOSED_AS, LambdaType.encode(numPlaceholders, fReturnType));
if (ArrayUtils.size(r.mArgs) < fNumArgs) r.mArgs = new Object[fNumArgs];
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/jni/android_media_AudioSystem.cpp b/core/jni/android_media_AudioSystem.cpp
index fc2b7f6..686a919 100644
--- a/core/jni/android_media_AudioSystem.cpp
+++ b/core/jni/android_media_AudioSystem.cpp
@@ -2242,6 +2242,12 @@
return AudioSystem::setAllowedCapturePolicy(uid, flags);
}
+static jint
+android_media_AudioSystem_setRttEnabled(JNIEnv *env, jobject thiz, jboolean enabled)
+{
+ return (jint) check_AudioSystem_Command(AudioSystem::setRttEnabled(enabled));
+}
+
// ----------------------------------------------------------------------------
static const JNINativeMethod gMethods[] = {
@@ -2319,6 +2325,7 @@
{"getHwOffloadEncodingFormatsSupportedForA2DP", "(Ljava/util/ArrayList;)I",
(void*)android_media_AudioSystem_getHwOffloadEncodingFormatsSupportedForA2DP},
{"setAllowedCapturePolicy", "(II)I", (void *)android_media_AudioSystem_setAllowedCapturePolicy},
+ {"setRttEnabled", "(Z)I", (void *)android_media_AudioSystem_setRttEnabled},
};
static const JNINativeMethod gEventHandlerMethods[] = {
diff --git a/core/jni/android_os_Debug.cpp b/core/jni/android_os_Debug.cpp
index 842679e..14dbabb 100644
--- a/core/jni/android_os_Debug.cpp
+++ b/core/jni/android_os_Debug.cpp
@@ -713,16 +713,20 @@
O_CREAT | O_WRONLY | O_NOFOLLOW | O_CLOEXEC | O_APPEND,
0666));
if (fd < 0) {
- fprintf(stderr, "Can't open %s: %s\n", fileNameChars.c_str(), strerror(errno));
+ PLOG(ERROR) << "Can't open " << fileNameChars.c_str();
return false;
}
- return (dump_backtrace_to_file_timeout(pid, dumpType, timeoutSecs, fd) == 0);
+ int res = dump_backtrace_to_file_timeout(pid, dumpType, timeoutSecs, fd);
+ if (fdatasync(fd.get()) != 0) {
+ PLOG(ERROR) << "Failed flushing trace.";
+ }
+ return res == 0;
}
static jboolean android_os_Debug_dumpJavaBacktraceToFileTimeout(JNIEnv* env, jobject clazz,
jint pid, jstring fileName, jint timeoutSecs) {
- const bool ret = dumpTraces(env, pid, fileName, timeoutSecs, kDebuggerdJavaBacktrace);
+ const bool ret = dumpTraces(env, pid, fileName, timeoutSecs, kDebuggerdJavaBacktrace);
return ret ? JNI_TRUE : JNI_FALSE;
}
diff --git a/core/jni/android_os_Trace.cpp b/core/jni/android_os_Trace.cpp
index 81428dc..bd82bd9 100644
--- a/core/jni/android_os_Trace.cpp
+++ b/core/jni/android_os_Trace.cpp
@@ -24,26 +24,29 @@
namespace android {
-inline static void sanitizeString(char* str, size_t size) {
- for (size_t i = 0; i < size; i++) {
- char c = str[i];
- if (c == '\0' || c == '\n' || c == '|') {
- str[i] = ' ';
+inline static void sanitizeString(char* str) {
+ while (*str) {
+ char c = *str;
+ if (c == '\n' || c == '|') {
+ *str = ' ';
}
+ str++;
}
}
-inline static void getString(JNIEnv* env, jstring jstring, char* outBuffer, jsize maxSize) {
- jsize size = std::min(env->GetStringLength(jstring), maxSize);
- env->GetStringUTFRegion(jstring, 0, size, outBuffer);
- sanitizeString(outBuffer, size);
- outBuffer[size] = '\0';
-}
-
template<typename F>
inline static void withString(JNIEnv* env, jstring jstr, F callback) {
- std::array<char, 1024> buffer;
- getString(env, jstr, buffer.data(), buffer.size());
+ // We need to handle the worst case of 1 character -> 4 bytes
+ // So make a buffer of size 4097 and let it hold a string with a maximum length
+ // of 1024. The extra last byte for the null terminator.
+ std::array<char, 4097> buffer;
+ // We have no idea of knowing how much data GetStringUTFRegion wrote, so null it out in
+ // advance so we can have a reliable null terminator
+ memset(buffer.data(), 0, buffer.size());
+ jsize size = std::min(env->GetStringLength(jstr), 1024);
+ env->GetStringUTFRegion(jstr, 0, size, buffer.data());
+ sanitizeString(buffer.data());
+
callback(buffer.data());
}
diff --git a/core/jni/com_android_internal_os_Zygote.cpp b/core/jni/com_android_internal_os_Zygote.cpp
index 8ff1691..4783a25 100644
--- a/core/jni/com_android_internal_os_Zygote.cpp
+++ b/core/jni/com_android_internal_os_Zygote.cpp
@@ -198,7 +198,7 @@
* PIDs don't match nothing will happen.
*
* @param pid The ID of the process who's entry we want to clear.
- * @return True if the entry was cleared; false otherwise
+ * @return True if the entry was cleared by this call; false otherwise
*/
bool ClearForPID(int32_t pid) {
EntryStorage storage = mStorage.load();
@@ -212,14 +212,16 @@
* 3) It fails and the new value isn't INVALID_ENTRY_VALUE, in which
* case the entry has already been cleared and re-used.
*
- * In all three cases the goal of the caller has been met and we can
- * return true.
+ * In all three cases the goal of the caller has been met, but only in
+ * the first case do we need to decrement the pool count.
*/
if (mStorage.compare_exchange_strong(storage, INVALID_ENTRY_VALUE)) {
close(storage.read_pipe_fd);
+ return true;
+ } else {
+ return false;
}
- return true;
} else {
return false;
}
@@ -331,11 +333,24 @@
if (WIFEXITED(status)) {
async_safe_format_log(ANDROID_LOG_INFO, LOG_TAG,
"Process %d exited cleanly (%d)", pid, WEXITSTATUS(status));
+
+ // Check to see if the PID is in the USAP pool and remove it if it is.
+ if (RemoveUsapTableEntry(pid)) {
+ ++usaps_removed;
+ }
} else if (WIFSIGNALED(status)) {
async_safe_format_log(ANDROID_LOG_INFO, LOG_TAG,
"Process %d exited due to signal %d (%s)%s", pid,
WTERMSIG(status), strsignal(WTERMSIG(status)),
WCOREDUMP(status) ? "; core dumped" : "");
+
+ // If the process exited due to a signal other than SIGTERM, check to see
+ // if the PID is in the USAP pool and remove it if it is. If the process
+ // was closed by the Zygote using SIGTERM then the USAP pool entry will
+ // have already been removed (see nativeEmptyUsapPool()).
+ if (WTERMSIG(status) != SIGTERM && RemoveUsapTableEntry(pid)) {
+ ++usaps_removed;
+ }
}
// If the just-crashed process is the system_server, bring down zygote
@@ -346,11 +361,6 @@
"Exit zygote because system server (pid %d) has terminated", pid);
kill(getpid(), SIGKILL);
}
-
- // Check to see if the PID is in the USAP pool and remove it if it is.
- if (RemoveUsapTableEntry(pid)) {
- ++usaps_removed;
- }
}
// Note that we shouldn't consider ECHILD an error because
@@ -1648,7 +1658,13 @@
auto entry_storage = entry.GetValues();
if (entry_storage.has_value()) {
- kill(entry_storage.value().pid, SIGKILL);
+ kill(entry_storage.value().pid, SIGTERM);
+
+ // Clean up the USAP table entry here. This avoids a potential race
+ // where a newly created USAP might not be able to find a valid table
+ // entry if signal handler (which would normally do the cleanup) doesn't
+ // run between now and when the new process is created.
+
close(entry_storage.value().read_pipe_fd);
// Avoid a second atomic load by invalidating instead of clearing.
@@ -1678,6 +1694,16 @@
return dl_iterate_phdr(disable_execute_only, nullptr) == 0;
}
+static void com_android_internal_os_Zygote_nativeBlockSigTerm(JNIEnv* env, jclass) {
+ auto fail_fn = std::bind(ZygoteFailure, env, "usap", nullptr, _1);
+ BlockSignal(SIGTERM, fail_fn);
+}
+
+static void com_android_internal_os_Zygote_nativeUnblockSigTerm(JNIEnv* env, jclass) {
+ auto fail_fn = std::bind(ZygoteFailure, env, "usap", nullptr, _1);
+ UnblockSignal(SIGTERM, fail_fn);
+}
+
static const JNINativeMethod gMethods[] = {
{ "nativeForkAndSpecialize",
"(II[II[[IILjava/lang/String;Ljava/lang/String;[I[IZLjava/lang/String;Ljava/lang/String;)I",
@@ -1708,7 +1734,11 @@
{ "nativeEmptyUsapPool", "()V",
(void *) com_android_internal_os_Zygote_nativeEmptyUsapPool },
{ "nativeDisableExecuteOnly", "()Z",
- (void *) com_android_internal_os_Zygote_nativeDisableExecuteOnly }
+ (void *) com_android_internal_os_Zygote_nativeDisableExecuteOnly },
+ { "nativeBlockSigTerm", "()V",
+ (void* ) com_android_internal_os_Zygote_nativeBlockSigTerm },
+ { "nativeUnblockSigTerm", "()V",
+ (void* ) com_android_internal_os_Zygote_nativeUnblockSigTerm }
};
int register_com_android_internal_os_Zygote(JNIEnv* env) {
diff --git a/core/proto/android/os/incident.proto b/core/proto/android/os/incident.proto
index 9a9c9d1..7d0629e 100644
--- a/core/proto/android/os/incident.proto
+++ b/core/proto/android/os/incident.proto
@@ -321,6 +321,14 @@
(section).args = "incidentcompanion --restricted_image"
];
+ // System trace as a serialized protobuf.
+ optional bytes system_trace = 3026 [
+ (section).type = SECTION_FILE,
+ (section).args = "/data/misc/perfetto-traces/incident-trace",
+ (privacy).dest = DEST_AUTOMATIC,
+ (section).userdebug_and_eng_only = true
+ ];
+
// Reserved for OEMs.
extensions 50000 to 100000;
}
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/res/res/values/colors.xml b/core/res/res/values/colors.xml
index 3b28265..1dcd389 100644
--- a/core/res/res/values/colors.xml
+++ b/core/res/res/values/colors.xml
@@ -79,6 +79,7 @@
<drawable name="input_method_fullscreen_background">#fff9f9f9</drawable>
<color name="decor_view_status_guard">#ff000000</color>
+ <color name="decor_view_status_guard_light">#ffffffff</color>
<!-- For date picker widget -->
<drawable name="selected_day_background">#ff0092f4</drawable>
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 641f223..9d75654 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -1962,6 +1962,7 @@
<java-symbol type="bool" name="show_ongoing_ime_switcher" />
<java-symbol type="color" name="config_defaultNotificationColor" />
<java-symbol type="color" name="decor_view_status_guard" />
+ <java-symbol type="color" name="decor_view_status_guard_light" />
<java-symbol type="drawable" name="ic_notification_ime_default" />
<java-symbol type="drawable" name="ic_menu_refresh" />
<java-symbol type="drawable" name="ic_settings" />
@@ -3803,7 +3804,9 @@
<java-symbol type="string" name="chooser_all_apps_button_label" />
<java-symbol type="anim" name="resolver_launch_anim" />
<java-symbol type="style" name="Animation.DeviceDefault.Activity.Resolver" />
-
+
+ <java-symbol type="color" name="decor_view_status_guard_light" />
+
<java-symbol type="string" name="config_defaultSupervisionProfileOwnerComponent" />
<java-symbol type="bool" name="config_inflateSignalStrength" />
</resources>
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/data/keyboards/Vendor_045e_Product_02d1.kl b/data/keyboards/Vendor_045e_Product_02d1.kl
index 5d1637b..0867670 100644
--- a/data/keyboards/Vendor_045e_Product_02d1.kl
+++ b/data/keyboards/Vendor_045e_Product_02d1.kl
@@ -13,20 +13,22 @@
# limitations under the License.
#
-# XBox One USB Controller
+# XBox One Controller - Model 1537 - USB
#
+# Mapping according to https://developer.android.com/training/game-controllers/controller-input.html
+
key 304 BUTTON_A
key 305 BUTTON_B
key 307 BUTTON_X
key 308 BUTTON_Y
+
key 310 BUTTON_L1
key 311 BUTTON_R1
-key 314 BACK
-key 315 BUTTON_START
-key 316 HOME
-key 317 BUTTON_THUMBL
-key 318 BUTTON_THUMBR
+
+# Triggers.
+axis 0x02 LTRIGGER
+axis 0x05 RTRIGGER
# Left and right stick.
# The reported value for flat is 128 out of a range from -32767 to 32768, which is absurd.
@@ -37,10 +39,19 @@
axis 0x03 Z flat 4096
axis 0x04 RZ flat 4096
-# Triggers.
-axis 0x02 LTRIGGER
-axis 0x05 RTRIGGER
+key 317 BUTTON_THUMBL
+key 318 BUTTON_THUMBR
# Hat.
axis 0x10 HAT_X
axis 0x11 HAT_Y
+
+
+# Mapping according to https://www.kernel.org/doc/Documentation/input/gamepad.txt
+# Two overlapping rectangles
+key 314 BUTTON_SELECT
+# Hamburger - 3 parallel lines
+key 315 BUTTON_START
+
+# Xbox key
+key 316 BUTTON_MODE
diff --git a/data/keyboards/Vendor_045e_Product_02ea.kl b/data/keyboards/Vendor_045e_Product_02ea.kl
new file mode 100644
index 0000000..3b46db2
--- /dev/null
+++ b/data/keyboards/Vendor_045e_Product_02ea.kl
@@ -0,0 +1,57 @@
+# Copyright (C) 2019 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+#
+# XBox One Controller - Model 1708 - USB
+#
+
+# Mapping according to https://developer.android.com/training/game-controllers/controller-input.html
+
+key 304 BUTTON_A
+key 305 BUTTON_B
+key 307 BUTTON_X
+key 308 BUTTON_Y
+
+key 310 BUTTON_L1
+key 311 BUTTON_R1
+
+# Triggers.
+axis 0x02 LTRIGGER
+axis 0x05 RTRIGGER
+
+# Left and right stick.
+# The reported value for flat is 128 out of a range from -32767 to 32768, which is absurd.
+# This confuses applications that rely on the flat value because the joystick actually
+# settles in a flat range of +/- 4096 or so.
+axis 0x00 X flat 4096
+axis 0x01 Y flat 4096
+axis 0x03 Z flat 4096
+axis 0x04 RZ flat 4096
+
+key 317 BUTTON_THUMBL
+key 318 BUTTON_THUMBR
+
+# Hat.
+axis 0x10 HAT_X
+axis 0x11 HAT_Y
+
+
+# Mapping according to https://www.kernel.org/doc/Documentation/input/gamepad.txt
+# Two overlapping rectangles
+key 314 BUTTON_SELECT
+# Hamburger - 3 parallel lines
+key 315 BUTTON_START
+
+# Xbox key
+key 316 BUTTON_MODE
diff --git a/data/keyboards/Vendor_045e_Product_02fd.kl b/data/keyboards/Vendor_045e_Product_02fd.kl
new file mode 100644
index 0000000..512f7e1
--- /dev/null
+++ b/data/keyboards/Vendor_045e_Product_02fd.kl
@@ -0,0 +1,57 @@
+# Copyright (C) 2019 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+#
+# XBox One Controller - Model 1708 - Bluetooth
+#
+
+# Mapping according to https://developer.android.com/training/game-controllers/controller-input.html
+
+key 304 BUTTON_A
+key 305 BUTTON_B
+key 307 BUTTON_X
+key 308 BUTTON_Y
+
+key 310 BUTTON_L1
+key 311 BUTTON_R1
+
+# Triggers.
+axis 0x0a LTRIGGER
+axis 0x09 RTRIGGER
+
+# Left and right stick.
+# The reported value for flat is 128 out of a range from -32767 to 32768, which is absurd.
+# This confuses applications that rely on the flat value because the joystick actually
+# settles in a flat range of +/- 4096 or so.
+axis 0x00 X flat 4096
+axis 0x01 Y flat 4096
+axis 0x02 Z flat 4096
+axis 0x05 RZ flat 4096
+
+key 317 BUTTON_THUMBL
+key 318 BUTTON_THUMBR
+
+# Hat.
+axis 0x10 HAT_X
+axis 0x11 HAT_Y
+
+
+# Mapping according to https://www.kernel.org/doc/Documentation/input/gamepad.txt
+# Two overlapping rectangles
+key 158 BUTTON_SELECT
+# Hamburger - 3 parallel lines
+key 315 BUTTON_START
+
+# Xbox key
+key 172 BUTTON_MODE
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/media/java/android/media/AudioSystem.java b/media/java/android/media/AudioSystem.java
index fde0e64..53bc65d 100644
--- a/media/java/android/media/AudioSystem.java
+++ b/media/java/android/media/AudioSystem.java
@@ -24,7 +24,6 @@
import android.content.pm.PackageManager;
import android.media.audiofx.AudioEffect;
import android.media.audiopolicy.AudioMix;
-import android.os.Build;
import android.util.Log;
import java.util.ArrayList;
@@ -981,6 +980,8 @@
public static native boolean getMasterMono();
/** @hide enables or disables the master mono mode. */
public static native int setMasterMono(boolean mono);
+ /** @hide enables or disables the RTT mode. */
+ public static native int setRttEnabled(boolean enabled);
/** @hide returns master balance value in range -1.f -> 1.f, where 0.f is dead center. */
@TestApi
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/PackageInstaller/src/com/android/packageinstaller/InstallInstalling.java b/packages/PackageInstaller/src/com/android/packageinstaller/InstallInstalling.java
index 93f24f7..4f85eea 100755
--- a/packages/PackageInstaller/src/com/android/packageinstaller/InstallInstalling.java
+++ b/packages/PackageInstaller/src/com/android/packageinstaller/InstallInstalling.java
@@ -130,18 +130,15 @@
} else {
PackageInstaller.SessionParams params = new PackageInstaller.SessionParams(
PackageInstaller.SessionParams.MODE_FULL_INSTALL);
- params.installFlags = PackageManager.INSTALL_FULL_APP;
- params.referrerUri = getIntent().getParcelableExtra(Intent.EXTRA_REFERRER);
- params.originatingUri = getIntent()
- .getParcelableExtra(Intent.EXTRA_ORIGINATING_URI);
- params.originatingUid = getIntent().getIntExtra(Intent.EXTRA_ORIGINATING_UID,
- UID_UNKNOWN);
- params.installerPackageName =
- getIntent().getStringExtra(Intent.EXTRA_INSTALLER_PACKAGE_NAME);
- params.installReason = PackageManager.INSTALL_REASON_USER;
-
- // Whitelist all restricted permissions.
- params.setWhitelistedRestrictedPermissions(null /*permissions*/);
+ params.setInstallAsInstantApp(false);
+ params.setReferrerUri(getIntent().getParcelableExtra(Intent.EXTRA_REFERRER));
+ params.setOriginatingUri(getIntent()
+ .getParcelableExtra(Intent.EXTRA_ORIGINATING_URI));
+ params.setOriginatingUid(getIntent().getIntExtra(Intent.EXTRA_ORIGINATING_UID,
+ UID_UNKNOWN));
+ params.setInstallerPackageName(getIntent().getStringExtra(
+ Intent.EXTRA_INSTALLER_PACKAGE_NAME));
+ params.setInstallReason(PackageManager.INSTALL_REASON_USER);
File file = new File(mPackageURI.getPath());
try {
diff --git a/packages/SettingsLib/src/com/android/settingslib/graph/SignalDrawable.java b/packages/SettingsLib/src/com/android/settingslib/graph/SignalDrawable.java
index 98eb573..c7380c58 100644
--- a/packages/SettingsLib/src/com/android/settingslib/graph/SignalDrawable.java
+++ b/packages/SettingsLib/src/com/android/settingslib/graph/SignalDrawable.java
@@ -132,6 +132,7 @@
super.onLevelChange(unpackLevel(packedState));
updateAnimation();
setTintList(ColorStateList.valueOf(mForegroundPaint.getColor()));
+ invalidateSelf();
return true;
}
diff --git a/packages/SettingsLib/src/com/android/settingslib/wifi/AccessPoint.java b/packages/SettingsLib/src/com/android/settingslib/wifi/AccessPoint.java
index 9036abc..ab174f4 100644
--- a/packages/SettingsLib/src/com/android/settingslib/wifi/AccessPoint.java
+++ b/packages/SettingsLib/src/com/android/settingslib/wifi/AccessPoint.java
@@ -55,6 +55,7 @@
import android.util.Log;
import android.util.Pair;
+import androidx.annotation.GuardedBy;
import androidx.annotation.NonNull;
import com.android.internal.annotations.VisibleForTesting;
@@ -108,6 +109,14 @@
/** The key which identifies this AccessPoint grouping. */
private String mKey;
+ /**
+ * Synchronization lock for managing concurrency between main and worker threads.
+ *
+ * <p>This lock should be held for all modifications to {@link #mScanResults} and
+ * {@link #mExtraScanResults}.
+ */
+ private final Object mLock = new Object();
+
@IntDef({Speed.NONE, Speed.SLOW, Speed.MODERATE, Speed.FAST, Speed.VERY_FAST})
@Retention(RetentionPolicy.SOURCE)
public @interface Speed {
@@ -134,12 +143,14 @@
}
/** The underlying set of scan results comprising this AccessPoint. */
+ @GuardedBy("mLock")
private final ArraySet<ScanResult> mScanResults = new ArraySet<>();
/**
* Extra set of unused scan results corresponding to this AccessPoint for verbose logging
* purposes, such as a set of Passpoint roaming scan results when home scans are available.
*/
+ @GuardedBy("mLock")
private final ArraySet<ScanResult> mExtraScanResults = new ArraySet<>();
/**
@@ -489,8 +500,10 @@
if (isVerboseLoggingEnabled()) {
builder.append(",rssi=").append(mRssi);
- builder.append(",scan cache size=").append(mScanResults.size()
- + mExtraScanResults.size());
+ synchronized (mLock) {
+ builder.append(",scan cache size=").append(mScanResults.size()
+ + mExtraScanResults.size());
+ }
}
return builder.append(')').toString();
@@ -532,18 +545,20 @@
*/
private boolean updateScores(WifiNetworkScoreCache scoreCache, long maxScoreCacheAgeMillis) {
long nowMillis = SystemClock.elapsedRealtime();
- for (ScanResult result : mScanResults) {
- ScoredNetwork score = scoreCache.getScoredNetwork(result);
- if (score == null) {
- continue;
- }
- TimestampedScoredNetwork timedScore = mScoredNetworkCache.get(result.BSSID);
- if (timedScore == null) {
- mScoredNetworkCache.put(
- result.BSSID, new TimestampedScoredNetwork(score, nowMillis));
- } else {
- // Update data since the has been seen in the score cache
- timedScore.update(score, nowMillis);
+ synchronized (mLock) {
+ for (ScanResult result : mScanResults) {
+ ScoredNetwork score = scoreCache.getScoredNetwork(result);
+ if (score == null) {
+ continue;
+ }
+ TimestampedScoredNetwork timedScore = mScoredNetworkCache.get(result.BSSID);
+ if (timedScore == null) {
+ mScoredNetworkCache.put(
+ result.BSSID, new TimestampedScoredNetwork(score, nowMillis));
+ } else {
+ // Update data since the has been seen in the score cache
+ timedScore.update(score, nowMillis);
+ }
}
}
@@ -619,12 +634,14 @@
mIsScoredNetworkMetered |= score.meteredHint;
}
} else {
- for (ScanResult result : mScanResults) {
- ScoredNetwork score = scoreCache.getScoredNetwork(result);
- if (score == null) {
- continue;
+ synchronized (mLock) {
+ for (ScanResult result : mScanResults) {
+ ScoredNetwork score = scoreCache.getScoredNetwork(result);
+ if (score == null) {
+ continue;
+ }
+ mIsScoredNetworkMetered |= score.meteredHint;
}
- mIsScoredNetworkMetered |= score.meteredHint;
}
}
return oldMetering == mIsScoredNetworkMetered;
@@ -741,8 +758,10 @@
*/
public Set<ScanResult> getScanResults() {
Set<ScanResult> allScans = new ArraySet<>();
- allScans.addAll(mScanResults);
- allScans.addAll(mExtraScanResults);
+ synchronized (mLock) {
+ allScans.addAll(mScanResults);
+ allScans.addAll(mExtraScanResults);
+ }
return allScans;
}
@@ -766,10 +785,12 @@
ScanResult bestResult = null;
int bestRssi = UNREACHABLE_RSSI;
- for (ScanResult result : mScanResults) {
- if (result.level > bestRssi) {
- bestRssi = result.level;
- bestResult = result;
+ synchronized (mLock) {
+ for (ScanResult result : mScanResults) {
+ if (result.level > bestRssi) {
+ bestRssi = result.level;
+ bestResult = result;
+ }
}
}
@@ -1210,9 +1231,11 @@
savedState.putInt(KEY_EAPTYPE, mEapType);
if (mConfig != null) savedState.putParcelable(KEY_CONFIG, mConfig);
savedState.putParcelable(KEY_WIFIINFO, mInfo);
- savedState.putParcelableArray(KEY_SCANRESULTS,
- mScanResults.toArray(new Parcelable[mScanResults.size()
- + mExtraScanResults.size()]));
+ synchronized (mLock) {
+ savedState.putParcelableArray(KEY_SCANRESULTS,
+ mScanResults.toArray(new Parcelable[mScanResults.size()
+ + mExtraScanResults.size()]));
+ }
savedState.putParcelableArrayList(KEY_SCOREDNETWORKCACHE,
new ArrayList<>(mScoredNetworkCache.values()));
if (mNetworkInfo != null) {
@@ -1291,8 +1314,10 @@
}
int oldLevel = getLevel();
- mScanResults.clear();
- mScanResults.addAll(scanResults);
+ synchronized (mLock) {
+ mScanResults.clear();
+ mScanResults.addAll(scanResults);
+ }
updateBestRssiInfo();
int newLevel = getLevel();
@@ -1323,16 +1348,18 @@
void setScanResultsPasspoint(
@Nullable Collection<ScanResult> homeScans,
@Nullable Collection<ScanResult> roamingScans) {
- mExtraScanResults.clear();
- if (!CollectionUtils.isEmpty(homeScans)) {
- if (!CollectionUtils.isEmpty(roamingScans)) {
- mExtraScanResults.addAll(roamingScans);
+ synchronized (mLock) {
+ mExtraScanResults.clear();
+ if (!CollectionUtils.isEmpty(homeScans)) {
+ mIsRoaming = false;
+ if (!CollectionUtils.isEmpty(roamingScans)) {
+ mExtraScanResults.addAll(roamingScans);
+ }
+ setScanResults(homeScans);
+ } else if (!CollectionUtils.isEmpty(roamingScans)) {
+ mIsRoaming = true;
+ setScanResults(roamingScans);
}
- mIsRoaming = false;
- setScanResults(homeScans);
- } else if (!CollectionUtils.isEmpty(roamingScans)) {
- mIsRoaming = true;
- setScanResults(roamingScans);
}
}
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/legacy/recents/src/com/android/systemui/recents/RecentsActivity.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/RecentsActivity.java
index 79c691c..a7ccc3a 100644
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/RecentsActivity.java
+++ b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/RecentsActivity.java
@@ -323,7 +323,7 @@
mColorExtractor = Dependency.get(SysuiColorExtractor.class);
mColorExtractor.addOnColorsChangedListener(this);
mUsingDarkText = mColorExtractor.getColors(ColorExtractor.TYPE_DARK,
- WallpaperManager.FLAG_SYSTEM, true).supportsDarkText();
+ WallpaperManager.FLAG_SYSTEM).supportsDarkText();
setTheme(mUsingDarkText ? R.style.RecentsTheme_Wallpaper_Light
: R.style.RecentsTheme_Wallpaper);
@@ -394,8 +394,6 @@
@Override
public void onColorsChanged(ColorExtractor colorExtractor, int which) {
if ((which & WallpaperManager.FLAG_SYSTEM) != 0) {
- // Recents doesn't care about the wallpaper being visible or not, it always
- // wants to scrim with wallpaper colors
ColorExtractor.GradientColors colors = mColorExtractor.getNeutralColors();
boolean darkText = colors.supportsDarkText();
if (darkText != mUsingDarkText) {
diff --git a/packages/SystemUI/res-keyguard/values/styles.xml b/packages/SystemUI/res-keyguard/values/styles.xml
index 9a04222..67c4458 100644
--- a/packages/SystemUI/res-keyguard/values/styles.xml
+++ b/packages/SystemUI/res-keyguard/values/styles.xml
@@ -111,7 +111,7 @@
<item name="android:colorBackground">@*android:color/background_material_dark</item>
</style>
- <style name="TextAppearance.Keyguard" parent="Theme.SystemUI">
+ <style name="TextAppearance.Keyguard">
<item name="android:textSize">@dimen/widget_title_font_size</item>
<item name="android:gravity">center</item>
<item name="android:ellipsize">end</item>
diff --git a/packages/SystemUI/res/layout/notif_half_shelf.xml b/packages/SystemUI/res/layout/notif_half_shelf.xml
index a563bb5..26c8872 100644
--- a/packages/SystemUI/res/layout/notif_half_shelf.xml
+++ b/packages/SystemUI/res/layout/notif_half_shelf.xml
@@ -69,7 +69,7 @@
<Switch
android:id="@+id/toggle"
- android:layout_height="wrap_content"
+ android:layout_height="48dp"
android:layout_width="wrap_content"
android:layout_gravity="center_vertical"
android:padding="8dp" />
diff --git a/packages/SystemUI/res/layout/notif_half_shelf_row.xml b/packages/SystemUI/res/layout/notif_half_shelf_row.xml
index 1b80455..b95d5e9 100644
--- a/packages/SystemUI/res/layout/notif_half_shelf_row.xml
+++ b/packages/SystemUI/res/layout/notif_half_shelf_row.xml
@@ -71,7 +71,7 @@
<Switch
android:id="@+id/toggle"
- android:layout_height="wrap_content"
+ android:layout_height="48dp"
android:layout_width="wrap_content"
android:layout_gravity="center_vertical"
android:padding="8dp"
diff --git a/packages/SystemUI/res/layout/status_bar_notification_section_header.xml b/packages/SystemUI/res/layout/status_bar_notification_section_header.xml
index d3eb9ae..eabc5c5 100644
--- a/packages/SystemUI/res/layout/status_bar_notification_section_header.xml
+++ b/packages/SystemUI/res/layout/status_bar_notification_section_header.xml
@@ -49,6 +49,7 @@
android:text="@string/notification_section_header_gentle"
android:textSize="12sp"
android:textColor="@color/notification_section_header_label_color"
+ android:fontFamily="@*android:string/config_headlineFontFamilyMedium"
/>
<ImageView
android:id="@+id/btn_clear_all"
diff --git a/packages/SystemUI/res/values/styles.xml b/packages/SystemUI/res/values/styles.xml
index b387793..2f1770a 100644
--- a/packages/SystemUI/res/values/styles.xml
+++ b/packages/SystemUI/res/values/styles.xml
@@ -450,7 +450,7 @@
<style name="TextAppearance.NotificationInfo.Secondary">
<item name="android:textSize">14sp</item>
- <item name="android:alpha">0.54</item>
+ <item name="android:alpha">0.62</item>
</style>
<style name="TextAppearance.NotificationInfo.Title">
diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/system/ActivityManagerWrapper.java b/packages/SystemUI/shared/src/com/android/systemui/shared/system/ActivityManagerWrapper.java
index 6b07ed8..a2abb4b 100644
--- a/packages/SystemUI/shared/src/com/android/systemui/shared/system/ActivityManagerWrapper.java
+++ b/packages/SystemUI/shared/src/com/android/systemui/shared/system/ActivityManagerWrapper.java
@@ -64,6 +64,7 @@
import java.util.ArrayList;
import java.util.List;
+import java.util.concurrent.Future;
import java.util.function.Consumer;
public class ActivityManagerWrapper {
@@ -380,8 +381,8 @@
/**
* Requests that the system close any open system windows (including other SystemUI).
*/
- public void closeSystemWindows(final String reason) {
- mBackgroundExecutor.submit(new Runnable() {
+ public Future<?> closeSystemWindows(final String reason) {
+ return mBackgroundExecutor.submit(new Runnable() {
@Override
public void run() {
try {
diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/system/SyncRtSurfaceTransactionApplierCompat.java b/packages/SystemUI/shared/src/com/android/systemui/shared/system/SyncRtSurfaceTransactionApplierCompat.java
index bd7b3d5..9ba21a3 100644
--- a/packages/SystemUI/shared/src/com/android/systemui/shared/system/SyncRtSurfaceTransactionApplierCompat.java
+++ b/packages/SystemUI/shared/src/com/android/systemui/shared/system/SyncRtSurfaceTransactionApplierCompat.java
@@ -22,6 +22,7 @@
import android.os.Handler;
import android.os.Handler.Callback;
import android.os.Message;
+import android.os.Trace;
import android.view.Surface;
import android.view.View;
import android.view.ViewRootImpl;
@@ -95,6 +96,7 @@
.sendToTarget();
return;
}
+ Trace.traceBegin(Trace.TRACE_TAG_VIEW, "Sync transaction frameNumber=" + frame);
TransactionCompat t = new TransactionCompat();
for (int i = params.length - 1; i >= 0; i--) {
SyncRtSurfaceTransactionApplierCompat.SurfaceParams surfaceParams =
@@ -105,6 +107,7 @@
}
t.setEarlyWakeup();
t.apply();
+ Trace.traceEnd(Trace.TRACE_TAG_VIEW);
Message.obtain(mApplyHandler, MSG_UPDATE_SEQUENCE_NUMBER, toApplySeqNo, 0)
.sendToTarget();
}
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitch.java b/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitch.java
index 0bb9e744..7ec1bda 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitch.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitch.java
@@ -374,7 +374,7 @@
private void updateColors() {
ColorExtractor.GradientColors colors = mSysuiColorExtractor.getColors(
- WallpaperManager.FLAG_LOCK, true);
+ WallpaperManager.FLAG_LOCK);
mSupportsDarkText = colors.supportsDarkText();
mColorPalette = colors.getColorPalette();
if (mClockPlugin != null) {
diff --git a/packages/SystemUI/src/com/android/keyguard/clock/AnalogClockController.java b/packages/SystemUI/src/com/android/keyguard/clock/AnalogClockController.java
index f468eca..558ac4b 100644
--- a/packages/SystemUI/src/com/android/keyguard/clock/AnalogClockController.java
+++ b/packages/SystemUI/src/com/android/keyguard/clock/AnalogClockController.java
@@ -130,7 +130,7 @@
setDarkAmount(1f);
setTextColor(Color.WHITE);
ColorExtractor.GradientColors colors = mColorExtractor.getColors(
- WallpaperManager.FLAG_LOCK, true);
+ WallpaperManager.FLAG_LOCK);
setColorPalette(colors.supportsDarkText(), colors.getColorPalette());
onTimeTick();
diff --git a/packages/SystemUI/src/com/android/keyguard/clock/BubbleClockController.java b/packages/SystemUI/src/com/android/keyguard/clock/BubbleClockController.java
index 61a6952..bdf9dc4 100644
--- a/packages/SystemUI/src/com/android/keyguard/clock/BubbleClockController.java
+++ b/packages/SystemUI/src/com/android/keyguard/clock/BubbleClockController.java
@@ -130,7 +130,7 @@
setDarkAmount(1f);
setTextColor(Color.WHITE);
ColorExtractor.GradientColors colors = mColorExtractor.getColors(
- WallpaperManager.FLAG_LOCK, true);
+ WallpaperManager.FLAG_LOCK);
setColorPalette(colors.supportsDarkText(), colors.getColorPalette());
onTimeTick();
diff --git a/packages/SystemUI/src/com/android/keyguard/clock/DefaultClockController.java b/packages/SystemUI/src/com/android/keyguard/clock/DefaultClockController.java
index ce1f09c..98679ade 100644
--- a/packages/SystemUI/src/com/android/keyguard/clock/DefaultClockController.java
+++ b/packages/SystemUI/src/com/android/keyguard/clock/DefaultClockController.java
@@ -124,7 +124,7 @@
setDarkAmount(1f);
setTextColor(Color.WHITE);
ColorExtractor.GradientColors colors = mColorExtractor.getColors(
- WallpaperManager.FLAG_LOCK, true);
+ WallpaperManager.FLAG_LOCK);
setColorPalette(colors.supportsDarkText(), colors.getColorPalette());
onTimeTick();
diff --git a/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java b/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java
index 305558f..73e57de 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);
}
}
@@ -764,6 +768,10 @@
@Override
public void onDarkIntensity(float darkIntensity) {
+ if (!mHandler.getLooper().isCurrentThread()) {
+ mHandler.post(() -> onDarkIntensity(darkIntensity));
+ return;
+ }
if (mOverlay != null) {
CornerHandleView assistHintTopLeft = mOverlay.findViewById(R.id.assist_hint_left);
CornerHandleView assistHintTopRight = mOverlay.findViewById(R.id.assist_hint_right);
@@ -911,6 +919,7 @@
if (shouldDrawCutout(getContext()) && hasCutout()) {
mBounds.addAll(mInfo.displayCutout.getBoundingRects());
localBounds(mBoundingRect);
+ updateGravity();
updateBoundingPath();
invalidate();
newVisible = VISIBLE;
@@ -961,6 +970,18 @@
}
}
+ private void updateGravity() {
+ LayoutParams lp = getLayoutParams();
+ if (lp instanceof FrameLayout.LayoutParams) {
+ FrameLayout.LayoutParams flp = (FrameLayout.LayoutParams) lp;
+ int newGravity = getGravity(mInfo.displayCutout);
+ if (flp.gravity != newGravity) {
+ flp.gravity = newGravity;
+ setLayoutParams(flp);
+ }
+ }
+ }
+
private boolean hasCutout() {
final DisplayCutout displayCutout = mInfo.displayCutout;
if (displayCutout == null) {
@@ -1007,21 +1028,25 @@
}
private void localBounds(Rect out) {
- final DisplayCutout displayCutout = mInfo.displayCutout;
+ DisplayCutout displayCutout = mInfo.displayCutout;
+ boundsFromDirection(displayCutout, getGravity(displayCutout), out);
+ }
+ private int getGravity(DisplayCutout displayCutout) {
if (mStart) {
if (displayCutout.getSafeInsetLeft() > 0) {
- boundsFromDirection(displayCutout, Gravity.LEFT, out);
+ return Gravity.LEFT;
} else if (displayCutout.getSafeInsetTop() > 0) {
- boundsFromDirection(displayCutout, Gravity.TOP, out);
+ return Gravity.TOP;
}
} else {
if (displayCutout.getSafeInsetRight() > 0) {
- boundsFromDirection(displayCutout, Gravity.RIGHT, out);
+ return Gravity.RIGHT;
} else if (displayCutout.getSafeInsetBottom() > 0) {
- boundsFromDirection(displayCutout, Gravity.BOTTOM, out);
+ return Gravity.BOTTOM;
}
}
+ return Gravity.NO_GRAVITY;
}
@Override
diff --git a/packages/SystemUI/src/com/android/systemui/assist/AssistHandleBehaviorController.java b/packages/SystemUI/src/com/android/systemui/assist/AssistHandleBehaviorController.java
index b7479985..002d4f3 100644
--- a/packages/SystemUI/src/com/android/systemui/assist/AssistHandleBehaviorController.java
+++ b/packages/SystemUI/src/com/android/systemui/assist/AssistHandleBehaviorController.java
@@ -243,12 +243,12 @@
return;
}
- mHandlesShowing = false;
- mHandlesLastHiddenAt = SystemClock.elapsedRealtime();
ScreenDecorations screenDecorations = mScreenDecorationsSupplier.get();
if (screenDecorations == null) {
Log.w(TAG, "Couldn't hide handles, ScreenDecorations unavailable");
} else {
+ mHandlesShowing = false;
+ mHandlesLastHiddenAt = SystemClock.elapsedRealtime();
screenDecorations.setAssistHintVisible(false);
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/assist/AssistHandleReminderExpBehavior.java b/packages/SystemUI/src/com/android/systemui/assist/AssistHandleReminderExpBehavior.java
index 87fb28b..909b68b 100644
--- a/packages/SystemUI/src/com/android/systemui/assist/AssistHandleReminderExpBehavior.java
+++ b/packages/SystemUI/src/com/android/systemui/assist/AssistHandleReminderExpBehavior.java
@@ -16,14 +16,13 @@
package com.android.systemui.assist;
-import static com.android.systemui.shared.system.PackageManagerWrapper.ACTION_PREFERRED_ACTIVITY_CHANGED;
-
import android.app.ActivityManager;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
+import android.content.pm.ResolveInfo;
import android.os.Handler;
import android.os.SystemClock;
import android.provider.Settings;
@@ -44,6 +43,7 @@
import java.io.PrintWriter;
import java.time.LocalDate;
import java.util.ArrayList;
+import java.util.List;
import java.util.concurrent.TimeUnit;
/**
@@ -68,6 +68,14 @@
private static final boolean DEFAULT_SUPPRESS_ON_LAUNCHER = false;
private static final boolean DEFAULT_SUPPRESS_ON_APPS = false;
+ private static final String[] DEFAULT_HOME_CHANGE_ACTIONS = new String[] {
+ PackageManagerWrapper.ACTION_PREFERRED_ACTIVITY_CHANGED,
+ Intent.ACTION_BOOT_COMPLETED,
+ Intent.ACTION_PACKAGE_ADDED,
+ Intent.ACTION_PACKAGE_CHANGED,
+ Intent.ACTION_PACKAGE_REMOVED
+ };
+
private final StatusBarStateController.StateListener mStatusBarStateListener =
new StatusBarStateController.StateListener() {
@Override
@@ -110,8 +118,7 @@
mDefaultHome = getCurrentDefaultHome();
}
};
- private final IntentFilter mDefaultHomeIntentFilter =
- new IntentFilter(ACTION_PREFERRED_ACTIVITY_CHANGED);
+ private final IntentFilter mDefaultHomeIntentFilter;
private final Runnable mResetConsecutiveTaskSwitches = this::resetConsecutiveTaskSwitches;
private final Handler mHandler;
@@ -146,6 +153,10 @@
mStatusBarStateController = Dependency.get(StatusBarStateController.class);
mActivityManagerWrapper = ActivityManagerWrapper.getInstance();
mOverviewProxyService = Dependency.get(OverviewProxyService.class);
+ mDefaultHomeIntentFilter = new IntentFilter();
+ for (String action : DEFAULT_HOME_CHANGE_ACTIONS) {
+ mDefaultHomeIntentFilter.addAction(action);
+ }
}
@Override
@@ -205,7 +216,24 @@
@Nullable
private static ComponentName getCurrentDefaultHome() {
- return PackageManagerWrapper.getInstance().getHomeActivities(new ArrayList<>());
+ List<ResolveInfo> homeActivities = new ArrayList<>();
+ ComponentName defaultHome =
+ PackageManagerWrapper.getInstance().getHomeActivities(homeActivities);
+ if (defaultHome != null) {
+ return defaultHome;
+ }
+
+ int topPriority = Integer.MIN_VALUE;
+ ComponentName topComponent = null;
+ for (ResolveInfo resolveInfo : homeActivities) {
+ if (resolveInfo.priority > topPriority) {
+ topComponent = resolveInfo.activityInfo.getComponentName();
+ topPriority = resolveInfo.priority;
+ } else if (resolveInfo.priority == topPriority) {
+ topComponent = null;
+ }
+ }
+ return topComponent;
}
private void handleStatusBarStateChanged(int newState) {
diff --git a/packages/SystemUI/src/com/android/systemui/assist/PhoneStateMonitor.java b/packages/SystemUI/src/com/android/systemui/assist/PhoneStateMonitor.java
index 1fd3089..e73dc4a 100644
--- a/packages/SystemUI/src/com/android/systemui/assist/PhoneStateMonitor.java
+++ b/packages/SystemUI/src/com/android/systemui/assist/PhoneStateMonitor.java
@@ -16,8 +16,6 @@
package com.android.systemui.assist;
-import static com.android.systemui.shared.system.PackageManagerWrapper.ACTION_PREFERRED_ACTIVITY_CHANGED;
-
import android.app.ActivityManager;
import android.app.KeyguardManager;
import android.content.BroadcastReceiver;
@@ -25,6 +23,7 @@
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
+import android.content.pm.ResolveInfo;
import androidx.annotation.Nullable;
@@ -38,6 +37,7 @@
import com.android.systemui.statusbar.phone.StatusBar;
import java.util.ArrayList;
+import java.util.List;
/** Class to monitor and report the state of the phone. */
final class PhoneStateMonitor {
@@ -53,6 +53,14 @@
private static final int PHONE_STATE_APP_IMMERSIVE = 9;
private static final int PHONE_STATE_APP_FULLSCREEN = 10;
+ private static final String[] DEFAULT_HOME_CHANGE_ACTIONS = new String[] {
+ PackageManagerWrapper.ACTION_PREFERRED_ACTIVITY_CHANGED,
+ Intent.ACTION_BOOT_COMPLETED,
+ Intent.ACTION_PACKAGE_ADDED,
+ Intent.ACTION_PACKAGE_CHANGED,
+ Intent.ACTION_PACKAGE_REMOVED
+ };
+
private final Context mContext;
private final StatusBarStateController mStatusBarStateController;
@@ -64,14 +72,17 @@
mStatusBarStateController = Dependency.get(StatusBarStateController.class);
ActivityManagerWrapper activityManagerWrapper = ActivityManagerWrapper.getInstance();
- mDefaultHome = PackageManagerWrapper.getInstance().getHomeActivities(new ArrayList<>());
+ mDefaultHome = getCurrentDefaultHome();
+ IntentFilter intentFilter = new IntentFilter();
+ for (String action : DEFAULT_HOME_CHANGE_ACTIONS) {
+ intentFilter.addAction(action);
+ }
mContext.registerReceiver(new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
- mDefaultHome =
- PackageManagerWrapper.getInstance().getHomeActivities(new ArrayList<>());
+ mDefaultHome = getCurrentDefaultHome();
}
- }, new IntentFilter(ACTION_PREFERRED_ACTIVITY_CHANGED));
+ }, intentFilter);
mLauncherShowing = isLauncherShowing(activityManagerWrapper.getRunningTask());
activityManagerWrapper.registerTaskStackListener(new TaskStackChangeListener() {
@Override
@@ -93,6 +104,28 @@
return phoneState;
}
+ @Nullable
+ private static ComponentName getCurrentDefaultHome() {
+ List<ResolveInfo> homeActivities = new ArrayList<>();
+ ComponentName defaultHome =
+ PackageManagerWrapper.getInstance().getHomeActivities(homeActivities);
+ if (defaultHome != null) {
+ return defaultHome;
+ }
+
+ int topPriority = Integer.MIN_VALUE;
+ ComponentName topComponent = null;
+ for (ResolveInfo resolveInfo : homeActivities) {
+ if (resolveInfo.priority > topPriority) {
+ topComponent = resolveInfo.activityInfo.getComponentName();
+ topPriority = resolveInfo.priority;
+ } else if (resolveInfo.priority == topPriority) {
+ topComponent = null;
+ }
+ }
+ return topComponent;
+ }
+
private int getPhoneLockscreenState() {
if (isDozing()) {
return PHONE_STATE_AOD1;
diff --git a/packages/SystemUI/src/com/android/systemui/colorextraction/SysuiColorExtractor.java b/packages/SystemUI/src/com/android/systemui/colorextraction/SysuiColorExtractor.java
index 835ffc9..6f56a53 100644
--- a/packages/SystemUI/src/com/android/systemui/colorextraction/SysuiColorExtractor.java
+++ b/packages/SystemUI/src/com/android/systemui/colorextraction/SysuiColorExtractor.java
@@ -16,18 +16,11 @@
package com.android.systemui.colorextraction;
-import android.annotation.ColorInt;
import android.app.WallpaperColors;
import android.app.WallpaperManager;
import android.content.Context;
-import android.os.Handler;
-import android.os.RemoteException;
+import android.graphics.Color;
import android.os.UserHandle;
-import android.util.Log;
-import android.view.Display;
-import android.view.IWallpaperVisibilityListener;
-import android.view.IWindowManager;
-import android.view.WindowManagerGlobal;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.colorextraction.ColorExtractor;
@@ -52,46 +45,28 @@
ConfigurationController.ConfigurationListener {
private static final String TAG = "SysuiColorExtractor";
private final Tonal mTonal;
- private boolean mWallpaperVisible;
- private boolean mHasBackdrop;
- // Colors to return when the wallpaper isn't visible
- private final GradientColors mWpHiddenColors;
+ private boolean mHasMediaArtwork;
+ private final GradientColors mNeutralColorsLock;
+ private final GradientColors mBackdropColors;
@Inject
public SysuiColorExtractor(Context context, ConfigurationController configurationController) {
- this(context, new Tonal(context), configurationController, true);
+ this(context, new Tonal(context), configurationController,
+ context.getSystemService(WallpaperManager.class), false /* immediately */);
}
@VisibleForTesting
public SysuiColorExtractor(Context context, ExtractionType type,
- ConfigurationController configurationController, boolean registerVisibility) {
- super(context, type, false /* immediately */);
+ ConfigurationController configurationController,
+ WallpaperManager wallpaperManager, boolean immediately) {
+ super(context, type, immediately, wallpaperManager);
mTonal = type instanceof Tonal ? (Tonal) type : new Tonal(context);
- mWpHiddenColors = new GradientColors();
+ mNeutralColorsLock = new GradientColors();
configurationController.addCallback(this);
- WallpaperColors systemColors = getWallpaperColors(WallpaperManager.FLAG_SYSTEM);
- updateDefaultGradients(systemColors);
+ mBackdropColors = new GradientColors();
+ mBackdropColors.setMainColor(Color.BLACK);
- if (registerVisibility) {
- try {
- IWindowManager windowManagerService = WindowManagerGlobal.getWindowManagerService();
- Handler handler = Handler.getMain();
- boolean visible = windowManagerService.registerWallpaperVisibilityListener(
- new IWallpaperVisibilityListener.Stub() {
- @Override
- public void onWallpaperVisibilityChanged(boolean newVisibility,
- int displayId) throws RemoteException {
- handler.post(() -> setWallpaperVisible(newVisibility));
- }
- }, Display.DEFAULT_DISPLAY);
- setWallpaperVisible(visible);
- } catch (RemoteException e) {
- Log.w(TAG, "Can't listen to wallpaper visibility changes", e);
- }
- }
-
- WallpaperManager wallpaperManager = context.getSystemService(WallpaperManager.class);
if (wallpaperManager != null) {
// Listen to all users instead of only the current one.
wallpaperManager.removeOnColorsChangedListener(this);
@@ -100,8 +75,14 @@
}
}
- private void updateDefaultGradients(WallpaperColors colors) {
- mTonal.applyFallback(colors, mWpHiddenColors);
+ @Override
+ protected void extractWallpaperColors() {
+ super.extractWallpaperColors();
+ // mTonal is final but this method will be invoked by the base class during its ctor.
+ if (mTonal == null) {
+ return;
+ }
+ mTonal.applyFallback(mLockColors == null ? mSystemColors : mLockColors, mNeutralColorsLock);
}
@Override
@@ -110,27 +91,28 @@
// Colors do not belong to current user, ignoring.
return;
}
-
- super.onColorsChanged(colors, which);
-
- if ((which & WallpaperManager.FLAG_SYSTEM) != 0) {
- @ColorInt int oldColor = mWpHiddenColors.getMainColor();
- updateDefaultGradients(colors);
- if (oldColor != mWpHiddenColors.getMainColor()) {
- triggerColorsChanged(WallpaperManager.FLAG_SYSTEM);
- }
+ if ((which & WallpaperManager.FLAG_LOCK) != 0) {
+ mTonal.applyFallback(colors, mNeutralColorsLock);
}
+ super.onColorsChanged(colors, which);
}
@Override
public void onUiModeChanged() {
- WallpaperColors systemColors = getWallpaperColors(WallpaperManager.FLAG_SYSTEM);
- updateDefaultGradients(systemColors);
- triggerColorsChanged(WallpaperManager.FLAG_SYSTEM);
+ extractWallpaperColors();
+ triggerColorsChanged(WallpaperManager.FLAG_SYSTEM | WallpaperManager.FLAG_LOCK);
+ }
+
+ @Override
+ public GradientColors getColors(int which, int type) {
+ if (mHasMediaArtwork && (which & WallpaperManager.FLAG_LOCK) != 0) {
+ return mBackdropColors;
+ }
+ return super.getColors(which, type);
}
/**
- * Colors the should be using for scrims.
+ * Colors that should be using for scrims.
*
* They will be:
* - A light gray if the wallpaper is light
@@ -138,81 +120,12 @@
* - Black otherwise
*/
public GradientColors getNeutralColors() {
- return mWpHiddenColors;
+ return mHasMediaArtwork ? mBackdropColors : mNeutralColorsLock;
}
- /**
- * Get TYPE_NORMAL colors when wallpaper is visible, or fallback otherwise.
- *
- * @param which FLAG_LOCK or FLAG_SYSTEM
- * @return colors
- */
- @Override
- public GradientColors getColors(int which) {
- return getColors(which, TYPE_DARK);
- }
-
- /**
- * Wallpaper colors when the wallpaper is visible, fallback otherwise.
- *
- * @param which FLAG_LOCK or FLAG_SYSTEM
- * @param type TYPE_NORMAL, TYPE_DARK or TYPE_EXTRA_DARK
- * @return colors
- */
- @Override
- public GradientColors getColors(int which, int type) {
- return getColors(which, type, false /* ignoreVisibility */);
- }
-
- /**
- * Get TYPE_NORMAL colors, possibly ignoring wallpaper visibility.
- *
- * @param which FLAG_LOCK or FLAG_SYSTEM
- * @param ignoreWallpaperVisibility whether you want fallback colors or not if the wallpaper
- * isn't visible
- * @return
- */
- public GradientColors getColors(int which, boolean ignoreWallpaperVisibility) {
- return getColors(which, TYPE_NORMAL, ignoreWallpaperVisibility);
- }
-
- /**
- *
- * @param which FLAG_LOCK or FLAG_SYSTEM
- * @param type TYPE_NORMAL, TYPE_DARK or TYPE_EXTRA_DARK
- * @param ignoreWallpaperVisibility true if true wallpaper colors should be returning
- * if it's visible or not
- * @return colors
- */
- public GradientColors getColors(int which, int type, boolean ignoreWallpaperVisibility) {
- // mWallpaperVisible only handles the "system wallpaper" and will be always set to false
- // if we have different lock and system wallpapers.
- if (which == WallpaperManager.FLAG_SYSTEM) {
- if (mWallpaperVisible || ignoreWallpaperVisibility) {
- return super.getColors(which, type);
- } else {
- return mWpHiddenColors;
- }
- } else {
- if (mHasBackdrop) {
- return mWpHiddenColors;
- } else {
- return super.getColors(which, type);
- }
- }
- }
-
- @VisibleForTesting
- void setWallpaperVisible(boolean visible) {
- if (mWallpaperVisible != visible) {
- mWallpaperVisible = visible;
- triggerColorsChanged(WallpaperManager.FLAG_SYSTEM);
- }
- }
-
- public void setHasBackdrop(boolean hasBackdrop) {
- if (mHasBackdrop != hasBackdrop) {
- mHasBackdrop = hasBackdrop;
+ public void setHasMediaArtwork(boolean hasBackdrop) {
+ if (mHasMediaArtwork != hasBackdrop) {
+ mHasMediaArtwork = hasBackdrop;
triggerColorsChanged(WallpaperManager.FLAG_LOCK);
}
}
@@ -230,7 +143,8 @@
pw.println(" Gradients:");
pw.println(" system: " + Arrays.toString(system));
pw.println(" lock: " + Arrays.toString(lock));
- pw.println(" Default scrim: " + mWpHiddenColors);
+ pw.println(" Neutral colors: " + mNeutralColorsLock);
+ pw.println(" Has media backdrop: " + mHasMediaArtwork);
}
}
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/recents/OverviewProxyService.java b/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java
index b0f77ce..88a8b31 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java
@@ -53,7 +53,6 @@
import android.view.accessibility.AccessibilityManager;
import com.android.internal.policy.ScreenDecorationsUtils;
-import com.android.systemui.Dependency;
import com.android.systemui.Dumpable;
import com.android.systemui.SysUiServiceProvider;
import com.android.systemui.recents.OverviewProxyService.OverviewProxyListener;
@@ -100,6 +99,8 @@
private final Context mContext;
private final Handler mHandler;
+ private final NavigationBarController mNavBarController;
+ private final StatusBarWindowController mStatusBarWinController;
private final Runnable mConnectionRunnable = this::internalConnectToCurrentUser;
private final ComponentName mRecentsComponentName;
private final DeviceProvisionedController mDeviceProvisionedController;
@@ -446,9 +447,13 @@
= this::cleanupAfterDeath;
@Inject
- public OverviewProxyService(Context context, DeviceProvisionedController provisionController) {
+ public OverviewProxyService(Context context, DeviceProvisionedController provisionController,
+ NavigationBarController navBarController, NavigationModeController navModeController,
+ StatusBarWindowController statusBarWinController) {
mContext = context;
mHandler = new Handler();
+ mNavBarController = navBarController;
+ mStatusBarWinController = statusBarWinController;
mDeviceProvisionedController = provisionController;
mConnectionBackoffAttempts = 0;
mRecentsComponentName = ComponentName.unflattenFromString(context.getString(
@@ -463,7 +468,7 @@
mBackButtonAlpha = 1.0f;
// Listen for nav bar mode changes
- mNavBarMode = Dependency.get(NavigationModeController.class).addListener(this);
+ mNavBarMode = navModeController.addListener(this);
// Listen for device provisioned/user setup
updateEnabledState();
@@ -513,11 +518,10 @@
}
private void updateSystemUiStateFlags() {
- final NavigationBarController navBar = Dependency.get(NavigationBarController.class);
- final NavigationBarFragment navBarFragment = navBar.getDefaultNavigationBarFragment();
- final NavigationBarView navBarView = navBar.getNavigationBarView(mContext.getDisplayId());
- final StatusBarWindowController statusBarController =
- Dependency.get(StatusBarWindowController.class);
+ final NavigationBarFragment navBarFragment =
+ mNavBarController.getDefaultNavigationBarFragment();
+ final NavigationBarView navBarView =
+ mNavBarController.getNavigationBarView(mContext.getDisplayId());
mSysUiStateFlags = 0;
if (navBarFragment != null) {
@@ -526,8 +530,8 @@
if (navBarView != null) {
navBarView.updateSystemUiStateFlags();
}
- if (statusBarController != null) {
- statusBarController.updateSystemUiStateFlags();
+ if (mStatusBarWinController != null) {
+ mStatusBarWinController.updateSystemUiStateFlags();
}
notifySystemUiStateFlags(mSysUiStateFlags);
}
diff --git a/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java b/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java
index 341461b..11ca94f 100644
--- a/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java
+++ b/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java
@@ -92,6 +92,11 @@
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+
+
/**
* POD used in the AsyncTask which saves an image in the background.
@@ -446,6 +451,8 @@
static final String EXTRA_CANCEL_NOTIFICATION = "android:screenshot_cancel_notification";
static final String EXTRA_DISALLOW_ENTER_PIP = "android:screenshot_disallow_enter_pip";
+ private static final String TAG = "GlobalScreenshot";
+
private static final int SCREENSHOT_FLASH_TO_PEAK_DURATION = 130;
private static final int SCREENSHOT_DROP_IN_DURATION = 430;
private static final int SCREENSHOT_DROP_OUT_DELAY = 500;
@@ -902,11 +909,19 @@
* appropriate signals to the system (ie. to dismiss the keyguard if necessary).
*/
public static class ActionProxyReceiver extends BroadcastReceiver {
+ static final int CLOSE_WINDOWS_TIMEOUT_MILLIS = 3000;
+
@Override
public void onReceive(Context context, final Intent intent) {
Runnable startActivityRunnable = () -> {
- ActivityManagerWrapper.getInstance().closeSystemWindows(
- SYSTEM_DIALOG_REASON_SCREENSHOT);
+ try {
+ ActivityManagerWrapper.getInstance().closeSystemWindows(
+ SYSTEM_DIALOG_REASON_SCREENSHOT).get(
+ CLOSE_WINDOWS_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS);
+ } catch (TimeoutException | InterruptedException | ExecutionException e) {
+ Slog.e(TAG, "Unable to share screenshot", e);
+ return;
+ }
Intent actionIntent = intent.getParcelableExtra(EXTRA_ACTION_INTENT);
if (intent.getBooleanExtra(EXTRA_CANCEL_NOTIFICATION, false)) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java
index 75ef185..6c36ab9 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java
@@ -488,6 +488,7 @@
if (bmp != null) {
artworkDrawable = new BitmapDrawable(mBackdropBack.getResources(), bmp);
}
+ boolean hasMediaArtwork = artworkDrawable != null;
boolean allowWhenShade = false;
if (ENABLE_LOCKSCREEN_WALLPAPER && artworkDrawable == null) {
Bitmap lockWallpaper =
@@ -506,7 +507,7 @@
boolean hideBecauseOccluded = shadeController != null && shadeController.isOccluded();
final boolean hasArtwork = artworkDrawable != null;
- mColorExtractor.setHasBackdrop(hasArtwork);
+ mColorExtractor.setHasMediaArtwork(hasMediaArtwork);
if (mScrimController != null) {
mScrimController.setHasBackdrop(hasArtwork);
}
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 d219ac9..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
@@ -654,15 +654,7 @@
@Override
@ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
public void onThemeChanged() {
- int which;
- if (mStatusBarState == StatusBarState.KEYGUARD
- || mStatusBarState == StatusBarState.SHADE_LOCKED) {
- which = WallpaperManager.FLAG_LOCK;
- } else {
- which = WallpaperManager.FLAG_SYSTEM;
- }
- final boolean useDarkText = mColorExtractor.getColors(which,
- true /* ignoreVisibility */).supportsDarkText();
+ final boolean useDarkText = mColorExtractor.getNeutralColors().supportsDarkText();
updateDecorViews(useDarkText);
updateFooter();
@@ -868,8 +860,8 @@
int backgroundRectTop = top;
int lastSectionBottom =
mSections[0].getCurrentBounds().bottom + animationYOffset;
- int previousLeft = left;
- int previousRight = right;
+ int currentLeft = left;
+ int currentRight = right;
boolean first = true;
for (NotificationSection section : mSections) {
if (section.getFirstVisibleChild() == null) {
@@ -882,23 +874,23 @@
// as separate roundrects, as the rounded corners right next to each other look
// bad.
if (sectionTop - lastSectionBottom > DISTANCE_BETWEEN_ADJACENT_SECTIONS_PX
- || (previousLeft != ownLeft && !first)) {
- canvas.drawRoundRect(ownLeft,
+ || ((currentLeft != ownLeft || currentRight != ownRight) && !first)) {
+ canvas.drawRoundRect(currentLeft,
backgroundRectTop,
- ownRight,
+ currentRight,
lastSectionBottom,
mCornerRadius, mCornerRadius, mBackgroundPaint);
backgroundRectTop = sectionTop;
}
- previousLeft = ownLeft;
- previousRight = ownRight;
+ currentLeft = ownLeft;
+ currentRight = ownRight;
lastSectionBottom =
section.getCurrentBounds().bottom + animationYOffset;
first = false;
}
- canvas.drawRoundRect(previousLeft,
+ canvas.drawRoundRect(currentLeft,
backgroundRectTop,
- previousRight,
+ currentRight,
lastSectionBottom,
mCornerRadius, mCornerRadius, mBackgroundPaint);
}
@@ -5765,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/FloatingRotationButton.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/FloatingRotationButton.java
index f5016da..6bbeffa 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/FloatingRotationButton.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/FloatingRotationButton.java
@@ -16,8 +16,10 @@
package com.android.systemui.statusbar.phone;
+import android.annotation.ColorInt;
import android.content.Context;
import android.content.res.Resources;
+import android.graphics.Color;
import android.graphics.PixelFormat;
import android.view.ContextThemeWrapper;
import android.view.Gravity;
@@ -26,6 +28,7 @@
import android.view.View;
import android.view.WindowManager;
+import com.android.settingslib.Utils;
import com.android.systemui.R;
import com.android.systemui.statusbar.policy.KeyButtonDrawable;
import com.android.systemui.statusbar.policy.KeyButtonView;
@@ -33,6 +36,8 @@
/** Containing logic for the rotation button on the physical left bottom corner of the screen. */
public class FloatingRotationButton implements RotationButton {
+ private static final float BACKGROUND_ALPHA = 0.92f;
+
private final Context mContext;
private final WindowManager mWindowManager;
private final KeyButtonView mKeyButtonView;
@@ -151,8 +156,18 @@
public KeyButtonDrawable getImageDrawable() {
Context context = new ContextThemeWrapper(mContext.getApplicationContext(),
mRotationButtonController.getStyleRes());
- return KeyButtonDrawable.create(context, R.drawable.ic_sysbar_rotate_button,
- false /* shadow */, true /* hasOvalBg */);
+ final int dualToneDarkTheme = Utils.getThemeAttr(context, R.attr.darkIconTheme);
+ final int dualToneLightTheme = Utils.getThemeAttr(context, R.attr.lightIconTheme);
+ Context lightContext = new ContextThemeWrapper(context, dualToneLightTheme);
+ Context darkContext = new ContextThemeWrapper(context, dualToneDarkTheme);
+ @ColorInt int darkColor = Utils.getColorAttrDefaultColor(darkContext,
+ R.attr.singleToneColor);
+ Color ovalBackgroundColor = Color.valueOf(Color.red(darkColor), Color.green(darkColor),
+ Color.blue(darkColor), BACKGROUND_ALPHA);
+
+ return KeyButtonDrawable.create(lightContext,
+ Utils.getColorAttrDefaultColor(lightContext, R.attr.singleToneColor), darkColor,
+ R.drawable.ic_sysbar_rotate_button, false /* shadow */, ovalBackgroundColor);
}
@Override
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarFragment.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarFragment.java
index d94a335..79976d0 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarFragment.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarFragment.java
@@ -136,6 +136,7 @@
protected final AssistManager mAssistManager;
private final MetricsLogger mMetricsLogger;
private final DeviceProvisionedController mDeviceProvisionedController;
+ private final StatusBarStateController mStatusBarStateController;
protected NavigationBarView mNavigationBarView = null;
@@ -244,9 +245,11 @@
public NavigationBarFragment(AccessibilityManagerWrapper accessibilityManagerWrapper,
DeviceProvisionedController deviceProvisionedController, MetricsLogger metricsLogger,
AssistManager assistManager, OverviewProxyService overviewProxyService,
- NavigationModeController navigationModeController) {
+ NavigationModeController navigationModeController,
+ StatusBarStateController statusBarStateController) {
mAccessibilityManagerWrapper = accessibilityManagerWrapper;
mDeviceProvisionedController = deviceProvisionedController;
+ mStatusBarStateController = statusBarStateController;
mMetricsLogger = metricsLogger;
mAssistManager = assistManager;
mAssistantAvailable = mAssistManager.getAssistInfoForUser(UserHandle.USER_CURRENT) != null;
@@ -951,7 +954,7 @@
public void touchAutoDim() {
getBarTransitions().setAutoDim(false);
mHandler.removeCallbacks(mAutoDim);
- int state = Dependency.get(StatusBarStateController.class).getState();
+ int state = mStatusBarStateController.getState();
if (state != StatusBarState.KEYGUARD && state != StatusBarState.SHADE_LOCKED) {
mHandler.postDelayed(mAutoDim, AUTODIM_TIMEOUT_MS);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationModeController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationModeController.java
index 7cd8f7b..77eb469 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationModeController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationModeController.java
@@ -24,6 +24,9 @@
import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL;
import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL_OVERLAY;
+import android.app.Notification;
+import android.app.NotificationManager;
+import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
@@ -38,13 +41,16 @@
import android.os.UserHandle;
import android.provider.Settings;
import android.provider.Settings.Secure;
+import android.text.TextUtils;
import android.util.Log;
import android.util.SparseBooleanArray;
import com.android.systemui.Dumpable;
+import com.android.systemui.R;
import com.android.systemui.UiOffloadThread;
import com.android.systemui.shared.system.ActivityManagerWrapper;
import com.android.systemui.statusbar.policy.DeviceProvisionedController;
+import com.android.systemui.util.NotificationChannels;
import java.io.FileDescriptor;
import java.io.PrintWriter;
@@ -63,6 +69,9 @@
private static final String TAG = NavigationModeController.class.getSimpleName();
private static final boolean DEBUG = false;
+ static final String SHARED_PREFERENCES_NAME = "navigation_mode_controller_preferences";
+ static final String PREFS_SWITCHED_FROM_GESTURE_NAV_KEY = "switched_from_gesture_nav";
+
public interface ModeChangedListener {
void onNavigationModeChanged(int mode);
}
@@ -78,6 +87,8 @@
private int mMode = NAV_BAR_MODE_3BUTTON;
private ArrayList<ModeChangedListener> mListeners = new ArrayList<>();
+ private String mLastDefaultLauncher;
+
private BroadcastReceiver mReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
@@ -92,7 +103,13 @@
if (DEBUG) {
Log.d(TAG, "ACTION_PREFERRED_ACTIVITY_CHANGED");
}
- switchFromGestureNavModeIfNotSupportedByDefaultLauncher();
+ final String launcher = getDefaultLauncherPackageName(mCurrentUserContext);
+ // Check if it is a default launcher change
+ if (!TextUtils.equals(mLastDefaultLauncher, launcher)) {
+ switchFromGestureNavModeIfNotSupportedByDefaultLauncher();
+ showNotificationIfDefaultLauncherSupportsGestureNav();
+ mLastDefaultLauncher = launcher;
+ }
break;
}
}
@@ -157,6 +174,8 @@
IntentFilter preferredActivityFilter = new IntentFilter(ACTION_PREFERRED_ACTIVITY_CHANGED);
mContext.registerReceiverAsUser(mReceiver, UserHandle.ALL, preferredActivityFilter, null,
null);
+ // We are only interested in launcher changes, so keeping track of the current default.
+ mLastDefaultLauncher = getDefaultLauncherPackageName(mContext);
updateCurrentInteractionMode(false /* notify */);
switchFromGestureNavModeIfNotSupportedByDefaultLauncher();
@@ -287,6 +306,84 @@
});
}
+ private void switchFromGestureNavModeIfNotSupportedByDefaultLauncher() {
+ if (getCurrentInteractionMode(mCurrentUserContext) != NAV_BAR_MODE_GESTURAL) {
+ return;
+ }
+ final Boolean supported = isGestureNavSupportedByDefaultLauncher(mCurrentUserContext);
+ if (supported == null || supported) {
+ return;
+ }
+
+ setModeOverlay(NAV_BAR_MODE_3BUTTON_OVERLAY, USER_CURRENT);
+ showNotification(mCurrentUserContext, R.string.notification_content_system_nav_changed);
+ mCurrentUserContext.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE)
+ .edit().putBoolean(PREFS_SWITCHED_FROM_GESTURE_NAV_KEY, true).apply();
+ }
+
+ private void showNotificationIfDefaultLauncherSupportsGestureNav() {
+ boolean previouslySwitchedFromGestureNav = mCurrentUserContext
+ .getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE)
+ .getBoolean(PREFS_SWITCHED_FROM_GESTURE_NAV_KEY, false);
+ if (!previouslySwitchedFromGestureNav) {
+ return;
+ }
+ if (getCurrentInteractionMode(mCurrentUserContext) == NAV_BAR_MODE_GESTURAL) {
+ return;
+ }
+ final Boolean supported = isGestureNavSupportedByDefaultLauncher(mCurrentUserContext);
+ if (supported == null || !supported) {
+ return;
+ }
+
+ showNotification(mCurrentUserContext, R.string.notification_content_gesture_nav_available);
+ mCurrentUserContext.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE)
+ .edit().putBoolean(PREFS_SWITCHED_FROM_GESTURE_NAV_KEY, false).apply();
+ }
+
+ /**
+ * Returns null if there is no default launcher set for the current user. Returns true if the
+ * current default launcher supports Gesture Navigation. Returns false otherwise.
+ */
+ private Boolean isGestureNavSupportedByDefaultLauncher(Context context) {
+ final String defaultLauncherPackageName = getDefaultLauncherPackageName(context);
+ if (DEBUG) {
+ Log.d(TAG, "isGestureNavSupportedByDefaultLauncher:"
+ + " defaultLauncher=" + defaultLauncherPackageName
+ + " contextUser=" + context.getUserId());
+ }
+ if (defaultLauncherPackageName == null) {
+ return null;
+ }
+ ComponentName recentsComponentName = ComponentName.unflattenFromString(
+ context.getString(com.android.internal.R.string.config_recentsComponentName));
+ return recentsComponentName.getPackageName().equals(defaultLauncherPackageName);
+ }
+
+ private String getDefaultLauncherPackageName(Context context) {
+ final ComponentName cn = context.getPackageManager().getHomeActivities(new ArrayList<>());
+ if (cn == null) {
+ return null;
+ }
+ return cn.getPackageName();
+ }
+
+ private void showNotification(Context context, int resId) {
+ final CharSequence message = context.getResources().getString(resId);
+ if (DEBUG) {
+ Log.d(TAG, "showNotification: message=" + message);
+ }
+
+ final Notification.Builder builder =
+ new Notification.Builder(mContext, NotificationChannels.ALERTS)
+ .setContentText(message)
+ .setStyle(new Notification.BigTextStyle())
+ .setSmallIcon(R.drawable.ic_info)
+ .setAutoCancel(true)
+ .setContentIntent(PendingIntent.getActivity(context, 0, new Intent(), 0));
+ context.getSystemService(NotificationManager.class).notify(TAG, 0, builder.build());
+ }
+
@Override
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
pw.println("NavigationModeController:");
@@ -299,6 +396,12 @@
}
pw.println(" defaultOverlays=" + defaultOverlays);
dumpAssetPaths(mCurrentUserContext);
+
+ pw.println(" defaultLauncher=" + mLastDefaultLauncher);
+ boolean previouslySwitchedFromGestureNav = mCurrentUserContext
+ .getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE)
+ .getBoolean(PREFS_SWITCHED_FROM_GESTURE_NAV_KEY, false);
+ pw.println(" previouslySwitchedFromGestureNav=" + previouslySwitchedFromGestureNav);
}
private void dumpAssetPaths(Context context) {
@@ -308,27 +411,4 @@
Log.d(TAG, " " + a.getAssetPath());
}
}
-
- private void switchFromGestureNavModeIfNotSupportedByDefaultLauncher() {
- if (getCurrentInteractionMode(mCurrentUserContext) == NAV_BAR_MODE_GESTURAL
- && !isGestureNavSupportedByDefaultLauncher(mCurrentUserContext)) {
- setModeOverlay(NAV_BAR_MODE_3BUTTON_OVERLAY, USER_CURRENT);
- }
- }
-
- private boolean isGestureNavSupportedByDefaultLauncher(Context context) {
- final ComponentName cn = context.getPackageManager().getHomeActivities(new ArrayList<>());
- if (cn == null) {
- // There is no default home app set for the current user, don't make any changes yet.
- return true;
- }
- if (DEBUG) {
- Log.d(TAG, "isGestureNavSupportedByDefaultLauncher: launcher=" + cn.getPackageName()
- + " contextUser=" + context.getUserId());
- }
-
- ComponentName recentsComponentName = ComponentName.unflattenFromString(context.getString(
- com.android.internal.R.string.config_recentsComponentName));
- return recentsComponentName.getPackageName().equals(cn.getPackageName());
- }
}
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/src/com/android/systemui/statusbar/phone/RotationContextButton.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/RotationContextButton.java
index b117dec..24e7336 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/RotationContextButton.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/RotationContextButton.java
@@ -24,7 +24,6 @@
import android.view.ContextThemeWrapper;
import android.view.View;
-import com.android.systemui.shared.system.QuickStepContract;
import com.android.systemui.statusbar.policy.KeyButtonDrawable;
/** Containing logic for the rotation button in nav bar. */
@@ -61,7 +60,7 @@
Context context = new ContextThemeWrapper(getContext().getApplicationContext(),
mRotationButtonController.getStyleRes());
return KeyButtonDrawable.create(context, mIconResId, false /* shadow */,
- QuickStepContract.isGesturalMode(mNavBarMode));
+ null /* ovalBackgroundColor */);
}
@Override
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
index 5fff054..1fdabc0 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
@@ -317,17 +317,6 @@
/** If true, the lockscreen will show a distinct wallpaper */
public static final boolean ENABLE_LOCKSCREEN_WALLPAPER = true;
- private static final AudioAttributes AUDIO_ATTRIBUTES =
- new AudioAttributes.Builder()
- .setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)
- // Temporary fix for b/123870990. No time in this release to
- // introduce a new vibration type, but we need to distinguish these vibrations
- // from other haptic feedback vibrations. Fortunately, Alarm vibrations have
- // exactly the same behavior as we need
- // TODO: refactor within the scope of b/132170758
- .setUsage(AudioAttributes.USAGE_ALARM)
- .build();
-
static {
boolean onlyCoreApps;
try {
@@ -3222,8 +3211,7 @@
// Lock wallpaper defines the color of the majority of the views, hence we'll use it
// to set our default theme.
- final boolean lockDarkText = mColorExtractor.getColors(WallpaperManager.FLAG_LOCK, true
- /* ignoreVisibility */).supportsDarkText();
+ final boolean lockDarkText = mColorExtractor.getNeutralColors().supportsDarkText();
final int themeResId = lockDarkText ? R.style.Theme_SystemUI_Light : R.style.Theme_SystemUI;
if (mContext.getThemeResId() != themeResId) {
mContext.setTheme(themeResId);
@@ -3700,7 +3688,7 @@
private void vibrateForCameraGesture() {
// Make sure to pass -1 for repeat so VibratorService doesn't stop us when going to sleep.
- mVibrator.vibrate(mCameraLaunchGestureVibePattern, -1 /* repeat */, AUDIO_ATTRIBUTES);
+ mVibrator.vibrate(mCameraLaunchGestureVibePattern, -1 /* repeat */);
}
/**
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowController.java
index 891bb35..c73ed60 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowController.java
@@ -25,7 +25,6 @@
import android.app.ActivityManager;
import android.app.IActivityManager;
-import android.app.WallpaperManager;
import android.content.Context;
import android.content.pm.ActivityInfo;
import android.content.res.Resources;
@@ -556,17 +555,7 @@
return;
}
- StatusBarStateController state = Dependency.get(StatusBarStateController.class);
- int which;
- if (state.getState() == StatusBarState.KEYGUARD
- || state.getState() == StatusBarState.SHADE_LOCKED) {
- which = WallpaperManager.FLAG_LOCK;
- } else {
- which = WallpaperManager.FLAG_SYSTEM;
- }
- final boolean useDarkText = mColorExtractor.getColors(which,
- true /* ignoreVisibility */).supportsDarkText();
-
+ final boolean useDarkText = mColorExtractor.getNeutralColors().supportsDarkText();
// Make sure we have the correct navbar/statusbar colors.
setKeyguardDark(useDarkText);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonDrawable.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonDrawable.java
index 568de63..8fcaa67 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonDrawable.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonDrawable.java
@@ -82,9 +82,9 @@
private AnimatedVectorDrawable mAnimatedDrawable;
public KeyButtonDrawable(Drawable d, @ColorInt int lightColor, @ColorInt int darkColor,
- boolean horizontalFlip, boolean hasOvalBg) {
+ boolean horizontalFlip, Color ovalBackgroundColor) {
this(d, new ShadowDrawableState(lightColor, darkColor,
- d instanceof AnimatedVectorDrawable, horizontalFlip, hasOvalBg));
+ d instanceof AnimatedVectorDrawable, horizontalFlip, ovalBackgroundColor));
}
private KeyButtonDrawable(Drawable d, ShadowDrawableState state) {
@@ -166,7 +166,7 @@
public void setColorFilter(ColorFilter colorFilter) {
mIconPaint.setColorFilter(colorFilter);
if (mAnimatedDrawable != null) {
- if (mState.mHasOvalBg) {
+ if (hasOvalBg()) {
mAnimatedDrawable.setColorFilter(
new PorterDuffColorFilter(mState.mLightColor, PorterDuff.Mode.SRC_IN));
} else {
@@ -212,15 +212,6 @@
return mState.mBaseWidth + (mState.mShadowSize + Math.abs(mState.mShadowOffsetX)) * 2;
}
- /** Return if the drawable has oval background. */
- public boolean hasOvalBg() {
- return mState.mHasOvalBg;
- }
-
- public int getDarkColor() {
- return mState.mDarkColor;
- }
-
public boolean canAnimate() {
return mState.mSupportsAnimation;
}
@@ -290,6 +281,14 @@
return mState.canApplyTheme();
}
+ @ColorInt int getDrawableBackgroundColor() {
+ return mState.mOvalBackgroundColor.toArgb();
+ }
+
+ boolean hasOvalBg() {
+ return mState.mOvalBackgroundColor != null;
+ }
+
private void regenerateBitmapIconCache() {
final int width = getIntrinsicWidth();
final int height = getIntrinsicHeight();
@@ -394,16 +393,16 @@
final int mLightColor;
final int mDarkColor;
final boolean mSupportsAnimation;
- final boolean mHasOvalBg;
+ final Color mOvalBackgroundColor;
public ShadowDrawableState(@ColorInt int lightColor, @ColorInt int darkColor,
- boolean animated, boolean horizontalFlip, boolean hasOvalBg) {
+ boolean animated, boolean horizontalFlip, Color ovalBackgroundColor) {
mLightColor = lightColor;
mDarkColor = darkColor;
mSupportsAnimation = animated;
mAlpha = 255;
mHorizontalFlip = horizontalFlip;
- mHasOvalBg = hasOvalBg;
+ mOvalBackgroundColor = ovalBackgroundColor;
}
@Override
@@ -428,16 +427,17 @@
* @param ctx Context to get the drawable and determine the dark and light theme
* @param icon the icon resource id
* @param hasShadow if a shadow will appear with the drawable
- * @param hasOvalBg if an oval bg will be drawn
+ * @param ovalBackgroundColor the color of the oval bg that will be drawn
* @return KeyButtonDrawable
*/
public static KeyButtonDrawable create(@NonNull Context ctx, @DrawableRes int icon,
- boolean hasShadow, boolean hasOvalBg) {
+ boolean hasShadow, Color ovalBackgroundColor) {
final int dualToneDarkTheme = Utils.getThemeAttr(ctx, R.attr.darkIconTheme);
final int dualToneLightTheme = Utils.getThemeAttr(ctx, R.attr.lightIconTheme);
Context lightContext = new ContextThemeWrapper(ctx, dualToneLightTheme);
Context darkContext = new ContextThemeWrapper(ctx, dualToneDarkTheme);
- return KeyButtonDrawable.create(lightContext, darkContext, icon, hasShadow, hasOvalBg);
+ return KeyButtonDrawable.create(lightContext, darkContext, icon, hasShadow,
+ ovalBackgroundColor);
}
/**
@@ -446,7 +446,7 @@
*/
public static KeyButtonDrawable create(@NonNull Context ctx, @DrawableRes int icon,
boolean hasShadow) {
- return create(ctx, icon, hasShadow, false /* hasOvalBg */);
+ return create(ctx, icon, hasShadow, null /* ovalBackgroundColor */);
}
/**
@@ -454,11 +454,11 @@
* {@link #create(Context, int, boolean, boolean)}.
*/
public static KeyButtonDrawable create(Context lightContext, Context darkContext,
- @DrawableRes int iconResId, boolean hasShadow, boolean hasOvalBg) {
+ @DrawableRes int iconResId, boolean hasShadow, Color ovalBackgroundColor) {
return create(lightContext,
Utils.getColorAttrDefaultColor(lightContext, R.attr.singleToneColor),
Utils.getColorAttrDefaultColor(darkContext, R.attr.singleToneColor),
- iconResId, hasShadow, hasOvalBg);
+ iconResId, hasShadow, ovalBackgroundColor);
}
/**
@@ -467,12 +467,12 @@
*/
public static KeyButtonDrawable create(Context context, @ColorInt int lightColor,
@ColorInt int darkColor, @DrawableRes int iconResId, boolean hasShadow,
- boolean hasOvalBg) {
+ Color ovalBackgroundColor) {
final Resources res = context.getResources();
boolean isRtl = res.getConfiguration().getLayoutDirection() == View.LAYOUT_DIRECTION_RTL;
Drawable d = context.getDrawable(iconResId);
final KeyButtonDrawable drawable = new KeyButtonDrawable(d, lightColor, darkColor,
- isRtl && d.isAutoMirrored(), hasOvalBg);
+ isRtl && d.isAutoMirrored(), ovalBackgroundColor);
if (hasShadow) {
int offsetX = res.getDimensionPixelSize(R.dimen.nav_key_button_shadow_offset_x);
int offsetY = res.getDimensionPixelSize(R.dimen.nav_key_button_shadow_offset_y);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java
index c9579fd..64b2842 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java
@@ -79,6 +79,7 @@
private final MetricsLogger mMetricsLogger = Dependency.get(MetricsLogger.class);
private final InputManager mInputManager;
private final Paint mOvalBgPaint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.FILTER_BITMAP_FLAG);
+ private float mDarkIntensity;
private boolean mHasOvalBg = false;
private final Runnable mCheckLongPress = new Runnable() {
@@ -304,6 +305,23 @@
return true;
}
+ @Override
+ public void setImageDrawable(Drawable drawable) {
+ super.setImageDrawable(drawable);
+
+ if (drawable == null) {
+ return;
+ }
+ KeyButtonDrawable keyButtonDrawable = (KeyButtonDrawable) drawable;
+ keyButtonDrawable.setDarkIntensity(mDarkIntensity);
+ mHasOvalBg = keyButtonDrawable.hasOvalBg();
+ if (mHasOvalBg) {
+ mOvalBgPaint.setColor(keyButtonDrawable.getDrawableBackgroundColor());
+ }
+ mRipple.setType(keyButtonDrawable.hasOvalBg() ? KeyButtonRipple.Type.OVAL
+ : KeyButtonRipple.Type.ROUNDED_RECT);
+ }
+
public void playSoundEffect(int soundConstant) {
if (!mPlaySounds) return;
mAudioManager.playSoundEffect(soundConstant, ActivityManager.getCurrentUser());
@@ -360,17 +378,11 @@
@Override
public void setDarkIntensity(float darkIntensity) {
+ mDarkIntensity = darkIntensity;
+
Drawable drawable = getDrawable();
if (drawable != null) {
- KeyButtonDrawable keyButtonDrawable = (KeyButtonDrawable) drawable;
- keyButtonDrawable.setDarkIntensity(darkIntensity);
- mHasOvalBg = keyButtonDrawable.hasOvalBg();
- if (mHasOvalBg) {
- mOvalBgPaint.setColor(keyButtonDrawable.getDarkColor());
- }
- mRipple.setType(keyButtonDrawable.hasOvalBg() ? KeyButtonRipple.Type.OVAL
- : KeyButtonRipple.Type.ROUNDED_RECT);
-
+ ((KeyButtonDrawable) drawable).setDarkIntensity(darkIntensity);
// Since we reuse the same drawable for multiple views, we need to invalidate the view
// manually.
invalidate();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java
index 2afe485..13f93b9 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java
@@ -545,7 +545,7 @@
}
private boolean isDataDisabled() {
- return !mPhone.getDataEnabled(mSubscriptionInfo.getSubscriptionId());
+ return !mPhone.isDataCapable();
}
@VisibleForTesting
@@ -566,6 +566,7 @@
pw.println(" mDataState=" + mDataState + ",");
pw.println(" mDataNetType=" + mDataNetType + ",");
pw.println(" mInflateSignalStrengths=" + mInflateSignalStrengths + ",");
+ pw.println(" isDataDisabled=" + isDataDisabled() + ",");
}
class MobilePhoneStateListener extends PhoneStateListener {
diff --git a/packages/SystemUI/src/com/android/systemui/util/leak/DumpTruck.java b/packages/SystemUI/src/com/android/systemui/util/leak/DumpTruck.java
index efd6e03..fa7af0b 100644
--- a/packages/SystemUI/src/com/android/systemui/util/leak/DumpTruck.java
+++ b/packages/SystemUI/src/com/android/systemui/util/leak/DumpTruck.java
@@ -16,6 +16,8 @@
package com.android.systemui.util.leak;
+import android.content.ClipData;
+import android.content.ClipDescription;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
@@ -47,10 +49,11 @@
private static final String FILEPROVIDER_PATH = "leak";
private static final String TAG = "DumpTruck";
- private static final int BUFSIZ = 512 * 1024; // 512K
+ private static final int BUFSIZ = 1024 * 1024; // 1MB
private final Context context;
private Uri hprofUri;
+ private long pss;
final StringBuilder body = new StringBuilder();
public DumpTruck(Context context) {
@@ -89,6 +92,7 @@
.append(info.currentPss)
.append(" uss=")
.append(info.currentUss);
+ pss = info.currentPss;
}
}
if (pid == myPid) {
@@ -114,6 +118,7 @@
if (DumpTruck.zipUp(zipfile, paths)) {
final File pathFile = new File(zipfile);
hprofUri = FileProvider.getUriForFile(context, FILEPROVIDER_AUTHORITY, pathFile);
+ Log.v(TAG, "Heap dump accessible at URI: " + hprofUri);
}
} catch (IOException e) {
Log.e(TAG, "unable to zip up heapdumps", e);
@@ -138,16 +143,27 @@
* @return share intent
*/
public Intent createShareIntent() {
- Intent shareIntent = new Intent(Intent.ACTION_SEND);
+ Intent shareIntent = new Intent(Intent.ACTION_SEND_MULTIPLE);
shareIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
- shareIntent.putExtra(Intent.EXTRA_SUBJECT, "SystemUI memory dump");
+ shareIntent.putExtra(Intent.EXTRA_SUBJECT,
+ String.format("SystemUI memory dump (pss=%dM)", pss / 1024));
shareIntent.putExtra(Intent.EXTRA_TEXT, body.toString());
if (hprofUri != null) {
+ final ArrayList<Uri> uriList = new ArrayList<>();
+ uriList.add(hprofUri);
shareIntent.setType("application/zip");
- shareIntent.putExtra(Intent.EXTRA_STREAM, hprofUri);
+ shareIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uriList);
+
+ // Include URI in ClipData also, so that grantPermission picks it up.
+ // We don't use setData here because some apps interpret this as "to:".
+ ClipData clipdata = new ClipData(new ClipDescription("content",
+ new String[]{ClipDescription.MIMETYPE_TEXT_PLAIN}),
+ new ClipData.Item(hprofUri));
+ shareIntent.setClipData(clipdata);
+ shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
}
return shareIntent;
}
diff --git a/packages/SystemUI/src/com/android/systemui/util/leak/GarbageMonitor.java b/packages/SystemUI/src/com/android/systemui/util/leak/GarbageMonitor.java
index aa3fd5f..583f6b3 100644
--- a/packages/SystemUI/src/com/android/systemui/util/leak/GarbageMonitor.java
+++ b/packages/SystemUI/src/com/android/systemui/util/leak/GarbageMonitor.java
@@ -16,9 +16,13 @@
package com.android.systemui.util.leak;
+import static android.service.quicksettings.Tile.STATE_ACTIVE;
+import static android.telephony.ims.feature.ImsFeature.STATE_UNAVAILABLE;
+
import static com.android.internal.logging.MetricsLogger.VIEW_UNKNOWN;
import static com.android.systemui.Dependency.BG_LOOPER_NAME;
+import android.annotation.Nullable;
import android.app.ActivityManager;
import android.content.Context;
import android.content.Intent;
@@ -38,11 +42,11 @@
import android.os.Process;
import android.os.SystemProperties;
import android.provider.Settings;
-import android.service.quicksettings.Tile;
import android.text.format.DateUtils;
import android.util.Log;
import android.util.LongSparseArray;
+import com.android.systemui.Dumpable;
import com.android.systemui.R;
import com.android.systemui.SystemUI;
import com.android.systemui.SystemUIFactory;
@@ -50,6 +54,8 @@
import com.android.systemui.qs.QSHost;
import com.android.systemui.qs.tileimpl.QSTileImpl;
+import java.io.FileDescriptor;
+import java.io.PrintWriter;
import java.util.ArrayList;
import javax.inject.Inject;
@@ -59,7 +65,7 @@
/**
*/
@Singleton
-public class GarbageMonitor {
+public class GarbageMonitor implements Dumpable {
private static final boolean LEAK_REPORTING_ENABLED =
Build.IS_DEBUGGABLE
&& SystemProperties.getBoolean("debug.enable_leak_reporting", false);
@@ -77,12 +83,15 @@
private static final long GARBAGE_INSPECTION_INTERVAL =
15 * DateUtils.MINUTE_IN_MILLIS; // 15 min
private static final long HEAP_TRACK_INTERVAL = 1 * DateUtils.MINUTE_IN_MILLIS; // 1 min
+ private static final int HEAP_TRACK_HISTORY_LEN = 720; // 12 hours
private static final int DO_GARBAGE_INSPECTION = 1000;
private static final int DO_HEAP_TRACK = 3000;
private static final int GARBAGE_ALLOWANCE = 5;
+ private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
+
private final Handler mHandler;
private final TrackedGarbage mTrackedGarbage;
private final LeakReporter mLeakReporter;
@@ -180,7 +189,7 @@
sb.append(p);
sb.append(" ");
}
- Log.v(TAG, sb.toString());
+ if (DEBUG) Log.v(TAG, sb.toString());
}
private void update() {
@@ -189,18 +198,18 @@
for (int i = 0; i < dinfos.length; i++) {
Debug.MemoryInfo dinfo = dinfos[i];
if (i > mPids.size()) {
- Log.e(TAG, "update: unknown process info received: " + dinfo);
+ if (DEBUG) Log.e(TAG, "update: unknown process info received: " + dinfo);
break;
}
final long pid = mPids.get(i).intValue();
final ProcessMemInfo info = mData.get(pid);
- info.head = (info.head + 1) % info.pss.length;
info.pss[info.head] = info.currentPss = dinfo.getTotalPss();
info.uss[info.head] = info.currentUss = dinfo.getTotalPrivateDirty();
+ info.head = (info.head + 1) % info.pss.length;
if (info.currentPss > info.max) info.max = info.currentPss;
if (info.currentUss > info.max) info.max = info.currentUss;
if (info.currentPss == 0) {
- Log.v(TAG, "update: pid " + pid + " has pss=0, it probably died");
+ if (DEBUG) Log.v(TAG, "update: pid " + pid + " has pss=0, it probably died");
mData.remove(pid);
}
}
@@ -230,11 +239,36 @@
return b + SUFFIXES[i];
}
- private void dumpHprofAndShare() {
- final Intent share = mDumpTruck.captureHeaps(getTrackedProcesses()).createShareIntent();
- mContext.startActivity(share);
+ private Intent dumpHprofAndGetShareIntent() {
+ return mDumpTruck.captureHeaps(getTrackedProcesses()).createShareIntent();
}
+ @Override
+ public void dump(@Nullable FileDescriptor fd, PrintWriter pw, @Nullable String[] args) {
+ pw.println("GarbageMonitor params:");
+ pw.println(String.format(" mHeapLimit=%d KB", mHeapLimit));
+ pw.println(String.format(" GARBAGE_INSPECTION_INTERVAL=%d (%.1f mins)",
+ GARBAGE_INSPECTION_INTERVAL,
+ (float) GARBAGE_INSPECTION_INTERVAL / DateUtils.MINUTE_IN_MILLIS));
+ final float htiMins = HEAP_TRACK_INTERVAL / DateUtils.MINUTE_IN_MILLIS;
+ pw.println(String.format(" HEAP_TRACK_INTERVAL=%d (%.1f mins)",
+ HEAP_TRACK_INTERVAL,
+ htiMins));
+ pw.println(String.format(" HEAP_TRACK_HISTORY_LEN=%d (%.1f hr total)",
+ HEAP_TRACK_HISTORY_LEN,
+ (float) HEAP_TRACK_HISTORY_LEN * htiMins / 60f));
+
+ pw.println("GarbageMonitor tracked processes:");
+
+ for (long pid : mPids) {
+ final ProcessMemInfo pmi = mData.get(pid);
+ if (pmi != null) {
+ pmi.dump(fd, pw, args);
+ }
+ }
+ }
+
+
private static class MemoryIconDrawable extends Drawable {
long pss, limit;
final Drawable baseIcon;
@@ -244,7 +278,7 @@
MemoryIconDrawable(Context context) {
baseIcon = context.getDrawable(R.drawable.ic_memory).mutate();
dp = context.getResources().getDisplayMetrics().density;
- paint.setColor(QSTileImpl.getColorForState(context, Tile.STATE_ACTIVE));
+ paint.setColor(QSTileImpl.getColorForState(context, STATE_ACTIVE));
}
public void setPss(long pss) {
@@ -354,6 +388,7 @@
private final GarbageMonitor gm;
private ProcessMemInfo pmi;
+ private boolean dumpInProgress;
@Inject
public MemoryTile(QSHost host) {
@@ -373,8 +408,26 @@
@Override
protected void handleClick() {
- getHost().collapsePanels();
- mHandler.post(gm::dumpHprofAndShare);
+ if (dumpInProgress) return;
+
+ dumpInProgress = true;
+ refreshState();
+ new Thread("HeapDumpThread") {
+ @Override
+ public void run() {
+ try {
+ // wait for animations & state changes
+ Thread.sleep(500);
+ } catch (InterruptedException ignored) { }
+ final Intent shareIntent = gm.dumpHprofAndGetShareIntent();
+ mHandler.post(() -> {
+ dumpInProgress = false;
+ refreshState();
+ getHost().collapsePanels();
+ mContext.startActivity(shareIntent);
+ });
+ }
+ }.start();
}
@Override
@@ -404,9 +457,12 @@
pmi = gm.getMemInfo(Process.myPid());
final MemoryGraphIcon icon = new MemoryGraphIcon();
icon.setHeapLimit(gm.mHeapLimit);
+ state.state = dumpInProgress ? STATE_UNAVAILABLE : STATE_ACTIVE;
+ state.label = dumpInProgress
+ ? "Dumping..."
+ : mContext.getString(R.string.heap_dump_tile_name);
if (pmi != null) {
icon.setPss(pmi.currentPss);
- state.label = mContext.getString(R.string.heap_dump_tile_name);
state.secondaryLabel =
String.format(
"pss: %s / %s",
@@ -414,7 +470,6 @@
formatBytes(gm.mHeapLimit * 1024));
} else {
icon.setPss(0);
- state.label = "Dump SysUI";
state.secondaryLabel = null;
}
state.icon = icon;
@@ -433,13 +488,14 @@
}
}
- public static class ProcessMemInfo {
+ /** */
+ public static class ProcessMemInfo implements Dumpable {
public long pid;
public String name;
public long startTime;
public long currentPss, currentUss;
- public long[] pss = new long[256];
- public long[] uss = new long[256];
+ public long[] pss = new long[HEAP_TRACK_HISTORY_LEN];
+ public long[] uss = new long[HEAP_TRACK_HISTORY_LEN];
public long max = 1;
public int head = 0;
@@ -452,9 +508,33 @@
public long getUptime() {
return System.currentTimeMillis() - startTime;
}
+
+ @Override
+ public void dump(@Nullable FileDescriptor fd, PrintWriter pw, @Nullable String[] args) {
+ pw.print("{ \"pid\": ");
+ pw.print(pid);
+ pw.print(", \"name\": \"");
+ pw.print(name.replace('"', '-'));
+ pw.print("\", \"start\": ");
+ pw.print(startTime);
+ pw.print(", \"pss\": [");
+ // write pss values starting from the oldest, which is pss[head], wrapping around to
+ // pss[(head-1) % pss.length]
+ for (int i = 0; i < pss.length; i++) {
+ if (i > 0) pw.print(",");
+ pw.print(pss[(head + i) % pss.length]);
+ }
+ pw.print("], \"uss\": [");
+ for (int i = 0; i < uss.length; i++) {
+ if (i > 0) pw.print(",");
+ pw.print(uss[(head + i) % uss.length]);
+ }
+ pw.println("] }");
+ }
}
- public static class Service extends SystemUI {
+ /** */
+ public static class Service extends SystemUI implements Dumpable {
private GarbageMonitor mGarbageMonitor;
@Override
@@ -472,6 +552,11 @@
mGarbageMonitor.startHeapTracking();
}
}
+
+ @Override
+ public void dump(@Nullable FileDescriptor fd, PrintWriter pw, @Nullable String[] args) {
+ if (mGarbageMonitor != null) mGarbageMonitor.dump(fd, pw, args);
+ }
}
private class BackgroundHeapCheckHandler extends Handler {
diff --git a/packages/SystemUI/tests/src/com/android/systemui/colorextraction/SysuiColorExtractorTests.java b/packages/SystemUI/tests/src/com/android/systemui/colorextraction/SysuiColorExtractorTests.java
index 9c2c822..41747f4 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/colorextraction/SysuiColorExtractorTests.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/colorextraction/SysuiColorExtractorTests.java
@@ -40,6 +40,7 @@
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
/**
@@ -57,6 +58,8 @@
ColorExtractor.TYPE_DARK,
ColorExtractor.TYPE_EXTRA_DARK};
+ @Mock
+ private WallpaperManager mWallpaperManager;
private ColorExtractor.GradientColors mColors;
private SysuiColorExtractor mColorExtractor;
@@ -72,32 +75,15 @@
outGradientColorsNormal.set(mColors);
outGradientColorsDark.set(mColors);
outGradientColorsExtraDark.set(mColors);
- }, mock(ConfigurationController.class), false);
+ }, mock(ConfigurationController.class), mWallpaperManager, true /* immediately */);
}
@Test
- public void getColors_usesGreyIfWallpaperNotVisible() {
- simulateEvent(mColorExtractor);
- mColorExtractor.setWallpaperVisible(false);
-
- ColorExtractor.GradientColors fallbackColors = mColorExtractor.getNeutralColors();
-
- for (int type : sTypes) {
- assertEquals("Not using fallback!",
- mColorExtractor.getColors(WallpaperManager.FLAG_SYSTEM, type), fallbackColors);
- assertNotEquals("Wallpaper visibility event should not affect lock wallpaper.",
- mColorExtractor.getColors(WallpaperManager.FLAG_LOCK, type), fallbackColors);
- }
- }
-
- @Test
- public void getColors_doesntUseFallbackIfVisible() {
+ public void getColors() {
mColors.setMainColor(Color.RED);
mColors.setSecondaryColor(Color.RED);
simulateEvent(mColorExtractor);
- mColorExtractor.setWallpaperVisible(true);
-
for (int which : sWhich) {
for (int type : sTypes) {
assertEquals("Not using extracted colors!",
@@ -109,8 +95,7 @@
@Test
public void getColors_fallbackWhenMediaIsVisible() {
simulateEvent(mColorExtractor);
- mColorExtractor.setWallpaperVisible(true);
- mColorExtractor.setHasBackdrop(true);
+ mColorExtractor.setHasMediaArtwork(true);
ColorExtractor.GradientColors fallbackColors = mColorExtractor.getNeutralColors();
@@ -127,7 +112,7 @@
Tonal tonal = mock(Tonal.class);
ConfigurationController configurationController = mock(ConfigurationController.class);
SysuiColorExtractor sysuiColorExtractor = new SysuiColorExtractor(getContext(),
- tonal, configurationController, false /* registerVisibility */);
+ tonal, configurationController, mWallpaperManager, true /* immediately */);
verify(configurationController).addCallback(eq(sysuiColorExtractor));
reset(tonal);
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/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationContentInflaterTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationContentInflaterTest.java
index 025296d..06ff047 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationContentInflaterTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationContentInflaterTest.java
@@ -101,7 +101,7 @@
mNotificationInflater.setUsesIncreasedHeadsUpHeight(true);
Notification.Builder builder = spy(mBuilder);
mNotificationInflater.inflateNotificationViews(
- false /* inflateSynchronously */,
+ true /* inflateSynchronously */,
FLAG_CONTENT_VIEW_ALL,
builder,
mContext);
@@ -113,7 +113,7 @@
mNotificationInflater.setUsesIncreasedHeight(true);
Notification.Builder builder = spy(mBuilder);
mNotificationInflater.inflateNotificationViews(
- false /* inflateSynchronously */,
+ true /* inflateSynchronously */,
FLAG_CONTENT_VIEW_ALL,
builder,
mContext);
@@ -161,6 +161,7 @@
@Test
public void testRemovedNotInflated() throws Exception {
mRow.setRemoved();
+ mNotificationInflater.setInflateSynchronously(true);
mNotificationInflater.inflateNotificationViews();
Assert.assertNull(mRow.getEntry().getRunningTask());
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java
index 56265d0..d425982 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java
@@ -70,6 +70,7 @@
import com.android.systemui.statusbar.notification.row.NotificationBlockingHelperManager;
import com.android.systemui.statusbar.phone.HeadsUpManagerPhone;
import com.android.systemui.statusbar.phone.NotificationGroupManager;
+import com.android.systemui.statusbar.phone.NotificationIconAreaController;
import com.android.systemui.statusbar.phone.ScrimController;
import com.android.systemui.statusbar.phone.ShadeController;
import com.android.systemui.statusbar.phone.StatusBar;
@@ -110,6 +111,7 @@
@Mock private NotificationData mNotificationData;
@Mock private NotificationRemoteInputManager mRemoteInputManager;
@Mock private RemoteInputController mRemoteInputController;
+ @Mock private NotificationIconAreaController mNotificationIconAreaController;
@Mock private MetricsLogger mMetricsLogger;
@Mock private NotificationRoundnessManager mNotificationRoundnessManager;
private TestableNotificationEntryManager mEntryManager;
@@ -162,6 +164,7 @@
mStackScroller.setHeadsUpManager(mHeadsUpManager);
mStackScroller.setGroupManager(mGroupManager);
mStackScroller.setEmptyShadeView(mEmptyShadeView);
+ mStackScroller.setIconAreaController(mNotificationIconAreaController);
// Stub out functionality that isn't necessary to test.
doNothing().when(mBar)
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NavigationBarContextTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NavigationBarContextTest.java
index cb70a1f..be69f5f 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NavigationBarContextTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NavigationBarContextTest.java
@@ -180,9 +180,9 @@
final Drawable d = mock(Drawable.class);
final ContextualButton button = spy(mBtn0);
final KeyButtonDrawable kbd1 = spy(new KeyButtonDrawable(d, unusedColor, unusedColor,
- false /* horizontalFlip */, false /* hasOvalBg */));
+ false /* horizontalFlip */, null /* ovalBackgroundColor */));
final KeyButtonDrawable kbd2 = spy(new KeyButtonDrawable(d, unusedColor, unusedColor,
- false /* horizontalFlip */, false /* hasOvalBg */));
+ false /* horizontalFlip */, null /* ovalBackgroundColor */));
kbd1.setDarkIntensity(TEST_DARK_INTENSITY);
kbd2.setDarkIntensity(0f);
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NavigationBarFragmentTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NavigationBarFragmentTest.java
index faf5a97..3da9a4b 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NavigationBarFragmentTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NavigationBarFragmentTest.java
@@ -56,6 +56,7 @@
import com.android.systemui.SysuiBaseFragmentTest;
import com.android.systemui.SysuiTestableContext;
import com.android.systemui.assist.AssistManager;
+import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.recents.OverviewProxyService;
import com.android.systemui.recents.Recents;
import com.android.systemui.stackdivider.Divider;
@@ -215,7 +216,8 @@
new MetricsLogger(),
mock(AssistManager.class),
mOverviewProxyService,
- mock(NavigationModeController.class));
+ mock(NavigationModeController.class),
+ mock(StatusBarStateController.class));
}
private class HostCallbacksForExternalDisplay extends
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerBaseTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerBaseTest.java
index 616b46a..3464fe5 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerBaseTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerBaseTest.java
@@ -164,7 +164,7 @@
protected void setupNetworkController() {
// For now just pretend to be the data sim, so we can test that too.
mSubId = SubscriptionManager.DEFAULT_SUBSCRIPTION_ID;
- when(mMockTm.getDataEnabled(mSubId)).thenReturn(true);
+ when(mMockTm.isDataCapable()).thenReturn(true);
setDefaultSubId(mSubId);
setSubscriptions(mSubId);
mMobileSignalController = mNetworkController.mMobileSignalControllers.get(mSubId);
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerDataTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerDataTest.java
index cd0a0441..5128675 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerDataTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerDataTest.java
@@ -119,7 +119,7 @@
@Test
public void testNoInternetIcon_withDefaultSub() {
setupNetworkController();
- when(mMockTm.getDataEnabled(mSubId)).thenReturn(false);
+ when(mMockTm.isDataCapable()).thenReturn(false);
setupDefaultSignal();
updateDataConnectionState(TelephonyManager.DATA_CONNECTED, 0);
setConnectivityViaBroadcast(NetworkCapabilities.TRANSPORT_CELLULAR, false, false);
@@ -133,7 +133,7 @@
@Test
public void testDataDisabledIcon_withDefaultSub() {
setupNetworkController();
- when(mMockTm.getDataEnabled(mSubId)).thenReturn(false);
+ when(mMockTm.isDataCapable()).thenReturn(false);
setupDefaultSignal();
updateDataConnectionState(TelephonyManager.DATA_DISCONNECTED, 0);
setConnectivityViaBroadcast(NetworkCapabilities.TRANSPORT_CELLULAR, false, false);
@@ -147,7 +147,7 @@
@Test
public void testNoInternetIcon_withoutDefaultSub() {
setupNetworkController();
- when(mMockTm.getDataEnabled(mSubId)).thenReturn(false);
+ when(mMockTm.isDataCapable()).thenReturn(false);
setupDefaultSignal();
setDefaultSubId(mSubId + 1);
updateDataConnectionState(TelephonyManager.DATA_CONNECTED, 0);
@@ -162,7 +162,7 @@
@Test
public void testDataDisabledIcon_withoutDefaultSub() {
setupNetworkController();
- when(mMockTm.getDataEnabled(mSubId)).thenReturn(false);
+ when(mMockTm.isDataCapable()).thenReturn(false);
setupDefaultSignal();
setDefaultSubId(mSubId + 1);
updateDataConnectionState(TelephonyManager.DATA_DISCONNECTED, 0);
@@ -218,7 +218,7 @@
@Test
public void testDataDisabledIcon_UserNotSetup() {
setupNetworkController();
- when(mMockTm.getDataEnabled(mSubId)).thenReturn(false);
+ when(mMockTm.isDataCapable()).thenReturn(false);
setupDefaultSignal();
updateDataConnectionState(TelephonyManager.DATA_DISCONNECTED, 0);
setConnectivityViaBroadcast(NetworkCapabilities.TRANSPORT_CELLULAR, false, false);
@@ -233,7 +233,7 @@
@Test
public void testAlwaysShowDataRatIcon() {
setupDefaultSignal();
- when(mMockTm.getDataEnabled(mSubId)).thenReturn(false);
+ when(mMockTm.isDataCapable()).thenReturn(false);
updateDataConnectionState(TelephonyManager.DATA_DISCONNECTED,
TelephonyManager.NETWORK_TYPE_GSM);
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/autofill/java/com/android/server/autofill/Session.java b/services/autofill/java/com/android/server/autofill/Session.java
index af9b0e2..3764ca4 100644
--- a/services/autofill/java/com/android/server/autofill/Session.java
+++ b/services/autofill/java/com/android/server/autofill/Session.java
@@ -569,12 +569,13 @@
@GuardedBy("mLock")
private void requestNewFillResponseLocked(@NonNull ViewState viewState, int newState,
int flags) {
- if (mForAugmentedAutofillOnly) {
+ if (mForAugmentedAutofillOnly || mRemoteFillService == null) {
if (sVerbose) {
Slog.v(TAG, "requestNewFillResponse(): triggering augmented autofill instead "
+ "(mForAugmentedAutofillOnly=" + mForAugmentedAutofillOnly
+ ", flags=" + flags + ")");
}
+ mForAugmentedAutofillOnly = true;
triggerAugmentedAutofillLocked();
return;
}
diff --git a/services/core/java/com/android/server/ConnectivityService.java b/services/core/java/com/android/server/ConnectivityService.java
index 5027a12..1cca0b9 100644
--- a/services/core/java/com/android/server/ConnectivityService.java
+++ b/services/core/java/com/android/server/ConnectivityService.java
@@ -6901,8 +6901,10 @@
final int userId = UserHandle.getCallingUserId();
- final IpMemoryStore ipMemoryStore = IpMemoryStore.getMemoryStore(mContext);
- ipMemoryStore.factoryReset();
+ Binder.withCleanCallingIdentity(() -> {
+ final IpMemoryStore ipMemoryStore = IpMemoryStore.getMemoryStore(mContext);
+ ipMemoryStore.factoryReset();
+ });
// Turn airplane mode off
setAirplaneMode(false);
diff --git a/services/core/java/com/android/server/LocationManagerService.java b/services/core/java/com/android/server/LocationManagerService.java
index 78f0603..8a639c5 100644
--- a/services/core/java/com/android/server/LocationManagerService.java
+++ b/services/core/java/com/android/server/LocationManagerService.java
@@ -2361,7 +2361,7 @@
mRealRequest,
mReceiver.isListener(),
mReceiver.isPendingIntent(),
- /* radius= */ 0,
+ /* geofence= */ null,
mActivityManager.getPackageImportance(packageName));
// remove from mRecordsByProvider
@@ -2541,7 +2541,7 @@
LocationStatsEnums.USAGE_STARTED,
LocationStatsEnums.API_REQUEST_LOCATION_UPDATES,
packageName, request, listener != null, intent != null,
- /* radius= */ 0,
+ /* geofence= */ null,
mActivityManager.getPackageImportance(packageName));
Receiver receiver;
@@ -2844,7 +2844,7 @@
request,
/* hasListener= */ false,
intent != null,
- geofence.getRadius(),
+ geofence,
mActivityManager.getPackageImportance(packageName));
}
@@ -2876,7 +2876,7 @@
/* LocationRequest= */ null,
/* hasListener= */ false,
intent != null,
- geofence.getRadius(),
+ geofence,
mActivityManager.getPackageImportance(packageName));
}
mGeofenceManager.removeFence(geofence, intent);
@@ -2973,7 +2973,7 @@
/* LocationRequest= */ null,
/* hasListener= */ true,
/* hasIntent= */ false,
- /* radius */ 0,
+ /* geofence= */ null,
mActivityManager.getPackageImportance(packageName));
}
if (isThrottlingExemptLocked(callerIdentity)
@@ -3014,7 +3014,7 @@
/* LocationRequest= */ null,
/* hasListener= */ true,
/* hasIntent= */ false,
- /* radius= */ 0,
+ /* geofence= */ null,
mActivityManager.getPackageImportance(
linkedListener.mCallerIdentity.mPackageName));
}
diff --git a/services/core/java/com/android/server/LocationUsageLogger.java b/services/core/java/com/android/server/LocationUsageLogger.java
index c503035..4ca74bf 100644
--- a/services/core/java/com/android/server/LocationUsageLogger.java
+++ b/services/core/java/com/android/server/LocationUsageLogger.java
@@ -17,6 +17,7 @@
package com.android.server;
import android.app.ActivityManager;
+import android.location.Geofence;
import android.location.LocationManager;
import android.location.LocationRequest;
import android.os.SystemClock;
@@ -180,13 +181,14 @@
public void logLocationApiUsage(int usageType, int apiInUse,
String packageName, LocationRequest locationRequest,
boolean hasListener, boolean hasIntent,
- float radius, int activityImportance) {
+ Geofence geofence, int activityImportance) {
try {
if (!checkApiUsageLogCap()) {
return;
}
boolean isLocationRequestNull = locationRequest == null;
+ boolean isGeofenceNull = geofence == null;
if (D) {
Log.d(TAG, "log API Usage to statsd. usageType: " + usageType + ", apiInUse: "
+ apiInUse + ", packageName: " + (packageName == null ? "" : packageName)
@@ -194,7 +196,8 @@
+ (isLocationRequestNull ? "" : locationRequest.toString())
+ ", hasListener: " + hasListener
+ ", hasIntent: " + hasIntent
- + ", radius: " + radius
+ + ", geofence: "
+ + (isGeofenceNull ? "" : geofence.toString())
+ ", importance: " + activityImportance);
}
@@ -219,7 +222,9 @@
? LocationStatsEnums.EXPIRATION_UNKNOWN
: getBucketizedExpireIn(locationRequest.getExpireAt()),
getCallbackType(apiInUse, hasListener, hasIntent),
- bucketizeRadiusToStatsdEnum(radius),
+ isGeofenceNull
+ ? LocationStatsEnums.RADIUS_UNKNOWN
+ : bucketizeRadiusToStatsdEnum(geofence.getRadius()),
categorizeActivityImportance(activityImportance));
} catch (Exception e) {
// Swallow exceptions to avoid crashing LMS.
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/VibratorService.java b/services/core/java/com/android/server/VibratorService.java
index 0d19a67..6eb9f0c 100644
--- a/services/core/java/com/android/server/VibratorService.java
+++ b/services/core/java/com/android/server/VibratorService.java
@@ -620,7 +620,6 @@
linkVibration(vib);
long ident = Binder.clearCallingIdentity();
try {
-
doCancelVibrateLocked();
startVibrationLocked(vib);
addToPreviousVibrationsLocked(vib);
@@ -1437,6 +1436,8 @@
}
final class ExternalVibratorService extends IExternalVibratorService.Stub {
+ ExternalVibrationDeathRecipient mCurrentExternalDeathRecipient;
+
@Override
public int onExternalVibrationStart(ExternalVibration vib) {
if (!mSupportsExternalControl) {
@@ -1470,6 +1471,8 @@
// Note that this doesn't support multiple concurrent external controls, as we
// would need to mute the old one still if it came from a different controller.
mCurrentExternalVibration = vib;
+ mCurrentExternalDeathRecipient = new ExternalVibrationDeathRecipient();
+ mCurrentExternalVibration.linkToDeath(mCurrentExternalDeathRecipient);
if (mPreviousExternalVibrations.size() > mPreviousVibrationsLimit) {
mPreviousExternalVibrations.removeFirst();
}
@@ -1514,6 +1517,8 @@
public void onExternalVibrationStop(ExternalVibration vib) {
synchronized (mLock) {
if (vib.equals(mCurrentExternalVibration)) {
+ mCurrentExternalVibration.unlinkToDeath(mCurrentExternalDeathRecipient);
+ mCurrentExternalDeathRecipient = null;
mCurrentExternalVibration = null;
setVibratorUnderExternalControl(false);
if (DEBUG) {
@@ -1522,6 +1527,14 @@
}
}
}
+
+ private class ExternalVibrationDeathRecipient implements IBinder.DeathRecipient {
+ public void binderDied() {
+ synchronized (mLock) {
+ onExternalVibrationStop(mCurrentExternalVibration);
+ }
+ }
+ }
}
private final class VibratorShellCommand extends ShellCommand {
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index c5fc5c8..627ca91 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -547,6 +547,7 @@
private static final int MAX_BUGREPORT_TITLE_SIZE = 50;
private static final int NATIVE_DUMP_TIMEOUT_MS = 2000; // 2 seconds;
+ private static final int JAVA_DUMP_MINIMUM_SIZE = 100; // 100 bytes.
OomAdjuster mOomAdjuster;
final LowMemDetector mLowMemDetector;
@@ -3805,9 +3806,28 @@
*/
private static long dumpJavaTracesTombstoned(int pid, String fileName, long timeoutMs) {
final long timeStart = SystemClock.elapsedRealtime();
- if (!Debug.dumpJavaBacktraceToFileTimeout(pid, fileName, (int) (timeoutMs / 1000))) {
- Debug.dumpNativeBacktraceToFileTimeout(pid, fileName,
- (NATIVE_DUMP_TIMEOUT_MS / 1000));
+ boolean javaSuccess = Debug.dumpJavaBacktraceToFileTimeout(pid, fileName,
+ (int) (timeoutMs / 1000));
+ if (javaSuccess) {
+ // Check that something is in the file, actually. Try-catch should not be necessary,
+ // but better safe than sorry.
+ try {
+ long size = new File(fileName).length();
+ if (size < JAVA_DUMP_MINIMUM_SIZE) {
+ Slog.w(TAG, "Successfully created Java ANR file is empty!");
+ javaSuccess = false;
+ }
+ } catch (Exception e) {
+ Slog.w(TAG, "Unable to get ANR file size", e);
+ javaSuccess = false;
+ }
+ }
+ if (!javaSuccess) {
+ Slog.w(TAG, "Dumping Java threads failed, initiating native stack dump.");
+ if (!Debug.dumpNativeBacktraceToFileTimeout(pid, fileName,
+ (NATIVE_DUMP_TIMEOUT_MS / 1000))) {
+ Slog.w(TAG, "Native stack dump failed!");
+ }
}
return SystemClock.elapsedRealtime() - timeStart;
@@ -5375,34 +5395,13 @@
@Override
public void registerIntentSenderCancelListener(IIntentSender sender, IResultReceiver receiver) {
- if (!(sender instanceof PendingIntentRecord)) {
- return;
- }
- boolean isCancelled;
- synchronized(this) {
- PendingIntentRecord pendingIntent = (PendingIntentRecord) sender;
- isCancelled = pendingIntent.canceled;
- if (!isCancelled) {
- pendingIntent.registerCancelListenerLocked(receiver);
- }
- }
- if (isCancelled) {
- try {
- receiver.send(Activity.RESULT_CANCELED, null);
- } catch (RemoteException e) {
- }
- }
+ mPendingIntentController.registerIntentSenderCancelListener(sender, receiver);
}
@Override
public void unregisterIntentSenderCancelListener(IIntentSender sender,
IResultReceiver receiver) {
- if (!(sender instanceof PendingIntentRecord)) {
- return;
- }
- synchronized(this) {
- ((PendingIntentRecord)sender).unregisterCancelListenerLocked(receiver);
- }
+ mPendingIntentController.unregisterIntentSenderCancelListener(sender, receiver);
}
@Override
@@ -7300,6 +7299,13 @@
if (wasInLaunchingProviders) {
mHandler.removeMessages(CONTENT_PROVIDER_PUBLISH_TIMEOUT_MSG, r);
}
+ // Make sure the package is associated with the process.
+ // XXX We shouldn't need to do this, since we have added the package
+ // when we generated the providers in generateApplicationProvidersLocked().
+ // But for some reason in some cases we get here with the package no longer
+ // added... for now just patch it in to make things happy.
+ r.addPackage(dst.info.applicationInfo.packageName,
+ dst.info.applicationInfo.longVersionCode, mProcessStats);
synchronized (dst) {
dst.provider = src.provider;
dst.setProcess(r);
@@ -17679,13 +17685,8 @@
@Override
public void setPendingIntentWhitelistDuration(IIntentSender target, IBinder whitelistToken,
long duration) {
- if (!(target instanceof PendingIntentRecord)) {
- Slog.w(TAG, "markAsSentFromNotification(): not a PendingIntentRecord: " + target);
- return;
- }
- synchronized (ActivityManagerService.this) {
- ((PendingIntentRecord) target).setWhitelistDurationLocked(whitelistToken, duration);
- }
+ mPendingIntentController.setPendingIntentWhitelistDuration(target, whitelistToken,
+ duration);
}
@Override
diff --git a/services/core/java/com/android/server/am/BroadcastDispatcher.java b/services/core/java/com/android/server/am/BroadcastDispatcher.java
index d029482..f8a3d1e 100644
--- a/services/core/java/com/android/server/am/BroadcastDispatcher.java
+++ b/services/core/java/com/android/server/am/BroadcastDispatcher.java
@@ -725,6 +725,14 @@
final Dumper dumper = new Dumper(pw, queueName, dumpPackage, sdf);
boolean printed = false;
+ dumper.setHeading("Currently in flight");
+ dumper.setLabel("In-Flight Ordered Broadcast");
+ if (mCurrentBroadcast != null) {
+ dumper.dump(mCurrentBroadcast);
+ } else {
+ pw.println(" (null)");
+ }
+
dumper.setHeading("Active ordered broadcasts");
dumper.setLabel("Active Ordered Broadcast");
for (Deferrals d : mAlarmBroadcasts) {
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/PendingIntentController.java b/services/core/java/com/android/server/am/PendingIntentController.java
index a5d4738..d75591c 100644
--- a/services/core/java/com/android/server/am/PendingIntentController.java
+++ b/services/core/java/com/android/server/am/PendingIntentController.java
@@ -17,6 +17,7 @@
package com.android.server.am;
import static android.content.pm.PackageManager.MATCH_DEBUG_TRIAGED_MISSING;
+
import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_MU;
import static com.android.server.am.ActivityManagerDebugConfig.POSTFIX_MU;
import static com.android.server.am.ActivityManagerDebugConfig.TAG_AM;
@@ -39,6 +40,7 @@
import android.os.UserHandle;
import android.util.ArrayMap;
import android.util.Slog;
+
import com.android.internal.os.IResultReceiver;
import com.android.internal.util.function.pooled.PooledLambda;
import com.android.server.LocalServices;
@@ -242,6 +244,47 @@
}
}
+ void registerIntentSenderCancelListener(IIntentSender sender, IResultReceiver receiver) {
+ if (!(sender instanceof PendingIntentRecord)) {
+ return;
+ }
+ boolean isCancelled;
+ synchronized (mLock) {
+ PendingIntentRecord pendingIntent = (PendingIntentRecord) sender;
+ isCancelled = pendingIntent.canceled;
+ if (!isCancelled) {
+ pendingIntent.registerCancelListenerLocked(receiver);
+ }
+ }
+ if (isCancelled) {
+ try {
+ receiver.send(Activity.RESULT_CANCELED, null);
+ } catch (RemoteException e) {
+ }
+ }
+ }
+
+ void unregisterIntentSenderCancelListener(IIntentSender sender,
+ IResultReceiver receiver) {
+ if (!(sender instanceof PendingIntentRecord)) {
+ return;
+ }
+ synchronized (mLock) {
+ ((PendingIntentRecord) sender).unregisterCancelListenerLocked(receiver);
+ }
+ }
+
+ void setPendingIntentWhitelistDuration(IIntentSender target, IBinder whitelistToken,
+ long duration) {
+ if (!(target instanceof PendingIntentRecord)) {
+ Slog.w(TAG, "markAsSentFromNotification(): not a PendingIntentRecord: " + target);
+ return;
+ }
+ synchronized (mLock) {
+ ((PendingIntentRecord) target).setWhitelistDurationLocked(whitelistToken, duration);
+ }
+ }
+
private void makeIntentSenderCanceled(PendingIntentRecord rec) {
rec.canceled = true;
final RemoteCallbackList<IResultReceiver> callbacks = rec.detachCancelListenersLocked();
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/am/UserController.java b/services/core/java/com/android/server/am/UserController.java
index 2399d05..b311233 100644
--- a/services/core/java/com/android/server/am/UserController.java
+++ b/services/core/java/com/android/server/am/UserController.java
@@ -559,7 +559,7 @@
// Spin up app widgets prior to boot-complete, so they can be ready promptly
mInjector.startUserWidgets(userId);
- Slog.i(TAG, "Sending BOOT_COMPLETE user #" + userId);
+ Slog.i(TAG, "Posting BOOT_COMPLETED user #" + userId);
// Do not report secondary users, runtime restarts or first boot/upgrade
if (userId == UserHandle.USER_SYSTEM
&& !mInjector.isRuntimeRestarted() && !mInjector.isFirstBootOrUpgrade()) {
@@ -572,18 +572,26 @@
bootIntent.addFlags(Intent.FLAG_RECEIVER_NO_ABORT
| Intent.FLAG_RECEIVER_INCLUDE_BACKGROUND
| Intent.FLAG_RECEIVER_OFFLOAD);
- mInjector.broadcastIntent(bootIntent, null, new IIntentReceiver.Stub() {
- @Override
- public void performReceive(Intent intent, int resultCode, String data,
- Bundle extras, boolean ordered, boolean sticky, int sendingUser)
- throws RemoteException {
- Slog.i(UserController.TAG, "Finished processing BOOT_COMPLETED for u" + userId);
- mBootCompleted = true;
- }
- }, 0, null, null,
- new String[]{android.Manifest.permission.RECEIVE_BOOT_COMPLETED},
- AppOpsManager.OP_NONE, null, true, false, MY_PID, SYSTEM_UID,
- Binder.getCallingUid(), Binder.getCallingPid(), userId);
+ // Widget broadcasts are outbound via FgThread, so to guarantee sequencing
+ // we also send the boot_completed broadcast from that thread.
+ final int callingUid = Binder.getCallingUid();
+ final int callingPid = Binder.getCallingPid();
+ FgThread.getHandler().post(() -> {
+ mInjector.broadcastIntent(bootIntent, null,
+ new IIntentReceiver.Stub() {
+ @Override
+ public void performReceive(Intent intent, int resultCode, String data,
+ Bundle extras, boolean ordered, boolean sticky, int sendingUser)
+ throws RemoteException {
+ Slog.i(UserController.TAG, "Finished processing BOOT_COMPLETED for u"
+ + userId);
+ mBootCompleted = true;
+ }
+ }, 0, null, null,
+ new String[]{android.Manifest.permission.RECEIVE_BOOT_COMPLETED},
+ AppOpsManager.OP_NONE, null, true, false, MY_PID, SYSTEM_UID,
+ callingUid, callingPid, userId);
+ });
}
int restartUser(final int userId, final boolean foreground) {
diff --git a/services/core/java/com/android/server/audio/AudioService.java b/services/core/java/com/android/server/audio/AudioService.java
index e43c548..5ae5113 100644
--- a/services/core/java/com/android/server/audio/AudioService.java
+++ b/services/core/java/com/android/server/audio/AudioService.java
@@ -1016,6 +1016,7 @@
sendEncodedSurroundMode(mContentResolver, "onAudioServerDied");
sendEnabledSurroundFormats(mContentResolver, true);
updateAssistantUId(true);
+ updateRttEanbled(mContentResolver);
}
synchronized (mAccessibilityServiceUidsLock) {
AudioSystem.setA11yServicesUids(mAccessibilityServiceUids);
@@ -1480,6 +1481,12 @@
}
}
+ private void updateRttEanbled(ContentResolver cr) {
+ final boolean rttEnabled = Settings.Secure.getIntForUser(cr,
+ Settings.Secure.RTT_CALLING_MODE, 0, UserHandle.USER_CURRENT) != 0;
+ AudioSystem.setRttEnabled(rttEnabled);
+ }
+
private void readPersistedSettings() {
final ContentResolver cr = mContentResolver;
@@ -1524,6 +1531,7 @@
sendEncodedSurroundMode(cr, "readPersistedSettings");
sendEnabledSurroundFormats(cr, true);
updateAssistantUId(true);
+ updateRttEanbled(cr);
}
mMuteAffectedStreams = System.getIntForUser(cr,
@@ -5502,6 +5510,8 @@
mContentResolver.registerContentObserver(Settings.Secure.getUriFor(
Settings.Secure.VOICE_INTERACTION_SERVICE), false, this);
+ mContentResolver.registerContentObserver(Settings.Secure.getUriFor(
+ Settings.Secure.RTT_CALLING_MODE), false, this);
}
@Override
@@ -5525,6 +5535,7 @@
updateEncodedSurroundOutput();
sendEnabledSurroundFormats(mContentResolver, mSurroundModeChanged);
updateAssistantUId(false);
+ updateRttEanbled(mContentResolver);
}
}
diff --git a/services/core/java/com/android/server/biometrics/ClientMonitor.java b/services/core/java/com/android/server/biometrics/ClientMonitor.java
index 421b3f5..942e050 100644
--- a/services/core/java/com/android/server/biometrics/ClientMonitor.java
+++ b/services/core/java/com/android/server/biometrics/ClientMonitor.java
@@ -42,12 +42,7 @@
private static final AudioAttributes FINGERPRINT_SONFICATION_ATTRIBUTES =
new AudioAttributes.Builder()
.setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)
- // Temporary fix for b/123870990. No time in this release to
- // introduce a new vibration type, but we need to distinguish these vibrations
- // from other haptic feedback vibrations. Fortunately, Alarm vibrations have
- // exactly the same behavior as we need
- // TODO: refactor within the scope of b/132170758
- .setUsage(AudioAttributes.USAGE_ALARM)
+ .setUsage(AudioAttributes.USAGE_ASSISTANCE_SONIFICATION)
.build();
private final Context mContext;
diff --git a/services/core/java/com/android/server/gpu/GpuService.java b/services/core/java/com/android/server/gpu/GpuService.java
index d439653..955f177 100644
--- a/services/core/java/com/android/server/gpu/GpuService.java
+++ b/services/core/java/com/android/server/gpu/GpuService.java
@@ -64,7 +64,6 @@
private static final String PROPERTY_GFX_DRIVER = "ro.gfx.driver.0";
private static final String GAME_DRIVER_WHITELIST_FILENAME = "whitelist.txt";
- private static final String GAME_DRIVER_SPHAL_LIBRARIES_FILENAME = "sphal_libraries.txt";
private static final int BASE64_FLAGS = Base64.NO_PADDING | Base64.NO_WRAP;
private final Context mContext;
@@ -230,9 +229,6 @@
// Reset the whitelist.
Settings.Global.putString(mContentResolver,
Settings.Global.GAME_DRIVER_WHITELIST, "");
- // Reset the sphal libraries
- Settings.Global.putString(mContentResolver,
- Settings.Global.GAME_DRIVER_SPHAL_LIBRARIES, "");
mGameDriverVersionCode = driverInfo.longVersionCode;
try {
@@ -241,10 +237,6 @@
assetToSettingsGlobal(mContext, driverContext, GAME_DRIVER_WHITELIST_FILENAME,
Settings.Global.GAME_DRIVER_WHITELIST, ",");
-
- assetToSettingsGlobal(mContext, driverContext, GAME_DRIVER_SPHAL_LIBRARIES_FILENAME,
- Settings.Global.GAME_DRIVER_SPHAL_LIBRARIES, ":");
-
} catch (PackageManager.NameNotFoundException e) {
if (DEBUG) {
Slog.w(TAG, "driver package '" + mDriverPackageName + "' not installed");
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 65bd5c6..ea4f9c4 100644
--- a/services/core/java/com/android/server/location/GnssVisibilityControl.java
+++ b/services/core/java/com/android/server/location/GnssVisibilityControl.java
@@ -78,7 +78,6 @@
private final Handler mHandler;
private final Context mContext;
private final GpsNetInitiatedHandler mNiHandler;
- private final Notification mEmergencyLocationUserNotification;
private boolean mIsGpsEnabled;
@@ -107,7 +106,6 @@
mNiHandler = niHandler;
mAppOps = mContext.getSystemService(AppOpsManager.class);
mPackageManager = mContext.getPackageManager();
- mEmergencyLocationUserNotification = createEmergencyLocationUserNotification(mContext);
// Complete initialization as the first event to run in mHandler thread. After that,
// all object state read/update events run in the mHandler thread.
@@ -153,7 +151,6 @@
}
private void handleInitialize() {
- disableNfwLocationAccess(); // Disable until config properties are loaded.
listenForProxyAppsPackageUpdates();
}
@@ -263,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() {
@@ -632,13 +625,15 @@
}
notificationManager.notifyAsUser(/* tag= */ null, /* notificationId= */ 0,
- mEmergencyLocationUserNotification, UserHandle.ALL);
+ createEmergencyLocationUserNotification(mContext), UserHandle.ALL);
}
private static Notification createEmergencyLocationUserNotification(Context context) {
- String firstLineText = context.getString(R.string.gpsNotifTitle);
- String secondLineText = context.getString(R.string.global_action_emergency);
- String accessibilityServicesText = firstLineText + " (" + secondLineText + ")";
+ // NOTE: Do not reuse the returned notification object as it will not reflect
+ // changes to notification text when the system language is changed.
+ final String firstLineText = context.getString(R.string.gpsNotifTitle);
+ final String secondLineText = context.getString(R.string.global_action_emergency);
+ final String accessibilityServicesText = firstLineText + " (" + secondLineText + ")";
return new Notification.Builder(context, SystemNotificationChannels.NETWORK_ALERTS)
.setSmallIcon(com.android.internal.R.drawable.stat_sys_gps_on)
.setWhen(0)
diff --git a/services/core/java/com/android/server/oemlock/PersistentDataBlockLock.java b/services/core/java/com/android/server/oemlock/PersistentDataBlockLock.java
index a1c27d6..2474b2aa 100644
--- a/services/core/java/com/android/server/oemlock/PersistentDataBlockLock.java
+++ b/services/core/java/com/android/server/oemlock/PersistentDataBlockLock.java
@@ -73,6 +73,10 @@
// unlocked but doesn't actually do any unlocking.
final PersistentDataBlockManager pdbm = (PersistentDataBlockManager)
mContext.getSystemService(Context.PERSISTENT_DATA_BLOCK_SERVICE);
+ if (pdbm == null) {
+ Slog.w(TAG, "PersistentDataBlock is not supported on this device");
+ return;
+ }
pdbm.setOemUnlockEnabled(allowedByDevice);
}
@@ -80,6 +84,10 @@
boolean isOemUnlockAllowedByDevice() {
final PersistentDataBlockManager pdbm = (PersistentDataBlockManager)
mContext.getSystemService(Context.PERSISTENT_DATA_BLOCK_SERVICE);
+ if (pdbm == null) {
+ Slog.w(TAG, "PersistentDataBlock is not supported on this device");
+ return false;
+ }
return pdbm.getOemUnlockEnabled();
}
@@ -91,6 +99,10 @@
private void disallowUnlockIfNotUnlocked() {
final PersistentDataBlockManager pdbm = (PersistentDataBlockManager)
mContext.getSystemService(Context.PERSISTENT_DATA_BLOCK_SERVICE);
+ if (pdbm == null) {
+ Slog.w(TAG, "PersistentDataBlock is not supported on this device");
+ return;
+ }
if (pdbm.getFlashLockState() != PersistentDataBlockManager.FLASH_LOCK_UNLOCKED) {
pdbm.setOemUnlockEnabled(false);
}
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/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java
index d624a85..7e706ad 100644
--- a/services/core/java/com/android/server/policy/PhoneWindowManager.java
+++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java
@@ -4863,6 +4863,7 @@
}
}
startedWakingUp(ON_BECAUSE_OF_UNKNOWN);
+ finishedWakingUp(ON_BECAUSE_OF_UNKNOWN);
screenTurningOn(null);
screenTurnedOn();
}
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/webkit/WebViewUpdateServiceImpl.java b/services/core/java/com/android/server/webkit/WebViewUpdateServiceImpl.java
index 165055a..11fd795 100644
--- a/services/core/java/com/android/server/webkit/WebViewUpdateServiceImpl.java
+++ b/services/core/java/com/android/server/webkit/WebViewUpdateServiceImpl.java
@@ -82,6 +82,22 @@
void prepareWebViewInSystemServer() {
migrateFallbackStateOnBoot();
mWebViewUpdater.prepareWebViewInSystemServer();
+ if (getCurrentWebViewPackage() == null) {
+ // We didn't find a valid WebView implementation. Try explicitly re-enabling the
+ // fallback package for all users in case it was disabled, even if we already did the
+ // one-time migration before. If this actually changes the state, WebViewUpdater will
+ // see the PackageManager broadcast shortly and try again.
+ WebViewProviderInfo[] webviewProviders = mSystemInterface.getWebViewPackages();
+ WebViewProviderInfo fallbackProvider = getFallbackProvider(webviewProviders);
+ if (fallbackProvider != null) {
+ Slog.w(TAG, "No valid provider, trying to enable " + fallbackProvider.packageName);
+ mSystemInterface.enablePackageForAllUsers(mContext, fallbackProvider.packageName,
+ true);
+ } else {
+ Slog.e(TAG, "No valid provider and no fallback available.");
+ }
+ }
+
boolean multiProcessEnabled = isMultiProcessEnabled();
mSystemInterface.notifyZygote(multiProcessEnabled);
if (multiProcessEnabled) {
diff --git a/services/core/java/com/android/server/wm/ActivityStarter.java b/services/core/java/com/android/server/wm/ActivityStarter.java
index 5c55c2e..0a88eef 100644
--- a/services/core/java/com/android/server/wm/ActivityStarter.java
+++ b/services/core/java/com/android/server/wm/ActivityStarter.java
@@ -1419,6 +1419,13 @@
stack.finishActivityLocked(mStartActivity, RESULT_CANCELED,
null /* intentResultData */, "startActivity", true /* oomAdj */);
}
+
+ // Stack should also be detached from display and be removed if it's empty.
+ if (startedActivityStack != null && startedActivityStack.isAttached()
+ && startedActivityStack.numActivities() == 0
+ && !startedActivityStack.isActivityTypeHome()) {
+ startedActivityStack.remove();
+ }
}
mService.mWindowManager.continueSurfaceLayout();
}
@@ -2289,15 +2296,17 @@
}
private int setTaskFromReuseOrCreateNewTask(TaskRecord taskToAffiliate) {
+ if (mRestrictedBgActivity && (mReuseTask == null || !mReuseTask.containsAppUid(mCallingUid))
+ && handleBackgroundActivityAbort(mStartActivity)) {
+ return START_ABORTED;
+ }
+
mTargetStack = computeStackFocus(mStartActivity, true, mLaunchFlags, mOptions);
// Do no move the target stack to front yet, as we might bail if
// isLockTaskModeViolation fails below.
if (mReuseTask == null) {
- if (mRestrictedBgActivity && handleBackgroundActivityAbort(mStartActivity)) {
- return START_ABORTED;
- }
final TaskRecord task = mTargetStack.createTaskRecord(
mSupervisor.getNextTaskIdForUserLocked(mStartActivity.mUserId),
mNewTaskInfo != null ? mNewTaskInfo : mStartActivity.info,
@@ -2310,11 +2319,6 @@
if (DEBUG_TASKS) Slog.v(TAG_TASKS, "Starting new activity " + mStartActivity
+ " in new task " + mStartActivity.getTaskRecord());
} else {
- if (mRestrictedBgActivity && !mReuseTask.containsAppUid(mCallingUid)) {
- if (handleBackgroundActivityAbort(mStartActivity)) {
- return START_ABORTED;
- }
- }
addOrReparentStartingActivity(mReuseTask, "setTaskFromReuseOrCreateNewTask");
}
diff --git a/services/core/java/com/android/server/wm/AppWindowToken.java b/services/core/java/com/android/server/wm/AppWindowToken.java
index 4a9a3f7..9189279 100644
--- a/services/core/java/com/android/server/wm/AppWindowToken.java
+++ b/services/core/java/com/android/server/wm/AppWindowToken.java
@@ -1322,7 +1322,9 @@
if (prevDc == null || prevDc == mDisplayContent) {
return;
}
- if (prevDc.mChangingApps.contains(this)) {
+
+ prevDc.mOpeningApps.remove(this);
+ if (prevDc.mChangingApps.remove(this)) {
// This gets called *after* the AppWindowToken has been reparented to the new display.
// That reparenting resulted in this window changing modes (eg. FREEFORM -> FULLSCREEN),
// so this token is now "frozen" while waiting for the animation to start on prevDc
@@ -1331,6 +1333,8 @@
// so we need to cancel the change transition here.
clearChangeLeash(getPendingTransaction(), true /* cancel */);
}
+ prevDc.mClosingApps.remove(this);
+
if (prevDc.mFocusedApp == this) {
prevDc.setFocusedApp(null);
final TaskStack stack = dc.getTopStack();
@@ -3216,16 +3220,6 @@
true /* topToBottom */);
}
- void removeFromPendingTransition() {
- if (isWaitingForTransitionStart() && mDisplayContent != null) {
- mDisplayContent.mOpeningApps.remove(this);
- if (mDisplayContent.mChangingApps.remove(this)) {
- clearChangeLeash(getPendingTransaction(), true /* cancel */);
- }
- mDisplayContent.mClosingApps.remove(this);
- }
- }
-
private void updateColorTransform() {
if (mSurfaceControl != null && mLastAppSaturationInfo != null) {
getPendingTransaction().setColorTransform(mSurfaceControl,
diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java
index c3a769b..80848a8f 100644
--- a/services/core/java/com/android/server/wm/DisplayContent.java
+++ b/services/core/java/com/android/server/wm/DisplayContent.java
@@ -2377,9 +2377,6 @@
+ " to its current displayId=" + mDisplayId);
}
- // Clean up all pending transitions when stack reparent to another display.
- stack.forAllAppWindows(AppWindowToken::removeFromPendingTransition);
-
prevDc.mTaskStackContainers.removeChild(stack);
mTaskStackContainers.addStackToDisplay(stack, onTop);
}
diff --git a/services/core/java/com/android/server/wm/TaskStack.java b/services/core/java/com/android/server/wm/TaskStack.java
index d838691..481c3ba 100644
--- a/services/core/java/com/android/server/wm/TaskStack.java
+++ b/services/core/java/com/android/server/wm/TaskStack.java
@@ -1640,6 +1640,7 @@
if (mAnimationType == BoundsAnimationController.FADE_IN) {
setPinnedStackAlpha(1f);
mActivityStack.mService.notifyPinnedStackAnimationEnded();
+ return;
}
if (finalStackSize != null && !mCancelCurrentBoundsAnimation) {
@@ -1935,14 +1936,11 @@
public boolean setPinnedStackAlpha(float alpha) {
// Hold the lock since this is called from the BoundsAnimator running on the UiThread
synchronized (mWmService.mGlobalLock) {
- if (mCancelCurrentBoundsAnimation) {
- return false;
- }
- getPendingTransaction().setAlpha(getSurfaceControl(), alpha);
+ getPendingTransaction().setAlpha(getSurfaceControl(),
+ mCancelCurrentBoundsAnimation ? 1 : alpha);
scheduleAnimation();
+ return !mCancelCurrentBoundsAnimation;
}
-
- return true;
}
public DisplayInfo getDisplayInfo() {
diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java
index de9d769..c6c9e1b 100644
--- a/services/core/java/com/android/server/wm/WindowState.java
+++ b/services/core/java/com/android/server/wm/WindowState.java
@@ -1548,7 +1548,8 @@
*/
boolean isInteresting() {
return mAppToken != null && !mAppDied
- && (!mAppToken.isFreezingScreen() || !mAppFreezing);
+ && (!mAppToken.isFreezingScreen() || !mAppFreezing)
+ && mViewVisibility == View.VISIBLE;
}
/**
diff --git a/services/net/aidl/ipmemorystore/3/android/net/IIpMemoryStore.aidl b/services/net/aidl/ipmemorystore/3/android/net/IIpMemoryStore.aidl
index 1e688d0..30893b2 100644
--- a/services/net/aidl/ipmemorystore/3/android/net/IIpMemoryStore.aidl
+++ b/services/net/aidl/ipmemorystore/3/android/net/IIpMemoryStore.aidl
@@ -1,3 +1,20 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not
+// try to edit this file. It looks like you are doing that because you have
+// modified an AIDL interface in a backward-incompatible way, e.g., deleting a
+// function from an interface or a field from a parcelable and it broke the
+// build. That breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
package android.net;
interface IIpMemoryStore {
oneway void storeNetworkAttributes(String l2Key, in android.net.ipmemorystore.NetworkAttributesParcelable attributes, android.net.ipmemorystore.IOnStatusListener listener);
diff --git a/services/net/aidl/ipmemorystore/3/android/net/IIpMemoryStoreCallbacks.aidl b/services/net/aidl/ipmemorystore/3/android/net/IIpMemoryStoreCallbacks.aidl
index cf02c26..535ae2c 100644
--- a/services/net/aidl/ipmemorystore/3/android/net/IIpMemoryStoreCallbacks.aidl
+++ b/services/net/aidl/ipmemorystore/3/android/net/IIpMemoryStoreCallbacks.aidl
@@ -1,3 +1,20 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not
+// try to edit this file. It looks like you are doing that because you have
+// modified an AIDL interface in a backward-incompatible way, e.g., deleting a
+// function from an interface or a field from a parcelable and it broke the
+// build. That breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
package android.net;
interface IIpMemoryStoreCallbacks {
oneway void onIpMemoryStoreFetched(in android.net.IIpMemoryStore ipMemoryStore);
diff --git a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/Blob.aidl b/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/Blob.aidl
index 291dbef..6d2dc0c 100644
--- a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/Blob.aidl
+++ b/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/Blob.aidl
@@ -1,3 +1,20 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not
+// try to edit this file. It looks like you are doing that because you have
+// modified an AIDL interface in a backward-incompatible way, e.g., deleting a
+// function from an interface or a field from a parcelable and it broke the
+// build. That breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
package android.net.ipmemorystore;
parcelable Blob {
byte[] data;
diff --git a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnBlobRetrievedListener.aidl b/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnBlobRetrievedListener.aidl
index 52f40d4..48c1fb8 100644
--- a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnBlobRetrievedListener.aidl
+++ b/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnBlobRetrievedListener.aidl
@@ -1,3 +1,20 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not
+// try to edit this file. It looks like you are doing that because you have
+// modified an AIDL interface in a backward-incompatible way, e.g., deleting a
+// function from an interface or a field from a parcelable and it broke the
+// build. That breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
package android.net.ipmemorystore;
interface IOnBlobRetrievedListener {
oneway void onBlobRetrieved(in android.net.ipmemorystore.StatusParcelable status, in String l2Key, in String name, in android.net.ipmemorystore.Blob data);
diff --git a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnL2KeyResponseListener.aidl b/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnL2KeyResponseListener.aidl
index 7853514..aebc724 100644
--- a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnL2KeyResponseListener.aidl
+++ b/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnL2KeyResponseListener.aidl
@@ -1,3 +1,20 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not
+// try to edit this file. It looks like you are doing that because you have
+// modified an AIDL interface in a backward-incompatible way, e.g., deleting a
+// function from an interface or a field from a parcelable and it broke the
+// build. That breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
package android.net.ipmemorystore;
interface IOnL2KeyResponseListener {
oneway void onL2KeyResponse(in android.net.ipmemorystore.StatusParcelable status, in String l2Key);
diff --git a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnNetworkAttributesRetrievedListener.aidl b/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnNetworkAttributesRetrievedListener.aidl
index 3dd2ae6..b66db5a 100644
--- a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnNetworkAttributesRetrievedListener.aidl
+++ b/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnNetworkAttributesRetrievedListener.aidl
@@ -1,3 +1,20 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not
+// try to edit this file. It looks like you are doing that because you have
+// modified an AIDL interface in a backward-incompatible way, e.g., deleting a
+// function from an interface or a field from a parcelable and it broke the
+// build. That breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
package android.net.ipmemorystore;
interface IOnNetworkAttributesRetrievedListener {
oneway void onNetworkAttributesRetrieved(in android.net.ipmemorystore.StatusParcelable status, in String l2Key, in android.net.ipmemorystore.NetworkAttributesParcelable attributes);
diff --git a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnSameL3NetworkResponseListener.aidl b/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnSameL3NetworkResponseListener.aidl
index 46d4ecb..e9f2db4 100644
--- a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnSameL3NetworkResponseListener.aidl
+++ b/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnSameL3NetworkResponseListener.aidl
@@ -1,3 +1,20 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not
+// try to edit this file. It looks like you are doing that because you have
+// modified an AIDL interface in a backward-incompatible way, e.g., deleting a
+// function from an interface or a field from a parcelable and it broke the
+// build. That breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
package android.net.ipmemorystore;
interface IOnSameL3NetworkResponseListener {
oneway void onSameL3NetworkResponse(in android.net.ipmemorystore.StatusParcelable status, in android.net.ipmemorystore.SameL3NetworkResponseParcelable response);
diff --git a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnStatusListener.aidl b/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnStatusListener.aidl
index 54e654b..49172ce 100644
--- a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnStatusListener.aidl
+++ b/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnStatusListener.aidl
@@ -1,3 +1,20 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not
+// try to edit this file. It looks like you are doing that because you have
+// modified an AIDL interface in a backward-incompatible way, e.g., deleting a
+// function from an interface or a field from a parcelable and it broke the
+// build. That breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
package android.net.ipmemorystore;
interface IOnStatusListener {
oneway void onComplete(in android.net.ipmemorystore.StatusParcelable status);
diff --git a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/NetworkAttributesParcelable.aidl b/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/NetworkAttributesParcelable.aidl
index 9531ea3..188db20 100644
--- a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/NetworkAttributesParcelable.aidl
+++ b/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/NetworkAttributesParcelable.aidl
@@ -1,3 +1,20 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not
+// try to edit this file. It looks like you are doing that because you have
+// modified an AIDL interface in a backward-incompatible way, e.g., deleting a
+// function from an interface or a field from a parcelable and it broke the
+// build. That breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
package android.net.ipmemorystore;
parcelable NetworkAttributesParcelable {
byte[] assignedV4Address;
diff --git a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/SameL3NetworkResponseParcelable.aidl b/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/SameL3NetworkResponseParcelable.aidl
index 414272b..7a2ed48 100644
--- a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/SameL3NetworkResponseParcelable.aidl
+++ b/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/SameL3NetworkResponseParcelable.aidl
@@ -1,3 +1,20 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not
+// try to edit this file. It looks like you are doing that because you have
+// modified an AIDL interface in a backward-incompatible way, e.g., deleting a
+// function from an interface or a field from a parcelable and it broke the
+// build. That breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
package android.net.ipmemorystore;
parcelable SameL3NetworkResponseParcelable {
String l2Key1;
diff --git a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/StatusParcelable.aidl b/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/StatusParcelable.aidl
index 92c6779..d9b0678 100644
--- a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/StatusParcelable.aidl
+++ b/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/StatusParcelable.aidl
@@ -1,3 +1,20 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not
+// try to edit this file. It looks like you are doing that because you have
+// modified an AIDL interface in a backward-incompatible way, e.g., deleting a
+// function from an interface or a field from a parcelable and it broke the
+// build. That breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
package android.net.ipmemorystore;
parcelable StatusParcelable {
int resultCode;
diff --git a/services/net/aidl/networkstack/3/android/net/DhcpResultsParcelable.aidl b/services/net/aidl/networkstack/3/android/net/DhcpResultsParcelable.aidl
index 31891de..07ff321 100644
--- a/services/net/aidl/networkstack/3/android/net/DhcpResultsParcelable.aidl
+++ b/services/net/aidl/networkstack/3/android/net/DhcpResultsParcelable.aidl
@@ -1,3 +1,20 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not
+// try to edit this file. It looks like you are doing that because you have
+// modified an AIDL interface in a backward-incompatible way, e.g., deleting a
+// function from an interface or a field from a parcelable and it broke the
+// build. That breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
package android.net;
parcelable DhcpResultsParcelable {
android.net.StaticIpConfiguration baseConfiguration;
diff --git a/services/net/aidl/networkstack/3/android/net/INetworkMonitor.aidl b/services/net/aidl/networkstack/3/android/net/INetworkMonitor.aidl
index 029968b..8aa68bd 100644
--- a/services/net/aidl/networkstack/3/android/net/INetworkMonitor.aidl
+++ b/services/net/aidl/networkstack/3/android/net/INetworkMonitor.aidl
@@ -1,3 +1,20 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not
+// try to edit this file. It looks like you are doing that because you have
+// modified an AIDL interface in a backward-incompatible way, e.g., deleting a
+// function from an interface or a field from a parcelable and it broke the
+// build. That breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
package android.net;
interface INetworkMonitor {
oneway void start();
diff --git a/services/net/aidl/networkstack/3/android/net/INetworkMonitorCallbacks.aidl b/services/net/aidl/networkstack/3/android/net/INetworkMonitorCallbacks.aidl
index ee9871d..ea93729 100644
--- a/services/net/aidl/networkstack/3/android/net/INetworkMonitorCallbacks.aidl
+++ b/services/net/aidl/networkstack/3/android/net/INetworkMonitorCallbacks.aidl
@@ -1,3 +1,20 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not
+// try to edit this file. It looks like you are doing that because you have
+// modified an AIDL interface in a backward-incompatible way, e.g., deleting a
+// function from an interface or a field from a parcelable and it broke the
+// build. That breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
package android.net;
interface INetworkMonitorCallbacks {
oneway void onNetworkMonitorCreated(in android.net.INetworkMonitor networkMonitor);
diff --git a/services/net/aidl/networkstack/3/android/net/INetworkStackConnector.aidl b/services/net/aidl/networkstack/3/android/net/INetworkStackConnector.aidl
index 7da11e4..e3a83d1 100644
--- a/services/net/aidl/networkstack/3/android/net/INetworkStackConnector.aidl
+++ b/services/net/aidl/networkstack/3/android/net/INetworkStackConnector.aidl
@@ -1,3 +1,20 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not
+// try to edit this file. It looks like you are doing that because you have
+// modified an AIDL interface in a backward-incompatible way, e.g., deleting a
+// function from an interface or a field from a parcelable and it broke the
+// build. That breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
package android.net;
interface INetworkStackConnector {
oneway void makeDhcpServer(in String ifName, in android.net.dhcp.DhcpServingParamsParcel params, in android.net.dhcp.IDhcpServerCallbacks cb);
diff --git a/services/net/aidl/networkstack/3/android/net/INetworkStackStatusCallback.aidl b/services/net/aidl/networkstack/3/android/net/INetworkStackStatusCallback.aidl
index f6ca6f7..3112a08 100644
--- a/services/net/aidl/networkstack/3/android/net/INetworkStackStatusCallback.aidl
+++ b/services/net/aidl/networkstack/3/android/net/INetworkStackStatusCallback.aidl
@@ -1,3 +1,20 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not
+// try to edit this file. It looks like you are doing that because you have
+// modified an AIDL interface in a backward-incompatible way, e.g., deleting a
+// function from an interface or a field from a parcelable and it broke the
+// build. That breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
package android.net;
interface INetworkStackStatusCallback {
oneway void onStatusAvailable(int statusCode);
diff --git a/services/net/aidl/networkstack/3/android/net/InitialConfigurationParcelable.aidl b/services/net/aidl/networkstack/3/android/net/InitialConfigurationParcelable.aidl
index c80a787..f846b26 100644
--- a/services/net/aidl/networkstack/3/android/net/InitialConfigurationParcelable.aidl
+++ b/services/net/aidl/networkstack/3/android/net/InitialConfigurationParcelable.aidl
@@ -1,3 +1,20 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not
+// try to edit this file. It looks like you are doing that because you have
+// modified an AIDL interface in a backward-incompatible way, e.g., deleting a
+// function from an interface or a field from a parcelable and it broke the
+// build. That breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
package android.net;
parcelable InitialConfigurationParcelable {
android.net.LinkAddress[] ipAddresses;
diff --git a/services/net/aidl/networkstack/3/android/net/NattKeepalivePacketDataParcelable.aidl b/services/net/aidl/networkstack/3/android/net/NattKeepalivePacketDataParcelable.aidl
index 65de883..de75940 100644
--- a/services/net/aidl/networkstack/3/android/net/NattKeepalivePacketDataParcelable.aidl
+++ b/services/net/aidl/networkstack/3/android/net/NattKeepalivePacketDataParcelable.aidl
@@ -1,3 +1,20 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not
+// try to edit this file. It looks like you are doing that because you have
+// modified an AIDL interface in a backward-incompatible way, e.g., deleting a
+// function from an interface or a field from a parcelable and it broke the
+// build. That breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
package android.net;
parcelable NattKeepalivePacketDataParcelable {
byte[] srcAddress;
diff --git a/services/net/aidl/networkstack/3/android/net/PrivateDnsConfigParcel.aidl b/services/net/aidl/networkstack/3/android/net/PrivateDnsConfigParcel.aidl
index 2de790b..cf0fbce9 100644
--- a/services/net/aidl/networkstack/3/android/net/PrivateDnsConfigParcel.aidl
+++ b/services/net/aidl/networkstack/3/android/net/PrivateDnsConfigParcel.aidl
@@ -1,3 +1,20 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not
+// try to edit this file. It looks like you are doing that because you have
+// modified an AIDL interface in a backward-incompatible way, e.g., deleting a
+// function from an interface or a field from a parcelable and it broke the
+// build. That breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
package android.net;
parcelable PrivateDnsConfigParcel {
String hostname;
diff --git a/services/net/aidl/networkstack/3/android/net/ProvisioningConfigurationParcelable.aidl b/services/net/aidl/networkstack/3/android/net/ProvisioningConfigurationParcelable.aidl
index 3a6c304..c0f2d4d 100644
--- a/services/net/aidl/networkstack/3/android/net/ProvisioningConfigurationParcelable.aidl
+++ b/services/net/aidl/networkstack/3/android/net/ProvisioningConfigurationParcelable.aidl
@@ -1,3 +1,20 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not
+// try to edit this file. It looks like you are doing that because you have
+// modified an AIDL interface in a backward-incompatible way, e.g., deleting a
+// function from an interface or a field from a parcelable and it broke the
+// build. That breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
package android.net;
parcelable ProvisioningConfigurationParcelable {
boolean enableIPv4;
diff --git a/services/net/aidl/networkstack/3/android/net/TcpKeepalivePacketDataParcelable.aidl b/services/net/aidl/networkstack/3/android/net/TcpKeepalivePacketDataParcelable.aidl
index e121c06..5926794 100644
--- a/services/net/aidl/networkstack/3/android/net/TcpKeepalivePacketDataParcelable.aidl
+++ b/services/net/aidl/networkstack/3/android/net/TcpKeepalivePacketDataParcelable.aidl
@@ -1,3 +1,20 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not
+// try to edit this file. It looks like you are doing that because you have
+// modified an AIDL interface in a backward-incompatible way, e.g., deleting a
+// function from an interface or a field from a parcelable and it broke the
+// build. That breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
package android.net;
parcelable TcpKeepalivePacketDataParcelable {
byte[] srcAddress;
diff --git a/services/net/aidl/networkstack/3/android/net/dhcp/DhcpServingParamsParcel.aidl b/services/net/aidl/networkstack/3/android/net/dhcp/DhcpServingParamsParcel.aidl
index 67193ae..7ab156f 100644
--- a/services/net/aidl/networkstack/3/android/net/dhcp/DhcpServingParamsParcel.aidl
+++ b/services/net/aidl/networkstack/3/android/net/dhcp/DhcpServingParamsParcel.aidl
@@ -1,3 +1,20 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not
+// try to edit this file. It looks like you are doing that because you have
+// modified an AIDL interface in a backward-incompatible way, e.g., deleting a
+// function from an interface or a field from a parcelable and it broke the
+// build. That breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
package android.net.dhcp;
parcelable DhcpServingParamsParcel {
int serverAddr;
diff --git a/services/net/aidl/networkstack/3/android/net/dhcp/IDhcpServer.aidl b/services/net/aidl/networkstack/3/android/net/dhcp/IDhcpServer.aidl
index 9143158..d281ecf 100644
--- a/services/net/aidl/networkstack/3/android/net/dhcp/IDhcpServer.aidl
+++ b/services/net/aidl/networkstack/3/android/net/dhcp/IDhcpServer.aidl
@@ -1,3 +1,20 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not
+// try to edit this file. It looks like you are doing that because you have
+// modified an AIDL interface in a backward-incompatible way, e.g., deleting a
+// function from an interface or a field from a parcelable and it broke the
+// build. That breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
package android.net.dhcp;
interface IDhcpServer {
oneway void start(in android.net.INetworkStackStatusCallback cb);
diff --git a/services/net/aidl/networkstack/3/android/net/dhcp/IDhcpServerCallbacks.aidl b/services/net/aidl/networkstack/3/android/net/dhcp/IDhcpServerCallbacks.aidl
index dcc4489..98be0ab 100644
--- a/services/net/aidl/networkstack/3/android/net/dhcp/IDhcpServerCallbacks.aidl
+++ b/services/net/aidl/networkstack/3/android/net/dhcp/IDhcpServerCallbacks.aidl
@@ -1,3 +1,20 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not
+// try to edit this file. It looks like you are doing that because you have
+// modified an AIDL interface in a backward-incompatible way, e.g., deleting a
+// function from an interface or a field from a parcelable and it broke the
+// build. That breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
package android.net.dhcp;
interface IDhcpServerCallbacks {
oneway void onDhcpServerCreated(int statusCode, in android.net.dhcp.IDhcpServer server);
diff --git a/services/net/aidl/networkstack/3/android/net/ip/IIpClient.aidl b/services/net/aidl/networkstack/3/android/net/ip/IIpClient.aidl
index 176a5ce..85c8676 100644
--- a/services/net/aidl/networkstack/3/android/net/ip/IIpClient.aidl
+++ b/services/net/aidl/networkstack/3/android/net/ip/IIpClient.aidl
@@ -1,3 +1,20 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not
+// try to edit this file. It looks like you are doing that because you have
+// modified an AIDL interface in a backward-incompatible way, e.g., deleting a
+// function from an interface or a field from a parcelable and it broke the
+// build. That breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
package android.net.ip;
interface IIpClient {
oneway void completedPreDhcpAction();
diff --git a/services/net/aidl/networkstack/3/android/net/ip/IIpClientCallbacks.aidl b/services/net/aidl/networkstack/3/android/net/ip/IIpClientCallbacks.aidl
index d6bc808..7fe39ed 100644
--- a/services/net/aidl/networkstack/3/android/net/ip/IIpClientCallbacks.aidl
+++ b/services/net/aidl/networkstack/3/android/net/ip/IIpClientCallbacks.aidl
@@ -1,3 +1,20 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not
+// try to edit this file. It looks like you are doing that because you have
+// modified an AIDL interface in a backward-incompatible way, e.g., deleting a
+// function from an interface or a field from a parcelable and it broke the
+// build. That breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
package android.net.ip;
interface IIpClientCallbacks {
oneway void onIpClientCreated(in android.net.ip.IIpClient ipClient);
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/services/tests/wmtests/src/com/android/server/wm/ActivityTestsBase.java b/services/tests/wmtests/src/com/android/server/wm/ActivityTestsBase.java
index 53b0add..4986a6d 100644
--- a/services/tests/wmtests/src/com/android/server/wm/ActivityTestsBase.java
+++ b/services/tests/wmtests/src/com/android/server/wm/ActivityTestsBase.java
@@ -585,7 +585,10 @@
}
void tearDown() {
- mHandlerThread.quitSafely();
+ // Make sure there are no running messages and then quit the thread so the next test
+ // won't be affected.
+ mHandlerThread.getThreadHandler().runWithScissors(mHandlerThread::quit,
+ 0 /* timeout */);
}
}
@@ -630,7 +633,8 @@
mWindowManager = prepareMockWindowManager();
mKeyguardController = mock(KeyguardController.class);
- // Do not schedule idle timeouts
+ // Do not schedule idle that may touch methods outside the scope of the test.
+ doNothing().when(this).scheduleIdleLocked();
doNothing().when(this).scheduleIdleTimeoutLocked(any());
// unit test version does not handle launch wake lock
doNothing().when(this).acquireLaunchWakelock();
diff --git a/telephony/java/android/telephony/ServiceState.java b/telephony/java/android/telephony/ServiceState.java
index 5d39a2c..518da74 100644
--- a/telephony/java/android/telephony/ServiceState.java
+++ b/telephony/java/android/telephony/ServiceState.java
@@ -16,6 +16,8 @@
package android.telephony;
+import static android.telephony.TelephonyManager.NETWORK_TYPE_BITMASK_UNKNOWN;
+
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
@@ -1605,6 +1607,12 @@
}
}
+ /** @hide */
+ public static int networkTypeToAccessNetworkType(@TelephonyManager.NetworkType
+ int networkType) {
+ return rilRadioTechnologyToAccessNetworkType(networkTypeToRilRadioTechnology(networkType));
+ }
+
/**
* Get current data network type.
*
@@ -1730,6 +1738,36 @@
return false;
}
+ /**
+ *
+ * Returns whether the bearerBitmask includes a networkType that matches the accessNetworkType.
+ *
+ * The NetworkType refers to NetworkType in TelephonyManager. For example
+ * {@link TelephonyManager#NETWORK_TYPE_GPRS}.
+ *
+ * The accessNetworkType refers to {@link AccessNetworkType}.
+ *
+ * @hide
+ * */
+ public static boolean networkBitmaskHasAccessNetworkType(
+ @TelephonyManager.NetworkTypeBitMask int networkBitmask, int accessNetworkType) {
+ if (networkBitmask == NETWORK_TYPE_BITMASK_UNKNOWN) return true;
+ if (accessNetworkType == AccessNetworkType.UNKNOWN) return false;
+
+ int networkType = 1;
+ while (networkBitmask != 0) {
+ if ((networkBitmask & 1) != 0) {
+ if (networkTypeToAccessNetworkType(networkType) == accessNetworkType) {
+ return true;
+ }
+ }
+ networkBitmask = networkBitmask >> 1;
+ networkType++;
+ }
+
+ return false;
+ }
+
/** @hide */
public static int getBitmaskForTech(int radioTech) {
if (radioTech >= 1) {
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.");
}
/**
diff --git a/tests/Internal/src/com/android/internal/colorextraction/ColorExtractorTest.java b/tests/Internal/src/com/android/internal/colorextraction/ColorExtractorTest.java
index 17fa931..45ddc3e 100644
--- a/tests/Internal/src/com/android/internal/colorextraction/ColorExtractorTest.java
+++ b/tests/Internal/src/com/android/internal/colorextraction/ColorExtractorTest.java
@@ -39,6 +39,8 @@
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
/**
* Tests color extraction generation.
@@ -48,16 +50,19 @@
public class ColorExtractorTest {
Context mContext;
+ @Mock
+ WallpaperManager mWallpaperManager;
@Before
public void setup() {
+ MockitoAnnotations.initMocks(this);
mContext = InstrumentationRegistry.getContext();
}
@Test
public void ColorExtractor_extractWhenInitialized() {
ExtractionType type = mock(Tonal.class);
- new ColorExtractor(mContext, type, true);
+ new ColorExtractor(mContext, type, true, mWallpaperManager);
// 1 for lock and 1 for system
verify(type, times(2))
.extractInto(any(), any(), any(), any());
@@ -84,7 +89,7 @@
outGradientColorsDark.set(colorsExpectedDark);
outGradientColorsExtraDark.set(colorsExpectedExtraDark);
};
- ColorExtractor extractor = new ColorExtractor(mContext, type, true);
+ ColorExtractor extractor = new ColorExtractor(mContext, type, true, mWallpaperManager);
GradientColors colors = extractor.getColors(WallpaperManager.FLAG_SYSTEM,
ColorExtractor.TYPE_NORMAL);
@@ -99,7 +104,8 @@
public void addOnColorsChangedListener_invokesListener() {
ColorExtractor.OnColorsChangedListener mockedListeners =
mock(ColorExtractor.OnColorsChangedListener.class);
- ColorExtractor extractor = new ColorExtractor(mContext, new Tonal(mContext), true);
+ ColorExtractor extractor = new ColorExtractor(mContext, new Tonal(mContext), true,
+ mWallpaperManager);
extractor.addOnColorsChangedListener(mockedListeners);
extractor.onColorsChanged(new WallpaperColors(Color.valueOf(Color.RED), null, null),
diff --git a/tools/incident_section_gen/main.cpp b/tools/incident_section_gen/main.cpp
index c9c0edc..91f875e 100644
--- a/tools/incident_section_gen/main.cpp
+++ b/tools/incident_section_gen/main.cpp
@@ -408,9 +408,10 @@
for (int i=0; i<descriptor->field_count(); i++) {
const FieldDescriptor* field = descriptor->field(i);
- if (field->type() != FieldDescriptor::TYPE_MESSAGE
- && field->type() != FieldDescriptor::TYPE_STRING) {
- continue;
+ if (field->type() != FieldDescriptor::TYPE_MESSAGE &&
+ field->type() != FieldDescriptor::TYPE_STRING &&
+ field->type() != FieldDescriptor::TYPE_BYTES) {
+ continue;
}
const SectionFlags s = getSectionFlags(field);