Merge "DO NOT MERGE - Merge qt-dev-plus-aosp-without-vendor (5699924) into stage-aosp-master" into stage-aosp-master
This commit is contained in:
committed by
Android (Google) Code Review
commit
ca4c520f19
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,2 +1,3 @@
|
|||||||
/.idea
|
/.idea
|
||||||
*.iml
|
*.iml
|
||||||
|
*.sw*
|
||||||
|
|||||||
203
Android.bp
203
Android.bp
@@ -59,6 +59,7 @@ java_defaults {
|
|||||||
"core/java/android/app/IActivityController.aidl",
|
"core/java/android/app/IActivityController.aidl",
|
||||||
"core/java/android/app/IActivityManager.aidl",
|
"core/java/android/app/IActivityManager.aidl",
|
||||||
"core/java/android/app/IActivityPendingResult.aidl",
|
"core/java/android/app/IActivityPendingResult.aidl",
|
||||||
|
"core/java/android/app/IActivityTaskManager.aidl",
|
||||||
"core/java/android/app/IAlarmCompleteListener.aidl",
|
"core/java/android/app/IAlarmCompleteListener.aidl",
|
||||||
"core/java/android/app/IAlarmListener.aidl",
|
"core/java/android/app/IAlarmListener.aidl",
|
||||||
"core/java/android/app/IAlarmManager.aidl",
|
"core/java/android/app/IAlarmManager.aidl",
|
||||||
@@ -68,11 +69,11 @@ java_defaults {
|
|||||||
"core/java/android/app/ITaskStackListener.aidl",
|
"core/java/android/app/ITaskStackListener.aidl",
|
||||||
"core/java/android/app/IBackupAgent.aidl",
|
"core/java/android/app/IBackupAgent.aidl",
|
||||||
"core/java/android/app/IEphemeralResolver.aidl",
|
"core/java/android/app/IEphemeralResolver.aidl",
|
||||||
"core/java/android/app/IInputForwarder.aidl",
|
|
||||||
"core/java/android/app/IInstantAppResolver.aidl",
|
"core/java/android/app/IInstantAppResolver.aidl",
|
||||||
"core/java/android/app/IInstrumentationWatcher.aidl",
|
"core/java/android/app/IInstrumentationWatcher.aidl",
|
||||||
"core/java/android/app/INotificationManager.aidl",
|
"core/java/android/app/INotificationManager.aidl",
|
||||||
"core/java/android/app/IProcessObserver.aidl",
|
"core/java/android/app/IProcessObserver.aidl",
|
||||||
|
"core/java/android/app/IRequestFinishCallback.aidl",
|
||||||
"core/java/android/app/ISearchManager.aidl",
|
"core/java/android/app/ISearchManager.aidl",
|
||||||
"core/java/android/app/ISearchManagerCallback.aidl",
|
"core/java/android/app/ISearchManagerCallback.aidl",
|
||||||
"core/java/android/app/IServiceConnection.aidl",
|
"core/java/android/app/IServiceConnection.aidl",
|
||||||
@@ -84,14 +85,17 @@ java_defaults {
|
|||||||
"core/java/android/app/IUidObserver.aidl",
|
"core/java/android/app/IUidObserver.aidl",
|
||||||
"core/java/android/app/IUiAutomationConnection.aidl",
|
"core/java/android/app/IUiAutomationConnection.aidl",
|
||||||
"core/java/android/app/IUiModeManager.aidl",
|
"core/java/android/app/IUiModeManager.aidl",
|
||||||
|
"core/java/android/app/IUriGrantsManager.aidl",
|
||||||
"core/java/android/app/IUserSwitchObserver.aidl",
|
"core/java/android/app/IUserSwitchObserver.aidl",
|
||||||
"core/java/android/app/IWallpaperManager.aidl",
|
"core/java/android/app/IWallpaperManager.aidl",
|
||||||
"core/java/android/app/IWallpaperManagerCallback.aidl",
|
"core/java/android/app/IWallpaperManagerCallback.aidl",
|
||||||
"core/java/android/app/admin/IDeviceAdminService.aidl",
|
"core/java/android/app/admin/IDeviceAdminService.aidl",
|
||||||
"core/java/android/app/admin/IDevicePolicyManager.aidl",
|
"core/java/android/app/admin/IDevicePolicyManager.aidl",
|
||||||
|
"core/java/android/app/admin/StartInstallingUpdateCallback.aidl",
|
||||||
"core/java/android/app/trust/IStrongAuthTracker.aidl",
|
"core/java/android/app/trust/IStrongAuthTracker.aidl",
|
||||||
"core/java/android/app/trust/ITrustManager.aidl",
|
"core/java/android/app/trust/ITrustManager.aidl",
|
||||||
"core/java/android/app/trust/ITrustListener.aidl",
|
"core/java/android/app/trust/ITrustListener.aidl",
|
||||||
|
"core/java/android/app/backup/IBackupCallback.aidl",
|
||||||
"core/java/android/app/backup/IBackupManager.aidl",
|
"core/java/android/app/backup/IBackupManager.aidl",
|
||||||
"core/java/android/app/backup/IBackupObserver.aidl",
|
"core/java/android/app/backup/IBackupObserver.aidl",
|
||||||
"core/java/android/app/backup/IBackupManagerMonitor.aidl",
|
"core/java/android/app/backup/IBackupManagerMonitor.aidl",
|
||||||
@@ -99,6 +103,14 @@ java_defaults {
|
|||||||
"core/java/android/app/backup/IRestoreObserver.aidl",
|
"core/java/android/app/backup/IRestoreObserver.aidl",
|
||||||
"core/java/android/app/backup/IRestoreSession.aidl",
|
"core/java/android/app/backup/IRestoreSession.aidl",
|
||||||
"core/java/android/app/backup/ISelectBackupTransportCallback.aidl",
|
"core/java/android/app/backup/ISelectBackupTransportCallback.aidl",
|
||||||
|
"core/java/android/app/contentsuggestions/IClassificationsCallback.aidl",
|
||||||
|
"core/java/android/app/contentsuggestions/IContentSuggestionsManager.aidl",
|
||||||
|
"core/java/android/app/contentsuggestions/ISelectionsCallback.aidl",
|
||||||
|
"core/java/android/app/prediction/IPredictionCallback.aidl",
|
||||||
|
"core/java/android/app/prediction/IPredictionManager.aidl",
|
||||||
|
"core/java/android/app/role/IOnRoleHoldersChangedListener.aidl",
|
||||||
|
"core/java/android/app/role/IRoleController.aidl",
|
||||||
|
"core/java/android/app/role/IRoleManager.aidl",
|
||||||
"core/java/android/app/slice/ISliceManager.aidl",
|
"core/java/android/app/slice/ISliceManager.aidl",
|
||||||
"core/java/android/app/slice/ISliceListener.aidl",
|
"core/java/android/app/slice/ISliceListener.aidl",
|
||||||
"core/java/android/app/timedetector/ITimeDetectorService.aidl",
|
"core/java/android/app/timedetector/ITimeDetectorService.aidl",
|
||||||
@@ -142,18 +154,28 @@ java_defaults {
|
|||||||
"core/java/android/content/pm/dex/IArtManager.aidl",
|
"core/java/android/content/pm/dex/IArtManager.aidl",
|
||||||
"core/java/android/content/pm/dex/ISnapshotRuntimeProfileCallback.aidl",
|
"core/java/android/content/pm/dex/ISnapshotRuntimeProfileCallback.aidl",
|
||||||
"core/java/android/content/pm/permission/IRuntimePermissionPresenter.aidl",
|
"core/java/android/content/pm/permission/IRuntimePermissionPresenter.aidl",
|
||||||
|
"core/java/android/content/rollback/IRollbackManager.aidl",
|
||||||
"core/java/android/database/IContentObserver.aidl",
|
"core/java/android/database/IContentObserver.aidl",
|
||||||
|
"core/java/android/debug/IAdbManager.aidl",
|
||||||
|
"core/java/android/debug/IAdbTransport.aidl",
|
||||||
":libcamera_client_aidl",
|
":libcamera_client_aidl",
|
||||||
":libcamera_client_framework_aidl",
|
":libcamera_client_framework_aidl",
|
||||||
"core/java/android/hardware/IConsumerIrService.aidl",
|
"core/java/android/hardware/IConsumerIrService.aidl",
|
||||||
"core/java/android/hardware/ISerialManager.aidl",
|
"core/java/android/hardware/ISerialManager.aidl",
|
||||||
"core/java/android/hardware/biometrics/IBiometricPromptReceiver.aidl",
|
"core/java/android/hardware/biometrics/IBiometricConfirmDeviceCredentialCallback.aidl",
|
||||||
|
"core/java/android/hardware/biometrics/IBiometricEnabledOnKeyguardCallback.aidl",
|
||||||
|
"core/java/android/hardware/biometrics/IBiometricService.aidl",
|
||||||
|
"core/java/android/hardware/biometrics/IBiometricServiceReceiver.aidl",
|
||||||
|
"core/java/android/hardware/biometrics/IBiometricServiceReceiverInternal.aidl",
|
||||||
|
"core/java/android/hardware/biometrics/IBiometricServiceLockoutResetCallback.aidl",
|
||||||
|
"core/java/android/hardware/display/IColorDisplayManager.aidl",
|
||||||
"core/java/android/hardware/display/IDisplayManager.aidl",
|
"core/java/android/hardware/display/IDisplayManager.aidl",
|
||||||
"core/java/android/hardware/display/IDisplayManagerCallback.aidl",
|
"core/java/android/hardware/display/IDisplayManagerCallback.aidl",
|
||||||
"core/java/android/hardware/display/IVirtualDisplayCallback.aidl",
|
"core/java/android/hardware/display/IVirtualDisplayCallback.aidl",
|
||||||
"core/java/android/hardware/fingerprint/IFingerprintClientActiveCallback.aidl",
|
"core/java/android/hardware/fingerprint/IFingerprintClientActiveCallback.aidl",
|
||||||
|
"core/java/android/hardware/face/IFaceService.aidl",
|
||||||
|
"core/java/android/hardware/face/IFaceServiceReceiver.aidl",
|
||||||
"core/java/android/hardware/fingerprint/IFingerprintService.aidl",
|
"core/java/android/hardware/fingerprint/IFingerprintService.aidl",
|
||||||
"core/java/android/hardware/fingerprint/IFingerprintServiceLockoutResetCallback.aidl",
|
|
||||||
"core/java/android/hardware/fingerprint/IFingerprintServiceReceiver.aidl",
|
"core/java/android/hardware/fingerprint/IFingerprintServiceReceiver.aidl",
|
||||||
"core/java/android/hardware/hdmi/IHdmiControlCallback.aidl",
|
"core/java/android/hardware/hdmi/IHdmiControlCallback.aidl",
|
||||||
"core/java/android/hardware/hdmi/IHdmiControlService.aidl",
|
"core/java/android/hardware/hdmi/IHdmiControlService.aidl",
|
||||||
@@ -167,6 +189,7 @@ java_defaults {
|
|||||||
"core/java/android/hardware/input/IInputManager.aidl",
|
"core/java/android/hardware/input/IInputManager.aidl",
|
||||||
"core/java/android/hardware/input/IInputDevicesChangedListener.aidl",
|
"core/java/android/hardware/input/IInputDevicesChangedListener.aidl",
|
||||||
"core/java/android/hardware/input/ITabletModeChangedListener.aidl",
|
"core/java/android/hardware/input/ITabletModeChangedListener.aidl",
|
||||||
|
"core/java/android/hardware/iris/IIrisService.aidl",
|
||||||
"core/java/android/hardware/location/IActivityRecognitionHardware.aidl",
|
"core/java/android/hardware/location/IActivityRecognitionHardware.aidl",
|
||||||
"core/java/android/hardware/location/IActivityRecognitionHardwareClient.aidl",
|
"core/java/android/hardware/location/IActivityRecognitionHardwareClient.aidl",
|
||||||
"core/java/android/hardware/location/IActivityRecognitionHardwareSink.aidl",
|
"core/java/android/hardware/location/IActivityRecognitionHardwareSink.aidl",
|
||||||
@@ -186,8 +209,11 @@ java_defaults {
|
|||||||
"core/java/android/hardware/radio/ITunerCallback.aidl",
|
"core/java/android/hardware/radio/ITunerCallback.aidl",
|
||||||
"core/java/android/hardware/soundtrigger/IRecognitionStatusCallback.aidl",
|
"core/java/android/hardware/soundtrigger/IRecognitionStatusCallback.aidl",
|
||||||
"core/java/android/hardware/usb/IUsbManager.aidl",
|
"core/java/android/hardware/usb/IUsbManager.aidl",
|
||||||
|
"core/java/android/hardware/usb/IUsbSerialReader.aidl",
|
||||||
"core/java/android/net/ICaptivePortal.aidl",
|
"core/java/android/net/ICaptivePortal.aidl",
|
||||||
"core/java/android/net/IConnectivityManager.aidl",
|
"core/java/android/net/IConnectivityManager.aidl",
|
||||||
|
"core/java/android/hardware/ISensorPrivacyListener.aidl",
|
||||||
|
"core/java/android/hardware/ISensorPrivacyManager.aidl",
|
||||||
"core/java/android/net/IIpConnectivityMetrics.aidl",
|
"core/java/android/net/IIpConnectivityMetrics.aidl",
|
||||||
"core/java/android/net/IEthernetManager.aidl",
|
"core/java/android/net/IEthernetManager.aidl",
|
||||||
"core/java/android/net/IEthernetServiceListener.aidl",
|
"core/java/android/net/IEthernetServiceListener.aidl",
|
||||||
@@ -224,7 +250,6 @@ java_defaults {
|
|||||||
"core/java/android/os/ICancellationSignal.aidl",
|
"core/java/android/os/ICancellationSignal.aidl",
|
||||||
"core/java/android/os/IDeviceIdentifiersPolicyService.aidl",
|
"core/java/android/os/IDeviceIdentifiersPolicyService.aidl",
|
||||||
"core/java/android/os/IDeviceIdleController.aidl",
|
"core/java/android/os/IDeviceIdleController.aidl",
|
||||||
"core/java/android/os/IDynamicAndroidService.aidl",
|
|
||||||
"core/java/android/os/IHardwarePropertiesManager.aidl",
|
"core/java/android/os/IHardwarePropertiesManager.aidl",
|
||||||
":libincident_aidl",
|
":libincident_aidl",
|
||||||
"core/java/android/os/IMaintenanceActivityListener.aidl",
|
"core/java/android/os/IMaintenanceActivityListener.aidl",
|
||||||
@@ -242,16 +267,23 @@ java_defaults {
|
|||||||
":statsd_aidl",
|
":statsd_aidl",
|
||||||
"core/java/android/os/ISystemUpdateManager.aidl",
|
"core/java/android/os/ISystemUpdateManager.aidl",
|
||||||
"core/java/android/os/IThermalEventListener.aidl",
|
"core/java/android/os/IThermalEventListener.aidl",
|
||||||
|
"core/java/android/os/IThermalStatusListener.aidl",
|
||||||
"core/java/android/os/IThermalService.aidl",
|
"core/java/android/os/IThermalService.aidl",
|
||||||
"core/java/android/os/IUpdateLock.aidl",
|
"core/java/android/os/IUpdateLock.aidl",
|
||||||
"core/java/android/os/IUserManager.aidl",
|
"core/java/android/os/IUserManager.aidl",
|
||||||
|
":libvibrator_aidl",
|
||||||
"core/java/android/os/IVibratorService.aidl",
|
"core/java/android/os/IVibratorService.aidl",
|
||||||
|
"core/java/android/os/image/IDynamicSystemService.aidl",
|
||||||
"core/java/android/os/storage/IStorageManager.aidl",
|
"core/java/android/os/storage/IStorageManager.aidl",
|
||||||
"core/java/android/os/storage/IStorageEventListener.aidl",
|
"core/java/android/os/storage/IStorageEventListener.aidl",
|
||||||
"core/java/android/os/storage/IStorageShutdownObserver.aidl",
|
"core/java/android/os/storage/IStorageShutdownObserver.aidl",
|
||||||
"core/java/android/os/storage/IObbActionListener.aidl",
|
"core/java/android/os/storage/IObbActionListener.aidl",
|
||||||
|
"core/java/android/permission/IPermissionController.aidl",
|
||||||
":keystore_aidl",
|
":keystore_aidl",
|
||||||
"core/java/android/security/keymaster/IKeyAttestationApplicationIdProvider.aidl",
|
"core/java/android/security/keymaster/IKeyAttestationApplicationIdProvider.aidl",
|
||||||
|
"core/java/android/service/appprediction/IPredictionService.aidl",
|
||||||
|
"core/java/android/service/autofill/augmented/IAugmentedAutofillService.aidl",
|
||||||
|
"core/java/android/service/autofill/augmented/IFillCallback.aidl",
|
||||||
"core/java/android/service/autofill/IAutoFillService.aidl",
|
"core/java/android/service/autofill/IAutoFillService.aidl",
|
||||||
"core/java/android/service/autofill/IAutofillFieldClassificationService.aidl",
|
"core/java/android/service/autofill/IAutofillFieldClassificationService.aidl",
|
||||||
"core/java/android/service/autofill/IFillCallback.aidl",
|
"core/java/android/service/autofill/IFillCallback.aidl",
|
||||||
@@ -259,6 +291,8 @@ java_defaults {
|
|||||||
"core/java/android/service/carrier/ICarrierService.aidl",
|
"core/java/android/service/carrier/ICarrierService.aidl",
|
||||||
"core/java/android/service/carrier/ICarrierMessagingCallback.aidl",
|
"core/java/android/service/carrier/ICarrierMessagingCallback.aidl",
|
||||||
"core/java/android/service/carrier/ICarrierMessagingService.aidl",
|
"core/java/android/service/carrier/ICarrierMessagingService.aidl",
|
||||||
|
"core/java/android/service/carrier/ICarrierMessagingClientService.aidl",
|
||||||
|
"core/java/android/service/contentsuggestions/IContentSuggestionsService.aidl",
|
||||||
"core/java/android/service/euicc/IDeleteSubscriptionCallback.aidl",
|
"core/java/android/service/euicc/IDeleteSubscriptionCallback.aidl",
|
||||||
"core/java/android/service/euicc/IDownloadSubscriptionCallback.aidl",
|
"core/java/android/service/euicc/IDownloadSubscriptionCallback.aidl",
|
||||||
"core/java/android/service/euicc/IEraseSubscriptionsCallback.aidl",
|
"core/java/android/service/euicc/IEraseSubscriptionsCallback.aidl",
|
||||||
@@ -274,15 +308,20 @@ java_defaults {
|
|||||||
"core/java/android/service/euicc/ISwitchToSubscriptionCallback.aidl",
|
"core/java/android/service/euicc/ISwitchToSubscriptionCallback.aidl",
|
||||||
"core/java/android/service/euicc/IUpdateSubscriptionNicknameCallback.aidl",
|
"core/java/android/service/euicc/IUpdateSubscriptionNicknameCallback.aidl",
|
||||||
":gatekeeper_aidl",
|
":gatekeeper_aidl",
|
||||||
|
"core/java/android/service/contentcapture/IContentCaptureService.aidl",
|
||||||
|
"core/java/android/service/contentcapture/IContentCaptureServiceCallback.aidl",
|
||||||
"core/java/android/service/notification/INotificationListener.aidl",
|
"core/java/android/service/notification/INotificationListener.aidl",
|
||||||
"core/java/android/service/notification/IStatusBarNotificationHolder.aidl",
|
"core/java/android/service/notification/IStatusBarNotificationHolder.aidl",
|
||||||
"core/java/android/service/notification/IConditionListener.aidl",
|
"core/java/android/service/notification/IConditionListener.aidl",
|
||||||
"core/java/android/service/notification/IConditionProvider.aidl",
|
"core/java/android/service/notification/IConditionProvider.aidl",
|
||||||
"core/java/android/service/settings/suggestions/ISuggestionService.aidl",
|
"core/java/android/service/settings/suggestions/ISuggestionService.aidl",
|
||||||
|
"core/java/android/service/sms/IFinancialSmsService.aidl",
|
||||||
"core/java/android/service/vr/IPersistentVrStateCallbacks.aidl",
|
"core/java/android/service/vr/IPersistentVrStateCallbacks.aidl",
|
||||||
"core/java/android/service/vr/IVrListener.aidl",
|
"core/java/android/service/vr/IVrListener.aidl",
|
||||||
"core/java/android/service/vr/IVrManager.aidl",
|
"core/java/android/service/vr/IVrManager.aidl",
|
||||||
"core/java/android/service/vr/IVrStateCallbacks.aidl",
|
"core/java/android/service/vr/IVrStateCallbacks.aidl",
|
||||||
|
"core/java/android/service/watchdog/IExplicitHealthCheckService.aidl",
|
||||||
|
"core/java/android/service/watchdog/PackageConfig.aidl",
|
||||||
"core/java/android/print/ILayoutResultCallback.aidl",
|
"core/java/android/print/ILayoutResultCallback.aidl",
|
||||||
"core/java/android/print/IPrinterDiscoveryObserver.aidl",
|
"core/java/android/print/IPrinterDiscoveryObserver.aidl",
|
||||||
"core/java/android/print/IPrintDocumentAdapter.aidl",
|
"core/java/android/print/IPrintDocumentAdapter.aidl",
|
||||||
@@ -319,22 +358,27 @@ java_defaults {
|
|||||||
"core/java/android/service/chooser/IChooserTargetResult.aidl",
|
"core/java/android/service/chooser/IChooserTargetResult.aidl",
|
||||||
"core/java/android/service/resolver/IResolverRankerService.aidl",
|
"core/java/android/service/resolver/IResolverRankerService.aidl",
|
||||||
"core/java/android/service/resolver/IResolverRankerResult.aidl",
|
"core/java/android/service/resolver/IResolverRankerResult.aidl",
|
||||||
"core/java/android/service/textclassifier/ITextClassificationCallback.aidl",
|
"core/java/android/service/textclassifier/ITextClassifierCallback.aidl",
|
||||||
"core/java/android/service/textclassifier/ITextClassifierService.aidl",
|
"core/java/android/service/textclassifier/ITextClassifierService.aidl",
|
||||||
"core/java/android/service/textclassifier/ITextLinksCallback.aidl",
|
"core/java/android/service/attention/IAttentionService.aidl",
|
||||||
"core/java/android/service/textclassifier/ITextSelectionCallback.aidl",
|
"core/java/android/service/attention/IAttentionCallback.aidl",
|
||||||
"core/java/android/view/accessibility/IAccessibilityInteractionConnection.aidl",
|
"core/java/android/view/accessibility/IAccessibilityInteractionConnection.aidl",
|
||||||
"core/java/android/view/accessibility/IAccessibilityInteractionConnectionCallback.aidl",
|
"core/java/android/view/accessibility/IAccessibilityInteractionConnectionCallback.aidl",
|
||||||
"core/java/android/view/accessibility/IAccessibilityManager.aidl",
|
"core/java/android/view/accessibility/IAccessibilityManager.aidl",
|
||||||
"core/java/android/view/accessibility/IAccessibilityManagerClient.aidl",
|
"core/java/android/view/accessibility/IAccessibilityManagerClient.aidl",
|
||||||
"core/java/android/view/autofill/IAutoFillManager.aidl",
|
"core/java/android/view/autofill/IAutoFillManager.aidl",
|
||||||
"core/java/android/view/autofill/IAutoFillManagerClient.aidl",
|
"core/java/android/view/autofill/IAutoFillManagerClient.aidl",
|
||||||
|
"core/java/android/view/autofill/IAugmentedAutofillManagerClient.aidl",
|
||||||
"core/java/android/view/autofill/IAutofillWindowPresenter.aidl",
|
"core/java/android/view/autofill/IAutofillWindowPresenter.aidl",
|
||||||
|
"core/java/android/view/contentcapture/IContentCaptureDirectManager.aidl",
|
||||||
|
"core/java/android/view/contentcapture/IContentCaptureManager.aidl",
|
||||||
"core/java/android/view/IApplicationToken.aidl",
|
"core/java/android/view/IApplicationToken.aidl",
|
||||||
"core/java/android/view/IAppTransitionAnimationSpecsFuture.aidl",
|
"core/java/android/view/IAppTransitionAnimationSpecsFuture.aidl",
|
||||||
"core/java/android/view/IDockedStackListener.aidl",
|
"core/java/android/view/IDockedStackListener.aidl",
|
||||||
|
"core/java/android/view/IDisplayFoldListener.aidl",
|
||||||
"core/java/android/view/IGraphicsStats.aidl",
|
"core/java/android/view/IGraphicsStats.aidl",
|
||||||
"core/java/android/view/IGraphicsStatsCallback.aidl",
|
"core/java/android/view/IGraphicsStatsCallback.aidl",
|
||||||
|
"core/java/android/view/IInputMonitorHost.aidl",
|
||||||
"core/java/android/view/IInputFilter.aidl",
|
"core/java/android/view/IInputFilter.aidl",
|
||||||
"core/java/android/view/IInputFilterHost.aidl",
|
"core/java/android/view/IInputFilterHost.aidl",
|
||||||
"core/java/android/view/IOnKeyguardExitResult.aidl",
|
"core/java/android/view/IOnKeyguardExitResult.aidl",
|
||||||
@@ -345,6 +389,7 @@ java_defaults {
|
|||||||
"core/java/android/view/IRecentsAnimationRunner.aidl",
|
"core/java/android/view/IRecentsAnimationRunner.aidl",
|
||||||
"core/java/android/view/IRemoteAnimationFinishedCallback.aidl",
|
"core/java/android/view/IRemoteAnimationFinishedCallback.aidl",
|
||||||
"core/java/android/view/IRotationWatcher.aidl",
|
"core/java/android/view/IRotationWatcher.aidl",
|
||||||
|
"core/java/android/view/ISystemGestureExclusionListener.aidl",
|
||||||
"core/java/android/view/IWallpaperVisibilityListener.aidl",
|
"core/java/android/view/IWallpaperVisibilityListener.aidl",
|
||||||
"core/java/android/view/IWindow.aidl",
|
"core/java/android/view/IWindow.aidl",
|
||||||
"core/java/android/view/IWindowFocusObserver.aidl",
|
"core/java/android/view/IWindowFocusObserver.aidl",
|
||||||
@@ -359,9 +404,11 @@ java_defaults {
|
|||||||
"core/java/android/speech/tts/ITextToSpeechService.aidl",
|
"core/java/android/speech/tts/ITextToSpeechService.aidl",
|
||||||
"core/java/com/android/internal/app/IAppOpsActiveCallback.aidl",
|
"core/java/com/android/internal/app/IAppOpsActiveCallback.aidl",
|
||||||
"core/java/com/android/internal/app/IAppOpsCallback.aidl",
|
"core/java/com/android/internal/app/IAppOpsCallback.aidl",
|
||||||
|
"core/java/com/android/internal/app/IAppOpsNotedCallback.aidl",
|
||||||
"core/java/com/android/internal/app/IAppOpsService.aidl",
|
"core/java/com/android/internal/app/IAppOpsService.aidl",
|
||||||
"core/java/com/android/internal/app/IBatteryStats.aidl",
|
"core/java/com/android/internal/app/IBatteryStats.aidl",
|
||||||
"core/java/com/android/internal/app/ISoundTriggerService.aidl",
|
"core/java/com/android/internal/app/ISoundTriggerService.aidl",
|
||||||
|
"core/java/com/android/internal/app/IVoiceActionCheckCallback.aidl",
|
||||||
"core/java/com/android/internal/app/IVoiceInteractionManagerService.aidl",
|
"core/java/com/android/internal/app/IVoiceInteractionManagerService.aidl",
|
||||||
"core/java/com/android/internal/app/IVoiceInteractionSessionListener.aidl",
|
"core/java/com/android/internal/app/IVoiceInteractionSessionListener.aidl",
|
||||||
"core/java/com/android/internal/app/IVoiceInteractionSessionShowCallback.aidl",
|
"core/java/com/android/internal/app/IVoiceInteractionSessionShowCallback.aidl",
|
||||||
@@ -375,6 +422,10 @@ java_defaults {
|
|||||||
"core/java/com/android/internal/backup/IBackupTransport.aidl",
|
"core/java/com/android/internal/backup/IBackupTransport.aidl",
|
||||||
"core/java/com/android/internal/backup/IObbBackupService.aidl",
|
"core/java/com/android/internal/backup/IObbBackupService.aidl",
|
||||||
"core/java/com/android/internal/inputmethod/IInputContentUriToken.aidl",
|
"core/java/com/android/internal/inputmethod/IInputContentUriToken.aidl",
|
||||||
|
"core/java/com/android/internal/inputmethod/IInputMethodPrivilegedOperations.aidl",
|
||||||
|
"core/java/com/android/internal/inputmethod/IMultiClientInputMethod.aidl",
|
||||||
|
"core/java/com/android/internal/inputmethod/IMultiClientInputMethodPrivilegedOperations.aidl",
|
||||||
|
"core/java/com/android/internal/inputmethod/IMultiClientInputMethodSession.aidl",
|
||||||
"core/java/com/android/internal/net/INetworkWatchlistManager.aidl",
|
"core/java/com/android/internal/net/INetworkWatchlistManager.aidl",
|
||||||
"core/java/com/android/internal/policy/IKeyguardDrawnCallback.aidl",
|
"core/java/com/android/internal/policy/IKeyguardDrawnCallback.aidl",
|
||||||
"core/java/com/android/internal/policy/IKeyguardDismissCallback.aidl",
|
"core/java/com/android/internal/policy/IKeyguardDismissCallback.aidl",
|
||||||
@@ -388,6 +439,7 @@ java_defaults {
|
|||||||
"core/java/com/android/internal/os/IShellCallback.aidl",
|
"core/java/com/android/internal/os/IShellCallback.aidl",
|
||||||
"core/java/com/android/internal/statusbar/IStatusBar.aidl",
|
"core/java/com/android/internal/statusbar/IStatusBar.aidl",
|
||||||
"core/java/com/android/internal/statusbar/IStatusBarService.aidl",
|
"core/java/com/android/internal/statusbar/IStatusBarService.aidl",
|
||||||
|
"core/java/com/android/internal/statusbar/RegisterStatusBarResult.aidl",
|
||||||
"core/java/com/android/internal/textservice/ISpellCheckerService.aidl",
|
"core/java/com/android/internal/textservice/ISpellCheckerService.aidl",
|
||||||
"core/java/com/android/internal/textservice/ISpellCheckerServiceCallback.aidl",
|
"core/java/com/android/internal/textservice/ISpellCheckerServiceCallback.aidl",
|
||||||
"core/java/com/android/internal/textservice/ISpellCheckerSession.aidl",
|
"core/java/com/android/internal/textservice/ISpellCheckerSession.aidl",
|
||||||
@@ -413,7 +465,6 @@ java_defaults {
|
|||||||
"location/java/android/location/IGeocodeProvider.aidl",
|
"location/java/android/location/IGeocodeProvider.aidl",
|
||||||
"location/java/android/location/IGeofenceProvider.aidl",
|
"location/java/android/location/IGeofenceProvider.aidl",
|
||||||
"location/java/android/location/IGnssStatusListener.aidl",
|
"location/java/android/location/IGnssStatusListener.aidl",
|
||||||
"location/java/android/location/IGnssStatusProvider.aidl",
|
|
||||||
"location/java/android/location/IGnssMeasurementsListener.aidl",
|
"location/java/android/location/IGnssMeasurementsListener.aidl",
|
||||||
"location/java/android/location/IGnssNavigationMessageListener.aidl",
|
"location/java/android/location/IGnssNavigationMessageListener.aidl",
|
||||||
"location/java/android/location/ILocationListener.aidl",
|
"location/java/android/location/ILocationListener.aidl",
|
||||||
@@ -422,6 +473,7 @@ java_defaults {
|
|||||||
"location/java/android/location/IGpsGeofenceHardware.aidl",
|
"location/java/android/location/IGpsGeofenceHardware.aidl",
|
||||||
"location/java/android/location/INetInitiatedListener.aidl",
|
"location/java/android/location/INetInitiatedListener.aidl",
|
||||||
"location/java/com/android/internal/location/ILocationProvider.aidl",
|
"location/java/com/android/internal/location/ILocationProvider.aidl",
|
||||||
|
"location/java/com/android/internal/location/ILocationProviderManager.aidl",
|
||||||
"media/java/android/media/IAudioFocusDispatcher.aidl",
|
"media/java/android/media/IAudioFocusDispatcher.aidl",
|
||||||
"media/java/android/media/IAudioRoutesObserver.aidl",
|
"media/java/android/media/IAudioRoutesObserver.aidl",
|
||||||
"media/java/android/media/IAudioService.aidl",
|
"media/java/android/media/IAudioService.aidl",
|
||||||
@@ -434,7 +486,6 @@ java_defaults {
|
|||||||
"media/java/android/media/IMediaScannerListener.aidl",
|
"media/java/android/media/IMediaScannerListener.aidl",
|
||||||
"media/java/android/media/IMediaScannerService.aidl",
|
"media/java/android/media/IMediaScannerService.aidl",
|
||||||
"media/java/android/media/IPlaybackConfigDispatcher.aidl",
|
"media/java/android/media/IPlaybackConfigDispatcher.aidl",
|
||||||
"media/java/android/media/ISessionTokensListener.aidl",
|
|
||||||
":libaudioclient_aidl",
|
":libaudioclient_aidl",
|
||||||
"media/java/android/media/IRecordingConfigDispatcher.aidl",
|
"media/java/android/media/IRecordingConfigDispatcher.aidl",
|
||||||
"media/java/android/media/IRemoteDisplayCallback.aidl",
|
"media/java/android/media/IRemoteDisplayCallback.aidl",
|
||||||
@@ -458,6 +509,7 @@ java_defaults {
|
|||||||
"media/java/android/media/session/IOnMediaKeyListener.aidl",
|
"media/java/android/media/session/IOnMediaKeyListener.aidl",
|
||||||
"media/java/android/media/session/IOnVolumeKeyLongPressListener.aidl",
|
"media/java/android/media/session/IOnVolumeKeyLongPressListener.aidl",
|
||||||
"media/java/android/media/session/ISession.aidl",
|
"media/java/android/media/session/ISession.aidl",
|
||||||
|
"media/java/android/media/session/ISession2TokensListener.aidl",
|
||||||
"media/java/android/media/session/ISessionCallback.aidl",
|
"media/java/android/media/session/ISessionCallback.aidl",
|
||||||
"media/java/android/media/session/ISessionController.aidl",
|
"media/java/android/media/session/ISessionController.aidl",
|
||||||
"media/java/android/media/session/ISessionControllerCallback.aidl",
|
"media/java/android/media/session/ISessionControllerCallback.aidl",
|
||||||
@@ -519,6 +571,7 @@ java_defaults {
|
|||||||
"telephony/java/android/telephony/mbms/vendor/IMbmsStreamingService.aidl",
|
"telephony/java/android/telephony/mbms/vendor/IMbmsStreamingService.aidl",
|
||||||
"telephony/java/android/telephony/mbms/vendor/IMbmsGroupCallService.aidl",
|
"telephony/java/android/telephony/mbms/vendor/IMbmsGroupCallService.aidl",
|
||||||
"telephony/java/android/telephony/ICellInfoCallback.aidl",
|
"telephony/java/android/telephony/ICellInfoCallback.aidl",
|
||||||
|
"telephony/java/android/telephony/IFinancialSmsCallback.aidl",
|
||||||
"telephony/java/android/telephony/INetworkService.aidl",
|
"telephony/java/android/telephony/INetworkService.aidl",
|
||||||
"telephony/java/android/telephony/INetworkServiceCallback.aidl",
|
"telephony/java/android/telephony/INetworkServiceCallback.aidl",
|
||||||
"telephony/java/com/android/ims/internal/IImsCallSession.aidl",
|
"telephony/java/com/android/ims/internal/IImsCallSession.aidl",
|
||||||
@@ -587,8 +640,12 @@ java_defaults {
|
|||||||
"telephony/java/com/android/internal/telephony/euicc/ISetDefaultSmdpAddressCallback.aidl",
|
"telephony/java/com/android/internal/telephony/euicc/ISetDefaultSmdpAddressCallback.aidl",
|
||||||
"telephony/java/com/android/internal/telephony/euicc/ISetNicknameCallback.aidl",
|
"telephony/java/com/android/internal/telephony/euicc/ISetNicknameCallback.aidl",
|
||||||
"telephony/java/com/android/internal/telephony/euicc/ISwitchToProfileCallback.aidl",
|
"telephony/java/com/android/internal/telephony/euicc/ISwitchToProfileCallback.aidl",
|
||||||
|
"wifi/java/android/net/wifi/INetworkRequestMatchCallback.aidl",
|
||||||
|
"wifi/java/android/net/wifi/INetworkRequestUserSelectionCallback.aidl",
|
||||||
"wifi/java/android/net/wifi/ISoftApCallback.aidl",
|
"wifi/java/android/net/wifi/ISoftApCallback.aidl",
|
||||||
|
"wifi/java/android/net/wifi/ITrafficStateCallback.aidl",
|
||||||
"wifi/java/android/net/wifi/IWifiManager.aidl",
|
"wifi/java/android/net/wifi/IWifiManager.aidl",
|
||||||
|
"wifi/java/android/net/wifi/IOnWifiUsabilityStatsListener.aidl",
|
||||||
"wifi/java/android/net/wifi/aware/IWifiAwareDiscoverySessionCallback.aidl",
|
"wifi/java/android/net/wifi/aware/IWifiAwareDiscoverySessionCallback.aidl",
|
||||||
"wifi/java/android/net/wifi/aware/IWifiAwareEventCallback.aidl",
|
"wifi/java/android/net/wifi/aware/IWifiAwareEventCallback.aidl",
|
||||||
"wifi/java/android/net/wifi/aware/IWifiAwareMacAddressProvider.aidl",
|
"wifi/java/android/net/wifi/aware/IWifiAwareMacAddressProvider.aidl",
|
||||||
@@ -597,6 +654,7 @@ java_defaults {
|
|||||||
"wifi/java/android/net/wifi/rtt/IRttCallback.aidl",
|
"wifi/java/android/net/wifi/rtt/IRttCallback.aidl",
|
||||||
"wifi/java/android/net/wifi/rtt/IWifiRttManager.aidl",
|
"wifi/java/android/net/wifi/rtt/IWifiRttManager.aidl",
|
||||||
"wifi/java/android/net/wifi/hotspot2/IProvisioningCallback.aidl",
|
"wifi/java/android/net/wifi/hotspot2/IProvisioningCallback.aidl",
|
||||||
|
"wifi/java/android/net/wifi/IDppCallback.aidl",
|
||||||
"wifi/java/android/net/wifi/IWifiScanner.aidl",
|
"wifi/java/android/net/wifi/IWifiScanner.aidl",
|
||||||
"packages/services/PacProcessor/com/android/net/IProxyService.aidl",
|
"packages/services/PacProcessor/com/android/net/IProxyService.aidl",
|
||||||
"packages/services/Proxy/com/android/net/IProxyCallback.aidl",
|
"packages/services/Proxy/com/android/net/IProxyCallback.aidl",
|
||||||
@@ -611,6 +669,7 @@ java_defaults {
|
|||||||
":gsiservice_aidl",
|
":gsiservice_aidl",
|
||||||
":installd_aidl",
|
":installd_aidl",
|
||||||
":dumpstate_aidl",
|
":dumpstate_aidl",
|
||||||
|
":incidentcompanion_aidl",
|
||||||
|
|
||||||
"lowpan/java/android/net/lowpan/ILowpanEnergyScanCallback.aidl",
|
"lowpan/java/android/net/lowpan/ILowpanEnergyScanCallback.aidl",
|
||||||
"lowpan/java/android/net/lowpan/ILowpanNetScanCallback.aidl",
|
"lowpan/java/android/net/lowpan/ILowpanNetScanCallback.aidl",
|
||||||
@@ -630,6 +689,7 @@ java_defaults {
|
|||||||
"core/java/com/android/server/DropboxLogTags.logtags",
|
"core/java/com/android/server/DropboxLogTags.logtags",
|
||||||
"core/java/org/chromium/arc/EventLogTags.logtags",
|
"core/java/org/chromium/arc/EventLogTags.logtags",
|
||||||
|
|
||||||
|
":apex-properties",
|
||||||
":platform-properties",
|
":platform-properties",
|
||||||
|
|
||||||
":framework-statslog-gen",
|
":framework-statslog-gen",
|
||||||
@@ -643,6 +703,7 @@ java_defaults {
|
|||||||
"location/java",
|
"location/java",
|
||||||
"lowpan/java",
|
"lowpan/java",
|
||||||
"media/java",
|
"media/java",
|
||||||
|
"media/apex/java",
|
||||||
"media/mca/effect/java",
|
"media/mca/effect/java",
|
||||||
"media/mca/filterfw/java",
|
"media/mca/filterfw/java",
|
||||||
"media/mca/filterpacks/java",
|
"media/mca/filterpacks/java",
|
||||||
@@ -660,9 +721,11 @@ java_defaults {
|
|||||||
"system/update_engine/binder_bindings",
|
"system/update_engine/binder_bindings",
|
||||||
"frameworks/native/aidl/binder",
|
"frameworks/native/aidl/binder",
|
||||||
"frameworks/native/cmds/dumpstate/binder",
|
"frameworks/native/cmds/dumpstate/binder",
|
||||||
|
"frameworks/native/libs/incidentcompanion/binder",
|
||||||
"frameworks/av/camera/aidl",
|
"frameworks/av/camera/aidl",
|
||||||
"frameworks/av/media/libaudioclient/aidl",
|
"frameworks/av/media/libaudioclient/aidl",
|
||||||
"frameworks/native/aidl/gui",
|
"frameworks/native/aidl/gui",
|
||||||
|
"frameworks/native/libs/incidentcompanion/binder",
|
||||||
"system/core/gatekeeperd/binder",
|
"system/core/gatekeeperd/binder",
|
||||||
"system/core/storaged/binder",
|
"system/core/storaged/binder",
|
||||||
"system/vold/binder",
|
"system/vold/binder",
|
||||||
@@ -682,6 +745,7 @@ java_defaults {
|
|||||||
sdk_version: "core_platform",
|
sdk_version: "core_platform",
|
||||||
libs: [
|
libs: [
|
||||||
"ext",
|
"ext",
|
||||||
|
"updatable_media_stubs",
|
||||||
],
|
],
|
||||||
|
|
||||||
jarjar_rules: ":framework-jarjar-rules",
|
jarjar_rules: ":framework-jarjar-rules",
|
||||||
@@ -692,6 +756,7 @@ java_defaults {
|
|||||||
"framework-protos",
|
"framework-protos",
|
||||||
"game-driver-protos",
|
"game-driver-protos",
|
||||||
"android.hidl.base-V1.0-java",
|
"android.hidl.base-V1.0-java",
|
||||||
|
"android.hardware.cas-V1.1-java",
|
||||||
"android.hardware.cas-V1.0-java",
|
"android.hardware.cas-V1.0-java",
|
||||||
"android.hardware.contexthub-V1.0-java",
|
"android.hardware.contexthub-V1.0-java",
|
||||||
"android.hardware.health-V1.0-java-constants",
|
"android.hardware.health-V1.0-java-constants",
|
||||||
@@ -701,21 +766,25 @@ java_defaults {
|
|||||||
"android.hardware.radio-V1.3-java",
|
"android.hardware.radio-V1.3-java",
|
||||||
"android.hardware.radio-V1.4-java",
|
"android.hardware.radio-V1.4-java",
|
||||||
"android.hardware.thermal-V1.0-java-constants",
|
"android.hardware.thermal-V1.0-java-constants",
|
||||||
|
"android.hardware.thermal-V1.0-java",
|
||||||
|
"android.hardware.thermal-V1.1-java",
|
||||||
|
"android.hardware.thermal-V2.0-java",
|
||||||
"android.hardware.tv.input-V1.0-java-constants",
|
"android.hardware.tv.input-V1.0-java-constants",
|
||||||
"android.hardware.usb-V1.0-java-constants",
|
"android.hardware.usb-V1.0-java-constants",
|
||||||
"android.hardware.usb-V1.1-java-constants",
|
"android.hardware.usb-V1.1-java-constants",
|
||||||
|
"android.hardware.usb-V1.2-java-constants",
|
||||||
"android.hardware.usb.gadget-V1.0-java",
|
"android.hardware.usb.gadget-V1.0-java",
|
||||||
"android.hardware.vibrator-V1.0-java",
|
"android.hardware.vibrator-V1.0-java",
|
||||||
"android.hardware.vibrator-V1.1-java",
|
"android.hardware.vibrator-V1.1-java",
|
||||||
"android.hardware.vibrator-V1.2-java",
|
"android.hardware.vibrator-V1.2-java",
|
||||||
|
"android.hardware.vibrator-V1.3-java",
|
||||||
"android.hardware.wifi-V1.0-java-constants",
|
"android.hardware.wifi-V1.0-java-constants",
|
||||||
|
"devicepolicyprotosnano",
|
||||||
],
|
],
|
||||||
|
|
||||||
required: [
|
required: [
|
||||||
// TODO: remove gps_debug when the build system propagates "required" properly.
|
// TODO: remove gps_debug when the build system propagates "required" properly.
|
||||||
"gps_debug.conf",
|
"gps_debug.conf",
|
||||||
// Loaded with System.loadLibrary by android.view.textclassifier
|
|
||||||
"libmedia2_jni",
|
|
||||||
],
|
],
|
||||||
|
|
||||||
dxflags: [
|
dxflags: [
|
||||||
@@ -723,6 +792,7 @@ java_defaults {
|
|||||||
"--multi-dex",
|
"--multi-dex",
|
||||||
],
|
],
|
||||||
|
|
||||||
|
plugins: ["view-inspector-annotation-processor"],
|
||||||
}
|
}
|
||||||
|
|
||||||
filegroup {
|
filegroup {
|
||||||
@@ -744,6 +814,16 @@ filegroup {
|
|||||||
srcs: [
|
srcs: [
|
||||||
"core/java/android/os/IStatsCompanionService.aidl",
|
"core/java/android/os/IStatsCompanionService.aidl",
|
||||||
"core/java/android/os/IStatsManager.aidl",
|
"core/java/android/os/IStatsManager.aidl",
|
||||||
|
"core/java/android/os/IStatsPullerCallback.aidl",
|
||||||
|
],
|
||||||
|
path: "core/java",
|
||||||
|
}
|
||||||
|
|
||||||
|
filegroup {
|
||||||
|
name: "libvibrator_aidl",
|
||||||
|
srcs: [
|
||||||
|
"core/java/android/os/IExternalVibrationController.aidl",
|
||||||
|
"core/java/android/os/IExternalVibratorService.aidl",
|
||||||
],
|
],
|
||||||
path: "core/java",
|
path: "core/java",
|
||||||
}
|
}
|
||||||
@@ -887,9 +967,9 @@ java_library_host {
|
|||||||
name: "platformprotos",
|
name: "platformprotos",
|
||||||
srcs: [
|
srcs: [
|
||||||
"cmds/am/proto/instrumentation_data.proto",
|
"cmds/am/proto/instrumentation_data.proto",
|
||||||
|
"cmds/statsd/src/**/*.proto",
|
||||||
"core/proto/**/*.proto",
|
"core/proto/**/*.proto",
|
||||||
"libs/incident/proto/**/*.proto",
|
"libs/incident/proto/**/*.proto",
|
||||||
"cmds/statsd/src/**/*.proto",
|
|
||||||
],
|
],
|
||||||
proto: {
|
proto: {
|
||||||
include_dirs: ["external/protobuf/src"],
|
include_dirs: ["external/protobuf/src"],
|
||||||
@@ -908,7 +988,10 @@ java_library {
|
|||||||
output_params: ["store_unknown_fields=true"],
|
output_params: ["store_unknown_fields=true"],
|
||||||
include_dirs: ["external/protobuf/src"],
|
include_dirs: ["external/protobuf/src"],
|
||||||
},
|
},
|
||||||
|
exclude_srcs: [
|
||||||
|
"core/proto/android/privacy.proto",
|
||||||
|
"core/proto/android/section.proto",
|
||||||
|
],
|
||||||
sdk_version: "current",
|
sdk_version: "current",
|
||||||
srcs: [
|
srcs: [
|
||||||
"core/proto/**/*.proto",
|
"core/proto/**/*.proto",
|
||||||
@@ -928,6 +1011,10 @@ java_library {
|
|||||||
"core/proto/**/*.proto",
|
"core/proto/**/*.proto",
|
||||||
"libs/incident/proto/android/os/**/*.proto",
|
"libs/incident/proto/android/os/**/*.proto",
|
||||||
],
|
],
|
||||||
|
exclude_srcs: [
|
||||||
|
"core/proto/android/privacy.proto",
|
||||||
|
"core/proto/android/section.proto",
|
||||||
|
],
|
||||||
// Protos have lots of MissingOverride and similar.
|
// Protos have lots of MissingOverride and similar.
|
||||||
errorprone: {
|
errorprone: {
|
||||||
javacflags: ["-XepDisableAllChecks"],
|
javacflags: ["-XepDisableAllChecks"],
|
||||||
@@ -935,9 +1022,9 @@ java_library {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ==== c++ proto device library ==============================
|
// ==== c++ proto device library ==============================
|
||||||
cc_library {
|
cc_defaults {
|
||||||
name: "libplatformprotos",
|
name: "libplatformprotos-defaults",
|
||||||
host_supported: true,
|
|
||||||
proto: {
|
proto: {
|
||||||
export_proto_headers: true,
|
export_proto_headers: true,
|
||||||
include_dirs: ["external/protobuf/src"],
|
include_dirs: ["external/protobuf/src"],
|
||||||
@@ -951,8 +1038,13 @@ cc_library {
|
|||||||
|
|
||||||
srcs: [
|
srcs: [
|
||||||
"core/proto/**/*.proto",
|
"core/proto/**/*.proto",
|
||||||
"libs/incident/**/*.proto",
|
|
||||||
],
|
],
|
||||||
|
}
|
||||||
|
|
||||||
|
cc_library {
|
||||||
|
name: "libplatformprotos",
|
||||||
|
defaults: ["libplatformprotos-defaults"],
|
||||||
|
host_supported: true,
|
||||||
|
|
||||||
target: {
|
target: {
|
||||||
host: {
|
host: {
|
||||||
@@ -964,6 +1056,9 @@ cc_library {
|
|||||||
proto: {
|
proto: {
|
||||||
type: "lite",
|
type: "lite",
|
||||||
},
|
},
|
||||||
|
shared_libs: [
|
||||||
|
"libprotobuf-cpp-lite",
|
||||||
|
],
|
||||||
shared: {
|
shared: {
|
||||||
enabled: false,
|
enabled: false,
|
||||||
},
|
},
|
||||||
@@ -971,6 +1066,55 @@ cc_library {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This library is meant for vendor code that needs to output protobuf. It links
|
||||||
|
// against the static version of libprotobuf-cpp-lite, for which we can not guarantee
|
||||||
|
// binary compatibility.
|
||||||
|
cc_library {
|
||||||
|
name: "libplatformprotos-static",
|
||||||
|
defaults: ["libplatformprotos-defaults"],
|
||||||
|
host_supported: false,
|
||||||
|
|
||||||
|
// This is okay because this library is only built as a static library. The C++
|
||||||
|
// API is not guaranteed. The proto API is guaranteed to be stable via Metrics Council,
|
||||||
|
// but is not authorized to be used outside of debugging.
|
||||||
|
vendor_available: true,
|
||||||
|
|
||||||
|
target: {
|
||||||
|
android: {
|
||||||
|
proto: {
|
||||||
|
type: "lite",
|
||||||
|
},
|
||||||
|
static_libs: [
|
||||||
|
"libprotobuf-cpp-lite",
|
||||||
|
],
|
||||||
|
shared: {
|
||||||
|
enabled: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// This is the full proto version of libplatformprotos. It may only
|
||||||
|
// be used by test code that is not shipped on the device.
|
||||||
|
cc_library {
|
||||||
|
name: "libplatformprotos-test",
|
||||||
|
defaults: ["libplatformprotos-defaults"],
|
||||||
|
host_supported: false,
|
||||||
|
|
||||||
|
target: {
|
||||||
|
android: {
|
||||||
|
proto: {
|
||||||
|
type: "full",
|
||||||
|
},
|
||||||
|
shared: {
|
||||||
|
enabled: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
gensrcs {
|
gensrcs {
|
||||||
name: "gen-platform-proto-constants",
|
name: "gen-platform-proto-constants",
|
||||||
depfile: true,
|
depfile: true,
|
||||||
@@ -1008,6 +1152,7 @@ gensrcs {
|
|||||||
output_extension: "proto.h",
|
output_extension: "proto.h",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
subdirs = [
|
subdirs = [
|
||||||
"cmds/*",
|
"cmds/*",
|
||||||
"core/*",
|
"core/*",
|
||||||
@@ -1210,6 +1355,7 @@ stubs_defaults {
|
|||||||
":opt-telephony-srcs",
|
":opt-telephony-srcs",
|
||||||
":opt-net-voip-srcs",
|
":opt-net-voip-srcs",
|
||||||
":core_public_api_files",
|
":core_public_api_files",
|
||||||
|
":updatable-media-srcs-without-aidls",
|
||||||
"test-mock/src/**/*.java",
|
"test-mock/src/**/*.java",
|
||||||
"test-runner/src/**/*.java",
|
"test-runner/src/**/*.java",
|
||||||
],
|
],
|
||||||
@@ -1268,6 +1414,7 @@ stubs_defaults {
|
|||||||
":opt-telephony-srcs",
|
":opt-telephony-srcs",
|
||||||
":opt-net-voip-srcs",
|
":opt-net-voip-srcs",
|
||||||
":core_public_api_files",
|
":core_public_api_files",
|
||||||
|
":updatable-media-srcs-without-aidls",
|
||||||
],
|
],
|
||||||
srcs_lib: "framework",
|
srcs_lib: "framework",
|
||||||
srcs_lib_whitelist_dirs: frameworks_base_subdirs,
|
srcs_lib_whitelist_dirs: frameworks_base_subdirs,
|
||||||
@@ -1450,7 +1597,7 @@ droiddoc {
|
|||||||
],
|
],
|
||||||
proofread_file: "ds-docs-proofrerad.txt",
|
proofread_file: "ds-docs-proofrerad.txt",
|
||||||
args: framework_docs_only_args +
|
args: framework_docs_only_args +
|
||||||
" -toroot / -samplegroup Admin " +
|
" -toroot / -yamlV2 -metalavaApiSince -samplegroup Admin " +
|
||||||
" -samplegroup Background " +
|
" -samplegroup Background " +
|
||||||
" -samplegroup Connectivity " +
|
" -samplegroup Connectivity " +
|
||||||
" -samplegroup Content " +
|
" -samplegroup Content " +
|
||||||
@@ -1710,6 +1857,26 @@ filegroup {
|
|||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
filegroup {
|
||||||
|
name: "framework-media-annotation-srcs",
|
||||||
|
srcs: [
|
||||||
|
"core/java/android/annotation/CallbackExecutor.java",
|
||||||
|
"core/java/android/annotation/CallSuper.java",
|
||||||
|
"core/java/android/annotation/DrawableRes.java",
|
||||||
|
"core/java/android/annotation/IntDef.java",
|
||||||
|
"core/java/android/annotation/LongDef.java",
|
||||||
|
"core/java/android/annotation/NonNull.java",
|
||||||
|
"core/java/android/annotation/Nullable.java",
|
||||||
|
"core/java/android/annotation/RequiresPermission.java",
|
||||||
|
"core/java/android/annotation/SdkConstant.java",
|
||||||
|
"core/java/android/annotation/StringDef.java",
|
||||||
|
"core/java/android/annotation/SystemApi.java",
|
||||||
|
"core/java/android/annotation/TestApi.java",
|
||||||
|
"core/java/android/annotation/UnsupportedAppUsage.java",
|
||||||
|
"core/java/com/android/internal/annotations/GuardedBy.java",
|
||||||
|
],
|
||||||
|
}
|
||||||
|
|
||||||
// Creates an index of AIDL methods; used for adding UnsupportedAppUsage
|
// Creates an index of AIDL methods; used for adding UnsupportedAppUsage
|
||||||
// annotations to private apis
|
// annotations to private apis
|
||||||
aidl_mapping {
|
aidl_mapping {
|
||||||
|
|||||||
@@ -248,8 +248,11 @@ $(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/framework/com.android.mediad
|
|||||||
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/framework/com.android.location.provider.jar)
|
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/framework/com.android.location.provider.jar)
|
||||||
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/framework/com.android.future.usb.accessory.jar)
|
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/framework/com.android.future.usb.accessory.jar)
|
||||||
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/framework/com.android.media.remotedisplay.jar)
|
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/framework/com.android.media.remotedisplay.jar)
|
||||||
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/media/audio)
|
|
||||||
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/priv-app/SystemUI)
|
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/priv-app/SystemUI)
|
||||||
|
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/media/audio)
|
||||||
|
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/priv-app/DynamicAndroidInstallationService)
|
||||||
|
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/priv-app/DefaultContainerService)
|
||||||
|
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/app/CaptivePortalLogin)
|
||||||
# ******************************************************************
|
# ******************************************************************
|
||||||
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST ABOVE THIS BANNER
|
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST ABOVE THIS BANNER
|
||||||
# ******************************************************************
|
# ******************************************************************
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ hidden_api_txt_checksorted_hook = ${REPO_ROOT}/frameworks/base/tools/hiddenapi/c
|
|||||||
|
|
||||||
hidden_api_txt_exclude_hook = ${REPO_ROOT}/frameworks/base/tools/hiddenapi/exclude.sh ${PREUPLOAD_COMMIT} ${REPO_ROOT}
|
hidden_api_txt_exclude_hook = ${REPO_ROOT}/frameworks/base/tools/hiddenapi/exclude.sh ${PREUPLOAD_COMMIT} ${REPO_ROOT}
|
||||||
|
|
||||||
|
ktlint_hook = ${REPO_ROOT}/prebuilts/ktlint/ktlint.py -f ${PREUPLOAD_FILES}
|
||||||
|
|
||||||
owners_hook = ${REPO_ROOT}/frameworks/base/tools/aosp/aosp_sha.sh ${PREUPLOAD_COMMIT} "OWNERS$"
|
owners_hook = ${REPO_ROOT}/frameworks/base/tools/aosp/aosp_sha.sh ${PREUPLOAD_COMMIT} "OWNERS$"
|
||||||
|
|
||||||
shell_hook = ${REPO_ROOT}/frameworks/base/tools/aosp/aosp_sha.sh ${PREUPLOAD_COMMIT} "^packages/Shell/"
|
shell_hook = ${REPO_ROOT}/frameworks/base/tools/aosp/aosp_sha.sh ${PREUPLOAD_COMMIT} "^packages/Shell/"
|
||||||
|
|||||||
26
apct-tests/perftests/autofill/Android.bp
Normal file
26
apct-tests/perftests/autofill/Android.bp
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
// Copyright (C) 2018 The Android Open Source Project
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
android_test {
|
||||||
|
name: "AutofillPerfTests",
|
||||||
|
srcs: ["src/**/*.java"],
|
||||||
|
resource_dirs: ["res"],
|
||||||
|
static_libs: [
|
||||||
|
"androidx.test.rules",
|
||||||
|
"androidx.annotation_annotation",
|
||||||
|
"apct-perftests-utils",
|
||||||
|
],
|
||||||
|
platform_apis: true,
|
||||||
|
test_suites: ["device-tests"],
|
||||||
|
}
|
||||||
40
apct-tests/perftests/autofill/AndroidManifest.xml
Normal file
40
apct-tests/perftests/autofill/AndroidManifest.xml
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Copyright (C) 2018 The Android Open Source Project
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
-->
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
package="com.android.perftests.autofill">
|
||||||
|
|
||||||
|
<application>
|
||||||
|
<uses-library android:name="android.test.runner" />
|
||||||
|
<activity android:name="android.perftests.utils.StubActivity">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="com.android.perftests.core.PERFTEST" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
|
||||||
|
<service
|
||||||
|
android:name="android.view.autofill.MyAutofillService"
|
||||||
|
android:label="PERF AutofillService"
|
||||||
|
android:permission="android.permission.BIND_AUTOFILL_SERVICE" >
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.service.autofill.AutofillService" />
|
||||||
|
</intent-filter>
|
||||||
|
</service>
|
||||||
|
|
||||||
|
</application>
|
||||||
|
|
||||||
|
<instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
android:targetPackage="com.android.perftests.autofill"/>
|
||||||
|
</manifest>
|
||||||
28
apct-tests/perftests/autofill/AndroidTest.xml
Normal file
28
apct-tests/perftests/autofill/AndroidTest.xml
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Copyright (C) 2018 The Android Open Source Project
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
-->
|
||||||
|
<configuration description="Runs AutofillPerfTests metric instrumentation.">
|
||||||
|
<option name="test-suite-tag" value="apct" />
|
||||||
|
<option name="test-suite-tag" value="apct-metric-instrumentation" />
|
||||||
|
<target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
|
||||||
|
<option name="cleanup-apks" value="true" />
|
||||||
|
<option name="test-file-name" value="AutofillPerfTests.apk" />
|
||||||
|
</target_preparer>
|
||||||
|
|
||||||
|
<test class="com.android.tradefed.testtype.AndroidJUnitTest" >
|
||||||
|
<option name="package" value="com.android.perftests.autofill" />
|
||||||
|
<option name="hidden-api-checks" value="false"/>
|
||||||
|
</test>
|
||||||
|
</configuration>
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?><!--
|
||||||
|
* Copyright (C) 2018 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
-->
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/text"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"/>
|
||||||
|
</LinearLayout>
|
||||||
@@ -0,0 +1,94 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
* Copyright (C) 2018 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:focusable="true"
|
||||||
|
android:focusableInTouchMode="true"
|
||||||
|
android:orientation="vertical" >
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/username_container"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal" >
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/username_label"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Username" />
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/username"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:imeOptions="flagNoFullscreen" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal" >
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/password_label"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Password" />
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/password"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:inputType="textPassword"
|
||||||
|
android:imeOptions="flagNoFullscreen" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal" >
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal" >
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/login"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Login" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/cancel"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Cancel" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/output"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
@@ -0,0 +1,114 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2018 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License
|
||||||
|
*/
|
||||||
|
|
||||||
|
package android.view.autofill;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
|
import android.os.Looper;
|
||||||
|
import android.perftests.utils.PerfStatusReporter;
|
||||||
|
import android.perftests.utils.SettingsHelper;
|
||||||
|
import android.perftests.utils.SettingsStateKeeperRule;
|
||||||
|
import android.perftests.utils.StubActivity;
|
||||||
|
import android.provider.Settings;
|
||||||
|
|
||||||
|
import androidx.test.InstrumentationRegistry;
|
||||||
|
import androidx.test.filters.LargeTest;
|
||||||
|
import androidx.test.rule.ActivityTestRule;
|
||||||
|
|
||||||
|
import org.junit.After;
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.ClassRule;
|
||||||
|
import org.junit.Rule;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Base class for all autofill tests.
|
||||||
|
*/
|
||||||
|
@LargeTest
|
||||||
|
public abstract class AbstractAutofillPerfTestCase {
|
||||||
|
|
||||||
|
@ClassRule
|
||||||
|
public static final SettingsStateKeeperRule mServiceSettingsKeeper =
|
||||||
|
new SettingsStateKeeperRule(InstrumentationRegistry.getTargetContext(),
|
||||||
|
Settings.Secure.AUTOFILL_SERVICE);
|
||||||
|
|
||||||
|
@Rule
|
||||||
|
public ActivityTestRule<StubActivity> mActivityRule =
|
||||||
|
new ActivityTestRule<StubActivity>(StubActivity.class);
|
||||||
|
|
||||||
|
@Rule
|
||||||
|
public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
|
||||||
|
|
||||||
|
private final int mLayoutId;
|
||||||
|
|
||||||
|
protected AbstractAutofillPerfTestCase(int layoutId) {
|
||||||
|
mLayoutId = layoutId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prepares the activity so that by the time the test is run it has reference to its fields.
|
||||||
|
*/
|
||||||
|
@Before
|
||||||
|
public void prepareActivity() throws Throwable {
|
||||||
|
mActivityRule.runOnUiThread(() -> {
|
||||||
|
assertTrue("We should be running on the main thread",
|
||||||
|
Looper.getMainLooper().getThread() == Thread.currentThread());
|
||||||
|
assertTrue("We should be running on the main thread",
|
||||||
|
Looper.myLooper() == Looper.getMainLooper());
|
||||||
|
StubActivity activity = mActivityRule.getActivity();
|
||||||
|
activity.setContentView(mLayoutId);
|
||||||
|
onCreate(activity);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Before
|
||||||
|
public void enableService() {
|
||||||
|
MyAutofillService.resetStaticState();
|
||||||
|
MyAutofillService.setEnabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@After
|
||||||
|
public void disableService() {
|
||||||
|
// Must disable service so calls are ignored in case of errors during the test case;
|
||||||
|
// otherwise, other tests will fail because these calls are made in the UI thread (as both
|
||||||
|
// the service, the tests, and the app run in the same process).
|
||||||
|
MyAutofillService.setEnabled(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes the {@link StubActivity} after it was launched.
|
||||||
|
*/
|
||||||
|
protected abstract void onCreate(StubActivity activity);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Uses the {@code settings} binary to set the autofill service.
|
||||||
|
*/
|
||||||
|
protected void setService() {
|
||||||
|
SettingsHelper.syncSet(InstrumentationRegistry.getTargetContext(),
|
||||||
|
SettingsHelper.NAMESPACE_SECURE,
|
||||||
|
Settings.Secure.AUTOFILL_SERVICE,
|
||||||
|
MyAutofillService.COMPONENT_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Uses the {@code settings} binary to reset the autofill service.
|
||||||
|
*/
|
||||||
|
protected void resetService() {
|
||||||
|
SettingsHelper.syncDelete(InstrumentationRegistry.getTargetContext(),
|
||||||
|
SettingsHelper.NAMESPACE_SECURE,
|
||||||
|
Settings.Secure.AUTOFILL_SERVICE);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,302 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2018 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License
|
||||||
|
*/
|
||||||
|
|
||||||
|
package android.view.autofill;
|
||||||
|
|
||||||
|
import static android.view.autofill.AutofillManager.AutofillCallback.EVENT_INPUT_HIDDEN;
|
||||||
|
import static android.view.autofill.AutofillManager.AutofillCallback.EVENT_INPUT_SHOWN;
|
||||||
|
|
||||||
|
import android.perftests.utils.BenchmarkState;
|
||||||
|
import android.perftests.utils.StubActivity;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.EditText;
|
||||||
|
|
||||||
|
import com.android.perftests.autofill.R;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
public class LoginTest extends AbstractAutofillPerfTestCase {
|
||||||
|
|
||||||
|
private EditText mUsername;
|
||||||
|
private EditText mPassword;
|
||||||
|
private AutofillManager mAfm;
|
||||||
|
|
||||||
|
public LoginTest() {
|
||||||
|
super(R.layout.test_autofill_login);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(StubActivity activity) {
|
||||||
|
View root = activity.getWindow().getDecorView();
|
||||||
|
mUsername = root.findViewById(R.id.username);
|
||||||
|
mPassword = root.findViewById(R.id.password);
|
||||||
|
mAfm = activity.getSystemService(AutofillManager.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the baseline test for focusing the 2 views when autofill is disabled.
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testFocus_noService() throws Throwable {
|
||||||
|
resetService();
|
||||||
|
|
||||||
|
mActivityRule.runOnUiThread(() -> {
|
||||||
|
BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||||
|
while (state.keepRunning()) {
|
||||||
|
mUsername.requestFocus();
|
||||||
|
mPassword.requestFocus();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This time the service is called, but it returns a {@code null} response so the UI behaves
|
||||||
|
* as if autofill was disabled.
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testFocus_serviceDoesNotAutofill() throws Throwable {
|
||||||
|
MyAutofillService.newCannedResponse().reply();
|
||||||
|
setService();
|
||||||
|
|
||||||
|
// Must first focus in a field to trigger autofill and wait for service response
|
||||||
|
// outside the loop
|
||||||
|
mActivityRule.runOnUiThread(() -> mUsername.requestFocus());
|
||||||
|
MyAutofillService.getLastFillRequest();
|
||||||
|
// Then focus on password so loop start with focus away from username
|
||||||
|
mActivityRule.runOnUiThread(() -> mPassword.requestFocus());
|
||||||
|
|
||||||
|
mActivityRule.runOnUiThread(() -> {
|
||||||
|
BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||||
|
while (state.keepRunning()) {
|
||||||
|
mUsername.requestFocus();
|
||||||
|
mPassword.requestFocus();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Now the service returns autofill data, for both username and password.
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testFocus_autofillBothFields() throws Throwable {
|
||||||
|
MyAutofillService.newCannedResponse()
|
||||||
|
.setUsername(mUsername.getAutofillId(), "user")
|
||||||
|
.setPassword(mPassword.getAutofillId(), "pass")
|
||||||
|
.reply();
|
||||||
|
setService();
|
||||||
|
|
||||||
|
// Callback is used to slow down the calls made to the autofill server so the
|
||||||
|
// app is not crashed due to binder exhaustion. But the time spent waiting for the callbacks
|
||||||
|
// is not measured here...
|
||||||
|
MyAutofillCallback callback = new MyAutofillCallback();
|
||||||
|
mAfm.registerCallback(callback);
|
||||||
|
|
||||||
|
// Must first trigger autofill and wait for service response outside the loop
|
||||||
|
mActivityRule.runOnUiThread(() -> mUsername.requestFocus());
|
||||||
|
MyAutofillService.getLastFillRequest();
|
||||||
|
callback.expectEvent(mUsername, EVENT_INPUT_SHOWN);
|
||||||
|
|
||||||
|
// Then focus on password so loop start with focus away from username
|
||||||
|
mActivityRule.runOnUiThread(() -> mPassword.requestFocus());
|
||||||
|
callback.expectEvent(mUsername, EVENT_INPUT_HIDDEN);
|
||||||
|
callback.expectEvent(mPassword, EVENT_INPUT_SHOWN);
|
||||||
|
|
||||||
|
|
||||||
|
// NOTE: we cannot run the whole loop inside the UI thread, because the autofill callback
|
||||||
|
// is called on it, which would cause a deadlock on expectEvent().
|
||||||
|
try {
|
||||||
|
BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||||
|
while (state.keepRunning()) {
|
||||||
|
mActivityRule.runOnUiThread(() -> mUsername.requestFocus());
|
||||||
|
state.pauseTiming(); // Ignore time spent waiting for callbacks
|
||||||
|
callback.expectEvent(mPassword, EVENT_INPUT_HIDDEN);
|
||||||
|
callback.expectEvent(mUsername, EVENT_INPUT_SHOWN);
|
||||||
|
state.resumeTiming();
|
||||||
|
mActivityRule.runOnUiThread(() -> mPassword.requestFocus());
|
||||||
|
state.pauseTiming(); // Ignore time spent waiting for callbacks
|
||||||
|
callback.expectEvent(mUsername, EVENT_INPUT_HIDDEN);
|
||||||
|
callback.expectEvent(mPassword, EVENT_INPUT_SHOWN);
|
||||||
|
state.resumeTiming();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sanity check
|
||||||
|
callback.assertNoAsyncErrors();
|
||||||
|
} finally {
|
||||||
|
mAfm.unregisterCallback(callback);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Now the service returns autofill data, but just for username.
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testFocus_autofillUsernameOnly() throws Throwable {
|
||||||
|
// Must set ignored ids so focus on password does not trigger new requests
|
||||||
|
MyAutofillService.newCannedResponse()
|
||||||
|
.setUsername(mUsername.getAutofillId(), "user")
|
||||||
|
.setIgnored(mPassword.getAutofillId())
|
||||||
|
.reply();
|
||||||
|
setService();
|
||||||
|
|
||||||
|
// Callback is used to slow down the calls made to the autofill server so the
|
||||||
|
// app is not crashed due to binder exhaustion. But the time spent waiting for the callbacks
|
||||||
|
// is not measured here...
|
||||||
|
MyAutofillCallback callback = new MyAutofillCallback();
|
||||||
|
mAfm.registerCallback(callback);
|
||||||
|
|
||||||
|
// Must first trigger autofill and wait for service response outside the loop
|
||||||
|
mActivityRule.runOnUiThread(() -> mUsername.requestFocus());
|
||||||
|
MyAutofillService.getLastFillRequest();
|
||||||
|
callback.expectEvent(mUsername, EVENT_INPUT_SHOWN);
|
||||||
|
|
||||||
|
// Then focus on password so loop start with focus away from username
|
||||||
|
mActivityRule.runOnUiThread(() -> mPassword.requestFocus());
|
||||||
|
callback.expectEvent(mUsername, EVENT_INPUT_HIDDEN);
|
||||||
|
|
||||||
|
// NOTE: we cannot run the whole loop inside the UI thread, because the autofill callback
|
||||||
|
// is called on it, which would cause a deadlock on expectEvent().
|
||||||
|
try {
|
||||||
|
BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||||
|
while (state.keepRunning()) {
|
||||||
|
mActivityRule.runOnUiThread(() -> mUsername.requestFocus());
|
||||||
|
state.pauseTiming(); // Ignore time spent waiting for callbacks
|
||||||
|
callback.expectEvent(mUsername, EVENT_INPUT_SHOWN);
|
||||||
|
state.resumeTiming();
|
||||||
|
mActivityRule.runOnUiThread(() -> mPassword.requestFocus());
|
||||||
|
state.pauseTiming(); // Ignore time spent waiting for callbacks
|
||||||
|
callback.expectEvent(mUsername, EVENT_INPUT_HIDDEN);
|
||||||
|
state.resumeTiming();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sanity check
|
||||||
|
callback.assertNoAsyncErrors();
|
||||||
|
} finally {
|
||||||
|
mAfm.unregisterCallback(callback);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the baseline test for changing the 2 views when autofill is disabled.
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testChange_noService() throws Throwable {
|
||||||
|
resetService();
|
||||||
|
|
||||||
|
changeTest(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This time the service is called, but it returns a {@code null} response so the UI behaves
|
||||||
|
* as if autofill was disabled.
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testChange_serviceDoesNotAutofill() throws Throwable {
|
||||||
|
MyAutofillService.newCannedResponse().reply();
|
||||||
|
setService();
|
||||||
|
|
||||||
|
changeTest(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Now the service returns autofill data, for both username and password.
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testChange_autofillBothFields() throws Throwable {
|
||||||
|
MyAutofillService.newCannedResponse()
|
||||||
|
.setUsername(mUsername.getAutofillId(), "user")
|
||||||
|
.setPassword(mPassword.getAutofillId(), "pass")
|
||||||
|
.reply();
|
||||||
|
setService();
|
||||||
|
|
||||||
|
changeTest(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Now the service returns autofill data, but just for username.
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testChange_autofillUsernameOnly() throws Throwable {
|
||||||
|
// Must set ignored ids so focus on password does not trigger new requests
|
||||||
|
MyAutofillService.newCannedResponse()
|
||||||
|
.setUsername(mUsername.getAutofillId(), "user")
|
||||||
|
.setIgnored(mPassword.getAutofillId())
|
||||||
|
.reply();
|
||||||
|
setService();
|
||||||
|
|
||||||
|
changeTest(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void changeTest(boolean waitForService) throws Throwable {
|
||||||
|
// Must first focus in a field to trigger autofill and wait for service response
|
||||||
|
// outside the loop
|
||||||
|
mActivityRule.runOnUiThread(() -> mUsername.requestFocus());
|
||||||
|
if (waitForService) {
|
||||||
|
MyAutofillService.getLastFillRequest();
|
||||||
|
}
|
||||||
|
mActivityRule.runOnUiThread(() -> {
|
||||||
|
|
||||||
|
BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||||
|
while (state.keepRunning()) {
|
||||||
|
mUsername.setText("");
|
||||||
|
mUsername.setText("a");
|
||||||
|
mPassword.setText("");
|
||||||
|
mPassword.setText("x");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCallbacks() throws Throwable {
|
||||||
|
MyAutofillService.newCannedResponse()
|
||||||
|
.setUsername(mUsername.getAutofillId(), "user")
|
||||||
|
.setPassword(mPassword.getAutofillId(), "pass")
|
||||||
|
.reply();
|
||||||
|
setService();
|
||||||
|
|
||||||
|
MyAutofillCallback callback = new MyAutofillCallback();
|
||||||
|
mAfm.registerCallback(callback);
|
||||||
|
|
||||||
|
// Must first focus in a field to trigger autofill and wait for service response
|
||||||
|
// outside the loop
|
||||||
|
mActivityRule.runOnUiThread(() -> mUsername.requestFocus());
|
||||||
|
MyAutofillService.getLastFillRequest();
|
||||||
|
callback.expectEvent(mUsername, EVENT_INPUT_SHOWN);
|
||||||
|
|
||||||
|
// Now focus on password to prepare loop state
|
||||||
|
mActivityRule.runOnUiThread(() -> mPassword.requestFocus());
|
||||||
|
callback.expectEvent(mUsername, EVENT_INPUT_HIDDEN);
|
||||||
|
callback.expectEvent(mPassword, EVENT_INPUT_SHOWN);
|
||||||
|
|
||||||
|
// NOTE: we cannot run the whole loop inside the UI thread, because the autofill callback
|
||||||
|
// is called on it, which would cause a deadlock on expectEvent().
|
||||||
|
try {
|
||||||
|
BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||||
|
while (state.keepRunning()) {
|
||||||
|
mActivityRule.runOnUiThread(() -> mUsername.requestFocus());
|
||||||
|
callback.expectEvent(mPassword, EVENT_INPUT_HIDDEN);
|
||||||
|
callback.expectEvent(mUsername, EVENT_INPUT_SHOWN);
|
||||||
|
mActivityRule.runOnUiThread(() -> mPassword.requestFocus());
|
||||||
|
callback.expectEvent(mUsername, EVENT_INPUT_HIDDEN);
|
||||||
|
callback.expectEvent(mPassword, EVENT_INPUT_SHOWN);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sanity check
|
||||||
|
callback.assertNoAsyncErrors();
|
||||||
|
} finally {
|
||||||
|
mAfm.unregisterCallback(callback);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,127 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2018 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License
|
||||||
|
*/
|
||||||
|
package android.view.autofill;
|
||||||
|
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.autofill.AutofillManager.AutofillCallback;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.concurrent.BlockingQueue;
|
||||||
|
import java.util.concurrent.LinkedBlockingQueue;
|
||||||
|
import java.util.concurrent.Semaphore;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
import static android.view.autofill.AutofillManager.AutofillCallback.EVENT_INPUT_HIDDEN;
|
||||||
|
import static android.view.autofill.AutofillManager.AutofillCallback.EVENT_INPUT_SHOWN;
|
||||||
|
import static android.view.autofill.AutofillManager.AutofillCallback.EVENT_INPUT_UNAVAILABLE;
|
||||||
|
|
||||||
|
import android.os.CancellationSignal;
|
||||||
|
import android.service.autofill.FillCallback;
|
||||||
|
import android.service.autofill.FillRequest;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Custom {@link AutofillCallback} used to recover events during tests.
|
||||||
|
*/
|
||||||
|
public final class MyAutofillCallback extends AutofillCallback {
|
||||||
|
|
||||||
|
private static final String TAG = "MyAutofillCallback";
|
||||||
|
private static final int TIMEOUT_MS = 5000;
|
||||||
|
|
||||||
|
private final BlockingQueue<MyEvent> mEvents = new LinkedBlockingQueue<>(2);
|
||||||
|
private final List<String> mAsyncErrors = new ArrayList<>();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAutofillEvent(View view, int event) {
|
||||||
|
boolean offered = false;
|
||||||
|
try {
|
||||||
|
offered = mEvents.offer(new MyEvent(view, event), TIMEOUT_MS, TimeUnit.MILLISECONDS);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
Thread.currentThread().interrupt();
|
||||||
|
}
|
||||||
|
if (!offered) {
|
||||||
|
String error = "could not offer " + toString(view, event) + " in " + TIMEOUT_MS + "ms";
|
||||||
|
Log.e(TAG, error);
|
||||||
|
mAsyncErrors.add(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Asserts the callback is called for the given view and event, or fail if it times out.
|
||||||
|
*/
|
||||||
|
public void expectEvent(@NonNull View view, int event) {
|
||||||
|
MyEvent myEvent;
|
||||||
|
try {
|
||||||
|
myEvent = mEvents.poll(TIMEOUT_MS, TimeUnit.MILLISECONDS);
|
||||||
|
if (myEvent == null) {
|
||||||
|
throw new IllegalStateException("no event received in " + TIMEOUT_MS
|
||||||
|
+ "ms while waiting for " + toString(view, event));
|
||||||
|
}
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
Thread.currentThread().interrupt();
|
||||||
|
throw new IllegalStateException("interrupted waiting for " + toString(view, event));
|
||||||
|
}
|
||||||
|
if (!myEvent.view.equals(view) || myEvent.event != event) {
|
||||||
|
throw new AssertionError("Invalid event: expected " + myEvent + ", got "
|
||||||
|
+ toString(view, event));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Throws an exception if an error happened asynchronously while handing
|
||||||
|
* {@link #onAutofillEvent(View, int)}.
|
||||||
|
*/
|
||||||
|
public void assertNoAsyncErrors() {
|
||||||
|
if (!mAsyncErrors.isEmpty()) {
|
||||||
|
throw new IllegalStateException(mAsyncErrors.size() + " errors: " + mAsyncErrors);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String eventToString(int event) {
|
||||||
|
switch (event) {
|
||||||
|
case EVENT_INPUT_HIDDEN:
|
||||||
|
return "HIDDEN";
|
||||||
|
case EVENT_INPUT_SHOWN:
|
||||||
|
return "SHOWN";
|
||||||
|
case EVENT_INPUT_UNAVAILABLE:
|
||||||
|
return "UNAVAILABLE";
|
||||||
|
default:
|
||||||
|
throw new IllegalArgumentException("invalid event: " + event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String toString(View view, int event) {
|
||||||
|
return eventToString(event) + ": " + view + ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final class MyEvent {
|
||||||
|
public final View view;
|
||||||
|
public final int event;
|
||||||
|
|
||||||
|
MyEvent(View view, int event) {
|
||||||
|
this.view = view;
|
||||||
|
this.event = event;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return MyAutofillCallback.toString(view, event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,219 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2018 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License
|
||||||
|
*/
|
||||||
|
package android.view.autofill;
|
||||||
|
|
||||||
|
import android.os.CancellationSignal;
|
||||||
|
import android.service.autofill.AutofillService;
|
||||||
|
import android.service.autofill.Dataset;
|
||||||
|
import android.service.autofill.FillCallback;
|
||||||
|
import android.service.autofill.FillRequest;
|
||||||
|
import android.service.autofill.FillResponse;
|
||||||
|
import android.service.autofill.SaveCallback;
|
||||||
|
import android.service.autofill.SaveRequest;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.util.Pair;
|
||||||
|
import android.widget.RemoteViews;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
|
import com.android.perftests.autofill.R;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.concurrent.BlockingQueue;
|
||||||
|
import java.util.concurrent.LinkedBlockingQueue;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An {@link AutofillService} implementation whose replies can be programmed by the test case.
|
||||||
|
*/
|
||||||
|
public class MyAutofillService extends AutofillService {
|
||||||
|
|
||||||
|
private static final String TAG = "MyAutofillService";
|
||||||
|
private static final int TIMEOUT_MS = 5000;
|
||||||
|
|
||||||
|
private static final String PACKAGE_NAME = "com.android.perftests.autofill";
|
||||||
|
static final String COMPONENT_NAME = PACKAGE_NAME + "/android.view.autofill.MyAutofillService";
|
||||||
|
|
||||||
|
private static final BlockingQueue<FillRequest> sFillRequests = new LinkedBlockingQueue<>();
|
||||||
|
private static final BlockingQueue<CannedResponse> sCannedResponses =
|
||||||
|
new LinkedBlockingQueue<>();
|
||||||
|
|
||||||
|
private static boolean sEnabled;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resets the static state associated with the service.
|
||||||
|
*/
|
||||||
|
static void resetStaticState() {
|
||||||
|
sFillRequests.clear();
|
||||||
|
sCannedResponses.clear();
|
||||||
|
sEnabled = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets whether the service is enabled or not - when disabled, calls to
|
||||||
|
* {@link #onFillRequest(FillRequest, CancellationSignal, FillCallback)} will be ignored.
|
||||||
|
*/
|
||||||
|
static void setEnabled(boolean enabled) {
|
||||||
|
sEnabled = enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the the last {@link FillRequest} passed to
|
||||||
|
* {@link #onFillRequest(FillRequest, CancellationSignal, FillCallback)} or throws an
|
||||||
|
* exception if that method was not called.
|
||||||
|
*/
|
||||||
|
@NonNull
|
||||||
|
static FillRequest getLastFillRequest() {
|
||||||
|
FillRequest request = null;
|
||||||
|
try {
|
||||||
|
request = sFillRequests.poll(TIMEOUT_MS, TimeUnit.MILLISECONDS);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
Thread.currentThread().interrupt();
|
||||||
|
throw new IllegalStateException("onFillRequest() interrupted");
|
||||||
|
}
|
||||||
|
if (request == null) {
|
||||||
|
throw new IllegalStateException("onFillRequest() not called in " + TIMEOUT_MS + "ms");
|
||||||
|
}
|
||||||
|
return request;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFillRequest(FillRequest request, CancellationSignal cancellationSignal,
|
||||||
|
FillCallback callback) {
|
||||||
|
try {
|
||||||
|
handleRequest(request, callback);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
Thread.currentThread().interrupt();
|
||||||
|
onError("onFillRequest() interrupted", e, callback);
|
||||||
|
} catch (Exception e) {
|
||||||
|
onError("exception on onFillRequest()", e, callback);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void handleRequest(FillRequest request, FillCallback callback) throws Exception {
|
||||||
|
if (!sEnabled) {
|
||||||
|
onError("ignoring onFillRequest(): service is disabled", callback);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
CannedResponse response = sCannedResponses.poll(TIMEOUT_MS, TimeUnit.MILLISECONDS);
|
||||||
|
if (response == null) {
|
||||||
|
onError("ignoring onFillRequest(): response not set", callback);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Dataset.Builder dataset = new Dataset.Builder(newDatasetPresentation("dataset"));
|
||||||
|
boolean hasData = false;
|
||||||
|
if (response.mUsername != null) {
|
||||||
|
hasData = true;
|
||||||
|
dataset.setValue(response.mUsername.first,
|
||||||
|
AutofillValue.forText(response.mUsername.second));
|
||||||
|
}
|
||||||
|
if (response.mPassword != null) {
|
||||||
|
hasData = true;
|
||||||
|
dataset.setValue(response.mPassword.first,
|
||||||
|
AutofillValue.forText(response.mPassword.second));
|
||||||
|
}
|
||||||
|
if (hasData) {
|
||||||
|
FillResponse.Builder fillResponse = new FillResponse.Builder();
|
||||||
|
if (response.mIgnoredIds != null) {
|
||||||
|
fillResponse.setIgnoredIds(response.mIgnoredIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
callback.onSuccess(fillResponse.addDataset(dataset.build()).build());
|
||||||
|
} else {
|
||||||
|
callback.onSuccess(null);
|
||||||
|
}
|
||||||
|
if (!sFillRequests.offer(request, TIMEOUT_MS, TimeUnit.MILLISECONDS)) {
|
||||||
|
Log.w(TAG, "could not offer request in " + TIMEOUT_MS + "ms");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSaveRequest(SaveRequest request, SaveCallback callback) {
|
||||||
|
// No current test should have triggered it...
|
||||||
|
Log.e(TAG, "onSaveRequest() should not have been called");
|
||||||
|
callback.onFailure("onSaveRequest() should not have been called");
|
||||||
|
}
|
||||||
|
|
||||||
|
static final class CannedResponse {
|
||||||
|
private final Pair<AutofillId, String> mUsername;
|
||||||
|
private final Pair<AutofillId, String> mPassword;
|
||||||
|
private final AutofillId[] mIgnoredIds;
|
||||||
|
|
||||||
|
private CannedResponse(@NonNull Builder builder) {
|
||||||
|
mUsername = builder.mUsername;
|
||||||
|
mPassword = builder.mPassword;
|
||||||
|
mIgnoredIds = builder.mIgnoredIds;
|
||||||
|
}
|
||||||
|
|
||||||
|
static class Builder {
|
||||||
|
private Pair<AutofillId, String> mUsername;
|
||||||
|
private Pair<AutofillId, String> mPassword;
|
||||||
|
private AutofillId[] mIgnoredIds;
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
Builder setUsername(@NonNull AutofillId id, @NonNull String value) {
|
||||||
|
mUsername = new Pair<>(id, value);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
Builder setPassword(@NonNull AutofillId id, @NonNull String value) {
|
||||||
|
mPassword = new Pair<>(id, value);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
Builder setIgnored(AutofillId... ids) {
|
||||||
|
mIgnoredIds = ids;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
void reply() {
|
||||||
|
sCannedResponses.add(new CannedResponse(this));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the expected canned {@link FillResponse} for the next
|
||||||
|
* {@link AutofillService#onFillRequest(FillRequest, CancellationSignal, FillCallback)}.
|
||||||
|
*/
|
||||||
|
static CannedResponse.Builder newCannedResponse() {
|
||||||
|
return new CannedResponse.Builder();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onError(@NonNull String msg, @NonNull FillCallback callback) {
|
||||||
|
Log.e(TAG, msg);
|
||||||
|
callback.onFailure(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onError(@NonNull String msg, @NonNull Exception e,
|
||||||
|
@NonNull FillCallback callback) {
|
||||||
|
Log.e(TAG, msg, e);
|
||||||
|
callback.onFailure(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
private static RemoteViews newDatasetPresentation(@NonNull CharSequence text) {
|
||||||
|
RemoteViews presentation =
|
||||||
|
new RemoteViews(PACKAGE_NAME, R.layout.autofill_dataset_picker_text_only);
|
||||||
|
presentation.setTextViewText(R.id.text, text);
|
||||||
|
return presentation;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,7 +9,8 @@ LOCAL_SRC_FILES := \
|
|||||||
src/android/os/ISomeService.aidl
|
src/android/os/ISomeService.aidl
|
||||||
|
|
||||||
LOCAL_STATIC_JAVA_LIBRARIES := \
|
LOCAL_STATIC_JAVA_LIBRARIES := \
|
||||||
android-support-test \
|
androidx.test.rules \
|
||||||
|
androidx.annotation_annotation \
|
||||||
apct-perftests-utils \
|
apct-perftests-utils \
|
||||||
guava
|
guava
|
||||||
|
|
||||||
|
|||||||
@@ -16,9 +16,19 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
<service android:name="android.os.SomeService" android:exported="false" android:process=":some_service" />
|
<service android:name="android.os.SomeService" android:exported="false" android:process=":some_service" />
|
||||||
|
|
||||||
|
<service
|
||||||
|
android:name="android.view.autofill.MyAutofillService"
|
||||||
|
android:label="PERF AutofillService"
|
||||||
|
android:permission="android.permission.BIND_AUTOFILL_SERVICE" >
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.service.autofill.AutofillService" />
|
||||||
|
</intent-filter>
|
||||||
|
</service>
|
||||||
|
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
<instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
|
<instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
|
||||||
android:targetPackage="com.android.perftests.core"/>
|
android:targetPackage="com.android.perftests.core"/>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
||||||
|
|||||||
@@ -23,10 +23,10 @@ import android.content.Context;
|
|||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.perftests.utils.BenchmarkState;
|
import android.perftests.utils.BenchmarkState;
|
||||||
import android.perftests.utils.PerfStatusReporter;
|
import android.perftests.utils.PerfStatusReporter;
|
||||||
import android.support.test.InstrumentationRegistry;
|
|
||||||
import android.support.test.filters.LargeTest;
|
import androidx.test.InstrumentationRegistry;
|
||||||
import android.support.test.runner.AndroidJUnit4;
|
import androidx.test.filters.LargeTest;
|
||||||
import android.util.Log;
|
import androidx.test.runner.AndroidJUnit4;
|
||||||
|
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|||||||
@@ -21,9 +21,10 @@ import android.content.Intent;
|
|||||||
import android.perftests.utils.BenchmarkState;
|
import android.perftests.utils.BenchmarkState;
|
||||||
import android.perftests.utils.PerfStatusReporter;
|
import android.perftests.utils.PerfStatusReporter;
|
||||||
import android.perftests.utils.StubActivity;
|
import android.perftests.utils.StubActivity;
|
||||||
import android.support.test.InstrumentationRegistry;
|
|
||||||
import android.support.test.filters.LargeTest;
|
import androidx.test.InstrumentationRegistry;
|
||||||
import android.support.test.runner.AndroidJUnit4;
|
import androidx.test.filters.LargeTest;
|
||||||
|
import androidx.test.runner.AndroidJUnit4;
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
@@ -33,7 +34,6 @@ import org.junit.runner.RunWith;
|
|||||||
// Due to b/71353150, you might get "java.lang.AssertionError: Binder ProxyMap has too many
|
// Due to b/71353150, you might get "java.lang.AssertionError: Binder ProxyMap has too many
|
||||||
// entries", but it's flaky. Adding "Runtime.getRuntime().gc()" between each iteration solves
|
// entries", but it's flaky. Adding "Runtime.getRuntime().gc()" between each iteration solves
|
||||||
// the problem, but it doesn't seem like it's currently needed.
|
// the problem, but it doesn't seem like it's currently needed.
|
||||||
|
|
||||||
@RunWith(AndroidJUnit4.class)
|
@RunWith(AndroidJUnit4.class)
|
||||||
@LargeTest
|
@LargeTest
|
||||||
public class PendingIntentPerfTest {
|
public class PendingIntentPerfTest {
|
||||||
|
|||||||
108
apct-tests/perftests/core/src/android/app/ResourcesPerfTest.java
Normal file
108
apct-tests/perftests/core/src/android/app/ResourcesPerfTest.java
Normal file
@@ -0,0 +1,108 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2018 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package android.app;
|
||||||
|
|
||||||
|
import static org.junit.Assert.fail;
|
||||||
|
|
||||||
|
import android.content.res.AssetManager;
|
||||||
|
import android.content.res.Resources;
|
||||||
|
import android.content.res.XmlResourceParser;
|
||||||
|
import android.perftests.utils.BenchmarkState;
|
||||||
|
import android.perftests.utils.PerfStatusReporter;
|
||||||
|
|
||||||
|
import androidx.test.filters.LargeTest;
|
||||||
|
|
||||||
|
import org.junit.After;
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Rule;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.xmlpull.v1.XmlPullParser;
|
||||||
|
import org.xmlpull.v1.XmlPullParserException;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Benchmarks for {@link android.content.res.Resources}.
|
||||||
|
*/
|
||||||
|
@LargeTest
|
||||||
|
public class ResourcesPerfTest {
|
||||||
|
@Rule
|
||||||
|
public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
|
||||||
|
|
||||||
|
private AssetManager mAsset;
|
||||||
|
private Resources mRes;
|
||||||
|
|
||||||
|
private int mTextId;
|
||||||
|
private int mColorId;
|
||||||
|
private int mIntegerId;
|
||||||
|
private int mLayoutId;
|
||||||
|
|
||||||
|
@Before
|
||||||
|
public void setUp() {
|
||||||
|
mAsset = new AssetManager();
|
||||||
|
mAsset.addAssetPath("/system/framework/framework-res.apk");
|
||||||
|
mRes = new Resources(mAsset, null, null);
|
||||||
|
|
||||||
|
mTextId = mRes.getIdentifier("cancel", "string", "android");
|
||||||
|
mColorId = mRes.getIdentifier("transparent", "color", "android");
|
||||||
|
mIntegerId = mRes.getIdentifier("config_shortAnimTime", "integer", "android");
|
||||||
|
mLayoutId = mRes.getIdentifier("two_line_list_item", "layout", "android");
|
||||||
|
}
|
||||||
|
|
||||||
|
@After
|
||||||
|
public void tearDown() {
|
||||||
|
mAsset.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getText() {
|
||||||
|
final BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||||
|
while (state.keepRunning()) {
|
||||||
|
mRes.getText(mTextId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getColor() {
|
||||||
|
final BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||||
|
while (state.keepRunning()) {
|
||||||
|
mRes.getColor(mColorId, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getInteger() {
|
||||||
|
final BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||||
|
while (state.keepRunning()) {
|
||||||
|
mRes.getInteger(mIntegerId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getLayoutAndTravese() {
|
||||||
|
final BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||||
|
while (state.keepRunning()) {
|
||||||
|
try (XmlResourceParser parser = mRes.getLayout(mLayoutId)) {
|
||||||
|
while (parser.next() != XmlPullParser.END_DOCUMENT) {
|
||||||
|
// Walk the entire tree
|
||||||
|
}
|
||||||
|
} catch (IOException | XmlPullParserException exception) {
|
||||||
|
fail("Parsing of the layout failed. Something is really broken");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2018 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package android.app;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.res.Resources;
|
||||||
|
import android.perftests.utils.BenchmarkState;
|
||||||
|
import android.perftests.utils.PerfStatusReporter;
|
||||||
|
|
||||||
|
import androidx.test.InstrumentationRegistry;
|
||||||
|
import androidx.test.filters.LargeTest;
|
||||||
|
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Rule;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Benchmarks for {@link android.content.res.Resources.Theme}.
|
||||||
|
*/
|
||||||
|
@LargeTest
|
||||||
|
public class ResourcesThemePerfTest {
|
||||||
|
@Rule
|
||||||
|
public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
|
||||||
|
|
||||||
|
private Resources.Theme mTheme;
|
||||||
|
|
||||||
|
@Before
|
||||||
|
public void setUp() {
|
||||||
|
Context context = InstrumentationRegistry.getTargetContext();
|
||||||
|
mTheme = context.getTheme();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void obtainStyledAttributesForViewFromMaterial() {
|
||||||
|
final BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||||
|
while (state.keepRunning()) {
|
||||||
|
mTheme.obtainStyledAttributes(android.R.style.Theme_Material, android.R.styleable.View);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -23,9 +23,10 @@ import android.database.sqlite.SQLiteCursor;
|
|||||||
import android.database.sqlite.SQLiteDatabase;
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
import android.perftests.utils.BenchmarkState;
|
import android.perftests.utils.BenchmarkState;
|
||||||
import android.perftests.utils.PerfStatusReporter;
|
import android.perftests.utils.PerfStatusReporter;
|
||||||
import android.support.test.InstrumentationRegistry;
|
|
||||||
import android.support.test.filters.LargeTest;
|
import androidx.test.InstrumentationRegistry;
|
||||||
import android.support.test.runner.AndroidJUnit4;
|
import androidx.test.filters.LargeTest;
|
||||||
|
import androidx.test.runner.AndroidJUnit4;
|
||||||
|
|
||||||
import org.junit.AfterClass;
|
import org.junit.AfterClass;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
|
|||||||
@@ -16,17 +16,20 @@
|
|||||||
|
|
||||||
package android.database;
|
package android.database;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.ContentValues;
|
import android.content.ContentValues;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.database.sqlite.SQLiteDatabase;
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.test.InstrumentationRegistry;
|
|
||||||
import android.support.test.filters.LargeTest;
|
|
||||||
import android.support.test.runner.AndroidJUnit4;
|
|
||||||
import android.util.ArrayMap;
|
import android.util.ArrayMap;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
import androidx.test.InstrumentationRegistry;
|
||||||
|
import androidx.test.filters.LargeTest;
|
||||||
|
import androidx.test.runner.AndroidJUnit4;
|
||||||
|
|
||||||
import com.android.internal.util.Preconditions;
|
import com.android.internal.util.Preconditions;
|
||||||
|
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
@@ -40,8 +43,6 @@ import java.nio.file.Files;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Performance tests for measuring amount of data written during typical DB operations
|
* Performance tests for measuring amount of data written during typical DB operations
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -16,14 +16,18 @@
|
|||||||
|
|
||||||
package android.database;
|
package android.database;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
import android.content.ContentValues;
|
import android.content.ContentValues;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.database.sqlite.SQLiteDatabase;
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
import android.perftests.utils.BenchmarkState;
|
import android.perftests.utils.BenchmarkState;
|
||||||
import android.perftests.utils.PerfStatusReporter;
|
import android.perftests.utils.PerfStatusReporter;
|
||||||
import android.support.test.InstrumentationRegistry;
|
|
||||||
import android.support.test.filters.LargeTest;
|
import androidx.test.InstrumentationRegistry;
|
||||||
import android.support.test.runner.AndroidJUnit4;
|
import androidx.test.filters.LargeTest;
|
||||||
|
import androidx.test.runner.AndroidJUnit4;
|
||||||
|
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
@@ -33,9 +37,6 @@ import org.junit.runner.RunWith;
|
|||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
|
||||||
import static org.junit.Assert.assertTrue;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Performance tests for typical CRUD operations and loading rows into the Cursor
|
* Performance tests for typical CRUD operations and loading rows into the Cursor
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -17,14 +17,15 @@
|
|||||||
package android.graphics.perftests;
|
package android.graphics.perftests;
|
||||||
|
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.Color;
|
|
||||||
import android.graphics.Bitmap.Config;
|
import android.graphics.Bitmap.Config;
|
||||||
|
import android.graphics.Color;
|
||||||
import android.graphics.Paint;
|
import android.graphics.Paint;
|
||||||
|
import android.graphics.RecordingCanvas;
|
||||||
|
import android.graphics.RenderNode;
|
||||||
import android.perftests.utils.BenchmarkState;
|
import android.perftests.utils.BenchmarkState;
|
||||||
import android.perftests.utils.PerfStatusReporter;
|
import android.perftests.utils.PerfStatusReporter;
|
||||||
import android.support.test.filters.LargeTest;
|
|
||||||
import android.view.DisplayListCanvas;
|
import androidx.test.filters.LargeTest;
|
||||||
import android.view.RenderNode;
|
|
||||||
|
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
@@ -43,7 +44,7 @@ public class CanvasPerfTest {
|
|||||||
RenderNode child = RenderNode.create("child", null);
|
RenderNode child = RenderNode.create("child", null);
|
||||||
child.setLeftTopRightBottom(50, 50, 100, 100);
|
child.setLeftTopRightBottom(50, 50, 100, 100);
|
||||||
|
|
||||||
DisplayListCanvas canvas = node.start(100, 100);
|
RecordingCanvas canvas = node.start(100, 100);
|
||||||
node.end(canvas);
|
node.end(canvas);
|
||||||
canvas = child.start(50, 50);
|
canvas = child.start(50, 50);
|
||||||
canvas.drawColor(Color.WHITE);
|
canvas.drawColor(Color.WHITE);
|
||||||
@@ -70,7 +71,7 @@ public class CanvasPerfTest {
|
|||||||
BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||||
RenderNode node = RenderNode.create("benchmark", null);
|
RenderNode node = RenderNode.create("benchmark", null);
|
||||||
|
|
||||||
DisplayListCanvas canvas = node.start(100, 100);
|
RecordingCanvas canvas = node.start(100, 100);
|
||||||
node.end(canvas);
|
node.end(canvas);
|
||||||
Bitmap bitmap = Bitmap.createBitmap(80, 80, Config.ARGB_8888);
|
Bitmap bitmap = Bitmap.createBitmap(80, 80, Config.ARGB_8888);
|
||||||
Paint paint = new Paint();
|
Paint paint = new Paint();
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ package android.graphics.perftests;
|
|||||||
import android.graphics.Outline;
|
import android.graphics.Outline;
|
||||||
import android.perftests.utils.BenchmarkState;
|
import android.perftests.utils.BenchmarkState;
|
||||||
import android.perftests.utils.PerfStatusReporter;
|
import android.perftests.utils.PerfStatusReporter;
|
||||||
import android.support.test.filters.LargeTest;
|
|
||||||
import android.view.RenderNode;
|
import androidx.test.filters.LargeTest;
|
||||||
|
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|||||||
@@ -20,17 +20,18 @@ import android.graphics.Paint;
|
|||||||
import android.perftests.utils.BenchmarkState;
|
import android.perftests.utils.BenchmarkState;
|
||||||
import android.perftests.utils.PerfStatusReporter;
|
import android.perftests.utils.PerfStatusReporter;
|
||||||
import android.perftests.utils.StubActivity;
|
import android.perftests.utils.StubActivity;
|
||||||
import android.support.test.filters.LargeTest;
|
|
||||||
import android.support.test.rule.ActivityTestRule;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
import androidx.test.filters.LargeTest;
|
||||||
import java.util.Collection;
|
import androidx.test.rule.ActivityTestRule;
|
||||||
|
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.junit.runners.Parameterized.Parameters;
|
|
||||||
import org.junit.runners.Parameterized;
|
import org.junit.runners.Parameterized;
|
||||||
|
import org.junit.runners.Parameterized.Parameters;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
@LargeTest
|
@LargeTest
|
||||||
@RunWith(Parameterized.class)
|
@RunWith(Parameterized.class)
|
||||||
|
|||||||
@@ -19,9 +19,10 @@ package android.graphics.perftests;
|
|||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.perftests.utils.BenchmarkState;
|
import android.perftests.utils.BenchmarkState;
|
||||||
import android.perftests.utils.PerfStatusReporter;
|
import android.perftests.utils.PerfStatusReporter;
|
||||||
import android.support.test.filters.LargeTest;
|
|
||||||
import android.text.TextPaint;
|
import android.text.TextPaint;
|
||||||
|
|
||||||
|
import androidx.test.filters.LargeTest;
|
||||||
|
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
|||||||
@@ -20,7 +20,8 @@ import android.graphics.Path;
|
|||||||
import android.graphics.RectF;
|
import android.graphics.RectF;
|
||||||
import android.perftests.utils.BenchmarkState;
|
import android.perftests.utils.BenchmarkState;
|
||||||
import android.perftests.utils.PerfStatusReporter;
|
import android.perftests.utils.PerfStatusReporter;
|
||||||
import android.support.test.filters.LargeTest;
|
|
||||||
|
import androidx.test.filters.LargeTest;
|
||||||
|
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|||||||
@@ -17,17 +17,15 @@
|
|||||||
package android.graphics.perftests;
|
package android.graphics.perftests;
|
||||||
|
|
||||||
import android.graphics.Outline;
|
import android.graphics.Outline;
|
||||||
|
import android.graphics.RenderNode;
|
||||||
import android.perftests.utils.BenchmarkState;
|
import android.perftests.utils.BenchmarkState;
|
||||||
import android.perftests.utils.PerfStatusReporter;
|
import android.perftests.utils.PerfStatusReporter;
|
||||||
import android.support.test.filters.LargeTest;
|
|
||||||
import android.view.DisplayListCanvas;
|
import androidx.test.filters.LargeTest;
|
||||||
import android.view.RenderNode;
|
|
||||||
|
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
@LargeTest
|
@LargeTest
|
||||||
public class RenderNodePerfTest {
|
public class RenderNodePerfTest {
|
||||||
@Rule
|
@Rule
|
||||||
@@ -47,8 +45,7 @@ public class RenderNodePerfTest {
|
|||||||
public void testCreateRenderNodeNoName() {
|
public void testCreateRenderNodeNoName() {
|
||||||
final BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
final BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||||
while (state.keepRunning()) {
|
while (state.keepRunning()) {
|
||||||
RenderNode node = RenderNode.create(null, null);
|
RenderNode.create(null, null);
|
||||||
node.destroy();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,8 +53,7 @@ public class RenderNodePerfTest {
|
|||||||
public void testCreateRenderNode() {
|
public void testCreateRenderNode() {
|
||||||
final BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
final BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||||
while (state.keepRunning()) {
|
while (state.keepRunning()) {
|
||||||
RenderNode node = RenderNode.create("LinearLayout", null);
|
RenderNode.create("LinearLayout", null);
|
||||||
node.destroy();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -66,7 +62,7 @@ public class RenderNodePerfTest {
|
|||||||
final BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
final BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||||
RenderNode node = RenderNode.create("LinearLayout", null);
|
RenderNode node = RenderNode.create("LinearLayout", null);
|
||||||
while (state.keepRunning()) {
|
while (state.keepRunning()) {
|
||||||
node.isValid();
|
node.hasDisplayList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -75,8 +71,8 @@ public class RenderNodePerfTest {
|
|||||||
final BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
final BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||||
RenderNode node = RenderNode.create("LinearLayout", null);
|
RenderNode node = RenderNode.create("LinearLayout", null);
|
||||||
while (state.keepRunning()) {
|
while (state.keepRunning()) {
|
||||||
DisplayListCanvas canvas = node.start(100, 100);
|
node.beginRecording(100, 100);
|
||||||
node.end(canvas);
|
node.endRecording();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -84,17 +80,16 @@ public class RenderNodePerfTest {
|
|||||||
public void testStartEndDeepHierarchy() {
|
public void testStartEndDeepHierarchy() {
|
||||||
final BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
final BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||||
RenderNode[] nodes = new RenderNode[30];
|
RenderNode[] nodes = new RenderNode[30];
|
||||||
DisplayListCanvas[] canvases = new DisplayListCanvas[nodes.length];
|
|
||||||
for (int i = 0; i < nodes.length; i++) {
|
for (int i = 0; i < nodes.length; i++) {
|
||||||
nodes[i] = RenderNode.create("LinearLayout", null);
|
nodes[i] = RenderNode.create("LinearLayout", null);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (state.keepRunning()) {
|
while (state.keepRunning()) {
|
||||||
for (int i = 0; i < nodes.length; i++) {
|
for (int i = 0; i < nodes.length; i++) {
|
||||||
canvases[i] = nodes[i].start(100, 100);
|
nodes[i].beginRecording(100, 100);
|
||||||
}
|
}
|
||||||
for (int i = nodes.length - 1; i >= 0; i--) {
|
for (int i = nodes.length - 1; i >= 0; i--) {
|
||||||
nodes[i].end(canvases[i]);
|
nodes[i].endRecording();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,12 +18,20 @@ package android.graphics.perftests;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.res.AssetManager;
|
import android.content.res.AssetManager;
|
||||||
|
import android.content.res.Resources;
|
||||||
import android.graphics.Typeface;
|
import android.graphics.Typeface;
|
||||||
import android.perftests.utils.BenchmarkState;
|
import android.perftests.utils.BenchmarkState;
|
||||||
import android.perftests.utils.PerfStatusReporter;
|
import android.perftests.utils.PerfStatusReporter;
|
||||||
import android.support.test.InstrumentationRegistry;
|
|
||||||
import android.support.test.filters.LargeTest;
|
import androidx.test.InstrumentationRegistry;
|
||||||
import android.support.test.runner.AndroidJUnit4;
|
import androidx.test.filters.LargeTest;
|
||||||
|
import androidx.test.runner.AndroidJUnit4;
|
||||||
|
|
||||||
|
import com.android.perftests.core.R;
|
||||||
|
|
||||||
|
import org.junit.Rule;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
@@ -31,10 +39,6 @@ import java.io.IOException;
|
|||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
|
||||||
import org.junit.Rule;
|
|
||||||
import org.junit.Test;
|
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
|
|
||||||
@LargeTest
|
@LargeTest
|
||||||
@RunWith(AndroidJUnit4.class)
|
@RunWith(AndroidJUnit4.class)
|
||||||
public class TypefaceCreatePerfTest {
|
public class TypefaceCreatePerfTest {
|
||||||
@@ -103,4 +107,15 @@ public class TypefaceCreatePerfTest {
|
|||||||
|
|
||||||
outFile.delete();
|
outFile.delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCreate_fromResources() {
|
||||||
|
BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||||
|
final Resources r = InstrumentationRegistry.getContext().getResources();
|
||||||
|
|
||||||
|
while (state.keepRunning()) {
|
||||||
|
Typeface face = r.getFont(R.font.samplefont);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
|
|
||||||
package android.graphics.perftests;
|
package android.graphics.perftests;
|
||||||
|
|
||||||
|
import static junit.framework.Assert.assertTrue;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
@@ -25,21 +27,17 @@ import android.perftests.utils.BenchmarkState;
|
|||||||
import android.perftests.utils.BitmapUtils;
|
import android.perftests.utils.BitmapUtils;
|
||||||
import android.perftests.utils.PerfStatusReporter;
|
import android.perftests.utils.PerfStatusReporter;
|
||||||
import android.perftests.utils.StubActivity;
|
import android.perftests.utils.StubActivity;
|
||||||
import android.support.test.InstrumentationRegistry;
|
|
||||||
import android.support.test.rule.ActivityTestRule;
|
|
||||||
import android.support.test.runner.AndroidJUnit4;
|
|
||||||
import android.test.suitebuilder.annotation.LargeTest;
|
import android.test.suitebuilder.annotation.LargeTest;
|
||||||
|
|
||||||
|
import androidx.test.rule.ActivityTestRule;
|
||||||
|
import androidx.test.runner.AndroidJUnit4;
|
||||||
|
|
||||||
import com.android.perftests.core.R;
|
import com.android.perftests.core.R;
|
||||||
|
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import static junit.framework.Assert.assertTrue;
|
|
||||||
|
|
||||||
@RunWith(AndroidJUnit4.class)
|
@RunWith(AndroidJUnit4.class)
|
||||||
@LargeTest
|
@LargeTest
|
||||||
public class VectorDrawablePerfTest {
|
public class VectorDrawablePerfTest {
|
||||||
|
|||||||
@@ -18,10 +18,13 @@ package android.os;
|
|||||||
|
|
||||||
import android.perftests.utils.BenchmarkState;
|
import android.perftests.utils.BenchmarkState;
|
||||||
import android.perftests.utils.PerfStatusReporter;
|
import android.perftests.utils.PerfStatusReporter;
|
||||||
import android.support.test.filters.LargeTest;
|
|
||||||
import android.support.test.runner.AndroidJUnit4;
|
import androidx.test.filters.LargeTest;
|
||||||
|
import androidx.test.runner.AndroidJUnit4;
|
||||||
|
|
||||||
import com.android.internal.os.BinderCallsStats;
|
import com.android.internal.os.BinderCallsStats;
|
||||||
|
import com.android.internal.os.BinderInternal.CallSession;
|
||||||
|
import com.android.internal.os.CachedDeviceState;
|
||||||
|
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
@@ -29,15 +32,30 @@ import org.junit.Rule;
|
|||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
import static org.junit.Assert.assertNull;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Performance tests for {@link BinderCallsStats}
|
* Performance tests for {@link BinderCallsStats}
|
||||||
*/
|
*/
|
||||||
@RunWith(AndroidJUnit4.class)
|
@RunWith(AndroidJUnit4.class)
|
||||||
@LargeTest
|
@LargeTest
|
||||||
public class BinderCallsStatsPerfTest {
|
public class BinderCallsStatsPerfTest {
|
||||||
|
private static final int DEFAULT_BUCKET_SIZE = 1000;
|
||||||
|
private static final int WORKSOURCE_UID = 1;
|
||||||
|
static class FakeCpuTimeBinderCallsStats extends BinderCallsStats {
|
||||||
|
private int mTimeMs;
|
||||||
|
|
||||||
|
FakeCpuTimeBinderCallsStats() {
|
||||||
|
super(new BinderCallsStats.Injector());
|
||||||
|
setDeviceState(new CachedDeviceState(false, false).getReadonlyClient());
|
||||||
|
}
|
||||||
|
|
||||||
|
protected long getThreadTimeMicro() {
|
||||||
|
return mTimeMs++;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected long getElapsedRealtimeMicro() {
|
||||||
|
return mTimeMs++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Rule
|
@Rule
|
||||||
public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
|
public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
|
||||||
@@ -45,7 +63,9 @@ public class BinderCallsStatsPerfTest {
|
|||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
mBinderCallsStats = new BinderCallsStats(true);
|
mBinderCallsStats = new BinderCallsStats(new BinderCallsStats.Injector());
|
||||||
|
CachedDeviceState deviceState = new CachedDeviceState(false, false);
|
||||||
|
mBinderCallsStats.setDeviceState(deviceState.getReadonlyClient());
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
@After
|
||||||
@@ -54,25 +74,53 @@ public class BinderCallsStatsPerfTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void timeCallSession() {
|
public void timeCallSession() {
|
||||||
final BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
mBinderCallsStats.setDetailedTracking(true);
|
||||||
Binder b = new Binder();
|
runScenario(DEFAULT_BUCKET_SIZE);
|
||||||
int i = 0;
|
}
|
||||||
while (state.keepRunning()) {
|
|
||||||
BinderCallsStats.CallSession s = mBinderCallsStats.callStarted(b, i % 100);
|
@Test
|
||||||
mBinderCallsStats.callEnded(s);
|
public void timeCallSessionOnePercentSampling() {
|
||||||
i++;
|
mBinderCallsStats.setDetailedTracking(false);
|
||||||
}
|
mBinderCallsStats.setSamplingInterval(100);
|
||||||
|
runScenario(DEFAULT_BUCKET_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void timeCallSessionTrackingDisabled() {
|
public void timeCallSessionTrackingDisabled() {
|
||||||
final BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
mBinderCallsStats.setDetailedTracking(false);
|
||||||
Binder b = new Binder();
|
runScenario(DEFAULT_BUCKET_SIZE);
|
||||||
mBinderCallsStats = new BinderCallsStats(false);
|
|
||||||
while (state.keepRunning()) {
|
|
||||||
BinderCallsStats.CallSession s = mBinderCallsStats.callStarted(b, 0);
|
|
||||||
mBinderCallsStats.callEnded(s);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void timeCallSession_1000_buckets_cpuNotRecorded() {
|
||||||
|
mBinderCallsStats = new FakeCpuTimeBinderCallsStats();
|
||||||
|
mBinderCallsStats.setSamplingInterval(1);
|
||||||
|
runScenario(/* max bucket size */ 1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void timeCallSession_500_buckets_cpuNotRecorded() {
|
||||||
|
mBinderCallsStats = new FakeCpuTimeBinderCallsStats();
|
||||||
|
mBinderCallsStats.setSamplingInterval(1);
|
||||||
|
runScenario(/* max bucket size */ 500);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void timeCallSession_100_buckets_cpuNotRecorded() {
|
||||||
|
mBinderCallsStats = new FakeCpuTimeBinderCallsStats();
|
||||||
|
mBinderCallsStats.setSamplingInterval(1);
|
||||||
|
runScenario(/* max bucket size */ 100);
|
||||||
|
}
|
||||||
|
|
||||||
|
// There will be a warmup time of maxBucketSize to initialize the map of CallStat.
|
||||||
|
private void runScenario(int maxBucketSize) {
|
||||||
|
final BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||||
|
Binder b = new Binder();
|
||||||
|
while (state.keepRunning()) {
|
||||||
|
for (int i = 0; i < 10000; i++) {
|
||||||
|
CallSession s = mBinderCallsStats.callStarted(b, i % maxBucketSize, WORKSOURCE_UID);
|
||||||
|
mBinderCallsStats.callEnded(s, 0, 0, WORKSOURCE_UID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,80 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2018 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package android.os;
|
||||||
|
|
||||||
|
import android.perftests.utils.BenchmarkState;
|
||||||
|
import android.perftests.utils.PerfStatusReporter;
|
||||||
|
|
||||||
|
import androidx.test.filters.LargeTest;
|
||||||
|
import androidx.test.runner.AndroidJUnit4;
|
||||||
|
|
||||||
|
import org.junit.Rule;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Performance tests collecting CPU data different mechanisms.
|
||||||
|
*/
|
||||||
|
@RunWith(AndroidJUnit4.class)
|
||||||
|
@LargeTest
|
||||||
|
public class CpuUsageTrackingPerfTest {
|
||||||
|
@Rule
|
||||||
|
public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void timeSystemThread() {
|
||||||
|
final BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||||
|
Binder b = new Binder();
|
||||||
|
while (state.keepRunning()) {
|
||||||
|
SystemClock.currentThreadTimeMicro();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void timeReadStatFileDirectly() throws Exception {
|
||||||
|
final BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||||
|
// CPU usage by frequency for this pid. Data is in text format.
|
||||||
|
final String procFile = "/proc/self/stat";
|
||||||
|
while (state.keepRunning()) {
|
||||||
|
byte[] data = Files.readAllBytes(Paths.get(procFile));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void timeReadPidProcDirectly() throws Exception {
|
||||||
|
final BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||||
|
// CPU usage by frequency for this pid. Data is in text format.
|
||||||
|
final String procFile = "/proc/self/time_in_state";
|
||||||
|
while (state.keepRunning()) {
|
||||||
|
byte[] data = Files.readAllBytes(Paths.get(procFile));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void timeReadThreadProcDirectly() throws Exception {
|
||||||
|
final BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||||
|
// CPU usage by frequency for this UID. Data is in text format.
|
||||||
|
final String procFile = "/proc/self/task/" + android.os.Process.myTid()
|
||||||
|
+ "/time_in_state";
|
||||||
|
while (state.keepRunning()) {
|
||||||
|
byte[] data = Files.readAllBytes(Paths.get(procFile));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2018 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package android.os;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertNotNull;
|
||||||
|
|
||||||
|
import android.perftests.utils.BenchmarkState;
|
||||||
|
import android.perftests.utils.PerfStatusReporter;
|
||||||
|
|
||||||
|
import androidx.test.filters.LargeTest;
|
||||||
|
import androidx.test.runner.AndroidJUnit4;
|
||||||
|
|
||||||
|
import com.android.internal.os.KernelCpuThreadReader;
|
||||||
|
|
||||||
|
import org.junit.Rule;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Performance tests collecting per-thread CPU data.
|
||||||
|
*/
|
||||||
|
@RunWith(AndroidJUnit4.class)
|
||||||
|
@LargeTest
|
||||||
|
public class KernelCpuThreadReaderPerfTest {
|
||||||
|
@Rule
|
||||||
|
public final PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
|
||||||
|
|
||||||
|
private final KernelCpuThreadReader mKernelCpuThreadReader =
|
||||||
|
KernelCpuThreadReader.create(8, uid -> 1000 <= uid && uid < 2000);
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void timeReadCurrentProcessCpuUsage() {
|
||||||
|
final BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||||
|
assertNotNull(mKernelCpuThreadReader);
|
||||||
|
while (state.keepRunning()) {
|
||||||
|
this.mKernelCpuThreadReader.getProcessCpuUsage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,96 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2018 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package android.os;
|
||||||
|
|
||||||
|
|
||||||
|
import android.perftests.utils.BenchmarkState;
|
||||||
|
import android.perftests.utils.PerfStatusReporter;
|
||||||
|
|
||||||
|
import androidx.test.filters.LargeTest;
|
||||||
|
import androidx.test.runner.AndroidJUnit4;
|
||||||
|
|
||||||
|
import com.android.internal.os.CachedDeviceState;
|
||||||
|
import com.android.internal.os.LooperStats;
|
||||||
|
|
||||||
|
import org.junit.After;
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Rule;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Performance tests for {@link LooperStats}.
|
||||||
|
*/
|
||||||
|
@RunWith(AndroidJUnit4.class)
|
||||||
|
@LargeTest
|
||||||
|
public class LooperStatsPerfTest {
|
||||||
|
private static final int DISTINCT_MESSAGE_COUNT = 1000;
|
||||||
|
|
||||||
|
@Rule
|
||||||
|
public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
|
||||||
|
private LooperStats mStats;
|
||||||
|
private CachedDeviceState mDeviceState;
|
||||||
|
private HandlerThread mThread;
|
||||||
|
private Message[] mMessages = new Message[DISTINCT_MESSAGE_COUNT];
|
||||||
|
|
||||||
|
@Before
|
||||||
|
public void setUp() {
|
||||||
|
mStats = new LooperStats(1, DISTINCT_MESSAGE_COUNT - 1);
|
||||||
|
mDeviceState = new CachedDeviceState(false, false);
|
||||||
|
mStats.setDeviceState(mDeviceState.getReadonlyClient());
|
||||||
|
// The tests are all single-threaded. HandlerThread is created to allow creating Handlers.
|
||||||
|
mThread = new HandlerThread("UnusedThread");
|
||||||
|
mThread.start();
|
||||||
|
for (int i = 0; i < DISTINCT_MESSAGE_COUNT; i++) {
|
||||||
|
mMessages[i] = mThread.getThreadHandler().obtainMessage(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@After
|
||||||
|
public void tearDown() {
|
||||||
|
mThread.quit();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void timeHundredPercentSampling() {
|
||||||
|
mStats.setSamplingInterval(1);
|
||||||
|
runScenario();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void timeOnePercentSampling() {
|
||||||
|
mStats.setSamplingInterval(100);
|
||||||
|
runScenario();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void timeCollectionDisabled() {
|
||||||
|
// We do not collect data on charger.
|
||||||
|
mDeviceState.setCharging(true);
|
||||||
|
runScenario();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void runScenario() {
|
||||||
|
final BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||||
|
while (state.keepRunning()) {
|
||||||
|
for (int i = 0; i < DISTINCT_MESSAGE_COUNT; i++) {
|
||||||
|
Object token = mStats.messageDispatchStarting();
|
||||||
|
mStats.messageDispatched(token, mMessages[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -16,20 +16,16 @@
|
|||||||
|
|
||||||
package android.os;
|
package android.os;
|
||||||
|
|
||||||
import static android.content.pm.PackageManager.PERMISSION_DENIED;
|
|
||||||
import static android.content.pm.PackageManager.PERMISSION_GRANTED;
|
|
||||||
|
|
||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.perftests.utils.BenchmarkState;
|
import android.perftests.utils.BenchmarkState;
|
||||||
import android.perftests.utils.PerfStatusReporter;
|
import android.perftests.utils.PerfStatusReporter;
|
||||||
import android.support.test.InstrumentationRegistry;
|
|
||||||
import android.support.test.filters.LargeTest;
|
|
||||||
import android.support.test.runner.AndroidJUnit4;
|
|
||||||
|
|
||||||
import org.junit.Assert;
|
import androidx.test.InstrumentationRegistry;
|
||||||
|
import androidx.test.filters.LargeTest;
|
||||||
|
import androidx.test.runner.AndroidJUnit4;
|
||||||
|
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
|||||||
@@ -18,7 +18,8 @@ package android.os;
|
|||||||
|
|
||||||
import android.perftests.utils.BenchmarkState;
|
import android.perftests.utils.BenchmarkState;
|
||||||
import android.perftests.utils.PerfStatusReporter;
|
import android.perftests.utils.PerfStatusReporter;
|
||||||
import android.support.test.filters.LargeTest;
|
|
||||||
|
import androidx.test.filters.LargeTest;
|
||||||
|
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
|
|||||||
@@ -16,10 +16,15 @@
|
|||||||
|
|
||||||
package android.os;
|
package android.os;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import static org.junit.Assert.assertNull;
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
import android.perftests.utils.BenchmarkState;
|
import android.perftests.utils.BenchmarkState;
|
||||||
import android.perftests.utils.PerfStatusReporter;
|
import android.perftests.utils.PerfStatusReporter;
|
||||||
import android.support.test.filters.LargeTest;
|
|
||||||
import android.support.test.runner.AndroidJUnit4;
|
import androidx.test.filters.LargeTest;
|
||||||
|
import androidx.test.runner.AndroidJUnit4;
|
||||||
|
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
@@ -27,10 +32,6 @@ import org.junit.Rule;
|
|||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
|
||||||
import static org.junit.Assert.assertNull;
|
|
||||||
import static org.junit.Assert.assertTrue;
|
|
||||||
|
|
||||||
@RunWith(AndroidJUnit4.class)
|
@RunWith(AndroidJUnit4.class)
|
||||||
@LargeTest
|
@LargeTest
|
||||||
public class ParcelPerfTest {
|
public class ParcelPerfTest {
|
||||||
|
|||||||
@@ -18,8 +18,9 @@ package android.os;
|
|||||||
|
|
||||||
import android.perftests.utils.BenchmarkState;
|
import android.perftests.utils.BenchmarkState;
|
||||||
import android.perftests.utils.PerfStatusReporter;
|
import android.perftests.utils.PerfStatusReporter;
|
||||||
import android.support.test.filters.LargeTest;
|
|
||||||
import android.support.test.runner.AndroidJUnit4;
|
import androidx.test.filters.LargeTest;
|
||||||
|
import androidx.test.runner.AndroidJUnit4;
|
||||||
|
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|||||||
@@ -20,9 +20,10 @@ import android.content.Context;
|
|||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.perftests.utils.BenchmarkState;
|
import android.perftests.utils.BenchmarkState;
|
||||||
import android.perftests.utils.PerfStatusReporter;
|
import android.perftests.utils.PerfStatusReporter;
|
||||||
import android.support.test.InstrumentationRegistry;
|
|
||||||
import android.support.test.filters.LargeTest;
|
import androidx.test.InstrumentationRegistry;
|
||||||
import android.support.test.runner.AndroidJUnit4;
|
import androidx.test.filters.LargeTest;
|
||||||
|
import androidx.test.runner.AndroidJUnit4;
|
||||||
|
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|||||||
@@ -23,17 +23,21 @@ import android.content.ServiceConnection;
|
|||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.perftests.utils.BenchmarkState;
|
import android.perftests.utils.BenchmarkState;
|
||||||
import android.perftests.utils.PerfStatusReporter;
|
import android.perftests.utils.PerfStatusReporter;
|
||||||
import android.support.test.InstrumentationRegistry;
|
|
||||||
import android.support.test.filters.LargeTest;
|
import androidx.test.InstrumentationRegistry;
|
||||||
import android.support.test.runner.AndroidJUnit4;
|
import androidx.test.filters.LargeTest;
|
||||||
|
import androidx.test.runner.AndroidJUnit4;
|
||||||
|
|
||||||
import com.google.common.util.concurrent.SettableFuture;
|
import com.google.common.util.concurrent.SettableFuture;
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.concurrent.ExecutionException;
|
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.concurrent.ExecutionException;
|
||||||
|
|
||||||
@RunWith(AndroidJUnit4.class)
|
@RunWith(AndroidJUnit4.class)
|
||||||
@LargeTest
|
@LargeTest
|
||||||
public class StrictModeTest {
|
public class StrictModeTest {
|
||||||
|
|||||||
87
apct-tests/perftests/core/src/android/os/TracePerfTest.java
Normal file
87
apct-tests/perftests/core/src/android/os/TracePerfTest.java
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2018 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy of
|
||||||
|
* the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations under
|
||||||
|
* the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
package android.os;
|
||||||
|
|
||||||
|
import android.perftests.utils.BenchmarkState;
|
||||||
|
import android.perftests.utils.PerfStatusReporter;
|
||||||
|
import android.perftests.utils.ShellHelper;
|
||||||
|
|
||||||
|
import androidx.test.runner.AndroidJUnit4;
|
||||||
|
|
||||||
|
import org.junit.AfterClass;
|
||||||
|
import org.junit.Assert;
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.BeforeClass;
|
||||||
|
import org.junit.Rule;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
|
@RunWith(AndroidJUnit4.class)
|
||||||
|
public class TracePerfTest {
|
||||||
|
@Rule
|
||||||
|
public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
|
||||||
|
|
||||||
|
@BeforeClass
|
||||||
|
public static void startTracing() {
|
||||||
|
ShellHelper.runShellCommandRaw("atrace -c --async_start -a *");
|
||||||
|
}
|
||||||
|
|
||||||
|
@AfterClass
|
||||||
|
public static void endTracing() {
|
||||||
|
ShellHelper.runShellCommandRaw("atrace --async_stop");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Before
|
||||||
|
public void verifyTracingEnabled() {
|
||||||
|
Assert.assertTrue(Trace.isEnabled());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testEnabled() {
|
||||||
|
BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||||
|
while (state.keepRunning()) {
|
||||||
|
Trace.isEnabled();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testBeginEndSection() {
|
||||||
|
BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||||
|
while (state.keepRunning()) {
|
||||||
|
Trace.beginSection("testBeginEndSection");
|
||||||
|
Trace.endSection();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testAsyncBeginEnd() {
|
||||||
|
BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||||
|
while (state.keepRunning()) {
|
||||||
|
Trace.beginAsyncSection("testAsyncBeginEnd", 42);
|
||||||
|
Trace.endAsyncSection("testAsyncBeginEnd", 42);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCounter() {
|
||||||
|
BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||||
|
while (state.keepRunning()) {
|
||||||
|
Trace.setCounter("testCounter", 123);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -18,8 +18,9 @@ package android.perftests;
|
|||||||
|
|
||||||
import android.perftests.utils.BenchmarkState;
|
import android.perftests.utils.BenchmarkState;
|
||||||
import android.perftests.utils.PerfStatusReporter;
|
import android.perftests.utils.PerfStatusReporter;
|
||||||
import android.support.test.filters.LargeTest;
|
|
||||||
import android.support.test.runner.AndroidJUnit4;
|
import androidx.test.filters.LargeTest;
|
||||||
|
import androidx.test.runner.AndroidJUnit4;
|
||||||
|
|
||||||
import dalvik.annotation.optimization.FastNative;
|
import dalvik.annotation.optimization.FastNative;
|
||||||
|
|
||||||
|
|||||||
@@ -18,12 +18,13 @@ package android.text;
|
|||||||
import static android.text.Layout.Alignment.ALIGN_NORMAL;
|
import static android.text.Layout.Alignment.ALIGN_NORMAL;
|
||||||
|
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
|
import android.graphics.RecordingCanvas;
|
||||||
|
import android.graphics.RenderNode;
|
||||||
import android.perftests.utils.BenchmarkState;
|
import android.perftests.utils.BenchmarkState;
|
||||||
import android.perftests.utils.PerfStatusReporter;
|
import android.perftests.utils.PerfStatusReporter;
|
||||||
import android.support.test.filters.LargeTest;
|
|
||||||
import android.text.NonEditableTextGenerator.TextType;
|
import android.text.NonEditableTextGenerator.TextType;
|
||||||
import android.view.DisplayListCanvas;
|
|
||||||
import android.view.RenderNode;
|
import androidx.test.filters.LargeTest;
|
||||||
|
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
@@ -46,7 +47,7 @@ public class BoringLayoutCreateDrawPerfTest {
|
|||||||
private static final float SPACING_ADD = 10f;
|
private static final float SPACING_ADD = 10f;
|
||||||
private static final float SPACING_MULT = 1.5f;
|
private static final float SPACING_MULT = 1.5f;
|
||||||
|
|
||||||
@Parameterized.Parameters(name = "cached={3},{1}chars,{0}")
|
@Parameterized.Parameters(name = "cached {3} {1}chars {0}")
|
||||||
public static Collection cases() {
|
public static Collection cases() {
|
||||||
final List<Object[]> params = new ArrayList<>();
|
final List<Object[]> params = new ArrayList<>();
|
||||||
for (int length : new int[]{128}) {
|
for (int length : new int[]{128}) {
|
||||||
@@ -120,7 +121,7 @@ public class BoringLayoutCreateDrawPerfTest {
|
|||||||
while (state.keepRunning()) {
|
while (state.keepRunning()) {
|
||||||
|
|
||||||
state.pauseTiming();
|
state.pauseTiming();
|
||||||
final DisplayListCanvas canvas = node.start(1200, 200);
|
final RecordingCanvas canvas = node.start(1200, 200);
|
||||||
final int save = canvas.save();
|
final int save = canvas.save();
|
||||||
if (!mCached) Canvas.freeTextLayoutCaches();
|
if (!mCached) Canvas.freeTextLayoutCaches();
|
||||||
state.resumeTiming();
|
state.resumeTiming();
|
||||||
|
|||||||
@@ -18,9 +18,10 @@ package android.text;
|
|||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.perftests.utils.BenchmarkState;
|
import android.perftests.utils.BenchmarkState;
|
||||||
import android.perftests.utils.PerfStatusReporter;
|
import android.perftests.utils.PerfStatusReporter;
|
||||||
import android.support.test.filters.LargeTest;
|
|
||||||
import android.text.NonEditableTextGenerator.TextType;
|
import android.text.NonEditableTextGenerator.TextType;
|
||||||
|
|
||||||
|
import androidx.test.filters.LargeTest;
|
||||||
|
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
@@ -40,7 +41,7 @@ public class BoringLayoutIsBoringPerfTest {
|
|||||||
|
|
||||||
private static final boolean[] BOOLEANS = new boolean[]{false, true};
|
private static final boolean[] BOOLEANS = new boolean[]{false, true};
|
||||||
|
|
||||||
@Parameterized.Parameters(name = "cached={4},{1}chars,{0}")
|
@Parameterized.Parameters(name = "cached {4} {1}chars {0}")
|
||||||
public static Collection cases() {
|
public static Collection cases() {
|
||||||
final List<Object[]> params = new ArrayList<>();
|
final List<Object[]> params = new ArrayList<>();
|
||||||
for (int length : new int[]{128}) {
|
for (int length : new int[]{128}) {
|
||||||
|
|||||||
@@ -0,0 +1,71 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2018 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package android.text;
|
||||||
|
|
||||||
|
import android.graphics.RecordingCanvas;
|
||||||
|
import android.graphics.RenderNode;
|
||||||
|
import android.perftests.utils.BenchmarkState;
|
||||||
|
import android.perftests.utils.PerfStatusReporter;
|
||||||
|
|
||||||
|
import androidx.test.filters.LargeTest;
|
||||||
|
import androidx.test.runner.AndroidJUnit4;
|
||||||
|
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Rule;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
@LargeTest
|
||||||
|
@RunWith(AndroidJUnit4.class)
|
||||||
|
public class CanvasDrawTextTest {
|
||||||
|
private static final int WORD_LENGTH = 9; // Random word has 9 characters.
|
||||||
|
|
||||||
|
private static final TextPaint PAINT = new TextPaint();
|
||||||
|
|
||||||
|
@Rule
|
||||||
|
public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
|
||||||
|
|
||||||
|
private TextPerfUtils mTextUtil = new TextPerfUtils();
|
||||||
|
|
||||||
|
@Before
|
||||||
|
public void setUp() {
|
||||||
|
mTextUtil.resetRandom(0 /* seed */);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void drawText_LongText_SmallWindow() {
|
||||||
|
final BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||||
|
final String text = mTextUtil.nextRandomParagraph(
|
||||||
|
WORD_LENGTH, 4 * 1024 * 1024 /* 4mb text */).toString();
|
||||||
|
final RenderNode node = RenderNode.create("benchmark", null);
|
||||||
|
final RenderNode child = RenderNode.create("child", null);
|
||||||
|
child.setLeftTopRightBottom(50, 50, 100, 100);
|
||||||
|
|
||||||
|
RecordingCanvas canvas = node.start(100, 100);
|
||||||
|
node.end(canvas);
|
||||||
|
canvas = child.start(50, 50);
|
||||||
|
child.end(canvas);
|
||||||
|
|
||||||
|
final Random r = new Random(0);
|
||||||
|
|
||||||
|
while (state.keepRunning()) {
|
||||||
|
int start = r.nextInt(text.length() - 100);
|
||||||
|
canvas.drawText(text, start, start + 100, 0, 0, PAINT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -24,11 +24,12 @@ import android.graphics.Paint.FontMetricsInt;
|
|||||||
import android.perftests.utils.BenchmarkState;
|
import android.perftests.utils.BenchmarkState;
|
||||||
import android.perftests.utils.PerfStatusReporter;
|
import android.perftests.utils.PerfStatusReporter;
|
||||||
import android.perftests.utils.StubActivity;
|
import android.perftests.utils.StubActivity;
|
||||||
import android.support.test.filters.LargeTest;
|
|
||||||
import android.support.test.rule.ActivityTestRule;
|
|
||||||
import android.text.style.ReplacementSpan;
|
import android.text.style.ReplacementSpan;
|
||||||
import android.util.ArraySet;
|
import android.util.ArraySet;
|
||||||
|
|
||||||
|
import androidx.test.filters.LargeTest;
|
||||||
|
import androidx.test.rule.ActivityTestRule;
|
||||||
|
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
|||||||
@@ -17,11 +17,12 @@ package android.text;
|
|||||||
|
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.graphics.Paint;
|
import android.graphics.Paint;
|
||||||
|
import android.graphics.RecordingCanvas;
|
||||||
|
import android.graphics.RenderNode;
|
||||||
import android.perftests.utils.BenchmarkState;
|
import android.perftests.utils.BenchmarkState;
|
||||||
import android.perftests.utils.PerfStatusReporter;
|
import android.perftests.utils.PerfStatusReporter;
|
||||||
import android.support.test.filters.LargeTest;
|
|
||||||
import android.view.DisplayListCanvas;
|
import androidx.test.filters.LargeTest;
|
||||||
import android.view.RenderNode;
|
|
||||||
|
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
@@ -42,7 +43,7 @@ public class PaintMeasureDrawPerfTest {
|
|||||||
|
|
||||||
private static final boolean[] BOOLEANS = new boolean[]{false, true};
|
private static final boolean[] BOOLEANS = new boolean[]{false, true};
|
||||||
|
|
||||||
@Parameterized.Parameters(name = "cached={1},{0}chars")
|
@Parameterized.Parameters(name = "cached {1} {0}chars")
|
||||||
public static Collection cases() {
|
public static Collection cases() {
|
||||||
final List<Object[]> params = new ArrayList<>();
|
final List<Object[]> params = new ArrayList<>();
|
||||||
for (int length : new int[]{128}) {
|
for (int length : new int[]{128}) {
|
||||||
@@ -107,7 +108,7 @@ public class PaintMeasureDrawPerfTest {
|
|||||||
while (state.keepRunning()) {
|
while (state.keepRunning()) {
|
||||||
|
|
||||||
state.pauseTiming();
|
state.pauseTiming();
|
||||||
final DisplayListCanvas canvas = node.start(1200, 200);
|
final RecordingCanvas canvas = node.start(1200, 200);
|
||||||
final int save = canvas.save();
|
final int save = canvas.save();
|
||||||
if (!mCached) Canvas.freeTextLayoutCaches();
|
if (!mCached) Canvas.freeTextLayoutCaches();
|
||||||
state.resumeTiming();
|
state.resumeTiming();
|
||||||
|
|||||||
@@ -16,32 +16,18 @@
|
|||||||
|
|
||||||
package android.text;
|
package android.text;
|
||||||
|
|
||||||
import static android.text.TextDirectionHeuristics.LTR;
|
|
||||||
|
|
||||||
import android.perftests.utils.BenchmarkState;
|
|
||||||
import android.perftests.utils.PerfStatusReporter;
|
|
||||||
|
|
||||||
import android.support.test.filters.LargeTest;
|
|
||||||
import android.support.test.runner.AndroidJUnit4;
|
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.test.InstrumentationRegistry;
|
|
||||||
import android.content.res.ColorStateList;
|
import androidx.test.InstrumentationRegistry;
|
||||||
import android.graphics.Canvas;
|
import androidx.test.filters.LargeTest;
|
||||||
import android.graphics.Typeface;
|
import androidx.test.runner.AndroidJUnit4;
|
||||||
import android.text.Layout;
|
|
||||||
import android.text.style.TextAppearanceSpan;
|
|
||||||
import android.view.DisplayListCanvas;
|
|
||||||
import android.view.RenderNode;
|
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Rule;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
import java.nio.CharBuffer;
|
import java.util.Locale;
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
@LargeTest
|
@LargeTest
|
||||||
@RunWith(AndroidJUnit4.class)
|
@RunWith(AndroidJUnit4.class)
|
||||||
@@ -49,9 +35,7 @@ public class PrecomputedTextMemoryUsageTest {
|
|||||||
private static final int WORD_LENGTH = 9; // Random word has 9 characters.
|
private static final int WORD_LENGTH = 9; // Random word has 9 characters.
|
||||||
private static final boolean NO_STYLE_TEXT = false;
|
private static final boolean NO_STYLE_TEXT = false;
|
||||||
|
|
||||||
private static TextPaint PAINT = new TextPaint();
|
private static int TRIAL_COUNT = 10;
|
||||||
|
|
||||||
private static int TRIAL_COUNT = 100;
|
|
||||||
|
|
||||||
public PrecomputedTextMemoryUsageTest() {}
|
public PrecomputedTextMemoryUsageTest() {}
|
||||||
|
|
||||||
@@ -75,9 +59,10 @@ public class PrecomputedTextMemoryUsageTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMemoryUsage_NoHyphenation() {
|
public void testMemoryUsage_Latin_NoHyphenation() {
|
||||||
|
TextPaint paint = new TextPaint();
|
||||||
int[] memories = new int[TRIAL_COUNT];
|
int[] memories = new int[TRIAL_COUNT];
|
||||||
final PrecomputedText.Params param = new PrecomputedText.Params.Builder(PAINT)
|
final PrecomputedText.Params param = new PrecomputedText.Params.Builder(paint)
|
||||||
.setBreakStrategy(Layout.BREAK_STRATEGY_SIMPLE)
|
.setBreakStrategy(Layout.BREAK_STRATEGY_SIMPLE)
|
||||||
.setHyphenationFrequency(Layout.HYPHENATION_FREQUENCY_NONE)
|
.setHyphenationFrequency(Layout.HYPHENATION_FREQUENCY_NONE)
|
||||||
.build();
|
.build();
|
||||||
@@ -88,13 +73,14 @@ public class PrecomputedTextMemoryUsageTest {
|
|||||||
mTextUtil.nextRandomParagraph(WORD_LENGTH, NO_STYLE_TEXT), param)
|
mTextUtil.nextRandomParagraph(WORD_LENGTH, NO_STYLE_TEXT), param)
|
||||||
.getMemoryUsage();
|
.getMemoryUsage();
|
||||||
}
|
}
|
||||||
reportMemoryUsage(median(memories), "MemoryUsage_NoHyphenation");
|
reportMemoryUsage(median(memories), "MemoryUsage_Latin_NoHyphenation");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMemoryUsage_Hyphenation() {
|
public void testMemoryUsage_Latin_Hyphenation() {
|
||||||
|
TextPaint paint = new TextPaint();
|
||||||
int[] memories = new int[TRIAL_COUNT];
|
int[] memories = new int[TRIAL_COUNT];
|
||||||
final PrecomputedText.Params param = new PrecomputedText.Params.Builder(PAINT)
|
final PrecomputedText.Params param = new PrecomputedText.Params.Builder(paint)
|
||||||
.setBreakStrategy(Layout.BREAK_STRATEGY_BALANCED)
|
.setBreakStrategy(Layout.BREAK_STRATEGY_BALANCED)
|
||||||
.setHyphenationFrequency(Layout.HYPHENATION_FREQUENCY_NORMAL)
|
.setHyphenationFrequency(Layout.HYPHENATION_FREQUENCY_NORMAL)
|
||||||
.build();
|
.build();
|
||||||
@@ -105,48 +91,97 @@ public class PrecomputedTextMemoryUsageTest {
|
|||||||
mTextUtil.nextRandomParagraph(WORD_LENGTH, NO_STYLE_TEXT), param)
|
mTextUtil.nextRandomParagraph(WORD_LENGTH, NO_STYLE_TEXT), param)
|
||||||
.getMemoryUsage();
|
.getMemoryUsage();
|
||||||
}
|
}
|
||||||
reportMemoryUsage(median(memories), "MemoryUsage_Hyphenation");
|
reportMemoryUsage(median(memories), "MemoryUsage_Latin_Hyphenation");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMemoryUsage_NoHyphenation_WidthOnly() {
|
public void testMemoryUsage_CJK_NoHyphenation() {
|
||||||
|
TextPaint paint = new TextPaint();
|
||||||
int[] memories = new int[TRIAL_COUNT];
|
int[] memories = new int[TRIAL_COUNT];
|
||||||
final PrecomputedText.Params param = new PrecomputedText.Params.Builder(PAINT)
|
final PrecomputedText.Params param = new PrecomputedText.Params.Builder(paint)
|
||||||
.setBreakStrategy(Layout.BREAK_STRATEGY_SIMPLE)
|
.setBreakStrategy(Layout.BREAK_STRATEGY_SIMPLE)
|
||||||
.setHyphenationFrequency(Layout.HYPHENATION_FREQUENCY_NONE)
|
.setHyphenationFrequency(Layout.HYPHENATION_FREQUENCY_NONE)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
// Report median of randomly generated PrecomputedText.
|
// Report median of randomly generated PrecomputedText.
|
||||||
for (int i = 0; i < TRIAL_COUNT; ++i) {
|
for (int i = 0; i < TRIAL_COUNT; ++i) {
|
||||||
CharSequence cs = mTextUtil.nextRandomParagraph(WORD_LENGTH, NO_STYLE_TEXT);
|
memories[i] = PrecomputedText.create(
|
||||||
PrecomputedText.ParagraphInfo[] paragraphInfo =
|
mTextUtil.nextRandomParagraph(WORD_LENGTH, NO_STYLE_TEXT, "[\\u4E00-\\u9FA0]"),
|
||||||
PrecomputedText.createMeasuredParagraphs(cs, param, 0, cs.length(), false);
|
param).getMemoryUsage();
|
||||||
memories[i] = 0;
|
|
||||||
for (PrecomputedText.ParagraphInfo info : paragraphInfo) {
|
|
||||||
memories[i] += info.measured.getMemoryUsage();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
reportMemoryUsage(median(memories), "MemoryUsage_NoHyphenation_WidthOnly");
|
reportMemoryUsage(median(memories), "MemoryUsage_CJK_NoHyphenation");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMemoryUsage_Hyphenatation_WidthOnly() {
|
public void testMemoryUsage_CJK_Hyphenation() {
|
||||||
|
TextPaint paint = new TextPaint();
|
||||||
int[] memories = new int[TRIAL_COUNT];
|
int[] memories = new int[TRIAL_COUNT];
|
||||||
final PrecomputedText.Params param = new PrecomputedText.Params.Builder(PAINT)
|
final PrecomputedText.Params param = new PrecomputedText.Params.Builder(paint)
|
||||||
.setBreakStrategy(Layout.BREAK_STRATEGY_BALANCED)
|
.setBreakStrategy(Layout.BREAK_STRATEGY_BALANCED)
|
||||||
.setHyphenationFrequency(Layout.HYPHENATION_FREQUENCY_NORMAL)
|
.setHyphenationFrequency(Layout.HYPHENATION_FREQUENCY_NORMAL)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
// Report median of randomly generated PrecomputedText.
|
// Report median of randomly generated PrecomputedText.
|
||||||
for (int i = 0; i < TRIAL_COUNT; ++i) {
|
for (int i = 0; i < TRIAL_COUNT; ++i) {
|
||||||
CharSequence cs = mTextUtil.nextRandomParagraph(WORD_LENGTH, NO_STYLE_TEXT);
|
memories[i] = PrecomputedText.create(
|
||||||
PrecomputedText.ParagraphInfo[] paragraphInfo =
|
mTextUtil.nextRandomParagraph(WORD_LENGTH, NO_STYLE_TEXT, "[\\u4E00-\\u9FA0]"),
|
||||||
PrecomputedText.createMeasuredParagraphs(cs, param, 0, cs.length(), false);
|
param).getMemoryUsage();
|
||||||
memories[i] = 0;
|
|
||||||
for (PrecomputedText.ParagraphInfo info : paragraphInfo) {
|
|
||||||
memories[i] += info.measured.getMemoryUsage();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
reportMemoryUsage(median(memories), "MemoryUsage_Hyphenation_WidthOnly");
|
reportMemoryUsage(median(memories), "MemoryUsage_CJK_Hyphenation");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testMemoryUsage_Arabic_NoHyphenation() {
|
||||||
|
TextPaint paint = new TextPaint();
|
||||||
|
paint.setTextLocale(Locale.forLanguageTag("ar"));
|
||||||
|
int[] memories = new int[TRIAL_COUNT];
|
||||||
|
final PrecomputedText.Params param = new PrecomputedText.Params.Builder(paint)
|
||||||
|
.setBreakStrategy(Layout.BREAK_STRATEGY_SIMPLE)
|
||||||
|
.setHyphenationFrequency(Layout.HYPHENATION_FREQUENCY_NONE)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
// Report median of randomly generated PrecomputedText.
|
||||||
|
for (int i = 0; i < TRIAL_COUNT; ++i) {
|
||||||
|
memories[i] = PrecomputedText.create(
|
||||||
|
mTextUtil.nextRandomParagraph(WORD_LENGTH, NO_STYLE_TEXT, "[\\u0600-\\u06FF]"),
|
||||||
|
param).getMemoryUsage();
|
||||||
|
}
|
||||||
|
reportMemoryUsage(median(memories), "MemoryUsage_Arabic_NoHyphenation");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testMemoryUsage_Arabic_Hyphenation() {
|
||||||
|
TextPaint paint = new TextPaint();
|
||||||
|
paint.setTextLocale(Locale.forLanguageTag("ar"));
|
||||||
|
int[] memories = new int[TRIAL_COUNT];
|
||||||
|
final PrecomputedText.Params param = new PrecomputedText.Params.Builder(paint)
|
||||||
|
.setBreakStrategy(Layout.BREAK_STRATEGY_BALANCED)
|
||||||
|
.setHyphenationFrequency(Layout.HYPHENATION_FREQUENCY_NORMAL)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
// Report median of randomly generated PrecomputedText.
|
||||||
|
for (int i = 0; i < TRIAL_COUNT; ++i) {
|
||||||
|
memories[i] = PrecomputedText.create(
|
||||||
|
mTextUtil.nextRandomParagraph(WORD_LENGTH, NO_STYLE_TEXT, "[\\u0600-\\u06FF]"),
|
||||||
|
param).getMemoryUsage();
|
||||||
|
}
|
||||||
|
reportMemoryUsage(median(memories), "MemoryUsage_Arabic_Hyphenation");
|
||||||
|
}
|
||||||
|
@Test
|
||||||
|
public void testMemoryUsage_Emoji() {
|
||||||
|
TextPaint paint = new TextPaint();
|
||||||
|
int[] memories = new int[TRIAL_COUNT];
|
||||||
|
final PrecomputedText.Params param = new PrecomputedText.Params.Builder(paint)
|
||||||
|
.setBreakStrategy(Layout.BREAK_STRATEGY_SIMPLE)
|
||||||
|
.setHyphenationFrequency(Layout.HYPHENATION_FREQUENCY_NONE)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
// Report median of randomly generated PrecomputedText.
|
||||||
|
for (int i = 0; i < TRIAL_COUNT; ++i) {
|
||||||
|
memories[i] = PrecomputedText.create(
|
||||||
|
mTextUtil.nextRandomParagraph(WORD_LENGTH, NO_STYLE_TEXT, "[:emoji:]"),
|
||||||
|
param).getMemoryUsage();
|
||||||
|
}
|
||||||
|
reportMemoryUsage(median(memories), "MemoryUsage_Emoji_NoHyphenation");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,30 +16,17 @@
|
|||||||
|
|
||||||
package android.text;
|
package android.text;
|
||||||
|
|
||||||
import static android.text.TextDirectionHeuristics.LTR;
|
|
||||||
|
|
||||||
import android.perftests.utils.BenchmarkState;
|
import android.perftests.utils.BenchmarkState;
|
||||||
import android.perftests.utils.PerfStatusReporter;
|
import android.perftests.utils.PerfStatusReporter;
|
||||||
|
|
||||||
import android.support.test.filters.LargeTest;
|
import androidx.test.filters.LargeTest;
|
||||||
import android.support.test.runner.AndroidJUnit4;
|
import androidx.test.runner.AndroidJUnit4;
|
||||||
|
|
||||||
import android.content.res.ColorStateList;
|
|
||||||
import android.graphics.Canvas;
|
|
||||||
import android.graphics.Typeface;
|
|
||||||
import android.text.Layout;
|
|
||||||
import android.text.style.TextAppearanceSpan;
|
|
||||||
import android.view.DisplayListCanvas;
|
|
||||||
import android.view.RenderNode;
|
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
import java.nio.CharBuffer;
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
@LargeTest
|
@LargeTest
|
||||||
@RunWith(AndroidJUnit4.class)
|
@RunWith(AndroidJUnit4.class)
|
||||||
public class PrecomputedTextPerfTest {
|
public class PrecomputedTextPerfTest {
|
||||||
|
|||||||
@@ -18,12 +18,13 @@ package android.text;
|
|||||||
import static android.text.Layout.Alignment.ALIGN_NORMAL;
|
import static android.text.Layout.Alignment.ALIGN_NORMAL;
|
||||||
|
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
|
import android.graphics.RecordingCanvas;
|
||||||
|
import android.graphics.RenderNode;
|
||||||
import android.perftests.utils.BenchmarkState;
|
import android.perftests.utils.BenchmarkState;
|
||||||
import android.perftests.utils.PerfStatusReporter;
|
import android.perftests.utils.PerfStatusReporter;
|
||||||
import android.support.test.filters.LargeTest;
|
|
||||||
import android.text.NonEditableTextGenerator.TextType;
|
import android.text.NonEditableTextGenerator.TextType;
|
||||||
import android.view.DisplayListCanvas;
|
|
||||||
import android.view.RenderNode;
|
import androidx.test.filters.LargeTest;
|
||||||
|
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
@@ -50,7 +51,7 @@ public class StaticLayoutCreateDrawPerfTest {
|
|||||||
@Rule
|
@Rule
|
||||||
public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
|
public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
|
||||||
|
|
||||||
@Parameterized.Parameters(name = "cached={3},{1}chars,{0}")
|
@Parameterized.Parameters(name = "cached {3} {1}chars {0}")
|
||||||
public static Collection cases() {
|
public static Collection cases() {
|
||||||
final List<Object[]> params = new ArrayList<>();
|
final List<Object[]> params = new ArrayList<>();
|
||||||
for (int length : new int[]{128}) {
|
for (int length : new int[]{128}) {
|
||||||
@@ -119,7 +120,7 @@ public class StaticLayoutCreateDrawPerfTest {
|
|||||||
while (state.keepRunning()) {
|
while (state.keepRunning()) {
|
||||||
|
|
||||||
state.pauseTiming();
|
state.pauseTiming();
|
||||||
final DisplayListCanvas canvas = node.start(1200, 200);
|
final RecordingCanvas canvas = node.start(1200, 200);
|
||||||
int save = canvas.save();
|
int save = canvas.save();
|
||||||
if (!mCached) Canvas.freeTextLayoutCaches();
|
if (!mCached) Canvas.freeTextLayoutCaches();
|
||||||
state.resumeTiming();
|
state.resumeTiming();
|
||||||
|
|||||||
@@ -0,0 +1,100 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2018 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy of
|
||||||
|
* the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations under
|
||||||
|
* the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package android.text;
|
||||||
|
|
||||||
|
import android.perftests.utils.BenchmarkState;
|
||||||
|
import android.perftests.utils.PerfStatusReporter;
|
||||||
|
|
||||||
|
import androidx.test.filters.LargeTest;
|
||||||
|
import androidx.test.runner.AndroidJUnit4;
|
||||||
|
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Rule;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
|
@LargeTest
|
||||||
|
@RunWith(AndroidJUnit4.class)
|
||||||
|
public class StaticLayoutGetOffsetForHorizontalPerfTest {
|
||||||
|
private static final int WORD_LENGTH = 9; // Random word has 9 characters.
|
||||||
|
private static final int WORDS_IN_LINE = 64; // Roughly, 64 words in a line.
|
||||||
|
private static final boolean NO_STYLE_TEXT = false;
|
||||||
|
private static final boolean STYLE_TEXT = true;
|
||||||
|
|
||||||
|
private static TextPaint PAINT = new TextPaint();
|
||||||
|
static {
|
||||||
|
PAINT.setTextSize(16.0f);
|
||||||
|
}
|
||||||
|
private static final int TEXT_WIDTH = WORDS_IN_LINE * WORD_LENGTH * (int) PAINT.getTextSize();
|
||||||
|
|
||||||
|
public StaticLayoutGetOffsetForHorizontalPerfTest() {}
|
||||||
|
|
||||||
|
@Rule
|
||||||
|
public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
|
||||||
|
|
||||||
|
private TextPerfUtils mTextUtil = new TextPerfUtils();
|
||||||
|
|
||||||
|
@Before
|
||||||
|
public void setUp() {
|
||||||
|
mTextUtil.resetRandom(0 /* seed */);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testGetOffsetForHorizontal_LTR() {
|
||||||
|
final BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||||
|
while (state.keepRunning()) {
|
||||||
|
state.pauseTiming();
|
||||||
|
final CharSequence text = mTextUtil.nextRandomParagraph(WORD_LENGTH, NO_STYLE_TEXT,
|
||||||
|
"[a-zA-Z]");
|
||||||
|
StaticLayout layout =
|
||||||
|
StaticLayout.Builder.obtain(text, 0, text.length(), PAINT, TEXT_WIDTH).build();
|
||||||
|
state.resumeTiming();
|
||||||
|
|
||||||
|
layout.getOffsetForHorizontal(0, TEXT_WIDTH / 2.0f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testGetOffsetForHorizontal_RTL() {
|
||||||
|
final BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||||
|
while (state.keepRunning()) {
|
||||||
|
state.pauseTiming();
|
||||||
|
final CharSequence text = mTextUtil.nextRandomParagraph(WORD_LENGTH, NO_STYLE_TEXT,
|
||||||
|
"[:Arabic:]");
|
||||||
|
StaticLayout layout =
|
||||||
|
StaticLayout.Builder.obtain(text, 0, text.length(), PAINT, TEXT_WIDTH).build();
|
||||||
|
state.resumeTiming();
|
||||||
|
|
||||||
|
layout.getOffsetForHorizontal(0, TEXT_WIDTH / 2.0f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testGetOffsetForHorizontal_BiDi() {
|
||||||
|
final BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||||
|
while (state.keepRunning()) {
|
||||||
|
state.pauseTiming();
|
||||||
|
final CharSequence text = mTextUtil.nextRandomParagraph(WORD_LENGTH, NO_STYLE_TEXT,
|
||||||
|
"[[a-zA-Z][:Arabic:]]");
|
||||||
|
StaticLayout layout =
|
||||||
|
StaticLayout.Builder.obtain(text, 0, text.length(), PAINT, TEXT_WIDTH).build();
|
||||||
|
state.resumeTiming();
|
||||||
|
|
||||||
|
layout.getOffsetForHorizontal(0, TEXT_WIDTH / 2.0f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -19,17 +19,16 @@ package android.text;
|
|||||||
import android.perftests.utils.BenchmarkState;
|
import android.perftests.utils.BenchmarkState;
|
||||||
import android.perftests.utils.PerfStatusReporter;
|
import android.perftests.utils.PerfStatusReporter;
|
||||||
|
|
||||||
import android.support.test.filters.LargeTest;
|
import androidx.test.filters.LargeTest;
|
||||||
import android.support.test.runner.AndroidJUnit4;
|
import androidx.test.runner.AndroidJUnit4;
|
||||||
|
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
import java.util.concurrent.CountDownLatch;
|
import java.util.concurrent.CountDownLatch;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
|
||||||
@LargeTest
|
@LargeTest
|
||||||
@RunWith(AndroidJUnit4.class)
|
@RunWith(AndroidJUnit4.class)
|
||||||
|
|||||||
@@ -16,30 +16,20 @@
|
|||||||
|
|
||||||
package android.text;
|
package android.text;
|
||||||
|
|
||||||
import static android.text.TextDirectionHeuristics.LTR;
|
import android.graphics.Canvas;
|
||||||
|
import android.graphics.RecordingCanvas;
|
||||||
|
import android.graphics.RenderNode;
|
||||||
import android.perftests.utils.BenchmarkState;
|
import android.perftests.utils.BenchmarkState;
|
||||||
import android.perftests.utils.PerfStatusReporter;
|
import android.perftests.utils.PerfStatusReporter;
|
||||||
|
|
||||||
import android.support.test.filters.LargeTest;
|
import androidx.test.filters.LargeTest;
|
||||||
import android.support.test.runner.AndroidJUnit4;
|
import androidx.test.runner.AndroidJUnit4;
|
||||||
|
|
||||||
import android.content.res.ColorStateList;
|
|
||||||
import android.graphics.Canvas;
|
|
||||||
import android.graphics.Typeface;
|
|
||||||
import android.text.Layout;
|
|
||||||
import android.text.style.TextAppearanceSpan;
|
|
||||||
import android.view.DisplayListCanvas;
|
|
||||||
import android.view.RenderNode;
|
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
import java.nio.CharBuffer;
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
@LargeTest
|
@LargeTest
|
||||||
@RunWith(AndroidJUnit4.class)
|
@RunWith(AndroidJUnit4.class)
|
||||||
public class StaticLayoutPerfTest {
|
public class StaticLayoutPerfTest {
|
||||||
@@ -179,6 +169,25 @@ public class StaticLayoutPerfTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCreate_PrecomputedText_NoStyled_Greedy_NoHyphenation_DirDifferent() {
|
||||||
|
final BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||||
|
while (state.keepRunning()) {
|
||||||
|
state.pauseTiming();
|
||||||
|
final PrecomputedText text = makeMeasured(
|
||||||
|
mTextUtil.nextRandomParagraph(WORD_LENGTH, NO_STYLE_TEXT), PAINT,
|
||||||
|
Layout.BREAK_STRATEGY_SIMPLE, Layout.HYPHENATION_FREQUENCY_NONE);
|
||||||
|
Canvas.freeTextLayoutCaches();
|
||||||
|
state.resumeTiming();
|
||||||
|
|
||||||
|
StaticLayout.Builder.obtain(text, 0, text.length(), PAINT, TEXT_WIDTH)
|
||||||
|
.setHyphenationFrequency(Layout.HYPHENATION_FREQUENCY_NONE)
|
||||||
|
.setBreakStrategy(Layout.BREAK_STRATEGY_SIMPLE)
|
||||||
|
.setTextDirection(TextDirectionHeuristics.RTL)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCreate_PrecomputedText_NoStyled_Greedy_Hyphenation() {
|
public void testCreate_PrecomputedText_NoStyled_Greedy_Hyphenation() {
|
||||||
final BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
final BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||||
@@ -256,10 +265,11 @@ public class StaticLayoutPerfTest {
|
|||||||
state.pauseTiming();
|
state.pauseTiming();
|
||||||
final StaticLayout layout =
|
final StaticLayout layout =
|
||||||
StaticLayout.Builder.obtain(text, 0, text.length(), PAINT, TEXT_WIDTH).build();
|
StaticLayout.Builder.obtain(text, 0, text.length(), PAINT, TEXT_WIDTH).build();
|
||||||
final DisplayListCanvas c = node.start(1200, 200);
|
final RecordingCanvas c = node.beginRecording(1200, 200);
|
||||||
state.resumeTiming();
|
state.resumeTiming();
|
||||||
|
|
||||||
layout.draw(c);
|
layout.draw(c);
|
||||||
|
node.endRecording();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -272,10 +282,11 @@ public class StaticLayoutPerfTest {
|
|||||||
final CharSequence text = mTextUtil.nextRandomParagraph(WORD_LENGTH, STYLE_TEXT);
|
final CharSequence text = mTextUtil.nextRandomParagraph(WORD_LENGTH, STYLE_TEXT);
|
||||||
final StaticLayout layout =
|
final StaticLayout layout =
|
||||||
StaticLayout.Builder.obtain(text, 0, text.length(), PAINT, TEXT_WIDTH).build();
|
StaticLayout.Builder.obtain(text, 0, text.length(), PAINT, TEXT_WIDTH).build();
|
||||||
final DisplayListCanvas c = node.start(1200, 200);
|
final RecordingCanvas c = node.beginRecording(1200, 200);
|
||||||
state.resumeTiming();
|
state.resumeTiming();
|
||||||
|
|
||||||
layout.draw(c);
|
layout.draw(c);
|
||||||
|
node.endRecording();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -288,10 +299,11 @@ public class StaticLayoutPerfTest {
|
|||||||
final CharSequence text = mTextUtil.nextRandomParagraph(WORD_LENGTH, NO_STYLE_TEXT);
|
final CharSequence text = mTextUtil.nextRandomParagraph(WORD_LENGTH, NO_STYLE_TEXT);
|
||||||
final StaticLayout layout =
|
final StaticLayout layout =
|
||||||
StaticLayout.Builder.obtain(text, 0, text.length(), PAINT, TEXT_WIDTH).build();
|
StaticLayout.Builder.obtain(text, 0, text.length(), PAINT, TEXT_WIDTH).build();
|
||||||
final DisplayListCanvas c = node.start(1200, 200);
|
final RecordingCanvas c = node.beginRecording(1200, 200);
|
||||||
state.resumeTiming();
|
state.resumeTiming();
|
||||||
|
|
||||||
layout.draw(c);
|
layout.draw(c);
|
||||||
|
node.endRecording();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -304,11 +316,12 @@ public class StaticLayoutPerfTest {
|
|||||||
final CharSequence text = mTextUtil.nextRandomParagraph(WORD_LENGTH, STYLE_TEXT);
|
final CharSequence text = mTextUtil.nextRandomParagraph(WORD_LENGTH, STYLE_TEXT);
|
||||||
final StaticLayout layout =
|
final StaticLayout layout =
|
||||||
StaticLayout.Builder.obtain(text, 0, text.length(), PAINT, TEXT_WIDTH).build();
|
StaticLayout.Builder.obtain(text, 0, text.length(), PAINT, TEXT_WIDTH).build();
|
||||||
final DisplayListCanvas c = node.start(1200, 200);
|
final RecordingCanvas c = node.beginRecording(1200, 200);
|
||||||
Canvas.freeTextLayoutCaches();
|
Canvas.freeTextLayoutCaches();
|
||||||
state.resumeTiming();
|
state.resumeTiming();
|
||||||
|
|
||||||
layout.draw(c);
|
layout.draw(c);
|
||||||
|
node.endRecording();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -321,11 +334,12 @@ public class StaticLayoutPerfTest {
|
|||||||
final CharSequence text = mTextUtil.nextRandomParagraph(WORD_LENGTH, NO_STYLE_TEXT);
|
final CharSequence text = mTextUtil.nextRandomParagraph(WORD_LENGTH, NO_STYLE_TEXT);
|
||||||
final StaticLayout layout =
|
final StaticLayout layout =
|
||||||
StaticLayout.Builder.obtain(text, 0, text.length(), PAINT, TEXT_WIDTH).build();
|
StaticLayout.Builder.obtain(text, 0, text.length(), PAINT, TEXT_WIDTH).build();
|
||||||
final DisplayListCanvas c = node.start(1200, 200);
|
final RecordingCanvas c = node.beginRecording(1200, 200);
|
||||||
Canvas.freeTextLayoutCaches();
|
Canvas.freeTextLayoutCaches();
|
||||||
state.resumeTiming();
|
state.resumeTiming();
|
||||||
|
|
||||||
layout.draw(c);
|
layout.draw(c);
|
||||||
|
node.endRecording();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -339,10 +353,11 @@ public class StaticLayoutPerfTest {
|
|||||||
mTextUtil.nextRandomParagraph(WORD_LENGTH, STYLE_TEXT), PAINT);
|
mTextUtil.nextRandomParagraph(WORD_LENGTH, STYLE_TEXT), PAINT);
|
||||||
final StaticLayout layout =
|
final StaticLayout layout =
|
||||||
StaticLayout.Builder.obtain(text, 0, text.length(), PAINT, TEXT_WIDTH).build();
|
StaticLayout.Builder.obtain(text, 0, text.length(), PAINT, TEXT_WIDTH).build();
|
||||||
final DisplayListCanvas c = node.start(1200, 200);
|
final RecordingCanvas c = node.beginRecording(1200, 200);
|
||||||
state.resumeTiming();
|
state.resumeTiming();
|
||||||
|
|
||||||
layout.draw(c);
|
layout.draw(c);
|
||||||
|
node.endRecording();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -356,10 +371,11 @@ public class StaticLayoutPerfTest {
|
|||||||
mTextUtil.nextRandomParagraph(WORD_LENGTH, NO_STYLE_TEXT), PAINT);
|
mTextUtil.nextRandomParagraph(WORD_LENGTH, NO_STYLE_TEXT), PAINT);
|
||||||
final StaticLayout layout =
|
final StaticLayout layout =
|
||||||
StaticLayout.Builder.obtain(text, 0, text.length(), PAINT, TEXT_WIDTH).build();
|
StaticLayout.Builder.obtain(text, 0, text.length(), PAINT, TEXT_WIDTH).build();
|
||||||
final DisplayListCanvas c = node.start(1200, 200);
|
final RecordingCanvas c = node.beginRecording(1200, 200);
|
||||||
state.resumeTiming();
|
state.resumeTiming();
|
||||||
|
|
||||||
layout.draw(c);
|
layout.draw(c);
|
||||||
|
node.endRecording();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -373,11 +389,12 @@ public class StaticLayoutPerfTest {
|
|||||||
mTextUtil.nextRandomParagraph(WORD_LENGTH, STYLE_TEXT), PAINT);
|
mTextUtil.nextRandomParagraph(WORD_LENGTH, STYLE_TEXT), PAINT);
|
||||||
final StaticLayout layout =
|
final StaticLayout layout =
|
||||||
StaticLayout.Builder.obtain(text, 0, text.length(), PAINT, TEXT_WIDTH).build();
|
StaticLayout.Builder.obtain(text, 0, text.length(), PAINT, TEXT_WIDTH).build();
|
||||||
final DisplayListCanvas c = node.start(1200, 200);
|
final RecordingCanvas c = node.beginRecording(1200, 200);
|
||||||
Canvas.freeTextLayoutCaches();
|
Canvas.freeTextLayoutCaches();
|
||||||
state.resumeTiming();
|
state.resumeTiming();
|
||||||
|
|
||||||
layout.draw(c);
|
layout.draw(c);
|
||||||
|
node.endRecording();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -391,11 +408,12 @@ public class StaticLayoutPerfTest {
|
|||||||
mTextUtil.nextRandomParagraph(WORD_LENGTH, NO_STYLE_TEXT), PAINT);
|
mTextUtil.nextRandomParagraph(WORD_LENGTH, NO_STYLE_TEXT), PAINT);
|
||||||
final StaticLayout layout =
|
final StaticLayout layout =
|
||||||
StaticLayout.Builder.obtain(text, 0, text.length(), PAINT, TEXT_WIDTH).build();
|
StaticLayout.Builder.obtain(text, 0, text.length(), PAINT, TEXT_WIDTH).build();
|
||||||
final DisplayListCanvas c = node.start(1200, 200);
|
final RecordingCanvas c = node.beginRecording(1200, 200);
|
||||||
Canvas.freeTextLayoutCaches();
|
Canvas.freeTextLayoutCaches();
|
||||||
state.resumeTiming();
|
state.resumeTiming();
|
||||||
|
|
||||||
layout.draw(c);
|
layout.draw(c);
|
||||||
|
node.endRecording();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,28 +16,14 @@
|
|||||||
|
|
||||||
package android.text;
|
package android.text;
|
||||||
|
|
||||||
import static android.text.TextDirectionHeuristics.LTR;
|
|
||||||
|
|
||||||
import android.perftests.utils.BenchmarkState;
|
|
||||||
import android.perftests.utils.PerfStatusReporter;
|
|
||||||
|
|
||||||
import android.support.test.filters.LargeTest;
|
|
||||||
import android.support.test.runner.AndroidJUnit4;
|
|
||||||
|
|
||||||
import android.content.res.ColorStateList;
|
import android.content.res.ColorStateList;
|
||||||
import android.graphics.Canvas;
|
|
||||||
import android.graphics.Typeface;
|
import android.graphics.Typeface;
|
||||||
import android.text.Layout;
|
import android.icu.text.UnicodeSet;
|
||||||
|
import android.icu.text.UnicodeSetIterator;
|
||||||
import android.text.style.TextAppearanceSpan;
|
import android.text.style.TextAppearanceSpan;
|
||||||
import android.view.DisplayListCanvas;
|
|
||||||
import android.view.RenderNode;
|
|
||||||
|
|
||||||
import org.junit.Before;
|
|
||||||
import org.junit.Rule;
|
|
||||||
import org.junit.Test;
|
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
|
|
||||||
import java.nio.CharBuffer;
|
import java.nio.CharBuffer;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
public class TextPerfUtils {
|
public class TextPerfUtils {
|
||||||
@@ -46,8 +32,17 @@ public class TextPerfUtils {
|
|||||||
|
|
||||||
private Random mRandom = new Random(0);
|
private Random mRandom = new Random(0);
|
||||||
|
|
||||||
private static final String ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
private static final String[] ALPHABET;
|
||||||
private static final int ALPHABET_LENGTH = ALPHABET.length();
|
private static final int ALPHABET_LENGTH;
|
||||||
|
static {
|
||||||
|
String alphabets = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
||||||
|
ALPHABET_LENGTH = alphabets.length();
|
||||||
|
ALPHABET = new String[ALPHABET_LENGTH];
|
||||||
|
for (int i = 0; i < ALPHABET_LENGTH; ++i) {
|
||||||
|
ALPHABET[i] = Character.toString(alphabets.charAt(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private static final ColorStateList TEXT_COLOR = ColorStateList.valueOf(0x00000000);
|
private static final ColorStateList TEXT_COLOR = ColorStateList.valueOf(0x00000000);
|
||||||
private static final String[] FAMILIES = { "sans-serif", "serif", "monospace" };
|
private static final String[] FAMILIES = { "sans-serif", "serif", "monospace" };
|
||||||
@@ -55,30 +50,64 @@ public class TextPerfUtils {
|
|||||||
Typeface.NORMAL, Typeface.BOLD, Typeface.ITALIC, Typeface.BOLD_ITALIC
|
Typeface.NORMAL, Typeface.BOLD, Typeface.ITALIC, Typeface.BOLD_ITALIC
|
||||||
};
|
};
|
||||||
|
|
||||||
private final char[] mBuffer = new char[PARA_LENGTH];
|
|
||||||
|
|
||||||
public void resetRandom(long seed) {
|
public void resetRandom(long seed) {
|
||||||
mRandom = new Random(seed);
|
mRandom = new Random(seed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static String[] UnicodeSetToArray(String setStr) {
|
||||||
|
final UnicodeSet set = new UnicodeSet(setStr);
|
||||||
|
final UnicodeSetIterator iterator = new UnicodeSetIterator(set);
|
||||||
|
final ArrayList<String> out = new ArrayList<>(set.size());
|
||||||
|
while (iterator.next()) {
|
||||||
|
out.add(iterator.getString());
|
||||||
|
}
|
||||||
|
return out.toArray(new String[out.size()]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public CharSequence nextRandomParagraph(int wordLen, boolean applyRandomStyle, String setStr) {
|
||||||
|
return nextRandomParagraph(wordLen, PARA_LENGTH, applyRandomStyle,
|
||||||
|
UnicodeSetToArray(setStr));
|
||||||
|
}
|
||||||
|
|
||||||
public CharSequence nextRandomParagraph(int wordLen, boolean applyRandomStyle) {
|
public CharSequence nextRandomParagraph(int wordLen, boolean applyRandomStyle) {
|
||||||
for (int i = 0; i < PARA_LENGTH; i++) {
|
return nextRandomParagraph(wordLen, PARA_LENGTH, applyRandomStyle, ALPHABET);
|
||||||
|
}
|
||||||
|
|
||||||
|
public CharSequence nextRandomParagraph(int wordLen, int paraLength) {
|
||||||
|
return nextRandomParagraph(wordLen, paraLength, false /* no style */, ALPHABET);
|
||||||
|
}
|
||||||
|
|
||||||
|
public CharSequence nextRandomParagraph(int wordLen, int paraLength, boolean applyRandomStyle,
|
||||||
|
String[] charSet) {
|
||||||
|
ArrayList<Character> chars = new ArrayList<>();
|
||||||
|
ArrayList<Integer> wordOffsets = new ArrayList<>();
|
||||||
|
for (int i = 0; i < paraLength; i++) {
|
||||||
if (i % (wordLen + 1) == wordLen) {
|
if (i % (wordLen + 1) == wordLen) {
|
||||||
mBuffer[i] = ' ';
|
chars.add(' ');
|
||||||
|
wordOffsets.add(chars.size());
|
||||||
} else {
|
} else {
|
||||||
mBuffer[i] = ALPHABET.charAt(mRandom.nextInt(ALPHABET_LENGTH));
|
final String str = charSet[mRandom.nextInt(charSet.length)];
|
||||||
|
for (int j = 0; j < str.length(); ++j) {
|
||||||
|
chars.add(str.charAt(j));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
wordOffsets.add(chars.size());
|
||||||
|
|
||||||
CharSequence cs = CharBuffer.wrap(mBuffer);
|
char[] buffer = new char[chars.size()];
|
||||||
|
for (int i = 0; i < buffer.length; ++i) {
|
||||||
|
buffer[i] = chars.get(i);
|
||||||
|
}
|
||||||
|
CharSequence cs = CharBuffer.wrap(buffer);
|
||||||
if (!applyRandomStyle) {
|
if (!applyRandomStyle) {
|
||||||
return cs;
|
return cs;
|
||||||
}
|
}
|
||||||
|
|
||||||
SpannableStringBuilder ssb = new SpannableStringBuilder(cs);
|
SpannableStringBuilder ssb = new SpannableStringBuilder(cs);
|
||||||
for (int i = 0; i < ssb.length(); i += wordLen + 1) {
|
int prevWordStart = 0;
|
||||||
final int spanStart = i;
|
for (int i = 0; i < wordOffsets.size(); i++) {
|
||||||
final int spanEnd = (i + wordLen) > ssb.length() ? ssb.length() : i + wordLen;
|
final int spanStart = prevWordStart;
|
||||||
|
final int spanEnd = wordOffsets.get(i);
|
||||||
|
|
||||||
final TextAppearanceSpan span = new TextAppearanceSpan(
|
final TextAppearanceSpan span = new TextAppearanceSpan(
|
||||||
FAMILIES[mRandom.nextInt(FAMILIES.length)],
|
FAMILIES[mRandom.nextInt(FAMILIES.length)],
|
||||||
@@ -87,6 +116,7 @@ public class TextPerfUtils {
|
|||||||
TEXT_COLOR, TEXT_COLOR);
|
TEXT_COLOR, TEXT_COLOR);
|
||||||
|
|
||||||
ssb.setSpan(span, spanStart, spanEnd, Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
ssb.setSpan(span, spanStart, spanEnd, Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||||
|
prevWordStart = spanEnd;
|
||||||
}
|
}
|
||||||
return ssb;
|
return ssb;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,15 +19,16 @@ import static android.view.View.MeasureSpec.AT_MOST;
|
|||||||
import static android.view.View.MeasureSpec.UNSPECIFIED;
|
import static android.view.View.MeasureSpec.UNSPECIFIED;
|
||||||
|
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
|
import android.graphics.RecordingCanvas;
|
||||||
|
import android.graphics.RenderNode;
|
||||||
import android.perftests.utils.BenchmarkState;
|
import android.perftests.utils.BenchmarkState;
|
||||||
import android.perftests.utils.PerfStatusReporter;
|
import android.perftests.utils.PerfStatusReporter;
|
||||||
import android.support.test.InstrumentationRegistry;
|
|
||||||
import android.support.test.filters.LargeTest;
|
|
||||||
import android.text.NonEditableTextGenerator.TextType;
|
import android.text.NonEditableTextGenerator.TextType;
|
||||||
import android.view.DisplayListCanvas;
|
|
||||||
import android.view.RenderNode;
|
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.test.InstrumentationRegistry;
|
||||||
|
import androidx.test.filters.LargeTest;
|
||||||
|
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
@@ -51,7 +52,7 @@ public class TextViewSetTextMeasurePerfTest {
|
|||||||
@Rule
|
@Rule
|
||||||
public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
|
public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
|
||||||
|
|
||||||
@Parameterized.Parameters(name = "cached={3},{1}chars,{0}")
|
@Parameterized.Parameters(name = "cached {3} {1}chars {0}")
|
||||||
public static Collection cases() {
|
public static Collection cases() {
|
||||||
final List<Object[]> params = new ArrayList<>();
|
final List<Object[]> params = new ArrayList<>();
|
||||||
for (int length : new int[]{128}) {
|
for (int length : new int[]{128}) {
|
||||||
@@ -92,6 +93,8 @@ public class TextViewSetTextMeasurePerfTest {
|
|||||||
Canvas.freeTextLayoutCaches();
|
Canvas.freeTextLayoutCaches();
|
||||||
final CharSequence text = createRandomText(mLength);
|
final CharSequence text = createRandomText(mLength);
|
||||||
final TextView textView = new TextView(InstrumentationRegistry.getTargetContext());
|
final TextView textView = new TextView(InstrumentationRegistry.getTargetContext());
|
||||||
|
textView.setHyphenationFrequency(Layout.HYPHENATION_FREQUENCY_NONE);
|
||||||
|
|
||||||
textView.setText(text);
|
textView.setText(text);
|
||||||
state.resumeTiming();
|
state.resumeTiming();
|
||||||
|
|
||||||
@@ -119,13 +122,14 @@ public class TextViewSetTextMeasurePerfTest {
|
|||||||
final RenderNode node = RenderNode.create("benchmark", null);
|
final RenderNode node = RenderNode.create("benchmark", null);
|
||||||
final CharSequence text = createRandomText(mLength);
|
final CharSequence text = createRandomText(mLength);
|
||||||
final TextView textView = new TextView(InstrumentationRegistry.getTargetContext());
|
final TextView textView = new TextView(InstrumentationRegistry.getTargetContext());
|
||||||
|
textView.setHyphenationFrequency(Layout.HYPHENATION_FREQUENCY_NONE);
|
||||||
textView.setText(text);
|
textView.setText(text);
|
||||||
state.resumeTiming();
|
state.resumeTiming();
|
||||||
|
|
||||||
while (state.keepRunning()) {
|
while (state.keepRunning()) {
|
||||||
|
|
||||||
state.pauseTiming();
|
state.pauseTiming();
|
||||||
final DisplayListCanvas canvas = node.start(1200, 200);
|
final RecordingCanvas canvas = node.start(1200, 200);
|
||||||
int save = canvas.save();
|
int save = canvas.save();
|
||||||
textView.setTextLocale(Locale.UK);
|
textView.setTextLocale(Locale.UK);
|
||||||
textView.setTextLocale(Locale.US);
|
textView.setTextLocale(Locale.US);
|
||||||
|
|||||||
213
apct-tests/perftests/core/src/android/util/ArraySetPerfTest.java
Normal file
213
apct-tests/perftests/core/src/android/util/ArraySetPerfTest.java
Normal file
@@ -0,0 +1,213 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2018 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package android.util;
|
||||||
|
|
||||||
|
import android.perftests.utils.BenchmarkState;
|
||||||
|
import android.perftests.utils.PerfStatusReporter;
|
||||||
|
|
||||||
|
import androidx.test.filters.LargeTest;
|
||||||
|
import androidx.test.runner.AndroidJUnit4;
|
||||||
|
|
||||||
|
import org.junit.Rule;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
|
import java.util.function.Predicate;
|
||||||
|
|
||||||
|
@RunWith(AndroidJUnit4.class)
|
||||||
|
@LargeTest
|
||||||
|
public class ArraySetPerfTest {
|
||||||
|
private static final int NUM_ITERATIONS = 100;
|
||||||
|
private static final int SET_SIZE_SMALL = 10;
|
||||||
|
private static final int SET_SIZE_LARGE = 50;
|
||||||
|
|
||||||
|
@Rule
|
||||||
|
public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testValueAt_InBounds() {
|
||||||
|
BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||||
|
ArraySet<Integer> set = new ArraySet<>();
|
||||||
|
set.add(0);
|
||||||
|
while (state.keepRunning()) {
|
||||||
|
for (int i = 0; i < NUM_ITERATIONS; ++i) {
|
||||||
|
set.valueAt(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testValueAt_OutOfBounds_Negative() {
|
||||||
|
BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||||
|
ArraySet<Integer> set = new ArraySet<>();
|
||||||
|
while (state.keepRunning()) {
|
||||||
|
for (int i = 0; i < NUM_ITERATIONS; ++i) {
|
||||||
|
try {
|
||||||
|
set.valueAt(-1);
|
||||||
|
} catch (ArrayIndexOutOfBoundsException expected) {
|
||||||
|
// expected
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests the case where ArraySet could index into its array even though the index is out of
|
||||||
|
* bounds.
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testValueAt_OutOfBounds_EdgeCase() {
|
||||||
|
BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||||
|
ArraySet<Integer> set = new ArraySet<>();
|
||||||
|
set.add(0);
|
||||||
|
while (state.keepRunning()) {
|
||||||
|
for (int i = 0; i < NUM_ITERATIONS; ++i) {
|
||||||
|
try {
|
||||||
|
set.valueAt(1);
|
||||||
|
} catch (ArrayIndexOutOfBoundsException expected) {
|
||||||
|
// expected
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the same code as testRemoveIf_Small_* without the removeIf in order to measure
|
||||||
|
* the performance of the rest of the code in the loop.
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testRemoveIf_Small_Base() {
|
||||||
|
BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||||
|
Predicate<Integer> predicate = (i) -> i % 2 == 0;
|
||||||
|
while (state.keepRunning()) {
|
||||||
|
for (int i = 0; i < NUM_ITERATIONS; ++i) {
|
||||||
|
ArraySet<Integer> set = new ArraySet<>();
|
||||||
|
for (int j = 0; j < SET_SIZE_SMALL; ++j) {
|
||||||
|
set.add(j);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testRemoveIf_Small_RemoveNothing() {
|
||||||
|
BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||||
|
Predicate<Integer> predicate = (i) -> false;
|
||||||
|
while (state.keepRunning()) {
|
||||||
|
for (int i = 0; i < NUM_ITERATIONS; ++i) {
|
||||||
|
ArraySet<Integer> set = new ArraySet<>();
|
||||||
|
for (int j = 0; j < SET_SIZE_SMALL; ++j) {
|
||||||
|
set.add(j);
|
||||||
|
}
|
||||||
|
set.removeIf(predicate);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testRemoveIf_Small_RemoveAll() {
|
||||||
|
BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||||
|
Predicate<Integer> predicate = (i) -> true;
|
||||||
|
while (state.keepRunning()) {
|
||||||
|
for (int i = 0; i < NUM_ITERATIONS; ++i) {
|
||||||
|
ArraySet<Integer> set = new ArraySet<>();
|
||||||
|
for (int j = 0; j < SET_SIZE_SMALL; j++) {
|
||||||
|
set.add(j);
|
||||||
|
}
|
||||||
|
set.removeIf(predicate);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testRemoveIf_Small_RemoveHalf() {
|
||||||
|
BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||||
|
Predicate<Integer> predicate = (i) -> i % 2 == 0;
|
||||||
|
while (state.keepRunning()) {
|
||||||
|
for (int i = 0; i < NUM_ITERATIONS; ++i) {
|
||||||
|
ArraySet<Integer> set = new ArraySet<>();
|
||||||
|
for (int j = 0; j < SET_SIZE_SMALL; ++j) {
|
||||||
|
set.add(j);
|
||||||
|
}
|
||||||
|
set.removeIf(predicate);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the same code as testRemoveIf_Large_* without the removeIf in order to measure
|
||||||
|
* the performance of the rest of the code in the loop.
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testRemoveIf_Large_Base() {
|
||||||
|
BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||||
|
Predicate<Integer> predicate = (i) -> i % 2 == 0;
|
||||||
|
while (state.keepRunning()) {
|
||||||
|
for (int i = 0; i < NUM_ITERATIONS; ++i) {
|
||||||
|
ArraySet<Integer> set = new ArraySet<>();
|
||||||
|
for (int j = 0; j < SET_SIZE_LARGE; ++j) {
|
||||||
|
set.add(j);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testRemoveIf_Large_RemoveNothing() {
|
||||||
|
BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||||
|
Predicate<Integer> predicate = (i) -> false;
|
||||||
|
while (state.keepRunning()) {
|
||||||
|
for (int i = 0; i < NUM_ITERATIONS; ++i) {
|
||||||
|
ArraySet<Integer> set = new ArraySet<>();
|
||||||
|
for (int j = 0; j < SET_SIZE_LARGE; ++j) {
|
||||||
|
set.add(j);
|
||||||
|
}
|
||||||
|
set.removeIf(predicate);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testRemoveIf_Large_RemoveAll() {
|
||||||
|
BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||||
|
Predicate<Integer> predicate = (i) -> true;
|
||||||
|
while (state.keepRunning()) {
|
||||||
|
for (int i = 0; i < NUM_ITERATIONS; ++i) {
|
||||||
|
ArraySet<Integer> set = new ArraySet<>();
|
||||||
|
for (int j = 0; j < SET_SIZE_LARGE; ++j) {
|
||||||
|
set.add(j);
|
||||||
|
}
|
||||||
|
set.removeIf(predicate);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testRemoveIf_Large_RemoveHalf() {
|
||||||
|
BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||||
|
Predicate<Integer> predicate = (i) -> i % 2 == 0;
|
||||||
|
while (state.keepRunning()) {
|
||||||
|
for (int i = 0; i < NUM_ITERATIONS; ++i) {
|
||||||
|
ArraySet<Integer> set = new ArraySet<>();
|
||||||
|
for (int j = 0; j < SET_SIZE_LARGE; ++j) {
|
||||||
|
set.add(j);
|
||||||
|
}
|
||||||
|
set.removeIf(predicate);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -18,11 +18,11 @@ package android.util.perftests;
|
|||||||
|
|
||||||
import android.perftests.utils.BenchmarkState;
|
import android.perftests.utils.BenchmarkState;
|
||||||
import android.perftests.utils.PerfStatusReporter;
|
import android.perftests.utils.PerfStatusReporter;
|
||||||
import android.support.test.filters.LargeTest;
|
|
||||||
import android.support.test.runner.AndroidJUnit4;
|
|
||||||
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
import androidx.test.filters.LargeTest;
|
||||||
|
import androidx.test.runner.AndroidJUnit4;
|
||||||
|
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
|||||||
@@ -17,13 +17,13 @@
|
|||||||
package android.view;
|
package android.view;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.res.Resources;
|
|
||||||
import android.perftests.utils.BenchmarkState;
|
import android.perftests.utils.BenchmarkState;
|
||||||
import android.perftests.utils.PerfStatusReporter;
|
import android.perftests.utils.PerfStatusReporter;
|
||||||
import android.support.test.InstrumentationRegistry;
|
|
||||||
import android.support.test.filters.LargeTest;
|
|
||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
|
|
||||||
|
import androidx.test.InstrumentationRegistry;
|
||||||
|
import androidx.test.filters.LargeTest;
|
||||||
|
|
||||||
import com.android.perftests.core.R;
|
import com.android.perftests.core.R;
|
||||||
|
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
|
|||||||
@@ -24,14 +24,15 @@ import android.graphics.drawable.ColorDrawable;
|
|||||||
import android.perftests.utils.BenchmarkState;
|
import android.perftests.utils.BenchmarkState;
|
||||||
import android.perftests.utils.PerfStatusReporter;
|
import android.perftests.utils.PerfStatusReporter;
|
||||||
import android.perftests.utils.StubActivity;
|
import android.perftests.utils.StubActivity;
|
||||||
import android.support.test.InstrumentationRegistry;
|
|
||||||
import android.support.test.filters.LargeTest;
|
|
||||||
import android.support.test.rule.ActivityTestRule;
|
|
||||||
import android.view.View.MeasureSpec;
|
import android.view.View.MeasureSpec;
|
||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
|
|
||||||
|
import androidx.test.InstrumentationRegistry;
|
||||||
|
import androidx.test.filters.LargeTest;
|
||||||
|
import androidx.test.rule.ActivityTestRule;
|
||||||
|
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
@@ -155,7 +156,7 @@ public class ViewShowHidePerfTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateAndValidateDisplayList(View view) {
|
private void updateAndValidateDisplayList(View view) {
|
||||||
boolean hasDisplayList = view.updateDisplayListIfDirty().isValid();
|
boolean hasDisplayList = view.updateDisplayListIfDirty().hasDisplayList();
|
||||||
assertTrue(hasDisplayList);
|
assertTrue(hasDisplayList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,14 +19,15 @@ package android.widget;
|
|||||||
import android.perftests.utils.BenchmarkState;
|
import android.perftests.utils.BenchmarkState;
|
||||||
import android.perftests.utils.PerfStatusReporter;
|
import android.perftests.utils.PerfStatusReporter;
|
||||||
import android.perftests.utils.StubActivity;
|
import android.perftests.utils.StubActivity;
|
||||||
import android.support.test.InstrumentationRegistry;
|
|
||||||
import android.support.test.filters.LargeTest;
|
|
||||||
import android.support.test.rule.ActivityTestRule;
|
|
||||||
import android.text.Selection;
|
import android.text.Selection;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
import android.view.View.MeasureSpec;
|
import android.view.View.MeasureSpec;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import androidx.test.InstrumentationRegistry;
|
||||||
|
import androidx.test.filters.LargeTest;
|
||||||
|
import androidx.test.rule.ActivityTestRule;
|
||||||
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|||||||
@@ -19,14 +19,15 @@ package android.widget;
|
|||||||
import android.perftests.utils.BenchmarkState;
|
import android.perftests.utils.BenchmarkState;
|
||||||
import android.perftests.utils.PerfStatusReporter;
|
import android.perftests.utils.PerfStatusReporter;
|
||||||
import android.perftests.utils.StubActivity;
|
import android.perftests.utils.StubActivity;
|
||||||
import android.support.test.InstrumentationRegistry;
|
|
||||||
import android.support.test.filters.LargeTest;
|
|
||||||
import android.support.test.rule.ActivityTestRule;
|
|
||||||
import android.text.Selection;
|
import android.text.Selection;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
import android.view.View.MeasureSpec;
|
import android.view.View.MeasureSpec;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import androidx.test.InstrumentationRegistry;
|
||||||
|
import androidx.test.filters.LargeTest;
|
||||||
|
import androidx.test.rule.ActivityTestRule;
|
||||||
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|||||||
@@ -16,10 +16,16 @@
|
|||||||
|
|
||||||
package android.widget;
|
package android.widget;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import android.app.Activity;
|
||||||
import java.util.Collection;
|
import android.perftests.utils.BenchmarkState;
|
||||||
import java.util.Locale;
|
import android.perftests.utils.PerfStatusReporter;
|
||||||
import java.util.Random;
|
import android.perftests.utils.StubActivity;
|
||||||
|
import android.view.KeyEvent;
|
||||||
|
import android.view.View.MeasureSpec;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import androidx.test.filters.LargeTest;
|
||||||
|
import androidx.test.rule.ActivityTestRule;
|
||||||
|
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
@@ -27,22 +33,9 @@ import org.junit.runner.RunWith;
|
|||||||
import org.junit.runners.Parameterized;
|
import org.junit.runners.Parameterized;
|
||||||
import org.junit.runners.Parameterized.Parameters;
|
import org.junit.runners.Parameterized.Parameters;
|
||||||
|
|
||||||
import android.app.Activity;
|
import java.util.Arrays;
|
||||||
import android.graphics.Bitmap;
|
import java.util.Collection;
|
||||||
import android.graphics.Canvas;
|
import java.util.Random;
|
||||||
import android.util.Log;
|
|
||||||
import android.view.KeyEvent;
|
|
||||||
import android.view.RenderNodeAnimator;
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
import android.view.View.MeasureSpec;
|
|
||||||
|
|
||||||
import android.perftests.utils.BenchmarkState;
|
|
||||||
import android.perftests.utils.PerfStatusReporter;
|
|
||||||
import android.perftests.utils.StubActivity;
|
|
||||||
import android.support.test.filters.LargeTest;
|
|
||||||
import android.support.test.runner.AndroidJUnit4;
|
|
||||||
import android.support.test.rule.ActivityTestRule;
|
|
||||||
import android.support.test.InstrumentationRegistry;
|
|
||||||
|
|
||||||
@LargeTest
|
@LargeTest
|
||||||
@RunWith(Parameterized.class)
|
@RunWith(Parameterized.class)
|
||||||
|
|||||||
@@ -16,17 +16,26 @@
|
|||||||
|
|
||||||
package android.widget;
|
package android.widget;
|
||||||
|
|
||||||
|
import static android.perftests.utils.LayoutUtils.gatherViewTree;
|
||||||
|
import static android.perftests.utils.LayoutUtils.requestLayoutForAllNodes;
|
||||||
|
import static android.view.View.MeasureSpec.AT_MOST;
|
||||||
|
import static android.view.View.MeasureSpec.EXACTLY;
|
||||||
|
import static android.view.View.MeasureSpec.UNSPECIFIED;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
import android.perftests.utils.BenchmarkState;
|
import android.perftests.utils.BenchmarkState;
|
||||||
import android.perftests.utils.PerfStatusReporter;
|
import android.perftests.utils.PerfStatusReporter;
|
||||||
import android.perftests.utils.StubActivity;
|
import android.perftests.utils.StubActivity;
|
||||||
import android.support.test.annotation.UiThreadTest;
|
|
||||||
import android.support.test.filters.LargeTest;
|
|
||||||
import android.support.test.rule.ActivityTestRule;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import androidx.test.annotation.UiThreadTest;
|
||||||
|
import androidx.test.filters.LargeTest;
|
||||||
|
import androidx.test.rule.ActivityTestRule;
|
||||||
|
|
||||||
import com.android.perftests.core.R;
|
import com.android.perftests.core.R;
|
||||||
|
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
@@ -38,13 +47,6 @@ import java.util.Arrays;
|
|||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static android.perftests.utils.LayoutUtils.gatherViewTree;
|
|
||||||
import static android.perftests.utils.LayoutUtils.requestLayoutForAllNodes;
|
|
||||||
import static android.view.View.MeasureSpec.AT_MOST;
|
|
||||||
import static android.view.View.MeasureSpec.EXACTLY;
|
|
||||||
import static android.view.View.MeasureSpec.UNSPECIFIED;
|
|
||||||
import static org.junit.Assert.assertTrue;
|
|
||||||
|
|
||||||
@LargeTest
|
@LargeTest
|
||||||
@RunWith(Parameterized.class)
|
@RunWith(Parameterized.class)
|
||||||
public class LayoutPerfTest {
|
public class LayoutPerfTest {
|
||||||
|
|||||||
@@ -16,33 +16,27 @@
|
|||||||
|
|
||||||
package android.widget;
|
package android.widget;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
import android.os.Bundle;
|
|
||||||
import android.perftests.utils.PerfStatusReporter;
|
|
||||||
import android.util.Log;
|
|
||||||
import android.view.View;
|
|
||||||
|
|
||||||
import android.perftests.utils.BenchmarkState;
|
import android.perftests.utils.BenchmarkState;
|
||||||
|
import android.perftests.utils.PerfStatusReporter;
|
||||||
import android.perftests.utils.StubActivity;
|
import android.perftests.utils.StubActivity;
|
||||||
import android.support.test.filters.LargeTest;
|
|
||||||
import android.support.test.runner.AndroidJUnit4;
|
import androidx.test.filters.LargeTest;
|
||||||
import android.support.test.rule.ActivityTestRule;
|
import androidx.test.rule.ActivityTestRule;
|
||||||
import android.support.test.InstrumentationRegistry;
|
|
||||||
|
|
||||||
import com.android.perftests.core.R;
|
import com.android.perftests.core.R;
|
||||||
|
|
||||||
import java.util.Locale;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Arrays;
|
|
||||||
|
|
||||||
import org.junit.Test;
|
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
import org.junit.runners.Parameterized;
|
import org.junit.runners.Parameterized;
|
||||||
import org.junit.runners.Parameterized.Parameters;
|
import org.junit.runners.Parameterized.Parameters;
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
|
|
||||||
import static org.junit.Assert.assertTrue;
|
import java.util.Arrays;
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
@LargeTest
|
@LargeTest
|
||||||
@RunWith(Parameterized.class)
|
@RunWith(Parameterized.class)
|
||||||
|
|||||||
@@ -19,23 +19,21 @@ package android.widget;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.perftests.utils.BenchmarkState;
|
import android.perftests.utils.BenchmarkState;
|
||||||
import android.perftests.utils.PerfStatusReporter;
|
import android.perftests.utils.PerfStatusReporter;
|
||||||
import android.support.test.InstrumentationRegistry;
|
|
||||||
import android.support.test.filters.LargeTest;
|
|
||||||
import android.support.test.runner.AndroidJUnit4;
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
|
||||||
|
import androidx.test.InstrumentationRegistry;
|
||||||
|
import androidx.test.filters.LargeTest;
|
||||||
|
|
||||||
import com.android.perftests.core.R;
|
import com.android.perftests.core.R;
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Arrays;
|
|
||||||
|
|
||||||
import org.junit.Test;
|
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
import org.junit.runners.Parameterized;
|
import org.junit.runners.Parameterized;
|
||||||
import org.junit.runners.Parameterized.Parameters;
|
import org.junit.runners.Parameterized.Parameters;
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
|
|
||||||
import static org.junit.Assert.assertTrue;
|
import java.util.Arrays;
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
@LargeTest
|
@LargeTest
|
||||||
@RunWith(Parameterized.class)
|
@RunWith(Parameterized.class)
|
||||||
|
|||||||
@@ -25,24 +25,20 @@ import android.content.res.ColorStateList;
|
|||||||
import android.graphics.Typeface;
|
import android.graphics.Typeface;
|
||||||
import android.perftests.utils.BenchmarkState;
|
import android.perftests.utils.BenchmarkState;
|
||||||
import android.perftests.utils.PerfStatusReporter;
|
import android.perftests.utils.PerfStatusReporter;
|
||||||
import android.support.test.InstrumentationRegistry;
|
|
||||||
import android.support.test.filters.LargeTest;
|
|
||||||
import android.support.test.runner.AndroidJUnit4;
|
|
||||||
import android.text.SpannableStringBuilder;
|
import android.text.SpannableStringBuilder;
|
||||||
import android.text.Spanned;
|
import android.text.Spanned;
|
||||||
import android.text.style.TextAppearanceSpan;
|
import android.text.style.TextAppearanceSpan;
|
||||||
import android.view.LayoutInflater;
|
|
||||||
|
|
||||||
import com.android.perftests.core.R;
|
import androidx.test.InstrumentationRegistry;
|
||||||
|
import androidx.test.filters.LargeTest;
|
||||||
|
import androidx.test.runner.AndroidJUnit4;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
import org.junit.Test;
|
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
import static org.junit.Assert.assertTrue;
|
import java.util.Locale;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
@LargeTest
|
@LargeTest
|
||||||
@RunWith(AndroidJUnit4.class)
|
@RunWith(AndroidJUnit4.class)
|
||||||
|
|||||||
@@ -16,46 +16,30 @@
|
|||||||
|
|
||||||
package android.widget;
|
package android.widget;
|
||||||
|
|
||||||
import static android.view.View.MeasureSpec.AT_MOST;
|
import static android.widget.TextView.UNKNOWN_BORING;
|
||||||
import static android.view.View.MeasureSpec.EXACTLY;
|
|
||||||
import static android.view.View.MeasureSpec.UNSPECIFIED;
|
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.res.ColorStateList;
|
|
||||||
import android.graphics.Typeface;
|
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
|
import android.graphics.RecordingCanvas;
|
||||||
|
import android.graphics.RenderNode;
|
||||||
import android.perftests.utils.BenchmarkState;
|
import android.perftests.utils.BenchmarkState;
|
||||||
import android.perftests.utils.PerfStatusReporter;
|
import android.perftests.utils.PerfStatusReporter;
|
||||||
import android.support.test.InstrumentationRegistry;
|
|
||||||
import android.support.test.filters.LargeTest;
|
|
||||||
import android.support.test.runner.AndroidJUnit4;
|
|
||||||
import android.text.PrecomputedText;
|
|
||||||
import android.text.Layout;
|
|
||||||
import android.text.BoringLayout;
|
import android.text.BoringLayout;
|
||||||
import android.text.SpannableStringBuilder;
|
import android.text.Layout;
|
||||||
import android.text.Spanned;
|
import android.text.PrecomputedText;
|
||||||
import android.text.TextPaint;
|
import android.text.TextPaint;
|
||||||
import android.text.style.TextAppearanceSpan;
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.text.TextPerfUtils;
|
import android.text.TextPerfUtils;
|
||||||
import android.view.View.MeasureSpec;
|
import android.view.View.MeasureSpec;
|
||||||
import android.view.DisplayListCanvas;
|
|
||||||
import android.view.RenderNode;
|
|
||||||
|
|
||||||
import com.android.perftests.core.R;
|
import androidx.test.InstrumentationRegistry;
|
||||||
|
import androidx.test.filters.LargeTest;
|
||||||
import java.util.Random;
|
import androidx.test.runner.AndroidJUnit4;
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
import static org.junit.Assert.assertTrue;
|
|
||||||
|
|
||||||
import static android.widget.TextView.UNKNOWN_BORING;
|
|
||||||
|
|
||||||
@LargeTest
|
@LargeTest
|
||||||
@RunWith(AndroidJUnit4.class)
|
@RunWith(AndroidJUnit4.class)
|
||||||
public class TextViewPrecomputedTextPerfTest {
|
public class TextViewPrecomputedTextPerfTest {
|
||||||
@@ -360,13 +344,14 @@ public class TextViewPrecomputedTextPerfTest {
|
|||||||
textView.setText(text);
|
textView.setText(text);
|
||||||
textView.measure(width, height);
|
textView.measure(width, height);
|
||||||
textView.layout(0, 0, textView.getMeasuredWidth(), textView.getMeasuredHeight());
|
textView.layout(0, 0, textView.getMeasuredWidth(), textView.getMeasuredHeight());
|
||||||
final DisplayListCanvas c = node.start(
|
final RecordingCanvas c = node.beginRecording(
|
||||||
textView.getMeasuredWidth(), textView.getMeasuredHeight());
|
textView.getMeasuredWidth(), textView.getMeasuredHeight());
|
||||||
textView.nullLayouts();
|
textView.nullLayouts();
|
||||||
Canvas.freeTextLayoutCaches();
|
Canvas.freeTextLayoutCaches();
|
||||||
state.resumeTiming();
|
state.resumeTiming();
|
||||||
|
|
||||||
textView.onDraw(c);
|
textView.onDraw(c);
|
||||||
|
node.endRecording();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -386,13 +371,14 @@ public class TextViewPrecomputedTextPerfTest {
|
|||||||
textView.setText(text);
|
textView.setText(text);
|
||||||
textView.measure(width, height);
|
textView.measure(width, height);
|
||||||
textView.layout(0, 0, textView.getMeasuredWidth(), textView.getMeasuredHeight());
|
textView.layout(0, 0, textView.getMeasuredWidth(), textView.getMeasuredHeight());
|
||||||
final DisplayListCanvas c = node.start(
|
final RecordingCanvas c = node.beginRecording(
|
||||||
textView.getMeasuredWidth(), textView.getMeasuredHeight());
|
textView.getMeasuredWidth(), textView.getMeasuredHeight());
|
||||||
textView.nullLayouts();
|
textView.nullLayouts();
|
||||||
Canvas.freeTextLayoutCaches();
|
Canvas.freeTextLayoutCaches();
|
||||||
state.resumeTiming();
|
state.resumeTiming();
|
||||||
|
|
||||||
textView.onDraw(c);
|
textView.onDraw(c);
|
||||||
|
node.endRecording();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -414,13 +400,14 @@ public class TextViewPrecomputedTextPerfTest {
|
|||||||
textView.setText(text);
|
textView.setText(text);
|
||||||
textView.measure(width, height);
|
textView.measure(width, height);
|
||||||
textView.layout(0, 0, textView.getMeasuredWidth(), textView.getMeasuredHeight());
|
textView.layout(0, 0, textView.getMeasuredWidth(), textView.getMeasuredHeight());
|
||||||
final DisplayListCanvas c = node.start(
|
final RecordingCanvas c = node.beginRecording(
|
||||||
textView.getMeasuredWidth(), textView.getMeasuredHeight());
|
textView.getMeasuredWidth(), textView.getMeasuredHeight());
|
||||||
textView.nullLayouts();
|
textView.nullLayouts();
|
||||||
Canvas.freeTextLayoutCaches();
|
Canvas.freeTextLayoutCaches();
|
||||||
state.resumeTiming();
|
state.resumeTiming();
|
||||||
|
|
||||||
textView.onDraw(c);
|
textView.onDraw(c);
|
||||||
|
node.endRecording();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -443,13 +430,14 @@ public class TextViewPrecomputedTextPerfTest {
|
|||||||
textView.setText(text);
|
textView.setText(text);
|
||||||
textView.measure(width, height);
|
textView.measure(width, height);
|
||||||
textView.layout(0, 0, textView.getMeasuredWidth(), textView.getMeasuredHeight());
|
textView.layout(0, 0, textView.getMeasuredWidth(), textView.getMeasuredHeight());
|
||||||
final DisplayListCanvas c = node.start(
|
final RecordingCanvas c = node.beginRecording(
|
||||||
textView.getMeasuredWidth(), textView.getMeasuredHeight());
|
textView.getMeasuredWidth(), textView.getMeasuredHeight());
|
||||||
textView.nullLayouts();
|
textView.nullLayouts();
|
||||||
Canvas.freeTextLayoutCaches();
|
Canvas.freeTextLayoutCaches();
|
||||||
state.resumeTiming();
|
state.resumeTiming();
|
||||||
|
|
||||||
textView.onDraw(c);
|
textView.onDraw(c);
|
||||||
|
node.endRecording();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,8 +19,9 @@ package android.widget;
|
|||||||
import android.perftests.utils.BenchmarkState;
|
import android.perftests.utils.BenchmarkState;
|
||||||
import android.perftests.utils.PerfStatusReporter;
|
import android.perftests.utils.PerfStatusReporter;
|
||||||
import android.perftests.utils.StubActivity;
|
import android.perftests.utils.StubActivity;
|
||||||
import android.support.test.filters.LargeTest;
|
|
||||||
import android.support.test.rule.ActivityTestRule;
|
import androidx.test.filters.LargeTest;
|
||||||
|
import androidx.test.rule.ActivityTestRule;
|
||||||
|
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|||||||
@@ -16,8 +16,8 @@ android_test {
|
|||||||
name: "MultiUserPerfTests",
|
name: "MultiUserPerfTests",
|
||||||
srcs: ["src/**/*.java"],
|
srcs: ["src/**/*.java"],
|
||||||
static_libs: [
|
static_libs: [
|
||||||
"android-support-test",
|
"androidx.test.rules",
|
||||||
"ub-uiautomator",
|
"apct-perftests-utils",
|
||||||
],
|
],
|
||||||
platform_apis: true,
|
platform_apis: true,
|
||||||
test_suites: ["device-tests"],
|
test_suites: ["device-tests"],
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
<uses-library android:name="android.test.runner" />
|
<uses-library android:name="android.test.runner" />
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
<instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
|
<instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
|
||||||
android:targetPackage="com.android.perftests.multiuser"/>
|
android:targetPackage="com.android.perftests.multiuser"/>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
||||||
|
|||||||
@@ -60,11 +60,13 @@ public class BenchmarkResults {
|
|||||||
if (size == 0) {
|
if (size == 0) {
|
||||||
return 0f;
|
return 0f;
|
||||||
}
|
}
|
||||||
Collections.sort(mResults);
|
|
||||||
|
final ArrayList<Long> resultsCopy = new ArrayList<>(mResults);
|
||||||
|
Collections.sort(resultsCopy);
|
||||||
final int idx = size / 2;
|
final int idx = size / 2;
|
||||||
return size % 2 == 0
|
return size % 2 == 0
|
||||||
? (double) (mResults.get(idx) + mResults.get(idx - 1)) / 2
|
? (double) (resultsCopy.get(idx) + resultsCopy.get(idx - 1)) / 2
|
||||||
: mResults.get(idx);
|
: resultsCopy.get(idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
private double standardDeviation() {
|
private double standardDeviation() {
|
||||||
|
|||||||
@@ -18,9 +18,10 @@ package android.multiuser;
|
|||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.Instrumentation;
|
import android.app.Instrumentation;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.test.InstrumentationRegistry;
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
import androidx.test.InstrumentationRegistry;
|
||||||
|
|
||||||
import org.junit.rules.TestRule;
|
import org.junit.rules.TestRule;
|
||||||
import org.junit.runner.Description;
|
import org.junit.runner.Description;
|
||||||
import org.junit.runners.model.Statement;
|
import org.junit.runners.model.Statement;
|
||||||
|
|||||||
@@ -17,10 +17,8 @@ package android.multiuser;
|
|||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
import android.support.test.InstrumentationRegistry;
|
import android.perftests.utils.ShellHelper;
|
||||||
import android.support.test.uiautomator.UiDevice;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
// Based on //platform/frameworks/base/apct-tests/perftests/utils/BenchmarkState.java
|
// Based on //platform/frameworks/base/apct-tests/perftests/utils/BenchmarkState.java
|
||||||
@@ -74,12 +72,7 @@ public class BenchmarkRunner {
|
|||||||
|
|
||||||
private void prepareForNextRun() {
|
private void prepareForNextRun() {
|
||||||
SystemClock.sleep(COOL_OFF_PERIOD_MS);
|
SystemClock.sleep(COOL_OFF_PERIOD_MS);
|
||||||
try {
|
ShellHelper.runShellCommand("am wait-for-broadcast-idle");
|
||||||
UiDevice.getInstance(InstrumentationRegistry.getInstrumentation())
|
|
||||||
.executeShellCommand("am wait-for-broadcast-idle");
|
|
||||||
} catch (IOException e) {
|
|
||||||
throw new IllegalStateException("Cannot execute shell command", e);
|
|
||||||
}
|
|
||||||
mStartTimeNs = System.nanoTime();
|
mStartTimeNs = System.nanoTime();
|
||||||
mPausedDurationNs = 0;
|
mPausedDurationNs = 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,9 +27,11 @@ import android.content.pm.UserInfo;
|
|||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
import android.os.UserManager;
|
import android.os.UserManager;
|
||||||
import android.support.test.InstrumentationRegistry;
|
import android.util.Log;
|
||||||
import android.support.test.filters.LargeTest;
|
|
||||||
import android.support.test.runner.AndroidJUnit4;
|
import androidx.test.InstrumentationRegistry;
|
||||||
|
import androidx.test.filters.LargeTest;
|
||||||
|
import androidx.test.runner.AndroidJUnit4;
|
||||||
|
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
@@ -50,7 +52,7 @@ import java.util.concurrent.TimeUnit;
|
|||||||
* adb install -r \
|
* adb install -r \
|
||||||
* ${ANDROID_PRODUCT_OUT}/data/app/MultiUserPerfTests/MultiUserPerfTests.apk &&
|
* ${ANDROID_PRODUCT_OUT}/data/app/MultiUserPerfTests/MultiUserPerfTests.apk &&
|
||||||
* adb shell am instrument -e class android.multiuser.UserLifecycleTests \
|
* adb shell am instrument -e class android.multiuser.UserLifecycleTests \
|
||||||
* -w com.android.perftests.multiuser/android.support.test.runner.AndroidJUnitRunner
|
* -w com.android.perftests.multiuser/androidx.test.runner.AndroidJUnitRunner
|
||||||
*
|
*
|
||||||
* or
|
* or
|
||||||
*
|
*
|
||||||
@@ -129,6 +131,47 @@ public class UserLifecycleTests {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Tests switching to an already-created, but no-longer-running, user. */
|
||||||
|
@Test
|
||||||
|
public void switchUser_stopped() throws Exception {
|
||||||
|
while (mRunner.keepRunning()) {
|
||||||
|
mRunner.pauseTiming();
|
||||||
|
final int startUser = mAm.getCurrentUser();
|
||||||
|
final int testUser = initializeNewUserAndSwitchBack(/* stopNewUser */ true);
|
||||||
|
final CountDownLatch latch = new CountDownLatch(1);
|
||||||
|
registerBroadcastReceiver(Intent.ACTION_USER_UNLOCKED, latch, testUser);
|
||||||
|
mRunner.resumeTiming();
|
||||||
|
|
||||||
|
mAm.switchUser(testUser);
|
||||||
|
boolean success = latch.await(TIMEOUT_IN_SECOND, TimeUnit.SECONDS);
|
||||||
|
|
||||||
|
mRunner.pauseTiming();
|
||||||
|
attestTrue("Failed to achieve 2nd ACTION_USER_UNLOCKED for user " + testUser, success);
|
||||||
|
switchUser(startUser);
|
||||||
|
removeUser(testUser);
|
||||||
|
mRunner.resumeTiming();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Tests switching to an already-created already-running non-owner user. */
|
||||||
|
@Test
|
||||||
|
public void switchUser_running() throws Exception {
|
||||||
|
while (mRunner.keepRunning()) {
|
||||||
|
mRunner.pauseTiming();
|
||||||
|
final int startUser = mAm.getCurrentUser();
|
||||||
|
final int testUser = initializeNewUserAndSwitchBack(/* stopNewUser */ false);
|
||||||
|
mRunner.resumeTiming();
|
||||||
|
|
||||||
|
switchUser(testUser);
|
||||||
|
|
||||||
|
mRunner.pauseTiming();
|
||||||
|
attestTrue("Failed to switch to user " + testUser, mAm.isUserRunning(testUser));
|
||||||
|
switchUser(startUser);
|
||||||
|
removeUser(testUser);
|
||||||
|
mRunner.resumeTiming();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void stopUser() throws Exception {
|
public void stopUser() throws Exception {
|
||||||
while (mRunner.keepRunning()) {
|
while (mRunner.keepRunning()) {
|
||||||
@@ -187,6 +230,34 @@ public class UserLifecycleTests {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Tests starting an already-created, but no-longer-running, profile. */
|
||||||
|
@Test
|
||||||
|
public void managedProfileUnlock_stopped() throws Exception {
|
||||||
|
while (mRunner.keepRunning()) {
|
||||||
|
mRunner.pauseTiming();
|
||||||
|
final UserInfo userInfo = mUm.createProfileForUser("TestUser",
|
||||||
|
UserInfo.FLAG_MANAGED_PROFILE, mAm.getCurrentUser());
|
||||||
|
// Start the profile initially, then stop it. Similar to setQuietModeEnabled.
|
||||||
|
final CountDownLatch latch1 = new CountDownLatch(1);
|
||||||
|
registerBroadcastReceiver(Intent.ACTION_USER_UNLOCKED, latch1, userInfo.id);
|
||||||
|
mIam.startUserInBackground(userInfo.id);
|
||||||
|
latch1.await(TIMEOUT_IN_SECOND, TimeUnit.SECONDS);
|
||||||
|
stopUser(userInfo.id, true);
|
||||||
|
|
||||||
|
// Now we restart the profile.
|
||||||
|
final CountDownLatch latch2 = new CountDownLatch(1);
|
||||||
|
registerBroadcastReceiver(Intent.ACTION_USER_UNLOCKED, latch2, userInfo.id);
|
||||||
|
mRunner.resumeTiming();
|
||||||
|
|
||||||
|
mIam.startUserInBackground(userInfo.id);
|
||||||
|
latch2.await(TIMEOUT_IN_SECOND, TimeUnit.SECONDS);
|
||||||
|
|
||||||
|
mRunner.pauseTiming();
|
||||||
|
removeUser(userInfo.id);
|
||||||
|
mRunner.resumeTiming();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void ephemeralUserStopped() throws Exception {
|
public void ephemeralUserStopped() throws Exception {
|
||||||
while (mRunner.keepRunning()) {
|
while (mRunner.keepRunning()) {
|
||||||
@@ -261,6 +332,35 @@ public class UserLifecycleTests {
|
|||||||
latch.await(TIMEOUT_IN_SECOND, TimeUnit.SECONDS);
|
latch.await(TIMEOUT_IN_SECOND, TimeUnit.SECONDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a user and waits for its ACTION_USER_UNLOCKED.
|
||||||
|
* Then switches to back to the original user and waits for its switchUser() to finish.
|
||||||
|
*
|
||||||
|
* @param stopNewUser whether to stop the new user after switching to otherUser.
|
||||||
|
* @return userId of the newly created user.
|
||||||
|
*/
|
||||||
|
private int initializeNewUserAndSwitchBack(boolean stopNewUser) throws Exception {
|
||||||
|
final int origUser = mAm.getCurrentUser();
|
||||||
|
// First, create and switch to testUser, waiting for its ACTION_USER_UNLOCKED
|
||||||
|
final int testUser = mUm.createUser("TestUser", 0).id;
|
||||||
|
final CountDownLatch latch1 = new CountDownLatch(1);
|
||||||
|
registerBroadcastReceiver(Intent.ACTION_USER_UNLOCKED, latch1, testUser);
|
||||||
|
mAm.switchUser(testUser);
|
||||||
|
attestTrue("Failed to achieve initial ACTION_USER_UNLOCKED for user " + testUser,
|
||||||
|
latch1.await(TIMEOUT_IN_SECOND, TimeUnit.SECONDS));
|
||||||
|
|
||||||
|
// Second, switch back to origUser, waiting merely for switchUser() to finish
|
||||||
|
switchUser(origUser);
|
||||||
|
attestTrue("Didn't switch back to user, " + origUser, origUser == mAm.getCurrentUser());
|
||||||
|
|
||||||
|
if (stopNewUser) {
|
||||||
|
stopUser(testUser, true);
|
||||||
|
attestFalse("Failed to stop user " + testUser, mAm.isUserRunning(testUser));
|
||||||
|
}
|
||||||
|
|
||||||
|
return testUser;
|
||||||
|
}
|
||||||
|
|
||||||
private void registerUserSwitchObserver(final CountDownLatch switchLatch,
|
private void registerUserSwitchObserver(final CountDownLatch switchLatch,
|
||||||
final CountDownLatch bootCompleteLatch, final int userId) throws Exception {
|
final CountDownLatch bootCompleteLatch, final int userId) throws Exception {
|
||||||
ActivityManager.getService().registerUserSwitchObserver(
|
ActivityManager.getService().registerUserSwitchObserver(
|
||||||
@@ -312,4 +412,14 @@ public class UserLifecycleTests {
|
|||||||
mUsersToRemove.add(userId);
|
mUsersToRemove.add(userId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void attestTrue(String message, boolean attestion) {
|
||||||
|
if (!attestion) {
|
||||||
|
Log.w(TAG, message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void attestFalse(String message, boolean attestion) {
|
||||||
|
attestTrue(message, !attestion);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
25
apct-tests/perftests/textclassifier/Android.bp
Normal file
25
apct-tests/perftests/textclassifier/Android.bp
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
// Copyright (C) 2019 The Android Open Source Project
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
android_test {
|
||||||
|
name: "TextClassifierPerfTests",
|
||||||
|
srcs: ["src/**/*.java"],
|
||||||
|
static_libs: [
|
||||||
|
"androidx.test.rules",
|
||||||
|
"androidx.annotation_annotation",
|
||||||
|
"apct-perftests-utils",
|
||||||
|
],
|
||||||
|
platform_apis: true,
|
||||||
|
test_suites: ["device-tests"],
|
||||||
|
}
|
||||||
25
apct-tests/perftests/textclassifier/AndroidManifest.xml
Normal file
25
apct-tests/perftests/textclassifier/AndroidManifest.xml
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Copyright (C) 2018 The Android Open Source Project
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
-->
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
package="com.android.perftests.textclassifier">
|
||||||
|
|
||||||
|
<application>
|
||||||
|
<uses-library android:name="android.test.runner" />
|
||||||
|
</application>
|
||||||
|
|
||||||
|
<instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
android:targetPackage="com.android.perftests.textclassifier"/>
|
||||||
|
</manifest>
|
||||||
28
apct-tests/perftests/textclassifier/AndroidTest.xml
Normal file
28
apct-tests/perftests/textclassifier/AndroidTest.xml
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Copyright (C) 2018 The Android Open Source Project
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
-->
|
||||||
|
<configuration description="Runs TextClassifierPerfTests metric instrumentation.">
|
||||||
|
<option name="test-suite-tag" value="apct" />
|
||||||
|
<option name="test-suite-tag" value="apct-metric-instrumentation" />
|
||||||
|
<target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
|
||||||
|
<option name="cleanup-apks" value="true" />
|
||||||
|
<option name="test-file-name" value="TextClassifierPerfTests.apk" />
|
||||||
|
</target_preparer>
|
||||||
|
|
||||||
|
<test class="com.android.tradefed.testtype.AndroidJUnitTest" >
|
||||||
|
<option name="package" value="com.android.perftests.textclassifier" />
|
||||||
|
<option name="hidden-api-checks" value="false"/>
|
||||||
|
</test>
|
||||||
|
</configuration>
|
||||||
8
apct-tests/perftests/textclassifier/run.sh
Executable file
8
apct-tests/perftests/textclassifier/run.sh
Executable file
@@ -0,0 +1,8 @@
|
|||||||
|
set -e
|
||||||
|
make TextClassifierPerfTests perf-setup.sh
|
||||||
|
adb install ${OUT}/testcases/TextClassifierPerfTests/arm64/TextClassifierPerfTests.apk
|
||||||
|
adb shell cmd package compile -m speed -f com.android.perftests.textclassifier
|
||||||
|
adb push ${OUT}/obj/EXECUTABLES/perf-setup.sh_intermediates/perf-setup.sh /data/local/tmp/
|
||||||
|
adb shell chmod +x /data/local/tmp/perf-setup.sh
|
||||||
|
adb shell /data/local/tmp/perf-setup.sh
|
||||||
|
adb shell am instrument -w -e package android.view.textclassifier com.android.perftests.textclassifier/androidx.test.runner.AndroidJUnitRunner
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2018 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package android.view.textclassifier;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.perftests.utils.BenchmarkState;
|
||||||
|
import android.perftests.utils.PerfStatusReporter;
|
||||||
|
import android.perftests.utils.SettingsHelper;
|
||||||
|
import android.provider.Settings;
|
||||||
|
|
||||||
|
import androidx.test.InstrumentationRegistry;
|
||||||
|
import androidx.test.filters.LargeTest;
|
||||||
|
|
||||||
|
import org.junit.After;
|
||||||
|
import org.junit.Rule;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
@LargeTest
|
||||||
|
public class TextClassificationManagerPerfTest {
|
||||||
|
|
||||||
|
@Rule
|
||||||
|
public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
|
||||||
|
|
||||||
|
@After
|
||||||
|
public void tearDown() {
|
||||||
|
SettingsHelper.delete(
|
||||||
|
SettingsHelper.NAMESPACE_GLOBAL, Settings.Global.TEXT_CLASSIFIER_CONSTANTS);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testGetTextClassifier_systemTextClassifierDisabled() {
|
||||||
|
Context context = InstrumentationRegistry.getTargetContext();
|
||||||
|
SettingsHelper.set(
|
||||||
|
SettingsHelper.NAMESPACE_GLOBAL,
|
||||||
|
Settings.Global.TEXT_CLASSIFIER_CONSTANTS,
|
||||||
|
"system_textclassifier_enabled=false");
|
||||||
|
TextClassificationManager textClassificationManager =
|
||||||
|
context.getSystemService(TextClassificationManager.class);
|
||||||
|
BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||||
|
while (state.keepRunning()) {
|
||||||
|
textClassificationManager.getTextClassifier();
|
||||||
|
textClassificationManager.invalidateForTesting();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testGetTextClassifier_systemTextClassifierEnabled() {
|
||||||
|
Context context = InstrumentationRegistry.getTargetContext();
|
||||||
|
SettingsHelper.set(
|
||||||
|
SettingsHelper.NAMESPACE_GLOBAL,
|
||||||
|
Settings.Global.TEXT_CLASSIFIER_CONSTANTS,
|
||||||
|
"system_textclassifier_enabled=true");
|
||||||
|
TextClassificationManager textClassificationManager =
|
||||||
|
context.getSystemService(TextClassificationManager.class);
|
||||||
|
BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||||
|
while (state.keepRunning()) {
|
||||||
|
textClassificationManager.getTextClassifier();
|
||||||
|
textClassificationManager.invalidateForTesting();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,110 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2018 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package android.view.textclassifier;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.perftests.utils.BenchmarkState;
|
||||||
|
import android.perftests.utils.PerfStatusReporter;
|
||||||
|
|
||||||
|
import androidx.test.InstrumentationRegistry;
|
||||||
|
import androidx.test.filters.LargeTest;
|
||||||
|
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Rule;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.junit.runners.Parameterized;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
@RunWith(Parameterized.class)
|
||||||
|
@LargeTest
|
||||||
|
public class TextClassifierPerfTest {
|
||||||
|
/** Request contains meaning text, rather than garbled text. */
|
||||||
|
private static final int ACTUAL_REQUEST = 0;
|
||||||
|
private static final String RANDOM_CHAR_SET = "abcdefghijklmnopqrstuvwxyz0123456789";
|
||||||
|
|
||||||
|
@Rule
|
||||||
|
public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
|
||||||
|
|
||||||
|
@Parameterized.Parameters(name = "size{0}")
|
||||||
|
public static Collection<Object[]> data() {
|
||||||
|
return Arrays.asList(new Object[][]{{ACTUAL_REQUEST}, {10}, {100}, {1000}});
|
||||||
|
}
|
||||||
|
|
||||||
|
private TextClassifier mTextClassifier;
|
||||||
|
private final int mSize;
|
||||||
|
|
||||||
|
public TextClassifierPerfTest(int size) {
|
||||||
|
mSize = size;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Before
|
||||||
|
public void setUp() {
|
||||||
|
Context context = InstrumentationRegistry.getTargetContext();
|
||||||
|
TextClassificationManager textClassificationManager =
|
||||||
|
context.getSystemService(TextClassificationManager.class);
|
||||||
|
mTextClassifier = textClassificationManager.getTextClassifier(TextClassifier.LOCAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSuggestConversationActions() {
|
||||||
|
String text = mSize == ACTUAL_REQUEST ? "Where are you?" : generateRandomString(mSize);
|
||||||
|
ConversationActions.Request request = createConversationActionsRequest(text);
|
||||||
|
BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||||
|
while (state.keepRunning()) {
|
||||||
|
mTextClassifier.suggestConversationActions(request);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDetectLanguage() {
|
||||||
|
String text = mSize == ACTUAL_REQUEST
|
||||||
|
? "これは日本語のテキストです" : generateRandomString(mSize);
|
||||||
|
TextLanguage.Request request = createTextLanguageRequest(text);
|
||||||
|
BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||||
|
while (state.keepRunning()) {
|
||||||
|
mTextClassifier.detectLanguage(request);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static ConversationActions.Request createConversationActionsRequest(CharSequence text) {
|
||||||
|
ConversationActions.Message message =
|
||||||
|
new ConversationActions.Message.Builder(
|
||||||
|
ConversationActions.Message.PERSON_USER_OTHERS)
|
||||||
|
.setText(text)
|
||||||
|
.build();
|
||||||
|
return new ConversationActions.Request.Builder(Collections.singletonList(message))
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static TextLanguage.Request createTextLanguageRequest(CharSequence text) {
|
||||||
|
return new TextLanguage.Request.Builder(text).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String generateRandomString(int length) {
|
||||||
|
Random random = new Random();
|
||||||
|
StringBuilder stringBuilder = new StringBuilder(length);
|
||||||
|
for (int i = 0; i < length; i++) {
|
||||||
|
int index = random.nextInt(RANDOM_CHAR_SET.length());
|
||||||
|
stringBuilder.append(RANDOM_CHAR_SET.charAt(index));
|
||||||
|
}
|
||||||
|
return stringBuilder.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,9 @@
|
|||||||
java_library {
|
java_library {
|
||||||
name: "apct-perftests-utils",
|
name: "apct-perftests-utils",
|
||||||
static_libs: ["android-support-test"],
|
static_libs: [
|
||||||
|
"androidx.test.rules",
|
||||||
|
"androidx.annotation_annotation",
|
||||||
|
],
|
||||||
// Build all java files in the java subdirectory
|
// Build all java files in the java subdirectory
|
||||||
srcs: ["**/*.java"],
|
srcs: ["**/*.java"],
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,9 +20,10 @@ import android.app.Activity;
|
|||||||
import android.app.Instrumentation;
|
import android.app.Instrumentation;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Debug;
|
import android.os.Debug;
|
||||||
import android.support.test.InstrumentationRegistry;
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
import androidx.test.InstrumentationRegistry;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|||||||
@@ -0,0 +1,82 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2018 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package android.perftests.utils;
|
||||||
|
|
||||||
|
import static android.perftests.utils.SettingsHelper.NAMESPACE_SECURE;
|
||||||
|
|
||||||
|
import android.content.ContentResolver;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.database.ContentObserver;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.os.Looper;
|
||||||
|
import android.provider.Settings;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
import java.util.concurrent.CountDownLatch;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper used to block tests until a secure settings value has been updated.
|
||||||
|
*/
|
||||||
|
public final class OneTimeSettingsListener extends ContentObserver {
|
||||||
|
private final CountDownLatch mLatch = new CountDownLatch(1);
|
||||||
|
private final ContentResolver mResolver;
|
||||||
|
private final String mKey;
|
||||||
|
private final int mTimeoutMs;
|
||||||
|
|
||||||
|
public OneTimeSettingsListener(@NonNull Context context, @NonNull String namespace,
|
||||||
|
@NonNull String key, int timeoutMs) {
|
||||||
|
super(new Handler(Looper.getMainLooper()));
|
||||||
|
mKey = key;
|
||||||
|
mResolver = context.getContentResolver();
|
||||||
|
mTimeoutMs = timeoutMs;
|
||||||
|
final Uri uri;
|
||||||
|
switch (namespace) {
|
||||||
|
case NAMESPACE_SECURE:
|
||||||
|
uri = Settings.Secure.getUriFor(key);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new IllegalArgumentException("invalid namespace: " + namespace);
|
||||||
|
}
|
||||||
|
mResolver.registerContentObserver(uri, false, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onChange(boolean selfChange, Uri uri) {
|
||||||
|
mResolver.unregisterContentObserver(this);
|
||||||
|
mLatch.countDown();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Blocks for a few seconds until it's called, or throws an {@link IllegalStateException} if
|
||||||
|
* it isn't.
|
||||||
|
*/
|
||||||
|
public void assertCalled() {
|
||||||
|
try {
|
||||||
|
final boolean updated = mLatch.await(mTimeoutMs, TimeUnit.MILLISECONDS);
|
||||||
|
if (!updated) {
|
||||||
|
throw new IllegalStateException(
|
||||||
|
"Settings " + mKey + " not called in " + mTimeoutMs + "ms");
|
||||||
|
}
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
Thread.currentThread().interrupt();
|
||||||
|
throw new IllegalStateException("Interrupted", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
package android.perftests.utils;
|
package android.perftests.utils;
|
||||||
|
|
||||||
import android.support.test.InstrumentationRegistry;
|
import androidx.test.InstrumentationRegistry;
|
||||||
|
|
||||||
import org.junit.rules.TestRule;
|
import org.junit.rules.TestRule;
|
||||||
import org.junit.runner.Description;
|
import org.junit.runner.Description;
|
||||||
|
|||||||
@@ -16,15 +16,17 @@
|
|||||||
|
|
||||||
package android.perftests.utils;
|
package android.perftests.utils;
|
||||||
|
|
||||||
import android.support.test.InstrumentationRegistry;
|
import static junit.framework.Assert.assertFalse;
|
||||||
|
import static junit.framework.Assert.assertTrue;
|
||||||
|
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
import androidx.test.InstrumentationRegistry;
|
||||||
|
|
||||||
import org.junit.rules.TestRule;
|
import org.junit.rules.TestRule;
|
||||||
import org.junit.runner.Description;
|
import org.junit.runner.Description;
|
||||||
import org.junit.runners.model.Statement;
|
import org.junit.runners.model.Statement;
|
||||||
|
|
||||||
import static junit.framework.Assert.assertFalse;
|
|
||||||
import static junit.framework.Assert.assertTrue;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use this rule to make sure we report the status after the test success.
|
* Use this rule to make sure we report the status after the test success.
|
||||||
*
|
*
|
||||||
@@ -49,6 +51,7 @@ import static junit.framework.Assert.assertTrue;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
public class PerfStatusReporter implements TestRule {
|
public class PerfStatusReporter implements TestRule {
|
||||||
|
private static final String TAG = "PerfStatusReporter";
|
||||||
private final BenchmarkState mState = new BenchmarkState();
|
private final BenchmarkState mState = new BenchmarkState();
|
||||||
|
|
||||||
public BenchmarkState getBenchmarkState() {
|
public BenchmarkState getBenchmarkState() {
|
||||||
@@ -61,6 +64,8 @@ public class PerfStatusReporter implements TestRule {
|
|||||||
@Override
|
@Override
|
||||||
public void evaluate() throws Throwable {
|
public void evaluate() throws Throwable {
|
||||||
String invokeMethodName = description.getMethodName();
|
String invokeMethodName = description.getMethodName();
|
||||||
|
Log.i(TAG, "Running " + description.getClassName() + "#" + invokeMethodName);
|
||||||
|
|
||||||
// validate and simplify the function name.
|
// validate and simplify the function name.
|
||||||
// First, remove the "test" prefix which normally comes from CTS test.
|
// First, remove the "test" prefix which normally comes from CTS test.
|
||||||
// Then make sure the [subTestName] is valid, not just numbers like [0].
|
// Then make sure the [subTestName] is valid, not just numbers like [0].
|
||||||
|
|||||||
@@ -0,0 +1,118 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2018 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package android.perftests.utils;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.provider.Settings;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides utilities to interact with the device's {@link Settings}.
|
||||||
|
*/
|
||||||
|
public final class SettingsHelper {
|
||||||
|
|
||||||
|
public static final String NAMESPACE_SECURE = "secure";
|
||||||
|
public static final String NAMESPACE_GLOBAL = "global";
|
||||||
|
|
||||||
|
private static int DEFAULT_TIMEOUT_MS = 5000;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Uses a Shell command to "asynchronously" set the given preference, returning right away.
|
||||||
|
*/
|
||||||
|
public static void set(@NonNull String namespace, @NonNull String key, @Nullable String value) {
|
||||||
|
if (value == null) {
|
||||||
|
delete(namespace, key);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ShellHelper.runShellCommand("settings put %s %s %s default", namespace, key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Uses a Shell command to "synchronously" set the given preference by registering a listener
|
||||||
|
* and wait until it's set.
|
||||||
|
*/
|
||||||
|
public static void syncSet(@NonNull Context context, @NonNull String namespace,
|
||||||
|
@NonNull String key, @Nullable String value) {
|
||||||
|
if (value == null) {
|
||||||
|
syncDelete(context, namespace, key);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
String currentValue = get(namespace, key);
|
||||||
|
if (value.equals(currentValue)) {
|
||||||
|
// Already set, ignore
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
OneTimeSettingsListener observer = new OneTimeSettingsListener(context, namespace, key,
|
||||||
|
DEFAULT_TIMEOUT_MS);
|
||||||
|
set(namespace, key, value);
|
||||||
|
observer.assertCalled();
|
||||||
|
assertNewValue(namespace, key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Uses a Shell command to "asynchronously" delete the given preference, returning right away.
|
||||||
|
*/
|
||||||
|
public static void delete(@NonNull String namespace, @NonNull String key) {
|
||||||
|
ShellHelper.runShellCommand("settings delete %s %s", namespace, key);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Uses a Shell command to "synchronously" delete the given preference by registering a listener
|
||||||
|
* and wait until it's called.
|
||||||
|
*/
|
||||||
|
public static void syncDelete(@NonNull Context context, @NonNull String namespace,
|
||||||
|
@NonNull String key) {
|
||||||
|
String currentValue = get(namespace, key);
|
||||||
|
if (currentValue == null || currentValue.equals("null")) {
|
||||||
|
// Already set, ignore
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
OneTimeSettingsListener observer = new OneTimeSettingsListener(context, namespace, key,
|
||||||
|
DEFAULT_TIMEOUT_MS);
|
||||||
|
delete(namespace, key);
|
||||||
|
observer.assertCalled();
|
||||||
|
assertNewValue(namespace, key, "null");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the value of a given preference using Shell command.
|
||||||
|
*/
|
||||||
|
@NonNull
|
||||||
|
public static String get(@NonNull String namespace, @NonNull String key) {
|
||||||
|
return ShellHelper.runShellCommand("settings get %s %s", namespace, key);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void assertNewValue(@NonNull String namespace, @NonNull String key,
|
||||||
|
@Nullable String expectedValue) {
|
||||||
|
String actualValue = get(namespace, key);
|
||||||
|
if (!Objects.equals(actualValue, expectedValue)) {
|
||||||
|
throw new AssertionError("invalid value for " + namespace + ":" + key + ": expected '"
|
||||||
|
+ actualValue + "' , got '" + expectedValue + "'");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private SettingsHelper() {
|
||||||
|
throw new UnsupportedOperationException("contain static methods only");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2018 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package android.perftests.utils;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.provider.Settings;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* JUnit rule used to restore a {@link Settings} preference after the test is run.
|
||||||
|
*
|
||||||
|
* <p>It stores the current value before the test, and restores it after the test (if necessary).
|
||||||
|
*/
|
||||||
|
public class SettingsStateKeeperRule extends StateKeeperRule<String> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default constructor.
|
||||||
|
*
|
||||||
|
* @param context context used to retrieve the {@link Settings} provider.
|
||||||
|
* @param key prefence key.
|
||||||
|
*/
|
||||||
|
public SettingsStateKeeperRule(@NonNull Context context, @NonNull String key) {
|
||||||
|
super(new SettingsStateManager(context, SettingsHelper.NAMESPACE_SECURE, key));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2018 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package android.perftests.utils;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.provider.Settings;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Manages the state of a preference backed by {@link Settings}.
|
||||||
|
*/
|
||||||
|
public class SettingsStateManager implements StateManager<String> {
|
||||||
|
|
||||||
|
private final Context mContext;
|
||||||
|
private final String mNamespace;
|
||||||
|
private final String mKey;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default constructor.
|
||||||
|
*
|
||||||
|
* @param context context used to retrieve the {@link Settings} provider.
|
||||||
|
* @param namespace settings namespace.
|
||||||
|
* @param key prefence key.
|
||||||
|
*/
|
||||||
|
public SettingsStateManager(@NonNull Context context, @NonNull String namespace,
|
||||||
|
@NonNull String key) {
|
||||||
|
mContext = context;
|
||||||
|
mNamespace = namespace;
|
||||||
|
mKey = key;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void set(@Nullable String value) {
|
||||||
|
SettingsHelper.syncSet(mContext, mNamespace, mKey, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Nullable
|
||||||
|
public String get() {
|
||||||
|
return SettingsHelper.get(mNamespace, mKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "SettingsStateManager[namespace=" + mNamespace + ", key=" + mKey + "]";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2018 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package android.perftests.utils;
|
||||||
|
|
||||||
|
import android.app.UiAutomation;
|
||||||
|
import android.os.ParcelFileDescriptor;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
import android.util.AndroidRuntimeException;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.test.InstrumentationRegistry;
|
||||||
|
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides Shell-based utilities such as running a command.
|
||||||
|
*/
|
||||||
|
public final class ShellHelper {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Runs a Shell command, returning a trimmed response.
|
||||||
|
*/
|
||||||
|
@NonNull
|
||||||
|
public static String runShellCommand(@NonNull String template, Object...args) {
|
||||||
|
String command = String.format(template, args);
|
||||||
|
return runShellCommandRaw(command);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Runs a Shell command, returning a trimmed response.
|
||||||
|
*/
|
||||||
|
@NonNull
|
||||||
|
public static String runShellCommandRaw(@NonNull String command) {
|
||||||
|
UiAutomation automan = InstrumentationRegistry.getInstrumentation()
|
||||||
|
.getUiAutomation();
|
||||||
|
ParcelFileDescriptor pfd = automan.executeShellCommand(command);
|
||||||
|
byte[] buf = new byte[512];
|
||||||
|
int bytesRead;
|
||||||
|
try(FileInputStream fis = new ParcelFileDescriptor.AutoCloseInputStream(pfd)) {
|
||||||
|
StringBuilder stdout = new StringBuilder();
|
||||||
|
while ((bytesRead = fis.read(buf)) != -1) {
|
||||||
|
stdout.append(new String(buf, 0, bytesRead));
|
||||||
|
}
|
||||||
|
String result = stdout.toString();
|
||||||
|
return TextUtils.isEmpty(result) ? "" : result.trim();
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new AndroidRuntimeException("Command '" + command + "' failed: ", e);
|
||||||
|
} finally {
|
||||||
|
// Must disconnect UI automation after every call, otherwise its accessibility service
|
||||||
|
// skews the performance tests.
|
||||||
|
automan.destroy();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private ShellHelper() {
|
||||||
|
throw new UnsupportedOperationException("contain static methods only");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2018 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package android.perftests.utils;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
import org.junit.rules.TestRule;
|
||||||
|
import org.junit.runner.Description;
|
||||||
|
import org.junit.runners.model.Statement;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* JUnit rule used to restore a state after the test is run.
|
||||||
|
*
|
||||||
|
* <p>It stores the current state before the test, and restores it after the test (if necessary).
|
||||||
|
*/
|
||||||
|
public class StateKeeperRule<T> implements TestRule {
|
||||||
|
|
||||||
|
private final StateManager<T> mStateManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default constructor.
|
||||||
|
*
|
||||||
|
* @param stateManager abstraction used to manage the state.
|
||||||
|
*/
|
||||||
|
public StateKeeperRule(StateManager<T> stateManager) {
|
||||||
|
mStateManager = stateManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Statement apply(Statement base, Description description) {
|
||||||
|
return new Statement() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void evaluate() throws Throwable {
|
||||||
|
final T previousValue = mStateManager.get();
|
||||||
|
try {
|
||||||
|
base.evaluate();
|
||||||
|
} finally {
|
||||||
|
final T currentValue = mStateManager.get();
|
||||||
|
if (!Objects.equals(previousValue, currentValue)) {
|
||||||
|
mStateManager.set(previousValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2018 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package android.perftests.utils;
|
||||||
|
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Abstraction for a state that is managed somewhere, like Android Settings.
|
||||||
|
*/
|
||||||
|
public interface StateManager<T> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets a new state.
|
||||||
|
*/
|
||||||
|
void set(@Nullable T value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the current state.
|
||||||
|
*/
|
||||||
|
@Nullable T get();
|
||||||
|
}
|
||||||
@@ -2,6 +2,14 @@
|
|||||||
"presubmit": [
|
"presubmit": [
|
||||||
{
|
{
|
||||||
"name": "CtsCurrentApiSignatureTestCases"
|
"name": "CtsCurrentApiSignatureTestCases"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "CtsSystemApiSignatureTestCases"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"imports": [
|
||||||
|
{
|
||||||
|
"path": "vendor/xts/gts-tests/hostsidetests/api"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
6694
api/current.txt
Executable file → Normal file
6694
api/current.txt
Executable file → Normal file
File diff suppressed because it is too large
Load Diff
@@ -32,7 +32,7 @@ package android.app {
|
|||||||
method public int describeContents();
|
method public int describeContents();
|
||||||
method public void writeToParcel(android.os.Parcel, int);
|
method public void writeToParcel(android.os.Parcel, int);
|
||||||
field public static final int CONTENTS_FILE_DESCRIPTOR = 1; // 0x1
|
field public static final int CONTENTS_FILE_DESCRIPTOR = 1; // 0x1
|
||||||
field public static final android.os.Parcelable.Creator<android.app.PictureInPictureArgs> CREATOR;
|
field @NonNull public static final android.os.Parcelable.Creator<android.app.PictureInPictureArgs> CREATOR;
|
||||||
field public static final int PARCELABLE_WRITE_RETURN_VALUE = 1; // 0x1
|
field public static final int PARCELABLE_WRITE_RETURN_VALUE = 1; // 0x1
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -238,6 +238,11 @@ package android.graphics {
|
|||||||
method @Deprecated public android.graphics.Rasterizer setRasterizer(android.graphics.Rasterizer);
|
method @Deprecated public android.graphics.Rasterizer setRasterizer(android.graphics.Rasterizer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class Picture {
|
||||||
|
method @Deprecated public static android.graphics.Picture createFromStream(@NonNull java.io.InputStream);
|
||||||
|
method @Deprecated public void writeToStream(@NonNull java.io.OutputStream);
|
||||||
|
}
|
||||||
|
|
||||||
@Deprecated public class PixelXorXfermode extends android.graphics.Xfermode {
|
@Deprecated public class PixelXorXfermode extends android.graphics.Xfermode {
|
||||||
ctor public PixelXorXfermode(int);
|
ctor public PixelXorXfermode(int);
|
||||||
}
|
}
|
||||||
@@ -291,6 +296,11 @@ package android.location {
|
|||||||
method @Deprecated public void removeVerticalAccuracy();
|
method @Deprecated public void removeVerticalAccuracy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class LocationManager {
|
||||||
|
method @Deprecated @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public boolean addNmeaListener(android.location.GpsStatus.NmeaListener);
|
||||||
|
method @Deprecated public void removeNmeaListener(android.location.GpsStatus.NmeaListener);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
package android.media {
|
package android.media {
|
||||||
@@ -347,7 +357,7 @@ package android.os {
|
|||||||
public final class PowerManager {
|
public final class PowerManager {
|
||||||
method public void goToSleep(long);
|
method public void goToSleep(long);
|
||||||
method @Deprecated public void userActivity(long, boolean);
|
method @Deprecated public void userActivity(long, boolean);
|
||||||
method public void wakeUp(long);
|
method @Deprecated public void wakeUp(long);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class RecoverySystem {
|
public class RecoverySystem {
|
||||||
@@ -355,11 +365,11 @@ package android.os {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static final class StrictMode.ThreadPolicy.Builder {
|
public static final class StrictMode.ThreadPolicy.Builder {
|
||||||
method public android.os.StrictMode.ThreadPolicy.Builder penaltyListener(@NonNull android.os.StrictMode.OnThreadViolationListener, @NonNull java.util.concurrent.Executor);
|
method @NonNull public android.os.StrictMode.ThreadPolicy.Builder penaltyListener(@NonNull android.os.StrictMode.OnThreadViolationListener, @NonNull java.util.concurrent.Executor);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final class StrictMode.VmPolicy.Builder {
|
public static final class StrictMode.VmPolicy.Builder {
|
||||||
method public android.os.StrictMode.VmPolicy.Builder penaltyListener(@NonNull android.os.StrictMode.OnVmViolationListener, @NonNull java.util.concurrent.Executor);
|
method @NonNull public android.os.StrictMode.VmPolicy.Builder penaltyListener(@NonNull android.os.StrictMode.OnVmViolationListener, @NonNull java.util.concurrent.Executor);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final class SystemClock {
|
public final class SystemClock {
|
||||||
@@ -510,6 +520,65 @@ package android.provider {
|
|||||||
field @Deprecated public static final String TIMESTAMP = "timestamp";
|
field @Deprecated public static final String TIMESTAMP = "timestamp";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public final class MediaStore {
|
||||||
|
method @Deprecated @NonNull public static android.net.Uri createPending(@NonNull android.content.Context, @NonNull android.provider.MediaStore.PendingParams);
|
||||||
|
method @Deprecated @NonNull public static java.util.Set<java.lang.String> getAllVolumeNames(@NonNull android.content.Context);
|
||||||
|
method @Deprecated @NonNull public static android.provider.MediaStore.PendingSession openPending(@NonNull android.content.Context, @NonNull android.net.Uri);
|
||||||
|
method @Deprecated @NonNull public static android.net.Uri setIncludeTrashed(@NonNull android.net.Uri);
|
||||||
|
method @Deprecated public static void trash(@NonNull android.content.Context, @NonNull android.net.Uri);
|
||||||
|
method @Deprecated public static void trash(@NonNull android.content.Context, @NonNull android.net.Uri, long);
|
||||||
|
method @Deprecated public static void untrash(@NonNull android.content.Context, @NonNull android.net.Uri);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static interface MediaStore.Audio.AudioColumns extends android.provider.MediaStore.MediaColumns {
|
||||||
|
field public static final String DURATION = "duration";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static interface MediaStore.DownloadColumns extends android.provider.MediaStore.MediaColumns {
|
||||||
|
field @Deprecated public static final String DESCRIPTION = "description";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static interface MediaStore.Images.ImageColumns extends android.provider.MediaStore.MediaColumns {
|
||||||
|
field public static final String BUCKET_DISPLAY_NAME = "bucket_display_name";
|
||||||
|
field public static final String BUCKET_ID = "bucket_id";
|
||||||
|
field public static final String DATE_TAKEN = "datetaken";
|
||||||
|
field public static final String GROUP_ID = "group_id";
|
||||||
|
field public static final String ORIENTATION = "orientation";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static interface MediaStore.MediaColumns extends android.provider.BaseColumns {
|
||||||
|
field @Deprecated public static final String GROUP_ID = "group_id";
|
||||||
|
field @Deprecated public static final String HASH = "_hash";
|
||||||
|
field @Deprecated public static final String IS_TRASHED = "is_trashed";
|
||||||
|
field @Deprecated public static final String PRIMARY_DIRECTORY = "primary_directory";
|
||||||
|
field @Deprecated public static final String SECONDARY_DIRECTORY = "secondary_directory";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated public static class MediaStore.PendingParams {
|
||||||
|
ctor public MediaStore.PendingParams(@NonNull android.net.Uri, @NonNull String, @NonNull String);
|
||||||
|
method public void setDownloadUri(@Nullable android.net.Uri);
|
||||||
|
method public void setPrimaryDirectory(@Nullable String);
|
||||||
|
method public void setRefererUri(@Nullable android.net.Uri);
|
||||||
|
method public void setSecondaryDirectory(@Nullable String);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated public static class MediaStore.PendingSession implements java.lang.AutoCloseable {
|
||||||
|
method public void abandon();
|
||||||
|
method public void close();
|
||||||
|
method public void notifyProgress(@IntRange(from=0, to=100) int);
|
||||||
|
method @NonNull public android.os.ParcelFileDescriptor open() throws java.io.FileNotFoundException;
|
||||||
|
method @NonNull public java.io.OutputStream openOutputStream() throws java.io.FileNotFoundException;
|
||||||
|
method @NonNull public android.net.Uri publish();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static interface MediaStore.Video.VideoColumns extends android.provider.MediaStore.MediaColumns {
|
||||||
|
field public static final String BUCKET_DISPLAY_NAME = "bucket_display_name";
|
||||||
|
field public static final String BUCKET_ID = "bucket_id";
|
||||||
|
field public static final String DATE_TAKEN = "datetaken";
|
||||||
|
field public static final String DURATION = "duration";
|
||||||
|
field public static final String GROUP_ID = "group_id";
|
||||||
|
}
|
||||||
|
|
||||||
public static final class Settings.Global extends android.provider.Settings.NameValueTable {
|
public static final class Settings.Global extends android.provider.Settings.NameValueTable {
|
||||||
field @Deprecated public static final String CONTACT_METADATA_SYNC = "contact_metadata_sync";
|
field @Deprecated public static final String CONTACT_METADATA_SYNC = "contact_metadata_sync";
|
||||||
}
|
}
|
||||||
@@ -630,6 +699,13 @@ package android.widget {
|
|||||||
method protected <T extends android.view.View> T findViewWithTagTraversal(Object);
|
method protected <T extends android.view.View> T findViewWithTagTraversal(Object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class PopupWindow {
|
||||||
|
method @Deprecated public boolean isClipToScreenEnabled();
|
||||||
|
method @Deprecated public boolean isLayoutInScreenEnabled();
|
||||||
|
method @Deprecated public void setClipToScreenEnabled(boolean);
|
||||||
|
method @Deprecated public void setLayoutInScreenEnabled(boolean);
|
||||||
|
}
|
||||||
|
|
||||||
@android.widget.RemoteViews.RemoteView public class TextView extends android.view.View implements android.view.ViewTreeObserver.OnPreDrawListener {
|
@android.widget.RemoteViews.RemoteView public class TextView extends android.view.View implements android.view.ViewTreeObserver.OnPreDrawListener {
|
||||||
method public static int getTextColor(android.content.Context, android.content.res.TypedArray, int);
|
method public static int getTextColor(android.content.Context, android.content.res.TypedArray, int);
|
||||||
method public static android.content.res.ColorStateList getTextColors(android.content.Context, android.content.res.TypedArray);
|
method public static android.content.res.ColorStateList getTextColors(android.content.Context, android.content.res.TypedArray);
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,18 @@
|
|||||||
// Signature format: 2.0
|
// Signature format: 2.0
|
||||||
|
package android {
|
||||||
|
|
||||||
|
public static final class Manifest.permission {
|
||||||
|
field public static final String MANAGE_DEVICE_ADMINS = "android.permission.MANAGE_DEVICE_ADMINS";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
package android.app {
|
package android.app {
|
||||||
|
|
||||||
|
public class AppOpsManager {
|
||||||
|
method @Deprecated @NonNull @RequiresPermission(android.Manifest.permission.GET_APP_OPS_STATS) public java.util.List<android.app.AppOpsManager.PackageOps> getOpsForPackage(int, @NonNull String, @Nullable int[]);
|
||||||
|
}
|
||||||
|
|
||||||
public class Notification implements android.os.Parcelable {
|
public class Notification implements android.os.Parcelable {
|
||||||
method public static Class<? extends android.app.Notification.Style> getNotificationStyleClass(String);
|
method public static Class<? extends android.app.Notification.Style> getNotificationStyleClass(String);
|
||||||
}
|
}
|
||||||
@@ -20,6 +32,25 @@ package android.app.admin {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
package android.app.backup {
|
||||||
|
|
||||||
|
public class RestoreSession {
|
||||||
|
method @Deprecated public int restoreSome(long, android.app.backup.RestoreObserver, android.app.backup.BackupManagerMonitor, String[]);
|
||||||
|
method @Deprecated public int restoreSome(long, android.app.backup.RestoreObserver, String[]);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
package android.app.prediction {
|
||||||
|
|
||||||
|
public static final class AppTarget.Builder {
|
||||||
|
ctor @Deprecated public AppTarget.Builder(@NonNull android.app.prediction.AppTargetId);
|
||||||
|
method @Deprecated @NonNull public android.app.prediction.AppTarget.Builder setTarget(@NonNull String, @NonNull android.os.UserHandle);
|
||||||
|
method @Deprecated @NonNull public android.app.prediction.AppTarget.Builder setTarget(@NonNull android.content.pm.ShortcutInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
package android.content {
|
package android.content {
|
||||||
|
|
||||||
public class Intent implements java.lang.Cloneable android.os.Parcelable {
|
public class Intent implements java.lang.Cloneable android.os.Parcelable {
|
||||||
@@ -52,6 +83,41 @@ package android.content {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
package android.content.pm {
|
||||||
|
|
||||||
|
public class PackageItemInfo {
|
||||||
|
field @Deprecated public static final int SAFE_LABEL_FLAG_FIRST_LINE = 4; // 0x4
|
||||||
|
field @Deprecated public static final int SAFE_LABEL_FLAG_SINGLE_LINE = 2; // 0x2
|
||||||
|
field @Deprecated public static final int SAFE_LABEL_FLAG_TRIM = 1; // 0x1
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
package android.hardware.hdmi {
|
||||||
|
|
||||||
|
public final class HdmiControlManager {
|
||||||
|
method @Deprecated public java.util.List<android.hardware.hdmi.HdmiDeviceInfo> getConnectedDevicesList();
|
||||||
|
method @Deprecated public boolean isRemoteDeviceConnected(@NonNull android.hardware.hdmi.HdmiDeviceInfo);
|
||||||
|
method @Deprecated public void powerOffRemoteDevice(@NonNull android.hardware.hdmi.HdmiDeviceInfo);
|
||||||
|
method @Deprecated public void powerOnRemoteDevice(android.hardware.hdmi.HdmiDeviceInfo);
|
||||||
|
method @Deprecated public void requestRemoteDeviceToBecomeActiveSource(@NonNull android.hardware.hdmi.HdmiDeviceInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
package android.location {
|
||||||
|
|
||||||
|
public class LocationManager {
|
||||||
|
method @Deprecated public boolean addGpsMeasurementListener(android.location.GpsMeasurementsEvent.Listener);
|
||||||
|
method @Deprecated public boolean addGpsNavigationMessageListener(android.location.GpsNavigationMessageEvent.Listener);
|
||||||
|
method @Deprecated public void removeGpsMeasurementListener(android.location.GpsMeasurementsEvent.Listener);
|
||||||
|
method @Deprecated public void removeGpsNavigationMessageListener(android.location.GpsNavigationMessageEvent.Listener);
|
||||||
|
method @Deprecated @RequiresPermission(android.Manifest.permission.LOCATION_HARDWARE) public void setLocationControllerExtraPackage(String);
|
||||||
|
method @Deprecated @RequiresPermission(android.Manifest.permission.LOCATION_HARDWARE) public void setLocationControllerExtraPackageEnabled(boolean);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
package android.media.tv {
|
package android.media.tv {
|
||||||
|
|
||||||
public final class TvInputManager {
|
public final class TvInputManager {
|
||||||
@@ -82,7 +148,7 @@ package android.net.wifi {
|
|||||||
package android.os {
|
package android.os {
|
||||||
|
|
||||||
public class Build {
|
public class Build {
|
||||||
field public static final boolean PERMISSIONS_REVIEW_REQUIRED;
|
field public static final boolean PERMISSIONS_REVIEW_REQUIRED = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final class PowerManager {
|
public final class PowerManager {
|
||||||
@@ -92,34 +158,15 @@ package android.os {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
package android.security.keystore.recovery {
|
package android.provider {
|
||||||
|
|
||||||
public final class KeyChainSnapshot implements android.os.Parcelable {
|
public final class DeviceConfig {
|
||||||
method @Deprecated @NonNull public byte[] getTrustedHardwarePublicKey();
|
method @RequiresPermission(android.Manifest.permission.READ_DEVICE_CONFIG) public static void addOnPropertyChangedListener(@NonNull String, @NonNull java.util.concurrent.Executor, @NonNull android.provider.DeviceConfig.OnPropertyChangedListener);
|
||||||
|
method public static void removeOnPropertyChangedListener(@NonNull android.provider.DeviceConfig.OnPropertyChangedListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class RecoveryController {
|
public static interface DeviceConfig.OnPropertyChangedListener {
|
||||||
method @Deprecated @RequiresPermission(android.Manifest.permission.RECOVER_KEYSTORE) public byte[] generateAndStoreKey(@NonNull String, byte[]) throws android.security.keystore.recovery.InternalRecoveryServiceException, android.security.keystore.recovery.LockScreenRequiredException;
|
method public void onPropertyChanged(@NonNull String, @NonNull String, @Nullable String);
|
||||||
method @Deprecated @RequiresPermission(android.Manifest.permission.RECOVER_KEYSTORE) public java.security.Key generateKey(@NonNull String, byte[]) throws android.security.keystore.recovery.InternalRecoveryServiceException, android.security.keystore.recovery.LockScreenRequiredException;
|
|
||||||
method @Deprecated @RequiresPermission(android.Manifest.permission.RECOVER_KEYSTORE) public java.util.List<java.lang.String> getAliases(@Nullable String) throws android.security.keystore.recovery.InternalRecoveryServiceException;
|
|
||||||
method @Deprecated @Nullable @RequiresPermission(android.Manifest.permission.RECOVER_KEYSTORE) public android.security.keystore.recovery.KeyChainSnapshot getRecoveryData() throws android.security.keystore.recovery.InternalRecoveryServiceException;
|
|
||||||
method @Deprecated @RequiresPermission(android.Manifest.permission.RECOVER_KEYSTORE) public int getRecoveryStatus(String, String) throws android.security.keystore.recovery.InternalRecoveryServiceException;
|
|
||||||
method @Deprecated @RequiresPermission(android.Manifest.permission.RECOVER_KEYSTORE) public void initRecoveryService(@NonNull String, @NonNull byte[]) throws java.security.cert.CertificateException, android.security.keystore.recovery.InternalRecoveryServiceException;
|
|
||||||
method @Deprecated @RequiresPermission(android.Manifest.permission.RECOVER_KEYSTORE) public void setRecoveryStatus(@NonNull String, String, int) throws android.security.keystore.recovery.InternalRecoveryServiceException, android.content.pm.PackageManager.NameNotFoundException;
|
|
||||||
}
|
|
||||||
|
|
||||||
public class RecoverySession implements java.lang.AutoCloseable {
|
|
||||||
method @Deprecated @RequiresPermission(android.Manifest.permission.RECOVER_KEYSTORE) public java.util.Map<java.lang.String,byte[]> recoverKeys(@NonNull byte[], @NonNull java.util.List<android.security.keystore.recovery.WrappedApplicationKey>) throws android.security.keystore.recovery.DecryptionFailedException, android.security.keystore.recovery.InternalRecoveryServiceException, android.security.keystore.recovery.SessionExpiredException;
|
|
||||||
method @Deprecated @NonNull @RequiresPermission(android.Manifest.permission.RECOVER_KEYSTORE) public byte[] start(@NonNull byte[], @NonNull byte[], @NonNull byte[], @NonNull java.util.List<android.security.keystore.recovery.KeyChainProtectionParams>) throws java.security.cert.CertificateException, android.security.keystore.recovery.InternalRecoveryServiceException;
|
|
||||||
method @Deprecated @NonNull @RequiresPermission(android.Manifest.permission.RECOVER_KEYSTORE) public byte[] start(@NonNull java.security.cert.CertPath, @NonNull byte[], @NonNull byte[], @NonNull java.util.List<android.security.keystore.recovery.KeyChainProtectionParams>) throws java.security.cert.CertificateException, android.security.keystore.recovery.InternalRecoveryServiceException;
|
|
||||||
}
|
|
||||||
|
|
||||||
public final class WrappedApplicationKey implements android.os.Parcelable {
|
|
||||||
method @Deprecated @NonNull public byte[] getAccount();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class WrappedApplicationKey.Builder {
|
|
||||||
method @Deprecated public android.security.keystore.recovery.WrappedApplicationKey.Builder setAccount(@NonNull byte[]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -144,6 +191,14 @@ package android.service.notification {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
package android.telecom {
|
||||||
|
|
||||||
|
public class TelecomManager {
|
||||||
|
method @Deprecated @RequiresPermission(allOf={android.Manifest.permission.MODIFY_PHONE_STATE, android.Manifest.permission.WRITE_SECURE_SETTINGS}) public boolean setDefaultDialer(@Nullable String);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
package android.telephony {
|
package android.telephony {
|
||||||
|
|
||||||
public class TelephonyManager {
|
public class TelephonyManager {
|
||||||
|
|||||||
1828
api/test-current.txt
1828
api/test-current.txt
File diff suppressed because it is too large
Load Diff
@@ -1 +1,23 @@
|
|||||||
// Signature format: 2.0
|
// Signature format: 2.0
|
||||||
|
package android.app.prediction {
|
||||||
|
|
||||||
|
public static final class AppTarget.Builder {
|
||||||
|
method @Deprecated @NonNull public android.app.prediction.AppTarget.Builder setTarget(@NonNull String, @NonNull android.os.UserHandle);
|
||||||
|
method @Deprecated @NonNull public android.app.prediction.AppTarget.Builder setTarget(@NonNull android.content.pm.ShortcutInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
package android.provider {
|
||||||
|
|
||||||
|
public final class DeviceConfig {
|
||||||
|
method @RequiresPermission("android.permission.READ_DEVICE_CONFIG") public static void addOnPropertyChangedListener(@NonNull String, @NonNull java.util.concurrent.Executor, @NonNull android.provider.DeviceConfig.OnPropertyChangedListener);
|
||||||
|
method public static void removeOnPropertyChangedListener(@NonNull android.provider.DeviceConfig.OnPropertyChangedListener);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static interface DeviceConfig.OnPropertyChangedListener {
|
||||||
|
method public void onPropertyChanged(@NonNull String, @NonNull String, @Nullable String);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ message ResultsBundle {
|
|||||||
message TestStatus {
|
message TestStatus {
|
||||||
optional sint32 result_code = 3;
|
optional sint32 result_code = 3;
|
||||||
optional ResultsBundle results = 4;
|
optional ResultsBundle results = 4;
|
||||||
|
optional string logcat = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum SessionStatusCode {
|
enum SessionStatusCode {
|
||||||
|
|||||||
@@ -175,7 +175,7 @@ public class Am extends BaseCommand {
|
|||||||
} else if (opt.equals("--no-hidden-api-checks")) {
|
} else if (opt.equals("--no-hidden-api-checks")) {
|
||||||
instrument.disableHiddenApiChecks = true;
|
instrument.disableHiddenApiChecks = true;
|
||||||
} else if (opt.equals("--no-isolated-storage")) {
|
} else if (opt.equals("--no-isolated-storage")) {
|
||||||
// NOTE: currently a no-op in this branch
|
instrument.disableIsolatedStorage = true;
|
||||||
} else if (opt.equals("--user")) {
|
} else if (opt.equals("--user")) {
|
||||||
instrument.userId = parseUserArg(nextArgRequired());
|
instrument.userId = parseUserArg(nextArgRequired());
|
||||||
} else if (opt.equals("--abi")) {
|
} else if (opt.equals("--abi")) {
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user