diff options
47 files changed, 749 insertions, 358 deletions
diff --git a/api/javadoc-lint-baseline b/api/javadoc-lint-baseline index d9e72b83e46e..29a8dfa96a57 100644 --- a/api/javadoc-lint-baseline +++ b/api/javadoc-lint-baseline @@ -1,58 +1,4 @@ -android/adservices/ondevicepersonalization/DownloadCompletedInput.java:22: lint: Unresolved link/see tag "android.adservices.ondevicepersonalization.IsolatedWorker#onDownloadCompleted() IsolatedWorker#onDownloadCompleted()" in android.adservices.ondevicepersonalization.DownloadCompletedInput [101] -android/adservices/ondevicepersonalization/DownloadCompletedOutput.java:21: lint: Unresolved link/see tag "android.adservices.ondevicepersonalization.IsolatedWorker#onDownloadCompleted() IsolatedWorker#onDownloadCompleted()" in android.adservices.ondevicepersonalization.DownloadCompletedOutput [101] -android/adservices/ondevicepersonalization/EventLogRecord.java:13: lint: Unresolved link/see tag "RequestRecordRecord" in android.adservices.ondevicepersonalization.EventLogRecord [101] -android/adservices/ondevicepersonalization/EventUrlProvider.java:43: lint: Unresolved link/see tag "android.adservices.ondevicepersonalization.IsolatedWorker#onEvent IsolatedWorker#onEvent" in android.adservices.ondevicepersonalization.EventUrlProvider [101] -android/adservices/ondevicepersonalization/ExecuteInput.java:22: lint: Unresolved link/see tag "android.adservices.ondevicepersonalization.IsolatedWorker#onExecute() IsolatedWorker#onExecute()" in android.adservices.ondevicepersonalization.ExecuteInput [101] -android/adservices/ondevicepersonalization/ExecuteOutput.java:20: lint: Unresolved link/see tag "android.adservices.ondevicepersonalization.IsolatedWorker#onExecute() IsolatedWorker#onExecute()" in android.adservices.ondevicepersonalization.ExecuteOutput [101] -android/adservices/ondevicepersonalization/ExecuteOutput.java:20: lint: Unresolved link/see tag "android.adservices.ondevicepersonalization.OnDevicePersonalizationManager#execute() OnDevicePersonalizationManager#execute()" in android.adservices.ondevicepersonalization.ExecuteOutput [101] -android/adservices/ondevicepersonalization/ExecuteOutput.java:31: lint: Unresolved link/see tag "android.adservices.ondevicepersonalization.IsolatedWorker#onExecute() IsolatedWorker#onExecute()" in android.adservices.ondevicepersonalization.ExecuteOutput [101] -android/adservices/ondevicepersonalization/ExecuteOutput.java:93: lint: Unresolved link/see tag "android.adservices.ondevicepersonalization.IsolatedWorker#onExecute() IsolatedWorker#onExecute()" in android.adservices.ondevicepersonalization.ExecuteOutput.Builder [101] -android/adservices/ondevicepersonalization/IsolatedService.java:18: lint: Unresolved link/see tag "SurfaceView" in android.adservices.ondevicepersonalization.IsolatedService [101] -android/adservices/ondevicepersonalization/IsolatedService.java:18: lint: Unresolved link/see tag "android.adservices.ondevicepersonalization.OnDevicePersonalizationManager#execute" in android.adservices.ondevicepersonalization.IsolatedService [101] -android/adservices/ondevicepersonalization/IsolatedService.java:119: lint: Unresolved link/see tag "IsolatedCmputationCallback#onWebViewEvent()" in android.adservices.ondevicepersonalization.IsolatedService [101] -android/adservices/ondevicepersonalization/IsolatedService.java:119: lint: Unresolved link/see tag "IsolatedCmputationCallback#onEvent()" in android.adservices.ondevicepersonalization.IsolatedService [101] -android/adservices/ondevicepersonalization/IsolatedService.java:119: lint: Unresolved link/see tag "WebView" in android.adservices.ondevicepersonalization.IsolatedService [101] -android/adservices/ondevicepersonalization/IsolatedWorker.java:9: lint: Unresolved link/see tag "RunTimeException" in android.adservices.ondevicepersonalization.IsolatedWorker [101] -android/adservices/ondevicepersonalization/IsolatedWorker.java:24: lint: Unresolved link/see tag "android.adservices.ondevicepersonalization.OnDevicePersonalizationManager#execute" in android.adservices.ondevicepersonalization.IsolatedWorker [101] -android/adservices/ondevicepersonalization/IsolatedWorker.java:57: lint: Unresolved link/see tag "#onExecute()" in android.adservices.ondevicepersonalization.IsolatedWorker [101] -android/adservices/ondevicepersonalization/IsolatedWorker.java:74: lint: Unresolved link/see tag "#onRender()" in android.adservices.ondevicepersonalization.IsolatedWorker [101] -android/adservices/ondevicepersonalization/OnDevicePersonalizationManager.java:-11: lint: Unresolved link/see tag "requestSurfacePackage" in android.adservices.ondevicepersonalization.OnDevicePersonalizationManager [101] -android/adservices/ondevicepersonalization/OnDevicePersonalizationManager.java:11: lint: Unresolved link/see tag "SurfaceView" in android.adservices.ondevicepersonalization.OnDevicePersonalizationManager [101] -android/adservices/ondevicepersonalization/OnDevicePersonalizationManager.java:11: lint: Unresolved link/see tag "android.adservices.ondevicepersonalization.IsolatedService#onExecute() IsolatedService#onExecute()" in android.adservices.ondevicepersonalization.OnDevicePersonalizationManager [101] -android/adservices/ondevicepersonalization/OnDevicePersonalizationManager.java:19: lint: Unresolved link/see tag "SurfaceView" in android.adservices.ondevicepersonalization.OnDevicePersonalizationManager [101] -android/adservices/ondevicepersonalization/OnDevicePersonalizationManager.java:54: lint: Unresolved link/see tag "SurfaceView" in android.adservices.ondevicepersonalization.OnDevicePersonalizationManager [101] -android/adservices/ondevicepersonalization/OnDevicePersonalizationManager.java:54: lint: Unresolved link/see tag "SurfaceView#getHostToken()" in android.adservices.ondevicepersonalization.OnDevicePersonalizationManager [101] -android/adservices/ondevicepersonalization/OnDevicePersonalizationManager.java:54: lint: Unresolved link/see tag "execute" in android.adservices.ondevicepersonalization.OnDevicePersonalizationManager [101] -android/adservices/ondevicepersonalization/OnDevicePersonalizationManager.java:60: lint: Unresolved link/see tag "#execute()" in android.adservices.ondevicepersonalization.OnDevicePersonalizationManager [101] -android/adservices/ondevicepersonalization/OnDevicePersonalizationManager.java:60: lint: Unresolved link/see tag "SurfacePackage" in android.adservices.ondevicepersonalization.OnDevicePersonalizationManager [101] -android/adservices/ondevicepersonalization/OnDevicePersonalizationManager.java:60: lint: Unresolved link/see tag "SurfaceView" in android.adservices.ondevicepersonalization.OnDevicePersonalizationManager [101] -android/adservices/ondevicepersonalization/OnDevicePersonalizationManager.java:60: lint: Unresolved link/see tag "View" in android.adservices.ondevicepersonalization.OnDevicePersonalizationManager [101] -android/adservices/ondevicepersonalization/OnDevicePersonalizationManager.java:64: lint: Unresolved link/see tag "SurfacePackage" in android.adservices.ondevicepersonalization.OnDevicePersonalizationManager [101] -android/adservices/ondevicepersonalization/OnDevicePersonalizationManager.java:69: lint: Unresolved link/see tag "SurfacePackage" in android.adservices.ondevicepersonalization.OnDevicePersonalizationManager [101] -android/adservices/ondevicepersonalization/OnDevicePersonalizationManager.java:70: lint: Unresolved link/see tag "SurfacePackage" in android.adservices.ondevicepersonalization.OnDevicePersonalizationManager [101] -android/adservices/ondevicepersonalization/RenderInput.java:21: lint: Unresolved link/see tag "android.adservices.ondevicepersonalization.IsolatedWorker#onRender() IsolatedWorker#onRender()" in android.adservices.ondevicepersonalization.RenderInput [101] -android/adservices/ondevicepersonalization/RenderInput.java:53: lint: Unresolved link/see tag "onExecute" in android.adservices.ondevicepersonalization.RenderInput [101] -android/adservices/ondevicepersonalization/RenderOutput.java:20: lint: Unresolved link/see tag "android.adservices.ondevicepersonalization.IsolatedWorker#onExecute() IsolatedWorker#onExecute()" in android.adservices.ondevicepersonalization.RenderOutput [101] -android/adservices/ondevicepersonalization/RenderOutput.java:20: lint: Unresolved link/see tag "android.adservices.ondevicepersonalization.OnDevicePersonalizationManager#requestSurfacePackage() OnDevicePersonalizationManager#requestSurfacePackage()" in android.adservices.ondevicepersonalization.RenderOutput [101] -android/adservices/ondevicepersonalization/RenderOutput.java:31: lint: Unresolved link/see tag "getTemplateId()" in android.adservices.ondevicepersonalization.RenderOutput [101] -android/adservices/ondevicepersonalization/RenderOutput.java:31: lint: Unresolved link/see tag "getTemplateParams" in android.adservices.ondevicepersonalization.RenderOutput [101] -android/adservices/ondevicepersonalization/RenderOutput.java:41: lint: Unresolved link/see tag "getContent()" in android.adservices.ondevicepersonalization.RenderOutput [101] -android/adservices/ondevicepersonalization/RenderOutput.java:52: lint: Unresolved link/see tag "getTemplateId()" in android.adservices.ondevicepersonalization.RenderOutput [101] -android/adservices/ondevicepersonalization/RenderOutput.java:102: lint: Unresolved link/see tag "getTemplateId()" in android.adservices.ondevicepersonalization.RenderOutput.Builder [101] -android/adservices/ondevicepersonalization/RenderOutput.java:102: lint: Unresolved link/see tag "getTemplateParams" in android.adservices.ondevicepersonalization.RenderOutput.Builder [101] -android/adservices/ondevicepersonalization/RenderOutput.java:114: lint: Unresolved link/see tag "getContent()" in android.adservices.ondevicepersonalization.RenderOutput.Builder [101] -android/adservices/ondevicepersonalization/RenderOutput.java:127: lint: Unresolved link/see tag "getTemplateId()" in android.adservices.ondevicepersonalization.RenderOutput.Builder [101] -android/adservices/ondevicepersonalization/RenderingConfig.java:20: lint: Unresolved link/see tag "View" in android.adservices.ondevicepersonalization.RenderingConfig [101] -android/adservices/ondevicepersonalization/RenderingConfig.java:20: lint: Unresolved link/see tag "android.adservices.ondevicepersonalization.IsolatedWorker#onExecute() IsolatedWorker#onExecute()" in android.adservices.ondevicepersonalization.RenderingConfig [101] -android/adservices/ondevicepersonalization/RenderingConfig.java:20: lint: Unresolved link/see tag "android.adservices.ondevicepersonalization.IsolatedWorker#onRender() IsolatedWorker#onRender()" in android.adservices.ondevicepersonalization.RenderingConfig [101] -android/adservices/ondevicepersonalization/RenderingConfig.java:33: lint: Unresolved link/see tag "IsolatedSurface#getRemoteData" in android.adservices.ondevicepersonalization.RenderingConfig [101] -android/adservices/ondevicepersonalization/RenderingConfig.java:85: lint: Unresolved link/see tag "IsolatedSurface#getRemoteData" in android.adservices.ondevicepersonalization.RenderingConfig.Builder [101] -android/adservices/ondevicepersonalization/RequestLogRecord.java:19: lint: Unresolved link/see tag "android.adservices.ondevicepersonalization.IsolatedWorker#onExecute() IsolatedWorker#onExecute()" in android.adservices.ondevicepersonalization.RequestLogRecord [101] -android/adservices/ondevicepersonalization/SurfacePackageToken.java:20: lint: Unresolved link/see tag "SurfaceView" in android.adservices.ondevicepersonalization.SurfacePackageToken [101] -android/adservices/ondevicepersonalization/WebViewEventInput.java:21: lint: Unresolved link/see tag "android.adservices.ondevicepersonalization.IsolatedWorker#onWebViewEvent() IsolatedWorker#onWebViewEvent()" in android.adservices.ondevicepersonalization.WebViewEventInput [101] -android/adservices/ondevicepersonalization/WebViewEventInput.java:30: lint: Unresolved link/see tag "android.adservices.ondevicepersonalization.IsolatedWorker#onExecute() IsolatedWorker#onExecute()" in android.adservices.ondevicepersonalization.WebViewEventInput [101] -android/adservices/ondevicepersonalization/WebViewEventInput.java:41: lint: Unresolved link/see tag "android.adservices.ondevicepersonalization.EventUrlProvider#createEventTrackingUrlWithResponse() EventUrlProvider#createEventTrackingUrlWithResponse()" in android.adservices.ondevicepersonalization.WebViewEventInput [101] -android/adservices/ondevicepersonalization/WebViewEventOutput.java:21: lint: Unresolved link/see tag "android.adservices.ondevicepersonalization.IsolatedWorker#onWebViewEvent() IsolatedWorker#onWebViewEvent()" in android.adservices.ondevicepersonalization.WebViewEventOutput [101] +// b/305195721 android/app/admin/DevicePolicyManager.java:2670: lint: Unresolved link/see tag "android.os.UserManager#DISALLOW_CAMERA UserManager#DISALLOW_CAMERA" in android.app.admin.DevicePolicyManager [101] android/app/admin/DevicePolicyManager.java:7257: lint: Unresolved link/see tag "android.app.admin.DevicePolicyIdentifiers#USB_DATA_SIGNALING_POLICY DevicePolicyIdentifiers#USB_DATA_SIGNALING_POLICY" in android.app.admin.DevicePolicyManager [101] android/app/admin/DevicePolicyManager.java:7425: lint: Unresolved link/see tag "ACTION_DEVICE_FINANCING_STATE_CHANGED" in android.app.admin.DevicePolicyManager [101] @@ -61,6 +7,8 @@ android/app/admin/DevicePolicyManager.java:7428: lint: Unresolved link/see tag " android/app/admin/DevicePolicyManager.java:8860: lint: Unresolved link/see tag "android.app.admin.DevicePolicyResources.Drawables DevicePolicyResources.Drawables" in android.app.admin.DevicePolicyManager [101] android/app/admin/DevicePolicyManager.java:8860: lint: Unresolved link/see tag "android.app.admin.DevicePolicyResources.Strings DevicePolicyResources.Strings" in android.app.admin.DevicePolicyManager [101] android/app/admin/DevicePolicyResourcesManager.java:179: lint: Unresolved link/see tag "android.app.admin.DevicePolicyResources.Strings DevicePolicyResources.Strings" in android.app.admin.DevicePolicyResourcesManager [101] + +// b/303477132 android/app/appsearch/AppSearchSchema.java:402: lint: Unresolved link/see tag "#getIndexableNestedProperties()" in android.app.appsearch.AppSearchSchema.DocumentPropertyConfig.Builder [101] android/app/appsearch/AppSearchSession.java:55: lint: Unresolved link/see tag "Features#LIST_FILTER_QUERY_LANGUAGE" in android.app.appsearch.AppSearchSession [101] android/app/appsearch/AppSearchSession.java:55: lint: Unresolved link/see tag "Features#NUMERIC_SEARCH" in android.app.appsearch.AppSearchSession [101] @@ -73,6 +21,8 @@ android/app/appsearch/SearchSpec.java:244: lint: Unresolved link/see tag "Featur android/app/appsearch/SearchSpec.java:913: lint: Unresolved link/see tag "Features#NUMERIC_SEARCH" in android.app.appsearch.SearchSpec.Builder [101] android/app/appsearch/SearchSpec.java:925: lint: Unresolved link/see tag "Features#VERBATIM_SEARCH" in android.app.appsearch.SearchSpec.Builder [101] android/app/appsearch/SearchSpec.java:929: lint: Unresolved link/see tag "Features#LIST_FILTER_QUERY_LANGUAGE" in android.app.appsearch.SearchSpec.Builder [101] + +// b/303582215 android/hardware/camera2/CameraCharacteristics.java:2169: lint: Unresolved link/see tag "android.hardware.camera2.CameraDevice#stream-use-case-capability-additional-guaranteed-configurations guideline" in android.hardware.camera2.CameraCharacteristics [101] android/hardware/camera2/CameraCharacteristics.java:2344: lint: Unresolved link/see tag "android.hardware.camera2.CameraDevice#concurrent-stream-guaranteed-configurations guideline" in android.hardware.camera2.CameraCharacteristics [101] android/hardware/camera2/CameraCharacteristics.java:2344: lint: Unresolved link/see tag "android.hardware.camera2.CameraDevice#concurrent-stream-guaranteed-configurations tables" in android.hardware.camera2.CameraCharacteristics [101] @@ -98,77 +48,37 @@ android/hardware/camera2/CaptureRequest.java:704: lint: Unresolved link/see tag android/hardware/camera2/CaptureRequest.java:1501: lint: Unresolved link/see tag "SessionConfiguration#setSessionParameters" in android.hardware.camera2.CaptureRequest [101] android/hardware/camera2/CaptureResult.java:923: lint: Unresolved link/see tag "SessionConfiguration#setSessionParameters" in android.hardware.camera2.CaptureResult [101] android/hardware/camera2/CaptureResult.java:2337: lint: Unresolved link/see tag "SessionConfiguration#setSessionParameters" in android.hardware.camera2.CaptureResult [101] -android/media/AudioAttributes.java:443: lint: Unresolved link/see tag "android.media.AudioAttributes.AttributeSdkUsage#USAGE_ALARM AttributeSdkUsage#USAGE_ALARM" in android.media.AudioAttributes.Builder [101] -android/media/AudioAttributes.java:443: lint: Unresolved link/see tag "android.media.AudioAttributes.AttributeSdkUsage#USAGE_ASSISTANCE_ACCESSIBILITY AttributeSdkUsage#USAGE_ASSISTANCE_ACCESSIBILITY" in android.media.AudioAttributes.Builder [101] -android/media/AudioAttributes.java:443: lint: Unresolved link/see tag "android.media.AudioAttributes.AttributeSdkUsage#USAGE_ASSISTANCE_NAVIGATION_GUIDANCE AttributeSdkUsage#USAGE_ASSISTANCE_NAVIGATION_GUIDANCE" in android.media.AudioAttributes.Builder [101] -android/media/AudioAttributes.java:443: lint: Unresolved link/see tag "android.media.AudioAttributes.AttributeSdkUsage#USAGE_ASSISTANCE_SONIFICATION AttributeSdkUsage#USAGE_ASSISTANCE_SONIFICATION" in android.media.AudioAttributes.Builder [101] -android/media/AudioAttributes.java:443: lint: Unresolved link/see tag "android.media.AudioAttributes.AttributeSdkUsage#USAGE_ASSISTANT AttributeSdkUsage#USAGE_ASSISTANT" in android.media.AudioAttributes.Builder [101] -android/media/AudioAttributes.java:443: lint: Unresolved link/see tag "android.media.AudioAttributes.AttributeSdkUsage#USAGE_GAME AttributeSdkUsage#USAGE_GAME" in android.media.AudioAttributes.Builder [101] -android/media/AudioAttributes.java:443: lint: Unresolved link/see tag "android.media.AudioAttributes.AttributeSdkUsage#USAGE_MEDIA AttributeSdkUsage#USAGE_MEDIA" in android.media.AudioAttributes.Builder [101] -android/media/AudioAttributes.java:443: lint: Unresolved link/see tag "android.media.AudioAttributes.AttributeSdkUsage#USAGE_NOTIFICATION_EVENT AttributeSdkUsage#USAGE_NOTIFICATION_EVENT" in android.media.AudioAttributes.Builder [101] -android/media/AudioAttributes.java:443: lint: Unresolved link/see tag "android.media.AudioAttributes.AttributeSdkUsage#USAGE_NOTIFICATION_RINGTONE AttributeSdkUsage#USAGE_NOTIFICATION_RINGTONE" in android.media.AudioAttributes.Builder [101] -android/media/AudioAttributes.java:443: lint: Unresolved link/see tag "android.media.AudioAttributes.AttributeSdkUsage#USAGE_UNKNOWN AttributeSdkUsage#USAGE_UNKNOWN" in android.media.AudioAttributes.Builder [101] -android/media/AudioAttributes.java:443: lint: Unresolved link/see tag "android.media.AudioAttributes.AttributeSdkUsage#USAGE_VOICE_COMMUNICATION AttributeSdkUsage#USAGE_VOICE_COMMUNICATION" in android.media.AudioAttributes.Builder [101] -android/media/AudioAttributes.java:443: lint: Unresolved link/see tag "android.media.AudioAttributes.AttributeSdkUsage#USAGE_VOICE_COMMUNICATION_SIGNALLING AttributeSdkUsage#USAGE_VOICE_COMMUNICATION_SIGNALLING" in android.media.AudioAttributes.Builder [101] -android/media/AudioFormat.java:963: lint: Unresolved link/see tag "android.media.AudioSystem#OUT_CHANNEL_COUNT_MAX AudioSystem#OUT_CHANNEL_COUNT_MAX" in android.media.AudioFormat.Builder [101] -android/media/AudioManager.java:275: lint: Unresolved link/see tag "android.media.audiopolicy.AudioVolumeGroup" in android.media.AudioManager [101] -android/media/AudioManager.java:287: lint: Unresolved link/see tag "android.media.audiopolicy.AudioVolumeGroup" in android.media.AudioManager [101] -android/media/AudioManager.java:311: lint: Unresolved link/see tag "android.media.audiopolicy.AudioVolumeGroup" in android.media.AudioManager [101] -android/media/AudioManager.java:313: lint: Unresolved link/see tag "android.media.audiopolicy.AudioVolumeGroup" in android.media.AudioManager [101] -android/media/AudioMetadata.java:118: lint: Unresolved link/see tag "android.media.AudioPresentation.ContentClassifier One of {@link android.media.AudioPresentation#CONTENT_UNKNOWN AudioPresentation#CONTENT_UNKNOWN}, {@link android.media.AudioPresentation#CONTENT_MAIN AudioPresentation#CONTENT_MAIN}, {@link android.media.AudioPresentation#CONTENT_MUSIC_AND_EFFECTS AudioPresentation#CONTENT_MUSIC_AND_EFFECTS}, {@link android.media.AudioPresentation#CONTENT_VISUALLY_IMPAIRED AudioPresentation#CONTENT_VISUALLY_IMPAIRED}, {@link android.media.AudioPresentation#CONTENT_HEARING_IMPAIRED AudioPresentation#CONTENT_HEARING_IMPAIRED}, {@link android.media.AudioPresentation#CONTENT_DIALOG AudioPresentation#CONTENT_DIALOG}, {@link android.media.AudioPresentation#CONTENT_COMMENTARY AudioPresentation#CONTENT_COMMENTARY}, {@link android.media.AudioPresentation#CONTENT_EMERGENCY AudioPresentation#CONTENT_EMERGENCY}, {@link android.media.AudioPresentation#CONTENT_VOICEOVER AudioPresentation#CONTENT_VOICEOVER}." in android.media.AudioMetadata.Format [101] -android/media/tv/SectionRequest.java:44: lint: Unresolved link/see tag "android.media.tv.BroadcastInfoRequest.RequestOption BroadcastInfoRequest.RequestOption" in android.media.tv.SectionRequest [101] -android/media/tv/SectionResponse.java:39: lint: Unresolved link/see tag "android.media.tv.BroadcastInfoRequest.RequestOption BroadcastInfoRequest.RequestOption" in android.media.tv.SectionResponse [101] -android/media/tv/TableRequest.java:48: lint: Unresolved link/see tag "android.media.tv.BroadcastInfoRequest.RequestOption BroadcastInfoRequest.RequestOption" in android.media.tv.TableRequest [101] -android/media/tv/TableResponse.java:82: lint: Unresolved link/see tag "android.media.tv.BroadcastInfoRequest.RequestOption BroadcastInfoRequest.RequestOption" in android.media.tv.TableResponse [101] -android/net/EthernetNetworkSpecifier.java:21: lint: Unresolved link/see tag "android.net.EthernetManager" in android.net.EthernetNetworkSpecifier [101] -android/net/eap/EapSessionConfig.java:120: lint: Unresolved link/see tag "android.telephony.Annotation.UiccAppType UiccAppType" in android.net.eap.EapSessionConfig.Builder [101] -android/net/eap/EapSessionConfig.java:135: lint: Unresolved link/see tag "android.telephony.Annotation.UiccAppType UiccAppType" in android.net.eap.EapSessionConfig.Builder [101] -android/net/eap/EapSessionConfig.java:148: lint: Unresolved link/see tag "android.telephony.Annotation.UiccAppType UiccAppType" in android.net.eap.EapSessionConfig.Builder [101] -android/net/eap/EapSessionConfig.java:161: lint: Unresolved link/see tag "android.telephony.Annotation.UiccAppType UiccAppType" in android.net.eap.EapSessionConfig.Builder [101] -android/net/eap/EapSessionConfig.java:288: lint: Unresolved link/see tag "android.telephony.Annotation.UiccAppType UiccAppType" in android.net.eap.EapSessionConfig.EapAkaConfig [101] -android/net/eap/EapSessionConfig.java:390: lint: Unresolved link/see tag "android.telephony.Annotation.UiccAppType UiccAppType" in android.net.eap.EapSessionConfig.EapAkaPrimeConfig [101] -android/net/eap/EapSessionConfig.java:587: lint: Unresolved link/see tag "android.telephony.Annotation.UiccAppType UiccAppType" in android.net.eap.EapSessionConfig.EapSimConfig [101] -android/net/wifi/MloLink.java:32: lint: Unresolved link/see tag "android.net.wifi.WifiScanner#WIFI_BAND_24_GHZ WifiScanner#WIFI_BAND_24_GHZ" in android.net.wifi.MloLink [101] -android/net/wifi/MloLink.java:32: lint: Unresolved link/see tag "android.net.wifi.WifiScanner#WIFI_BAND_5_GHZ WifiScanner#WIFI_BAND_5_GHZ" in android.net.wifi.MloLink [101] -android/net/wifi/MloLink.java:32: lint: Unresolved link/see tag "android.net.wifi.WifiScanner#WIFI_BAND_6_GHZ WifiScanner#WIFI_BAND_6_GHZ" in android.net.wifi.MloLink [101] -android/net/wifi/MloLink.java:32: lint: Unresolved link/see tag "android.net.wifi.WifiScanner#WIFI_BAND_UNSPECIFIED WifiScanner#WIFI_BAND_UNSPECIFIED" in android.net.wifi.MloLink [101] -android/net/wifi/SoftApConfiguration.java:9: lint: Unresolved link/see tag "android.net.wifi.SoftApConfiguration.Builder SoftApConfiguration.Builder" in android.net.wifi.SoftApConfiguration [101] -android/net/wifi/SoftApConfiguration.java:66: lint: Unresolved link/see tag "android.net.wifi.SoftApConfiguration.Builder#setSsid(java.lang.String) Builder#setSsid(String)" in android.net.wifi.SoftApConfiguration [101] -android/net/wifi/SoftApConfiguration.java:85: lint: Unresolved link/see tag "android.net.wifi.SoftApConfiguration.Builder#setWifiSsid(android.net.wifi.WifiSsid) Builder#setWifiSsid(WifiSsid)" in android.net.wifi.SoftApConfiguration [101] -android/net/wifi/SoftApConfiguration.java:96: lint: Unresolved link/see tag "android.net.wifi.SoftApConfiguration.Builder#setBssid(android.net.MacAddress) Builder#setBssid(MacAddress)" in android.net.wifi.SoftApConfiguration [101] -android/net/wifi/SoftApConfiguration.java:107: lint: Unresolved link/see tag "android.net.wifi.SoftApConfiguration.Builder#setPassphrase(java.lang.String,int) Builder#setPassphrase(String, int)" in android.net.wifi.SoftApConfiguration [101] -android/net/wifi/SoftApConfiguration.java:118: lint: Unresolved link/see tag "android.net.wifi.SoftApConfiguration.Builder#setHiddenSsid(boolean) Builder#setHiddenSsid(boolean)" in android.net.wifi.SoftApConfiguration [101] -android/net/wifi/WifiManager.java:764: lint: Unresolved link/see tag "android.net.wifi.SoftApConfiguration.Builder#setBands(int[]) SoftApConfiguration.Builder#setBands(int[])" in android.net.wifi.WifiManager [101] -android/net/wifi/WifiManager.java:764: lint: Unresolved link/see tag "android.net.wifi.SoftApConfiguration.Builder#setChannels(android.util.SparseIntArray) SoftApConfiguration.Builder#setChannels(android.util.SparseIntArray)" in android.net.wifi.WifiManager [101] -android/net/wifi/WifiManager.java:779: lint: Unresolved link/see tag "android.net.wifi.SoftApConfiguration.Builder#setBands(int[]) SoftApConfiguration.Builder#setBands(int[])" in android.net.wifi.WifiManager [101] -android/net/wifi/WifiManager.java:779: lint: Unresolved link/see tag "android.net.wifi.SoftApConfiguration.Builder#setChannels(android.util.SparseIntArray) SoftApConfiguration.Builder#setChannels(android.util.SparseIntArray)" in android.net.wifi.WifiManager [101] -android/net/wifi/WifiManager.java:2466: lint: Unresolved link/see tag "TelephonyManager#hasCarrierPrivileges()." in android.net.wifi.WifiManager [101] -android/net/wifi/aware/PublishConfig.java:50: lint: Unresolved link/see tag "android.net.wifi.WifiScanner#WIFI_BAND_24_GHZ WifiScanner#WIFI_BAND_24_GHZ" in android.net.wifi.aware.PublishConfig [101] -android/net/wifi/aware/PublishConfig.java:50: lint: Unresolved link/see tag "android.net.wifi.WifiScanner#WIFI_BAND_5_GHZ WifiScanner#WIFI_BAND_5_GHZ" in android.net.wifi.aware.PublishConfig [101] -android/net/wifi/aware/PublishConfig.java:249: lint: Unresolved link/see tag "android.net.wifi.WifiScanner#WIFI_BAND_24_GHZ WifiScanner#WIFI_BAND_24_GHZ" in android.net.wifi.aware.PublishConfig.Builder [101] -android/net/wifi/aware/PublishConfig.java:249: lint: Unresolved link/see tag "android.net.wifi.WifiScanner#WIFI_BAND_5_GHZ WifiScanner#WIFI_BAND_5_GHZ" in android.net.wifi.aware.PublishConfig.Builder [101] -android/net/wifi/aware/SubscribeConfig.java:51: lint: Unresolved link/see tag "android.net.wifi.WifiScanner#WIFI_BAND_24_GHZ WifiScanner#WIFI_BAND_24_GHZ" in android.net.wifi.aware.SubscribeConfig [101] -android/net/wifi/aware/SubscribeConfig.java:51: lint: Unresolved link/see tag "android.net.wifi.WifiScanner#WIFI_BAND_5_GHZ WifiScanner#WIFI_BAND_5_GHZ" in android.net.wifi.aware.SubscribeConfig [101] -android/net/wifi/aware/SubscribeConfig.java:276: lint: Unresolved link/see tag "android.net.wifi.WifiScanner#WIFI_BAND_24_GHZ WifiScanner#WIFI_BAND_24_GHZ" in android.net.wifi.aware.SubscribeConfig.Builder [101] -android/net/wifi/aware/SubscribeConfig.java:276: lint: Unresolved link/see tag "android.net.wifi.WifiScanner#WIFI_BAND_5_GHZ WifiScanner#WIFI_BAND_5_GHZ" in android.net.wifi.aware.SubscribeConfig.Builder [101] -android/net/wifi/SoftApConfiguration.java:173: lint: Unresolved link/see tag "android.net.wifi.SoftApConfiguration.Builder#setShutdownTimeoutMillis(long)" in android.net.wifi.SoftApConfiguration [101] -android/os/UserManager.java:2384: lint: Unresolved link/see tag "android.annotation.UserHandleAware @UserHandleAware" in android.os.UserManager [101] +// These are javadoc errors for @ChangeId constants, which are problematic to generate documentation +// for. They're not necessarily errors in the docs themselves but are also a limitation in the tool. +// Regardless, the docs currently generated for them is not good, but it is also not used directly +// in production at the moment. +// The main limitation is that all references must be fully qualified in order to resolve properly +// (aside from the normal limitatinos of only being able to @link public APIs). +// See the CompatInfo.java source file in doclava for more information. +android/net/wifi/SoftApConfiguration.java:171: lint: Unresolved link/see tag "android.net.wifi.SoftApConfiguration.Builder#setShutdownTimeoutMillis(long)" in android.net.wifi.SoftApConfiguration [101] android/os/UserManager.java:2384: lint: Unresolved link/see tag "android.annotation.UserHandleAware#enabledSinceTargetSdkVersion" in android.os.UserManager [101] -android/service/voice/AlwaysOnHotwordDetector.java:269: lint: Unresolved link/see tag "#initialize( PersistableBundle, SharedMemory, SoundTrigger.ModuleProperties)" in android.service.voice.AlwaysOnHotwordDetector [101] -android/service/voice/AlwaysOnHotwordDetector.java:269: lint: Unresolved link/see tag "STATE_HARDWARE_UNAVAILABLE" in android.service.voice.AlwaysOnHotwordDetector [101] -android/service/voice/AlwaysOnHotwordDetector.java:278: lint: Unresolved link/see tag "#STATE_ERROR" in android [101] +android/os/UserManager.java:2384: lint: Unresolved link/see tag "android.annotation.UserHandleAware @UserHandleAware" in android.os.UserManager [101] +android/service/voice/AlwaysOnHotwordDetector.java:269: lint: Unresolved link/see tag "#initialize( PersistableBundle, SharedMemory, SoundTrigger.ModuleProperties)" in android [101] +android/service/voice/AlwaysOnHotwordDetector.java:269: lint: Unresolved link/see tag "STATE_HARDWARE_UNAVAILABLE" in android [101] +android/service/voice/AlwaysOnHotwordDetector.java:278: lint: Unresolved link/see tag "android.service.voice.AlwaysOnHotwordDetector.Callback#onFailure" in android [101] +android/service/voice/AlwaysOnHotwordDetector.java:278: lint: Unresolved link/see tag "android.service.voice.AlwaysOnHotwordDetector.Callback#onUnknownFailure" in android [101] +android/service/voice/AlwaysOnHotwordDetector.java:278: lint: Unresolved link/see tag "android.service.voice.AlwaysOnHotwordDetector#STATE_ERROR" in android [101] android/service/voice/AlwaysOnHotwordDetector.java:278: lint: Unresolved link/see tag "Callback#onFailure" in android [101] android/service/voice/AlwaysOnHotwordDetector.java:278: lint: Unresolved link/see tag "Callback#onUnknownFailure" in android [101] -com/android/internal/policy/PhoneWindow.java:172: lint: Unresolved link/see tag "Build.VERSION_CODES#VANILLA_ICE_CREAM" in com.android.internal.policy.PhoneWindow [101] - +android/service/voice/AlwaysOnHotwordDetector.java:278: lint: Unresolved link/see tag "#STATE_ERROR" in android [101] +com/android/internal/policy/PhoneWindow.java:172: lint: Unresolved link/see tag "Build.VERSION_CODES#VANILLA_ICE_CREAM" in android [101] com/android/server/broadcastradio/aidl/ConversionUtils.java:70: lint: Unresolved link/see tag "IdentifierType#DAB_SID_EXT" in android [101] com/android/server/broadcastradio/aidl/ConversionUtils.java:70: lint: Unresolved link/see tag "ProgramSelector#IDENTIFIER_TYPE_DAB_DMB_SID_EXT" in android [101] com/android/server/broadcastradio/aidl/ConversionUtils.java:70: lint: Unresolved link/see tag "RadioTuner" in android [101] +com/android/server/broadcastradio/aidl/ConversionUtils.java:72: lint: Unresolved link/see tag "com.android.server.broadcastradio.aidl.IdentifierType#DAB_SID_EXT" in android [101] +com/android/server/broadcastradio/aidl/ConversionUtils.java:72: lint: Unresolved link/see tag "com.android.server.broadcastradio.aidl.ProgramSelector#IDENTIFIER_TYPE_DAB_DMB_SID_EXT" in android [101] +com/android/server/broadcastradio/aidl/ConversionUtils.java:72: lint: Unresolved link/see tag "com.android.server.broadcastradio.aidl.RadioTuner" in android [101] +com/android/server/devicepolicy/DevicePolicyManagerService.java:861: lint: Unresolved link/see tag "android.security.IKeyChainService#setGrant" in android [101] com/android/server/pm/PackageInstallerSession.java:313: lint: Unresolved link/see tag "Build.VERSION_CODES#S API 31" in android [101] com/android/server/pm/PackageInstallerSession.java:313: lint: Unresolved link/see tag "PackageInstaller.SessionParams#setRequireUserAction" in android [101] -com/android/server/pm/PackageInstallerSession.java:327: lint: Unresolved link/see tag "#requestUserPreapproval(PreapprovalDetails, IntentSender)" in android [101] com/android/server/pm/PackageInstallerSession.java:327: lint: Unresolved link/see tag "Build.VERSION_CODES#UPSIDE_DOWN_CAKE API 34" in android [101] com/android/server/pm/PackageInstallerSession.java:327: lint: Unresolved link/see tag "PackageInstaller.SessionParams#setRequestUpdateOwnership(boolean)" in android [101] -com/android/server/pm/PackageInstallerSession.java:358: lint: Unresolved link/see tag "IntentSender" in android [101] -com/android/server/devicepolicy/DevicePolicyManagerService.java:860: lint: Unresolved link/see tag "android.security.IKeyChainService#setGrant" in android [101] +com/android/server/pm/PackageInstallerSession.java:327: lint: Unresolved link/see tag "#requestUserPreapproval(PreapprovalDetails, IntentSender)" in android [101] +com/android/server/pm/PackageInstallerSession.java:330: lint: Unresolved link/see tag "com.android.android.server.pm#requestUserPreapproval(PreapprovalDetails, IntentSender)" in android [101] +com/android/server/pm/PackageInstallerSession.java:358: lint: Unresolved link/see tag "IntentSender" in android [101]
\ No newline at end of file diff --git a/core/api/test-current.txt b/core/api/test-current.txt index b9052873243e..384b9573528e 100644 --- a/core/api/test-current.txt +++ b/core/api/test-current.txt @@ -3797,14 +3797,14 @@ package android.view.inputmethod { public final class InputMethodManager { method @RequiresPermission(android.Manifest.permission.TEST_INPUT_METHOD) public void addVirtualStylusIdForTestSession(); method public int getDisplayId(); - method @NonNull @RequiresPermission(value=android.Manifest.permission.INTERACT_ACROSS_USERS_FULL, conditional=true) public java.util.List<android.view.inputmethod.InputMethodInfo> getEnabledInputMethodListAsUser(@NonNull android.os.UserHandle); - method @NonNull @RequiresPermission(value=android.Manifest.permission.INTERACT_ACROSS_USERS_FULL, conditional=true) public java.util.List<android.view.inputmethod.InputMethodSubtype> getEnabledInputMethodSubtypeListAsUser(@NonNull String, boolean, @NonNull android.os.UserHandle); + method @FlaggedApi("android.view.inputmethod.imm_userhandle_hostsidetests") @NonNull @RequiresPermission(value=android.Manifest.permission.INTERACT_ACROSS_USERS_FULL, conditional=true) public java.util.List<android.view.inputmethod.InputMethodInfo> getEnabledInputMethodListAsUser(@NonNull android.os.UserHandle); + method @FlaggedApi("android.view.inputmethod.imm_userhandle_hostsidetests") @NonNull @RequiresPermission(value=android.Manifest.permission.INTERACT_ACROSS_USERS_FULL, conditional=true) public java.util.List<android.view.inputmethod.InputMethodSubtype> getEnabledInputMethodSubtypeListAsUser(@NonNull String, boolean, @NonNull android.os.UserHandle); method @NonNull @RequiresPermission(value=android.Manifest.permission.INTERACT_ACROSS_USERS_FULL, conditional=true) public java.util.List<android.view.inputmethod.InputMethodInfo> getInputMethodListAsUser(int); method public boolean hasActiveInputConnection(@Nullable android.view.View); method @RequiresPermission(android.Manifest.permission.TEST_INPUT_METHOD) public boolean hasPendingImeVisibilityRequests(); method @RequiresPermission(android.Manifest.permission.TEST_INPUT_METHOD) public boolean isCurrentRootView(@NonNull android.view.View); method @RequiresPermission(android.Manifest.permission.TEST_INPUT_METHOD) public boolean isInputMethodPickerShown(); - method @NonNull @RequiresPermission(value=android.Manifest.permission.INTERACT_ACROSS_USERS_FULL, conditional=true) public boolean isStylusHandwritingAvailableAsUser(@NonNull android.os.UserHandle); + method @FlaggedApi("android.view.inputmethod.imm_userhandle_hostsidetests") @NonNull @RequiresPermission(value=android.Manifest.permission.INTERACT_ACROSS_USERS_FULL, conditional=true) public boolean isStylusHandwritingAvailableAsUser(@NonNull android.os.UserHandle); method @RequiresPermission(android.Manifest.permission.TEST_INPUT_METHOD) public void setStylusWindowIdleTimeoutForTest(long); field public static final long CLEAR_SHOW_FORCED_FLAG_WHEN_LEAVING = 214016041L; // 0xcc1a029L } diff --git a/core/java/android/app/LocaleConfig.java b/core/java/android/app/LocaleConfig.java index 0857c9655e8d..1fdc51687433 100644 --- a/core/java/android/app/LocaleConfig.java +++ b/core/java/android/app/LocaleConfig.java @@ -20,7 +20,6 @@ import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; import android.content.Context; -import android.content.pm.ApplicationInfo; import android.content.res.Resources; import android.content.res.TypedArray; import android.content.res.XmlResourceParser; @@ -133,15 +132,14 @@ public class LocaleConfig implements Parcelable { return; } } - int resId = 0; Resources res = context.getResources(); + //Get the resource id + int resId = context.getApplicationInfo().getLocaleConfigRes(); + if (resId == 0) { + mStatus = STATUS_NOT_SPECIFIED; + return; + } try { - //Get the resource id - resId = new ApplicationInfo(context.getApplicationInfo()).getLocaleConfigRes(); - if (resId == 0) { - mStatus = STATUS_NOT_SPECIFIED; - return; - } //Get the parser to read XML data XmlResourceParser parser = res.getXml(resId); parseLocaleConfig(parser, res); diff --git a/core/java/android/os/VibrationAttributes.java b/core/java/android/os/VibrationAttributes.java index 98f9dffaae13..5078dc351f6f 100644 --- a/core/java/android/os/VibrationAttributes.java +++ b/core/java/android/os/VibrationAttributes.java @@ -140,6 +140,31 @@ public final class VibrationAttributes implements Parcelable { */ public static final int USAGE_MEDIA = 0x10 | USAGE_CLASS_MEDIA; + /** @hide */ + @IntDef(prefix = { "CATEGORY_" }, value = { + CATEGORY_UNKNOWN, + CATEGORY_KEYBOARD, + }) + @Retention(RetentionPolicy.SOURCE) + public @interface Category {} + + /** + * Category value when the vibration category is unknown. + * + * @hide + */ + public static final int CATEGORY_UNKNOWN = 0x0; + + /** + * Category value for keyboard vibrations. + * + * <p>Most typical keyboard vibrations are haptic feedback for virtual keyboard key + * press/release, for example. + * + * @hide + */ + public static final int CATEGORY_KEYBOARD = 1; + /** * @hide */ @@ -147,7 +172,8 @@ public final class VibrationAttributes implements Parcelable { FLAG_BYPASS_INTERRUPTION_POLICY, FLAG_BYPASS_USER_VIBRATION_INTENSITY_OFF, FLAG_INVALIDATE_SETTINGS_CACHE, - FLAG_PIPELINED_EFFECT + FLAG_PIPELINED_EFFECT, + FLAG_BYPASS_USER_VIBRATION_INTENSITY_SCALE }) @Retention(RetentionPolicy.SOURCE) public @interface Flag{} @@ -167,6 +193,8 @@ public final class VibrationAttributes implements Parcelable { * {@link android.view.HapticFeedbackConstants#FLAG_IGNORE_GLOBAL_SETTING} and * {@link AudioAttributes#FLAG_BYPASS_MUTE}. * + * <p>Only privileged apps can ignore user settings, and this flag will be ignored otherwise. + * * @hide */ public static final int FLAG_BYPASS_USER_VIBRATION_INTENSITY_OFF = 1 << 1; @@ -199,12 +227,31 @@ public final class VibrationAttributes implements Parcelable { public static final int FLAG_PIPELINED_EFFECT = 1 << 3; /** + * Flag requesting that this vibration effect to be played without applying the user + * intensity setting to scale the vibration. + * + * <p>The user setting is still applied to enable/disable the vibration, but the vibration + * effect strength will not be scaled based on the enabled setting value. + * + * <p>This is intended to be used on scenarios where the system needs to enforce a specific + * strength for the vibration effect, regardless of the user preference. Only privileged apps + * can ignore user settings, and this flag will be ignored otherwise. + * + * <p>If you need to bypass the user setting when it's disabling vibrations then this also + * needs the flag {@link #FLAG_BYPASS_USER_VIBRATION_INTENSITY_OFF} to be set. + * + * @hide + */ + public static final int FLAG_BYPASS_USER_VIBRATION_INTENSITY_SCALE = 1 << 4; + + /** * All flags supported by vibrator service, update it when adding new flag. * @hide */ public static final int FLAG_ALL_SUPPORTED = FLAG_BYPASS_INTERRUPTION_POLICY | FLAG_BYPASS_USER_VIBRATION_INTENSITY_OFF - | FLAG_INVALIDATE_SETTINGS_CACHE | FLAG_PIPELINED_EFFECT; + | FLAG_INVALIDATE_SETTINGS_CACHE | FLAG_PIPELINED_EFFECT + | FLAG_BYPASS_USER_VIBRATION_INTENSITY_SCALE; /** Creates a new {@link VibrationAttributes} instance with given usage. */ public static @NonNull VibrationAttributes createForUsage(@Usage int usage) { @@ -214,12 +261,14 @@ public final class VibrationAttributes implements Parcelable { private final int mUsage; private final int mFlags; private final int mOriginalAudioUsage; + private final int mCategory; private VibrationAttributes(@Usage int usage, @AudioAttributes.AttributeUsage int audioUsage, - @Flag int flags) { + @Flag int flags, @Category int category) { mUsage = usage; mOriginalAudioUsage = audioUsage; mFlags = flags & FLAG_ALL_SUPPORTED; + mCategory = category; } /** @@ -248,6 +297,20 @@ public final class VibrationAttributes implements Parcelable { } /** + * Return the vibration category. + * + * <p>Vibration categories describe the source of the vibration, and it can be combined with + * the vibration usage to best match to a user setting, e.g. a vibration with usage touch and + * category keyboard can be used to control keyboard haptic feedback independently. + * + * @hide + */ + @Category + public int getCategory() { + return mCategory; + } + + /** * Check whether a flag is set * @return true if a flag is set and false otherwise */ @@ -298,12 +361,14 @@ public final class VibrationAttributes implements Parcelable { dest.writeInt(mUsage); dest.writeInt(mOriginalAudioUsage); dest.writeInt(mFlags); + dest.writeInt(mCategory); } private VibrationAttributes(Parcel src) { mUsage = src.readInt(); mOriginalAudioUsage = src.readInt(); mFlags = src.readInt(); + mCategory = src.readInt(); } public static final @NonNull Parcelable.Creator<VibrationAttributes> @@ -326,12 +391,12 @@ public final class VibrationAttributes implements Parcelable { } VibrationAttributes rhs = (VibrationAttributes) o; return mUsage == rhs.mUsage && mOriginalAudioUsage == rhs.mOriginalAudioUsage - && mFlags == rhs.mFlags; + && mFlags == rhs.mFlags && mCategory == rhs.mCategory; } @Override public int hashCode() { - return Objects.hash(mUsage, mOriginalAudioUsage, mFlags); + return Objects.hash(mUsage, mOriginalAudioUsage, mFlags, mCategory); } @Override @@ -340,6 +405,7 @@ public final class VibrationAttributes implements Parcelable { + "mUsage=" + usageToString() + ", mAudioUsage= " + AudioAttributes.usageToString(mOriginalAudioUsage) + ", mFlags=" + mFlags + + ", mCategory=" + categoryToString() + '}'; } @@ -376,6 +442,23 @@ public final class VibrationAttributes implements Parcelable { } } + /** @hide */ + public String categoryToString() { + return categoryToString(mCategory); + } + + /** @hide */ + public static String categoryToString(@Category int category) { + switch (category) { + case CATEGORY_UNKNOWN: + return "UNKNOWN"; + case CATEGORY_KEYBOARD: + return "KEYBOARD"; + default: + return "unknown category " + category; + } + } + /** * Builder class for {@link VibrationAttributes} objects. * By default, all information is set to UNKNOWN. @@ -384,6 +467,7 @@ public final class VibrationAttributes implements Parcelable { private int mUsage = USAGE_UNKNOWN; private int mOriginalAudioUsage = AudioAttributes.USAGE_UNKNOWN; private int mFlags = 0x0; + private int mCategory = CATEGORY_UNKNOWN; /** * Constructs a new Builder with the defaults. @@ -399,6 +483,7 @@ public final class VibrationAttributes implements Parcelable { mUsage = vib.mUsage; mOriginalAudioUsage = vib.mOriginalAudioUsage; mFlags = vib.mFlags; + mCategory = vib.mCategory; } } @@ -464,7 +549,8 @@ public final class VibrationAttributes implements Parcelable { * @return a new {@link VibrationAttributes} object */ public @NonNull VibrationAttributes build() { - VibrationAttributes ans = new VibrationAttributes(mUsage, mOriginalAudioUsage, mFlags); + VibrationAttributes ans = new VibrationAttributes( + mUsage, mOriginalAudioUsage, mFlags, mCategory); return ans; } @@ -480,6 +566,19 @@ public final class VibrationAttributes implements Parcelable { } /** + * Sets the attribute describing the category of the corresponding vibration. + * + * @param category The category for the vibration + * @return the same Builder instance. + * + * @hide + */ + public @NonNull Builder setCategory(@Category int category) { + mCategory = category; + return this; + } + + /** * Sets only the flags specified in the bitmask, leaving the other supported flag values * unchanged in the builder. * diff --git a/core/java/android/os/Vibrator.java b/core/java/android/os/Vibrator.java index 99c9925d9cb7..2fc24142acf2 100644 --- a/core/java/android/os/Vibrator.java +++ b/core/java/android/os/Vibrator.java @@ -184,6 +184,16 @@ public abstract class Vibrator { } /** + * Whether the keyboard vibration is enabled by default. + * + * @return {@code true} if the keyboard vibration is default enabled, {@code false} otherwise. + * @hide + */ + public boolean isDefaultKeyboardVibrationEnabled() { + return getConfig().isDefaultKeyboardVibrationEnabled(); + } + + /** * Return the ID of this vibrator. * * @return A non-negative integer representing the id of the vibrator controlled by this diff --git a/core/java/android/os/vibrator/VibrationConfig.java b/core/java/android/os/vibrator/VibrationConfig.java index bde334a6edc5..92e49676cbae 100644 --- a/core/java/android/os/vibrator/VibrationConfig.java +++ b/core/java/android/os/vibrator/VibrationConfig.java @@ -65,6 +65,8 @@ public class VibrationConfig { @VibrationIntensity private final int mDefaultRingVibrationIntensity; + private final boolean mDefaultKeyboardVibrationEnabled; + /** @hide */ public VibrationConfig(@Nullable Resources resources) { mHapticChannelMaxVibrationAmplitude = loadFloat(resources, @@ -76,6 +78,8 @@ public class VibrationConfig { mIgnoreVibrationsOnWirelessCharger = loadBoolean(resources, com.android.internal.R.bool.config_ignoreVibrationsOnWirelessCharger, false); + mDefaultKeyboardVibrationEnabled = loadBoolean(resources, + com.android.internal.R.bool.config_defaultKeyboardVibrationEnabled, true); mDefaultAlarmVibrationIntensity = loadDefaultIntensity(resources, com.android.internal.R.integer.config_defaultAlarmVibrationIntensity); @@ -157,6 +161,14 @@ public class VibrationConfig { return mIgnoreVibrationsOnWirelessCharger; } + /** + * Whether keyboard vibration settings is enabled by default. + * @hide + */ + public boolean isDefaultKeyboardVibrationEnabled() { + return mDefaultKeyboardVibrationEnabled; + } + /** Get the default vibration intensity for given usage. */ @VibrationIntensity public int getDefaultVibrationIntensity(@VibrationAttributes.Usage int usage) { diff --git a/core/java/android/os/vibrator/flags.aconfig b/core/java/android/os/vibrator/flags.aconfig index 66ad12c7559a..69d86a6604ad 100644 --- a/core/java/android/os/vibrator/flags.aconfig +++ b/core/java/android/os/vibrator/flags.aconfig @@ -37,3 +37,10 @@ flag { is_fixed_read_only: true bug: "291128479" } + +flag { + namespace: "haptics" + name: "keyboard_category_enabled" + description: "Enables the independent keyboard vibration settings feature" + bug: "289107579" +} diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index b34e09f2c97a..f0906b1e3c06 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -5129,6 +5129,14 @@ public final class Settings { "hardware_haptic_feedback_intensity"; /** + * Whether keyboard vibration feedback is enabled. The value is boolean (1 or 0). + * + * @hide + */ + @Readable + public static final String KEYBOARD_VIBRATION_ENABLED = "keyboard_vibration_enabled"; + + /** * Ringer volume. This is used internally, changing this value will not * change the volume. See AudioManager. * diff --git a/core/java/android/service/voice/AbstractDetector.java b/core/java/android/service/voice/AbstractDetector.java index 7af7fe6108e6..db97d4f52643 100644 --- a/core/java/android/service/voice/AbstractDetector.java +++ b/core/java/android/service/voice/AbstractDetector.java @@ -199,8 +199,12 @@ abstract class AbstractDetector implements HotwordDetector { } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } + Consumer<AbstractDetector> onDestroyListener; synchronized (mLock) { - mOnDestroyListener.accept(this); + onDestroyListener = mOnDestroyListener; + } + if (onDestroyListener != null) { + onDestroyListener.accept(this); } } diff --git a/core/java/android/view/inputmethod/InputMethodManager.java b/core/java/android/view/inputmethod/InputMethodManager.java index 8159af3ddd4a..eeab005771f5 100644 --- a/core/java/android/view/inputmethod/InputMethodManager.java +++ b/core/java/android/view/inputmethod/InputMethodManager.java @@ -39,6 +39,7 @@ import android.Manifest; import android.annotation.DisplayContext; import android.annotation.DrawableRes; import android.annotation.DurationMillisLong; +import android.annotation.FlaggedApi; import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; @@ -1512,6 +1513,7 @@ public final class InputMethodManager { * Returns {@code true} if currently selected IME supports Stylus handwriting & is enabled. * If the method returns {@code false}, {@link #startStylusHandwriting(View)} shouldn't be * called and Stylus touch should continue as normal touch input. + * * @see #startStylusHandwriting(View) */ public boolean isStylusHandwritingAvailable() { @@ -1535,6 +1537,7 @@ public final class InputMethodManager { @NonNull @RequiresPermission(value = Manifest.permission.INTERACT_ACROSS_USERS_FULL, conditional = true) @TestApi + @FlaggedApi(Flags.FLAG_IMM_USERHANDLE_HOSTSIDETESTS) @SuppressLint("UserHandle") public boolean isStylusHandwritingAvailableAsUser(@NonNull UserHandle user) { final Context fallbackContext = ActivityThread.currentApplication(); @@ -1655,6 +1658,7 @@ public final class InputMethodManager { @NonNull @RequiresPermission(value = Manifest.permission.INTERACT_ACROSS_USERS_FULL, conditional = true) @TestApi + @FlaggedApi(Flags.FLAG_IMM_USERHANDLE_HOSTSIDETESTS) @SuppressLint("UserHandle") public List<InputMethodInfo> getEnabledInputMethodListAsUser(@NonNull UserHandle user) { return IInputMethodManagerGlobalInvoker.getEnabledInputMethodList(user.getIdentifier()); @@ -1690,12 +1694,13 @@ public final class InputMethodManager { * {@link Manifest.permission#INTERACT_ACROSS_USERS_FULL} is required if this is * different from the calling process user ID. * @return {@link List} of {@link InputMethodSubtype}. - * @see #getEnabledInputMethodListAsUser(int) + * @see #getEnabledInputMethodListAsUser(UserHandle) * @hide */ @NonNull @RequiresPermission(value = Manifest.permission.INTERACT_ACROSS_USERS_FULL, conditional = true) @TestApi + @FlaggedApi(Flags.FLAG_IMM_USERHANDLE_HOSTSIDETESTS) @SuppressLint("UserHandle") public List<InputMethodSubtype> getEnabledInputMethodSubtypeListAsUser( @NonNull String imeId, boolean allowsImplicitlyEnabledSubtypes, diff --git a/core/java/android/view/inputmethod/flags.aconfig b/core/java/android/view/inputmethod/flags.aconfig index c14b5104242a..1e8718ce42c0 100644 --- a/core/java/android/view/inputmethod/flags.aconfig +++ b/core/java/android/view/inputmethod/flags.aconfig @@ -14,4 +14,12 @@ flag { description: "Feature flag for adding EditorInfo#mStylusHandwritingEnabled" bug: "293898187" is_fixed_read_only: true +} + +flag { + name: "imm_userhandle_hostsidetests" + namespace: "input_method" + description: "Feature flag for replacing UserIdInt with UserHandle in some helper IMM functions" + bug: "301713309" + is_fixed_read_only: true }
\ No newline at end of file diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index b211ac2fd316..929133f792c0 100644 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -3988,6 +3988,13 @@ limit is unknown. --> <item name="config_hapticChannelMaxVibrationAmplitude" format="float" type="dimen">0</item> + <!-- The fixed keyboard vibration strength in [0,1], or -1 to indicate the strength not fixed + and should depend on the touch feedback intensity user setting --> + <item name="config_keyboardHapticFeedbackFixedAmplitude" format="float" type="dimen">-1</item> + + <!-- The default value for keyboard vibration toggle in settings. --> + <bool name="config_defaultKeyboardVibrationEnabled">true</bool> + <!-- If the device should still vibrate even in low power mode, for certain priority vibrations (e.g. accessibility, alarms). This is mainly for Wear devices that don't have speakers. --> <bool name="config_allowPriorityVibrationsInLowPowerMode">false</bool> diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index 76744ea67589..2b9194f8c54e 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -2053,6 +2053,8 @@ <java-symbol type="integer" name="config_previousVibrationsDumpAggregationTimeMillisLimit" /> <java-symbol type="integer" name="config_defaultVibrationAmplitude" /> <java-symbol type="dimen" name="config_hapticChannelMaxVibrationAmplitude" /> + <java-symbol type="dimen" name="config_keyboardHapticFeedbackFixedAmplitude" /> + <java-symbol type="bool" name="config_defaultKeyboardVibrationEnabled" /> <java-symbol type="integer" name="config_vibrationWaveformRampStepDuration" /> <java-symbol type="bool" name="config_ignoreVibrationsOnWirelessCharger" /> <java-symbol type="integer" name="config_vibrationWaveformRampDownDuration" /> diff --git a/core/res/res/xml/sms_short_codes.xml b/core/res/res/xml/sms_short_codes.xml index af8c69ea1441..3a2e50aa06e8 100644 --- a/core/res/res/xml/sms_short_codes.xml +++ b/core/res/res/xml/sms_short_codes.xml @@ -54,6 +54,9 @@ <!-- Azerbaijan: 4-5 digits, known premium codes listed --> <shortcode country="az" pattern="\\d{4,5}" premium="330[12]|87744|901[234]|93(?:94|101)|9426|9525" /> + <!-- Bangladesh: 1-5 digits (standard system default, not country specific) --> + <shortcode country="bd" pattern="\\d{1,5}" free="16672" /> + <!-- Belgium: 4 digits, plus EU: http://www.mobileweb.be/en/mobileweb/sms-numberplan.asp --> <shortcode country="be" premium="\\d{4}" free="8\\d{3}|116\\d{3}" /> @@ -145,7 +148,7 @@ <shortcode country="in" pattern="\\d{1,5}" free="59336|53969" /> <!-- Indonesia: 1-5 digits (standard system default, not country specific) --> - <shortcode country="id" pattern="\\d{1,5}" free="99477|6006|46645|363" /> + <shortcode country="id" pattern="\\d{1,5}" free="99477|6006|46645|363|93457" /> <!-- Ireland: 5 digits, 5xxxx (50xxx=free, 5[12]xxx=standard), plus EU: http://www.comreg.ie/_fileupload/publications/ComReg1117.pdf --> @@ -190,7 +193,7 @@ <shortcode country="mk" pattern="\\d{1,6}" free="129005|122" /> <!-- Mexico: 4-5 digits (not confirmed), known premium codes listed --> - <shortcode country="mx" pattern="\\d{4,5}" premium="53035|7766" free="26259|46645|50025|50052|5050|76551|88778|9963|91101" /> + <shortcode country="mx" pattern="\\d{4,5}" premium="53035|7766" free="26259|46645|50025|50052|5050|76551|88778|9963|91101|45453" /> <!-- Malaysia: 5 digits: http://www.skmm.gov.my/attachment/Consumer_Regulation/Mobile_Content_Services_FAQs.pdf --> <shortcode country="my" pattern="\\d{5}" premium="32298|33776" free="22099|28288|66668" /> @@ -205,7 +208,7 @@ <shortcode country="no" pattern="\\d{4,5}" premium="2201|222[67]" free="2171" /> <!-- New Zealand: 3-4 digits, known premium codes listed --> - <shortcode country="nz" pattern="\\d{3,4}" premium="3903|8995|4679" free="1737|176|2141|3067|3068|3110|4006|4053|4061|4062|4202|4300|4334|4412|4575|5626|8006|8681" /> + <shortcode country="nz" pattern="\\d{3,4}" premium="3903|8995|4679" free="1737|176|2141|3067|3068|3110|3876|4006|4053|4061|4062|4202|4300|4334|4412|4575|5626|8006|8681" /> <!-- Peru: 4-5 digits (not confirmed), known premium codes listed --> <shortcode country="pe" pattern="\\d{4,5}" free="9963|40778" /> diff --git a/graphics/java/android/graphics/text/LineBreakConfig.java b/graphics/java/android/graphics/text/LineBreakConfig.java index f5e5803d4796..dc1773bd7290 100644 --- a/graphics/java/android/graphics/text/LineBreakConfig.java +++ b/graphics/java/android/graphics/text/LineBreakConfig.java @@ -39,12 +39,14 @@ public final class LineBreakConfig { /** * No hyphenation preference is specified. * + * <p> * This is a special value of hyphenation preference indicating no hyphenation preference is * specified. When overriding a {@link LineBreakConfig} with another {@link LineBreakConfig} * with {@link Builder#merge(LineBreakConfig)} function, the hyphenation preference of * overridden config will be kept if the hyphenation preference of overriding config is * {@link #HYPHENATION_UNSPECIFIED}. * + * <p> * <pre> * val override = LineBreakConfig.Builder() * .setLineBreakWordStyle(LineBreakConfig.LINE_BREAK_WORD_STYLE_PHRASE) @@ -57,6 +59,7 @@ public final class LineBreakConfig { * // LINE_BREAK_WORD_STYLE_PHRASE for line break word style. * </pre> * + * <p> * This value is resolved to {@link #HYPHENATION_ENABLED} if this value is used for text * layout/rendering. */ @@ -89,6 +92,7 @@ public final class LineBreakConfig { /** * No line break style is specified. * + * <p> * This is a special value of line break style indicating no style value is specified. * When overriding a {@link LineBreakConfig} with another {@link LineBreakConfig} with * {@link Builder#merge(LineBreakConfig)} function, the line break style of overridden config @@ -107,6 +111,7 @@ public final class LineBreakConfig { * // LINE_BREAK_WORD_STYLE_PHRASE for line break word style. * </pre> * + * <p> * This value is resolved to {@link #LINE_BREAK_STYLE_NONE} if this value is used for text * layout/rendering. */ @@ -270,6 +275,8 @@ public final class LineBreakConfig { /** * Resets this builder to the given config state. * + * @param config a config value used for resetting. {@code null} is allowed. If {@code null} + * is passed, all configs are reset to unspecified. * @return This {@code Builder}. * @hide */ diff --git a/libs/WindowManager/Shell/res/values-television/config.xml b/libs/WindowManager/Shell/res/values-television/config.xml index da8abde8407f..8d2e28b9492f 100644 --- a/libs/WindowManager/Shell/res/values-television/config.xml +++ b/libs/WindowManager/Shell/res/values-television/config.xml @@ -45,13 +45,13 @@ <integer name="config_pipForceCloseDelay">5000</integer> <!-- Animation duration when exit starting window: fade out icon --> - <integer name="starting_window_app_reveal_icon_fade_out_duration">500</integer> + <integer name="starting_window_app_reveal_icon_fade_out_duration">200</integer> <!-- Animation delay when exit starting window: reveal app --> - <integer name="starting_window_app_reveal_anim_delay">0</integer> + <integer name="starting_window_app_reveal_anim_delay">200</integer> <!-- Animation duration when exit starting window: reveal app --> - <integer name="starting_window_app_reveal_anim_duration">500</integer> + <integer name="starting_window_app_reveal_anim_duration">300</integer> <!-- Default animation type when hiding the starting window. The possible values are: - 0 for radial vanish + slide up diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleStackView.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleStackView.java index 2241c343a208..ac5ba51ec139 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleStackView.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleStackView.java @@ -1784,13 +1784,14 @@ public class BubbleStackView extends FrameLayout mStackOnLeftOrWillBe = mPositioner.isStackOnLeft(startPosition); mStackAnimationController.setStackPosition(startPosition); mExpandedAnimationController.setCollapsePoint(startPosition); - // Set the translation x so that this bubble will animate in from the same side they - // expand / collapse on. - bubble.getIconView().setTranslationX(startPosition.x); } else if (firstBubble) { mStackOnLeftOrWillBe = mStackAnimationController.isStackOnLeftSide(); } + // Set the view translation x so that this bubble will animate in from the same side they + // expand / collapse on. + bubble.getIconView().setTranslationX(mStackAnimationController.getStackPosition().x); + mBubbleContainer.addView(bubble.getIconView(), 0, new FrameLayout.LayoutParams(mPositioner.getBubbleSize(), mPositioner.getBubbleSize())); diff --git a/media/java/android/media/IMediaRouterService.aidl b/media/java/android/media/IMediaRouterService.aidl index 7eb0c76fbf4e..4a5b4f2de20f 100644 --- a/media/java/android/media/IMediaRouterService.aidl +++ b/media/java/android/media/IMediaRouterService.aidl @@ -74,8 +74,7 @@ interface IMediaRouterService { // Methods for MediaRouter2Manager List<RoutingSessionInfo> getRemoteSessions(IMediaRouter2Manager manager); - RoutingSessionInfo getSystemSessionInfoForPackage( - IMediaRouter2Manager manager, String packageName); + RoutingSessionInfo getSystemSessionInfoForPackage(String packageName); void registerManager(IMediaRouter2Manager manager, String packageName); void unregisterManager(IMediaRouter2Manager manager); void setRouteVolumeWithManager(IMediaRouter2Manager manager, int requestId, diff --git a/media/java/android/media/MediaRouter2.java b/media/java/android/media/MediaRouter2.java index 21690904fe42..159427bc2796 100644 --- a/media/java/android/media/MediaRouter2.java +++ b/media/java/android/media/MediaRouter2.java @@ -2059,9 +2059,7 @@ public final class MediaRouter2 { public RoutingSessionInfo getSystemSessionInfo() { RoutingSessionInfo result; try { - result = - mMediaRouterService.getSystemSessionInfoForPackage( - mClient, mClientPackageName); + result = mMediaRouterService.getSystemSessionInfoForPackage(mClientPackageName); } catch (RemoteException ex) { throw ex.rethrowFromSystemServer(); } diff --git a/media/java/android/media/MediaRouter2Manager.java b/media/java/android/media/MediaRouter2Manager.java index 3abfc6297b0b..830708cb38b2 100644 --- a/media/java/android/media/MediaRouter2Manager.java +++ b/media/java/android/media/MediaRouter2Manager.java @@ -377,7 +377,7 @@ public final class MediaRouter2Manager { @Nullable public RoutingSessionInfo getSystemRoutingSession(@Nullable String packageName) { try { - return mMediaRouterService.getSystemSessionInfoForPackage(mClient, packageName); + return mMediaRouterService.getSystemSessionInfoForPackage(packageName); } catch (RemoteException ex) { throw ex.rethrowFromSystemServer(); } diff --git a/packages/SettingsProvider/src/android/provider/settings/backup/SystemSettings.java b/packages/SettingsProvider/src/android/provider/settings/backup/SystemSettings.java index fe39c4febc80..59c3cd38a97d 100644 --- a/packages/SettingsProvider/src/android/provider/settings/backup/SystemSettings.java +++ b/packages/SettingsProvider/src/android/provider/settings/backup/SystemSettings.java @@ -84,6 +84,7 @@ public class SystemSettings { Settings.System.RING_VIBRATION_INTENSITY, Settings.System.HAPTIC_FEEDBACK_INTENSITY, Settings.System.HARDWARE_HAPTIC_FEEDBACK_INTENSITY, + Settings.System.KEYBOARD_VIBRATION_ENABLED, Settings.System.HAPTIC_FEEDBACK_ENABLED, Settings.System.DISPLAY_COLOR_MODE_VENDOR_HINT, // must precede DISPLAY_COLOR_MODE Settings.System.DISPLAY_COLOR_MODE, diff --git a/packages/SettingsProvider/src/android/provider/settings/validators/SystemSettingsValidators.java b/packages/SettingsProvider/src/android/provider/settings/validators/SystemSettingsValidators.java index eba74ab14f3d..572303a813bf 100644 --- a/packages/SettingsProvider/src/android/provider/settings/validators/SystemSettingsValidators.java +++ b/packages/SettingsProvider/src/android/provider/settings/validators/SystemSettingsValidators.java @@ -138,6 +138,7 @@ public class SystemSettingsValidators { VALIDATORS.put(System.RING_VIBRATION_INTENSITY, VIBRATION_INTENSITY_VALIDATOR); VALIDATORS.put(System.HAPTIC_FEEDBACK_INTENSITY, VIBRATION_INTENSITY_VALIDATOR); VALIDATORS.put(System.HARDWARE_HAPTIC_FEEDBACK_INTENSITY, VIBRATION_INTENSITY_VALIDATOR); + VALIDATORS.put(System.KEYBOARD_VIBRATION_ENABLED, BOOLEAN_VALIDATOR); VALIDATORS.put(System.HAPTIC_FEEDBACK_ENABLED, BOOLEAN_VALIDATOR); VALIDATORS.put(System.RINGTONE, URI_VALIDATOR); VALIDATORS.put(System.NOTIFICATION_SOUND, URI_VALIDATOR); diff --git a/packages/SystemUI/src/com/android/keyguard/LockIconView.java b/packages/SystemUI/src/com/android/keyguard/LockIconView.java index 40d0be1173fa..ff6a3d0cc6f0 100644 --- a/packages/SystemUI/src/com/android/keyguard/LockIconView.java +++ b/packages/SystemUI/src/com/android/keyguard/LockIconView.java @@ -25,7 +25,6 @@ import android.graphics.Color; import android.graphics.Point; import android.graphics.Rect; import android.graphics.RectF; -import android.graphics.drawable.Drawable; import android.util.AttributeSet; import android.view.Gravity; import android.view.View; @@ -105,18 +104,6 @@ public class LockIconView extends FrameLayout implements Dumpable { mLockIcon.setImageTintList(ColorStateList.valueOf(mLockIconColor)); } - void setImageDrawable(Drawable drawable) { - mLockIcon.setImageDrawable(drawable); - - if (!mUseBackground) return; - - if (drawable == null) { - mBgView.setVisibility(View.INVISIBLE); - } else { - mBgView.setVisibility(View.VISIBLE); - } - } - /** * Whether or not to render the lock icon background. Mainly used for UDPFS. */ @@ -197,6 +184,7 @@ public class LockIconView extends FrameLayout implements Dumpable { mLockIcon = new ImageView(context, attrs); mLockIcon.setId(R.id.lock_icon); mLockIcon.setScaleType(ImageView.ScaleType.CENTER_CROP); + mLockIcon.setImageDrawable(context.getDrawable(R.drawable.super_lock_icon)); addView(mLockIcon); LayoutParams lp = (LayoutParams) mLockIcon.getLayoutParams(); lp.height = MATCH_PARENT; diff --git a/packages/SystemUI/src/com/android/keyguard/LockIconViewController.java b/packages/SystemUI/src/com/android/keyguard/LockIconViewController.java index 83da80f4123a..611283f12984 100644 --- a/packages/SystemUI/src/com/android/keyguard/LockIconViewController.java +++ b/packages/SystemUI/src/com/android/keyguard/LockIconViewController.java @@ -35,7 +35,6 @@ import android.content.res.Configuration; import android.content.res.Resources; import android.graphics.Point; import android.graphics.Rect; -import android.graphics.drawable.AnimatedStateListDrawable; import android.hardware.biometrics.BiometricAuthenticator; import android.hardware.biometrics.BiometricSourceType; import android.os.Process; @@ -120,9 +119,6 @@ public class LockIconViewController implements Dumpable { private boolean mUdfpsEnrolled; private Resources mResources; private Context mContext; - - @NonNull private final AnimatedStateListDrawable mIcon; - @NonNull private CharSequence mUnlockedLabel; @NonNull private CharSequence mLockedLabel; @NonNull private final VibratorHelper mVibrator; @@ -147,7 +143,6 @@ public class LockIconViewController implements Dumpable { private boolean mCanDismissLockScreen; private int mStatusBarState; private boolean mIsKeyguardShowing; - private Runnable mOnGestureDetectedRunnable; private Runnable mLongPressCancelRunnable; private boolean mUdfpsSupported; @@ -232,9 +227,6 @@ public class LockIconViewController implements Dumpable { mMaxBurnInOffsetX = resources.getDimensionPixelSize(R.dimen.udfps_burn_in_offset_x); mMaxBurnInOffsetY = resources.getDimensionPixelSize(R.dimen.udfps_burn_in_offset_y); - - mIcon = (AnimatedStateListDrawable) - resources.getDrawable(R.drawable.super_lock_icon, context.getTheme()); mUnlockedLabel = resources.getString(R.string.accessibility_unlock_button); mLockedLabel = resources.getString(R.string.accessibility_lock_icon); mLongPressTimeout = resources.getInteger(R.integer.config_lockIconLongPress); @@ -270,7 +262,6 @@ public class LockIconViewController implements Dumpable { @SuppressLint("ClickableViewAccessibility") public void setLockIconView(LockIconView lockIconView) { mView = lockIconView; - mView.setImageDrawable(mIcon); mView.setAccessibilityDelegate(mAccessibilityDelegate); if (mFeatureFlags.isEnabled(DOZING_MIGRATION_1)) { @@ -492,10 +483,6 @@ public class LockIconViewController implements Dumpable { pw.println("mUdfpsSupported: " + mUdfpsSupported); pw.println("mUdfpsEnrolled: " + mUdfpsEnrolled); pw.println("mIsKeyguardShowing: " + mIsKeyguardShowing); - pw.println(" mIcon: "); - for (int state : mIcon.getState()) { - pw.print(" " + state); - } pw.println(); pw.println(" mShowUnlockIcon: " + mShowUnlockIcon); pw.println(" mShowLockIcon: " + mShowLockIcon); diff --git a/packages/SystemUI/src/com/android/systemui/flags/Flags.kt b/packages/SystemUI/src/com/android/systemui/flags/Flags.kt index 472cc24080d5..58998c82dabc 100644 --- a/packages/SystemUI/src/com/android/systemui/flags/Flags.kt +++ b/packages/SystemUI/src/com/android/systemui/flags/Flags.kt @@ -796,8 +796,7 @@ object Flags { /** TODO(b/296223317): Enables the new keyguard presentation containing a clock. */ @JvmField - val ENABLE_CLOCK_KEYGUARD_PRESENTATION = - unreleasedFlag("enable_clock_keyguard_presentation", teamfood = true) + val ENABLE_CLOCK_KEYGUARD_PRESENTATION = releasedFlag("enable_clock_keyguard_presentation") /** Enable the Compose implementation of the PeopleSpaceActivity. */ @JvmField diff --git a/services/accessibility/java/com/android/server/accessibility/AccessibilityInputFilter.java b/services/accessibility/java/com/android/server/accessibility/AccessibilityInputFilter.java index cd83f8f4d9d8..5af80da894cc 100644 --- a/services/accessibility/java/com/android/server/accessibility/AccessibilityInputFilter.java +++ b/services/accessibility/java/com/android/server/accessibility/AccessibilityInputFilter.java @@ -68,7 +68,7 @@ class AccessibilityInputFilter extends InputFilter implements EventStreamTransfo * * @see #setUserAndEnabledFeatures(int, int) */ - static final int FLAG_FEATURE_SCREEN_MAGNIFIER = 0x00000001; + static final int FLAG_FEATURE_MAGNIFICATION_SINGLE_FINGER_TRIPLE_TAP = 0x00000001; /** * Flag for enabling the touch exploration feature. @@ -100,7 +100,7 @@ class AccessibilityInputFilter extends InputFilter implements EventStreamTransfo /** * Flag for enabling the feature to control the screen magnifier. If - * {@link #FLAG_FEATURE_SCREEN_MAGNIFIER} is set this flag is ignored + * {@link #FLAG_FEATURE_MAGNIFICATION_SINGLE_FINGER_TRIPLE_TAP} is set this flag is ignored * as the screen magnifier feature performs a super set of the work * performed by this feature. * @@ -149,7 +149,7 @@ class AccessibilityInputFilter extends InputFilter implements EventStreamTransfo FLAG_FEATURE_INJECT_MOTION_EVENTS | FLAG_FEATURE_AUTOCLICK | FLAG_FEATURE_TOUCH_EXPLORATION - | FLAG_FEATURE_SCREEN_MAGNIFIER + | FLAG_FEATURE_MAGNIFICATION_SINGLE_FINGER_TRIPLE_TAP | FLAG_FEATURE_TRIGGERED_SCREEN_MAGNIFIER | FLAG_SERVICE_HANDLES_DOUBLE_TAP | FLAG_REQUEST_MULTI_FINGER_GESTURES @@ -530,7 +530,7 @@ class AccessibilityInputFilter extends InputFilter implements EventStreamTransfo } if ((mEnabledFeatures & FLAG_FEATURE_CONTROL_SCREEN_MAGNIFIER) != 0 - || ((mEnabledFeatures & FLAG_FEATURE_SCREEN_MAGNIFIER) != 0) + || ((mEnabledFeatures & FLAG_FEATURE_MAGNIFICATION_SINGLE_FINGER_TRIPLE_TAP) != 0) || ((mEnabledFeatures & FLAG_FEATURE_TRIGGERED_SCREEN_MAGNIFIER) != 0)) { final MagnificationGestureHandler magnificationGestureHandler = createMagnificationGestureHandler(displayId, @@ -648,7 +648,7 @@ class AccessibilityInputFilter extends InputFilter implements EventStreamTransfo private MagnificationGestureHandler createMagnificationGestureHandler( int displayId, Context displayContext) { final boolean detectControlGestures = (mEnabledFeatures - & FLAG_FEATURE_SCREEN_MAGNIFIER) != 0; + & FLAG_FEATURE_MAGNIFICATION_SINGLE_FINGER_TRIPLE_TAP) != 0; final boolean triggerable = (mEnabledFeatures & FLAG_FEATURE_TRIGGERED_SCREEN_MAGNIFIER) != 0; MagnificationGestureHandler magnificationGestureHandler; diff --git a/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java b/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java index 8c1d444006bd..d28d291537aa 100644 --- a/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java +++ b/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java @@ -2693,8 +2693,9 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub AccessibilityInputFilter inputFilter = null; synchronized (mLock) { int flags = 0; - if (userState.isDisplayMagnificationEnabledLocked()) { - flags |= AccessibilityInputFilter.FLAG_FEATURE_SCREEN_MAGNIFIER; + if (userState.isMagnificationSingleFingerTripleTapEnabledLocked()) { + flags |= AccessibilityInputFilter + .FLAG_FEATURE_MAGNIFICATION_SINGLE_FINGER_TRIPLE_TAP; } if (userState.isShortcutMagnificationEnabledLocked()) { flags |= AccessibilityInputFilter.FLAG_FEATURE_TRIGGERED_SCREEN_MAGNIFIER; @@ -3047,12 +3048,14 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub } private boolean readMagnificationEnabledSettingsLocked(AccessibilityUserState userState) { - final boolean displayMagnificationEnabled = Settings.Secure.getIntForUser( + final boolean magnificationSingleFingerTripleTapEnabled = Settings.Secure.getIntForUser( mContext.getContentResolver(), Settings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED, 0, userState.mUserId) == 1; - if ((displayMagnificationEnabled != userState.isDisplayMagnificationEnabledLocked())) { - userState.setDisplayMagnificationEnabledLocked(displayMagnificationEnabled); + if ((magnificationSingleFingerTripleTapEnabled + != userState.isMagnificationSingleFingerTripleTapEnabledLocked())) { + userState.setMagnificationSingleFingerTripleTapEnabledLocked( + magnificationSingleFingerTripleTapEnabled); return true; } return false; @@ -3292,7 +3295,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub // We would skip overlay display because it uses overlay window to simulate secondary // displays in one display. It's not a real display and there's no input events for it. final ArrayList<Display> displays = getValidDisplayList(); - if (userState.isDisplayMagnificationEnabledLocked() + if (userState.isMagnificationSingleFingerTripleTapEnabledLocked() || userState.isShortcutMagnificationEnabledLocked()) { for (int i = 0; i < displays.size(); i++) { final Display display = displays.get(i); @@ -3321,7 +3324,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub return; } final boolean connect = (userState.isShortcutMagnificationEnabledLocked() - || userState.isDisplayMagnificationEnabledLocked()) + || userState.isMagnificationSingleFingerTripleTapEnabledLocked()) && (userState.getMagnificationCapabilitiesLocked() != Settings.Secure.ACCESSIBILITY_MAGNIFICATION_MODE_FULLSCREEN) || userHasMagnificationServicesLocked(userState); @@ -5006,7 +5009,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub updateWindowMagnificationConnectionIfNeeded(userState); // Remove magnification button UI when the magnification capability is not all mode or // magnification is disabled. - if (!(userState.isDisplayMagnificationEnabledLocked() + if (!(userState.isMagnificationSingleFingerTripleTapEnabledLocked() || userState.isShortcutMagnificationEnabledLocked()) || userState.getMagnificationCapabilitiesLocked() != Settings.Secure.ACCESSIBILITY_MAGNIFICATION_MODE_ALL) { diff --git a/services/accessibility/java/com/android/server/accessibility/AccessibilityUserState.java b/services/accessibility/java/com/android/server/accessibility/AccessibilityUserState.java index 693526adc8d6..b4efec1a4b38 100644 --- a/services/accessibility/java/com/android/server/accessibility/AccessibilityUserState.java +++ b/services/accessibility/java/com/android/server/accessibility/AccessibilityUserState.java @@ -109,7 +109,7 @@ class AccessibilityUserState { private boolean mBindInstantServiceAllowed; private boolean mIsAudioDescriptionByDefaultRequested; private boolean mIsAutoclickEnabled; - private boolean mIsDisplayMagnificationEnabled; + private boolean mIsMagnificationSingleFingerTripleTapEnabled; private boolean mIsFilterKeyEventsEnabled; private boolean mIsPerformGesturesEnabled; private boolean mAccessibilityFocusOnlyInActiveWindow; @@ -211,7 +211,7 @@ class AccessibilityUserState { mRequestMultiFingerGestures = false; mRequestTwoFingerPassthrough = false; mSendMotionEventsEnabled = false; - mIsDisplayMagnificationEnabled = false; + mIsMagnificationSingleFingerTripleTapEnabled = false; mIsAutoclickEnabled = false; mUserNonInteractiveUiTimeout = 0; mUserInteractiveUiTimeout = 0; @@ -520,7 +520,7 @@ class AccessibilityUserState { .append(String.valueOf(mRequestTwoFingerPassthrough)); pw.append(", sendMotionEventsEnabled").append(String.valueOf(mSendMotionEventsEnabled)); pw.append(", displayMagnificationEnabled=").append(String.valueOf( - mIsDisplayMagnificationEnabled)); + mIsMagnificationSingleFingerTripleTapEnabled)); pw.append(", autoclickEnabled=").append(String.valueOf(mIsAutoclickEnabled)); pw.append(", nonInteractiveUiTimeout=").append(String.valueOf(mNonInteractiveUiTimeout)); pw.append(", interactiveUiTimeout=").append(String.valueOf(mInteractiveUiTimeout)); @@ -625,12 +625,12 @@ class AccessibilityUserState { mIsAutoclickEnabled = enabled; } - public boolean isDisplayMagnificationEnabledLocked() { - return mIsDisplayMagnificationEnabled; + public boolean isMagnificationSingleFingerTripleTapEnabledLocked() { + return mIsMagnificationSingleFingerTripleTapEnabled; } - public void setDisplayMagnificationEnabledLocked(boolean enabled) { - mIsDisplayMagnificationEnabled = enabled; + public void setMagnificationSingleFingerTripleTapEnabledLocked(boolean enabled) { + mIsMagnificationSingleFingerTripleTapEnabled = enabled; } public boolean isFilterKeyEventsEnabledLocked() { diff --git a/services/core/java/com/android/server/audio/AudioDeviceBroker.java b/services/core/java/com/android/server/audio/AudioDeviceBroker.java index 9cfac9af3991..eea3d3885b34 100644 --- a/services/core/java/com/android/server/audio/AudioDeviceBroker.java +++ b/services/core/java/com/android/server/audio/AudioDeviceBroker.java @@ -68,6 +68,7 @@ import java.util.HashSet; import java.util.LinkedList; import java.util.List; import java.util.NoSuchElementException; +import java.util.Objects; import java.util.Set; import java.util.UUID; import java.util.concurrent.atomic.AtomicBoolean; @@ -496,8 +497,9 @@ public class AudioDeviceBroker { AudioDeviceInfo.TYPE_AUX_LINE }; - /*package */ static boolean isValidCommunicationDevice(AudioDeviceInfo device) { - return isValidCommunicationDeviceType(device.getType()); + /*package */ static boolean isValidCommunicationDevice(@NonNull AudioDeviceInfo device) { + Objects.requireNonNull(device, "device must not be null"); + return device.isSink() && isValidCommunicationDeviceType(device.getType()); } private static boolean isValidCommunicationDeviceType(int deviceType) { diff --git a/services/core/java/com/android/server/media/MediaRouterService.java b/services/core/java/com/android/server/media/MediaRouterService.java index cc261a4b9797..44719f88351b 100644 --- a/services/core/java/com/android/server/media/MediaRouterService.java +++ b/services/core/java/com/android/server/media/MediaRouterService.java @@ -515,8 +515,7 @@ public final class MediaRouterService extends IMediaRouterService.Stub // Binder call @Override - public RoutingSessionInfo getSystemSessionInfoForPackage(IMediaRouter2Manager manager, - String packageName) { + public RoutingSessionInfo getSystemSessionInfoForPackage(@Nullable String packageName) { final int uid = Binder.getCallingUid(); final int userId = UserHandle.getUserHandleForUid(uid).getIdentifier(); boolean setDeviceRouteSelected = false; diff --git a/services/core/java/com/android/server/power/PowerManagerService.java b/services/core/java/com/android/server/power/PowerManagerService.java index dfbcbae650cd..4a4214f7af83 100644 --- a/services/core/java/com/android/server/power/PowerManagerService.java +++ b/services/core/java/com/android/server/power/PowerManagerService.java @@ -3347,8 +3347,6 @@ public final class PowerManagerService extends SystemService } else { startDreaming = false; } - Slog.i(TAG, "handleSandman powerGroup=" + groupId + " startDreaming=" + startDreaming - + " wakefulness=" + wakefulnessToString(wakefulness)); } // Start dreaming if needed. @@ -3383,23 +3381,19 @@ public final class PowerManagerService extends SystemService if (startDreaming && isDreaming) { mDreamsBatteryLevelDrain = 0; if (wakefulness == WAKEFULNESS_DOZING) { - Slog.i(TAG, "Dozing powerGroup " + groupId); + Slog.i(TAG, "Dozing..."); } else { - Slog.i(TAG, "Dreaming powerGroup " + groupId); + Slog.i(TAG, "Dreaming..."); } } // If preconditions changed, wait for the next iteration to determine // whether the dream should continue (or be restarted). final PowerGroup powerGroup = mPowerGroups.get(groupId); - final int newWakefulness = powerGroup.getWakefulnessLocked(); if (powerGroup.isSandmanSummonedLocked() - || newWakefulness != wakefulness) { + || powerGroup.getWakefulnessLocked() != wakefulness) { return; // wait for next cycle } - Slog.i(TAG, "handleSandman powerGroup=" + groupId + " isDreaming=" + isDreaming - + " wakefulness=" + newWakefulness); - // Determine whether the dream should continue. long now = mClock.uptimeMillis(); diff --git a/services/core/java/com/android/server/vibrator/HapticFeedbackVibrationProvider.java b/services/core/java/com/android/server/vibrator/HapticFeedbackVibrationProvider.java index becbbf2ea76a..519acec2f7b4 100644 --- a/services/core/java/com/android/server/vibrator/HapticFeedbackVibrationProvider.java +++ b/services/core/java/com/android/server/vibrator/HapticFeedbackVibrationProvider.java @@ -22,11 +22,10 @@ import android.os.VibrationAttributes; import android.os.VibrationEffect; import android.os.Vibrator; import android.os.VibratorInfo; +import android.os.vibrator.Flags; import android.util.Slog; import android.util.SparseArray; import android.view.HapticFeedbackConstants; -import android.view.flags.FeatureFlags; -import android.view.flags.FeatureFlagsImpl; import com.android.internal.annotations.VisibleForTesting; @@ -56,7 +55,8 @@ public final class HapticFeedbackVibrationProvider { // If present and valid, a vibration here will be used for an effect. // Otherwise, the system's default vibration will be used. @Nullable private final SparseArray<VibrationEffect> mHapticCustomizations; - private final FeatureFlags mViewFeatureFlags; + + private float mKeyboardVibrationFixedAmplitude; /** @hide */ public HapticFeedbackVibrationProvider(Resources res, Vibrator vibrator) { @@ -65,16 +65,14 @@ public final class HapticFeedbackVibrationProvider { /** @hide */ public HapticFeedbackVibrationProvider(Resources res, VibratorInfo vibratorInfo) { - this(res, vibratorInfo, loadHapticCustomizations(res, vibratorInfo), - new FeatureFlagsImpl()); + this(res, vibratorInfo, loadHapticCustomizations(res, vibratorInfo)); } /** @hide */ @VisibleForTesting HapticFeedbackVibrationProvider( Resources res, VibratorInfo vibratorInfo, - @Nullable SparseArray<VibrationEffect> hapticCustomizations, - FeatureFlags viewFeatureFlags) { + @Nullable SparseArray<VibrationEffect> hapticCustomizations) { mVibratorInfo = vibratorInfo; mHapticTextHandleEnabled = res.getBoolean( com.android.internal.R.bool.config_enableHapticTextHandle); @@ -83,14 +81,17 @@ public final class HapticFeedbackVibrationProvider { hapticCustomizations = null; } mHapticCustomizations = hapticCustomizations; - mViewFeatureFlags = viewFeatureFlags; - mSafeModeEnabledVibrationEffect = effectHasCustomization(HapticFeedbackConstants.SAFE_MODE_ENABLED) ? mHapticCustomizations.get(HapticFeedbackConstants.SAFE_MODE_ENABLED) : VibrationSettings.createEffectFromResource( res, com.android.internal.R.array.config_safeModeEnabledVibePattern); + mKeyboardVibrationFixedAmplitude = res.getFloat( + com.android.internal.R.dimen.config_keyboardHapticFeedbackFixedAmplitude); + if (mKeyboardVibrationFixedAmplitude < 0 || mKeyboardVibrationFixedAmplitude > 1) { + mKeyboardVibrationFixedAmplitude = -1; + } } /** @@ -120,6 +121,9 @@ public final class HapticFeedbackVibrationProvider { return getVibration(effectId, VibrationEffect.EFFECT_TEXTURE_TICK); case HapticFeedbackConstants.KEYBOARD_RELEASE: + case HapticFeedbackConstants.KEYBOARD_TAP: // == KEYBOARD_PRESS + return getKeyboardVibration(effectId); + case HapticFeedbackConstants.VIRTUAL_KEY_RELEASE: case HapticFeedbackConstants.ENTRY_BUMP: case HapticFeedbackConstants.DRAG_CROSSING: @@ -128,7 +132,6 @@ public final class HapticFeedbackVibrationProvider { VibrationEffect.EFFECT_TICK, /* fallbackForPredefinedEffect= */ false); - case HapticFeedbackConstants.KEYBOARD_TAP: // == KEYBOARD_PRESS case HapticFeedbackConstants.VIRTUAL_KEY: case HapticFeedbackConstants.EDGE_RELEASE: case HapticFeedbackConstants.CALENDAR_DATE: @@ -204,6 +207,10 @@ public final class HapticFeedbackVibrationProvider { case HapticFeedbackConstants.SCROLL_LIMIT: attrs = HARDWARE_FEEDBACK_VIBRATION_ATTRIBUTES; break; + case HapticFeedbackConstants.KEYBOARD_TAP: + case HapticFeedbackConstants.KEYBOARD_RELEASE: + attrs = createKeyboardVibrationAttributes(); + break; default: attrs = TOUCH_VIBRATION_ATTRIBUTES; } @@ -212,9 +219,12 @@ public final class HapticFeedbackVibrationProvider { if (bypassVibrationIntensitySetting) { flags |= VibrationAttributes.FLAG_BYPASS_USER_VIBRATION_INTENSITY_OFF; } - if (shouldBypassInterruptionPolicy(effectId, mViewFeatureFlags)) { + if (shouldBypassInterruptionPolicy(effectId)) { flags |= VibrationAttributes.FLAG_BYPASS_INTERRUPTION_POLICY; } + if (shouldBypassIntensityScale(effectId)) { + flags |= VibrationAttributes.FLAG_BYPASS_USER_VIBRATION_INTENSITY_SCALE; + } return flags == 0 ? attrs : new VibrationAttributes.Builder(attrs).setFlags(flags).build(); } @@ -295,6 +305,64 @@ public final class HapticFeedbackVibrationProvider { return mHapticCustomizations != null && mHapticCustomizations.contains(effectId); } + private VibrationEffect getKeyboardVibration(int effectId) { + if (effectHasCustomization(effectId)) { + return mHapticCustomizations.get(effectId); + } + + int primitiveId; + int predefinedEffectId; + boolean predefinedEffectFallback; + + switch (effectId) { + case HapticFeedbackConstants.KEYBOARD_RELEASE: + primitiveId = VibrationEffect.Composition.PRIMITIVE_TICK; + predefinedEffectId = VibrationEffect.EFFECT_TICK; + predefinedEffectFallback = false; + break; + case HapticFeedbackConstants.KEYBOARD_TAP: + default: + primitiveId = VibrationEffect.Composition.PRIMITIVE_CLICK; + predefinedEffectId = VibrationEffect.EFFECT_CLICK; + predefinedEffectFallback = true; + } + if (Flags.keyboardCategoryEnabled() && mKeyboardVibrationFixedAmplitude > 0) { + if (mVibratorInfo.isPrimitiveSupported(primitiveId)) { + return VibrationEffect.startComposition() + .addPrimitive(primitiveId, mKeyboardVibrationFixedAmplitude) + .compose(); + } + } + return getVibration(effectId, predefinedEffectId, + /* fallbackForPredefinedEffect= */ predefinedEffectFallback); + } + + private boolean shouldBypassIntensityScale(int effectId) { + if (!Flags.keyboardCategoryEnabled() || mKeyboardVibrationFixedAmplitude < 0) { + // shouldn't bypass if not support keyboard category or no fixed amplitude + return false; + } + switch (effectId) { + case HapticFeedbackConstants.KEYBOARD_TAP: + return mVibratorInfo.isPrimitiveSupported( + VibrationEffect.Composition.PRIMITIVE_CLICK); + case HapticFeedbackConstants.KEYBOARD_RELEASE: + return mVibratorInfo.isPrimitiveSupported( + VibrationEffect.Composition.PRIMITIVE_TICK); + } + return false; + } + + private static VibrationAttributes createKeyboardVibrationAttributes() { + if (!Flags.keyboardCategoryEnabled()) { + return TOUCH_VIBRATION_ATTRIBUTES; + } + + return new VibrationAttributes.Builder(TOUCH_VIBRATION_ATTRIBUTES) + .setCategory(VibrationAttributes.CATEGORY_KEYBOARD) + .build(); + } + @Nullable private static SparseArray<VibrationEffect> loadHapticCustomizations( Resources res, VibratorInfo vibratorInfo) { @@ -306,8 +374,7 @@ public final class HapticFeedbackVibrationProvider { } } - private static boolean shouldBypassInterruptionPolicy( - int effectId, FeatureFlags viewFeatureFlags) { + private static boolean shouldBypassInterruptionPolicy(int effectId) { switch (effectId) { case HapticFeedbackConstants.SCROLL_TICK: case HapticFeedbackConstants.SCROLL_ITEM_FOCUS: @@ -315,7 +382,7 @@ public final class HapticFeedbackVibrationProvider { // The SCROLL_* constants should bypass interruption filter, so that scroll haptics // can play regardless of focus modes like DND. Guard this behavior by the feature // flag controlling the general scroll feedback APIs. - return viewFeatureFlags.scrollFeedbackApi(); + return android.view.flags.Flags.scrollFeedbackApi(); default: return false; } diff --git a/services/core/java/com/android/server/vibrator/VibrationSettings.java b/services/core/java/com/android/server/vibrator/VibrationSettings.java index db8a9ae553cd..1d5cac54d12b 100644 --- a/services/core/java/com/android/server/vibrator/VibrationSettings.java +++ b/services/core/java/com/android/server/vibrator/VibrationSettings.java @@ -16,6 +16,7 @@ package com.android.server.vibrator; +import static android.os.VibrationAttributes.CATEGORY_KEYBOARD; import static android.os.VibrationAttributes.USAGE_ACCESSIBILITY; import static android.os.VibrationAttributes.USAGE_ALARM; import static android.os.VibrationAttributes.USAGE_COMMUNICATION_REQUEST; @@ -52,6 +53,7 @@ import android.os.VibrationAttributes; import android.os.VibrationEffect; import android.os.Vibrator; import android.os.Vibrator.VibrationIntensity; +import android.os.vibrator.Flags; import android.os.vibrator.VibrationConfig; import android.provider.Settings; import android.util.IndentingPrintWriter; @@ -188,6 +190,8 @@ final class VibrationSettings { @GuardedBy("mLock") private boolean mVibrateOn; @GuardedBy("mLock") + private boolean mKeyboardVibrationOn; + @GuardedBy("mLock") private int mRingerMode; @GuardedBy("mLock") private boolean mOnWirelessCharger; @@ -295,6 +299,8 @@ final class VibrationSettings { Settings.System.getUriFor(Settings.System.NOTIFICATION_VIBRATION_INTENSITY)); registerSettingsObserver( Settings.System.getUriFor(Settings.System.RING_VIBRATION_INTENSITY)); + registerSettingsObserver( + Settings.System.getUriFor(Settings.System.KEYBOARD_VIBRATION_ENABLED)); if (mVibrationConfig.ignoreVibrationsOnWirelessCharger()) { Intent batteryStatus = mContext.registerReceiver( @@ -418,14 +424,9 @@ final class VibrationSettings { } if (!callerInfo.attrs.isFlagSet( - VibrationAttributes.FLAG_BYPASS_USER_VIBRATION_INTENSITY_OFF)) { - if (!mVibrateOn && (VIBRATE_ON_DISABLED_USAGE_ALLOWED != usage)) { - return Vibration.Status.IGNORED_FOR_SETTINGS; - } - - if (getCurrentIntensity(usage) == Vibrator.VIBRATION_INTENSITY_OFF) { - return Vibration.Status.IGNORED_FOR_SETTINGS; - } + VibrationAttributes.FLAG_BYPASS_USER_VIBRATION_INTENSITY_OFF) + && !shouldVibrateForUserSetting(callerInfo)) { + return Vibration.Status.IGNORED_FOR_SETTINGS; } if (!callerInfo.attrs.isFlagSet(VibrationAttributes.FLAG_BYPASS_INTERRUPTION_POLICY)) { @@ -497,6 +498,30 @@ final class VibrationSettings { return mRingerMode != AudioManager.RINGER_MODE_SILENT; } + /** + * Return {@code true} if the device should vibrate for user setting, and + * {@code false} to ignore the vibration. + */ + @GuardedBy("mLock") + private boolean shouldVibrateForUserSetting(Vibration.CallerInfo callerInfo) { + final int usage = callerInfo.attrs.getUsage(); + if (!mVibrateOn && (VIBRATE_ON_DISABLED_USAGE_ALLOWED != usage)) { + // Main setting disabled. + return false; + } + + if (Flags.keyboardCategoryEnabled()) { + int category = callerInfo.attrs.getCategory(); + if (usage == USAGE_TOUCH && category == CATEGORY_KEYBOARD) { + // Keyboard touch has a different user setting. + return mKeyboardVibrationOn; + } + } + + // Apply individual user setting based on usage. + return getCurrentIntensity(usage) != Vibrator.VIBRATION_INTENSITY_OFF; + } + /** Update all cached settings and triggers registered listeners. */ void update() { updateSettings(); @@ -508,6 +533,8 @@ final class VibrationSettings { synchronized (mLock) { mVibrateInputDevices = loadSystemSetting(Settings.System.VIBRATE_INPUT_DEVICES, 0) > 0; mVibrateOn = loadSystemSetting(Settings.System.VIBRATE_ON, 1) > 0; + mKeyboardVibrationOn = loadSystemSetting(Settings.System.KEYBOARD_VIBRATION_ENABLED, + mVibrationConfig.isDefaultKeyboardVibrationEnabled() ? 1 : 0) > 0; int alarmIntensity = toIntensity( loadSystemSetting(Settings.System.ALARM_VIBRATION_INTENSITY, -1), diff --git a/services/core/java/com/android/server/vibrator/VibratorManagerService.java b/services/core/java/com/android/server/vibrator/VibratorManagerService.java index 45bd1521bc35..ace7777c9b58 100644 --- a/services/core/java/com/android/server/vibrator/VibratorManagerService.java +++ b/services/core/java/com/android/server/vibrator/VibratorManagerService.java @@ -97,7 +97,8 @@ public class VibratorManagerService extends IVibratorManagerService.Stub { new VibrationAttributes.Builder().build(); private static final int ATTRIBUTES_ALL_BYPASS_FLAGS = VibrationAttributes.FLAG_BYPASS_INTERRUPTION_POLICY - | VibrationAttributes.FLAG_BYPASS_USER_VIBRATION_INTENSITY_OFF; + | VibrationAttributes.FLAG_BYPASS_USER_VIBRATION_INTENSITY_OFF + | VibrationAttributes.FLAG_BYPASS_USER_VIBRATION_INTENSITY_SCALE; /** Fixed large duration used to note repeating vibrations to {@link IBatteryStats}. */ private static final long BATTERY_STATS_REPEATING_VIBRATION_DURATION = 5_000; @@ -771,8 +772,11 @@ public class VibratorManagerService extends IVibratorManagerService.Stub { private Vibration.EndInfo startVibrationLocked(HalVibration vib) { Trace.traceBegin(Trace.TRACE_TAG_VIBRATOR, "startVibrationLocked"); try { - // Scale effect before dispatching it to the input devices or the vibration thread. - vib.scaleEffects(mVibrationScaler::scale); + if (!vib.callerInfo.attrs.isFlagSet( + VibrationAttributes.FLAG_BYPASS_USER_VIBRATION_INTENSITY_SCALE)) { + // Scale effect before dispatching it to the input devices or the vibration thread. + vib.scaleEffects(mVibrationScaler::scale); + } boolean inputDevicesAvailable = mInputDeviceDelegate.vibrateIfAvailable( vib.callerInfo, vib.getEffectToPlay()); if (inputDevicesAvailable) { diff --git a/services/core/java/com/android/server/wm/Dimmer.java b/services/core/java/com/android/server/wm/Dimmer.java index 64a230effb38..823fbc9b0f3e 100644 --- a/services/core/java/com/android/server/wm/Dimmer.java +++ b/services/core/java/com/android/server/wm/Dimmer.java @@ -28,6 +28,9 @@ import com.android.window.flags.Flags; * black layers of varying opacity at various Z-levels which create the effect of a Dim. */ public abstract class Dimmer { + + static final boolean DIMMER_REFACTOR = Flags.dimmerRefactor(); + /** * The {@link WindowContainer} that our Dims are bounded to. We may be dimming on behalf of the * host, some controller of it, or one of the hosts children. @@ -40,7 +43,7 @@ public abstract class Dimmer { // Constructs the correct type of dimmer static Dimmer create(WindowContainer host) { - return Flags.dimmerRefactor() ? new SmoothDimmer(host) : new LegacyDimmer(host); + return DIMMER_REFACTOR ? new SmoothDimmer(host) : new LegacyDimmer(host); } @NonNull @@ -48,32 +51,34 @@ public abstract class Dimmer { return mHost; } - protected abstract void dim( - WindowContainer container, int relativeLayer, float alpha, int blurRadius); - /** - * Place a dim above the given container, which should be a child of the host container. - * for each call to {@link WindowContainer#prepareSurfaces} the Dim state will be reset - * and the child should call dimAbove again to request the Dim to continue. + * Position the dim relatively to the dimming container. + * Normally called together with #setAppearance, it can be called alone to keep the dim parented + * to a visible container until the next dimming container is ready. + * If multiple containers call this method, only the changes relative to the topmost will be + * applied. * - * @param container The container which to dim above. Should be a child of our host. - * @param alpha The alpha at which to Dim. + * For each call to {@link WindowContainer#prepareSurfaces()} the DimState will be reset, and + * the child of the host should call adjustRelativeLayer and {@link Dimmer#adjustAppearance} to + * continue dimming. Indeed, this method won't be able to keep dimming or get a new DimState + * without also adjusting the appearance. + * @param container The container which to dim above. Should be a child of the host. + * @param relativeLayer The position of the dim wrt the container */ - void dimAbove(@NonNull WindowContainer container, float alpha) { - dim(container, 1, alpha, 0); - } + protected abstract void adjustRelativeLayer(WindowContainer container, int relativeLayer); /** - * Like {@link #dimAbove} but places the dim below the given container. - * - * @param container The container which to dim below. Should be a child of our host. - * @param alpha The alpha at which to Dim. - * @param blurRadius The amount of blur added to the Dim. + * Set the aspect of the dim layer, and request to keep dimming. + * For each call to {@link WindowContainer#prepareSurfaces} the Dim state will be reset, and the + * child should call setAppearance again to request the Dim to continue. + * If multiple containers call this method, only the changes relative to the topmost will be + * applied. + * @param container Container requesting the dim + * @param alpha Dim amount + * @param blurRadius Blur amount */ - - void dimBelow(@NonNull WindowContainer container, float alpha, int blurRadius) { - dim(container, -1, alpha, blurRadius); - } + protected abstract void adjustAppearance( + WindowContainer container, float alpha, int blurRadius); /** * Mark all dims as pending completion on the next call to {@link #updateDims} diff --git a/services/core/java/com/android/server/wm/InsetsSourceProvider.java b/services/core/java/com/android/server/wm/InsetsSourceProvider.java index 02f5c217e5d8..cd114fcf9e21 100644 --- a/services/core/java/com/android/server/wm/InsetsSourceProvider.java +++ b/services/core/java/com/android/server/wm/InsetsSourceProvider.java @@ -68,6 +68,7 @@ class InsetsSourceProvider { private final Rect mTmpRect = new Rect(); private final InsetsStateController mStateController; private final InsetsSourceControl mFakeControl; + private final Consumer<Transaction> mSetLeashPositionConsumer; private @Nullable InsetsSourceControl mControl; private @Nullable InsetsControlTarget mControlTarget; private @Nullable InsetsControlTarget mPendingControlTarget; @@ -85,16 +86,7 @@ class InsetsSourceProvider { private boolean mInsetsHintStale = true; private @Flags int mFlagsFromFrameProvider; private @Flags int mFlagsFromServer; - - private final Consumer<Transaction> mSetLeashPositionConsumer = t -> { - if (mControl != null) { - final SurfaceControl leash = mControl.getLeash(); - if (leash != null) { - final Point position = mControl.getSurfacePosition(); - t.setPosition(leash, position.x, position.y); - } - } - }; + private boolean mHasPendingPosition; /** The visibility override from the current controlling window. */ private boolean mClientVisible; @@ -129,6 +121,21 @@ class InsetsSourceProvider { source.getId(), source.getType(), null /* leash */, false /* initialVisible */, new Point(), Insets.NONE); mControllable = (InsetsPolicy.CONTROLLABLE_TYPES & source.getType()) != 0; + mSetLeashPositionConsumer = t -> { + if (mControl != null) { + final SurfaceControl leash = mControl.getLeash(); + if (leash != null) { + final Point position = mControl.getSurfacePosition(); + t.setPosition(leash, position.x, position.y); + } + } + if (mHasPendingPosition) { + mHasPendingPosition = false; + if (mPendingControlTarget != mControlTarget) { + mStateController.notifyControlTargetChanged(mPendingControlTarget, this); + } + } + }; } InsetsSource getSource() { @@ -185,9 +192,8 @@ class InsetsSourceProvider { mWindowContainer.getInsetsSourceProviders().put(mSource.getId(), this); if (mControllable) { mWindowContainer.setControllableInsetProvider(this); - if (mPendingControlTarget != null) { + if (mPendingControlTarget != mControlTarget) { updateControlForTarget(mPendingControlTarget, true /* force */); - mPendingControlTarget = null; } } } @@ -344,6 +350,7 @@ class InsetsSourceProvider { changed = true; if (windowState != null && windowState.getWindowFrames().didFrameSizeChange() && windowState.mWinAnimator.getShown() && mWindowContainer.okToDisplay()) { + mHasPendingPosition = true; windowState.applyWithNextDraw(mSetLeashPositionConsumer); } else { Transaction t = mWindowContainer.getSyncTransaction(); @@ -465,18 +472,23 @@ class InsetsSourceProvider { // to control the window for now. return; } + mPendingControlTarget = target; if (mWindowContainer != null && mWindowContainer.getSurfaceControl() == null) { // if window doesn't have a surface, set it null and return. setWindowContainer(null, null, null); } if (mWindowContainer == null) { - mPendingControlTarget = target; return; } if (target == mControlTarget && !force) { return; } + if (mHasPendingPosition) { + // Don't create a new leash while having a pending position. Otherwise, the position + // will be changed earlier than expected, which can cause flicker. + return; + } if (target == null) { // Cancelling the animation will invoke onAnimationCancelled, resetting all the fields. mWindowContainer.cancelAnimation(); @@ -618,6 +630,7 @@ class InsetsSourceProvider { } pw.print(prefix); pw.print("mIsLeashReadyForDispatching="); pw.print(mIsLeashReadyForDispatching); + pw.print("mHasPendingPosition="); pw.print(mHasPendingPosition); pw.println(); if (mWindowContainer != null) { pw.print(prefix + "mWindowContainer="); @@ -631,7 +644,7 @@ class InsetsSourceProvider { pw.print(prefix + "mControlTarget="); pw.println(mControlTarget); } - if (mPendingControlTarget != null) { + if (mPendingControlTarget != mControlTarget) { pw.print(prefix + "mPendingControlTarget="); pw.println(mPendingControlTarget); } @@ -652,7 +665,8 @@ class InsetsSourceProvider { if (mControlTarget != null && mControlTarget.getWindow() != null) { mControlTarget.getWindow().dumpDebug(proto, CONTROL_TARGET, logLevel); } - if (mPendingControlTarget != null && mPendingControlTarget.getWindow() != null) { + if (mPendingControlTarget != null && mPendingControlTarget != mControlTarget + && mPendingControlTarget.getWindow() != null) { mPendingControlTarget.getWindow().dumpDebug(proto, PENDING_CONTROL_TARGET, logLevel); } if (mFakeControlTarget != null && mFakeControlTarget.getWindow() != null) { diff --git a/services/core/java/com/android/server/wm/InsetsStateController.java b/services/core/java/com/android/server/wm/InsetsStateController.java index 081ebe0e7cbd..c4d01291f558 100644 --- a/services/core/java/com/android/server/wm/InsetsStateController.java +++ b/services/core/java/com/android/server/wm/InsetsStateController.java @@ -278,6 +278,12 @@ class InsetsStateController { notifyPendingInsetsControlChanged(); } + void notifyControlTargetChanged(@Nullable InsetsControlTarget target, + InsetsSourceProvider provider) { + onControlTargetChanged(provider, target, false /* fake */); + notifyPendingInsetsControlChanged(); + } + void notifyControlRevoked(@NonNull InsetsControlTarget previousControlTarget, InsetsSourceProvider provider) { removeFromControlMaps(previousControlTarget, provider, false /* fake */); diff --git a/services/core/java/com/android/server/wm/LegacyDimmer.java b/services/core/java/com/android/server/wm/LegacyDimmer.java index ccf956ecef1e..3265e605ab15 100644 --- a/services/core/java/com/android/server/wm/LegacyDimmer.java +++ b/services/core/java/com/android/server/wm/LegacyDimmer.java @@ -134,8 +134,9 @@ public class LegacyDimmer extends Dimmer { boolean mAnimateExit = true; /** - * Used for Dims not associated with a WindowContainer. See {@link Dimmer#dimAbove} for - * details on Dim lifecycle. + * Used for Dims not associated with a WindowContainer. + * See {@link Dimmer#adjustRelativeLayer(WindowContainer, int)} for details on Dim + * lifecycle. */ boolean mDontReset; SurfaceAnimator mSurfaceAnimator; @@ -218,9 +219,8 @@ public class LegacyDimmer extends Dimmer { } @Override - protected void dim(WindowContainer container, int relativeLayer, float alpha, int blurRadius) { + protected void adjustAppearance(WindowContainer container, float alpha, int blurRadius) { final DimState d = obtainDimState(container); - if (d == null) { return; } @@ -229,14 +229,21 @@ public class LegacyDimmer extends Dimmer { // in the correct Z from lowest Z to highest. This ensures that the dim layer is always // relative to the highest Z layer with a dim. SurfaceControl.Transaction t = mHost.getPendingTransaction(); - t.setRelativeLayer(d.mDimLayer, container.getSurfaceControl(), relativeLayer); t.setAlpha(d.mDimLayer, alpha); t.setBackgroundBlurRadius(d.mDimLayer, blurRadius); - d.mDimming = true; } @Override + protected void adjustRelativeLayer(WindowContainer container, int relativeLayer) { + final DimState d = mDimState; + if (d != null) { + SurfaceControl.Transaction t = mHost.getPendingTransaction(); + t.setRelativeLayer(d.mDimLayer, container.getSurfaceControl(), relativeLayer); + } + } + + @Override boolean updateDims(SurfaceControl.Transaction t) { if (mDimState == null) { return false; diff --git a/services/core/java/com/android/server/wm/OWNERS b/services/core/java/com/android/server/wm/OWNERS index f6c364008c62..f8c39d0906a0 100644 --- a/services/core/java/com/android/server/wm/OWNERS +++ b/services/core/java/com/android/server/wm/OWNERS @@ -16,6 +16,7 @@ lihongyu@google.com mariiasand@google.com rgl@google.com yunfanc@google.com +wilsonshih@google.com per-file BackgroundActivityStartController.java = set noparent per-file BackgroundActivityStartController.java = brufino@google.com, topjohnwu@google.com, achim@google.com, ogunwale@google.com, louischang@google.com, lus@google.com diff --git a/services/core/java/com/android/server/wm/SmoothDimmer.java b/services/core/java/com/android/server/wm/SmoothDimmer.java index 6ddbd2c8eb67..2549bbf70e9f 100644 --- a/services/core/java/com/android/server/wm/SmoothDimmer.java +++ b/services/core/java/com/android/server/wm/SmoothDimmer.java @@ -63,8 +63,9 @@ class SmoothDimmer extends Dimmer { boolean mAnimateExit = true; /** - * Used for Dims not associated with a WindowContainer. See {@link Dimmer#dimAbove} for - * details on Dim lifecycle. + * Used for Dims not associated with a WindowContainer. + * See {@link Dimmer#adjustRelativeLayer(WindowContainer, int)} for details on Dim + * lifecycle. */ boolean mDontReset; @@ -105,22 +106,34 @@ class SmoothDimmer extends Dimmer { } void setExitParameters(WindowContainer container) { - setRequestedParameters(container, -1, 0, 0); + setRequestedRelativeParent(container, -1 /* relativeLayer */); + setRequestedAppearance(0f /* alpha */, 0 /* blur */); } + // Sets a requested change without applying it immediately - void setRequestedParameters(WindowContainer container, int relativeLayer, float alpha, - int blurRadius) { - mRequestedProperties.mDimmingContainer = container; + void setRequestedRelativeParent(WindowContainer relativeParent, int relativeLayer) { + mRequestedProperties.mDimmingContainer = relativeParent; mRequestedProperties.mRelativeLayer = relativeLayer; + } + + // Sets a requested change without applying it immediately + void setRequestedAppearance(float alpha, int blurRadius) { mRequestedProperties.mAlpha = alpha; mRequestedProperties.mBlurRadius = blurRadius; } /** * Commit the last changes we received. Called after - * {@link Change#setRequestedParameters(WindowContainer, int, float, int)} + * {@link Change#setExitParameters(WindowContainer)}, + * {@link Change#setRequestedRelativeParent(WindowContainer, int)}, or + * {@link Change#setRequestedAppearance(float, int)} */ void applyChanges(SurfaceControl.Transaction t) { + if (mRequestedProperties.mDimmingContainer == null) { + Log.e(TAG, this + " does not have a dimming container. Have you forgotten to " + + "call adjustRelativeLayer?"); + return; + } if (mRequestedProperties.mDimmingContainer.mSurfaceControl == null) { Log.w(TAG, "container " + mRequestedProperties.mDimmingContainer + "does not have a surface"); @@ -276,14 +289,19 @@ class SmoothDimmer extends Dimmer { } @Override - protected void dim(WindowContainer container, int relativeLayer, float alpha, int blurRadius) { + protected void adjustAppearance(WindowContainer container, float alpha, int blurRadius) { final DimState d = obtainDimState(container); - - mDimState.mRequestedProperties.mDimmingContainer = container; - mDimState.setRequestedParameters(container, relativeLayer, alpha, blurRadius); + mDimState.setRequestedAppearance(alpha, blurRadius); d.mDimming = true; } + @Override + protected void adjustRelativeLayer(WindowContainer container, int relativeLayer) { + if (mDimState != null) { + mDimState.setRequestedRelativeParent(container, relativeLayer); + } + } + boolean updateDims(SurfaceControl.Transaction t) { if (mDimState == null) { return false; diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java index 7f36aec69480..3a793e921c68 100644 --- a/services/core/java/com/android/server/wm/WindowState.java +++ b/services/core/java/com/android/server/wm/WindowState.java @@ -5136,8 +5136,8 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP private void applyDims() { if (((mAttrs.flags & FLAG_DIM_BEHIND) != 0 || shouldDrawBlurBehind()) - && mToken.isVisibleRequested() && isVisibleNow() && !mHidden - && mTransitionController.canApplyDim(getTask())) { + && (Dimmer.DIMMER_REFACTOR ? mWinAnimator.getShown() : isVisibleNow()) + && !mHidden && mTransitionController.canApplyDim(getTask())) { // Only show the Dimmer when the following is satisfied: // 1. The window has the flag FLAG_DIM_BEHIND or blur behind is requested // 2. The WindowToken is not hidden so dims aren't shown when the window is exiting. @@ -5147,7 +5147,13 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP mIsDimming = true; final float dimAmount = (mAttrs.flags & FLAG_DIM_BEHIND) != 0 ? mAttrs.dimAmount : 0; final int blurRadius = shouldDrawBlurBehind() ? mAttrs.getBlurBehindRadius() : 0; - getDimmer().dimBelow(this, dimAmount, blurRadius); + // If the window is visible from surface flinger perspective (mWinAnimator.getShown()) + // but not window manager visible (!isVisibleNow()), it can still be the parent of the + // dim, but can not create a new surface or continue a dim alone. + if (isVisibleNow()) { + getDimmer().adjustAppearance(this, dimAmount, blurRadius); + } + getDimmer().adjustRelativeLayer(this, -1 /* relativeLayer */); } } @@ -5207,12 +5213,17 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP void prepareSurfaces() { mIsDimming = false; if (mHasSurface) { - applyDims(); + if (!Dimmer.DIMMER_REFACTOR) { + applyDims(); + } updateSurfacePositionNonOrganized(); // Send information to SurfaceFlinger about the priority of the current window. updateFrameRateSelectionPriorityIfNeeded(); updateScaleIfNeeded(); mWinAnimator.prepareSurfaceLocked(getSyncTransaction()); + if (Dimmer.DIMMER_REFACTOR) { + applyDims(); + } } super.prepareSurfaces(); } diff --git a/services/tests/servicestests/src/com/android/server/accessibility/AccessibilityUserStateTest.java b/services/tests/servicestests/src/com/android/server/accessibility/AccessibilityUserStateTest.java index 63281b77ade7..71007f53f0e1 100644 --- a/services/tests/servicestests/src/com/android/server/accessibility/AccessibilityUserStateTest.java +++ b/services/tests/servicestests/src/com/android/server/accessibility/AccessibilityUserStateTest.java @@ -155,7 +155,7 @@ public class AccessibilityUserStateTest { mUserState.mAccessibilityButtonTargets.add(COMPONENT_NAME.flattenToString()); mUserState.setTargetAssignedToAccessibilityButton(COMPONENT_NAME.flattenToString()); mUserState.setTouchExplorationEnabledLocked(true); - mUserState.setDisplayMagnificationEnabledLocked(true); + mUserState.setMagnificationSingleFingerTripleTapEnabledLocked(true); mUserState.setAutoclickEnabledLocked(true); mUserState.setUserNonInteractiveUiTimeoutLocked(30); mUserState.setUserInteractiveUiTimeoutLocked(30); @@ -177,7 +177,7 @@ public class AccessibilityUserStateTest { assertTrue(mUserState.mAccessibilityButtonTargets.isEmpty()); assertNull(mUserState.getTargetAssignedToAccessibilityButton()); assertFalse(mUserState.isTouchExplorationEnabledLocked()); - assertFalse(mUserState.isDisplayMagnificationEnabledLocked()); + assertFalse(mUserState.isMagnificationSingleFingerTripleTapEnabledLocked()); assertFalse(mUserState.isAutoclickEnabledLocked()); assertEquals(0, mUserState.getUserNonInteractiveUiTimeoutLocked()); assertEquals(0, mUserState.getUserInteractiveUiTimeoutLocked()); diff --git a/services/tests/vibrator/Android.bp b/services/tests/vibrator/Android.bp index 95441060f0e5..6f37967bf7f0 100644 --- a/services/tests/vibrator/Android.bp +++ b/services/tests/vibrator/Android.bp @@ -35,6 +35,7 @@ android_test { "platform-test-annotations", "service-permission.stubs.system_server", "services.core", + "flag-junit", ], platform_apis: true, diff --git a/services/tests/vibrator/src/com/android/server/vibrator/HapticFeedbackVibrationProviderTest.java b/services/tests/vibrator/src/com/android/server/vibrator/HapticFeedbackVibrationProviderTest.java index 000355598281..3d0dca0de87e 100644 --- a/services/tests/vibrator/src/com/android/server/vibrator/HapticFeedbackVibrationProviderTest.java +++ b/services/tests/vibrator/src/com/android/server/vibrator/HapticFeedbackVibrationProviderTest.java @@ -16,20 +16,24 @@ package com.android.server.vibrator; +import static android.os.VibrationAttributes.CATEGORY_KEYBOARD; import static android.os.VibrationAttributes.FLAG_BYPASS_INTERRUPTION_POLICY; import static android.os.VibrationAttributes.FLAG_BYPASS_USER_VIBRATION_INTENSITY_OFF; +import static android.os.VibrationAttributes.FLAG_BYPASS_USER_VIBRATION_INTENSITY_SCALE; import static android.os.VibrationEffect.Composition.PRIMITIVE_CLICK; import static android.os.VibrationEffect.Composition.PRIMITIVE_TICK; +import static android.os.VibrationEffect.EFFECT_CLICK; import static android.os.VibrationEffect.EFFECT_TEXTURE_TICK; import static android.os.VibrationEffect.EFFECT_TICK; import static android.view.HapticFeedbackConstants.CLOCK_TICK; import static android.view.HapticFeedbackConstants.CONTEXT_CLICK; +import static android.view.HapticFeedbackConstants.KEYBOARD_RELEASE; +import static android.view.HapticFeedbackConstants.KEYBOARD_TAP; import static android.view.HapticFeedbackConstants.SAFE_MODE_ENABLED; -import static android.view.HapticFeedbackConstants.TEXT_HANDLE_MOVE; import static android.view.HapticFeedbackConstants.SCROLL_ITEM_FOCUS; import static android.view.HapticFeedbackConstants.SCROLL_LIMIT; import static android.view.HapticFeedbackConstants.SCROLL_TICK; - +import static android.view.HapticFeedbackConstants.TEXT_HANDLE_MOVE; import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertWithMessage; @@ -42,9 +46,10 @@ import android.hardware.vibrator.IVibrator; import android.os.VibrationAttributes; import android.os.VibrationEffect; import android.os.VibratorInfo; +import android.os.vibrator.Flags; +import android.platform.test.flag.junit.SetFlagsRule; import android.util.AtomicFile; import android.util.SparseArray; -import android.view.flags.FeatureFlags; import androidx.test.InstrumentationRegistry; @@ -62,6 +67,8 @@ import java.io.FileOutputStream; public class HapticFeedbackVibrationProviderTest { @Rule public MockitoRule rule = MockitoJUnit.rule(); + @Rule public final SetFlagsRule mSetFlagsRule = new SetFlagsRule(); + private static final VibrationEffect PRIMITIVE_TICK_EFFECT = VibrationEffect.startComposition().addPrimitive(PRIMITIVE_TICK, 0.2497f).compose(); private static final VibrationEffect PRIMITIVE_CLICK_EFFECT = @@ -69,11 +76,15 @@ public class HapticFeedbackVibrationProviderTest { private static final int[] SCROLL_FEEDBACK_CONSTANTS = new int[] {SCROLL_ITEM_FOCUS, SCROLL_LIMIT, SCROLL_TICK}; + private static final int[] KEYBOARD_FEEDBACK_CONSTANTS = + new int[] {KEYBOARD_TAP, KEYBOARD_RELEASE}; + + private static final float KEYBOARD_VIBRATION_FIXED_AMPLITUDE = 0.62f; + private Context mContext = InstrumentationRegistry.getContext(); private VibratorInfo mVibratorInfo = VibratorInfo.EMPTY_VIBRATOR_INFO; @Mock private Resources mResourcesMock; - @Mock private FeatureFlags mViewFeatureFlags; @Test public void testNonExistentCustomization_useDefault() throws Exception { @@ -214,6 +225,62 @@ public class HapticFeedbackVibrationProviderTest { } @Test + public void testKeyboardHaptic_noFixedAmplitude_defaultVibrationReturned() { + mockVibratorPrimitiveSupport(PRIMITIVE_CLICK, PRIMITIVE_TICK); + SparseArray<VibrationEffect> customizations = new SparseArray<>(); + customizations.put(KEYBOARD_TAP, PRIMITIVE_CLICK_EFFECT); + customizations.put(KEYBOARD_RELEASE, PRIMITIVE_TICK_EFFECT); + + // Test with a customization available for `KEYBOARD_TAP` & `KEYBOARD_RELEASE`. + HapticFeedbackVibrationProvider hapticProvider = createProvider(customizations); + + assertThat(hapticProvider.getVibrationForHapticFeedback(KEYBOARD_TAP)) + .isEqualTo(PRIMITIVE_CLICK_EFFECT); + assertThat(hapticProvider.getVibrationForHapticFeedback(KEYBOARD_RELEASE)) + .isEqualTo(PRIMITIVE_TICK_EFFECT); + + // Test with no customization available for `KEYBOARD_TAP` & `KEYBOARD_RELEASE`. + hapticProvider = createProviderWithDefaultCustomizations(); + + assertThat(hapticProvider.getVibrationForHapticFeedback(KEYBOARD_TAP)) + .isEqualTo(VibrationEffect.get(EFFECT_CLICK, true /* fallback */)); + assertThat(hapticProvider.getVibrationForHapticFeedback(KEYBOARD_RELEASE)) + .isEqualTo(VibrationEffect.get(EFFECT_TICK, false /* fallback */)); + } + + @Test + public void testKeyboardHaptic_fixAmplitude_keyboardCategoryOff_defaultVibrationReturned() { + mSetFlagsRule.disableFlags(Flags.FLAG_KEYBOARD_CATEGORY_ENABLED); + mockVibratorPrimitiveSupport(PRIMITIVE_CLICK, PRIMITIVE_TICK); + mockKeyboardVibrationFixedAmplitude(KEYBOARD_VIBRATION_FIXED_AMPLITUDE); + + HapticFeedbackVibrationProvider hapticProvider = createProviderWithDefaultCustomizations(); + + assertThat(hapticProvider.getVibrationForHapticFeedback(KEYBOARD_TAP)) + .isEqualTo(VibrationEffect.get(EFFECT_CLICK, true /* fallback */)); + assertThat(hapticProvider.getVibrationForHapticFeedback(KEYBOARD_RELEASE)) + .isEqualTo(VibrationEffect.get(EFFECT_TICK, false /* fallback */)); + } + + @Test + public void testKeyboardHaptic_fixAmplitude_keyboardCategoryOn_keyboardVibrationReturned() { + mSetFlagsRule.enableFlags(Flags.FLAG_KEYBOARD_CATEGORY_ENABLED); + mockVibratorPrimitiveSupport(PRIMITIVE_CLICK, PRIMITIVE_TICK); + mockKeyboardVibrationFixedAmplitude(KEYBOARD_VIBRATION_FIXED_AMPLITUDE); + + HapticFeedbackVibrationProvider hapticProvider = createProviderWithDefaultCustomizations(); + + assertThat(hapticProvider.getVibrationForHapticFeedback(KEYBOARD_TAP)) + .isEqualTo(VibrationEffect.startComposition() + .addPrimitive(PRIMITIVE_CLICK, KEYBOARD_VIBRATION_FIXED_AMPLITUDE) + .compose()); + assertThat(hapticProvider.getVibrationForHapticFeedback(KEYBOARD_RELEASE)) + .isEqualTo(VibrationEffect.startComposition() + .addPrimitive(PRIMITIVE_TICK, KEYBOARD_VIBRATION_FIXED_AMPLITUDE) + .compose()); + } + + @Test public void testVibrationAttribute_forNotBypassingIntensitySettings() { HapticFeedbackVibrationProvider hapticProvider = createProviderWithDefaultCustomizations(); @@ -235,7 +302,7 @@ public class HapticFeedbackVibrationProviderTest { @Test public void testVibrationAttribute_scrollFeedback_scrollApiFlagOn_bypassInterruptPolicy() { - when(mViewFeatureFlags.scrollFeedbackApi()).thenReturn(true); + mSetFlagsRule.enableFlags(android.view.flags.Flags.FLAG_SCROLL_FEEDBACK_API); HapticFeedbackVibrationProvider hapticProvider = createProviderWithDefaultCustomizations(); for (int effectId : SCROLL_FEEDBACK_CONSTANTS) { @@ -248,7 +315,7 @@ public class HapticFeedbackVibrationProviderTest { @Test public void testVibrationAttribute_scrollFeedback_scrollApiFlagOff_noBypassInterruptPolicy() { - when(mViewFeatureFlags.scrollFeedbackApi()).thenReturn(false); + mSetFlagsRule.disableFlags(android.view.flags.Flags.FLAG_SCROLL_FEEDBACK_API); HapticFeedbackVibrationProvider hapticProvider = createProviderWithDefaultCustomizations(); for (int effectId : SCROLL_FEEDBACK_CONSTANTS) { @@ -259,14 +326,71 @@ public class HapticFeedbackVibrationProviderTest { } } + @Test + public void testVibrationAttribute_keyboardCategoryOff_notUseKeyboardCategory() { + mSetFlagsRule.disableFlags(Flags.FLAG_KEYBOARD_CATEGORY_ENABLED); + HapticFeedbackVibrationProvider hapticProvider = createProviderWithDefaultCustomizations(); + + for (int effectId : KEYBOARD_FEEDBACK_CONSTANTS) { + VibrationAttributes attrs = hapticProvider.getVibrationAttributesForHapticFeedback( + effectId, /* bypassVibrationIntensitySetting= */ false); + assertWithMessage("Expected no CATEGORY_KEYBOARD for effect " + effectId) + .that(attrs.getCategory()).isEqualTo(0); + } + } + + @Test + public void testVibrationAttribute_keyboardCategoryOn_useKeyboardCategory() { + mSetFlagsRule.enableFlags(Flags.FLAG_KEYBOARD_CATEGORY_ENABLED); + HapticFeedbackVibrationProvider hapticProvider = createProviderWithDefaultCustomizations(); + + for (int effectId : KEYBOARD_FEEDBACK_CONSTANTS) { + VibrationAttributes attrs = hapticProvider.getVibrationAttributesForHapticFeedback( + effectId, /* bypassVibrationIntensitySetting= */ false); + assertWithMessage("Expected CATEGORY_KEYBOARD for effect " + effectId) + .that(attrs.getCategory()).isEqualTo(CATEGORY_KEYBOARD); + } + } + + @Test + public void testVibrationAttribute_noFixAmplitude_keyboardCategoryOn_noBypassIntensityScale() { + mSetFlagsRule.enableFlags(Flags.FLAG_KEYBOARD_CATEGORY_ENABLED); + mockVibratorPrimitiveSupport(PRIMITIVE_CLICK, PRIMITIVE_TICK); + mockKeyboardVibrationFixedAmplitude(-1); + HapticFeedbackVibrationProvider hapticProvider = createProviderWithDefaultCustomizations(); + + for (int effectId : KEYBOARD_FEEDBACK_CONSTANTS) { + VibrationAttributes attrs = hapticProvider.getVibrationAttributesForHapticFeedback( + effectId, /* bypassVibrationIntensitySetting= */ false); + assertWithMessage("Expected no FLAG_BYPASS_USER_VIBRATION_INTENSITY_SCALE for effect " + + effectId) + .that(attrs.isFlagSet(FLAG_BYPASS_USER_VIBRATION_INTENSITY_SCALE)).isFalse(); + } + } + + @Test + public void testVibrationAttribute_fixAmplitude_keyboardCategoryOn_bypassIntensityScale() { + mSetFlagsRule.enableFlags(Flags.FLAG_KEYBOARD_CATEGORY_ENABLED); + mockVibratorPrimitiveSupport(PRIMITIVE_CLICK, PRIMITIVE_TICK); + mockKeyboardVibrationFixedAmplitude(KEYBOARD_VIBRATION_FIXED_AMPLITUDE); + HapticFeedbackVibrationProvider hapticProvider = createProviderWithDefaultCustomizations(); + + for (int effectId : KEYBOARD_FEEDBACK_CONSTANTS) { + VibrationAttributes attrs = hapticProvider.getVibrationAttributesForHapticFeedback( + effectId, /* bypassVibrationIntensitySetting= */ false); + assertWithMessage("Expected FLAG_BYPASS_USER_VIBRATION_INTENSITY_SCALE for effect " + + effectId) + .that(attrs.isFlagSet(FLAG_BYPASS_USER_VIBRATION_INTENSITY_SCALE)).isTrue(); + } + } + private HapticFeedbackVibrationProvider createProviderWithDefaultCustomizations() { return createProvider(/* customizations= */ null); } private HapticFeedbackVibrationProvider createProvider( SparseArray<VibrationEffect> customizations) { - return new HapticFeedbackVibrationProvider( - mResourcesMock, mVibratorInfo, customizations, mViewFeatureFlags); + return new HapticFeedbackVibrationProvider(mResourcesMock, mVibratorInfo, customizations); } private void mockVibratorPrimitiveSupport(int... supportedPrimitives) { @@ -287,6 +411,11 @@ public class HapticFeedbackVibrationProviderTest { .thenReturn(vibrationPattern); } + private void mockKeyboardVibrationFixedAmplitude(float amplitude) { + when(mResourcesMock.getFloat(R.dimen.config_keyboardHapticFeedbackFixedAmplitude)) + .thenReturn(amplitude); + } + private void setupCustomizationFile(String xml) throws Exception { File file = new File(mContext.getCacheDir(), "test.xml"); file.createNewFile(); diff --git a/services/tests/vibrator/src/com/android/server/vibrator/VibrationSettingsTest.java b/services/tests/vibrator/src/com/android/server/vibrator/VibrationSettingsTest.java index 1ae096617dce..7a2bb5a90846 100644 --- a/services/tests/vibrator/src/com/android/server/vibrator/VibrationSettingsTest.java +++ b/services/tests/vibrator/src/com/android/server/vibrator/VibrationSettingsTest.java @@ -69,7 +69,11 @@ import android.os.VibrationAttributes; import android.os.VibrationEffect; import android.os.Vibrator; import android.os.test.TestLooper; +import android.os.vibrator.Flags; import android.os.vibrator.VibrationConfig; +import android.platform.test.annotations.RequiresFlagsEnabled; +import android.platform.test.flag.junit.CheckFlagsRule; +import android.platform.test.flag.junit.DeviceFlagsValueProvider; import android.provider.Settings; import android.util.ArraySet; import android.view.Display; @@ -95,6 +99,9 @@ import java.util.Set; public class VibrationSettingsTest { + @Rule + public final CheckFlagsRule mCheckFlagsRule = DeviceFlagsValueProvider.createCheckFlagsRule(); + private static final int UID = 1; private static final int VIRTUAL_DISPLAY_ID = 1; private static final String SYSUI_PACKAGE_NAME = "sysui"; @@ -606,6 +613,47 @@ public class VibrationSettingsTest { } @Test + @RequiresFlagsEnabled(Flags.FLAG_KEYBOARD_CATEGORY_ENABLED) + public void shouldIgnoreVibration_withKeyboardSettingsOff_shouldIgnoreKeyboardVibration() { + setUserSetting(Settings.System.HAPTIC_FEEDBACK_INTENSITY, VIBRATION_INTENSITY_MEDIUM); + setUserSetting(Settings.System.KEYBOARD_VIBRATION_ENABLED, 0); + + // Keyboard touch ignored. + assertVibrationIgnoredForAttributes( + new VibrationAttributes.Builder() + .setUsage(USAGE_TOUCH) + .setCategory(VibrationAttributes.CATEGORY_KEYBOARD) + .build(), + Vibration.Status.IGNORED_FOR_SETTINGS); + + // General touch and keyboard touch with bypass flag not ignored. + assertVibrationNotIgnoredForUsage(USAGE_TOUCH); + assertVibrationNotIgnoredForAttributes( + new VibrationAttributes.Builder() + .setUsage(USAGE_TOUCH) + .setCategory(VibrationAttributes.CATEGORY_KEYBOARD) + .setFlags(VibrationAttributes.FLAG_BYPASS_USER_VIBRATION_INTENSITY_OFF) + .build()); + } + + @Test + @RequiresFlagsEnabled(Flags.FLAG_KEYBOARD_CATEGORY_ENABLED) + public void shouldIgnoreVibration_withKeyboardSettingsOn_shouldNotIgnoreKeyboardVibration() { + setUserSetting(Settings.System.HAPTIC_FEEDBACK_INTENSITY, VIBRATION_INTENSITY_OFF); + setUserSetting(Settings.System.KEYBOARD_VIBRATION_ENABLED, 1); + + // General touch ignored. + assertVibrationIgnoredForUsage(USAGE_TOUCH, Vibration.Status.IGNORED_FOR_SETTINGS); + + // Keyboard touch not ignored. + assertVibrationNotIgnoredForAttributes( + new VibrationAttributes.Builder() + .setUsage(USAGE_TOUCH) + .setCategory(VibrationAttributes.CATEGORY_KEYBOARD) + .build()); + } + + @Test public void shouldIgnoreVibrationFromVirtualDisplays_displayNonVirtual_neverIgnored() { // Vibrations from the primary display is never ignored regardless of the creation and // removal of virtual displays and of the changes of apps running on virtual displays. @@ -895,6 +943,14 @@ public class VibrationSettingsTest { mVibrationSettings.shouldIgnoreVibration(callerInfo)); } + private void assertVibrationIgnoredForAttributes(VibrationAttributes attrs, + Vibration.Status expectedStatus) { + Vibration.CallerInfo callerInfo = new Vibration.CallerInfo(attrs, UID, + Display.DEFAULT_DISPLAY, null, null); + assertEquals(errorMessageForAttributes(attrs), expectedStatus, + mVibrationSettings.shouldIgnoreVibration(callerInfo)); + } + private void assertVibrationNotIgnoredForUsage(@VibrationAttributes.Usage int usage) { assertVibrationNotIgnoredForUsageAndFlags(usage, /* flags= */ 0); } @@ -919,10 +975,21 @@ public class VibrationSettingsTest { mVibrationSettings.shouldIgnoreVibration(callerInfo)); } + private void assertVibrationNotIgnoredForAttributes(VibrationAttributes attrs) { + Vibration.CallerInfo callerInfo = new Vibration.CallerInfo(attrs, UID, + Display.DEFAULT_DISPLAY, null, null); + assertNull(errorMessageForAttributes(attrs), + mVibrationSettings.shouldIgnoreVibration(callerInfo)); + } + private String errorMessageForUsage(int usage) { return "Error for usage " + VibrationAttributes.usageToString(usage); } + private String errorMessageForAttributes(VibrationAttributes attrs) { + return "Error for attributes " + attrs; + } + private void setDefaultIntensity(@Vibrator.VibrationIntensity int intensity) { when(mVibrationConfigMock.getDefaultVibrationIntensity(anyInt())).thenReturn(intensity); } diff --git a/services/tests/vibrator/src/com/android/server/vibrator/VibratorManagerServiceTest.java b/services/tests/vibrator/src/com/android/server/vibrator/VibratorManagerServiceTest.java index 40e0e84dca59..3dfaed69dea6 100644 --- a/services/tests/vibrator/src/com/android/server/vibrator/VibratorManagerServiceTest.java +++ b/services/tests/vibrator/src/com/android/server/vibrator/VibratorManagerServiceTest.java @@ -82,6 +82,7 @@ import android.os.vibrator.PrimitiveSegment; import android.os.vibrator.StepSegment; import android.os.vibrator.VibrationConfig; import android.os.vibrator.VibrationEffectSegment; +import android.platform.test.flag.junit.SetFlagsRule; import android.provider.Settings; import android.util.ArraySet; import android.util.SparseArray; @@ -89,7 +90,7 @@ import android.util.SparseBooleanArray; import android.view.Display; import android.view.HapticFeedbackConstants; import android.view.InputDevice; -import android.view.flags.FeatureFlags; +import android.view.flags.Flags; import androidx.test.InstrumentationRegistry; import androidx.test.filters.FlakyTest; @@ -155,6 +156,8 @@ public class VibratorManagerServiceTest { @Rule public FakeSettingsProviderRule mSettingsProviderRule = FakeSettingsProvider.rule(); + @Rule public final SetFlagsRule mSetFlagsRule = new SetFlagsRule(); + @Mock private VibratorManagerService.NativeWrapper mNativeWrapperMock; @Mock @@ -175,8 +178,6 @@ public class VibratorManagerServiceTest { private VirtualDeviceManagerInternal mVirtualDeviceManagerInternalMock; @Mock private AudioManager mAudioManagerMock; - @Mock - private FeatureFlags mViewFeatureFlags; private final Map<Integer, FakeVibratorControllerProvider> mVibratorProviders = new HashMap<>(); @@ -326,8 +327,7 @@ public class VibratorManagerServiceTest { HapticFeedbackVibrationProvider createHapticFeedbackVibrationProvider( Resources resources, VibratorInfo vibratorInfo) { return new HapticFeedbackVibrationProvider( - resources, vibratorInfo, mHapticFeedbackVibrationMap, - mViewFeatureFlags); + resources, vibratorInfo, mHapticFeedbackVibrationMap); } }); return mService; @@ -1354,7 +1354,7 @@ public class VibratorManagerServiceTest { denyPermission(android.Manifest.permission.MODIFY_PHONE_STATE); denyPermission(android.Manifest.permission.MODIFY_AUDIO_ROUTING); // Flag override to enable the scroll feedack constants to bypass interruption policies. - when(mViewFeatureFlags.scrollFeedbackApi()).thenReturn(true); + mSetFlagsRule.enableFlags(Flags.FLAG_SCROLL_FEEDBACK_API); mHapticFeedbackVibrationMap.put( HapticFeedbackConstants.SCROLL_TICK, VibrationEffect.createPredefined(VibrationEffect.EFFECT_CLICK)); diff --git a/services/tests/wmtests/src/com/android/server/wm/DimmerTests.java b/services/tests/wmtests/src/com/android/server/wm/DimmerTests.java index 84d42d42f834..6a738befba9a 100644 --- a/services/tests/wmtests/src/com/android/server/wm/DimmerTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/DimmerTests.java @@ -163,8 +163,8 @@ public class DimmerTests extends WindowTestsBase { public void testUpdateDimsAppliesCrop() { mHost.addChild(mChild, 0); - final float alpha = 0.8f; - mDimmer.dimAbove(mChild, alpha); + mDimmer.adjustAppearance(mChild, 1, 1); + mDimmer.adjustRelativeLayer(mChild, -1); int width = 100; int height = 300; @@ -176,42 +176,13 @@ public class DimmerTests extends WindowTestsBase { } @Test - public void testDimAboveWithChildCreatesSurfaceAboveChild_Smooth() { - assumeTrue(Flags.dimmerRefactor()); - final float alpha = 0.8f; - mHost.addChild(mChild, 0); - mDimmer.dimAbove(mChild, alpha); - SurfaceControl dimLayer = mDimmer.getDimLayer(); - - assertNotNull("Dimmer should have created a surface", dimLayer); - - mDimmer.updateDims(mTransaction); - verify(sTestAnimation).startAnimation(eq(dimLayer), eq(mTransaction), - anyInt(), any(SurfaceAnimator.OnAnimationFinishedCallback.class)); - verify(mTransaction).setRelativeLayer(dimLayer, mChild.mControl, 1); - verify(mTransaction, lastCall()).setAlpha(dimLayer, alpha); - } - - @Test - public void testDimAboveWithChildCreatesSurfaceAboveChild_Legacy() { - assumeFalse(Flags.dimmerRefactor()); - final float alpha = 0.8f; - mHost.addChild(mChild, 0); - mDimmer.dimAbove(mChild, alpha); - SurfaceControl dimLayer = mDimmer.getDimLayer(); - - assertNotNull("Dimmer should have created a surface", dimLayer); - - verify(mHost.getPendingTransaction()).setAlpha(dimLayer, alpha); - verify(mHost.getPendingTransaction()).setRelativeLayer(dimLayer, mChild.mControl, 1); - } - - @Test public void testDimBelowWithChildSurfaceCreatesSurfaceBelowChild_Smooth() { assumeTrue(Flags.dimmerRefactor()); final float alpha = 0.7f; + final int blur = 50; mHost.addChild(mChild, 0); - mDimmer.dimBelow(mChild, alpha, 50); + mDimmer.adjustAppearance(mChild, alpha, blur); + mDimmer.adjustRelativeLayer(mChild, -1); SurfaceControl dimLayer = mDimmer.getDimLayer(); assertNotNull("Dimmer should have created a surface", dimLayer); @@ -221,7 +192,7 @@ public class DimmerTests extends WindowTestsBase { anyInt(), any(SurfaceAnimator.OnAnimationFinishedCallback.class)); verify(mTransaction).setRelativeLayer(dimLayer, mChild.mControl, -1); verify(mTransaction, lastCall()).setAlpha(dimLayer, alpha); - verify(mTransaction).setBackgroundBlurRadius(dimLayer, 50); + verify(mTransaction).setBackgroundBlurRadius(dimLayer, blur); } @Test @@ -229,7 +200,8 @@ public class DimmerTests extends WindowTestsBase { assumeFalse(Flags.dimmerRefactor()); final float alpha = 0.7f; mHost.addChild(mChild, 0); - mDimmer.dimBelow(mChild, alpha, 50); + mDimmer.adjustAppearance(mChild, alpha, 20); + mDimmer.adjustRelativeLayer(mChild, -1); SurfaceControl dimLayer = mDimmer.getDimLayer(); assertNotNull("Dimmer should have created a surface", dimLayer); @@ -244,12 +216,15 @@ public class DimmerTests extends WindowTestsBase { mHost.addChild(mChild, 0); final float alpha = 0.8f; + final int blur = 50; // Dim once - mDimmer.dimBelow(mChild, alpha, 0); + mDimmer.adjustAppearance(mChild, alpha, blur); + mDimmer.adjustRelativeLayer(mChild, -1); SurfaceControl dimLayer = mDimmer.getDimLayer(); mDimmer.updateDims(mTransaction); // Reset, and don't dim mDimmer.resetDimStates(); + mDimmer.adjustRelativeLayer(mChild, -1); mDimmer.updateDims(mTransaction); verify(mTransaction).show(dimLayer); verify(mTransaction).remove(dimLayer); @@ -261,7 +236,8 @@ public class DimmerTests extends WindowTestsBase { mHost.addChild(mChild, 0); final float alpha = 0.8f; - mDimmer.dimAbove(mChild, alpha); + mDimmer.adjustAppearance(mChild, alpha, 20); + mDimmer.adjustRelativeLayer(mChild, -1); SurfaceControl dimLayer = mDimmer.getDimLayer(); mDimmer.resetDimStates(); @@ -278,13 +254,16 @@ public class DimmerTests extends WindowTestsBase { mHost.addChild(mChild, 0); final float alpha = 0.8f; + final int blur = 20; // Dim once - mDimmer.dimBelow(mChild, alpha, 0); + mDimmer.adjustAppearance(mChild, alpha, blur); + mDimmer.adjustRelativeLayer(mChild, -1); SurfaceControl dimLayer = mDimmer.getDimLayer(); mDimmer.updateDims(mTransaction); // Reset and dim again mDimmer.resetDimStates(); - mDimmer.dimAbove(mChild, alpha); + mDimmer.adjustAppearance(mChild, alpha, blur); + mDimmer.adjustRelativeLayer(mChild, -1); mDimmer.updateDims(mTransaction); verify(mTransaction).show(dimLayer); verify(mTransaction, never()).remove(dimLayer); @@ -294,7 +273,8 @@ public class DimmerTests extends WindowTestsBase { public void testDimUpdateWhileDimming() { mHost.addChild(mChild, 0); final float alpha = 0.8f; - mDimmer.dimAbove(mChild, alpha); + mDimmer.adjustAppearance(mChild, alpha, 20); + mDimmer.adjustRelativeLayer(mChild, -1); final Rect bounds = mDimmer.getDimBounds(); SurfaceControl dimLayer = mDimmer.getDimLayer(); @@ -314,7 +294,8 @@ public class DimmerTests extends WindowTestsBase { public void testRemoveDimImmediately_Smooth() { assumeTrue(Flags.dimmerRefactor()); mHost.addChild(mChild, 0); - mDimmer.dimAbove(mChild, 1); + mDimmer.adjustAppearance(mChild, 1, 2); + mDimmer.adjustRelativeLayer(mChild, -1); SurfaceControl dimLayer = mDimmer.getDimLayer(); mDimmer.updateDims(mTransaction); verify(mTransaction, times(1)).show(dimLayer); @@ -333,7 +314,8 @@ public class DimmerTests extends WindowTestsBase { public void testRemoveDimImmediately_Legacy() { assumeFalse(Flags.dimmerRefactor()); mHost.addChild(mChild, 0); - mDimmer.dimAbove(mChild, 1); + mDimmer.adjustAppearance(mChild, 1, 0); + mDimmer.adjustRelativeLayer(mChild, -1); SurfaceControl dimLayer = mDimmer.getDimLayer(); mDimmer.updateDims(mTransaction); verify(mTransaction, times(1)).show(dimLayer); @@ -351,16 +333,16 @@ public class DimmerTests extends WindowTestsBase { @Test public void testDimmerWithBlurUpdatesTransaction_Legacy() { assumeFalse(Flags.dimmerRefactor()); - TestWindowContainer child = new TestWindowContainer(mWm); - mHost.addChild(child, 0); + mHost.addChild(mChild, 0); final int blurRadius = 50; - mDimmer.dimBelow(child, 0, blurRadius); + mDimmer.adjustAppearance(mChild, 1, blurRadius); + mDimmer.adjustRelativeLayer(mChild, -1); SurfaceControl dimLayer = mDimmer.getDimLayer(); assertNotNull("Dimmer should have created a surface", dimLayer); verify(mHost.getPendingTransaction()).setBackgroundBlurRadius(dimLayer, blurRadius); - verify(mHost.getPendingTransaction()).setRelativeLayer(dimLayer, child.mControl, -1); + verify(mHost.getPendingTransaction()).setRelativeLayer(dimLayer, mChild.mControl, -1); } } |